var nWe=Object.defineProperty;var D2e=e=>{throw TypeError(e)};var sWe=(e,t,n)=>t in e?nWe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Gn=(e,t,n)=>sWe(e,typeof t!="symbol"?t+"":t,n),Hoe=(e,t,n)=>t.has(e)||D2e("Cannot "+n);var Jt=(e,t,n)=>(Hoe(e,t,"read from private field"),n?n.call(e):t.get(e)),li=(e,t,n)=>t.has(e)?D2e("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),us=(e,t,n,s)=>(Hoe(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),ia=(e,t,n)=>(Hoe(e,t,"access private method"),n);var B6=(e,t,n,s)=>({set _(i){us(e,t,i,n)},get _(){return Jt(e,t,s)}});function iWe(e,t){for(var n=0;ns[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Ix=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function za(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function V5e(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}),n}var H5e={exports:{}},fne={},W5e={exports:{}},Ma={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var iI=Symbol.for("react.element"),aWe=Symbol.for("react.portal"),oWe=Symbol.for("react.fragment"),lWe=Symbol.for("react.strict_mode"),cWe=Symbol.for("react.profiler"),dWe=Symbol.for("react.provider"),uWe=Symbol.for("react.context"),hWe=Symbol.for("react.forward_ref"),fWe=Symbol.for("react.suspense"),pWe=Symbol.for("react.memo"),mWe=Symbol.for("react.lazy"),R2e=Symbol.iterator;function gWe(e){return e===null||typeof e!="object"?null:(e=R2e&&e[R2e]||e["@@iterator"],typeof e=="function"?e:null)}var G5e={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},K5e=Object.assign,Z5e={};function GC(e,t,n){this.props=e,this.context=t,this.refs=Z5e,this.updater=n||G5e}GC.prototype.isReactComponent={};GC.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};GC.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Y5e(){}Y5e.prototype=GC.prototype;function Wpe(e,t,n){this.props=e,this.context=t,this.refs=Z5e,this.updater=n||G5e}var Gpe=Wpe.prototype=new Y5e;Gpe.constructor=Wpe;K5e(Gpe,GC.prototype);Gpe.isPureReactComponent=!0;var F2e=Array.isArray,X5e=Object.prototype.hasOwnProperty,Kpe={current:null},Q5e={key:!0,ref:!0,__self:!0,__source:!0};function J5e(e,t,n){var s,i={},o=null,l=null;if(t!=null)for(s in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(o=""+t.key),t)X5e.call(t,s)&&!Q5e.hasOwnProperty(s)&&(i[s]=t[s]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,we=de[Ne];if(0>>1;Nei(be,Ie))Oei(Te,be)?(de[Ne]=Te,de[Oe]=Ie,Ne=Oe):(de[Ne]=be,de[xe]=Ie,Ne=xe);else if(Oei(Te,Ie))de[Ne]=Te,de[Oe]=Ie,Ne=Oe;else break e}}return ye}function i(de,ye){var Ie=de.sortIndex-ye.sortIndex;return Ie!==0?Ie:de.id-ye.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,a=l.now();e.unstable_now=function(){return l.now()-a}}var h=[],p=[],x=1,y=null,b=3,j=!1,N=!1,C=!1,A=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function L(de){for(var ye=n(p);ye!==null;){if(ye.callback===null)s(p);else if(ye.startTime<=de)s(p),ye.sortIndex=ye.expirationTime,t(h,ye);else break;ye=n(p)}}function z(de){if(C=!1,L(de),!N)if(n(h)!==null)N=!0,ie(F);else{var ye=n(p);ye!==null&&fe(z,ye.startTime-de)}}function F(de,ye){N=!1,C&&(C=!1,E(K),K=-1),j=!0;var Ie=b;try{for(L(ye),y=n(h);y!==null&&(!(y.expirationTime>ye)||de&&!ae());){var Ne=y.callback;if(typeof Ne=="function"){y.callback=null,b=y.priorityLevel;var we=Ne(y.expirationTime<=ye);ye=e.unstable_now(),typeof we=="function"?y.callback=we:y===n(h)&&s(h),L(ye)}else s(h);y=n(h)}if(y!==null)var he=!0;else{var xe=n(p);xe!==null&&fe(z,xe.startTime-ye),he=!1}return he}finally{y=null,b=Ie,j=!1}}var q=!1,H=null,K=-1,Z=5,te=-1;function ae(){return!(e.unstable_now()-tede||125Ne?(de.sortIndex=Ie,t(p,de),n(h)===null&&de===n(p)&&(C?(E(K),K=-1):C=!0,fe(z,Ie-Ne))):(de.sortIndex=we,t(h,de),N||j||(N=!0,ie(F))),de},e.unstable_shouldYield=ae,e.unstable_wrapCallback=function(de){var ye=b;return function(){var Ie=b;b=ye;try{return de.apply(this,arguments)}finally{b=Ie}}}})(sMe);nMe.exports=sMe;var CWe=nMe.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var MWe=I,nf=CWe;function Mn(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yde=Object.prototype.hasOwnProperty,TWe=/^[: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]*$/,B2e={},$2e={};function AWe(e){return yde.call($2e,e)?!0:yde.call(B2e,e)?!1:TWe.test(e)?$2e[e]=!0:(B2e[e]=!0,!1)}function EWe(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function IWe(e,t,n,s){if(t===null||typeof t>"u"||EWe(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function $u(e,t,n,s,i,o,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=l}var Dd={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Dd[e]=new $u(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Dd[t]=new $u(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Dd[e]=new $u(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Dd[e]=new $u(e,2,!1,e,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(e){Dd[e]=new $u(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Dd[e]=new $u(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Dd[e]=new $u(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Dd[e]=new $u(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Dd[e]=new $u(e,5,!1,e.toLowerCase(),null,!1,!1)});var Xpe=/[\-:]([a-z])/g;function Qpe(e){return e[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(e){var t=e.replace(Xpe,Qpe);Dd[t]=new $u(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Xpe,Qpe);Dd[t]=new $u(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Xpe,Qpe);Dd[t]=new $u(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Dd[e]=new $u(e,1,!1,e.toLowerCase(),null,!1,!1)});Dd.xlinkHref=new $u("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Dd[e]=new $u(e,1,!1,e.toLowerCase(),null,!0,!0)});function Jpe(e,t,n,s){var i=Dd.hasOwnProperty(t)?Dd[t]:null;(i!==null?i.type!==0:s||!(2a||i[l]!==o[a]){var h=` `+i[l].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=l&&0<=a);break}}}finally{Koe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?sT(e):""}function PWe(e){switch(e.tag){case 5:return sT(e.type);case 16:return sT("Lazy");case 13:return sT("Suspense");case 19:return sT("SuspenseList");case 0:case 2:case 15:return e=Zoe(e.type,!1),e;case 11:return e=Zoe(e.type.render,!1),e;case 1:return e=Zoe(e.type,!0),e;default:return""}}function wde(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N4:return"Fragment";case k4:return"Portal";case vde:return"Profiler";case eme:return"StrictMode";case _de:return"Suspense";case bde:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case oMe:return(e.displayName||"Context")+".Consumer";case aMe:return(e._context.displayName||"Context")+".Provider";case tme:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case rme:return t=e.displayName||null,t!==null?t:wde(e.type)||"Memo";case h0:t=e._payload,e=e._init;try{return wde(e(t))}catch{}}return null}function LWe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wde(t);case 8:return t===eme?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function L1(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function cMe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function OWe(e){var t=cMe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(l){s=""+l,o.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(l){s=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function q6(e){e._valueTracker||(e._valueTracker=OWe(e))}function dMe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=cMe(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function vee(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function jde(e,t){var n=t.checked;return Rl({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function q2e(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=L1(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function uMe(e,t){t=t.checked,t!=null&&Jpe(e,"checked",t,!1)}function kde(e,t){uMe(e,t);var n=L1(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Nde(e,t.type,n):t.hasOwnProperty("defaultValue")&&Nde(e,t.type,L1(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function V2e(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Nde(e,t,n){(t!=="number"||vee(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var iT=Array.isArray;function V4(e,t,n,s){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=V6.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function TA(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var yT={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},DWe=["Webkit","ms","Moz","O"];Object.keys(yT).forEach(function(e){DWe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),yT[t]=yT[e]})});function mMe(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||yT.hasOwnProperty(e)&&yT[e]?(""+t).trim():t+"px"}function gMe(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,i=mMe(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,i):e[n]=i}}var RWe=Rl({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 Mde(e,t){if(t){if(RWe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Mn(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Mn(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Mn(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Mn(62))}}function Tde(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Ade=null;function nme(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ede=null,H4=null,W4=null;function G2e(e){if(e=lI(e)){if(typeof Ede!="function")throw Error(Mn(280));var t=e.stateNode;t&&(t=yne(t),Ede(e.stateNode,e.type,t))}}function xMe(e){H4?W4?W4.push(e):W4=[e]:H4=e}function yMe(){if(H4){var e=H4,t=W4;if(W4=H4=null,G2e(e),t)for(e=0;e>>=0,e===0?32:31-(KWe(e)/ZWe|0)|0}var H6=64,W6=4194304;function aT(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function jee(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,i=e.suspendedLanes,o=e.pingedLanes,l=n&268435455;if(l!==0){var a=l&~i;a!==0?s=aT(a):(o&=l,o!==0&&(s=aT(o)))}else l=n&~i,l!==0?s=aT(l):o!==0&&(s=aT(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&i)&&(i=s&-s,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0n;n++)t.push(e);return t}function aI(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-cm(t),e[t]=n}function JWe(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=_T),rbe=" ",nbe=!1;function FMe(e,t){switch(e){case"keyup":return CGe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zMe(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var S4=!1;function TGe(e,t){switch(e){case"compositionend":return zMe(t);case"keypress":return t.which!==32?null:(nbe=!0,rbe);case"textInput":return e=t.data,e===rbe&&nbe?null:e;default:return null}}function AGe(e,t){if(S4)return e==="compositionend"||!ume&&FMe(e,t)?(e=DMe(),o8=lme=$0=null,S4=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=obe(n)}}function qMe(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qMe(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function VMe(){for(var e=window,t=vee();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=vee(e.document)}return t}function hme(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function zGe(e){var t=VMe(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&qMe(n.ownerDocument.documentElement,n)){if(s!==null&&hme(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(s.start,i);s=s.end===void 0?o:Math.min(s.end,i),!e.extend&&o>s&&(i=s,s=o,o=i),i=lbe(n,o);var l=lbe(n,s);i&&l&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>s?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,C4=null,Rde=null,wT=null,Fde=!1;function cbe(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fde||C4==null||C4!==vee(s)||(s=C4,"selectionStart"in s&&hme(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),wT&&OA(wT,s)||(wT=s,s=See(Rde,"onSelect"),0A4||(e.current=Vde[A4],Vde[A4]=null,A4--)}function Yo(e,t){A4++,Vde[A4]=e.current,e.current=t}var O1={},ru=Q1(O1),mh=Q1(!1),Aj=O1;function XS(e,t){var n=e.type.contextTypes;if(!n)return O1;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function gh(e){return e=e.childContextTypes,e!=null}function Mee(){fl(mh),fl(ru)}function gbe(e,t,n){if(ru.current!==O1)throw Error(Mn(168));Yo(ru,t),Yo(mh,n)}function JMe(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var i in s)if(!(i in t))throw Error(Mn(108,LWe(e)||"Unknown",i));return Rl({},n,s)}function Tee(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||O1,Aj=ru.current,Yo(ru,e),Yo(mh,mh.current),!0}function xbe(e,t,n){var s=e.stateNode;if(!s)throw Error(Mn(169));n?(e=JMe(e,t,Aj),s.__reactInternalMemoizedMergedChildContext=e,fl(mh),fl(ru),Yo(ru,e)):fl(mh),Yo(mh,n)}var Sx=null,vne=!1,cle=!1;function eTe(e){Sx===null?Sx=[e]:Sx.push(e)}function XGe(e){vne=!0,eTe(e)}function J1(){if(!cle&&Sx!==null){cle=!0;var e=0,t=No;try{var n=Sx;for(No=1;e>=l,i-=l,Px=1<<32-cm(t)+i|n<K?(Z=H,H=null):Z=H.sibling;var te=b(E,H,L[K],z);if(te===null){H===null&&(H=Z);break}e&&H&&te.alternate===null&&t(E,H),T=o(te,T,K),q===null?F=te:q.sibling=te,q=te,H=Z}if(K===L.length)return n(E,H),jl&&h_(E,K),F;if(H===null){for(;KK?(Z=H,H=null):Z=H.sibling;var ae=b(E,H,te.value,z);if(ae===null){H===null&&(H=Z);break}e&&H&&ae.alternate===null&&t(E,H),T=o(ae,T,K),q===null?F=ae:q.sibling=ae,q=ae,H=Z}if(te.done)return n(E,H),jl&&h_(E,K),F;if(H===null){for(;!te.done;K++,te=L.next())te=y(E,te.value,z),te!==null&&(T=o(te,T,K),q===null?F=te:q.sibling=te,q=te);return jl&&h_(E,K),F}for(H=s(E,H);!te.done;K++,te=L.next())te=j(H,E,K,te.value,z),te!==null&&(e&&te.alternate!==null&&H.delete(te.key===null?K:te.key),T=o(te,T,K),q===null?F=te:q.sibling=te,q=te);return e&&H.forEach(function(le){return t(E,le)}),jl&&h_(E,K),F}function A(E,T,L,z){if(typeof L=="object"&&L!==null&&L.type===N4&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case U6:e:{for(var F=L.key,q=T;q!==null;){if(q.key===F){if(F=L.type,F===N4){if(q.tag===7){n(E,q.sibling),T=i(q,L.props.children),T.return=E,E=T;break e}}else if(q.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===h0&&_be(F)===q.type){n(E,q.sibling),T=i(q,L.props),T.ref=TM(E,q,L),T.return=E,E=T;break e}n(E,q);break}else t(E,q);q=q.sibling}L.type===N4?(T=lj(L.props.children,E.mode,z,L.key),T.return=E,E=T):(z=m8(L.type,L.key,L.props,null,E.mode,z),z.ref=TM(E,T,L),z.return=E,E=z)}return l(E);case k4:e:{for(q=L.key;T!==null;){if(T.key===q)if(T.tag===4&&T.stateNode.containerInfo===L.containerInfo&&T.stateNode.implementation===L.implementation){n(E,T.sibling),T=i(T,L.children||[]),T.return=E,E=T;break e}else{n(E,T);break}else t(E,T);T=T.sibling}T=xle(L,E.mode,z),T.return=E,E=T}return l(E);case h0:return q=L._init,A(E,T,q(L._payload),z)}if(iT(L))return N(E,T,L,z);if(kM(L))return C(E,T,L,z);J6(E,L)}return typeof L=="string"&&L!==""||typeof L=="number"?(L=""+L,T!==null&&T.tag===6?(n(E,T.sibling),T=i(T,L),T.return=E,E=T):(n(E,T),T=gle(L,E.mode,z),T.return=E,E=T),l(E)):n(E,T)}return A}var JS=sTe(!0),iTe=sTe(!1),Iee=Q1(null),Pee=null,P4=null,gme=null;function xme(){gme=P4=Pee=null}function yme(e){var t=Iee.current;fl(Iee),e._currentValue=t}function Gde(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function K4(e,t){Pee=e,gme=P4=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(uh=!0),e.firstContext=null)}function ep(e){var t=e._currentValue;if(gme!==e)if(e={context:e,memoizedValue:t,next:null},P4===null){if(Pee===null)throw Error(Mn(308));P4=e,Pee.dependencies={lanes:0,firstContext:e}}else P4=P4.next=e;return t}var Fw=null;function vme(e){Fw===null?Fw=[e]:Fw.push(e)}function aTe(e,t,n,s){var i=t.interleaved;return i===null?(n.next=n,vme(t)):(n.next=i.next,i.next=n),t.interleaved=n,ny(e,s)}function ny(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var f0=!1;function _me(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oTe(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Bx(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function t1(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,Xa&2){var i=s.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),s.pending=t,ny(e,n)}return i=s.interleaved,i===null?(t.next=t,vme(s)):(t.next=i.next,i.next=t),s.interleaved=t,ny(e,n)}function c8(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,ime(e,n)}}function bbe(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:s.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Lee(e,t,n,s){var i=e.updateQueue;f0=!1;var o=i.firstBaseUpdate,l=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var h=a,p=h.next;h.next=null,l===null?o=p:l.next=p,l=h;var x=e.alternate;x!==null&&(x=x.updateQueue,a=x.lastBaseUpdate,a!==l&&(a===null?x.firstBaseUpdate=p:a.next=p,x.lastBaseUpdate=h))}if(o!==null){var y=i.baseState;l=0,x=p=h=null,a=o;do{var b=a.lane,j=a.eventTime;if((s&b)===b){x!==null&&(x=x.next={eventTime:j,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var N=e,C=a;switch(b=t,j=n,C.tag){case 1:if(N=C.payload,typeof N=="function"){y=N.call(j,y,b);break e}y=N;break e;case 3:N.flags=N.flags&-65537|128;case 0:if(N=C.payload,b=typeof N=="function"?N.call(j,y,b):N,b==null)break e;y=Rl({},y,b);break e;case 2:f0=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,b=i.effects,b===null?i.effects=[a]:b.push(a))}else j={eventTime:j,lane:b,tag:a.tag,payload:a.payload,callback:a.callback,next:null},x===null?(p=x=j,h=y):x=x.next=j,l|=b;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;b=a,a=b.next,b.next=null,i.lastBaseUpdate=b,i.shared.pending=null}}while(!0);if(x===null&&(h=y),i.baseState=h,i.firstBaseUpdate=p,i.lastBaseUpdate=x,t=i.shared.interleaved,t!==null){i=t;do l|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);Pj|=l,e.lanes=l,e.memoizedState=y}}function wbe(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var s=ule.transition;ule.transition={};try{e(!1),t()}finally{No=n,ule.transition=s}}function kTe(){return tp().memoizedState}function tKe(e,t,n){var s=n1(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},NTe(e))STe(t,n);else if(n=aTe(e,t,n,s),n!==null){var i=Iu();dm(n,e,s,i),CTe(n,t,s)}}function rKe(e,t,n){var s=n1(e),i={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(NTe(e))STe(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,a=o(l,n);if(i.hasEagerState=!0,i.eagerState=a,bm(a,l)){var h=t.interleaved;h===null?(i.next=i,vme(t)):(i.next=h.next,h.next=i),t.interleaved=i;return}}catch{}finally{}n=aTe(e,t,i,s),n!==null&&(i=Iu(),dm(n,e,s,i),CTe(n,t,s))}}function NTe(e){var t=e.alternate;return e===Ll||t!==null&&t===Ll}function STe(e,t){jT=Dee=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function CTe(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,ime(e,n)}}var Ree={readContext:ep,useCallback:Vd,useContext:Vd,useEffect:Vd,useImperativeHandle:Vd,useInsertionEffect:Vd,useLayoutEffect:Vd,useMemo:Vd,useReducer:Vd,useRef:Vd,useState:Vd,useDebugValue:Vd,useDeferredValue:Vd,useTransition:Vd,useMutableSource:Vd,useSyncExternalStore:Vd,useId:Vd,unstable_isNewReconciler:!1},nKe={readContext:ep,useCallback:function(e,t){return eg().memoizedState=[e,t===void 0?null:t],e},useContext:ep,useEffect:kbe,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,u8(4194308,4,vTe.bind(null,t,e),n)},useLayoutEffect:function(e,t){return u8(4194308,4,e,t)},useInsertionEffect:function(e,t){return u8(4,2,e,t)},useMemo:function(e,t){var n=eg();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=eg();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=tKe.bind(null,Ll,e),[s.memoizedState,e]},useRef:function(e){var t=eg();return e={current:e},t.memoizedState=e},useState:jbe,useDebugValue:Mme,useDeferredValue:function(e){return eg().memoizedState=e},useTransition:function(){var e=jbe(!1),t=e[0];return e=eKe.bind(null,e[1]),eg().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=Ll,i=eg();if(jl){if(n===void 0)throw Error(Mn(407));n=n()}else{if(n=t(),dd===null)throw Error(Mn(349));Ij&30||uTe(s,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,kbe(fTe.bind(null,s,o,e),[e]),s.flags|=2048,qA(9,hTe.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=eg(),t=dd.identifierPrefix;if(jl){var n=Lx,s=Px;n=(s&~(1<<32-cm(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=$A++,0<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=l.createElement(n,{is:s.is}):(e=l.createElement(n),n==="select"&&(l=e,s.multiple?l.multiple=!0:s.size&&(l.size=s.size))):e=l.createElementNS(e,n),e[cg]=t,e[FA]=s,RTe(e,t,!1,!1),t.stateNode=e;e:{switch(l=Tde(n,s),n){case"dialog":cl("cancel",e),cl("close",e),i=s;break;case"iframe":case"object":case"embed":cl("load",e),i=s;break;case"video":case"audio":for(i=0;irC&&(t.flags|=128,s=!0,AM(o,!1),t.lanes=4194304)}else{if(!s)if(e=Oee(l),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),AM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!jl)return Hd(t),null}else 2*ic()-o.renderingStartTime>rC&&n!==1073741824&&(t.flags|=128,s=!0,AM(o,!1),t.lanes=4194304);o.isBackwards?(l.sibling=t.child,t.child=l):(n=o.last,n!==null?n.sibling=l:t.child=l,o.last=l)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=ic(),t.sibling=null,n=Al.current,Yo(Al,s?n&1|2:n&1),t):(Hd(t),null);case 22:case 23:return Lme(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?Rh&1073741824&&(Hd(t),t.subtreeFlags&6&&(t.flags|=8192)):Hd(t),null;case 24:return null;case 25:return null}throw Error(Mn(156,t.tag))}function uKe(e,t){switch(pme(t),t.tag){case 1:return gh(t.type)&&Mee(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return eC(),fl(mh),fl(ru),jme(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return wme(t),null;case 13:if(fl(Al),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Mn(340));QS()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return fl(Al),null;case 4:return eC(),null;case 10:return yme(t.type._context),null;case 22:case 23:return Lme(),null;case 24:return null;default:return null}}var tL=!1,Zd=!1,hKe=typeof WeakSet=="function"?WeakSet:Set,ys=null;function L4(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){ql(e,t,s)}else n.current=null}function rue(e,t,n){try{n()}catch(s){ql(e,t,s)}}var Obe=!1;function fKe(e,t){if(zde=kee,e=VMe(),hme(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var i=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,a=-1,h=-1,p=0,x=0,y=e,b=null;t:for(;;){for(var j;y!==n||i!==0&&y.nodeType!==3||(a=l+i),y!==o||s!==0&&y.nodeType!==3||(h=l+s),y.nodeType===3&&(l+=y.nodeValue.length),(j=y.firstChild)!==null;)b=y,y=j;for(;;){if(y===e)break t;if(b===n&&++p===i&&(a=l),b===o&&++x===s&&(h=l),(j=y.nextSibling)!==null)break;y=b,b=y.parentNode}y=j}n=a===-1||h===-1?null:{start:a,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bde={focusedElem:e,selectionRange:n},kee=!1,ys=t;ys!==null;)if(t=ys,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ys=e;else for(;ys!==null;){t=ys;try{var N=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(N!==null){var C=N.memoizedProps,A=N.memoizedState,E=t.stateNode,T=E.getSnapshotBeforeUpdate(t.elementType===t.type?C:Wp(t.type,C),A);E.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var L=t.stateNode.containerInfo;L.nodeType===1?L.textContent="":L.nodeType===9&&L.documentElement&&L.removeChild(L.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Mn(163))}}catch(z){ql(t,t.return,z)}if(e=t.sibling,e!==null){e.return=t.return,ys=e;break}ys=t.return}return N=Obe,Obe=!1,N}function kT(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var i=s=s.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&rue(t,n,o)}i=i.next}while(i!==s)}}function wne(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function nue(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function BTe(e){var t=e.alternate;t!==null&&(e.alternate=null,BTe(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[cg],delete t[FA],delete t[qde],delete t[ZGe],delete t[YGe])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function $Te(e){return e.tag===5||e.tag===3||e.tag===4}function Dbe(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$Te(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function sue(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Cee));else if(s!==4&&(e=e.child,e!==null))for(sue(e,t,n),e=e.sibling;e!==null;)sue(e,t,n),e=e.sibling}function iue(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(iue(e,t,n),e=e.sibling;e!==null;)iue(e,t,n),e=e.sibling}var Md=null,Yp=!1;function r0(e,t,n){for(n=n.child;n!==null;)UTe(e,t,n),n=n.sibling}function UTe(e,t,n){if(gg&&typeof gg.onCommitFiberUnmount=="function")try{gg.onCommitFiberUnmount(pne,n)}catch{}switch(n.tag){case 5:Zd||L4(n,t);case 6:var s=Md,i=Yp;Md=null,r0(e,t,n),Md=s,Yp=i,Md!==null&&(Yp?(e=Md,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Md.removeChild(n.stateNode));break;case 18:Md!==null&&(Yp?(e=Md,n=n.stateNode,e.nodeType===8?lle(e.parentNode,n):e.nodeType===1&&lle(e,n),PA(e)):lle(Md,n.stateNode));break;case 4:s=Md,i=Yp,Md=n.stateNode.containerInfo,Yp=!0,r0(e,t,n),Md=s,Yp=i;break;case 0:case 11:case 14:case 15:if(!Zd&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){i=s=s.next;do{var o=i,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&rue(n,t,l),i=i.next}while(i!==s)}r0(e,t,n);break;case 1:if(!Zd&&(L4(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(a){ql(n,t,a)}r0(e,t,n);break;case 21:r0(e,t,n);break;case 22:n.mode&1?(Zd=(s=Zd)||n.memoizedState!==null,r0(e,t,n),Zd=s):r0(e,t,n);break;default:r0(e,t,n)}}function Rbe(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new hKe),t.forEach(function(s){var i=wKe.bind(null,e,s);n.has(s)||(n.add(s),s.then(i,i))})}}function zp(e,t){var n=t.deletions;if(n!==null)for(var s=0;si&&(i=l),s&=~o}if(s=i,s=ic()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*mKe(s/1960))-s,10e?16:e,U0===null)var s=!1;else{if(e=U0,U0=null,Bee=0,Xa&6)throw Error(Mn(331));var i=Xa;for(Xa|=4,ys=e.current;ys!==null;){var o=ys,l=o.child;if(ys.flags&16){var a=o.deletions;if(a!==null){for(var h=0;hic()-Ime?oj(e,0):Eme|=n),xh(e,t)}function YTe(e,t){t===0&&(e.mode&1?(t=W6,W6<<=1,!(W6&130023424)&&(W6=4194304)):t=1);var n=Iu();e=ny(e,t),e!==null&&(aI(e,t,n),xh(e,n))}function bKe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),YTe(e,n)}function wKe(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(Mn(314))}s!==null&&s.delete(t),YTe(e,n)}var XTe;XTe=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||mh.current)uh=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return uh=!1,cKe(e,t,n);uh=!!(e.flags&131072)}else uh=!1,jl&&t.flags&1048576&&tTe(t,Eee,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;h8(e,t),e=t.pendingProps;var i=XS(t,ru.current);K4(t,n),i=Nme(null,t,s,e,i,n);var o=Sme();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,gh(s)?(o=!0,Tee(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,_me(t),i.updater=bne,t.stateNode=i,i._reactInternals=t,Zde(t,s,e,n),t=Qde(null,t,s,!0,o,n)):(t.tag=0,jl&&o&&fme(t),vu(null,t,i,n),t=t.child),t;case 16:s=t.elementType;e:{switch(h8(e,t),e=t.pendingProps,i=s._init,s=i(s._payload),t.type=s,i=t.tag=kKe(s),e=Wp(s,e),i){case 0:t=Xde(null,t,s,e,n);break e;case 1:t=Ibe(null,t,s,e,n);break e;case 11:t=Abe(null,t,s,e,n);break e;case 14:t=Ebe(null,t,s,Wp(s.type,e),n);break e}throw Error(Mn(306,s,""))}return t;case 0:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),Xde(e,t,s,i,n);case 1:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),Ibe(e,t,s,i,n);case 3:e:{if(LTe(t),e===null)throw Error(Mn(387));s=t.pendingProps,o=t.memoizedState,i=o.element,oTe(e,t),Lee(t,s,null,n);var l=t.memoizedState;if(s=l.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=tC(Error(Mn(423)),t),t=Pbe(e,t,s,n,i);break e}else if(s!==i){i=tC(Error(Mn(424)),t),t=Pbe(e,t,s,n,i);break e}else for(Wh=e1(t.stateNode.containerInfo.firstChild),Gh=t,jl=!0,em=null,n=iTe(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(QS(),s===i){t=sy(e,t,n);break e}vu(e,t,s,n)}t=t.child}return t;case 5:return lTe(t),e===null&&Wde(t),s=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,l=i.children,$de(s,i)?l=null:o!==null&&$de(s,o)&&(t.flags|=32),PTe(e,t),vu(e,t,l,n),t.child;case 6:return e===null&&Wde(t),null;case 13:return OTe(e,t,n);case 4:return bme(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=JS(t,null,s,n):vu(e,t,s,n),t.child;case 11:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),Abe(e,t,s,i,n);case 7:return vu(e,t,t.pendingProps,n),t.child;case 8:return vu(e,t,t.pendingProps.children,n),t.child;case 12:return vu(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,i=t.pendingProps,o=t.memoizedProps,l=i.value,Yo(Iee,s._currentValue),s._currentValue=l,o!==null)if(bm(o.value,l)){if(o.children===i.children&&!mh.current){t=sy(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){l=o.child;for(var h=a.firstContext;h!==null;){if(h.context===s){if(o.tag===1){h=Bx(-1,n&-n),h.tag=2;var p=o.updateQueue;if(p!==null){p=p.shared;var x=p.pending;x===null?h.next=h:(h.next=x.next,x.next=h),p.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Gde(o.return,n,t),a.lanes|=n;break}h=h.next}}else if(o.tag===10)l=o.type===t.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(Mn(341));l.lanes|=n,a=l.alternate,a!==null&&(a.lanes|=n),Gde(l,n,t),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===t){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}vu(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,s=t.pendingProps.children,K4(t,n),i=ep(i),s=s(i),t.flags|=1,vu(e,t,s,n),t.child;case 14:return s=t.type,i=Wp(s,t.pendingProps),i=Wp(s.type,i),Ebe(e,t,s,i,n);case 15:return ETe(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,i=t.pendingProps,i=t.elementType===s?i:Wp(s,i),h8(e,t),t.tag=1,gh(s)?(e=!0,Tee(t)):e=!1,K4(t,n),MTe(t,s,i),Zde(t,s,i,n),Qde(null,t,s,!0,e,n);case 19:return DTe(e,t,n);case 22:return ITe(e,t,n)}throw Error(Mn(156,t.tag))};function QTe(e,t){return NMe(e,t)}function jKe(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bf(e,t,n,s){return new jKe(e,t,n,s)}function Dme(e){return e=e.prototype,!(!e||!e.isReactComponent)}function kKe(e){if(typeof e=="function")return Dme(e)?1:0;if(e!=null){if(e=e.$$typeof,e===tme)return 11;if(e===rme)return 14}return 2}function s1(e,t){var n=e.alternate;return n===null?(n=Bf(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function m8(e,t,n,s,i,o){var l=2;if(s=e,typeof e=="function")Dme(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case N4:return lj(n.children,i,o,t);case eme:l=8,i|=8;break;case vde:return e=Bf(12,n,t,i|2),e.elementType=vde,e.lanes=o,e;case _de:return e=Bf(13,n,t,i),e.elementType=_de,e.lanes=o,e;case bde:return e=Bf(19,n,t,i),e.elementType=bde,e.lanes=o,e;case lMe:return kne(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case aMe:l=10;break e;case oMe:l=9;break e;case tme:l=11;break e;case rme:l=14;break e;case h0:l=16,s=null;break e}throw Error(Mn(130,e==null?e:typeof e,""))}return t=Bf(l,n,t,i),t.elementType=e,t.type=s,t.lanes=o,t}function lj(e,t,n,s){return e=Bf(7,e,s,t),e.lanes=n,e}function kne(e,t,n,s){return e=Bf(22,e,s,t),e.elementType=lMe,e.lanes=n,e.stateNode={isHidden:!1},e}function gle(e,t,n){return e=Bf(6,e,null,t),e.lanes=n,e}function xle(e,t,n){return t=Bf(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function NKe(e,t,n,s,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Xoe(0),this.expirationTimes=Xoe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Xoe(0),this.identifierPrefix=s,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Rme(e,t,n,s,i,o,l,a,h){return e=new NKe(e,t,n,a,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Bf(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_me(o),e}function SKe(e,t,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rAe)}catch(e){console.error(e)}}rAe(),rMe.exports=lf;var py=rMe.exports;const $me=za(py);var nAe,Hbe=py;nAe=Hbe.createRoot,Hbe.hydrateRoot;const EKe=1,IKe=1e6;let yle=0;function PKe(){return yle=(yle+1)%Number.MAX_SAFE_INTEGER,yle.toString()}const vle=new Map,Wbe=e=>{if(vle.has(e))return;const t=setTimeout(()=>{vle.delete(e),CT({type:"REMOVE_TOAST",toastId:e})},IKe);vle.set(e,t)},LKe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,EKe)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Wbe(n):e.toasts.forEach(s=>{Wbe(s.id)}),{...e,toasts:e.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},g8=[];let x8={toasts:[]};function CT(e){x8=LKe(x8,e),g8.forEach(t=>{t(x8)})}function $i({...e}){const t=PKe(),n=i=>CT({type:"UPDATE_TOAST",toast:{...i,id:t}}),s=()=>CT({type:"DISMISS_TOAST",toastId:t});return CT({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i=>{i||s()}}}),{id:t,dismiss:s,update:n}}function pa(){const[e,t]=I.useState(x8);return I.useEffect(()=>(g8.push(t),()=>{const n=g8.indexOf(t);n>-1&&g8.splice(n,1)}),[e]),{...e,toast:$i,dismiss:n=>CT({type:"DISMISS_TOAST",toastId:n})}}function cn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Gbe(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function iy(...e){return t=>{let n=!1;const s=e.map(i=>{const o=Gbe(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i{const{children:l,...a}=o,h=I.useMemo(()=>a,Object.values(a));return r.jsx(n.Provider,{value:h,children:l})};s.displayName=e+"Provider";function i(o){const l=I.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[s,i]}function Ql(e,t=[]){let n=[];function s(o,l){const a=I.createContext(l),h=n.length;n=[...n,l];const p=y=>{var E;const{scope:b,children:j,...N}=y,C=((E=b==null?void 0:b[e])==null?void 0:E[h])||a,A=I.useMemo(()=>N,Object.values(N));return r.jsx(C.Provider,{value:A,children:j})};p.displayName=o+"Provider";function x(y,b){var C;const j=((C=b==null?void 0:b[e])==null?void 0:C[h])||a,N=I.useContext(j);if(N)return N;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${o}\``)}return[p,x]}const i=()=>{const o=n.map(l=>I.createContext(l));return function(a){const h=(a==null?void 0:a[e])||o;return I.useMemo(()=>({[`__scope${e}`]:{...a,[e]:h}}),[a,h])}};return i.scopeName=e,[s,DKe(i,...t)]}function DKe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const l=s.reduce((a,{useScope:h,scopeName:p})=>{const y=h(o)[`__scope${p}`];return{...a,...y}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function D1(e){const t=RKe(e),n=I.forwardRef((s,i)=>{const{children:o,...l}=s,a=I.Children.toArray(o),h=a.find(FKe);if(h){const p=h.props.children,x=a.map(y=>y===h?I.Children.count(p)>1?I.Children.only(null):I.isValidElement(p)?p.props.children:null:y);return r.jsx(t,{...l,ref:i,children:I.isValidElement(p)?I.cloneElement(p,void 0,x):null})}return r.jsx(t,{...l,ref:i,children:o})});return n.displayName=`${e}.Slot`,n}var Ume=D1("Slot");function RKe(e){const t=I.forwardRef((n,s)=>{const{children:i,...o}=n;if(I.isValidElement(i)){const l=BKe(i),a=zKe(o,i.props);return i.type!==I.Fragment&&(a.ref=s?iy(s,l):l),I.cloneElement(i,a)}return I.Children.count(i)>1?I.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sAe=Symbol("radix.slottable");function iAe(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=sAe,t}function FKe(e){return I.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sAe}function zKe(e,t){const n={...t};for(const s in t){const i=e[s],o=t[s];/^on[A-Z]/.test(s)?i&&o?n[s]=(...a)=>{const h=o(...a);return i(...a),h}:i&&(n[s]=i):s==="style"?n[s]={...i,...o}:s==="className"&&(n[s]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function BKe(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function dI(e){const t=e+"CollectionProvider",[n,s]=Ql(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=C=>{const{scope:A,children:E}=C,T=rt.useRef(null),L=rt.useRef(new Map).current;return r.jsx(i,{scope:A,itemMap:L,collectionRef:T,children:E})};l.displayName=t;const a=e+"CollectionSlot",h=D1(a),p=rt.forwardRef((C,A)=>{const{scope:E,children:T}=C,L=o(a,E),z=ei(A,L.collectionRef);return r.jsx(h,{ref:z,children:T})});p.displayName=a;const x=e+"CollectionItemSlot",y="data-radix-collection-item",b=D1(x),j=rt.forwardRef((C,A)=>{const{scope:E,children:T,...L}=C,z=rt.useRef(null),F=ei(A,z),q=o(x,E);return rt.useEffect(()=>(q.itemMap.set(z,{ref:z,...L}),()=>void q.itemMap.delete(z))),r.jsx(b,{[y]:"",ref:F,children:T})});j.displayName=x;function N(C){const A=o(e+"CollectionConsumer",C);return rt.useCallback(()=>{const T=A.collectionRef.current;if(!T)return[];const L=Array.from(T.querySelectorAll(`[${y}]`));return Array.from(A.itemMap.values()).sort((q,H)=>L.indexOf(q.ref.current)-L.indexOf(H.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:l,Slot:p,ItemSlot:j},N,s]}var $Ke=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=$Ke.reduce((e,t)=>{const n=D1(`Primitive.${t}`),s=I.forwardRef((i,o)=>{const{asChild:l,...a}=i,h=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(h,{...a,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function qme(e,t){e&&py.flushSync(()=>e.dispatchEvent(t))}function Kl(e){const t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function UKe(e,t=globalThis==null?void 0:globalThis.document){const n=Kl(e);I.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var qKe="DismissableLayer",due="dismissableLayer.update",VKe="dismissableLayer.pointerDownOutside",HKe="dismissableLayer.focusOutside",Kbe,aAe=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ev=I.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,onDismiss:a,...h}=e,p=I.useContext(aAe),[x,y]=I.useState(null),b=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,j]=I.useState({}),N=ei(t,H=>y(H)),C=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),E=C.indexOf(A),T=x?C.indexOf(x):-1,L=p.layersWithOutsidePointerEventsDisabled.size>0,z=T>=E,F=GKe(H=>{const K=H.target,Z=[...p.branches].some(te=>te.contains(K));!z||Z||(i==null||i(H),l==null||l(H),H.defaultPrevented||a==null||a())},b),q=KKe(H=>{const K=H.target;[...p.branches].some(te=>te.contains(K))||(o==null||o(H),l==null||l(H),H.defaultPrevented||a==null||a())},b);return UKe(H=>{T===p.layers.size-1&&(s==null||s(H),!H.defaultPrevented&&a&&(H.preventDefault(),a()))},b),I.useEffect(()=>{if(x)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Kbe=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(x)),p.layers.add(x),Zbe(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=Kbe)}},[x,b,n,p]),I.useEffect(()=>()=>{x&&(p.layers.delete(x),p.layersWithOutsidePointerEventsDisabled.delete(x),Zbe())},[x,p]),I.useEffect(()=>{const H=()=>j({});return document.addEventListener(due,H),()=>document.removeEventListener(due,H)},[]),r.jsx(Rn.div,{...h,ref:N,style:{pointerEvents:L?z?"auto":"none":void 0,...e.style},onFocusCapture:cn(e.onFocusCapture,q.onFocusCapture),onBlurCapture:cn(e.onBlurCapture,q.onBlurCapture),onPointerDownCapture:cn(e.onPointerDownCapture,F.onPointerDownCapture)})});ev.displayName=qKe;var WKe="DismissableLayerBranch",oAe=I.forwardRef((e,t)=>{const n=I.useContext(aAe),s=I.useRef(null),i=ei(t,s);return I.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Rn.div,{...e,ref:i})});oAe.displayName=WKe;function GKe(e,t=globalThis==null?void 0:globalThis.document){const n=Kl(e),s=I.useRef(!1),i=I.useRef(()=>{});return I.useEffect(()=>{const o=a=>{if(a.target&&!s.current){let h=function(){lAe(VKe,n,p,{discrete:!0})};const p={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=h,t.addEventListener("click",i.current,{once:!0})):h()}else t.removeEventListener("click",i.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function KKe(e,t=globalThis==null?void 0:globalThis.document){const n=Kl(e),s=I.useRef(!1);return I.useEffect(()=>{const i=o=>{o.target&&!s.current&&lAe(HKe,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Zbe(){const e=new CustomEvent(due);document.dispatchEvent(e)}function lAe(e,t,n,{discrete:s}){const i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?qme(i,o):i.dispatchEvent(o)}var ZKe=ev,YKe=oAe,Yl=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},XKe="Portal",YC=I.forwardRef((e,t)=>{var a;const{container:n,...s}=e,[i,o]=I.useState(!1);Yl(()=>o(!0),[]);const l=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return l?$me.createPortal(r.jsx(Rn.div,{...s,ref:t}),l):null});YC.displayName=XKe;function QKe(e,t){return I.useReducer((n,s)=>t[n][s]??n,e)}var pc=e=>{const{present:t,children:n}=e,s=JKe(t),i=typeof n=="function"?n({present:s.isPresent}):I.Children.only(n),o=ei(s.ref,eZe(i));return typeof n=="function"||s.isPresent?I.cloneElement(i,{ref:o}):null};pc.displayName="Presence";function JKe(e){const[t,n]=I.useState(),s=I.useRef(null),i=I.useRef(e),o=I.useRef("none"),l=e?"mounted":"unmounted",[a,h]=QKe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const p=sL(s.current);o.current=a==="mounted"?p:"none"},[a]),Yl(()=>{const p=s.current,x=i.current;if(x!==e){const b=o.current,j=sL(p);e?h("MOUNT"):j==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(x&&b!==j?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,h]),Yl(()=>{if(t){let p;const x=t.ownerDocument.defaultView??window,y=j=>{const C=sL(s.current).includes(j.animationName);if(j.target===t&&C&&(h("ANIMATION_END"),!i.current)){const A=t.style.animationFillMode;t.style.animationFillMode="forwards",p=x.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=A)})}},b=j=>{j.target===t&&(o.current=sL(s.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{x.clearTimeout(p),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:I.useCallback(p=>{s.current=p?getComputedStyle(p):null,n(p)},[])}}function sL(e){return(e==null?void 0:e.animationName)||"none"}function eZe(e){var s,i;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tZe=Ype[" useInsertionEffect ".trim().toString()]||Yl;function Ou({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,o,l]=rZe({defaultProp:t,onChange:n}),a=e!==void 0,h=a?e:i;{const x=I.useRef(e!==void 0);I.useEffect(()=>{const y=x.current;y!==a&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=a},[a,s])}const p=I.useCallback(x=>{var y;if(a){const b=nZe(x)?x(e):x;b!==e&&((y=l.current)==null||y.call(l,b))}else o(x)},[a,e,o,l]);return[h,p]}function rZe({defaultProp:e,onChange:t}){const[n,s]=I.useState(e),i=I.useRef(n),o=I.useRef(t);return tZe(()=>{o.current=t},[t]),I.useEffect(()=>{var l;i.current!==n&&((l=o.current)==null||l.call(o,n),i.current=n)},[n,i]),[n,s,o]}function nZe(e){return typeof e=="function"}var cAe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),sZe="VisuallyHidden",Tne=I.forwardRef((e,t)=>r.jsx(Rn.span,{...e,ref:t,style:{...cAe,...e.style}}));Tne.displayName=sZe;var iZe=Tne,Vme="ToastProvider",[Hme,aZe,oZe]=dI("Toast"),[dAe]=Ql("Toast",[oZe]),[lZe,Ane]=dAe(Vme),uAe=e=>{const{__scopeToast:t,label:n="Notification",duration:s=5e3,swipeDirection:i="right",swipeThreshold:o=50,children:l}=e,[a,h]=I.useState(null),[p,x]=I.useState(0),y=I.useRef(!1),b=I.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Vme}\`. Expected non-empty \`string\`.`),r.jsx(Hme.Provider,{scope:t,children:r.jsx(lZe,{scope:t,label:n,duration:s,swipeDirection:i,swipeThreshold:o,toastCount:p,viewport:a,onViewportChange:h,onToastAdd:I.useCallback(()=>x(j=>j+1),[]),onToastRemove:I.useCallback(()=>x(j=>j-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:b,children:l})})};uAe.displayName=Vme;var hAe="ToastViewport",cZe=["F8"],uue="toast.viewportPause",hue="toast.viewportResume",fAe=I.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:s=cZe,label:i="Notifications ({hotkey})",...o}=e,l=Ane(hAe,n),a=aZe(n),h=I.useRef(null),p=I.useRef(null),x=I.useRef(null),y=I.useRef(null),b=ei(t,y,l.onViewportChange),j=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=l.toastCount>0;I.useEffect(()=>{const A=E=>{var L;s.length!==0&&s.every(z=>E[z]||E.code===z)&&((L=y.current)==null||L.focus())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[s]),I.useEffect(()=>{const A=h.current,E=y.current;if(N&&A&&E){const T=()=>{if(!l.isClosePausedRef.current){const q=new CustomEvent(uue);E.dispatchEvent(q),l.isClosePausedRef.current=!0}},L=()=>{if(l.isClosePausedRef.current){const q=new CustomEvent(hue);E.dispatchEvent(q),l.isClosePausedRef.current=!1}},z=q=>{!A.contains(q.relatedTarget)&&L()},F=()=>{A.contains(document.activeElement)||L()};return A.addEventListener("focusin",T),A.addEventListener("focusout",z),A.addEventListener("pointermove",T),A.addEventListener("pointerleave",F),window.addEventListener("blur",T),window.addEventListener("focus",L),()=>{A.removeEventListener("focusin",T),A.removeEventListener("focusout",z),A.removeEventListener("pointermove",T),A.removeEventListener("pointerleave",F),window.removeEventListener("blur",T),window.removeEventListener("focus",L)}}},[N,l.isClosePausedRef]);const C=I.useCallback(({tabbingDirection:A})=>{const T=a().map(L=>{const z=L.ref.current,F=[z,...wZe(z)];return A==="forwards"?F:F.reverse()});return(A==="forwards"?T.reverse():T).flat()},[a]);return I.useEffect(()=>{const A=y.current;if(A){const E=T=>{var F,q,H;const L=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!L){const K=document.activeElement,Z=T.shiftKey;if(T.target===A&&Z){(F=p.current)==null||F.focus();return}const le=C({tabbingDirection:Z?"backwards":"forwards"}),ve=le.findIndex(ne=>ne===K);_le(le.slice(ve+1))?T.preventDefault():Z?(q=p.current)==null||q.focus():(H=x.current)==null||H.focus()}};return A.addEventListener("keydown",E),()=>A.removeEventListener("keydown",E)}},[a,C]),r.jsxs(YKe,{ref:h,role:"region","aria-label":i.replace("{hotkey}",j),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&r.jsx(fue,{ref:p,onFocusFromOutsideViewport:()=>{const A=C({tabbingDirection:"forwards"});_le(A)}}),r.jsx(Hme.Slot,{scope:n,children:r.jsx(Rn.ol,{tabIndex:-1,...o,ref:b})}),N&&r.jsx(fue,{ref:x,onFocusFromOutsideViewport:()=>{const A=C({tabbingDirection:"backwards"});_le(A)}})]})});fAe.displayName=hAe;var pAe="ToastFocusProxy",fue=I.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...i}=e,o=Ane(pAe,n);return r.jsx(Tne,{"aria-hidden":!0,tabIndex:0,...i,ref:t,style:{position:"fixed"},onFocus:l=>{var p;const a=l.relatedTarget;!((p=o.viewport)!=null&&p.contains(a))&&s()}})});fue.displayName=pAe;var uI="Toast",dZe="toast.swipeStart",uZe="toast.swipeMove",hZe="toast.swipeCancel",fZe="toast.swipeEnd",mAe=I.forwardRef((e,t)=>{const{forceMount:n,open:s,defaultOpen:i,onOpenChange:o,...l}=e,[a,h]=Ou({prop:s,defaultProp:i??!0,onChange:o,caller:uI});return r.jsx(pc,{present:n||a,children:r.jsx(gZe,{open:a,...l,ref:t,onClose:()=>h(!1),onPause:Kl(e.onPause),onResume:Kl(e.onResume),onSwipeStart:cn(e.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:cn(e.onSwipeMove,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","move"),p.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:cn(e.onSwipeCancel,p=>{p.currentTarget.setAttribute("data-swipe","cancel"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:cn(e.onSwipeEnd,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),h(!1)})})})});mAe.displayName=uI;var[pZe,mZe]=dAe(uI,{onClose(){}}),gZe=I.forwardRef((e,t)=>{const{__scopeToast:n,type:s="foreground",duration:i,open:o,onClose:l,onEscapeKeyDown:a,onPause:h,onResume:p,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:b,onSwipeEnd:j,...N}=e,C=Ane(uI,n),[A,E]=I.useState(null),T=ei(t,ne=>E(ne)),L=I.useRef(null),z=I.useRef(null),F=i||C.duration,q=I.useRef(0),H=I.useRef(F),K=I.useRef(0),{onToastAdd:Z,onToastRemove:te}=C,ae=Kl(()=>{var ge;(A==null?void 0:A.contains(document.activeElement))&&((ge=C.viewport)==null||ge.focus()),l()}),le=I.useCallback(ne=>{!ne||ne===1/0||(window.clearTimeout(K.current),q.current=new Date().getTime(),K.current=window.setTimeout(ae,ne))},[ae]);I.useEffect(()=>{const ne=C.viewport;if(ne){const ge=()=>{le(H.current),p==null||p()},ie=()=>{const fe=new Date().getTime()-q.current;H.current=H.current-fe,window.clearTimeout(K.current),h==null||h()};return ne.addEventListener(uue,ie),ne.addEventListener(hue,ge),()=>{ne.removeEventListener(uue,ie),ne.removeEventListener(hue,ge)}}},[C.viewport,F,h,p,le]),I.useEffect(()=>{o&&!C.isClosePausedRef.current&&le(F)},[o,F,C.isClosePausedRef,le]),I.useEffect(()=>(Z(),()=>te()),[Z,te]);const ve=I.useMemo(()=>A?wAe(A):null,[A]);return C.viewport?r.jsxs(r.Fragment,{children:[ve&&r.jsx(xZe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:ve}),r.jsx(pZe,{scope:n,onClose:ae,children:py.createPortal(r.jsx(Hme.ItemSlot,{scope:n,children:r.jsx(ZKe,{asChild:!0,onEscapeKeyDown:cn(a,()=>{C.isFocusedToastEscapeKeyDownRef.current||ae(),C.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Rn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":C.swipeDirection,...N,ref:T,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:cn(e.onKeyDown,ne=>{ne.key==="Escape"&&(a==null||a(ne.nativeEvent),ne.nativeEvent.defaultPrevented||(C.isFocusedToastEscapeKeyDownRef.current=!0,ae()))}),onPointerDown:cn(e.onPointerDown,ne=>{ne.button===0&&(L.current={x:ne.clientX,y:ne.clientY})}),onPointerMove:cn(e.onPointerMove,ne=>{if(!L.current)return;const ge=ne.clientX-L.current.x,ie=ne.clientY-L.current.y,fe=!!z.current,de=["left","right"].includes(C.swipeDirection),ye=["left","up"].includes(C.swipeDirection)?Math.min:Math.max,Ie=de?ye(0,ge):0,Ne=de?0:ye(0,ie),we=ne.pointerType==="touch"?10:2,he={x:Ie,y:Ne},xe={originalEvent:ne,delta:he};fe?(z.current=he,iL(uZe,y,xe,{discrete:!1})):Ybe(he,C.swipeDirection,we)?(z.current=he,iL(dZe,x,xe,{discrete:!1}),ne.target.setPointerCapture(ne.pointerId)):(Math.abs(ge)>we||Math.abs(ie)>we)&&(L.current=null)}),onPointerUp:cn(e.onPointerUp,ne=>{const ge=z.current,ie=ne.target;if(ie.hasPointerCapture(ne.pointerId)&&ie.releasePointerCapture(ne.pointerId),z.current=null,L.current=null,ge){const fe=ne.currentTarget,de={originalEvent:ne,delta:ge};Ybe(ge,C.swipeDirection,C.swipeThreshold)?iL(fZe,j,de,{discrete:!0}):iL(hZe,b,de,{discrete:!0}),fe.addEventListener("click",ye=>ye.preventDefault(),{once:!0})}})})})}),C.viewport)})]}):null}),xZe=e=>{const{__scopeToast:t,children:n,...s}=e,i=Ane(uI,t),[o,l]=I.useState(!1),[a,h]=I.useState(!1);return _Ze(()=>l(!0)),I.useEffect(()=>{const p=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(p)},[]),a?null:r.jsx(YC,{asChild:!0,children:r.jsx(Tne,{...s,children:o&&r.jsxs(r.Fragment,{children:[i.label," ",n]})})})},yZe="ToastTitle",gAe=I.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Rn.div,{...s,ref:t})});gAe.displayName=yZe;var vZe="ToastDescription",xAe=I.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Rn.div,{...s,ref:t})});xAe.displayName=vZe;var yAe="ToastAction",vAe=I.forwardRef((e,t)=>{const{altText:n,...s}=e;return n.trim()?r.jsx(bAe,{altText:n,asChild:!0,children:r.jsx(Wme,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${yAe}\`. Expected non-empty \`string\`.`),null)});vAe.displayName=yAe;var _Ae="ToastClose",Wme=I.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e,i=mZe(_Ae,n);return r.jsx(bAe,{asChild:!0,children:r.jsx(Rn.button,{type:"button",...s,ref:t,onClick:cn(e.onClick,i.onClose)})})});Wme.displayName=_Ae;var bAe=I.forwardRef((e,t)=>{const{__scopeToast:n,altText:s,...i}=e;return r.jsx(Rn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...i,ref:t})});function wAe(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),bZe(s)){const i=s.ariaHidden||s.hidden||s.style.display==="none",o=s.dataset.radixToastAnnounceExclude==="";if(!i)if(o){const l=s.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...wAe(s))}}),t}function iL(e,t,n,{discrete:s}){const i=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?qme(i,o):i.dispatchEvent(o)}var Ybe=(e,t,n=0)=>{const s=Math.abs(e.x),i=Math.abs(e.y),o=s>i;return t==="left"||t==="right"?o&&s>n:!o&&i>n};function _Ze(e=()=>{}){const t=Kl(e);Yl(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[t])}function bZe(e){return e.nodeType===e.ELEMENT_NODE}function wZe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function _le(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var jZe=uAe,jAe=fAe,kAe=mAe,NAe=gAe,SAe=xAe,CAe=vAe,MAe=Wme;function TAe(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,Qbe=ra,XC=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return Qbe(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(p=>{const x=n==null?void 0:n[p],y=o==null?void 0:o[p];if(x===null)return null;const b=Xbe(x)||Xbe(y);return i[p][b]}),a=n&&Object.entries(n).reduce((p,x)=>{let[y,b]=x;return b===void 0||(p[y]=b),p},{}),h=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((p,x)=>{let{class:y,className:b,...j}=x;return Object.entries(j).every(N=>{let[C,A]=N;return Array.isArray(A)?A.includes({...o,...a}[C]):{...o,...a}[C]===A})?[...p,y,b]:p},[]);return Qbe(e,l,h,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kZe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),AAe=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var NZe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EAe=I.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:o,iconNode:l,...a},h)=>I.createElement("svg",{ref:h,...NZe,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:AAe("lucide",i),...a},[...l.map(([p,x])=>I.createElement(p,x)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U=(e,t)=>{const n=I.forwardRef(({className:s,...i},o)=>I.createElement(EAe,{ref:o,iconNode:t,className:AAe(`lucide-${kZe(e)}`,s),...i}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y8=U("AArrowDown",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 7v9",key:"pknjwm"}],["path",{d:"m14 12 4 4 4-4",key:"buelq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v8=U("AArrowUp",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 16V7",key:"ty0viw"}],["path",{d:"m14 11 4-4 4 4",key:"1pu57t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _8=U("ALargeSmall",[["path",{d:"M21 14h-5",key:"1vh23k"}],["path",{d:"M16 16v-3.5a2.5 2.5 0 0 1 5 0V16",key:"1wh10o"}],["path",{d:"M4.5 13h6",key:"dfilno"}],["path",{d:"m3 16 4.5-9 4.5 9",key:"2dxa0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b8=U("Accessibility",[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yg=U("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w8=U("AirVent",[["path",{d:"M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"larmp2"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12",key:"1bo8pg"}],["path",{d:"M6.6 15.6A2 2 0 1 0 10 17v-5",key:"t9h90c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j8=U("Airplay",[["path",{d:"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1",key:"ns4c3b"}],["path",{d:"m12 15 5 6H7Z",key:"14qnn2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p_=U("AlarmClockCheck",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m_=U("AlarmClockMinus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k8=U("AlarmClockOff",[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g_=U("AlarmClockPlus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N8=U("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S8=U("AlarmSmoke",[["path",{d:"M11 21c0-2.5 2-2.5 2-5",key:"1sicvv"}],["path",{d:"M16 21c0-2.5 2-2.5 2-5",key:"1o3eny"}],["path",{d:"m19 8-.8 3a1.25 1.25 0 0 1-1.2 1H7a1.25 1.25 0 0 1-1.2-1L5 8",key:"1bvca4"}],["path",{d:"M21 3a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a1 1 0 0 1 1-1z",key:"x3qr1j"}],["path",{d:"M6 21c0-2.5 2-2.5 2-5",key:"i3w1gp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C8=U("Album",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["polyline",{points:"11 3 11 11 14 8 17 11 17 3",key:"1wcwz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M8=U("AlignCenterHorizontal",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",key:"11f1s0"}],["path",{d:"M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",key:"t14dx9"}],["path",{d:"M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",key:"1w07xs"}],["path",{d:"M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",key:"1apec2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T8=U("AlignCenterVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",key:"14d6g8"}],["path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",key:"1e2lrw"}],["path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",key:"1fkdwx"}],["path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",key:"1euafb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y4=U("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A8=U("AlignEndHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E8=U("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I8=U("AlignHorizontalDistributeCenter",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P8=U("AlignHorizontalDistributeEnd",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M10 2v20",key:"uyc634"}],["path",{d:"M20 2v20",key:"1tx262"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L8=U("AlignHorizontalDistributeStart",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M4 2v20",key:"gtpd5x"}],["path",{d:"M14 2v20",key:"tg6bpw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O8=U("AlignHorizontalJustifyCenter",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D8=U("AlignHorizontalJustifyEnd",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"12",y:"7",rx:"2",key:"1ht384"}],["path",{d:"M22 2v20",key:"40qfg1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R8=U("AlignHorizontalJustifyStart",[["rect",{width:"6",height:"14",x:"6",y:"5",rx:"2",key:"hsirpf"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F8=U("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z8=U("AlignHorizontalSpaceBetween",[["rect",{width:"6",height:"14",x:"3",y:"5",rx:"2",key:"j77dae"}],["rect",{width:"6",height:"10",x:"15",y:"7",rx:"2",key:"bq30hj"}],["path",{d:"M3 2v20",key:"1d2pfg"}],["path",{d:"M21 2v20",key:"p059bm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B8=U("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X4=U("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q4=U("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $8=U("AlignStartHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U8=U("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q8=U("AlignVerticalDistributeCenter",[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V8=U("AlignVerticalDistributeEnd",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H8=U("AlignVerticalDistributeStart",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W8=U("AlignVerticalJustifyCenter",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G8=U("AlignVerticalJustifyEnd",[["rect",{width:"14",height:"6",x:"5",y:"12",rx:"2",key:"4l4tp2"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 22h20",key:"272qi7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K8=U("AlignVerticalJustifyStart",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"6",rx:"2",key:"13squh"}],["path",{d:"M2 2h20",key:"1ennik"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z8=U("AlignVerticalSpaceAround",[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y8=U("AlignVerticalSpaceBetween",[["rect",{width:"14",height:"6",x:"5",y:"15",rx:"2",key:"1w91an"}],["rect",{width:"10",height:"6",x:"7",y:"3",rx:"2",key:"17wqzy"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M2 3h20",key:"91anmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X8=U("Ambulance",[["path",{d:"M10 10H6",key:"1bsnug"}],["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.28a1 1 0 0 0-.684-.948l-1.923-.641a1 1 0 0 1-.578-.502l-1.539-3.076A1 1 0 0 0 16.382 8H14",key:"lrkjwd"}],["path",{d:"M8 8v4",key:"1fwk8c"}],["path",{d:"M9 18h6",key:"x1upvd"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q8=U("Ampersand",[["path",{d:"M17.5 12c0 4.4-3.6 8-8 8A4.5 4.5 0 0 1 5 15.5c0-6 8-4 8-8.5a3 3 0 1 0-6 0c0 3 2.5 8.5 12 13",key:"1o9ehi"}],["path",{d:"M16 12h3",key:"4uvgyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J8=U("Ampersands",[["path",{d:"M10 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"12lh1k"}],["path",{d:"M22 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"173c68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eO=U("Amphora",[["path",{d:"M10 2v5.632c0 .424-.272.795-.653.982A6 6 0 0 0 6 14c.006 4 3 7 5 8",key:"1h8rid"}],["path",{d:"M10 5H8a2 2 0 0 0 0 4h.68",key:"3ezsi6"}],["path",{d:"M14 2v5.632c0 .424.272.795.652.982A6 6 0 0 1 18 14c0 4-3 7-5 8",key:"yt6q09"}],["path",{d:"M14 5h2a2 2 0 0 1 0 4h-.68",key:"8f95yk"}],["path",{d:"M18 22H6",key:"mg6kv4"}],["path",{d:"M9 2h6",key:"1jrp98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tO=U("Anchor",[["path",{d:"M12 22V8",key:"qkxhtm"}],["path",{d:"M5 12H2a10 10 0 0 0 20 0h-3",key:"1hv3nh"}],["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rO=U("Angry",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["path",{d:"M7.5 8 10 9",key:"olxxln"}],["path",{d:"m14 9 2.5-1",key:"1j6cij"}],["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nO=U("Annoyed",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M14 9h2",key:"116p9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sO=U("Antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iO=U("Anvil",[["path",{d:"M7 10H6a4 4 0 0 1-4-4 1 1 0 0 1 1-1h4",key:"1hjpb6"}],["path",{d:"M7 5a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1 7 7 0 0 1-7 7H8a1 1 0 0 1-1-1z",key:"1qn45f"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M5 20a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3 1 1 0 0 1-1 1H6a1 1 0 0 1-1-1",key:"1fi4x8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aO=U("Aperture",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oO=U("AppWindowMac",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M14 8h.01",key:"1primd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MT=U("AppWindow",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lO=U("Apple",[["path",{d:"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z",key:"3s7exb"}],["path",{d:"M10 2c1 .5 2 2 2 5",key:"fcco2y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cO=U("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dO=U("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uO=U("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hO=U("Armchair",[["path",{d:"M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3",key:"irtipd"}],["path",{d:"M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"1qyhux"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fO=U("ArrowBigDownDash",[["path",{d:"M15 5H9",key:"1tp3ed"}],["path",{d:"M15 9v3h4l-7 7-7-7h4V9z",key:"ncdc4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pO=U("ArrowBigDown",[["path",{d:"M15 6v6h4l-7 7-7-7h4V6h6z",key:"1thax2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mO=U("ArrowBigLeftDash",[["path",{d:"M19 15V9",key:"1hci5f"}],["path",{d:"M15 15h-3v4l-7-7 7-7v4h3v6z",key:"16tjna"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gO=U("ArrowBigLeft",[["path",{d:"M18 15h-6v4l-7-7 7-7v4h6v6z",key:"lbrdak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xO=U("ArrowBigRightDash",[["path",{d:"M5 9v6",key:"158jrl"}],["path",{d:"M9 9h3V5l7 7-7 7v-4H9V9z",key:"1sg2xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yO=U("ArrowBigRight",[["path",{d:"M6 9h6V5l7 7-7 7v-4H6V9z",key:"7fvt9c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vO=U("ArrowBigUpDash",[["path",{d:"M9 19h6",key:"456am0"}],["path",{d:"M9 15v-3H5l7-7 7 7h-4v3H9z",key:"1r2uve"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _O=U("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bO=U("ArrowDown01",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wO=U("ArrowDown10",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x_=U("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jO=U("ArrowDownFromLine",[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kO=U("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NO=U("ArrowDownNarrowWide",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h4",key:"6d7r33"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h10",key:"1438ji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SO=U("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CO=U("ArrowDownToDot",[["path",{d:"M12 2v14",key:"jyx4ut"}],["path",{d:"m19 9-7 7-7-7",key:"1oe3oy"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MO=U("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TO=U("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y_=U("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v_=U("ArrowDownZA",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i1=U("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AO=U("ArrowLeftFromLine",[["path",{d:"m9 6-6 6 6 6",key:"7v63n9"}],["path",{d:"M3 12h14",key:"13k4hi"}],["path",{d:"M21 19V5",key:"b4bplr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EO=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IO=U("ArrowLeftToLine",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qa=U("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PO=U("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LO=U("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OO=U("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zo=U("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DO=U("ArrowUp01",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RO=U("ArrowUp10",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const __=U("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $x=U("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FO=U("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zO=U("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BO=U("ArrowUpLeft",[["path",{d:"M7 17V7h10",key:"11bw93"}],["path",{d:"M17 17 7 7",key:"2786uv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b_=U("ArrowUpNarrowWide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $O=U("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UO=U("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qO=U("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w_=U("ArrowUpZA",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vg=U("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VO=U("ArrowsUpFromLine",[["path",{d:"m4 6 3-3 3 3",key:"9aidw8"}],["path",{d:"M7 17V3",key:"19qxw1"}],["path",{d:"m14 6 3-3 3 3",key:"6iy689"}],["path",{d:"M17 17V3",key:"o0fmgi"}],["path",{d:"M4 21h16",key:"1h09gz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HO=U("Asterisk",[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WO=U("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GO=U("Atom",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KO=U("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZO=U("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pl=U("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YO=U("Axe",[["path",{d:"m14 12-8.5 8.5a2.12 2.12 0 1 1-3-3L11 9",key:"csbz4o"}],["path",{d:"M15 13 9 7l4-4 6 6h3a8 8 0 0 1-7 7z",key:"113wfo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j_=U("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XO=U("Baby",[["path",{d:"M9 12h.01",key:"157uk2"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"5yv0yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QO=U("Backpack",[["path",{d:"M4 10a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",key:"1ol0lm"}],["path",{d:"M8 10h8",key:"c7uz4u"}],["path",{d:"M8 18h8",key:"1no2b1"}],["path",{d:"M8 22v-6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v6",key:"1fr6do"}],["path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2",key:"donm21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JO=U("BadgeAlert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eD=U("BadgeCent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M15.4 10a4 4 0 1 0 0 4",key:"2eqtx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k_=U("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tD=U("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rD=U("BadgeEuro",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M7 12h5",key:"gblrwe"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nD=U("BadgeHelp",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sD=U("BadgeIndianRupee",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 8h8",key:"1bis0t"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m13 17-5-1h1a4 4 0 0 0 0-8",key:"nu2bwa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iD=U("BadgeInfo",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"16",y2:"12",key:"1y1yb1"}],["line",{x1:"12",x2:"12.01",y1:"8",y2:"8",key:"110wyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aD=U("BadgeJapaneseYen",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 8 3 3v7",key:"17yadx"}],["path",{d:"m12 11 3-3",key:"p4cfq1"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M9 16h6",key:"8wimt3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oD=U("BadgeMinus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lD=U("BadgePercent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cD=U("BadgePlus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dD=U("BadgePoundSterling",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 12h4",key:"qz6y1c"}],["path",{d:"M10 16V9.5a2.5 2.5 0 0 1 5 0",key:"3mlbjk"}],["path",{d:"M8 16h7",key:"sbedsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uD=U("BadgeRussianRuble",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9 16h5",key:"1syiyw"}],["path",{d:"M9 12h5a2 2 0 1 0 0-4h-3v9",key:"1ge9c1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hD=U("BadgeSwissFranc",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M11 17V8h4",key:"1bfq6y"}],["path",{d:"M11 12h3",key:"2eqnfz"}],["path",{d:"M9 16h4",key:"1skf3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fD=U("BadgeX",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pD=U("Badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mD=U("BaggageClaim",[["path",{d:"M22 18H6a2 2 0 0 1-2-2V7a2 2 0 0 0-2-2",key:"4irg2o"}],["path",{d:"M17 14V4a2 2 0 0 0-2-2h-1a2 2 0 0 0-2 2v10",key:"14fcyx"}],["rect",{width:"13",height:"8",x:"8",y:"6",rx:"1",key:"o6oiis"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"9",cy:"20",r:"2",key:"e5v82j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gD=U("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xD=U("Banana",[["path",{d:"M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5",key:"1cscit"}],["path",{d:"M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z",key:"1y1nbv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yD=U("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vD=U("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _D=U("Barcode",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bD=U("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vf=U("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wD=U("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jD=U("BatteryFull",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"13",key:"c6fn6x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kD=U("BatteryLow",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ND=U("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SD=U("BatteryWarning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 7h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1x5o8m"}],["path",{d:"M22 11v2",key:"1wo06k"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"1mdjgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CD=U("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MD=U("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TD=U("BeanOff",[["path",{d:"M9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22a13.96 13.96 0 0 0 9.9-4.1",key:"bq3udt"}],["path",{d:"M10.75 5.093A6 6 0 0 1 22 8c0 2.411-.61 4.68-1.683 6.66",key:"17ccse"}],["path",{d:"M5.341 10.62a4 4 0 0 0 6.487 1.208M10.62 5.341a4.015 4.015 0 0 1 2.039 2.04",key:"18zqgq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AD=U("Bean",[["path",{d:"M10.165 6.598C9.954 7.478 9.64 8.36 9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22c7.732 0 14-6.268 14-14a6 6 0 0 0-11.835-1.402Z",key:"1tvzk7"}],["path",{d:"M5.341 10.62a4 4 0 1 0 5.279-5.28",key:"2cyri2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ED=U("BedDouble",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ID=U("BedSingle",[["path",{d:"M3 20v-8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8",key:"1wm6mi"}],["path",{d:"M5 10V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",key:"4k93s5"}],["path",{d:"M3 18h18",key:"1h113x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hf=U("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PD=U("Beef",[["circle",{cx:"12.5",cy:"8.5",r:"2.5",key:"9738u8"}],["path",{d:"M12.5 2a6.5 6.5 0 0 0-6.22 4.6c-1.1 3.13-.78 3.9-3.18 6.08A3 3 0 0 0 5 18c4 0 8.4-1.8 11.4-4.3A6.5 6.5 0 0 0 12.5 2Z",key:"o0f6za"}],["path",{d:"m18.5 6 2.19 4.5a6.48 6.48 0 0 1 .31 2 6.49 6.49 0 0 1-2.6 5.2C15.4 20.2 11 22 7 22a3 3 0 0 1-2.68-1.66L2.4 16.5",key:"k7p6i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LD=U("BeerOff",[["path",{d:"M13 13v5",key:"igwfh0"}],["path",{d:"M17 11.47V8",key:"16yw0g"}],["path",{d:"M17 11h1a3 3 0 0 1 2.745 4.211",key:"1xbt65"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-3",key:"c55o3e"}],["path",{d:"M7.536 7.535C6.766 7.649 6.154 8 5.5 8a2.5 2.5 0 0 1-1.768-4.268",key:"1ydug7"}],["path",{d:"M8.727 3.204C9.306 2.767 9.885 2 11 2c1.56 0 2 1.5 3 1.5s1.72-.5 2.5-.5a1 1 0 1 1 0 5c-.78 0-1.5-.5-2.5-.5a3.149 3.149 0 0 0-.842.12",key:"q81o7q"}],["path",{d:"M9 14.6V18",key:"20ek98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OD=U("Beer",[["path",{d:"M17 11h1a3 3 0 0 1 0 6h-1",key:"1yp76v"}],["path",{d:"M9 12v6",key:"1u1cab"}],["path",{d:"M13 12v6",key:"1sugkk"}],["path",{d:"M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z",key:"1510fo"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"19jb7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DD=U("BellDot",[["path",{d:"M19.4 14.9C20.2 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 .7 0 1.3.1 1.9.3",key:"xcehk"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RD=U("BellElectric",[["path",{d:"M18.8 4A6.3 8.7 0 0 1 20 9",key:"xve1fh"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["rect",{width:"10",height:"6",x:"4",y:"16",rx:"2",key:"17f3te"}],["path",{d:"M14 19c3 0 4.6-1.6 4.6-1.6",key:"n7odp6"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FD=U("BellMinus",[["path",{d:"M18.4 12c.8 3.8 2.6 5 2.6 5H3s3-2 3-9c0-3.3 2.7-6 6-6 1.8 0 3.4.8 4.5 2",key:"eck70s"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cj=U("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zD=U("BellPlus",[["path",{d:"M19.3 14.8C20.1 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 1 0 1.9.2 2.8.7",key:"guizqy"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}],["path",{d:"M18 5v6",key:"g5ayrv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BD=U("BellRing",[["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"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _g=U("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N_=U("BetweenHorizontalEnd",[["rect",{width:"13",height:"7",x:"3",y:"3",rx:"1",key:"11xb64"}],["path",{d:"m22 15-3-3 3-3",key:"26chmm"}],["rect",{width:"13",height:"7",x:"3",y:"14",rx:"1",key:"k6ky7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S_=U("BetweenHorizontalStart",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $D=U("BetweenVerticalEnd",[["rect",{width:"7",height:"13",x:"3",y:"3",rx:"1",key:"1fdu0f"}],["path",{d:"m9 22 3-3 3 3",key:"17z65a"}],["rect",{width:"7",height:"13",x:"14",y:"3",rx:"1",key:"1squn4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UD=U("BetweenVerticalStart",[["rect",{width:"7",height:"13",x:"3",y:"8",rx:"1",key:"1fjrkv"}],["path",{d:"m15 2-3 3-3-3",key:"1uh6eb"}],["rect",{width:"7",height:"13",x:"14",y:"8",rx:"1",key:"w3fjg8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qD=U("BicepsFlexed",[["path",{d:"M12.409 13.017A5 5 0 0 1 22 15c0 3.866-4 7-9 7-4.077 0-8.153-.82-10.371-2.462-.426-.316-.631-.832-.62-1.362C2.118 12.723 2.627 2 10 2a3 3 0 0 1 3 3 2 2 0 0 1-2 2c-1.105 0-1.64-.444-2-1",key:"1pmlyh"}],["path",{d:"M15 14a5 5 0 0 0-7.584 2",key:"5rb254"}],["path",{d:"M9.964 6.825C8.019 7.977 9.5 13 8 15",key:"kbvsx9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VD=U("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HD=U("Binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WD=U("Binoculars",[["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M19 7V4a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3",key:"3apit1"}],["path",{d:"M20 21a2 2 0 0 0 2-2v-3.851c0-1.39-2-2.962-2-4.829V8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v11a2 2 0 0 0 2 2z",key:"rhpgnw"}],["path",{d:"M 22 16 L 2 16",key:"14lkq7"}],["path",{d:"M4 21a2 2 0 0 1-2-2v-3.851c0-1.39 2-2.962 2-4.829V8a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v11a2 2 0 0 1-2 2z",key:"104b3k"}],["path",{d:"M9 7V4a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v3",key:"14fczp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GD=U("Biohazard",[["circle",{cx:"12",cy:"11.9",r:"2",key:"e8h31w"}],["path",{d:"M6.7 3.4c-.9 2.5 0 5.2 2.2 6.7C6.5 9 3.7 9.6 2 11.6",key:"17bolr"}],["path",{d:"m8.9 10.1 1.4.8",key:"15ezny"}],["path",{d:"M17.3 3.4c.9 2.5 0 5.2-2.2 6.7 2.4-1.2 5.2-.6 6.9 1.5",key:"wtwa5u"}],["path",{d:"m15.1 10.1-1.4.8",key:"1r0b28"}],["path",{d:"M16.7 20.8c-2.6-.4-4.6-2.6-4.7-5.3-.2 2.6-2.1 4.8-4.7 5.2",key:"m7qszh"}],["path",{d:"M12 13.9v1.6",key:"zfyyim"}],["path",{d:"M13.5 5.4c-1-.2-2-.2-3 0",key:"1bi9q0"}],["path",{d:"M17 16.4c.7-.7 1.2-1.6 1.5-2.5",key:"1rhjqw"}],["path",{d:"M5.5 13.9c.3.9.8 1.8 1.5 2.5",key:"8gsud3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KD=U("Bird",[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZD=U("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YD=U("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XD=U("Blinds",[["path",{d:"M3 3h18",key:"o7r712"}],["path",{d:"M20 7H8",key:"gd2fo2"}],["path",{d:"M20 11H8",key:"1ynp89"}],["path",{d:"M10 19h10",key:"19hjk5"}],["path",{d:"M8 15h12",key:"1yqzne"}],["path",{d:"M4 3v14",key:"fggqzn"}],["circle",{cx:"4",cy:"19",r:"2",key:"p3m9r0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QD=U("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JD=U("BluetoothConnected",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["line",{x1:"18",x2:"21",y1:"12",y2:"12",key:"1rsjjs"}],["line",{x1:"3",x2:"6",y1:"12",y2:"12",key:"11yl8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eR=U("BluetoothOff",[["path",{d:"m17 17-5 5V12l-5 5",key:"v5aci6"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M14.5 9.5 17 7l-5-5v4.5",key:"1kddfz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tR=U("BluetoothSearching",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["path",{d:"M20.83 14.83a4 4 0 0 0 0-5.66",key:"k8tn1j"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rR=U("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J4=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nR=U("Bolt",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sR=U("Bomb",[["circle",{cx:"11",cy:"13",r:"9",key:"hd149"}],["path",{d:"M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",key:"jp4j1b"}],["path",{d:"m22 2-1.5 1.5",key:"ay92ug"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iR=U("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aR=U("BookA",[["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"}],["path",{d:"m8 13 4-7 4 7",key:"4rari8"}],["path",{d:"M9.1 11h5.7",key:"1gkovt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oR=U("BookAudio",[["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8v3",key:"gejaml"}],["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"}],["path",{d:"M8 8v3",key:"1qzp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lR=U("BookCheck",[["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"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cR=U("BookCopy",[["path",{d:"M2 16V4a2 2 0 0 1 2-2h11",key:"spzkk5"}],["path",{d:"M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12",key:"1wz07i"}],["path",{d:"M5 14H4a2 2 0 1 0 0 4h1",key:"16gqf9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C_=U("BookDashed",[["path",{d:"M12 17h2",key:"13u4lk"}],["path",{d:"M12 22h2",key:"kn7ki6"}],["path",{d:"M12 2h2",key:"cvn524"}],["path",{d:"M18 22h1a1 1 0 0 0 1-1",key:"w6gbqz"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v1",key:"1vpra5"}],["path",{d:"M20 15v2h-2",key:"fph276"}],["path",{d:"M20 8v3",key:"deu0bs"}],["path",{d:"M4 11V9",key:"v3xsx8"}],["path",{d:"M4 19.5V15",key:"6gr39e"}],["path",{d:"M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8",key:"wywhs9"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dR=U("BookDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["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"}],["path",{d:"m9 10 3 3 3-3",key:"zt5b4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uR=U("BookHeadphones",[["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"}],["path",{d:"M8 12v-2a4 4 0 0 1 8 0v2",key:"1vsqkj"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hR=U("BookHeart",[["path",{d:"M16 8.2A2.22 2.22 0 0 0 13.8 6c-.8 0-1.4.3-1.8.9-.4-.6-1-.9-1.8-.9A2.22 2.22 0 0 0 8 8.2c0 .6.3 1.2.7 1.6A226.652 226.652 0 0 0 12 13a404 404 0 0 0 3.3-3.1 2.413 2.413 0 0 0 .7-1.7",key:"1t75a8"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fR=U("BookImage",[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["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"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pR=U("BookKey",[["path",{d:"m19 3 1 1",key:"ze14oc"}],["path",{d:"m20 2-4.5 4.5",key:"1sppr8"}],["path",{d:"M20 8v13a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1ocbpn"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H14",key:"1gfsgw"}],["circle",{cx:"14",cy:"8",r:"2",key:"u49eql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mR=U("BookLock",[["path",{d:"M18 6V4a2 2 0 1 0-4 0v2",key:"1aquzs"}],["path",{d:"M20 15v6a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1rkj32"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H10",key:"18wgow"}],["rect",{x:"12",y:"6",width:"8",height:"5",rx:"1",key:"73l30o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gR=U("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xR=U("BookMinus",[["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"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yR=U("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vR=U("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["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"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _R=U("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["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"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bR=U("BookText",[["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"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wR=U("BookType",[["path",{d:"M10 13h4",key:"ytezjc"}],["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8V6H8v2",key:"x8j6u4"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jR=U("BookUp2",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"161d7n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2",key:"1lorq7"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kR=U("BookUp",[["path",{d:"M12 13V7",key:"h0r20n"}],["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"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NR=U("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["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"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SR=U("BookX",[["path",{d:"m14.5 7-5 5",key:"dy991v"}],["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"}],["path",{d:"m9.5 7 5 5",key:"s45iea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CR=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MR=U("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TR=U("BookmarkMinus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AR=U("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ER=U("BookmarkX",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const um=U("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IR=U("BoomBox",[["path",{d:"M4 9V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"vvzvr1"}],["path",{d:"M8 8v1",key:"xcqmfk"}],["path",{d:"M12 8v1",key:"1rj8u4"}],["path",{d:"M16 8v1",key:"1q12zr"}],["rect",{width:"20",height:"12",x:"2",y:"9",rx:"2",key:"igpb89"}],["circle",{cx:"8",cy:"15",r:"2",key:"fa4a8s"}],["circle",{cx:"16",cy:"15",r:"2",key:"14c3ya"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PR=U("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LR=U("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eS=U("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OR=U("Box",[["path",{d:"M21 8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DR=U("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M_=U("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RR=U("Brackets",[["path",{d:"M16 3h3v18h-3",key:"1yor1f"}],["path",{d:"M8 21H5V3h3",key:"1qrfwo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FR=U("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zR=U("BrainCog",[["path",{d:"M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5",key:"1kgmhc"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m15.7 10.4-.9.4",key:"ayzo6p"}],["path",{d:"m9.2 13.2-.9.4",key:"1uzb3g"}],["path",{d:"m13.6 15.7-.4-.9",key:"11ifqf"}],["path",{d:"m10.8 9.2-.4-.9",key:"1pmk2v"}],["path",{d:"m15.7 13.5-.9-.4",key:"7ng02m"}],["path",{d:"m9.2 10.9-.9-.4",key:"1x66zd"}],["path",{d:"m10.5 15.7.4-.9",key:"3js94g"}],["path",{d:"m13.1 9.2.4-.9",key:"18n7mc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AT=U("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BR=U("BrickWall",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 9v6",key:"199k2o"}],["path",{d:"M16 15v6",key:"8rj2es"}],["path",{d:"M16 3v6",key:"1j6rpj"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 15v6",key:"1stoo3"}],["path",{d:"M8 3v6",key:"vlvjmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $R=U("BriefcaseBusiness",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UR=U("BriefcaseConveyorBelt",[["path",{d:"M10 20v2",key:"1n8e1g"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M18 20v2",key:"10uadw"}],["path",{d:"M21 20H3",key:"kdqkdp"}],["path",{d:"M6 20v2",key:"a9bc87"}],["path",{d:"M8 16V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v12",key:"17n9tx"}],["rect",{x:"4",y:"6",width:"16",height:"10",rx:"2",key:"1097i5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qR=U("BriefcaseMedical",[["path",{d:"M12 11v4",key:"a6ujw6"}],["path",{d:"M14 13h-4",key:"1pl8zg"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M18 6v14",key:"1mu4gy"}],["path",{d:"M6 6v14",key:"1s15cj"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yh=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VR=U("BringToFront",[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2",key:"yj20xf"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2",key:"1ltk23"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2",key:"1q24h9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HR=U("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WR=U("BugOff",[["path",{d:"M15 7.13V6a3 3 0 0 0-5.14-2.1L8 2",key:"vl8zik"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M22 13h-4v-2a4 4 0 0 0-4-4h-1.3",key:"1ou0bd"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7.7 7.7A4 4 0 0 0 6 11v3a6 6 0 0 0 11.13 3.13",key:"1njkjs"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GR=U("BugPlay",[["path",{d:"M12.765 21.522a.5.5 0 0 1-.765-.424v-8.196a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"17shqo"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5",key:"1tjixy"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KR=U("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const na=U("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dj=U("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZR=U("BusFront",[["path",{d:"M4 6 2 7",key:"1mqr15"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"m22 7-2-1",key:"1umjhc"}],["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 21v-2",key:"sqyl04"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YR=U("Bus",[["path",{d:"M8 6v6",key:"18i7km"}],["path",{d:"M15 6v6",key:"1sg6z9"}],["path",{d:"M2 12h19.6",key:"de5uta"}],["path",{d:"M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3",key:"1wwztk"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M9 18h5",key:"lrx6i"}],["circle",{cx:"16",cy:"18",r:"2",key:"1v4tcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XR=U("CableCar",[["path",{d:"M10 3h.01",key:"lbucoy"}],["path",{d:"M14 2h.01",key:"1k8aa1"}],["path",{d:"m2 9 20-5",key:"1kz0j5"}],["path",{d:"M12 12V6.5",key:"1vbrij"}],["rect",{width:"16",height:"10",x:"4",y:"12",rx:"3",key:"if91er"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QR=U("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JR=U("CakeSlice",[["circle",{cx:"9",cy:"7",r:"2",key:"1305pl"}],["path",{d:"M7.2 7.9 3 11v9c0 .6.4 1 1 1h16c.6 0 1-.4 1-1v-9c0-2-3-6-7-8l-3.6 2.6",key:"xle13f"}],["path",{d:"M16 13H3",key:"1wpj08"}],["path",{d:"M16 17H3",key:"3lvfcd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kh=U("Cake",[["path",{d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8",key:"1w3rig"}],["path",{d:"M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1",key:"n2jgmb"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M7 8v3",key:"1qtyvj"}],["path",{d:"M12 8v3",key:"hwp4zt"}],["path",{d:"M17 8v3",key:"1i6e5u"}],["path",{d:"M7 4h.01",key:"1bh4kh"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M17 4h.01",key:"1upcoc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eF=U("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tF=U("Calendar1",[["path",{d:"M11 14h1v4",key:"fy54vd"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rF=U("CalendarArrowDown",[["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 14v8",key:"irew45"}],["path",{d:"M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343",key:"bse4f3"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nF=U("CalendarArrowUp",[["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 22v-8",key:"su0gjh"}],["path",{d:"M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9",key:"1exg90"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sF=U("CalendarCheck2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iF=U("CalendarCheck",[["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:"m9 16 2 2 4-4",key:"19s6y9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aF=U("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oF=U("CalendarCog",[["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"M21 10.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"11kmuh"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hm=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lF=U("CalendarFold",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 17V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11Z",key:"kg77oy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M15 22v-4a2 2 0 0 1 2-2h4",key:"1gnbqr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cF=U("CalendarHeart",[["path",{d:"M3 10h18V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7",key:"136lmk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21.29 14.7a2.43 2.43 0 0 0-2.65-.52c-.3.12-.57.3-.8.53l-.34.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L17.5 22l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1t7hil"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dF=U("CalendarMinus2",[["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:"M10 16h4",key:"17e571"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uF=U("CalendarMinus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 15V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1scpom"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hF=U("CalendarOff",[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fF=U("CalendarPlus2",[["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:"M10 16h4",key:"17e571"}],["path",{d:"M12 14v4",key:"1thi36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uj=U("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pF=U("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mF=U("CalendarSearch",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gF=U("CalendarSync",[["path",{d:"M11 10v4h4",key:"172dkj"}],["path",{d:"m11 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"vu0qm5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m21 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"1qgeyt"}],["path",{d:"M21 22v-4h-4",key:"hrummi"}],["path",{d:"M21 8.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4.3",key:"mctw84"}],["path",{d:"M3 10h4",key:"1el30a"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xF=U("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yF=U("CalendarX",[["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:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zs=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vF=U("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bg=U("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _F=U("CandyCane",[["path",{d:"M5.7 21a2 2 0 0 1-3.5-2l8.6-14a6 6 0 0 1 10.4 6 2 2 0 1 1-3.464-2 2 2 0 1 0-3.464-2Z",key:"isaq8g"}],["path",{d:"M17.75 7 15 2.1",key:"12x7e8"}],["path",{d:"M10.9 4.8 13 9",key:"100a87"}],["path",{d:"m7.9 9.7 2 4.4",key:"ntfhaj"}],["path",{d:"M4.9 14.7 7 18.9",key:"1x43jy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bF=U("CandyOff",[["path",{d:"m8.5 8.5-1 1a4.95 4.95 0 0 0 7 7l1-1",key:"1ff4ui"}],["path",{d:"M11.843 6.187A4.947 4.947 0 0 1 16.5 7.5a4.947 4.947 0 0 1 1.313 4.657",key:"1sbrv4"}],["path",{d:"M14 16.5V14",key:"1maf8j"}],["path",{d:"M14 6.5v1.843",key:"1a6u6t"}],["path",{d:"M10 10v7.5",key:"80pj65"}],["path",{d:"m16 7 1-5 1.367.683A3 3 0 0 0 19.708 3H21v1.292a3 3 0 0 0 .317 1.341L22 7l-5 1",key:"11a9mt"}],["path",{d:"m8 17-1 5-1.367-.683A3 3 0 0 0 4.292 21H3v-1.292a3 3 0 0 0-.317-1.341L2 17l5-1",key:"3mjmon"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wF=U("Candy",[["path",{d:"m9.5 7.5-2 2a4.95 4.95 0 1 0 7 7l2-2a4.95 4.95 0 1 0-7-7Z",key:"ue6khb"}],["path",{d:"M14 6.5v10",key:"5xnk7c"}],["path",{d:"M10 7.5v10",key:"1uew51"}],["path",{d:"m16 7 1-5 1.37.68A3 3 0 0 0 19.7 3H21v1.3c0 .46.1.92.32 1.33L22 7l-5 1",key:"b9cp6k"}],["path",{d:"m8 17-1 5-1.37-.68A3 3 0 0 0 4.3 21H3v-1.3a3 3 0 0 0-.32-1.33L2 17l5-1",key:"5lney8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jF=U("Cannabis",[["path",{d:"M12 22v-4",key:"1utk9m"}],["path",{d:"M7 12c-1.5 0-4.5 1.5-5 3 3.5 1.5 6 1 6 1-1.5 1.5-2 3.5-2 5 2.5 0 4.5-1.5 6-3 1.5 1.5 3.5 3 6 3 0-1.5-.5-3.5-2-5 0 0 2.5.5 6-1-.5-1.5-3.5-3-5-3 1.5-1 4-4 4-6-2.5 0-5.5 1.5-7 3 0-2.5-.5-5-2-7-1.5 2-2 4.5-2 7-1.5-1.5-4.5-3-7-3 0 2 2.5 5 4 6",key:"1mezod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kF=U("CaptionsOff",[["path",{d:"M10.5 5H19a2 2 0 0 1 2 2v8.5",key:"jqtk4d"}],["path",{d:"M17 11h-.5",key:"1961ue"}],["path",{d:"M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2",key:"1keqsi"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7 11h4",key:"1o1z6v"}],["path",{d:"M7 15h2.5",key:"1ina1g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T_=U("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NF=U("CarFront",[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SF=U("CarTaxiFront",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CF=U("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MF=U("Caravan",[["path",{d:"M18 19V9a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v8a2 2 0 0 0 2 2h2",key:"19jm3t"}],["path",{d:"M2 9h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2",key:"13hakp"}],["path",{d:"M22 17v1a1 1 0 0 1-1 1H10v-9a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v9",key:"1crci8"}],["circle",{cx:"8",cy:"19",r:"2",key:"t8fc5s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TF=U("Carrot",[["path",{d:"M2.27 21.7s9.87-3.5 12.73-6.36a4.5 4.5 0 0 0-6.36-6.37C5.77 11.84 2.27 21.7 2.27 21.7zM8.64 14l-2.05-2.04M15.34 15l-2.46-2.46",key:"rfqxbe"}],["path",{d:"M22 9s-1.33-2-3.5-2C16.86 7 15 9 15 9s1.33 2 3.5 2S22 9 22 9z",key:"6b25w4"}],["path",{d:"M15 2s-2 1.33-2 3.5S15 9 15 9s2-1.84 2-3.5C17 3.33 15 2 15 2z",key:"fn65lo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AF=U("CaseLower",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EF=U("CaseSensitive",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["circle",{cx:"18",cy:"12",r:"3",key:"1kchzo"}],["path",{d:"M21 9v6",key:"anns31"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IF=U("CaseUpper",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["path",{d:"M15 11h4.5a2 2 0 0 1 0 4H15V7h4a2 2 0 0 1 0 4",key:"1sqfas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PF=U("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LF=U("Cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OF=U("Castle",[["path",{d:"M22 20v-9H2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2Z",key:"109fe4"}],["path",{d:"M18 11V4H6v7",key:"mon5oj"}],["path",{d:"M15 22v-4a3 3 0 0 0-3-3a3 3 0 0 0-3 3v4",key:"1k4jtn"}],["path",{d:"M22 11V9",key:"3zbp94"}],["path",{d:"M2 11V9",key:"1x5rnq"}],["path",{d:"M6 4V2",key:"1rsq15"}],["path",{d:"M18 4V2",key:"1jsdo1"}],["path",{d:"M10 4V2",key:"75d9ly"}],["path",{d:"M14 4V2",key:"8nj3z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DF=U("Cat",[["path",{d:"M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z",key:"x6xyqk"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M11.25 16.25h1.5L12 17l-.75-.75Z",key:"12kq1m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RF=U("Cctv",[["path",{d:"M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97",key:"ir91b5"}],["path",{d:"M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z",key:"jlp8i1"}],["path",{d:"M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15",key:"19bib8"}],["path",{d:"M2 21v-4",key:"l40lih"}],["path",{d:"M7 9h.01",key:"19b3jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A_=U("ChartArea",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E_=U("ChartBarBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FF=U("ChartBarDecreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h3",key:"ur6vzw"}],["path",{d:"M7 6h12",key:"sz5b0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zF=U("ChartBarIncreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h12",key:"wsnu98"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BF=U("ChartBarStacked",[["path",{d:"M11 13v4",key:"vyy2rb"}],["path",{d:"M15 5v4",key:"1gx88a"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I_=U("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P_=U("ChartCandlestick",[["path",{d:"M9 5v4",key:"14uxtq"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1",key:"f4fvz0"}],["path",{d:"M9 15v2",key:"r5rk32"}],["path",{d:"M17 3v2",key:"1l2re6"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1",key:"z38je5"}],["path",{d:"M17 13v3",key:"5l0wba"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L_=U("ChartColumnBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $F=U("ChartColumnDecreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17v-3",key:"1sqioe"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17V5",key:"1wzmnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O_=U("ChartColumnIncreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UF=U("ChartColumnStacked",[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ac=U("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qF=U("ChartGantt",[["path",{d:"M10 6h8",key:"zvc2xc"}],["path",{d:"M12 16h6",key:"yi5mkt"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 11h7",key:"wz2hg0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D_=U("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VF=U("ChartNetwork",[["path",{d:"m13.11 7.664 1.78 2.672",key:"go2gg9"}],["path",{d:"m14.162 12.788-3.324 1.424",key:"11x848"}],["path",{d:"m20 4-6.06 1.515",key:"1wxxh7"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["circle",{cx:"12",cy:"6",r:"2",key:"1jj5th"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}],["circle",{cx:"9",cy:"15",r:"2",key:"lf2ghp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HF=U("ChartNoAxesColumnDecreasing",[["path",{d:"M12 20V10",key:"g8npz5"}],["path",{d:"M18 20v-4",key:"8uic4z"}],["path",{d:"M6 20V4",key:"1w1bmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R_=U("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F_=U("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WF=U("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z_=U("ChartNoAxesGantt",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B_=U("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $_=U("ChartScatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GF=U("ChartSpline",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KF=U("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ca=U("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZF=U("ChefHat",[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YF=U("Cherry",[["path",{d:"M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"cvxqlc"}],["path",{d:"M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"1ostrc"}],["path",{d:"M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12",key:"hqx58h"}],["path",{d:"M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z",key:"eykp1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pu=U("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XF=U("ChevronFirst",[["path",{d:"m17 18-6-6 6-6",key:"1yerx2"}],["path",{d:"M7 6v12",key:"1p53r6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QF=U("ChevronLast",[["path",{d:"m7 18 6-6-6-6",key:"lwmzdw"}],["path",{d:"M17 6v12",key:"1o0aio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qc=U("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ka=U("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a1=U("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JF=U("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ez=U("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tz=U("ChevronsLeftRightEllipsis",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rz=U("ChevronsLeftRight",[["path",{d:"m9 7-5 5 5 5",key:"j5w590"}],["path",{d:"m15 7 5 5-5 5",key:"1bl6da"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nz=U("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sz=U("ChevronsRightLeft",[["path",{d:"m20 17-5-5 5-5",key:"30x0n2"}],["path",{d:"m4 17 5-5-5-5",key:"16spf4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iz=U("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o1=U("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const az=U("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oz=U("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lz=U("Church",[["path",{d:"M10 9h4",key:"u4k05v"}],["path",{d:"M12 7v5",key:"ma6bk"}],["path",{d:"M14 22v-4a2 2 0 0 0-4 0v4",key:"1pdhuj"}],["path",{d:"M18 22V5.618a1 1 0 0 0-.553-.894l-4.553-2.277a2 2 0 0 0-1.788 0L6.553 4.724A1 1 0 0 0 6 5.618V22",key:"1rkokr"}],["path",{d:"m18 7 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.618a1 1 0 0 1 .553-.894L6 7",key:"1w6esw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cz=U("CigaretteOff",[["path",{d:"M12 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h13",key:"1gdiyg"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 12a1 1 0 0 1 1 1v2a1 1 0 0 1-.5.866",key:"166zjj"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dz=U("Cigarette",[["path",{d:"M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14",key:"1mb5g1"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"1yl5r7"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const El=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U_=U("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q_=U("CircleArrowLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V_=U("CircleArrowOutDownLeft",[["path",{d:"M2 12a10 10 0 1 1 10 10",key:"1yn6ov"}],["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"M8 22H2v-6",key:"sulq54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H_=U("CircleArrowOutDownRight",[["path",{d:"M12 22a10 10 0 1 1 10-10",key:"130bv5"}],["path",{d:"M22 22 12 12",key:"131aw7"}],["path",{d:"M22 16v6h-6",key:"1gvm70"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W_=U("CircleArrowOutUpLeft",[["path",{d:"M2 8V2h6",key:"hiwtdz"}],["path",{d:"m2 2 10 10",key:"1oh8rs"}],["path",{d:"M12 2A10 10 0 1 1 2 12",key:"rrk4fa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G_=U("CircleArrowOutUpRight",[["path",{d:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K_=U("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z_=U("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qa=U("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ya=U("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y_=U("CircleChevronDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X_=U("CircleChevronLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q_=U("CircleChevronRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J_=U("CircleChevronUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uz=U("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=U("CircleDivide",[["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hz=U("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fz=U("CircleDotDashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pz=U("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mz=U("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gz=U("CircleEqual",[["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xz=U("CircleFadingArrowUp",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yz=U("CircleFadingPlus",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=U("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cx=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=U("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vz=U("CircleOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n2=U("CircleParkingOff",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m5 5 14 14",key:"11anup"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.34",key:"a9qo08"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s2=U("CircleParking",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=U("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a2=U("CirclePercent",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Df=U("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=U("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=U("CirclePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=U("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _z=U("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=U("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=U("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=U("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zc=U("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lu=U("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bz=U("CircuitBoard",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wz=U("Citrus",[["path",{d:"M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z",key:"4ite01"}],["path",{d:"M19.65 15.66A8 8 0 0 1 8.35 4.34",key:"1gxipu"}],["path",{d:"m14 10-5.5 5.5",key:"92pfem"}],["path",{d:"M14 17.85V10H6.15",key:"xqmtsk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jz=U("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ET=U("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kz=U("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nz=U("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sz=U("ClipboardMinus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cz=U("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f2=U("ClipboardPenLine",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.5",key:"1but9f"}],["path",{d:"M16 4h2a2 2 0 0 1 1.73 1",key:"1p8n7l"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=U("ClipboardPen",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5",key:"cereej"}],["path",{d:"M4 13.5V6a2 2 0 0 1 2-2h2",key:"5ua5vh"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mz=U("ClipboardPlus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}],["path",{d:"M12 17v-6",key:"1y8rbf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tz=U("ClipboardType",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Az=U("ClipboardX",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m15 11-6 6",key:"1toa9n"}],["path",{d:"m9 11 6 6",key:"wlibny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ez=U("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iz=U("Clock1",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 8",key:"12zbmj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pz=U("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lz=U("Clock11",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 8",key:"l5bg6f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oz=U("Clock12",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12",key:"1fub01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dz=U("Clock2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 10",key:"1g230d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rz=U("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fz=U("Clock4",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zz=U("Clock5",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 16",key:"1pcbox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bz=U("Clock6",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 12 16.5",key:"hb2qv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $z=U("Clock7",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 16",key:"ka3394"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uz=U("Clock8",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 14",key:"tmc9b4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qz=U("Clock9",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 7.5 12",key:"1k60p0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vz=U("ClockAlert",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hz=U("ClockArrowDown",[["path",{d:"M12.338 21.994A10 10 0 1 1 21.925 13.227",key:"1i7shu"}],["path",{d:"M12 6v6l2 1",key:"19cm8n"}],["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M18 14v8",key:"irew45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wz=U("ClockArrowUp",[["path",{d:"M13.228 21.925A10 10 0 1 1 21.994 12.338",key:"1fzlyi"}],["path",{d:"M12 6v6l1.562.781",key:"1ujuk9"}],["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M18 22v-8",key:"su0gjh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ki=U("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gz=U("CloudAlert",[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kz=U("CloudCog",[["circle",{cx:"12",cy:"17",r:"3",key:"1spfwm"}],["path",{d:"M4.2 15.1A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"zaobp"}],["path",{d:"m15.7 18.4-.9-.3",key:"4qxpbn"}],["path",{d:"m9.2 15.9-.9-.3",key:"17q7o2"}],["path",{d:"m10.6 20.7.3-.9",key:"1pf4s2"}],["path",{d:"m13.1 14.2.3-.9",key:"1mnuqm"}],["path",{d:"m13.6 20.7-.4-1",key:"1jpd1m"}],["path",{d:"m10.8 14.3-.4-1",key:"17ugyy"}],["path",{d:"m8.3 18.6 1-.4",key:"s42vdx"}],["path",{d:"m14.7 15.8 1-.4",key:"2wizun"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m2=U("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zz=U("CloudDrizzle",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 19v1",key:"1dk2by"}],["path",{d:"M8 14v1",key:"84yxot"}],["path",{d:"M16 19v1",key:"v220m7"}],["path",{d:"M16 14v1",key:"g12gj6"}],["path",{d:"M12 21v1",key:"q8vafk"}],["path",{d:"M12 16v1",key:"1mx6rx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yz=U("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xz=U("CloudHail",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v2",key:"a1is7l"}],["path",{d:"M8 14v2",key:"1e9m6t"}],["path",{d:"M16 20h.01",key:"xwek51"}],["path",{d:"M8 20h.01",key:"1vjney"}],["path",{d:"M12 16v2",key:"z66u1j"}],["path",{d:"M12 22h.01",key:"1urd7a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qz=U("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jz=U("CloudMoonRain",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e7=U("CloudMoon",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t7=U("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r7=U("CloudRainWind",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m9.2 22 3-7",key:"sb5f6j"}],["path",{d:"m9 13-3 7",key:"500co5"}],["path",{d:"m17 13-3 7",key:"8t2fiy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n7=U("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s7=U("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i7=U("CloudSunRain",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a7=U("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=U("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o7=U("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l7=U("Cloudy",[["path",{d:"M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"gqqjvc"}],["path",{d:"M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5",key:"1p2s76"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ox=U("Clover",[["path",{d:"M16.17 7.83 2 22",key:"t58vo8"}],["path",{d:"M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12",key:"17k36q"}],["path",{d:"m7.83 7.83 8.34 8.34",key:"1d7sxk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c7=U("Club",[["path",{d:"M17.28 9.05a5.5 5.5 0 1 0-10.56 0A5.5 5.5 0 1 0 12 17.66a5.5 5.5 0 1 0 5.28-8.6Z",key:"27yuqz"}],["path",{d:"M12 17.66L12 22",key:"ogfahf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x2=U("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hj=U("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d7=U("Codepen",[["polygon",{points:"12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2",key:"srzb37"}],["line",{x1:"12",x2:"12",y1:"22",y2:"15.5",key:"1t73f2"}],["polyline",{points:"22 8.5 12 15.5 2 8.5",key:"ajlxae"}],["polyline",{points:"2 15.5 12 8.5 22 15.5",key:"susrui"}],["line",{x1:"12",x2:"12",y1:"2",y2:"8.5",key:"2cldga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u7=U("Codesandbox",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"7.5 4.21 12 6.81 16.5 4.21",key:"fabo96"}],["polyline",{points:"7.5 19.79 7.5 14.6 3 12",key:"z377f1"}],["polyline",{points:"21 12 16.5 14.6 16.5 19.79",key:"9nrev1"}],["polyline",{points:"3.27 6.96 12 12.01 20.73 6.96",key:"1180pa"}],["line",{x1:"12",x2:"12",y1:"22.08",y2:"12",key:"3z3uq6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fj=U("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h7=U("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f7=U("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y2=U("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=U("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p7=U("Columns4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m7=U("Combine",[["path",{d:"M10 18H5a3 3 0 0 1-3-3v-1",key:"ru65g8"}],["path",{d:"M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"e30een"}],["path",{d:"M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"2ahx8o"}],["path",{d:"m7 21 3-3-3-3",key:"127cv2"}],["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g7=U("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x7=U("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y7=U("Component",[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v7=U("Computer",[["rect",{width:"14",height:"8",x:"5",y:"2",rx:"2",key:"wc9tft"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h2",key:"rwmk9e"}],["path",{d:"M12 18h6",key:"aqd8w3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _7=U("ConciergeBell",[["path",{d:"M3 20a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Z",key:"1pvr1r"}],["path",{d:"M20 16a8 8 0 1 0-16 0",key:"1pa543"}],["path",{d:"M12 4v4",key:"1bq03y"}],["path",{d:"M10 4h4",key:"1xpv9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b7=U("Cone",[["path",{d:"m20.9 18.55-8-15.98a1 1 0 0 0-1.8 0l-8 15.98",key:"53pte7"}],["ellipse",{cx:"12",cy:"19",rx:"9",ry:"3",key:"1ji25f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w7=U("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _2=U("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j7=U("Contact",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k7=U("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N7=U("Contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S7=U("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C7=U("CookingPot",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M20 12v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"u0tga0"}],["path",{d:"m4 8 16-4",key:"16g0ng"}],["path",{d:"m8.86 6.78-.45-1.81a2 2 0 0 1 1.45-2.43l1.94-.48a2 2 0 0 1 2.43 1.46l.45 1.8",key:"12cejc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M7=U("CopyCheck",[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T7=U("CopyMinus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A7=U("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E7=U("CopySlash",[["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I7=U("CopyX",[["line",{x1:"12",x2:"18",y1:"12",y2:"18",key:"1rg63v"}],["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pl=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P7=U("Copyleft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.17 14.83a4 4 0 1 0 0-5.66",key:"1sveal"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L7=U("Copyright",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O7=U("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D7=U("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R7=U("CornerLeftDown",[["polyline",{points:"14 15 9 20 4 15",key:"nkc4i"}],["path",{d:"M20 4h-7a4 4 0 0 0-4 4v12",key:"nbpdq2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F7=U("CornerLeftUp",[["polyline",{points:"14 9 9 4 4 9",key:"m9oyvo"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z7=U("CornerRightDown",[["polyline",{points:"10 15 15 20 20 15",key:"axus6l"}],["path",{d:"M4 4h7a4 4 0 0 1 4 4v12",key:"wcbgct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B7=U("CornerRightUp",[["polyline",{points:"10 9 15 4 20 9",key:"1lr6px"}],["path",{d:"M4 20h7a4 4 0 0 0 4-4V4",key:"1plgdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $7=U("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U7=U("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q7=U("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V7=U("CreativeCommons",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M10 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1ss3eq"}],["path",{d:"M17 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1od56t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fm=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H7=U("Croissant",[["path",{d:"m4.6 13.11 5.79-3.21c1.89-1.05 4.79 1.78 3.71 3.71l-3.22 5.81C8.8 23.16.79 15.23 4.6 13.11Z",key:"1ozxlb"}],["path",{d:"m10.5 9.5-1-2.29C9.2 6.48 8.8 6 8 6H4.5C2.79 6 2 6.5 2 8.5a7.71 7.71 0 0 0 2 4.83",key:"ffuyb5"}],["path",{d:"M8 6c0-1.55.24-4-2-4-2 0-2.5 2.17-2.5 4",key:"osnpzi"}],["path",{d:"m14.5 13.5 2.29 1c.73.3 1.21.7 1.21 1.5v3.5c0 1.71-.5 2.5-2.5 2.5a7.71 7.71 0 0 1-4.83-2",key:"1vubaw"}],["path",{d:"M18 16c1.55 0 4-.24 4 2 0 2-2.17 2.5-4 2.5",key:"wxr772"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W7=U("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G7=U("Cross",[["path",{d:"M4 9a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h4a1 1 0 0 1 1 1v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a1 1 0 0 1 1-1h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-4a1 1 0 0 1-1-1V4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4a1 1 0 0 1-1 1z",key:"1xbrqy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K7=U("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l1=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z7=U("Cuboid",[["path",{d:"m21.12 6.4-6.05-4.06a2 2 0 0 0-2.17-.05L2.95 8.41a2 2 0 0 0-.95 1.7v5.82a2 2 0 0 0 .88 1.66l6.05 4.07a2 2 0 0 0 2.17.05l9.95-6.12a2 2 0 0 0 .95-1.7V8.06a2 2 0 0 0-.88-1.66Z",key:"1u2ovd"}],["path",{d:"M10 22v-8L2.25 9.15",key:"11pn4q"}],["path",{d:"m10 14 11.77-6.87",key:"1kt1wh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y7=U("CupSoda",[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X7=U("Currency",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["line",{x1:"3",x2:"6",y1:"3",y2:"6",key:"1jkytn"}],["line",{x1:"21",x2:"18",y1:"3",y2:"6",key:"14zfjt"}],["line",{x1:"3",x2:"6",y1:"21",y2:"18",key:"iusuec"}],["line",{x1:"21",x2:"18",y1:"21",y2:"18",key:"yj2dd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q7=U("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J7=U("Dam",[["path",{d:"M11 11.31c1.17.56 1.54 1.69 3.5 1.69 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"157kva"}],["path",{d:"M11.75 18c.35.5 1.45 1 2.75 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"d7q6m6"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M7 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1L10 4a1 1 0 0 0-1-1z",key:"pr6s65"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e9=U("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t9=U("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r9=U("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n9=U("Delete",[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s9=U("Dessert",[["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["path",{d:"M10.2 3.2C5.5 4 2 8.1 2 13a2 2 0 0 0 4 0v-1a2 2 0 0 1 4 0v4a2 2 0 0 0 4 0v-4a2 2 0 0 1 4 0v1a2 2 0 0 0 4 0c0-4.9-3.5-9-8.2-9.8",key:"lfo06j"}],["path",{d:"M3.2 14.8a9 9 0 0 0 17.6 0",key:"12xarc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i9=U("Diameter",[["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}],["path",{d:"M6.48 3.66a10 10 0 0 1 13.86 13.86",key:"xr8kdq"}],["path",{d:"m6.41 6.41 11.18 11.18",key:"uhpjw7"}],["path",{d:"M3.66 6.48a10 10 0 0 0 13.86 13.86",key:"cldpwv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a9=U("DiamondMinus",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=U("DiamondPercent",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0Z",key:"1tpxz2"}],["path",{d:"M9.2 9.2h.01",key:"1b7bvt"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"M14.7 14.8h.01",key:"17nsh4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o9=U("DiamondPlus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l9=U("Diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c9=U("Dice1",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d9=U("Dice2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u9=U("Dice3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h9=U("Dice4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f9=U("Dice5",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p9=U("Dice6",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m9=U("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g9=U("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x9=U("Disc2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y9=U("Disc3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v9=U("DiscAlbum",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"5",key:"nd82uf"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _9=U("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b9=U("Divide",[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w9=U("DnaOff",[["path",{d:"M15 2c-1.35 1.5-2.092 3-2.5 4.5L14 8",key:"1bivrr"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c3.333-3 6.667-3 10-3",key:"nxix30"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M22 9c-1.5 1.35-3 2.092-4.5 2.5l-1-1",key:"18cutr"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.35-1.5 2.092-3 2.5-4.5L10 16",key:"rlvei3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j9=U("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k9=U("Dock",[["path",{d:"M2 8h20",key:"d11cs7"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 16h12",key:"u522kt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N9=U("Dog",[["path",{d:"M11.25 16.25h1.5L12 17z",key:"w7jh35"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309",key:"u7s9ue"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5",key:"v8hric"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ud=U("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S9=U("Donut",[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3",key:"19sr3x"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C9=U("DoorClosed",[["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M14 12v.01",key:"xfcn54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c1=U("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M9=U("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Va=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T9=U("DraftingCompass",[["path",{d:"m12.99 6.74 1.93 3.44",key:"iwagvd"}],["path",{d:"M19.136 12a10 10 0 0 1-14.271 0",key:"ppmlo4"}],["path",{d:"m21 21-2.16-3.84",key:"vylbct"}],["path",{d:"m3 21 8.02-14.26",key:"1ssaw4"}],["circle",{cx:"12",cy:"5",r:"2",key:"f1ur92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A9=U("Drama",[["path",{d:"M10 11h.01",key:"d2at3l"}],["path",{d:"M14 6h.01",key:"k028ub"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6.5 13.1h.01",key:"1748ia"}],["path",{d:"M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3",key:"172yzv"}],["path",{d:"M17.4 9.9c-.8.8-2 .8-2.8 0",key:"1obv0w"}],["path",{d:"M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7",key:"rqjl8i"}],["path",{d:"M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4",key:"1mr6wy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=U("Dribbble",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M19.13 5.09C15.22 9.14 10 10.44 2.25 10.94",key:"hpej1"}],["path",{d:"M21.75 12.84c-6.62-1.41-12.14 1-16.38 6.32",key:"1tr44o"}],["path",{d:"M8.56 2.75c4.37 6 6 9.42 8 17.72",key:"kbh691"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I9=U("Drill",[["path",{d:"M10 18a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H5a3 3 0 0 1-3-3 1 1 0 0 1 1-1z",key:"ioqxb1"}],["path",{d:"M13 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1l-.81 3.242a1 1 0 0 1-.97.758H8",key:"1rs59n"}],["path",{d:"M14 4h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-3",key:"105ega"}],["path",{d:"M18 6h4",key:"66u95g"}],["path",{d:"m5 10-2 8",key:"xt2lic"}],["path",{d:"m7 18 2-8",key:"1bzku2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P9=U("Droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L9=U("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O9=U("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D9=U("Drumstick",[["path",{d:"M15.4 15.63a7.875 6 135 1 1 6.23-6.23 4.5 3.43 135 0 0-6.23 6.23",key:"1dtqwm"}],["path",{d:"m8.29 12.71-2.6 2.6a2.5 2.5 0 1 0-1.65 4.65A2.5 2.5 0 1 0 8.7 18.3l2.59-2.59",key:"1oq1fw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R9=U("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F9=U("EarOff",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z9=U("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B9=U("EarthLock",[["path",{d:"M7 3.34V5a3 3 0 0 0 3 3",key:"w732o8"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"f02343"}],["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M12 2a10 10 0 1 0 9.54 13",key:"zjsr6q"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w2=U("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $9=U("Eclipse",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a7 7 0 1 0 10 10",key:"1yuj32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U9=U("EggFried",[["circle",{cx:"11.5",cy:"12.5",r:"3.5",key:"1cl1mi"}],["path",{d:"M3 8c0-3.5 2.5-6 6.5-6 5 0 4.83 3 7.5 5s5 2 5 6c0 4.5-2.5 6.5-7 6.5-2.5 0-2.5 2.5-6 2.5s-7-2-7-5.5c0-3 1.5-3 1.5-5C3.5 10 3 9 3 8Z",key:"165ef9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q9=U("EggOff",[["path",{d:"M6.399 6.399C5.362 8.157 4.65 10.189 4.5 12c-.37 4.43 1.27 9.95 7.5 10 3.256-.026 5.259-1.547 6.375-3.625",key:"6et380"}],["path",{d:"M19.532 13.875A14.07 14.07 0 0 0 19.5 12c-.36-4.34-3.95-9.96-7.5-10-1.04.012-2.082.502-3.046 1.297",key:"gcdc3f"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tS=U("Egg",[["path",{d:"M12 22c6.23-.05 7.87-5.57 7.5-10-.36-4.34-3.95-9.96-7.5-10-3.55.04-7.14 5.66-7.5 10-.37 4.43 1.27 9.95 7.5 10z",key:"1c39pg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mx=U("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lg=U("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V9=U("EqualApproximately",[["path",{d:"M5 15a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"yrdkhy"}],["path",{d:"M5 9a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"gzkvyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H9=U("EqualNot",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}],["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W9=U("Equal",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G9=U("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K9=U("EthernetPort",[["path",{d:"m15 20 3-3h2a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h2l3 3z",key:"rbahqx"}],["path",{d:"M6 8v1",key:"1636ez"}],["path",{d:"M10 8v1",key:"1talb4"}],["path",{d:"M14 8v1",key:"1rsfgr"}],["path",{d:"M18 8v1",key:"gnkwox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z9=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y9=U("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fs=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X9=U("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d1=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qo=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Od=U("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q9=U("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J9=U("Fan",[["path",{d:"M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z",key:"484a7f"}],["path",{d:"M12 12v.01",key:"u5ubse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eB=U("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tB=U("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rB=U("Fence",[["path",{d:"M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"1n2rgs"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M6 18h4",key:"12yh4b"}],["path",{d:"m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"3ha7mj"}],["path",{d:"M14 8h4",key:"1r8wg2"}],["path",{d:"M14 18h4",key:"1t3kbu"}],["path",{d:"m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"dfd4e2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nB=U("FerrisWheel",[["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m6.8 15-3.5 2",key:"hjy98k"}],["path",{d:"m20.7 7-3.5 2",key:"f08gto"}],["path",{d:"M6.8 9 3.3 7",key:"1aevh4"}],["path",{d:"m20.7 17-3.5-2",key:"1liqo3"}],["path",{d:"m9 22 3-8 3 8",key:"wees03"}],["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M18 18.7a9 9 0 1 0-12 0",key:"dhzg4g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sB=U("Figma",[["path",{d:"M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z",key:"1340ok"}],["path",{d:"M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z",key:"1hz3m3"}],["path",{d:"M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z",key:"1oz8n2"}],["path",{d:"M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z",key:"1ff65i"}],["path",{d:"M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z",key:"pdip6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iB=U("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aB=U("FileAudio2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"3",cy:"17",r:"1",key:"vo6nti"}],["path",{d:"M2 17v-3a4 4 0 0 1 8 0v3",key:"1ggdre"}],["circle",{cx:"9",cy:"17",r:"1",key:"bc1fq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oB=U("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j2=U("FileAxis3d",[["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:"m8 18 4-4",key:"12zab0"}],["path",{d:"M8 10v8h8",key:"tlaukw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lB=U("FileBadge2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14 12.5 1 5.5-3-1-3 1 1-5.5",key:"14xlky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cB=U("FileBadge",[["path",{d:"M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"12ixgl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M5 17a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"u0c8gj"}],["path",{d:"M7 16.5 8 22l-3-1-3 1 1-5.5",key:"5gm2nr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dB=U("FileBox",[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k2=U("FileChartColumnIncreasing",[["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:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N2=U("FileChartColumn",[["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:"M8 18v-1",key:"zg0ygc"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"M16 18v-3",key:"j5jt4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S2=U("FileChartLine",[["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:"m16 13-3.5 3.5-2-2L8 17",key:"zz7yod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C2=U("FileChartPie",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3.5",key:"13ddob"}],["path",{d:"M4.017 11.512a6 6 0 1 0 8.466 8.475",key:"s6vs5t"}],["path",{d:"M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",key:"1dl6s6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uB=U("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hB=U("FileCheck",[["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:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fB=U("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pB=U("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mB=U("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M2=U("FileCog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gB=U("FileDiff",[["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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xB=U("FileDigit",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"4",height:"6",x:"2",y:"12",rx:"2",key:"jm304g"}],["path",{d:"M10 12h2v6",key:"12zw74"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yB=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vB=U("FileHeart",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10.29 10.7a2.43 2.43 0 0 0-2.66-.52c-.29.12-.56.3-.78.53l-.35.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L6.5 18l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1c1fso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u1=U("FileImage",[["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"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _B=U("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bB=U("FileJson2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"fq0c9t"}],["path",{d:"M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"4gibmv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wB=U("FileJson",[["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 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jB=U("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kB=U("FileKey",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"10",cy:"16",r:"2",key:"4ckbqe"}],["path",{d:"m16 10-4.5 4.5",key:"7p3ebg"}],["path",{d:"m15 11 1 1",key:"1bsyx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NB=U("FileLock2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SB=U("FileLock",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["rect",{width:"8",height:"6",x:"8",y:"12",rx:"1",key:"3yr8at"}],["path",{d:"M10 12v-2a2 2 0 1 1 4 0v2",key:"j4i8d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CB=U("FileMinus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MB=U("FileMinus",[["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:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TB=U("FileMusic",[["path",{d:"M10.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v8.4",key:"1d3kfm"}],["path",{d:"M8 18v-7.7L16 9v7",key:"1oie6o"}],["circle",{cx:"14",cy:"16",r:"2",key:"1bzzi3"}],["circle",{cx:"6",cy:"18",r:"2",key:"1fncim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AB=U("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T2=U("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A2=U("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EB=U("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IB=U("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PB=U("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LB=U("FileScan",[["path",{d:"M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4",key:"1rdf37"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 14a2 2 0 0 0-2 2",key:"ceaadl"}],["path",{d:"M20 14a2 2 0 0 1 2 2",key:"1ny6zw"}],["path",{d:"M20 22a2 2 0 0 0 2-2",key:"1l9q4k"}],["path",{d:"M16 22a2 2 0 0 1-2-2",key:"1wqh5n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OB=U("FileSearch2",[["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"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DB=U("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RB=U("FileSliders",[["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:"M8 12h8",key:"1wcyev"}],["path",{d:"M10 11v2",key:"1s651w"}],["path",{d:"M8 17h8",key:"wh5c61"}],["path",{d:"M14 16v2",key:"12fp5e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h1=U("FileSpreadsheet",[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FB=U("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zB=U("FileSymlink",[["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"50q2rw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BB=U("FileTerminal",[["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:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wi=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $B=U("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UB=U("FileType",[["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:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qB=U("FileUp",[["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 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VB=U("FileUser",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 18a3 3 0 1 0-6 0",key:"16awa0"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HB=U("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WB=U("FileVideo",[["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 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GB=U("FileVolume2",[["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:"M8 15h.01",key:"a7atzg"}],["path",{d:"M11.5 13.5a2.5 2.5 0 0 1 0 3",key:"1fccat"}],["path",{d:"M15 12a5 5 0 0 1 0 6",key:"ps46cm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KB=U("FileVolume",[["path",{d:"M11 11a5 5 0 0 1 0 6",key:"193qb2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 6.765V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-.93-.23",key:"ifyjnl"}],["path",{d:"M7 10.51a.5.5 0 0 0-.826-.38l-1.893 1.628A1 1 0 0 1 3.63 12H2.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h1.129a1 1 0 0 1 .652.242l1.893 1.63a.5.5 0 0 0 .826-.38z",key:"mk8rxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZB=U("FileWarning",[["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:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YB=U("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XB=U("FileX",[["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:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QB=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JB=U("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ad=U("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e$=U("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pj=U("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t$=U("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r$=U("FireExtinguisher",[["path",{d:"M15 6.5V3a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3.5",key:"sqyvz"}],["path",{d:"M9 18h8",key:"i7pszb"}],["path",{d:"M18 3h-3",key:"7idoqj"}],["path",{d:"M11 3a6 6 0 0 0-6 6v11",key:"1v5je3"}],["path",{d:"M5 13h4",key:"svpcxo"}],["path",{d:"M17 10a4 4 0 0 0-8 0v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2Z",key:"vsjego"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n$=U("FishOff",[["path",{d:"M18 12.47v.03m0-.5v.47m-.475 5.056A6.744 6.744 0 0 1 15 18c-3.56 0-7.56-2.53-8.5-6 .348-1.28 1.114-2.433 2.121-3.38m3.444-2.088A8.802 8.802 0 0 1 15 6c3.56 0 6.06 2.54 7 6-.309 1.14-.786 2.177-1.413 3.058",key:"1j1hse"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33m7.48-4.372A9.77 9.77 0 0 1 16 6.07m0 11.86a9.77 9.77 0 0 1-1.728-3.618",key:"1q46z8"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98M8.53 3h5.27a2 2 0 0 1 1.98 1.67l.23 1.4M2 2l20 20",key:"1407gh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s$=U("FishSymbol",[["path",{d:"M2 16s9-15 20-4C11 23 2 8 2 8",key:"h4oh4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i$=U("Fish",[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a$=U("FlagOff",[["path",{d:"M8 2c3 0 5 2 8 2s4-1 4-1v11",key:"9rwyz9"}],["path",{d:"M4 22V4",key:"1plyxx"}],["path",{d:"M4 15s1-1 4-1 5 2 8 2",key:"1myooe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o$=U("FlagTriangleLeft",[["path",{d:"M17 22V2L7 7l10 5",key:"1rmf0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l$=U("FlagTriangleRight",[["path",{d:"M7 22V2l10 5-10 5",key:"17n18y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ux=U("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c$=U("FlameKindling",[["path",{d:"M12 2c1 3 2.5 3.5 3.5 4.5A5 5 0 0 1 17 10a5 5 0 1 1-10 0c0-.3 0-.6.1-.9a2 2 0 1 0 3.3-2C8 4.5 11 2 12 2Z",key:"1ir223"}],["path",{d:"m5 22 14-4",key:"1brv4h"}],["path",{d:"m5 18 14 4",key:"lgyyje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zh=U("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d$=U("FlashlightOff",[["path",{d:"M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4",key:"1r120k"}],["path",{d:"M7 2h11v4c0 2-2 2-2 4v1",key:"dz1920"}],["line",{x1:"11",x2:"18",y1:"6",y2:"6",key:"bi1vpe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u$=U("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h$=U("FlaskConicalOff",[["path",{d:"M10 10 4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-1.272-2.542",key:"59ek9y"}],["path",{d:"M10 2v2.343",key:"15t272"}],["path",{d:"M14 2v6.343",key:"sxr80q"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h9",key:"t5njau"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mj=U("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f$=U("FlaskRound",[["path",{d:"M10 2v7.31",key:"5d1hyh"}],["path",{d:"M14 9.3V1.99",key:"14k4l0"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14 9.3a6.5 6.5 0 1 1-4 0",key:"1r8fvy"}],["path",{d:"M5.52 16h12.96",key:"46hh1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p$=U("FlipHorizontal2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m$=U("FlipHorizontal",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g$=U("FlipVertical2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x$=U("FlipVertical",[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const im=U("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y$=U("Flower",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v$=U("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _$=U("FoldHorizontal",[["path",{d:"M2 12h6",key:"1wqiqv"}],["path",{d:"M22 12h-6",key:"1eg9hc"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 9-3 3 3 3",key:"12ol22"}],["path",{d:"m5 15 3-3-3-3",key:"1kdhjc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b$=U("FoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w$=U("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j$=U("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k$=U("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N$=U("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S$=U("FolderCode",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E2=U("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C$=U("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M$=U("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T$=U("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A$=U("FolderGit",[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E$=U("FolderHeart",[["path",{d:"M11 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1.5",key:"6hud8k"}],["path",{d:"M13.9 17.45c-1.2-1.2-1.14-2.8-.2-3.73a2.43 2.43 0 0 1 3.44 0l.36.34.34-.34a2.43 2.43 0 0 1 3.45-.01c.95.95 1 2.53-.2 3.74L17.5 21Z",key:"wpff58"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I$=U("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P$=U("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L$=U("FolderKey",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O$=U("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D$=U("FolderMinus",[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R$=U("FolderOpenDot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qx=U("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F$=U("FolderOutput",[["path",{d:"M2 7.5V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-1.5",key:"1yk7aj"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m5 10-3 3 3 3",key:"1r8ie0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I2=U("FolderPen",[["path",{d:"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5",key:"a8xqs0"}],["path",{d:"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1saktj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z$=U("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B$=U("FolderRoot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M12 15v5",key:"11xva1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $$=U("FolderSearch2",[["circle",{cx:"11.5",cy:"12.5",r:"2.5",key:"1ea5ju"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M13.3 14.3 15 16",key:"1y4v1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U$=U("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q$=U("FolderSymlink",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"x1c07l"}],["path",{d:"m8 16 3-3-3-3",key:"rlqrt1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V$=U("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H$=U("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W$=U("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G$=U("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K$=U("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z$=U("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y$=U("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X$=U("Forklift",[["path",{d:"M12 12H5a2 2 0 0 0-2 2v5",key:"7zsz91"}],["circle",{cx:"13",cy:"19",r:"2",key:"wjnkru"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M8 19h3m5-17v17h6M6 12V7c0-1.1.9-2 2-2h3l5 5",key:"13bk1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q$=U("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J$=U("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eU=U("Framer",[["path",{d:"M5 16V9h14V2H5l14 14h-7m-7 0 7 7v-7m-7 0h7",key:"1a2nng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tU=U("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rU=U("Fuel",[["line",{x1:"3",x2:"15",y1:"22",y2:"22",key:"xegly4"}],["line",{x1:"4",x2:"14",y1:"9",y2:"9",key:"xcnuvu"}],["path",{d:"M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18",key:"16j0yd"}],["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 2 2a2 2 0 0 0 2-2V9.83a2 2 0 0 0-.59-1.42L18 5",key:"7cu91f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nU=U("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sU=U("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iU=U("GalleryHorizontal",[["path",{d:"M2 3v18",key:"pzttux"}],["rect",{width:"12",height:"18",x:"6",y:"3",rx:"2",key:"btr8bg"}],["path",{d:"M22 3v18",key:"6jf3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aU=U("GalleryThumbnails",[["rect",{width:"18",height:"14",x:"3",y:"3",rx:"2",key:"74y24f"}],["path",{d:"M4 21h1",key:"16zlid"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M19 21h1",key:"edywat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oU=U("GalleryVerticalEnd",[["path",{d:"M7 2h10",key:"nczekb"}],["path",{d:"M5 6h14",key:"u2x4p"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lU=U("GalleryVertical",[["path",{d:"M3 2h18",key:"15qxfx"}],["rect",{width:"18",height:"12",x:"3",y:"6",rx:"2",key:"1439r6"}],["path",{d:"M3 22h18",key:"8prr45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cU=U("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dU=U("Gamepad",[["line",{x1:"6",x2:"10",y1:"12",y2:"12",key:"161bw2"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"15",x2:"15.01",y1:"13",y2:"13",key:"dqpgro"}],["line",{x1:"18",x2:"18.01",y1:"11",y2:"11",key:"meh2c"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uU=U("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hU=U("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fU=U("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gj=U("Ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ha=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pU=U("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mU=U("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P2=U("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gU=U("GitCommitVertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xU=U("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yU=U("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vU=U("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _U=U("GitGraph",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bU=U("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wU=U("GitPullRequestArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jU=U("GitPullRequestClosed",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kU=U("GitPullRequestCreateArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v3",key:"1rbwk6"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M22 18h-6",key:"1d5gi5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NU=U("GitPullRequestCreate",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SU=U("GitPullRequestDraft",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CU=U("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MU=U("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TU=U("Gitlab",[["path",{d:"m22 13.29-3.33-10a.42.42 0 0 0-.14-.18.38.38 0 0 0-.22-.11.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18l-2.26 6.67H8.32L6.1 3.26a.42.42 0 0 0-.1-.18.38.38 0 0 0-.26-.08.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18L2 13.29a.74.74 0 0 0 .27.83L12 21l9.69-6.88a.71.71 0 0 0 .31-.83Z",key:"148pdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AU=U("GlassWater",[["path",{d:"M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79z",key:"p55z4y"}],["path",{d:"M6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0",key:"mjntcy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EU=U("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IU=U("GlobeLock",[["path",{d:"M15.686 15A14.5 14.5 0 0 1 12 22a14.5 14.5 0 0 1 0-20 10 10 0 1 0 9.542 13",key:"qkt0x6"}],["path",{d:"M2 12h8.5",key:"ovaggd"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vx=U("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PU=U("Goal",[["path",{d:"M12 13V2l8 4-8 4",key:"5wlwwj"}],["path",{d:"M20.561 10.222a9 9 0 1 1-12.55-5.29",key:"1c0wjv"}],["path",{d:"M8.002 9.997a5 5 0 1 0 8.9 2.02",key:"gb1g7m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LU=U("Grab",[["path",{d:"M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"edstyy"}],["path",{d:"M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"19wdwo"}],["path",{d:"M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"1lugqo"}],["path",{d:"M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1hbeus"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0",key:"1etffm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f1=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OU=U("Grape",[["path",{d:"M22 5V2l-5.89 5.89",key:"1eenpo"}],["circle",{cx:"16.6",cy:"15.89",r:"3",key:"xjtalx"}],["circle",{cx:"8.11",cy:"7.4",r:"3",key:"u2fv6i"}],["circle",{cx:"12.35",cy:"11.65",r:"3",key:"i6i8g7"}],["circle",{cx:"13.91",cy:"5.85",r:"3",key:"6ye0dv"}],["circle",{cx:"18.15",cy:"10.09",r:"3",key:"snx9no"}],["circle",{cx:"6.56",cy:"13.2",r:"3",key:"17x4xg"}],["circle",{cx:"10.8",cy:"17.44",r:"3",key:"1hogw9"}],["circle",{cx:"5",cy:"19",r:"3",key:"1sn6vo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DU=U("Grid2x2Check",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L2=U("Grid2x2Plus",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 22v-6",key:"qhmiwi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RU=U("Grid2x2X",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O2=U("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dh=U("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FU=U("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p1=U("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zU=U("Grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BU=U("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $U=U("Guitar",[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-.8 2.3-1.9 2.8l-.9.4A2 2 0 0 0 12 18a4 4 0 0 1-4 4c-3.3 0-6-2.7-6-6a4 4 0 0 1 4-4 2 2 0 0 0 1.8-1.2z",key:"1u8q3z"}],["circle",{cx:"11.5",cy:"12.5",r:".5",fill:"currentColor",key:"16onso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UU=U("Ham",[["path",{d:"M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856",key:"1k1t7q"}],["path",{d:"M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288",key:"153t1g"}],["path",{d:"M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025",key:"gzrt0n"}],["path",{d:"m8.5 16.5-1-1",key:"otr954"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qU=U("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VU=U("HandCoins",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 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:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HU=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D2=U("HandHelping",[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 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:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WU=U("HandMetal",[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"wc6myp"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2",key:"94qvcw"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9",key:"m1ah89"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5",key:"t1skq1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GU=U("HandPlatter",[["path",{d:"M12 3V2",key:"ar7q03"}],["path",{d:"m15.4 17.4 3.2-2.8a2 2 0 1 1 2.8 2.9l-3.6 3.3c-.7.8-1.7 1.2-2.8 1.2h-4c-1.1 0-2.1-.4-2.8-1.2l-1.302-1.464A1 1 0 0 0 6.151 19H5",key:"n2g93r"}],["path",{d:"M2 14h12a2 2 0 0 1 0 4h-2",key:"1o2jem"}],["path",{d:"M4 10h16",key:"img6z1"}],["path",{d:"M5 10a7 7 0 0 1 14 0",key:"1ega1o"}],["path",{d:"M5 14v6a1 1 0 0 1-1 1H2",key:"1hescx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KU=U("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZU=U("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YU=U("HardDriveDownload",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XU=U("HardDriveUpload",[["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M12 2v8",key:"1q4o3n"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IT=U("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QU=U("HardHat",[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JU=U("Haze",[["path",{d:"m5.2 6.2 1.4 1.4",key:"17imol"}],["path",{d:"M2 13h2",key:"13gyu8"}],["path",{d:"M20 13h2",key:"16rner"}],["path",{d:"m17.4 7.6 1.4-1.4",key:"t4xlah"}],["path",{d:"M22 17H2",key:"1gtaj3"}],["path",{d:"M22 21H2",key:"1gy6en"}],["path",{d:"M16 13a4 4 0 0 0-8 0",key:"1dyczq"}],["path",{d:"M12 5V2.5",key:"1vytko"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eq=U("HdmiPort",[["path",{d:"M22 9a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h1l2 2h12l2-2h1a1 1 0 0 0 1-1Z",key:"2128wb"}],["path",{d:"M7.5 12h9",key:"1t0ckc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PT=U("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LT=U("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tq=U("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rq=U("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nq=U("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sq=U("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iq=U("Heading",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aq=U("HeadphoneOff",[["path",{d:"M21 14h-1.343",key:"1jdnxi"}],["path",{d:"M9.128 3.47A9 9 0 0 1 21 12v3.343",key:"6kipu2"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3",key:"9x50f4"}],["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364",key:"1bkxnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oq=U("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lq=U("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cq=U("HeartCrack",[["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"}],["path",{d:"m12 13-1-1 2-2-3-3 2-2",key:"xjdxli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dq=U("HeartHandshake",[["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"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uq=U("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hq=U("HeartPulse",[["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"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oa=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fq=U("Heater",[["path",{d:"M11 8c2-3-2-3 0-6",key:"1ldv5m"}],["path",{d:"M15.5 8c2-3-2-3 0-6",key:"1otqoz"}],["path",{d:"M6 10h.01",key:"1lbq93"}],["path",{d:"M6 14h.01",key:"zudwn7"}],["path",{d:"M10 16v-4",key:"1c25yv"}],["path",{d:"M14 16v-4",key:"1dkbt8"}],["path",{d:"M18 16v-4",key:"1yg9me"}],["path",{d:"M20 6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3",key:"1ubg90"}],["path",{d:"M5 20v2",key:"1abpe8"}],["path",{d:"M19 20v2",key:"kqn6ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pq=U("Hexagon",[["path",{d:"M21 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mq=U("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nS=U("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gq=U("HopOff",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.28.01.53-.09.7-.27",key:"qyzcap"}],["path",{d:"M11.14 20.57c.52.24 2.44 1.12 4.08 1.37.46.06.86-.25.9-.71.12-1.52-.3-3.43-.5-4.28",key:"y078lb"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .7-.26",key:"1utre3"}],["path",{d:"M17.99 5.52a20.83 20.83 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-1.17.1-2.5.02-3.9-.25",key:"17o9hm"}],["path",{d:"M20.57 11.14c.24.52 1.12 2.44 1.37 4.08.04.3-.08.59-.31.75",key:"1d1n4p"}],["path",{d:"M4.93 4.93a10 10 0 0 0-.67 13.4c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.85.85 0 0 0 .48-.24",key:"9uv3tt"}],["path",{d:"M5.52 17.99c1.05.95 2.91 2.42 4.5 3.15a.8.8 0 0 0 1.13-.68c.2-2.34-.33-5.3-1.57-8.28",key:"1292wz"}],["path",{d:"M8.35 2.68a10 10 0 0 1 9.98 1.58c.43.35.4.96-.12 1.17-1.5.6-4.3.98-6.07 1.05",key:"7ozu9p"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xq=U("Hop",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.55.03 1-.42.97-.97-.06-1.27-.26-3.5-.85-5.18",key:"18lxf1"}],["path",{d:"M11.5 6.5c1.64 0 5-.38 6.71-1.07.52-.2.55-.82.12-1.17A10 10 0 0 0 4.26 18.33c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.88.88 0 0 0 .73-.74c.3-2.14-.15-3.5-.61-4.88",key:"vtfxrw"}],["path",{d:"M15.62 16.95c.2.85.62 2.76.5 4.28a.77.77 0 0 1-.9.7 16.64 16.64 0 0 1-4.08-1.36",key:"13hl71"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .96-.96 17.68 17.68 0 0 0-.9-4.87",key:"1sl8oj"}],["path",{d:"M16.94 15.62c.86.2 2.77.62 4.29.5a.77.77 0 0 0 .7-.9 16.64 16.64 0 0 0-1.36-4.08",key:"19c6kt"}],["path",{d:"M17.99 5.52a20.82 20.82 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-2.33.2-5.3-.32-8.27-1.57",key:"85ghs3"}],["path",{d:"M4.93 4.93 3 3a.7.7 0 0 1 0-1",key:"x087yj"}],["path",{d:"M9.58 12.18c1.24 2.98 1.77 5.95 1.57 8.28a.8.8 0 0 1-1.13.68 20.82 20.82 0 0 1-4.5-3.15",key:"11xdqo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yq=U("Hospital",[["path",{d:"M12 6v4",key:"16clxf"}],["path",{d:"M14 14h-4",key:"esezmu"}],["path",{d:"M14 18h-4",key:"16mqa2"}],["path",{d:"M14 8h-4",key:"z8ypaz"}],["path",{d:"M18 12h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h2",key:"b1k337"}],["path",{d:"M18 22V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v18",key:"16g51d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vq=U("Hotel",[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _q=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bq=U("HousePlug",[["path",{d:"M10 12V8.964",key:"1vll13"}],["path",{d:"M14 12V8.964",key:"1x3qvg"}],["path",{d:"M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z",key:"ppykja"}],["path",{d:"M8.5 21H5a2 2 0 0 1-2-2v-9a2 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 2h-5a2 2 0 0 1-2-2v-2",key:"1gvg2z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wq=U("HousePlus",[["path",{d:"M13.22 2.416a2 2 0 0 0-2.511.057l-7 5.999A2 2 0 0 0 3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7.354",key:"5phn05"}],["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 3v6",key:"x1uolp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fi=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R2=U("IceCreamBowl",[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F2=U("IceCreamCone",[["path",{d:"m7 11 4.08 10.35a1 1 0 0 0 1.84 0L17 11",key:"1v6356"}],["path",{d:"M17 7A5 5 0 0 0 7 7",key:"151p3v"}],["path",{d:"M17 7a2 2 0 0 1 0 4H7a2 2 0 0 1 0-4",key:"1sdaij"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jq=U("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kq=U("ImageDown",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19 3 3v-5.5",key:"9ldu5r"}],["path",{d:"m17 22 3-3",key:"1nkfve"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nq=U("ImageMinus",[["path",{d:"M21 9v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"m87ecr"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sq=U("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cq=U("ImagePlay",[["path",{d:"m11 16-5 5",key:"j5f7ct"}],["path",{d:"M11 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6.5",key:"7s81lt"}],["path",{d:"M15.765 22a.5.5 0 0 1-.765-.424V13.38a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"1omb6s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mq=U("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tq=U("ImageUpscale",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M17 21h2a2 2 0 0 0 2-2",key:"130fy9"}],["path",{d:"M21 12v3",key:"1wzk3p"}],["path",{d:"m21 3-5 5",key:"1g5oa7"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2",key:"kk3yz1"}],["path",{d:"m5 21 4.144-4.144a1.21 1.21 0 0 1 1.712 0L13 19",key:"fyekpt"}],["path",{d:"M9 3h3",key:"d52fa"}],["rect",{x:"3",y:"11",width:"10",height:"10",rx:"1",key:"1wpmix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Do=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aq=U("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eq=U("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iq=U("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z2=U("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B2=U("IndentIncrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pq=U("IndianRupee",[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lq=U("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oq=U("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dq=U("InspectionPanel",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h.01",key:"7u93v4"}],["path",{d:"M17 7h.01",key:"14a9sn"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eu=U("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rq=U("IterationCcw",[["path",{d:"M20 10c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8h8",key:"4znkd0"}],["polyline",{points:"16 14 20 18 16 22",key:"11njsm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fq=U("IterationCw",[["path",{d:"M4 10c0-4.4 3.6-8 8-8s8 3.6 8 8-3.6 8-8 8H4",key:"tuf4su"}],["polyline",{points:"8 22 4 18 8 14",key:"evkj9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zq=U("JapaneseYen",[["path",{d:"M12 9.5V21m0-11.5L6 3m6 6.5L18 3",key:"2ej80x"}],["path",{d:"M6 15h12",key:"1hwgt5"}],["path",{d:"M6 11h12",key:"wf4gp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bq=U("Joystick",[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m1=U("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xj=U("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $q=U("KeySquare",[["path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z",key:"165ttr"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814",key:"1ubxi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yh=U("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uq=U("KeyboardMusic",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M6 12v4",key:"dy92yo"}],["path",{d:"M10 12v4",key:"1fxnav"}],["path",{d:"M14 12v4",key:"1hft58"}],["path",{d:"M18 12v4",key:"tjjnbz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qq=U("KeyboardOff",[["path",{d:"M 20 4 A2 2 0 0 1 22 6",key:"1g1fkt"}],["path",{d:"M 22 6 L 22 16.41",key:"1qjg3w"}],["path",{d:"M 7 16 L 16 16",key:"n0yqwb"}],["path",{d:"M 9.69 4 L 20 4",key:"kbpcgx"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2",key:"s23sx2"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M8 12h.01",key:"czm47f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vq=U("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hq=U("LampCeiling",[["path",{d:"M12 2v5",key:"nd4vlx"}],["path",{d:"M6 7h12l4 9H2l4-9Z",key:"123d64"}],["path",{d:"M9.17 16a3 3 0 1 0 5.66 0",key:"1061mw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wq=U("LampDesk",[["path",{d:"m14 5-3 3 2 7 8-8-7-2Z",key:"1b0msb"}],["path",{d:"m14 5-3 3-3-3 3-3 3 3Z",key:"1uemms"}],["path",{d:"M9.5 6.5 4 12l3 6",key:"1bx08v"}],["path",{d:"M3 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H3Z",key:"wap775"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gq=U("LampFloor",[["path",{d:"M9 2h6l3 7H6l3-7Z",key:"wcx6mj"}],["path",{d:"M12 9v13",key:"3n1su1"}],["path",{d:"M9 22h6",key:"1rlq3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kq=U("LampWallDown",[["path",{d:"M11 13h6l3 7H8l3-7Z",key:"9n3qlo"}],["path",{d:"M14 13V8a2 2 0 0 0-2-2H8",key:"1hu4hb"}],["path",{d:"M4 9h2a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H4v6Z",key:"s053bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zq=U("LampWallUp",[["path",{d:"M11 4h6l3 7H8l3-7Z",key:"11x1ee"}],["path",{d:"M14 11v5a2 2 0 0 1-2 2H8",key:"eutp5o"}],["path",{d:"M4 15h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H4v-6Z",key:"1iuthr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yq=U("Lamp",[["path",{d:"M8 2h8l4 10H4L8 2Z",key:"9dma5w"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M8 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H8Z",key:"mwf4oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xq=U("LandPlot",[["path",{d:"m12 8 6-3-6-3v10",key:"mvpnpy"}],["path",{d:"m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",key:"ek95tt"}],["path",{d:"m6.49 12.85 11.02 6.3",key:"1kt42w"}],["path",{d:"M17.51 12.85 6.5 19.15",key:"v55bdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qq=U("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jq=U("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eV=U("LaptopMinimalCheck",[["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{x:"3",y:"4",width:"18",height:"12",rx:"2",key:"8ur36m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $2=U("LaptopMinimal",[["rect",{width:"18",height:"12",x:"3",y:"4",rx:"2",ry:"2",key:"1qhy41"}],["line",{x1:"2",x2:"22",y1:"20",y2:"20",key:"ni3hll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tV=U("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rV=U("LassoSelect",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M7 16.93c.96.43 1.96.74 2.99.91",key:"ybbtv3"}],["path",{d:"M3.34 14A6.8 6.8 0 0 1 2 10c0-4.42 4.48-8 10-8s10 3.58 10 8a7.19 7.19 0 0 1-.33 2",key:"gt5e1w"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}],["path",{d:"M14.33 22h-.09a.35.35 0 0 1-.24-.32v-10a.34.34 0 0 1 .33-.34c.08 0 .15.03.21.08l7.34 6a.33.33 0 0 1-.21.59h-4.49l-2.57 3.85a.35.35 0 0 1-.28.14z",key:"72q637"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nV=U("Lasso",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",key:"146dds"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sV=U("Laugh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iV=U("Layers2",[["path",{d:"m16.02 12 5.48 3.13a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74L7.98 12",key:"1cuww1"}],["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74Z",key:"pdlvxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aV=U("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oV=U("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aS=U("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pm=U("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lV=U("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cV=U("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dV=U("LayoutPanelTop",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uV=U("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hV=U("Leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fV=U("LeafyGreen",[["path",{d:"M2 22c1.25-.987 2.27-1.975 3.9-2.2a5.56 5.56 0 0 1 3.8 1.5 4 4 0 0 0 6.187-2.353 3.5 3.5 0 0 0 3.69-5.116A3.5 3.5 0 0 0 20.95 8 3.5 3.5 0 1 0 16 3.05a3.5 3.5 0 0 0-5.831 1.373 3.5 3.5 0 0 0-5.116 3.69 4 4 0 0 0-2.348 6.155C3.499 15.42 4.409 16.712 4.2 18.1 3.926 19.743 3.014 20.732 2 22",key:"1134nt"}],["path",{d:"M2 22 17 7",key:"1q7jp2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pV=U("Lectern",[["path",{d:"M16 12h3a2 2 0 0 0 1.902-1.38l1.056-3.333A1 1 0 0 0 21 6H3a1 1 0 0 0-.958 1.287l1.056 3.334A2 2 0 0 0 5 12h3",key:"13jjxg"}],["path",{d:"M18 6V3a1 1 0 0 0-1-1h-3",key:"1550fe"}],["rect",{width:"8",height:"12",x:"8",y:"10",rx:"1",key:"qmu8b6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mV=U("LetterText",[["path",{d:"M15 12h6",key:"upa0zy"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"m3 13 3.553-7.724a.5.5 0 0 1 .894 0L11 13",key:"blevx4"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M4 11h6",key:"olkgv1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gV=U("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oS=U("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lS=U("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xV=U("Ligature",[["path",{d:"M8 20V8c0-2.2 1.8-4 4-4 1.5 0 2.8.8 3.5 2",key:"1rtphz"}],["path",{d:"M6 12h4",key:"a4o3ry"}],["path",{d:"M14 12h2v8",key:"c1fccl"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 20h4",key:"lzx1xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yV=U("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g1=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vV=U("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xh=U("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const So=U("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mm=U("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _V=U("ListCheck",[["path",{d:"M11 18H3",key:"n3j2dh"}],["path",{d:"m15 18 2 2 4-4",key:"1szwhi"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bV=U("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wV=U("ListCollapse",[["path",{d:"m3 10 2.5-2.5L3 5",key:"i6eama"}],["path",{d:"m3 19 2.5-2.5L3 14",key:"w2gmor"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jV=U("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kV=U("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NV=U("ListMinus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SV=U("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CV=U("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MV=U("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TV=U("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AV=U("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EV=U("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IV=U("ListVideo",[["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}],["path",{d:"m16 12 5 3-5 3v-6Z",key:"zpskkp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PV=U("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wf=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nn=U("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LV=U("LoaderPinwheel",[["path",{d:"M22 12a1 1 0 0 1-10 0 1 1 0 0 0-10 0",key:"1lzz15"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OV=U("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DV=U("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RV=U("LocateOff",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["path",{d:"M7.11 7.11C5.83 8.39 5 10.1 5 12c0 3.87 3.13 7 7 7 1.9 0 3.61-.83 4.89-2.11",key:"1oh7ia"}],["path",{d:"M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29",key:"3qdecy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OT=U("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U2=U("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FV=U("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q2=U("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gf=U("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dS=U("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uS=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zV=U("Logs",[["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M3 18h1",key:"1eiwyy"}],["path",{d:"M3 6h1",key:"rgxa97"}],["path",{d:"M8 12h1",key:"1con00"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M8 6h1",key:"tn6mkg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BV=U("Lollipop",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M11 11a2 2 0 0 0 4 0 4 4 0 0 0-8 0 6 6 0 0 0 12 0",key:"107gwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $V=U("Luggage",[["path",{d:"M6 20a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1m57jg"}],["path",{d:"M8 18V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v14",key:"1l99gc"}],["path",{d:"M10 20h4",key:"ni2waw"}],["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UV=U("Magnet",[["path",{d:"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",key:"1i3lhw"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}],["path",{d:"m12 15 4 4",key:"lnac28"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qV=U("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VV=U("MailMinus",[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HV=U("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WV=U("MailPlus",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GV=U("MailQuestion",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KV=U("MailSearch",[["path",{d:"M22 12.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h7.5",key:"w80f2v"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"8lzu5m"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.5-1.5",key:"1x83k4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZV=U("MailWarning",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DT=U("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ys=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YV=U("Mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XV=U("Mails",[["rect",{width:"16",height:"13",x:"6",y:"4",rx:"2",key:"1drq3f"}],["path",{d:"m22 7-7.1 3.78c-.57.3-1.23.3-1.8 0L6 7",key:"xn252p"}],["path",{d:"M2 8v11c0 1.1.9 2 2 2h14",key:"n13cji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QV=U("MapPinCheckInside",[["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"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JV=U("MapPinCheck",[["path",{d:"M19.43 12.935c.357-.967.57-1.955.57-2.935a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32.197 32.197 0 0 0 .813-.728",key:"1dq61d"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m16 18 2 2 4-4",key:"1mkfmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eH=U("MapPinHouse",[["path",{d:"M15 22a1 1 0 0 1-1-1v-4a1 1 0 0 1 .445-.832l3-2a1 1 0 0 1 1.11 0l3 2A1 1 0 0 1 22 17v4a1 1 0 0 1-1 1z",key:"1p1rcz"}],["path",{d:"M18 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 .601.2",key:"mcbcs9"}],["path",{d:"M18 22v-3",key:"1t1ugv"}],["circle",{cx:"10",cy:"10",r:"3",key:"1ns7v1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tH=U("MapPinMinusInside",[["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"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rH=U("MapPinMinus",[["path",{d:"M18.977 14C19.6 12.701 20 11.343 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"11uxia"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nH=U("MapPinOff",[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16",key:"1d4wjd"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",key:"12yil7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533",key:"lhrkcz"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74",key:"13wojd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sH=U("MapPinPlusInside",[["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"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iH=U("MapPinPlus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aH=U("MapPinXInside",[["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"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oH=U("MapPinX",[["path",{d:"M19.752 11.901A7.78 7.78 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 19 19 0 0 0 .09-.077",key:"y0ewhp"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m21.5 15.5-5 5",key:"11iqnx"}],["path",{d:"m21.5 20.5-5-5",key:"1bylgx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ml=U("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lH=U("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cH=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dH=U("Martini",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M12 11v11",key:"ur9y6a"}],["path",{d:"m19 3-7 8-7-8Z",key:"1sgpiw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uH=U("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x1=U("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hx=U("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hH=U("MegaphoneOff",[["path",{d:"M9.26 9.26 3 11v3l14.14 3.14",key:"3429n"}],["path",{d:"M21 15.34V6l-7.31 2.03",key:"4o1dh8"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gm=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fH=U("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pH=U("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RT=U("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mH=U("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gH=U("MessageCircleCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",key:"k85zhp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xH=U("MessageCircleDashed",[["path",{d:"M13.5 3.1c-.5 0-1-.1-1.5-.1s-1 .1-1.5.1",key:"16ll65"}],["path",{d:"M19.3 6.8a10.45 10.45 0 0 0-2.1-2.1",key:"1nq77a"}],["path",{d:"M20.9 13.5c.1-.5.1-1 .1-1.5s-.1-1-.1-1.5",key:"1sf7wn"}],["path",{d:"M17.2 19.3a10.45 10.45 0 0 0 2.1-2.1",key:"x1hs5g"}],["path",{d:"M10.5 20.9c.5.1 1 .1 1.5.1s1-.1 1.5-.1",key:"19m18z"}],["path",{d:"M3.5 17.5 2 22l4.5-1.5",key:"1f36qi"}],["path",{d:"M3.1 10.5c0 .5-.1 1-.1 1.5s.1 1 .1 1.5",key:"1vz3ju"}],["path",{d:"M6.8 4.7a10.45 10.45 0 0 0-2.1 2.1",key:"19f9do"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hS=U("MessageCircleHeart",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7",key:"43lnbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yH=U("MessageCircleMore",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vH=U("MessageCircleOff",[["path",{d:"M20.5 14.9A9 9 0 0 0 9.1 3.5",key:"1iebmn"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7",key:"1ov8ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _H=U("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FT=U("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bH=U("MessageCircleReply",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}],["path",{d:"M7 12h7a2 2 0 0 1 2 2v1",key:"1gheu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wH=U("MessageCircleWarning",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jH=U("MessageCircleX",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ol=U("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kH=U("MessageSquareCode",[["path",{d:"M10 7.5 8 10l2 2.5",key:"xb17xw"}],["path",{d:"m14 7.5 2 2.5-2 2.5",key:"5rap1v"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NH=U("MessageSquareDashed",[["path",{d:"M10 17H7l-4 4v-7",key:"1r71xu"}],["path",{d:"M14 17h1",key:"nufu4t"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1a2 2 0 0 1-2 2",key:"29akq3"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SH=U("MessageSquareDiff",[["path",{d:"m5 19-2 2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1xuzuj"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CH=U("MessageSquareDot",[["path",{d:"M11.7 3H5a2 2 0 0 0-2 2v16l4-4h12a2 2 0 0 0 2-2v-2.7",key:"uodpkb"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MH=U("MessageSquareHeart",[["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"}],["path",{d:"M14.8 7.5a1.84 1.84 0 0 0-2.6 0l-.2.3-.3-.3a1.84 1.84 0 1 0-2.4 2.8L12 13l2.7-2.7c.9-.9.8-2.1.1-2.8",key:"1blaws"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TH=U("MessageSquareLock",[["path",{d:"M19 15v-2a2 2 0 1 0-4 0v2",key:"h3d1vz"}],["path",{d:"M9 17H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3.5",key:"xsnnhn"}],["rect",{x:"13",y:"15",width:"8",height:"5",rx:"1",key:"1ccwuk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AH=U("MessageSquareMore",[["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"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EH=U("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IH=U("MessageSquarePlus",[["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"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zT=U("MessageSquareQuote",[["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"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PH=U("MessageSquareReply",[["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"}],["path",{d:"m10 7-3 3 3 3",key:"1eugdv"}],["path",{d:"M17 13v-1a2 2 0 0 0-2-2H7",key:"ernfh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LH=U("MessageSquareShare",[["path",{d:"M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7",key:"tqtdkg"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m16 8 5-5",key:"15mbrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OH=U("MessageSquareText",[["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"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DH=U("MessageSquareWarning",[["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"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RH=U("MessageSquareX",[["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"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Po=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FH=U("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zH=U("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V2=U("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BT=U("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BH=U("Microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $H=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UH=U("Microwave",[["rect",{width:"20",height:"15",x:"2",y:"4",rx:"2",key:"2no95f"}],["rect",{width:"8",height:"7",x:"6",y:"8",rx:"1",key:"zh9wx"}],["path",{d:"M18 8v7",key:"o5zi4n"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 19v2",key:"1dawf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qH=U("Milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M4 6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h13a2 2 0 0 0 1.152-.365l3.424-2.317a1 1 0 0 0 0-1.635l-3.424-2.318A2 2 0 0 0 17 6z",key:"1btarq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VH=U("MilkOff",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v1.343M15 2v2.789a4 4 0 0 0 .672 2.219l.656.984a4 4 0 0 1 .672 2.22v1.131M7.8 7.8l-.128.192A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3",key:"y0ejgx"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.472 6.472 0 0 0 3.435.435",key:"iaxqsy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HH=U("Milk",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WH=U("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GH=U("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y1=U("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KH=U("MonitorCheck",[["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZH=U("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YH=U("MonitorDot",[["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9",key:"1fet9y"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XH=U("MonitorDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"m15 10-3 3-3-3",key:"lzhmyn"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QH=U("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JH=U("MonitorPause",[["path",{d:"M10 13V7",key:"1u13u9"}],["path",{d:"M14 13V7",key:"1vj9om"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eW=U("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tW=U("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rW=U("MonitorSpeaker",[["path",{d:"M5.5 20H8",key:"1k40s5"}],["path",{d:"M17 9h.01",key:"1j24nn"}],["rect",{width:"10",height:"16",x:"12",y:"4",rx:"2",key:"ixliua"}],["path",{d:"M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4",key:"1mp6e1"}],["circle",{cx:"17",cy:"15",r:"1",key:"tqvash"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nW=U("MonitorStop",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}],["rect",{x:"9",y:"7",width:"6",height:"6",rx:"1",key:"5m2oou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sW=U("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iW=U("MonitorX",[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yj=U("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aW=U("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oW=U("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lW=U("MountainSnow",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cW=U("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dW=U("MouseOff",[["path",{d:"M12 6v.343",key:"1gyhex"}],["path",{d:"M18.218 18.218A7 7 0 0 1 5 15V9a7 7 0 0 1 .782-3.218",key:"ukzz01"}],["path",{d:"M19 13.343V9A7 7 0 0 0 8.56 2.902",key:"104jy9"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uW=U("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hW=U("MousePointerBan",[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vj=U("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fW=U("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pW=U("Mouse",[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H2=U("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mW=U("MoveDiagonal2",[["path",{d:"M19 13v6h-6",key:"1hxl6d"}],["path",{d:"M5 11V5h6",key:"12e2xe"}],["path",{d:"m5 5 14 14",key:"11anup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gW=U("MoveDiagonal",[["path",{d:"M11 19H5v-6",key:"8awifj"}],["path",{d:"M13 5h6v6",key:"7voy1q"}],["path",{d:"M19 5 5 19",key:"wwaj1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xW=U("MoveDownLeft",[["path",{d:"M11 19H5V13",key:"1akmht"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yW=U("MoveDownRight",[["path",{d:"M19 13V19H13",key:"10vkzq"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vW=U("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _W=U("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bW=U("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wW=U("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jW=U("MoveUpLeft",[["path",{d:"M5 11V5H11",key:"3q78g9"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kW=U("MoveUpRight",[["path",{d:"M13 5H19V11",key:"1n1gyv"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NW=U("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SW=U("MoveVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CW=U("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MW=U("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TW=U("Music3",[["circle",{cx:"12",cy:"18",r:"4",key:"m3r9ws"}],["path",{d:"M16 18V2",key:"40x2m5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AW=U("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EW=U("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IW=U("Navigation2Off",[["path",{d:"M9.31 9.31 5 21l7-4 7 4-1.17-3.17",key:"qoq2o2"}],["path",{d:"M14.53 8.88 12 2l-1.17 3.17",key:"k3sjzy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PW=U("Navigation2",[["polygon",{points:"12 2 19 21 12 17 5 21 12 2",key:"x8c0qg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LW=U("NavigationOff",[["path",{d:"M8.43 8.43 3 11l8 2 2 8 2.57-5.43",key:"1vdtb7"}],["path",{d:"M17.39 11.73 22 2l-9.73 4.61",key:"tya3r6"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $T=U("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OW=U("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wx=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DW=U("Nfc",[["path",{d:"M6 8.32a7.43 7.43 0 0 1 0 7.36",key:"9iaqei"}],["path",{d:"M9.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"1yha7l"}],["path",{d:"M12.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"4iu2gk"}],["path",{d:"M16.37 2a20.16 20.16 0 0 1 0 20",key:"sap9u2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RW=U("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FW=U("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zW=U("NotebookText",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M9.5 8h5",key:"11mslq"}],["path",{d:"M9.5 12H16",key:"ktog6x"}],["path",{d:"M9.5 16H14",key:"p1seyn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BW=U("Notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $W=U("NotepadTextDashed",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"j91f56"}],["path",{d:"M20 12v2",key:"w8o0tu"}],["path",{d:"M20 18v2a2 2 0 0 1-2 2h-1",key:"1c9ggx"}],["path",{d:"M13 22h-2",key:"191ugt"}],["path",{d:"M7 22H6a2 2 0 0 1-2-2v-2",key:"1rt9px"}],["path",{d:"M4 14v-2",key:"1v0sqh"}],["path",{d:"M4 8V6a2 2 0 0 1 2-2h2",key:"1mwabg"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UW=U("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qW=U("NutOff",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592a7.01 7.01 0 0 0 4.125-2.939",key:"1xcvy9"}],["path",{d:"M19 10v3.343",key:"163tfc"}],["path",{d:"M12 12c-1.349-.573-1.905-1.005-2.5-2-.546.902-1.048 1.353-2.5 2-1.018-.644-1.46-1.08-2-2-1.028.71-1.69.918-3 1 1.081-1.048 1.757-2.03 2-3 .194-.776.84-1.551 1.79-2.21m11.654 5.997c.887-.457 1.28-.891 1.556-1.787 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4-.74 0-1.461.068-2.15.192",key:"17914v"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VW=U("Nut",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592A7.003 7.003 0 0 0 19 14v-4",key:"1tgyif"}],["path",{d:"M12 4C8 4 4.5 6 4 8c-.243.97-.919 1.952-2 3 1.31-.082 1.972-.29 3-1 .54.92.982 1.356 2 2 1.452-.647 1.954-1.098 2.5-2 .595.995 1.151 1.427 2.5 2 1.31-.621 1.862-1.058 2.5-2 .629.977 1.162 1.423 2.5 2 1.209-.548 1.68-.967 2-2 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4Z",key:"tnsqj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W2=U("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HW=U("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G2=U("OctagonPause",[["path",{d:"M10 15V9",key:"1lckn7"}],["path",{d:"M14 15V9",key:"1muqhk"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K2=U("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WW=U("Octagon",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GW=U("Omega",[["path",{d:"M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21",key:"1x94xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KW=U("Option",[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZW=U("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YW=U("Origami",[["path",{d:"M12 12V4a1 1 0 0 1 1-1h6.297a1 1 0 0 1 .651 1.759l-4.696 4.025",key:"1bx4vc"}],["path",{d:"m12 21-7.414-7.414A2 2 0 0 1 4 12.172V6.415a1.002 1.002 0 0 1 1.707-.707L20 20.009",key:"1h3km6"}],["path",{d:"m12.214 3.381 8.414 14.966a1 1 0 0 1-.167 1.199l-1.168 1.163a1 1 0 0 1-.706.291H6.351a1 1 0 0 1-.625-.219L3.25 18.8a1 1 0 0 1 .631-1.781l4.165.027",key:"1hj4wg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XW=U("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QW=U("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JW=U("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eG=U("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tG=U("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rG=U("PackageSearch",[["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nG=U("PackageX",[["path",{d:"M21 10V8a2 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.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dl=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sG=U("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iG=U("PaintRoller",[["rect",{width:"16",height:"6",x:"2",y:"2",rx:"2",key:"jcyz7m"}],["path",{d:"M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1b9h7c"}],["rect",{width:"4",height:"6",x:"8",y:"16",rx:"1",key:"d6e7yl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z2=U("PaintbrushVertical",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v4",key:"qmzblu"}],["path",{d:"M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z",key:"ycvu00"}],["path",{d:"M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1",key:"iw4wnp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aG=U("Paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hd=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oG=U("PanelBottomClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y2=U("PanelBottomDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 15h1",key:"171nev"}],["path",{d:"M19 15h2",key:"1vnucp"}],["path",{d:"M3 15h2",key:"8bym0q"}],["path",{d:"M9 15h1",key:"1tg3ks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lG=U("PanelBottomOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cG=U("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X2=U("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q2=U("PanelLeftDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 14v1",key:"askpd8"}],["path",{d:"M9 19v2",key:"16tejx"}],["path",{d:"M9 3v2",key:"1noubl"}],["path",{d:"M9 9v1",key:"19ebxg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J2=U("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eb=U("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dG=U("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tb=U("PanelRightDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 14v1",key:"ilsfch"}],["path",{d:"M15 19v2",key:"1fst2f"}],["path",{d:"M15 3v2",key:"z204g4"}],["path",{d:"M15 9v1",key:"z2a8b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uG=U("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hG=U("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fG=U("PanelTopClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rb=U("PanelTopDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 9h1",key:"l0svgy"}],["path",{d:"M19 9h2",key:"te2zfg"}],["path",{d:"M3 9h2",key:"1h4ldw"}],["path",{d:"M9 9h1",key:"15jzuz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pG=U("PanelTopOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mG=U("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gG=U("PanelsLeftBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M9 15h12",key:"5ijen5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xG=U("PanelsRightBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h12",key:"1wkqb3"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p0=U("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yG=U("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vG=U("Parentheses",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _G=U("ParkingMeter",[["path",{d:"M11 15h2",key:"199qp6"}],["path",{d:"M12 12v3",key:"158kv8"}],["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15.282 19a1 1 0 0 0 .948-.68l2.37-6.988a7 7 0 1 0-13.2 0l2.37 6.988a1 1 0 0 0 .948.68z",key:"1jofit"}],["path",{d:"M9 9a3 3 0 1 1 6 0",key:"jdoeu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sc=U("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qh=U("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bG=U("PawPrint",[["circle",{cx:"11",cy:"4",r:"2",key:"vol9p0"}],["circle",{cx:"18",cy:"8",r:"2",key:"17gozi"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}],["path",{d:"M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z",key:"1ydw1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wG=U("PcCase",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",key:"1uq1d7"}],["path",{d:"M15 14h.01",key:"1kp3bh"}],["path",{d:"M9 6h6",key:"dgm16u"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nb=U("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jG=U("PenOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _j=U("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m0=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kG=U("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NG=U("PencilOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SG=U("PencilRuler",[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ha=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CG=U("Pentagon",[["path",{d:"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z",key:"2hea0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fS=U("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MG=U("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TG=U("PhilippinePeso",[["path",{d:"M20 11H4",key:"6ut86h"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"M7 21V4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 12H7",key:"1ana5r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AG=U("PhoneCall",[["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"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EG=U("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IG=U("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PG=U("PhoneMissed",[["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["line",{x1:"16",x2:"22",y1:"2",y2:"8",key:"13zxdn"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LG=U("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 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.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OG=U("PhoneOutgoing",[["polyline",{points:"22 8 22 2 16 2",key:"1g204g"}],["line",{x1:"16",x2:"22",y1:"8",y2:"2",key:"1ggias"}],["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ca=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DG=U("Pi",[["line",{x1:"9",x2:"9",y1:"4",y2:"20",key:"ovs5a5"}],["path",{d:"M4 7c0-1.7 1.3-3 3-3h13",key:"10pag4"}],["path",{d:"M18 20c-1.7 0-3-1.3-3-3V4",key:"1gaosr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RG=U("Piano",[["path",{d:"M18.5 8c-1.4 0-2.6-.8-3.2-2A6.87 6.87 0 0 0 2 9v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8.5C22 9.6 20.4 8 18.5 8",key:"lag0yf"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M6 14v4",key:"9ng0ue"}],["path",{d:"M10 14v4",key:"1v8uk5"}],["path",{d:"M14 14v4",key:"1tqops"}],["path",{d:"M18 14v4",key:"18uqwm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FG=U("Pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zG=U("PictureInPicture2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BG=U("PictureInPicture",[["path",{d:"M8 4.5v5H3m-1-6 6 6m13 0v-3c0-1.16-.84-2-2-2h-7m-9 9v2c0 1.05.95 2 2 2h3",key:"bcd8fb"}],["rect",{width:"10",height:"7",x:"12",y:"13.5",ry:"2",key:"136fx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $G=U("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UG=U("PilcrowLeft",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qG=U("PilcrowRight",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VG=U("Pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HG=U("PillBottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WG=U("Pill",[["path",{d:"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z",key:"wa1lgi"}],["path",{d:"m8.5 8.5 7 7",key:"rvfmvr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UT=U("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v1=U("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GG=U("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KG=U("Pizza",[["path",{d:"m12 14-1 1",key:"11onhr"}],["path",{d:"m13.75 18.25-1.25 1.42",key:"1yisr3"}],["path",{d:"M17.775 5.654a15.68 15.68 0 0 0-12.121 12.12",key:"1qtqk6"}],["path",{d:"M18.8 9.3a1 1 0 0 0 2.1 7.7",key:"fbbbr2"}],["path",{d:"M21.964 20.732a1 1 0 0 1-1.232 1.232l-18-5a1 1 0 0 1-.695-1.232A19.68 19.68 0 0 1 15.732 2.037a1 1 0 0 1 1.232.695z",key:"1hyfdd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZG=U("PlaneLanding",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z",key:"1ma21e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YG=U("PlaneTakeoff",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M6.36 17.4 4 17l-2-4 1.1-.55a2 2 0 0 1 1.8 0l.17.1a2 2 0 0 0 1.8 0L8 12 5 6l.9-.45a2 2 0 0 1 2.09.2l4.02 3a2 2 0 0 0 2.1.2l4.19-2.06a2.41 2.41 0 0 1 1.73-.17L21 7a1.4 1.4 0 0 1 .87 1.99l-.38.76c-.23.46-.6.84-1.07 1.08L7.58 17.2a2 2 0 0 1-1.22.18Z",key:"fkigj9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XG=U("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dc=U("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QG=U("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sb=U("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JG=U("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jn=U("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eK=U("PocketKnife",[["path",{d:"M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2",key:"19w3oe"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z",key:"6fykxj"}],["path",{d:"M18 11.66V22a4 4 0 0 0 4-4V6",key:"1utzek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tK=U("Pocket",[["path",{d:"M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z",key:"1mz881"}],["polyline",{points:"8 10 12 14 16 10",key:"w4mbv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rK=U("Podcast",[["path",{d:"M16.85 18.58a9 9 0 1 0-9.7 0",key:"d71mpg"}],["path",{d:"M8 14a5 5 0 1 1 8 0",key:"fc81rn"}],["circle",{cx:"12",cy:"11",r:"1",key:"1gvufo"}],["path",{d:"M13 17a1 1 0 1 0-2 0l.5 4.5a.5.5 0 1 0 1 0Z",key:"za5kbj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nK=U("PointerOff",[["path",{d:"M10 4.5V4a2 2 0 0 0-2.41-1.957",key:"jsi14n"}],["path",{d:"M13.9 8.4a2 2 0 0 0-1.26-1.295",key:"hirc7f"}],["path",{d:"M21.7 16.2A8 8 0 0 0 22 14v-3a2 2 0 1 0-4 0v-1a2 2 0 0 0-3.63-1.158",key:"1jxb2e"}],["path",{d:"m7 15-1.8-1.8a2 2 0 0 0-2.79 2.86L6 19.7a7.74 7.74 0 0 0 6 2.3h2a8 8 0 0 0 5.657-2.343",key:"10r7hm"}],["path",{d:"M6 6v8",key:"tv5xkp"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sK=U("Pointer",[["path",{d:"M22 14a8 8 0 0 1-8 8",key:"56vcr3"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1agjmk"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1",key:"wdbh2u"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10",key:"1ibuk9"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"g6ys72"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iK=U("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aK=U("Popsicle",[["path",{d:"M18.6 14.4c.8-.8.8-2 0-2.8l-8.1-8.1a4.95 4.95 0 1 0-7.1 7.1l8.1 8.1c.9.7 2.1.7 2.9-.1Z",key:"1o68ps"}],["path",{d:"m22 22-5.5-5.5",key:"17o70y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oK=U("PoundSterling",[["path",{d:"M18 7c0-5.333-8-5.333-8 0",key:"1prm2n"}],["path",{d:"M10 7v14",key:"18tmcs"}],["path",{d:"M6 21h12",key:"4dkmi1"}],["path",{d:"M6 13h10",key:"ybwr4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lK=U("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cK=U("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dK=U("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uK=U("PrinterCheck",[["path",{d:"M13.5 22H7a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v.5",key:"qeb09x"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v2",key:"1md90i"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hK=U("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fK=U("Projector",[["path",{d:"M5 7 3 5",key:"1yys58"}],["path",{d:"M9 6V3",key:"1ptz9u"}],["path",{d:"m13 7 2-2",key:"1w3vmq"}],["circle",{cx:"9",cy:"13",r:"3",key:"1mma13"}],["path",{d:"M11.83 12H20a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h2.17",key:"2frwzc"}],["path",{d:"M16 16h2",key:"dnq2od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pK=U("Proportions",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M12 9v11",key:"1fnkrn"}],["path",{d:"M2 9h13a2 2 0 0 1 2 2v9",key:"11z3ex"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mK=U("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gK=U("Pyramid",[["path",{d:"M2.5 16.88a1 1 0 0 1-.32-1.43l9-13.02a1 1 0 0 1 1.64 0l9 13.01a1 1 0 0 1-.32 1.44l-8.51 4.86a2 2 0 0 1-1.98 0Z",key:"aenxs0"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qT=U("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VT=U("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xK=U("Rabbit",[["path",{d:"M13 16a3 3 0 0 1 2.24 5",key:"1epib5"}],["path",{d:"M18 12h.01",key:"yjnet6"}],["path",{d:"M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3",key:"ue9ozu"}],["path",{d:"M20 8.54V4a2 2 0 1 0-4 0v3",key:"49iql8"}],["path",{d:"M7.612 12.524a3 3 0 1 0-1.6 4.3",key:"1e33i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yK=U("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vK=U("Radiation",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",key:"wy49g3"}],["path",{d:"M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",key:"vklnvr"}],["path",{d:"M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",key:"wkdf1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _K=U("Radical",[["path",{d:"M3 12h3.28a1 1 0 0 1 .948.684l2.298 7.934a.5.5 0 0 0 .96-.044L13.82 4.771A1 1 0 0 1 14.792 4H21",key:"1mqj8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bK=U("RadioReceiver",[["path",{d:"M5 16v2",key:"g5qcv5"}],["path",{d:"M19 16v2",key:"1gbaio"}],["rect",{width:"20",height:"8",x:"2",y:"8",rx:"2",key:"vjsjur"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wK=U("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bj=U("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jK=U("Radius",[["path",{d:"M20.34 17.52a10 10 0 1 0-2.82 2.82",key:"fydyku"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["path",{d:"m13.41 13.41 4.18 4.18",key:"1gqbwc"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kK=U("RailSymbol",[["path",{d:"M5 15h14",key:"m0yey3"}],["path",{d:"M5 9h14",key:"7tsvo6"}],["path",{d:"m14 20-5-5 6-6-5-5",key:"1jo42i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NK=U("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SK=U("Rat",[["path",{d:"M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4",key:"1wq71c"}],["path",{d:"M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3",key:"1crdmb"}],["path",{d:"M13.2 18a3 3 0 0 0-2.2-5",key:"1ol3lk"}],["path",{d:"M13 22H4a2 2 0 0 1 0-4h12",key:"bt3f23"}],["path",{d:"M16 9h.01",key:"1bdo4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CK=U("Ratio",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MK=U("ReceiptCent",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M12 6.5v11",key:"ecfhkf"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TK=U("ReceiptEuro",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 12h5",key:"1g6qi8"}],["path",{d:"M16 9.5a4 4 0 1 0 0 5.2",key:"b2px4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AK=U("ReceiptIndianRupee",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 7h8",key:"i86dvs"}],["path",{d:"M12 17.5 8 15h1a4 4 0 0 0 0-8",key:"grpkl4"}],["path",{d:"M8 11h8",key:"vwpz6n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EK=U("ReceiptJapaneseYen",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"m12 10 3-3",key:"1mc12w"}],["path",{d:"m9 7 3 3v7.5",key:"39i0xv"}],["path",{d:"M9 11h6",key:"1fldmi"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IK=U("ReceiptPoundSterling",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 13h5",key:"1k9z8w"}],["path",{d:"M10 17V9.5a2.5 2.5 0 0 1 5 0",key:"1dzgp0"}],["path",{d:"M8 17h7",key:"8mjdqu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PK=U("ReceiptRussianRuble",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 15h5",key:"vxg57a"}],["path",{d:"M8 11h5a2 2 0 1 0 0-4h-3v10",key:"1usi5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LK=U("ReceiptSwissFranc",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M10 17V7h5",key:"k7jq18"}],["path",{d:"M10 11h4",key:"1i0mka"}],["path",{d:"M8 15h5",key:"vxg57a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OK=U("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DK=U("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ib=U("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RK=U("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FK=U("RectangleVertical",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zK=U("Recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BK=U("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $K=U("RedoDot",[["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}],["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pS=U("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UK=U("RefreshCcwDot",[["path",{d:"M3 2v6h6",key:"18ldww"}],["path",{d:"M21 12A9 9 0 0 0 6 5.3L3 8",key:"1pbrqz"}],["path",{d:"M21 22v-6h-6",key:"usdfbe"}],["path",{d:"M3 12a9 9 0 0 0 15 6.7l3-2.7",key:"1hosoe"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qK=U("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VK=U("RefreshCwOff",[["path",{d:"M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47",key:"1krf6h"}],["path",{d:"M8 16H3v5",key:"1cv678"}],["path",{d:"M3 12C3 9.51 4 7.26 5.64 5.64",key:"ruvoct"}],["path",{d:"m3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64",key:"19q130"}],["path",{d:"M21 12c0 1-.16 1.97-.47 2.87",key:"4w8emr"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vl=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HK=U("Refrigerator",[["path",{d:"M5 6a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6Z",key:"fpq118"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M15 7v6",key:"1nx30x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WK=U("Regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GK=U("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KK=U("Repeat1",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}],["path",{d:"M11 10h1v4",key:"70cz1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZK=U("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HT=U("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YK=U("ReplaceAll",[["path",{d:"M14 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"1yyzbs"}],["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"zfj4xr"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a 3 3 0 0 1 3-3h1",key:"1ageje"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XK=U("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QK=U("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WT=U("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JK=U("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eZ=U("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wg=U("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tZ=U("RockingChair",[["polyline",{points:"3.5 2 6.5 12.5 18 12.5",key:"y3iy52"}],["line",{x1:"9.5",x2:"5.5",y1:"12.5",y2:"20",key:"19vg5i"}],["line",{x1:"15",x2:"18.5",y1:"12.5",y2:"20",key:"1inpmv"}],["path",{d:"M2.75 18a13 13 0 0 0 18.5 0",key:"1nquas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rZ=U("RollerCoaster",[["path",{d:"M6 19V5",key:"1r845m"}],["path",{d:"M10 19V6.8",key:"9j2tfs"}],["path",{d:"M14 19v-7.8",key:"10s8qv"}],["path",{d:"M18 5v4",key:"1tajlv"}],["path",{d:"M18 19v-6",key:"ielfq3"}],["path",{d:"M22 19V9",key:"158nzp"}],["path",{d:"M2 19V9a4 4 0 0 1 4-4c2 0 4 1.33 6 4s4 4 6 4a4 4 0 1 0-3-6.65",key:"1930oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ab=U("Rotate3d",[["path",{d:"M16.466 7.5C15.643 4.237 13.952 2 12 2 9.239 2 7 6.477 7 12s2.239 10 5 10c.342 0 .677-.069 1-.2",key:"10n0gc"}],["path",{d:"m15.194 13.707 3.814 1.86-1.86 3.814",key:"16shm9"}],["path",{d:"M19 15.57c-1.804.885-4.274 1.43-7 1.43-5.523 0-10-2.239-10-5s4.477-5 10-5c4.838 0 8.873 1.718 9.8 4",key:"1lxi77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nZ=U("RotateCcwSquare",[["path",{d:"M20 9V7a2 2 0 0 0-2-2h-6",key:"19z8uc"}],["path",{d:"m15 2-3 3 3 3",key:"177bxs"}],["path",{d:"M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2",key:"d36hnl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mS=U("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sZ=U("RotateCwSquare",[["path",{d:"M12 5H6a2 2 0 0 0-2 2v3",key:"l96uqu"}],["path",{d:"m9 8 3-3-3-3",key:"1gzgc3"}],["path",{d:"M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1w2k5h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GT=U("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iZ=U("RouteOff",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5c.4 0 .9-.1 1.3-.2",key:"1effex"}],["path",{d:"M5.2 5.2A3.5 3.53 0 0 0 6.5 12H12",key:"k9y2ds"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 15.3a3.5 3.5 0 0 0-3.3-3.3",key:"11nlu2"}],["path",{d:"M15 5h-4.3",key:"6537je"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aZ=U("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oZ=U("Router",[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ob=U("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lb=U("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lZ=U("Rows4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 7.5H3",key:"1hm9pq"}],["path",{d:"M21 12H3",key:"2avoz0"}],["path",{d:"M21 16.5H3",key:"n7jzkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cZ=U("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dZ=U("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uZ=U("RussianRuble",[["path",{d:"M6 11h8a4 4 0 0 0 0-8H9v18",key:"18ai8t"}],["path",{d:"M6 15h8",key:"1y8f6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hZ=U("Sailboat",[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fZ=U("Salad",[["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M11.38 12a2.4 2.4 0 0 1-.4-4.77 2.4 2.4 0 0 1 3.2-2.77 2.4 2.4 0 0 1 3.47-.63 2.4 2.4 0 0 1 3.37 3.37 2.4 2.4 0 0 1-1.1 3.7 2.51 2.51 0 0 1 .03 1.1",key:"10xrj0"}],["path",{d:"m13 12 4-4",key:"1hckqy"}],["path",{d:"M10.9 7.25A3.99 3.99 0 0 0 4 10c0 .73.2 1.41.54 2",key:"1p4srx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pZ=U("Sandwich",[["path",{d:"m2.37 11.223 8.372-6.777a2 2 0 0 1 2.516 0l8.371 6.777",key:"f1wd0e"}],["path",{d:"M21 15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-5.25",key:"1pfu07"}],["path",{d:"M3 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h9",key:"1oq9qw"}],["path",{d:"m6.67 15 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2",key:"1fnwu5"}],["rect",{width:"20",height:"4",x:"2",y:"11",rx:"1",key:"itshg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mZ=U("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gZ=U("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xZ=U("SaveAll",[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yZ=U("SaveOff",[["path",{d:"M13 13H8a1 1 0 0 0-1 1v7",key:"h8g396"}],["path",{d:"M14 8h1",key:"1lfen6"}],["path",{d:"M17 21v-4",key:"1yknxs"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.41 20.41A2 2 0 0 1 19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.41",key:"1t4vdl"}],["path",{d:"M29.5 11.5s5 5 4 5",key:"zzn4i6"}],["path",{d:"M9 3h6.2a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V15",key:"24cby9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jg=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cb=U("Scale3d",[["path",{d:"M5 7v11a1 1 0 0 0 1 1h11",key:"13dt1j"}],["path",{d:"M5.293 18.707 11 13",key:"ezgbsx"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vZ=U("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"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Z=U("Scaling",[["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:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bZ=U("ScanBarcode",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 7v10",key:"23sfjj"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M17 7v10",key:"578dap"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wZ=U("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jZ=U("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kZ=U("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NZ=U("ScanQrCode",[["path",{d:"M17 12v4a1 1 0 0 1-1 1h-4",key:"uk4fdo"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M17 8V7",key:"q2g9wo"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{x:"7",y:"7",width:"5",height:"5",rx:"1",key:"m9kyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZ=U("ScanSearch",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CZ=U("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MZ=U("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TZ=U("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AZ=U("ScissorsLineDashed",[["path",{d:"M5.42 9.42 8 12",key:"12pkuq"}],["circle",{cx:"4",cy:"8",r:"2",key:"107mxr"}],["path",{d:"m14 6-8.58 8.58",key:"gvzu5l"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"M10.8 14.8 14 18",key:"ax7m9r"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EZ=U("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IZ=U("ScreenShareOff",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PZ=U("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LZ=U("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OZ=U("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DZ=U("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RZ=U("SearchCode",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FZ=U("SearchSlash",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zZ=U("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _i=U("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BZ=U("Section",[["path",{d:"M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0",key:"vqan6v"}],["path",{d:"M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0",key:"wdjd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const db=U("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Z=U("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lo=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UZ=U("SeparatorHorizontal",[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qZ=U("SeparatorVertical",[["line",{x1:"12",x2:"12",y1:"3",y2:"21",key:"1efggb"}],["polyline",{points:"8 8 4 12 8 16",key:"bnfmv4"}],["polyline",{points:"16 16 20 12 16 8",key:"u90052"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VZ=U("ServerCog",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m15.7 13.4-.9-.3",key:"1jwmzr"}],["path",{d:"m9.2 10.9-.9-.3",key:"qapnim"}],["path",{d:"m10.6 15.7.3-.9",key:"quwk0k"}],["path",{d:"m13.6 15.7-.4-1",key:"cb9xp7"}],["path",{d:"m10.8 9.3-.4-1",key:"1uaiz5"}],["path",{d:"m8.3 13.6 1-.4",key:"s6srou"}],["path",{d:"m14.7 10.8 1-.4",key:"4d31cq"}],["path",{d:"m13.4 8.3-.3.9",key:"1bm987"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HZ=U("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WZ=U("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GZ=U("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KZ=U("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fd=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZZ=U("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uc=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KT=U("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YZ=U("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XZ=U("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QZ=U("ShieldAlert",[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JZ=U("ShieldBan",[["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:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZT=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eY=U("ShieldEllipsis",[["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:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tY=U("ShieldHalf",[["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:"M12 22V2",key:"zs6s6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rY=U("ShieldMinus",[["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 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nY=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sY=U("ShieldPlus",[["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 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iY=U("ShieldQuestion",[["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.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ub=U("ShieldX",[["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:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kf=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aY=U("ShipWheel",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["path",{d:"M12 2v7.5",key:"1e5rl5"}],["path",{d:"m19 5-5.23 5.23",key:"1ezxxf"}],["path",{d:"M22 12h-7.5",key:"le1719"}],["path",{d:"m19 19-5.23-5.23",key:"p3fmgn"}],["path",{d:"M12 14.5V22",key:"dgcmos"}],["path",{d:"M10.23 13.77 5 19",key:"qwopd4"}],["path",{d:"M9.5 12H2",key:"r7bup8"}],["path",{d:"M10.23 10.23 5 5",key:"k2y7lj"}],["circle",{cx:"12",cy:"12",r:"2.5",key:"ix0uyj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oY=U("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lY=U("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kg=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cY=U("ShoppingBasket",[["path",{d:"m15 11-1 9",key:"5wnq3a"}],["path",{d:"m19 11-4-7",key:"cnml18"}],["path",{d:"M2 11h20",key:"3eubbj"}],["path",{d:"m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4",key:"yiazzp"}],["path",{d:"M4.5 15.5h15",key:"13mye1"}],["path",{d:"m5 11 4-7",key:"116ra9"}],["path",{d:"m9 11 1 9",key:"1ojof7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hh=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dY=U("Shovel",[["path",{d:"M2 22v-5l5-5 5 5-5 5z",key:"1fh25c"}],["path",{d:"M9.5 14.5 16 8",key:"1smz5x"}],["path",{d:"m17 2 5 5-.5.5a3.53 3.53 0 0 1-5 0s0 0 0 0a3.53 3.53 0 0 1 0-5L17 2",key:"1q8uv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uY=U("ShowerHead",[["path",{d:"m4 4 2.5 2.5",key:"uv2vmf"}],["path",{d:"M13.5 6.5a4.95 4.95 0 0 0-7 7",key:"frdkwv"}],["path",{d:"M15 5 5 15",key:"1ag8rq"}],["path",{d:"M14 17v.01",key:"eokfpp"}],["path",{d:"M10 16v.01",key:"14uyyl"}],["path",{d:"M13 13v.01",key:"1v1k97"}],["path",{d:"M16 10v.01",key:"5169yg"}],["path",{d:"M11 20v.01",key:"cj92p8"}],["path",{d:"M17 14v.01",key:"11cswd"}],["path",{d:"M20 11v.01",key:"19e0od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hY=U("Shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fY=U("Shrub",[["path",{d:"M12 22v-7l-2-2",key:"eqv9mc"}],["path",{d:"M17 8v.8A6 6 0 0 1 13.8 20H10A6.5 6.5 0 0 1 7 8a5 5 0 0 1 10 0Z",key:"ubcgy"}],["path",{d:"m14 14-2 2",key:"847xa2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pY=U("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mY=U("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gY=U("SignalHigh",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xY=U("SignalLow",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yY=U("SignalMedium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vY=U("SignalZero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Y=U("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bY=U("Signature",[["path",{d:"m21 17-2.156-1.868A.5.5 0 0 0 18 15.5v.5a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1c0-2.545-3.991-3.97-8.5-4a1 1 0 0 0 0 5c4.153 0 4.745-11.295 5.708-13.5a2.5 2.5 0 1 1 3.31 3.284",key:"y32ogt"}],["path",{d:"M3 21h18",key:"itz85i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wY=U("SignpostBig",[["path",{d:"M10 9H4L2 7l2-2h6",key:"1hq7x2"}],["path",{d:"M14 5h6l2 2-2 2h-6",key:"bv62ej"}],["path",{d:"M10 22V4a2 2 0 1 1 4 0v18",key:"eqpcf2"}],["path",{d:"M8 22h8",key:"rmew8v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jY=U("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kY=U("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NY=U("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SY=U("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CY=U("Skull",[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MY=U("Slack",[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TY=U("Slash",[["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AY=U("Slice",[["path",{d:"M11 16.586V19a1 1 0 0 1-1 1H2L18.37 3.63a1 1 0 1 1 3 3l-9.663 9.663a1 1 0 0 1-1.414 0L8 14",key:"1sllp5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YT=U("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hb=U("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EY=U("SmartphoneCharging",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12.667 8 10 12h4l-2.667 4",key:"h9lk2d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IY=U("SmartphoneNfc",[["rect",{width:"7",height:"12",x:"2",y:"6",rx:"1",key:"5nje8w"}],["path",{d:"M13 8.32a7.43 7.43 0 0 1 0 7.36",key:"1g306n"}],["path",{d:"M16.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"uqvjvo"}],["path",{d:"M19.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"ujntz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xm=U("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PY=U("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["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"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LY=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OY=U("Snail",[["path",{d:"M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0",key:"hneq2s"}],["circle",{cx:"10",cy:"13",r:"8",key:"194lz3"}],["path",{d:"M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6",key:"ixqyt7"}],["path",{d:"M18 3 19.1 5.2",key:"9tjm43"}],["path",{d:"M22 3 20.9 5.2",key:"j3odrs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q0=U("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DY=U("Sofa",[["path",{d:"M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3",key:"1dgpiv"}],["path",{d:"M2 16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"xacw8m"}],["path",{d:"M4 18v2",key:"jwo5n2"}],["path",{d:"M20 18v2",key:"1ar1qi"}],["path",{d:"M12 4v9",key:"oqhhn3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RY=U("Soup",[["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M19.5 12 22 6",key:"shfsr5"}],["path",{d:"M16.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.73 1.62",key:"rpc6vp"}],["path",{d:"M11.25 3c.27.1.8.53.74 1.36-.05.83-.93 1.2-.98 2.02-.06.78.33 1.24.72 1.62",key:"1lf63m"}],["path",{d:"M6.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.74 1.62",key:"97tijn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FY=U("Space",[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zY=U("Spade",[["path",{d:"M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z",key:"40bo9n"}],["path",{d:"M12 18v4",key:"jadmvz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BY=U("Sparkle",[["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cs=U("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Y=U("Speaker",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["circle",{cx:"12",cy:"14",r:"4",key:"1jruaj"}],["path",{d:"M12 14h.01",key:"1etili"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UY=U("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qY=U("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VY=U("SpellCheck",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HY=U("Spline",[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WY=U("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GY=U("SprayCan",[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KY=U("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fb=U("SquareActivity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pb=U("SquareArrowDownLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 8-8 8",key:"166keh"}],["path",{d:"M16 16H8V8",key:"1w2ppm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mb=U("SquareArrowDownRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"M16 8v8H8",key:"1lbpgo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gb=U("SquareArrowDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xb=U("SquareArrowLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}],["path",{d:"M16 12H8",key:"1fr5h0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yb=U("SquareArrowOutDownLeft",[["path",{d:"M13 21h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6",key:"14qz4y"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vb=U("SquareArrowOutDownRight",[["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}],["path",{d:"m21 21-9-9",key:"1et2py"}],["path",{d:"M21 15v6h-6",key:"1jko0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _b=U("SquareArrowOutUpLeft",[["path",{d:"M13 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6",key:"14mv1t"}],["path",{d:"m3 3 9 9",key:"rks13r"}],["path",{d:"M3 9V3h6",key:"ira0h2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bb=U("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wb=U("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jb=U("SquareArrowUpLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8h8",key:"19xb1h"}],["path",{d:"M16 16 8 8",key:"1qdy8n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kb=U("SquareArrowUpRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nb=U("SquareArrowUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sb=U("SquareAsterisk",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8.5 14 7-4",key:"12hpby"}],["path",{d:"m8.5 10 7 4",key:"wwy2dy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cb=U("SquareBottomDashedScissors",[["path",{d:"M4 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2",key:"1vzg26"}],["path",{d:"M10 22H8",key:"euku7a"}],["path",{d:"M16 22h-2",key:"18d249"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jm=U("SquareChartGantt",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g0=U("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mb=U("SquareCheck",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tb=U("SquareChevronDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ab=U("SquareChevronLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eb=U("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ib=U("SquareChevronUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pb=U("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZY=U("SquareDashedBottomCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YY=U("SquareDashedBottom",[["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lb=U("SquareDashedKanban",[["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ob=U("SquareDashedMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Db=U("SquareDashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rb=U("SquareDivide",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fb=U("SquareDot",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zb=U("SquareEqual",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bb=U("SquareFunction",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $b=U("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ub=U("SquareLibrary",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7v10",key:"d5nglc"}],["path",{d:"M11 7v10",key:"pptsnr"}],["path",{d:"m15 7 2 10",key:"1m7qm5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qb=U("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vb=U("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hb=U("SquareMinus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wb=U("SquareMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=U("SquareParkingOff",[["path",{d:"M3.6 3.6A2 2 0 0 1 5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-.59 1.41",key:"9l1ft6"}],["path",{d:"M3 8.7V19a2 2 0 0 0 2 2h10.3",key:"17knke"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.3",key:"1jxgo2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kb=U("SquareParking",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rc=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zb=U("SquarePercent",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=U("SquarePi",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h10",key:"udp07y"}],["path",{d:"M10 7v10",key:"i1d9ee"}],["path",{d:"M16 17a2 2 0 0 1-2-2V7",key:"ftwdc7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=U("SquarePilcrow",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 12H9.5a2.5 2.5 0 0 1 0-5H17",key:"1l9586"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M16 7v10",key:"lavkr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qb=U("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jb=U("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ew=U("SquarePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XY=U("SquareRadical",[["path",{d:"M7 12h2l2 5 2-10h4",key:"1fxv6h"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tw=U("SquareScissors",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"2",key:"1btzen"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rw=U("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nw=U("SquareSlash",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sw=U("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iw=U("SquareSplitVertical",[["path",{d:"M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3",key:"1pi83i"}],["path",{d:"M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3",key:"ido5k7"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QY=U("SquareSquare",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JY=U("SquareStack",[["path",{d:"M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"4i38lg"}],["path",{d:"M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"mlte4a"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aw=U("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ow=U("SquareUserRound",[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lw=U("SquareUser",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 21v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1m6ac2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cw=U("SquareX",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ym=U("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eX=U("Squircle",[["path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9",key:"garfkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tX=U("Squirrel",[["path",{d:"M15.236 22a3 3 0 0 0-2.2-5",key:"21bitc"}],["path",{d:"M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4",key:"oh0fg0"}],["path",{d:"M18 13h.01",key:"9veqaj"}],["path",{d:"M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10",key:"980v8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rX=U("Stamp",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nX=U("StarHalf",[["path",{d:"M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2",key:"2ksp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sX=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vs=U("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iX=U("StepBack",[["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["polygon",{points:"14,20 4,12 14,4",key:"ypakod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aX=U("StepForward",[["line",{x1:"6",x2:"6",y1:"4",y2:"20",key:"fy8qot"}],["polygon",{points:"10,4 20,12 10,20",key:"1mc1pf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oX=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lX=U("Sticker",[["path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z",key:"1wis1t"}],["path",{d:"M14 3v4a2 2 0 0 0 2 2h4",key:"36rjfy"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cX=U("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dX=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uX=U("StretchHorizontal",[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hX=U("StretchVertical",[["rect",{width:"6",height:"20",x:"4",y:"2",rx:"2",key:"19qu7m"}],["rect",{width:"6",height:"20",x:"14",y:"2",rx:"2",key:"24v0nk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fX=U("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pX=U("Subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mX=U("SunDim",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gX=U("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xX=U("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yX=U("SunSnow",[["path",{d:"M10 9a3 3 0 1 0 0 6",key:"6zmtdl"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M14 21V3",key:"1llu3z"}],["path",{d:"M10 4V3",key:"pkzwkn"}],["path",{d:"M10 21v-1",key:"1u8rkd"}],["path",{d:"m3.64 18.36.7-.7",key:"105rm9"}],["path",{d:"m4.34 6.34-.7-.7",key:"d3unjp"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 4-3 3",key:"15jcng"}],["path",{d:"m14 17 3 3",key:"6tlq38"}],["path",{d:"m21 15-3-3 3-3",key:"1nlnje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _1=U("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vX=U("Sunrise",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _X=U("Sunset",[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bX=U("Superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wX=U("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h.01",key:"1euzgo"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jX=U("SwissFranc",[["path",{d:"M10 21V3h8",key:"br2l0g"}],["path",{d:"M6 16h9",key:"2py0wn"}],["path",{d:"M10 9.5h7",key:"13dmhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kX=U("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NX=U("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SX=U("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CX=U("Syringe",[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XT=U("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MX=U("TableCellsMerge",[["path",{d:"M12 21v-6",key:"lihzve"}],["path",{d:"M12 9V3",key:"da5inc"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TX=U("TableCellsSplit",[["path",{d:"M12 15V9",key:"8c7uyn"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AX=U("TableColumnsSplit",[["path",{d:"M14 14v2",key:"w2a1xv"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M14 8v2",key:"i67w9a"}],["path",{d:"M2 15h8",key:"82wtch"}],["path",{d:"M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2",key:"up0l64"}],["path",{d:"M2 9h8",key:"yelfik"}],["path",{d:"M22 15h-4",key:"1es58f"}],["path",{d:"M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"pdjoqf"}],["path",{d:"M22 9h-4",key:"1luja7"}],["path",{d:"M5 3v18",key:"14hmio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EX=U("TableOfContents",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M21 12h.01",key:"msek7k"}],["path",{d:"M21 18h.01",key:"1e8rq1"}],["path",{d:"M21 6h.01",key:"1koanj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IX=U("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PX=U("TableRowsSplit",[["path",{d:"M14 10h2",key:"1lstlu"}],["path",{d:"M15 22v-8",key:"1fwwgm"}],["path",{d:"M15 2v4",key:"1044rn"}],["path",{d:"M2 10h2",key:"1r8dkt"}],["path",{d:"M20 10h2",key:"1ug425"}],["path",{d:"M3 19h18",key:"awlh7x"}],["path",{d:"M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6",key:"ibqhof"}],["path",{d:"M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2",key:"1uenja"}],["path",{d:"M8 10h2",key:"66od0"}],["path",{d:"M9 22v-8",key:"fmnu31"}],["path",{d:"M9 2v4",key:"j1yeou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LX=U("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OX=U("TabletSmartphone",[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DX=U("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RX=U("Tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gx=U("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FX=U("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zX=U("Tally1",[["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BX=U("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $X=U("Tally3",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UX=U("Tally4",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qX=U("Tally5",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}],["path",{d:"M22 6 2 18",key:"h9moai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VX=U("Tangent",[["circle",{cx:"17",cy:"4",r:"2",key:"y5j2s2"}],["path",{d:"M15.59 5.41 5.41 15.59",key:"l0vprr"}],["circle",{cx:"4",cy:"17",r:"2",key:"9p4efm"}],["path",{d:"M12 22s-4-9-1.5-11.5S22 12 22 12",key:"1twk4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kx=U("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HX=U("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WX=U("TentTree",[["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}],["path",{d:"m14 5 3-3 3 3",key:"1sorif"}],["path",{d:"m14 10 3-3 3 3",key:"1jyi9h"}],["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M17 14H7l-5 8h20Z",key:"13ar7p"}],["path",{d:"M8 14v8",key:"1ghmqk"}],["path",{d:"m9 14 5 8",key:"13pgi6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GX=U("Tent",[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KX=U("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dw=U("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZX=U("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YX=U("TestTubes",[["path",{d:"M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",key:"1hjrqt"}],["path",{d:"M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2",key:"16lc8n"}],["path",{d:"M3 2h7",key:"7s29d5"}],["path",{d:"M14 2h7",key:"7sicin"}],["path",{d:"M9 16H4",key:"1bfye3"}],["path",{d:"M20 16h-5",key:"ddnjpe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XX=U("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QX=U("TextCursor",[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JX=U("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eQ=U("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uw=U("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tQ=U("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rQ=U("Theater",[["path",{d:"M2 10s3-3 3-8",key:"3xiif0"}],["path",{d:"M22 10s-3-3-3-8",key:"ioaa5q"}],["path",{d:"M10 2c0 4.4-3.6 8-8 8",key:"16fkpi"}],["path",{d:"M14 2c0 4.4 3.6 8 8 8",key:"b9eulq"}],["path",{d:"M2 10s2 2 2 5",key:"1au1lb"}],["path",{d:"M22 10s-2 2-2 5",key:"qi2y5e"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M2 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"1vsc2m"}],["path",{d:"M14 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"hrha4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nQ=U("ThermometerSnowflake",[["path",{d:"M2 12h10",key:"19562f"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"m3 9 3 3-3 3",key:"1sas0l"}],["path",{d:"M12 6 9 9 6 6",key:"pfrgxu"}],["path",{d:"m6 18 3-3 1.5 1.5",key:"1e277p"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sQ=U("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iQ=U("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QT=U("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pd=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aQ=U("TicketCheck",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oQ=U("TicketMinus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lQ=U("TicketPercent",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cQ=U("TicketPlus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dQ=U("TicketSlash",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uQ=U("TicketX",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JT=U("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hQ=U("TicketsPlane",[["path",{d:"M10.5 17h1.227a2 2 0 0 0 1.345-.52L18 12",key:"16muxl"}],["path",{d:"m12 13.5 3.75.5",key:"1i9qhk"}],["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fQ=U("Tickets",[["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pQ=U("TimerOff",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mQ=U("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gQ=U("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xQ=U("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yQ=U("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vQ=U("Toilet",[["path",{d:"M7 12h13a1 1 0 0 1 1 1 5 5 0 0 1-5 5h-.598a.5.5 0 0 0-.424.765l1.544 2.47a.5.5 0 0 1-.424.765H5.402a.5.5 0 0 1-.424-.765L7 18",key:"kc4kqr"}],["path",{d:"M8 18a5 5 0 0 1-5-5V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8",key:"1tqs57"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Q=U("Tornado",[["path",{d:"M21 4H3",key:"1hwok0"}],["path",{d:"M18 8H6",key:"41n648"}],["path",{d:"M19 12H9",key:"1g4lpz"}],["path",{d:"M16 16h-6",key:"1j5d54"}],["path",{d:"M11 20H9",key:"39obr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bQ=U("Torus",[["ellipse",{cx:"12",cy:"11",rx:"3",ry:"2",key:"1b2qxu"}],["ellipse",{cx:"12",cy:"12.5",rx:"10",ry:"8.5",key:"h8emeu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wQ=U("TouchpadOff",[["path",{d:"M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16",key:"lnt0bk"}],["path",{d:"M2 14h12",key:"d8icqz"}],["path",{d:"M22 14h-2",key:"jrx26d"}],["path",{d:"M12 20v-6",key:"1rm09r"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M22 16V6a2 2 0 0 0-2-2H10",key:"11y8e4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jQ=U("Touchpad",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kQ=U("TowerControl",[["path",{d:"M18.2 12.27 20 6H4l1.8 6.27a1 1 0 0 0 .95.73h10.5a1 1 0 0 0 .96-.73Z",key:"1pledb"}],["path",{d:"M8 13v9",key:"hmv0ci"}],["path",{d:"M16 22v-9",key:"ylnf1u"}],["path",{d:"m9 6 1 7",key:"dpdgam"}],["path",{d:"m15 6-1 7",key:"ls7zgu"}],["path",{d:"M12 6V2",key:"1pj48d"}],["path",{d:"M13 2h-2",key:"mj6ths"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NQ=U("ToyBrick",[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SQ=U("Tractor",[["path",{d:"m10 11 11 .9a1 1 0 0 1 .8 1.1l-.665 4.158a1 1 0 0 1-.988.842H20",key:"she1j9"}],["path",{d:"M16 18h-5",key:"bq60fd"}],["path",{d:"M18 5a1 1 0 0 0-1 1v5.573",key:"1kv8ia"}],["path",{d:"M3 4h8.129a1 1 0 0 1 .99.863L13 11.246",key:"1q1ert"}],["path",{d:"M4 11V4",key:"9ft8pt"}],["path",{d:"M7 15h.01",key:"k5ht0j"}],["path",{d:"M8 10.1V4",key:"1jgyzo"}],["circle",{cx:"18",cy:"18",r:"2",key:"1emm8v"}],["circle",{cx:"7",cy:"15",r:"5",key:"ddtuc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CQ=U("TrafficCone",[["path",{d:"M9.3 6.2a4.55 4.55 0 0 0 5.4 0",key:"flyxqv"}],["path",{d:"M7.9 10.7c.9.8 2.4 1.3 4.1 1.3s3.2-.5 4.1-1.3",key:"1nlxxg"}],["path",{d:"M13.9 3.5a1.93 1.93 0 0 0-3.8-.1l-3 10c-.1.2-.1.4-.1.6 0 1.7 2.2 3 5 3s5-1.3 5-3c0-.2 0-.4-.1-.5Z",key:"vz7x1l"}],["path",{d:"m7.5 12.2-4.7 2.7c-.5.3-.8.7-.8 1.1s.3.8.8 1.1l7.6 4.5c.9.5 2.1.5 3 0l7.6-4.5c.7-.3 1-.7 1-1.1s-.3-.8-.8-1.1l-4.7-2.8",key:"1xfzlw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MQ=U("TrainFrontTunnel",[["path",{d:"M2 22V12a10 10 0 1 1 20 0v10",key:"o0fyp0"}],["path",{d:"M15 6.8v1.4a3 2.8 0 1 1-6 0V6.8",key:"m8q3n9"}],["path",{d:"M10 15h.01",key:"44in9x"}],["path",{d:"M14 15h.01",key:"5mohn5"}],["path",{d:"M10 19a4 4 0 0 1-4-4v-3a6 6 0 1 1 12 0v3a4 4 0 0 1-4 4Z",key:"hckbmu"}],["path",{d:"m9 19-2 3",key:"iij7hm"}],["path",{d:"m15 19 2 3",key:"npx8sa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TQ=U("TrainFront",[["path",{d:"M8 3.1V7a4 4 0 0 0 8 0V3.1",key:"1v71zp"}],["path",{d:"m9 15-1-1",key:"1yrq24"}],["path",{d:"m15 15 1-1",key:"1t0d6s"}],["path",{d:"M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5Z",key:"1p0hjs"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m16 19 2 3",key:"xo31yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AQ=U("TrainTrack",[["path",{d:"M2 17 17 2",key:"18b09t"}],["path",{d:"m2 14 8 8",key:"1gv9hu"}],["path",{d:"m5 11 8 8",key:"189pqp"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"m11 5 8 8",key:"ummqn6"}],["path",{d:"m14 2 8 8",key:"1vk7dn"}],["path",{d:"M7 22 22 7",key:"15mb1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hw=U("TramFront",[["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m18 22-2-3",key:"1p0ohu"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zn=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EQ=U("Trash",[["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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IQ=U("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fw=U("TreePalm",[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b1=U("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PQ=U("Trees",[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LQ=U("Trello",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["rect",{width:"3",height:"9",x:"7",y:"7",key:"14n3xi"}],["rect",{width:"3",height:"5",x:"14",y:"7",key:"s4azjd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w1=U("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OQ=U("TrendingUpDown",[["path",{d:"M14.828 14.828 21 21",key:"ar5fw7"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"m21 3-9 9-4-4-6 6",key:"1h02xo"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zf=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bh=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DQ=U("TriangleRight",[["path",{d:"M22 18a2 2 0 0 1-2 2H3c-1.1 0-1.3-.6-.4-1.3L20.4 4.3c.9-.7 1.6-.4 1.6.7Z",key:"183wce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RQ=U("Triangle",[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wa=U("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eA=U("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FQ=U("Turtle",[["path",{d:"m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z",key:"1lbbv7"}],["path",{d:"M4.82 7.9 8 10",key:"m9wose"}],["path",{d:"M15.18 7.9 12 10",key:"p8dp2u"}],["path",{d:"M16.93 10H20a2 2 0 0 1 0 4H2",key:"12nsm7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zQ=U("TvMinimalPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pw=U("TvMinimal",[["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BQ=U("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Q=U("Twitch",[["path",{d:"M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7",key:"c0yzno"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UQ=U("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qQ=U("TypeOutline",[["path",{d:"M14 16.5a.5.5 0 0 0 .5.5h.5a2 2 0 0 1 0 4H9a2 2 0 0 1 0-4h.5a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5V8a2 2 0 0 1-4 0V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3a2 2 0 0 1-4 0v-.5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z",key:"1reda3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VQ=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HQ=U("UmbrellaOff",[["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"M15.5 21a1.85 1.85 0 0 1-3.5-1v-8H2a10 10 0 0 1 3.428-6.575",key:"eki10q"}],["path",{d:"M17.5 12H22A10 10 0 0 0 9.004 3.455",key:"n2ayka"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WQ=U("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GQ=U("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KQ=U("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZQ=U("UndoDot",[["path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13",key:"8mp6z9"}],["path",{d:"M3 7v6h6",key:"1v2h90"}],["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gS=U("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YQ=U("UnfoldHorizontal",[["path",{d:"M16 12h6",key:"15xry1"}],["path",{d:"M8 12H2",key:"1jqql6"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 15 3-3-3-3",key:"wjy7rq"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XQ=U("UnfoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QQ=U("Ungroup",[["rect",{width:"8",height:"6",x:"5",y:"4",rx:"1",key:"nzclkv"}],["rect",{width:"8",height:"6",x:"11",y:"14",rx:"1",key:"4tytwb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mw=U("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JQ=U("Unlink2",[["path",{d:"M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",key:"1re2ne"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tA=U("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eJ=U("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const no=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tJ=U("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wj=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rA=U("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rJ=U("UserMinus",[["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:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nJ=U("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jh=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gw=U("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xw=U("UserRoundCog",[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yw=U("UserRoundMinus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sJ=U("UserRoundPen",[["path",{d:"M2 21a8 8 0 0 1 10.821-7.487",key:"1c8h7z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vw=U("UserRoundPlus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iJ=U("UserRoundSearch",[["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.9-1.9",key:"1e5ubv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _w=U("UserRoundX",[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bw=U("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aJ=U("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oJ=U("UserX",[["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:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cc=U("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ww=U("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vn=U("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jw=U("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kw=U("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lJ=U("UtilityPole",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M3 3v2",key:"9imdir"}],["path",{d:"M7 3v2",key:"n0os7"}],["path",{d:"M17 3v2",key:"1l2re6"}],["path",{d:"M21 3v2",key:"1duuac"}],["path",{d:"m19 5-7 7-7-7",key:"133zxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nA=U("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cJ=U("Vault",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["path",{d:"m7.9 7.9 2.7 2.7",key:"hpeyl3"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}],["path",{d:"m13.4 10.6 2.7-2.7",key:"264c1n"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["path",{d:"m7.9 16.1 2.7-2.7",key:"p81g5e"}],["circle",{cx:"16.5",cy:"16.5",r:".5",fill:"currentColor",key:"fubopw"}],["path",{d:"m13.4 13.4 2.7 2.7",key:"abhel3"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dJ=U("Vegan",[["path",{d:"M16 8q6 0 6-6-6 0-6 6",key:"qsyyc4"}],["path",{d:"M17.41 3.59a10 10 0 1 0 3 3",key:"41m9h7"}],["path",{d:"M2 2a26.6 26.6 0 0 1 10 20c.9-6.82 1.5-9.5 4-14",key:"qiv7li"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uJ=U("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hJ=U("VibrateOff",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["path",{d:"M8 8v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2",key:"1hbad5"}],["path",{d:"M16 10.34V6c0-.55-.45-1-1-1h-4.34",key:"1x5tf0"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fJ=U("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pJ=U("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fi=U("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"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mJ=U("Videotape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 8h20",key:"d11cs7"}],["circle",{cx:"8",cy:"14",r:"2",key:"1k2qr5"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"14",r:"2",key:"14k7lr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gJ=U("View",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xJ=U("Voicemail",[["circle",{cx:"6",cy:"12",r:"4",key:"1ehtga"}],["circle",{cx:"18",cy:"12",r:"4",key:"4vafl8"}],["line",{x1:"6",x2:"18",y1:"16",y2:"16",key:"pmt8us"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yJ=U("Volleyball",[["path",{d:"M11.1 7.1a16.55 16.55 0 0 1 10.9 4",key:"2880wi"}],["path",{d:"M12 12a12.6 12.6 0 0 1-8.7 5",key:"113sja"}],["path",{d:"M16.8 13.6a16.55 16.55 0 0 1-9 7.5",key:"1qmsgl"}],["path",{d:"M20.7 17a12.8 12.8 0 0 0-8.7-5 13.3 13.3 0 0 1 0-10",key:"1bmeqp"}],["path",{d:"M6.3 3.8a16.55 16.55 0 0 0 1.9 11.5",key:"iekzv9"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vJ=U("Volume1",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _J=U("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bJ=U("VolumeOff",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wJ=U("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jJ=U("Volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kJ=U("Vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NJ=U("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nw=U("WalletMinimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SJ=U("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CJ=U("Wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sw=U("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MJ=U("Wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TJ=U("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AJ=U("WashingMachine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EJ=U("Watch",[["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["polyline",{points:"12 10 12 12 13 13",key:"19dquz"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IJ=U("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PJ=U("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LJ=U("Webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OJ=U("WebhookOff",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DJ=U("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RJ=U("Weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FJ=U("WheatOff",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zJ=U("Wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BJ=U("WholeWord",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $J=U("WifiHigh",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UJ=U("WifiLow",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qJ=U("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VJ=U("WifiZero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HJ=U("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WJ=U("WindArrowDown",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GJ=U("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KJ=U("WineOff",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZJ=U("Wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YJ=U("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XJ=U("Worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QJ=U("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zx=U("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bs=U("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JJ=U("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eee=U("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ng=U("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xS=U("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yS=U("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:y8,AArrowUp:v8,ALargeSmall:_8,Accessibility:b8,Activity:yg,AirVent:w8,Airplay:j8,AlarmClock:N8,AlarmClockCheck:p_,AlarmClockMinus:m_,AlarmClockOff:k8,AlarmClockPlus:g_,AlarmSmoke:S8,Album:C8,AlignCenter:Y4,AlignCenterHorizontal:M8,AlignCenterVertical:T8,AlignEndHorizontal:A8,AlignEndVertical:E8,AlignHorizontalDistributeCenter:I8,AlignHorizontalDistributeEnd:P8,AlignHorizontalDistributeStart:L8,AlignHorizontalJustifyCenter:O8,AlignHorizontalJustifyEnd:D8,AlignHorizontalJustifyStart:R8,AlignHorizontalSpaceAround:F8,AlignHorizontalSpaceBetween:z8,AlignJustify:B8,AlignLeft:X4,AlignRight:Q4,AlignStartHorizontal:$8,AlignStartVertical:U8,AlignVerticalDistributeCenter:q8,AlignVerticalDistributeEnd:V8,AlignVerticalDistributeStart:H8,AlignVerticalJustifyCenter:W8,AlignVerticalJustifyEnd:G8,AlignVerticalJustifyStart:K8,AlignVerticalSpaceAround:Z8,AlignVerticalSpaceBetween:Y8,Ambulance:X8,Ampersand:Q8,Ampersands:J8,Amphora:eO,Anchor:tO,Angry:rO,Annoyed:nO,Antenna:sO,Anvil:iO,Aperture:aO,AppWindow:MT,AppWindowMac:oO,Apple:lO,Archive:uO,ArchiveRestore:cO,ArchiveX:dO,Armchair:hO,ArrowBigDown:pO,ArrowBigDownDash:fO,ArrowBigLeft:gO,ArrowBigLeftDash:mO,ArrowBigRight:yO,ArrowBigRightDash:xO,ArrowBigUp:_O,ArrowBigUpDash:vO,ArrowDown:i1,ArrowDown01:bO,ArrowDown10:wO,ArrowDownAZ:x_,ArrowDownFromLine:jO,ArrowDownLeft:kO,ArrowDownNarrowWide:NO,ArrowDownRight:SO,ArrowDownToDot:CO,ArrowDownToLine:MO,ArrowDownUp:TO,ArrowDownWideNarrow:y_,ArrowDownZA:v_,ArrowLeft:Qa,ArrowLeftFromLine:AO,ArrowLeftRight:EO,ArrowLeftToLine:IO,ArrowRight:Zo,ArrowRightFromLine:PO,ArrowRightLeft:LO,ArrowRightToLine:OO,ArrowUp:vg,ArrowUp01:DO,ArrowUp10:RO,ArrowUpAZ:__,ArrowUpDown:$x,ArrowUpFromDot:FO,ArrowUpFromLine:zO,ArrowUpLeft:BO,ArrowUpNarrowWide:b_,ArrowUpRight:$O,ArrowUpToLine:UO,ArrowUpWideNarrow:qO,ArrowUpZA:w_,ArrowsUpFromLine:VO,Asterisk:HO,AtSign:WO,Atom:GO,AudioLines:KO,AudioWaveform:ZO,Award:Pl,Axe:YO,Axis3d:j_,Baby:XO,Backpack:QO,Badge:pD,BadgeAlert:JO,BadgeCent:eD,BadgeCheck:k_,BadgeDollarSign:tD,BadgeEuro:rD,BadgeHelp:nD,BadgeIndianRupee:sD,BadgeInfo:iD,BadgeJapaneseYen:aD,BadgeMinus:oD,BadgePercent:lD,BadgePlus:cD,BadgePoundSterling:dD,BadgeRussianRuble:uD,BadgeSwissFranc:hD,BadgeX:fD,BaggageClaim:mD,Ban:gD,Banana:xD,Bandage:yD,Banknote:vD,Barcode:_D,Baseline:bD,Bath:Vf,Battery:CD,BatteryCharging:wD,BatteryFull:jD,BatteryLow:kD,BatteryMedium:ND,BatteryWarning:SD,Beaker:MD,Bean:AD,BeanOff:TD,Bed:Hf,BedDouble:ED,BedSingle:ID,Beef:PD,Beer:OD,BeerOff:LD,Bell:_g,BellDot:DD,BellElectric:RD,BellMinus:FD,BellOff:cj,BellPlus:zD,BellRing:BD,BetweenHorizontalEnd:N_,BetweenHorizontalStart:S_,BetweenVerticalEnd:$D,BetweenVerticalStart:UD,BicepsFlexed:qD,Bike:VD,Binary:HD,Binoculars:WD,Biohazard:GD,Bird:KD,Bitcoin:ZD,Blend:YD,Blinds:XD,Blocks:QD,Bluetooth:rR,BluetoothConnected:JD,BluetoothOff:eR,BluetoothSearching:tR,Bold:J4,Bolt:nR,Bomb:sR,Bone:iR,Book:CR,BookA:aR,BookAudio:oR,BookCheck:lR,BookCopy:cR,BookDashed:C_,BookDown:dR,BookHeadphones:uR,BookHeart:hR,BookImage:fR,BookKey:pR,BookLock:mR,BookMarked:gR,BookMinus:xR,BookOpen:TT,BookOpenCheck:yR,BookOpenText:vR,BookPlus:_R,BookText:bR,BookType:wR,BookUp:kR,BookUp2:jR,BookUser:NR,BookX:SR,Bookmark:um,BookmarkCheck:MR,BookmarkMinus:TR,BookmarkPlus:AR,BookmarkX:ER,BoomBox:IR,Bot:eS,BotMessageSquare:PR,BotOff:LR,Box:OR,Boxes:DR,Braces:M_,Brackets:RR,Brain:AT,BrainCircuit:FR,BrainCog:zR,BrickWall:BR,Briefcase:yh,BriefcaseBusiness:$R,BriefcaseConveyorBelt:UR,BriefcaseMedical:qR,BringToFront:VR,Brush:HR,Bug:KR,BugOff:WR,BugPlay:GR,Building:dj,Building2:na,Bus:YR,BusFront:ZR,Cable:QR,CableCar:XR,Cake:Kh,CakeSlice:JR,Calculator:eF,Calendar:zs,Calendar1:tF,CalendarArrowDown:rF,CalendarArrowUp:nF,CalendarCheck:iF,CalendarCheck2:sF,CalendarClock:aF,CalendarCog:oF,CalendarDays:hm,CalendarFold:lF,CalendarHeart:cF,CalendarMinus:uF,CalendarMinus2:dF,CalendarOff:hF,CalendarPlus:uj,CalendarPlus2:fF,CalendarRange:pF,CalendarSearch:mF,CalendarSync:gF,CalendarX:yF,CalendarX2:xF,Camera:bg,CameraOff:vF,Candy:wF,CandyCane:_F,CandyOff:bF,Cannabis:jF,Captions:T_,CaptionsOff:kF,Car:CF,CarFront:NF,CarTaxiFront:SF,Caravan:MF,Carrot:TF,CaseLower:AF,CaseSensitive:EF,CaseUpper:IF,CassetteTape:PF,Cast:LF,Castle:OF,Cat:DF,Cctv:RF,ChartArea:A_,ChartBar:I_,ChartBarBig:E_,ChartBarDecreasing:FF,ChartBarIncreasing:zF,ChartBarStacked:BF,ChartCandlestick:P_,ChartColumn:ac,ChartColumnBig:L_,ChartColumnDecreasing:$F,ChartColumnIncreasing:O_,ChartColumnStacked:UF,ChartGantt:qF,ChartLine:D_,ChartNetwork:VF,ChartNoAxesColumn:F_,ChartNoAxesColumnDecreasing:HF,ChartNoAxesColumnIncreasing:R_,ChartNoAxesCombined:WF,ChartNoAxesGantt:z_,ChartPie:B_,ChartScatter:$_,ChartSpline:GF,Check:Ca,CheckCheck:KF,ChefHat:ZF,Cherry:YF,ChevronDown:Pu,ChevronFirst:XF,ChevronLast:QF,ChevronLeft:qc,ChevronRight:Ka,ChevronUp:a1,ChevronsDown:ez,ChevronsDownUp:JF,ChevronsLeft:nz,ChevronsLeftRight:rz,ChevronsLeftRightEllipsis:tz,ChevronsRight:iz,ChevronsRightLeft:sz,ChevronsUp:az,ChevronsUpDown:o1,Chrome:oz,Church:lz,Cigarette:dz,CigaretteOff:cz,Circle:Lu,CircleAlert:El,CircleArrowDown:U_,CircleArrowLeft:q_,CircleArrowOutDownLeft:V_,CircleArrowOutDownRight:H_,CircleArrowOutUpLeft:W_,CircleArrowOutUpRight:G_,CircleArrowRight:K_,CircleArrowUp:Z_,CircleCheck:Ya,CircleCheckBig:qa,CircleChevronDown:Y_,CircleChevronLeft:X_,CircleChevronRight:Q_,CircleChevronUp:J_,CircleDashed:uz,CircleDivide:e2,CircleDollarSign:hz,CircleDot:pz,CircleDotDashed:fz,CircleEllipsis:mz,CircleEqual:gz,CircleFadingArrowUp:xz,CircleFadingPlus:yz,CircleGauge:t2,CircleHelp:Cx,CircleMinus:r2,CircleOff:vz,CircleParking:s2,CircleParkingOff:n2,CirclePause:i2,CirclePercent:a2,CirclePlay:Df,CirclePlus:o2,CirclePower:l2,CircleSlash:_z,CircleSlash2:c2,CircleStop:d2,CircleUser:h2,CircleUserRound:u2,CircleX:zc,CircuitBoard:bz,Citrus:wz,Clapperboard:jz,Clipboard:Ez,ClipboardCheck:ET,ClipboardCopy:kz,ClipboardList:Nz,ClipboardMinus:Sz,ClipboardPaste:Cz,ClipboardPen:p2,ClipboardPenLine:f2,ClipboardPlus:Mz,ClipboardType:Tz,ClipboardX:Az,Clock:Ki,Clock1:Iz,Clock10:Pz,Clock11:Lz,Clock12:Oz,Clock2:Dz,Clock3:Rz,Clock4:Fz,Clock5:zz,Clock6:Bz,Clock7:$z,Clock8:Uz,Clock9:qz,ClockAlert:Vz,ClockArrowDown:Hz,ClockArrowUp:Wz,Cloud:o7,CloudAlert:Gz,CloudCog:Kz,CloudDownload:m2,CloudDrizzle:Zz,CloudFog:Yz,CloudHail:Xz,CloudLightning:Qz,CloudMoon:e7,CloudMoonRain:Jz,CloudOff:t7,CloudRain:n7,CloudRainWind:r7,CloudSnow:s7,CloudSun:a7,CloudSunRain:i7,CloudUpload:g2,Cloudy:l7,Clover:Ox,Club:c7,Code:hj,CodeXml:x2,Codepen:d7,Codesandbox:u7,Coffee:fj,Cog:h7,Coins:f7,Columns2:y2,Columns3:v2,Columns4:p7,Combine:m7,Command:g7,Compass:x7,Component:y7,Computer:v7,ConciergeBell:_7,Cone:b7,Construction:w7,Contact:j7,ContactRound:_2,Container:k7,Contrast:N7,Cookie:S7,CookingPot:C7,Copy:pl,CopyCheck:M7,CopyMinus:T7,CopyPlus:A7,CopySlash:E7,CopyX:I7,Copyleft:P7,Copyright:L7,CornerDownLeft:O7,CornerDownRight:D7,CornerLeftDown:R7,CornerLeftUp:F7,CornerRightDown:z7,CornerRightUp:B7,CornerUpLeft:$7,CornerUpRight:U7,Cpu:q7,CreativeCommons:V7,CreditCard:fm,Croissant:H7,Crop:W7,Cross:G7,Crosshair:K7,Crown:l1,Cuboid:Z7,CupSoda:Y7,Currency:X7,Cylinder:Q7,Dam:J7,Database:r9,DatabaseBackup:e9,DatabaseZap:t9,Delete:n9,Dessert:s9,Diameter:i9,Diamond:l9,DiamondMinus:a9,DiamondPercent:b2,DiamondPlus:o9,Dice1:c9,Dice2:d9,Dice3:u9,Dice4:h9,Dice5:f9,Dice6:p9,Dices:m9,Diff:g9,Disc:_9,Disc2:x9,Disc3:y9,DiscAlbum:v9,Divide:b9,Dna:j9,DnaOff:w9,Dock:k9,Dog:N9,DollarSign:ud,Donut:S9,DoorClosed:C9,DoorOpen:c1,Dot:M9,Download:Va,DraftingCompass:T9,Drama:A9,Dribbble:E9,Drill:I9,Droplet:P9,Droplets:L9,Drum:O9,Drumstick:D9,Dumbbell:R9,Ear:z9,EarOff:F9,Earth:w2,EarthLock:B9,Eclipse:$9,Egg:tS,EggFried:U9,EggOff:q9,Ellipsis:lg,EllipsisVertical:Mx,Equal:W9,EqualApproximately:V9,EqualNot:H9,Eraser:G9,EthernetPort:K9,Euro:Z9,Expand:Y9,ExternalLink:Fs,Eye:Qo,EyeClosed:X9,EyeOff:d1,Facebook:Od,Factory:Q9,Fan:J9,FastForward:eB,Feather:tB,Fence:rB,FerrisWheel:nB,Figma:sB,File:QB,FileArchive:iB,FileAudio:oB,FileAudio2:aB,FileAxis3d:j2,FileBadge:cB,FileBadge2:lB,FileBox:dB,FileChartColumn:N2,FileChartColumnIncreasing:k2,FileChartLine:S2,FileChartPie:C2,FileCheck:hB,FileCheck2:uB,FileClock:fB,FileCode:mB,FileCode2:pB,FileCog:M2,FileDiff:gB,FileDigit:xB,FileDown:yB,FileHeart:vB,FileImage:u1,FileInput:_B,FileJson:wB,FileJson2:bB,FileKey:kB,FileKey2:jB,FileLock:SB,FileLock2:NB,FileMinus:MB,FileMinus2:CB,FileMusic:TB,FileOutput:AB,FilePen:A2,FilePenLine:T2,FilePlus:IB,FilePlus2:EB,FileQuestion:PB,FileScan:LB,FileSearch:DB,FileSearch2:OB,FileSliders:RB,FileSpreadsheet:h1,FileStack:FB,FileSymlink:zB,FileTerminal:BB,FileText:wi,FileType:UB,FileType2:$B,FileUp:qB,FileUser:VB,FileVideo:WB,FileVideo2:HB,FileVolume:KB,FileVolume2:GB,FileWarning:ZB,FileX:XB,FileX2:YB,Files:JB,Film:Ad,Filter:pj,FilterX:e$,Fingerprint:t$,FireExtinguisher:r$,Fish:i$,FishOff:n$,FishSymbol:s$,Flag:Ux,FlagOff:a$,FlagTriangleLeft:o$,FlagTriangleRight:l$,Flame:Zh,FlameKindling:c$,Flashlight:u$,FlashlightOff:d$,FlaskConical:mj,FlaskConicalOff:h$,FlaskRound:f$,FlipHorizontal:m$,FlipHorizontal2:p$,FlipVertical:x$,FlipVertical2:g$,Flower:y$,Flower2:im,Focus:v$,FoldHorizontal:_$,FoldVertical:b$,Folder:K$,FolderArchive:w$,FolderCheck:j$,FolderClock:k$,FolderClosed:N$,FolderCode:S$,FolderCog:E2,FolderDot:C$,FolderDown:M$,FolderGit:A$,FolderGit2:T$,FolderHeart:E$,FolderInput:I$,FolderKanban:P$,FolderKey:L$,FolderLock:O$,FolderMinus:D$,FolderOpen:qx,FolderOpenDot:R$,FolderOutput:F$,FolderPen:I2,FolderPlus:z$,FolderRoot:B$,FolderSearch:U$,FolderSearch2:$$,FolderSymlink:q$,FolderSync:V$,FolderTree:H$,FolderUp:W$,FolderX:G$,Folders:Z$,Footprints:Y$,Forklift:X$,Forward:Q$,Frame:J$,Framer:eU,Frown:tU,Fuel:rU,Fullscreen:nU,GalleryHorizontal:iU,GalleryHorizontalEnd:sU,GalleryThumbnails:aU,GalleryVertical:lU,GalleryVerticalEnd:oU,Gamepad:dU,Gamepad2:cU,Gauge:uU,Gavel:hU,Gem:fU,Ghost:gj,Gift:Ha,GitBranch:mU,GitBranchPlus:pU,GitCommitHorizontal:P2,GitCommitVertical:gU,GitCompare:yU,GitCompareArrows:xU,GitFork:vU,GitGraph:_U,GitMerge:bU,GitPullRequest:CU,GitPullRequestArrow:wU,GitPullRequestClosed:jU,GitPullRequestCreate:NU,GitPullRequestCreateArrow:kU,GitPullRequestDraft:SU,Github:MU,Gitlab:TU,GlassWater:AU,Glasses:EU,Globe:Vx,GlobeLock:IU,Goal:PU,Grab:LU,GraduationCap:f1,Grape:OU,Grid2x2:O2,Grid2x2Check:DU,Grid2x2Plus:L2,Grid2x2X:RU,Grid3x3:Dh,Grip:zU,GripHorizontal:FU,GripVertical:p1,Group:BU,Guitar:$U,Ham:UU,Hammer:qU,Hand:KU,HandCoins:VU,HandHeart:HU,HandHelping:D2,HandMetal:WU,HandPlatter:GU,Handshake:ZU,HardDrive:IT,HardDriveDownload:YU,HardDriveUpload:XU,HardHat:QU,Hash:rS,Haze:JU,HdmiPort:eq,Heading:iq,Heading1:PT,Heading2:LT,Heading3:tq,Heading4:rq,Heading5:nq,Heading6:sq,HeadphoneOff:aq,Headphones:oq,Headset:lq,Heart:oa,HeartCrack:cq,HeartHandshake:dq,HeartOff:uq,HeartPulse:hq,Heater:fq,Hexagon:pq,Highlighter:mq,History:nS,Hop:xq,HopOff:gq,Hospital:yq,Hotel:vq,Hourglass:_q,House:fi,HousePlug:bq,HousePlus:wq,IceCreamBowl:R2,IceCreamCone:F2,IdCard:jq,Image:Do,ImageDown:kq,ImageMinus:Nq,ImageOff:Sq,ImagePlay:Cq,ImagePlus:sS,ImageUp:Mq,ImageUpscale:Tq,Images:Aq,Import:Eq,Inbox:Iq,IndentDecrease:z2,IndentIncrease:B2,IndianRupee:Pq,Infinity:Lq,Info:Oq,InspectionPanel:Dq,Instagram:eu,Italic:iS,IterationCcw:Rq,IterationCw:Fq,JapaneseYen:zq,Joystick:Bq,Kanban:m1,Key:Yh,KeyRound:xj,KeySquare:$q,Keyboard:Vq,KeyboardMusic:Uq,KeyboardOff:qq,Lamp:Yq,LampCeiling:Hq,LampDesk:Wq,LampFloor:Gq,LampWallDown:Kq,LampWallUp:Zq,LandPlot:Xq,Landmark:Qq,Languages:Jq,Laptop:tV,LaptopMinimal:$2,LaptopMinimalCheck:eV,Lasso:nV,LassoSelect:rV,Laugh:sV,Layers:oV,Layers2:iV,Layers3:aV,LayoutDashboard:aS,LayoutGrid:pm,LayoutList:lV,LayoutPanelLeft:cV,LayoutPanelTop:dV,LayoutTemplate:uV,Leaf:hV,LeafyGreen:fV,Lectern:pV,LetterText:mV,Library:oS,LibraryBig:gV,LifeBuoy:lS,Ligature:xV,Lightbulb:g1,LightbulbOff:yV,Link:So,Link2:Xh,Link2Off:vV,Linkedin:mm,List:Wf,ListCheck:_V,ListChecks:bV,ListCollapse:wV,ListEnd:jV,ListFilter:kV,ListMinus:NV,ListMusic:SV,ListOrdered:cS,ListPlus:CV,ListRestart:MV,ListStart:TV,ListTodo:AV,ListTree:EV,ListVideo:IV,ListX:PV,Loader:OV,LoaderCircle:nn,LoaderPinwheel:LV,Locate:OT,LocateFixed:DV,LocateOff:RV,Lock:Gf,LockKeyhole:FV,LockKeyholeOpen:U2,LockOpen:q2,LogIn:dS,LogOut:uS,Logs:zV,Lollipop:BV,Luggage:$V,Magnet:UV,Mail:Ys,MailCheck:qV,MailMinus:VV,MailOpen:HV,MailPlus:WV,MailQuestion:GV,MailSearch:KV,MailWarning:ZV,MailX:DT,Mailbox:YV,Mails:XV,Map:cH,MapPin:ml,MapPinCheck:JV,MapPinCheckInside:QV,MapPinHouse:eH,MapPinMinus:rH,MapPinMinusInside:tH,MapPinOff:nH,MapPinPlus:iH,MapPinPlusInside:sH,MapPinX:oH,MapPinXInside:aH,MapPinned:lH,Martini:dH,Maximize:x1,Maximize2:uH,Medal:Hx,Megaphone:gm,MegaphoneOff:hH,Meh:fH,MemoryStick:pH,Menu:RT,Merge:mH,MessageCircle:Ol,MessageCircleCode:gH,MessageCircleDashed:xH,MessageCircleHeart:hS,MessageCircleMore:yH,MessageCircleOff:vH,MessageCirclePlus:_H,MessageCircleQuestion:FT,MessageCircleReply:bH,MessageCircleWarning:wH,MessageCircleX:jH,MessageSquare:Po,MessageSquareCode:kH,MessageSquareDashed:NH,MessageSquareDiff:SH,MessageSquareDot:CH,MessageSquareHeart:MH,MessageSquareLock:TH,MessageSquareMore:AH,MessageSquareOff:EH,MessageSquarePlus:IH,MessageSquareQuote:zT,MessageSquareReply:PH,MessageSquareShare:LH,MessageSquareText:OH,MessageSquareWarning:DH,MessageSquareX:RH,MessagesSquare:FH,Mic:BT,MicOff:zH,MicVocal:V2,Microchip:BH,Microscope:$H,Microwave:UH,Milestone:qH,Milk:HH,MilkOff:VH,Minimize:GH,Minimize2:WH,Minus:y1,Monitor:yj,MonitorCheck:KH,MonitorCog:ZH,MonitorDot:YH,MonitorDown:XH,MonitorOff:QH,MonitorPause:JH,MonitorPlay:eW,MonitorSmartphone:tW,MonitorSpeaker:rW,MonitorStop:nW,MonitorUp:sW,MonitorX:iW,Moon:oW,MoonStar:aW,Mountain:cW,MountainSnow:lW,Mouse:pW,MouseOff:dW,MousePointer:fW,MousePointer2:uW,MousePointerBan:hW,MousePointerClick:vj,Move:CW,Move3d:H2,MoveDiagonal:gW,MoveDiagonal2:mW,MoveDown:vW,MoveDownLeft:xW,MoveDownRight:yW,MoveHorizontal:_W,MoveLeft:bW,MoveRight:wW,MoveUp:NW,MoveUpLeft:jW,MoveUpRight:kW,MoveVertical:SW,Music:EW,Music2:MW,Music3:TW,Music4:AW,Navigation:$T,Navigation2:PW,Navigation2Off:IW,NavigationOff:LW,Network:OW,Newspaper:Wx,Nfc:DW,Notebook:BW,NotebookPen:RW,NotebookTabs:FW,NotebookText:zW,NotepadText:UW,NotepadTextDashed:$W,Nut:VW,NutOff:qW,Octagon:WW,OctagonAlert:W2,OctagonMinus:HW,OctagonPause:G2,OctagonX:K2,Omega:GW,Option:KW,Orbit:ZW,Origami:YW,Package:Dl,Package2:XW,PackageCheck:QW,PackageMinus:JW,PackageOpen:eG,PackagePlus:tG,PackageSearch:rG,PackageX:nG,PaintBucket:sG,PaintRoller:iG,Paintbrush:aG,PaintbrushVertical:Z2,Palette:hd,PanelBottom:cG,PanelBottomClose:oG,PanelBottomDashed:Y2,PanelBottomOpen:lG,PanelLeft:eb,PanelLeftClose:X2,PanelLeftDashed:Q2,PanelLeftOpen:J2,PanelRight:hG,PanelRightClose:dG,PanelRightDashed:tb,PanelRightOpen:uG,PanelTop:mG,PanelTopClose:fG,PanelTopDashed:rb,PanelTopOpen:pG,PanelsLeftBottom:gG,PanelsRightBottom:xG,PanelsTopLeft:p0,Paperclip:yG,Parentheses:vG,ParkingMeter:_G,PartyPopper:Sc,Pause:Qh,PawPrint:bG,PcCase:wG,Pen:m0,PenLine:nb,PenOff:jG,PenTool:_j,Pencil:ha,PencilLine:kG,PencilOff:NG,PencilRuler:SG,Pentagon:CG,Percent:fS,PersonStanding:MG,PhilippinePeso:TG,Phone:ca,PhoneCall:AG,PhoneForwarded:EG,PhoneIncoming:IG,PhoneMissed:PG,PhoneOff:LG,PhoneOutgoing:OG,Pi:DG,Piano:RG,Pickaxe:FG,PictureInPicture:BG,PictureInPicture2:zG,PiggyBank:$G,Pilcrow:VG,PilcrowLeft:UG,PilcrowRight:qG,Pill:WG,PillBottle:HG,Pin:v1,PinOff:UT,Pipette:GG,Pizza:KG,Plane:XG,PlaneLanding:ZG,PlaneTakeoff:YG,Play:dc,Plug:JG,Plug2:QG,PlugZap:sb,Plus:jn,Pocket:tK,PocketKnife:eK,Podcast:rK,Pointer:sK,PointerOff:nK,Popcorn:iK,Popsicle:aK,PoundSterling:oK,Power:cK,PowerOff:lK,Presentation:dK,Printer:hK,PrinterCheck:uK,Projector:fK,Proportions:pK,Puzzle:mK,Pyramid:gK,QrCode:qT,Quote:VT,Rabbit:xK,Radar:yK,Radiation:vK,Radical:_K,Radio:bj,RadioReceiver:bK,RadioTower:wK,Radius:jK,RailSymbol:kK,Rainbow:NK,Rat:SK,Ratio:CK,Receipt:DK,ReceiptCent:MK,ReceiptEuro:TK,ReceiptIndianRupee:AK,ReceiptJapaneseYen:EK,ReceiptPoundSterling:IK,ReceiptRussianRuble:PK,ReceiptSwissFranc:LK,ReceiptText:OK,RectangleEllipsis:ib,RectangleHorizontal:RK,RectangleVertical:FK,Recycle:zK,Redo:pS,Redo2:BK,RedoDot:$K,RefreshCcw:qK,RefreshCcwDot:UK,RefreshCw:Vl,RefreshCwOff:VK,Refrigerator:HK,Regex:WK,RemoveFormatting:GK,Repeat:HT,Repeat1:KK,Repeat2:ZK,Replace:XK,ReplaceAll:YK,Reply:WT,ReplyAll:QK,Rewind:JK,Ribbon:eZ,Rocket:wg,RockingChair:tZ,RollerCoaster:rZ,Rotate3d:ab,RotateCcw:mS,RotateCcwSquare:nZ,RotateCw:GT,RotateCwSquare:sZ,Route:aZ,RouteOff:iZ,Router:oZ,Rows2:ob,Rows3:lb,Rows4:lZ,Rss:cZ,Ruler:dZ,RussianRuble:uZ,Sailboat:hZ,Salad:fZ,Sandwich:pZ,Satellite:gZ,SatelliteDish:mZ,Save:jg,SaveAll:xZ,SaveOff:yZ,Scale:vZ,Scale3d:cb,Scaling:_Z,Scan:MZ,ScanBarcode:bZ,ScanEye:wZ,ScanFace:jZ,ScanLine:kZ,ScanQrCode:NZ,ScanSearch:SZ,ScanText:CZ,School:TZ,Scissors:EZ,ScissorsLineDashed:AZ,ScreenShare:PZ,ScreenShareOff:IZ,Scroll:OZ,ScrollText:LZ,Search:_i,SearchCheck:DZ,SearchCode:RZ,SearchSlash:FZ,SearchX:zZ,Section:BZ,Send:Lo,SendHorizontal:db,SendToBack:$Z,SeparatorHorizontal:UZ,SeparatorVertical:qZ,Server:GZ,ServerCog:VZ,ServerCrash:HZ,ServerOff:WZ,Settings:fd,Settings2:KZ,Shapes:ZZ,Share:KT,Share2:uc,Sheet:YZ,Shell:XZ,Shield:Kf,ShieldAlert:QZ,ShieldBan:JZ,ShieldCheck:ZT,ShieldEllipsis:eY,ShieldHalf:tY,ShieldMinus:rY,ShieldOff:nY,ShieldPlus:sY,ShieldQuestion:iY,ShieldX:ub,Ship:oY,ShipWheel:aY,Shirt:lY,ShoppingBag:kg,ShoppingBasket:cY,ShoppingCart:hh,Shovel:dY,ShowerHead:uY,Shrink:hY,Shrub:fY,Shuffle:pY,Sigma:mY,Signal:_Y,SignalHigh:gY,SignalLow:xY,SignalMedium:yY,SignalZero:vY,Signature:bY,Signpost:jY,SignpostBig:wY,Siren:kY,SkipBack:NY,SkipForward:SY,Skull:CY,Slack:MY,Slash:TY,Slice:AY,SlidersHorizontal:YT,SlidersVertical:hb,Smartphone:xm,SmartphoneCharging:EY,SmartphoneNfc:IY,Smile:LY,SmilePlus:PY,Snail:OY,Snowflake:q0,Sofa:DY,Soup:RY,Space:FY,Spade:zY,Sparkle:BY,Sparkles:Cs,Speaker:$Y,Speech:UY,SpellCheck:VY,SpellCheck2:qY,Spline:HY,Split:WY,SprayCan:GY,Sprout:KY,Square:ym,SquareActivity:fb,SquareArrowDown:gb,SquareArrowDownLeft:pb,SquareArrowDownRight:mb,SquareArrowLeft:xb,SquareArrowOutDownLeft:yb,SquareArrowOutDownRight:vb,SquareArrowOutUpLeft:_b,SquareArrowOutUpRight:bb,SquareArrowRight:wb,SquareArrowUp:Nb,SquareArrowUpLeft:jb,SquareArrowUpRight:kb,SquareAsterisk:Sb,SquareBottomDashedScissors:Cb,SquareChartGantt:Jm,SquareCheck:Mb,SquareCheckBig:g0,SquareChevronDown:Tb,SquareChevronLeft:Ab,SquareChevronRight:Eb,SquareChevronUp:Ib,SquareCode:Pb,SquareDashed:Db,SquareDashedBottom:YY,SquareDashedBottomCode:ZY,SquareDashedKanban:Lb,SquareDashedMousePointer:Ob,SquareDivide:Rb,SquareDot:Fb,SquareEqual:zb,SquareFunction:Bb,SquareKanban:$b,SquareLibrary:Ub,SquareM:qb,SquareMenu:Vb,SquareMinus:Hb,SquareMousePointer:Wb,SquareParking:Kb,SquareParkingOff:Gb,SquarePen:rc,SquarePercent:Zb,SquarePi:Yb,SquarePilcrow:Xb,SquarePlay:Qb,SquarePlus:Jb,SquarePower:ew,SquareRadical:XY,SquareScissors:tw,SquareSigma:rw,SquareSlash:nw,SquareSplitHorizontal:sw,SquareSplitVertical:iw,SquareSquare:QY,SquareStack:JY,SquareTerminal:aw,SquareUser:lw,SquareUserRound:ow,SquareX:cw,Squircle:eX,Squirrel:tX,Stamp:rX,Star:vs,StarHalf:nX,StarOff:sX,StepBack:iX,StepForward:aX,Stethoscope:oX,Sticker:lX,StickyNote:cX,Store:dX,StretchHorizontal:uX,StretchVertical:hX,Strikethrough:fX,Subscript:pX,Sun:_1,SunDim:mX,SunMedium:gX,SunMoon:xX,SunSnow:yX,Sunrise:vX,Sunset:_X,Superscript:bX,SwatchBook:wX,SwissFranc:jX,SwitchCamera:kX,Sword:NX,Swords:SX,Syringe:CX,Table:LX,Table2:XT,TableCellsMerge:MX,TableCellsSplit:TX,TableColumnsSplit:AX,TableOfContents:EX,TableProperties:IX,TableRowsSplit:PX,Tablet:DX,TabletSmartphone:OX,Tablets:RX,Tag:Gx,Tags:FX,Tally1:zX,Tally2:BX,Tally3:$X,Tally4:UX,Tally5:qX,Tangent:VX,Target:Kx,Telescope:HX,Tent:GX,TentTree:WX,Terminal:KX,TestTube:ZX,TestTubeDiagonal:dw,TestTubes:YX,Text:tQ,TextCursor:QX,TextCursorInput:XX,TextQuote:JX,TextSearch:eQ,TextSelect:uw,Theater:rQ,Thermometer:iQ,ThermometerSnowflake:nQ,ThermometerSun:sQ,ThumbsDown:QT,ThumbsUp:pd,Ticket:JT,TicketCheck:aQ,TicketMinus:oQ,TicketPercent:lQ,TicketPlus:cQ,TicketSlash:dQ,TicketX:uQ,Tickets:fQ,TicketsPlane:hQ,Timer:gQ,TimerOff:pQ,TimerReset:mQ,ToggleLeft:xQ,ToggleRight:yQ,Toilet:vQ,Tornado:_Q,Torus:bQ,Touchpad:jQ,TouchpadOff:wQ,TowerControl:kQ,ToyBrick:NQ,Tractor:SQ,TrafficCone:CQ,TrainFront:TQ,TrainFrontTunnel:MQ,TrainTrack:AQ,TramFront:hw,Trash:EQ,Trash2:Zn,TreeDeciduous:IQ,TreePalm:fw,TreePine:b1,Trees:PQ,Trello:LQ,TrendingDown:w1,TrendingUp:Zf,TrendingUpDown:OQ,Triangle:RQ,TriangleAlert:Bh,TriangleRight:DQ,Trophy:Wa,Truck:eA,Turtle:FQ,Tv:BQ,TvMinimal:pw,TvMinimalPlay:zQ,Twitch:$Q,Twitter:UQ,Type:VQ,TypeOutline:qQ,Umbrella:WQ,UmbrellaOff:HQ,Underline:GQ,Undo:gS,Undo2:KQ,UndoDot:ZQ,UnfoldHorizontal:YQ,UnfoldVertical:XQ,Ungroup:QQ,University:mw,Unlink:tA,Unlink2:JQ,Unplug:eJ,Upload:no,Usb:tJ,User:Cc,UserCheck:wj,UserCog:rA,UserMinus:rJ,UserPen:nJ,UserPlus:Jh,UserRound:bw,UserRoundCheck:gw,UserRoundCog:xw,UserRoundMinus:yw,UserRoundPen:sJ,UserRoundPlus:vw,UserRoundSearch:iJ,UserRoundX:_w,UserSearch:aJ,UserX:oJ,Users:Vn,UsersRound:ww,Utensils:kw,UtensilsCrossed:jw,UtilityPole:lJ,Variable:nA,Vault:cJ,Vegan:dJ,VenetianMask:uJ,Vibrate:fJ,VibrateOff:hJ,Video:Fi,VideoOff:pJ,Videotape:mJ,View:gJ,Voicemail:xJ,Volleyball:yJ,Volume:jJ,Volume1:vJ,Volume2:_J,VolumeOff:bJ,VolumeX:wJ,Vote:kJ,Wallet:SJ,WalletCards:NJ,WalletMinimal:Nw,Wallpaper:CJ,Wand:MJ,WandSparkles:Sw,Warehouse:TJ,WashingMachine:AJ,Watch:EJ,Waves:IJ,Waypoints:PJ,Webcam:LJ,Webhook:DJ,WebhookOff:OJ,Weight:RJ,Wheat:zJ,WheatOff:FJ,WholeWord:BJ,Wifi:HJ,WifiHigh:$J,WifiLow:UJ,WifiOff:qJ,WifiZero:VJ,Wind:GJ,WindArrowDown:WJ,Wine:ZJ,WineOff:KJ,Workflow:YJ,Worm:XJ,WrapText:QJ,Wrench:Zx,X:bs,Youtube:JJ,Zap:Ng,ZapOff:eee,ZoomIn:xS,ZoomOut:yS},Symbol.toStringTag,{value:"Module"}));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IAe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:y8,AArrowDownIcon:y8,AArrowUp:v8,AArrowUpIcon:v8,ALargeSmall:_8,ALargeSmallIcon:_8,Accessibility:b8,AccessibilityIcon:b8,Activity:yg,ActivityIcon:yg,ActivitySquare:fb,ActivitySquareIcon:fb,AirVent:w8,AirVentIcon:w8,Airplay:j8,AirplayIcon:j8,AlarmCheck:p_,AlarmCheckIcon:p_,AlarmClock:N8,AlarmClockCheck:p_,AlarmClockCheckIcon:p_,AlarmClockIcon:N8,AlarmClockMinus:m_,AlarmClockMinusIcon:m_,AlarmClockOff:k8,AlarmClockOffIcon:k8,AlarmClockPlus:g_,AlarmClockPlusIcon:g_,AlarmMinus:m_,AlarmMinusIcon:m_,AlarmPlus:g_,AlarmPlusIcon:g_,AlarmSmoke:S8,AlarmSmokeIcon:S8,Album:C8,AlbumIcon:C8,AlertCircle:El,AlertCircleIcon:El,AlertOctagon:W2,AlertOctagonIcon:W2,AlertTriangle:Bh,AlertTriangleIcon:Bh,AlignCenter:Y4,AlignCenterHorizontal:M8,AlignCenterHorizontalIcon:M8,AlignCenterIcon:Y4,AlignCenterVertical:T8,AlignCenterVerticalIcon:T8,AlignEndHorizontal:A8,AlignEndHorizontalIcon:A8,AlignEndVertical:E8,AlignEndVerticalIcon:E8,AlignHorizontalDistributeCenter:I8,AlignHorizontalDistributeCenterIcon:I8,AlignHorizontalDistributeEnd:P8,AlignHorizontalDistributeEndIcon:P8,AlignHorizontalDistributeStart:L8,AlignHorizontalDistributeStartIcon:L8,AlignHorizontalJustifyCenter:O8,AlignHorizontalJustifyCenterIcon:O8,AlignHorizontalJustifyEnd:D8,AlignHorizontalJustifyEndIcon:D8,AlignHorizontalJustifyStart:R8,AlignHorizontalJustifyStartIcon:R8,AlignHorizontalSpaceAround:F8,AlignHorizontalSpaceAroundIcon:F8,AlignHorizontalSpaceBetween:z8,AlignHorizontalSpaceBetweenIcon:z8,AlignJustify:B8,AlignJustifyIcon:B8,AlignLeft:X4,AlignLeftIcon:X4,AlignRight:Q4,AlignRightIcon:Q4,AlignStartHorizontal:$8,AlignStartHorizontalIcon:$8,AlignStartVertical:U8,AlignStartVerticalIcon:U8,AlignVerticalDistributeCenter:q8,AlignVerticalDistributeCenterIcon:q8,AlignVerticalDistributeEnd:V8,AlignVerticalDistributeEndIcon:V8,AlignVerticalDistributeStart:H8,AlignVerticalDistributeStartIcon:H8,AlignVerticalJustifyCenter:W8,AlignVerticalJustifyCenterIcon:W8,AlignVerticalJustifyEnd:G8,AlignVerticalJustifyEndIcon:G8,AlignVerticalJustifyStart:K8,AlignVerticalJustifyStartIcon:K8,AlignVerticalSpaceAround:Z8,AlignVerticalSpaceAroundIcon:Z8,AlignVerticalSpaceBetween:Y8,AlignVerticalSpaceBetweenIcon:Y8,Ambulance:X8,AmbulanceIcon:X8,Ampersand:Q8,AmpersandIcon:Q8,Ampersands:J8,AmpersandsIcon:J8,Amphora:eO,AmphoraIcon:eO,Anchor:tO,AnchorIcon:tO,Angry:rO,AngryIcon:rO,Annoyed:nO,AnnoyedIcon:nO,Antenna:sO,AntennaIcon:sO,Anvil:iO,AnvilIcon:iO,Aperture:aO,ApertureIcon:aO,AppWindow:MT,AppWindowIcon:MT,AppWindowMac:oO,AppWindowMacIcon:oO,Apple:lO,AppleIcon:lO,Archive:uO,ArchiveIcon:uO,ArchiveRestore:cO,ArchiveRestoreIcon:cO,ArchiveX:dO,ArchiveXIcon:dO,AreaChart:A_,AreaChartIcon:A_,Armchair:hO,ArmchairIcon:hO,ArrowBigDown:pO,ArrowBigDownDash:fO,ArrowBigDownDashIcon:fO,ArrowBigDownIcon:pO,ArrowBigLeft:gO,ArrowBigLeftDash:mO,ArrowBigLeftDashIcon:mO,ArrowBigLeftIcon:gO,ArrowBigRight:yO,ArrowBigRightDash:xO,ArrowBigRightDashIcon:xO,ArrowBigRightIcon:yO,ArrowBigUp:_O,ArrowBigUpDash:vO,ArrowBigUpDashIcon:vO,ArrowBigUpIcon:_O,ArrowDown:i1,ArrowDown01:bO,ArrowDown01Icon:bO,ArrowDown10:wO,ArrowDown10Icon:wO,ArrowDownAZ:x_,ArrowDownAZIcon:x_,ArrowDownAz:x_,ArrowDownAzIcon:x_,ArrowDownCircle:U_,ArrowDownCircleIcon:U_,ArrowDownFromLine:jO,ArrowDownFromLineIcon:jO,ArrowDownIcon:i1,ArrowDownLeft:kO,ArrowDownLeftFromCircle:V_,ArrowDownLeftFromCircleIcon:V_,ArrowDownLeftFromSquare:yb,ArrowDownLeftFromSquareIcon:yb,ArrowDownLeftIcon:kO,ArrowDownLeftSquare:pb,ArrowDownLeftSquareIcon:pb,ArrowDownNarrowWide:NO,ArrowDownNarrowWideIcon:NO,ArrowDownRight:SO,ArrowDownRightFromCircle:H_,ArrowDownRightFromCircleIcon:H_,ArrowDownRightFromSquare:vb,ArrowDownRightFromSquareIcon:vb,ArrowDownRightIcon:SO,ArrowDownRightSquare:mb,ArrowDownRightSquareIcon:mb,ArrowDownSquare:gb,ArrowDownSquareIcon:gb,ArrowDownToDot:CO,ArrowDownToDotIcon:CO,ArrowDownToLine:MO,ArrowDownToLineIcon:MO,ArrowDownUp:TO,ArrowDownUpIcon:TO,ArrowDownWideNarrow:y_,ArrowDownWideNarrowIcon:y_,ArrowDownZA:v_,ArrowDownZAIcon:v_,ArrowDownZa:v_,ArrowDownZaIcon:v_,ArrowLeft:Qa,ArrowLeftCircle:q_,ArrowLeftCircleIcon:q_,ArrowLeftFromLine:AO,ArrowLeftFromLineIcon:AO,ArrowLeftIcon:Qa,ArrowLeftRight:EO,ArrowLeftRightIcon:EO,ArrowLeftSquare:xb,ArrowLeftSquareIcon:xb,ArrowLeftToLine:IO,ArrowLeftToLineIcon:IO,ArrowRight:Zo,ArrowRightCircle:K_,ArrowRightCircleIcon:K_,ArrowRightFromLine:PO,ArrowRightFromLineIcon:PO,ArrowRightIcon:Zo,ArrowRightLeft:LO,ArrowRightLeftIcon:LO,ArrowRightSquare:wb,ArrowRightSquareIcon:wb,ArrowRightToLine:OO,ArrowRightToLineIcon:OO,ArrowUp:vg,ArrowUp01:DO,ArrowUp01Icon:DO,ArrowUp10:RO,ArrowUp10Icon:RO,ArrowUpAZ:__,ArrowUpAZIcon:__,ArrowUpAz:__,ArrowUpAzIcon:__,ArrowUpCircle:Z_,ArrowUpCircleIcon:Z_,ArrowUpDown:$x,ArrowUpDownIcon:$x,ArrowUpFromDot:FO,ArrowUpFromDotIcon:FO,ArrowUpFromLine:zO,ArrowUpFromLineIcon:zO,ArrowUpIcon:vg,ArrowUpLeft:BO,ArrowUpLeftFromCircle:W_,ArrowUpLeftFromCircleIcon:W_,ArrowUpLeftFromSquare:_b,ArrowUpLeftFromSquareIcon:_b,ArrowUpLeftIcon:BO,ArrowUpLeftSquare:jb,ArrowUpLeftSquareIcon:jb,ArrowUpNarrowWide:b_,ArrowUpNarrowWideIcon:b_,ArrowUpRight:$O,ArrowUpRightFromCircle:G_,ArrowUpRightFromCircleIcon:G_,ArrowUpRightFromSquare:bb,ArrowUpRightFromSquareIcon:bb,ArrowUpRightIcon:$O,ArrowUpRightSquare:kb,ArrowUpRightSquareIcon:kb,ArrowUpSquare:Nb,ArrowUpSquareIcon:Nb,ArrowUpToLine:UO,ArrowUpToLineIcon:UO,ArrowUpWideNarrow:qO,ArrowUpWideNarrowIcon:qO,ArrowUpZA:w_,ArrowUpZAIcon:w_,ArrowUpZa:w_,ArrowUpZaIcon:w_,ArrowsUpFromLine:VO,ArrowsUpFromLineIcon:VO,Asterisk:HO,AsteriskIcon:HO,AsteriskSquare:Sb,AsteriskSquareIcon:Sb,AtSign:WO,AtSignIcon:WO,Atom:GO,AtomIcon:GO,AudioLines:KO,AudioLinesIcon:KO,AudioWaveform:ZO,AudioWaveformIcon:ZO,Award:Pl,AwardIcon:Pl,Axe:YO,AxeIcon:YO,Axis3D:j_,Axis3DIcon:j_,Axis3d:j_,Axis3dIcon:j_,Baby:XO,BabyIcon:XO,Backpack:QO,BackpackIcon:QO,Badge:pD,BadgeAlert:JO,BadgeAlertIcon:JO,BadgeCent:eD,BadgeCentIcon:eD,BadgeCheck:k_,BadgeCheckIcon:k_,BadgeDollarSign:tD,BadgeDollarSignIcon:tD,BadgeEuro:rD,BadgeEuroIcon:rD,BadgeHelp:nD,BadgeHelpIcon:nD,BadgeIcon:pD,BadgeIndianRupee:sD,BadgeIndianRupeeIcon:sD,BadgeInfo:iD,BadgeInfoIcon:iD,BadgeJapaneseYen:aD,BadgeJapaneseYenIcon:aD,BadgeMinus:oD,BadgeMinusIcon:oD,BadgePercent:lD,BadgePercentIcon:lD,BadgePlus:cD,BadgePlusIcon:cD,BadgePoundSterling:dD,BadgePoundSterlingIcon:dD,BadgeRussianRuble:uD,BadgeRussianRubleIcon:uD,BadgeSwissFranc:hD,BadgeSwissFrancIcon:hD,BadgeX:fD,BadgeXIcon:fD,BaggageClaim:mD,BaggageClaimIcon:mD,Ban:gD,BanIcon:gD,Banana:xD,BananaIcon:xD,Bandage:yD,BandageIcon:yD,Banknote:vD,BanknoteIcon:vD,BarChart:R_,BarChart2:F_,BarChart2Icon:F_,BarChart3:ac,BarChart3Icon:ac,BarChart4:O_,BarChart4Icon:O_,BarChartBig:L_,BarChartBigIcon:L_,BarChartHorizontal:I_,BarChartHorizontalBig:E_,BarChartHorizontalBigIcon:E_,BarChartHorizontalIcon:I_,BarChartIcon:R_,Barcode:_D,BarcodeIcon:_D,Baseline:bD,BaselineIcon:bD,Bath:Vf,BathIcon:Vf,Battery:CD,BatteryCharging:wD,BatteryChargingIcon:wD,BatteryFull:jD,BatteryFullIcon:jD,BatteryIcon:CD,BatteryLow:kD,BatteryLowIcon:kD,BatteryMedium:ND,BatteryMediumIcon:ND,BatteryWarning:SD,BatteryWarningIcon:SD,Beaker:MD,BeakerIcon:MD,Bean:AD,BeanIcon:AD,BeanOff:TD,BeanOffIcon:TD,Bed:Hf,BedDouble:ED,BedDoubleIcon:ED,BedIcon:Hf,BedSingle:ID,BedSingleIcon:ID,Beef:PD,BeefIcon:PD,Beer:OD,BeerIcon:OD,BeerOff:LD,BeerOffIcon:LD,Bell:_g,BellDot:DD,BellDotIcon:DD,BellElectric:RD,BellElectricIcon:RD,BellIcon:_g,BellMinus:FD,BellMinusIcon:FD,BellOff:cj,BellOffIcon:cj,BellPlus:zD,BellPlusIcon:zD,BellRing:BD,BellRingIcon:BD,BetweenHorizonalEnd:N_,BetweenHorizonalEndIcon:N_,BetweenHorizonalStart:S_,BetweenHorizonalStartIcon:S_,BetweenHorizontalEnd:N_,BetweenHorizontalEndIcon:N_,BetweenHorizontalStart:S_,BetweenHorizontalStartIcon:S_,BetweenVerticalEnd:$D,BetweenVerticalEndIcon:$D,BetweenVerticalStart:UD,BetweenVerticalStartIcon:UD,BicepsFlexed:qD,BicepsFlexedIcon:qD,Bike:VD,BikeIcon:VD,Binary:HD,BinaryIcon:HD,Binoculars:WD,BinocularsIcon:WD,Biohazard:GD,BiohazardIcon:GD,Bird:KD,BirdIcon:KD,Bitcoin:ZD,BitcoinIcon:ZD,Blend:YD,BlendIcon:YD,Blinds:XD,BlindsIcon:XD,Blocks:QD,BlocksIcon:QD,Bluetooth:rR,BluetoothConnected:JD,BluetoothConnectedIcon:JD,BluetoothIcon:rR,BluetoothOff:eR,BluetoothOffIcon:eR,BluetoothSearching:tR,BluetoothSearchingIcon:tR,Bold:J4,BoldIcon:J4,Bolt:nR,BoltIcon:nR,Bomb:sR,BombIcon:sR,Bone:iR,BoneIcon:iR,Book:CR,BookA:aR,BookAIcon:aR,BookAudio:oR,BookAudioIcon:oR,BookCheck:lR,BookCheckIcon:lR,BookCopy:cR,BookCopyIcon:cR,BookDashed:C_,BookDashedIcon:C_,BookDown:dR,BookDownIcon:dR,BookHeadphones:uR,BookHeadphonesIcon:uR,BookHeart:hR,BookHeartIcon:hR,BookIcon:CR,BookImage:fR,BookImageIcon:fR,BookKey:pR,BookKeyIcon:pR,BookLock:mR,BookLockIcon:mR,BookMarked:gR,BookMarkedIcon:gR,BookMinus:xR,BookMinusIcon:xR,BookOpen:TT,BookOpenCheck:yR,BookOpenCheckIcon:yR,BookOpenIcon:TT,BookOpenText:vR,BookOpenTextIcon:vR,BookPlus:_R,BookPlusIcon:_R,BookTemplate:C_,BookTemplateIcon:C_,BookText:bR,BookTextIcon:bR,BookType:wR,BookTypeIcon:wR,BookUp:kR,BookUp2:jR,BookUp2Icon:jR,BookUpIcon:kR,BookUser:NR,BookUserIcon:NR,BookX:SR,BookXIcon:SR,Bookmark:um,BookmarkCheck:MR,BookmarkCheckIcon:MR,BookmarkIcon:um,BookmarkMinus:TR,BookmarkMinusIcon:TR,BookmarkPlus:AR,BookmarkPlusIcon:AR,BookmarkX:ER,BookmarkXIcon:ER,BoomBox:IR,BoomBoxIcon:IR,Bot:eS,BotIcon:eS,BotMessageSquare:PR,BotMessageSquareIcon:PR,BotOff:LR,BotOffIcon:LR,Box:OR,BoxIcon:OR,BoxSelect:Db,BoxSelectIcon:Db,Boxes:DR,BoxesIcon:DR,Braces:M_,BracesIcon:M_,Brackets:RR,BracketsIcon:RR,Brain:AT,BrainCircuit:FR,BrainCircuitIcon:FR,BrainCog:zR,BrainCogIcon:zR,BrainIcon:AT,BrickWall:BR,BrickWallIcon:BR,Briefcase:yh,BriefcaseBusiness:$R,BriefcaseBusinessIcon:$R,BriefcaseConveyorBelt:UR,BriefcaseConveyorBeltIcon:UR,BriefcaseIcon:yh,BriefcaseMedical:qR,BriefcaseMedicalIcon:qR,BringToFront:VR,BringToFrontIcon:VR,Brush:HR,BrushIcon:HR,Bug:KR,BugIcon:KR,BugOff:WR,BugOffIcon:WR,BugPlay:GR,BugPlayIcon:GR,Building:dj,Building2:na,Building2Icon:na,BuildingIcon:dj,Bus:YR,BusFront:ZR,BusFrontIcon:ZR,BusIcon:YR,Cable:QR,CableCar:XR,CableCarIcon:XR,CableIcon:QR,Cake:Kh,CakeIcon:Kh,CakeSlice:JR,CakeSliceIcon:JR,Calculator:eF,CalculatorIcon:eF,Calendar:zs,Calendar1:tF,Calendar1Icon:tF,CalendarArrowDown:rF,CalendarArrowDownIcon:rF,CalendarArrowUp:nF,CalendarArrowUpIcon:nF,CalendarCheck:iF,CalendarCheck2:sF,CalendarCheck2Icon:sF,CalendarCheckIcon:iF,CalendarClock:aF,CalendarClockIcon:aF,CalendarCog:oF,CalendarCogIcon:oF,CalendarDays:hm,CalendarDaysIcon:hm,CalendarFold:lF,CalendarFoldIcon:lF,CalendarHeart:cF,CalendarHeartIcon:cF,CalendarIcon:zs,CalendarMinus:uF,CalendarMinus2:dF,CalendarMinus2Icon:dF,CalendarMinusIcon:uF,CalendarOff:hF,CalendarOffIcon:hF,CalendarPlus:uj,CalendarPlus2:fF,CalendarPlus2Icon:fF,CalendarPlusIcon:uj,CalendarRange:pF,CalendarRangeIcon:pF,CalendarSearch:mF,CalendarSearchIcon:mF,CalendarSync:gF,CalendarSyncIcon:gF,CalendarX:yF,CalendarX2:xF,CalendarX2Icon:xF,CalendarXIcon:yF,Camera:bg,CameraIcon:bg,CameraOff:vF,CameraOffIcon:vF,CandlestickChart:P_,CandlestickChartIcon:P_,Candy:wF,CandyCane:_F,CandyCaneIcon:_F,CandyIcon:wF,CandyOff:bF,CandyOffIcon:bF,Cannabis:jF,CannabisIcon:jF,Captions:T_,CaptionsIcon:T_,CaptionsOff:kF,CaptionsOffIcon:kF,Car:CF,CarFront:NF,CarFrontIcon:NF,CarIcon:CF,CarTaxiFront:SF,CarTaxiFrontIcon:SF,Caravan:MF,CaravanIcon:MF,Carrot:TF,CarrotIcon:TF,CaseLower:AF,CaseLowerIcon:AF,CaseSensitive:EF,CaseSensitiveIcon:EF,CaseUpper:IF,CaseUpperIcon:IF,CassetteTape:PF,CassetteTapeIcon:PF,Cast:LF,CastIcon:LF,Castle:OF,CastleIcon:OF,Cat:DF,CatIcon:DF,Cctv:RF,CctvIcon:RF,ChartArea:A_,ChartAreaIcon:A_,ChartBar:I_,ChartBarBig:E_,ChartBarBigIcon:E_,ChartBarDecreasing:FF,ChartBarDecreasingIcon:FF,ChartBarIcon:I_,ChartBarIncreasing:zF,ChartBarIncreasingIcon:zF,ChartBarStacked:BF,ChartBarStackedIcon:BF,ChartCandlestick:P_,ChartCandlestickIcon:P_,ChartColumn:ac,ChartColumnBig:L_,ChartColumnBigIcon:L_,ChartColumnDecreasing:$F,ChartColumnDecreasingIcon:$F,ChartColumnIcon:ac,ChartColumnIncreasing:O_,ChartColumnIncreasingIcon:O_,ChartColumnStacked:UF,ChartColumnStackedIcon:UF,ChartGantt:qF,ChartGanttIcon:qF,ChartLine:D_,ChartLineIcon:D_,ChartNetwork:VF,ChartNetworkIcon:VF,ChartNoAxesColumn:F_,ChartNoAxesColumnDecreasing:HF,ChartNoAxesColumnDecreasingIcon:HF,ChartNoAxesColumnIcon:F_,ChartNoAxesColumnIncreasing:R_,ChartNoAxesColumnIncreasingIcon:R_,ChartNoAxesCombined:WF,ChartNoAxesCombinedIcon:WF,ChartNoAxesGantt:z_,ChartNoAxesGanttIcon:z_,ChartPie:B_,ChartPieIcon:B_,ChartScatter:$_,ChartScatterIcon:$_,ChartSpline:GF,ChartSplineIcon:GF,Check:Ca,CheckCheck:KF,CheckCheckIcon:KF,CheckCircle:qa,CheckCircle2:Ya,CheckCircle2Icon:Ya,CheckCircleIcon:qa,CheckIcon:Ca,CheckSquare:g0,CheckSquare2:Mb,CheckSquare2Icon:Mb,CheckSquareIcon:g0,ChefHat:ZF,ChefHatIcon:ZF,Cherry:YF,CherryIcon:YF,ChevronDown:Pu,ChevronDownCircle:Y_,ChevronDownCircleIcon:Y_,ChevronDownIcon:Pu,ChevronDownSquare:Tb,ChevronDownSquareIcon:Tb,ChevronFirst:XF,ChevronFirstIcon:XF,ChevronLast:QF,ChevronLastIcon:QF,ChevronLeft:qc,ChevronLeftCircle:X_,ChevronLeftCircleIcon:X_,ChevronLeftIcon:qc,ChevronLeftSquare:Ab,ChevronLeftSquareIcon:Ab,ChevronRight:Ka,ChevronRightCircle:Q_,ChevronRightCircleIcon:Q_,ChevronRightIcon:Ka,ChevronRightSquare:Eb,ChevronRightSquareIcon:Eb,ChevronUp:a1,ChevronUpCircle:J_,ChevronUpCircleIcon:J_,ChevronUpIcon:a1,ChevronUpSquare:Ib,ChevronUpSquareIcon:Ib,ChevronsDown:ez,ChevronsDownIcon:ez,ChevronsDownUp:JF,ChevronsDownUpIcon:JF,ChevronsLeft:nz,ChevronsLeftIcon:nz,ChevronsLeftRight:rz,ChevronsLeftRightEllipsis:tz,ChevronsLeftRightEllipsisIcon:tz,ChevronsLeftRightIcon:rz,ChevronsRight:iz,ChevronsRightIcon:iz,ChevronsRightLeft:sz,ChevronsRightLeftIcon:sz,ChevronsUp:az,ChevronsUpDown:o1,ChevronsUpDownIcon:o1,ChevronsUpIcon:az,Chrome:oz,ChromeIcon:oz,Church:lz,ChurchIcon:lz,Cigarette:dz,CigaretteIcon:dz,CigaretteOff:cz,CigaretteOffIcon:cz,Circle:Lu,CircleAlert:El,CircleAlertIcon:El,CircleArrowDown:U_,CircleArrowDownIcon:U_,CircleArrowLeft:q_,CircleArrowLeftIcon:q_,CircleArrowOutDownLeft:V_,CircleArrowOutDownLeftIcon:V_,CircleArrowOutDownRight:H_,CircleArrowOutDownRightIcon:H_,CircleArrowOutUpLeft:W_,CircleArrowOutUpLeftIcon:W_,CircleArrowOutUpRight:G_,CircleArrowOutUpRightIcon:G_,CircleArrowRight:K_,CircleArrowRightIcon:K_,CircleArrowUp:Z_,CircleArrowUpIcon:Z_,CircleCheck:Ya,CircleCheckBig:qa,CircleCheckBigIcon:qa,CircleCheckIcon:Ya,CircleChevronDown:Y_,CircleChevronDownIcon:Y_,CircleChevronLeft:X_,CircleChevronLeftIcon:X_,CircleChevronRight:Q_,CircleChevronRightIcon:Q_,CircleChevronUp:J_,CircleChevronUpIcon:J_,CircleDashed:uz,CircleDashedIcon:uz,CircleDivide:e2,CircleDivideIcon:e2,CircleDollarSign:hz,CircleDollarSignIcon:hz,CircleDot:pz,CircleDotDashed:fz,CircleDotDashedIcon:fz,CircleDotIcon:pz,CircleEllipsis:mz,CircleEllipsisIcon:mz,CircleEqual:gz,CircleEqualIcon:gz,CircleFadingArrowUp:xz,CircleFadingArrowUpIcon:xz,CircleFadingPlus:yz,CircleFadingPlusIcon:yz,CircleGauge:t2,CircleGaugeIcon:t2,CircleHelp:Cx,CircleHelpIcon:Cx,CircleIcon:Lu,CircleMinus:r2,CircleMinusIcon:r2,CircleOff:vz,CircleOffIcon:vz,CircleParking:s2,CircleParkingIcon:s2,CircleParkingOff:n2,CircleParkingOffIcon:n2,CirclePause:i2,CirclePauseIcon:i2,CirclePercent:a2,CirclePercentIcon:a2,CirclePlay:Df,CirclePlayIcon:Df,CirclePlus:o2,CirclePlusIcon:o2,CirclePower:l2,CirclePowerIcon:l2,CircleSlash:_z,CircleSlash2:c2,CircleSlash2Icon:c2,CircleSlashIcon:_z,CircleSlashed:c2,CircleSlashedIcon:c2,CircleStop:d2,CircleStopIcon:d2,CircleUser:h2,CircleUserIcon:h2,CircleUserRound:u2,CircleUserRoundIcon:u2,CircleX:zc,CircleXIcon:zc,CircuitBoard:bz,CircuitBoardIcon:bz,Citrus:wz,CitrusIcon:wz,Clapperboard:jz,ClapperboardIcon:jz,Clipboard:Ez,ClipboardCheck:ET,ClipboardCheckIcon:ET,ClipboardCopy:kz,ClipboardCopyIcon:kz,ClipboardEdit:p2,ClipboardEditIcon:p2,ClipboardIcon:Ez,ClipboardList:Nz,ClipboardListIcon:Nz,ClipboardMinus:Sz,ClipboardMinusIcon:Sz,ClipboardPaste:Cz,ClipboardPasteIcon:Cz,ClipboardPen:p2,ClipboardPenIcon:p2,ClipboardPenLine:f2,ClipboardPenLineIcon:f2,ClipboardPlus:Mz,ClipboardPlusIcon:Mz,ClipboardSignature:f2,ClipboardSignatureIcon:f2,ClipboardType:Tz,ClipboardTypeIcon:Tz,ClipboardX:Az,ClipboardXIcon:Az,Clock:Ki,Clock1:Iz,Clock10:Pz,Clock10Icon:Pz,Clock11:Lz,Clock11Icon:Lz,Clock12:Oz,Clock12Icon:Oz,Clock1Icon:Iz,Clock2:Dz,Clock2Icon:Dz,Clock3:Rz,Clock3Icon:Rz,Clock4:Fz,Clock4Icon:Fz,Clock5:zz,Clock5Icon:zz,Clock6:Bz,Clock6Icon:Bz,Clock7:$z,Clock7Icon:$z,Clock8:Uz,Clock8Icon:Uz,Clock9:qz,Clock9Icon:qz,ClockAlert:Vz,ClockAlertIcon:Vz,ClockArrowDown:Hz,ClockArrowDownIcon:Hz,ClockArrowUp:Wz,ClockArrowUpIcon:Wz,ClockIcon:Ki,Cloud:o7,CloudAlert:Gz,CloudAlertIcon:Gz,CloudCog:Kz,CloudCogIcon:Kz,CloudDownload:m2,CloudDownloadIcon:m2,CloudDrizzle:Zz,CloudDrizzleIcon:Zz,CloudFog:Yz,CloudFogIcon:Yz,CloudHail:Xz,CloudHailIcon:Xz,CloudIcon:o7,CloudLightning:Qz,CloudLightningIcon:Qz,CloudMoon:e7,CloudMoonIcon:e7,CloudMoonRain:Jz,CloudMoonRainIcon:Jz,CloudOff:t7,CloudOffIcon:t7,CloudRain:n7,CloudRainIcon:n7,CloudRainWind:r7,CloudRainWindIcon:r7,CloudSnow:s7,CloudSnowIcon:s7,CloudSun:a7,CloudSunIcon:a7,CloudSunRain:i7,CloudSunRainIcon:i7,CloudUpload:g2,CloudUploadIcon:g2,Cloudy:l7,CloudyIcon:l7,Clover:Ox,CloverIcon:Ox,Club:c7,ClubIcon:c7,Code:hj,Code2:x2,Code2Icon:x2,CodeIcon:hj,CodeSquare:Pb,CodeSquareIcon:Pb,CodeXml:x2,CodeXmlIcon:x2,Codepen:d7,CodepenIcon:d7,Codesandbox:u7,CodesandboxIcon:u7,Coffee:fj,CoffeeIcon:fj,Cog:h7,CogIcon:h7,Coins:f7,CoinsIcon:f7,Columns:y2,Columns2:y2,Columns2Icon:y2,Columns3:v2,Columns3Icon:v2,Columns4:p7,Columns4Icon:p7,ColumnsIcon:y2,Combine:m7,CombineIcon:m7,Command:g7,CommandIcon:g7,Compass:x7,CompassIcon:x7,Component:y7,ComponentIcon:y7,Computer:v7,ComputerIcon:v7,ConciergeBell:_7,ConciergeBellIcon:_7,Cone:b7,ConeIcon:b7,Construction:w7,ConstructionIcon:w7,Contact:j7,Contact2:_2,Contact2Icon:_2,ContactIcon:j7,ContactRound:_2,ContactRoundIcon:_2,Container:k7,ContainerIcon:k7,Contrast:N7,ContrastIcon:N7,Cookie:S7,CookieIcon:S7,CookingPot:C7,CookingPotIcon:C7,Copy:pl,CopyCheck:M7,CopyCheckIcon:M7,CopyIcon:pl,CopyMinus:T7,CopyMinusIcon:T7,CopyPlus:A7,CopyPlusIcon:A7,CopySlash:E7,CopySlashIcon:E7,CopyX:I7,CopyXIcon:I7,Copyleft:P7,CopyleftIcon:P7,Copyright:L7,CopyrightIcon:L7,CornerDownLeft:O7,CornerDownLeftIcon:O7,CornerDownRight:D7,CornerDownRightIcon:D7,CornerLeftDown:R7,CornerLeftDownIcon:R7,CornerLeftUp:F7,CornerLeftUpIcon:F7,CornerRightDown:z7,CornerRightDownIcon:z7,CornerRightUp:B7,CornerRightUpIcon:B7,CornerUpLeft:$7,CornerUpLeftIcon:$7,CornerUpRight:U7,CornerUpRightIcon:U7,Cpu:q7,CpuIcon:q7,CreativeCommons:V7,CreativeCommonsIcon:V7,CreditCard:fm,CreditCardIcon:fm,Croissant:H7,CroissantIcon:H7,Crop:W7,CropIcon:W7,Cross:G7,CrossIcon:G7,Crosshair:K7,CrosshairIcon:K7,Crown:l1,CrownIcon:l1,Cuboid:Z7,CuboidIcon:Z7,CupSoda:Y7,CupSodaIcon:Y7,CurlyBraces:M_,CurlyBracesIcon:M_,Currency:X7,CurrencyIcon:X7,Cylinder:Q7,CylinderIcon:Q7,Dam:J7,DamIcon:J7,Database:r9,DatabaseBackup:e9,DatabaseBackupIcon:e9,DatabaseIcon:r9,DatabaseZap:t9,DatabaseZapIcon:t9,Delete:n9,DeleteIcon:n9,Dessert:s9,DessertIcon:s9,Diameter:i9,DiameterIcon:i9,Diamond:l9,DiamondIcon:l9,DiamondMinus:a9,DiamondMinusIcon:a9,DiamondPercent:b2,DiamondPercentIcon:b2,DiamondPlus:o9,DiamondPlusIcon:o9,Dice1:c9,Dice1Icon:c9,Dice2:d9,Dice2Icon:d9,Dice3:u9,Dice3Icon:u9,Dice4:h9,Dice4Icon:h9,Dice5:f9,Dice5Icon:f9,Dice6:p9,Dice6Icon:p9,Dices:m9,DicesIcon:m9,Diff:g9,DiffIcon:g9,Disc:_9,Disc2:x9,Disc2Icon:x9,Disc3:y9,Disc3Icon:y9,DiscAlbum:v9,DiscAlbumIcon:v9,DiscIcon:_9,Divide:b9,DivideCircle:e2,DivideCircleIcon:e2,DivideIcon:b9,DivideSquare:Rb,DivideSquareIcon:Rb,Dna:j9,DnaIcon:j9,DnaOff:w9,DnaOffIcon:w9,Dock:k9,DockIcon:k9,Dog:N9,DogIcon:N9,DollarSign:ud,DollarSignIcon:ud,Donut:S9,DonutIcon:S9,DoorClosed:C9,DoorClosedIcon:C9,DoorOpen:c1,DoorOpenIcon:c1,Dot:M9,DotIcon:M9,DotSquare:Fb,DotSquareIcon:Fb,Download:Va,DownloadCloud:m2,DownloadCloudIcon:m2,DownloadIcon:Va,DraftingCompass:T9,DraftingCompassIcon:T9,Drama:A9,DramaIcon:A9,Dribbble:E9,DribbbleIcon:E9,Drill:I9,DrillIcon:I9,Droplet:P9,DropletIcon:P9,Droplets:L9,DropletsIcon:L9,Drum:O9,DrumIcon:O9,Drumstick:D9,DrumstickIcon:D9,Dumbbell:R9,DumbbellIcon:R9,Ear:z9,EarIcon:z9,EarOff:F9,EarOffIcon:F9,Earth:w2,EarthIcon:w2,EarthLock:B9,EarthLockIcon:B9,Eclipse:$9,EclipseIcon:$9,Edit:rc,Edit2:m0,Edit2Icon:m0,Edit3:nb,Edit3Icon:nb,EditIcon:rc,Egg:tS,EggFried:U9,EggFriedIcon:U9,EggIcon:tS,EggOff:q9,EggOffIcon:q9,Ellipsis:lg,EllipsisIcon:lg,EllipsisVertical:Mx,EllipsisVerticalIcon:Mx,Equal:W9,EqualApproximately:V9,EqualApproximatelyIcon:V9,EqualIcon:W9,EqualNot:H9,EqualNotIcon:H9,EqualSquare:zb,EqualSquareIcon:zb,Eraser:G9,EraserIcon:G9,EthernetPort:K9,EthernetPortIcon:K9,Euro:Z9,EuroIcon:Z9,Expand:Y9,ExpandIcon:Y9,ExternalLink:Fs,ExternalLinkIcon:Fs,Eye:Qo,EyeClosed:X9,EyeClosedIcon:X9,EyeIcon:Qo,EyeOff:d1,EyeOffIcon:d1,Facebook:Od,FacebookIcon:Od,Factory:Q9,FactoryIcon:Q9,Fan:J9,FanIcon:J9,FastForward:eB,FastForwardIcon:eB,Feather:tB,FeatherIcon:tB,Fence:rB,FenceIcon:rB,FerrisWheel:nB,FerrisWheelIcon:nB,Figma:sB,FigmaIcon:sB,File:QB,FileArchive:iB,FileArchiveIcon:iB,FileAudio:oB,FileAudio2:aB,FileAudio2Icon:aB,FileAudioIcon:oB,FileAxis3D:j2,FileAxis3DIcon:j2,FileAxis3d:j2,FileAxis3dIcon:j2,FileBadge:cB,FileBadge2:lB,FileBadge2Icon:lB,FileBadgeIcon:cB,FileBarChart:k2,FileBarChart2:N2,FileBarChart2Icon:N2,FileBarChartIcon:k2,FileBox:dB,FileBoxIcon:dB,FileChartColumn:N2,FileChartColumnIcon:N2,FileChartColumnIncreasing:k2,FileChartColumnIncreasingIcon:k2,FileChartLine:S2,FileChartLineIcon:S2,FileChartPie:C2,FileChartPieIcon:C2,FileCheck:hB,FileCheck2:uB,FileCheck2Icon:uB,FileCheckIcon:hB,FileClock:fB,FileClockIcon:fB,FileCode:mB,FileCode2:pB,FileCode2Icon:pB,FileCodeIcon:mB,FileCog:M2,FileCog2:M2,FileCog2Icon:M2,FileCogIcon:M2,FileDiff:gB,FileDiffIcon:gB,FileDigit:xB,FileDigitIcon:xB,FileDown:yB,FileDownIcon:yB,FileEdit:A2,FileEditIcon:A2,FileHeart:vB,FileHeartIcon:vB,FileIcon:QB,FileImage:u1,FileImageIcon:u1,FileInput:_B,FileInputIcon:_B,FileJson:wB,FileJson2:bB,FileJson2Icon:bB,FileJsonIcon:wB,FileKey:kB,FileKey2:jB,FileKey2Icon:jB,FileKeyIcon:kB,FileLineChart:S2,FileLineChartIcon:S2,FileLock:SB,FileLock2:NB,FileLock2Icon:NB,FileLockIcon:SB,FileMinus:MB,FileMinus2:CB,FileMinus2Icon:CB,FileMinusIcon:MB,FileMusic:TB,FileMusicIcon:TB,FileOutput:AB,FileOutputIcon:AB,FilePen:A2,FilePenIcon:A2,FilePenLine:T2,FilePenLineIcon:T2,FilePieChart:C2,FilePieChartIcon:C2,FilePlus:IB,FilePlus2:EB,FilePlus2Icon:EB,FilePlusIcon:IB,FileQuestion:PB,FileQuestionIcon:PB,FileScan:LB,FileScanIcon:LB,FileSearch:DB,FileSearch2:OB,FileSearch2Icon:OB,FileSearchIcon:DB,FileSignature:T2,FileSignatureIcon:T2,FileSliders:RB,FileSlidersIcon:RB,FileSpreadsheet:h1,FileSpreadsheetIcon:h1,FileStack:FB,FileStackIcon:FB,FileSymlink:zB,FileSymlinkIcon:zB,FileTerminal:BB,FileTerminalIcon:BB,FileText:wi,FileTextIcon:wi,FileType:UB,FileType2:$B,FileType2Icon:$B,FileTypeIcon:UB,FileUp:qB,FileUpIcon:qB,FileUser:VB,FileUserIcon:VB,FileVideo:WB,FileVideo2:HB,FileVideo2Icon:HB,FileVideoIcon:WB,FileVolume:KB,FileVolume2:GB,FileVolume2Icon:GB,FileVolumeIcon:KB,FileWarning:ZB,FileWarningIcon:ZB,FileX:XB,FileX2:YB,FileX2Icon:YB,FileXIcon:XB,Files:JB,FilesIcon:JB,Film:Ad,FilmIcon:Ad,Filter:pj,FilterIcon:pj,FilterX:e$,FilterXIcon:e$,Fingerprint:t$,FingerprintIcon:t$,FireExtinguisher:r$,FireExtinguisherIcon:r$,Fish:i$,FishIcon:i$,FishOff:n$,FishOffIcon:n$,FishSymbol:s$,FishSymbolIcon:s$,Flag:Ux,FlagIcon:Ux,FlagOff:a$,FlagOffIcon:a$,FlagTriangleLeft:o$,FlagTriangleLeftIcon:o$,FlagTriangleRight:l$,FlagTriangleRightIcon:l$,Flame:Zh,FlameIcon:Zh,FlameKindling:c$,FlameKindlingIcon:c$,Flashlight:u$,FlashlightIcon:u$,FlashlightOff:d$,FlashlightOffIcon:d$,FlaskConical:mj,FlaskConicalIcon:mj,FlaskConicalOff:h$,FlaskConicalOffIcon:h$,FlaskRound:f$,FlaskRoundIcon:f$,FlipHorizontal:m$,FlipHorizontal2:p$,FlipHorizontal2Icon:p$,FlipHorizontalIcon:m$,FlipVertical:x$,FlipVertical2:g$,FlipVertical2Icon:g$,FlipVerticalIcon:x$,Flower:y$,Flower2:im,Flower2Icon:im,FlowerIcon:y$,Focus:v$,FocusIcon:v$,FoldHorizontal:_$,FoldHorizontalIcon:_$,FoldVertical:b$,FoldVerticalIcon:b$,Folder:K$,FolderArchive:w$,FolderArchiveIcon:w$,FolderCheck:j$,FolderCheckIcon:j$,FolderClock:k$,FolderClockIcon:k$,FolderClosed:N$,FolderClosedIcon:N$,FolderCode:S$,FolderCodeIcon:S$,FolderCog:E2,FolderCog2:E2,FolderCog2Icon:E2,FolderCogIcon:E2,FolderDot:C$,FolderDotIcon:C$,FolderDown:M$,FolderDownIcon:M$,FolderEdit:I2,FolderEditIcon:I2,FolderGit:A$,FolderGit2:T$,FolderGit2Icon:T$,FolderGitIcon:A$,FolderHeart:E$,FolderHeartIcon:E$,FolderIcon:K$,FolderInput:I$,FolderInputIcon:I$,FolderKanban:P$,FolderKanbanIcon:P$,FolderKey:L$,FolderKeyIcon:L$,FolderLock:O$,FolderLockIcon:O$,FolderMinus:D$,FolderMinusIcon:D$,FolderOpen:qx,FolderOpenDot:R$,FolderOpenDotIcon:R$,FolderOpenIcon:qx,FolderOutput:F$,FolderOutputIcon:F$,FolderPen:I2,FolderPenIcon:I2,FolderPlus:z$,FolderPlusIcon:z$,FolderRoot:B$,FolderRootIcon:B$,FolderSearch:U$,FolderSearch2:$$,FolderSearch2Icon:$$,FolderSearchIcon:U$,FolderSymlink:q$,FolderSymlinkIcon:q$,FolderSync:V$,FolderSyncIcon:V$,FolderTree:H$,FolderTreeIcon:H$,FolderUp:W$,FolderUpIcon:W$,FolderX:G$,FolderXIcon:G$,Folders:Z$,FoldersIcon:Z$,Footprints:Y$,FootprintsIcon:Y$,ForkKnife:kw,ForkKnifeCrossed:jw,ForkKnifeCrossedIcon:jw,ForkKnifeIcon:kw,Forklift:X$,ForkliftIcon:X$,FormInput:ib,FormInputIcon:ib,Forward:Q$,ForwardIcon:Q$,Frame:J$,FrameIcon:J$,Framer:eU,FramerIcon:eU,Frown:tU,FrownIcon:tU,Fuel:rU,FuelIcon:rU,Fullscreen:nU,FullscreenIcon:nU,FunctionSquare:Bb,FunctionSquareIcon:Bb,GalleryHorizontal:iU,GalleryHorizontalEnd:sU,GalleryHorizontalEndIcon:sU,GalleryHorizontalIcon:iU,GalleryThumbnails:aU,GalleryThumbnailsIcon:aU,GalleryVertical:lU,GalleryVerticalEnd:oU,GalleryVerticalEndIcon:oU,GalleryVerticalIcon:lU,Gamepad:dU,Gamepad2:cU,Gamepad2Icon:cU,GamepadIcon:dU,GanttChart:z_,GanttChartIcon:z_,GanttChartSquare:Jm,GanttChartSquareIcon:Jm,Gauge:uU,GaugeCircle:t2,GaugeCircleIcon:t2,GaugeIcon:uU,Gavel:hU,GavelIcon:hU,Gem:fU,GemIcon:fU,Ghost:gj,GhostIcon:gj,Gift:Ha,GiftIcon:Ha,GitBranch:mU,GitBranchIcon:mU,GitBranchPlus:pU,GitBranchPlusIcon:pU,GitCommit:P2,GitCommitHorizontal:P2,GitCommitHorizontalIcon:P2,GitCommitIcon:P2,GitCommitVertical:gU,GitCommitVerticalIcon:gU,GitCompare:yU,GitCompareArrows:xU,GitCompareArrowsIcon:xU,GitCompareIcon:yU,GitFork:vU,GitForkIcon:vU,GitGraph:_U,GitGraphIcon:_U,GitMerge:bU,GitMergeIcon:bU,GitPullRequest:CU,GitPullRequestArrow:wU,GitPullRequestArrowIcon:wU,GitPullRequestClosed:jU,GitPullRequestClosedIcon:jU,GitPullRequestCreate:NU,GitPullRequestCreateArrow:kU,GitPullRequestCreateArrowIcon:kU,GitPullRequestCreateIcon:NU,GitPullRequestDraft:SU,GitPullRequestDraftIcon:SU,GitPullRequestIcon:CU,Github:MU,GithubIcon:MU,Gitlab:TU,GitlabIcon:TU,GlassWater:AU,GlassWaterIcon:AU,Glasses:EU,GlassesIcon:EU,Globe:Vx,Globe2:w2,Globe2Icon:w2,GlobeIcon:Vx,GlobeLock:IU,GlobeLockIcon:IU,Goal:PU,GoalIcon:PU,Grab:LU,GrabIcon:LU,GraduationCap:f1,GraduationCapIcon:f1,Grape:OU,GrapeIcon:OU,Grid:Dh,Grid2X2:O2,Grid2X2Icon:O2,Grid2X2Plus:L2,Grid2X2PlusIcon:L2,Grid2x2:O2,Grid2x2Check:DU,Grid2x2CheckIcon:DU,Grid2x2Icon:O2,Grid2x2Plus:L2,Grid2x2PlusIcon:L2,Grid2x2X:RU,Grid2x2XIcon:RU,Grid3X3:Dh,Grid3X3Icon:Dh,Grid3x3:Dh,Grid3x3Icon:Dh,GridIcon:Dh,Grip:zU,GripHorizontal:FU,GripHorizontalIcon:FU,GripIcon:zU,GripVertical:p1,GripVerticalIcon:p1,Group:BU,GroupIcon:BU,Guitar:$U,GuitarIcon:$U,Ham:UU,HamIcon:UU,Hammer:qU,HammerIcon:qU,Hand:KU,HandCoins:VU,HandCoinsIcon:VU,HandHeart:HU,HandHeartIcon:HU,HandHelping:D2,HandHelpingIcon:D2,HandIcon:KU,HandMetal:WU,HandMetalIcon:WU,HandPlatter:GU,HandPlatterIcon:GU,Handshake:ZU,HandshakeIcon:ZU,HardDrive:IT,HardDriveDownload:YU,HardDriveDownloadIcon:YU,HardDriveIcon:IT,HardDriveUpload:XU,HardDriveUploadIcon:XU,HardHat:QU,HardHatIcon:QU,Hash:rS,HashIcon:rS,Haze:JU,HazeIcon:JU,HdmiPort:eq,HdmiPortIcon:eq,Heading:iq,Heading1:PT,Heading1Icon:PT,Heading2:LT,Heading2Icon:LT,Heading3:tq,Heading3Icon:tq,Heading4:rq,Heading4Icon:rq,Heading5:nq,Heading5Icon:nq,Heading6:sq,Heading6Icon:sq,HeadingIcon:iq,HeadphoneOff:aq,HeadphoneOffIcon:aq,Headphones:oq,HeadphonesIcon:oq,Headset:lq,HeadsetIcon:lq,Heart:oa,HeartCrack:cq,HeartCrackIcon:cq,HeartHandshake:dq,HeartHandshakeIcon:dq,HeartIcon:oa,HeartOff:uq,HeartOffIcon:uq,HeartPulse:hq,HeartPulseIcon:hq,Heater:fq,HeaterIcon:fq,HelpCircle:Cx,HelpCircleIcon:Cx,HelpingHand:D2,HelpingHandIcon:D2,Hexagon:pq,HexagonIcon:pq,Highlighter:mq,HighlighterIcon:mq,History:nS,HistoryIcon:nS,Home:fi,HomeIcon:fi,Hop:xq,HopIcon:xq,HopOff:gq,HopOffIcon:gq,Hospital:yq,HospitalIcon:yq,Hotel:vq,HotelIcon:vq,Hourglass:_q,HourglassIcon:_q,House:fi,HouseIcon:fi,HousePlug:bq,HousePlugIcon:bq,HousePlus:wq,HousePlusIcon:wq,IceCream:F2,IceCream2:R2,IceCream2Icon:R2,IceCreamBowl:R2,IceCreamBowlIcon:R2,IceCreamCone:F2,IceCreamConeIcon:F2,IceCreamIcon:F2,Icon:EAe,IdCard:jq,IdCardIcon:jq,Image:Do,ImageDown:kq,ImageDownIcon:kq,ImageIcon:Do,ImageMinus:Nq,ImageMinusIcon:Nq,ImageOff:Sq,ImageOffIcon:Sq,ImagePlay:Cq,ImagePlayIcon:Cq,ImagePlus:sS,ImagePlusIcon:sS,ImageUp:Mq,ImageUpIcon:Mq,ImageUpscale:Tq,ImageUpscaleIcon:Tq,Images:Aq,ImagesIcon:Aq,Import:Eq,ImportIcon:Eq,Inbox:Iq,InboxIcon:Iq,Indent:B2,IndentDecrease:z2,IndentDecreaseIcon:z2,IndentIcon:B2,IndentIncrease:B2,IndentIncreaseIcon:B2,IndianRupee:Pq,IndianRupeeIcon:Pq,Infinity:Lq,InfinityIcon:Lq,Info:Oq,InfoIcon:Oq,Inspect:Wb,InspectIcon:Wb,InspectionPanel:Dq,InspectionPanelIcon:Dq,Instagram:eu,InstagramIcon:eu,Italic:iS,ItalicIcon:iS,IterationCcw:Rq,IterationCcwIcon:Rq,IterationCw:Fq,IterationCwIcon:Fq,JapaneseYen:zq,JapaneseYenIcon:zq,Joystick:Bq,JoystickIcon:Bq,Kanban:m1,KanbanIcon:m1,KanbanSquare:$b,KanbanSquareDashed:Lb,KanbanSquareDashedIcon:Lb,KanbanSquareIcon:$b,Key:Yh,KeyIcon:Yh,KeyRound:xj,KeyRoundIcon:xj,KeySquare:$q,KeySquareIcon:$q,Keyboard:Vq,KeyboardIcon:Vq,KeyboardMusic:Uq,KeyboardMusicIcon:Uq,KeyboardOff:qq,KeyboardOffIcon:qq,Lamp:Yq,LampCeiling:Hq,LampCeilingIcon:Hq,LampDesk:Wq,LampDeskIcon:Wq,LampFloor:Gq,LampFloorIcon:Gq,LampIcon:Yq,LampWallDown:Kq,LampWallDownIcon:Kq,LampWallUp:Zq,LampWallUpIcon:Zq,LandPlot:Xq,LandPlotIcon:Xq,Landmark:Qq,LandmarkIcon:Qq,Languages:Jq,LanguagesIcon:Jq,Laptop:tV,Laptop2:$2,Laptop2Icon:$2,LaptopIcon:tV,LaptopMinimal:$2,LaptopMinimalCheck:eV,LaptopMinimalCheckIcon:eV,LaptopMinimalIcon:$2,Lasso:nV,LassoIcon:nV,LassoSelect:rV,LassoSelectIcon:rV,Laugh:sV,LaughIcon:sV,Layers:oV,Layers2:iV,Layers2Icon:iV,Layers3:aV,Layers3Icon:aV,LayersIcon:oV,Layout:p0,LayoutDashboard:aS,LayoutDashboardIcon:aS,LayoutGrid:pm,LayoutGridIcon:pm,LayoutIcon:p0,LayoutList:lV,LayoutListIcon:lV,LayoutPanelLeft:cV,LayoutPanelLeftIcon:cV,LayoutPanelTop:dV,LayoutPanelTopIcon:dV,LayoutTemplate:uV,LayoutTemplateIcon:uV,Leaf:hV,LeafIcon:hV,LeafyGreen:fV,LeafyGreenIcon:fV,Lectern:pV,LecternIcon:pV,LetterText:mV,LetterTextIcon:mV,Library:oS,LibraryBig:gV,LibraryBigIcon:gV,LibraryIcon:oS,LibrarySquare:Ub,LibrarySquareIcon:Ub,LifeBuoy:lS,LifeBuoyIcon:lS,Ligature:xV,LigatureIcon:xV,Lightbulb:g1,LightbulbIcon:g1,LightbulbOff:yV,LightbulbOffIcon:yV,LineChart:D_,LineChartIcon:D_,Link:So,Link2:Xh,Link2Icon:Xh,Link2Off:vV,Link2OffIcon:vV,LinkIcon:So,Linkedin:mm,LinkedinIcon:mm,List:Wf,ListCheck:_V,ListCheckIcon:_V,ListChecks:bV,ListChecksIcon:bV,ListCollapse:wV,ListCollapseIcon:wV,ListEnd:jV,ListEndIcon:jV,ListFilter:kV,ListFilterIcon:kV,ListIcon:Wf,ListMinus:NV,ListMinusIcon:NV,ListMusic:SV,ListMusicIcon:SV,ListOrdered:cS,ListOrderedIcon:cS,ListPlus:CV,ListPlusIcon:CV,ListRestart:MV,ListRestartIcon:MV,ListStart:TV,ListStartIcon:TV,ListTodo:AV,ListTodoIcon:AV,ListTree:EV,ListTreeIcon:EV,ListVideo:IV,ListVideoIcon:IV,ListX:PV,ListXIcon:PV,Loader:OV,Loader2:nn,Loader2Icon:nn,LoaderCircle:nn,LoaderCircleIcon:nn,LoaderIcon:OV,LoaderPinwheel:LV,LoaderPinwheelIcon:LV,Locate:OT,LocateFixed:DV,LocateFixedIcon:DV,LocateIcon:OT,LocateOff:RV,LocateOffIcon:RV,Lock:Gf,LockIcon:Gf,LockKeyhole:FV,LockKeyholeIcon:FV,LockKeyholeOpen:U2,LockKeyholeOpenIcon:U2,LockOpen:q2,LockOpenIcon:q2,LogIn:dS,LogInIcon:dS,LogOut:uS,LogOutIcon:uS,Logs:zV,LogsIcon:zV,Lollipop:BV,LollipopIcon:BV,LucideAArrowDown:y8,LucideAArrowUp:v8,LucideALargeSmall:_8,LucideAccessibility:b8,LucideActivity:yg,LucideActivitySquare:fb,LucideAirVent:w8,LucideAirplay:j8,LucideAlarmCheck:p_,LucideAlarmClock:N8,LucideAlarmClockCheck:p_,LucideAlarmClockMinus:m_,LucideAlarmClockOff:k8,LucideAlarmClockPlus:g_,LucideAlarmMinus:m_,LucideAlarmPlus:g_,LucideAlarmSmoke:S8,LucideAlbum:C8,LucideAlertCircle:El,LucideAlertOctagon:W2,LucideAlertTriangle:Bh,LucideAlignCenter:Y4,LucideAlignCenterHorizontal:M8,LucideAlignCenterVertical:T8,LucideAlignEndHorizontal:A8,LucideAlignEndVertical:E8,LucideAlignHorizontalDistributeCenter:I8,LucideAlignHorizontalDistributeEnd:P8,LucideAlignHorizontalDistributeStart:L8,LucideAlignHorizontalJustifyCenter:O8,LucideAlignHorizontalJustifyEnd:D8,LucideAlignHorizontalJustifyStart:R8,LucideAlignHorizontalSpaceAround:F8,LucideAlignHorizontalSpaceBetween:z8,LucideAlignJustify:B8,LucideAlignLeft:X4,LucideAlignRight:Q4,LucideAlignStartHorizontal:$8,LucideAlignStartVertical:U8,LucideAlignVerticalDistributeCenter:q8,LucideAlignVerticalDistributeEnd:V8,LucideAlignVerticalDistributeStart:H8,LucideAlignVerticalJustifyCenter:W8,LucideAlignVerticalJustifyEnd:G8,LucideAlignVerticalJustifyStart:K8,LucideAlignVerticalSpaceAround:Z8,LucideAlignVerticalSpaceBetween:Y8,LucideAmbulance:X8,LucideAmpersand:Q8,LucideAmpersands:J8,LucideAmphora:eO,LucideAnchor:tO,LucideAngry:rO,LucideAnnoyed:nO,LucideAntenna:sO,LucideAnvil:iO,LucideAperture:aO,LucideAppWindow:MT,LucideAppWindowMac:oO,LucideApple:lO,LucideArchive:uO,LucideArchiveRestore:cO,LucideArchiveX:dO,LucideAreaChart:A_,LucideArmchair:hO,LucideArrowBigDown:pO,LucideArrowBigDownDash:fO,LucideArrowBigLeft:gO,LucideArrowBigLeftDash:mO,LucideArrowBigRight:yO,LucideArrowBigRightDash:xO,LucideArrowBigUp:_O,LucideArrowBigUpDash:vO,LucideArrowDown:i1,LucideArrowDown01:bO,LucideArrowDown10:wO,LucideArrowDownAZ:x_,LucideArrowDownAz:x_,LucideArrowDownCircle:U_,LucideArrowDownFromLine:jO,LucideArrowDownLeft:kO,LucideArrowDownLeftFromCircle:V_,LucideArrowDownLeftFromSquare:yb,LucideArrowDownLeftSquare:pb,LucideArrowDownNarrowWide:NO,LucideArrowDownRight:SO,LucideArrowDownRightFromCircle:H_,LucideArrowDownRightFromSquare:vb,LucideArrowDownRightSquare:mb,LucideArrowDownSquare:gb,LucideArrowDownToDot:CO,LucideArrowDownToLine:MO,LucideArrowDownUp:TO,LucideArrowDownWideNarrow:y_,LucideArrowDownZA:v_,LucideArrowDownZa:v_,LucideArrowLeft:Qa,LucideArrowLeftCircle:q_,LucideArrowLeftFromLine:AO,LucideArrowLeftRight:EO,LucideArrowLeftSquare:xb,LucideArrowLeftToLine:IO,LucideArrowRight:Zo,LucideArrowRightCircle:K_,LucideArrowRightFromLine:PO,LucideArrowRightLeft:LO,LucideArrowRightSquare:wb,LucideArrowRightToLine:OO,LucideArrowUp:vg,LucideArrowUp01:DO,LucideArrowUp10:RO,LucideArrowUpAZ:__,LucideArrowUpAz:__,LucideArrowUpCircle:Z_,LucideArrowUpDown:$x,LucideArrowUpFromDot:FO,LucideArrowUpFromLine:zO,LucideArrowUpLeft:BO,LucideArrowUpLeftFromCircle:W_,LucideArrowUpLeftFromSquare:_b,LucideArrowUpLeftSquare:jb,LucideArrowUpNarrowWide:b_,LucideArrowUpRight:$O,LucideArrowUpRightFromCircle:G_,LucideArrowUpRightFromSquare:bb,LucideArrowUpRightSquare:kb,LucideArrowUpSquare:Nb,LucideArrowUpToLine:UO,LucideArrowUpWideNarrow:qO,LucideArrowUpZA:w_,LucideArrowUpZa:w_,LucideArrowsUpFromLine:VO,LucideAsterisk:HO,LucideAsteriskSquare:Sb,LucideAtSign:WO,LucideAtom:GO,LucideAudioLines:KO,LucideAudioWaveform:ZO,LucideAward:Pl,LucideAxe:YO,LucideAxis3D:j_,LucideAxis3d:j_,LucideBaby:XO,LucideBackpack:QO,LucideBadge:pD,LucideBadgeAlert:JO,LucideBadgeCent:eD,LucideBadgeCheck:k_,LucideBadgeDollarSign:tD,LucideBadgeEuro:rD,LucideBadgeHelp:nD,LucideBadgeIndianRupee:sD,LucideBadgeInfo:iD,LucideBadgeJapaneseYen:aD,LucideBadgeMinus:oD,LucideBadgePercent:lD,LucideBadgePlus:cD,LucideBadgePoundSterling:dD,LucideBadgeRussianRuble:uD,LucideBadgeSwissFranc:hD,LucideBadgeX:fD,LucideBaggageClaim:mD,LucideBan:gD,LucideBanana:xD,LucideBandage:yD,LucideBanknote:vD,LucideBarChart:R_,LucideBarChart2:F_,LucideBarChart3:ac,LucideBarChart4:O_,LucideBarChartBig:L_,LucideBarChartHorizontal:I_,LucideBarChartHorizontalBig:E_,LucideBarcode:_D,LucideBaseline:bD,LucideBath:Vf,LucideBattery:CD,LucideBatteryCharging:wD,LucideBatteryFull:jD,LucideBatteryLow:kD,LucideBatteryMedium:ND,LucideBatteryWarning:SD,LucideBeaker:MD,LucideBean:AD,LucideBeanOff:TD,LucideBed:Hf,LucideBedDouble:ED,LucideBedSingle:ID,LucideBeef:PD,LucideBeer:OD,LucideBeerOff:LD,LucideBell:_g,LucideBellDot:DD,LucideBellElectric:RD,LucideBellMinus:FD,LucideBellOff:cj,LucideBellPlus:zD,LucideBellRing:BD,LucideBetweenHorizonalEnd:N_,LucideBetweenHorizonalStart:S_,LucideBetweenHorizontalEnd:N_,LucideBetweenHorizontalStart:S_,LucideBetweenVerticalEnd:$D,LucideBetweenVerticalStart:UD,LucideBicepsFlexed:qD,LucideBike:VD,LucideBinary:HD,LucideBinoculars:WD,LucideBiohazard:GD,LucideBird:KD,LucideBitcoin:ZD,LucideBlend:YD,LucideBlinds:XD,LucideBlocks:QD,LucideBluetooth:rR,LucideBluetoothConnected:JD,LucideBluetoothOff:eR,LucideBluetoothSearching:tR,LucideBold:J4,LucideBolt:nR,LucideBomb:sR,LucideBone:iR,LucideBook:CR,LucideBookA:aR,LucideBookAudio:oR,LucideBookCheck:lR,LucideBookCopy:cR,LucideBookDashed:C_,LucideBookDown:dR,LucideBookHeadphones:uR,LucideBookHeart:hR,LucideBookImage:fR,LucideBookKey:pR,LucideBookLock:mR,LucideBookMarked:gR,LucideBookMinus:xR,LucideBookOpen:TT,LucideBookOpenCheck:yR,LucideBookOpenText:vR,LucideBookPlus:_R,LucideBookTemplate:C_,LucideBookText:bR,LucideBookType:wR,LucideBookUp:kR,LucideBookUp2:jR,LucideBookUser:NR,LucideBookX:SR,LucideBookmark:um,LucideBookmarkCheck:MR,LucideBookmarkMinus:TR,LucideBookmarkPlus:AR,LucideBookmarkX:ER,LucideBoomBox:IR,LucideBot:eS,LucideBotMessageSquare:PR,LucideBotOff:LR,LucideBox:OR,LucideBoxSelect:Db,LucideBoxes:DR,LucideBraces:M_,LucideBrackets:RR,LucideBrain:AT,LucideBrainCircuit:FR,LucideBrainCog:zR,LucideBrickWall:BR,LucideBriefcase:yh,LucideBriefcaseBusiness:$R,LucideBriefcaseConveyorBelt:UR,LucideBriefcaseMedical:qR,LucideBringToFront:VR,LucideBrush:HR,LucideBug:KR,LucideBugOff:WR,LucideBugPlay:GR,LucideBuilding:dj,LucideBuilding2:na,LucideBus:YR,LucideBusFront:ZR,LucideCable:QR,LucideCableCar:XR,LucideCake:Kh,LucideCakeSlice:JR,LucideCalculator:eF,LucideCalendar:zs,LucideCalendar1:tF,LucideCalendarArrowDown:rF,LucideCalendarArrowUp:nF,LucideCalendarCheck:iF,LucideCalendarCheck2:sF,LucideCalendarClock:aF,LucideCalendarCog:oF,LucideCalendarDays:hm,LucideCalendarFold:lF,LucideCalendarHeart:cF,LucideCalendarMinus:uF,LucideCalendarMinus2:dF,LucideCalendarOff:hF,LucideCalendarPlus:uj,LucideCalendarPlus2:fF,LucideCalendarRange:pF,LucideCalendarSearch:mF,LucideCalendarSync:gF,LucideCalendarX:yF,LucideCalendarX2:xF,LucideCamera:bg,LucideCameraOff:vF,LucideCandlestickChart:P_,LucideCandy:wF,LucideCandyCane:_F,LucideCandyOff:bF,LucideCannabis:jF,LucideCaptions:T_,LucideCaptionsOff:kF,LucideCar:CF,LucideCarFront:NF,LucideCarTaxiFront:SF,LucideCaravan:MF,LucideCarrot:TF,LucideCaseLower:AF,LucideCaseSensitive:EF,LucideCaseUpper:IF,LucideCassetteTape:PF,LucideCast:LF,LucideCastle:OF,LucideCat:DF,LucideCctv:RF,LucideChartArea:A_,LucideChartBar:I_,LucideChartBarBig:E_,LucideChartBarDecreasing:FF,LucideChartBarIncreasing:zF,LucideChartBarStacked:BF,LucideChartCandlestick:P_,LucideChartColumn:ac,LucideChartColumnBig:L_,LucideChartColumnDecreasing:$F,LucideChartColumnIncreasing:O_,LucideChartColumnStacked:UF,LucideChartGantt:qF,LucideChartLine:D_,LucideChartNetwork:VF,LucideChartNoAxesColumn:F_,LucideChartNoAxesColumnDecreasing:HF,LucideChartNoAxesColumnIncreasing:R_,LucideChartNoAxesCombined:WF,LucideChartNoAxesGantt:z_,LucideChartPie:B_,LucideChartScatter:$_,LucideChartSpline:GF,LucideCheck:Ca,LucideCheckCheck:KF,LucideCheckCircle:qa,LucideCheckCircle2:Ya,LucideCheckSquare:g0,LucideCheckSquare2:Mb,LucideChefHat:ZF,LucideCherry:YF,LucideChevronDown:Pu,LucideChevronDownCircle:Y_,LucideChevronDownSquare:Tb,LucideChevronFirst:XF,LucideChevronLast:QF,LucideChevronLeft:qc,LucideChevronLeftCircle:X_,LucideChevronLeftSquare:Ab,LucideChevronRight:Ka,LucideChevronRightCircle:Q_,LucideChevronRightSquare:Eb,LucideChevronUp:a1,LucideChevronUpCircle:J_,LucideChevronUpSquare:Ib,LucideChevronsDown:ez,LucideChevronsDownUp:JF,LucideChevronsLeft:nz,LucideChevronsLeftRight:rz,LucideChevronsLeftRightEllipsis:tz,LucideChevronsRight:iz,LucideChevronsRightLeft:sz,LucideChevronsUp:az,LucideChevronsUpDown:o1,LucideChrome:oz,LucideChurch:lz,LucideCigarette:dz,LucideCigaretteOff:cz,LucideCircle:Lu,LucideCircleAlert:El,LucideCircleArrowDown:U_,LucideCircleArrowLeft:q_,LucideCircleArrowOutDownLeft:V_,LucideCircleArrowOutDownRight:H_,LucideCircleArrowOutUpLeft:W_,LucideCircleArrowOutUpRight:G_,LucideCircleArrowRight:K_,LucideCircleArrowUp:Z_,LucideCircleCheck:Ya,LucideCircleCheckBig:qa,LucideCircleChevronDown:Y_,LucideCircleChevronLeft:X_,LucideCircleChevronRight:Q_,LucideCircleChevronUp:J_,LucideCircleDashed:uz,LucideCircleDivide:e2,LucideCircleDollarSign:hz,LucideCircleDot:pz,LucideCircleDotDashed:fz,LucideCircleEllipsis:mz,LucideCircleEqual:gz,LucideCircleFadingArrowUp:xz,LucideCircleFadingPlus:yz,LucideCircleGauge:t2,LucideCircleHelp:Cx,LucideCircleMinus:r2,LucideCircleOff:vz,LucideCircleParking:s2,LucideCircleParkingOff:n2,LucideCirclePause:i2,LucideCirclePercent:a2,LucideCirclePlay:Df,LucideCirclePlus:o2,LucideCirclePower:l2,LucideCircleSlash:_z,LucideCircleSlash2:c2,LucideCircleSlashed:c2,LucideCircleStop:d2,LucideCircleUser:h2,LucideCircleUserRound:u2,LucideCircleX:zc,LucideCircuitBoard:bz,LucideCitrus:wz,LucideClapperboard:jz,LucideClipboard:Ez,LucideClipboardCheck:ET,LucideClipboardCopy:kz,LucideClipboardEdit:p2,LucideClipboardList:Nz,LucideClipboardMinus:Sz,LucideClipboardPaste:Cz,LucideClipboardPen:p2,LucideClipboardPenLine:f2,LucideClipboardPlus:Mz,LucideClipboardSignature:f2,LucideClipboardType:Tz,LucideClipboardX:Az,LucideClock:Ki,LucideClock1:Iz,LucideClock10:Pz,LucideClock11:Lz,LucideClock12:Oz,LucideClock2:Dz,LucideClock3:Rz,LucideClock4:Fz,LucideClock5:zz,LucideClock6:Bz,LucideClock7:$z,LucideClock8:Uz,LucideClock9:qz,LucideClockAlert:Vz,LucideClockArrowDown:Hz,LucideClockArrowUp:Wz,LucideCloud:o7,LucideCloudAlert:Gz,LucideCloudCog:Kz,LucideCloudDownload:m2,LucideCloudDrizzle:Zz,LucideCloudFog:Yz,LucideCloudHail:Xz,LucideCloudLightning:Qz,LucideCloudMoon:e7,LucideCloudMoonRain:Jz,LucideCloudOff:t7,LucideCloudRain:n7,LucideCloudRainWind:r7,LucideCloudSnow:s7,LucideCloudSun:a7,LucideCloudSunRain:i7,LucideCloudUpload:g2,LucideCloudy:l7,LucideClover:Ox,LucideClub:c7,LucideCode:hj,LucideCode2:x2,LucideCodeSquare:Pb,LucideCodeXml:x2,LucideCodepen:d7,LucideCodesandbox:u7,LucideCoffee:fj,LucideCog:h7,LucideCoins:f7,LucideColumns:y2,LucideColumns2:y2,LucideColumns3:v2,LucideColumns4:p7,LucideCombine:m7,LucideCommand:g7,LucideCompass:x7,LucideComponent:y7,LucideComputer:v7,LucideConciergeBell:_7,LucideCone:b7,LucideConstruction:w7,LucideContact:j7,LucideContact2:_2,LucideContactRound:_2,LucideContainer:k7,LucideContrast:N7,LucideCookie:S7,LucideCookingPot:C7,LucideCopy:pl,LucideCopyCheck:M7,LucideCopyMinus:T7,LucideCopyPlus:A7,LucideCopySlash:E7,LucideCopyX:I7,LucideCopyleft:P7,LucideCopyright:L7,LucideCornerDownLeft:O7,LucideCornerDownRight:D7,LucideCornerLeftDown:R7,LucideCornerLeftUp:F7,LucideCornerRightDown:z7,LucideCornerRightUp:B7,LucideCornerUpLeft:$7,LucideCornerUpRight:U7,LucideCpu:q7,LucideCreativeCommons:V7,LucideCreditCard:fm,LucideCroissant:H7,LucideCrop:W7,LucideCross:G7,LucideCrosshair:K7,LucideCrown:l1,LucideCuboid:Z7,LucideCupSoda:Y7,LucideCurlyBraces:M_,LucideCurrency:X7,LucideCylinder:Q7,LucideDam:J7,LucideDatabase:r9,LucideDatabaseBackup:e9,LucideDatabaseZap:t9,LucideDelete:n9,LucideDessert:s9,LucideDiameter:i9,LucideDiamond:l9,LucideDiamondMinus:a9,LucideDiamondPercent:b2,LucideDiamondPlus:o9,LucideDice1:c9,LucideDice2:d9,LucideDice3:u9,LucideDice4:h9,LucideDice5:f9,LucideDice6:p9,LucideDices:m9,LucideDiff:g9,LucideDisc:_9,LucideDisc2:x9,LucideDisc3:y9,LucideDiscAlbum:v9,LucideDivide:b9,LucideDivideCircle:e2,LucideDivideSquare:Rb,LucideDna:j9,LucideDnaOff:w9,LucideDock:k9,LucideDog:N9,LucideDollarSign:ud,LucideDonut:S9,LucideDoorClosed:C9,LucideDoorOpen:c1,LucideDot:M9,LucideDotSquare:Fb,LucideDownload:Va,LucideDownloadCloud:m2,LucideDraftingCompass:T9,LucideDrama:A9,LucideDribbble:E9,LucideDrill:I9,LucideDroplet:P9,LucideDroplets:L9,LucideDrum:O9,LucideDrumstick:D9,LucideDumbbell:R9,LucideEar:z9,LucideEarOff:F9,LucideEarth:w2,LucideEarthLock:B9,LucideEclipse:$9,LucideEdit:rc,LucideEdit2:m0,LucideEdit3:nb,LucideEgg:tS,LucideEggFried:U9,LucideEggOff:q9,LucideEllipsis:lg,LucideEllipsisVertical:Mx,LucideEqual:W9,LucideEqualApproximately:V9,LucideEqualNot:H9,LucideEqualSquare:zb,LucideEraser:G9,LucideEthernetPort:K9,LucideEuro:Z9,LucideExpand:Y9,LucideExternalLink:Fs,LucideEye:Qo,LucideEyeClosed:X9,LucideEyeOff:d1,LucideFacebook:Od,LucideFactory:Q9,LucideFan:J9,LucideFastForward:eB,LucideFeather:tB,LucideFence:rB,LucideFerrisWheel:nB,LucideFigma:sB,LucideFile:QB,LucideFileArchive:iB,LucideFileAudio:oB,LucideFileAudio2:aB,LucideFileAxis3D:j2,LucideFileAxis3d:j2,LucideFileBadge:cB,LucideFileBadge2:lB,LucideFileBarChart:k2,LucideFileBarChart2:N2,LucideFileBox:dB,LucideFileChartColumn:N2,LucideFileChartColumnIncreasing:k2,LucideFileChartLine:S2,LucideFileChartPie:C2,LucideFileCheck:hB,LucideFileCheck2:uB,LucideFileClock:fB,LucideFileCode:mB,LucideFileCode2:pB,LucideFileCog:M2,LucideFileCog2:M2,LucideFileDiff:gB,LucideFileDigit:xB,LucideFileDown:yB,LucideFileEdit:A2,LucideFileHeart:vB,LucideFileImage:u1,LucideFileInput:_B,LucideFileJson:wB,LucideFileJson2:bB,LucideFileKey:kB,LucideFileKey2:jB,LucideFileLineChart:S2,LucideFileLock:SB,LucideFileLock2:NB,LucideFileMinus:MB,LucideFileMinus2:CB,LucideFileMusic:TB,LucideFileOutput:AB,LucideFilePen:A2,LucideFilePenLine:T2,LucideFilePieChart:C2,LucideFilePlus:IB,LucideFilePlus2:EB,LucideFileQuestion:PB,LucideFileScan:LB,LucideFileSearch:DB,LucideFileSearch2:OB,LucideFileSignature:T2,LucideFileSliders:RB,LucideFileSpreadsheet:h1,LucideFileStack:FB,LucideFileSymlink:zB,LucideFileTerminal:BB,LucideFileText:wi,LucideFileType:UB,LucideFileType2:$B,LucideFileUp:qB,LucideFileUser:VB,LucideFileVideo:WB,LucideFileVideo2:HB,LucideFileVolume:KB,LucideFileVolume2:GB,LucideFileWarning:ZB,LucideFileX:XB,LucideFileX2:YB,LucideFiles:JB,LucideFilm:Ad,LucideFilter:pj,LucideFilterX:e$,LucideFingerprint:t$,LucideFireExtinguisher:r$,LucideFish:i$,LucideFishOff:n$,LucideFishSymbol:s$,LucideFlag:Ux,LucideFlagOff:a$,LucideFlagTriangleLeft:o$,LucideFlagTriangleRight:l$,LucideFlame:Zh,LucideFlameKindling:c$,LucideFlashlight:u$,LucideFlashlightOff:d$,LucideFlaskConical:mj,LucideFlaskConicalOff:h$,LucideFlaskRound:f$,LucideFlipHorizontal:m$,LucideFlipHorizontal2:p$,LucideFlipVertical:x$,LucideFlipVertical2:g$,LucideFlower:y$,LucideFlower2:im,LucideFocus:v$,LucideFoldHorizontal:_$,LucideFoldVertical:b$,LucideFolder:K$,LucideFolderArchive:w$,LucideFolderCheck:j$,LucideFolderClock:k$,LucideFolderClosed:N$,LucideFolderCode:S$,LucideFolderCog:E2,LucideFolderCog2:E2,LucideFolderDot:C$,LucideFolderDown:M$,LucideFolderEdit:I2,LucideFolderGit:A$,LucideFolderGit2:T$,LucideFolderHeart:E$,LucideFolderInput:I$,LucideFolderKanban:P$,LucideFolderKey:L$,LucideFolderLock:O$,LucideFolderMinus:D$,LucideFolderOpen:qx,LucideFolderOpenDot:R$,LucideFolderOutput:F$,LucideFolderPen:I2,LucideFolderPlus:z$,LucideFolderRoot:B$,LucideFolderSearch:U$,LucideFolderSearch2:$$,LucideFolderSymlink:q$,LucideFolderSync:V$,LucideFolderTree:H$,LucideFolderUp:W$,LucideFolderX:G$,LucideFolders:Z$,LucideFootprints:Y$,LucideForkKnife:kw,LucideForkKnifeCrossed:jw,LucideForklift:X$,LucideFormInput:ib,LucideForward:Q$,LucideFrame:J$,LucideFramer:eU,LucideFrown:tU,LucideFuel:rU,LucideFullscreen:nU,LucideFunctionSquare:Bb,LucideGalleryHorizontal:iU,LucideGalleryHorizontalEnd:sU,LucideGalleryThumbnails:aU,LucideGalleryVertical:lU,LucideGalleryVerticalEnd:oU,LucideGamepad:dU,LucideGamepad2:cU,LucideGanttChart:z_,LucideGanttChartSquare:Jm,LucideGauge:uU,LucideGaugeCircle:t2,LucideGavel:hU,LucideGem:fU,LucideGhost:gj,LucideGift:Ha,LucideGitBranch:mU,LucideGitBranchPlus:pU,LucideGitCommit:P2,LucideGitCommitHorizontal:P2,LucideGitCommitVertical:gU,LucideGitCompare:yU,LucideGitCompareArrows:xU,LucideGitFork:vU,LucideGitGraph:_U,LucideGitMerge:bU,LucideGitPullRequest:CU,LucideGitPullRequestArrow:wU,LucideGitPullRequestClosed:jU,LucideGitPullRequestCreate:NU,LucideGitPullRequestCreateArrow:kU,LucideGitPullRequestDraft:SU,LucideGithub:MU,LucideGitlab:TU,LucideGlassWater:AU,LucideGlasses:EU,LucideGlobe:Vx,LucideGlobe2:w2,LucideGlobeLock:IU,LucideGoal:PU,LucideGrab:LU,LucideGraduationCap:f1,LucideGrape:OU,LucideGrid:Dh,LucideGrid2X2:O2,LucideGrid2X2Plus:L2,LucideGrid2x2:O2,LucideGrid2x2Check:DU,LucideGrid2x2Plus:L2,LucideGrid2x2X:RU,LucideGrid3X3:Dh,LucideGrid3x3:Dh,LucideGrip:zU,LucideGripHorizontal:FU,LucideGripVertical:p1,LucideGroup:BU,LucideGuitar:$U,LucideHam:UU,LucideHammer:qU,LucideHand:KU,LucideHandCoins:VU,LucideHandHeart:HU,LucideHandHelping:D2,LucideHandMetal:WU,LucideHandPlatter:GU,LucideHandshake:ZU,LucideHardDrive:IT,LucideHardDriveDownload:YU,LucideHardDriveUpload:XU,LucideHardHat:QU,LucideHash:rS,LucideHaze:JU,LucideHdmiPort:eq,LucideHeading:iq,LucideHeading1:PT,LucideHeading2:LT,LucideHeading3:tq,LucideHeading4:rq,LucideHeading5:nq,LucideHeading6:sq,LucideHeadphoneOff:aq,LucideHeadphones:oq,LucideHeadset:lq,LucideHeart:oa,LucideHeartCrack:cq,LucideHeartHandshake:dq,LucideHeartOff:uq,LucideHeartPulse:hq,LucideHeater:fq,LucideHelpCircle:Cx,LucideHelpingHand:D2,LucideHexagon:pq,LucideHighlighter:mq,LucideHistory:nS,LucideHome:fi,LucideHop:xq,LucideHopOff:gq,LucideHospital:yq,LucideHotel:vq,LucideHourglass:_q,LucideHouse:fi,LucideHousePlug:bq,LucideHousePlus:wq,LucideIceCream:F2,LucideIceCream2:R2,LucideIceCreamBowl:R2,LucideIceCreamCone:F2,LucideIdCard:jq,LucideImage:Do,LucideImageDown:kq,LucideImageMinus:Nq,LucideImageOff:Sq,LucideImagePlay:Cq,LucideImagePlus:sS,LucideImageUp:Mq,LucideImageUpscale:Tq,LucideImages:Aq,LucideImport:Eq,LucideInbox:Iq,LucideIndent:B2,LucideIndentDecrease:z2,LucideIndentIncrease:B2,LucideIndianRupee:Pq,LucideInfinity:Lq,LucideInfo:Oq,LucideInspect:Wb,LucideInspectionPanel:Dq,LucideInstagram:eu,LucideItalic:iS,LucideIterationCcw:Rq,LucideIterationCw:Fq,LucideJapaneseYen:zq,LucideJoystick:Bq,LucideKanban:m1,LucideKanbanSquare:$b,LucideKanbanSquareDashed:Lb,LucideKey:Yh,LucideKeyRound:xj,LucideKeySquare:$q,LucideKeyboard:Vq,LucideKeyboardMusic:Uq,LucideKeyboardOff:qq,LucideLamp:Yq,LucideLampCeiling:Hq,LucideLampDesk:Wq,LucideLampFloor:Gq,LucideLampWallDown:Kq,LucideLampWallUp:Zq,LucideLandPlot:Xq,LucideLandmark:Qq,LucideLanguages:Jq,LucideLaptop:tV,LucideLaptop2:$2,LucideLaptopMinimal:$2,LucideLaptopMinimalCheck:eV,LucideLasso:nV,LucideLassoSelect:rV,LucideLaugh:sV,LucideLayers:oV,LucideLayers2:iV,LucideLayers3:aV,LucideLayout:p0,LucideLayoutDashboard:aS,LucideLayoutGrid:pm,LucideLayoutList:lV,LucideLayoutPanelLeft:cV,LucideLayoutPanelTop:dV,LucideLayoutTemplate:uV,LucideLeaf:hV,LucideLeafyGreen:fV,LucideLectern:pV,LucideLetterText:mV,LucideLibrary:oS,LucideLibraryBig:gV,LucideLibrarySquare:Ub,LucideLifeBuoy:lS,LucideLigature:xV,LucideLightbulb:g1,LucideLightbulbOff:yV,LucideLineChart:D_,LucideLink:So,LucideLink2:Xh,LucideLink2Off:vV,LucideLinkedin:mm,LucideList:Wf,LucideListCheck:_V,LucideListChecks:bV,LucideListCollapse:wV,LucideListEnd:jV,LucideListFilter:kV,LucideListMinus:NV,LucideListMusic:SV,LucideListOrdered:cS,LucideListPlus:CV,LucideListRestart:MV,LucideListStart:TV,LucideListTodo:AV,LucideListTree:EV,LucideListVideo:IV,LucideListX:PV,LucideLoader:OV,LucideLoader2:nn,LucideLoaderCircle:nn,LucideLoaderPinwheel:LV,LucideLocate:OT,LucideLocateFixed:DV,LucideLocateOff:RV,LucideLock:Gf,LucideLockKeyhole:FV,LucideLockKeyholeOpen:U2,LucideLockOpen:q2,LucideLogIn:dS,LucideLogOut:uS,LucideLogs:zV,LucideLollipop:BV,LucideLuggage:$V,LucideMSquare:qb,LucideMagnet:UV,LucideMail:Ys,LucideMailCheck:qV,LucideMailMinus:VV,LucideMailOpen:HV,LucideMailPlus:WV,LucideMailQuestion:GV,LucideMailSearch:KV,LucideMailWarning:ZV,LucideMailX:DT,LucideMailbox:YV,LucideMails:XV,LucideMap:cH,LucideMapPin:ml,LucideMapPinCheck:JV,LucideMapPinCheckInside:QV,LucideMapPinHouse:eH,LucideMapPinMinus:rH,LucideMapPinMinusInside:tH,LucideMapPinOff:nH,LucideMapPinPlus:iH,LucideMapPinPlusInside:sH,LucideMapPinX:oH,LucideMapPinXInside:aH,LucideMapPinned:lH,LucideMartini:dH,LucideMaximize:x1,LucideMaximize2:uH,LucideMedal:Hx,LucideMegaphone:gm,LucideMegaphoneOff:hH,LucideMeh:fH,LucideMemoryStick:pH,LucideMenu:RT,LucideMenuSquare:Vb,LucideMerge:mH,LucideMessageCircle:Ol,LucideMessageCircleCode:gH,LucideMessageCircleDashed:xH,LucideMessageCircleHeart:hS,LucideMessageCircleMore:yH,LucideMessageCircleOff:vH,LucideMessageCirclePlus:_H,LucideMessageCircleQuestion:FT,LucideMessageCircleReply:bH,LucideMessageCircleWarning:wH,LucideMessageCircleX:jH,LucideMessageSquare:Po,LucideMessageSquareCode:kH,LucideMessageSquareDashed:NH,LucideMessageSquareDiff:SH,LucideMessageSquareDot:CH,LucideMessageSquareHeart:MH,LucideMessageSquareLock:TH,LucideMessageSquareMore:AH,LucideMessageSquareOff:EH,LucideMessageSquarePlus:IH,LucideMessageSquareQuote:zT,LucideMessageSquareReply:PH,LucideMessageSquareShare:LH,LucideMessageSquareText:OH,LucideMessageSquareWarning:DH,LucideMessageSquareX:RH,LucideMessagesSquare:FH,LucideMic:BT,LucideMic2:V2,LucideMicOff:zH,LucideMicVocal:V2,LucideMicrochip:BH,LucideMicroscope:$H,LucideMicrowave:UH,LucideMilestone:qH,LucideMilk:HH,LucideMilkOff:VH,LucideMinimize:GH,LucideMinimize2:WH,LucideMinus:y1,LucideMinusCircle:r2,LucideMinusSquare:Hb,LucideMonitor:yj,LucideMonitorCheck:KH,LucideMonitorCog:ZH,LucideMonitorDot:YH,LucideMonitorDown:XH,LucideMonitorOff:QH,LucideMonitorPause:JH,LucideMonitorPlay:eW,LucideMonitorSmartphone:tW,LucideMonitorSpeaker:rW,LucideMonitorStop:nW,LucideMonitorUp:sW,LucideMonitorX:iW,LucideMoon:oW,LucideMoonStar:aW,LucideMoreHorizontal:lg,LucideMoreVertical:Mx,LucideMountain:cW,LucideMountainSnow:lW,LucideMouse:pW,LucideMouseOff:dW,LucideMousePointer:fW,LucideMousePointer2:uW,LucideMousePointerBan:hW,LucideMousePointerClick:vj,LucideMousePointerSquareDashed:Ob,LucideMove:CW,LucideMove3D:H2,LucideMove3d:H2,LucideMoveDiagonal:gW,LucideMoveDiagonal2:mW,LucideMoveDown:vW,LucideMoveDownLeft:xW,LucideMoveDownRight:yW,LucideMoveHorizontal:_W,LucideMoveLeft:bW,LucideMoveRight:wW,LucideMoveUp:NW,LucideMoveUpLeft:jW,LucideMoveUpRight:kW,LucideMoveVertical:SW,LucideMusic:EW,LucideMusic2:MW,LucideMusic3:TW,LucideMusic4:AW,LucideNavigation:$T,LucideNavigation2:PW,LucideNavigation2Off:IW,LucideNavigationOff:LW,LucideNetwork:OW,LucideNewspaper:Wx,LucideNfc:DW,LucideNotebook:BW,LucideNotebookPen:RW,LucideNotebookTabs:FW,LucideNotebookText:zW,LucideNotepadText:UW,LucideNotepadTextDashed:$W,LucideNut:VW,LucideNutOff:qW,LucideOctagon:WW,LucideOctagonAlert:W2,LucideOctagonMinus:HW,LucideOctagonPause:G2,LucideOctagonX:K2,LucideOmega:GW,LucideOption:KW,LucideOrbit:ZW,LucideOrigami:YW,LucideOutdent:z2,LucidePackage:Dl,LucidePackage2:XW,LucidePackageCheck:QW,LucidePackageMinus:JW,LucidePackageOpen:eG,LucidePackagePlus:tG,LucidePackageSearch:rG,LucidePackageX:nG,LucidePaintBucket:sG,LucidePaintRoller:iG,LucidePaintbrush:aG,LucidePaintbrush2:Z2,LucidePaintbrushVertical:Z2,LucidePalette:hd,LucidePalmtree:fw,LucidePanelBottom:cG,LucidePanelBottomClose:oG,LucidePanelBottomDashed:Y2,LucidePanelBottomInactive:Y2,LucidePanelBottomOpen:lG,LucidePanelLeft:eb,LucidePanelLeftClose:X2,LucidePanelLeftDashed:Q2,LucidePanelLeftInactive:Q2,LucidePanelLeftOpen:J2,LucidePanelRight:hG,LucidePanelRightClose:dG,LucidePanelRightDashed:tb,LucidePanelRightInactive:tb,LucidePanelRightOpen:uG,LucidePanelTop:mG,LucidePanelTopClose:fG,LucidePanelTopDashed:rb,LucidePanelTopInactive:rb,LucidePanelTopOpen:pG,LucidePanelsLeftBottom:gG,LucidePanelsLeftRight:v2,LucidePanelsRightBottom:xG,LucidePanelsTopBottom:lb,LucidePanelsTopLeft:p0,LucidePaperclip:yG,LucideParentheses:vG,LucideParkingCircle:s2,LucideParkingCircleOff:n2,LucideParkingMeter:_G,LucideParkingSquare:Kb,LucideParkingSquareOff:Gb,LucidePartyPopper:Sc,LucidePause:Qh,LucidePauseCircle:i2,LucidePauseOctagon:G2,LucidePawPrint:bG,LucidePcCase:wG,LucidePen:m0,LucidePenBox:rc,LucidePenLine:nb,LucidePenOff:jG,LucidePenSquare:rc,LucidePenTool:_j,LucidePencil:ha,LucidePencilLine:kG,LucidePencilOff:NG,LucidePencilRuler:SG,LucidePentagon:CG,LucidePercent:fS,LucidePercentCircle:a2,LucidePercentDiamond:b2,LucidePercentSquare:Zb,LucidePersonStanding:MG,LucidePhilippinePeso:TG,LucidePhone:ca,LucidePhoneCall:AG,LucidePhoneForwarded:EG,LucidePhoneIncoming:IG,LucidePhoneMissed:PG,LucidePhoneOff:LG,LucidePhoneOutgoing:OG,LucidePi:DG,LucidePiSquare:Yb,LucidePiano:RG,LucidePickaxe:FG,LucidePictureInPicture:BG,LucidePictureInPicture2:zG,LucidePieChart:B_,LucidePiggyBank:$G,LucidePilcrow:VG,LucidePilcrowLeft:UG,LucidePilcrowRight:qG,LucidePilcrowSquare:Xb,LucidePill:WG,LucidePillBottle:HG,LucidePin:v1,LucidePinOff:UT,LucidePipette:GG,LucidePizza:KG,LucidePlane:XG,LucidePlaneLanding:ZG,LucidePlaneTakeoff:YG,LucidePlay:dc,LucidePlayCircle:Df,LucidePlaySquare:Qb,LucidePlug:JG,LucidePlug2:QG,LucidePlugZap:sb,LucidePlugZap2:sb,LucidePlus:jn,LucidePlusCircle:o2,LucidePlusSquare:Jb,LucidePocket:tK,LucidePocketKnife:eK,LucidePodcast:rK,LucidePointer:sK,LucidePointerOff:nK,LucidePopcorn:iK,LucidePopsicle:aK,LucidePoundSterling:oK,LucidePower:cK,LucidePowerCircle:l2,LucidePowerOff:lK,LucidePowerSquare:ew,LucidePresentation:dK,LucidePrinter:hK,LucidePrinterCheck:uK,LucideProjector:fK,LucideProportions:pK,LucidePuzzle:mK,LucidePyramid:gK,LucideQrCode:qT,LucideQuote:VT,LucideRabbit:xK,LucideRadar:yK,LucideRadiation:vK,LucideRadical:_K,LucideRadio:bj,LucideRadioReceiver:bK,LucideRadioTower:wK,LucideRadius:jK,LucideRailSymbol:kK,LucideRainbow:NK,LucideRat:SK,LucideRatio:CK,LucideReceipt:DK,LucideReceiptCent:MK,LucideReceiptEuro:TK,LucideReceiptIndianRupee:AK,LucideReceiptJapaneseYen:EK,LucideReceiptPoundSterling:IK,LucideReceiptRussianRuble:PK,LucideReceiptSwissFranc:LK,LucideReceiptText:OK,LucideRectangleEllipsis:ib,LucideRectangleHorizontal:RK,LucideRectangleVertical:FK,LucideRecycle:zK,LucideRedo:pS,LucideRedo2:BK,LucideRedoDot:$K,LucideRefreshCcw:qK,LucideRefreshCcwDot:UK,LucideRefreshCw:Vl,LucideRefreshCwOff:VK,LucideRefrigerator:HK,LucideRegex:WK,LucideRemoveFormatting:GK,LucideRepeat:HT,LucideRepeat1:KK,LucideRepeat2:ZK,LucideReplace:XK,LucideReplaceAll:YK,LucideReply:WT,LucideReplyAll:QK,LucideRewind:JK,LucideRibbon:eZ,LucideRocket:wg,LucideRockingChair:tZ,LucideRollerCoaster:rZ,LucideRotate3D:ab,LucideRotate3d:ab,LucideRotateCcw:mS,LucideRotateCcwSquare:nZ,LucideRotateCw:GT,LucideRotateCwSquare:sZ,LucideRoute:aZ,LucideRouteOff:iZ,LucideRouter:oZ,LucideRows:ob,LucideRows2:ob,LucideRows3:lb,LucideRows4:lZ,LucideRss:cZ,LucideRuler:dZ,LucideRussianRuble:uZ,LucideSailboat:hZ,LucideSalad:fZ,LucideSandwich:pZ,LucideSatellite:gZ,LucideSatelliteDish:mZ,LucideSave:jg,LucideSaveAll:xZ,LucideSaveOff:yZ,LucideScale:vZ,LucideScale3D:cb,LucideScale3d:cb,LucideScaling:_Z,LucideScan:MZ,LucideScanBarcode:bZ,LucideScanEye:wZ,LucideScanFace:jZ,LucideScanLine:kZ,LucideScanQrCode:NZ,LucideScanSearch:SZ,LucideScanText:CZ,LucideScatterChart:$_,LucideSchool:TZ,LucideSchool2:mw,LucideScissors:EZ,LucideScissorsLineDashed:AZ,LucideScissorsSquare:tw,LucideScissorsSquareDashedBottom:Cb,LucideScreenShare:PZ,LucideScreenShareOff:IZ,LucideScroll:OZ,LucideScrollText:LZ,LucideSearch:_i,LucideSearchCheck:DZ,LucideSearchCode:RZ,LucideSearchSlash:FZ,LucideSearchX:zZ,LucideSection:BZ,LucideSend:Lo,LucideSendHorizonal:db,LucideSendHorizontal:db,LucideSendToBack:$Z,LucideSeparatorHorizontal:UZ,LucideSeparatorVertical:qZ,LucideServer:GZ,LucideServerCog:VZ,LucideServerCrash:HZ,LucideServerOff:WZ,LucideSettings:fd,LucideSettings2:KZ,LucideShapes:ZZ,LucideShare:KT,LucideShare2:uc,LucideSheet:YZ,LucideShell:XZ,LucideShield:Kf,LucideShieldAlert:QZ,LucideShieldBan:JZ,LucideShieldCheck:ZT,LucideShieldClose:ub,LucideShieldEllipsis:eY,LucideShieldHalf:tY,LucideShieldMinus:rY,LucideShieldOff:nY,LucideShieldPlus:sY,LucideShieldQuestion:iY,LucideShieldX:ub,LucideShip:oY,LucideShipWheel:aY,LucideShirt:lY,LucideShoppingBag:kg,LucideShoppingBasket:cY,LucideShoppingCart:hh,LucideShovel:dY,LucideShowerHead:uY,LucideShrink:hY,LucideShrub:fY,LucideShuffle:pY,LucideSidebar:eb,LucideSidebarClose:X2,LucideSidebarOpen:J2,LucideSigma:mY,LucideSigmaSquare:rw,LucideSignal:_Y,LucideSignalHigh:gY,LucideSignalLow:xY,LucideSignalMedium:yY,LucideSignalZero:vY,LucideSignature:bY,LucideSignpost:jY,LucideSignpostBig:wY,LucideSiren:kY,LucideSkipBack:NY,LucideSkipForward:SY,LucideSkull:CY,LucideSlack:MY,LucideSlash:TY,LucideSlashSquare:nw,LucideSlice:AY,LucideSliders:hb,LucideSlidersHorizontal:YT,LucideSlidersVertical:hb,LucideSmartphone:xm,LucideSmartphoneCharging:EY,LucideSmartphoneNfc:IY,LucideSmile:LY,LucideSmilePlus:PY,LucideSnail:OY,LucideSnowflake:q0,LucideSofa:DY,LucideSortAsc:b_,LucideSortDesc:y_,LucideSoup:RY,LucideSpace:FY,LucideSpade:zY,LucideSparkle:BY,LucideSparkles:Cs,LucideSpeaker:$Y,LucideSpeech:UY,LucideSpellCheck:VY,LucideSpellCheck2:qY,LucideSpline:HY,LucideSplit:WY,LucideSplitSquareHorizontal:sw,LucideSplitSquareVertical:iw,LucideSprayCan:GY,LucideSprout:KY,LucideSquare:ym,LucideSquareActivity:fb,LucideSquareArrowDown:gb,LucideSquareArrowDownLeft:pb,LucideSquareArrowDownRight:mb,LucideSquareArrowLeft:xb,LucideSquareArrowOutDownLeft:yb,LucideSquareArrowOutDownRight:vb,LucideSquareArrowOutUpLeft:_b,LucideSquareArrowOutUpRight:bb,LucideSquareArrowRight:wb,LucideSquareArrowUp:Nb,LucideSquareArrowUpLeft:jb,LucideSquareArrowUpRight:kb,LucideSquareAsterisk:Sb,LucideSquareBottomDashedScissors:Cb,LucideSquareChartGantt:Jm,LucideSquareCheck:Mb,LucideSquareCheckBig:g0,LucideSquareChevronDown:Tb,LucideSquareChevronLeft:Ab,LucideSquareChevronRight:Eb,LucideSquareChevronUp:Ib,LucideSquareCode:Pb,LucideSquareDashed:Db,LucideSquareDashedBottom:YY,LucideSquareDashedBottomCode:ZY,LucideSquareDashedKanban:Lb,LucideSquareDashedMousePointer:Ob,LucideSquareDivide:Rb,LucideSquareDot:Fb,LucideSquareEqual:zb,LucideSquareFunction:Bb,LucideSquareGanttChart:Jm,LucideSquareKanban:$b,LucideSquareLibrary:Ub,LucideSquareM:qb,LucideSquareMenu:Vb,LucideSquareMinus:Hb,LucideSquareMousePointer:Wb,LucideSquareParking:Kb,LucideSquareParkingOff:Gb,LucideSquarePen:rc,LucideSquarePercent:Zb,LucideSquarePi:Yb,LucideSquarePilcrow:Xb,LucideSquarePlay:Qb,LucideSquarePlus:Jb,LucideSquarePower:ew,LucideSquareRadical:XY,LucideSquareScissors:tw,LucideSquareSigma:rw,LucideSquareSlash:nw,LucideSquareSplitHorizontal:sw,LucideSquareSplitVertical:iw,LucideSquareSquare:QY,LucideSquareStack:JY,LucideSquareTerminal:aw,LucideSquareUser:lw,LucideSquareUserRound:ow,LucideSquareX:cw,LucideSquircle:eX,LucideSquirrel:tX,LucideStamp:rX,LucideStar:vs,LucideStarHalf:nX,LucideStarOff:sX,LucideStars:Cs,LucideStepBack:iX,LucideStepForward:aX,LucideStethoscope:oX,LucideSticker:lX,LucideStickyNote:cX,LucideStopCircle:d2,LucideStore:dX,LucideStretchHorizontal:uX,LucideStretchVertical:hX,LucideStrikethrough:fX,LucideSubscript:pX,LucideSubtitles:T_,LucideSun:_1,LucideSunDim:mX,LucideSunMedium:gX,LucideSunMoon:xX,LucideSunSnow:yX,LucideSunrise:vX,LucideSunset:_X,LucideSuperscript:bX,LucideSwatchBook:wX,LucideSwissFranc:jX,LucideSwitchCamera:kX,LucideSword:NX,LucideSwords:SX,LucideSyringe:CX,LucideTable:LX,LucideTable2:XT,LucideTableCellsMerge:MX,LucideTableCellsSplit:TX,LucideTableColumnsSplit:AX,LucideTableOfContents:EX,LucideTableProperties:IX,LucideTableRowsSplit:PX,LucideTablet:DX,LucideTabletSmartphone:OX,LucideTablets:RX,LucideTag:Gx,LucideTags:FX,LucideTally1:zX,LucideTally2:BX,LucideTally3:$X,LucideTally4:UX,LucideTally5:qX,LucideTangent:VX,LucideTarget:Kx,LucideTelescope:HX,LucideTent:GX,LucideTentTree:WX,LucideTerminal:KX,LucideTerminalSquare:aw,LucideTestTube:ZX,LucideTestTube2:dw,LucideTestTubeDiagonal:dw,LucideTestTubes:YX,LucideText:tQ,LucideTextCursor:QX,LucideTextCursorInput:XX,LucideTextQuote:JX,LucideTextSearch:eQ,LucideTextSelect:uw,LucideTextSelection:uw,LucideTheater:rQ,LucideThermometer:iQ,LucideThermometerSnowflake:nQ,LucideThermometerSun:sQ,LucideThumbsDown:QT,LucideThumbsUp:pd,LucideTicket:JT,LucideTicketCheck:aQ,LucideTicketMinus:oQ,LucideTicketPercent:lQ,LucideTicketPlus:cQ,LucideTicketSlash:dQ,LucideTicketX:uQ,LucideTickets:fQ,LucideTicketsPlane:hQ,LucideTimer:gQ,LucideTimerOff:pQ,LucideTimerReset:mQ,LucideToggleLeft:xQ,LucideToggleRight:yQ,LucideToilet:vQ,LucideTornado:_Q,LucideTorus:bQ,LucideTouchpad:jQ,LucideTouchpadOff:wQ,LucideTowerControl:kQ,LucideToyBrick:NQ,LucideTractor:SQ,LucideTrafficCone:CQ,LucideTrain:hw,LucideTrainFront:TQ,LucideTrainFrontTunnel:MQ,LucideTrainTrack:AQ,LucideTramFront:hw,LucideTrash:EQ,LucideTrash2:Zn,LucideTreeDeciduous:IQ,LucideTreePalm:fw,LucideTreePine:b1,LucideTrees:PQ,LucideTrello:LQ,LucideTrendingDown:w1,LucideTrendingUp:Zf,LucideTrendingUpDown:OQ,LucideTriangle:RQ,LucideTriangleAlert:Bh,LucideTriangleRight:DQ,LucideTrophy:Wa,LucideTruck:eA,LucideTurtle:FQ,LucideTv:BQ,LucideTv2:pw,LucideTvMinimal:pw,LucideTvMinimalPlay:zQ,LucideTwitch:$Q,LucideTwitter:UQ,LucideType:VQ,LucideTypeOutline:qQ,LucideUmbrella:WQ,LucideUmbrellaOff:HQ,LucideUnderline:GQ,LucideUndo:gS,LucideUndo2:KQ,LucideUndoDot:ZQ,LucideUnfoldHorizontal:YQ,LucideUnfoldVertical:XQ,LucideUngroup:QQ,LucideUniversity:mw,LucideUnlink:tA,LucideUnlink2:JQ,LucideUnlock:q2,LucideUnlockKeyhole:U2,LucideUnplug:eJ,LucideUpload:no,LucideUploadCloud:g2,LucideUsb:tJ,LucideUser:Cc,LucideUser2:bw,LucideUserCheck:wj,LucideUserCheck2:gw,LucideUserCircle:h2,LucideUserCircle2:u2,LucideUserCog:rA,LucideUserCog2:xw,LucideUserMinus:rJ,LucideUserMinus2:yw,LucideUserPen:nJ,LucideUserPlus:Jh,LucideUserPlus2:vw,LucideUserRound:bw,LucideUserRoundCheck:gw,LucideUserRoundCog:xw,LucideUserRoundMinus:yw,LucideUserRoundPen:sJ,LucideUserRoundPlus:vw,LucideUserRoundSearch:iJ,LucideUserRoundX:_w,LucideUserSearch:aJ,LucideUserSquare:lw,LucideUserSquare2:ow,LucideUserX:oJ,LucideUserX2:_w,LucideUsers:Vn,LucideUsers2:ww,LucideUsersRound:ww,LucideUtensils:kw,LucideUtensilsCrossed:jw,LucideUtilityPole:lJ,LucideVariable:nA,LucideVault:cJ,LucideVegan:dJ,LucideVenetianMask:uJ,LucideVerified:k_,LucideVibrate:fJ,LucideVibrateOff:hJ,LucideVideo:Fi,LucideVideoOff:pJ,LucideVideotape:mJ,LucideView:gJ,LucideVoicemail:xJ,LucideVolleyball:yJ,LucideVolume:jJ,LucideVolume1:vJ,LucideVolume2:_J,LucideVolumeOff:bJ,LucideVolumeX:wJ,LucideVote:kJ,LucideWallet:SJ,LucideWallet2:Nw,LucideWalletCards:NJ,LucideWalletMinimal:Nw,LucideWallpaper:CJ,LucideWand:MJ,LucideWand2:Sw,LucideWandSparkles:Sw,LucideWarehouse:TJ,LucideWashingMachine:AJ,LucideWatch:EJ,LucideWaves:IJ,LucideWaypoints:PJ,LucideWebcam:LJ,LucideWebhook:DJ,LucideWebhookOff:OJ,LucideWeight:RJ,LucideWheat:zJ,LucideWheatOff:FJ,LucideWholeWord:BJ,LucideWifi:HJ,LucideWifiHigh:$J,LucideWifiLow:UJ,LucideWifiOff:qJ,LucideWifiZero:VJ,LucideWind:GJ,LucideWindArrowDown:WJ,LucideWine:ZJ,LucideWineOff:KJ,LucideWorkflow:YJ,LucideWorm:XJ,LucideWrapText:QJ,LucideWrench:Zx,LucideX:bs,LucideXCircle:zc,LucideXOctagon:K2,LucideXSquare:cw,LucideYoutube:JJ,LucideZap:Ng,LucideZapOff:eee,LucideZoomIn:xS,LucideZoomOut:yS,Luggage:$V,LuggageIcon:$V,MSquare:qb,MSquareIcon:qb,Magnet:UV,MagnetIcon:UV,Mail:Ys,MailCheck:qV,MailCheckIcon:qV,MailIcon:Ys,MailMinus:VV,MailMinusIcon:VV,MailOpen:HV,MailOpenIcon:HV,MailPlus:WV,MailPlusIcon:WV,MailQuestion:GV,MailQuestionIcon:GV,MailSearch:KV,MailSearchIcon:KV,MailWarning:ZV,MailWarningIcon:ZV,MailX:DT,MailXIcon:DT,Mailbox:YV,MailboxIcon:YV,Mails:XV,MailsIcon:XV,Map:cH,MapIcon:cH,MapPin:ml,MapPinCheck:JV,MapPinCheckIcon:JV,MapPinCheckInside:QV,MapPinCheckInsideIcon:QV,MapPinHouse:eH,MapPinHouseIcon:eH,MapPinIcon:ml,MapPinMinus:rH,MapPinMinusIcon:rH,MapPinMinusInside:tH,MapPinMinusInsideIcon:tH,MapPinOff:nH,MapPinOffIcon:nH,MapPinPlus:iH,MapPinPlusIcon:iH,MapPinPlusInside:sH,MapPinPlusInsideIcon:sH,MapPinX:oH,MapPinXIcon:oH,MapPinXInside:aH,MapPinXInsideIcon:aH,MapPinned:lH,MapPinnedIcon:lH,Martini:dH,MartiniIcon:dH,Maximize:x1,Maximize2:uH,Maximize2Icon:uH,MaximizeIcon:x1,Medal:Hx,MedalIcon:Hx,Megaphone:gm,MegaphoneIcon:gm,MegaphoneOff:hH,MegaphoneOffIcon:hH,Meh:fH,MehIcon:fH,MemoryStick:pH,MemoryStickIcon:pH,Menu:RT,MenuIcon:RT,MenuSquare:Vb,MenuSquareIcon:Vb,Merge:mH,MergeIcon:mH,MessageCircle:Ol,MessageCircleCode:gH,MessageCircleCodeIcon:gH,MessageCircleDashed:xH,MessageCircleDashedIcon:xH,MessageCircleHeart:hS,MessageCircleHeartIcon:hS,MessageCircleIcon:Ol,MessageCircleMore:yH,MessageCircleMoreIcon:yH,MessageCircleOff:vH,MessageCircleOffIcon:vH,MessageCirclePlus:_H,MessageCirclePlusIcon:_H,MessageCircleQuestion:FT,MessageCircleQuestionIcon:FT,MessageCircleReply:bH,MessageCircleReplyIcon:bH,MessageCircleWarning:wH,MessageCircleWarningIcon:wH,MessageCircleX:jH,MessageCircleXIcon:jH,MessageSquare:Po,MessageSquareCode:kH,MessageSquareCodeIcon:kH,MessageSquareDashed:NH,MessageSquareDashedIcon:NH,MessageSquareDiff:SH,MessageSquareDiffIcon:SH,MessageSquareDot:CH,MessageSquareDotIcon:CH,MessageSquareHeart:MH,MessageSquareHeartIcon:MH,MessageSquareIcon:Po,MessageSquareLock:TH,MessageSquareLockIcon:TH,MessageSquareMore:AH,MessageSquareMoreIcon:AH,MessageSquareOff:EH,MessageSquareOffIcon:EH,MessageSquarePlus:IH,MessageSquarePlusIcon:IH,MessageSquareQuote:zT,MessageSquareQuoteIcon:zT,MessageSquareReply:PH,MessageSquareReplyIcon:PH,MessageSquareShare:LH,MessageSquareShareIcon:LH,MessageSquareText:OH,MessageSquareTextIcon:OH,MessageSquareWarning:DH,MessageSquareWarningIcon:DH,MessageSquareX:RH,MessageSquareXIcon:RH,MessagesSquare:FH,MessagesSquareIcon:FH,Mic:BT,Mic2:V2,Mic2Icon:V2,MicIcon:BT,MicOff:zH,MicOffIcon:zH,MicVocal:V2,MicVocalIcon:V2,Microchip:BH,MicrochipIcon:BH,Microscope:$H,MicroscopeIcon:$H,Microwave:UH,MicrowaveIcon:UH,Milestone:qH,MilestoneIcon:qH,Milk:HH,MilkIcon:HH,MilkOff:VH,MilkOffIcon:VH,Minimize:GH,Minimize2:WH,Minimize2Icon:WH,MinimizeIcon:GH,Minus:y1,MinusCircle:r2,MinusCircleIcon:r2,MinusIcon:y1,MinusSquare:Hb,MinusSquareIcon:Hb,Monitor:yj,MonitorCheck:KH,MonitorCheckIcon:KH,MonitorCog:ZH,MonitorCogIcon:ZH,MonitorDot:YH,MonitorDotIcon:YH,MonitorDown:XH,MonitorDownIcon:XH,MonitorIcon:yj,MonitorOff:QH,MonitorOffIcon:QH,MonitorPause:JH,MonitorPauseIcon:JH,MonitorPlay:eW,MonitorPlayIcon:eW,MonitorSmartphone:tW,MonitorSmartphoneIcon:tW,MonitorSpeaker:rW,MonitorSpeakerIcon:rW,MonitorStop:nW,MonitorStopIcon:nW,MonitorUp:sW,MonitorUpIcon:sW,MonitorX:iW,MonitorXIcon:iW,Moon:oW,MoonIcon:oW,MoonStar:aW,MoonStarIcon:aW,MoreHorizontal:lg,MoreHorizontalIcon:lg,MoreVertical:Mx,MoreVerticalIcon:Mx,Mountain:cW,MountainIcon:cW,MountainSnow:lW,MountainSnowIcon:lW,Mouse:pW,MouseIcon:pW,MouseOff:dW,MouseOffIcon:dW,MousePointer:fW,MousePointer2:uW,MousePointer2Icon:uW,MousePointerBan:hW,MousePointerBanIcon:hW,MousePointerClick:vj,MousePointerClickIcon:vj,MousePointerIcon:fW,MousePointerSquareDashed:Ob,MousePointerSquareDashedIcon:Ob,Move:CW,Move3D:H2,Move3DIcon:H2,Move3d:H2,Move3dIcon:H2,MoveDiagonal:gW,MoveDiagonal2:mW,MoveDiagonal2Icon:mW,MoveDiagonalIcon:gW,MoveDown:vW,MoveDownIcon:vW,MoveDownLeft:xW,MoveDownLeftIcon:xW,MoveDownRight:yW,MoveDownRightIcon:yW,MoveHorizontal:_W,MoveHorizontalIcon:_W,MoveIcon:CW,MoveLeft:bW,MoveLeftIcon:bW,MoveRight:wW,MoveRightIcon:wW,MoveUp:NW,MoveUpIcon:NW,MoveUpLeft:jW,MoveUpLeftIcon:jW,MoveUpRight:kW,MoveUpRightIcon:kW,MoveVertical:SW,MoveVerticalIcon:SW,Music:EW,Music2:MW,Music2Icon:MW,Music3:TW,Music3Icon:TW,Music4:AW,Music4Icon:AW,MusicIcon:EW,Navigation:$T,Navigation2:PW,Navigation2Icon:PW,Navigation2Off:IW,Navigation2OffIcon:IW,NavigationIcon:$T,NavigationOff:LW,NavigationOffIcon:LW,Network:OW,NetworkIcon:OW,Newspaper:Wx,NewspaperIcon:Wx,Nfc:DW,NfcIcon:DW,Notebook:BW,NotebookIcon:BW,NotebookPen:RW,NotebookPenIcon:RW,NotebookTabs:FW,NotebookTabsIcon:FW,NotebookText:zW,NotebookTextIcon:zW,NotepadText:UW,NotepadTextDashed:$W,NotepadTextDashedIcon:$W,NotepadTextIcon:UW,Nut:VW,NutIcon:VW,NutOff:qW,NutOffIcon:qW,Octagon:WW,OctagonAlert:W2,OctagonAlertIcon:W2,OctagonIcon:WW,OctagonMinus:HW,OctagonMinusIcon:HW,OctagonPause:G2,OctagonPauseIcon:G2,OctagonX:K2,OctagonXIcon:K2,Omega:GW,OmegaIcon:GW,Option:KW,OptionIcon:KW,Orbit:ZW,OrbitIcon:ZW,Origami:YW,OrigamiIcon:YW,Outdent:z2,OutdentIcon:z2,Package:Dl,Package2:XW,Package2Icon:XW,PackageCheck:QW,PackageCheckIcon:QW,PackageIcon:Dl,PackageMinus:JW,PackageMinusIcon:JW,PackageOpen:eG,PackageOpenIcon:eG,PackagePlus:tG,PackagePlusIcon:tG,PackageSearch:rG,PackageSearchIcon:rG,PackageX:nG,PackageXIcon:nG,PaintBucket:sG,PaintBucketIcon:sG,PaintRoller:iG,PaintRollerIcon:iG,Paintbrush:aG,Paintbrush2:Z2,Paintbrush2Icon:Z2,PaintbrushIcon:aG,PaintbrushVertical:Z2,PaintbrushVerticalIcon:Z2,Palette:hd,PaletteIcon:hd,Palmtree:fw,PalmtreeIcon:fw,PanelBottom:cG,PanelBottomClose:oG,PanelBottomCloseIcon:oG,PanelBottomDashed:Y2,PanelBottomDashedIcon:Y2,PanelBottomIcon:cG,PanelBottomInactive:Y2,PanelBottomInactiveIcon:Y2,PanelBottomOpen:lG,PanelBottomOpenIcon:lG,PanelLeft:eb,PanelLeftClose:X2,PanelLeftCloseIcon:X2,PanelLeftDashed:Q2,PanelLeftDashedIcon:Q2,PanelLeftIcon:eb,PanelLeftInactive:Q2,PanelLeftInactiveIcon:Q2,PanelLeftOpen:J2,PanelLeftOpenIcon:J2,PanelRight:hG,PanelRightClose:dG,PanelRightCloseIcon:dG,PanelRightDashed:tb,PanelRightDashedIcon:tb,PanelRightIcon:hG,PanelRightInactive:tb,PanelRightInactiveIcon:tb,PanelRightOpen:uG,PanelRightOpenIcon:uG,PanelTop:mG,PanelTopClose:fG,PanelTopCloseIcon:fG,PanelTopDashed:rb,PanelTopDashedIcon:rb,PanelTopIcon:mG,PanelTopInactive:rb,PanelTopInactiveIcon:rb,PanelTopOpen:pG,PanelTopOpenIcon:pG,PanelsLeftBottom:gG,PanelsLeftBottomIcon:gG,PanelsLeftRight:v2,PanelsLeftRightIcon:v2,PanelsRightBottom:xG,PanelsRightBottomIcon:xG,PanelsTopBottom:lb,PanelsTopBottomIcon:lb,PanelsTopLeft:p0,PanelsTopLeftIcon:p0,Paperclip:yG,PaperclipIcon:yG,Parentheses:vG,ParenthesesIcon:vG,ParkingCircle:s2,ParkingCircleIcon:s2,ParkingCircleOff:n2,ParkingCircleOffIcon:n2,ParkingMeter:_G,ParkingMeterIcon:_G,ParkingSquare:Kb,ParkingSquareIcon:Kb,ParkingSquareOff:Gb,ParkingSquareOffIcon:Gb,PartyPopper:Sc,PartyPopperIcon:Sc,Pause:Qh,PauseCircle:i2,PauseCircleIcon:i2,PauseIcon:Qh,PauseOctagon:G2,PauseOctagonIcon:G2,PawPrint:bG,PawPrintIcon:bG,PcCase:wG,PcCaseIcon:wG,Pen:m0,PenBox:rc,PenBoxIcon:rc,PenIcon:m0,PenLine:nb,PenLineIcon:nb,PenOff:jG,PenOffIcon:jG,PenSquare:rc,PenSquareIcon:rc,PenTool:_j,PenToolIcon:_j,Pencil:ha,PencilIcon:ha,PencilLine:kG,PencilLineIcon:kG,PencilOff:NG,PencilOffIcon:NG,PencilRuler:SG,PencilRulerIcon:SG,Pentagon:CG,PentagonIcon:CG,Percent:fS,PercentCircle:a2,PercentCircleIcon:a2,PercentDiamond:b2,PercentDiamondIcon:b2,PercentIcon:fS,PercentSquare:Zb,PercentSquareIcon:Zb,PersonStanding:MG,PersonStandingIcon:MG,PhilippinePeso:TG,PhilippinePesoIcon:TG,Phone:ca,PhoneCall:AG,PhoneCallIcon:AG,PhoneForwarded:EG,PhoneForwardedIcon:EG,PhoneIcon:ca,PhoneIncoming:IG,PhoneIncomingIcon:IG,PhoneMissed:PG,PhoneMissedIcon:PG,PhoneOff:LG,PhoneOffIcon:LG,PhoneOutgoing:OG,PhoneOutgoingIcon:OG,Pi:DG,PiIcon:DG,PiSquare:Yb,PiSquareIcon:Yb,Piano:RG,PianoIcon:RG,Pickaxe:FG,PickaxeIcon:FG,PictureInPicture:BG,PictureInPicture2:zG,PictureInPicture2Icon:zG,PictureInPictureIcon:BG,PieChart:B_,PieChartIcon:B_,PiggyBank:$G,PiggyBankIcon:$G,Pilcrow:VG,PilcrowIcon:VG,PilcrowLeft:UG,PilcrowLeftIcon:UG,PilcrowRight:qG,PilcrowRightIcon:qG,PilcrowSquare:Xb,PilcrowSquareIcon:Xb,Pill:WG,PillBottle:HG,PillBottleIcon:HG,PillIcon:WG,Pin:v1,PinIcon:v1,PinOff:UT,PinOffIcon:UT,Pipette:GG,PipetteIcon:GG,Pizza:KG,PizzaIcon:KG,Plane:XG,PlaneIcon:XG,PlaneLanding:ZG,PlaneLandingIcon:ZG,PlaneTakeoff:YG,PlaneTakeoffIcon:YG,Play:dc,PlayCircle:Df,PlayCircleIcon:Df,PlayIcon:dc,PlaySquare:Qb,PlaySquareIcon:Qb,Plug:JG,Plug2:QG,Plug2Icon:QG,PlugIcon:JG,PlugZap:sb,PlugZap2:sb,PlugZap2Icon:sb,PlugZapIcon:sb,Plus:jn,PlusCircle:o2,PlusCircleIcon:o2,PlusIcon:jn,PlusSquare:Jb,PlusSquareIcon:Jb,Pocket:tK,PocketIcon:tK,PocketKnife:eK,PocketKnifeIcon:eK,Podcast:rK,PodcastIcon:rK,Pointer:sK,PointerIcon:sK,PointerOff:nK,PointerOffIcon:nK,Popcorn:iK,PopcornIcon:iK,Popsicle:aK,PopsicleIcon:aK,PoundSterling:oK,PoundSterlingIcon:oK,Power:cK,PowerCircle:l2,PowerCircleIcon:l2,PowerIcon:cK,PowerOff:lK,PowerOffIcon:lK,PowerSquare:ew,PowerSquareIcon:ew,Presentation:dK,PresentationIcon:dK,Printer:hK,PrinterCheck:uK,PrinterCheckIcon:uK,PrinterIcon:hK,Projector:fK,ProjectorIcon:fK,Proportions:pK,ProportionsIcon:pK,Puzzle:mK,PuzzleIcon:mK,Pyramid:gK,PyramidIcon:gK,QrCode:qT,QrCodeIcon:qT,Quote:VT,QuoteIcon:VT,Rabbit:xK,RabbitIcon:xK,Radar:yK,RadarIcon:yK,Radiation:vK,RadiationIcon:vK,Radical:_K,RadicalIcon:_K,Radio:bj,RadioIcon:bj,RadioReceiver:bK,RadioReceiverIcon:bK,RadioTower:wK,RadioTowerIcon:wK,Radius:jK,RadiusIcon:jK,RailSymbol:kK,RailSymbolIcon:kK,Rainbow:NK,RainbowIcon:NK,Rat:SK,RatIcon:SK,Ratio:CK,RatioIcon:CK,Receipt:DK,ReceiptCent:MK,ReceiptCentIcon:MK,ReceiptEuro:TK,ReceiptEuroIcon:TK,ReceiptIcon:DK,ReceiptIndianRupee:AK,ReceiptIndianRupeeIcon:AK,ReceiptJapaneseYen:EK,ReceiptJapaneseYenIcon:EK,ReceiptPoundSterling:IK,ReceiptPoundSterlingIcon:IK,ReceiptRussianRuble:PK,ReceiptRussianRubleIcon:PK,ReceiptSwissFranc:LK,ReceiptSwissFrancIcon:LK,ReceiptText:OK,ReceiptTextIcon:OK,RectangleEllipsis:ib,RectangleEllipsisIcon:ib,RectangleHorizontal:RK,RectangleHorizontalIcon:RK,RectangleVertical:FK,RectangleVerticalIcon:FK,Recycle:zK,RecycleIcon:zK,Redo:pS,Redo2:BK,Redo2Icon:BK,RedoDot:$K,RedoDotIcon:$K,RedoIcon:pS,RefreshCcw:qK,RefreshCcwDot:UK,RefreshCcwDotIcon:UK,RefreshCcwIcon:qK,RefreshCw:Vl,RefreshCwIcon:Vl,RefreshCwOff:VK,RefreshCwOffIcon:VK,Refrigerator:HK,RefrigeratorIcon:HK,Regex:WK,RegexIcon:WK,RemoveFormatting:GK,RemoveFormattingIcon:GK,Repeat:HT,Repeat1:KK,Repeat1Icon:KK,Repeat2:ZK,Repeat2Icon:ZK,RepeatIcon:HT,Replace:XK,ReplaceAll:YK,ReplaceAllIcon:YK,ReplaceIcon:XK,Reply:WT,ReplyAll:QK,ReplyAllIcon:QK,ReplyIcon:WT,Rewind:JK,RewindIcon:JK,Ribbon:eZ,RibbonIcon:eZ,Rocket:wg,RocketIcon:wg,RockingChair:tZ,RockingChairIcon:tZ,RollerCoaster:rZ,RollerCoasterIcon:rZ,Rotate3D:ab,Rotate3DIcon:ab,Rotate3d:ab,Rotate3dIcon:ab,RotateCcw:mS,RotateCcwIcon:mS,RotateCcwSquare:nZ,RotateCcwSquareIcon:nZ,RotateCw:GT,RotateCwIcon:GT,RotateCwSquare:sZ,RotateCwSquareIcon:sZ,Route:aZ,RouteIcon:aZ,RouteOff:iZ,RouteOffIcon:iZ,Router:oZ,RouterIcon:oZ,Rows:ob,Rows2:ob,Rows2Icon:ob,Rows3:lb,Rows3Icon:lb,Rows4:lZ,Rows4Icon:lZ,RowsIcon:ob,Rss:cZ,RssIcon:cZ,Ruler:dZ,RulerIcon:dZ,RussianRuble:uZ,RussianRubleIcon:uZ,Sailboat:hZ,SailboatIcon:hZ,Salad:fZ,SaladIcon:fZ,Sandwich:pZ,SandwichIcon:pZ,Satellite:gZ,SatelliteDish:mZ,SatelliteDishIcon:mZ,SatelliteIcon:gZ,Save:jg,SaveAll:xZ,SaveAllIcon:xZ,SaveIcon:jg,SaveOff:yZ,SaveOffIcon:yZ,Scale:vZ,Scale3D:cb,Scale3DIcon:cb,Scale3d:cb,Scale3dIcon:cb,ScaleIcon:vZ,Scaling:_Z,ScalingIcon:_Z,Scan:MZ,ScanBarcode:bZ,ScanBarcodeIcon:bZ,ScanEye:wZ,ScanEyeIcon:wZ,ScanFace:jZ,ScanFaceIcon:jZ,ScanIcon:MZ,ScanLine:kZ,ScanLineIcon:kZ,ScanQrCode:NZ,ScanQrCodeIcon:NZ,ScanSearch:SZ,ScanSearchIcon:SZ,ScanText:CZ,ScanTextIcon:CZ,ScatterChart:$_,ScatterChartIcon:$_,School:TZ,School2:mw,School2Icon:mw,SchoolIcon:TZ,Scissors:EZ,ScissorsIcon:EZ,ScissorsLineDashed:AZ,ScissorsLineDashedIcon:AZ,ScissorsSquare:tw,ScissorsSquareDashedBottom:Cb,ScissorsSquareDashedBottomIcon:Cb,ScissorsSquareIcon:tw,ScreenShare:PZ,ScreenShareIcon:PZ,ScreenShareOff:IZ,ScreenShareOffIcon:IZ,Scroll:OZ,ScrollIcon:OZ,ScrollText:LZ,ScrollTextIcon:LZ,Search:_i,SearchCheck:DZ,SearchCheckIcon:DZ,SearchCode:RZ,SearchCodeIcon:RZ,SearchIcon:_i,SearchSlash:FZ,SearchSlashIcon:FZ,SearchX:zZ,SearchXIcon:zZ,Section:BZ,SectionIcon:BZ,Send:Lo,SendHorizonal:db,SendHorizonalIcon:db,SendHorizontal:db,SendHorizontalIcon:db,SendIcon:Lo,SendToBack:$Z,SendToBackIcon:$Z,SeparatorHorizontal:UZ,SeparatorHorizontalIcon:UZ,SeparatorVertical:qZ,SeparatorVerticalIcon:qZ,Server:GZ,ServerCog:VZ,ServerCogIcon:VZ,ServerCrash:HZ,ServerCrashIcon:HZ,ServerIcon:GZ,ServerOff:WZ,ServerOffIcon:WZ,Settings:fd,Settings2:KZ,Settings2Icon:KZ,SettingsIcon:fd,Shapes:ZZ,ShapesIcon:ZZ,Share:KT,Share2:uc,Share2Icon:uc,ShareIcon:KT,Sheet:YZ,SheetIcon:YZ,Shell:XZ,ShellIcon:XZ,Shield:Kf,ShieldAlert:QZ,ShieldAlertIcon:QZ,ShieldBan:JZ,ShieldBanIcon:JZ,ShieldCheck:ZT,ShieldCheckIcon:ZT,ShieldClose:ub,ShieldCloseIcon:ub,ShieldEllipsis:eY,ShieldEllipsisIcon:eY,ShieldHalf:tY,ShieldHalfIcon:tY,ShieldIcon:Kf,ShieldMinus:rY,ShieldMinusIcon:rY,ShieldOff:nY,ShieldOffIcon:nY,ShieldPlus:sY,ShieldPlusIcon:sY,ShieldQuestion:iY,ShieldQuestionIcon:iY,ShieldX:ub,ShieldXIcon:ub,Ship:oY,ShipIcon:oY,ShipWheel:aY,ShipWheelIcon:aY,Shirt:lY,ShirtIcon:lY,ShoppingBag:kg,ShoppingBagIcon:kg,ShoppingBasket:cY,ShoppingBasketIcon:cY,ShoppingCart:hh,ShoppingCartIcon:hh,Shovel:dY,ShovelIcon:dY,ShowerHead:uY,ShowerHeadIcon:uY,Shrink:hY,ShrinkIcon:hY,Shrub:fY,ShrubIcon:fY,Shuffle:pY,ShuffleIcon:pY,Sidebar:eb,SidebarClose:X2,SidebarCloseIcon:X2,SidebarIcon:eb,SidebarOpen:J2,SidebarOpenIcon:J2,Sigma:mY,SigmaIcon:mY,SigmaSquare:rw,SigmaSquareIcon:rw,Signal:_Y,SignalHigh:gY,SignalHighIcon:gY,SignalIcon:_Y,SignalLow:xY,SignalLowIcon:xY,SignalMedium:yY,SignalMediumIcon:yY,SignalZero:vY,SignalZeroIcon:vY,Signature:bY,SignatureIcon:bY,Signpost:jY,SignpostBig:wY,SignpostBigIcon:wY,SignpostIcon:jY,Siren:kY,SirenIcon:kY,SkipBack:NY,SkipBackIcon:NY,SkipForward:SY,SkipForwardIcon:SY,Skull:CY,SkullIcon:CY,Slack:MY,SlackIcon:MY,Slash:TY,SlashIcon:TY,SlashSquare:nw,SlashSquareIcon:nw,Slice:AY,SliceIcon:AY,Sliders:hb,SlidersHorizontal:YT,SlidersHorizontalIcon:YT,SlidersIcon:hb,SlidersVertical:hb,SlidersVerticalIcon:hb,Smartphone:xm,SmartphoneCharging:EY,SmartphoneChargingIcon:EY,SmartphoneIcon:xm,SmartphoneNfc:IY,SmartphoneNfcIcon:IY,Smile:LY,SmileIcon:LY,SmilePlus:PY,SmilePlusIcon:PY,Snail:OY,SnailIcon:OY,Snowflake:q0,SnowflakeIcon:q0,Sofa:DY,SofaIcon:DY,SortAsc:b_,SortAscIcon:b_,SortDesc:y_,SortDescIcon:y_,Soup:RY,SoupIcon:RY,Space:FY,SpaceIcon:FY,Spade:zY,SpadeIcon:zY,Sparkle:BY,SparkleIcon:BY,Sparkles:Cs,SparklesIcon:Cs,Speaker:$Y,SpeakerIcon:$Y,Speech:UY,SpeechIcon:UY,SpellCheck:VY,SpellCheck2:qY,SpellCheck2Icon:qY,SpellCheckIcon:VY,Spline:HY,SplineIcon:HY,Split:WY,SplitIcon:WY,SplitSquareHorizontal:sw,SplitSquareHorizontalIcon:sw,SplitSquareVertical:iw,SplitSquareVerticalIcon:iw,SprayCan:GY,SprayCanIcon:GY,Sprout:KY,SproutIcon:KY,Square:ym,SquareActivity:fb,SquareActivityIcon:fb,SquareArrowDown:gb,SquareArrowDownIcon:gb,SquareArrowDownLeft:pb,SquareArrowDownLeftIcon:pb,SquareArrowDownRight:mb,SquareArrowDownRightIcon:mb,SquareArrowLeft:xb,SquareArrowLeftIcon:xb,SquareArrowOutDownLeft:yb,SquareArrowOutDownLeftIcon:yb,SquareArrowOutDownRight:vb,SquareArrowOutDownRightIcon:vb,SquareArrowOutUpLeft:_b,SquareArrowOutUpLeftIcon:_b,SquareArrowOutUpRight:bb,SquareArrowOutUpRightIcon:bb,SquareArrowRight:wb,SquareArrowRightIcon:wb,SquareArrowUp:Nb,SquareArrowUpIcon:Nb,SquareArrowUpLeft:jb,SquareArrowUpLeftIcon:jb,SquareArrowUpRight:kb,SquareArrowUpRightIcon:kb,SquareAsterisk:Sb,SquareAsteriskIcon:Sb,SquareBottomDashedScissors:Cb,SquareBottomDashedScissorsIcon:Cb,SquareChartGantt:Jm,SquareChartGanttIcon:Jm,SquareCheck:Mb,SquareCheckBig:g0,SquareCheckBigIcon:g0,SquareCheckIcon:Mb,SquareChevronDown:Tb,SquareChevronDownIcon:Tb,SquareChevronLeft:Ab,SquareChevronLeftIcon:Ab,SquareChevronRight:Eb,SquareChevronRightIcon:Eb,SquareChevronUp:Ib,SquareChevronUpIcon:Ib,SquareCode:Pb,SquareCodeIcon:Pb,SquareDashed:Db,SquareDashedBottom:YY,SquareDashedBottomCode:ZY,SquareDashedBottomCodeIcon:ZY,SquareDashedBottomIcon:YY,SquareDashedIcon:Db,SquareDashedKanban:Lb,SquareDashedKanbanIcon:Lb,SquareDashedMousePointer:Ob,SquareDashedMousePointerIcon:Ob,SquareDivide:Rb,SquareDivideIcon:Rb,SquareDot:Fb,SquareDotIcon:Fb,SquareEqual:zb,SquareEqualIcon:zb,SquareFunction:Bb,SquareFunctionIcon:Bb,SquareGanttChart:Jm,SquareGanttChartIcon:Jm,SquareIcon:ym,SquareKanban:$b,SquareKanbanIcon:$b,SquareLibrary:Ub,SquareLibraryIcon:Ub,SquareM:qb,SquareMIcon:qb,SquareMenu:Vb,SquareMenuIcon:Vb,SquareMinus:Hb,SquareMinusIcon:Hb,SquareMousePointer:Wb,SquareMousePointerIcon:Wb,SquareParking:Kb,SquareParkingIcon:Kb,SquareParkingOff:Gb,SquareParkingOffIcon:Gb,SquarePen:rc,SquarePenIcon:rc,SquarePercent:Zb,SquarePercentIcon:Zb,SquarePi:Yb,SquarePiIcon:Yb,SquarePilcrow:Xb,SquarePilcrowIcon:Xb,SquarePlay:Qb,SquarePlayIcon:Qb,SquarePlus:Jb,SquarePlusIcon:Jb,SquarePower:ew,SquarePowerIcon:ew,SquareRadical:XY,SquareRadicalIcon:XY,SquareScissors:tw,SquareScissorsIcon:tw,SquareSigma:rw,SquareSigmaIcon:rw,SquareSlash:nw,SquareSlashIcon:nw,SquareSplitHorizontal:sw,SquareSplitHorizontalIcon:sw,SquareSplitVertical:iw,SquareSplitVerticalIcon:iw,SquareSquare:QY,SquareSquareIcon:QY,SquareStack:JY,SquareStackIcon:JY,SquareTerminal:aw,SquareTerminalIcon:aw,SquareUser:lw,SquareUserIcon:lw,SquareUserRound:ow,SquareUserRoundIcon:ow,SquareX:cw,SquareXIcon:cw,Squircle:eX,SquircleIcon:eX,Squirrel:tX,SquirrelIcon:tX,Stamp:rX,StampIcon:rX,Star:vs,StarHalf:nX,StarHalfIcon:nX,StarIcon:vs,StarOff:sX,StarOffIcon:sX,Stars:Cs,StarsIcon:Cs,StepBack:iX,StepBackIcon:iX,StepForward:aX,StepForwardIcon:aX,Stethoscope:oX,StethoscopeIcon:oX,Sticker:lX,StickerIcon:lX,StickyNote:cX,StickyNoteIcon:cX,StopCircle:d2,StopCircleIcon:d2,Store:dX,StoreIcon:dX,StretchHorizontal:uX,StretchHorizontalIcon:uX,StretchVertical:hX,StretchVerticalIcon:hX,Strikethrough:fX,StrikethroughIcon:fX,Subscript:pX,SubscriptIcon:pX,Subtitles:T_,SubtitlesIcon:T_,Sun:_1,SunDim:mX,SunDimIcon:mX,SunIcon:_1,SunMedium:gX,SunMediumIcon:gX,SunMoon:xX,SunMoonIcon:xX,SunSnow:yX,SunSnowIcon:yX,Sunrise:vX,SunriseIcon:vX,Sunset:_X,SunsetIcon:_X,Superscript:bX,SuperscriptIcon:bX,SwatchBook:wX,SwatchBookIcon:wX,SwissFranc:jX,SwissFrancIcon:jX,SwitchCamera:kX,SwitchCameraIcon:kX,Sword:NX,SwordIcon:NX,Swords:SX,SwordsIcon:SX,Syringe:CX,SyringeIcon:CX,Table:LX,Table2:XT,Table2Icon:XT,TableCellsMerge:MX,TableCellsMergeIcon:MX,TableCellsSplit:TX,TableCellsSplitIcon:TX,TableColumnsSplit:AX,TableColumnsSplitIcon:AX,TableIcon:LX,TableOfContents:EX,TableOfContentsIcon:EX,TableProperties:IX,TablePropertiesIcon:IX,TableRowsSplit:PX,TableRowsSplitIcon:PX,Tablet:DX,TabletIcon:DX,TabletSmartphone:OX,TabletSmartphoneIcon:OX,Tablets:RX,TabletsIcon:RX,Tag:Gx,TagIcon:Gx,Tags:FX,TagsIcon:FX,Tally1:zX,Tally1Icon:zX,Tally2:BX,Tally2Icon:BX,Tally3:$X,Tally3Icon:$X,Tally4:UX,Tally4Icon:UX,Tally5:qX,Tally5Icon:qX,Tangent:VX,TangentIcon:VX,Target:Kx,TargetIcon:Kx,Telescope:HX,TelescopeIcon:HX,Tent:GX,TentIcon:GX,TentTree:WX,TentTreeIcon:WX,Terminal:KX,TerminalIcon:KX,TerminalSquare:aw,TerminalSquareIcon:aw,TestTube:ZX,TestTube2:dw,TestTube2Icon:dw,TestTubeDiagonal:dw,TestTubeDiagonalIcon:dw,TestTubeIcon:ZX,TestTubes:YX,TestTubesIcon:YX,Text:tQ,TextCursor:QX,TextCursorIcon:QX,TextCursorInput:XX,TextCursorInputIcon:XX,TextIcon:tQ,TextQuote:JX,TextQuoteIcon:JX,TextSearch:eQ,TextSearchIcon:eQ,TextSelect:uw,TextSelectIcon:uw,TextSelection:uw,TextSelectionIcon:uw,Theater:rQ,TheaterIcon:rQ,Thermometer:iQ,ThermometerIcon:iQ,ThermometerSnowflake:nQ,ThermometerSnowflakeIcon:nQ,ThermometerSun:sQ,ThermometerSunIcon:sQ,ThumbsDown:QT,ThumbsDownIcon:QT,ThumbsUp:pd,ThumbsUpIcon:pd,Ticket:JT,TicketCheck:aQ,TicketCheckIcon:aQ,TicketIcon:JT,TicketMinus:oQ,TicketMinusIcon:oQ,TicketPercent:lQ,TicketPercentIcon:lQ,TicketPlus:cQ,TicketPlusIcon:cQ,TicketSlash:dQ,TicketSlashIcon:dQ,TicketX:uQ,TicketXIcon:uQ,Tickets:fQ,TicketsIcon:fQ,TicketsPlane:hQ,TicketsPlaneIcon:hQ,Timer:gQ,TimerIcon:gQ,TimerOff:pQ,TimerOffIcon:pQ,TimerReset:mQ,TimerResetIcon:mQ,ToggleLeft:xQ,ToggleLeftIcon:xQ,ToggleRight:yQ,ToggleRightIcon:yQ,Toilet:vQ,ToiletIcon:vQ,Tornado:_Q,TornadoIcon:_Q,Torus:bQ,TorusIcon:bQ,Touchpad:jQ,TouchpadIcon:jQ,TouchpadOff:wQ,TouchpadOffIcon:wQ,TowerControl:kQ,TowerControlIcon:kQ,ToyBrick:NQ,ToyBrickIcon:NQ,Tractor:SQ,TractorIcon:SQ,TrafficCone:CQ,TrafficConeIcon:CQ,Train:hw,TrainFront:TQ,TrainFrontIcon:TQ,TrainFrontTunnel:MQ,TrainFrontTunnelIcon:MQ,TrainIcon:hw,TrainTrack:AQ,TrainTrackIcon:AQ,TramFront:hw,TramFrontIcon:hw,Trash:EQ,Trash2:Zn,Trash2Icon:Zn,TrashIcon:EQ,TreeDeciduous:IQ,TreeDeciduousIcon:IQ,TreePalm:fw,TreePalmIcon:fw,TreePine:b1,TreePineIcon:b1,Trees:PQ,TreesIcon:PQ,Trello:LQ,TrelloIcon:LQ,TrendingDown:w1,TrendingDownIcon:w1,TrendingUp:Zf,TrendingUpDown:OQ,TrendingUpDownIcon:OQ,TrendingUpIcon:Zf,Triangle:RQ,TriangleAlert:Bh,TriangleAlertIcon:Bh,TriangleIcon:RQ,TriangleRight:DQ,TriangleRightIcon:DQ,Trophy:Wa,TrophyIcon:Wa,Truck:eA,TruckIcon:eA,Turtle:FQ,TurtleIcon:FQ,Tv:BQ,Tv2:pw,Tv2Icon:pw,TvIcon:BQ,TvMinimal:pw,TvMinimalIcon:pw,TvMinimalPlay:zQ,TvMinimalPlayIcon:zQ,Twitch:$Q,TwitchIcon:$Q,Twitter:UQ,TwitterIcon:UQ,Type:VQ,TypeIcon:VQ,TypeOutline:qQ,TypeOutlineIcon:qQ,Umbrella:WQ,UmbrellaIcon:WQ,UmbrellaOff:HQ,UmbrellaOffIcon:HQ,Underline:GQ,UnderlineIcon:GQ,Undo:gS,Undo2:KQ,Undo2Icon:KQ,UndoDot:ZQ,UndoDotIcon:ZQ,UndoIcon:gS,UnfoldHorizontal:YQ,UnfoldHorizontalIcon:YQ,UnfoldVertical:XQ,UnfoldVerticalIcon:XQ,Ungroup:QQ,UngroupIcon:QQ,University:mw,UniversityIcon:mw,Unlink:tA,Unlink2:JQ,Unlink2Icon:JQ,UnlinkIcon:tA,Unlock:q2,UnlockIcon:q2,UnlockKeyhole:U2,UnlockKeyholeIcon:U2,Unplug:eJ,UnplugIcon:eJ,Upload:no,UploadCloud:g2,UploadCloudIcon:g2,UploadIcon:no,Usb:tJ,UsbIcon:tJ,User:Cc,User2:bw,User2Icon:bw,UserCheck:wj,UserCheck2:gw,UserCheck2Icon:gw,UserCheckIcon:wj,UserCircle:h2,UserCircle2:u2,UserCircle2Icon:u2,UserCircleIcon:h2,UserCog:rA,UserCog2:xw,UserCog2Icon:xw,UserCogIcon:rA,UserIcon:Cc,UserMinus:rJ,UserMinus2:yw,UserMinus2Icon:yw,UserMinusIcon:rJ,UserPen:nJ,UserPenIcon:nJ,UserPlus:Jh,UserPlus2:vw,UserPlus2Icon:vw,UserPlusIcon:Jh,UserRound:bw,UserRoundCheck:gw,UserRoundCheckIcon:gw,UserRoundCog:xw,UserRoundCogIcon:xw,UserRoundIcon:bw,UserRoundMinus:yw,UserRoundMinusIcon:yw,UserRoundPen:sJ,UserRoundPenIcon:sJ,UserRoundPlus:vw,UserRoundPlusIcon:vw,UserRoundSearch:iJ,UserRoundSearchIcon:iJ,UserRoundX:_w,UserRoundXIcon:_w,UserSearch:aJ,UserSearchIcon:aJ,UserSquare:lw,UserSquare2:ow,UserSquare2Icon:ow,UserSquareIcon:lw,UserX:oJ,UserX2:_w,UserX2Icon:_w,UserXIcon:oJ,Users:Vn,Users2:ww,Users2Icon:ww,UsersIcon:Vn,UsersRound:ww,UsersRoundIcon:ww,Utensils:kw,UtensilsCrossed:jw,UtensilsCrossedIcon:jw,UtensilsIcon:kw,UtilityPole:lJ,UtilityPoleIcon:lJ,Variable:nA,VariableIcon:nA,Vault:cJ,VaultIcon:cJ,Vegan:dJ,VeganIcon:dJ,VenetianMask:uJ,VenetianMaskIcon:uJ,Verified:k_,VerifiedIcon:k_,Vibrate:fJ,VibrateIcon:fJ,VibrateOff:hJ,VibrateOffIcon:hJ,Video:Fi,VideoIcon:Fi,VideoOff:pJ,VideoOffIcon:pJ,Videotape:mJ,VideotapeIcon:mJ,View:gJ,ViewIcon:gJ,Voicemail:xJ,VoicemailIcon:xJ,Volleyball:yJ,VolleyballIcon:yJ,Volume:jJ,Volume1:vJ,Volume1Icon:vJ,Volume2:_J,Volume2Icon:_J,VolumeIcon:jJ,VolumeOff:bJ,VolumeOffIcon:bJ,VolumeX:wJ,VolumeXIcon:wJ,Vote:kJ,VoteIcon:kJ,Wallet:SJ,Wallet2:Nw,Wallet2Icon:Nw,WalletCards:NJ,WalletCardsIcon:NJ,WalletIcon:SJ,WalletMinimal:Nw,WalletMinimalIcon:Nw,Wallpaper:CJ,WallpaperIcon:CJ,Wand:MJ,Wand2:Sw,Wand2Icon:Sw,WandIcon:MJ,WandSparkles:Sw,WandSparklesIcon:Sw,Warehouse:TJ,WarehouseIcon:TJ,WashingMachine:AJ,WashingMachineIcon:AJ,Watch:EJ,WatchIcon:EJ,Waves:IJ,WavesIcon:IJ,Waypoints:PJ,WaypointsIcon:PJ,Webcam:LJ,WebcamIcon:LJ,Webhook:DJ,WebhookIcon:DJ,WebhookOff:OJ,WebhookOffIcon:OJ,Weight:RJ,WeightIcon:RJ,Wheat:zJ,WheatIcon:zJ,WheatOff:FJ,WheatOffIcon:FJ,WholeWord:BJ,WholeWordIcon:BJ,Wifi:HJ,WifiHigh:$J,WifiHighIcon:$J,WifiIcon:HJ,WifiLow:UJ,WifiLowIcon:UJ,WifiOff:qJ,WifiOffIcon:qJ,WifiZero:VJ,WifiZeroIcon:VJ,Wind:GJ,WindArrowDown:WJ,WindArrowDownIcon:WJ,WindIcon:GJ,Wine:ZJ,WineIcon:ZJ,WineOff:KJ,WineOffIcon:KJ,Workflow:YJ,WorkflowIcon:YJ,Worm:XJ,WormIcon:XJ,WrapText:QJ,WrapTextIcon:QJ,Wrench:Zx,WrenchIcon:Zx,X:bs,XCircle:zc,XCircleIcon:zc,XIcon:bs,XOctagon:K2,XOctagonIcon:K2,XSquare:cw,XSquareIcon:cw,Youtube:JJ,YoutubeIcon:JJ,Zap:Ng,ZapIcon:Ng,ZapOff:eee,ZapOffIcon:eee,ZoomIn:xS,ZoomInIcon:xS,ZoomOut:yS,ZoomOutIcon:yS,createLucideIcon:U,icons:SZe},Symbol.toStringTag,{value:"Module"})),Gme="-",CZe=e=>{const t=TZe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const a=l.split(Gme);return a[0]===""&&a.length!==1&&a.shift(),PAe(a,t)||MZe(l)},getConflictingClassGroupIds:(l,a)=>{const h=n[l]||[];return a&&s[l]?[...h,...s[l]]:h}}},PAe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),i=s?PAe(e.slice(1),s):void 0;if(i)return i;if(t.validators.length===0)return;const o=e.join(Gme);return(l=t.validators.find(({validator:a})=>a(o)))==null?void 0:l.classGroupId},Jbe=/^\[(.+)\]$/,MZe=e=>{if(Jbe.test(e)){const t=Jbe.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},TZe=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return EZe(Object.entries(e.classGroups),n).forEach(([o,l])=>{pue(l,s,o,t)}),s},pue=(e,t,n,s)=>{e.forEach(i=>{if(typeof i=="string"){const o=i===""?t:ewe(t,i);o.classGroupId=n;return}if(typeof i=="function"){if(AZe(i)){pue(i(s),t,n,s);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,l])=>{pue(l,ewe(t,o),n,s)})})},ewe=(e,t)=>{let n=e;return t.split(Gme).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},AZe=e=>e.isThemeGetter,EZe=(e,t)=>t?e.map(([n,s])=>{const i=s.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,a])=>[t+l,a])):o);return[n,i]}):e,IZe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const i=(o,l)=>{n.set(o,l),t++,t>e&&(t=0,s=n,n=new Map)};return{get(o){let l=n.get(o);if(l!==void 0)return l;if((l=s.get(o))!==void 0)return i(o,l),l},set(o,l){n.has(o)?n.set(o,l):i(o,l)}}},LAe="!",PZe=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,i=t[0],o=t.length,l=a=>{const h=[];let p=0,x=0,y;for(let A=0;Ax?y-x:void 0;return{modifiers:h,hasImportantModifier:j,baseClassName:N,maybePostfixModifierPosition:C}};return n?a=>n({className:a,parseClassName:l}):l},LZe=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},OZe=e=>({cache:IZe(e.cacheSize),parseClassName:PZe(e),...CZe(e)}),DZe=/\s+/,RZe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=t,o=[],l=e.trim().split(DZe);let a="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{modifiers:x,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:j}=n(p);let N=!!j,C=s(N?b.substring(0,j):b);if(!C){if(!N){a=p+(a.length>0?" "+a:a);continue}if(C=s(b),!C){a=p+(a.length>0?" "+a:a);continue}N=!1}const A=LZe(x).join(":"),E=y?A+LAe:A,T=E+C;if(o.includes(T))continue;o.push(T);const L=i(C,N);for(let z=0;z0?" "+a:a)}return a};function FZe(){let e=0,t,n,s="";for(;e{if(typeof e=="string")return e;let t,n="";for(let s=0;sy(x),e());return n=OZe(p),s=n.cache.get,i=n.cache.set,o=a,a(h)}function a(h){const p=s(h);if(p)return p;const x=RZe(h,n);return i(h,x),x}return function(){return o(FZe.apply(null,arguments))}}const ll=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},DAe=/^\[(?:([a-z-]+):)?(.+)\]$/i,BZe=/^\d+\/\d+$/,$Ze=new Set(["px","full","screen"]),UZe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qZe=/\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$/,VZe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,HZe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,WZe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,fx=e=>vS(e)||$Ze.has(e)||BZe.test(e),n0=e=>QC(e,"length",eYe),vS=e=>!!e&&!Number.isNaN(Number(e)),ble=e=>QC(e,"number",vS),IM=e=>!!e&&Number.isInteger(Number(e)),GZe=e=>e.endsWith("%")&&vS(e.slice(0,-1)),ta=e=>DAe.test(e),s0=e=>UZe.test(e),KZe=new Set(["length","size","percentage"]),ZZe=e=>QC(e,KZe,RAe),YZe=e=>QC(e,"position",RAe),XZe=new Set(["image","url"]),QZe=e=>QC(e,XZe,rYe),JZe=e=>QC(e,"",tYe),PM=()=>!0,QC=(e,t,n)=>{const s=DAe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},eYe=e=>qZe.test(e)&&!VZe.test(e),RAe=()=>!1,tYe=e=>HZe.test(e),rYe=e=>WZe.test(e),nYe=()=>{const e=ll("colors"),t=ll("spacing"),n=ll("blur"),s=ll("brightness"),i=ll("borderColor"),o=ll("borderRadius"),l=ll("borderSpacing"),a=ll("borderWidth"),h=ll("contrast"),p=ll("grayscale"),x=ll("hueRotate"),y=ll("invert"),b=ll("gap"),j=ll("gradientColorStops"),N=ll("gradientColorStopPositions"),C=ll("inset"),A=ll("margin"),E=ll("opacity"),T=ll("padding"),L=ll("saturate"),z=ll("scale"),F=ll("sepia"),q=ll("skew"),H=ll("space"),K=ll("translate"),Z=()=>["auto","contain","none"],te=()=>["auto","hidden","clip","visible","scroll"],ae=()=>["auto",ta,t],le=()=>[ta,t],ve=()=>["",fx,n0],ne=()=>["auto",vS,ta],ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>["start","end","center","between","around","evenly","stretch"],ye=()=>["","0",ta],Ie=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ne=()=>[vS,ta];return{cacheSize:500,separator:":",theme:{colors:[PM],spacing:[fx,n0],blur:["none","",s0,ta],brightness:Ne(),borderColor:[e],borderRadius:["none","","full",s0,ta],borderSpacing:le(),borderWidth:ve(),contrast:Ne(),grayscale:ye(),hueRotate:Ne(),invert:ye(),gap:le(),gradientColorStops:[e],gradientColorStopPositions:[GZe,n0],inset:ae(),margin:ae(),opacity:Ne(),padding:le(),saturate:Ne(),scale:Ne(),sepia:ye(),skew:Ne(),space:le(),translate:le()},classGroups:{aspect:[{aspect:["auto","square","video",ta]}],container:["container"],columns:[{columns:[s0]}],"break-after":[{"break-after":Ie()}],"break-before":[{"break-before":Ie()}],"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:[...ge(),ta]}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",IM,ta]}],basis:[{basis:ae()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ta]}],grow:[{grow:ye()}],shrink:[{shrink:ye()}],order:[{order:["first","last","none",IM,ta]}],"grid-cols":[{"grid-cols":[PM]}],"col-start-end":[{col:["auto",{span:["full",IM,ta]},ta]}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":[PM]}],"row-start-end":[{row:["auto",{span:[IM,ta]},ta]}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ta]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ta]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...de()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...de(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...de(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[A]}],mx:[{mx:[A]}],my:[{my:[A]}],ms:[{ms:[A]}],me:[{me:[A]}],mt:[{mt:[A]}],mr:[{mr:[A]}],mb:[{mb:[A]}],ml:[{ml:[A]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ta,t]}],"min-w":[{"min-w":[ta,t,"min","max","fit"]}],"max-w":[{"max-w":[ta,t,"none","full","min","max","fit","prose",{screen:[s0]},s0]}],h:[{h:[ta,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ta,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ta,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ta,t,"auto","min","max","fit"]}],"font-size":[{text:["base",s0,n0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ble]}],"font-family":[{font:[PM]}],"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",ta]}],"line-clamp":[{"line-clamp":["none",vS,ble]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fx,ta]}],"list-image":[{"list-image":["none",ta]}],"list-style-type":[{list:["none","disc","decimal",ta]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fx,n0]}],"underline-offset":[{"underline-offset":["auto",fx,ta]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:le()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ta]}],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",ta]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ge(),YZe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",ZZe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},QZe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:ie()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[fx,ta]}],"outline-w":[{outline:[fx,n0]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ve()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[fx,n0]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",s0,JZe]}],"shadow-color":[{shadow:[PM]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",s0,ta]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[y]}],saturate:[{saturate:[L]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[L]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ta]}],duration:[{duration:Ne()}],ease:[{ease:["linear","in","out","in-out",ta]}],delay:[{delay:Ne()}],animate:[{animate:["none","spin","ping","pulse","bounce",ta]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[IM,ta]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[q]}],"skew-y":[{"skew-y":[q]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ta]}],accent:[{accent:["auto",e]}],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",ta]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":le()}],"scroll-mx":[{"scroll-mx":le()}],"scroll-my":[{"scroll-my":le()}],"scroll-ms":[{"scroll-ms":le()}],"scroll-me":[{"scroll-me":le()}],"scroll-mt":[{"scroll-mt":le()}],"scroll-mr":[{"scroll-mr":le()}],"scroll-mb":[{"scroll-mb":le()}],"scroll-ml":[{"scroll-ml":le()}],"scroll-p":[{"scroll-p":le()}],"scroll-px":[{"scroll-px":le()}],"scroll-py":[{"scroll-py":le()}],"scroll-ps":[{"scroll-ps":le()}],"scroll-pe":[{"scroll-pe":le()}],"scroll-pt":[{"scroll-pt":le()}],"scroll-pr":[{"scroll-pr":le()}],"scroll-pb":[{"scroll-pb":le()}],"scroll-pl":[{"scroll-pl":le()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ta]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[fx,n0,ble]}],stroke:[{stroke:[e,"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"]}}},sYe=zZe(nYe);function $t(...e){return sYe(ra(e))}function Ed(e,t=!1){return t&&e>=1e6?`$${(e/1e6).toFixed(1)}M`:t&&e>=1e3?`$${(e/1e3).toFixed(0)}K`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function twe(e){const t=new Date(e);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}function Ene(e){return e?e.replace(/<[^>]*>/g,""):""}const iYe=jZe,FAe=I.forwardRef(({className:e,...t},n)=>r.jsx(jAe,{ref:n,className:$t("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]",e),...t}));FAe.displayName=jAe.displayName;const aYe=XC("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"}}),zAe=I.forwardRef(({className:e,variant:t,...n},s)=>r.jsx(kAe,{ref:s,className:$t(aYe({variant:t}),e),...n}));zAe.displayName=kAe.displayName;const oYe=I.forwardRef(({className:e,...t},n)=>r.jsx(CAe,{ref:n,className:$t("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",e),...t}));oYe.displayName=CAe.displayName;const BAe=I.forwardRef(({className:e,...t},n)=>r.jsx(MAe,{ref:n,className:$t("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsx(bs,{className:"h-4 w-4"})}));BAe.displayName=MAe.displayName;const $Ae=I.forwardRef(({className:e,...t},n)=>r.jsx(NAe,{ref:n,className:$t("text-sm font-semibold",e),...t}));$Ae.displayName=NAe.displayName;const UAe=I.forwardRef(({className:e,...t},n)=>r.jsx(SAe,{ref:n,className:$t("text-sm opacity-90",e),...t}));UAe.displayName=SAe.displayName;function lYe(){const{toasts:e}=pa();return r.jsxs(iYe,{children:[e.map(function({id:t,title:n,description:s,action:i,...o}){return r.jsxs(zAe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx($Ae,{children:n}),s&&r.jsx(UAe,{children:s})]}),i,r.jsx(BAe,{})]},t)}),r.jsx(FAe,{})]})}var rwe=["light","dark"],cYe="(prefers-color-scheme: dark)",dYe=I.createContext(void 0),uYe={setTheme:e=>{},themes:[]},hYe=()=>{var e;return(e=I.useContext(dYe))!=null?e:uYe};I.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:s,enableColorScheme:i,defaultTheme:o,value:l,attrs:a,nonce:h})=>{let p=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${a.map(N=>`'${N}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,y=i?rwe.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",b=(N,C=!1,A=!0)=>{let E=l?l[N]:N,T=C?N+"|| ''":`'${E}'`,L="";return i&&A&&!C&&rwe.includes(N)&&(L+=`d.style.colorScheme = '${N}';`),n==="class"?C||E?L+=`c.add(${T})`:L+="null":E&&(L+=`d[s](n,${T})`),L},j=e?`!function(){${x}${b(e)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${p})){var t='${cYe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${b("dark")}}else{${b("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${b(l?"x[e]":"e",!0)}}${p?"":"else{"+b(o,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${t}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${b(l?"x[e]":"e",!0)}}else{${b(o,!1,!1)};}${y}}catch(t){}}();`;return I.createElement("script",{nonce:h,dangerouslySetInnerHTML:{__html:j}})});var fYe=e=>{switch(e){case"success":return gYe;case"info":return yYe;case"warning":return xYe;case"error":return vYe;default:return null}},pYe=Array(12).fill(0),mYe=({visible:e,className:t})=>rt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},rt.createElement("div",{className:"sonner-spinner"},pYe.map((n,s)=>rt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),gYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},rt.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),xYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},rt.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),yYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},rt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),vYe=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},rt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),_Ye=rt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},rt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),rt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),bYe=()=>{let[e,t]=rt.useState(document.hidden);return rt.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},mue=1,wYe=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:mue++,o=this.toasts.find(a=>a.id===i),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(a=>a.id===i?(this.publish({...a,...e,id:i,title:n}),{...a,...e,id:i,dismissible:l,title:n}):a):this.addToast({title:n,...s,dismissible:l,id:i}),i},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),i=n!==void 0,o,l=s.then(async h=>{if(o=["resolve",h],rt.isValidElement(h))i=!1,this.create({id:n,type:"default",message:h});else if(kYe(h)&&!h.ok){i=!1;let p=typeof t.error=="function"?await t.error(`HTTP error! status: ${h.status}`):t.error,x=typeof t.description=="function"?await t.description(`HTTP error! status: ${h.status}`):t.description;this.create({id:n,type:"error",message:p,description:x})}else if(t.success!==void 0){i=!1;let p=typeof t.success=="function"?await t.success(h):t.success,x=typeof t.description=="function"?await t.description(h):t.description;this.create({id:n,type:"success",message:p,description:x})}}).catch(async h=>{if(o=["reject",h],t.error!==void 0){i=!1;let p=typeof t.error=="function"?await t.error(h):t.error,x=typeof t.description=="function"?await t.description(h):t.description;this.create({id:n,type:"error",message:p,description:x})}}).finally(()=>{var h;i&&(this.dismiss(n),n=void 0),(h=t.finally)==null||h.call(t)}),a=()=>new Promise((h,p)=>l.then(()=>o[0]==="reject"?p(o[1]):h(o[1])).catch(p));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||mue++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},oh=new wYe,jYe=(e,t)=>{let n=(t==null?void 0:t.id)||mue++;return oh.addToast({title:e,...t,id:n}),n},kYe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",NYe=jYe,SYe=()=>oh.toasts,CYe=()=>oh.getActiveToasts(),ze=Object.assign(NYe,{success:oh.success,info:oh.info,warning:oh.warning,error:oh.error,custom:oh.custom,message:oh.message,promise:oh.promise,dismiss:oh.dismiss,loading:oh.loading},{getHistory:SYe,getToasts:CYe});function MYe(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}MYe(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} `);function aL(e){return e.label!==void 0}var TYe=3,AYe="32px",EYe="16px",nwe=4e3,IYe=356,PYe=14,LYe=20,OYe=200;function Bp(...e){return e.filter(Boolean).join(" ")}function DYe(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var RYe=e=>{var t,n,s,i,o,l,a,h,p,x,y;let{invert:b,toast:j,unstyled:N,interacting:C,setHeights:A,visibleToasts:E,heights:T,index:L,toasts:z,expanded:F,removeToast:q,defaultRichColors:H,closeButton:K,style:Z,cancelButtonStyle:te,actionButtonStyle:ae,className:le="",descriptionClassName:ve="",duration:ne,position:ge,gap:ie,loadingIcon:fe,expandByDefault:de,classNames:ye,icons:Ie,closeButtonAriaLabel:Ne="Close toast",pauseWhenPageIsHidden:we}=e,[he,xe]=rt.useState(null),[be,Oe]=rt.useState(null),[Te,Ve]=rt.useState(!1),[Fe,Me]=rt.useState(!1),[Qe,Ee]=rt.useState(!1),[Ye,me]=rt.useState(!1),[mt,et]=rt.useState(!1),[nt,Ae]=rt.useState(0),[ht,$e]=rt.useState(0),Je=rt.useRef(j.duration||ne||nwe),tt=rt.useRef(null),ft=rt.useRef(null),jt=L===0,Nt=L+1<=E,Et=j.type,vt=j.dismissible!==!1,rr=j.className||"",Ar=j.descriptionClassName||"",yn=rt.useMemo(()=>T.findIndex(Ns=>Ns.toastId===j.id)||0,[T,j.id]),kn=rt.useMemo(()=>{var Ns;return(Ns=j.closeButton)!=null?Ns:K},[j.closeButton,K]),Jr=rt.useMemo(()=>j.duration||ne||nwe,[j.duration,ne]),zn=rt.useRef(0),ks=rt.useRef(0),fr=rt.useRef(0),xs=rt.useRef(null),[ji,mi]=ge.split("-"),La=rt.useMemo(()=>T.reduce((Ns,Ei,Ii)=>Ii>=yn?Ns:Ns+Ei.height,0),[T,yn]),da=bYe(),tl=j.invert||b,rl=Et==="loading";ks.current=rt.useMemo(()=>yn*ie+La,[yn,La]),rt.useEffect(()=>{Je.current=Jr},[Jr]),rt.useEffect(()=>{Ve(!0)},[]),rt.useEffect(()=>{let Ns=ft.current;if(Ns){let Ei=Ns.getBoundingClientRect().height;return $e(Ei),A(Ii=>[{toastId:j.id,height:Ei,position:j.position},...Ii]),()=>A(Ii=>Ii.filter(Oo=>Oo.toastId!==j.id))}},[A,j.id]),rt.useLayoutEffect(()=>{if(!Te)return;let Ns=ft.current,Ei=Ns.style.height;Ns.style.height="auto";let Ii=Ns.getBoundingClientRect().height;Ns.style.height=Ei,$e(Ii),A(Oo=>Oo.find(ir=>ir.toastId===j.id)?Oo.map(ir=>ir.toastId===j.id?{...ir,height:Ii}:ir):[{toastId:j.id,height:Ii,position:j.position},...Oo])},[Te,j.title,j.description,A,j.id]);let Gs=rt.useCallback(()=>{Me(!0),Ae(ks.current),A(Ns=>Ns.filter(Ei=>Ei.toastId!==j.id)),setTimeout(()=>{q(j)},OYe)},[j,q,A,ks]);rt.useEffect(()=>{if(j.promise&&Et==="loading"||j.duration===1/0||j.type==="loading")return;let Ns;return F||C||we&&da?(()=>{if(fr.current{var Ei;(Ei=j.onAutoClose)==null||Ei.call(j,j),Gs()},Je.current)),()=>clearTimeout(Ns)},[F,C,j,Et,we,da,Gs]),rt.useEffect(()=>{j.delete&&Gs()},[Gs,j.delete]);function Zi(){var Ns,Ei,Ii;return Ie!=null&&Ie.loading?rt.createElement("div",{className:Bp(ye==null?void 0:ye.loader,(Ns=j==null?void 0:j.classNames)==null?void 0:Ns.loader,"sonner-loader"),"data-visible":Et==="loading"},Ie.loading):fe?rt.createElement("div",{className:Bp(ye==null?void 0:ye.loader,(Ei=j==null?void 0:j.classNames)==null?void 0:Ei.loader,"sonner-loader"),"data-visible":Et==="loading"},fe):rt.createElement(mYe,{className:Bp(ye==null?void 0:ye.loader,(Ii=j==null?void 0:j.classNames)==null?void 0:Ii.loader),visible:Et==="loading"})}return rt.createElement("li",{tabIndex:0,ref:ft,className:Bp(le,rr,ye==null?void 0:ye.toast,(t=j==null?void 0:j.classNames)==null?void 0:t.toast,ye==null?void 0:ye.default,ye==null?void 0:ye[Et],(n=j==null?void 0:j.classNames)==null?void 0:n[Et]),"data-sonner-toast":"","data-rich-colors":(s=j.richColors)!=null?s:H,"data-styled":!(j.jsx||j.unstyled||N),"data-mounted":Te,"data-promise":!!j.promise,"data-swiped":mt,"data-removed":Fe,"data-visible":Nt,"data-y-position":ji,"data-x-position":mi,"data-index":L,"data-front":jt,"data-swiping":Qe,"data-dismissible":vt,"data-type":Et,"data-invert":tl,"data-swipe-out":Ye,"data-swipe-direction":be,"data-expanded":!!(F||de&&Te),style:{"--index":L,"--toasts-before":L,"--z-index":z.length-L,"--offset":`${Fe?nt:ks.current}px`,"--initial-height":de?"auto":`${ht}px`,...Z,...j.style},onDragEnd:()=>{Ee(!1),xe(null),xs.current=null},onPointerDown:Ns=>{rl||!vt||(tt.current=new Date,Ae(ks.current),Ns.target.setPointerCapture(Ns.pointerId),Ns.target.tagName!=="BUTTON"&&(Ee(!0),xs.current={x:Ns.clientX,y:Ns.clientY}))},onPointerUp:()=>{var Ns,Ei,Ii,Oo;if(Ye||!vt)return;xs.current=null;let ir=Number(((Ns=ft.current)==null?void 0:Ns.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),xo=Number(((Ei=ft.current)==null?void 0:Ei.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Tc=new Date().getTime()-((Ii=tt.current)==null?void 0:Ii.getTime()),yo=he==="x"?ir:xo,ss=Math.abs(yo)/Tc;if(Math.abs(yo)>=LYe||ss>.11){Ae(ks.current),(Oo=j.onDismiss)==null||Oo.call(j,j),Oe(he==="x"?ir>0?"right":"left":xo>0?"down":"up"),Gs(),me(!0),et(!1);return}Ee(!1),xe(null)},onPointerMove:Ns=>{var Ei,Ii,Oo,ir;if(!xs.current||!vt||((Ei=window.getSelection())==null?void 0:Ei.toString().length)>0)return;let xo=Ns.clientY-xs.current.y,Tc=Ns.clientX-xs.current.x,yo=(Ii=e.swipeDirections)!=null?Ii:DYe(ge);!he&&(Math.abs(Tc)>1||Math.abs(xo)>1)&&xe(Math.abs(Tc)>Math.abs(xo)?"x":"y");let ss={x:0,y:0};he==="y"?(yo.includes("top")||yo.includes("bottom"))&&(yo.includes("top")&&xo<0||yo.includes("bottom")&&xo>0)&&(ss.y=xo):he==="x"&&(yo.includes("left")||yo.includes("right"))&&(yo.includes("left")&&Tc<0||yo.includes("right")&&Tc>0)&&(ss.x=Tc),(Math.abs(ss.x)>0||Math.abs(ss.y)>0)&&et(!0),(Oo=ft.current)==null||Oo.style.setProperty("--swipe-amount-x",`${ss.x}px`),(ir=ft.current)==null||ir.style.setProperty("--swipe-amount-y",`${ss.y}px`)}},kn&&!j.jsx?rt.createElement("button",{"aria-label":Ne,"data-disabled":rl,"data-close-button":!0,onClick:rl||!vt?()=>{}:()=>{var Ns;Gs(),(Ns=j.onDismiss)==null||Ns.call(j,j)},className:Bp(ye==null?void 0:ye.closeButton,(i=j==null?void 0:j.classNames)==null?void 0:i.closeButton)},(o=Ie==null?void 0:Ie.close)!=null?o:_Ye):null,j.jsx||I.isValidElement(j.title)?j.jsx?j.jsx:typeof j.title=="function"?j.title():j.title:rt.createElement(rt.Fragment,null,Et||j.icon||j.promise?rt.createElement("div",{"data-icon":"",className:Bp(ye==null?void 0:ye.icon,(l=j==null?void 0:j.classNames)==null?void 0:l.icon)},j.promise||j.type==="loading"&&!j.icon?j.icon||Zi():null,j.type!=="loading"?j.icon||(Ie==null?void 0:Ie[Et])||fYe(Et):null):null,rt.createElement("div",{"data-content":"",className:Bp(ye==null?void 0:ye.content,(a=j==null?void 0:j.classNames)==null?void 0:a.content)},rt.createElement("div",{"data-title":"",className:Bp(ye==null?void 0:ye.title,(h=j==null?void 0:j.classNames)==null?void 0:h.title)},typeof j.title=="function"?j.title():j.title),j.description?rt.createElement("div",{"data-description":"",className:Bp(ve,Ar,ye==null?void 0:ye.description,(p=j==null?void 0:j.classNames)==null?void 0:p.description)},typeof j.description=="function"?j.description():j.description):null),I.isValidElement(j.cancel)?j.cancel:j.cancel&&aL(j.cancel)?rt.createElement("button",{"data-button":!0,"data-cancel":!0,style:j.cancelButtonStyle||te,onClick:Ns=>{var Ei,Ii;aL(j.cancel)&&vt&&((Ii=(Ei=j.cancel).onClick)==null||Ii.call(Ei,Ns),Gs())},className:Bp(ye==null?void 0:ye.cancelButton,(x=j==null?void 0:j.classNames)==null?void 0:x.cancelButton)},j.cancel.label):null,I.isValidElement(j.action)?j.action:j.action&&aL(j.action)?rt.createElement("button",{"data-button":!0,"data-action":!0,style:j.actionButtonStyle||ae,onClick:Ns=>{var Ei,Ii;aL(j.action)&&((Ii=(Ei=j.action).onClick)==null||Ii.call(Ei,Ns),!Ns.defaultPrevented&&Gs())},className:Bp(ye==null?void 0:ye.actionButton,(y=j==null?void 0:j.classNames)==null?void 0:y.actionButton)},j.action.label):null))};function swe(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function FYe(e,t){let n={};return[e,t].forEach((s,i)=>{let o=i===1,l=o?"--mobile-offset":"--offset",a=o?EYe:AYe;function h(p){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof p=="number"?`${p}px`:p})}typeof s=="number"||typeof s=="string"?h(s):typeof s=="object"?["top","right","bottom","left"].forEach(p=>{s[p]===void 0?n[`${l}-${p}`]=a:n[`${l}-${p}`]=typeof s[p]=="number"?`${s[p]}px`:s[p]}):h(a)}),n}var zYe=I.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:l,className:a,offset:h,mobileOffset:p,theme:x="light",richColors:y,duration:b,style:j,visibleToasts:N=TYe,toastOptions:C,dir:A=swe(),gap:E=PYe,loadingIcon:T,icons:L,containerAriaLabel:z="Notifications",pauseWhenPageIsHidden:F}=e,[q,H]=rt.useState([]),K=rt.useMemo(()=>Array.from(new Set([s].concat(q.filter(we=>we.position).map(we=>we.position)))),[q,s]),[Z,te]=rt.useState([]),[ae,le]=rt.useState(!1),[ve,ne]=rt.useState(!1),[ge,ie]=rt.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),fe=rt.useRef(null),de=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),ye=rt.useRef(null),Ie=rt.useRef(!1),Ne=rt.useCallback(we=>{H(he=>{var xe;return(xe=he.find(be=>be.id===we.id))!=null&&xe.delete||oh.dismiss(we.id),he.filter(({id:be})=>be!==we.id)})},[]);return rt.useEffect(()=>oh.subscribe(we=>{if(we.dismiss){H(he=>he.map(xe=>xe.id===we.id?{...xe,delete:!0}:xe));return}setTimeout(()=>{$me.flushSync(()=>{H(he=>{let xe=he.findIndex(be=>be.id===we.id);return xe!==-1?[...he.slice(0,xe),{...he[xe],...we},...he.slice(xe+1)]:[we,...he]})})})}),[]),rt.useEffect(()=>{if(x!=="system"){ie(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ie("dark"):ie("light")),typeof window>"u")return;let we=window.matchMedia("(prefers-color-scheme: dark)");try{we.addEventListener("change",({matches:he})=>{ie(he?"dark":"light")})}catch{we.addListener(({matches:xe})=>{try{ie(xe?"dark":"light")}catch(be){console.error(be)}})}},[x]),rt.useEffect(()=>{q.length<=1&&le(!1)},[q]),rt.useEffect(()=>{let we=he=>{var xe,be;i.every(Oe=>he[Oe]||he.code===Oe)&&(le(!0),(xe=fe.current)==null||xe.focus()),he.code==="Escape"&&(document.activeElement===fe.current||(be=fe.current)!=null&&be.contains(document.activeElement))&&le(!1)};return document.addEventListener("keydown",we),()=>document.removeEventListener("keydown",we)},[i]),rt.useEffect(()=>{if(fe.current)return()=>{ye.current&&(ye.current.focus({preventScroll:!0}),ye.current=null,Ie.current=!1)}},[fe.current]),rt.createElement("section",{ref:t,"aria-label":`${z} ${de}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},K.map((we,he)=>{var xe;let[be,Oe]=we.split("-");return q.length?rt.createElement("ol",{key:we,dir:A==="auto"?swe():A,tabIndex:-1,ref:fe,className:a,"data-sonner-toaster":!0,"data-theme":ge,"data-y-position":be,"data-lifted":ae&&q.length>1&&!o,"data-x-position":Oe,style:{"--front-toast-height":`${((xe=Z[0])==null?void 0:xe.height)||0}px`,"--width":`${IYe}px`,"--gap":`${E}px`,...j,...FYe(h,p)},onBlur:Te=>{Ie.current&&!Te.currentTarget.contains(Te.relatedTarget)&&(Ie.current=!1,ye.current&&(ye.current.focus({preventScroll:!0}),ye.current=null))},onFocus:Te=>{Te.target instanceof HTMLElement&&Te.target.dataset.dismissible==="false"||Ie.current||(Ie.current=!0,ye.current=Te.relatedTarget)},onMouseEnter:()=>le(!0),onMouseMove:()=>le(!0),onMouseLeave:()=>{ve||le(!1)},onDragEnd:()=>le(!1),onPointerDown:Te=>{Te.target instanceof HTMLElement&&Te.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},q.filter(Te=>!Te.position&&he===0||Te.position===we).map((Te,Ve)=>{var Fe,Me;return rt.createElement(RYe,{key:Te.id,icons:L,index:Ve,toast:Te,defaultRichColors:y,duration:(Fe=C==null?void 0:C.duration)!=null?Fe:b,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:n,visibleToasts:N,closeButton:(Me=C==null?void 0:C.closeButton)!=null?Me:l,interacting:ve,position:we,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,removeToast:Ne,toasts:q.filter(Qe=>Qe.position==Te.position),heights:Z.filter(Qe=>Qe.position==Te.position),setHeights:te,expandByDefault:o,gap:E,loadingIcon:T,expanded:ae,pauseWhenPageIsHidden:F,swipeDirections:e.swipeDirections})})):null}))});const BYe=({...e})=>{const{theme:t="system"}=hYe();return r.jsx(zYe,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};var $Ye=Ype[" useId ".trim().toString()]||(()=>{}),UYe=0;function Vc(e){const[t,n]=I.useState($Ye());return Yl(()=>{n(s=>s??String(UYe++))},[e]),t?`radix-${t}`:""}const qYe=["top","right","bottom","left"],R1=Math.min,$h=Math.max,qee=Math.round,oL=Math.floor,Sg=e=>({x:e,y:e}),VYe={left:"right",right:"left",bottom:"top",top:"bottom"},HYe={start:"end",end:"start"};function gue(e,t,n){return $h(e,R1(t,n))}function ay(e,t){return typeof e=="function"?e(t):e}function oy(e){return e.split("-")[0]}function JC(e){return e.split("-")[1]}function Kme(e){return e==="x"?"y":"x"}function Zme(e){return e==="y"?"height":"width"}const WYe=new Set(["top","bottom"]);function hg(e){return WYe.has(oy(e))?"y":"x"}function Yme(e){return Kme(hg(e))}function GYe(e,t,n){n===void 0&&(n=!1);const s=JC(e),i=Yme(e),o=Zme(i);let l=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Vee(l)),[l,Vee(l)]}function KYe(e){const t=Vee(e);return[xue(e),t,xue(t)]}function xue(e){return e.replace(/start|end/g,t=>HYe[t])}const iwe=["left","right"],awe=["right","left"],ZYe=["top","bottom"],YYe=["bottom","top"];function XYe(e,t,n){switch(e){case"top":case"bottom":return n?t?awe:iwe:t?iwe:awe;case"left":case"right":return t?ZYe:YYe;default:return[]}}function QYe(e,t,n,s){const i=JC(e);let o=XYe(oy(e),n==="start",s);return i&&(o=o.map(l=>l+"-"+i),t&&(o=o.concat(o.map(xue)))),o}function Vee(e){return e.replace(/left|right|bottom|top/g,t=>VYe[t])}function JYe(e){return{top:0,right:0,bottom:0,left:0,...e}}function qAe(e){return typeof e!="number"?JYe(e):{top:e,right:e,bottom:e,left:e}}function Hee(e){const{x:t,y:n,width:s,height:i}=e;return{width:s,height:i,top:n,left:t,right:t+s,bottom:n+i,x:t,y:n}}function owe(e,t,n){let{reference:s,floating:i}=e;const o=hg(t),l=Yme(t),a=Zme(l),h=oy(t),p=o==="y",x=s.x+s.width/2-i.width/2,y=s.y+s.height/2-i.height/2,b=s[a]/2-i[a]/2;let j;switch(h){case"top":j={x,y:s.y-i.height};break;case"bottom":j={x,y:s.y+s.height};break;case"right":j={x:s.x+s.width,y};break;case"left":j={x:s.x-i.width,y};break;default:j={x:s.x,y:s.y}}switch(JC(t)){case"start":j[l]-=b*(n&&p?-1:1);break;case"end":j[l]+=b*(n&&p?-1:1);break}return j}const eXe=async(e,t,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,a=o.filter(Boolean),h=await(l.isRTL==null?void 0:l.isRTL(t));let p=await l.getElementRects({reference:e,floating:t,strategy:i}),{x,y}=owe(p,s,h),b=s,j={},N=0;for(let C=0;C({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:i,rects:o,platform:l,elements:a,middlewareData:h}=t,{element:p,padding:x=0}=ay(e,t)||{};if(p==null)return{};const y=qAe(x),b={x:n,y:s},j=Yme(i),N=Zme(j),C=await l.getDimensions(p),A=j==="y",E=A?"top":"left",T=A?"bottom":"right",L=A?"clientHeight":"clientWidth",z=o.reference[N]+o.reference[j]-b[j]-o.floating[N],F=b[j]-o.reference[j],q=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let H=q?q[L]:0;(!H||!await(l.isElement==null?void 0:l.isElement(q)))&&(H=a.floating[L]||o.floating[N]);const K=z/2-F/2,Z=H/2-C[N]/2-1,te=R1(y[E],Z),ae=R1(y[T],Z),le=te,ve=H-C[N]-ae,ne=H/2-C[N]/2+K,ge=gue(le,ne,ve),ie=!h.arrow&&JC(i)!=null&&ne!==ge&&o.reference[N]/2-(nene<=0)){var ae,le;const ne=(((ae=o.flip)==null?void 0:ae.index)||0)+1,ge=H[ne];if(ge&&(!(y==="alignment"?T!==hg(ge):!1)||te.every(de=>de.overflows[0]>0&&hg(de.placement)===T)))return{data:{index:ne,overflows:te},reset:{placement:ge}};let ie=(le=te.filter(fe=>fe.overflows[0]<=0).sort((fe,de)=>fe.overflows[1]-de.overflows[1])[0])==null?void 0:le.placement;if(!ie)switch(j){case"bestFit":{var ve;const fe=(ve=te.filter(de=>{if(q){const ye=hg(de.placement);return ye===T||ye==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(ye=>ye>0).reduce((ye,Ie)=>ye+Ie,0)]).sort((de,ye)=>de[1]-ye[1])[0])==null?void 0:ve[0];fe&&(ie=fe);break}case"initialPlacement":ie=a;break}if(i!==ie)return{reset:{placement:ie}}}return{}}}};function lwe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cwe(e){return qYe.some(t=>e[t]>=0)}const nXe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...i}=ay(e,t);switch(s){case"referenceHidden":{const o=await HA(t,{...i,elementContext:"reference"}),l=lwe(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:cwe(l)}}}case"escaped":{const o=await HA(t,{...i,altBoundary:!0}),l=lwe(o,n.floating);return{data:{escapedOffsets:l,escaped:cwe(l)}}}default:return{}}}}},VAe=new Set(["left","top"]);async function sXe(e,t){const{placement:n,platform:s,elements:i}=e,o=await(s.isRTL==null?void 0:s.isRTL(i.floating)),l=oy(n),a=JC(n),h=hg(n)==="y",p=VAe.has(l)?-1:1,x=o&&h?-1:1,y=ay(t,e);let{mainAxis:b,crossAxis:j,alignmentAxis:N}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return a&&typeof N=="number"&&(j=a==="end"?N*-1:N),h?{x:j*x,y:b*p}:{x:b*p,y:j*x}}const iXe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:i,y:o,placement:l,middlewareData:a}=t,h=await sXe(t,e);return l===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:i+h.x,y:o+h.y,data:{...h,placement:l}}}}},aXe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:i}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:a={fn:A=>{let{x:E,y:T}=A;return{x:E,y:T}}},...h}=ay(e,t),p={x:n,y:s},x=await HA(t,h),y=hg(oy(i)),b=Kme(y);let j=p[b],N=p[y];if(o){const A=b==="y"?"top":"left",E=b==="y"?"bottom":"right",T=j+x[A],L=j-x[E];j=gue(T,j,L)}if(l){const A=y==="y"?"top":"left",E=y==="y"?"bottom":"right",T=N+x[A],L=N-x[E];N=gue(T,N,L)}const C=a.fn({...t,[b]:j,[y]:N});return{...C,data:{x:C.x-n,y:C.y-s,enabled:{[b]:o,[y]:l}}}}}},oXe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:i,rects:o,middlewareData:l}=t,{offset:a=0,mainAxis:h=!0,crossAxis:p=!0}=ay(e,t),x={x:n,y:s},y=hg(i),b=Kme(y);let j=x[b],N=x[y];const C=ay(a,t),A=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(h){const L=b==="y"?"height":"width",z=o.reference[b]-o.floating[L]+A.mainAxis,F=o.reference[b]+o.reference[L]-A.mainAxis;jF&&(j=F)}if(p){var E,T;const L=b==="y"?"width":"height",z=VAe.has(oy(i)),F=o.reference[y]-o.floating[L]+(z&&((E=l.offset)==null?void 0:E[y])||0)+(z?0:A.crossAxis),q=o.reference[y]+o.reference[L]+(z?0:((T=l.offset)==null?void 0:T[y])||0)-(z?A.crossAxis:0);Nq&&(N=q)}return{[b]:j,[y]:N}}}},lXe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:i,rects:o,platform:l,elements:a}=t,{apply:h=()=>{},...p}=ay(e,t),x=await HA(t,p),y=oy(i),b=JC(i),j=hg(i)==="y",{width:N,height:C}=o.floating;let A,E;y==="top"||y==="bottom"?(A=y,E=b===(await(l.isRTL==null?void 0:l.isRTL(a.floating))?"start":"end")?"left":"right"):(E=y,A=b==="end"?"top":"bottom");const T=C-x.top-x.bottom,L=N-x.left-x.right,z=R1(C-x[A],T),F=R1(N-x[E],L),q=!t.middlewareData.shift;let H=z,K=F;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(K=L),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(H=T),q&&!b){const te=$h(x.left,0),ae=$h(x.right,0),le=$h(x.top,0),ve=$h(x.bottom,0);j?K=N-2*(te!==0||ae!==0?te+ae:$h(x.left,x.right)):H=C-2*(le!==0||ve!==0?le+ve:$h(x.top,x.bottom))}await h({...t,availableWidth:K,availableHeight:H});const Z=await l.getDimensions(a.floating);return N!==Z.width||C!==Z.height?{reset:{rects:!0}}:{}}}};function Ine(){return typeof window<"u"}function e3(e){return HAe(e)?(e.nodeName||"").toLowerCase():"#document"}function ef(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fg(e){var t;return(t=(HAe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HAe(e){return Ine()?e instanceof Node||e instanceof ef(e).Node:!1}function wm(e){return Ine()?e instanceof Element||e instanceof ef(e).Element:!1}function Ig(e){return Ine()?e instanceof HTMLElement||e instanceof ef(e).HTMLElement:!1}function dwe(e){return!Ine()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ef(e).ShadowRoot}const cXe=new Set(["inline","contents"]);function hI(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=jm(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!cXe.has(i)}const dXe=new Set(["table","td","th"]);function uXe(e){return dXe.has(e3(e))}const hXe=[":popover-open",":modal"];function Pne(e){return hXe.some(t=>{try{return e.matches(t)}catch{return!1}})}const fXe=["transform","translate","scale","rotate","perspective"],pXe=["transform","translate","scale","rotate","perspective","filter"],mXe=["paint","layout","strict","content"];function Xme(e){const t=Qme(),n=wm(e)?jm(e):e;return fXe.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||pXe.some(s=>(n.willChange||"").includes(s))||mXe.some(s=>(n.contain||"").includes(s))}function gXe(e){let t=F1(e);for(;Ig(t)&&!nC(t);){if(Xme(t))return t;if(Pne(t))return null;t=F1(t)}return null}function Qme(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xXe=new Set(["html","body","#document"]);function nC(e){return xXe.has(e3(e))}function jm(e){return ef(e).getComputedStyle(e)}function Lne(e){return wm(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function F1(e){if(e3(e)==="html")return e;const t=e.assignedSlot||e.parentNode||dwe(e)&&e.host||Fg(e);return dwe(t)?t.host:t}function WAe(e){const t=F1(e);return nC(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ig(t)&&hI(t)?t:WAe(t)}function WA(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=WAe(e),o=i===((s=e.ownerDocument)==null?void 0:s.body),l=ef(i);if(o){const a=yue(l);return t.concat(l,l.visualViewport||[],hI(i)?i:[],a&&n?WA(a):[])}return t.concat(i,WA(i,[],n))}function yue(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function GAe(e){const t=jm(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=Ig(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:s,a=qee(n)!==o||qee(s)!==l;return a&&(n=o,s=l),{width:n,height:s,$:a}}function Jme(e){return wm(e)?e:e.contextElement}function _S(e){const t=Jme(e);if(!Ig(t))return Sg(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:o}=GAe(t);let l=(o?qee(n.width):n.width)/s,a=(o?qee(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const yXe=Sg(0);function KAe(e){const t=ef(e);return!Qme()||!t.visualViewport?yXe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vXe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ef(e)?!1:t}function Oj(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Jme(e);let l=Sg(1);t&&(s?wm(s)&&(l=_S(s)):l=_S(e));const a=vXe(o,n,s)?KAe(o):Sg(0);let h=(i.left+a.x)/l.x,p=(i.top+a.y)/l.y,x=i.width/l.x,y=i.height/l.y;if(o){const b=ef(o),j=s&&wm(s)?ef(s):s;let N=b,C=yue(N);for(;C&&s&&j!==N;){const A=_S(C),E=C.getBoundingClientRect(),T=jm(C),L=E.left+(C.clientLeft+parseFloat(T.paddingLeft))*A.x,z=E.top+(C.clientTop+parseFloat(T.paddingTop))*A.y;h*=A.x,p*=A.y,x*=A.x,y*=A.y,h+=L,p+=z,N=ef(C),C=yue(N)}}return Hee({width:x,height:y,x:h,y:p})}function ege(e,t){const n=Lne(e).scrollLeft;return t?t.left+n:Oj(Fg(e)).left+n}function ZAe(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=s.left+t.scrollLeft-(n?0:ege(e,s)),o=s.top+t.scrollTop;return{x:i,y:o}}function _Xe(e){let{elements:t,rect:n,offsetParent:s,strategy:i}=e;const o=i==="fixed",l=Fg(s),a=t?Pne(t.floating):!1;if(s===l||a&&o)return n;let h={scrollLeft:0,scrollTop:0},p=Sg(1);const x=Sg(0),y=Ig(s);if((y||!y&&!o)&&((e3(s)!=="body"||hI(l))&&(h=Lne(s)),Ig(s))){const j=Oj(s);p=_S(s),x.x=j.x+s.clientLeft,x.y=j.y+s.clientTop}const b=l&&!y&&!o?ZAe(l,h,!0):Sg(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+x.x+b.x,y:n.y*p.y-h.scrollTop*p.y+x.y+b.y}}function bXe(e){return Array.from(e.getClientRects())}function wXe(e){const t=Fg(e),n=Lne(e),s=e.ownerDocument.body,i=$h(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=$h(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+ege(e);const a=-n.scrollTop;return jm(s).direction==="rtl"&&(l+=$h(t.clientWidth,s.clientWidth)-i),{width:i,height:o,x:l,y:a}}function jXe(e,t){const n=ef(e),s=Fg(e),i=n.visualViewport;let o=s.clientWidth,l=s.clientHeight,a=0,h=0;if(i){o=i.width,l=i.height;const p=Qme();(!p||p&&t==="fixed")&&(a=i.offsetLeft,h=i.offsetTop)}return{width:o,height:l,x:a,y:h}}const kXe=new Set(["absolute","fixed"]);function NXe(e,t){const n=Oj(e,!0,t==="fixed"),s=n.top+e.clientTop,i=n.left+e.clientLeft,o=Ig(e)?_S(e):Sg(1),l=e.clientWidth*o.x,a=e.clientHeight*o.y,h=i*o.x,p=s*o.y;return{width:l,height:a,x:h,y:p}}function uwe(e,t,n){let s;if(t==="viewport")s=jXe(e,n);else if(t==="document")s=wXe(Fg(e));else if(wm(t))s=NXe(t,n);else{const i=KAe(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Hee(s)}function YAe(e,t){const n=F1(e);return n===t||!wm(n)||nC(n)?!1:jm(n).position==="fixed"||YAe(n,t)}function SXe(e,t){const n=t.get(e);if(n)return n;let s=WA(e,[],!1).filter(a=>wm(a)&&e3(a)!=="body"),i=null;const o=jm(e).position==="fixed";let l=o?F1(e):e;for(;wm(l)&&!nC(l);){const a=jm(l),h=Xme(l);!h&&a.position==="fixed"&&(i=null),(o?!h&&!i:!h&&a.position==="static"&&!!i&&kXe.has(i.position)||hI(l)&&!h&&YAe(e,l))?s=s.filter(x=>x!==l):i=a,l=F1(l)}return t.set(e,s),s}function CXe(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const l=[...n==="clippingAncestors"?Pne(t)?[]:SXe(t,this._c):[].concat(n),s],a=l[0],h=l.reduce((p,x)=>{const y=uwe(t,x,i);return p.top=$h(y.top,p.top),p.right=R1(y.right,p.right),p.bottom=R1(y.bottom,p.bottom),p.left=$h(y.left,p.left),p},uwe(t,a,i));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function MXe(e){const{width:t,height:n}=GAe(e);return{width:t,height:n}}function TXe(e,t,n){const s=Ig(t),i=Fg(t),o=n==="fixed",l=Oj(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const h=Sg(0);function p(){h.x=ege(i)}if(s||!s&&!o)if((e3(t)!=="body"||hI(i))&&(a=Lne(t)),s){const j=Oj(t,!0,o,t);h.x=j.x+t.clientLeft,h.y=j.y+t.clientTop}else i&&p();o&&!s&&i&&p();const x=i&&!s&&!o?ZAe(i,a):Sg(0),y=l.left+a.scrollLeft-h.x-x.x,b=l.top+a.scrollTop-h.y-x.y;return{x:y,y:b,width:l.width,height:l.height}}function wle(e){return jm(e).position==="static"}function hwe(e,t){if(!Ig(e)||jm(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fg(e)===n&&(n=n.ownerDocument.body),n}function XAe(e,t){const n=ef(e);if(Pne(e))return n;if(!Ig(e)){let i=F1(e);for(;i&&!nC(i);){if(wm(i)&&!wle(i))return i;i=F1(i)}return n}let s=hwe(e,t);for(;s&&uXe(s)&&wle(s);)s=hwe(s,t);return s&&nC(s)&&wle(s)&&!Xme(s)?n:s||gXe(e)||n}const AXe=async function(e){const t=this.getOffsetParent||XAe,n=this.getDimensions,s=await n(e.floating);return{reference:TXe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function EXe(e){return jm(e).direction==="rtl"}const IXe={convertOffsetParentRelativeRectToViewportRelativeRect:_Xe,getDocumentElement:Fg,getClippingRect:CXe,getOffsetParent:XAe,getElementRects:AXe,getClientRects:bXe,getDimensions:MXe,getScale:_S,isElement:wm,isRTL:EXe};function QAe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PXe(e,t){let n=null,s;const i=Fg(e);function o(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function l(a,h){a===void 0&&(a=!1),h===void 0&&(h=1),o();const p=e.getBoundingClientRect(),{left:x,top:y,width:b,height:j}=p;if(a||t(),!b||!j)return;const N=oL(y),C=oL(i.clientWidth-(x+b)),A=oL(i.clientHeight-(y+j)),E=oL(x),L={rootMargin:-N+"px "+-C+"px "+-A+"px "+-E+"px",threshold:$h(0,R1(1,h))||1};let z=!0;function F(q){const H=q[0].intersectionRatio;if(H!==h){if(!z)return l();H?l(!1,H):s=setTimeout(()=>{l(!1,1e-7)},1e3)}H===1&&!QAe(p,e.getBoundingClientRect())&&l(),z=!1}try{n=new IntersectionObserver(F,{...L,root:i.ownerDocument})}catch{n=new IntersectionObserver(F,L)}n.observe(e)}return l(!0),o}function LXe(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=Jme(e),x=i||o?[...p?WA(p):[],...WA(t)]:[];x.forEach(E=>{i&&E.addEventListener("scroll",n,{passive:!0}),o&&E.addEventListener("resize",n)});const y=p&&a?PXe(p,n):null;let b=-1,j=null;l&&(j=new ResizeObserver(E=>{let[T]=E;T&&T.target===p&&j&&(j.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var L;(L=j)==null||L.observe(t)})),n()}),p&&!h&&j.observe(p),j.observe(t));let N,C=h?Oj(e):null;h&&A();function A(){const E=Oj(e);C&&!QAe(C,E)&&n(),C=E,N=requestAnimationFrame(A)}return n(),()=>{var E;x.forEach(T=>{i&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),y==null||y(),(E=j)==null||E.disconnect(),j=null,h&&cancelAnimationFrame(N)}}const OXe=iXe,DXe=aXe,RXe=rXe,FXe=lXe,zXe=nXe,fwe=tXe,BXe=oXe,$Xe=(e,t,n)=>{const s=new Map,i={platform:IXe,...n},o={...i.platform,_c:s};return eXe(e,t,{...i,platform:o})};var UXe=typeof document<"u",qXe=function(){},tee=UXe?I.useLayoutEffect:qXe;function Wee(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Wee(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=n;s--!==0;){const o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!Wee(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function JAe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pwe(e,t){const n=JAe(e);return Math.round(t*n)/n}function jle(e){const t=I.useRef(e);return tee(()=>{t.current=e}),t}function VXe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:o,floating:l}={},transform:a=!0,whileElementsMounted:h,open:p}=e,[x,y]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[b,j]=I.useState(s);Wee(b,s)||j(s);const[N,C]=I.useState(null),[A,E]=I.useState(null),T=I.useCallback(de=>{de!==q.current&&(q.current=de,C(de))},[]),L=I.useCallback(de=>{de!==H.current&&(H.current=de,E(de))},[]),z=o||N,F=l||A,q=I.useRef(null),H=I.useRef(null),K=I.useRef(x),Z=h!=null,te=jle(h),ae=jle(i),le=jle(p),ve=I.useCallback(()=>{if(!q.current||!H.current)return;const de={placement:t,strategy:n,middleware:b};ae.current&&(de.platform=ae.current),$Xe(q.current,H.current,de).then(ye=>{const Ie={...ye,isPositioned:le.current!==!1};ne.current&&!Wee(K.current,Ie)&&(K.current=Ie,py.flushSync(()=>{y(Ie)}))})},[b,t,n,ae,le]);tee(()=>{p===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,y(de=>({...de,isPositioned:!1})))},[p]);const ne=I.useRef(!1);tee(()=>(ne.current=!0,()=>{ne.current=!1}),[]),tee(()=>{if(z&&(q.current=z),F&&(H.current=F),z&&F){if(te.current)return te.current(z,F,ve);ve()}},[z,F,ve,te,Z]);const ge=I.useMemo(()=>({reference:q,floating:H,setReference:T,setFloating:L}),[T,L]),ie=I.useMemo(()=>({reference:z,floating:F}),[z,F]),fe=I.useMemo(()=>{const de={position:n,left:0,top:0};if(!ie.floating)return de;const ye=pwe(ie.floating,x.x),Ie=pwe(ie.floating,x.y);return a?{...de,transform:"translate("+ye+"px, "+Ie+"px)",...JAe(ie.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ye,top:Ie}},[n,a,ie.floating,x.x,x.y]);return I.useMemo(()=>({...x,update:ve,refs:ge,elements:ie,floatingStyles:fe}),[x,ve,ge,ie,fe])}const HXe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:i}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?fwe({element:s.current,padding:i}).fn(n):{}:s?fwe({element:s,padding:i}).fn(n):{}}}},WXe=(e,t)=>({...OXe(e),options:[e,t]}),GXe=(e,t)=>({...DXe(e),options:[e,t]}),KXe=(e,t)=>({...BXe(e),options:[e,t]}),ZXe=(e,t)=>({...RXe(e),options:[e,t]}),YXe=(e,t)=>({...FXe(e),options:[e,t]}),XXe=(e,t)=>({...zXe(e),options:[e,t]}),QXe=(e,t)=>({...HXe(e),options:[e,t]});var JXe="Arrow",eEe=I.forwardRef((e,t)=>{const{children:n,width:s=10,height:i=5,...o}=e;return r.jsx(Rn.svg,{...o,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});eEe.displayName=JXe;var eQe=eEe;function fI(e){const[t,n]=I.useState(void 0);return Yl(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let l,a;if("borderBoxSize"in o){const h=o.borderBoxSize,p=Array.isArray(h)?h[0]:h;l=p.inlineSize,a=p.blockSize}else l=e.offsetWidth,a=e.offsetHeight;n({width:l,height:a})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var tge="Popper",[tEe,zg]=Ql(tge),[tQe,rEe]=tEe(tge),nEe=e=>{const{__scopePopper:t,children:n}=e,[s,i]=I.useState(null);return r.jsx(tQe,{scope:t,anchor:s,onAnchorChange:i,children:n})};nEe.displayName=tge;var sEe="PopperAnchor",iEe=I.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...i}=e,o=rEe(sEe,n),l=I.useRef(null),a=ei(t,l);return I.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||l.current)}),s?null:r.jsx(Rn.div,{...i,ref:a})});iEe.displayName=sEe;var rge="PopperContent",[rQe,nQe]=tEe(rge),aEe=I.forwardRef((e,t)=>{var Te,Ve,Fe,Me,Qe,Ee;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:o="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:b=!1,updatePositionStrategy:j="optimized",onPlaced:N,...C}=e,A=rEe(rge,n),[E,T]=I.useState(null),L=ei(t,Ye=>T(Ye)),[z,F]=I.useState(null),q=fI(z),H=(q==null?void 0:q.width)??0,K=(q==null?void 0:q.height)??0,Z=s+(o!=="center"?"-"+o:""),te=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ae=Array.isArray(p)?p:[p],le=ae.length>0,ve={padding:te,boundary:ae.filter(iQe),altBoundary:le},{refs:ne,floatingStyles:ge,placement:ie,isPositioned:fe,middlewareData:de}=VXe({strategy:"fixed",placement:Z,whileElementsMounted:(...Ye)=>LXe(...Ye,{animationFrame:j==="always"}),elements:{reference:A.anchor},middleware:[WXe({mainAxis:i+K,alignmentAxis:l}),h&&GXe({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?KXe():void 0,...ve}),h&&ZXe({...ve}),YXe({...ve,apply:({elements:Ye,rects:me,availableWidth:mt,availableHeight:et})=>{const{width:nt,height:Ae}=me.reference,ht=Ye.floating.style;ht.setProperty("--radix-popper-available-width",`${mt}px`),ht.setProperty("--radix-popper-available-height",`${et}px`),ht.setProperty("--radix-popper-anchor-width",`${nt}px`),ht.setProperty("--radix-popper-anchor-height",`${Ae}px`)}}),z&&QXe({element:z,padding:a}),aQe({arrowWidth:H,arrowHeight:K}),b&&XXe({strategy:"referenceHidden",...ve})]}),[ye,Ie]=cEe(ie),Ne=Kl(N);Yl(()=>{fe&&(Ne==null||Ne())},[fe,Ne]);const we=(Te=de.arrow)==null?void 0:Te.x,he=(Ve=de.arrow)==null?void 0:Ve.y,xe=((Fe=de.arrow)==null?void 0:Fe.centerOffset)!==0,[be,Oe]=I.useState();return Yl(()=>{E&&Oe(window.getComputedStyle(E).zIndex)},[E]),r.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...ge,transform:fe?ge.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(Me=de.transformOrigin)==null?void 0:Me.x,(Qe=de.transformOrigin)==null?void 0:Qe.y].join(" "),...((Ee=de.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(rQe,{scope:n,placedSide:ye,onArrowChange:F,arrowX:we,arrowY:he,shouldHideArrow:xe,children:r.jsx(Rn.div,{"data-side":ye,"data-align":Ie,...C,ref:L,style:{...C.style,animation:fe?void 0:"none"}})})})});aEe.displayName=rge;var oEe="PopperArrow",sQe={top:"bottom",right:"left",bottom:"top",left:"right"},lEe=I.forwardRef(function(t,n){const{__scopePopper:s,...i}=t,o=nQe(oEe,s),l=sQe[o.placedSide];return r.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:r.jsx(eQe,{...i,ref:n,style:{...i.style,display:"block"}})})});lEe.displayName=oEe;function iQe(e){return e!==null}var aQe=e=>({name:"transformOrigin",options:e,fn(t){var A,E,T;const{placement:n,rects:s,middlewareData:i}=t,l=((A=i.arrow)==null?void 0:A.centerOffset)!==0,a=l?0:e.arrowWidth,h=l?0:e.arrowHeight,[p,x]=cEe(n),y={start:"0%",center:"50%",end:"100%"}[x],b=(((E=i.arrow)==null?void 0:E.x)??0)+a/2,j=(((T=i.arrow)==null?void 0:T.y)??0)+h/2;let N="",C="";return p==="bottom"?(N=l?y:`${b}px`,C=`${-h}px`):p==="top"?(N=l?y:`${b}px`,C=`${s.floating.height+h}px`):p==="right"?(N=`${-h}px`,C=l?y:`${j}px`):p==="left"&&(N=`${s.floating.width+h}px`,C=l?y:`${j}px`),{data:{x:N,y:C}}}});function cEe(e){const[t,n="center"]=e.split("-");return[t,n]}var pI=nEe,t3=iEe,mI=aEe,gI=lEe,[One]=Ql("Tooltip",[zg]),Dne=zg(),dEe="TooltipProvider",oQe=700,vue="tooltip.open",[lQe,nge]=One(dEe),uEe=e=>{const{__scopeTooltip:t,delayDuration:n=oQe,skipDelayDuration:s=300,disableHoverableContent:i=!1,children:o}=e,l=I.useRef(!0),a=I.useRef(!1),h=I.useRef(0);return I.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),r.jsx(lQe,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:a,onPointerInTransitChange:I.useCallback(p=>{a.current=p},[]),disableHoverableContent:i,children:o})};uEe.displayName=dEe;var GA="Tooltip",[cQe,Rne]=One(GA),hEe=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:i,onOpenChange:o,disableHoverableContent:l,delayDuration:a}=e,h=nge(GA,e.__scopeTooltip),p=Dne(t),[x,y]=I.useState(null),b=Vc(),j=I.useRef(0),N=l??h.disableHoverableContent,C=a??h.delayDuration,A=I.useRef(!1),[E,T]=Ou({prop:s,defaultProp:i??!1,onChange:H=>{H?(h.onOpen(),document.dispatchEvent(new CustomEvent(vue))):h.onClose(),o==null||o(H)},caller:GA}),L=I.useMemo(()=>E?A.current?"delayed-open":"instant-open":"closed",[E]),z=I.useCallback(()=>{window.clearTimeout(j.current),j.current=0,A.current=!1,T(!0)},[T]),F=I.useCallback(()=>{window.clearTimeout(j.current),j.current=0,T(!1)},[T]),q=I.useCallback(()=>{window.clearTimeout(j.current),j.current=window.setTimeout(()=>{A.current=!0,T(!0),j.current=0},C)},[C,T]);return I.useEffect(()=>()=>{j.current&&(window.clearTimeout(j.current),j.current=0)},[]),r.jsx(pI,{...p,children:r.jsx(cQe,{scope:t,contentId:b,open:E,stateAttribute:L,trigger:x,onTriggerChange:y,onTriggerEnter:I.useCallback(()=>{h.isOpenDelayedRef.current?q():z()},[h.isOpenDelayedRef,q,z]),onTriggerLeave:I.useCallback(()=>{N?F():(window.clearTimeout(j.current),j.current=0)},[F,N]),onOpen:z,onClose:F,disableHoverableContent:N,children:n})})};hEe.displayName=GA;var _ue="TooltipTrigger",fEe=I.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=Rne(_ue,n),o=nge(_ue,n),l=Dne(n),a=I.useRef(null),h=ei(t,a,i.onTriggerChange),p=I.useRef(!1),x=I.useRef(!1),y=I.useCallback(()=>p.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),r.jsx(t3,{asChild:!0,...l,children:r.jsx(Rn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:h,onPointerMove:cn(e.onPointerMove,b=>{b.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),x.current=!0)}),onPointerLeave:cn(e.onPointerLeave,()=>{i.onTriggerLeave(),x.current=!1}),onPointerDown:cn(e.onPointerDown,()=>{i.open&&i.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:cn(e.onFocus,()=>{p.current||i.onOpen()}),onBlur:cn(e.onBlur,i.onClose),onClick:cn(e.onClick,i.onClose)})})});fEe.displayName=_ue;var dQe="TooltipPortal",[WZt,uQe]=One(dQe,{forceMount:void 0}),sC="TooltipContent",pEe=I.forwardRef((e,t)=>{const n=uQe(sC,e.__scopeTooltip),{forceMount:s=n.forceMount,side:i="top",...o}=e,l=Rne(sC,e.__scopeTooltip);return r.jsx(pc,{present:s||l.open,children:l.disableHoverableContent?r.jsx(mEe,{side:i,...o,ref:t}):r.jsx(hQe,{side:i,...o,ref:t})})}),hQe=I.forwardRef((e,t)=>{const n=Rne(sC,e.__scopeTooltip),s=nge(sC,e.__scopeTooltip),i=I.useRef(null),o=ei(t,i),[l,a]=I.useState(null),{trigger:h,onClose:p}=n,x=i.current,{onPointerInTransitChange:y}=s,b=I.useCallback(()=>{a(null),y(!1)},[y]),j=I.useCallback((N,C)=>{const A=N.currentTarget,E={x:N.clientX,y:N.clientY},T=xQe(E,A.getBoundingClientRect()),L=yQe(E,T),z=vQe(C.getBoundingClientRect()),F=bQe([...L,...z]);a(F),y(!0)},[y]);return I.useEffect(()=>()=>b(),[b]),I.useEffect(()=>{if(h&&x){const N=A=>j(A,x),C=A=>j(A,h);return h.addEventListener("pointerleave",N),x.addEventListener("pointerleave",C),()=>{h.removeEventListener("pointerleave",N),x.removeEventListener("pointerleave",C)}}},[h,x,j,b]),I.useEffect(()=>{if(l){const N=C=>{const A=C.target,E={x:C.clientX,y:C.clientY},T=(h==null?void 0:h.contains(A))||(x==null?void 0:x.contains(A)),L=!_Qe(E,l);T?b():L&&(b(),p())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[h,x,l,p,b]),r.jsx(mEe,{...e,ref:o})}),[fQe,pQe]=One(GA,{isInside:!1}),mQe=iAe("TooltipContent"),mEe=I.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:l,...a}=e,h=Rne(sC,n),p=Dne(n),{onClose:x}=h;return I.useEffect(()=>(document.addEventListener(vue,x),()=>document.removeEventListener(vue,x)),[x]),I.useEffect(()=>{if(h.trigger){const y=b=>{const j=b.target;j!=null&&j.contains(h.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[h.trigger,x]),r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(mI,{"data-state":h.stateAttribute,...p,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(mQe,{children:s}),r.jsx(fQe,{scope:n,isInside:!0,children:r.jsx(iZe,{id:h.contentId,role:"tooltip",children:i||s})})]})})});pEe.displayName=sC;var gEe="TooltipArrow",gQe=I.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=Dne(n);return pQe(gEe,n).isInside?null:r.jsx(gI,{...i,...s,ref:t})});gQe.displayName=gEe;function xQe(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,i,o)){case o:return"left";case i:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function yQe(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function vQe(e){const{top:t,right:n,bottom:s,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:s},{x:i,y:s}]}function _Qe(e,t){const{x:n,y:s}=e;let i=!1;for(let o=0,l=t.length-1;os!=b>s&&n<(y-p)*(s-x)/(b-x)+p&&(i=!i)}return i}function bQe(e){const t=e.slice();return t.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),wQe(t)}function wQe(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const i=e[s];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(i.y-l.y)>=(o.y-l.y)*(i.x-l.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var jQe=uEe,kQe=hEe,NQe=fEe,xEe=pEe;const xI=jQe,Cg=kQe,Mg=NQe,vm=I.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(xEe,{ref:s,sideOffset:t,className:$t("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",e),...n}));vm.displayName=xEe.displayName;var r3=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Dj=typeof window>"u"||"Deno"in globalThis;function _u(){}function SQe(e,t){return typeof e=="function"?e(t):e}function bue(e){return typeof e=="number"&&e>=0&&e!==1/0}function yEe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function j1(e,t){return typeof e=="function"?e(t):e}function If(e,t){return typeof e=="function"?e(t):e}function mwe(e,t){const{type:n="all",exact:s,fetchStatus:i,predicate:o,queryKey:l,stale:a}=e;if(l){if(s){if(t.queryHash!==sge(l,t.options))return!1}else if(!KA(t.queryKey,l))return!1}if(n!=="all"){const h=t.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||i&&i!==t.state.fetchStatus||o&&!o(t))}function gwe(e,t){const{exact:n,status:s,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Rj(t.options.mutationKey)!==Rj(o))return!1}else if(!KA(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||i&&!i(t))}function sge(e,t){return((t==null?void 0:t.queryKeyHashFn)||Rj)(e)}function Rj(e){return JSON.stringify(e,(t,n)=>wue(n)?Object.keys(n).sort().reduce((s,i)=>(s[i]=n[i],s),{}):n)}function KA(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>KA(e[n],t[n])):!1}function vEe(e,t){if(e===t)return e;const n=xwe(e)&&xwe(t);if(n||wue(e)&&wue(t)){const s=n?e:Object.keys(e),i=s.length,o=n?t:Object.keys(t),l=o.length,a=n?[]:{},h=new Set(s);let p=0;for(let x=0;x{setTimeout(t,e)})}function jue(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?vEe(e,t):t}function MQe(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function TQe(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var ige=Symbol();function _Ee(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===ige?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function bEe(e,t){return typeof e=="function"?e(...t):!!e}var Xw,E0,FS,L5e,AQe=(L5e=class extends r3{constructor(){super();li(this,Xw);li(this,E0);li(this,FS);us(this,FS,t=>{if(!Dj&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Jt(this,E0)||this.setEventListener(Jt(this,FS))}onUnsubscribe(){var t;this.hasListeners()||((t=Jt(this,E0))==null||t.call(this),us(this,E0,void 0))}setEventListener(t){var n;us(this,FS,t),(n=Jt(this,E0))==null||n.call(this),us(this,E0,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){Jt(this,Xw)!==t&&(us(this,Xw,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof Jt(this,Xw)=="boolean"?Jt(this,Xw):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xw=new WeakMap,E0=new WeakMap,FS=new WeakMap,L5e),age=new AQe,zS,I0,BS,O5e,EQe=(O5e=class extends r3{constructor(){super();li(this,zS,!0);li(this,I0);li(this,BS);us(this,BS,t=>{if(!Dj&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){Jt(this,I0)||this.setEventListener(Jt(this,BS))}onUnsubscribe(){var t;this.hasListeners()||((t=Jt(this,I0))==null||t.call(this),us(this,I0,void 0))}setEventListener(t){var n;us(this,BS,t),(n=Jt(this,I0))==null||n.call(this),us(this,I0,t(this.setOnline.bind(this)))}setOnline(t){Jt(this,zS)!==t&&(us(this,zS,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return Jt(this,zS)}},zS=new WeakMap,I0=new WeakMap,BS=new WeakMap,O5e),Kee=new EQe;function kue(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function s(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{s({status:"fulfilled",value:i}),e(i)},n.reject=i=>{s({status:"rejected",reason:i}),t(i)},n}function IQe(e){return Math.min(1e3*2**e,3e4)}function wEe(e){return(e??"online")==="online"?Kee.isOnline():!0}var jEe=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function kle(e){return e instanceof jEe}function kEe(e){let t=!1,n=0,s=!1,i;const o=kue(),l=C=>{var A;s||(b(new jEe(C)),(A=e.abort)==null||A.call(e))},a=()=>{t=!0},h=()=>{t=!1},p=()=>age.isFocused()&&(e.networkMode==="always"||Kee.isOnline())&&e.canRun(),x=()=>wEe(e.networkMode)&&e.canRun(),y=C=>{var A;s||(s=!0,(A=e.onSuccess)==null||A.call(e,C),i==null||i(),o.resolve(C))},b=C=>{var A;s||(s=!0,(A=e.onError)==null||A.call(e,C),i==null||i(),o.reject(C))},j=()=>new Promise(C=>{var A;i=E=>{(s||p())&&C(E)},(A=e.onPause)==null||A.call(e)}).then(()=>{var C;i=void 0,s||(C=e.onContinue)==null||C.call(e)}),N=()=>{if(s)return;let C;const A=n===0?e.initialPromise:void 0;try{C=A??e.fn()}catch(E){C=Promise.reject(E)}Promise.resolve(C).then(y).catch(E=>{var q;if(s)return;const T=e.retry??(Dj?0:3),L=e.retryDelay??IQe,z=typeof L=="function"?L(n,E):L,F=T===!0||typeof T=="number"&&np()?void 0:j()).then(()=>{t?b(E):N()})})};return{promise:o,cancel:l,continue:()=>(i==null||i(),o),cancelRetry:a,continueRetry:h,canStart:x,start:()=>(x()?N():j().then(N),o)}}var PQe=e=>setTimeout(e,0);function LQe(){let e=[],t=0,n=a=>{a()},s=a=>{a()},i=PQe;const o=a=>{t?e.push(a):i(()=>{n(a)})},l=()=>{const a=e;e=[],a.length&&i(()=>{s(()=>{a.forEach(h=>{n(h)})})})};return{batch:a=>{let h;t++;try{h=a()}finally{t--,t||l()}return h},batchCalls:a=>(...h)=>{o(()=>{a(...h)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{s=a},setScheduler:a=>{i=a}}}var Bc=LQe(),Qw,D5e,NEe=(D5e=class{constructor(){li(this,Qw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bue(this.gcTime)&&us(this,Qw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Dj?1/0:5*60*1e3))}clearGcTimeout(){Jt(this,Qw)&&(clearTimeout(Jt(this,Qw)),us(this,Qw,void 0))}},Qw=new WeakMap,D5e),$S,Jw,Ef,ej,Wd,tI,tj,Kp,_x,R5e,OQe=(R5e=class extends NEe{constructor(t){super();li(this,Kp);li(this,$S);li(this,Jw);li(this,Ef);li(this,ej);li(this,Wd);li(this,tI);li(this,tj);us(this,tj,!1),us(this,tI,t.defaultOptions),this.setOptions(t.options),this.observers=[],us(this,ej,t.client),us(this,Ef,Jt(this,ej).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,us(this,$S,DQe(this.options)),this.state=t.state??Jt(this,$S),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Jt(this,Wd))==null?void 0:t.promise}setOptions(t){this.options={...Jt(this,tI),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Jt(this,Ef).remove(this)}setData(t,n){const s=jue(this.state.data,t,this.options);return ia(this,Kp,_x).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){ia(this,Kp,_x).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,i;const n=(s=Jt(this,Wd))==null?void 0:s.promise;return(i=Jt(this,Wd))==null||i.cancel(t),n?n.then(_u).catch(_u):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Jt(this,$S))}isActive(){return this.observers.some(t=>If(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ige||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>j1(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!yEe(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=Jt(this,Wd))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=Jt(this,Wd))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Jt(this,Ef).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(Jt(this,Wd)&&(Jt(this,tj)?Jt(this,Wd).cancel({revert:!0}):Jt(this,Wd).cancelRetry()),this.scheduleGc()),Jt(this,Ef).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ia(this,Kp,_x).call(this,{type:"invalidate"})}fetch(t,n){var p,x,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Jt(this,Wd))return Jt(this,Wd).continueRetry(),Jt(this,Wd).promise}if(t&&this.setOptions(t),!this.options.queryFn){const b=this.observers.find(j=>j.options.queryFn);b&&this.setOptions(b.options)}const s=new AbortController,i=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(us(this,tj,!0),s.signal)})},o=()=>{const b=_Ee(this.options,n),N=(()=>{const C={client:Jt(this,ej),queryKey:this.queryKey,meta:this.meta};return i(C),C})();return us(this,tj,!1),this.options.persister?this.options.persister(b,N,this):b(N)},a=(()=>{const b={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Jt(this,ej),state:this.state,fetchFn:o};return i(b),b})();(p=this.options.behavior)==null||p.onFetch(a,this),us(this,Jw,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=a.fetchOptions)==null?void 0:x.meta))&&ia(this,Kp,_x).call(this,{type:"fetch",meta:(y=a.fetchOptions)==null?void 0:y.meta});const h=b=>{var j,N,C,A;kle(b)&&b.silent||ia(this,Kp,_x).call(this,{type:"error",error:b}),kle(b)||((N=(j=Jt(this,Ef).config).onError)==null||N.call(j,b,this),(A=(C=Jt(this,Ef).config).onSettled)==null||A.call(C,this.state.data,b,this)),this.scheduleGc()};return us(this,Wd,kEe({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:s.abort.bind(s),onSuccess:b=>{var j,N,C,A;if(b===void 0){h(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(b)}catch(E){h(E);return}(N=(j=Jt(this,Ef).config).onSuccess)==null||N.call(j,b,this),(A=(C=Jt(this,Ef).config).onSettled)==null||A.call(C,b,this.state.error,this),this.scheduleGc()},onError:h,onFail:(b,j)=>{ia(this,Kp,_x).call(this,{type:"failed",failureCount:b,error:j})},onPause:()=>{ia(this,Kp,_x).call(this,{type:"pause"})},onContinue:()=>{ia(this,Kp,_x).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),Jt(this,Wd).start()}},$S=new WeakMap,Jw=new WeakMap,Ef=new WeakMap,ej=new WeakMap,Wd=new WeakMap,tI=new WeakMap,tj=new WeakMap,Kp=new WeakSet,_x=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...SEe(s.data,this.options),fetchMeta:t.meta??null};case"success":return us(this,Jw,void 0),{...s,data:t.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return kle(i)&&i.revert&&Jt(this,Jw)?{...Jt(this,Jw),fetchStatus:"idle"}:{...s,error:i,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),Bc.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),Jt(this,Ef).notify({query:this,type:"updated",action:t})})},R5e);function SEe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:wEe(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function DQe(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ig,F5e,RQe=(F5e=class extends r3{constructor(t={}){super();li(this,ig);this.config=t,us(this,ig,new Map)}build(t,n,s){const i=n.queryKey,o=n.queryHash??sge(i,n);let l=this.get(o);return l||(l=new OQe({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(l)),l}add(t){Jt(this,ig).has(t.queryHash)||(Jt(this,ig).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=Jt(this,ig).get(t.queryHash);n&&(t.destroy(),n===t&&Jt(this,ig).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Bc.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Jt(this,ig).get(t)}getAll(){return[...Jt(this,ig).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>mwe(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>mwe(t,s)):n}notify(t){Bc.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Bc.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Bc.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ig=new WeakMap,F5e),ag,xu,rj,og,l0,z5e,FQe=(z5e=class extends NEe{constructor(t){super();li(this,og);li(this,ag);li(this,xu);li(this,rj);this.mutationId=t.mutationId,us(this,xu,t.mutationCache),us(this,ag,[]),this.state=t.state||CEe(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Jt(this,ag).includes(t)||(Jt(this,ag).push(t),this.clearGcTimeout(),Jt(this,xu).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){us(this,ag,Jt(this,ag).filter(n=>n!==t)),this.scheduleGc(),Jt(this,xu).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Jt(this,ag).length||(this.state.status==="pending"?this.scheduleGc():Jt(this,xu).remove(this))}continue(){var t;return((t=Jt(this,rj))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,a,h,p,x,y,b,j,N,C,A,E,T,L,z,F,q,H,K;const n=()=>{ia(this,og,l0).call(this,{type:"continue"})};us(this,rj,kEe({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(Z,te)=>{ia(this,og,l0).call(this,{type:"failed",failureCount:Z,error:te})},onPause:()=>{ia(this,og,l0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Jt(this,xu).canRun(this)}));const s=this.state.status==="pending",i=!Jt(this,rj).canStart();try{if(s)n();else{ia(this,og,l0).call(this,{type:"pending",variables:t,isPaused:i}),await((l=(o=Jt(this,xu).config).onMutate)==null?void 0:l.call(o,t,this));const te=await((h=(a=this.options).onMutate)==null?void 0:h.call(a,t));te!==this.state.context&&ia(this,og,l0).call(this,{type:"pending",context:te,variables:t,isPaused:i})}const Z=await Jt(this,rj).start();return await((x=(p=Jt(this,xu).config).onSuccess)==null?void 0:x.call(p,Z,t,this.state.context,this)),await((b=(y=this.options).onSuccess)==null?void 0:b.call(y,Z,t,this.state.context)),await((N=(j=Jt(this,xu).config).onSettled)==null?void 0:N.call(j,Z,null,this.state.variables,this.state.context,this)),await((A=(C=this.options).onSettled)==null?void 0:A.call(C,Z,null,t,this.state.context)),ia(this,og,l0).call(this,{type:"success",data:Z}),Z}catch(Z){try{throw await((T=(E=Jt(this,xu).config).onError)==null?void 0:T.call(E,Z,t,this.state.context,this)),await((z=(L=this.options).onError)==null?void 0:z.call(L,Z,t,this.state.context)),await((q=(F=Jt(this,xu).config).onSettled)==null?void 0:q.call(F,void 0,Z,this.state.variables,this.state.context,this)),await((K=(H=this.options).onSettled)==null?void 0:K.call(H,void 0,Z,t,this.state.context)),Z}finally{ia(this,og,l0).call(this,{type:"error",error:Z})}}finally{Jt(this,xu).runNext(this)}}},ag=new WeakMap,xu=new WeakMap,rj=new WeakMap,og=new WeakSet,l0=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Bc.batch(()=>{Jt(this,ag).forEach(s=>{s.onMutationUpdate(t)}),Jt(this,xu).notify({mutation:this,type:"updated",action:t})})},z5e);function CEe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Tx,Zp,rI,B5e,zQe=(B5e=class extends r3{constructor(t={}){super();li(this,Tx);li(this,Zp);li(this,rI);this.config=t,us(this,Tx,new Set),us(this,Zp,new Map),us(this,rI,0)}build(t,n,s){const i=new FQe({mutationCache:this,mutationId:++B6(this,rI)._,options:t.defaultMutationOptions(n),state:s});return this.add(i),i}add(t){Jt(this,Tx).add(t);const n=lL(t);if(typeof n=="string"){const s=Jt(this,Zp).get(n);s?s.push(t):Jt(this,Zp).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(Jt(this,Tx).delete(t)){const n=lL(t);if(typeof n=="string"){const s=Jt(this,Zp).get(n);if(s)if(s.length>1){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}else s[0]===t&&Jt(this,Zp).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=lL(t);if(typeof n=="string"){const s=Jt(this,Zp).get(n),i=s==null?void 0:s.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var s;const n=lL(t);if(typeof n=="string"){const i=(s=Jt(this,Zp).get(n))==null?void 0:s.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bc.batch(()=>{Jt(this,Tx).forEach(t=>{this.notify({type:"removed",mutation:t})}),Jt(this,Tx).clear(),Jt(this,Zp).clear()})}getAll(){return Array.from(Jt(this,Tx))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>gwe(n,s))}findAll(t={}){return this.getAll().filter(n=>gwe(t,n))}notify(t){Bc.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Bc.batch(()=>Promise.all(t.map(n=>n.continue().catch(_u))))}},Tx=new WeakMap,Zp=new WeakMap,rI=new WeakMap,B5e);function lL(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Zee(e){return{onFetch:(t,n)=>{var x,y,b,j,N;const s=t.options,i=(b=(y=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:b.direction,o=((j=t.state.data)==null?void 0:j.pages)||[],l=((N=t.state.data)==null?void 0:N.pageParams)||[];let a={pages:[],pageParams:[]},h=0;const p=async()=>{let C=!1;const A=L=>{Object.defineProperty(L,"signal",{enumerable:!0,get:()=>(t.signal.aborted?C=!0:t.signal.addEventListener("abort",()=>{C=!0}),t.signal)})},E=_Ee(t.options,t.fetchOptions),T=async(L,z,F)=>{if(C)return Promise.reject();if(z==null&&L.pages.length)return Promise.resolve(L);const H=(()=>{const ae={client:t.client,queryKey:t.queryKey,pageParam:z,direction:F?"backward":"forward",meta:t.options.meta};return A(ae),ae})(),K=await E(H),{maxPages:Z}=t.options,te=F?TQe:MQe;return{pages:te(L.pages,K,Z),pageParams:te(L.pageParams,z,Z)}};if(i&&o.length){const L=i==="backward",z=L?MEe:Nue,F={pages:o,pageParams:l},q=z(s,F);a=await T(F,q,L)}else{const L=e??o.length;do{const z=h===0?l[0]??s.initialPageParam:Nue(s,a);if(h>0&&z==null)break;a=await T(a,z),h++}while(h{var C,A;return(A=(C=t.options).persister)==null?void 0:A.call(C,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=p}}}function Nue(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function MEe(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}function BQe(e,t){return t?Nue(e,t)!=null:!1}function $Qe(e,t){return!t||!e.getPreviousPageParam?!1:MEe(e,t)!=null}var Ul,P0,L0,US,qS,O0,VS,HS,$5e,UQe=($5e=class{constructor(e={}){li(this,Ul);li(this,P0);li(this,L0);li(this,US);li(this,qS);li(this,O0);li(this,VS);li(this,HS);us(this,Ul,e.queryCache||new RQe),us(this,P0,e.mutationCache||new zQe),us(this,L0,e.defaultOptions||{}),us(this,US,new Map),us(this,qS,new Map),us(this,O0,0)}mount(){B6(this,O0)._++,Jt(this,O0)===1&&(us(this,VS,age.subscribe(async e=>{e&&(await this.resumePausedMutations(),Jt(this,Ul).onFocus())})),us(this,HS,Kee.subscribe(async e=>{e&&(await this.resumePausedMutations(),Jt(this,Ul).onOnline())})))}unmount(){var e,t;B6(this,O0)._--,Jt(this,O0)===0&&((e=Jt(this,VS))==null||e.call(this),us(this,VS,void 0),(t=Jt(this,HS))==null||t.call(this),us(this,HS,void 0))}isFetching(e){return Jt(this,Ul).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return Jt(this,P0).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Jt(this,Ul).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=Jt(this,Ul).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(j1(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return Jt(this,Ul).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),i=Jt(this,Ul).get(s.queryHash),o=i==null?void 0:i.state.data,l=SQe(t,o);if(l!==void 0)return Jt(this,Ul).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return Bc.batch(()=>Jt(this,Ul).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=Jt(this,Ul).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=Jt(this,Ul);Bc.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=Jt(this,Ul);return Bc.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=Bc.batch(()=>Jt(this,Ul).findAll(e).map(i=>i.cancel(n)));return Promise.all(s).then(_u).catch(_u)}invalidateQueries(e,t={}){return Bc.batch(()=>(Jt(this,Ul).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=Bc.batch(()=>Jt(this,Ul).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(_u)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(_u)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=Jt(this,Ul).build(this,t);return n.isStaleByTime(j1(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_u).catch(_u)}fetchInfiniteQuery(e){return e.behavior=Zee(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_u).catch(_u)}ensureInfiniteQueryData(e){return e.behavior=Zee(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Kee.isOnline()?Jt(this,P0).resumePausedMutations():Promise.resolve()}getQueryCache(){return Jt(this,Ul)}getMutationCache(){return Jt(this,P0)}getDefaultOptions(){return Jt(this,L0)}setDefaultOptions(e){us(this,L0,e)}setQueryDefaults(e,t){Jt(this,US).set(Rj(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...Jt(this,US).values()],n={};return t.forEach(s=>{KA(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){Jt(this,qS).set(Rj(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...Jt(this,qS).values()],n={};return t.forEach(s=>{KA(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...Jt(this,L0).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=sge(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ige&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...Jt(this,L0).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){Jt(this,Ul).clear(),Jt(this,P0).clear()}},Ul=new WeakMap,P0=new WeakMap,L0=new WeakMap,US=new WeakMap,qS=new WeakMap,O0=new WeakMap,VS=new WeakMap,HS=new WeakMap,$5e),sh,Fa,nI,yu,nj,WS,D0,R0,sI,GS,KS,sj,ij,F0,ZS,go,lT,Sue,Cue,Mue,Tue,Aue,Eue,Iue,AEe,U5e,TEe=(U5e=class extends r3{constructor(t,n){super();li(this,go);li(this,sh);li(this,Fa);li(this,nI);li(this,yu);li(this,nj);li(this,WS);li(this,D0);li(this,R0);li(this,sI);li(this,GS);li(this,KS);li(this,sj);li(this,ij);li(this,F0);li(this,ZS,new Set);this.options=n,us(this,sh,t),us(this,R0,null),us(this,D0,kue()),this.options.experimental_prefetchInRender||Jt(this,D0).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Jt(this,Fa).addObserver(this),vwe(Jt(this,Fa),this.options)?ia(this,go,lT).call(this):this.updateResult(),ia(this,go,Tue).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pue(Jt(this,Fa),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pue(Jt(this,Fa),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ia(this,go,Aue).call(this),ia(this,go,Eue).call(this),Jt(this,Fa).removeObserver(this)}setOptions(t){const n=this.options,s=Jt(this,Fa);if(this.options=Jt(this,sh).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof If(this.options.enabled,Jt(this,Fa))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ia(this,go,Iue).call(this),Jt(this,Fa).setOptions(this.options),n._defaulted&&!Gee(this.options,n)&&Jt(this,sh).getQueryCache().notify({type:"observerOptionsUpdated",query:Jt(this,Fa),observer:this});const i=this.hasListeners();i&&_we(Jt(this,Fa),s,this.options,n)&&ia(this,go,lT).call(this),this.updateResult(),i&&(Jt(this,Fa)!==s||If(this.options.enabled,Jt(this,Fa))!==If(n.enabled,Jt(this,Fa))||j1(this.options.staleTime,Jt(this,Fa))!==j1(n.staleTime,Jt(this,Fa)))&&ia(this,go,Sue).call(this);const o=ia(this,go,Cue).call(this);i&&(Jt(this,Fa)!==s||If(this.options.enabled,Jt(this,Fa))!==If(n.enabled,Jt(this,Fa))||o!==Jt(this,F0))&&ia(this,go,Mue).call(this,o)}getOptimisticResult(t){const n=Jt(this,sh).getQueryCache().build(Jt(this,sh),t),s=this.createResult(n,t);return VQe(this,s)&&(us(this,yu,s),us(this,WS,this.options),us(this,nj,Jt(this,Fa).state)),s}getCurrentResult(){return Jt(this,yu)}trackResult(t,n){return new Proxy(t,{get:(s,i)=>(this.trackProp(i),n==null||n(i),Reflect.get(s,i))})}trackProp(t){Jt(this,ZS).add(t)}getCurrentQuery(){return Jt(this,Fa)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=Jt(this,sh).defaultQueryOptions(t),s=Jt(this,sh).getQueryCache().build(Jt(this,sh),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return ia(this,go,lT).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Jt(this,yu)))}createResult(t,n){var Z;const s=Jt(this,Fa),i=this.options,o=Jt(this,yu),l=Jt(this,nj),a=Jt(this,WS),p=t!==s?t.state:Jt(this,nI),{state:x}=t;let y={...x},b=!1,j;if(n._optimisticResults){const te=this.hasListeners(),ae=!te&&vwe(t,n),le=te&&_we(t,s,n,i);(ae||le)&&(y={...y,...SEe(x.data,t.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:N,errorUpdatedAt:C,status:A}=y;j=y.data;let E=!1;if(n.placeholderData!==void 0&&j===void 0&&A==="pending"){let te;o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(te=o.data,E=!0):te=typeof n.placeholderData=="function"?n.placeholderData((Z=Jt(this,KS))==null?void 0:Z.state.data,Jt(this,KS)):n.placeholderData,te!==void 0&&(A="success",j=jue(o==null?void 0:o.data,te,n),b=!0)}if(n.select&&j!==void 0&&!E)if(o&&j===(l==null?void 0:l.data)&&n.select===Jt(this,sI))j=Jt(this,GS);else try{us(this,sI,n.select),j=n.select(j),j=jue(o==null?void 0:o.data,j,n),us(this,GS,j),us(this,R0,null)}catch(te){us(this,R0,te)}Jt(this,R0)&&(N=Jt(this,R0),j=Jt(this,GS),C=Date.now(),A="error");const T=y.fetchStatus==="fetching",L=A==="pending",z=A==="error",F=L&&T,q=j!==void 0,K={status:A,fetchStatus:y.fetchStatus,isPending:L,isSuccess:A==="success",isError:z,isInitialLoading:F,isLoading:F,data:j,dataUpdatedAt:y.dataUpdatedAt,error:N,errorUpdatedAt:C,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:T,isRefetching:T&&!L,isLoadingError:z&&!q,isPaused:y.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:z&&q,isStale:oge(t,n),refetch:this.refetch,promise:Jt(this,D0),isEnabled:If(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const te=ve=>{K.status==="error"?ve.reject(K.error):K.data!==void 0&&ve.resolve(K.data)},ae=()=>{const ve=us(this,D0,K.promise=kue());te(ve)},le=Jt(this,D0);switch(le.status){case"pending":t.queryHash===s.queryHash&&te(le);break;case"fulfilled":(K.status==="error"||K.data!==le.value)&&ae();break;case"rejected":(K.status!=="error"||K.error!==le.reason)&&ae();break}}return K}updateResult(){const t=Jt(this,yu),n=this.createResult(Jt(this,Fa),this.options);if(us(this,nj,Jt(this,Fa).state),us(this,WS,this.options),Jt(this,nj).data!==void 0&&us(this,KS,Jt(this,Fa)),Gee(n,t))return;us(this,yu,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!Jt(this,ZS).size)return!0;const l=new Set(o??Jt(this,ZS));return this.options.throwOnError&&l.add("error"),Object.keys(Jt(this,yu)).some(a=>{const h=a;return Jt(this,yu)[h]!==t[h]&&l.has(h)})};ia(this,go,AEe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ia(this,go,Tue).call(this)}},sh=new WeakMap,Fa=new WeakMap,nI=new WeakMap,yu=new WeakMap,nj=new WeakMap,WS=new WeakMap,D0=new WeakMap,R0=new WeakMap,sI=new WeakMap,GS=new WeakMap,KS=new WeakMap,sj=new WeakMap,ij=new WeakMap,F0=new WeakMap,ZS=new WeakMap,go=new WeakSet,lT=function(t){ia(this,go,Iue).call(this);let n=Jt(this,Fa).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(_u)),n},Sue=function(){ia(this,go,Aue).call(this);const t=j1(this.options.staleTime,Jt(this,Fa));if(Dj||Jt(this,yu).isStale||!bue(t))return;const s=yEe(Jt(this,yu).dataUpdatedAt,t)+1;us(this,sj,setTimeout(()=>{Jt(this,yu).isStale||this.updateResult()},s))},Cue=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Jt(this,Fa)):this.options.refetchInterval)??!1},Mue=function(t){ia(this,go,Eue).call(this),us(this,F0,t),!(Dj||If(this.options.enabled,Jt(this,Fa))===!1||!bue(Jt(this,F0))||Jt(this,F0)===0)&&us(this,ij,setInterval(()=>{(this.options.refetchIntervalInBackground||age.isFocused())&&ia(this,go,lT).call(this)},Jt(this,F0)))},Tue=function(){ia(this,go,Sue).call(this),ia(this,go,Mue).call(this,ia(this,go,Cue).call(this))},Aue=function(){Jt(this,sj)&&(clearTimeout(Jt(this,sj)),us(this,sj,void 0))},Eue=function(){Jt(this,ij)&&(clearInterval(Jt(this,ij)),us(this,ij,void 0))},Iue=function(){const t=Jt(this,sh).getQueryCache().build(Jt(this,sh),this.options);if(t===Jt(this,Fa))return;const n=Jt(this,Fa);us(this,Fa,t),us(this,nI,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},AEe=function(t){Bc.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(Jt(this,yu))}),Jt(this,sh).getQueryCache().notify({query:Jt(this,Fa),type:"observerResultsUpdated"})})},U5e);function qQe(e,t){return If(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function vwe(e,t){return qQe(e,t)||e.state.data!==void 0&&Pue(e,t,t.refetchOnMount)}function Pue(e,t,n){if(If(t.enabled,e)!==!1&&j1(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&oge(e,t)}return!1}function _we(e,t,n,s){return(e!==t||If(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&oge(e,n)}function oge(e,t){return If(t.enabled,e)!==!1&&e.isStaleByTime(j1(t.staleTime,e))}function VQe(e,t){return!Gee(e.getCurrentResult(),t)}var HQe=class extends TEe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Zee()})}getOptimisticResult(e){return e.behavior=Zee(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var N,C;const{state:n}=e,s=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:l,isRefetchError:a}=s,h=(C=(N=n.fetchMeta)==null?void 0:N.fetchMore)==null?void 0:C.direction,p=l&&h==="forward",x=i&&h==="forward",y=l&&h==="backward",b=i&&h==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:BQe(t,n.data),hasPreviousPage:$Qe(t,n.data),isFetchNextPageError:p,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:b,isRefetchError:a&&!p&&!y,isRefetching:o&&!x&&!b}}},z0,B0,ih,Ax,ey,ree,Lue,q5e,WQe=(q5e=class extends r3{constructor(n,s){super();li(this,ey);li(this,z0);li(this,B0);li(this,ih);li(this,Ax);us(this,z0,n),this.setOptions(s),this.bindMethods(),ia(this,ey,ree).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const s=this.options;this.options=Jt(this,z0).defaultMutationOptions(n),Gee(this.options,s)||Jt(this,z0).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Jt(this,ih),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Rj(s.mutationKey)!==Rj(this.options.mutationKey)?this.reset():((i=Jt(this,ih))==null?void 0:i.state.status)==="pending"&&Jt(this,ih).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Jt(this,ih))==null||n.removeObserver(this)}onMutationUpdate(n){ia(this,ey,ree).call(this),ia(this,ey,Lue).call(this,n)}getCurrentResult(){return Jt(this,B0)}reset(){var n;(n=Jt(this,ih))==null||n.removeObserver(this),us(this,ih,void 0),ia(this,ey,ree).call(this),ia(this,ey,Lue).call(this)}mutate(n,s){var i;return us(this,Ax,s),(i=Jt(this,ih))==null||i.removeObserver(this),us(this,ih,Jt(this,z0).getMutationCache().build(Jt(this,z0),this.options)),Jt(this,ih).addObserver(this),Jt(this,ih).execute(n)}},z0=new WeakMap,B0=new WeakMap,ih=new WeakMap,Ax=new WeakMap,ey=new WeakSet,ree=function(){var s;const n=((s=Jt(this,ih))==null?void 0:s.state)??CEe();us(this,B0,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Lue=function(n){Bc.batch(()=>{var s,i,o,l,a,h,p,x;if(Jt(this,Ax)&&this.hasListeners()){const y=Jt(this,B0).variables,b=Jt(this,B0).context;(n==null?void 0:n.type)==="success"?((i=(s=Jt(this,Ax)).onSuccess)==null||i.call(s,n.data,y,b),(l=(o=Jt(this,Ax)).onSettled)==null||l.call(o,n.data,null,y,b)):(n==null?void 0:n.type)==="error"&&((h=(a=Jt(this,Ax)).onError)==null||h.call(a,n.error,y,b),(x=(p=Jt(this,Ax)).onSettled)==null||x.call(p,void 0,n.error,y,b))}this.listeners.forEach(y=>{y(Jt(this,B0))})})},q5e),EEe=I.createContext(void 0),Wr=e=>{const t=I.useContext(EEe);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},GQe=({client:e,children:t})=>(I.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(EEe.Provider,{value:e,children:t})),IEe=I.createContext(!1),KQe=()=>I.useContext(IEe);IEe.Provider;function ZQe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var YQe=I.createContext(ZQe()),XQe=()=>I.useContext(YQe),QQe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},JQe=e=>{I.useEffect(()=>{e.clearReset()},[e])},eJe=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(i&&e.data===void 0||bEe(n,[e.error,s])),tJe=e=>{if(e.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>t(n(...s)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},rJe=(e,t)=>e.isLoading&&e.isFetching&&!t,nJe=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bwe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function PEe(e,t,n){var y,b,j,N,C;const s=KQe(),i=XQe(),o=Wr(),l=o.defaultQueryOptions(e);(b=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,l),l._optimisticResults=s?"isRestoring":"optimistic",tJe(l),QQe(l,i),JQe(i);const a=!o.getQueryCache().get(l.queryHash),[h]=I.useState(()=>new t(o,l)),p=h.getOptimisticResult(l),x=!s&&e.subscribed!==!1;if(I.useSyncExternalStore(I.useCallback(A=>{const E=x?h.subscribe(Bc.batchCalls(A)):_u;return h.updateResult(),E},[h,x]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),I.useEffect(()=>{h.setOptions(l)},[l,h]),nJe(l,p))throw bwe(l,h,i);if(eJe({result:p,errorResetBoundary:i,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw p.error;if((N=(j=o.getDefaultOptions().queries)==null?void 0:j._experimental_afterQuery)==null||N.call(j,l,p),l.experimental_prefetchInRender&&!Dj&&rJe(p,s)){const A=a?bwe(l,h,i):(C=o.getQueryCache().get(l.queryHash))==null?void 0:C.promise;A==null||A.catch(_u).finally(()=>{h.updateResult()})}return l.notifyOnChangeProps?p:h.trackResult(p)}function Zt(e,t){return PEe(e,TEe)}function cr(e,t){const n=Wr(),[s]=I.useState(()=>new WQe(n,e));I.useEffect(()=>{s.setOptions(e)},[s,e]);const i=I.useSyncExternalStore(I.useCallback(l=>s.subscribe(Bc.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=I.useCallback((l,a)=>{s.mutate(l,a).catch(_u)},[s]);if(i.error&&bEe(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function sJe(e,t){return PEe(e,HQe)}/** * @remix-run/router v1.23.0 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function ZA(){return ZA=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function LEe(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function aJe(){return Math.random().toString(36).substr(2,8)}function jwe(e,t){return{usr:e.state,key:e.key,idx:t}}function Oue(e,t,n,s){return n===void 0&&(n=null),ZA({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?n3(t):t,{state:n,key:t&&t.key||s||aJe()})}function Yee(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function n3(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function oJe(e,t,n,s){s===void 0&&(s={});let{window:i=document.defaultView,v5Compat:o=!1}=s,l=i.history,a=V0.Pop,h=null,p=x();p==null&&(p=0,l.replaceState(ZA({},l.state,{idx:p}),""));function x(){return(l.state||{idx:null}).idx}function y(){a=V0.Pop;let A=x(),E=A==null?null:A-p;p=A,h&&h({action:a,location:C.location,delta:E})}function b(A,E){a=V0.Push;let T=Oue(C.location,A,E);p=x()+1;let L=jwe(T,p),z=C.createHref(T);try{l.pushState(L,"",z)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;i.location.assign(z)}o&&h&&h({action:a,location:C.location,delta:1})}function j(A,E){a=V0.Replace;let T=Oue(C.location,A,E);p=x();let L=jwe(T,p),z=C.createHref(T);l.replaceState(L,"",z),o&&h&&h({action:a,location:C.location,delta:0})}function N(A){let E=i.location.origin!=="null"?i.location.origin:i.location.href,T=typeof A=="string"?A:Yee(A);return T=T.replace(/ $/,"%20"),hc(E,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,E)}let C={get action(){return a},get location(){return e(i,l)},listen(A){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(wwe,y),h=A,()=>{i.removeEventListener(wwe,y),h=null}},createHref(A){return t(i,A)},createURL:N,encodeLocation(A){let E=N(A);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:b,replace:j,go(A){return l.go(A)}};return C}var kwe;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(kwe||(kwe={}));function lJe(e,t,n){return n===void 0&&(n="/"),cJe(e,t,n)}function cJe(e,t,n,s){let i=typeof t=="string"?n3(t):t,o=lge(i.pathname||"/",n);if(o==null)return null;let l=OEe(e);dJe(l);let a=null;for(let h=0;a==null&&h{let h={relativePath:a===void 0?o.path||"":a,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};h.relativePath.startsWith("/")&&(hc(h.relativePath.startsWith(s),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(s.length));let p=k1([s,h.relativePath]),x=n.concat(h);o.children&&o.children.length>0&&(hc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),OEe(o.children,t,x,p)),!(o.path==null&&!o.index)&&t.push({path:p,score:xJe(p,o.index),routesMeta:x})};return e.forEach((o,l)=>{var a;if(o.path===""||!((a=o.path)!=null&&a.includes("?")))i(o,l);else for(let h of DEe(o.path))i(o,l,h)}),t}function DEe(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return i?[o,""]:[o];let l=DEe(s.join("/")),a=[];return a.push(...l.map(h=>h===""?o:[o,h].join("/"))),i&&a.push(...l),a.map(h=>e.startsWith("/")&&h===""?"/":h)}function dJe(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yJe(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const uJe=/^:[\w-]+$/,hJe=3,fJe=2,pJe=1,mJe=10,gJe=-2,Nwe=e=>e==="*";function xJe(e,t){let n=e.split("/"),s=n.length;return n.some(Nwe)&&(s+=gJe),t&&(s+=fJe),n.filter(i=>!Nwe(i)).reduce((i,o)=>i+(uJe.test(o)?hJe:o===""?pJe:mJe),s)}function yJe(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function vJe(e,t,n){let{routesMeta:s}=e,i={},o="/",l=[];for(let a=0;a{let{paramName:b,isOptional:j}=x;if(b==="*"){let C=a[y]||"";l=o.slice(0,o.length-C.length).replace(/(.)\/+$/,"$1")}const N=a[y];return j&&!N?p[b]=void 0:p[b]=(N||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:e}}function bJe(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),LEe(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,a,h)=>(s.push({paramName:a,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function wJe(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return LEe(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function lge(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}function jJe(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:i=""}=typeof e=="string"?n3(e):e;return{pathname:n?n.startsWith("/")?n:kJe(n,t):t,search:CJe(s),hash:MJe(i)}}function kJe(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Nle(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function NJe(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function cge(e,t){let n=NJe(e);return t?n.map((s,i)=>i===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function dge(e,t,n,s){s===void 0&&(s=!1);let i;typeof e=="string"?i=n3(e):(i=ZA({},e),hc(!i.pathname||!i.pathname.includes("?"),Nle("?","pathname","search",i)),hc(!i.pathname||!i.pathname.includes("#"),Nle("#","pathname","hash",i)),hc(!i.search||!i.search.includes("#"),Nle("#","search","hash",i)));let o=e===""||i.pathname==="",l=o?"/":i.pathname,a;if(l==null)a=n;else{let y=t.length-1;if(!s&&l.startsWith("..")){let b=l.split("/");for(;b[0]==="..";)b.shift(),y-=1;i.pathname=b.join("/")}a=y>=0?t[y]:"/"}let h=jJe(i,a),p=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||x)&&(h.pathname+="/"),h}const k1=e=>e.join("/").replace(/\/\/+/g,"/"),SJe=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),CJe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,MJe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function TJe(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const REe=["post","put","patch","delete"];new Set(REe);const AJe=["get",...REe];new Set(AJe);/** * React Router v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function YA(){return YA=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),I.useCallback(function(p,x){if(x===void 0&&(x={}),!a.current)return;if(typeof p=="number"){s.go(p);return}let y=dge(p,JSON.parse(l),o,x.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:k1([t,y.pathname])),(x.replace?s.replace:s.push)(y,x.state,x)},[t,s,l,o,e])}const LJe=I.createContext(null);function OJe(e){let t=I.useContext(Bg).outlet;return t&&I.createElement(LJe.Provider,{value:e},t)}function Wc(){let{matches:e}=I.useContext(Bg),t=e[e.length-1];return t?t.params:{}}function BEe(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=I.useContext(tv),{matches:i}=I.useContext(Bg),{pathname:o}=Nm(),l=JSON.stringify(cge(i,s.v7_relativeSplatPath));return I.useMemo(()=>dge(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function DJe(e,t){return RJe(e,t)}function RJe(e,t,n,s){s3()||hc(!1);let{navigator:i}=I.useContext(tv),{matches:o}=I.useContext(Bg),l=o[o.length-1],a=l?l.params:{};l&&l.pathname;let h=l?l.pathnameBase:"/";l&&l.route;let p=Nm(),x;if(t){var y;let A=typeof t=="string"?n3(t):t;h==="/"||(y=A.pathname)!=null&&y.startsWith(h)||hc(!1),x=A}else x=p;let b=x.pathname||"/",j=b;if(h!=="/"){let A=h.replace(/^\//,"").split("/");j="/"+b.replace(/^\//,"").split("/").slice(A.length).join("/")}let N=lJe(e,{pathname:j}),C=UJe(N&&N.map(A=>Object.assign({},A,{params:Object.assign({},a,A.params),pathname:k1([h,i.encodeLocation?i.encodeLocation(A.pathname).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?h:k1([h,i.encodeLocation?i.encodeLocation(A.pathnameBase).pathname:A.pathnameBase])})),o,n,s);return t&&C?I.createElement(Fne.Provider,{value:{location:YA({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:V0.Pop}},C):C}function FJe(){let e=WJe(),t=TJe(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return I.createElement(I.Fragment,null,I.createElement("h2",null,"Unexpected Application Error!"),I.createElement("h3",{style:{fontStyle:"italic"}},t),n?I.createElement("pre",{style:i},n):null,null)}const zJe=I.createElement(FJe,null);class BJe extends I.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?I.createElement(Bg.Provider,{value:this.props.routeContext},I.createElement(FEe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function $Je(e){let{routeContext:t,match:n,children:s}=e,i=I.useContext(uge);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),I.createElement(Bg.Provider,{value:t},s)}function UJe(e,t,n,s){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=s)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,a=(i=n)==null?void 0:i.errors;if(a!=null){let x=l.findIndex(y=>y.route.id&&(a==null?void 0:a[y.route.id])!==void 0);x>=0||hc(!1),l=l.slice(0,Math.min(l.length,x+1))}let h=!1,p=-1;if(n&&s&&s.v7_partialHydration)for(let x=0;x=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((x,y,b)=>{let j,N=!1,C=null,A=null;n&&(j=a&&y.route.id?a[y.route.id]:void 0,C=y.route.errorElement||zJe,h&&(p<0&&b===0?(KJe("route-fallback"),N=!0,A=null):p===b&&(N=!0,A=y.route.hydrateFallbackElement||null)));let E=t.concat(l.slice(0,b+1)),T=()=>{let L;return j?L=C:N?L=A:y.route.Component?L=I.createElement(y.route.Component,null):y.route.element?L=y.route.element:L=x,I.createElement($Je,{match:y,routeContext:{outlet:x,matches:E,isDataRoute:n!=null},children:L})};return n&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?I.createElement(BJe,{location:n.location,revalidation:n.revalidation,component:C,error:j,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):T()},null)}var $Ee=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}($Ee||{}),UEe=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(UEe||{});function qJe(e){let t=I.useContext(uge);return t||hc(!1),t}function VJe(e){let t=I.useContext(EJe);return t||hc(!1),t}function HJe(e){let t=I.useContext(Bg);return t||hc(!1),t}function qEe(e){let t=HJe(),n=t.matches[t.matches.length-1];return n.route.id||hc(!1),n.route.id}function WJe(){var e;let t=I.useContext(FEe),n=VJe(),s=qEe();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function GJe(){let{router:e}=qJe($Ee.UseNavigateStable),t=qEe(UEe.UseNavigateStable),n=I.useRef(!1);return zEe(()=>{n.current=!0}),I.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,YA({fromRouteId:t},o)))},[e,t])}const Swe={};function KJe(e,t,n){Swe[e]||(Swe[e]=!0)}function ZJe(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function nee(e){let{to:t,replace:n,state:s,relative:i}=e;s3()||hc(!1);let{future:o,static:l}=I.useContext(tv),{matches:a}=I.useContext(Bg),{pathname:h}=Nm(),p=ns(),x=dge(t,cge(a,o.v7_relativeSplatPath),h,i==="path"),y=JSON.stringify(x);return I.useEffect(()=>p(JSON.parse(y),{replace:n,state:s,relative:i}),[p,y,i,n,s]),null}function YJe(e){return OJe(e.context)}function an(e){hc(!1)}function XJe(e){let{basename:t="/",children:n=null,location:s,navigationType:i=V0.Pop,navigator:o,static:l=!1,future:a}=e;s3()&&hc(!1);let h=t.replace(/^\/*/,"/"),p=I.useMemo(()=>({basename:h,navigator:o,static:l,future:YA({v7_relativeSplatPath:!1},a)}),[h,a,o,l]);typeof s=="string"&&(s=n3(s));let{pathname:x="/",search:y="",hash:b="",state:j=null,key:N="default"}=s,C=I.useMemo(()=>{let A=lge(x,h);return A==null?null:{location:{pathname:A,search:y,hash:b,state:j,key:N},navigationType:i}},[h,x,y,b,j,N,i]);return C==null?null:I.createElement(tv.Provider,{value:p},I.createElement(Fne.Provider,{children:n,value:C}))}function QJe(e){let{children:t,location:n}=e;return DJe(Due(t),n)}new Promise(()=>{});function Due(e,t){t===void 0&&(t=[]);let n=[];return I.Children.forEach(e,(s,i)=>{if(!I.isValidElement(s))return;let o=[...t,i];if(s.type===I.Fragment){n.push.apply(n,Due(s.props.children,o));return}s.type!==an&&hc(!1),!s.props.index||!s.props.children||hc(!1);let l={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(l.children=Due(s.props.children,o)),n.push(l)}),n}/** * React Router DOM v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Rue(){return Rue=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function eet(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tet(e,t){return e.button===0&&(!t||t==="_self")&&!eet(e)}function Fue(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(i=>[n,i]):[[n,s]])},[]))}function ret(e,t){let n=Fue(e);return t&&t.forEach((s,i)=>{n.has(i)||t.getAll(i).forEach(o=>{n.append(i,o)})}),n}const net=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],set="6";try{window.__reactRouterVersion=set}catch{}const iet="startTransition",Cwe=Ype[iet];function aet(e){let{basename:t,children:n,future:s,window:i}=e,o=I.useRef();o.current==null&&(o.current=iJe({window:i,v5Compat:!0}));let l=o.current,[a,h]=I.useState({action:l.action,location:l.location}),{v7_startTransition:p}=s||{},x=I.useCallback(y=>{p&&Cwe?Cwe(()=>h(y)):h(y)},[h,p]);return I.useLayoutEffect(()=>l.listen(x),[l,x]),I.useEffect(()=>ZJe(s),[s]),I.createElement(XJe,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:l,future:s})}const oet=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",cet=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uo=I.forwardRef(function(t,n){let{onClick:s,relative:i,reloadDocument:o,replace:l,state:a,target:h,to:p,preventScrollReset:x,viewTransition:y}=t,b=JJe(t,net),{basename:j}=I.useContext(tv),N,C=!1;if(typeof p=="string"&&cet.test(p)&&(N=p,oet))try{let L=new URL(window.location.href),z=p.startsWith("//")?new URL(L.protocol+p):new URL(p),F=lge(z.pathname,j);z.origin===L.origin&&F!=null?p=F+z.search+z.hash:C=!0}catch{}let A=IJe(p,{relative:i}),E=det(p,{replace:l,state:a,target:h,preventScrollReset:x,relative:i,viewTransition:y});function T(L){s&&s(L),L.defaultPrevented||E(L)}return I.createElement("a",Rue({},b,{href:N||A,onClick:C||o?s:T,ref:n,target:h}))});var Mwe;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Mwe||(Mwe={}));var Twe;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Twe||(Twe={}));function det(e,t){let{target:n,replace:s,state:i,preventScrollReset:o,relative:l,viewTransition:a}=t===void 0?{}:t,h=ns(),p=Nm(),x=BEe(e,{relative:l});return I.useCallback(y=>{if(tet(y,n)){y.preventDefault();let b=s!==void 0?s:Yee(p)===Yee(x);h(e,{replace:b,state:i,preventScrollReset:o,relative:l,viewTransition:a})}},[p,h,x,s,i,n,e,o,l,a])}function Fd(e){let t=I.useRef(Fue(e)),n=I.useRef(!1),s=Nm(),i=I.useMemo(()=>ret(s.search,n.current?null:t.current),[s.search]),o=ns(),l=I.useCallback((a,h)=>{const p=Fue(typeof a=="function"?a(i):a);n.current=!0,o("?"+p,h)},[o,i]);return[i,l]}var uet=typeof Element<"u",het=typeof Map=="function",fet=typeof Set=="function",pet=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function see(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,s,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!see(e[s],t[s]))return!1;return!0}var o;if(het&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;for(o=e.entries();!(s=o.next()).done;)if(!see(s.value[1],t.get(s.value[0])))return!1;return!0}if(fet&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(pet&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[s]))return!1;if(uet&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((i[s]==="_owner"||i[s]==="__v"||i[s]==="__o")&&e.$$typeof)&&!see(e[i[s]],t[i[s]]))return!1;return!0}return e!==e&&t!==t}var met=function(t,n){try{return see(t,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const get=za(met);var xet=function(e,t,n,s,i,o,l,a){if(!e){var h;if(t===void 0)h=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,s,i,o,l,a],x=0;h=new Error(t.replace(/%s/g,function(){return p[x++]})),h.name="Invariant Violation"}throw h.framesToPop=1,h}},yet=xet;const Awe=za(yet);var vet=function(t,n,s,i){var o=s?s.call(i,t,n):void 0;if(o!==void 0)return!!o;if(t===n)return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var l=Object.keys(t),a=Object.keys(n);if(l.length!==a.length)return!1;for(var h=Object.prototype.hasOwnProperty.bind(n),p=0;p(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(VEe||{}),Sle={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},Ewe=Object.values(VEe),hge={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},bet=Object.entries(hge).reduce((e,[t,n])=>(e[n]=t,e),{}),am="data-rh",bS={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},wS=(e,t)=>{for(let n=e.length-1;n>=0;n-=1){const s=e[n];if(Object.prototype.hasOwnProperty.call(s,t))return s[t]}return null},wet=e=>{let t=wS(e,"title");const n=wS(e,bS.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,()=>t);const s=wS(e,bS.DEFAULT_TITLE);return t||s||void 0},jet=e=>wS(e,bS.ON_CHANGE_CLIENT_STATE)||(()=>{}),Cle=(e,t)=>t.filter(n=>typeof n[e]<"u").map(n=>n[e]).reduce((n,s)=>({...n,...s}),{}),ket=(e,t)=>t.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(e),LM=(e,t,n)=>{const s={};return n.filter(i=>Array.isArray(i[e])?!0:(typeof i[e]<"u"&&Net(`Helmet: ${e} should be of type "Array". Instead found type "${typeof i[e]}"`),!1)).map(i=>i[e]).reverse().reduce((i,o)=>{const l={};o.filter(h=>{let p;const x=Object.keys(h);for(let b=0;bi.push(h));const a=Object.keys(l);for(let h=0;h{if(Array.isArray(e)&&e.length){for(let n=0;n({baseTag:ket(["href"],e),bodyAttributes:Cle("bodyAttributes",e),defer:wS(e,bS.DEFER),encode:wS(e,bS.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:Cle("htmlAttributes",e),linkTags:LM("link",["rel","href"],e),metaTags:LM("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:LM("noscript",["innerHTML"],e),onChangeClientState:jet(e),scriptTags:LM("script",["src","innerHTML"],e),styleTags:LM("style",["cssText"],e),title:wet(e),titleAttributes:Cle("titleAttributes",e),prioritizeSeoTags:Cet(e,bS.PRIORITIZE_SEO_TAGS)}),HEe=e=>Array.isArray(e)?e.join(""):e,Tet=(e,t)=>{const n=Object.keys(e);for(let s=0;sArray.isArray(e)?e.reduce((n,s)=>(Tet(s,t)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:e,priority:[]},Iwe=(e,t)=>({...e,[t]:void 0}),Aet=["noscript","script","style"],zue=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),WEe=e=>Object.keys(e).reduce((t,n)=>{const s=typeof e[n]<"u"?`${n}="${e[n]}"`:`${n}`;return t?`${t} ${s}`:s},""),Eet=(e,t,n,s)=>{const i=WEe(n),o=HEe(t);return i?`<${e} ${am}="true" ${i}>${zue(o,s)}`:`<${e} ${am}="true">${zue(o,s)}`},Iet=(e,t,n=!0)=>t.reduce((s,i)=>{const o=i,l=Object.keys(o).filter(p=>!(p==="innerHTML"||p==="cssText")).reduce((p,x)=>{const y=typeof o[x]>"u"?x:`${x}="${zue(o[x],n)}"`;return p?`${p} ${y}`:y},""),a=o.innerHTML||o.cssText||"",h=Aet.indexOf(e)===-1;return`${s}<${e} ${am}="true" ${l}${h?"/>":`>${a}`}`},""),GEe=(e,t={})=>Object.keys(e).reduce((n,s)=>{const i=hge[s];return n[i||s]=e[s],n},t),Pet=(e,t,n)=>{const s={key:t,[am]:!0},i=GEe(n,s);return[rt.createElement("title",i,t)]},iee=(e,t)=>t.map((n,s)=>{const i={key:s,[am]:!0};return Object.keys(n).forEach(o=>{const a=hge[o]||o;if(a==="innerHTML"||a==="cssText"){const h=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:h}}else i[a]=n[o]}),rt.createElement(e,i)}),Af=(e,t,n=!0)=>{switch(e){case"title":return{toComponent:()=>Pet(e,t.title,t.titleAttributes),toString:()=>Eet(e,t.title,t.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>GEe(t),toString:()=>WEe(t)};default:return{toComponent:()=>iee(e,t),toString:()=>Iet(e,t,n)}}},Let=({metaTags:e,linkTags:t,scriptTags:n,encode:s})=>{const i=Mle(e,Sle.meta),o=Mle(t,Sle.link),l=Mle(n,Sle.script);return{priorityMethods:{toComponent:()=>[...iee("meta",i.priority),...iee("link",o.priority),...iee("script",l.priority)],toString:()=>`${Af("meta",i.priority,s)} ${Af("link",o.priority,s)} ${Af("script",l.priority,s)}`},metaTags:i.default,linkTags:o.default,scriptTags:l.default}},Oet=e=>{const{baseTag:t,bodyAttributes:n,encode:s=!0,htmlAttributes:i,noscriptTags:o,styleTags:l,title:a="",titleAttributes:h,prioritizeSeoTags:p}=e;let{linkTags:x,metaTags:y,scriptTags:b}=e,j={toComponent:()=>{},toString:()=>""};return p&&({priorityMethods:j,linkTags:x,metaTags:y,scriptTags:b}=Let(e)),{priority:j,base:Af("base",t,s),bodyAttributes:Af("bodyAttributes",n,s),htmlAttributes:Af("htmlAttributes",i,s),link:Af("link",x,s),meta:Af("meta",y,s),noscript:Af("noscript",o,s),script:Af("script",b,s),style:Af("style",l,s),title:Af("title",{title:a,titleAttributes:h},s)}},Bue=Oet,cL=[],KEe=!!(typeof window<"u"&&window.document&&window.document.createElement),$ue=class{constructor(e,t){Gn(this,"instances",[]);Gn(this,"canUseDOM",KEe);Gn(this,"context");Gn(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?cL:this.instances,add:e=>{(this.canUseDOM?cL:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?cL:this.instances).indexOf(e);(this.canUseDOM?cL:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=Bue({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},Det={},ZEe=rt.createContext(Det),aj,YEe=(aj=class extends I.Component{constructor(n){super(n);Gn(this,"helmetData");this.helmetData=new $ue(this.props.context||{},aj.canUseDOM)}render(){return rt.createElement(ZEe.Provider,{value:this.helmetData.value},this.props.children)}},Gn(aj,"canUseDOM",KEe),aj),GN=(e,t)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${e}[${am}]`),i=[].slice.call(s),o=[];let l;return t&&t.length&&t.forEach(a=>{const h=document.createElement(e);for(const p in a)if(Object.prototype.hasOwnProperty.call(a,p))if(p==="innerHTML")h.innerHTML=a.innerHTML;else if(p==="cssText")h.styleSheet?h.styleSheet.cssText=a.cssText:h.appendChild(document.createTextNode(a.cssText));else{const x=p,y=typeof a[x]>"u"?"":a[x];h.setAttribute(p,y)}h.setAttribute(am,"true"),i.some((p,x)=>(l=x,h.isEqualNode(p)))?i.splice(l,1):o.push(h)}),i.forEach(a=>{var h;return(h=a.parentNode)==null?void 0:h.removeChild(a)}),o.forEach(a=>n.appendChild(a)),{oldTags:i,newTags:o}},Uue=(e,t)=>{const n=document.getElementsByTagName(e)[0];if(!n)return;const s=n.getAttribute(am),i=s?s.split(","):[],o=[...i],l=Object.keys(t);for(const a of l){const h=t[a]||"";n.getAttribute(a)!==h&&n.setAttribute(a,h),i.indexOf(a)===-1&&i.push(a);const p=o.indexOf(a);p!==-1&&o.splice(p,1)}for(let a=o.length-1;a>=0;a-=1)n.removeAttribute(o[a]);i.length===o.length?n.removeAttribute(am):n.getAttribute(am)!==l.join(",")&&n.setAttribute(am,l.join(","))},Ret=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=HEe(e)),Uue("title",t)},Pwe=(e,t)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:i,linkTags:o,metaTags:l,noscriptTags:a,onChangeClientState:h,scriptTags:p,styleTags:x,title:y,titleAttributes:b}=e;Uue("body",s),Uue("html",i),Ret(y,b);const j={baseTag:GN("base",n),linkTags:GN("link",o),metaTags:GN("meta",l),noscriptTags:GN("noscript",a),scriptTags:GN("script",p),styleTags:GN("style",x)},N={},C={};Object.keys(j).forEach(A=>{const{newTags:E,oldTags:T}=j[A];E.length&&(N[A]=E),T.length&&(C[A]=j[A].oldTags)}),t&&t(),h(e,N,C)},OM=null,Fet=e=>{OM&&cancelAnimationFrame(OM),e.defer?OM=requestAnimationFrame(()=>{Pwe(e,()=>{OM=null})}):(Pwe(e),OM=null)},zet=Fet,Lwe=class extends I.Component{constructor(){super(...arguments);Gn(this,"rendered",!1)}shouldComponentUpdate(t){return!_et(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=Met(t.get().map(o=>{const l={...o.props};return delete l.context,l}));YEe.canUseDOM?zet(i):Bue&&(s=Bue(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},xde,np=(xde=class extends I.Component{shouldComponentUpdate(e){return!get(Iwe(this.props,"helmetData"),Iwe(e,"helmetData"))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case"script":case"noscript":return{innerHTML:t};case"style":return{cssText:t};default:throw new Error(`<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(e,t,n,s){return{...t,[e.type]:[...t[e.type]||[],{...n,...this.mapNestedChildrenToProps(e,s)}]}}mapObjectTypeChildren(e,t,n,s){switch(e.type){case"title":return{...t,[e.type]:s,titleAttributes:{...n}};case"body":return{...t,bodyAttributes:{...n}};case"html":return{...t,htmlAttributes:{...n}};default:return{...t,[e.type]:{...n}}}}mapArrayTypeChildrenToProps(e,t){let n={...t};return Object.keys(e).forEach(s=>{n={...n,[s]:e[s]}}),n}warnOnInvalidChildren(e,t){return Awe(Ewe.some(n=>e.type===n),typeof e.type=="function"?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${Ewe.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),Awe(!t||typeof t=="string"||Array.isArray(t)&&!t.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(e,t){let n={};return rt.Children.forEach(e,s=>{if(!s||!s.props)return;const{children:i,...o}=s.props,l=Object.keys(o).reduce((h,p)=>(h[bet[p]||p]=o[p],h),{});let{type:a}=s;switch(typeof a=="symbol"?a=a.toString():this.warnOnInvalidChildren(s,i),a){case"Symbol(react.fragment)":t=this.mapChildrenToProps(i,t);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,l,i);break;default:t=this.mapObjectTypeChildren(s,t,l,i);break}}),this.mapArrayTypeChildrenToProps(n,t)}render(){const{children:e,...t}=this.props;let n={...t},{helmetData:s}=t;if(e&&(n=this.mapChildrenToProps(e,n)),s&&!(s instanceof $ue)){const i=s;s=new $ue(i.context,!0),delete n.helmetData}return s?rt.createElement(Lwe,{...n,context:s.value}):rt.createElement(ZEe.Consumer,null,i=>rt.createElement(Lwe,{...n,context:i}))}},Gn(xde,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),xde),que=function(e,t){return que=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},que(e,t)};function XEe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");que(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Rf=function(){return Rf=Object.assign||function(t){for(var n,s=1,i=arguments.length;s=0;a--)(l=e[a])&&(o=(i<3?l(o):i>3?l(t,n,o):l(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function JEe(e,t){return function(n,s){t(n,s,e)}}function eIe(e,t,n,s,i,o){function l(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var a=s.kind,h=a==="getter"?"get":a==="setter"?"set":"value",p=!t&&e?s.static?e:e.prototype:null,x=t||(p?Object.getOwnPropertyDescriptor(p,s.name):{}),y,b=!1,j=n.length-1;j>=0;j--){var N={};for(var C in s)N[C]=C==="access"?{}:s[C];for(var C in s.access)N.access[C]=s.access[C];N.addInitializer=function(E){if(b)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(E||null))};var A=(0,n[j])(a==="accessor"?{get:x.get,set:x.set}:x[h],N);if(a==="accessor"){if(A===void 0)continue;if(A===null||typeof A!="object")throw new TypeError("Object expected");(y=l(A.get))&&(x.get=y),(y=l(A.set))&&(x.set=y),(y=l(A.init))&&i.unshift(y)}else(y=l(A))&&(a==="field"?i.unshift(y):x[h]=y)}p&&Object.defineProperty(p,s.name,x),b=!0}function tIe(e,t,n){for(var s=arguments.length>2,i=0;i0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function fge(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var s=n.call(e),i,o=[],l;try{for(;(t===void 0||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(a){l={error:a}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(l)throw l.error}}return o}function oIe(){for(var e=[],t=0;t1||h(j,C)})},N&&(i[j]=N(i[j])))}function h(j,N){try{p(s[j](N))}catch(C){b(o[0][3],C)}}function p(j){j.value instanceof iC?Promise.resolve(j.value.v).then(x,y):b(o[0][2],j)}function x(j){h("next",j)}function y(j){h("throw",j)}function b(j,N){j(N),o.shift(),o.length&&h(o[0][0],o[0][1])}}function dIe(e){var t,n;return t={},s("next"),s("throw",function(i){throw i}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(i,o){t[i]=e[i]?function(l){return(n=!n)?{value:iC(e[i](l)),done:!1}:o?o(l):l}:o}}function uIe(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Xee=="function"?Xee(e):e[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(o){n[o]=e[o]&&function(l){return new Promise(function(a,h){l=e[o](l),i(a,h,l.done,l.value)})}}function i(o,l,a,h){Promise.resolve(h).then(function(p){o({value:p,done:a})},l)}}function hIe(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Bet=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},Vue=function(e){return Vue=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},Vue(e)};function fIe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=Vue(e),s=0;s0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));i=Promise.allSettled(n.map(h=>{if(h=Het(h),h in Owe)return;Owe[h]=!0;const p=h.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${x}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":Vet,p||(y.as="script"),y.crossOrigin="",y.href=h,a&&y.setAttribute("nonce",a),document.head.appendChild(y),p)return new Promise((b,j)=>{y.addEventListener("load",b),y.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(l){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=l,window.dispatchEvent(a),!a.defaultPrevented)throw l}return i.then(l=>{for(const a of l||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})},Wet=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>i3(async()=>{const{default:s}=await Promise.resolve().then(()=>nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)};class mge extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}}class Dwe extends mge{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class Rwe extends mge{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Fwe extends mge{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Hue;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Hue||(Hue={}));class Get{constructor(t,{headers:n={},customFetch:s,region:i=Hue.Any}={}){this.url=t,this.headers=n,this.region=i,this.fetch=Wet(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return Ps(this,arguments,void 0,function*(n,s={}){var i;try{const{headers:o,method:l,body:a,signal:h}=s;let p={},{region:x}=s;x||(x=this.region);const y=new URL(`${this.url}/${n}`);x&&x!=="any"&&(p["x-region"]=x,y.searchParams.set("forceFunctionRegion",x));let b;a&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",b=a):typeof a=="string"?(p["Content-Type"]="text/plain",b=a):typeof FormData<"u"&&a instanceof FormData?b=a:(p["Content-Type"]="application/json",b=JSON.stringify(a)):b=a;const j=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),o),body:b,signal:h}).catch(E=>{throw E.name==="AbortError"?E:new Dwe(E)}),N=j.headers.get("x-relay-error");if(N&&N==="true")throw new Rwe(j);if(!j.ok)throw new Fwe(j);let C=((i=j.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),A;return C==="application/json"?A=yield j.json():C==="application/octet-stream"||C==="application/pdf"?A=yield j.blob():C==="text/event-stream"?A=j:C==="multipart/form-data"?A=yield j.formData():A=yield j.text(),{data:A,error:null,response:j}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new Dwe(o)}:{data:null,error:o,response:o instanceof Fwe||o instanceof Rwe?o.context:void 0}}})}}var ch={};const a3=V5e(qet);var dL={},uL={},hL={},fL={},pL={},Ket=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},aC=Ket();const Zet=aC.fetch,bIe=aC.fetch.bind(aC),wIe=aC.Headers,Yet=aC.Request,Xet=aC.Response,nk=Object.freeze(Object.defineProperty({__proto__:null,Headers:wIe,Request:Yet,Response:Xet,default:bIe,fetch:Zet},Symbol.toStringTag,{value:"Module"})),Qet=V5e(nk);var mL={},zwe;function jIe(){if(zwe)return mL;zwe=1,Object.defineProperty(mL,"__esModule",{value:!0});class e extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}}return mL.default=e,mL}var Bwe;function kIe(){if(Bwe)return pL;Bwe=1,Object.defineProperty(pL,"__esModule",{value:!0});const e=a3,t=e.__importDefault(Qet),n=e.__importDefault(jIe());class s{constructor(o){var l,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(l=o.shouldThrowOnError)!==null&&l!==void 0?l:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:typeof fetch>"u"?this.fetch=t.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,l){return this.headers=new Headers(this.headers),this.headers.set(o,l),this}then(o,l){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const a=this.fetch;let h=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async p=>{var x,y,b,j;let N=null,C=null,A=null,E=p.status,T=p.statusText;if(p.ok){if(this.method!=="HEAD"){const q=await p.text();q===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((x=this.headers.get("Accept"))===null||x===void 0)&&x.includes("application/vnd.pgrst.plan+text"))?C=q:C=JSON.parse(q))}const z=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),F=(b=p.headers.get("content-range"))===null||b===void 0?void 0:b.split("/");z&&F&&F.length>1&&(A=parseInt(F[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(C)&&(C.length>1?(N={code:"PGRST116",details:`Results contain ${C.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},C=null,A=null,E=406,T="Not Acceptable"):C.length===1?C=C[0]:C=null)}else{const z=await p.text();try{N=JSON.parse(z),Array.isArray(N)&&p.status===404&&(C=[],N=null,E=200,T="OK")}catch{p.status===404&&z===""?(E=204,T="No Content"):N={message:z}}if(N&&this.isMaybeSingle&&(!((j=N==null?void 0:N.details)===null||j===void 0)&&j.includes("0 rows"))&&(N=null,E=200,T="OK"),N&&this.shouldThrowOnError)throw new n.default(N)}return{error:N,data:C,count:A,status:E,statusText:T}});return this.shouldThrowOnError||(h=h.catch(p=>{var x,y,b;return{error:{message:`${(x=p==null?void 0:p.name)!==null&&x!==void 0?x:"FetchError"}: ${p==null?void 0:p.message}`,details:`${(y=p==null?void 0:p.stack)!==null&&y!==void 0?y:""}`,hint:"",code:`${(b=p==null?void 0:p.code)!==null&&b!==void 0?b:""}`},data:null,count:null,status:0,statusText:""}})),h.then(o,l)}returns(){return this}overrideTypes(){return this}}return pL.default=s,pL}var $we;function NIe(){if($we)return fL;$we=1,Object.defineProperty(fL,"__esModule",{value:!0});const t=a3.__importDefault(kIe());class n extends t.default{select(i){let o=!1;const l=(i??"*").split("").map(a=>/\s/.test(a)&&!o?"":(a==='"'&&(o=!o),a)).join("");return this.url.searchParams.set("select",l),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:o=!0,nullsFirst:l,foreignTable:a,referencedTable:h=a}={}){const p=h?`${h}.order`:"order",x=this.url.searchParams.get(p);return this.url.searchParams.set(p,`${x?`${x},`:""}${i}.${o?"asc":"desc"}${l===void 0?"":l?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:o,referencedTable:l=o}={}){const a=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(a,`${i}`),this}range(i,o,{foreignTable:l,referencedTable:a=l}={}){const h=typeof a>"u"?"offset":`${a}.offset`,p=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(h,`${i}`),this.url.searchParams.set(p,`${o-i+1}`),this}abortSignal(i){return this.signal=i,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:i=!1,verbose:o=!1,settings:l=!1,buffers:a=!1,wal:h=!1,format:p="text"}={}){var x;const y=[i?"analyze":null,o?"verbose":null,l?"settings":null,a?"buffers":null,h?"wal":null].filter(Boolean).join("|"),b=(x=this.headers.get("Accept"))!==null&&x!==void 0?x:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${p}; for="${b}"; options=${y};`),p==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}}return fL.default=n,fL}var Uwe;function gge(){if(Uwe)return hL;Uwe=1,Object.defineProperty(hL,"__esModule",{value:!0});const t=a3.__importDefault(NIe()),n=new RegExp("[,()]");class s extends t.default{eq(o,l){return this.url.searchParams.append(o,`eq.${l}`),this}neq(o,l){return this.url.searchParams.append(o,`neq.${l}`),this}gt(o,l){return this.url.searchParams.append(o,`gt.${l}`),this}gte(o,l){return this.url.searchParams.append(o,`gte.${l}`),this}lt(o,l){return this.url.searchParams.append(o,`lt.${l}`),this}lte(o,l){return this.url.searchParams.append(o,`lte.${l}`),this}like(o,l){return this.url.searchParams.append(o,`like.${l}`),this}likeAllOf(o,l){return this.url.searchParams.append(o,`like(all).{${l.join(",")}}`),this}likeAnyOf(o,l){return this.url.searchParams.append(o,`like(any).{${l.join(",")}}`),this}ilike(o,l){return this.url.searchParams.append(o,`ilike.${l}`),this}ilikeAllOf(o,l){return this.url.searchParams.append(o,`ilike(all).{${l.join(",")}}`),this}ilikeAnyOf(o,l){return this.url.searchParams.append(o,`ilike(any).{${l.join(",")}}`),this}is(o,l){return this.url.searchParams.append(o,`is.${l}`),this}in(o,l){const a=Array.from(new Set(l)).map(h=>typeof h=="string"&&n.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(o,`in.(${a})`),this}contains(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cs.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cs.{${l.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(l)}`),this}containedBy(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cd.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cd.{${l.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(l)}`),this}rangeGt(o,l){return this.url.searchParams.append(o,`sr.${l}`),this}rangeGte(o,l){return this.url.searchParams.append(o,`nxl.${l}`),this}rangeLt(o,l){return this.url.searchParams.append(o,`sl.${l}`),this}rangeLte(o,l){return this.url.searchParams.append(o,`nxr.${l}`),this}rangeAdjacent(o,l){return this.url.searchParams.append(o,`adj.${l}`),this}overlaps(o,l){return typeof l=="string"?this.url.searchParams.append(o,`ov.${l}`):this.url.searchParams.append(o,`ov.{${l.join(",")}}`),this}textSearch(o,l,{config:a,type:h}={}){let p="";h==="plain"?p="pl":h==="phrase"?p="ph":h==="websearch"&&(p="w");const x=a===void 0?"":`(${a})`;return this.url.searchParams.append(o,`${p}fts${x}.${l}`),this}match(o){return Object.entries(o).forEach(([l,a])=>{this.url.searchParams.append(l,`eq.${a}`)}),this}not(o,l,a){return this.url.searchParams.append(o,`not.${l}.${a}`),this}or(o,{foreignTable:l,referencedTable:a=l}={}){const h=a?`${a}.or`:"or";return this.url.searchParams.append(h,`(${o})`),this}filter(o,l,a){return this.url.searchParams.append(o,`${l}.${a}`),this}}return hL.default=s,hL}var qwe;function SIe(){if(qwe)return uL;qwe=1,Object.defineProperty(uL,"__esModule",{value:!0});const t=a3.__importDefault(gge());class n{constructor(i,{headers:o={},schema:l,fetch:a}){this.url=i,this.headers=new Headers(o),this.schema=l,this.fetch=a}select(i,o){const{head:l=!1,count:a}=o??{},h=l?"HEAD":"GET";let p=!1;const x=(i??"*").split("").map(y=>/\s/.test(y)&&!p?"":(y==='"'&&(p=!p),y)).join("");return this.url.searchParams.set("select",x),a&&this.headers.append("Prefer",`count=${a}`),new t.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(i,{count:o,defaultToNull:l=!0}={}){var a;const h="POST";if(o&&this.headers.append("Prefer",`count=${o}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const p=i.reduce((x,y)=>x.concat(Object.keys(y)),[]);if(p.length>0){const x=[...new Set(p)].map(y=>`"${y}"`);this.url.searchParams.set("columns",x.join(","))}}return new t.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}upsert(i,{onConflict:o,ignoreDuplicates:l=!1,count:a,defaultToNull:h=!0}={}){var p;const x="POST";if(this.headers.append("Prefer",`resolution=${l?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),a&&this.headers.append("Prefer",`count=${a}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(i)){const y=i.reduce((b,j)=>b.concat(Object.keys(j)),[]);if(y.length>0){const b=[...new Set(y)].map(j=>`"${j}"`);this.url.searchParams.set("columns",b.join(","))}}return new t.default({method:x,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(p=this.fetch)!==null&&p!==void 0?p:fetch})}update(i,{count:o}={}){var l;const a="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new t.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:i,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}delete({count:i}={}){var o;const l="DELETE";return i&&this.headers.append("Prefer",`count=${i}`),new t.default({method:l,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}}return uL.default=n,uL}var Vwe;function Jet(){if(Vwe)return dL;Vwe=1,Object.defineProperty(dL,"__esModule",{value:!0});const e=a3,t=e.__importDefault(SIe()),n=e.__importDefault(gge());class s{constructor(o,{headers:l={},schema:a,fetch:h}={}){this.url=o,this.headers=new Headers(l),this.schemaName=a,this.fetch=h}from(o){const l=new URL(`${this.url}/${o}`);return new t.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new s(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:a=!1,get:h=!1,count:p}={}){var x;let y;const b=new URL(`${this.url}/rpc/${o}`);let j;a||h?(y=a?"HEAD":"GET",Object.entries(l).filter(([C,A])=>A!==void 0).map(([C,A])=>[C,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([C,A])=>{b.searchParams.append(C,A)})):(y="POST",j=l);const N=new Headers(this.headers);return p&&N.set("Prefer",`count=${p}`),new n.default({method:y,url:b,headers:N,schema:this.schemaName,body:j,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return dL.default=s,dL}Object.defineProperty(ch,"__esModule",{value:!0});var CIe=ch.PostgrestError=RIe=ch.PostgrestBuilder=OIe=ch.PostgrestTransformBuilder=PIe=ch.PostgrestFilterBuilder=EIe=ch.PostgrestQueryBuilder=TIe=ch.PostgrestClient=void 0;const o3=a3,MIe=o3.__importDefault(Jet());var TIe=ch.PostgrestClient=MIe.default;const AIe=o3.__importDefault(SIe());var EIe=ch.PostgrestQueryBuilder=AIe.default;const IIe=o3.__importDefault(gge());var PIe=ch.PostgrestFilterBuilder=IIe.default;const LIe=o3.__importDefault(NIe());var OIe=ch.PostgrestTransformBuilder=LIe.default;const DIe=o3.__importDefault(kIe());var RIe=ch.PostgrestBuilder=DIe.default;const FIe=o3.__importDefault(jIe());CIe=ch.PostgrestError=FIe.default;var zIe=ch.default={PostgrestClient:MIe.default,PostgrestQueryBuilder:AIe.default,PostgrestFilterBuilder:IIe.default,PostgrestTransformBuilder:LIe.default,PostgrestBuilder:DIe.default,PostgrestError:FIe.default};const ett=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return RIe},get PostgrestClient(){return TIe},get PostgrestError(){return CIe},get PostgrestFilterBuilder(){return PIe},get PostgrestQueryBuilder(){return EIe},get PostgrestTransformBuilder(){return OIe},default:zIe},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:ttt,PostgrestQueryBuilder:KZt,PostgrestFilterBuilder:ZZt,PostgrestTransformBuilder:YZt,PostgrestBuilder:XZt,PostgrestError:QZt}=zIe||ett;class rtt{static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const s=n.node,i=parseInt(s.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option: import ws from "ws" new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=` Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const s=this.getWebSocketConstructor();return new s(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const ntt="2.78.0",stt=`realtime-js/${ntt}`,itt="1.0.0",Wue=1e4,att=1e3,ott=100;var sA;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(sA||(sA={}));var Oc;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(Oc||(Oc={}));var Xp;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(Xp||(Xp={}));var Gue;(function(e){e.websocket="websocket"})(Gue||(Gue={}));var Iw;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Iw||(Iw={}));class ltt{constructor(){this.HEADER_LENGTH=1}decode(t,n){return t.constructor===ArrayBuffer?n(this._binaryDecode(t)):n(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const n=new DataView(t),s=new TextDecoder;return this._decodeBroadcast(t,n,s)}_decodeBroadcast(t,n,s){const i=n.getUint8(1),o=n.getUint8(2);let l=this.HEADER_LENGTH+2;const a=s.decode(t.slice(l,l+i));l=l+i;const h=s.decode(t.slice(l,l+o));l=l+o;const p=JSON.parse(s.decode(t.slice(l,t.byteLength)));return{ref:null,topic:a,event:h,payload:p}}}class BIe{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Wo;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(Wo||(Wo={}));const Hwe=(e,t,n={})=>{var s;const i=(s=n.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((o,l)=>(o[l]=ctt(l,e,t,i),o),{}):{}},ctt=(e,t,n,s)=>{const i=t.find(a=>a.name===e),o=i==null?void 0:i.type,l=n[e];return o&&!s.includes(o)?$Ie(o,l):Kue(l)},$Ie=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return ftt(t,n)}switch(e){case Wo.bool:return dtt(t);case Wo.float4:case Wo.float8:case Wo.int2:case Wo.int4:case Wo.int8:case Wo.numeric:case Wo.oid:return utt(t);case Wo.json:case Wo.jsonb:return htt(t);case Wo.timestamp:return ptt(t);case Wo.abstime:case Wo.date:case Wo.daterange:case Wo.int4range:case Wo.int8range:case Wo.money:case Wo.reltime:case Wo.text:case Wo.time:case Wo.timestamptz:case Wo.timetz:case Wo.tsrange:case Wo.tstzrange:return Kue(t);default:return Kue(t)}},Kue=e=>e,dtt=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},utt=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},htt=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},ftt=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,s=e[n];if(e[0]==="{"&&s==="}"){let o;const l=e.slice(1,n);try{o=JSON.parse("["+l+"]")}catch{o=l?l.split(","):[]}return o.map(a=>$Ie(t,a))}return e},ptt=e=>typeof e=="string"?e.replace(" ","T"):e,UIe=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class Tle{constructor(t,n,s={},i=Wue){this.channel=t,this.event=n,this.payload=s,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(t){this.timeout=t,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var s;return this._hasReceived(t)&&n((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:t,response:n}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var Wwe;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(Wwe||(Wwe={}));class iA{constructor(t,n){this.channel=t,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},i=>{const{onJoin:o,onLeave:l,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=iA.syncState(this.state,i,o,l),this.pendingDiffs.forEach(h=>{this.state=iA.syncDiff(this.state,h,o,l)}),this.pendingDiffs=[],a()}),this.channel._on(s.diff,{},i=>{const{onJoin:o,onLeave:l,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=iA.syncDiff(this.state,i,o,l),a())}),this.onJoin((i,o,l)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:o,newPresences:l})}),this.onLeave((i,o,l)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:o,leftPresences:l})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,s,i){const o=this.cloneDeep(t),l=this.transformState(n),a={},h={};return this.map(o,(p,x)=>{l[p]||(h[p]=x)}),this.map(l,(p,x)=>{const y=o[p];if(y){const b=x.map(A=>A.presence_ref),j=y.map(A=>A.presence_ref),N=x.filter(A=>j.indexOf(A.presence_ref)<0),C=y.filter(A=>b.indexOf(A.presence_ref)<0);N.length>0&&(a[p]=N),C.length>0&&(h[p]=C)}else a[p]=x}),this.syncDiff(o,{joins:a,leaves:h},s,i)}static syncDiff(t,n,s,i){const{joins:o,leaves:l}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),i||(i=()=>{}),this.map(o,(a,h)=>{var p;const x=(p=t[a])!==null&&p!==void 0?p:[];if(t[a]=this.cloneDeep(h),x.length>0){const y=t[a].map(j=>j.presence_ref),b=x.filter(j=>y.indexOf(j.presence_ref)<0);t[a].unshift(...b)}s(a,x,h)}),this.map(l,(a,h)=>{let p=t[a];if(!p)return;const x=h.map(y=>y.presence_ref);p=p.filter(y=>x.indexOf(y.presence_ref)<0),t[a]=p,i(a,p,h),p.length===0&&delete t[a]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(s=>n(s,t[s]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,s)=>{const i=t[s];return"metas"in i?n[s]=i.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[s]=i,n},{})}static cloneDeep(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var Gwe;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(Gwe||(Gwe={}));var aA;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(aA||(aA={}));var jx;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(jx||(jx={}));class xge{constructor(t,n={config:{}},s){var i,o;if(this.topic=t,this.params=n,this.socket=s,this.bindings={},this.state=Oc.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new Tle(this,Xp.join,this.params,this.timeout),this.rejoinTimer=new BIe(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Oc.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Oc.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Oc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Oc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=Oc.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Xp.reply,{},(l,a)=>{this._trigger(this._replyEventName(a),l)}),this.presence=new iA(this),this.broadcastEndpointURL=UIe(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||o===void 0)&&o.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(t,n=this.timeout){var s,i,o;if(this.socket.isConnected()||this.socket.connect(),this.state==Oc.closed){const{config:{broadcast:l,presence:a,private:h}}=this.params,p=(i=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(j=>j.filter))!==null&&i!==void 0?i:[],x=!!this.bindings[aA.PRESENCE]&&this.bindings[aA.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,y={},b={broadcast:l,presence:Object.assign(Object.assign({},a),{enabled:x}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(j=>t==null?void 0:t(jx.CHANNEL_ERROR,j)),this._onClose(()=>t==null?void 0:t(jx.CLOSED)),this.updateJoinPayload(Object.assign({config:b},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:j})=>{var N;if(this.socket.setAuth(),j===void 0){t==null||t(jx.SUBSCRIBED);return}else{const C=this.bindings.postgres_changes,A=(N=C==null?void 0:C.length)!==null&&N!==void 0?N:0,E=[];for(let T=0;T{this.state=Oc.errored,t==null||t(jx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(j).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(jx.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,s){return this.state===Oc.joined&&t===aA.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(t,n,s)}async httpSend(t,n,s={}){var i;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(n==null)return Promise.reject("Payload is required for httpSend()");const l={method:"POST",headers:{Authorization:o,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:t,payload:n,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(i=s.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let h=a.statusText;try{const p=await a.json();h=p.error||p.message||h}catch{}return Promise.reject(new Error(h))}async send(t,n={}){var s,i;if(!this._canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:l}=t,h={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:l,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((i=p.body)===null||i===void 0?void 0:i.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var l,a,h;const p=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((h=(a=(l=this.params)===null||l===void 0?void 0:l.config)===null||a===void 0?void 0:a.broadcast)===null||h===void 0)&&h.ack)&&o("ok"),p.receive("ok",()=>o("ok")),p.receive("error",()=>o("error")),p.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=Oc.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Xp.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(i=>{s=new Tle(this,Xp.leave,{},t),s.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),s.send(),this._canPush()||s.trigger("ok",{})}).finally(()=>{s==null||s.destroy()})}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Oc.closed,this.bindings={}}async _fetchWithTimeout(t,n,s){const i=new AbortController,o=setTimeout(()=>i.abort(),s),l=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(o),l}_push(t,n,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Tle(this,t,n,s);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>ott){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,s){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,s){var i,o;const l=t.toLocaleLowerCase(),{close:a,error:h,leave:p,join:x}=Xp;if(s&&[a,h,p,x].indexOf(l)>=0&&s!==this._joinRef())return;let b=this._onMessage(l,n,s);if(n&&!b)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(l)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(j=>{var N,C,A;return((N=j.filter)===null||N===void 0?void 0:N.event)==="*"||((A=(C=j.filter)===null||C===void 0?void 0:C.event)===null||A===void 0?void 0:A.toLocaleLowerCase())===l}).map(j=>j.callback(b,s)):(o=this.bindings[l])===null||o===void 0||o.filter(j=>{var N,C,A,E,T,L;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in j){const z=j.id,F=(N=j.filter)===null||N===void 0?void 0:N.event;return z&&((C=n.ids)===null||C===void 0?void 0:C.includes(z))&&(F==="*"||(F==null?void 0:F.toLocaleLowerCase())===((A=n.data)===null||A===void 0?void 0:A.type.toLocaleLowerCase()))}else{const z=(T=(E=j==null?void 0:j.filter)===null||E===void 0?void 0:E.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return z==="*"||z===((L=n==null?void 0:n.event)===null||L===void 0?void 0:L.toLocaleLowerCase())}else return j.type.toLocaleLowerCase()===l}).map(j=>{if(typeof b=="object"&&"ids"in b){const N=b.data,{schema:C,table:A,commit_timestamp:E,type:T,errors:L}=N;b=Object.assign(Object.assign({},{schema:C,table:A,commit_timestamp:E,eventType:T,new:{},old:{},errors:L}),this._getPayloadRecords(N))}j.callback(b,s)})}_isClosed(){return this.state===Oc.closed}_isJoined(){return this.state===Oc.joined}_isJoining(){return this.state===Oc.joining}_isLeaving(){return this.state===Oc.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,s){const i=t.toLocaleLowerCase(),o={type:i,filter:n,callback:s};return this.bindings[i]?this.bindings[i].push(o):this.bindings[i]=[o],this}_off(t,n){const s=t.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(i=>{var o;return!(((o=i.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===s&&xge.isEqual(i.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const s in t)if(t[s]!==n[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(Xp.close,{},t)}_onError(t){this._on(Xp.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Oc.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Hwe(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Hwe(t.columns,t.old_record)),n}}const Ale=()=>{},gL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},mtt=[1e3,2e3,5e3,1e4],gtt=1e4,xtt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class ytt{constructor(t,n){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Wue,this.transport=null,this.heartbeatIntervalMs=gL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Ale,this.ref=0,this.reconnectTimer=null,this.logger=Ale,this.conn=null,this.sendBuffer=[],this.serializer=new ltt,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>{let o;return i?o=i:typeof fetch>"u"?o=(...l)=>i3(async()=>{const{default:a}=await Promise.resolve().then(()=>nk);return{default:a}},void 0).then(({default:a})=>a(...l)).catch(a=>{throw new Error(`Failed to load @supabase/node-fetch: ${a.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...l)=>o(...l)},!(!((s=n==null?void 0:n.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${t}/${Gue.websocket}`,this.httpEndpoint=UIe(t),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=rtt.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.message;throw n.includes("Node.js")?new Error(`${n} To use Realtime in Node.js, you need to provide a WebSocket implementation: Option 1: Use Node.js 22+ which has native WebSocket support Option 2: Install and provide the "ws" package: npm install ws import ws from "ws" const client = new RealtimeClient(url, { ...options, transport: ws })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:itt}))}disconnect(t,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const s=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(s),this._setConnectionState("disconnected")},t?this.conn.close(t,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,s){this.logger(t,n,s)}connectionState(){switch(this.conn&&this.conn.readyState){case sA.connecting:return Iw.Connecting;case sA.open:return Iw.Open;case sA.closing:return Iw.Closing;default:return Iw.Closed}}isConnected(){return this.connectionState()===Iw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const s=`realtime:${t}`,i=this.getChannels().find(o=>o.topic===s);if(i)return i;{const o=new xge(`realtime:${t}`,n,this);return this.channels.push(o),o}}push(t){const{topic:n,event:s,payload:i,ref:o}=t,l=()=>{this.encode(t,a=>{var h;(h=this.conn)===null||h===void 0||h.send(a)})};this.log("push",`${n} ${s} (${o})`,i),this.isConnected()?l():this.sendBuffer.push(l)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var t;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(t=this.conn)===null||t===void 0||t.close(att,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},gL.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(s=>s.topic===t&&(s._isJoined()||s._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(p){this.log("error","error in heartbeat callback",p)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:i,payload:o,ref:l}=n,a=l?`(${l})`:"",h=o.status||"";this.log("receive",`${h} ${s} ${i} ${a}`.trim(),o),this.channels.filter(p=>p._isMember(s)).forEach(p=>p._trigger(i,o,l)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(t=>t.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(Xp.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const s=t.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${t}${s}${i}`}_workerObjectUrl(t){let n;if(t)n=t;else{const s=new Blob([xtt],{type:"application/javascript"});n=URL.createObjectURL(s)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n;t?n=t:this.accessToken?n=await this.accessToken():n=this.accessTokenValue,this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(s=>{const i={access_token:n,version:stt};n&&s.updateJoinPayload(i),s.joinedOnce&&s._isJoined()&&s._push(Xp.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(s=>{try{s(n)}catch(i){this.log("error",`error in ${t} callback`,i)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new BIe(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},gL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,s,i,o,l,a,h,p,x;if(this.transport=(n=t==null?void 0:t.transport)!==null&&n!==void 0?n:null,this.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:Wue,this.heartbeatIntervalMs=(i=t==null?void 0:t.heartbeatIntervalMs)!==null&&i!==void 0?i:gL.HEARTBEAT_INTERVAL,this.worker=(o=t==null?void 0:t.worker)!==null&&o!==void 0?o:!1,this.accessToken=(l=t==null?void 0:t.accessToken)!==null&&l!==void 0?l:null,this.heartbeatCallback=(a=t==null?void 0:t.heartbeatCallback)!==null&&a!==void 0?a:Ale,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(h=t==null?void 0:t.reconnectAfterMs)!==null&&h!==void 0?h:y=>mtt[y-1]||gtt,this.encode=(p=t==null?void 0:t.encode)!==null&&p!==void 0?p:(y,b)=>b(JSON.stringify(y)),this.decode=(x=t==null?void 0:t.decode)!==null&&x!==void 0?x:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t==null?void 0:t.workerUrl}}}class yge extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Tl(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class vtt extends yge{constructor(t,n,s){super(t),this.name="StorageApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Zue extends yge{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}const vge=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>i3(async()=>{const{default:s}=await Promise.resolve().then(()=>nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},_tt=()=>Ps(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield i3(()=>Promise.resolve().then(()=>nk),void 0)).Response:Response}),Yue=e=>{if(Array.isArray(e))return e.map(n=>Yue(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,s])=>{const i=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[i]=Yue(s)}),t},btt=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Ele=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},wtt=(e,t,n)=>Ps(void 0,void 0,void 0,function*(){const s=yield _tt();e instanceof s&&!(n!=null&&n.noResolveJson)?e.json().then(i=>{const o=e.status||500,l=(i==null?void 0:i.statusCode)||o+"";t(new vtt(Ele(i),o,l))}).catch(i=>{t(new Zue(Ele(i),i))}):t(new Zue(Ele(e),e))}),jtt=(e,t,n,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!s?i:(btt(s)?(i.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(s)):i.body=s,t!=null&&t.duplex&&(i.duplex=t.duplex),Object.assign(Object.assign({},i),n))};function yI(e,t,n,s,i,o){return Ps(this,void 0,void 0,function*(){return new Promise((l,a)=>{e(n,jtt(t,s,i,o)).then(h=>{if(!h.ok)throw h;return s!=null&&s.noResolveJson?h:h.json()}).then(h=>l(h)).catch(h=>wtt(h,a,s))})})}function XA(e,t,n,s){return Ps(this,void 0,void 0,function*(){return yI(e,"GET",t,n,s)})}function Gp(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return yI(e,"POST",t,s,i,n)})}function Xue(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return yI(e,"PUT",t,s,i,n)})}function ktt(e,t,n,s){return Ps(this,void 0,void 0,function*(){return yI(e,"HEAD",t,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function _ge(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return yI(e,"DELETE",t,s,i,n)})}class Ntt{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n}then(t,n){return this.execute().then(t,n)}execute(){return Ps(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Tl(t))return{data:null,error:t};throw t}})}}var qIe;class Stt{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n,this[qIe]="BlobDownloadBuilder",this.promise=null}asStream(){return new Ntt(this.downloadFn,this.shouldThrowOnError)}then(t,n){return this.getPromise().then(t,n)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return Ps(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Tl(t))return{data:null,error:t};throw t}})}}qIe=Symbol.toStringTag;const Ctt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Kwe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Mtt{constructor(t,n={},s,i){this.shouldThrowOnError=!1,this.url=t,this.headers=n,this.bucketId=s,this.fetch=vge(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,n,s,i){return Ps(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},Kwe),i);let a=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(l.upsert)});const h=l.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h))):(o=s,a["cache-control"]=`max-age=${l.cacheControl}`,a["content-type"]=l.contentType,h&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(h)))),i!=null&&i.headers&&(a=Object.assign(Object.assign({},a),i.headers));const p=this._removeEmptyFolders(n),x=this._getFinalPath(p),y=yield(t=="PUT"?Xue:Gp)(this.fetch,`${this.url}/object/${x}`,o,Object.assign({headers:a},l!=null&&l.duplex?{duplex:l.duplex}:{}));return{data:{path:p,id:y.Id,fullPath:y.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(Tl(o))return{data:null,error:o};throw o}})}upload(t,n,s){return Ps(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,s)})}uploadToSignedUrl(t,n,s,i){return Ps(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(t),l=this._getFinalPath(o),a=new URL(this.url+`/object/upload/sign/${l}`);a.searchParams.set("token",n);try{let h;const p=Object.assign({upsert:Kwe.upsert},i),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(p.upsert)});typeof Blob<"u"&&s instanceof Blob?(h=new FormData,h.append("cacheControl",p.cacheControl),h.append("",s)):typeof FormData<"u"&&s instanceof FormData?(h=s,h.append("cacheControl",p.cacheControl)):(h=s,x["cache-control"]=`max-age=${p.cacheControl}`,x["content-type"]=p.contentType);const y=yield Xue(this.fetch,a.toString(),h,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(h){if(this.shouldThrowOnError)throw h;if(Tl(h))return{data:null,error:h};throw h}})}createSignedUploadUrl(t,n){return Ps(this,void 0,void 0,function*(){try{let s=this._getFinalPath(t);const i=Object.assign({},this.headers);n!=null&&n.upsert&&(i["x-upsert"]="true");const o=yield Gp(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:i}),l=new URL(this.url+o.url),a=l.searchParams.get("token");if(!a)throw new yge("No token returned by API");return{data:{signedUrl:l.toString(),path:t,token:a},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}update(t,n,s){return Ps(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,s)})}move(t,n,s){return Ps(this,void 0,void 0,function*(){try{return{data:yield Gp(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}copy(t,n,s){return Ps(this,void 0,void 0,function*(){try{return{data:{path:(yield Gp(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}createSignedUrl(t,n,s){return Ps(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),o=yield Gp(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:n},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const l=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return o={signedUrl:encodeURI(`${this.url}${o.signedURL}${l}`)},{data:o,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}createSignedUrls(t,n,s){return Ps(this,void 0,void 0,function*(){try{const i=yield Gp(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:t},{headers:this.headers}),o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:i.map(l=>Object.assign(Object.assign({},l),{signedUrl:l.signedURL?encodeURI(`${this.url}${l.signedURL}${o}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}download(t,n){const i=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),l=o?`?${o}`:"",a=this._getFinalPath(t),h=()=>XA(this.fetch,`${this.url}/${i}/${a}${l}`,{headers:this.headers,noResolveJson:!0});return new Stt(h,this.shouldThrowOnError)}info(t){return Ps(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{const s=yield XA(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Yue(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}exists(t){return Ps(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{return yield ktt(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s)&&s instanceof Zue){const i=s.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:s}}throw s}})}getPublicUrl(t,n){const s=this._getFinalPath(t),i=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&i.push(o);const a=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",h=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});h!==""&&i.push(h);let p=i.join("&");return p!==""&&(p=`?${p}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${s}${p}`)}}}remove(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield _ge(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}list(t,n,s){return Ps(this,void 0,void 0,function*(){try{const i=Object.assign(Object.assign(Object.assign({},Ctt),n),{prefix:t||""});return{data:yield Gp(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},s),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}listV2(t,n){return Ps(this,void 0,void 0,function*(){try{const s=Object.assign({},t);return{data:yield Gp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const n=[];return t.width&&n.push(`width=${t.width}`),t.height&&n.push(`height=${t.height}`),t.resize&&n.push(`resize=${t.resize}`),t.format&&n.push(`format=${t.format}`),t.quality&&n.push(`quality=${t.quality}`),n.join("&")}}const VIe="2.78.0",HIe={"X-Client-Info":`storage-js/${VIe}`};class Ttt{constructor(t,n={},s,i){this.shouldThrowOnError=!1;const o=new URL(t);i!=null&&i.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase.")),this.url=o.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},HIe),n),this.fetch=vge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return Ps(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(t);return{data:yield XA(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}getBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield XA(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}createBucket(t){return Ps(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield Gp(this.fetch,`${this.url}/bucket`,{id:n,name:n,type:s.type,public:s.public,file_size_limit:s.fileSizeLimit,allowed_mime_types:s.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if(Tl(i))return{data:null,error:i};throw i}})}updateBucket(t,n){return Ps(this,void 0,void 0,function*(){try{return{data:yield Xue(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Tl(s))return{data:null,error:s};throw s}})}emptyBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Gp(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield _ge(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}listBucketOptionsToQueryString(t){const n={};return t&&("limit"in t&&(n.limit=String(t.limit)),"offset"in t&&(n.offset=String(t.offset)),t.search&&(n.search=t.search),t.sortColumn&&(n.sortColumn=t.sortColumn),t.sortOrder&&(n.sortOrder=t.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}}class Att{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},HIe),n),this.fetch=vge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield Gp(this.fetch,`${this.url}/bucket`,{name:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}listBuckets(t){return Ps(this,void 0,void 0,function*(){try{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const s=n.toString(),i=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield XA(this.fetch,i,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield _ge(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Tl(n))return{data:null,error:n};throw n}})}}const bge={"X-Client-Info":`storage-js/${VIe}`,"Content-Type":"application/json"};class WIe extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Uh(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class Ile extends WIe{constructor(t,n,s){super(t),this.name="StorageVectorsApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Ett extends WIe{constructor(t,n){super(t),this.name="StorageVectorsUnknownError",this.originalError=n}}var Zwe;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(Zwe||(Zwe={}));const wge=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>i3(async()=>{const{default:s}=await Promise.resolve().then(()=>nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},Itt=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Ywe=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Ptt=(e,t,n)=>Ps(void 0,void 0,void 0,function*(){if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(n!=null&&n.noResolveJson)){const i=e.status||500,o=e;if(typeof o.json=="function")o.json().then(l=>{const a=(l==null?void 0:l.statusCode)||(l==null?void 0:l.code)||i+"";t(new Ile(Ywe(l),i,a))}).catch(()=>{const l=i+"",a=o.statusText||`HTTP ${i} error`;t(new Ile(a,i,l))});else{const l=i+"",a=o.statusText||`HTTP ${i} error`;t(new Ile(a,i,l))}}else t(new Ett(Ywe(e),e))}),Ltt=(e,t,n,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return s?(Itt(s)?(i.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),i.body=JSON.stringify(s)):i.body=s,Object.assign(Object.assign({},i),n)):i};function Ott(e,t,n,s,i,o){return Ps(this,void 0,void 0,function*(){return new Promise((l,a)=>{e(n,Ltt(t,s,i,o)).then(h=>{if(!h.ok)throw h;if(s!=null&&s.noResolveJson)return h;const p=h.headers.get("content-type");return!p||!p.includes("application/json")?{}:h.json()}).then(h=>l(h)).catch(h=>Ptt(h,a,s))})})}function qh(e,t,n,s,i){return Ps(this,void 0,void 0,function*(){return Ott(e,"POST",t,s,i,n)})}class Dtt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},bge),n),this.fetch=wge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return Ps(this,void 0,void 0,function*(){try{return{data:(yield qh(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}getIndex(t,n){return Ps(this,void 0,void 0,function*(){try{return{data:yield qh(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Uh(s))return{data:null,error:s};throw s}})}listIndexes(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield qh(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}deleteIndex(t,n){return Ps(this,void 0,void 0,function*(){try{return{data:(yield qh(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Uh(s))return{data:null,error:s};throw s}})}}class Rtt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},bge),n),this.fetch=wge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return Ps(this,void 0,void 0,function*(){try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield qh(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}getVectors(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield qh(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}listVectors(t){return Ps(this,void 0,void 0,function*(){try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:yield qh(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}queryVectors(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield qh(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}deleteVectors(t){return Ps(this,void 0,void 0,function*(){try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield qh(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}}class Ftt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},bge),n),this.fetch=wge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:(yield qh(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}getBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:yield qh(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}listBuckets(){return Ps(this,arguments,void 0,function*(t={}){try{return{data:yield qh(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}deleteBucket(t){return Ps(this,void 0,void 0,function*(){try{return{data:(yield qh(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Uh(n))return{data:null,error:n};throw n}})}}class ztt extends Ftt{constructor(t,n={}){super(t,n.headers||{},n.fetch)}from(t){return new Btt(this.url,this.headers,t,this.fetch)}}class Btt extends Dtt{constructor(t,n,s,i){super(t,n,i),this.vectorBucketName=s}createIndex(t){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Ps(this,void 0,void 0,function*(){return n.createIndex.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const t=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Ps(this,arguments,void 0,function*(n={}){return t.listIndexes.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName}))})}getIndex(t){const n=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Ps(this,void 0,void 0,function*(){return n.getIndex.call(this,this.vectorBucketName,t)})}deleteIndex(t){const n=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Ps(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new $tt(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class $tt extends Rtt{constructor(t,n,s,i,o){super(t,n,o),this.vectorBucketName=s,this.indexName=i}putVectors(t){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Ps(this,void 0,void 0,function*(){return n.putVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(t){const n=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Ps(this,void 0,void 0,function*(){return n.getVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const t=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Ps(this,arguments,void 0,function*(n={}){return t.listVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(t){const n=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Ps(this,void 0,void 0,function*(){return n.queryVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(t){const n=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Ps(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class Utt extends Ttt{constructor(t,n={},s,i){super(t,n,s,i)}from(t){return new Mtt(this.url,this.headers,t,this.fetch)}get vectors(){return new ztt(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Att(this.url+"/iceberg",this.headers,this.fetch)}}const qtt="2.78.0";let cT="";typeof Deno<"u"?cT="deno":typeof document<"u"?cT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?cT="react-native":cT="node";const Vtt={"X-Client-Info":`supabase-js-${cT}/${qtt}`},Htt={headers:Vtt},Wtt={schema:"public"},Gtt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Ktt={},Ztt=e=>{let t;return e?t=e:typeof fetch>"u"?t=bIe:t=fetch,(...n)=>t(...n)},Ytt=()=>typeof Headers>"u"?wIe:Headers,Xtt=(e,t,n)=>{const s=Ztt(n),i=Ytt();return async(o,l)=>{var a;const h=(a=await t())!==null&&a!==void 0?a:e;let p=new i(l==null?void 0:l.headers);return p.has("apikey")||p.set("apikey",e),p.has("Authorization")||p.set("Authorization",`Bearer ${h}`),s(o,Object.assign(Object.assign({},l),{headers:p}))}};function Qtt(e){return e.endsWith("/")?e:e+"/"}function Jtt(e,t){var n,s;const{db:i,auth:o,realtime:l,global:a}=e,{db:h,auth:p,realtime:x,global:y}=t,b={db:Object.assign(Object.assign({},h),i),auth:Object.assign(Object.assign({},p),o),realtime:Object.assign(Object.assign({},x),l),storage:{},global:Object.assign(Object.assign(Object.assign({},y),a),{headers:Object.assign(Object.assign({},(n=y==null?void 0:y.headers)!==null&&n!==void 0?n:{}),(s=a==null?void 0:a.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return e.accessToken?b.accessToken=e.accessToken:delete b.accessToken,b}function ert(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Qtt(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const GIe="2.78.0",g4=30*1e3,Que=3,Ple=Que*g4,trt="http://localhost:9999",rrt="supabase.auth.token",nrt={"X-Client-Info":`gotrue-js/${GIe}`},Jue="X-Supabase-Api-Version",KIe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},srt=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,irt=10*60*1e3;class QA extends Error{constructor(t,n,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function Js(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class art extends QA{constructor(t,n,s){super(t,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function ort(e){return Js(e)&&e.name==="AuthApiError"}class Pw extends QA{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class nv extends QA{constructor(t,n,s,i){super(t,s,i),this.name=n,this.status=s}}class Up extends nv{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function lrt(e){return Js(e)&&e.name==="AuthSessionMissingError"}class KN extends nv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class xL extends nv{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class yL extends nv{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function crt(e){return Js(e)&&e.name==="AuthImplicitGrantRedirectError"}class Xwe extends nv{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class ehe extends nv{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Lle(e){return Js(e)&&e.name==="AuthRetryableFetchError"}class Qwe extends nv{constructor(t,n,s){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class the extends nv{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Qee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Jwe=` \r=`.split(""),drt=(()=>{const e=new Array(128);for(let t=0;t=6;){const s=t.queue>>t.queuedBits-6&63;n(Qee[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;n(Qee[s]),t.queuedBits-=6}}function ZIe(e,t,n){const s=drt[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function tje(e){const t=[],n=l=>{t.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},o=l=>{frt(l,s,n)};for(let l=0;l>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function hrt(e,t){for(let n=0;n55295&&s<=56319){const i=(s-55296)*1024&65535;s=(e.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}urt(s,t)}}function frt(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let s=1;s<6;s+=1)if(!(e>>7-s&1)){t.utf8seq=s;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function jS(e){const t=[],n={queue:0,queuedBits:0},s=i=>{t.push(i)};for(let i=0;it.push(n)),new Uint8Array(t)}function Bw(e){const t=[],n={queue:0,queuedBits:0},s=i=>{t.push(i)};return e.forEach(i=>eje(i,n,s)),eje(null,n,s),t.join("")}function mrt(e){return Math.round(Date.now()/1e3)+e}function grt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const gu=()=>typeof window<"u"&&typeof document<"u",i_={tested:!1,writable:!1},YIe=()=>{if(!gu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(i_.tested)return i_.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),i_.tested=!0,i_.writable=!0}catch{i_.tested=!0,i_.writable=!1}return i_.writable};function xrt(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,o)=>{t[o]=i})}catch{}return n.searchParams.forEach((s,i)=>{t[i]=s}),t}const XIe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>i3(async()=>{const{default:s}=await Promise.resolve().then(()=>nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},yrt=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",x4=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},a_=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},i0=async(e,t)=>{await e.removeItem(t)};class Bne{constructor(){this.promise=new Bne.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Bne.promiseConstructor=Promise;function Ole(e){const t=e.split(".");if(t.length!==3)throw new the("Invalid JWT structure");for(let s=0;s{setTimeout(()=>t(null),e)})}function _rt(e,t){return new Promise((s,i)=>{(async()=>{for(let o=0;o<1/0;o++)try{const l=await e(o);if(!t(o,null,l)){s(l);return}}catch(l){if(!t(o,l)){i(l);return}}})()})}function brt(e){return("0"+e.toString(16)).substr(-2)}function wrt(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let i="";for(let o=0;o<56;o++)i+=n.charAt(Math.floor(Math.random()*s));return i}return crypto.getRandomValues(t),Array.from(t,brt).join("")}async function jrt(e){const n=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(s);return Array.from(i).map(o=>String.fromCharCode(o)).join("")}async function krt(e){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e;const n=await jrt(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ZN(e,t,n=!1){const s=wrt();let i=s;n&&(i+="/PASSWORD_RECOVERY"),await x4(e,`${t}-code-verifier`,i);const o=await krt(s);return[o,s===o?"plain":"s256"]}const Nrt=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Srt(e){const t=e.headers.get(Jue);if(!t||!t.match(Nrt))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Crt(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Mrt(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const Trt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function YN(e){if(!Trt.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Dle(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Art(e,t){return new Proxy(e,{get:(n,s,i)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const o=s.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,s,i)}return!t.value&&typeof s=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),t.value=!0),Reflect.get(n,s,i)}})}function rje(e){return JSON.parse(JSON.stringify(e))}const Cw=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),Ert=[502,503,504];async function nje(e){var t;if(!yrt(e))throw new ehe(Cw(e),0);if(Ert.includes(e.status))throw new ehe(Cw(e),e.status);let n;try{n=await e.json()}catch(o){throw new Pw(Cw(o),o)}let s;const i=Srt(e);if(i&&i.getTime()>=KIe["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?s=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(s=n.error_code),s){if(s==="weak_password")throw new Qwe(Cw(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new Up}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,l)=>o&&typeof l=="string",!0))throw new Qwe(Cw(n),e.status,n.weak_password.reasons);throw new art(Cw(n),e.status||500,s)}const Irt=(e,t,n,s)=>{const i={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),i.body=JSON.stringify(s),Object.assign(Object.assign({},i),n))};async function Mi(e,t,n,s){var i;const o=Object.assign({},s==null?void 0:s.headers);o[Jue]||(o[Jue]=KIe["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const l=(i=s==null?void 0:s.query)!==null&&i!==void 0?i:{};s!=null&&s.redirectTo&&(l.redirect_to=s.redirectTo);const a=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",h=await Prt(e,t,n+a,{headers:o,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(h):{data:Object.assign({},h),error:null}}async function Prt(e,t,n,s,i,o){const l=Irt(t,s,i,o);let a;try{a=await e(n,Object.assign({},l))}catch(h){throw console.error(h),new ehe(Cw(h),0)}if(a.ok||await nje(a),s!=null&&s.noResolveJson)return a;try{return await a.json()}catch(h){await nje(h)}}function qp(e){var t;let n=null;Drt(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=mrt(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:s},error:null}}function sje(e){const t=qp(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,s)=>n&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function C0(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Lrt(e){return{data:e,error:null}}function Ort(e){const{action_link:t,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o}=e,l=rv(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:t,email_otp:n,hashed_token:s,redirect_to:i,verification_type:o},h=Object.assign({},l);return{data:{properties:a,user:h},error:null}}function ije(e){return e}function Drt(e){return e.access_token&&e.refresh_token&&e.expires_in}const Rle=["global","local","others"];class Rrt{constructor({url:t="",headers:n={},fetch:s}){this.url=t,this.headers=n,this.fetch=XIe(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(t,n=Rle[0]){if(Rle.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Rle.join(", ")}`);try{return await Mi(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,n={}){try{return await Mi(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:C0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:n}=t,s=rv(t,["options"]),i=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(i.new_email=s==null?void 0:s.newEmail,delete i.newEmail),await Mi(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:Ort,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Js(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Mi(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:C0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,s,i,o,l,a,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Mi(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:ije});if(x.error)throw x.error;const y=await x.json(),b=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(a=x.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(N=>{const C=parseInt(N.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(N.split(";")[1].split("=")[1]);p[`${A}Page`]=C}),p.total=parseInt(b)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{users:[]},error:p};throw p}}async getUserById(t){YN(t);try{return await Mi(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:C0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){YN(t);try{return await Mi(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:C0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,n=!1){YN(t);try{return await Mi(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:C0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){YN(t.userId);try{const{data:n,error:s}=await Mi(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:s}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _deleteFactor(t){YN(t.userId),YN(t.id);try{return{data:await Mi(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,s,i,o,l,a,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Mi(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(i=t==null?void 0:t.perPage)===null||i===void 0?void 0:i.toString())!==null&&o!==void 0?o:""},xform:ije});if(x.error)throw x.error;const y=await x.json(),b=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(a=x.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(N=>{const C=parseInt(N.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(N.split(";")[1].split("=")[1]);p[`${A}Page`]=C}),p.total=parseInt(b)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(t){try{return await Mi(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Mi(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Mi(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{return await Mi(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Mi(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}}function aje(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const XN={debug:!!(globalThis&&YIe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class QIe extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class Frt extends QIe{}async function zrt(e,t,n){XN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;return t>0&&setTimeout(()=>{s.abort(),XN.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async i=>{if(i){XN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,i.name);try{return await n()}finally{XN.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,i.name)}}else{if(t===0)throw XN.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new Frt(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(XN.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function Brt(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function JIe(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function $rt(e){return parseInt(e,16)}function Urt(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function qrt(e){var t;const{chainId:n,domain:s,expirationTime:i,issuedAt:o=new Date,nonce:l,notBefore:a,requestId:h,resources:p,scheme:x,uri:y,version:b}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(l&&l.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${l}`);if(!y)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(b!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${b}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const j=JIe(e.address),N=x?`${x}://${s}`:s,C=e.statement?`${e.statement} `:"",A=`${N} wants you to sign in with your Ethereum account: ${j} ${C}`;let E=`URI: ${y} Version: ${b} Chain ID: ${n}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(i&&(E+=` Expiration Time: ${i.toISOString()}`),a&&(E+=` Not Before: ${a.toISOString()}`),h&&(E+=` Request ID: ${h}`),p){let T=` Resources:`;for(const L of p){if(!L||typeof L!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${L}`);T+=` - ${L}`}E+=T}return`${A} ${E}`}class wc extends Error{constructor({message:t,code:n,cause:s,name:i}){var o;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(o=i??(s instanceof Error?s.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class Jee extends wc{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Vrt({error:e,options:t}){var n,s,i;const{publicKey:o}=t;if(!o)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new wc({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new wc({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new wc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((i=o.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new wc({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new wc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new wc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new wc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new wc({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const l=window.location.hostname;if(ePe(l)){if(o.rp.id!==l)return new wc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new wc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new wc({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new wc({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new wc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Hrt({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new wc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new wc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(ePe(s)){if(n.rpId!==s)return new wc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new wc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new wc({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new wc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Wrt{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const Grt=new Wrt;function Krt(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:s}=e,i=rv(e,["challenge","user","excludeCredentials"]),o=jS(t).buffer,l=Object.assign(Object.assign({},n),{id:jS(n.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:o,user:l});if(s&&s.length>0){a.excludeCredentials=new Array(s.length);for(let h=0;h0){o.allowCredentials=new Array(n.length);for(let l=0;li!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),s={};for(const i of e)if(i)for(const o in i){const l=i[o];if(l!==void 0)if(Array.isArray(l))s[o]=l;else if(n(l))s[o]=l;else if(t(l)){const a=s[o];t(a)?s[o]=ete(a,l):s[o]=ete(l)}else s[o]=l}return s}function rnt(e,t){return ete(ent,e,t||{})}function nnt(e,t){return ete(tnt,e,t||{})}class snt{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:s,signal:i},o){try{const{data:l,error:a}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:a};const h=i??Grt.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:p}=l.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${s}`),p.displayName||(p.displayName=p.name)}switch(l.webauthn.type){case"create":{const p=rnt(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Qrt({publicKey:p,signal:h});return x?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}case"request":{const p=nnt(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Jrt(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:p,signal:h}));return x?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Pw("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:n,webauthn:s}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:s})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i}},o){if(!n)return{data:null,error:new QA("rpId is required for WebAuthn authentication")};try{if(!oje())return{data:null,error:new Pw("Browser does not support WebAuthn",null)};const{data:l,error:a}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:s},signal:i},{request:o});if(!l)return{data:null,error:a};const{webauthn:h}=l;return this._verify({factorId:t,challengeId:l.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:s,credential_response:h.credential_response}})}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Pw("Unexpected error in authenticate",l)}}}async _register({friendlyName:t,rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:s=typeof window<"u"?[window.location.origin]:void 0,signal:i},o){if(!n)return{data:null,error:new QA("rpId is required for WebAuthn registration")};try{if(!oje())return{data:null,error:new Pw("Browser does not support WebAuthn",null)};const{data:l,error:a}=await this._enroll({friendlyName:t});if(!l)return await this.client.mfa.listFactors().then(x=>{var y;return(y=x.data)===null||y===void 0?void 0:y.all.find(b=>b.factor_type==="webauthn"&&b.friendly_name===t&&b.status!=="unverified")}).then(x=>x?this.client.mfa.unenroll({factorId:x==null?void 0:x.id}):void 0),{data:null,error:a};const{data:h,error:p}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:i},{create:o});return h?this._verify({factorId:l.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:s,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:p}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Pw("Unexpected error in register",l)}}}}Brt();const int={url:trt,storageKey:rrt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:nrt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function lje(e,t,n){return await n()}const QN={};class JA{get jwks(){var t,n;return(n=(t=QN[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){QN[this.storageKey]=Object.assign(Object.assign({},QN[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=QN[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){QN[this.storageKey]=Object.assign(Object.assign({},QN[this.storageKey]),{cachedAt:t})}constructor(t){var n,s;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=JA.nextInstanceID,JA.nextInstanceID+=1,this.instanceID>0&&gu()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const i=Object.assign(Object.assign({},int),t);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new Rrt({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=XIe(i.fetch),this.lock=i.lock||lje,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,i.lock?this.lock=i.lock:gu()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=zrt:this.lock=lje,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new snt(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:YIe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=aje(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=aje(this.memoryStorage)),gu()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${GIe}) ${new Date().toISOString()}`,...t),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var t;try{const n=xrt(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),gu()&&this.detectSessionInUrl&&s!=="none"){const{data:i,error:o}=await this._getSessionFromURL(n,s);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),crt(o)){const h=(t=o.details)===null||t===void 0?void 0:t.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:l,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",l,"redirect type",a),await this._saveSession(l),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",l):await this._notifyAllSubscribers("SIGNED_IN",l)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Js(n)?{error:n}:{error:new Pw("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,s,i;try{const o=await Mi(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(i=t==null?void 0:t.options)===null||i===void 0?void 0:i.captchaToken}},xform:qp}),{data:l,error:a}=o;if(a||!l)return{data:{user:null,session:null},error:a};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(t){var n,s,i;try{let o;if("email"in t){const{email:x,password:y,options:b}=t;let j=null,N=null;this.flowType==="pkce"&&([j,N]=await ZN(this.storage,this.storageKey)),o=await Mi(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:b==null?void 0:b.emailRedirectTo,body:{email:x,password:y,data:(n=b==null?void 0:b.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:b==null?void 0:b.captchaToken},code_challenge:j,code_challenge_method:N},xform:qp})}else if("phone"in t){const{phone:x,password:y,options:b}=t;o=await Mi(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:y,data:(s=b==null?void 0:b.data)!==null&&s!==void 0?s:{},channel:(i=b==null?void 0:b.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:b==null?void 0:b.captchaToken}},xform:qp})}else throw new xL("You must provide either an email or phone number and a password");const{data:l,error:a}=o;if(a||!l)return{data:{user:null,session:null},error:a};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(t){try{let n;if("email"in t){const{email:o,password:l,options:a}=t;n=await Mi(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:l,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:sje})}else if("phone"in t){const{phone:o,password:l,options:a}=t;n=await Mi(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:l,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:sje})}else throw new xL("You must provide either an email or phone number and a password");const{data:s,error:i}=n;return i?{data:{user:null,session:null},error:i}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new KN}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:i})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,s,i,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.scopes,queryParams:(i=t.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,s,i,o,l,a,h,p,x,y,b;let j,N;if("message"in t)j=t.message,N=t.signature;else{const{chain:C,wallet:A,statement:E,options:T}=t;let L;if(gu())if(typeof A=="object")L=A;else{const Z=window;if("ethereum"in Z&&typeof Z.ethereum=="object"&&"request"in Z.ethereum&&typeof Z.ethereum.request=="function")L=Z.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof A!="object"||!(T!=null&&T.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");L=A}const z=new URL((n=T==null?void 0:T.url)!==null&&n!==void 0?n:window.location.href),F=await L.request({method:"eth_requestAccounts"}).then(Z=>Z).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const q=JIe(F[0]);let H=(s=T==null?void 0:T.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!H){const Z=await L.request({method:"eth_chainId"});H=$rt(Z)}const K={domain:z.host,address:q,statement:E,uri:z.href,version:"1",chainId:H,nonce:(i=T==null?void 0:T.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(l=(o=T==null?void 0:T.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(a=T==null?void 0:T.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(h=T==null?void 0:T.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(p=T==null?void 0:T.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(x=T==null?void 0:T.signInWithEthereum)===null||x===void 0?void 0:x.resources};j=qrt(K),N=await L.request({method:"personal_sign",params:[Urt(j),q]})}try{const{data:C,error:A}=await Mi(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:j,signature:N},!((y=t.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(b=t.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:qp});if(A)throw A;return!C||!C.session||!C.user?{data:{user:null,session:null},error:new KN}:(C.session&&(await this._saveSession(C.session),await this._notifyAllSubscribers("SIGNED_IN",C.session)),{data:Object.assign({},C),error:A})}catch(C){if(Js(C))return{data:{user:null,session:null},error:C};throw C}}async signInWithSolana(t){var n,s,i,o,l,a,h,p,x,y,b,j;let N,C;if("message"in t)N=t.message,C=t.signature;else{const{chain:A,wallet:E,statement:T,options:L}=t;let z;if(gu())if(typeof E=="object")z=E;else{const q=window;if("solana"in q&&typeof q.solana=="object"&&("signIn"in q.solana&&typeof q.solana.signIn=="function"||"signMessage"in q.solana&&typeof q.solana.signMessage=="function"))z=q.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!(L!=null&&L.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");z=E}const F=new URL((n=L==null?void 0:L.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in z&&z.signIn){const q=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},L==null?void 0:L.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),T?{statement:T}:null));let H;if(Array.isArray(q)&&q[0]&&typeof q[0]=="object")H=q[0];else if(q&&typeof q=="object"&&"signedMessage"in q&&"signature"in q)H=q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in H&&"signature"in H&&(typeof H.signedMessage=="string"||H.signedMessage instanceof Uint8Array)&&H.signature instanceof Uint8Array)N=typeof H.signedMessage=="string"?H.signedMessage:new TextDecoder().decode(H.signedMessage),C=H.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in z)||typeof z.signMessage!="function"||!("publicKey"in z)||typeof z!="object"||!z.publicKey||!("toBase58"in z.publicKey)||typeof z.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");N=[`${F.host} wants you to sign in with your Solana account:`,z.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(i=(s=L==null?void 0:L.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((o=L==null?void 0:L.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${L.signInWithSolana.notBefore}`]:[],...!((l=L==null?void 0:L.signInWithSolana)===null||l===void 0)&&l.expirationTime?[`Expiration Time: ${L.signInWithSolana.expirationTime}`]:[],...!((a=L==null?void 0:L.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${L.signInWithSolana.chainId}`]:[],...!((h=L==null?void 0:L.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${L.signInWithSolana.nonce}`]:[],...!((p=L==null?void 0:L.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${L.signInWithSolana.requestId}`]:[],...!((y=(x=L==null?void 0:L.signInWithSolana)===null||x===void 0?void 0:x.resources)===null||y===void 0)&&y.length?["Resources",...L.signInWithSolana.resources.map(H=>`- ${H}`)]:[]].join(` `);const q=await z.signMessage(new TextEncoder().encode(N),"utf8");if(!q||!(q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");C=q}}try{const{data:A,error:E}=await Mi(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:N,signature:Bw(C)},!((b=t.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(j=t.options)===null||j===void 0?void 0:j.captchaToken}}:null),xform:qp});if(E)throw E;return!A||!A.session||!A.user?{data:{user:null,session:null},error:new KN}:(A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),{data:Object.assign({},A),error:E})}catch(A){if(Js(A))return{data:{user:null,session:null},error:A};throw A}}async _exchangeCodeForSession(t){const n=await a_(this.storage,`${this.storageKey}-code-verifier`),[s,i]=(n??"").split("/");try{const{data:o,error:l}=await Mi(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:qp});if(await i0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new KN}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:i??null}),error:l})}catch(o){if(Js(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(t){try{const{options:n,provider:s,token:i,access_token:o,nonce:l}=t,a=await Mi(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:i,access_token:o,nonce:l,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:qp}),{data:h,error:p}=a;return p?{data:{user:null,session:null},error:p}:!h||!h.session||!h.user?{data:{user:null,session:null},error:new KN}:(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),{data:h,error:p})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,s,i,o,l;try{if("email"in t){const{email:a,options:h}=t;let p=null,x=null;this.flowType==="pkce"&&([p,x]=await ZN(this.storage,this.storageKey));const{error:y}=await Mi(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},create_user:(s=h==null?void 0:h.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:x},redirectTo:h==null?void 0:h.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in t){const{phone:a,options:h}=t,{data:p,error:x}=await Mi(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=h==null?void 0:h.data)!==null&&i!==void 0?i:{},create_user:(o=h==null?void 0:h.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},channel:(l=h==null?void 0:h.channel)!==null&&l!==void 0?l:"sms"}});return{data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:x}}throw new xL("You must provide either an email or phone number.")}catch(a){if(Js(a))return{data:{user:null,session:null},error:a};throw a}}async verifyOtp(t){var n,s;try{let i,o;"options"in t&&(i=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:l,error:a}=await Mi(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:i,xform:qp});if(a)throw a;if(!l)throw new Error("An error occurred on token verification.");const h=l.session,p=l.user;return h!=null&&h.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(i){if(Js(i))return{data:{user:null,session:null},error:i};throw i}}async signInWithSSO(t){var n,s,i;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await ZN(this.storage,this.storageKey)),await Mi(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s:void 0}),!((i=t==null?void 0:t.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:Lrt})}catch(o){if(Js(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:s}=t;if(s)throw s;if(!n)throw new Up;const{error:i}=await Mi(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:i}})}catch(t){if(Js(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:s,type:i,options:o}=t,{error:l}=await Mi(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:l}}else if("phone"in t){const{phone:s,type:i,options:o}=t,{data:l,error:a}=await Mi(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:i,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:l==null?void 0:l.message_id},error:a}}throw new xL("You must provide either an email or phone number and a type")}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=n();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await a_(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(t){try{return t?await Mi(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:C0}):await this._useSession(async n=>{var s,i,o;const{data:l,error:a}=n;if(a)throw a;return!(!((s=l.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Up}:await Mi(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(i=l.session)===null||i===void 0?void 0:i.access_token)!==null&&o!==void 0?o:void 0,xform:C0})})}catch(n){if(Js(n))return lrt(n)&&(await this._removeSession(),await i0(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async s=>{const{data:i,error:o}=s;if(o)throw o;if(!i.session)throw new Up;const l=i.session;let a=null,h=null;this.flowType==="pkce"&&t.email!=null&&([a,h]=await ZN(this.storage,this.storageKey));const{data:p,error:x}=await Mi(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:a,code_challenge_method:h}),jwt:l.access_token,xform:C0});if(x)throw x;return l.user=p.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),{data:{user:l.user},error:null}})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new Up;const n=Date.now()/1e3;let s=n,i=!0,o=null;const{payload:l}=Ole(t.access_token);if(l.exp&&(s=l.exp,i=s<=n),i){const{data:a,error:h}=await this._callRefreshToken(t.refresh_token);if(h)return{data:{user:null,session:null},error:h};if(!a)return{data:{user:null,session:null},error:null};o=a}else{const{data:a,error:h}=await this._getUser(t.access_token);if(h)throw h;o={access_token:t.access_token,refresh_token:t.refresh_token,user:a.user,token_type:"bearer",expires_in:s-n,expires_at:s},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(Js(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var s;if(!t){const{data:l,error:a}=n;if(a)throw a;t=(s=l.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new Up;const{data:i,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{user:null,session:null},error:o}:i?{data:{user:i.user,session:i},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t,n){try{if(!gu())throw new yL("No browser detected.");if(t.error||t.error_description||t.error_code)throw new yL(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new Xwe("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new yL("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new Xwe("No code detected.");const{data:T,error:L}=await this._exchangeCodeForSession(t.code);if(L)throw L;const z=new URL(window.location.href);return z.searchParams.delete("code"),window.history.replaceState(window.history.state,"",z.toString()),{data:{session:T.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:l,expires_in:a,expires_at:h,token_type:p}=t;if(!o||!a||!l||!p)throw new yL("No session defined in URL");const x=Math.round(Date.now()/1e3),y=parseInt(a);let b=x+y;h&&(b=parseInt(h));const j=b-x;j*1e3<=g4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${j}s, should have been closer to ${y}s`);const N=b-y;x-N>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",N,b,x):x-N<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",N,b,x);const{data:C,error:A}=await this._getUser(o);if(A)throw A;const E={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:y,expires_at:b,refresh_token:l,token_type:p,user:C.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:E,redirectType:t.type},error:null}}catch(s){if(Js(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(t){return!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await a_(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{error:o};const l=(s=i.session)===null||s===void 0?void 0:s.access_token;if(l){const{error:a}=await this.admin.signOut(l,t);if(a&&!(ort(a)&&(a.status===404||a.status===401||a.status===403)))return{error:a}}return t!=="others"&&(await this._removeSession(),await i0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(t){const n=grt(),s={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:s}}}async _emitInitialSession(t){return await this._useSession(async n=>{var s,i;try{const{data:{session:o},error:l}=n;if(l)throw l;await((s=this.stateChangeEmitters.get(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let s=null,i=null;this.flowType==="pkce"&&([s,i]=await ZN(this.storage,this.storageKey,!0));try{return await Mi(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(Js(o))return{data:null,error:o};throw o}}async getUserIdentities(){var t;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:s,error:i}=await this._useSession(async o=>{var l,a,h,p,x;const{data:y,error:b}=o;if(b)throw b;const j=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(l=t.options)===null||l===void 0?void 0:l.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(h=t.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await Mi(this.fetch,"GET",j,{headers:this.headers,jwt:(x=(p=y.session)===null||p===void 0?void 0:p.access_token)!==null&&x!==void 0?x:void 0})});if(i)throw i;return gu()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:t.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(Js(s))return{data:{provider:t.provider,url:null},error:s};throw s}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var s;try{const{error:i,data:{session:o}}=n;if(i)throw i;const{options:l,provider:a,token:h,access_token:p,nonce:x}=t,y=await Mi(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=o==null?void 0:o.access_token)!==null&&s!==void 0?s:void 0,body:{provider:a,id_token:h,access_token:p,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:qp}),{data:b,error:j}=y;return j?{data:{user:null,session:null},error:j}:!b||!b.session||!b.user?{data:{user:null,session:null},error:new KN}:(b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("USER_UPDATED",b.session)),{data:b,error:j})}catch(i){if(Js(i))return{data:{user:null,session:null},error:i};throw i}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var s,i;const{data:o,error:l}=n;if(l)throw l;return await Mi(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await _rt(async i=>(i>0&&await vrt(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await Mi(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:qp})),(i,o)=>{const l=200*Math.pow(2,i);return o&&Lle(o)&&Date.now()+l-s{try{await a.callback(t,n)}catch(h){o.push(h)}});if(await Promise.all(l),o.length>0){for(let a=0;athis._autoRefreshTokenTick(),g4);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:s}}=n;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((s.expires_at*1e3-t)/g4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${g4}ms, refresh threshold is ${Que} ticks`),i<=Que&&await this._callRefreshToken(s.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t.isAcquireTimeout||t instanceof QIe)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!gu()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,s){const i=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&i.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&i.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[o,l]=await ZN(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(l)}`});i.push(a.toString())}if(s!=null&&s.queryParams){const o=new URLSearchParams(s.queryParams);i.push(o.toString())}return s!=null&&s.skipBrowserRedirect&&i.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${i.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;return o?{data:null,error:o}:await Mi(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _enroll(t){try{return await this._useSession(async n=>{var s,i;const{data:o,error:l}=n;if(l)return{data:null,error:l};const a=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:h,error:p}=await Mi(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return p?{data:null,error:p}:(t.factorType==="totp"&&h.type==="totp"&&(!((i=h==null?void 0:h.totp)===null||i===void 0)&&i.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),{data:h,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const l=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Yrt(t.webauthn.credential_response):Xrt(t.webauthn.credential_response)})}:{code:t.code}),{data:a,error:h}=await Mi(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});return h?{data:null,error:h}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),{data:a,error:h})})}catch(n){if(Js(n))return{data:null,error:n};throw n}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:i,error:o}=n;if(o)return{data:null,error:o};const l=await Mi(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=i==null?void 0:i.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:a}=l;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Krt(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Zrt(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Js(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(t){const{data:n,error:s}=await this._challenge({factorId:t.factorId});return s?{data:null,error:s}:await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:s}=await this.getUser();if(s)return{data:null,error:s};const i={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])i.all.push(o),o.status==="verified"&&i[o.factor_type].push(o);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:s},error:i}=await this.getSession();if(i)return{data:null,error:i};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ole(s.access_token);let l=null;o.aal&&(l=o.aal);let a=l;((n=(t=s.user.factors)===null||t===void 0?void 0:t.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(a="aal2");const p=o.amr||[];return{data:{currentLevel:l,nextLevel:a,currentAuthenticationMethods:p},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;return i?{data:null,error:i}:s?await Mi(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new Up}})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Up};const l=await Mi(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return l.data&&l.data.redirect_url&&gu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _denyAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:i},error:o}=s;if(o)return{data:null,error:o};if(!i)return{data:null,error:new Up};const l=await Mi(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return l.data&&l.data.redirect_url&&gu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async fetchJwk(t,n={keys:[]}){let s=n.keys.find(a=>a.kid===t);if(s)return s;const i=Date.now();if(s=this.jwks.keys.find(a=>a.kid===t),s&&this.jwks_cached_at+irt>i)return s;const{data:o,error:l}=await Mi(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(l)throw l;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=i,s=o.keys.find(a=>a.kid===t),!s)?null:s}async getClaims(t,n={}){try{let s=t;if(!s){const{data:j,error:N}=await this.getSession();if(N||!j.session)return{data:null,error:N};s=j.session.access_token}const{header:i,payload:o,signature:l,raw:{header:a,payload:h}}=Ole(s);n!=null&&n.allowExpired||Crt(o.exp);const p=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!p){const{error:j}=await this.getUser(s);if(j)throw j;return{data:{claims:o,header:i,signature:l},error:null}}const x=Mrt(i.alg),y=await crypto.subtle.importKey("jwk",p,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,prt(`${a}.${h}`)))throw new the("Invalid JWT signature");return{data:{claims:o,header:i,signature:l},error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}}JA.nextInstanceID=0;const ant=JA;class ont extends ant{constructor(t){super(t)}}class lnt{constructor(t,n,s){var i,o,l;this.supabaseUrl=t,this.supabaseKey=n;const a=ert(t);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);const h=`sb-${a.hostname.split(".")[0]}-auth-token`,p={db:Wtt,realtime:Ktt,auth:Object.assign(Object.assign({},Gtt),{storageKey:h}),global:Htt},x=Jtt(s??{},p);this.storageKey=(i=x.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(o=x.global.headers)!==null&&o!==void 0?o:{},x.accessToken?(this.accessToken=x.accessToken,this.auth=new Proxy({},{get:(y,b)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((l=x.auth)!==null&&l!==void 0?l:{},this.headers,x.global.fetch),this.fetch=Xtt(n,this._getAccessToken.bind(this),x.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},x.realtime)),this.rest=new ttt(new URL("rest/v1",a).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new Utt(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new Get(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,n={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,n,s)}channel(t,n={config:{}}){return this.realtime.channel(t,n)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t,n;if(this.accessToken)return await this.accessToken();const{data:s}=await this.auth.getSession();return(n=(t=s.session)===null||t===void 0?void 0:t.access_token)!==null&&n!==void 0?n:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,storageKey:l,flowType:a,lock:h,debug:p},x,y){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new ont({url:this.authUrl.href,headers:Object.assign(Object.assign({},b),x),storageKey:l,autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:i,userStorage:o,flowType:a,lock:h,debug:p,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(j=>j.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new ytt(this.realtimeUrl.href,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,s)=>{this._handleTokenChanged(n,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(t,n,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const cnt=(e,t,n)=>new lnt(e,t,n);function dnt(){if(typeof window<"u"||typeof process>"u")return!1;const e=process.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}dnt()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const unt="https://relzejiswnotikjgvjhz.supabase.co",hnt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",J=cnt(unt,hnt,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),tPe=I.createContext(void 0),fnt=({children:e})=>{const[t,n]=I.useState(null),[s,i]=I.useState(null),[o,l]=I.useState(!0),[a,h]=I.useState(!1),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,N]=I.useState([]),[C,A]=I.useState(null),E=ns(),T=async q=>{try{console.log("Checking roles via RPC for user:",q);const[{data:H,error:K},{data:Z,error:te}]=await Promise.all([J.rpc("has_role",{_user_id:q,_role:"admin"}),J.rpc("has_role",{_user_id:q,_role:"brokerage_manager"})]);if(K||te)console.error("Role RPC errors:",{isAdminError:K,isBrokerError:te}),h(!1),x(!1);else{const ve=!!H,ne=!!Z;console.log("RPC roles result:",{adminValue:ve,brokerValue:ne}),h(ve),x(ne)}const{data:ae,error:le}=await J.from("profiles").select("brokerage_id").eq("id",q).single();if(b(!le&&ae?ae.brokerage_id:null),Z){console.log("Fetching managed brokerages for user:",q);const{data:ve,error:ne}=await J.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",q);if(console.log("Managed brokerage assignments result:",{assignments:ve,assignmentsError:ne}),ne||!ve){console.error("Error fetching managed brokerage assignments:",ne),N([]);return}const ge=Array.from(new Set(ve.map(ye=>ye.brokerage_id).filter(Boolean)));if(ge.length===0){N([]);return}const{data:ie,error:fe}=await J.from("brokerages").select("id, name").in("id",ge);if(console.log("Managed brokerages details result:",{brokeragesData:ie,brokeragesError:fe}),fe||!ie){console.error("Error fetching managed brokerages details:",fe),N([]);return}const de=ie.map(ye=>({id:ye.id,name:ye.name})).sort((ye,Ie)=>ge.indexOf(ye.id)-ge.indexOf(Ie.id));console.log("Parsed managed brokerages:",de),N(de),de.length>0&&!C&&A(de[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),N([])}catch(H){console.error("Unexpected error in checkRoles:",H),h(!1),x(!1),b(null),N([])}};I.useEffect(()=>{const{data:{subscription:q}}=J.auth.onAuthStateChange((H,K)=>{console.log("Auth event:",H),i(K),n((K==null?void 0:K.user)??null),H==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{E("/profile?reset=true")},100)),K!=null&&K.user?setTimeout(()=>{T(K.user.id)},0):(h(!1),x(!1),b(null),N([]),A(null))});return J.auth.getSession().then(({data:{session:H}})=>{i(H),n((H==null?void 0:H.user)??null),H!=null&&H.user?T(H.user.id).finally(()=>{l(!1)}):l(!1)}),()=>q.unsubscribe()},[]);const L=async(q,H)=>{const{error:K}=await J.auth.signInWithPassword({email:q,password:H});if(K)throw ze.error(K.message),K;ze.success("Welcome back!"),E("/dashboard")},z=async(q,H,K)=>{const Z=`${window.location.origin}/dashboard`,{error:te}=await J.auth.signUp({email:q,password:H,options:{emailRedirectTo:Z,data:{name:K}}});if(te)throw ze.error(te.message),te;ze.success("Account created! Welcome to LevelUp."),E("/dashboard")},F=async()=>{try{const{data:{session:q}}=await J.auth.getSession();if(q){const{error:H}=await J.auth.signOut();H?H.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",H.message):(console.error("Sign out error:",H),ze.error(H.message)):ze.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),i(null),h(!1),x(!1),b(null),N([]),A(null),E("/auth")}catch(q){console.error("Unexpected sign out error:",q),E("/auth")}};return r.jsx(tPe.Provider,{value:{user:t,session:s,loading:o,signIn:L,signUp:z,signOut:F,isAdmin:a,isBrokerageManager:p,brokerageId:y,managedBrokerages:j,selectedBrokerageId:C,setSelectedBrokerageId:A},children:e})},zr=()=>{const e=I.useContext(tPe);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},rPe=I.createContext(void 0),JN="levelup_admin_session",o_="levelup_impersonation",pnt=({children:e})=>{const[t,n]=I.useState(!1),[s,i]=I.useState(null),[o,l]=I.useState(!1);I.useEffect(()=>{const p=sessionStorage.getItem(o_);if(p)try{const x=JSON.parse(p);n(!0),i(x)}catch{sessionStorage.removeItem(o_)}},[]);const a=async p=>{l(!0);try{const{data:{session:x}}=await J.auth.getSession();if(!x)return ze.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(JN,JSON.stringify(y));const b=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x.access_token}`},body:JSON.stringify({targetUserId:p})}),j=await b.json();if(!b.ok)throw new Error(j.error||"Failed to impersonate user");const N={id:j.targetUser.id,name:j.targetUser.name,email:j.targetUser.email};sessionStorage.setItem(o_,JSON.stringify(N));const{error:C}=await J.auth.verifyOtp({token_hash:j.token_hash,type:"magiclink"});if(C)throw console.error("Verify OTP error:",C),sessionStorage.removeItem(JN),sessionStorage.removeItem(o_),new Error("Failed to establish impersonation session");return n(!0),i(N),ze.success(`Now viewing as ${N.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),ze.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(JN),sessionStorage.removeItem(o_),!1}finally{l(!1)}},h=async()=>{l(!0);try{const p=sessionStorage.getItem(JN);if(!p){await J.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(p);await J.auth.signOut();const{error:y}=await J.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(JN),sessionStorage.removeItem(o_),y){console.error("Failed to restore admin session:",y),ze.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),i(null),ze.success("Returned to admin account"),window.location.href="/admin/members"}catch(p){console.error("Stop impersonation error:",p),ze.error("Failed to restore admin session"),sessionStorage.removeItem(JN),sessionStorage.removeItem(o_),window.location.href="/auth"}finally{l(!1)}};return r.jsx(rPe.Provider,{value:{isImpersonating:t,impersonatedUser:s,startImpersonation:a,stopImpersonation:h,isLoading:o},children:e})},nPe=()=>{const e=I.useContext(rPe);if(e===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return e},eE=XC("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-full px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ee=I.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...i},o)=>{const l=s?Ume:"button";return r.jsx(l,{className:$t(eE({variant:t,size:n,className:e})),ref:o,...i})});ee.displayName="Button";const mnt=()=>{const{isImpersonating:e,impersonatedUser:t,stopImpersonation:n,isLoading:s}=nPe();return!e||!t?null:r.jsx("div",{className:"fixed top-0 left-0 right-0 z-[100] bg-amber-500 text-amber-950 px-4 py-2 shadow-lg",children:r.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Bh,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("span",{className:"font-medium text-sm md:text-base",children:[r.jsx("span",{className:"hidden sm:inline",children:"You are viewing as "}),r.jsx("strong",{children:t.name}),r.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",t.email,")"]})]})]}),r.jsx(ee,{size:"sm",variant:"secondary",onClick:n,disabled:s,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:s?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(bs,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Exit Impersonation"}),r.jsx("span",{className:"sm:hidden",children:"Exit"})]})})]})})},Sn=({children:e,requireAdmin:t=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:i,isAdmin:o,isBrokerageManager:l}=zr();return i?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading..."})]})}):s?t&&!o?r.jsx(nee,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(nee,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:e}):r.jsx(nee,{to:"/auth",replace:!0})};var jge={};(function e(t,n,s,i){var o=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),l=typeof Path2D=="function"&&typeof DOMMatrix=="function",a=function(){if(!t.OffscreenCanvas)return!1;try{var Ie=new OffscreenCanvas(1,1),Ne=Ie.getContext("2d");Ne.fillRect(0,0,1,1);var we=Ie.transferToImageBitmap();Ne.createPattern(we,"no-repeat")}catch{return!1}return!0}();function h(){}function p(Ie){var Ne=n.exports.Promise,we=Ne!==void 0?Ne:t.Promise;return typeof we=="function"?new we(Ie):(Ie(h,h),null)}var x=function(Ie,Ne){return{transform:function(we){if(Ie)return we;if(Ne.has(we))return Ne.get(we);var he=new OffscreenCanvas(we.width,we.height),xe=he.getContext("2d");return xe.drawImage(we,0,0),Ne.set(we,he),he},clear:function(){Ne.clear()}}}(a,new Map),y=function(){var Ie=Math.floor(16.666666666666668),Ne,we,he={},xe=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(Ne=function(be){var Oe=Math.random();return he[Oe]=requestAnimationFrame(function Te(Ve){xe===Ve||xe+Ie-1{const{data:t,error:n}=await J.from("celebration_queue").select("*").eq("user_id",e.id).is("seen_at",null).order("created_at",{ascending:!0});if(n)throw n;return t},enabled:!!(e!=null&&e.id),refetchOnWindowFocus:!0,staleTime:0})}function xnt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}function ynt(){const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await J.from("celebration_queue").insert({user_id:n.user_id,celebration_type:n.celebration_type,title:n.title,message:n.message||null,points_amount:n.points_amount||null,created_by:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}var Fle="focusScope.autoFocusOnMount",zle="focusScope.autoFocusOnUnmount",dje={bubbles:!1,cancelable:!0},vnt="FocusScope",vI=I.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...l}=e,[a,h]=I.useState(null),p=Kl(i),x=Kl(o),y=I.useRef(null),b=ei(t,C=>h(C)),j=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(s){let C=function(L){if(j.paused||!a)return;const z=L.target;a.contains(z)?y.current=z:c0(y.current,{select:!0})},A=function(L){if(j.paused||!a)return;const z=L.relatedTarget;z!==null&&(a.contains(z)||c0(y.current,{select:!0}))},E=function(L){if(document.activeElement===document.body)for(const F of L)F.removedNodes.length>0&&c0(a)};document.addEventListener("focusin",C),document.addEventListener("focusout",A);const T=new MutationObserver(E);return a&&T.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",A),T.disconnect()}}},[s,a,j.paused]),I.useEffect(()=>{if(a){hje.add(j);const C=document.activeElement;if(!a.contains(C)){const E=new CustomEvent(Fle,dje);a.addEventListener(Fle,p),a.dispatchEvent(E),E.defaultPrevented||(_nt(Nnt(sPe(a)),{select:!0}),document.activeElement===C&&c0(a))}return()=>{a.removeEventListener(Fle,p),setTimeout(()=>{const E=new CustomEvent(zle,dje);a.addEventListener(zle,x),a.dispatchEvent(E),E.defaultPrevented||c0(C??document.body,{select:!0}),a.removeEventListener(zle,x),hje.remove(j)},0)}}},[a,p,x,j]);const N=I.useCallback(C=>{if(!n&&!s||j.paused)return;const A=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,E=document.activeElement;if(A&&E){const T=C.currentTarget,[L,z]=bnt(T);L&&z?!C.shiftKey&&E===z?(C.preventDefault(),n&&c0(L,{select:!0})):C.shiftKey&&E===L&&(C.preventDefault(),n&&c0(z,{select:!0})):E===T&&C.preventDefault()}},[n,s,j.paused]);return r.jsx(Rn.div,{tabIndex:-1,...l,ref:b,onKeyDown:N})});vI.displayName=vnt;function _nt(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(c0(s,{select:t}),document.activeElement!==n)return}function bnt(e){const t=sPe(e),n=uje(t,e),s=uje(t.reverse(),e);return[n,s]}function sPe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function uje(e,t){for(const n of e)if(!wnt(n,{upTo:t}))return n}function wnt(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function jnt(e){return e instanceof HTMLInputElement&&"select"in e}function c0(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&jnt(e)&&t&&e.select()}}var hje=knt();function knt(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=fje(e,t),e.unshift(t)},remove(t){var n;e=fje(e,t),(n=e[0])==null||n.resume()}}}function fje(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Nnt(e){return e.filter(t=>t.tagName!=="A")}var Ble=0;function $ne(){I.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??pje()),document.body.insertAdjacentElement("beforeend",e[1]??pje()),Ble++,()=>{Ble===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ble--}},[])}function pje(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var aee="right-scroll-bar-position",oee="width-before-scroll-bar",Snt="with-scroll-bars-hidden",Cnt="--removed-body-scroll-bar-size";function $le(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mnt(e,t){var n=I.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=t,n.facade}var Tnt=typeof window<"u"?I.useLayoutEffect:I.useEffect,mje=new WeakMap;function Ant(e,t){var n=Mnt(null,function(s){return e.forEach(function(i){return $le(i,s)})});return Tnt(function(){var s=mje.get(n);if(s){var i=new Set(s),o=new Set(e),l=n.current;i.forEach(function(a){o.has(a)||$le(a,null)}),o.forEach(function(a){i.has(a)||$le(a,l)})}mje.set(n,e)},[e]),n}function Ent(e){return e}function Int(e,t){t===void 0&&(t=Ent);var n=[],s=!1,i={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var l=t(o,s);return n.push(l),function(){n=n.filter(function(a){return a!==l})}},assignSyncMedium:function(o){for(s=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(a){return o(a)},filter:function(){return n}}},assignMedium:function(o){s=!0;var l=[];if(n.length){var a=n;n=[],a.forEach(o),l=n}var h=function(){var x=l;l=[],x.forEach(o)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(x){l.push(x),p()},filter:function(x){return l=l.filter(x),n}}}};return i}function Pnt(e){e===void 0&&(e={});var t=Int(null);return t.options=Rf({async:!0,ssr:!1},e),t}var iPe=function(e){var t=e.sideCar,n=rv(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return I.createElement(s,Rf({},n))};iPe.isSideCarExport=!0;function Lnt(e,t){return e.useMedium(t),iPe}var aPe=Pnt(),Ule=function(){},Une=I.forwardRef(function(e,t){var n=I.useRef(null),s=I.useState({onScrollCapture:Ule,onWheelCapture:Ule,onTouchMoveCapture:Ule}),i=s[0],o=s[1],l=e.forwardProps,a=e.children,h=e.className,p=e.removeScrollBar,x=e.enabled,y=e.shards,b=e.sideCar,j=e.noRelative,N=e.noIsolation,C=e.inert,A=e.allowPinchZoom,E=e.as,T=E===void 0?"div":E,L=e.gapMode,z=rv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=b,q=Ant([n,t]),H=Rf(Rf({},z),i);return I.createElement(I.Fragment,null,x&&I.createElement(F,{sideCar:aPe,removeScrollBar:p,shards:y,noRelative:j,noIsolation:N,inert:C,setCallbacks:o,allowPinchZoom:!!A,lockRef:n,gapMode:L}),l?I.cloneElement(I.Children.only(a),Rf(Rf({},H),{ref:q})):I.createElement(T,Rf({},H,{className:h,ref:q}),a))});Une.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Une.classNames={fullWidth:oee,zeroRight:aee};var Ont=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Dnt(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ont();return t&&e.setAttribute("nonce",t),e}function Rnt(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Fnt(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var znt=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Dnt())&&(Rnt(t,n),Fnt(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Bnt=function(){var e=znt();return function(t,n){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},oPe=function(){var e=Bnt(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},$nt={left:0,top:0,right:0,gap:0},qle=function(e){return parseInt(e||"",10)||0},Unt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[qle(n),qle(s),qle(i)]},qnt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return $nt;var t=Unt(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},Vnt=oPe(),kS="data-scroll-locked",Hnt=function(e,t,n,s){var i=e.left,o=e.top,l=e.right,a=e.gap;return n===void 0&&(n="margin"),` .`.concat(Snt,` { overflow: hidden `).concat(s,`; padding-right: `).concat(a,"px ").concat(s,`; } body[`).concat(kS,`] { overflow: hidden `).concat(s,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&` padding-left: `.concat(i,`px; padding-top: `).concat(o,`px; padding-right: `).concat(l,`px; margin-left:0; margin-top:0; margin-right: `).concat(a,"px ").concat(s,`; `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(s,";")].filter(Boolean).join(""),` } .`).concat(aee,` { right: `).concat(a,"px ").concat(s,`; } .`).concat(oee,` { margin-right: `).concat(a,"px ").concat(s,`; } .`).concat(aee," .").concat(aee,` { right: 0 `).concat(s,`; } .`).concat(oee," .").concat(oee,` { margin-right: 0 `).concat(s,`; } body[`).concat(kS,`] { `).concat(Cnt,": ").concat(a,`px; } `)},gje=function(){var e=parseInt(document.body.getAttribute(kS)||"0",10);return isFinite(e)?e:0},Wnt=function(){I.useEffect(function(){return document.body.setAttribute(kS,(gje()+1).toString()),function(){var e=gje()-1;e<=0?document.body.removeAttribute(kS):document.body.setAttribute(kS,e.toString())}},[])},Gnt=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;Wnt();var o=I.useMemo(function(){return qnt(i)},[i]);return I.createElement(Vnt,{styles:Hnt(o,!t,i,n?"":"!important")})},rhe=!1;if(typeof window<"u")try{var vL=Object.defineProperty({},"passive",{get:function(){return rhe=!0,!0}});window.addEventListener("test",vL,vL),window.removeEventListener("test",vL,vL)}catch{rhe=!1}var e4=rhe?{passive:!1}:!1,Knt=function(e){return e.tagName==="TEXTAREA"},lPe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Knt(e)&&n[t]==="visible")},Znt=function(e){return lPe(e,"overflowY")},Ynt=function(e){return lPe(e,"overflowX")},xje=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=cPe(e,s);if(i){var o=dPe(e,s),l=o[1],a=o[2];if(l>a)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Xnt=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Qnt=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},cPe=function(e,t){return e==="v"?Znt(t):Ynt(t)},dPe=function(e,t){return e==="v"?Xnt(t):Qnt(t)},Jnt=function(e,t){return e==="h"&&t==="rtl"?-1:1},est=function(e,t,n,s,i){var o=Jnt(e,window.getComputedStyle(t).direction),l=o*s,a=n.target,h=t.contains(a),p=!1,x=l>0,y=0,b=0;do{if(!a)break;var j=dPe(e,a),N=j[0],C=j[1],A=j[2],E=C-A-o*N;(N||E)&&cPe(e,a)&&(y+=E,b+=N);var T=a.parentNode;a=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&a!==document.body||h&&(t.contains(a)||t===a));return(x&&Math.abs(y)<1||!x&&Math.abs(b)<1)&&(p=!0),p},_L=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},yje=function(e){return[e.deltaX,e.deltaY]},vje=function(e){return e&&"current"in e?e.current:e},tst=function(e,t){return e[0]===t[0]&&e[1]===t[1]},rst=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},nst=0,t4=[];function sst(e){var t=I.useRef([]),n=I.useRef([0,0]),s=I.useRef(),i=I.useState(nst++)[0],o=I.useState(oPe)[0],l=I.useRef(e);I.useEffect(function(){l.current=e},[e]),I.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var C=pge([e.lockRef.current],(e.shards||[]).map(vje),!0).filter(Boolean);return C.forEach(function(A){return A.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),C.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=I.useCallback(function(C,A){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!l.current.allowPinchZoom;var E=_L(C),T=n.current,L="deltaX"in C?C.deltaX:T[0]-E[0],z="deltaY"in C?C.deltaY:T[1]-E[1],F,q=C.target,H=Math.abs(L)>Math.abs(z)?"h":"v";if("touches"in C&&H==="h"&&q.type==="range")return!1;var K=xje(H,q);if(!K)return!0;if(K?F=H:(F=H==="v"?"h":"v",K=xje(H,q)),!K)return!1;if(!s.current&&"changedTouches"in C&&(L||z)&&(s.current=F),!F)return!0;var Z=s.current||F;return est(Z,A,C,Z==="h"?L:z)},[]),h=I.useCallback(function(C){var A=C;if(!(!t4.length||t4[t4.length-1]!==o)){var E="deltaY"in A?yje(A):_L(A),T=t.current.filter(function(F){return F.name===A.type&&(F.target===A.target||A.target===F.shadowParent)&&tst(F.delta,E)})[0];if(T&&T.should){A.cancelable&&A.preventDefault();return}if(!T){var L=(l.current.shards||[]).map(vje).filter(Boolean).filter(function(F){return F.contains(A.target)}),z=L.length>0?a(A,L[0]):!l.current.noIsolation;z&&A.cancelable&&A.preventDefault()}}},[]),p=I.useCallback(function(C,A,E,T){var L={name:C,delta:A,target:E,should:T,shadowParent:ist(E)};t.current.push(L),setTimeout(function(){t.current=t.current.filter(function(z){return z!==L})},1)},[]),x=I.useCallback(function(C){n.current=_L(C),s.current=void 0},[]),y=I.useCallback(function(C){p(C.type,yje(C),C.target,a(C,e.lockRef.current))},[]),b=I.useCallback(function(C){p(C.type,_L(C),C.target,a(C,e.lockRef.current))},[]);I.useEffect(function(){return t4.push(o),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:b}),document.addEventListener("wheel",h,e4),document.addEventListener("touchmove",h,e4),document.addEventListener("touchstart",x,e4),function(){t4=t4.filter(function(C){return C!==o}),document.removeEventListener("wheel",h,e4),document.removeEventListener("touchmove",h,e4),document.removeEventListener("touchstart",x,e4)}},[]);var j=e.removeScrollBar,N=e.inert;return I.createElement(I.Fragment,null,N?I.createElement(o,{styles:rst(i)}):null,j?I.createElement(Gnt,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ist(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ast=Lnt(aPe,sst);var _I=I.forwardRef(function(e,t){return I.createElement(Une,Rf({},e,{ref:t,sideCar:ast}))});_I.classNames=Une.classNames;var ost=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},r4=new WeakMap,bL=new WeakMap,wL={},Vle=0,uPe=function(e){return e&&(e.host||uPe(e.parentNode))},lst=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=uPe(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},cst=function(e,t,n,s){var i=lst(t,Array.isArray(e)?e:[e]);wL[n]||(wL[n]=new WeakMap);var o=wL[n],l=[],a=new Set,h=new Set(i),p=function(y){!y||a.has(y)||(a.add(y),p(y.parentNode))};i.forEach(p);var x=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(b){if(a.has(b))x(b);else try{var j=b.getAttribute(s),N=j!==null&&j!=="false",C=(r4.get(b)||0)+1,A=(o.get(b)||0)+1;r4.set(b,C),o.set(b,A),l.push(b),C===1&&N&&bL.set(b,!0),A===1&&b.setAttribute(n,"true"),N||b.setAttribute(s,"true")}catch(E){console.error("aria-hidden: cannot operate on ",b,E)}})};return x(t),a.clear(),Vle++,function(){l.forEach(function(y){var b=r4.get(y)-1,j=o.get(y)-1;r4.set(y,b),o.set(y,j),b||(bL.has(y)||y.removeAttribute(s),bL.delete(y)),j||y.removeAttribute(n)}),Vle--,Vle||(r4=new WeakMap,r4=new WeakMap,bL=new WeakMap,wL={})}},qne=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=ost(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live]"))),cst(s,i,n,"aria-hidden")):function(){return null}},Vne="Dialog",[hPe,fPe]=Ql(Vne),[dst,Sm]=hPe(Vne),pPe=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,a=I.useRef(null),h=I.useRef(null),[p,x]=Ou({prop:s,defaultProp:i??!1,onChange:o,caller:Vne});return r.jsx(dst,{scope:t,triggerRef:a,contentRef:h,contentId:Vc(),titleId:Vc(),descriptionId:Vc(),open:p,onOpenChange:x,onOpenToggle:I.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};pPe.displayName=Vne;var mPe="DialogTrigger",gPe=I.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Sm(mPe,n),o=ei(t,i.triggerRef);return r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Sge(i.open),...s,ref:o,onClick:cn(e.onClick,i.onOpenToggle)})});gPe.displayName=mPe;var kge="DialogPortal",[ust,xPe]=hPe(kge,{forceMount:void 0}),yPe=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:i}=e,o=Sm(kge,t);return r.jsx(ust,{scope:t,forceMount:n,children:I.Children.map(s,l=>r.jsx(pc,{present:n||o.open,children:r.jsx(YC,{asChild:!0,container:i,children:l})}))})};yPe.displayName=kge;var tte="DialogOverlay",vPe=I.forwardRef((e,t)=>{const n=xPe(tte,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,o=Sm(tte,e.__scopeDialog);return o.modal?r.jsx(pc,{present:s||o.open,children:r.jsx(fst,{...i,ref:t})}):null});vPe.displayName=tte;var hst=D1("DialogOverlay.RemoveScroll"),fst=I.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Sm(tte,n);return r.jsx(_I,{as:hst,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(Rn.div,{"data-state":Sge(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Fj="DialogContent",_Pe=I.forwardRef((e,t)=>{const n=xPe(Fj,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,o=Sm(Fj,e.__scopeDialog);return r.jsx(pc,{present:s||o.open,children:o.modal?r.jsx(pst,{...i,ref:t}):r.jsx(mst,{...i,ref:t})})});_Pe.displayName=Fj;var pst=I.forwardRef((e,t)=>{const n=Sm(Fj,e.__scopeDialog),s=I.useRef(null),i=ei(t,n.contentRef,s);return I.useEffect(()=>{const o=s.current;if(o)return qne(o)},[]),r.jsx(bPe,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cn(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:cn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0;(l.button===2||a)&&o.preventDefault()}),onFocusOutside:cn(e.onFocusOutside,o=>o.preventDefault())})}),mst=I.forwardRef((e,t)=>{const n=Sm(Fj,e.__scopeDialog),s=I.useRef(!1),i=I.useRef(!1);return r.jsx(bPe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var h,p;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),bPe=I.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,...l}=e,a=Sm(Fj,n),h=I.useRef(null),p=ei(t,h);return $ne(),r.jsxs(r.Fragment,{children:[r.jsx(vI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(ev,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Sge(a.open),...l,ref:p,onDismiss:()=>a.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(xst,{titleId:a.titleId}),r.jsx(vst,{contentRef:h,descriptionId:a.descriptionId})]})]})}),Nge="DialogTitle",wPe=I.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Sm(Nge,n);return r.jsx(Rn.h2,{id:i.titleId,...s,ref:t})});wPe.displayName=Nge;var jPe="DialogDescription",kPe=I.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Sm(jPe,n);return r.jsx(Rn.p,{id:i.descriptionId,...s,ref:t})});kPe.displayName=jPe;var NPe="DialogClose",SPe=I.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Sm(NPe,n);return r.jsx(Rn.button,{type:"button",...s,ref:t,onClick:cn(e.onClick,()=>i.onOpenChange(!1))})});SPe.displayName=NPe;function Sge(e){return e?"open":"closed"}var CPe="DialogTitleWarning",[gst,MPe]=OKe(CPe,{contentName:Fj,titleName:Nge,docsSlug:"dialog"}),xst=({titleId:e})=>{const t=MPe(CPe),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return I.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},yst="DialogDescriptionWarning",vst=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${MPe(yst).contentName}}.`;return I.useEffect(()=>{var o;const i=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Hne=pPe,Cge=gPe,Wne=yPe,l3=vPe,c3=_Pe,bI=wPe,wI=kPe,Gne=SPe;const Br=Hne,zo=Cge,_st=Wne,TPe=I.forwardRef(({className:e,...t},n)=>r.jsx(l3,{ref:n,className:$t("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",e),...t}));TPe.displayName=l3.displayName;const Fr=I.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(_st,{children:[r.jsx(TPe,{}),r.jsxs(c3,{ref:s,className:$t("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",e),...n,children:[t,r.jsxs(Gne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(bs,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Fr.displayName=c3.displayName;const Hr=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Hr.displayName="DialogHeader";const ri=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ri.displayName="DialogFooter";const qr=I.forwardRef(({className:e,...t},n)=>r.jsx(bI,{ref:n,className:$t("text-lg font-semibold leading-none tracking-tight",e),...t}));qr.displayName=bI.displayName;const es=I.forwardRef(({className:e,...t},n)=>r.jsx(wI,{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));es.displayName=wI.displayName;const bst={points_earned:Wa,listing_created:fi,deal_closed:ud,custom:vs},_je={points_earned:"from-amber-500 to-orange-500",listing_created:"from-emerald-500 to-teal-500",deal_closed:"from-green-500 to-emerald-500",custom:"from-purple-500 to-pink-500"};function wst(){const{user:e}=zr(),t=Wr(),{data:n}=gnt(),s=xnt(),[i,o]=I.useState(null),[l,a]=I.useState(!1),h=I.useCallback(()=>{const j=Date.now()+3e3,N={startVelocity:30,spread:360,ticks:60,zIndex:9999},C=(E,T)=>Math.random()*(T-E)+E,A=setInterval(()=>{const E=j-Date.now();if(E<=0){clearInterval(A);return}const T=50*(E/3e3);cje({...N,particleCount:T,origin:{x:C(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),cje({...N,particleCount:T,origin:{x:C(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);I.useEffect(()=>{n&&n.length>0&&!i&&(o(n[0]),a(!0),setTimeout(h,100))},[n,i,h]);const p=async()=>{if(i){const b=i.id;a(!1),o(null),t.setQueryData(["celebrations","pending",e==null?void 0:e.id],j=>(j==null?void 0:j.filter(N=>N.id!==b))??[]),await s.mutateAsync(b)}};if(!i)return null;const x=bst[i.celebration_type]||vs,y=_je[i.celebration_type]||_je.custom;return r.jsx(Br,{open:l,onOpenChange:b=>!b&&p(),children:r.jsxs(Fr,{className:"sm:max-w-md text-center border-0 overflow-hidden",children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${y} opacity-10`}),r.jsxs("div",{className:"relative z-10 py-6",children:[r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:`w-20 h-20 rounded-full bg-gradient-to-br ${y} flex items-center justify-center animate-bounce`,children:r.jsx(x,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"flex justify-center gap-1 mb-4",children:[r.jsx(Cs,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Cs,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Cs,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-150"})]}),r.jsxs("h2",{className:"text-2xl font-bold mb-2 bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent",children:["🎉 ",i.title]}),i.points_amount&&i.points_amount>0&&r.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",i.points_amount," points!"]}),i.message&&r.jsx("p",{className:"text-muted-foreground mb-6",children:i.message}),r.jsx(ee,{onClick:p,className:"w-full",size:"lg",children:"Awesome! 🙌"}),n&&n.length>1&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-3",children:["+",n.length-1," more celebration",n.length>2?"s":""," waiting"]})]})]})})}const tE="/assets/levelup-logo-color-D3mY9gCJ.png",Mge="/assets/levelup-logo-white-C2RAgAoG.png",jst="/assets/listings-hero-BI9Ki9Dq.jpg",at=I.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:$t("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));at.displayName="Input";const kst=XC("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Rt({className:e,variant:t,...n}){return r.jsx("div",{className:$t(kst({variant:t}),e),...n})}function Pr({className:e,...t}){return r.jsx("div",{className:$t("animate-pulse rounded-md bg-muted",e),...t})}function rE(e,[t,n]){return Math.min(n,Math.max(t,e))}var Nst=I.createContext(void 0);function sk(e){const t=I.useContext(Nst);return e||t||"ltr"}function jI(e){const t=I.useRef({value:e,previous:e});return I.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Sst=[" ","Enter","ArrowUp","ArrowDown"],Cst=[" ","Enter"],zj="Select",[Kne,Zne,Mst]=dI(zj),[d3]=Ql(zj,[Mst,zg]),Yne=zg(),[Tst,sv]=d3(zj),[Ast,Est]=d3(zj),APe=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:i,onOpenChange:o,value:l,defaultValue:a,onValueChange:h,dir:p,name:x,autoComplete:y,disabled:b,required:j,form:N}=e,C=Yne(t),[A,E]=I.useState(null),[T,L]=I.useState(null),[z,F]=I.useState(!1),q=sk(p),[H,K]=Ou({prop:s,defaultProp:i??!1,onChange:o,caller:zj}),[Z,te]=Ou({prop:l,defaultProp:a,onChange:h,caller:zj}),ae=I.useRef(null),le=A?N||!!A.closest("form"):!0,[ve,ne]=I.useState(new Set),ge=Array.from(ve).map(ie=>ie.props.value).join(";");return r.jsx(pI,{...C,children:r.jsxs(Tst,{required:j,scope:t,trigger:A,onTriggerChange:E,valueNode:T,onValueNodeChange:L,valueNodeHasChildren:z,onValueNodeHasChildrenChange:F,contentId:Vc(),value:Z,onValueChange:te,open:H,onOpenChange:K,dir:q,triggerPointerDownPosRef:ae,disabled:b,children:[r.jsx(Kne.Provider,{scope:t,children:r.jsx(Ast,{scope:e.__scopeSelect,onNativeOptionAdd:I.useCallback(ie=>{ne(fe=>new Set(fe).add(ie))},[]),onNativeOptionRemove:I.useCallback(ie=>{ne(fe=>{const de=new Set(fe);return de.delete(ie),de})},[]),children:n})}),le?r.jsxs(e6e,{"aria-hidden":!0,required:j,tabIndex:-1,name:x,autoComplete:y,value:Z,onChange:ie=>te(ie.target.value),disabled:b,form:N,children:[Z===void 0?r.jsx("option",{value:""}):null,Array.from(ve)]},ge):null]})})};APe.displayName=zj;var EPe="SelectTrigger",IPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...i}=e,o=Yne(n),l=sv(EPe,n),a=l.disabled||s,h=ei(t,l.onTriggerChange),p=Zne(n),x=I.useRef("touch"),[y,b,j]=r6e(C=>{const A=p().filter(L=>!L.disabled),E=A.find(L=>L.value===l.value),T=n6e(A,C,E);T!==void 0&&l.onValueChange(T.value)}),N=C=>{a||(l.onOpenChange(!0),j()),C&&(l.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return r.jsx(t3,{asChild:!0,...o,children:r.jsx(Rn.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":t6e(l.value)?"":void 0,...i,ref:h,onClick:cn(i.onClick,C=>{C.currentTarget.focus(),x.current!=="mouse"&&N(C)}),onPointerDown:cn(i.onPointerDown,C=>{x.current=C.pointerType;const A=C.target;A.hasPointerCapture(C.pointerId)&&A.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(N(C),C.preventDefault())}),onKeyDown:cn(i.onKeyDown,C=>{const A=y.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&b(C.key),!(A&&C.key===" ")&&Sst.includes(C.key)&&(N(),C.preventDefault())})})})});IPe.displayName=EPe;var PPe="SelectValue",LPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:i,children:o,placeholder:l="",...a}=e,h=sv(PPe,n),{onValueNodeHasChildrenChange:p}=h,x=o!==void 0,y=ei(t,h.onValueNodeChange);return Yl(()=>{p(x)},[p,x]),r.jsx(Rn.span,{...a,ref:y,style:{pointerEvents:"none"},children:t6e(h.value)?r.jsx(r.Fragment,{children:l}):o})});LPe.displayName=PPe;var Ist="SelectIcon",OPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...i}=e;return r.jsx(Rn.span,{"aria-hidden":!0,...i,ref:t,children:s||"▼"})});OPe.displayName=Ist;var Pst="SelectPortal",DPe=e=>r.jsx(YC,{asChild:!0,...e});DPe.displayName=Pst;var Bj="SelectContent",RPe=I.forwardRef((e,t)=>{const n=sv(Bj,e.__scopeSelect),[s,i]=I.useState();if(Yl(()=>{i(new DocumentFragment)},[]),!n.open){const o=s;return o?py.createPortal(r.jsx(FPe,{scope:e.__scopeSelect,children:r.jsx(Kne.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(zPe,{...e,ref:t})});RPe.displayName=Bj;var Hp=10,[FPe,iv]=d3(Bj),Lst="SelectContentImpl",Ost=D1("SelectContent.RemoveScroll"),zPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:l,side:a,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:b,collisionPadding:j,sticky:N,hideWhenDetached:C,avoidCollisions:A,...E}=e,T=sv(Bj,n),[L,z]=I.useState(null),[F,q]=I.useState(null),H=ei(t,Te=>z(Te)),[K,Z]=I.useState(null),[te,ae]=I.useState(null),le=Zne(n),[ve,ne]=I.useState(!1),ge=I.useRef(!1);I.useEffect(()=>{if(L)return qne(L)},[L]),$ne();const ie=I.useCallback(Te=>{const[Ve,...Fe]=le().map(Ee=>Ee.ref.current),[Me]=Fe.slice(-1),Qe=document.activeElement;for(const Ee of Te)if(Ee===Qe||(Ee==null||Ee.scrollIntoView({block:"nearest"}),Ee===Ve&&F&&(F.scrollTop=0),Ee===Me&&F&&(F.scrollTop=F.scrollHeight),Ee==null||Ee.focus(),document.activeElement!==Qe))return},[le,F]),fe=I.useCallback(()=>ie([K,L]),[ie,K,L]);I.useEffect(()=>{ve&&fe()},[ve,fe]);const{onOpenChange:de,triggerPointerDownPosRef:ye}=T;I.useEffect(()=>{if(L){let Te={x:0,y:0};const Ve=Me=>{var Qe,Ee;Te={x:Math.abs(Math.round(Me.pageX)-(((Qe=ye.current)==null?void 0:Qe.x)??0)),y:Math.abs(Math.round(Me.pageY)-(((Ee=ye.current)==null?void 0:Ee.y)??0))}},Fe=Me=>{Te.x<=10&&Te.y<=10?Me.preventDefault():L.contains(Me.target)||de(!1),document.removeEventListener("pointermove",Ve),ye.current=null};return ye.current!==null&&(document.addEventListener("pointermove",Ve),document.addEventListener("pointerup",Fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ve),document.removeEventListener("pointerup",Fe,{capture:!0})}}},[L,de,ye]),I.useEffect(()=>{const Te=()=>de(!1);return window.addEventListener("blur",Te),window.addEventListener("resize",Te),()=>{window.removeEventListener("blur",Te),window.removeEventListener("resize",Te)}},[de]);const[Ie,Ne]=r6e(Te=>{const Ve=le().filter(Qe=>!Qe.disabled),Fe=Ve.find(Qe=>Qe.ref.current===document.activeElement),Me=n6e(Ve,Te,Fe);Me&&setTimeout(()=>Me.ref.current.focus())}),we=I.useCallback((Te,Ve,Fe)=>{const Me=!ge.current&&!Fe;(T.value!==void 0&&T.value===Ve||Me)&&(Z(Te),Me&&(ge.current=!0))},[T.value]),he=I.useCallback(()=>L==null?void 0:L.focus(),[L]),xe=I.useCallback((Te,Ve,Fe)=>{const Me=!ge.current&&!Fe;(T.value!==void 0&&T.value===Ve||Me)&&ae(Te)},[T.value]),be=s==="popper"?nhe:BPe,Oe=be===nhe?{side:a,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:b,collisionPadding:j,sticky:N,hideWhenDetached:C,avoidCollisions:A}:{};return r.jsx(FPe,{scope:n,content:L,viewport:F,onViewportChange:q,itemRefCallback:we,selectedItem:K,onItemLeave:he,itemTextRefCallback:xe,focusSelectedItem:fe,selectedItemText:te,position:s,isPositioned:ve,searchRef:Ie,children:r.jsx(_I,{as:Ost,allowPinchZoom:!0,children:r.jsx(vI,{asChild:!0,trapped:T.open,onMountAutoFocus:Te=>{Te.preventDefault()},onUnmountAutoFocus:cn(i,Te=>{var Ve;(Ve=T.trigger)==null||Ve.focus({preventScroll:!0}),Te.preventDefault()}),children:r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Te=>Te.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:r.jsx(be,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:Te=>Te.preventDefault(),...E,...Oe,onPlaced:()=>ne(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:cn(E.onKeyDown,Te=>{const Ve=Te.ctrlKey||Te.altKey||Te.metaKey;if(Te.key==="Tab"&&Te.preventDefault(),!Ve&&Te.key.length===1&&Ne(Te.key),["ArrowUp","ArrowDown","Home","End"].includes(Te.key)){let Me=le().filter(Qe=>!Qe.disabled).map(Qe=>Qe.ref.current);if(["ArrowUp","End"].includes(Te.key)&&(Me=Me.slice().reverse()),["ArrowUp","ArrowDown"].includes(Te.key)){const Qe=Te.target,Ee=Me.indexOf(Qe);Me=Me.slice(Ee+1)}setTimeout(()=>ie(Me)),Te.preventDefault()}})})})})})})});zPe.displayName=Lst;var Dst="SelectItemAlignedPosition",BPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...i}=e,o=sv(Bj,n),l=iv(Bj,n),[a,h]=I.useState(null),[p,x]=I.useState(null),y=ei(t,H=>x(H)),b=Zne(n),j=I.useRef(!1),N=I.useRef(!0),{viewport:C,selectedItem:A,selectedItemText:E,focusSelectedItem:T}=l,L=I.useCallback(()=>{if(o.trigger&&o.valueNode&&a&&p&&C&&A&&E){const H=o.trigger.getBoundingClientRect(),K=p.getBoundingClientRect(),Z=o.valueNode.getBoundingClientRect(),te=E.getBoundingClientRect();if(o.dir!=="rtl"){const Qe=te.left-K.left,Ee=Z.left-Qe,Ye=H.left-Ee,me=H.width+Ye,mt=Math.max(me,K.width),et=window.innerWidth-Hp,nt=rE(Ee,[Hp,Math.max(Hp,et-mt)]);a.style.minWidth=me+"px",a.style.left=nt+"px"}else{const Qe=K.right-te.right,Ee=window.innerWidth-Z.right-Qe,Ye=window.innerWidth-H.right-Ee,me=H.width+Ye,mt=Math.max(me,K.width),et=window.innerWidth-Hp,nt=rE(Ee,[Hp,Math.max(Hp,et-mt)]);a.style.minWidth=me+"px",a.style.right=nt+"px"}const ae=b(),le=window.innerHeight-Hp*2,ve=C.scrollHeight,ne=window.getComputedStyle(p),ge=parseInt(ne.borderTopWidth,10),ie=parseInt(ne.paddingTop,10),fe=parseInt(ne.borderBottomWidth,10),de=parseInt(ne.paddingBottom,10),ye=ge+ie+ve+de+fe,Ie=Math.min(A.offsetHeight*5,ye),Ne=window.getComputedStyle(C),we=parseInt(Ne.paddingTop,10),he=parseInt(Ne.paddingBottom,10),xe=H.top+H.height/2-Hp,be=le-xe,Oe=A.offsetHeight/2,Te=A.offsetTop+Oe,Ve=ge+ie+Te,Fe=ye-Ve;if(Ve<=xe){const Qe=ae.length>0&&A===ae[ae.length-1].ref.current;a.style.bottom="0px";const Ee=p.clientHeight-C.offsetTop-C.offsetHeight,Ye=Math.max(be,Oe+(Qe?he:0)+Ee+fe),me=Ve+Ye;a.style.height=me+"px"}else{const Qe=ae.length>0&&A===ae[0].ref.current;a.style.top="0px";const Ye=Math.max(xe,ge+C.offsetTop+(Qe?we:0)+Oe)+Fe;a.style.height=Ye+"px",C.scrollTop=Ve-xe+C.offsetTop}a.style.margin=`${Hp}px 0`,a.style.minHeight=Ie+"px",a.style.maxHeight=le+"px",s==null||s(),requestAnimationFrame(()=>j.current=!0)}},[b,o.trigger,o.valueNode,a,p,C,A,E,o.dir,s]);Yl(()=>L(),[L]);const[z,F]=I.useState();Yl(()=>{p&&F(window.getComputedStyle(p).zIndex)},[p]);const q=I.useCallback(H=>{H&&N.current===!0&&(L(),T==null||T(),N.current=!1)},[L,T]);return r.jsx(Fst,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:j,onScrollButtonChange:q,children:r.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:r.jsx(Rn.div,{...i,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});BPe.displayName=Dst;var Rst="SelectPopperPosition",nhe=I.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:i=Hp,...o}=e,l=Yne(n);return r.jsx(mI,{...l,...o,ref:t,align:s,collisionPadding:i,style:{boxSizing:"border-box",...o.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)"}})});nhe.displayName=Rst;var[Fst,Tge]=d3(Bj,{}),she="SelectViewport",$Pe=I.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...i}=e,o=iv(she,n),l=Tge(she,n),a=ei(t,o.onViewportChange),h=I.useRef(0);return r.jsxs(r.Fragment,{children:[r.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:s}),r.jsx(Kne.Slot,{scope:n,children:r.jsx(Rn.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:cn(i.onScroll,p=>{const x=p.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:b}=l;if(b!=null&&b.current&&y){const j=Math.abs(h.current-x.scrollTop);if(j>0){const N=window.innerHeight-Hp*2,C=parseFloat(y.style.minHeight),A=parseFloat(y.style.height),E=Math.max(C,A);if(E0?z:0,y.style.justifyContent="flex-end")}}}h.current=x.scrollTop})})})]})});$Pe.displayName=she;var UPe="SelectGroup",[zst,Bst]=d3(UPe),$st=I.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,i=Vc();return r.jsx(zst,{scope:n,id:i,children:r.jsx(Rn.div,{role:"group","aria-labelledby":i,...s,ref:t})})});$st.displayName=UPe;var qPe="SelectLabel",VPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,i=Bst(qPe,n);return r.jsx(Rn.div,{id:i.id,...s,ref:t})});VPe.displayName=qPe;var rte="SelectItem",[Ust,HPe]=d3(rte),WPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:i=!1,textValue:o,...l}=e,a=sv(rte,n),h=iv(rte,n),p=a.value===s,[x,y]=I.useState(o??""),[b,j]=I.useState(!1),N=ei(t,T=>{var L;return(L=h.itemRefCallback)==null?void 0:L.call(h,T,s,i)}),C=Vc(),A=I.useRef("touch"),E=()=>{i||(a.onValueChange(s),a.onOpenChange(!1))};if(s==="")throw new Error("A 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 r.jsx(Ust,{scope:n,value:s,disabled:i,textId:C,isSelected:p,onItemTextChange:I.useCallback(T=>{y(L=>L||((T==null?void 0:T.textContent)??"").trim())},[]),children:r.jsx(Kne.ItemSlot,{scope:n,value:s,disabled:i,textValue:x,children:r.jsx(Rn.div,{role:"option","aria-labelledby":C,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...l,ref:N,onFocus:cn(l.onFocus,()=>j(!0)),onBlur:cn(l.onBlur,()=>j(!1)),onClick:cn(l.onClick,()=>{A.current!=="mouse"&&E()}),onPointerUp:cn(l.onPointerUp,()=>{A.current==="mouse"&&E()}),onPointerDown:cn(l.onPointerDown,T=>{A.current=T.pointerType}),onPointerMove:cn(l.onPointerMove,T=>{var L;A.current=T.pointerType,i?(L=h.onItemLeave)==null||L.call(h):A.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:cn(l.onPointerLeave,T=>{var L;T.currentTarget===document.activeElement&&((L=h.onItemLeave)==null||L.call(h))}),onKeyDown:cn(l.onKeyDown,T=>{var z;((z=h.searchRef)==null?void 0:z.current)!==""&&T.key===" "||(Cst.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})});WPe.displayName=rte;var dT="SelectItemText",GPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:i,...o}=e,l=sv(dT,n),a=iv(dT,n),h=HPe(dT,n),p=Est(dT,n),[x,y]=I.useState(null),b=ei(t,E=>y(E),h.onItemTextChange,E=>{var T;return(T=a.itemTextRefCallback)==null?void 0:T.call(a,E,h.value,h.disabled)}),j=x==null?void 0:x.textContent,N=I.useMemo(()=>r.jsx("option",{value:h.value,disabled:h.disabled,children:j},h.value),[h.disabled,h.value,j]),{onNativeOptionAdd:C,onNativeOptionRemove:A}=p;return Yl(()=>(C(N),()=>A(N)),[C,A,N]),r.jsxs(r.Fragment,{children:[r.jsx(Rn.span,{id:h.textId,...o,ref:b}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?py.createPortal(o.children,l.valueNode):null]})});GPe.displayName=dT;var KPe="SelectItemIndicator",ZPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return HPe(KPe,n).isSelected?r.jsx(Rn.span,{"aria-hidden":!0,...s,ref:t}):null});ZPe.displayName=KPe;var ihe="SelectScrollUpButton",YPe=I.forwardRef((e,t)=>{const n=iv(ihe,e.__scopeSelect),s=Tge(ihe,e.__scopeSelect),[i,o]=I.useState(!1),l=ei(t,s.onScrollButtonChange);return Yl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const p=h.scrollTop>0;o(p)};const h=n.viewport;return a(),h.addEventListener("scroll",a),()=>h.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(QPe,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:h}=n;a&&h&&(a.scrollTop=a.scrollTop-h.offsetHeight)}}):null});YPe.displayName=ihe;var ahe="SelectScrollDownButton",XPe=I.forwardRef((e,t)=>{const n=iv(ahe,e.__scopeSelect),s=Tge(ahe,e.__scopeSelect),[i,o]=I.useState(!1),l=ei(t,s.onScrollButtonChange);return Yl(()=>{if(n.viewport&&n.isPositioned){let a=function(){const p=h.scrollHeight-h.clientHeight,x=Math.ceil(h.scrollTop)h.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?r.jsx(QPe,{...e,ref:l,onAutoScroll:()=>{const{viewport:a,selectedItem:h}=n;a&&h&&(a.scrollTop=a.scrollTop+h.offsetHeight)}}):null});XPe.displayName=ahe;var QPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...i}=e,o=iv("SelectScrollButton",n),l=I.useRef(null),a=Zne(n),h=I.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return I.useEffect(()=>()=>h(),[h]),Yl(()=>{var x;const p=a().find(y=>y.ref.current===document.activeElement);(x=p==null?void 0:p.ref.current)==null||x.scrollIntoView({block:"nearest"})},[a]),r.jsx(Rn.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:cn(i.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:cn(i.onPointerMove,()=>{var p;(p=o.onItemLeave)==null||p.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:cn(i.onPointerLeave,()=>{h()})})}),qst="SelectSeparator",JPe=I.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Rn.div,{"aria-hidden":!0,...s,ref:t})});JPe.displayName=qst;var ohe="SelectArrow",Vst=I.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,i=Yne(n),o=sv(ohe,n),l=iv(ohe,n);return o.open&&l.position==="popper"?r.jsx(gI,{...i,...s,ref:t}):null});Vst.displayName=ohe;var Hst="SelectBubbleInput",e6e=I.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const i=I.useRef(null),o=ei(s,i),l=jI(t);return I.useEffect(()=>{const a=i.current;if(!a)return;const h=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&x){const y=new Event("change",{bubbles:!0});x.call(a,t),a.dispatchEvent(y)}},[l,t]),r.jsx(Rn.select,{...n,style:{...cAe,...n.style},ref:o,defaultValue:t})});e6e.displayName=Hst;function t6e(e){return e===""||e===void 0}function r6e(e){const t=Kl(e),n=I.useRef(""),s=I.useRef(0),i=I.useCallback(l=>{const a=n.current+l;t(a),function h(p){n.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>h(""),1e3))}(a)},[t]),o=I.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return I.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,i,o]}function n6e(e,t,n){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=Wst(e,Math.max(o,0));i.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.textValue.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function Wst(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Gst=APe,s6e=IPe,Kst=LPe,Zst=OPe,Yst=DPe,i6e=RPe,Xst=$Pe,a6e=VPe,o6e=WPe,Qst=GPe,Jst=ZPe,l6e=YPe,c6e=XPe,d6e=JPe;const vn=Gst,_n=Kst,mn=I.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(s6e,{ref:s,className:$t("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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",e),...n,children:[t,r.jsx(Zst,{asChild:!0,children:r.jsx(Pu,{className:"h-4 w-4 opacity-50"})})]}));mn.displayName=s6e.displayName;const u6e=I.forwardRef(({className:e,...t},n)=>r.jsx(l6e,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(a1,{className:"h-4 w-4"})}));u6e.displayName=l6e.displayName;const h6e=I.forwardRef(({className:e,...t},n)=>r.jsx(c6e,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Pu,{className:"h-4 w-4"})}));h6e.displayName=c6e.displayName;const gn=I.forwardRef(({className:e,children:t,position:n="popper",...s},i)=>r.jsx(Yst,{children:r.jsxs(i6e,{ref:i,className:$t("relative z-50 max-h-96 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",n==="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",e),position:n,...s,children:[r.jsx(u6e,{}),r.jsx(Xst,{className:$t("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(h6e,{})]})}));gn.displayName=i6e.displayName;const eit=I.forwardRef(({className:e,...t},n)=>r.jsx(a6e,{ref:n,className:$t("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));eit.displayName=a6e.displayName;const Ht=I.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(o6e,{ref:s,className:$t("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Jst,{children:r.jsx(Ca,{className:"h-4 w-4"})})}),r.jsx(Qst,{children:t})]}));Ht.displayName=o6e.displayName;const tit=I.forwardRef(({className:e,...t},n)=>r.jsx(d6e,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",e),...t}));tit.displayName=d6e.displayName;const rit=e=>Zt({queryKey:["public-listings",e],queryFn:async()=>{let t=J.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0).order("created_at",{ascending:!1});e!=null&&e.status&&(t=t.eq("status",e.status)),e!=null&&e.propertyType&&(t=t.eq("property_type",e.propertyType)),e!=null&&e.city&&(t=t.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(t=t.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(t=t.lte("price",e.maxPrice));const{data:n,error:s}=await t;if(s)throw s;return n}}),f6e=e=>Zt({queryKey:["public-listing",e],queryFn:async()=>{const t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);let n=J.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, agent_notes, agent_notes_public, mls_link, video_link, video_id, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary, sort_order), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds, bunny_video_id) `).eq("is_approved",!0).eq("is_public",!0);t?n=n.eq("id",e):n=n.eq("slug",e);const{data:s,error:i}=await n.single();if(i)throw i;return s},enabled:!!e}),p6e=()=>cr({mutationFn:async({listingId:e,agentId:t,firstName:n,lastName:s,email:i,phone:o,shareToken:l})=>{let a=null,h=null;if(l){const{data:b}=await J.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",e).maybeSingle();b&&(a=b.id,h=b.sharing_agent_id)}const{data:p,error:x}=await J.from("listing_leads").insert({listing_id:e,agent_id:h||t,first_name:n,last_name:s,email:i,phone:o,share_id:a,referred_by_agent_id:h}).select().single();if(x)throw x;const{error:y}=await J.functions.invoke("process-listing-lead",{body:{leadId:p.id}});return y&&console.error("Error processing lead:",y),p}}),nit=()=>cr({mutationFn:async e=>{const{error:t}=await J.rpc("increment_listing_share_click",{p_share_token:e});if(t)throw t}}),sit={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},bje={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},iit={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function m6e(){const[e,t]=I.useState(""),[n,s]=I.useState(!1),[i,o]=I.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:a}=rit({city:e||void 0,status:i.status||void 0,propertyType:i.propertyType||void 0,minPrice:i.minPrice?Number(i.minPrice):void 0,maxPrice:i.maxPrice?Number(i.maxPrice):void 0}),h=y=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(y),p=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),t("")},x=e||i.status||i.propertyType||i.minPrice||i.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"LevelUp Listings - Find Your Dream Home | Real Estate for Sale"}),r.jsx("meta",{name:"description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, condos, townhouses, and luxury properties. View photos, prices, and connect with agents."}),r.jsx("link",{rel:"canonical",href:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{property:"og:description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, view photos, and connect with agents."}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{name:"twitter:description",content:"Browse exclusive property listings from LevelUp real estate agents."}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"keywords",content:"homes for sale, real estate, property listings, houses, condos, townhouses, luxury homes, LevelUp"}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"LevelUp Listings",url:"https://listings.relevelup.com",description:"Browse exclusive property listings from LevelUp real estate agents",potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:"https://listings.relevelup.com?q={search_term_string}"},"query-input":"required name=search_term_string"}})}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateAgent",name:"LevelUp",url:"https://relevelup.com",logo:"https://listings.relevelup.com/assets/levelup-logo-color.png"})})]}),r.jsxs("div",{className:"min-h-screen bg-gray-50",children:[r.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(uo,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})}),r.jsx("nav",{className:"hidden md:flex items-center gap-6",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors",children:"About LevelUp"})})]})})}),r.jsxs("section",{className:"relative bg-cover bg-center py-20 md:py-32",style:{backgroundImage:`url(${jst})`},children:[r.jsx("div",{className:"absolute inset-0 bg-black/40"}),r.jsxs("div",{className:"relative max-w-7xl mx-auto px-4",children:[r.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-3 text-center drop-shadow-lg",children:"Find Your Perfect Home"}),r.jsx("p",{className:"text-white/90 text-center mb-10 text-lg md:text-xl drop-shadow",children:"Exclusive listings from LevelUp agents"}),r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex gap-0 shadow-2xl rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"relative flex-1 bg-white",children:[r.jsx(_i,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(at,{placeholder:"Enter an address, neighborhood, city, or ZIP code",value:e,onChange:y=>t(y.target.value),className:"pl-12 h-14 md:h-16 text-base md:text-lg border-0 focus-visible:ring-0 rounded-none bg-white"})]}),r.jsx(ee,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(_i,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(ee,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(YT,{className:"h-4 w-4"}),n?"Hide Filters":"More Filters"]})}),n&&r.jsxs("div",{className:"mt-4 p-6 bg-white rounded-lg shadow-xl",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Status"}),r.jsxs(vn,{value:i.status||"all",onValueChange:y=>o({...i,status:y==="all"?"":y}),children:[r.jsx(mn,{className:"bg-white",children:r.jsx(_n,{placeholder:"Any status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"Any status"}),Object.entries(bje).map(([y,b])=>r.jsx(Ht,{value:y,children:b},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),r.jsxs(vn,{value:i.propertyType||"all",onValueChange:y=>o({...i,propertyType:y==="all"?"":y}),children:[r.jsx(mn,{className:"bg-white",children:r.jsx(_n,{placeholder:"Any type"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"Any type"}),Object.entries(iit).map(([y,b])=>r.jsx(Ht,{value:y,children:b},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),r.jsx(at,{type:"number",placeholder:"No min",value:i.minPrice,onChange:y=>o({...i,minPrice:y.target.value}),className:"bg-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Max Price"}),r.jsx(at,{type:"number",placeholder:"No max",value:i.maxPrice,onChange:y=>o({...i,maxPrice:y.target.value}),className:"bg-white"})]})]}),x&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:p,className:"gap-1 text-gray-500",children:[r.jsx(bs,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),r.jsx("section",{className:"py-8",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:a?r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((y,b)=>r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[r.jsx(Pr,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Pr,{className:"h-7 w-28"}),r.jsx(Pr,{className:"h-4 w-full"}),r.jsx(Pr,{className:"h-4 w-3/4"})]})]},b))}):l&&l.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[l.length," ",l.length===1?"Home":"Homes"," Available"]})}),r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:l.map(y=>{var C,A,E;const b=((C=y.photos)==null?void 0:C.find(T=>T.is_primary))||((A=y.photos)==null?void 0:A[0]),N=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${y.slug||y.id}`:`/public/listing/${y.slug||y.id}`;return r.jsx(uo,{to:N,children:r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-lg transition-shadow cursor-pointer group border border-gray-100",children:[r.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-gray-100",children:[b?r.jsx("img",{src:b.photo_url,alt:y.property_address||y.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(fi,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Rt,{className:`absolute top-2 left-2 ${sit[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:bje[y.status]}),r.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:T=>T.preventDefault(),children:r.jsx(oa,{className:"h-5 w-5 text-gray-600"})})]}),r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-xl font-bold text-gray-900 mb-1",children:h(y.price)}),r.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[y.bedrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bedrooms}),r.jsx("span",{className:"text-gray-500",children:"bds"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.bathrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bathrooms}),r.jsx("span",{className:"text-gray-500",children:"ba"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.square_footage&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.square_footage.toLocaleString()}),r.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),y.property_address&&r.jsx("p",{className:"text-sm text-gray-700 truncate",children:y.property_address}),r.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[y.city,", ",y.state]}),y.agent&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[r.jsx("p",{className:"text-xs text-gray-500 truncate",children:y.agent.name}),((E=y.agent.brokerage)==null?void 0:E.name)&&r.jsx("p",{className:"text-xs text-gray-400 truncate",children:y.agent.brokerage.name})]})]})]})},y.id)})})]}):r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full bg-gray-100 flex items-center justify-center",children:r.jsx(fi,{className:"h-10 w-10 text-gray-400"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No listings found"}),r.jsx("p",{className:"text-gray-500 mb-6",children:x?"Try adjusting your search or filters":"Check back soon for new listings"}),x&&r.jsx(ee,{variant:"outline",onClick:p,children:"Clear filters"})]})})}),r.jsx("footer",{className:"bg-gray-900 text-white py-10 mt-auto",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("img",{src:Mge,alt:"LevelUp",className:"h-6"})}),r.jsxs("p",{className:"text-gray-400 text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-white text-sm transition-colors",children:"relevelup.com"})]})})})]})]})}const Ge=I.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ge.displayName="Card";const Gt=I.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("flex flex-col space-y-1.5 p-6",e),...t}));Gt.displayName="CardHeader";const Qt=I.forwardRef(({className:e,...t},n)=>r.jsx("h3",{ref:n,className:$t("text-2xl font-semibold leading-none tracking-tight",e),...t}));Qt.displayName="CardTitle";const En=I.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));En.displayName="CardDescription";const Xe=I.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("p-6 pt-0",e),...t}));Xe.displayName="CardContent";const oA=I.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("flex items-center p-6 pt-0",e),...t}));oA.displayName="CardFooter";var ait="Label",g6e=I.forwardRef((e,t)=>r.jsx(Rn.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));g6e.displayName=ait;var x6e=g6e;const oit=XC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ue=I.forwardRef(({className:e,...t},n)=>r.jsx(x6e,{ref:n,className:$t(oit(),e),...t}));Ue.displayName=x6e.displayName;function lit(){const e=Nm(),t=window.location.hostname;if(!(t==="listings.relevelup.com"||t.startsWith("listings.")))return null;const s=e.pathname.slice(1);return!s||s===""?r.jsx(m6e,{}):s.startsWith("public/")?null:r.jsx(cit,{slug:s})}function cit({slug:e}){return r.jsx(hit,{slug:e})}const dit={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},uit={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},wje={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function hit({slug:e}){var Z,te;const{data:t,isLoading:n}=f6e(e),s=p6e(),[i,o]=I.useState(""),[l,a]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(!1),[N,C]=I.useState(!1),[A,E]=I.useState(null),T=ae=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ae),L=async ae=>{if(ae.preventDefault(),!(!i.trim()||!h.trim()||!t)){j(!0);try{await s.mutateAsync({listingId:t.id,agentId:t.agent_id,firstName:i.trim(),lastName:l.trim(),email:h.trim(),phone:x.trim()}),C(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(le){console.error("Lead submission error:",le),ze.error(`Failed to submit: ${le.message||"Please try again"}`)}finally{j(!1)}}},z=(t==null?void 0:t.photos)||[],F=z.find(ae=>ae.is_primary)||z[0],q=()=>{A!==null&&E(A===0?z.length-1:A-1)},H=()=>{A!==null&&E(A===z.length-1?0:A+1)};if(n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Pr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Pr,{className:"h-10 w-48 mb-6"}),r.jsx(Pr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Pr,{className:"h-12 w-48"}),r.jsx(Pr,{className:"h-6 w-full"}),r.jsx(Pr,{className:"h-6 w-3/4"})]}),r.jsx(Pr,{className:"h-64"})]})]})]});if(!t)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(fi,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(ee,{asChild:!0,children:r.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const K=t.property_address?`${t.property_address} - ${t.city}, ${t.state}`:`${t.city}, ${t.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[K," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${T(t.price)} - ${t.bedrooms||""}BD ${t.bathrooms||""}BA ${t.square_footage?t.square_footage.toLocaleString()+" sqft":""} ${wje[t.property_type]} in ${t.city}, ${t.state}. ${((Z=t.description)==null?void 0:Z.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:K}),r.jsx("meta",{property:"og:description",content:`${T(t.price)} - ${t.bedrooms||""}BD ${t.bathrooms||""}BA in ${t.city}, ${t.state}`}),r.jsx("meta",{property:"og:type",content:"website"}),F&&r.jsx("meta",{property:"og:image",content:F.photo_url})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs("a",{href:"/",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),z.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>E(0),children:r.jsx("img",{src:F==null?void 0:F.photo_url,alt:"Primary",className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:z.slice(1,5).map((ae,le)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>E(le+1),children:[r.jsx("img",{src:ae.photo_url,alt:`Photo ${le+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),le===3&&z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",z.length-5," more"]})]},ae.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Rt,{className:`${dit[t.status]} text-white border-0`,children:uit[t.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:T(t.price)}),t.property_address&&r.jsx("p",{className:"text-xl font-medium",children:t.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(ml,{className:"h-4 w-4"}),t.city,", ",t.state,t.neighborhood&&` • ${t.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[t.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Hf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),t.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Vf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),t.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(ym,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),t.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(zs,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Rt,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),wje[t.property_type]]}),t.lot_size&&r.jsxs(Rt,{variant:"secondary",children:["Lot: ",t.lot_size]}),t.has_hoa&&r.jsx(Rt,{variant:"secondary",children:"HOA"})]}),t.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.description})]}),t.agent_notes&&t.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:t.agent_notes})]}),t.mls_link&&r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:t.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[t.agent&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Cc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-semibold text-lg",children:t.agent.name}),((te=t.agent.brokerage)==null?void 0:te.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.agent.brokerage.name})]})]}),r.jsxs(Ge,{className:"border-primary",children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Xe,{children:N?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(Ys,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:L,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"firstName",children:"First Name *"}),r.jsx(at,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:ae=>o(ae.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"lastName",children:"Last Name"}),r.jsx(at,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ae=>a(ae.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"email",children:"Email *"}),r.jsx(at,{id:"email",type:"email",placeholder:"you@example.com",value:h,onChange:ae=>p(ae.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"phone",children:"Phone"}),r.jsx(at,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ae=>y(ae.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:b,children:b?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Br,{open:A!==null,onOpenChange:()=>E(null),children:r.jsxs(Fr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Hr,{className:"sr-only",children:r.jsx(qr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>E(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(bs,{className:"h-5 w-5"})}),A!==null&&z[A]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:z[A].photo_url,alt:`Photo ${A+1}`,className:"w-full max-h-[80vh] object-contain"}),z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:q,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:H,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ka,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[A+1," / ",z.length]})]})]})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function Xne({card:e,variant:t}){const n=e.brokerage_display_name||e.brokerage_logo_url,s=e.team_name||e.team_logo_url;if(!n&&!s)return null;const i={standard:{container:"bg-slate-50 border border-slate-100",text:"text-slate-600",subtext:"text-slate-400"},luxury:{container:"bg-[#1e2636] border border-[#c9a84c]/10",text:"text-[#e2e8f0]",subtext:"text-[#4a5568]"},bold:{container:"bg-gray-50 border border-gray-100",text:"text-[#1a1a2e]",subtext:"text-gray-400"},classic:{container:"bg-white border border-[#d4cfc5] shadow-sm",text:"text-[#1b3a4b]",subtext:"text-[#a0aec0]"}}[t];return r.jsx("div",{className:`rounded-2xl p-4 mb-6 ${i.container}`,children:r.jsxs("div",{className:`flex flex-col items-center gap-3 ${n&&s?"divide-y divide-current/10":""}`,children:[n&&r.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-full",children:[e.brokerage_logo_url&&r.jsx("img",{src:e.brokerage_logo_url,alt:e.brokerage_display_name||"Brokerage",style:{height:`${e.brokerage_logo_size||56}px`},className:"max-w-[280px] object-contain"}),e.brokerage_display_name&&!e.brokerage_logo_url&&r.jsx("p",{className:`text-sm font-medium ${i.text}`,children:e.brokerage_display_name})]}),s&&r.jsxs("div",{className:`flex flex-col items-center gap-1.5 w-full ${n?"pt-3":""}`,children:[e.team_logo_url&&r.jsx("img",{src:e.team_logo_url,alt:e.team_name||"Team",style:{height:`${e.team_logo_size||56}px`},className:"max-w-[280px] object-contain"}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:`text-sm font-medium ${i.text}`,children:e.team_name})]})]})})}const y6e=e=>Zt({queryKey:["agent-card-public",e],queryFn:async()=>{if(!e)throw new Error("No slug provided");const{data:t,error:n}=await J.from("agent_cards").select("*").eq("slug",e).eq("is_published",!0).single();if(n)throw n;const{data:s}=await J.from("profiles").select("name, email, phone, brokerage_id").eq("id",t.user_id).single();let i=null;if(s!=null&&s.brokerage_id){const{data:l}=await J.from("brokerages").select("name").eq("id",s.brokerage_id).single();i=(l==null?void 0:l.name)||null}let o=null;try{const{data:l}=await J.from("profiles").select("avatar_url").eq("id",t.user_id).single();if(l!=null&&l.avatar_url)o=l.avatar_url;else{const{data:a}=await J.storage.from("avatars").list(`${t.user_id}`);if(a&&a.length>0){const{data:h}=J.storage.from("avatars").getPublicUrl(`${t.user_id}/${a[0].name}`);o=`${h.publicUrl}?t=${Date.now()}`}}}catch{}return{...t,social_links:t.social_links||[],profile:s||{name:null,email:null,phone:null,brokerage_id:null},brokerage_name:t.brokerage_display_name||i,avatar_url:o}},enabled:!!e}),fit=()=>Zt({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:e,error:t}=await J.from("agent_cards").select("*").order("created_at",{ascending:!1});if(t)throw t;return e}}),pit=e=>Zt({queryKey:["agent-card",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await J.from("agent_cards").select("*").eq("user_id",e).maybeSingle();if(n)throw n;return t},enabled:!!e}),v6e=()=>{const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("agent_cards").insert(t).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card created")},onError:t=>ze.error(t.message)})},_6e=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("agent_cards").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card updated")},onError:t=>ze.error(t.message)})},Sa=async(e,t,n,s)=>{const i=new URLSearchParams(window.location.search);await J.from("agent_card_interactions").insert({card_id:e,interaction_type:t,interaction_detail:n||null,referrer:document.referrer||null,user_agent:navigator.userAgent||null,utm_source:i.get("utm_source")||null,utm_medium:i.get("utm_medium")||null,utm_campaign:i.get("utm_campaign")||null,metadata:{}})},mit=async(e,t)=>{const{error:n}=await J.from("agent_card_leads").insert({card_id:e,...t});if(n)throw n},b6e=e=>Zt({queryKey:["agent-card-analytics",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await J.from("agent_card_interactions").select("interaction_type, interaction_detail, created_at").eq("card_id",e).order("created_at",{ascending:!1}).limit(500);if(n)throw n;const{data:s,error:i}=await J.from("agent_card_leads").select("*").eq("card_id",e).order("created_at",{ascending:!1});if(i)throw i;const o=(t==null?void 0:t.filter(h=>h.interaction_type==="card_view").length)||0,l=(t==null?void 0:t.filter(h=>h.interaction_type==="button_click").length)||0,a=(t==null?void 0:t.filter(h=>h.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:a,leads:s||[],interactions:t||[]}},enabled:!!e});var w6e={exports:{}},j6e={};/** * @license React * use-sync-external-store-shim.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var oC=I;function git(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xit=typeof Object.is=="function"?Object.is:git,yit=oC.useState,vit=oC.useEffect,_it=oC.useLayoutEffect,bit=oC.useDebugValue;function wit(e,t){var n=t(),s=yit({inst:{value:n,getSnapshot:t}}),i=s[0].inst,o=s[1];return _it(function(){i.value=n,i.getSnapshot=t,Hle(i)&&o({inst:i})},[e,n,t]),vit(function(){return Hle(i)&&o({inst:i}),e(function(){Hle(i)&&o({inst:i})})},[e]),bit(n),n}function Hle(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xit(e,n)}catch{return!0}}function jit(e,t){return t()}var kit=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?jit:wit;j6e.useSyncExternalStore=oC.useSyncExternalStore!==void 0?oC.useSyncExternalStore:kit;w6e.exports=j6e;var Nit=w6e.exports;function Sit(){return Nit.useSyncExternalStore(Cit,()=>!0,()=>!1)}function Cit(){return()=>{}}var Age="Avatar",[Mit]=Ql(Age),[Tit,k6e]=Mit(Age),N6e=I.forwardRef((e,t)=>{const{__scopeAvatar:n,...s}=e,[i,o]=I.useState("idle");return r.jsx(Tit,{scope:n,imageLoadingStatus:i,onImageLoadingStatusChange:o,children:r.jsx(Rn.span,{...s,ref:t})})});N6e.displayName=Age;var S6e="AvatarImage",C6e=I.forwardRef((e,t)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:i=()=>{},...o}=e,l=k6e(S6e,n),a=Ait(s,o),h=Kl(p=>{i(p),l.onImageLoadingStatusChange(p)});return Yl(()=>{a!=="idle"&&h(a)},[a,h]),a==="loaded"?r.jsx(Rn.img,{...o,ref:t,src:s}):null});C6e.displayName=S6e;var M6e="AvatarFallback",T6e=I.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:s,...i}=e,o=k6e(M6e,n),[l,a]=I.useState(s===void 0);return I.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>a(!0),s);return()=>window.clearTimeout(h)}},[s]),l&&o.imageLoadingStatus!=="loaded"?r.jsx(Rn.span,{...i,ref:t}):null});T6e.displayName=M6e;function jje(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Ait(e,{referrerPolicy:t,crossOrigin:n}){const s=Sit(),i=I.useRef(null),o=s?(i.current||(i.current=new window.Image),i.current):null,[l,a]=I.useState(()=>jje(o,e));return Yl(()=>{a(jje(o,e))},[o,e]),Yl(()=>{const h=y=>()=>{a(y)};if(!o)return;const p=h("loaded"),x=h("error");return o.addEventListener("load",p),o.addEventListener("error",x),t&&(o.referrerPolicy=t),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",p),o.removeEventListener("error",x)}},[o,n,t]),l}var A6e=N6e,E6e=C6e,I6e=T6e;const ci=I.forwardRef(({className:e,...t},n)=>r.jsx(A6e,{ref:n,className:$t("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ci.displayName=A6e.displayName;const Ga=I.forwardRef(({className:e,...t},n)=>r.jsx(E6e,{ref:n,className:$t("aspect-square h-full w-full",e),...t}));Ga.displayName=E6e.displayName;const di=I.forwardRef(({className:e,...t},n)=>r.jsx(I6e,{ref:n,className:$t("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));di.displayName=I6e.displayName;function Qne({open:e,onOpenChange:t,cardId:n,type:s,agentName:i}){const[o,l]=I.useState(""),[a,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,N]=I.useState(""),[C,A]=I.useState(!1),E=async T=>{if(T.preventDefault(),!o.trim()){ze.error("Please enter your name");return}A(!0);try{await mit(n,{lead_type:s,name:o.trim(),email:a.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}),Sa(n,"lead_submitted",s),J.functions.invoke("card-lead-notify",{body:{cardId:n,leadType:s,name:o.trim(),email:a.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}}).catch(L=>console.error("Card lead notify failed:",L)),ze.success(s==="booking"?"Request sent! They'll be in touch soon.":s==="connect"?"Info shared! They'll be in touch soon.":"Referral submitted! Thank you."),t(!1),l(""),h(""),x(""),b(""),N("")}catch{ze.error("Something went wrong. Please try again.")}finally{A(!1)}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(es,{children:s==="booking"?`Let ${i} know you'd like to connect.`:s==="connect"?`Share your info and ${i} will reach out.`:`Know someone who could use ${i}'s help?`})]}),r.jsxs("form",{onSubmit:E,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"lead-name",children:"Name *"}),r.jsx(at,{id:"lead-name",value:o,onChange:T=>l(T.target.value),placeholder:"Your name",required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"lead-phone",children:"Phone"}),r.jsx(at,{id:"lead-phone",type:"tel",value:p,onChange:T=>x(T.target.value),placeholder:"(555) 123-4567"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"lead-email",children:"Email"}),r.jsx(at,{id:"lead-email",type:"email",value:a,onChange:T=>h(T.target.value),placeholder:"you@example.com"})]}),s==="booking"&&r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(vn,{value:y,onValueChange:b,children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select one"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"buy",children:"Buy a home"}),r.jsx(Ht,{value:"sell",children:"Sell my home"}),r.jsx(Ht,{value:"both",children:"Buy & Sell"}),r.jsx(Ht,{value:"other",children:"Something else"})]})]})]}),s!=="connect"&&r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"lead-message",children:s==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(at,{id:"lead-message",value:j,onChange:T=>N(T.target.value),placeholder:s==="referral"?"Their name, phone, situation...":"Anything you'd like us to know"})]}),r.jsx(ee,{type:"submit",className:"w-full rounded-2xl",disabled:C,children:C?"Sending...":"Submit"})]})]})})}const Eit=e=>Zt({queryKey:["card-blocks",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await J.from("card_blocks").select("*").eq("card_id",e).eq("is_visible",!0).order("sort_order",{ascending:!0});if(n)throw n;return t||[]},enabled:!!e}),Iit=e=>Zt({queryKey:["card-blocks-all",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await J.from("card_blocks").select("*").eq("card_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t||[]},enabled:!!e}),Pit=()=>{const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("card_blocks").insert(t).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["card-blocks",n.card_id]}),e.invalidateQueries({queryKey:["card-blocks-all",n.card_id]}),ze.success("Block added")},onError:t=>ze.error(t.message)})},Lit=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("card_blocks").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block updated")},onError:t=>ze.error(t.message)})},Oit=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("card_blocks").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block removed")},onError:t=>ze.error(t.message)})};function Dit(e){const t=e.match(/(?:iframe\.mediadelivery\.net\/embed\/|video\.bunnycdn\.com\/play\/)(\d+)\/([a-f0-9-]+)/i);return t?`https://iframe.mediadelivery.net/embed/${t[1]}/${t[2]}?autoplay=false&responsive=true`:(e.includes("iframe.mediadelivery.net"),e)}function Rit(e){const t=e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/);return t?`https://www.youtube.com/embed/${t[1]}`:null}const Fit={standard:"rounded-2xl overflow-hidden mb-6 bg-slate-100",luxury:"rounded-xl overflow-hidden mb-6 bg-[#1e2636] border border-[#c9a84c]/10",bold:"rounded-2xl overflow-hidden mb-6",classic:"rounded-lg overflow-hidden mb-6 border border-[#d4cfc5] shadow-sm"};function zit({block:e,variant:t}){const n=e.config;if(!n.video_url)return null;const s=n.video_url.includes("mediadelivery.net")||n.video_url.includes("bunnycdn.com"),i=Rit(n.video_url),o=s||!!i,l=s?Dit(n.video_url):i||n.video_url;return r.jsx("div",{className:Fit[t],children:o?r.jsx("div",{style:{position:"relative",paddingTop:"56.25%"},children:r.jsx("iframe",{src:l,loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,width:"100%",height:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsx("video",{src:n.video_url,controls:!0,className:"w-full",preload:"metadata"})})}const Bit={standard:{container:"mb-6",card:"bg-slate-50 rounded-2xl p-5 border border-slate-100",quote:"text-sm text-slate-600 italic",name:"text-sm font-semibold text-slate-800",role:"text-xs text-slate-500",dot:"bg-primary",dotInactive:"bg-slate-300",nav:"text-slate-400 hover:text-slate-600"},luxury:{container:"mb-6",card:"bg-[#1e2636] rounded-xl p-5 border border-[#c9a84c]/10",quote:"text-sm text-[#a0aec0] italic font-serif",name:"text-sm font-semibold text-white",role:"text-xs text-[#c9a84c]",dot:"bg-[#c9a84c]",dotInactive:"bg-[#2a3040]",nav:"text-[#4a5568] hover:text-[#c9a84c]"},bold:{container:"mb-6",card:"bg-[#fff3e0] rounded-2xl p-5",quote:"text-sm text-[#1a1a2e] font-medium",name:"text-sm font-black text-[#1a1a2e]",role:"text-xs text-[#ff5722] font-bold",dot:"bg-[#ff5722]",dotInactive:"bg-gray-300",nav:"text-gray-400 hover:text-[#ff5722]"},classic:{container:"mb-6",card:"bg-white rounded-lg p-5 border border-[#d4cfc5] shadow-sm",quote:"text-sm text-[#4a5568] italic font-serif",name:"text-sm font-semibold text-[#1b3a4b]",role:"text-xs text-[#5a7a6f]",dot:"bg-[#1b3a4b]",dotInactive:"bg-[#d4cfc5]",nav:"text-[#a0aec0] hover:text-[#1b3a4b]"}};function $it({block:e,variant:t}){const s=e.config.testimonials||[],[i,o]=I.useState(0);if(s.length===0)return null;const l=Bit[t],a=s[i];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(VT,{className:"h-4 w-4 mb-2 opacity-30"}),r.jsxs("p",{className:`${l.quote} mb-3`,children:['"',a.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:l.name,children:a.name}),a.role&&r.jsx("p",{className:l.role,children:a.role})]})]}),s.length>1&&r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[r.jsx("button",{onClick:()=>o(h=>(h-1+s.length)%s.length),className:l.nav,children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:s.map((h,p)=>r.jsx("div",{className:`h-1.5 w-1.5 rounded-full transition-colors cursor-pointer ${p===i?l.dot:l.dotInactive}`,onClick:()=>o(p)},p))}),r.jsx("button",{onClick:()=>o(h=>(h+1)%s.length),className:l.nav,children:r.jsx(Ka,{className:"h-4 w-4"})})]})]})}const Uit={standard:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-primary/10 text-primary"},luxury:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-[#c9a84c]/10 text-[#e8d48b] border border-[#c9a84c]/20"},bold:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-black rounded-full bg-[#1a1a2e] text-white uppercase tracking-wide"},classic:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-md bg-[#1b3a4b]/10 text-[#1b3a4b] border border-[#d4cfc5]"}};function qit({block:e,variant:t}){const s=e.config.tags||[];if(s.length===0)return null;const i=Uit[t];return r.jsx("div",{className:i.container,children:s.map((o,l)=>r.jsx("span",{className:i.tag,children:o},l))})}const Vit={standard:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-2xl bg-slate-50 hover:bg-slate-100 border border-slate-100 transition-colors text-sm font-medium text-slate-700",icon:"text-primary"},luxury:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-xl bg-[#1e2636] hover:bg-[#252d3f] border border-[#c9a84c]/10 transition-colors text-sm font-medium text-[#e2e8f0]",icon:"text-[#c9a84c]"},bold:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-2xl bg-gray-50 hover:bg-gray-100 transition-colors text-sm font-bold text-[#1a1a2e]",icon:"text-[#ff5722]"},classic:{container:"space-y-2 mb-6",link:"w-full flex items-center justify-between h-12 px-4 rounded-lg bg-white hover:bg-[#f5f1eb] border border-[#d4cfc5] shadow-sm transition-colors text-sm font-medium text-[#1b3a4b]",icon:"text-[#5a7a6f]"}};function Hit({block:e,cardId:t,variant:n}){const i=e.config.links||[];if(i.length===0)return null;const o=Vit[n];return r.jsx("div",{className:o.container,children:i.map((l,a)=>r.jsxs("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(t,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(Fs,{className:`h-4 w-4 ${o.icon}`})]},a))})}const lhe={instagram:{label:"Instagram",icon:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z",color:"#E4405F",hoverBg:"hover:bg-[#E4405F]/10"},facebook:{label:"Facebook",icon:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z",color:"#1877F2",hoverBg:"hover:bg-[#1877F2]/10"},linkedin:{label:"LinkedIn",icon:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",color:"#0A66C2",hoverBg:"hover:bg-[#0A66C2]/10"},twitter:{label:"X",icon:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z",color:"#000000",hoverBg:"hover:bg-black/10"},youtube:{label:"YouTube",icon:"M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814z M9.545 15.568V8.432L15.818 12z",color:"#FF0000",hoverBg:"hover:bg-[#FF0000]/10"},tiktok:{label:"TikTok",icon:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z",color:"#000000",hoverBg:"hover:bg-black/10"},zillow:{label:"Zillow",icon:"M12 0L1 6v12l11 6 11-6V6L12 0zm0 2.18L21 7.5v9L12 21.82 3 16.5v-9L12 2.18z",color:"#006AFF",hoverBg:"hover:bg-[#006AFF]/10"},realtor:{label:"Realtor",icon:"M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18l8 4v8l-8 4-8-4v-8l8-4z",color:"#D92228",hoverBg:"hover:bg-[#D92228]/10"}};function Wit({path:e,color:t,size:n=20}){return r.jsx("svg",{viewBox:"0 0 24 24",width:n,height:n,fill:t,children:r.jsx("path",{d:e})})}const Git={standard:{container:"bg-white rounded-2xl border border-slate-100 p-5 mb-6 shadow-sm",title:"text-sm font-semibold text-slate-800 mb-3",linkClass:"h-11 w-11 rounded-xl bg-slate-50 border border-slate-100 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:shadow-md"},luxury:{container:"bg-zinc-900/50 backdrop-blur rounded-2xl border border-amber-900/20 p-5 mb-6",title:"text-sm font-semibold text-amber-200/80 mb-3",linkClass:"h-11 w-11 rounded-xl bg-zinc-800/80 border border-amber-900/20 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:border-amber-500/40 hover:shadow-md hover:shadow-amber-500/10"},bold:{container:"bg-white/10 backdrop-blur rounded-2xl border border-white/20 p-5 mb-6",title:"text-sm font-semibold text-white/90 mb-3",linkClass:"h-11 w-11 rounded-xl bg-white/10 border border-white/20 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:bg-white/20 hover:shadow-md"},classic:{container:"bg-stone-50 rounded-2xl border border-stone-200 p-5 mb-6",title:"text-sm font-semibold text-stone-800 mb-3",linkClass:"h-11 w-11 rounded-xl bg-white border border-stone-200 flex items-center justify-center transition-all duration-200 hover:scale-110 hover:shadow-md"}};function Kit({block:e,cardId:t,variant:n}){const i=e.config.platforms||[],o=Git[n];return i.length===0?null:r.jsxs("div",{className:o.container,children:[r.jsx("h3",{className:o.title,children:"Follow Me"}),r.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:i.map((l,a)=>{const h=lhe[l.platform.toLowerCase()];return!h||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(t,"button_click",`social_${l.platform}`),className:o.linkClass,title:h.label,children:r.jsx(Wit,{path:h.icon,color:h.color})},a)})})]})}function Jne({cardId:e,variant:t}){const{data:n}=Eit(e);return!n||n.length===0?null:r.jsx(r.Fragment,{children:n.map(s=>{switch(s.block_type){case"video_intro":return r.jsx(zit,{block:s,variant:t},s.id);case"testimonials":return r.jsx($it,{block:s,variant:t},s.id);case"specialties":return r.jsx(qit,{block:s,variant:t},s.id);case"custom_links":return r.jsx(Hit,{block:s,cardId:e,variant:t},s.id);case"social_media":return r.jsx(Kit,{block:s,cardId:e,variant:t},s.id);default:return null}})})}async function Zit(e){try{const t=await fetch(e);if(!t.ok)return null;const n=await t.blob(),s=n.type||"image/jpeg";return new Promise(i=>{const o=new FileReader;o.onloadend=()=>{const a=o.result.split(",")[1];i({base64:a,mimeType:s})},o.onerror=()=>i(null),o.readAsDataURL(n)})}catch{return null}}function Yit(e){const t=e.trim().split(/\s+/);if(t.length<=1)return{first:t[0]||"",last:""};const n=t.pop();return{first:t.join(" "),last:n}}async function ese(e){const{first:t,last:n}=Yit(e.name),s=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`,`N:${n};${t};;;`];if(e.phone&&s.push(`TEL;TYPE=CELL:${e.phone}`),e.email&&s.push(`EMAIL;TYPE=INTERNET:${e.email}`),e.brokerage&&s.push(`ORG:${e.brokerage}`),s.push(`URL:${e.cardUrl}`),e.avatarUrl){const a=await Zit(e.avatarUrl);if(a){const p={"image/jpeg":"JPEG","image/jpg":"JPEG","image/png":"PNG","image/gif":"GIF","image/webp":"JPEG"}[a.mimeType]||"JPEG";s.push(`PHOTO;ENCODING=b;TYPE=${p}:${a.base64}`)}}s.push("END:VCARD");const i=new Blob([s.join(`\r `)],{type:"text/vcard"}),o=URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=`${e.name.replace(/\s+/g,"_")}.vcf`,l.click(),URL.revokeObjectURL(o),ze.success("Contact saved!")}function Xit({card:e}){var E;const[t,n]=I.useState(!1),[s,i]=I.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,L)=>{Sa(e.id,"button_click",T),L()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},b=()=>{var T,L;Sa(e.id,"contact_saved"),ese({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(L=e.profile)==null?void 0:L.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:e.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},N=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 via-white to-slate-50",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(ci,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ga,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-semibold bg-primary text-primary-foreground",children:l})]}),r.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-medium text-primary mb-1",children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-slate-500 mb-1",children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-slate-400 mb-3",children:e.team_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-slate-600 italic leading-relaxed max-w-xs mx-auto",children:['"',e.positioning_statement,'"']})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[r.jsxs(ee,{onClick:h,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(ca,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),r.jsxs(ee,{onClick:p,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(Po,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),r.jsxs(ee,{onClick:x,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(Ys,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),r.jsxs(ee,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[r.jsx(zs,{className:"h-5 w-5 mr-2"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm text-slate-600",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-amber-500 fill-amber-500"}),r.jsx("span",{className:"font-bold text-slate-900",children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"bg-slate-50 rounded-2xl p-4 mb-6 border border-slate-100",children:r.jsxs("p",{className:"text-sm text-slate-600 italic text-center",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-2",children:"About Me"}),r.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:e.bio})]}),r.jsx(Xne,{card:e,variant:"standard"}),r.jsx(Jne,{cardId:e.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[e.show_save_contact&&r.jsxs(ee,{variant:"ghost",onClick:b,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Va,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs(ee,{variant:"ghost",onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(vs,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),e.show_refer_friend&&r.jsxs(ee,{variant:"ghost",onClick:N,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Vn,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),r.jsxs(ee,{variant:"ghost",onClick:C,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Jh,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),r.jsxs(ee,{variant:"ghost",onClick:j,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(uc,{className:"h-4 w-4 mr-3 text-primary"}),"Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-slate-100 hover:bg-slate-200 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},L))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-slate-400",children:"Powered by LevelUp"})})]}),r.jsx(Qne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Qit({card:e}){var E;const[t,n]=I.useState(!1),[s,i]=I.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,L)=>{Sa(e.id,"button_click",T),L()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},b=()=>{var T,L;Sa(e.id,"contact_saved"),ese({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(L=e.profile)==null?void 0:L.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:e.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},N=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#0f1419] via-[#1a1f2e] to-[#0f1419]",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsx("div",{className:"w-16 h-0.5 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] mx-auto mb-8"}),r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(ci,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(Ga,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-serif bg-[#c9a84c]/20 text-[#e8d48b]",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-white tracking-wide mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-medium text-[#e8d48b] mb-1",children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#c9a84c] tracking-widest uppercase mb-1",children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:e.team_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-[#a0aec0] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',e.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:ca,label:"Call",handler:h},{icon:Po,label:"Text",handler:p},{icon:Ys,label:"Email",handler:x}].map(({icon:T,label:L,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-[#1e2636] hover:bg-[#252d3f] border border-[#c9a84c]/20 rounded-xl transition-colors",children:[r.jsx(T,{className:"h-5 w-5 text-[#c9a84c]"}),r.jsx("span",{className:"text-xs font-medium text-[#e2e8f0]",children:L})]},L))}),r.jsxs("button",{onClick:y,className:"w-full h-12 text-base font-semibold rounded-xl mb-6 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] text-[#0f1419] hover:opacity-90 transition-opacity flex items-center justify-center gap-2",children:[r.jsx(zs,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c] fill-[#c9a84c]"}),r.jsx("span",{className:"font-bold text-white",children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"bg-[#1e2636] rounded-xl p-4 mb-6 border border-[#c9a84c]/10",children:r.jsxs("p",{className:"text-sm text-[#a0aec0] italic text-center font-serif",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#c9a84c] mb-2 tracking-wide uppercase",children:"About"}),r.jsx("p",{className:"text-sm text-[#a0aec0] leading-relaxed",children:e.bio})]}),r.jsx(Xne,{card:e,variant:"luxury"}),r.jsx(Jne,{cardId:e.id,variant:"luxury"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:b,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Va,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Vn,{className:"h-4 w-4 text-[#c9a84c]"})," Refer a Friend"]}),r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Jh,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(uc,{className:"h-4 w-4 text-[#c9a84c]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-[#1e2636] border border-[#c9a84c]/20 hover:border-[#c9a84c]/50 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},L))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),r.jsx(Qne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Jit({card:e}){var E;const[t,n]=I.useState(!1),[s,i]=I.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,L)=>{Sa(e.id,"button_click",T),L()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},b=()=>{var T,L;Sa(e.id,"contact_saved"),ese({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(L=e.profile)==null?void 0:L.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},N=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#ff5722]",children:[r.jsxs("div",{className:"bg-[#1a1a2e] px-5 pt-10 pb-14 text-center relative",children:[e.show_photo&&r.jsxs(ci,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-[#ff5722] shadow-2xl",children:[r.jsx(Ga,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-black bg-[#ff5722] text-white",children:l})]}),r.jsx("h1",{className:"text-3xl font-black text-white tracking-tight mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-bold text-[#ff5722]/80 mb-1",children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-bold text-[#ff5722] uppercase tracking-wider mb-1",children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-bold text-white/60 uppercase tracking-wider",children:e.team_name})]}),r.jsxs("div",{className:"max-w-md mx-auto px-5 -mt-6",children:[r.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl px-5 py-8",children:[e.positioning_statement&&r.jsx("p",{className:"text-center text-[#1a1a2e] font-bold text-lg leading-snug mb-6 max-w-xs mx-auto",children:e.positioning_statement}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:ca,label:"Call",handler:h},{icon:Po,label:"Text",handler:p},{icon:Ys,label:"Email",handler:x}].map(({icon:T,label:L,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-[#1a1a2e] hover:bg-[#2a2a4e] text-white rounded-2xl transition-colors font-bold",children:[r.jsx(T,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs",children:L})]},L))}),r.jsxs("button",{onClick:y,className:"w-full h-14 text-base font-black rounded-2xl mb-6 bg-[#ff5722] hover:bg-[#e64a19] text-white transition-colors flex items-center justify-center gap-2 uppercase tracking-wide",children:[r.jsx(zs,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-5 mb-6",children:e.review_snippet&&r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-5 w-5 text-[#ff5722] fill-[#ff5722]"}),r.jsx("span",{className:"font-black text-[#1a1a2e] text-2xl",children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"bg-[#fff3e0] rounded-2xl p-4 mb-6",children:r.jsxs("p",{className:"text-sm text-[#1a1a2e] font-medium text-center",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-xs font-black text-[#ff5722] mb-2 uppercase tracking-wider",children:"About Me"}),r.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:e.bio})]}),r.jsx(Xne,{card:e,variant:"bold"}),r.jsx(Jne,{cardId:e.id,variant:"bold"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:b,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(Va,{className:"h-4 w-4 text-[#ff5722]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(vs,{className:"h-4 w-4 text-[#ff5722]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(Vn,{className:"h-4 w-4 text-[#ff5722]"})," Refer a Friend"]}),r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(Jh,{className:"h-4 w-4 text-[#ff5722]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(uc,{className:"h-4 w-4 text-[#ff5722]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-6",children:e.social_links.slice(0,3).map((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-[#1a1a2e] hover:bg-[#2a2a4e] flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},L))})]}),r.jsx("div",{className:"text-center py-6",children:r.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),r.jsx(Qne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function eat({card:e}){var E;const[t,n]=I.useState(!1),[s,i]=I.useState("booking"),o=((E=e.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),a=(T,L)=>{Sa(e.id,"button_click",T),L()},h=()=>a("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:ze.error("Phone number not available")}),p=()=>a("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:ze.error("Phone number not available")}),x=()=>a("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:ze.error("Email not available")}),y=()=>{e.booking_url?a("book",()=>window.open(e.booking_url,"_blank")):(i("booking"),n(!0),Sa(e.id,"button_click","book"))},b=()=>{var T,L;Sa(e.id,"contact_saved"),ese({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(L=e.profile)==null?void 0:L.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Sa(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},N=()=>{i("referral"),n(!0),Sa(e.id,"button_click","refer")},C=()=>{i("connect"),n(!0),Sa(e.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#f5f1eb]",children:[r.jsx("div",{className:"bg-[#1b3a4b] h-2"}),r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(ci,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ga,{src:e.avatar_url||void 0,alt:o}),r.jsx(di,{className:"text-2xl font-serif bg-[#1b3a4b] text-white",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-[#1b3a4b] mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:e.team_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-[#4a5568] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',e.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:ca,label:"Call",handler:h},{icon:Po,label:"Text",handler:p},{icon:Ys,label:"Email",handler:x}].map(({icon:T,label:L,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-white hover:bg-[#e8e3db] border border-[#d4cfc5] rounded-lg transition-colors shadow-sm",children:[r.jsx(T,{className:"h-5 w-5 text-[#1b3a4b]"}),r.jsx("span",{className:"text-xs font-semibold text-[#1b3a4b]",children:L})]},L))}),r.jsxs("button",{onClick:y,className:"w-full h-12 text-base font-semibold rounded-lg mb-6 bg-[#1b3a4b] hover:bg-[#264d61] text-white transition-colors flex items-center justify-center gap-2 shadow-sm",children:[r.jsx(zs,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsx("div",{className:"flex items-center justify-center gap-6",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843] fill-[#d4a843]"}),r.jsx("span",{className:"font-bold text-[#1b3a4b] font-serif",children:"5.0"})]})})}),e.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsxs("p",{className:"text-sm text-[#4a5568] italic text-center font-serif",children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#1b3a4b] mb-2 font-serif",children:"About"}),r.jsx("p",{className:"text-sm text-[#4a5568] leading-relaxed",children:e.bio})]}),r.jsx(Xne,{card:e,variant:"classic"}),r.jsx(Jne,{cardId:e.id,variant:"classic"}),r.jsxs("div",{className:"bg-white rounded-lg border border-[#d4cfc5] shadow-sm divide-y divide-[#e8e3db] mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:b,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Va,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{Sa(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Vn,{className:"h-4 w-4 text-[#5a7a6f]"})," Refer a Friend"]}),r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Jh,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(uc,{className:"h-4 w-4 text-[#5a7a6f]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Sa(e.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-white border border-[#d4cfc5] hover:bg-[#e8e3db] flex items-center justify-center text-lg transition-colors shadow-sm",children:A[T.platform.toLowerCase()]||"🔗"},L))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),r.jsx(Qne,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Ege({card:e}){switch(e.theme){case"luxury":return r.jsx(Qit,{card:e});case"bold":return r.jsx(Jit,{card:e});case"classic":return r.jsx(eat,{card:e});case"standard":default:return r.jsx(Xit,{card:e})}}function tat(){const e=Nm();I.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]);const t=e.pathname.slice(1);return!t||t===""?r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Agent Cards"}),r.jsx("p",{className:"text-slate-500",children:"Visit a specific agent's card URL to view their digital business card."})]})}):r.jsx(rat,{slug:t})}function rat({slug:e}){return r.jsx(nat,{slug:e})}function nat({slug:e}){var o;const{data:t,isLoading:n,error:s}=y6e(e);if(I.useEffect(()=>{t!=null&&t.id&&Sa(t.id,"card_view")},[t==null?void 0:t.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Pr,{className:"h-28 w-28 rounded-full"}),r.jsx(Pr,{className:"h-6 w-48"}),r.jsx(Pr,{className:"h-4 w-36"})]}),r.jsx(Pr,{className:"h-12 w-full"}),r.jsx(Pr,{className:"h-12 w-full"})]})});if(s||!t)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const i=((o=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[i," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.positioning_statement||`Connect with ${i}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${i} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:t.positioning_statement||`Connect with ${i}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(Ege,{card:t})]})}const che="levelup_affiliate_ref",sat=30,iat=()=>{const[e]=Fd();I.useEffect(()=>{const t=e.get("ref");if(t){const n={code:t.toUpperCase(),timestamp:Date.now()};localStorage.setItem(che,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",t)}},[e])},aat=()=>{try{const e=localStorage.getItem(che);if(!e)return null;const t=JSON.parse(e),n=sat*24*60*60*1e3;return Date.now()-t.timestamp>n?(localStorage.removeItem(che),console.log("[Affiliate] Referral code expired"),null):t.code}catch{return null}},nte="/assets/levelup-logo-header-_ZX7DvlA.png",oat="/assets/scale-your-team-ku4MPatU.png";function lat({open:e,onOpenChange:t}){return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-[#4a6b6d]/10 rounded-lg",children:r.jsx(na,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(es,{children:"Learn how LevelUp can empower your entire team"})]})]})}),e&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/brokerinterestmeeting",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Brokerage Interest Meeting"})]})})}const sd={individual_agent:{name:"Individual Agent",price:"$39",period:"/month",description:"Perfect for independent agents ready to level up",features:["Full dashboard access","300+ professional templates","Academy training library","Community & networking","Live events & workshops","Social media content","Newsletter resources","Email support"],trial:"7-day free trial"},brokerage_under_25:{name:"Brokerage",subtitle:"Under 25 Agents",price:"$299",period:"/month",description:"Empower your entire team to succeed",features:["Everything in Individual","Brokerage manager dashboard","Invite & manage up to 25 agents","Exclusive brokerage resources","Team performance analytics","Agent onboarding tools","Resource sharing","Priority support"]},brokerage_over_25:{name:"Brokerage",subtitle:"Over 25 Agents",price:"$499",period:"/month",description:"Scale your brokerage without limits",features:["Everything in Brokerage","Unlimited agents","Advanced team analytics","Dedicated account manager","Custom onboarding sessions","White-glove support"]}},cat=[{icon:Df,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:hd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:zs,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Ol,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:wi,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ha,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],dat=[{icon:Vn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Cs,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:ca,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Kh,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:ml,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:ac,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:oa,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Ng,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],uat=[{name:"Sarah M.",role:"Top Producer, RE/MAX",quote:"LevelUp completely transformed how I run my business. The templates alone save me hours every week."},{name:"Mike T.",role:"Brokerage Owner",quote:"Onboarding new agents used to take weeks. Now they're productive from day one with all the training resources."},{name:"Jessica L.",role:"Team Lead",quote:"The community is incredible. I've learned more from other agents here than any conference I've attended."}],hat=()=>{const{user:e,loading:t}=zr(),n=ns(),[s]=Fd();I.useEffect(()=>{const H=window.location.host==="listings.relevelup.com",K=window.location.pathname==="/";if(H&&K){n("/public/listings",{replace:!0});return}},[n]);const[i,o]=I.useState(null),[l,a]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(""),[b,j]=I.useState(""),[N,C]=I.useState(""),[A,E]=I.useState(!1),[T,L]=I.useState(!1),z=(H,K=!1)=>{a({tier:H,skipTrial:K}),p(!0)};iat(),I.useEffect(()=>{const H=window.location.host==="listings.relevelup.com",K=location.pathname.startsWith("/public/");!t&&e&&!H&&!K&&n("/dashboard")},[e,t,n,location.pathname]),I.useEffect(()=>{s.get("canceled")==="true"&&ze.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const F=async(H,K=!1)=>{if(!x){ze.error("Please enter your email address");return}if(!b.trim()){ze.error("Please enter your full name");return}E(!0),o(H+(K?"_direct":""));const Z=aat();try{const{data:te,error:ae}=await J.functions.invoke("create-checkout",{body:{tier:H,email:x,name:b.trim(),couponCode:N.trim()||void 0,skipTrial:K,referralCode:Z}});if(ae)throw ae;if(te!=null&&te.url)window.open(te.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(te){console.error("Checkout error:",te),ze.error(te.message||"Failed to start checkout. Please try again.")}finally{E(!1),o(null),p(!1),a(null)}},q=()=>{l&&F(l.tier,l.skipTrial)};return t?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#4a6b6d]",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-white border-t-transparent"})}):r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:nte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var H;return(H=document.getElementById("features"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(ee,{onClick:()=>n("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("p",{className:"text-lg text-white/80 max-w-3xl mx-auto leading-relaxed font-sans font-bold md:text-4xl",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("free-trial"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",children:["Start Your Free Trial",r.jsx(Zo,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(ee,{size:"lg",variant:"outline",onClick:()=>{var H;return(H=document.getElementById("features"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#1e3a4c] rounded-full",children:"See What's Included"})]})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Learn how we support agents and empower brokerages to grow—together."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center pt-4",children:[r.jsxs(ee,{size:"lg",variant:"outline",onClick:()=>{var H;return(H=document.getElementById("brokerage"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(na,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(Cc,{className:"mr-2 h-5 w-5"}),"Individual Membership"]})]})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:cat.map((H,K)=>r.jsxs(Ge,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Gt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(H.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Qt,{className:"text-xl font-sans",children:H.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:H.description})})]},K))})]})}),r.jsxs("section",{id:"agent-os",className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Cs,{className:"w-4 h-4"}),"Included with Membership"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:dat.map((H,K)=>r.jsxs(Ge,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(H.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Qt,{className:"text-lg font-semibold text-white",children:H.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:H.description})})]},K))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-white text-[#4a6b6d] hover:bg-white/90 shadow-xl transition-all hover:scale-105",children:["Get Agent OS with Your Membership",r.jsx(Zo,{className:"ml-2 w-5 h-5"})]})})]})]}),r.jsx("section",{id:"brokerage",className:"py-20 bg-[#4a6b6d]/5",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsx("div",{className:"max-w-6xl mx-auto",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[#4a6b6d]/10 text-[#4a6b6d] text-sm font-medium",children:[r.jsx(na,{className:"w-4 h-4"}),"For Brokerages"]}),r.jsxs("h2",{className:"text-3xl font-sans font-bold md:text-6xl",children:["Empower Your"," ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Entire Team"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Give every agent on your team access to world-class training and resources. Track performance, streamline onboarding, and watch your brokerage thrive."}),r.jsx("ul",{className:"space-y-4",children:["Dedicated brokerage manager dashboard","Invite and manage agents with one click","Exclusive brokerage-only resources","Team analytics and performance tracking","Simplified agent onboarding","Share resources across your team"].map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ca,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:H})]},K))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Ka,{className:"ml-2 w-5 h-5"})]}),r.jsxs(ee,{size:"lg",variant:"outline",onClick:()=>L(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(zs,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:oat,alt:"Scale Your Team from 5 to 500 Agents",className:"w-full rounded-3xl shadow-lg"})})]})})})}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Agents Love ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"LevelUp"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what top producers are saying about the platform."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 max-w-6xl mx-auto",children:uat.map((H,K)=>r.jsx(Ge,{className:"bg-muted/30 border-0",children:r.jsxs(Xe,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(Z=>r.jsx(vs,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},Z))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',H.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:H.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:H.role})]})]})},K))})]})}),r.jsxs("section",{id:"free-trial",className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center space-y-8",children:[r.jsxs("h2",{className:"text-3xl md:text-5xl font-bold text-white",children:["Start Your Free Trial ",r.jsx("span",{className:"italic",children:"Today"})]}),r.jsx("p",{className:"text-lg md:text-xl text-white/80 leading-relaxed",children:"Get instant access to 7 days of trainings, templates, and tools — designed to give you quick wins now and resources you'll keep forever."}),r.jsx("div",{className:"pt-4",children:r.jsxs(ee,{size:"lg",className:"px-12 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",onClick:()=>z("individual_agent"),children:["Start Free Trial",r.jsx(Zo,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]})})]}),r.jsx("section",{id:"pricing",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Simple, Transparent ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Pricing"})]}),r.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Choose the plan that fits your needs. All plans include everything you need to succeed."})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:[r.jsxs(Ge,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Gt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Cc,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Qt,{className:"text-xl font-sans",children:sd.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:sd.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:sd.individual_agent.period})]}),r.jsx(En,{className:"text-base mt-2",children:sd.individual_agent.description}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-500/10 text-green-600 text-sm font-medium mt-4",children:[r.jsx(Ki,{className:"w-4 h-4"}),sd.individual_agent.trial]})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:sd.individual_agent.features.map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ca,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},K))})}),r.jsxs(oA,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("individual_agent"),children:"Start Free Trial"}),r.jsx(ee,{variant:"outline",className:"w-full rounded-full border-2 border-[#4a6b6d] text-[#4a6b6d] bg-white hover:bg-[#4a6b6d]/5 uppercase text-sm font-medium tracking-wide",onClick:()=>z("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),r.jsxs(Ge,{className:"relative flex flex-col border-2 border-[#4a6b6d] shadow-2xl scale-105 bg-background",children:[r.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 px-6 py-2 bg-[#4a6b6d] text-white text-sm font-semibold rounded-full shadow-lg",children:"Most Popular"}),r.jsxs(Gt,{className:"pb-4 pt-8",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(na,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-xl font-sans",children:sd.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:sd.brokerage_under_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:sd.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:sd.brokerage_under_25.period})]}),r.jsx(En,{className:"text-base mt-2",children:sd.brokerage_under_25.description})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:sd.brokerage_under_25.features.map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ca,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},K))})}),r.jsx(oA,{className:"pt-4",children:r.jsx(ee,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_under_25"),children:"Get Started"})})]}),r.jsxs(Ge,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Gt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(na,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-xl font-sans",children:sd.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:sd.brokerage_over_25.subtitle})]})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:sd.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:sd.brokerage_over_25.period})]}),r.jsx(En,{className:"text-base mt-2",children:sd.brokerage_over_25.description})]}),r.jsx(Xe,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:sd.brokerage_over_25.features.map((H,K)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ca,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},K))})}),r.jsx(oA,{className:"pt-4",children:r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_over_25"),children:"Get Started"})})]})]})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl text-white font-sans md:text-5xl",children:"Ready to Level Up?"}),r.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"Join thousands of agents who are closing more deals, saving time, and growing their business with LevelUp."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"px-10 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105",children:["Start Your Free Trial",r.jsx(Zo,{className:"ml-2 w-5 h-5"})]}),r.jsx(ee,{size:"lg",onClick:()=>n("/auth"),className:"px-10 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#4a6b6d]",children:"Sign In"})]})]})})]}),r.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("img",{src:nte,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx("a",{href:"/privacy-policy",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Privacy Policy"}),r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Contact Support"})]})]})})}),r.jsx(lat,{open:T,onOpenChange:L}),r.jsx(Br,{open:h,onOpenChange:p,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(es,{children:(l==null?void 0:l.tier)==="individual_agent"&&!(l!=null&&l.skipTrial)?"Start your 7-day free trial":(l==null?void 0:l.tier)==="individual_agent"?"Subscribe to Individual Agent":(l==null?void 0:l.tier)==="brokerage_under_25"?"Subscribe to Brokerage (Under 25 Agents)":"Subscribe to Brokerage (Over 25 Agents)"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsxs(Ue,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(at,{id:"dialog-name",type:"text",placeholder:"John Smith",value:b,onChange:H=>j(H.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Ue,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(at,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:H=>y(H.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(Ue,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(at,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:N,onChange:H=>C(H.target.value),className:"mt-1"})]})]}),r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:q,disabled:A,children:A?"Loading...":"Continue to Checkout"})]})})]})},fat=()=>r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Privacy Policy | LevelUp"}),r.jsx("meta",{name:"description",content:"Privacy Policy for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Privacy Policy"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Introduction"}),r.jsx("p",{children:'Welcome to LevelUp ("we," "our," or "us"). We are committed to protecting your personal information and your right to privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you use our platform.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Information We Collect"}),r.jsx("p",{children:"We collect information that you provide directly to us, including:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Name and contact information (email address, phone number)"}),r.jsx("li",{children:"Account credentials"}),r.jsx("li",{children:"Profile information"}),r.jsx("li",{children:"Transaction and billing information"}),r.jsx("li",{children:"Communications you send to us"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. How We Use Your Information"}),r.jsx("p",{children:"We use the information we collect to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide, maintain, and improve our services"}),r.jsx("li",{children:"Process transactions and send related information"}),r.jsx("li",{children:"Send you technical notices and support messages"}),r.jsx("li",{children:"Respond to your comments and questions"}),r.jsx("li",{children:"Communicate with you about products, services, and events"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Information Sharing"}),r.jsx("p",{children:"We do not sell, trade, or otherwise transfer your personal information to third parties without your consent, except as described in this policy or as required by law."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Data Security"}),r.jsx("p",{children:"We implement appropriate technical and organizational measures to protect the security of your personal information. However, no method of transmission over the Internet is 100% secure."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Your Rights"}),r.jsx("p",{children:"You have the right to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Access your personal information"}),r.jsx("li",{children:"Correct inaccurate data"}),r.jsx("li",{children:"Request deletion of your data"}),r.jsx("li",{children:"Opt-out of marketing communications"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Third-Party Services"}),r.jsx("p",{children:"Our platform may integrate with third-party services such as Facebook and Instagram for social media posting features. When you connect these accounts, you are subject to their respective privacy policies."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Contact Us"}),r.jsxs("p",{children:["If you have questions about this Privacy Policy, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),pat=()=>r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Terms of Service | LevelUp"}),r.jsx("meta",{name:"description",content:"Terms of Service for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Terms of Service"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"1. Acceptance of Terms"}),r.jsx("p",{children:'By accessing or using the LevelUp platform ("Service"), you agree to be bound by these Terms of Service. If you do not agree to these terms, please do not use our Service.'})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"2. Description of Service"}),r.jsx("p",{children:"LevelUp provides a platform for real estate professionals to access training, resources, marketing tools, and community features. We reserve the right to modify or discontinue the Service at any time."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"3. User Accounts"}),r.jsx("p",{children:"To use certain features, you must create an account. You agree to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Provide accurate and complete information"}),r.jsx("li",{children:"Maintain the security of your account credentials"}),r.jsx("li",{children:"Notify us immediately of any unauthorized access"}),r.jsx("li",{children:"Accept responsibility for all activities under your account"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"4. Acceptable Use"}),r.jsx("p",{children:"You agree not to:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Violate any applicable laws or regulations"}),r.jsx("li",{children:"Infringe on the rights of others"}),r.jsx("li",{children:"Upload malicious code or interfere with the Service"}),r.jsx("li",{children:"Attempt to gain unauthorized access to any part of the Service"}),r.jsx("li",{children:"Use the Service for any unlawful purpose"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"5. Intellectual Property"}),r.jsx("p",{children:"The Service and its original content, features, and functionality are owned by LevelUp and are protected by international copyright, trademark, and other intellectual property laws."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"6. Third-Party Integrations"}),r.jsx("p",{children:"Our Service may integrate with third-party platforms such as Facebook and Instagram. Your use of these integrations is subject to the terms and policies of those third parties. We are not responsible for the content or practices of any third-party services."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"7. Payment Terms"}),r.jsx("p",{children:"Certain features may require payment. By subscribing to paid features, you agree to pay all applicable fees. All payments are non-refundable unless otherwise specified."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"8. Limitation of Liability"}),r.jsx("p",{children:"To the maximum extent permitted by law, LevelUp shall not be liable for any indirect, incidental, special, consequential, or punitive damages resulting from your use of the Service."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"9. Termination"}),r.jsx("p",{children:"We may terminate or suspend your account at any time, without prior notice, for conduct that we believe violates these Terms or is harmful to other users, us, or third parties."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"10. Changes to Terms"}),r.jsx("p",{children:"We reserve the right to modify these Terms at any time. We will notify you of significant changes by posting a notice on our platform. Continued use of the Service constitutes acceptance of the modified terms."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"11. Contact Us"}),r.jsxs("p",{children:["If you have questions about these Terms, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]}),mat=()=>r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Data Deletion | LevelUp"}),r.jsx("meta",{name:"description",content:"Data deletion instructions for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Data Deletion Instructions"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"How to Request Data Deletion"}),r.jsx("p",{children:"If you wish to have your data deleted from LevelUp, you can request deletion through one of the following methods:"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 1: Email Request"}),r.jsxs("p",{children:["Send an email to"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})," ",'with the subject line "Data Deletion Request" and include:']}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your full name"}),r.jsx("li",{children:"The email address associated with your account"}),r.jsx("li",{children:"A clear statement requesting deletion of your data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 2: Account Settings"}),r.jsx("p",{children:"If you have an active account, you can request data deletion through your account settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Log in to your LevelUp account"}),r.jsx("li",{children:"Navigate to your Profile settings"}),r.jsx("li",{children:"Contact support through the Support page to request account deletion"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"What Data Will Be Deleted"}),r.jsx("p",{children:"Upon a valid deletion request, we will delete:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your account information (name, email, profile data)"}),r.jsx("li",{children:"Any content you have created or uploaded"}),r.jsx("li",{children:"Your activity history and preferences"}),r.jsx("li",{children:"Connected social media account tokens and data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Data Retention"}),r.jsx("p",{children:"Some data may be retained for legal or legitimate business purposes, such as:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Transaction records required for financial reporting"}),r.jsx("li",{children:"Data necessary to comply with legal obligations"}),r.jsx("li",{children:"Anonymized or aggregated data that cannot identify you"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Facebook/Instagram Data"}),r.jsx("p",{children:"If you have connected your Facebook or Instagram account to LevelUp, you can also manage your data through Facebook's settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Go to your Facebook Settings & Privacy → Settings"}),r.jsx("li",{children:'Click on "Apps and Websites"'}),r.jsx("li",{children:'Find LevelUp and click "Remove"'}),r.jsx("li",{children:"This will revoke our access to your Facebook/Instagram data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Processing Time"}),r.jsx("p",{children:"We will process your data deletion request within 30 days of receiving it. You will receive a confirmation email once your data has been deleted."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Contact Us"}),r.jsxs("p",{children:["If you have questions about data deletion, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]});var ro;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const l of i)o[l]=l;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),l={};for(const a of o)l[a]=i[a];return e.objectValues(l)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const l in i)Object.prototype.hasOwnProperty.call(i,l)&&o.push(l);return o},e.find=(i,o)=>{for(const l of i)if(o(l))return l},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function s(i,o=" | "){return i.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}e.joinValues=s,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ro||(ro={}));var kje;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(kje||(kje={}));const Ts=ro.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),x0=e=>{switch(typeof e){case"undefined":return Ts.undefined;case"string":return Ts.string;case"number":return Number.isNaN(e)?Ts.nan:Ts.number;case"boolean":return Ts.boolean;case"function":return Ts.function;case"bigint":return Ts.bigint;case"symbol":return Ts.symbol;case"object":return Array.isArray(e)?Ts.array:e===null?Ts.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ts.promise:typeof Map<"u"&&e instanceof Map?Ts.map:typeof Set<"u"&&e instanceof Set?Ts.set:typeof Date<"u"&&e instanceof Date?Ts.date:Ts.object;default:return Ts.unknown}},On=ro.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Pg extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(o){return o.message},s={_errors:[]},i=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(i);else if(l.code==="invalid_return_type")i(l.returnTypeError);else if(l.code==="invalid_arguments")i(l.argumentsError);else if(l.path.length===0)s._errors.push(n(l));else{let a=s,h=0;for(;hn.message){const n={},s=[];for(const i of this.issues)if(i.path.length>0){const o=i.path[0];n[o]=n[o]||[],n[o].push(t(i))}else s.push(t(i));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}Pg.create=e=>new Pg(e);const dhe=(e,t)=>{let n;switch(e.code){case On.invalid_type:e.received===Ts.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case On.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ro.jsonStringifyReplacer)}`;break;case On.unrecognized_keys:n=`Unrecognized key(s) in object: ${ro.joinValues(e.keys,", ")}`;break;case On.invalid_union:n="Invalid input";break;case On.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ro.joinValues(e.options)}`;break;case On.invalid_enum_value:n=`Invalid enum value. Expected ${ro.joinValues(e.options)}, received '${e.received}'`;break;case On.invalid_arguments:n="Invalid function arguments";break;case On.invalid_return_type:n="Invalid function return type";break;case On.invalid_date:n="Invalid date";break;case On.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ro.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case On.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case On.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case On.custom:n="Invalid input";break;case On.invalid_intersection_types:n="Intersection results could not be merged";break;case On.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case On.not_finite:n="Number must be finite";break;default:n=t.defaultError,ro.assertNever(e)}return{message:n}};let gat=dhe;function xat(){return gat}const yat=e=>{const{data:t,path:n,errorMaps:s,issueData:i}=e,o=[...n,...i.path||[]],l={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let a="";const h=s.filter(p=>!!p).slice().reverse();for(const p of h)a=p(l,{data:t,defaultError:a}).message;return{...i,path:o,message:a}};function hs(e,t){const n=xat(),s=yat({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===dhe?void 0:dhe].filter(i=>!!i)});e.common.issues.push(s)}class sf{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const s=[];for(const i of n){if(i.status==="aborted")return Wi;i.status==="dirty"&&t.dirty(),s.push(i.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){const s=[];for(const i of n){const o=await i.key,l=await i.value;s.push({key:o,value:l})}return sf.mergeObjectSync(t,s)}static mergeObjectSync(t,n){const s={};for(const i of n){const{key:o,value:l}=i;if(o.status==="aborted"||l.status==="aborted")return Wi;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||i.alwaysSet)&&(s[o.value]=l.value)}return{status:t.value,value:s}}}const Wi=Object.freeze({status:"aborted"}),uT=e=>({status:"dirty",value:e}),sp=e=>({status:"valid",value:e}),Nje=e=>e.status==="aborted",Sje=e=>e.status==="dirty",lC=e=>e.status==="valid",ste=e=>typeof Promise<"u"&&e instanceof Promise;var Ds;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ds||(Ds={}));class z1{constructor(t,n,s,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Cje=(e,t)=>{if(lC(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Pg(e.common.issues);return this._error=n,this._error}}};function va(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:i}=e;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(l,a)=>{const{message:h}=e;return l.code==="invalid_enum_value"?{message:h??a.defaultError}:typeof a.data>"u"?{message:h??s??a.defaultError}:l.code!=="invalid_type"?{message:a.defaultError}:{message:h??n??a.defaultError}},description:i}}class Ja{get description(){return this._def.description}_getType(t){return x0(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:x0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new sf,ctx:{common:t.parent.common,data:t.data,parsedType:x0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ste(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,n){const s={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:x0(t)},i=this._parseSync({data:t,path:s.path,parent:s});return Cje(s,i)}"~validate"(t){var s,i;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:x0(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return lC(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(i=(s=o==null?void 0:o.message)==null?void 0:s.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>lC(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(t,n){const s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,n){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:x0(t)},i=this._parse({data:t,path:s.path,parent:s}),o=await(ste(i)?i:Promise.resolve(i));return Cje(s,o)}refine(t,n){const s=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const l=t(i),a=()=>o.addIssue({code:On.custom,...s(i)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(a(),!1)):l?!0:(a(),!1)})}refinement(t,n){return this._refinement((s,i)=>t(s)?!0:(i.addIssue(typeof n=="function"?n(s,i):n),!1))}_refinement(t){return new uC({schema:this,typeName:Gi.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return N1.create(this,this._def)}nullable(){return hC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Tg.create(this)}promise(){return lte.create(this,this._def)}or(t){return ate.create([this,t],this._def)}and(t){return ote.create(this,t,this._def)}transform(t){return new uC({...va(this._def),schema:this,typeName:Gi.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new phe({...va(this._def),innerType:this,defaultValue:n,typeName:Gi.ZodDefault})}brand(){return new $at({typeName:Gi.ZodBranded,type:this,...va(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new mhe({...va(this._def),innerType:this,catchValue:n,typeName:Gi.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Ige.create(this,t)}readonly(){return ghe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vat=/^c[^\s-]{8,}$/i,_at=/^[0-9a-z]+$/,bat=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wat=/^[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,jat=/^[a-z0-9_-]{21}$/i,kat=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nat=/^[-+]?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)?)??$/,Sat=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Cat="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Wle;const Mat=/^(?:(?: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])$/,Tat=/^(?:(?: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])$/,Aat=/^(([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]))$/,Eat=/^(([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])$/,Iat=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pat=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,P6e="((\\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])))",Lat=new RegExp(`^${P6e}$`);function L6e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Oat(e){return new RegExp(`^${L6e(e)}$`)}function Dat(e){let t=`${P6e}T${L6e(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Rat(e,t){return!!((t==="v4"||!t)&&Mat.test(e)||(t==="v6"||!t)&&Aat.test(e))}function Fat(e,t){if(!kat.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(s));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function zat(e,t){return!!((t==="v4"||!t)&&Tat.test(e)||(t==="v6"||!t)&&Eat.test(e))}class H0 extends Ja{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ts.string){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_type,expected:Ts.string,received:o.parsedType}),Wi}const s=new sf;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),hs(i,{code:On.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){const l=t.data.length>o.value,a=t.data.lengtht.test(i),{validation:n,code:On.invalid_string,...Ds.errToObj(s)})}_addCheck(t){return new H0({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ds.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ds.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ds.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ds.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ds.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ds.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ds.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ds.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ds.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Ds.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Ds.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ds.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Ds.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Ds.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ds.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ds.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ds.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ds.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ds.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ds.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ds.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ds.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ds.errToObj(n)})}nonempty(t){return this.min(1,Ds.errToObj(t))}trim(){return new H0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new H0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new H0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew H0({checks:[],typeName:Gi.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...va(e)});function Bat(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,i=n>s?n:s,o=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return o%l/10**i}class cC extends Ja{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ts.number){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_type,expected:Ts.number,received:o.parsedType}),Wi}let s;const i=new sf;for(const o of this._def.checks)o.kind==="int"?ro.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),hs(s,{code:On.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Bat(t.data,o.value)!==0&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),hs(s,{code:On.not_finite,message:o.message}),i.dirty()):ro.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ds.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ds.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ds.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ds.toString(n))}setLimit(t,n,s,i){return new cC({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Ds.toString(i)}]})}_addCheck(t){return new cC({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ds.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ds.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ds.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ds.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ds.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ds.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ds.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ds.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ds.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&ro.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(t===null||s.valuenew cC({checks:[],typeName:Gi.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...va(e)});class nE extends Ja{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ts.bigint)return this._getInvalidInput(t);let s;const i=new sf;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ro.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return hs(n,{code:On.invalid_type,expected:Ts.bigint,received:n.parsedType}),Wi}gte(t,n){return this.setLimit("min",t,!0,Ds.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ds.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ds.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ds.toString(n))}setLimit(t,n,s,i){return new nE({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Ds.toString(i)}]})}_addCheck(t){return new nE({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ds.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ds.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ds.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ds.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ds.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew nE({checks:[],typeName:Gi.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...va(e)});class uhe extends Ja{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ts.boolean){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ts.boolean,received:s.parsedType}),Wi}return sp(t.data)}}uhe.create=e=>new uhe({typeName:Gi.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...va(e)});class ite extends Ja{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ts.date){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_type,expected:Ts.date,received:o.parsedType}),Wi}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return hs(o,{code:On.invalid_date}),Wi}const s=new sf;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),hs(i,{code:On.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):ro.assertNever(o);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new ite({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ds.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ds.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew ite({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Gi.ZodDate,...va(e)});class Mje extends Ja{_parse(t){if(this._getType(t)!==Ts.symbol){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ts.symbol,received:s.parsedType}),Wi}return sp(t.data)}}Mje.create=e=>new Mje({typeName:Gi.ZodSymbol,...va(e)});class Tje extends Ja{_parse(t){if(this._getType(t)!==Ts.undefined){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ts.undefined,received:s.parsedType}),Wi}return sp(t.data)}}Tje.create=e=>new Tje({typeName:Gi.ZodUndefined,...va(e)});class Aje extends Ja{_parse(t){if(this._getType(t)!==Ts.null){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ts.null,received:s.parsedType}),Wi}return sp(t.data)}}Aje.create=e=>new Aje({typeName:Gi.ZodNull,...va(e)});class Eje extends Ja{constructor(){super(...arguments),this._any=!0}_parse(t){return sp(t.data)}}Eje.create=e=>new Eje({typeName:Gi.ZodAny,...va(e)});class Ije extends Ja{constructor(){super(...arguments),this._unknown=!0}_parse(t){return sp(t.data)}}Ije.create=e=>new Ije({typeName:Gi.ZodUnknown,...va(e)});class B1 extends Ja{_parse(t){const n=this._getOrReturnCtx(t);return hs(n,{code:On.invalid_type,expected:Ts.never,received:n.parsedType}),Wi}}B1.create=e=>new B1({typeName:Gi.ZodNever,...va(e)});class Pje extends Ja{_parse(t){if(this._getType(t)!==Ts.undefined){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ts.void,received:s.parsedType}),Wi}return sp(t.data)}}Pje.create=e=>new Pje({typeName:Gi.ZodVoid,...va(e)});class Tg extends Ja{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ts.array)return hs(n,{code:On.invalid_type,expected:Ts.array,received:n.parsedType}),Wi;if(i.exactLength!==null){const l=n.data.length>i.exactLength.value,a=n.data.lengthi.maxLength.value&&(hs(n,{code:On.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((l,a)=>i.type._parseAsync(new z1(n,l,n.path,a)))).then(l=>sf.mergeArray(s,l));const o=[...n.data].map((l,a)=>i.type._parseSync(new z1(n,l,n.path,a)));return sf.mergeArray(s,o)}get element(){return this._def.type}min(t,n){return new Tg({...this._def,minLength:{value:t,message:Ds.toString(n)}})}max(t,n){return new Tg({...this._def,maxLength:{value:t,message:Ds.toString(n)}})}length(t,n){return new Tg({...this._def,exactLength:{value:t,message:Ds.toString(n)}})}nonempty(t){return this.min(1,t)}}Tg.create=(e,t)=>new Tg({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Gi.ZodArray,...va(t)});function y4(e){if(e instanceof jc){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=N1.create(y4(s))}return new jc({...e._def,shape:()=>t})}else return e instanceof Tg?new Tg({...e._def,type:y4(e.element)}):e instanceof N1?N1.create(y4(e.unwrap())):e instanceof hC?hC.create(y4(e.unwrap())):e instanceof $j?$j.create(e.items.map(t=>y4(t))):e}class jc extends Ja{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=ro.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ts.object){const p=this._getOrReturnCtx(t);return hs(p,{code:On.invalid_type,expected:Ts.object,received:p.parsedType}),Wi}const{status:s,ctx:i}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),a=[];if(!(this._def.catchall instanceof B1&&this._def.unknownKeys==="strip"))for(const p in i.data)l.includes(p)||a.push(p);const h=[];for(const p of l){const x=o[p],y=i.data[p];h.push({key:{status:"valid",value:p},value:x._parse(new z1(i,y,i.path,p)),alwaysSet:p in i.data})}if(this._def.catchall instanceof B1){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of a)h.push({key:{status:"valid",value:x},value:{status:"valid",value:i.data[x]}});else if(p==="strict")a.length>0&&(hs(i,{code:On.unrecognized_keys,keys:a}),s.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of a){const y=i.data[x];h.push({key:{status:"valid",value:x},value:p._parse(new z1(i,y,i.path,x)),alwaysSet:x in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of h){const y=await x.key,b=await x.value;p.push({key:y,value:b,alwaysSet:x.alwaysSet})}return p}).then(p=>sf.mergeObjectSync(s,p)):sf.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(t){return Ds.errToObj,new jc({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{var o,l;const i=((l=(o=this._def).errorMap)==null?void 0:l.call(o,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:Ds.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new jc({...this._def,unknownKeys:"strip"})}passthrough(){return new jc({...this._def,unknownKeys:"passthrough"})}extend(t){return new jc({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new jc({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Gi.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new jc({...this._def,catchall:t})}pick(t){const n={};for(const s of ro.objectKeys(t))t[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new jc({...this._def,shape:()=>n})}omit(t){const n={};for(const s of ro.objectKeys(this.shape))t[s]||(n[s]=this.shape[s]);return new jc({...this._def,shape:()=>n})}deepPartial(){return y4(this)}partial(t){const n={};for(const s of ro.objectKeys(this.shape)){const i=this.shape[s];t&&!t[s]?n[s]=i:n[s]=i.optional()}return new jc({...this._def,shape:()=>n})}required(t){const n={};for(const s of ro.objectKeys(this.shape))if(t&&!t[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof N1;)o=o._def.innerType;n[s]=o}return new jc({...this._def,shape:()=>n})}keyof(){return O6e(ro.objectKeys(this.shape))}}jc.create=(e,t)=>new jc({shape:()=>e,unknownKeys:"strip",catchall:B1.create(),typeName:Gi.ZodObject,...va(t)});jc.strictCreate=(e,t)=>new jc({shape:()=>e,unknownKeys:"strict",catchall:B1.create(),typeName:Gi.ZodObject,...va(t)});jc.lazycreate=(e,t)=>new jc({shape:e,unknownKeys:"strip",catchall:B1.create(),typeName:Gi.ZodObject,...va(t)});class ate extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t),s=this._def.options;function i(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(a=>new Pg(a.ctx.common.issues));return hs(n,{code:On.invalid_union,unionErrors:l}),Wi}if(n.common.async)return Promise.all(s.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(i);{let o;const l=[];for(const h of s){const p={...n,common:{...n.common,issues:[]},parent:null},x=h._parseSync({data:n.data,path:n.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!o&&(o={result:x,ctx:p}),p.common.issues.length&&l.push(p.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const a=l.map(h=>new Pg(h));return hs(n,{code:On.invalid_union,unionErrors:a}),Wi}}get options(){return this._def.options}}ate.create=(e,t)=>new ate({options:e,typeName:Gi.ZodUnion,...va(t)});function hhe(e,t){const n=x0(e),s=x0(t);if(e===t)return{valid:!0,data:e};if(n===Ts.object&&s===Ts.object){const i=ro.objectKeys(t),o=ro.objectKeys(e).filter(a=>i.indexOf(a)!==-1),l={...e,...t};for(const a of o){const h=hhe(e[a],t[a]);if(!h.valid)return{valid:!1};l[a]=h.data}return{valid:!0,data:l}}else if(n===Ts.array&&s===Ts.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(Nje(o)||Nje(l))return Wi;const a=hhe(o.value,l.value);return a.valid?((Sje(o)||Sje(l))&&n.dirty(),{status:n.value,value:a.data}):(hs(s,{code:On.invalid_intersection_types}),Wi)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,l])=>i(o,l)):i(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ote.create=(e,t,n)=>new ote({left:e,right:t,typeName:Gi.ZodIntersection,...va(n)});class $j extends Ja{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ts.array)return hs(s,{code:On.invalid_type,expected:Ts.array,received:s.parsedType}),Wi;if(s.data.lengththis._def.items.length&&(hs(s,{code:On.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((l,a)=>{const h=this._def.items[a]||this._def.rest;return h?h._parse(new z1(s,l,s.path,a)):null}).filter(l=>!!l);return s.common.async?Promise.all(o).then(l=>sf.mergeArray(n,l)):sf.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new $j({...this._def,rest:t})}}$j.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $j({items:e,typeName:Gi.ZodTuple,rest:null,...va(t)})};class Lje extends Ja{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ts.map)return hs(s,{code:On.invalid_type,expected:Ts.map,received:s.parsedType}),Wi;const i=this._def.keyType,o=this._def.valueType,l=[...s.data.entries()].map(([a,h],p)=>({key:i._parse(new z1(s,a,s.path,[p,"key"])),value:o._parse(new z1(s,h,s.path,[p,"value"]))}));if(s.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const h of l){const p=await h.key,x=await h.value;if(p.status==="aborted"||x.status==="aborted")return Wi;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),a.set(p.value,x.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const h of l){const p=h.key,x=h.value;if(p.status==="aborted"||x.status==="aborted")return Wi;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),a.set(p.value,x.value)}return{status:n.value,value:a}}}}Lje.create=(e,t,n)=>new Lje({valueType:t,keyType:e,typeName:Gi.ZodMap,...va(n)});class sE extends Ja{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ts.set)return hs(s,{code:On.invalid_type,expected:Ts.set,received:s.parsedType}),Wi;const i=this._def;i.minSize!==null&&s.data.sizei.maxSize.value&&(hs(s,{code:On.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function l(h){const p=new Set;for(const x of h){if(x.status==="aborted")return Wi;x.status==="dirty"&&n.dirty(),p.add(x.value)}return{status:n.value,value:p}}const a=[...s.data.values()].map((h,p)=>o._parse(new z1(s,h,s.path,p)));return s.common.async?Promise.all(a).then(h=>l(h)):l(a)}min(t,n){return new sE({...this._def,minSize:{value:t,message:Ds.toString(n)}})}max(t,n){return new sE({...this._def,maxSize:{value:t,message:Ds.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}sE.create=(e,t)=>new sE({valueType:e,minSize:null,maxSize:null,typeName:Gi.ZodSet,...va(t)});class Oje extends Ja{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Oje.create=(e,t)=>new Oje({getter:e,typeName:Gi.ZodLazy,...va(t)});class fhe extends Ja{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return hs(n,{received:n.data,code:On.invalid_literal,expected:this._def.value}),Wi}return{status:"valid",value:t.data}}get value(){return this._def.value}}fhe.create=(e,t)=>new fhe({value:e,typeName:Gi.ZodLiteral,...va(t)});function O6e(e,t){return new dC({values:e,typeName:Gi.ZodEnum,...va(t)})}class dC extends Ja{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return hs(n,{expected:ro.joinValues(s),received:n.parsedType,code:On.invalid_type}),Wi}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),s=this._def.values;return hs(n,{received:n.data,code:On.invalid_enum_value,options:s}),Wi}return sp(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return dC.create(t,{...this._def,...n})}exclude(t,n=this._def){return dC.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}dC.create=O6e;class Dje extends Ja{_parse(t){const n=ro.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Ts.string&&s.parsedType!==Ts.number){const i=ro.objectValues(n);return hs(s,{expected:ro.joinValues(i),received:s.parsedType,code:On.invalid_type}),Wi}if(this._cache||(this._cache=new Set(ro.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=ro.objectValues(n);return hs(s,{received:s.data,code:On.invalid_enum_value,options:i}),Wi}return sp(t.data)}get enum(){return this._def.values}}Dje.create=(e,t)=>new Dje({values:e,typeName:Gi.ZodNativeEnum,...va(t)});class lte extends Ja{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ts.promise&&n.common.async===!1)return hs(n,{code:On.invalid_type,expected:Ts.promise,received:n.parsedType}),Wi;const s=n.parsedType===Ts.promise?n.data:Promise.resolve(n.data);return sp(s.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}lte.create=(e,t)=>new lte({type:e,typeName:Gi.ZodPromise,...va(t)});class uC extends Ja{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Gi.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:l=>{hs(s,l),l.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const l=i.transform(s.data,o);if(s.common.async)return Promise.resolve(l).then(async a=>{if(n.value==="aborted")return Wi;const h=await this._def.schema._parseAsync({data:a,path:s.path,parent:s});return h.status==="aborted"?Wi:h.status==="dirty"||n.value==="dirty"?uT(h.value):h});{if(n.value==="aborted")return Wi;const a=this._def.schema._parseSync({data:l,path:s.path,parent:s});return a.status==="aborted"?Wi:a.status==="dirty"||n.value==="dirty"?uT(a.value):a}}if(i.type==="refinement"){const l=a=>{const h=i.refinement(a,o);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(s.common.async===!1){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Wi:(a.status==="dirty"&&n.dirty(),l(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(a=>a.status==="aborted"?Wi:(a.status==="dirty"&&n.dirty(),l(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(s.common.async===!1){const l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!lC(l))return Wi;const a=i.transform(l.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>lC(l)?Promise.resolve(i.transform(l.value,o)).then(a=>({status:n.value,value:a})):Wi);ro.assertNever(i)}}uC.create=(e,t,n)=>new uC({schema:e,typeName:Gi.ZodEffects,effect:t,...va(n)});uC.createWithPreprocess=(e,t,n)=>new uC({schema:t,effect:{type:"preprocess",transform:e},typeName:Gi.ZodEffects,...va(n)});class N1 extends Ja{_parse(t){return this._getType(t)===Ts.undefined?sp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}N1.create=(e,t)=>new N1({innerType:e,typeName:Gi.ZodOptional,...va(t)});class hC extends Ja{_parse(t){return this._getType(t)===Ts.null?sp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}hC.create=(e,t)=>new hC({innerType:e,typeName:Gi.ZodNullable,...va(t)});class phe extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===Ts.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}phe.create=(e,t)=>new phe({innerType:e,typeName:Gi.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...va(t)});class mhe extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ste(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Pg(s.common.issues)},input:s.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Pg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}mhe.create=(e,t)=>new mhe({innerType:e,typeName:Gi.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...va(t)});class Rje extends Ja{_parse(t){if(this._getType(t)!==Ts.nan){const s=this._getOrReturnCtx(t);return hs(s,{code:On.invalid_type,expected:Ts.nan,received:s.parsedType}),Wi}return{status:"valid",value:t.data}}}Rje.create=e=>new Rje({typeName:Gi.ZodNaN,...va(e)});class $at extends Ja{_parse(t){const{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Ige extends Ja{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Wi:o.status==="dirty"?(n.dirty(),uT(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{const i=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Wi:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:s.path,parent:s})}}static create(t,n){return new Ige({in:t,out:n,typeName:Gi.ZodPipeline})}}class ghe extends Ja{_parse(t){const n=this._def.innerType._parse(t),s=i=>(lC(i)&&(i.value=Object.freeze(i.value)),i);return ste(n)?n.then(i=>s(i)):s(n)}unwrap(){return this._def.innerType}}ghe.create=(e,t)=>new ghe({innerType:e,typeName:Gi.ZodReadonly,...va(t)});var Gi;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Gi||(Gi={}));const nc=H0.create,lA=cC.create,Uat=uhe.create;B1.create;Tg.create;const u3=jc.create;ate.create;ote.create;$j.create;const Fje=fhe.create,D6e=dC.create;lte.create;N1.create;hC.create;const qat="/assets/levelup-logo-horizontal-DEFNc0ms.png",Vat=u3({email:nc().email("Invalid email address"),password:nc().min(6,"Password must be at least 6 characters")}),Hat=()=>{const{signIn:e,user:t}=zr(),n=ns(),[s,i]=I.useState(!1),[o,l]=I.useState({}),[a,h]=I.useState(""),[p,x]=I.useState(!1),[y,b]=I.useState(!1);I.useEffect(()=>{t&&n("/dashboard")},[t,n]);const j=async C=>{C.preventDefault(),l({}),i(!0);const A=new FormData(C.currentTarget),E=A.get("email"),T=A.get("password");try{Vat.parse({email:E,password:T}),await e(E,T)}catch(L){if(L instanceof Pg){const z={};L.errors.forEach(F=>{F.path[0]&&(z[F.path[0]]=F.message)}),l(z)}}finally{i(!1)}},N=async()=>{if(!a){ze.error("Please enter your email address");return}x(!0);try{const{error:C}=await J.functions.invoke("send-password-reset",{body:{email:a,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(C)throw C;ze.success("Password reset email sent! Check your inbox."),b(!1),h("")}catch(C){ze.error(C.message||"Failed to send reset email")}finally{x(!1)}};return r.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#4a6b6d] via-[#3d5a5c] to-[#2a4347]",children:r.jsxs("div",{className:"absolute inset-0 opacity-30",children:[r.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"2s"}})]})}),r.jsxs("div",{className:"relative z-10 flex flex-col min-h-screen",children:[r.jsx("header",{className:"p-6",children:r.jsxs(uo,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Home"]})}),r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("div",{className:"bg-white rounded-xl p-4 shadow-2xl",children:r.jsx("img",{src:qat,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(Ge,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Gt,{className:"space-y-1 text-center pb-4",children:[r.jsx(Qt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(En,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(Xe,{children:r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(at,{id:"signin-email",name:"email",type:"email",placeholder:"your@email.com",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.email&&r.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(at,{id:"signin-password",name:"password",type:"password",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.password&&r.jsx("p",{className:"text-sm text-red-600",children:o.password})]}),r.jsx(ee,{type:"submit",className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white font-semibold py-6 text-lg transition-all duration-200 shadow-lg hover:shadow-xl",disabled:s,children:s?"Signing in...":"Sign In"}),r.jsxs(Br,{open:y,onOpenChange:b,children:[r.jsx(zo,{asChild:!0,children:r.jsx(ee,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Fr,{className:"bg-white",children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(es,{className:"text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(at,{id:"reset-email",type:"email",placeholder:"your@email.com",value:a,onChange:C=>h(C.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(ee,{onClick:N,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:p,children:p?"Sending...":"Send Reset Link"})]})]})]})]})})]}),r.jsxs("p",{className:"text-center text-white/70 text-sm mt-6",children:["Don't have an account?"," ",r.jsx(uo,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},Wat=()=>{const[e]=Fd(),t=e.get("tier"),n=t==null?void 0:t.includes("brokerage");return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ge,{className:"max-w-lg w-full",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mb-4",children:r.jsx(qa,{className:"w-10 h-10 text-green-500"})}),r.jsx(Qt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(En,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Ys,{className:"w-5 h-5"}),r.jsx("span",{className:"font-semibold",children:"Check your email to sign in"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"We've sent you an email with a secure link to access your account. Click the link in your email to get started."})]}),n?r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Create and name your brokerage"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"4."}),"Start inviting agents to join your team"]})]})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold",children:"What's next?"}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"1."}),"Click the link in your email to sign in"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"2."}),"Set your password and complete your profile"]}),r.jsxs("li",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"font-bold text-primary",children:"3."}),"Start exploring templates, training videos, and more!"]})]}),r.jsx("p",{className:"text-sm text-green-600 font-medium mt-4",children:"🎉 Your 7-day free trial has started!"})]}),r.jsx("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Didn't receive the email? Check your spam folder or contact support."})})]})]})})},Pge=e=>{const[t,n]=I.useState(null),[s,i]=I.useState(!0);return I.useEffect(()=>{if(!e){i(!1);return}(async()=>{try{const{data:a}=await J.storage.from("avatars").list(`${e}`);if(a&&a.length>0){const{data:h}=J.storage.from("avatars").getPublicUrl(`${e}/${a[0].name}`);n(`${h.publicUrl}?t=${Date.now()}`)}else n(null)}catch(a){console.error("Error fetching avatar:",a),n(null)}finally{i(!1)}})()},[e]),{avatarUrl:t,loading:s,refreshAvatar:async()=>{if(e)try{const{data:l}=await J.storage.from("avatars").list(`${e}`);if(l&&l.length>0){const{data:a}=J.storage.from("avatars").getPublicUrl(`${e}/${l[0].name}`);n(`${a.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},R6e=async e=>{const t=new Map;return await Promise.all(e.map(async n=>{try{const{data:s}=await J.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:i}=J.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);t.set(n,i.publicUrl)}}catch{}})),t},Gat=e=>{const[t,n]=I.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return I.useEffect(()=>{if(!e){n(i=>({...i,loading:!1}));return}(async()=>{try{const{data:i,error:o}=await J.from("profiles").select("is_trial, trial_expires_at, subscription_status, subscription_end_date").eq("id",e).single();if(o){console.error("Error fetching trial status:",o),n(h=>({...h,loading:!1}));return}const l=(i==null?void 0:i.subscription_status)==="trialing"&&(i==null?void 0:i.subscription_end_date),a=(i==null?void 0:i.is_trial)&&(i==null?void 0:i.trial_expires_at);if(l){const h=new Date().getTime(),p=new Date(i.subscription_end_date).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:i.subscription_end_date,daysLeft:y?0:x,loading:!1})}else if(a){const h=new Date().getTime(),p=new Date(i.trial_expires_at).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:i.trial_expires_at,daysLeft:y?0:x,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(i){console.error("Error in useTrialStatus:",i),n(o=>({...o,loading:!1}))}})()},[e]),t},F6e=()=>{const{data:e,isLoading:t}=Zt({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:i}=await J.from("feature_flags").select("*");if(i)throw i;return s}}),n=s=>{if(!e)return!1;const i=e.find(o=>o.key===s);return(i==null?void 0:i.enabled)??!1};return{flags:e,isLoading:t,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},zje="community_last_seen_post_at";function Kat(){const{user:e}=zr(),t=Nm(),[n,s]=I.useState(0),[i,o]=I.useState(null);I.useEffect(()=>{if(!e)return;const a=localStorage.getItem(`${zje}_${e.id}`);o(a)},[e]),I.useEffect(()=>{if(!e)return;(async()=>{let h=J.from("community_posts").select("id",{count:"exact",head:!0});i&&(h=h.gt("created_at",i));const{data:p}=await J.from("profiles").select("brokerage_id").eq("id",e.id).single(),{count:x,error:y}=await h;!y&&x!==null&&s(x)})()},[e,i]),I.useEffect(()=>{if(!e)return;const a=J.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async h=>{const p=h.new;if(p.user_id===e.id)return;const x=t.pathname==="/community";x||s(N=>N+1);const{data:y}=await J.from("profiles").select("name").eq("id",p.user_id).single(),b=(y==null?void 0:y.name)||"Someone",j=p.content.length>50?p.content.substring(0,50)+"...":p.content;x||ze("New Community Post",{description:`${b}: ${j}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{J.removeChannel(a)}},[e,t.pathname]);const l=I.useCallback(()=>{if(!e)return;const a=new Date().toISOString();localStorage.setItem(`${zje}_${e.id}`,a),o(a),s(0)},[e]);return I.useEffect(()=>{t.pathname==="/community"&&n>0&&l()},[t.pathname,n,l]),{unreadCount:n,markAsRead:l}}function Zat(){const{isAdmin:e}=zr(),{data:t=0}=Zt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await J.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(s)throw s;return n||0},enabled:e,staleTime:6e4});return{openCount:e?t:0}}const tse=Hne,Lge=Cge,Yat=Wne,z6e=I.forwardRef(({className:e,...t},n)=>r.jsx(l3,{className:$t("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",e),...t,ref:n}));z6e.displayName=l3.displayName;const Xat=XC("fixed z-50 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"}}),kI=I.forwardRef(({side:e="right",className:t,children:n,...s},i)=>r.jsxs(Yat,{children:[r.jsx(z6e,{}),r.jsxs(c3,{ref:i,className:$t(Xat({side:e}),t),...s,children:[n,r.jsxs(Gne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(bs,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));kI.displayName=c3.displayName;const rse=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",e),...t});rse.displayName="SheetHeader";const nse=I.forwardRef(({className:e,...t},n)=>r.jsx(bI,{ref:n,className:$t("text-lg font-semibold text-foreground",e),...t}));nse.displayName=bI.displayName;const Qat=I.forwardRef(({className:e,...t},n)=>r.jsx(wI,{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));Qat.displayName=wI.displayName;function Jat(e,t){return I.useReducer((n,s)=>t[n][s]??n,e)}var Oge="ScrollArea",[B6e]=Ql(Oge),[eot,ip]=B6e(Oge),$6e=I.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:s="hover",dir:i,scrollHideDelay:o=600,...l}=e,[a,h]=I.useState(null),[p,x]=I.useState(null),[y,b]=I.useState(null),[j,N]=I.useState(null),[C,A]=I.useState(null),[E,T]=I.useState(0),[L,z]=I.useState(0),[F,q]=I.useState(!1),[H,K]=I.useState(!1),Z=ei(t,ae=>h(ae)),te=sk(i);return r.jsx(eot,{scope:n,type:s,dir:te,scrollHideDelay:o,scrollArea:a,viewport:p,onViewportChange:x,content:y,onContentChange:b,scrollbarX:j,onScrollbarXChange:N,scrollbarXEnabled:F,onScrollbarXEnabledChange:q,scrollbarY:C,onScrollbarYChange:A,scrollbarYEnabled:H,onScrollbarYEnabledChange:K,onCornerWidthChange:T,onCornerHeightChange:z,children:r.jsx(Rn.div,{dir:te,...l,ref:Z,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":L+"px",...e.style}})})});$6e.displayName=Oge;var U6e="ScrollAreaViewport",q6e=I.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:i,...o}=e,l=ip(U6e,n),a=I.useRef(null),h=ei(t,a,l.onViewportChange);return r.jsxs(r.Fragment,{children:[r.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:i}),r.jsx(Rn.div,{"data-radix-scroll-area-viewport":"",...o,ref:h,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});q6e.displayName=U6e;var $g="ScrollAreaScrollbar",Dge=I.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=ip($g,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=i,a=e.orientation==="horizontal";return I.useEffect(()=>(a?o(!0):l(!0),()=>{a?o(!1):l(!1)}),[a,o,l]),i.type==="hover"?r.jsx(tot,{...s,ref:t,forceMount:n}):i.type==="scroll"?r.jsx(rot,{...s,ref:t,forceMount:n}):i.type==="auto"?r.jsx(V6e,{...s,ref:t,forceMount:n}):i.type==="always"?r.jsx(Rge,{...s,ref:t}):null});Dge.displayName=$g;var tot=I.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=ip($g,e.__scopeScrollArea),[o,l]=I.useState(!1);return I.useEffect(()=>{const a=i.scrollArea;let h=0;if(a){const p=()=>{window.clearTimeout(h),l(!0)},x=()=>{h=window.setTimeout(()=>l(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",p),a.addEventListener("pointerleave",x),()=>{window.clearTimeout(h),a.removeEventListener("pointerenter",p),a.removeEventListener("pointerleave",x)}}},[i.scrollArea,i.scrollHideDelay]),r.jsx(pc,{present:n||o,children:r.jsx(V6e,{"data-state":o?"visible":"hidden",...s,ref:t})})}),rot=I.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=ip($g,e.__scopeScrollArea),o=e.orientation==="horizontal",l=ise(()=>h("SCROLL_END"),100),[a,h]=Jat("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 I.useEffect(()=>{if(a==="idle"){const p=window.setTimeout(()=>h("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(p)}},[a,i.scrollHideDelay,h]),I.useEffect(()=>{const p=i.viewport,x=o?"scrollLeft":"scrollTop";if(p){let y=p[x];const b=()=>{const j=p[x];y!==j&&(h("SCROLL"),l()),y=j};return p.addEventListener("scroll",b),()=>p.removeEventListener("scroll",b)}},[i.viewport,o,h,l]),r.jsx(pc,{present:n||a!=="hidden",children:r.jsx(Rge,{"data-state":a==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:cn(e.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:cn(e.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),V6e=I.forwardRef((e,t)=>{const n=ip($g,e.__scopeScrollArea),{forceMount:s,...i}=e,[o,l]=I.useState(!1),a=e.orientation==="horizontal",h=ise(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=e,i=ip($g,e.__scopeScrollArea),o=I.useRef(null),l=I.useRef(0),[a,h]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=Z6e(a.viewport,a.content),x={...s,sizes:a,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:b=>o.current=b,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:b=>l.current=b};function y(b,j){return lot(b,l.current,a,j)}return n==="horizontal"?r.jsx(not,{...x,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const b=i.viewport.scrollLeft,j=Bje(b,a,i.dir);o.current.style.transform=`translate3d(${j}px, 0, 0)`}},onWheelScroll:b=>{i.viewport&&(i.viewport.scrollLeft=b)},onDragScroll:b=>{i.viewport&&(i.viewport.scrollLeft=y(b,i.dir))}}):n==="vertical"?r.jsx(sot,{...x,ref:t,onThumbPositionChange:()=>{if(i.viewport&&o.current){const b=i.viewport.scrollTop,j=Bje(b,a);o.current.style.transform=`translate3d(0, ${j}px, 0)`}},onWheelScroll:b=>{i.viewport&&(i.viewport.scrollTop=b)},onDragScroll:b=>{i.viewport&&(i.viewport.scrollTop=y(b))}}):null}),not=I.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...i}=e,o=ip($g,e.__scopeScrollArea),[l,a]=I.useState(),h=I.useRef(null),p=ei(t,h,o.onScrollbarXChange);return I.useEffect(()=>{h.current&&a(getComputedStyle(h.current))},[h]),r.jsx(W6e,{"data-orientation":"horizontal",...i,ref:p,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":sse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.x),onDragScroll:x=>e.onDragScroll(x.x),onWheelScroll:(x,y)=>{if(o.viewport){const b=o.viewport.scrollLeft+x.deltaX;e.onWheelScroll(b),X6e(b,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:dte(l.paddingLeft),paddingEnd:dte(l.paddingRight)}})}})}),sot=I.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...i}=e,o=ip($g,e.__scopeScrollArea),[l,a]=I.useState(),h=I.useRef(null),p=ei(t,h,o.onScrollbarYChange);return I.useEffect(()=>{h.current&&a(getComputedStyle(h.current))},[h]),r.jsx(W6e,{"data-orientation":"vertical",...i,ref:p,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":sse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.y),onDragScroll:x=>e.onDragScroll(x.y),onWheelScroll:(x,y)=>{if(o.viewport){const b=o.viewport.scrollTop+x.deltaY;e.onWheelScroll(b),X6e(b,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:dte(l.paddingTop),paddingEnd:dte(l.paddingBottom)}})}})}),[iot,H6e]=B6e($g),W6e=I.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:i,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:a,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:x,onResize:y,...b}=e,j=ip($g,n),[N,C]=I.useState(null),A=ei(t,Z=>C(Z)),E=I.useRef(null),T=I.useRef(""),L=j.viewport,z=s.content-s.viewport,F=Kl(x),q=Kl(h),H=ise(y,10);function K(Z){if(E.current){const te=Z.clientX-E.current.left,ae=Z.clientY-E.current.top;p({x:te,y:ae})}}return I.useEffect(()=>{const Z=te=>{const ae=te.target;(N==null?void 0:N.contains(ae))&&F(te,z)};return document.addEventListener("wheel",Z,{passive:!1}),()=>document.removeEventListener("wheel",Z,{passive:!1})},[L,N,z,F]),I.useEffect(q,[s,q]),fC(N,H),fC(j.content,H),r.jsx(iot,{scope:n,scrollbar:N,hasThumb:i,onThumbChange:Kl(o),onThumbPointerUp:Kl(l),onThumbPositionChange:q,onThumbPointerDown:Kl(a),children:r.jsx(Rn.div,{...b,ref:A,style:{position:"absolute",...b.style},onPointerDown:cn(e.onPointerDown,Z=>{Z.button===0&&(Z.target.setPointerCapture(Z.pointerId),E.current=N.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",j.viewport&&(j.viewport.style.scrollBehavior="auto"),K(Z))}),onPointerMove:cn(e.onPointerMove,K),onPointerUp:cn(e.onPointerUp,Z=>{const te=Z.target;te.hasPointerCapture(Z.pointerId)&&te.releasePointerCapture(Z.pointerId),document.body.style.webkitUserSelect=T.current,j.viewport&&(j.viewport.style.scrollBehavior=""),E.current=null})})})}),cte="ScrollAreaThumb",G6e=I.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=H6e(cte,e.__scopeScrollArea);return r.jsx(pc,{present:n||i.hasThumb,children:r.jsx(aot,{ref:t,...s})})}),aot=I.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...i}=e,o=ip(cte,n),l=H6e(cte,n),{onThumbPositionChange:a}=l,h=ei(t,y=>l.onThumbChange(y)),p=I.useRef(void 0),x=ise(()=>{p.current&&(p.current(),p.current=void 0)},100);return I.useEffect(()=>{const y=o.viewport;if(y){const b=()=>{if(x(),!p.current){const j=cot(y,a);p.current=j,a()}};return a(),y.addEventListener("scroll",b),()=>y.removeEventListener("scroll",b)}},[o.viewport,x,a]),r.jsx(Rn.div,{"data-state":l.hasThumb?"visible":"hidden",...i,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:cn(e.onPointerDownCapture,y=>{const j=y.target.getBoundingClientRect(),N=y.clientX-j.left,C=y.clientY-j.top;l.onThumbPointerDown({x:N,y:C})}),onPointerUp:cn(e.onPointerUp,l.onThumbPointerUp)})});G6e.displayName=cte;var Fge="ScrollAreaCorner",K6e=I.forwardRef((e,t)=>{const n=ip(Fge,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(oot,{...e,ref:t}):null});K6e.displayName=Fge;var oot=I.forwardRef((e,t)=>{const{__scopeScrollArea:n,...s}=e,i=ip(Fge,n),[o,l]=I.useState(0),[a,h]=I.useState(0),p=!!(o&&a);return fC(i.scrollbarX,()=>{var y;const x=((y=i.scrollbarX)==null?void 0:y.offsetHeight)||0;i.onCornerHeightChange(x),h(x)}),fC(i.scrollbarY,()=>{var y;const x=((y=i.scrollbarY)==null?void 0:y.offsetWidth)||0;i.onCornerWidthChange(x),l(x)}),p?r.jsx(Rn.div,{...s,ref:t,style:{width:o,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function dte(e){return e?parseInt(e,10):0}function Z6e(e,t){const n=e/t;return isNaN(n)?0:n}function sse(e){const t=Z6e(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function lot(e,t,n,s="ltr"){const i=sse(n),o=i/2,l=t||o,a=i-l,h=n.scrollbar.paddingStart+l,p=n.scrollbar.size-n.scrollbar.paddingEnd-a,x=n.content-n.viewport,y=s==="ltr"?[0,x]:[x*-1,0];return Y6e([h,p],y)(e)}function Bje(e,t,n="ltr"){const s=sse(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-i,l=t.content-t.viewport,a=o-s,h=n==="ltr"?[0,l]:[l*-1,0],p=rE(e,h);return Y6e([0,l],[0,a])(p)}function Y6e(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function X6e(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},s=0;return function i(){const o={left:e.scrollLeft,top:e.scrollTop},l=n.left!==o.left,a=n.top!==o.top;(l||a)&&t(),n=o,s=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(s)};function ise(e,t){const n=Kl(e),s=I.useRef(0);return I.useEffect(()=>()=>window.clearTimeout(s.current),[]),I.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,t)},[n,t])}function fC(e,t){const n=Kl(t);Yl(()=>{let s=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(s),i.unobserve(e)}}},[e,n])}var Q6e=$6e,dot=q6e,uot=K6e;const Jo=I.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Q6e,{ref:s,className:$t("relative overflow-hidden",e),...n,children:[r.jsx(dot,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(zge,{}),r.jsx(uot,{})]}));Jo.displayName=Q6e.displayName;const zge=I.forwardRef(({className:e,orientation:t="vertical",...n},s)=>r.jsx(Dge,{ref:s,orientation:t,className:$t("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(G6e,{className:"relative flex-1 rounded-full bg-border"})}));zge.displayName=Dge.displayName;var Gle="rovingFocusGroup.onEntryFocus",hot={bubbles:!1,cancelable:!0},NI="RovingFocusGroup",[xhe,J6e,fot]=dI(NI),[pot,h3]=Ql(NI,[fot]),[mot,got]=pot(NI),eLe=I.forwardRef((e,t)=>r.jsx(xhe.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(xhe.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(xot,{...e,ref:t})})}));eLe.displayName=NI;var xot=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...y}=e,b=I.useRef(null),j=ei(t,b),N=sk(o),[C,A]=Ou({prop:l,defaultProp:a??null,onChange:h,caller:NI}),[E,T]=I.useState(!1),L=Kl(p),z=J6e(n),F=I.useRef(!1),[q,H]=I.useState(0);return I.useEffect(()=>{const K=b.current;if(K)return K.addEventListener(Gle,L),()=>K.removeEventListener(Gle,L)},[L]),r.jsx(mot,{scope:n,orientation:s,dir:N,loop:i,currentTabStopId:C,onItemFocus:I.useCallback(K=>A(K),[A]),onItemShiftTab:I.useCallback(()=>T(!0),[]),onFocusableItemAdd:I.useCallback(()=>H(K=>K+1),[]),onFocusableItemRemove:I.useCallback(()=>H(K=>K-1),[]),children:r.jsx(Rn.div,{tabIndex:E||q===0?-1:0,"data-orientation":s,...y,ref:j,style:{outline:"none",...e.style},onMouseDown:cn(e.onMouseDown,()=>{F.current=!0}),onFocus:cn(e.onFocus,K=>{const Z=!F.current;if(K.target===K.currentTarget&&Z&&!E){const te=new CustomEvent(Gle,hot);if(K.currentTarget.dispatchEvent(te),!te.defaultPrevented){const ae=z().filter(ie=>ie.focusable),le=ae.find(ie=>ie.active),ve=ae.find(ie=>ie.id===C),ge=[le,ve,...ae].filter(Boolean).map(ie=>ie.ref.current);nLe(ge,x)}}F.current=!1}),onBlur:cn(e.onBlur,()=>T(!1))})})}),tLe="RovingFocusGroupItem",rLe=I.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:o,children:l,...a}=e,h=Vc(),p=o||h,x=got(tLe,n),y=x.currentTabStopId===p,b=J6e(n),{onFocusableItemAdd:j,onFocusableItemRemove:N,currentTabStopId:C}=x;return I.useEffect(()=>{if(s)return j(),()=>N()},[s,j,N]),r.jsx(xhe.ItemSlot,{scope:n,id:p,focusable:s,active:i,children:r.jsx(Rn.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...a,ref:t,onMouseDown:cn(e.onMouseDown,A=>{s?x.onItemFocus(p):A.preventDefault()}),onFocus:cn(e.onFocus,()=>x.onItemFocus(p)),onKeyDown:cn(e.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){x.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const E=_ot(A,x.orientation,x.dir);if(E!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let L=b().filter(z=>z.focusable).map(z=>z.ref.current);if(E==="last")L.reverse();else if(E==="prev"||E==="next"){E==="prev"&&L.reverse();const z=L.indexOf(A.currentTarget);L=x.loop?bot(L,z+1):L.slice(z+1)}setTimeout(()=>nLe(L))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:C!=null}):l})})});rLe.displayName=tLe;var yot={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function vot(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _ot(e,t,n){const s=vot(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return yot[s]}function nLe(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function bot(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Bge=eLe,$ge=rLe,yhe=["Enter"," "],wot=["ArrowDown","PageUp","Home"],sLe=["ArrowUp","PageDown","End"],jot=[...wot,...sLe],kot={ltr:[...yhe,"ArrowRight"],rtl:[...yhe,"ArrowLeft"]},Not={ltr:["ArrowLeft"],rtl:["ArrowRight"]},SI="Menu",[iE,Sot,Cot]=dI(SI),[ik,iLe]=Ql(SI,[Cot,zg,h3]),ase=zg(),aLe=h3(),[Mot,ak]=ik(SI),[Tot,CI]=ik(SI),oLe=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:i,onOpenChange:o,modal:l=!0}=e,a=ase(t),[h,p]=I.useState(null),x=I.useRef(!1),y=Kl(o),b=sk(i);return I.useEffect(()=>{const j=()=>{x.current=!0,document.addEventListener("pointerdown",N,{capture:!0,once:!0}),document.addEventListener("pointermove",N,{capture:!0,once:!0})},N=()=>x.current=!1;return document.addEventListener("keydown",j,{capture:!0}),()=>{document.removeEventListener("keydown",j,{capture:!0}),document.removeEventListener("pointerdown",N,{capture:!0}),document.removeEventListener("pointermove",N,{capture:!0})}},[]),r.jsx(pI,{...a,children:r.jsx(Mot,{scope:t,open:n,onOpenChange:y,content:h,onContentChange:p,children:r.jsx(Tot,{scope:t,onClose:I.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:b,modal:l,children:s})})})};oLe.displayName=SI;var Aot="MenuAnchor",Uge=I.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=ase(n);return r.jsx(t3,{...i,...s,ref:t})});Uge.displayName=Aot;var qge="MenuPortal",[Eot,lLe]=ik(qge,{forceMount:void 0}),cLe=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:i}=e,o=ak(qge,t);return r.jsx(Eot,{scope:t,forceMount:n,children:r.jsx(pc,{present:n||o.open,children:r.jsx(YC,{asChild:!0,container:i,children:s})})})};cLe.displayName=qge;var Yf="MenuContent",[Iot,Vge]=ik(Yf),dLe=I.forwardRef((e,t)=>{const n=lLe(Yf,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,o=ak(Yf,e.__scopeMenu),l=CI(Yf,e.__scopeMenu);return r.jsx(iE.Provider,{scope:e.__scopeMenu,children:r.jsx(pc,{present:s||o.open,children:r.jsx(iE.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(Pot,{...i,ref:t}):r.jsx(Lot,{...i,ref:t})})})})}),Pot=I.forwardRef((e,t)=>{const n=ak(Yf,e.__scopeMenu),s=I.useRef(null),i=ei(t,s);return I.useEffect(()=>{const o=s.current;if(o)return qne(o)},[]),r.jsx(Hge,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:cn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Lot=I.forwardRef((e,t)=>{const n=ak(Yf,e.__scopeMenu);return r.jsx(Hge,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Oot=D1("MenuContent.ScrollLock"),Hge=I.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:a,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:b,onDismiss:j,disableOutsideScroll:N,...C}=e,A=ak(Yf,n),E=CI(Yf,n),T=ase(n),L=aLe(n),z=Sot(n),[F,q]=I.useState(null),H=I.useRef(null),K=ei(t,H,A.onContentChange),Z=I.useRef(0),te=I.useRef(""),ae=I.useRef(0),le=I.useRef(null),ve=I.useRef("right"),ne=I.useRef(0),ge=N?_I:I.Fragment,ie=N?{as:Oot,allowPinchZoom:!0}:void 0,fe=ye=>{var Te,Ve;const Ie=te.current+ye,Ne=z().filter(Fe=>!Fe.disabled),we=document.activeElement,he=(Te=Ne.find(Fe=>Fe.ref.current===we))==null?void 0:Te.textValue,xe=Ne.map(Fe=>Fe.textValue),be=Got(xe,Ie,he),Oe=(Ve=Ne.find(Fe=>Fe.textValue===be))==null?void 0:Ve.ref.current;(function Fe(Me){te.current=Me,window.clearTimeout(Z.current),Me!==""&&(Z.current=window.setTimeout(()=>Fe(""),1e3))})(Ie),Oe&&setTimeout(()=>Oe.focus())};I.useEffect(()=>()=>window.clearTimeout(Z.current),[]),$ne();const de=I.useCallback(ye=>{var Ne,we;return ve.current===((Ne=le.current)==null?void 0:Ne.side)&&Zot(ye,(we=le.current)==null?void 0:we.area)},[]);return r.jsx(Iot,{scope:n,searchRef:te,onItemEnter:I.useCallback(ye=>{de(ye)&&ye.preventDefault()},[de]),onItemLeave:I.useCallback(ye=>{var Ie;de(ye)||((Ie=H.current)==null||Ie.focus(),q(null))},[de]),onTriggerLeave:I.useCallback(ye=>{de(ye)&&ye.preventDefault()},[de]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:I.useCallback(ye=>{le.current=ye},[]),children:r.jsx(ge,{...ie,children:r.jsx(vI,{asChild:!0,trapped:i,onMountAutoFocus:cn(o,ye=>{var Ie;ye.preventDefault(),(Ie=H.current)==null||Ie.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:b,onDismiss:j,children:r.jsx(Bge,{asChild:!0,...L,dir:E.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:q,onEntryFocus:cn(h,ye=>{E.isUsingKeyboardRef.current||ye.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(mI,{role:"menu","aria-orientation":"vertical","data-state":SLe(A.open),"data-radix-menu-content":"",dir:E.dir,...T,...C,ref:K,style:{outline:"none",...C.style},onKeyDown:cn(C.onKeyDown,ye=>{const Ne=ye.target.closest("[data-radix-menu-content]")===ye.currentTarget,we=ye.ctrlKey||ye.altKey||ye.metaKey,he=ye.key.length===1;Ne&&(ye.key==="Tab"&&ye.preventDefault(),!we&&he&&fe(ye.key));const xe=H.current;if(ye.target!==xe||!jot.includes(ye.key))return;ye.preventDefault();const Oe=z().filter(Te=>!Te.disabled).map(Te=>Te.ref.current);sLe.includes(ye.key)&&Oe.reverse(),Hot(Oe)}),onBlur:cn(e.onBlur,ye=>{ye.currentTarget.contains(ye.target)||(window.clearTimeout(Z.current),te.current="")}),onPointerMove:cn(e.onPointerMove,aE(ye=>{const Ie=ye.target,Ne=ne.current!==ye.clientX;if(ye.currentTarget.contains(Ie)&&Ne){const we=ye.clientX>ne.current?"right":"left";ve.current=we,ne.current=ye.clientX}}))})})})})})})});dLe.displayName=Yf;var Dot="MenuGroup",Wge=I.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Rn.div,{role:"group",...s,ref:t})});Wge.displayName=Dot;var Rot="MenuLabel",uLe=I.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Rn.div,{...s,ref:t})});uLe.displayName=Rot;var ute="MenuItem",$je="menu.itemSelect",ose=I.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...i}=e,o=I.useRef(null),l=CI(ute,e.__scopeMenu),a=Vge(ute,e.__scopeMenu),h=ei(t,o),p=I.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const b=new CustomEvent($je,{bubbles:!0,cancelable:!0});y.addEventListener($je,j=>s==null?void 0:s(j),{once:!0}),qme(y,b),b.defaultPrevented?p.current=!1:l.onClose()}};return r.jsx(hLe,{...i,ref:h,disabled:n,onClick:cn(e.onClick,x),onPointerDown:y=>{var b;(b=e.onPointerDown)==null||b.call(e,y),p.current=!0},onPointerUp:cn(e.onPointerUp,y=>{var b;p.current||(b=y.currentTarget)==null||b.click()}),onKeyDown:cn(e.onKeyDown,y=>{const b=a.searchRef.current!=="";n||b&&y.key===" "||yhe.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});ose.displayName=ute;var hLe=I.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:i,...o}=e,l=Vge(ute,n),a=aLe(n),h=I.useRef(null),p=ei(t,h),[x,y]=I.useState(!1),[b,j]=I.useState("");return I.useEffect(()=>{const N=h.current;N&&j((N.textContent??"").trim())},[o.children]),r.jsx(iE.ItemSlot,{scope:n,disabled:s,textValue:i??b,children:r.jsx($ge,{asChild:!0,...a,focusable:!s,children:r.jsx(Rn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:p,onPointerMove:cn(e.onPointerMove,aE(N=>{s?l.onItemLeave(N):(l.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:cn(e.onPointerLeave,aE(N=>l.onItemLeave(N))),onFocus:cn(e.onFocus,()=>y(!0)),onBlur:cn(e.onBlur,()=>y(!1))})})})}),Fot="MenuCheckboxItem",fLe=I.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...i}=e;return r.jsx(yLe,{scope:e.__scopeMenu,checked:n,children:r.jsx(ose,{role:"menuitemcheckbox","aria-checked":hte(n)?"mixed":n,...i,ref:t,"data-state":Kge(n),onSelect:cn(i.onSelect,()=>s==null?void 0:s(hte(n)?!0:!n),{checkForDefaultPrevented:!1})})})});fLe.displayName=Fot;var pLe="MenuRadioGroup",[zot,Bot]=ik(pLe,{value:void 0,onValueChange:()=>{}}),mLe=I.forwardRef((e,t)=>{const{value:n,onValueChange:s,...i}=e,o=Kl(s);return r.jsx(zot,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Wge,{...i,ref:t})})});mLe.displayName=pLe;var gLe="MenuRadioItem",xLe=I.forwardRef((e,t)=>{const{value:n,...s}=e,i=Bot(gLe,e.__scopeMenu),o=n===i.value;return r.jsx(yLe,{scope:e.__scopeMenu,checked:o,children:r.jsx(ose,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Kge(o),onSelect:cn(s.onSelect,()=>{var l;return(l=i.onValueChange)==null?void 0:l.call(i,n)},{checkForDefaultPrevented:!1})})})});xLe.displayName=gLe;var Gge="MenuItemIndicator",[yLe,$ot]=ik(Gge,{checked:!1}),vLe=I.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...i}=e,o=$ot(Gge,n);return r.jsx(pc,{present:s||hte(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{...i,ref:t,"data-state":Kge(o.checked)})})});vLe.displayName=Gge;var Uot="MenuSeparator",_Le=I.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Rn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});_Le.displayName=Uot;var qot="MenuArrow",bLe=I.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,i=ase(n);return r.jsx(gI,{...i,...s,ref:t})});bLe.displayName=qot;var Vot="MenuSub",[JZt,wLe]=ik(Vot),hT="MenuSubTrigger",jLe=I.forwardRef((e,t)=>{const n=ak(hT,e.__scopeMenu),s=CI(hT,e.__scopeMenu),i=wLe(hT,e.__scopeMenu),o=Vge(hT,e.__scopeMenu),l=I.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:h}=o,p={__scopeMenu:e.__scopeMenu},x=I.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return I.useEffect(()=>x,[x]),I.useEffect(()=>{const y=a.current;return()=>{window.clearTimeout(y),h(null)}},[a,h]),r.jsx(Uge,{asChild:!0,...p,children:r.jsx(hLe,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":SLe(n.open),...e,ref:iy(t,i.onTriggerChange),onClick:y=>{var b;(b=e.onClick)==null||b.call(e,y),!(e.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:cn(e.onPointerMove,aE(y=>{o.onItemEnter(y),!y.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),x()},100))})),onPointerLeave:cn(e.onPointerLeave,aE(y=>{var j,N;x();const b=(j=n.content)==null?void 0:j.getBoundingClientRect();if(b){const C=(N=n.content)==null?void 0:N.dataset.side,A=C==="right",E=A?-5:5,T=b[A?"left":"right"],L=b[A?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+E,y:y.clientY},{x:T,y:b.top},{x:L,y:b.top},{x:L,y:b.bottom},{x:T,y:b.bottom}],side:C}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:cn(e.onKeyDown,y=>{var j;const b=o.searchRef.current!=="";e.disabled||b&&y.key===" "||kot[s.dir].includes(y.key)&&(n.onOpenChange(!0),(j=n.content)==null||j.focus(),y.preventDefault())})})})});jLe.displayName=hT;var kLe="MenuSubContent",NLe=I.forwardRef((e,t)=>{const n=lLe(Yf,e.__scopeMenu),{forceMount:s=n.forceMount,...i}=e,o=ak(Yf,e.__scopeMenu),l=CI(Yf,e.__scopeMenu),a=wLe(kLe,e.__scopeMenu),h=I.useRef(null),p=ei(t,h);return r.jsx(iE.Provider,{scope:e.__scopeMenu,children:r.jsx(pc,{present:s||o.open,children:r.jsx(iE.Slot,{scope:e.__scopeMenu,children:r.jsx(Hge,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:p,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{var y;l.isUsingKeyboardRef.current&&((y=h.current)==null||y.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:cn(e.onFocusOutside,x=>{x.target!==a.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:cn(e.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:cn(e.onKeyDown,x=>{var j;const y=x.currentTarget.contains(x.target),b=Not[l.dir].includes(x.key);y&&b&&(o.onOpenChange(!1),(j=a.trigger)==null||j.focus(),x.preventDefault())})})})})})});NLe.displayName=kLe;function SLe(e){return e?"open":"closed"}function hte(e){return e==="indeterminate"}function Kge(e){return hte(e)?"indeterminate":e?"checked":"unchecked"}function Hot(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Wot(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function Got(e,t,n){const i=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=Wot(e,Math.max(o,0));i.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.toLowerCase().startsWith(i.toLowerCase()));return h!==n?h:void 0}function Kot(e,t){const{x:n,y:s}=e;let i=!1;for(let o=0,l=t.length-1;os!=b>s&&n<(y-p)*(s-x)/(b-x)+p&&(i=!i)}return i}function Zot(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Kot(n,t)}function aE(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Yot=oLe,Xot=Uge,Qot=cLe,Jot=dLe,elt=Wge,tlt=uLe,rlt=ose,nlt=fLe,slt=mLe,ilt=xLe,alt=vLe,olt=_Le,llt=bLe,clt=jLe,dlt=NLe,lse="DropdownMenu",[ult]=Ql(lse,[iLe]),Uu=iLe(),[hlt,CLe]=ult(lse),MLe=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:i,defaultOpen:o,onOpenChange:l,modal:a=!0}=e,h=Uu(t),p=I.useRef(null),[x,y]=Ou({prop:i,defaultProp:o??!1,onChange:l,caller:lse});return r.jsx(hlt,{scope:t,triggerId:Vc(),triggerRef:p,contentId:Vc(),open:x,onOpenChange:y,onOpenToggle:I.useCallback(()=>y(b=>!b),[y]),modal:a,children:r.jsx(Yot,{...h,open:x,onOpenChange:y,dir:s,modal:a,children:n})})};MLe.displayName=lse;var TLe="DropdownMenuTrigger",ALe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...i}=e,o=CLe(TLe,n),l=Uu(n);return r.jsx(Xot,{asChild:!0,...l,children:r.jsx(Rn.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...i,ref:iy(t,o.triggerRef),onPointerDown:cn(e.onPointerDown,a=>{!s&&a.button===0&&a.ctrlKey===!1&&(o.onOpenToggle(),o.open||a.preventDefault())}),onKeyDown:cn(e.onKeyDown,a=>{s||(["Enter"," "].includes(a.key)&&o.onOpenToggle(),a.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});ALe.displayName=TLe;var flt="DropdownMenuPortal",ELe=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Uu(t);return r.jsx(Qot,{...s,...n})};ELe.displayName=flt;var ILe="DropdownMenuContent",PLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=CLe(ILe,n),o=Uu(n),l=I.useRef(!1);return r.jsx(Jot,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...s,ref:t,onCloseAutoFocus:cn(e.onCloseAutoFocus,a=>{var h;l.current||(h=i.triggerRef.current)==null||h.focus(),l.current=!1,a.preventDefault()}),onInteractOutside:cn(e.onInteractOutside,a=>{const h=a.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,x=h.button===2||p;(!i.modal||x)&&(l.current=!0)}),style:{...e.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)"}})});PLe.displayName=ILe;var plt="DropdownMenuGroup",mlt=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(elt,{...i,...s,ref:t})});mlt.displayName=plt;var glt="DropdownMenuLabel",LLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(tlt,{...i,...s,ref:t})});LLe.displayName=glt;var xlt="DropdownMenuItem",OLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(rlt,{...i,...s,ref:t})});OLe.displayName=xlt;var ylt="DropdownMenuCheckboxItem",DLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(nlt,{...i,...s,ref:t})});DLe.displayName=ylt;var vlt="DropdownMenuRadioGroup",_lt=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(slt,{...i,...s,ref:t})});_lt.displayName=vlt;var blt="DropdownMenuRadioItem",RLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(ilt,{...i,...s,ref:t})});RLe.displayName=blt;var wlt="DropdownMenuItemIndicator",FLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(alt,{...i,...s,ref:t})});FLe.displayName=wlt;var jlt="DropdownMenuSeparator",zLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(olt,{...i,...s,ref:t})});zLe.displayName=jlt;var klt="DropdownMenuArrow",Nlt=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(llt,{...i,...s,ref:t})});Nlt.displayName=klt;var Slt="DropdownMenuSubTrigger",BLe=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(clt,{...i,...s,ref:t})});BLe.displayName=Slt;var Clt="DropdownMenuSubContent",$Le=I.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,i=Uu(n);return r.jsx(dlt,{...i,...s,ref:t,style:{...e.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)"}})});$Le.displayName=Clt;var Mlt=MLe,Tlt=ALe,Alt=ELe,ULe=PLe,qLe=LLe,VLe=OLe,HLe=DLe,WLe=RLe,GLe=FLe,KLe=zLe,ZLe=BLe,YLe=$Le;const Cm=Mlt,Mm=Tlt,Elt=I.forwardRef(({className:e,inset:t,children:n,...s},i)=>r.jsxs(ZLe,{ref:i,className:$t("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",t&&"pl-8",e),...s,children:[n,r.jsx(Ka,{className:"ml-auto h-4 w-4"})]}));Elt.displayName=ZLe.displayName;const Ilt=I.forwardRef(({className:e,...t},n)=>r.jsx(YLe,{ref:n,className:$t("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",e),...t}));Ilt.displayName=YLe.displayName;const ap=I.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(Alt,{children:r.jsx(ULe,{ref:s,sideOffset:t,className:$t("z-50 min-w-[8rem] overflow-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",e),...n})}));ap.displayName=ULe.displayName;const mo=I.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(VLe,{ref:s,className:$t("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t&&"pl-8",e),...n}));mo.displayName=VLe.displayName;const Plt=I.forwardRef(({className:e,children:t,checked:n,...s},i)=>r.jsxs(HLe,{ref:i,className:$t("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(GLe,{children:r.jsx(Ca,{className:"h-4 w-4"})})}),t]}));Plt.displayName=HLe.displayName;const Llt=I.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(WLe,{ref:s,className:$t("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(GLe,{children:r.jsx(Lu,{className:"h-2 w-2 fill-current"})})}),t]}));Llt.displayName=WLe.displayName;const vhe=I.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(qLe,{ref:s,className:$t("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));vhe.displayName=qLe.displayName;const pC=I.forwardRef(({className:e,...t},n)=>r.jsx(KLe,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",e),...t}));pC.displayName=KLe.displayName;var cse="Collapsible",[Olt]=Ql(cse),[Dlt,Zge]=Olt(cse),XLe=I.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:i,disabled:o,onOpenChange:l,...a}=e,[h,p]=Ou({prop:s,defaultProp:i??!1,onChange:l,caller:cse});return r.jsx(Dlt,{scope:n,disabled:o,contentId:Vc(),open:h,onOpenToggle:I.useCallback(()=>p(x=>!x),[p]),children:r.jsx(Rn.div,{"data-state":Xge(h),"data-disabled":o?"":void 0,...a,ref:t})})});XLe.displayName=cse;var QLe="CollapsibleTrigger",JLe=I.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,i=Zge(QLe,n);return r.jsx(Rn.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Xge(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...s,ref:t,onClick:cn(e.onClick,i.onOpenToggle)})});JLe.displayName=QLe;var Yge="CollapsibleContent",e8e=I.forwardRef((e,t)=>{const{forceMount:n,...s}=e,i=Zge(Yge,e.__scopeCollapsible);return r.jsx(pc,{present:n||i.open,children:({present:o})=>r.jsx(Rlt,{...s,ref:t,present:o})})});e8e.displayName=Yge;var Rlt=I.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:i,...o}=e,l=Zge(Yge,n),[a,h]=I.useState(s),p=I.useRef(null),x=ei(t,p),y=I.useRef(0),b=y.current,j=I.useRef(0),N=j.current,C=l.open||a,A=I.useRef(C),E=I.useRef(void 0);return I.useEffect(()=>{const T=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(T)},[]),Yl(()=>{const T=p.current;if(T){E.current=E.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const L=T.getBoundingClientRect();y.current=L.height,j.current=L.width,A.current||(T.style.transitionDuration=E.current.transitionDuration,T.style.animationName=E.current.animationName),h(s)}},[l.open,s]),r.jsx(Rn.div,{"data-state":Xge(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!C,...o,ref:x,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":N?`${N}px`:void 0,...e.style},children:C&&i})});function Xge(e){return e?"open":"closed"}var Flt=XLe;const NS=Flt,SS=JLe,CS=e8e,Uje="/assets/levelup-logo-Eif24dqY.png",zlt="/assets/levelup-logo-icon-C-7iromj.png";var MI=e=>e.type==="checkbox",$w=e=>e instanceof Date,bu=e=>e==null;const t8e=e=>typeof e=="object";var fc=e=>!bu(e)&&!Array.isArray(e)&&t8e(e)&&!$w(e),r8e=e=>fc(e)&&e.target?MI(e.target)?e.target.checked:e.target.value:e,Blt=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,n8e=(e,t)=>e.has(Blt(t)),$lt=e=>{const t=e.constructor&&e.constructor.prototype;return fc(t)&&t.hasOwnProperty("isPrototypeOf")},Qge=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Dc(e){let t;const n=Array.isArray(e),s=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Qge&&(e instanceof Blob||s))&&(n||fc(e)))if(t=n?[]:{},!n&&!$lt(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=Dc(e[i]));else return e;return t}var dse=e=>/^\w*$/.test(e),sc=e=>e===void 0,Jge=e=>Array.isArray(e)?e.filter(Boolean):[],exe=e=>Jge(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Kn=(e,t,n)=>{if(!t||!fc(e))return n;const s=(dse(t)?[t]:exe(t)).reduce((i,o)=>bu(i)?i:i[o],e);return sc(s)||s===e?sc(e[t])?n:e[t]:s},zh=e=>typeof e=="boolean",bo=(e,t,n)=>{let s=-1;const i=dse(t)?[t]:exe(t),o=i.length,l=o-1;for(;++srt.useContext(txe),Ult=e=>{const{children:t,...n}=e;return rt.createElement(txe.Provider,{value:n},t)};var s8e=(e,t,n,s=!0)=>{const i={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(i,o,{get:()=>{const l=o;return t._proxyFormState[l]!==tm.all&&(t._proxyFormState[l]=!s||tm.all),n&&(n[l]=!0),e[l]}});return i};const rxe=typeof window<"u"?rt.useLayoutEffect:rt.useEffect;function qlt(e){const t=use(),{control:n=t.control,disabled:s,name:i,exact:o}=e||{},[l,a]=rt.useState(n._formState),h=rt.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return rxe(()=>n._subscribe({name:i,formState:h.current,exact:o,callback:p=>{!s&&a({...n._formState,...p})}}),[i,s,o]),rt.useEffect(()=>{h.current.isValid&&n._setValid(!0)},[n]),rt.useMemo(()=>s8e(l,n,h.current,!1),[l,n])}var fg=e=>typeof e=="string",i8e=(e,t,n,s,i)=>fg(e)?(s&&t.watch.add(e),Kn(n,e,i)):Array.isArray(e)?e.map(o=>(s&&t.watch.add(o),Kn(n,o))):(s&&(t.watchAll=!0),n),_he=e=>bu(e)||!t8e(e);function Ex(e,t,n=new WeakSet){if(_he(e)||_he(t))return e===t;if($w(e)&&$w(t))return e.getTime()===t.getTime();const s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of s){const l=e[o];if(!i.includes(o))return!1;if(o!=="ref"){const a=t[o];if($w(l)&&$w(a)||fc(l)&&fc(a)||Array.isArray(l)&&Array.isArray(a)?!Ex(l,a,n):l!==a)return!1}}return!0}function Vlt(e){const t=use(),{control:n=t.control,name:s,defaultValue:i,disabled:o,exact:l,compute:a}=e||{},h=rt.useRef(i),p=rt.useRef(a),x=rt.useRef(void 0);p.current=a;const y=rt.useMemo(()=>n._getWatch(s,h.current),[n,s]),[b,j]=rt.useState(p.current?p.current(y):y);return rxe(()=>n._subscribe({name:s,formState:{values:!0},exact:l,callback:N=>{if(!o){const C=i8e(s,n._names,N.values||n._formValues,!1,h.current);if(p.current){const A=p.current(C);Ex(A,x.current)||(j(A),x.current=A)}else j(C)}}}),[n,o,s,l]),rt.useEffect(()=>n._removeUnmounted()),b}function Hlt(e){const t=use(),{name:n,disabled:s,control:i=t.control,shouldUnregister:o,defaultValue:l}=e,a=n8e(i._names.array,n),h=rt.useMemo(()=>Kn(i._formValues,n,Kn(i._defaultValues,n,l)),[i,n,l]),p=Vlt({control:i,name:n,defaultValue:h,exact:!0}),x=qlt({control:i,name:n,exact:!0}),y=rt.useRef(e),b=rt.useRef(i.register(n,{...e.rules,value:p,...zh(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const j=rt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Kn(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!Kn(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Kn(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Kn(x.validatingFields,n)},error:{enumerable:!0,get:()=>Kn(x.errors,n)}}),[x,n]),N=rt.useCallback(T=>b.current.onChange({target:{value:r8e(T),name:n},type:fte.CHANGE}),[n]),C=rt.useCallback(()=>b.current.onBlur({target:{value:Kn(i._formValues,n),name:n},type:fte.BLUR}),[n,i._formValues]),A=rt.useCallback(T=>{const L=Kn(i._fields,n);L&&T&&(L._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:z=>T.setCustomValidity(z),reportValidity:()=>T.reportValidity()})},[i._fields,n]),E=rt.useMemo(()=>({name:n,value:p,...zh(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:N,onBlur:C,ref:A}),[n,s,x.disabled,N,C,A,p]);return rt.useEffect(()=>{const T=i._options.shouldUnregister||o;i.register(n,{...y.current.rules,...zh(y.current.disabled)?{disabled:y.current.disabled}:{}});const L=(z,F)=>{const q=Kn(i._fields,z);q&&q._f&&(q._f.mount=F)};if(L(n,!0),T){const z=Dc(Kn(i._options.defaultValues,n));bo(i._defaultValues,n,z),sc(Kn(i._formValues,n))&&bo(i._formValues,n,z)}return!a&&i.register(n),()=>{(a?T&&!i._state.action:T)?i.unregister(n):L(n,!1)}},[n,i,a,o]),rt.useEffect(()=>{i._setDisabledField({disabled:s,name:n})},[s,n,i]),rt.useMemo(()=>({field:E,formState:x,fieldState:j}),[E,x,j])}const Wlt=e=>e.render(Hlt(e));var a8e=(e,t,n,s,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:i||!0}}:{},cA=e=>Array.isArray(e)?e:[e],qje=()=>{let e=[];return{get observers(){return e},next:i=>{for(const o of e)o.next&&o.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(o=>o!==i)}}),unsubscribe:()=>{e=[]}}},ah=e=>fc(e)&&!Object.keys(e).length,nxe=e=>e.type==="file",rm=e=>typeof e=="function",pte=e=>{if(!Qge)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},o8e=e=>e.type==="select-multiple",sxe=e=>e.type==="radio",Glt=e=>sxe(e)||MI(e),Kle=e=>pte(e)&&e.isConnected;function Klt(e,t){const n=t.slice(0,-1).length;let s=0;for(;s{for(const t in e)if(rm(e[t]))return!0;return!1};function mte(e,t={}){const n=Array.isArray(e);if(fc(e)||n)for(const s in e)Array.isArray(e[s])||fc(e[s])&&!l8e(e[s])?(t[s]=Array.isArray(e[s])?[]:{},mte(e[s],t[s])):bu(e[s])||(t[s]=!0);return t}function c8e(e,t,n){const s=Array.isArray(e);if(fc(e)||s)for(const i in e)Array.isArray(e[i])||fc(e[i])&&!l8e(e[i])?sc(t)||_he(n[i])?n[i]=Array.isArray(e[i])?mte(e[i],[]):{...mte(e[i])}:c8e(e[i],bu(t)?{}:t[i],n[i]):n[i]=!Ex(e[i],t[i]);return n}var DM=(e,t)=>c8e(e,t,mte(t));const Vje={value:!1,isValid:!1},Hje={value:!0,isValid:!0};var d8e=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!sc(e[0].attributes.value)?sc(e[0].value)||e[0].value===""?Hje:{value:e[0].value,isValid:!0}:Hje:Vje}return Vje},u8e=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:s})=>sc(e)?e:t?e===""?NaN:e&&+e:n&&fg(e)?new Date(e):s?s(e):e;const Wje={isValid:!1,value:null};var h8e=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Wje):Wje;function Gje(e){const t=e.ref;return nxe(t)?t.files:sxe(t)?h8e(e.refs).value:o8e(t)?[...t.selectedOptions].map(({value:n})=>n):MI(t)?d8e(e.refs).value:u8e(sc(t.value)?e.ref.value:t.value,e)}var Ylt=(e,t,n,s)=>{const i={};for(const o of e){const l=Kn(t,o);l&&bo(i,o,l._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:s}},gte=e=>e instanceof RegExp,RM=e=>sc(e)?e:gte(e)?e.source:fc(e)?gte(e.value)?e.value.source:e.value:e,Kje=e=>({isOnSubmit:!e||e===tm.onSubmit,isOnBlur:e===tm.onBlur,isOnChange:e===tm.onChange,isOnAll:e===tm.all,isOnTouch:e===tm.onTouched});const Zje="AsyncFunction";var Xlt=e=>!!e&&!!e.validate&&!!(rm(e.validate)&&e.validate.constructor.name===Zje||fc(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Zje)),Qlt=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Yje=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const dA=(e,t,n,s)=>{for(const i of n||Object.keys(e)){const o=Kn(e,i);if(o){const{_f:l,...a}=o;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],i)&&!s)return!0;if(l.ref&&t(l.ref,l.name)&&!s)return!0;if(dA(a,t))break}else if(fc(a)&&dA(a,t))break}}};function Xje(e,t,n){const s=Kn(e,n);if(s||dse(n))return{error:s,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),l=Kn(t,o),a=Kn(e,o);if(l&&!Array.isArray(l)&&n!==o)return{name:n};if(a&&a.type)return{name:o,error:a};if(a&&a.root&&a.root.type)return{name:`${o}.root`,error:a.root};i.pop()}return{name:n}}var Jlt=(e,t,n,s)=>{n(e);const{name:i,...o}=e;return ah(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(l=>t[l]===(!s||tm.all))},ect=(e,t,n)=>!e||!t||e===t||cA(e).some(s=>s&&(n?s===t:s.startsWith(t)||t.startsWith(s))),tct=(e,t,n,s,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?s.isOnBlur:i.isOnBlur)?!e:(n?s.isOnChange:i.isOnChange)?e:!0,rct=(e,t)=>!Jge(Kn(e,t)).length&&_c(e,t),nct=(e,t,n)=>{const s=cA(Kn(e,n));return bo(s,"root",t[n]),bo(e,n,s),e},lee=e=>fg(e);function Qje(e,t,n="validate"){if(lee(e)||Array.isArray(e)&&e.every(lee)||zh(e)&&!e)return{type:n,message:lee(e)?e:"",ref:t}}var n4=e=>fc(e)&&!gte(e)?e:{value:e,message:""},Jje=async(e,t,n,s,i,o)=>{const{ref:l,refs:a,required:h,maxLength:p,minLength:x,min:y,max:b,pattern:j,validate:N,name:C,valueAsNumber:A,mount:E}=e._f,T=Kn(n,C);if(!E||t.has(C))return{};const L=a?a[0]:l,z=le=>{i&&L.reportValidity&&(L.setCustomValidity(zh(le)?"":le||""),L.reportValidity())},F={},q=sxe(l),H=MI(l),K=q||H,Z=(A||nxe(l))&&sc(l.value)&&sc(T)||pte(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,te=a8e.bind(null,C,s,F),ae=(le,ve,ne,ge=px.maxLength,ie=px.minLength)=>{const fe=le?ve:ne;F[C]={type:le?ge:ie,message:fe,ref:l,...te(le?ge:ie,fe)}};if(o?!Array.isArray(T)||!T.length:h&&(!K&&(Z||bu(T))||zh(T)&&!T||H&&!d8e(a).isValid||q&&!h8e(a).isValid)){const{value:le,message:ve}=lee(h)?{value:!!h,message:h}:n4(h);if(le&&(F[C]={type:px.required,message:ve,ref:L,...te(px.required,ve)},!s))return z(ve),F}if(!Z&&(!bu(y)||!bu(b))){let le,ve;const ne=n4(b),ge=n4(y);if(!bu(T)&&!isNaN(T)){const ie=l.valueAsNumber||T&&+T;bu(ne.value)||(le=ie>ne.value),bu(ge.value)||(ve=ienew Date(new Date().toDateString()+" "+Ie),de=l.type=="time",ye=l.type=="week";fg(ne.value)&&T&&(le=de?fe(T)>fe(ne.value):ye?T>ne.value:ie>new Date(ne.value)),fg(ge.value)&&T&&(ve=de?fe(T)+le.value,ge=!bu(ve.value)&&T.length<+ve.value;if((ne||ge)&&(ae(ne,le.message,ve.message),!s))return z(F[C].message),F}if(j&&!Z&&fg(T)){const{value:le,message:ve}=n4(j);if(gte(le)&&!T.match(le)&&(F[C]={type:px.pattern,message:ve,ref:l,...te(px.pattern,ve)},!s))return z(ve),F}if(N){if(rm(N)){const le=await N(T,n),ve=Qje(le,L);if(ve&&(F[C]={...ve,...te(px.validate,ve.message)},!s))return z(ve.message),F}else if(fc(N)){let le={};for(const ve in N){if(!ah(le)&&!s)break;const ne=Qje(await N[ve](T,n),L,ve);ne&&(le={...ne,...te(ve,ne.message)},z(ne.message),s&&(F[C]=le))}if(!ah(le)&&(F[C]={ref:L,...le},!s))return F}}return z(!0),F};const sct={mode:tm.onSubmit,reValidateMode:tm.onChange,shouldFocusError:!0};function ict(e={}){let t={...sct,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:rm(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},i=fc(t.defaultValues)||fc(t.values)?Dc(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Dc(i),l={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},h,p=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...x};const b={array:qje(),state:qje()},j=t.criteriaMode===tm.all,N=$e=>Je=>{clearTimeout(p),p=setTimeout($e,Je)},C=async $e=>{if(!t.disabled&&(x.isValid||y.isValid||$e)){const Je=t.resolver?ah((await H()).errors):await Z(s,!0);Je!==n.isValid&&b.state.next({isValid:Je})}},A=($e,Je)=>{!t.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&(($e||Array.from(a.mount)).forEach(tt=>{tt&&(Je?bo(n.validatingFields,tt,Je):_c(n.validatingFields,tt))}),b.state.next({validatingFields:n.validatingFields,isValidating:!ah(n.validatingFields)}))},E=($e,Je=[],tt,ft,jt=!0,Nt=!0)=>{if(ft&&tt&&!t.disabled){if(l.action=!0,Nt&&Array.isArray(Kn(s,$e))){const Et=tt(Kn(s,$e),ft.argA,ft.argB);jt&&bo(s,$e,Et)}if(Nt&&Array.isArray(Kn(n.errors,$e))){const Et=tt(Kn(n.errors,$e),ft.argA,ft.argB);jt&&bo(n.errors,$e,Et),rct(n.errors,$e)}if((x.touchedFields||y.touchedFields)&&Nt&&Array.isArray(Kn(n.touchedFields,$e))){const Et=tt(Kn(n.touchedFields,$e),ft.argA,ft.argB);jt&&bo(n.touchedFields,$e,Et)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=DM(i,o)),b.state.next({name:$e,isDirty:ae($e,Je),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else bo(o,$e,Je)},T=($e,Je)=>{bo(n.errors,$e,Je),b.state.next({errors:n.errors})},L=$e=>{n.errors=$e,b.state.next({errors:n.errors,isValid:!1})},z=($e,Je,tt,ft)=>{const jt=Kn(s,$e);if(jt){const Nt=Kn(o,$e,sc(tt)?Kn(i,$e):tt);sc(Nt)||ft&&ft.defaultChecked||Je?bo(o,$e,Je?Nt:Gje(jt._f)):ne($e,Nt),l.mount&&C()}},F=($e,Je,tt,ft,jt)=>{let Nt=!1,Et=!1;const vt={name:$e};if(!t.disabled){if(!tt||ft){(x.isDirty||y.isDirty)&&(Et=n.isDirty,n.isDirty=vt.isDirty=ae(),Nt=Et!==vt.isDirty);const rr=Ex(Kn(i,$e),Je);Et=!!Kn(n.dirtyFields,$e),rr?_c(n.dirtyFields,$e):bo(n.dirtyFields,$e,!0),vt.dirtyFields=n.dirtyFields,Nt=Nt||(x.dirtyFields||y.dirtyFields)&&Et!==!rr}if(tt){const rr=Kn(n.touchedFields,$e);rr||(bo(n.touchedFields,$e,tt),vt.touchedFields=n.touchedFields,Nt=Nt||(x.touchedFields||y.touchedFields)&&rr!==tt)}Nt&&jt&&b.state.next(vt)}return Nt?vt:{}},q=($e,Je,tt,ft)=>{const jt=Kn(n.errors,$e),Nt=(x.isValid||y.isValid)&&zh(Je)&&n.isValid!==Je;if(t.delayError&&tt?(h=N(()=>T($e,tt)),h(t.delayError)):(clearTimeout(p),h=null,tt?bo(n.errors,$e,tt):_c(n.errors,$e)),(tt?!Ex(jt,tt):jt)||!ah(ft)||Nt){const Et={...ft,...Nt&&zh(Je)?{isValid:Je}:{},errors:n.errors,name:$e};n={...n,...Et},b.state.next(Et)}},H=async $e=>{A($e,!0);const Je=await t.resolver(o,t.context,Ylt($e||a.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return A($e),Je},K=async $e=>{const{errors:Je}=await H($e);if($e)for(const tt of $e){const ft=Kn(Je,tt);ft?bo(n.errors,tt,ft):_c(n.errors,tt)}else n.errors=Je;return Je},Z=async($e,Je,tt={valid:!0})=>{for(const ft in $e){const jt=$e[ft];if(jt){const{_f:Nt,...Et}=jt;if(Nt){const vt=a.array.has(Nt.name),rr=jt._f&&Xlt(jt._f);rr&&x.validatingFields&&A([ft],!0);const Ar=await Jje(jt,a.disabled,o,j,t.shouldUseNativeValidation&&!Je,vt);if(rr&&x.validatingFields&&A([ft]),Ar[Nt.name]&&(tt.valid=!1,Je))break;!Je&&(Kn(Ar,Nt.name)?vt?nct(n.errors,Ar,Nt.name):bo(n.errors,Nt.name,Ar[Nt.name]):_c(n.errors,Nt.name))}!ah(Et)&&await Z(Et,Je,tt)}}return tt.valid},te=()=>{for(const $e of a.unMount){const Je=Kn(s,$e);Je&&(Je._f.refs?Je._f.refs.every(tt=>!Kle(tt)):!Kle(Je._f.ref))&&Te($e)}a.unMount=new Set},ae=($e,Je)=>!t.disabled&&($e&&Je&&bo(o,$e,Je),!Ex(Ie(),i)),le=($e,Je,tt)=>i8e($e,a,{...l.mount?o:sc(Je)?i:fg($e)?{[$e]:Je}:Je},tt,Je),ve=$e=>Jge(Kn(l.mount?o:i,$e,t.shouldUnregister?Kn(i,$e,[]):[])),ne=($e,Je,tt={})=>{const ft=Kn(s,$e);let jt=Je;if(ft){const Nt=ft._f;Nt&&(!Nt.disabled&&bo(o,$e,u8e(Je,Nt)),jt=pte(Nt.ref)&&bu(Je)?"":Je,o8e(Nt.ref)?[...Nt.ref.options].forEach(Et=>Et.selected=jt.includes(Et.value)):Nt.refs?MI(Nt.ref)?Nt.refs.forEach(Et=>{(!Et.defaultChecked||!Et.disabled)&&(Array.isArray(jt)?Et.checked=!!jt.find(vt=>vt===Et.value):Et.checked=jt===Et.value||!!jt)}):Nt.refs.forEach(Et=>Et.checked=Et.value===jt):nxe(Nt.ref)?Nt.ref.value="":(Nt.ref.value=jt,Nt.ref.type||b.state.next({name:$e,values:Dc(o)})))}(tt.shouldDirty||tt.shouldTouch)&&F($e,jt,tt.shouldTouch,tt.shouldDirty,!0),tt.shouldValidate&&ye($e)},ge=($e,Je,tt)=>{for(const ft in Je){if(!Je.hasOwnProperty(ft))return;const jt=Je[ft],Nt=$e+"."+ft,Et=Kn(s,Nt);(a.array.has($e)||fc(jt)||Et&&!Et._f)&&!$w(jt)?ge(Nt,jt,tt):ne(Nt,jt,tt)}},ie=($e,Je,tt={})=>{const ft=Kn(s,$e),jt=a.array.has($e),Nt=Dc(Je);bo(o,$e,Nt),jt?(b.array.next({name:$e,values:Dc(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&tt.shouldDirty&&b.state.next({name:$e,dirtyFields:DM(i,o),isDirty:ae($e,Nt)})):ft&&!ft._f&&!bu(Nt)?ge($e,Nt,tt):ne($e,Nt,tt),Yje($e,a)&&b.state.next({...n,name:$e}),b.state.next({name:l.mount?$e:void 0,values:Dc(o)})},fe=async $e=>{l.mount=!0;const Je=$e.target;let tt=Je.name,ft=!0;const jt=Kn(s,tt),Nt=rr=>{ft=Number.isNaN(rr)||$w(rr)&&isNaN(rr.getTime())||Ex(rr,Kn(o,tt,rr))},Et=Kje(t.mode),vt=Kje(t.reValidateMode);if(jt){let rr,Ar;const yn=Je.type?Gje(jt._f):r8e($e),kn=$e.type===fte.BLUR||$e.type===fte.FOCUS_OUT,Jr=!Qlt(jt._f)&&!t.resolver&&!Kn(n.errors,tt)&&!jt._f.deps||tct(kn,Kn(n.touchedFields,tt),n.isSubmitted,vt,Et),zn=Yje(tt,a,kn);bo(o,tt,yn),kn?(jt._f.onBlur&&jt._f.onBlur($e),h&&h(0)):jt._f.onChange&&jt._f.onChange($e);const ks=F(tt,yn,kn),fr=!ah(ks)||zn;if(!kn&&b.state.next({name:tt,type:$e.type,values:Dc(o)}),Jr)return(x.isValid||y.isValid)&&(t.mode==="onBlur"?kn&&C():kn||C()),fr&&b.state.next({name:tt,...zn?{}:ks});if(!kn&&zn&&b.state.next({...n}),t.resolver){const{errors:xs}=await H([tt]);if(Nt(yn),ft){const ji=Xje(n.errors,s,tt),mi=Xje(xs,s,ji.name||tt);rr=mi.error,tt=mi.name,Ar=ah(xs)}}else A([tt],!0),rr=(await Jje(jt,a.disabled,o,j,t.shouldUseNativeValidation))[tt],A([tt]),Nt(yn),ft&&(rr?Ar=!1:(x.isValid||y.isValid)&&(Ar=await Z(s,!0)));ft&&(jt._f.deps&&ye(jt._f.deps),q(tt,Ar,rr,ks))}},de=($e,Je)=>{if(Kn(n.errors,Je)&&$e.focus)return $e.focus(),1},ye=async($e,Je={})=>{let tt,ft;const jt=cA($e);if(t.resolver){const Nt=await K(sc($e)?$e:jt);tt=ah(Nt),ft=$e?!jt.some(Et=>Kn(Nt,Et)):tt}else $e?(ft=(await Promise.all(jt.map(async Nt=>{const Et=Kn(s,Nt);return await Z(Et&&Et._f?{[Nt]:Et}:Et)}))).every(Boolean),!(!ft&&!n.isValid)&&C()):ft=tt=await Z(s);return b.state.next({...!fg($e)||(x.isValid||y.isValid)&&tt!==n.isValid?{}:{name:$e},...t.resolver||!$e?{isValid:tt}:{},errors:n.errors}),Je.shouldFocus&&!ft&&dA(s,de,$e?jt:a.mount),ft},Ie=$e=>{const Je={...l.mount?o:i};return sc($e)?Je:fg($e)?Kn(Je,$e):$e.map(tt=>Kn(Je,tt))},Ne=($e,Je)=>({invalid:!!Kn((Je||n).errors,$e),isDirty:!!Kn((Je||n).dirtyFields,$e),error:Kn((Je||n).errors,$e),isValidating:!!Kn(n.validatingFields,$e),isTouched:!!Kn((Je||n).touchedFields,$e)}),we=$e=>{$e&&cA($e).forEach(Je=>_c(n.errors,Je)),b.state.next({errors:$e?n.errors:{}})},he=($e,Je,tt)=>{const ft=(Kn(s,$e,{_f:{}})._f||{}).ref,jt=Kn(n.errors,$e)||{},{ref:Nt,message:Et,type:vt,...rr}=jt;bo(n.errors,$e,{...rr,...Je,ref:ft}),b.state.next({name:$e,errors:n.errors,isValid:!1}),tt&&tt.shouldFocus&&ft&&ft.focus&&ft.focus()},xe=($e,Je)=>rm($e)?b.state.subscribe({next:tt=>"values"in tt&&$e(le(void 0,Je),tt)}):le($e,Je,!0),be=$e=>b.state.subscribe({next:Je=>{ect($e.name,Je.name,$e.exact)&&Jlt(Je,$e.formState||x,nt,$e.reRenderRoot)&&$e.callback({values:{...o},...n,...Je,defaultValues:i})}}).unsubscribe,Oe=$e=>(l.mount=!0,y={...y,...$e.formState},be({...$e,formState:y})),Te=($e,Je={})=>{for(const tt of $e?cA($e):a.mount)a.mount.delete(tt),a.array.delete(tt),Je.keepValue||(_c(s,tt),_c(o,tt)),!Je.keepError&&_c(n.errors,tt),!Je.keepDirty&&_c(n.dirtyFields,tt),!Je.keepTouched&&_c(n.touchedFields,tt),!Je.keepIsValidating&&_c(n.validatingFields,tt),!t.shouldUnregister&&!Je.keepDefaultValue&&_c(i,tt);b.state.next({values:Dc(o)}),b.state.next({...n,...Je.keepDirty?{isDirty:ae()}:{}}),!Je.keepIsValid&&C()},Ve=({disabled:$e,name:Je})=>{(zh($e)&&l.mount||$e||a.disabled.has(Je))&&($e?a.disabled.add(Je):a.disabled.delete(Je))},Fe=($e,Je={})=>{let tt=Kn(s,$e);const ft=zh(Je.disabled)||zh(t.disabled);return bo(s,$e,{...tt||{},_f:{...tt&&tt._f?tt._f:{ref:{name:$e}},name:$e,mount:!0,...Je}}),a.mount.add($e),tt?Ve({disabled:zh(Je.disabled)?Je.disabled:t.disabled,name:$e}):z($e,!0,Je.value),{...ft?{disabled:Je.disabled||t.disabled}:{},...t.progressive?{required:!!Je.required,min:RM(Je.min),max:RM(Je.max),minLength:RM(Je.minLength),maxLength:RM(Je.maxLength),pattern:RM(Je.pattern)}:{},name:$e,onChange:fe,onBlur:fe,ref:jt=>{if(jt){Fe($e,Je),tt=Kn(s,$e);const Nt=sc(jt.value)&&jt.querySelectorAll&&jt.querySelectorAll("input,select,textarea")[0]||jt,Et=Glt(Nt),vt=tt._f.refs||[];if(Et?vt.find(rr=>rr===Nt):Nt===tt._f.ref)return;bo(s,$e,{_f:{...tt._f,...Et?{refs:[...vt.filter(Kle),Nt,...Array.isArray(Kn(i,$e))?[{}]:[]],ref:{type:Nt.type,name:$e}}:{ref:Nt}}}),z($e,!1,void 0,Nt)}else tt=Kn(s,$e,{}),tt._f&&(tt._f.mount=!1),(t.shouldUnregister||Je.shouldUnregister)&&!(n8e(a.array,$e)&&l.action)&&a.unMount.add($e)}}},Me=()=>t.shouldFocusError&&dA(s,de,a.mount),Qe=$e=>{zh($e)&&(b.state.next({disabled:$e}),dA(s,(Je,tt)=>{const ft=Kn(s,tt);ft&&(Je.disabled=ft._f.disabled||$e,Array.isArray(ft._f.refs)&&ft._f.refs.forEach(jt=>{jt.disabled=ft._f.disabled||$e}))},0,!1))},Ee=($e,Je)=>async tt=>{let ft;tt&&(tt.preventDefault&&tt.preventDefault(),tt.persist&&tt.persist());let jt=Dc(o);if(b.state.next({isSubmitting:!0}),t.resolver){const{errors:Nt,values:Et}=await H();n.errors=Nt,jt=Dc(Et)}else await Z(s);if(a.disabled.size)for(const Nt of a.disabled)_c(jt,Nt);if(_c(n.errors,"root"),ah(n.errors)){b.state.next({errors:{}});try{await $e(jt,tt)}catch(Nt){ft=Nt}}else Je&&await Je({...n.errors},tt),Me(),setTimeout(Me);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ah(n.errors)&&!ft,submitCount:n.submitCount+1,errors:n.errors}),ft)throw ft},Ye=($e,Je={})=>{Kn(s,$e)&&(sc(Je.defaultValue)?ie($e,Dc(Kn(i,$e))):(ie($e,Je.defaultValue),bo(i,$e,Dc(Je.defaultValue))),Je.keepTouched||_c(n.touchedFields,$e),Je.keepDirty||(_c(n.dirtyFields,$e),n.isDirty=Je.defaultValue?ae($e,Dc(Kn(i,$e))):ae()),Je.keepError||(_c(n.errors,$e),x.isValid&&C()),b.state.next({...n}))},me=($e,Je={})=>{const tt=$e?Dc($e):i,ft=Dc(tt),jt=ah($e),Nt=jt?i:ft;if(Je.keepDefaultValues||(i=tt),!Je.keepValues){if(Je.keepDirtyValues){const Et=new Set([...a.mount,...Object.keys(DM(i,o))]);for(const vt of Array.from(Et))Kn(n.dirtyFields,vt)?bo(Nt,vt,Kn(o,vt)):ie(vt,Kn(Nt,vt))}else{if(Qge&&sc($e))for(const Et of a.mount){const vt=Kn(s,Et);if(vt&&vt._f){const rr=Array.isArray(vt._f.refs)?vt._f.refs[0]:vt._f.ref;if(pte(rr)){const Ar=rr.closest("form");if(Ar){Ar.reset();break}}}}if(Je.keepFieldsRef)for(const Et of a.mount)ie(Et,Kn(Nt,Et));else s={}}o=t.shouldUnregister?Je.keepDefaultValues?Dc(i):{}:Dc(Nt),b.array.next({values:{...Nt}}),b.state.next({values:{...Nt}})}a={mount:Je.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Je.keepIsValid||!!Je.keepDirtyValues,l.watch=!!t.shouldUnregister,b.state.next({submitCount:Je.keepSubmitCount?n.submitCount:0,isDirty:jt?!1:Je.keepDirty?n.isDirty:!!(Je.keepDefaultValues&&!Ex($e,i)),isSubmitted:Je.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:jt?{}:Je.keepDirtyValues?Je.keepDefaultValues&&o?DM(i,o):n.dirtyFields:Je.keepDefaultValues&&$e?DM(i,$e):Je.keepDirty?n.dirtyFields:{},touchedFields:Je.keepTouched?n.touchedFields:{},errors:Je.keepErrors?n.errors:{},isSubmitSuccessful:Je.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},mt=($e,Je)=>me(rm($e)?$e(o):$e,Je),et=($e,Je={})=>{const tt=Kn(s,$e),ft=tt&&tt._f;if(ft){const jt=ft.refs?ft.refs[0]:ft.ref;jt.focus&&(jt.focus(),Je.shouldSelect&&rm(jt.select)&&jt.select())}},nt=$e=>{n={...n,...$e}},ht={control:{register:Fe,unregister:Te,getFieldState:Ne,handleSubmit:Ee,setError:he,_subscribe:be,_runSchema:H,_focusError:Me,_getWatch:le,_getDirty:ae,_setValid:C,_setFieldArray:E,_setDisabledField:Ve,_setErrors:L,_getFieldArray:ve,_reset:me,_resetDefaultValues:()=>rm(t.defaultValues)&&t.defaultValues().then($e=>{mt($e,t.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:te,_disableForm:Qe,_subjects:b,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return l},set _state($e){l=$e},get _defaultValues(){return i},get _names(){return a},set _names($e){a=$e},get _formState(){return n},get _options(){return t},set _options($e){t={...t,...$e}}},subscribe:Oe,trigger:ye,register:Fe,handleSubmit:Ee,watch:xe,setValue:ie,getValues:Ie,reset:mt,resetField:Ye,clearErrors:we,unregister:Te,setError:he,setFocus:et,getFieldState:Ne};return{...ht,formControl:ht}}function hse(e={}){const t=rt.useRef(void 0),n=rt.useRef(void 0),[s,i]=rt.useState({isDirty:!1,isValidating:!1,isLoading:rm(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:rm(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!rm(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...a}=ict(e);t.current={...a,formState:s}}const o=t.current.control;return o._options=e,rxe(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>i({...o._formState}),reRenderRoot:!0});return i(a=>({...a,isReady:!0})),o._formState.isReady=!0,l},[o]),rt.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),rt.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),rt.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),rt.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),rt.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),rt.useEffect(()=>{e.values&&!Ex(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=e.values,i(l=>({...l}))):o._resetDefaultValues()},[o,e.values]),rt.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=s8e(s,o),t.current}const eke=(e,t,n)=>{if(e&&"reportValidity"in e){const s=Kn(n,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},f8e=(e,t)=>{for(const n in t.fields){const s=t.fields[n];s&&s.ref&&"reportValidity"in s.ref?eke(s.ref,n,e):s.refs&&s.refs.forEach(i=>eke(i,n,e))}},act=(e,t)=>{t.shouldUseNativeValidation&&f8e(e,t);const n={};for(const s in e){const i=Kn(t.fields,s),o=Object.assign(e[s]||{},{ref:i&&i.ref});if(oct(t.names||Object.keys(e),s)){const l=Object.assign({},Kn(n,s));bo(l,"root",o),bo(n,s,l)}else bo(n,s,o)}return n},oct=(e,t)=>e.some(n=>n.startsWith(t+"."));var lct=function(e,t){for(var n={};e.length;){var s=e[0],i=s.code,o=s.message,l=s.path.join(".");if(!n[l])if("unionErrors"in s){var a=s.unionErrors[0].errors[0];n[l]={message:a.message,type:a.code}}else n[l]={message:o,type:i};if("unionErrors"in s&&s.unionErrors.forEach(function(x){return x.errors.forEach(function(y){return e.push(y)})}),t){var h=n[l].types,p=h&&h[s.code];n[l]=a8e(l,t,n,i,p?[].concat(p,s.message):s.message)}e.shift()}return n},fse=function(e,t,n){return n===void 0&&(n={}),function(s,i,o){try{return Promise.resolve(function(l,a){try{var h=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](s,t)).then(function(p){return o.shouldUseNativeValidation&&f8e({},o),{errors:{},values:n.raw?s:p}})}catch(p){return a(p)}return h&&h.then?h.then(void 0,a):h}(0,function(l){if(function(a){return Array.isArray(a==null?void 0:a.errors)}(l))return{values:{},errors:act(lct(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const pse=Ult,p8e=I.createContext({}),Ml=({...e})=>r.jsx(p8e.Provider,{value:{name:e.name},children:r.jsx(Wlt,{...e})}),mse=()=>{const e=I.useContext(p8e),t=I.useContext(m8e),{getFieldState:n,formState:s}=use(),i=n(e.name,s);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},m8e=I.createContext({}),_l=I.forwardRef(({className:e,...t},n)=>{const s=I.useId();return r.jsx(m8e.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:$t("space-y-2",e),...t})})});_l.displayName="FormItem";const bl=I.forwardRef(({className:e,...t},n)=>{const{error:s,formItemId:i}=mse();return r.jsx(Ue,{ref:n,className:$t(s&&"text-destructive",e),htmlFor:i,...t})});bl.displayName="FormLabel";const wl=I.forwardRef(({...e},t)=>{const{error:n,formItemId:s,formDescriptionId:i,formMessageId:o}=mse();return r.jsx(Ume,{ref:t,id:s,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...e})});wl.displayName="FormControl";const cee=I.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:s}=mse();return r.jsx("p",{ref:n,id:s,className:$t("text-sm text-muted-foreground",e),...t})});cee.displayName="FormDescription";const wu=I.forwardRef(({className:e,children:t,...n},s)=>{const{error:i,formMessageId:o}=mse(),l=i?String(i==null?void 0:i.message):t;return l?r.jsx("p",{ref:s,id:o,className:$t("text-sm font-medium text-destructive",e),...n,children:l}):null});wu.displayName="FormMessage";const ps=I.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:$t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));ps.displayName="Textarea";const cct=u3({category:D6e(["general","technology","crm","marketing"]),subject:nc().min(5,"Subject must be at least 5 characters").max(200),description:nc().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),dct={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function bhe({trigger:e}){const[t,n]=I.useState(!1),[s,i]=I.useState(!1),{user:o}=zr(),l=hse({resolver:fse(cct),defaultValues:{category:"general",subject:"",description:""}}),a=async h=>{if(!o){ze.error("You must be logged in to submit a ticket");return}i(!0);try{const{error:p}=await J.from("support_tickets").insert({user_id:o.id,category:h.category,subject:h.subject,description:h.description});if(p)throw p;try{await J.functions.invoke("support-ticket-notify",{body:{category:dct[h.category],subject:h.subject}})}catch(x){console.log("Notification send attempted:",x)}ze.success("Support ticket submitted successfully!"),l.reset(),n(!1)}catch(p){console.error("Error submitting ticket:",p),ze.error("Failed to submit ticket. Please try again.")}finally{i(!1)}};return r.jsxs(Br,{open:t,onOpenChange:n,children:[r.jsx(zo,{asChild:!0,children:e||r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(FT,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Fr,{className:"sm:max-w-[500px]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Need Help?"}),r.jsx(es,{children:"Submit a support ticket and we'll get back to you as soon as possible."})]}),r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg mb-4",children:[r.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["You can also text us at: ",r.jsx("span",{className:"font-medium text-foreground",children:"1-866-527-8668"})]})]}),r.jsx(pse,{...l,children:r.jsxs("form",{onSubmit:l.handleSubmit(a),className:"space-y-4",children:[r.jsx(Ml,{control:l.control,name:"category",render:({field:h})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Category"}),r.jsxs(vn,{onValueChange:h.onChange,defaultValue:h.value,children:[r.jsx(wl,{children:r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select a category"})})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"general",children:"General Support"}),r.jsx(Ht,{value:"technology",children:"Technology Support"}),r.jsx(Ht,{value:"crm",children:"CRM Support"}),r.jsx(Ht,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(wu,{})]})}),r.jsx(Ml,{control:l.control,name:"subject",render:({field:h})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Subject"}),r.jsx(wl,{children:r.jsx(at,{placeholder:"Brief description of your issue",...h})}),r.jsx(wu,{})]})}),r.jsx(Ml,{control:l.control,name:"description",render:({field:h})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Description"}),r.jsx(wl,{children:r.jsx(ps,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...h})}),r.jsx(wu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function js(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function jo(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Hl(e,t){const n=js(e);return isNaN(t)?jo(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function wh(e,t){const n=js(e);if(isNaN(t))return jo(e,NaN);if(!t)return n;const s=n.getDate(),i=jo(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}function g8e(e,t){const n=+js(e);return jo(e,n+t)}const ixe=6048e5,uct=864e5,x8e=6e4,y8e=36e5,hct=1e3,jL=43200,tke=1440;function rke(e,t){return g8e(e,t*y8e)}let fct={};function av(){return fct}function af(e,t){var a,h,p,x;const n=av(),s=(t==null?void 0:t.weekStartsOn)??((h=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,i=js(e),o=i.getDay(),l=(o=i.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function of(e){const t=js(e);return t.setHours(0,0,0,0),t}function $1(e){const t=js(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function om(e,t){const n=of(e),s=of(t),i=+n-$1(n),o=+s-$1(s);return Math.round((i-o)/uct)}function pct(e){const t=v8e(e),n=jo(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),ly(n)}function nke(e,t){return g8e(e,t*x8e)}function Uw(e,t){const n=t*7;return Hl(e,n)}function mct(e,t){return wh(e,t*12)}function gct(e){let t;return e.forEach(function(n){const s=js(n);(t===void 0||t{const s=js(n);(!t||t>s||isNaN(+s))&&(t=s)}),t||new Date(NaN)}function dee(e,t){const n=js(e),s=js(t),i=n.getTime()-s.getTime();return i<0?-1:i>0?1:i}function yct(e){return jo(e,Date.now())}function Zl(e,t){const n=of(e),s=of(t);return+n==+s}function axe(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function whe(e){if(!axe(e)&&typeof e!="number")return!1;const t=js(e);return!isNaN(Number(t))}function mC(e,t){const n=js(e),s=js(t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function vct(e,t,n){const s=af(e,n),i=af(t,n),o=+s-$1(s),l=+i-$1(i);return Math.round((o-l)/ixe)}function gC(e,t){const n=js(e),s=js(t),i=ske(n,s),o=Math.abs(om(n,s));n.setDate(n.getDate()-i*o);const l=+(ske(n,s)===-i),a=i*(o-l);return a===0?0:a}function ske(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function _ct(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function bct(e,t){return+js(e)-+js(t)}function wct(e){const t=js(e);return t.setHours(23,59,59,999),t}function gse(e){const t=js(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function jct(e){const t=js(e);return+wct(t)==+gse(t)}function kct(e,t){const n=js(e),s=js(t),i=dee(n,s),o=Math.abs(mC(n,s));let l;if(o<1)l=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*o);let a=dee(n,s)===-i;jct(js(e))&&o===1&&dee(e,s)===1&&(a=!1),l=i*(o-Number(a))}return l===0?0:l}function Nct(e,t,n){const s=bct(e,t)/1e3;return _ct(n==null?void 0:n.roundingMethod)(s)}function vh(e){const t=js(e);return t.setDate(1),t.setHours(0,0,0,0),t}function _8e(e){const t=js(e),n=jo(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function oxe(e,t){var a,h,p,x;const n=av(),s=(t==null?void 0:t.weekStartsOn)??((h=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,i=js(e),o=i.getDay(),l=(o{let s;const i=Sct[e];return typeof i=="string"?s=i:t===1?s=i.one:s=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Zle(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Mct={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Tct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Act={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ect={date:Zle({formats:Mct,defaultWidth:"full"}),time:Zle({formats:Tct,defaultWidth:"full"}),dateTime:Zle({formats:Act,defaultWidth:"full"})},Ict={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Pct=(e,t,n,s)=>Ict[e];function FM(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let i;if(s==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,a=n!=null&&n.width?String(n.width):l;i=e.formattingValues[a]||e.formattingValues[l]}else{const l=e.defaultWidth,a=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[a]||e.values[l]}const o=e.argumentCallback?e.argumentCallback(t):t;return i[o]}}const Lct={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Oct={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Dct={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"]},Rct={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","Friday","Saturday"]},Fct={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"}},zct={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"}},Bct=(e,t)=>{const n=Number(e),s=n%100;if(s>20||s<10)switch(s%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},$ct={ordinalNumber:Bct,era:FM({values:Lct,defaultWidth:"wide"}),quarter:FM({values:Oct,defaultWidth:"wide",argumentCallback:e=>e-1}),month:FM({values:Dct,defaultWidth:"wide"}),day:FM({values:Rct,defaultWidth:"wide"}),dayPeriod:FM({values:Fct,defaultWidth:"wide",formattingValues:zct,defaultFormattingWidth:"wide"})};function zM(e){return(t,n={})=>{const s=n.width,i=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const l=o[0],a=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],h=Array.isArray(a)?qct(a,y=>y.test(l)):Uct(a,y=>y.test(l));let p;p=e.valueCallback?e.valueCallback(h):h,p=n.valueCallback?n.valueCallback(p):p;const x=t.slice(l.length);return{value:p,rest:x}}}function Uct(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function qct(e,t){for(let n=0;n{const s=t.match(e.matchPattern);if(!s)return null;const i=s[0],o=t.match(e.parsePattern);if(!o)return null;let l=e.valueCallback?e.valueCallback(o[0]):o[0];l=n.valueCallback?n.valueCallback(l):l;const a=t.slice(i.length);return{value:l,rest:a}}}const Hct=/^(\d+)(th|st|nd|rd)?/i,Wct=/\d+/i,Gct={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},Kct={any:[/^b/i,/^(a|c)/i]},Zct={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Yct={any:[/1/i,/2/i,/3/i,/4/i]},Xct={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},Qct={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]},Jct={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},edt={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]},tdt={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},rdt={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}},ndt={ordinalNumber:Vct({matchPattern:Hct,parsePattern:Wct,valueCallback:e=>parseInt(e,10)}),era:zM({matchPatterns:Gct,defaultMatchWidth:"wide",parsePatterns:Kct,defaultParseWidth:"any"}),quarter:zM({matchPatterns:Zct,defaultMatchWidth:"wide",parsePatterns:Yct,defaultParseWidth:"any",valueCallback:e=>e+1}),month:zM({matchPatterns:Xct,defaultMatchWidth:"wide",parsePatterns:Qct,defaultParseWidth:"any"}),day:zM({matchPatterns:Jct,defaultMatchWidth:"wide",parsePatterns:edt,defaultParseWidth:"any"}),dayPeriod:zM({matchPatterns:tdt,defaultMatchWidth:"any",parsePatterns:rdt,defaultParseWidth:"any"})},xse={code:"en-US",formatDistance:Cct,formatLong:Ect,formatRelative:Pct,localize:$ct,match:ndt,options:{weekStartsOn:0,firstWeekContainsDate:1}};function sdt(e){const t=js(e);return om(t,_8e(t))+1}function lxe(e){const t=js(e),n=+ly(t)-+pct(t);return Math.round(n/ixe)+1}function cxe(e,t){var x,y,b,j;const n=js(e),s=n.getFullYear(),i=av(),o=(t==null?void 0:t.firstWeekContainsDate)??((y=(x=t==null?void 0:t.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??i.firstWeekContainsDate??((j=(b=i.locale)==null?void 0:b.options)==null?void 0:j.firstWeekContainsDate)??1,l=jo(e,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const a=af(l,t),h=jo(e,0);h.setFullYear(s,0,o),h.setHours(0,0,0,0);const p=af(h,t);return n.getTime()>=a.getTime()?s+1:n.getTime()>=p.getTime()?s:s-1}function idt(e,t){var a,h,p,x;const n=av(),s=(t==null?void 0:t.firstWeekContainsDate)??((h=(a=t==null?void 0:t.locale)==null?void 0:a.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.firstWeekContainsDate)??1,i=cxe(e,t),o=jo(e,0);return o.setFullYear(i,0,s),o.setHours(0,0,0,0),af(o,t)}function dxe(e,t){const n=js(e),s=+af(n,t)-+idt(n,t);return Math.round(s/ixe)+1}function wo(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const a0={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return wo(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):wo(n+1,2)},d(e,t){return wo(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return wo(e.getHours()%12||12,t.length)},H(e,t){return wo(e.getHours(),t.length)},m(e,t){return wo(e.getMinutes(),t.length)},s(e,t){return wo(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),i=Math.trunc(s*Math.pow(10,n-3));return wo(i,t.length)}},s4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ike={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});case"GGGG":default:return n.era(s,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const s=e.getFullYear(),i=s>0?s:1-s;return n.ordinalNumber(i,{unit:"year"})}return a0.y(e,t)},Y:function(e,t,n,s){const i=cxe(e,s),o=i>0?i:1-i;if(t==="YY"){const l=o%100;return wo(l,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):wo(o,t.length)},R:function(e,t){const n=v8e(e);return wo(n,t.length)},u:function(e,t){const n=e.getFullYear();return wo(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return wo(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return wo(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return a0.M(e,t);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return wo(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(e,t,n,s){const i=dxe(e,s);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):wo(i,t.length)},I:function(e,t,n){const s=lxe(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):wo(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):a0.d(e,t)},D:function(e,t,n){const s=sdt(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):wo(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(e,t,n,s){const i=e.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return wo(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const i=e.getDay(),o=(i-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return wo(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),i=s===0?7:s;switch(t){case"i":return String(i);case"ii":return wo(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let i;switch(s===12?i=s4.noon:s===0?i=s4.midnight:i=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let i;switch(s>=17?i=s4.evening:s>=12?i=s4.afternoon:s>=4?i=s4.morning:i=s4.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return a0.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):a0.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):wo(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):wo(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):a0.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):a0.s(e,t)},S:function(e,t){return a0.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return oke(s);case"XXXX":case"XX":return Mw(s);case"XXXXX":case"XXX":default:return Mw(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return oke(s);case"xxxx":case"xx":return Mw(s);case"xxxxx":case"xxx":default:return Mw(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ake(s,":");case"OOOO":default:return"GMT"+Mw(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ake(s,":");case"zzzz":default:return"GMT"+Mw(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return wo(s,t.length)},T:function(e,t,n){const s=e.getTime();return wo(s,t.length)}};function ake(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),i=Math.trunc(s/60),o=s%60;return o===0?n+String(i):n+String(i)+t+wo(o,2)}function oke(e,t){return e%60===0?(e>0?"-":"+")+wo(Math.abs(e)/60,2):Mw(e,t)}function Mw(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),i=wo(Math.trunc(s/60),2),o=wo(s%60,2);return n+i+t+o}const lke=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},w8e=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},adt=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return lke(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",lke(s,t)).replace("{{time}}",w8e(i,t))},jhe={p:w8e,P:adt},odt=/^D+$/,ldt=/^Y+$/,cdt=["D","DD","YY","YYYY"];function j8e(e){return odt.test(e)}function k8e(e){return ldt.test(e)}function khe(e,t,n){const s=ddt(e,t,n);if(console.warn(s),cdt.includes(e))throw new RangeError(s)}function ddt(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const udt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,hdt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,fdt=/^'([^]*?)'?$/,pdt=/''/g,mdt=/[a-zA-Z]/;function xn(e,t,n){var x,y,b,j,N,C,A,E;const s=av(),i=(n==null?void 0:n.locale)??s.locale??xse,o=(n==null?void 0:n.firstWeekContainsDate)??((y=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??s.firstWeekContainsDate??((j=(b=s.locale)==null?void 0:b.options)==null?void 0:j.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((C=(N=n==null?void 0:n.locale)==null?void 0:N.options)==null?void 0:C.weekStartsOn)??s.weekStartsOn??((E=(A=s.locale)==null?void 0:A.options)==null?void 0:E.weekStartsOn)??0,a=js(e);if(!whe(a))throw new RangeError("Invalid time value");let h=t.match(hdt).map(T=>{const L=T[0];if(L==="p"||L==="P"){const z=jhe[L];return z(T,i.formatLong)}return T}).join("").match(udt).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const L=T[0];if(L==="'")return{isToken:!1,value:gdt(T)};if(ike[L])return{isToken:!0,value:T};if(L.match(mdt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+L+"`");return{isToken:!1,value:T}});i.localize.preprocessor&&(h=i.localize.preprocessor(a,h));const p={firstWeekContainsDate:o,weekStartsOn:l,locale:i};return h.map(T=>{if(!T.isToken)return T.value;const L=T.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&k8e(L)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&j8e(L))&&khe(L,t,String(e));const z=ike[L[0]];return z(a,L,i.localize,p)}).join("")}function gdt(e){const t=e.match(fdt);return t?t[1].replace(pdt,"'"):e}function xdt(e,t,n){const s=av(),i=(n==null?void 0:n.locale)??s.locale??xse,o=2520,l=dee(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:l});let h,p;l>0?(h=js(t),p=js(e)):(h=js(e),p=js(t));const x=Nct(p,h),y=($1(p)-$1(h))/1e3,b=Math.round((x-y)/60);let j;if(b<2)return n!=null&&n.includeSeconds?x<5?i.formatDistance("lessThanXSeconds",5,a):x<10?i.formatDistance("lessThanXSeconds",10,a):x<20?i.formatDistance("lessThanXSeconds",20,a):x<40?i.formatDistance("halfAMinute",0,a):x<60?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",1,a):b===0?i.formatDistance("lessThanXMinutes",1,a):i.formatDistance("xMinutes",b,a);if(b<45)return i.formatDistance("xMinutes",b,a);if(b<90)return i.formatDistance("aboutXHours",1,a);if(bs.getTime()}function yse(e,t){const n=js(e),s=js(t);return+n<+s}function kdt(e){return+js(e)>Date.now()}function Ndt(e,t){const n=t instanceof Date?jo(t,0):new t(0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}const Sdt=10;class N8e{constructor(){Gn(this,"subPriority",0)}validate(t,n){return!0}}class Cdt extends N8e{constructor(t,n,s,i,o){super(),this.value=t,this.validateValue=n,this.setValue=s,this.priority=i,o&&(this.subPriority=o)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,s){return this.setValue(t,n,this.value,s)}}class Mdt extends N8e{constructor(){super(...arguments);Gn(this,"priority",Sdt);Gn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:jo(n,Ndt(n,Date))}}class ho{run(t,n,s,i){const o=this.parse(t,n,s,i);return o?{setter:new Cdt(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,s){return!0}}class Tdt extends ho{constructor(){super(...arguments);Gn(this,"priority",140);Gn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,i){switch(s){case"G":case"GG":case"GGG":return i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"});case"GGGGG":return i.era(n,{width:"narrow"});case"GGGG":default:return i.era(n,{width:"wide"})||i.era(n,{width:"abbreviated"})||i.era(n,{width:"narrow"})}}set(n,s,i){return s.era=i,n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}const oc={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},dg={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function lc(e,t){return e&&{value:t(e.value),rest:e.rest}}function Il(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function ug(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.slice(1)};const s=n[1]==="+"?1:-1,i=n[2]?parseInt(n[2],10):0,o=n[3]?parseInt(n[3],10):0,l=n[5]?parseInt(n[5],10):0;return{value:s*(i*y8e+o*x8e+l*hct),rest:t.slice(n[0].length)}}function S8e(e){return Il(oc.anyDigitsSigned,e)}function Xl(e,t){switch(e){case 1:return Il(oc.singleDigit,t);case 2:return Il(oc.twoDigits,t);case 3:return Il(oc.threeDigits,t);case 4:return Il(oc.fourDigits,t);default:return Il(new RegExp("^\\d{1,"+e+"}"),t)}}function yte(e,t){switch(e){case 1:return Il(oc.singleDigitSigned,t);case 2:return Il(oc.twoDigitsSigned,t);case 3:return Il(oc.threeDigitsSigned,t);case 4:return Il(oc.fourDigitsSigned,t);default:return Il(new RegExp("^-?\\d{1,"+e+"}"),t)}}function uxe(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function C8e(e,t){const n=t>0,s=n?t:1-t;let i;if(s<=50)i=e||100;else{const o=s+50,l=Math.trunc(o/100)*100,a=e>=o%100;i=e+l-(a?100:0)}return n?i:1-i}function M8e(e){return e%400===0||e%4===0&&e%100!==0}class Adt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,i){const o=l=>({year:l,isTwoDigitYear:s==="yy"});switch(s){case"y":return lc(Xl(4,n),o);case"yo":return lc(i.ordinalNumber(n,{unit:"year"}),o);default:return lc(Xl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i){const o=n.getFullYear();if(i.isTwoDigitYear){const a=C8e(i.year,o);return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}const l=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(l,0,1),n.setHours(0,0,0,0),n}}class Edt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,i){const o=l=>({year:l,isTwoDigitYear:s==="YY"});switch(s){case"Y":return lc(Xl(4,n),o);case"Yo":return lc(i.ordinalNumber(n,{unit:"year"}),o);default:return lc(Xl(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,i,o){const l=cxe(n,o);if(i.isTwoDigitYear){const h=C8e(i.year,l);return n.setFullYear(h,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),af(n,o)}const a=!("era"in s)||s.era===1?i.year:1-i.year;return n.setFullYear(a,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),af(n,o)}}class Idt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return yte(s==="R"?4:s.length,n)}set(n,s,i){const o=jo(n,0);return o.setFullYear(i,0,4),o.setHours(0,0,0,0),ly(o)}}class Pdt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return yte(s==="u"?4:s.length,n)}set(n,s,i){return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}}class Ldt extends ho{constructor(){super(...arguments);Gn(this,"priority",120);Gn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"Q":case"QQ":return Xl(s.length,n);case"Qo":return i.ordinalNumber(n,{unit:"quarter"});case"QQQ":return i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return i.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(n,{width:"wide",context:"formatting"})||i.quarter(n,{width:"abbreviated",context:"formatting"})||i.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class Odt extends ho{constructor(){super(...arguments);Gn(this,"priority",120);Gn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"q":case"qq":return Xl(s.length,n);case"qo":return i.ordinalNumber(n,{unit:"quarter"});case"qqq":return i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return i.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(n,{width:"wide",context:"standalone"})||i.quarter(n,{width:"abbreviated",context:"standalone"})||i.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,i){return n.setMonth((i-1)*3,1),n.setHours(0,0,0,0),n}}class Ddt extends ho{constructor(){super(...arguments);Gn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Gn(this,"priority",110)}parse(n,s,i){const o=l=>l-1;switch(s){case"M":return lc(Il(oc.month,n),o);case"MM":return lc(Xl(2,n),o);case"Mo":return lc(i.ordinalNumber(n,{unit:"month"}),o);case"MMM":return i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return i.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(n,{width:"wide",context:"formatting"})||i.month(n,{width:"abbreviated",context:"formatting"})||i.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}class Rdt extends ho{constructor(){super(...arguments);Gn(this,"priority",110);Gn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,i){const o=l=>l-1;switch(s){case"L":return lc(Il(oc.month,n),o);case"LL":return lc(Xl(2,n),o);case"Lo":return lc(i.ordinalNumber(n,{unit:"month"}),o);case"LLL":return i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return i.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(n,{width:"wide",context:"standalone"})||i.month(n,{width:"abbreviated",context:"standalone"})||i.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.setMonth(i,1),n.setHours(0,0,0,0),n}}function Fdt(e,t,n){const s=js(e),i=dxe(s,n)-t;return s.setDate(s.getDate()-i*7),s}class zdt extends ho{constructor(){super(...arguments);Gn(this,"priority",100);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,i){switch(s){case"w":return Il(oc.week,n);case"wo":return i.ordinalNumber(n,{unit:"week"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i,o){return af(Fdt(n,i,o),o)}}function Bdt(e,t){const n=js(e),s=lxe(n)-t;return n.setDate(n.getDate()-s*7),n}class $dt extends ho{constructor(){super(...arguments);Gn(this,"priority",100);Gn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,i){switch(s){case"I":return Il(oc.week,n);case"Io":return i.ordinalNumber(n,{unit:"week"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,i){return ly(Bdt(n,i))}}const Udt=[31,28,31,30,31,30,31,31,30,31,30,31],qdt=[31,29,31,30,31,30,31,31,30,31,30,31];class Vdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"subPriority",1);Gn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"d":return Il(oc.date,n);case"do":return i.ordinalNumber(n,{unit:"date"});default:return Xl(s.length,n)}}validate(n,s){const i=n.getFullYear(),o=M8e(i),l=n.getMonth();return o?s>=1&&s<=qdt[l]:s>=1&&s<=Udt[l]}set(n,s,i){return n.setDate(i),n.setHours(0,0,0,0),n}}class Hdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"subpriority",1);Gn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,i){switch(s){case"D":case"DD":return Il(oc.dayOfYear,n);case"Do":return i.ordinalNumber(n,{unit:"date"});default:return Xl(s.length,n)}}validate(n,s){const i=n.getFullYear();return M8e(i)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,i){return n.setMonth(0,i),n.setHours(0,0,0,0),n}}function hxe(e,t,n){var y,b,j,N;const s=av(),i=(n==null?void 0:n.weekStartsOn)??((b=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:b.weekStartsOn)??s.weekStartsOn??((N=(j=s.locale)==null?void 0:j.options)==null?void 0:N.weekStartsOn)??0,o=js(e),l=o.getDay(),h=(t%7+7)%7,p=7-i,x=t<0||t>6?t-(l+p)%7:(h+p)%7-(l+p)%7;return Hl(o,x)}class Wdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,i){switch(s){case"E":case"EE":case"EEE":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return i.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=hxe(n,i,o),n.setHours(0,0,0,0),n}}class Gdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,i,o){const l=a=>{const h=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+h};switch(s){case"e":case"ee":return lc(Xl(s.length,n),l);case"eo":return lc(i.ordinalNumber(n,{unit:"day"}),l);case"eee":return i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeeee":return i.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=hxe(n,i,o),n.setHours(0,0,0,0),n}}class Kdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,i,o){const l=a=>{const h=Math.floor((a-1)/7)*7;return(a+o.weekStartsOn+6)%7+h};switch(s){case"c":case"cc":return lc(Xl(s.length,n),l);case"co":return lc(i.ordinalNumber(n,{unit:"day"}),l);case"ccc":return i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"ccccc":return i.day(n,{width:"narrow",context:"standalone"});case"cccccc":return i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return i.day(n,{width:"wide",context:"standalone"})||i.day(n,{width:"abbreviated",context:"standalone"})||i.day(n,{width:"short",context:"standalone"})||i.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,i,o){return n=hxe(n,i,o),n.setHours(0,0,0,0),n}}function Zdt(e,t){const n=js(e),s=_dt(n),i=t-s;return Hl(n,i)}class Ydt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,i){const o=l=>l===0?7:l;switch(s){case"i":case"ii":return Xl(s.length,n);case"io":return i.ordinalNumber(n,{unit:"day"});case"iii":return lc(i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return lc(i.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return lc(i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return lc(i.day(n,{width:"wide",context:"formatting"})||i.day(n,{width:"abbreviated",context:"formatting"})||i.day(n,{width:"short",context:"formatting"})||i.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,i){return n=Zdt(n,i),n.setHours(0,0,0,0),n}}class Xdt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,i){switch(s){case"a":case"aa":case"aaa":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(uxe(i),0,0,0),n}}class Qdt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,i){switch(s){case"b":case"bb":case"bbb":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(uxe(i),0,0,0),n}}class Jdt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,i){switch(s){case"B":case"BB":case"BBB":return i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return i.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(n,{width:"wide",context:"formatting"})||i.dayPeriod(n,{width:"abbreviated",context:"formatting"})||i.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,i){return n.setHours(uxe(i),0,0,0),n}}class eut extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,i){switch(s){case"h":return Il(oc.hour12h,n);case"ho":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,i){const o=n.getHours()>=12;return o&&i<12?n.setHours(i+12,0,0,0):!o&&i===12?n.setHours(0,0,0,0):n.setHours(i,0,0,0),n}}class tut extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,i){switch(s){case"H":return Il(oc.hour23h,n);case"Ho":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,i){return n.setHours(i,0,0,0),n}}class rut extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,i){switch(s){case"K":return Il(oc.hour11h,n);case"Ko":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,i){return n.getHours()>=12&&i<12?n.setHours(i+12,0,0,0):n.setHours(i,0,0,0),n}}class nut extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,i){switch(s){case"k":return Il(oc.hour24h,n);case"ko":return i.ordinalNumber(n,{unit:"hour"});default:return Xl(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,i){const o=i<=24?i%24:i;return n.setHours(o,0,0,0),n}}class sut extends ho{constructor(){super(...arguments);Gn(this,"priority",60);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"m":return Il(oc.minute,n);case"mo":return i.ordinalNumber(n,{unit:"minute"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setMinutes(i,0,0),n}}class iut extends ho{constructor(){super(...arguments);Gn(this,"priority",50);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s,i){switch(s){case"s":return Il(oc.second,n);case"so":return i.ordinalNumber(n,{unit:"second"});default:return Xl(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,i){return n.setSeconds(i,0),n}}class aut extends ho{constructor(){super(...arguments);Gn(this,"priority",30);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s){const i=o=>Math.trunc(o*Math.pow(10,-s.length+3));return lc(Xl(s.length,n),i)}set(n,s,i){return n.setMilliseconds(i),n}}class out extends ho{constructor(){super(...arguments);Gn(this,"priority",10);Gn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return ug(dg.basicOptionalMinutes,n);case"XX":return ug(dg.basic,n);case"XXXX":return ug(dg.basicOptionalSeconds,n);case"XXXXX":return ug(dg.extendedOptionalSeconds,n);case"XXX":default:return ug(dg.extended,n)}}set(n,s,i){return s.timestampIsSet?n:jo(n,n.getTime()-$1(n)-i)}}class lut extends ho{constructor(){super(...arguments);Gn(this,"priority",10);Gn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return ug(dg.basicOptionalMinutes,n);case"xx":return ug(dg.basic,n);case"xxxx":return ug(dg.basicOptionalSeconds,n);case"xxxxx":return ug(dg.extendedOptionalSeconds,n);case"xxx":default:return ug(dg.extended,n)}}set(n,s,i){return s.timestampIsSet?n:jo(n,n.getTime()-$1(n)-i)}}class cut extends ho{constructor(){super(...arguments);Gn(this,"priority",40);Gn(this,"incompatibleTokens","*")}parse(n){return S8e(n)}set(n,s,i){return[jo(n,i*1e3),{timestampIsSet:!0}]}}class dut extends ho{constructor(){super(...arguments);Gn(this,"priority",20);Gn(this,"incompatibleTokens","*")}parse(n){return S8e(n)}set(n,s,i){return[jo(n,i),{timestampIsSet:!0}]}}const uut={G:new Tdt,y:new Adt,Y:new Edt,R:new Idt,u:new Pdt,Q:new Ldt,q:new Odt,M:new Ddt,L:new Rdt,w:new zdt,I:new $dt,d:new Vdt,D:new Hdt,E:new Wdt,e:new Gdt,c:new Kdt,i:new Ydt,a:new Xdt,b:new Qdt,B:new Jdt,h:new eut,H:new tut,K:new rut,k:new nut,m:new sut,s:new iut,S:new aut,X:new out,x:new lut,t:new cut,T:new dut},hut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fut=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,put=/^'([^]*?)'?$/,mut=/''/g,gut=/\S/,xut=/[a-zA-Z]/;function fxe(e,t,n,s){var C,A,E,T;const i=vdt(),o=i.locale??xse,l=i.firstWeekContainsDate??((A=(C=i.locale)==null?void 0:C.options)==null?void 0:A.firstWeekContainsDate)??1,a=i.weekStartsOn??((T=(E=i.locale)==null?void 0:E.options)==null?void 0:T.weekStartsOn)??0;if(t==="")return e===""?js(n):jo(n,NaN);const h={firstWeekContainsDate:l,weekStartsOn:a,locale:o},p=[new Mdt],x=t.match(fut).map(L=>{const z=L[0];if(z in jhe){const F=jhe[z];return F(L,o.formatLong)}return L}).join("").match(hut),y=[];for(let L of x){k8e(L)&&khe(L,t,e),j8e(L)&&khe(L,t,e);const z=L[0],F=uut[z];if(F){const{incompatibleTokens:q}=F;if(Array.isArray(q)){const K=y.find(Z=>q.includes(Z.token)||Z.token===z);if(K)throw new RangeError(`The format string mustn't contain \`${K.fullToken}\` and \`${L}\` at the same time`)}else if(F.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${L}\` and any other token at the same time`);y.push({token:z,fullToken:L});const H=F.run(e,L,o.match,h);if(!H)return jo(n,NaN);p.push(H.setter),e=H.rest}else{if(z.match(xut))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");if(L==="''"?L="'":z==="'"&&(L=yut(L)),e.indexOf(L)===0)e=e.slice(L.length);else return jo(n,NaN)}}if(e.length>0&&gut.test(e))return jo(n,NaN);const b=p.map(L=>L.priority).sort((L,z)=>z-L).filter((L,z,F)=>F.indexOf(L)===z).map(L=>p.filter(z=>z.priority===L).sort((z,F)=>F.subPriority-z.subPriority)).map(L=>L[0]);let j=js(n);if(isNaN(j.getTime()))return jo(n,NaN);const N={};for(const L of b){if(!L.validate(j,h))return jo(n,NaN);const z=L.set(j,N,h);Array.isArray(z)?(j=z[0],Object.assign(N,z[1])):j=z}return jo(n,j)}function yut(e){return e.match(put)[1].replace(mut,"'")}function vut(e){return+js(e)o-l);return n>=s&&n<=i}function Yle(e,t){return Hl(e,-t)}function Xle(e,t){const n=js(e),s=n.getFullYear(),i=n.getDate(),o=jo(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=ydt(o);return n.setMonth(t,Math.min(i,l)),n}function T8e(e,t){const n=js(e);return n.setHours(t),n}function A8e(e,t){const n=js(e);return n.setMinutes(t),n}function uke(e,t){const n=js(e);return isNaN(+n)?jo(e,NaN):(n.setFullYear(t),n)}function but(e,t){return wh(e,-12)}const wut=()=>{const{user:e}=zr(),t=ns(),[n,s]=I.useState([]),[i,o]=I.useState(0),[l,a]=I.useState(!1),[h,p]=I.useState(null);I.useEffect(()=>{if(!e)return;const N=`notification_last_read_${e.id}`;let C=h;if(!C){const T=localStorage.getItem(N);T&&(C=T,p(T))}(async()=>{const{data:T,error:L}=await J.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!L&&T){s(T);const z=C?new Date(C):null,F=T.filter(q=>z?new Date(q.created_at)>z:!0);o(F.length)}})();const E=J.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},T=>{const L=T.new;s(F=>[L,...F].slice(0,20));const z=C?new Date(C):null;(!z||new Date(L.created_at)>z)&&o(F=>F+1),Notification.permission==="granted"&&new Notification(L.title,{body:L.body,icon:"/favicon.ico"})}).subscribe();return()=>{J.removeChannel(E)}},[e,h]);const x=N=>{const C=N.toLowerCase();return C.includes("community")||C.includes("post")?Po:C.includes("academy")||C.includes("video")?Fi:C.includes("template")?hd:C.includes("event")?zs:C.includes("newsletter")?Wx:C.includes("brokerage")?yh:C.includes("swag")||C.includes("social")?Ha:C.includes("toolbox")||C.includes("tool")?Zx:C.includes("brief")?Cs:Po},y=N=>{a(!1),N.url&&N.url!=="/"&&t(N.url)},b=()=>{if(!e)return;const N=new Date().toISOString(),C=`notification_last_read_${e.id}`;localStorage.setItem(C,N),p(N),o(0)},j=N=>{a(N),N&&i>0&&b()};return r.jsxs(Cm,{open:l,onOpenChange:j,children:[r.jsx(Mm,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(_g,{className:"h-5 w-5"}),i>0&&r.jsx(Rt,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:i>9?"9+":i})]})}),r.jsxs(ap,{align:"end",className:"w-80",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[r.jsx("span",{className:"font-semibold",children:"Notifications"}),n.length>0&&r.jsx(ee,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:b,children:"Mark all read"})]}),r.jsx(Jo,{className:"h-[300px]",children:n.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):n.map(N=>{const C=x(N.title);return r.jsxs(mo,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>y(N),children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx(C,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"font-medium text-sm",children:N.title}),r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:N.body}),r.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:tu(new Date(N.created_at),{addSuffix:!0})})]})]},N.id)})})]})]})};var hke=1,jut=.9,kut=.8,Nut=.17,Qle=.1,Jle=.999,Sut=.9999,Cut=.99,Mut=/[\\\/_+.#"@\[\(\{&]/,Tut=/[\\\/_+.#"@\[\(\{&]/g,Aut=/[\s-]/,E8e=/[\s-]/g;function Nhe(e,t,n,s,i,o,l){if(o===t.length)return i===e.length?hke:Cut;var a=`${i},${o}`;if(l[a]!==void 0)return l[a];for(var h=s.charAt(o),p=n.indexOf(h,i),x=0,y,b,j,N;p>=0;)y=Nhe(e,t,n,s,p+1,o+1,l),y>x&&(p===i?y*=hke:Mut.test(e.charAt(p-1))?(y*=kut,j=e.slice(i,p-1).match(Tut),j&&i>0&&(y*=Math.pow(Jle,j.length))):Aut.test(e.charAt(p-1))?(y*=jut,N=e.slice(i,p-1).match(E8e),N&&i>0&&(y*=Math.pow(Jle,N.length))):(y*=Nut,i>0&&(y*=Math.pow(Jle,p-i))),e.charAt(p)!==t.charAt(o)&&(y*=Sut)),(yy&&(y=b*Qle)),y>x&&(x=y),p=n.indexOf(h,p+1);return l[a]=x,x}function fke(e){return e.toLowerCase().replace(E8e," ")}function Eut(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Nhe(e,t,fke(e),fke(t),0,0,{})}var BM='[cmdk-group=""]',ece='[cmdk-group-items=""]',Iut='[cmdk-group-heading=""]',I8e='[cmdk-item=""]',pke=`${I8e}:not([aria-disabled="true"])`,She="cmdk-item-select",v4="data-value",Put=(e,t,n)=>Eut(e,t,n),P8e=I.createContext(void 0),TI=()=>I.useContext(P8e),L8e=I.createContext(void 0),mxe=()=>I.useContext(L8e),O8e=I.createContext(void 0),D8e=I.forwardRef((e,t)=>{let n=_4(()=>{var we,he;return{search:"",value:(he=(we=e.value)!=null?we:e.defaultValue)!=null?he:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=_4(()=>new Set),i=_4(()=>new Map),o=_4(()=>new Map),l=_4(()=>new Set),a=R8e(e),{label:h,children:p,value:x,onValueChange:y,filter:b,shouldFilter:j,loop:N,disablePointerSelection:C=!1,vimBindings:A=!0,...E}=e,T=Vc(),L=Vc(),z=Vc(),F=I.useRef(null),q=Vut();Uj(()=>{if(x!==void 0){let we=x.trim();n.current.value=we,H.emit()}},[x]),Uj(()=>{q(6,ve)},[]);let H=I.useMemo(()=>({subscribe:we=>(l.current.add(we),()=>l.current.delete(we)),snapshot:()=>n.current,setState:(we,he,xe)=>{var be,Oe,Te,Ve;if(!Object.is(n.current[we],he)){if(n.current[we]=he,we==="search")le(),te(),q(1,ae);else if(we==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Fe=document.getElementById(z);Fe?Fe.focus():(be=document.getElementById(T))==null||be.focus()}if(q(7,()=>{var Fe;n.current.selectedItemId=(Fe=ne())==null?void 0:Fe.id,H.emit()}),xe||q(5,ve),((Oe=a.current)==null?void 0:Oe.value)!==void 0){let Fe=he??"";(Ve=(Te=a.current).onValueChange)==null||Ve.call(Te,Fe);return}}H.emit()}},emit:()=>{l.current.forEach(we=>we())}}),[]),K=I.useMemo(()=>({value:(we,he,xe)=>{var be;he!==((be=o.current.get(we))==null?void 0:be.value)&&(o.current.set(we,{value:he,keywords:xe}),n.current.filtered.items.set(we,Z(he,xe)),q(2,()=>{te(),H.emit()}))},item:(we,he)=>(s.current.add(we),he&&(i.current.has(he)?i.current.get(he).add(we):i.current.set(he,new Set([we]))),q(3,()=>{le(),te(),n.current.value||ae(),H.emit()}),()=>{o.current.delete(we),s.current.delete(we),n.current.filtered.items.delete(we);let xe=ne();q(4,()=>{le(),(xe==null?void 0:xe.getAttribute("id"))===we&&ae(),H.emit()})}),group:we=>(i.current.has(we)||i.current.set(we,new Set),()=>{o.current.delete(we),i.current.delete(we)}),filter:()=>a.current.shouldFilter,label:h||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:T,inputId:z,labelId:L,listInnerRef:F}),[]);function Z(we,he){var xe,be;let Oe=(be=(xe=a.current)==null?void 0:xe.filter)!=null?be:Put;return we?Oe(we,n.current.search,he):0}function te(){if(!n.current.search||a.current.shouldFilter===!1)return;let we=n.current.filtered.items,he=[];n.current.filtered.groups.forEach(be=>{let Oe=i.current.get(be),Te=0;Oe.forEach(Ve=>{let Fe=we.get(Ve);Te=Math.max(Fe,Te)}),he.push([be,Te])});let xe=F.current;ge().sort((be,Oe)=>{var Te,Ve;let Fe=be.getAttribute("id"),Me=Oe.getAttribute("id");return((Te=we.get(Me))!=null?Te:0)-((Ve=we.get(Fe))!=null?Ve:0)}).forEach(be=>{let Oe=be.closest(ece);Oe?Oe.appendChild(be.parentElement===Oe?be:be.closest(`${ece} > *`)):xe.appendChild(be.parentElement===xe?be:be.closest(`${ece} > *`))}),he.sort((be,Oe)=>Oe[1]-be[1]).forEach(be=>{var Oe;let Te=(Oe=F.current)==null?void 0:Oe.querySelector(`${BM}[${v4}="${encodeURIComponent(be[0])}"]`);Te==null||Te.parentElement.appendChild(Te)})}function ae(){let we=ge().find(xe=>xe.getAttribute("aria-disabled")!=="true"),he=we==null?void 0:we.getAttribute(v4);H.setState("value",he||void 0)}function le(){var we,he,xe,be;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Oe=0;for(let Te of s.current){let Ve=(he=(we=o.current.get(Te))==null?void 0:we.value)!=null?he:"",Fe=(be=(xe=o.current.get(Te))==null?void 0:xe.keywords)!=null?be:[],Me=Z(Ve,Fe);n.current.filtered.items.set(Te,Me),Me>0&&Oe++}for(let[Te,Ve]of i.current)for(let Fe of Ve)if(n.current.filtered.items.get(Fe)>0){n.current.filtered.groups.add(Te);break}n.current.filtered.count=Oe}function ve(){var we,he,xe;let be=ne();be&&(((we=be.parentElement)==null?void 0:we.firstChild)===be&&((xe=(he=be.closest(BM))==null?void 0:he.querySelector(Iut))==null||xe.scrollIntoView({block:"nearest"})),be.scrollIntoView({block:"nearest"}))}function ne(){var we;return(we=F.current)==null?void 0:we.querySelector(`${I8e}[aria-selected="true"]`)}function ge(){var we;return Array.from(((we=F.current)==null?void 0:we.querySelectorAll(pke))||[])}function ie(we){let he=ge()[we];he&&H.setState("value",he.getAttribute(v4))}function fe(we){var he;let xe=ne(),be=ge(),Oe=be.findIndex(Ve=>Ve===xe),Te=be[Oe+we];(he=a.current)!=null&&he.loop&&(Te=Oe+we<0?be[be.length-1]:Oe+we===be.length?be[0]:be[Oe+we]),Te&&H.setState("value",Te.getAttribute(v4))}function de(we){let he=ne(),xe=he==null?void 0:he.closest(BM),be;for(;xe&&!be;)xe=we>0?Uut(xe,BM):qut(xe,BM),be=xe==null?void 0:xe.querySelector(pke);be?H.setState("value",be.getAttribute(v4)):fe(we)}let ye=()=>ie(ge().length-1),Ie=we=>{we.preventDefault(),we.metaKey?ye():we.altKey?de(1):fe(1)},Ne=we=>{we.preventDefault(),we.metaKey?ie(0):we.altKey?de(-1):fe(-1)};return I.createElement(Rn.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:we=>{var he;(he=E.onKeyDown)==null||he.call(E,we);let xe=we.nativeEvent.isComposing||we.keyCode===229;if(!(we.defaultPrevented||xe))switch(we.key){case"n":case"j":{A&&we.ctrlKey&&Ie(we);break}case"ArrowDown":{Ie(we);break}case"p":case"k":{A&&we.ctrlKey&&Ne(we);break}case"ArrowUp":{Ne(we);break}case"Home":{we.preventDefault(),ie(0);break}case"End":{we.preventDefault(),ye();break}case"Enter":{we.preventDefault();let be=ne();if(be){let Oe=new Event(She);be.dispatchEvent(Oe)}}}}},I.createElement("label",{"cmdk-label":"",htmlFor:K.inputId,id:K.labelId,style:Wut},h),vse(e,we=>I.createElement(L8e.Provider,{value:H},I.createElement(P8e.Provider,{value:K},we))))}),Lut=I.forwardRef((e,t)=>{var n,s;let i=Vc(),o=I.useRef(null),l=I.useContext(O8e),a=TI(),h=R8e(e),p=(s=(n=h.current)==null?void 0:n.forceMount)!=null?s:l==null?void 0:l.forceMount;Uj(()=>{if(!p)return a.item(i,l==null?void 0:l.id)},[p]);let x=F8e(i,o,[e.value,e.children,o],e.keywords),y=mxe(),b=U1(q=>q.value&&q.value===x.current),j=U1(q=>p||a.filter()===!1?!0:q.search?q.filtered.items.get(i)>0:!0);I.useEffect(()=>{let q=o.current;if(!(!q||e.disabled))return q.addEventListener(She,N),()=>q.removeEventListener(She,N)},[j,e.onSelect,e.disabled]);function N(){var q,H;C(),(H=(q=h.current).onSelect)==null||H.call(q,x.current)}function C(){y.setState("value",x.current,!0)}if(!j)return null;let{disabled:A,value:E,onSelect:T,forceMount:L,keywords:z,...F}=e;return I.createElement(Rn.div,{ref:iy(o,t),...F,id:i,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!b,"data-disabled":!!A,"data-selected":!!b,onPointerMove:A||a.getDisablePointerSelection()?void 0:C,onClick:A?void 0:N},e.children)}),Out=I.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:i,...o}=e,l=Vc(),a=I.useRef(null),h=I.useRef(null),p=Vc(),x=TI(),y=U1(j=>i||x.filter()===!1?!0:j.search?j.filtered.groups.has(l):!0);Uj(()=>x.group(l),[]),F8e(l,a,[e.value,e.heading,h]);let b=I.useMemo(()=>({id:l,forceMount:i}),[i]);return I.createElement(Rn.div,{ref:iy(a,t),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&I.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:p},n),vse(e,j=>I.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?p:void 0},I.createElement(O8e.Provider,{value:b},j))))}),Dut=I.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,i=I.useRef(null),o=U1(l=>!l.search);return!n&&!o?null:I.createElement(Rn.div,{ref:iy(i,t),...s,"cmdk-separator":"",role:"separator"})}),Rut=I.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,i=e.value!=null,o=mxe(),l=U1(p=>p.search),a=U1(p=>p.selectedItemId),h=TI();return I.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),I.createElement(Rn.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":a,id:h.inputId,type:"text",value:i?e.value:l,onChange:p=>{i||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),Fut=I.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...i}=e,o=I.useRef(null),l=I.useRef(null),a=U1(p=>p.selectedItemId),h=TI();return I.useEffect(()=>{if(l.current&&o.current){let p=l.current,x=o.current,y,b=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let j=p.offsetHeight;x.style.setProperty("--cmdk-list-height",j.toFixed(1)+"px")})});return b.observe(p),()=>{cancelAnimationFrame(y),b.unobserve(p)}}},[]),I.createElement(Rn.div,{ref:iy(o,t),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":s,id:h.listId},vse(e,p=>I.createElement("div",{ref:iy(l,h.listInnerRef),"cmdk-list-sizer":""},p)))}),zut=I.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:i,contentClassName:o,container:l,...a}=e;return I.createElement(Hne,{open:n,onOpenChange:s},I.createElement(Wne,{container:l},I.createElement(l3,{"cmdk-overlay":"",className:i}),I.createElement(c3,{"aria-label":e.label,"cmdk-dialog":"",className:o},I.createElement(D8e,{ref:t,...a}))))}),But=I.forwardRef((e,t)=>U1(n=>n.filtered.count===0)?I.createElement(Rn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),$ut=I.forwardRef((e,t)=>{let{progress:n,children:s,label:i="Loading...",...o}=e;return I.createElement(Rn.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},vse(e,l=>I.createElement("div",{"aria-hidden":!0},l)))}),jh=Object.assign(D8e,{List:Fut,Item:Lut,Input:Rut,Group:Out,Separator:Dut,Dialog:zut,Empty:But,Loading:$ut});function Uut(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function qut(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function R8e(e){let t=I.useRef(e);return Uj(()=>{t.current=e}),t}var Uj=typeof window>"u"?I.useEffect:I.useLayoutEffect;function _4(e){let t=I.useRef();return t.current===void 0&&(t.current=e()),t}function U1(e){let t=mxe(),n=()=>e(t.snapshot());return I.useSyncExternalStore(t.subscribe,n,n)}function F8e(e,t,n,s=[]){let i=I.useRef(),o=TI();return Uj(()=>{var l;let a=(()=>{var p;for(let x of n){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(p=x.current.textContent)==null?void 0:p.trim():i.current}})(),h=s.map(p=>p.trim());o.value(e,a,h),(l=t.current)==null||l.setAttribute(v4,a),i.current=a}),i}var Vut=()=>{let[e,t]=I.useState(),n=_4(()=>new Map);return Uj(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,i)=>{n.current.set(s,i),t({})}};function Hut(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function vse({asChild:e,children:t},n){return e&&I.isValidElement(t)?I.cloneElement(Hut(t),{ref:t.ref},n(t.props.children)):n(t)}var Wut={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const q1=I.forwardRef(({className:e,...t},n)=>r.jsx(jh,{ref:n,className:$t("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));q1.displayName=jh.displayName;const Gut=({children:e,...t})=>r.jsx(Br,{...t,children:r.jsx(Fr,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(q1,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),V1=I.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(_i,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(jh.Input,{ref:n,className:$t("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));V1.displayName=jh.Input.displayName;const H1=I.forwardRef(({className:e,...t},n)=>r.jsx(jh.List,{ref:n,className:$t("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));H1.displayName=jh.List.displayName;const W1=I.forwardRef((e,t)=>r.jsx(jh.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));W1.displayName=jh.Empty.displayName;const G1=I.forwardRef(({className:e,...t},n)=>r.jsx(jh.Group,{ref:n,className:$t("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));G1.displayName=jh.Group.displayName;const Kut=I.forwardRef(({className:e,...t},n)=>r.jsx(jh.Separator,{ref:n,className:$t("-mx-1 h-px bg-border",e),...t}));Kut.displayName=jh.Separator.displayName;const K1=I.forwardRef(({className:e,...t},n)=>r.jsx(jh.Item,{ref:n,className:$t("group relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-primary/80 data-[selected=true]:text-primary-foreground data-[disabled=true]:opacity-50",e),...t}));K1.displayName=jh.Item.displayName;const Zut={event:{label:"Events",icon:hm,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:hd,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:f1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:Zx,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Cs,color:"bg-fuchsia-500/10 text-fuchsia-600"}},mke=()=>{const[e,t]=I.useState(!1),[n,s]=I.useState(""),[i,o]=I.useState([]),[l,a]=I.useState(!1),h=ns();I.useEffect(()=>{const b=j=>{j.key==="k"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),t(N=>!N))};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[]);const p=I.useCallback(async b=>{if(!b.trim()){o([]);return}a(!0);const j=`%${b}%`;try{const[N,C,A,E,T]=await Promise.all([J.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),J.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${j},description.ilike.${j}`).limit(5),J.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),J.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${j},description.ilike.${j}`).limit(5),J.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5)]),L=[];N.data&&N.data.forEach(z=>{L.push({id:z.id,title:z.title,description:z.description,type:"event",date:z.event_date,path:`/event/${z.id}`})}),C.data&&C.data.forEach(z=>{L.push({id:z.id,title:z.name,description:z.description,type:"template",date:z.publish_date,path:`/templates/${z.id}`})}),A.data&&A.data.forEach(z=>{L.push({id:z.id,title:z.title,description:z.description,type:"academy",date:z.publish_date,path:`/academy/${z.id}`})}),E.data&&E.data.forEach(z=>{L.push({id:z.id,title:z.name,description:z.description,type:"toolbox",date:z.publish_date,path:`/toolbox/${z.id}`})}),T.data&&T.data.forEach(z=>{L.push({id:z.id,title:z.title,description:z.description,type:"social-swag",date:z.publish_date,path:`/social-swag/${z.id}`})}),o(L)}catch(N){console.error("Search error:",N)}finally{a(!1)}},[]);I.useEffect(()=>{const b=setTimeout(()=>{p(n)},300);return()=>clearTimeout(b)},[n,p]);const x=b=>{t(!1),s(""),h(b)},y=i.reduce((b,j)=>(b[j.type]||(b[j.type]=[]),b[j.type].push(j),b),{});return r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-9 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>t(!0),children:[r.jsx(_i,{className:"h-4 w-4 xl:mr-2"}),r.jsx("span",{className:"hidden xl:inline-flex text-muted-foreground text-sm",children:"Search..."}),r.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-1.5 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsxs(Gut,{open:e,onOpenChange:t,children:[r.jsx(V1,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(H1,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&i.length===0&&r.jsxs(W1,{children:['No results found for "',n,'"']}),!l&&!n&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search across all content..."}),Object.entries(y).map(([b,j])=>{const N=Zut[b],C=N.icon;return r.jsx(G1,{heading:N.label,children:j.map(A=>r.jsxs(K1,{value:`${A.type}-${A.id}-${A.title}`,onSelect:()=>x(A.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[r.jsx("div",{className:`p-2 rounded-md ${N.color}`,children:r.jsx(C,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:A.title}),A.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:A.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Rt,{variant:"secondary",className:"text-xs",children:N.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:tu(new Date(A.date),{addSuffix:!0})})]})]},`${A.type}-${A.id}`))},b)})]})]})]})},Yut=({expiresAt:e,className:t,showUpgradeButton:n=!0})=>{const[s,i]=I.useState(null),o=ns();if(I.useEffect(()=>{const p=()=>{const y=new Date().getTime(),j=new Date(e).getTime()-y;if(j<=0){i({days:0,hours:0,minutes:0});return}const N=Math.floor(j/(1e3*60*60*24)),C=Math.floor(j%(1e3*60*60*24)/(1e3*60*60)),A=Math.floor(j%(1e3*60*60)/(1e3*60));i({days:N,hours:C,minutes:A})};p();const x=setInterval(p,6e4);return()=>clearInterval(x)},[e]),!s)return null;const l=s.days===0&&s.hours===0&&s.minutes===0,a=s.days<=1,h=s.days<=3&&!a;return l?r.jsxs("div",{className:$t("flex items-center justify-between gap-3 px-4 py-2 rounded-lg bg-destructive/10 border border-destructive/20",t),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bh,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),n&&r.jsxs(ee,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Cs,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):r.jsxs("div",{className:$t("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",a?"bg-destructive/10 border-destructive/20":h?"bg-amber-500/10 border-amber-500/20":"bg-primary/10 border-primary/20",t),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ki,{className:$t("h-4 w-4",a?"text-destructive":h?"text-amber-500":"text-primary")}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:$t("text-sm font-medium",a?"text-destructive":h?"text-amber-600":"text-primary"),children:"Free Trial:"}),r.jsxs("div",{className:"flex items-center gap-1",children:[s.days>0&&r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:$t("text-sm font-bold",a?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:$t("text-xs",a?"text-destructive/70":h?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(ee,{size:"sm",onClick:()=>o("/subscription"),variant:a?"destructive":h?"default":"outline",className:$t("text-xs h-7 px-3",h&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(Cs,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Xut=()=>{const e=ns();return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:r.jsxs(Ge,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-destructive/10 flex items-center justify-center",children:r.jsx(Bh,{className:"h-8 w-8 text-destructive"})}),r.jsx(Qt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(En,{className:"text-base",children:"Your 7-day free trial has expired. Upgrade now to continue accessing all the powerful tools and resources LevelUp has to offer!"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(Ge,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(Xe,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Vn,{className:"h-6 w-6 text-primary"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Individual Agent"}),r.jsxs("p",{className:"text-2xl font-bold text-primary mb-2",children:["$39",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Perfect for solo agents ready to level up"}),r.jsxs(ee,{className:"w-full",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(Cs,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(Ge,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(Xe,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-6 w-6 text-amber-600"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Brokerage"}),r.jsxs("p",{className:"text-2xl font-bold text-amber-600 mb-2",children:["$299",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"For teams and brokerages"}),r.jsxs(ee,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(na,{className:"h-4 w-4 mr-2"}),"Choose Brokerage"]})]})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"With a full membership, you'll get:"}),r.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground grid sm:grid-cols-2 gap-x-4",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Unlimited access to all marketing templates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Complete Academy training library"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," AI-powered tools and resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Community forums and support"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Exclusive member events and workshops"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Deal pipeline & scorecard tracking"]})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[r.jsx("p",{className:"text-sm font-medium text-center",children:"Questions? Contact us:"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Ys,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Qut=({hasUnseenBrief:e,onClick:t,className:n})=>r.jsxs(Cg,{children:[r.jsx(Mg,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",onClick:t,className:$t("relative transition-colors",e&&"text-primary hover:text-primary",n),children:[r.jsx(gm,{className:"h-5 w-5"}),e&&r.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-primary animate-pulse"})]})}),r.jsx(vm,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var _se="Checkbox",[Jut]=Ql(_se),[eht,gxe]=Jut(_se);function tht(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:i,disabled:o,form:l,name:a,onCheckedChange:h,required:p,value:x="on",internal_do_not_use_render:y}=e,[b,j]=Ou({prop:n,defaultProp:i??!1,onChange:h,caller:_se}),[N,C]=I.useState(null),[A,E]=I.useState(null),T=I.useRef(!1),L=N?!!l||!!N.closest("form"):!0,z={checked:b,disabled:o,setChecked:j,control:N,setControl:C,name:a,form:l,value:x,hasConsumerStoppedPropagationRef:T,required:p,defaultChecked:S1(i)?!1:i,isFormControl:L,bubbleInput:A,setBubbleInput:E};return r.jsx(eht,{scope:t,...z,children:rht(y)?y(z):s})}var z8e="CheckboxTrigger",B8e=I.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},i)=>{const{control:o,value:l,disabled:a,checked:h,required:p,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:b,isFormControl:j,bubbleInput:N}=gxe(z8e,e),C=ei(i,x),A=I.useRef(h);return I.useEffect(()=>{const E=o==null?void 0:o.form;if(E){const T=()=>y(A.current);return E.addEventListener("reset",T),()=>E.removeEventListener("reset",T)}},[o,y]),r.jsx(Rn.button,{type:"button",role:"checkbox","aria-checked":S1(h)?"mixed":h,"aria-required":p,"data-state":H8e(h),"data-disabled":a?"":void 0,disabled:a,value:l,...s,ref:C,onKeyDown:cn(t,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:cn(n,E=>{y(T=>S1(T)?!0:!T),N&&j&&(b.current=E.isPropagationStopped(),b.current||E.stopPropagation())})})});B8e.displayName=z8e;var xxe=I.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:i,defaultChecked:o,required:l,disabled:a,value:h,onCheckedChange:p,form:x,...y}=e;return r.jsx(tht,{__scopeCheckbox:n,checked:i,defaultChecked:o,disabled:a,required:l,onCheckedChange:p,name:s,form:x,value:h,internal_do_not_use_render:({isFormControl:b})=>r.jsxs(r.Fragment,{children:[r.jsx(B8e,{...y,ref:t,__scopeCheckbox:n}),b&&r.jsx(V8e,{__scopeCheckbox:n})]})})});xxe.displayName=_se;var $8e="CheckboxIndicator",U8e=I.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...i}=e,o=gxe($8e,n);return r.jsx(pc,{present:s||S1(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{"data-state":H8e(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});U8e.displayName=$8e;var q8e="CheckboxBubbleInput",V8e=I.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:l,required:a,disabled:h,name:p,value:x,form:y,bubbleInput:b,setBubbleInput:j}=gxe(q8e,e),N=ei(n,j),C=jI(o),A=fI(s);I.useEffect(()=>{const T=b;if(!T)return;const L=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(L,"checked").set,q=!i.current;if(C!==o&&F){const H=new Event("click",{bubbles:q});T.indeterminate=S1(o),F.call(T,S1(o)?!1:o),T.dispatchEvent(H)}},[b,C,o,i]);const E=I.useRef(S1(o)?!1:o);return r.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??E.current,required:a,disabled:h,name:p,value:x,form:y,...t,tabIndex:-1,ref:N,style:{...t.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});V8e.displayName=q8e;function rht(e){return typeof e=="function"}function S1(e){return e==="indeterminate"}function H8e(e){return S1(e)?"indeterminate":e?"checked":"unchecked"}const cc=I.forwardRef(({className:e,...t},n)=>r.jsx(xxe,{ref:n,className:$t("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-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",e),...t,children:r.jsx(U8e,{className:$t("flex items-center justify-center text-current"),children:r.jsx(Ca,{className:"h-4 w-4"})})}));cc.displayName=xxe.displayName;var yxe="Radio",[nht,W8e]=Ql(yxe),[sht,iht]=nht(yxe),G8e=I.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:i=!1,required:o,disabled:l,value:a="on",onCheck:h,form:p,...x}=e,[y,b]=I.useState(null),j=ei(t,A=>b(A)),N=I.useRef(!1),C=y?p||!!y.closest("form"):!0;return r.jsxs(sht,{scope:n,checked:i,disabled:l,children:[r.jsx(Rn.button,{type:"button",role:"radio","aria-checked":i,"data-state":X8e(i),"data-disabled":l?"":void 0,disabled:l,value:a,...x,ref:j,onClick:cn(e.onClick,A=>{i||h==null||h(),C&&(N.current=A.isPropagationStopped(),N.current||A.stopPropagation())})}),C&&r.jsx(Y8e,{control:y,bubbles:!N.current,name:s,value:a,checked:i,required:o,disabled:l,form:p,style:{transform:"translateX(-100%)"}})]})});G8e.displayName=yxe;var K8e="RadioIndicator",Z8e=I.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...i}=e,o=iht(K8e,n);return r.jsx(pc,{present:s||o.checked,children:r.jsx(Rn.span,{"data-state":X8e(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t})})});Z8e.displayName=K8e;var aht="RadioBubbleInput",Y8e=I.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:s=!0,...i},o)=>{const l=I.useRef(null),a=ei(l,o),h=jI(n),p=fI(t);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const N=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(N)}},[h,n,s]),r.jsx(Rn.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Y8e.displayName=aht;function X8e(e){return e?"checked":"unchecked"}var oht=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],bse="RadioGroup",[lht]=Ql(bse,[h3,W8e]),Q8e=h3(),J8e=W8e(),[cht,dht]=lht(bse),eOe=I.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,defaultValue:i,value:o,required:l=!1,disabled:a=!1,orientation:h,dir:p,loop:x=!0,onValueChange:y,...b}=e,j=Q8e(n),N=sk(p),[C,A]=Ou({prop:o,defaultProp:i??null,onChange:y,caller:bse});return r.jsx(cht,{scope:n,name:s,required:l,disabled:a,value:C,onValueChange:A,children:r.jsx(Bge,{asChild:!0,...j,orientation:h,dir:N,loop:x,children:r.jsx(Rn.div,{role:"radiogroup","aria-required":l,"aria-orientation":h,"data-disabled":a?"":void 0,dir:N,...b,ref:t})})})});eOe.displayName=bse;var tOe="RadioGroupItem",rOe=I.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:s,...i}=e,o=dht(tOe,n),l=o.disabled||s,a=Q8e(n),h=J8e(n),p=I.useRef(null),x=ei(t,p),y=o.value===i.value,b=I.useRef(!1);return I.useEffect(()=>{const j=C=>{oht.includes(C.key)&&(b.current=!0)},N=()=>b.current=!1;return document.addEventListener("keydown",j),document.addEventListener("keyup",N),()=>{document.removeEventListener("keydown",j),document.removeEventListener("keyup",N)}},[]),r.jsx($ge,{asChild:!0,...a,focusable:!l,active:y,children:r.jsx(G8e,{disabled:l,required:o.required,checked:y,...h,...i,name:o.name,ref:x,onCheck:()=>o.onValueChange(i.value),onKeyDown:cn(j=>{j.key==="Enter"&&j.preventDefault()}),onFocus:cn(i.onFocus,()=>{var j;b.current&&((j=p.current)==null||j.click())})})})});rOe.displayName=tOe;var uht="RadioGroupIndicator",nOe=I.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,i=J8e(n);return r.jsx(Z8e,{...i,...s,ref:t})});nOe.displayName=uht;var sOe=eOe,iOe=rOe,hht=nOe;const aOe=I.forwardRef(({className:e,...t},n)=>r.jsx(sOe,{className:$t("grid gap-2",e),...t,ref:n}));aOe.displayName=sOe.displayName;const oOe=I.forwardRef(({className:e,...t},n)=>r.jsx(iOe,{ref:n,className:$t("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:r.jsx(hht,{className:"flex items-center justify-center",children:r.jsx(Lu,{className:"h-2.5 w-2.5 fill-current text-current"})})}));oOe.displayName=iOe.displayName;const fht=({brief:e,open:t,onClose:n,onDismiss:s})=>{const{user:i}=zr(),[o,l]=I.useState({}),[a,h]=I.useState({}),[p,x]=I.useState([]);I.useEffect(()=>{t&&i&&e.polls.length>0&&y()},[t,i,e.polls]);const y=async()=>{if(!i)return;const A=e.polls.map(T=>T.id),{data:E}=await J.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",i.id).in("poll_id",A);if(E){const T={};E.forEach(L=>{T[L.poll_id]||(T[L.poll_id]=[]),T[L.poll_id].push(L.option_id)}),h(T)}},b=(A,E)=>{l(T=>({...T,[A]:E}))},j=(A,E,T)=>{l(L=>{const z=L[A]||[];return T?{...L,[A]:[...z,E]}:{...L,[A]:z.filter(F=>F!==E)}})},N=async A=>{if(!i)return;const E=o[A];if(!E||Array.isArray(E)&&E.length===0){ze.error("Please select an option");return}x(T=>[...T,A]);try{await J.from("levelup_brief_poll_responses").delete().eq("poll_id",A).eq("user_id",i.id);const T=Array.isArray(E)?E:[E],L=T.map(F=>({poll_id:A,option_id:F,user_id:i.id})),{error:z}=await J.from("levelup_brief_poll_responses").insert(L);if(z)throw z;h(F=>({...F,[A]:T})),ze.success("Response submitted!")}catch(T){console.error("Error submitting poll response:",T),ze.error("Failed to submit response")}finally{x(T=>T.filter(L=>L!==A))}},C=A=>(A.includes("mediadelivery.net")||A.includes("bunny"),A);return r.jsx(Br,{open:t,onOpenChange:A=>!A&&n(),children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] p-0 overflow-hidden [&>button]:hidden",children:[r.jsxs("div",{className:"bg-gradient-to-r from-primary to-primary/80 p-4 pr-12 text-primary-foreground relative",children:[r.jsx("button",{onClick:n,className:"absolute top-3 right-3 p-1.5 rounded-full bg-white/30 hover:bg-white/50 transition-colors","aria-label":"Close",children:r.jsx(bs,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-white/20 rounded-lg",children:r.jsx(gm,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Rt,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(qr,{className:"text-xl font-bold text-white",children:e.brief.title})]})]})]}),r.jsx(Jo,{className:"max-h-[calc(90vh-240px)]",children:r.jsxs("div",{className:"p-6 space-y-6",children:[e.brief.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:e.brief.description}}),e.brief.video_url&&r.jsx("div",{className:"relative w-full aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:C(e.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),e.brief.graphic_url&&!e.brief.video_url&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted",children:e.brief.graphic_link_url?r.jsx("a",{href:e.brief.graphic_link_url,target:"_blank",rel:"noopener noreferrer",className:"block",children:r.jsx("img",{src:e.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain cursor-pointer hover:opacity-90 transition-opacity"})}):r.jsx("img",{src:e.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain"})}),e.links.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:"Quick Links"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.links.map(A=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>window.open(A.url,"_blank"),className:"gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),A.title]},A.id))})]}),e.polls.map(A=>{var L,z;const E=((L=a[A.id])==null?void 0:L.length)>0,T=p.includes(A.id);return r.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:A.question}),E&&r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),"Responded"]})]}),A.poll_type==="single"?r.jsx(aOe,{value:o[A.id]||((z=a[A.id])==null?void 0:z[0])||"",onValueChange:F=>b(A.id,F),className:"space-y-2",children:A.options.map(F=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(oOe,{value:F.id,id:F.id}),r.jsx(Ue,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id))}):r.jsx("div",{className:"space-y-2",children:A.options.map(F=>{const H=(o[A.id]||a[A.id]||[]).includes(F.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(cc,{id:F.id,checked:H,onCheckedChange:K=>j(A.id,F.id,K)}),r.jsx(Ue,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id)})}),r.jsx(ee,{size:"sm",onClick:()=>N(A.id),disabled:T,children:T?"Submitting...":E?"Update Response":"Submit"})]},A.id)})]})}),r.jsxs("div",{className:"p-4 pb-[calc(1rem+env(safe-area-inset-bottom))] border-t bg-muted/30 flex flex-col items-center gap-2 sticky bottom-0 z-10",children:[r.jsx(ee,{onClick:n,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"})]})]})})},pht=()=>{const{user:e}=zr(),[t,n]=I.useState(null),[s,i]=I.useState(!1),[o,l]=I.useState(!0),[a,h]=I.useState(!1),p=I.useCallback(async()=>{if(!e){l(!1);return}try{const{data:N,error:C}=await J.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(C||!N){l(!1);return}const{data:A}=await J.from("levelup_brief_views").select("*").eq("brief_id",N.id).eq("user_id",e.id).maybeSingle(),[E,T]=await Promise.all([J.from("levelup_brief_links").select("*").eq("brief_id",N.id).order("sort_order"),J.from("levelup_brief_polls").select("*").eq("brief_id",N.id).order("sort_order")]),L=[];if(T.data)for(const H of T.data){const{data:K}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",H.id).order("sort_order");L.push({...H,options:K||[]})}const z={brief:N,links:E.data||[],polls:L};n(z);const F=!!A,q=(A==null?void 0:A.dismissed_at)!==null;if(!F)i(!0),h(!0);else if(N.show_frequency==="every_login"&&!q)i(!0),h(!0);else if(N.show_frequency==="daily"){const H=new Date(A.viewed_at);(new Date().getTime()-H.getTime())/(1e3*60*60)>=24&&!q&&(i(!0),h(!0))}else h(!q)}catch(N){console.error("Error fetching brief:",N)}finally{l(!1)}},[e]);I.useEffect(()=>{p()},[p]);const x=async()=>{if(!(!e||!t))try{const{data:N}=await J.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();N?await J.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",N.id):await J.from("levelup_brief_views").insert({brief_id:t.brief.id,user_id:e.id})}catch(N){console.error("Error marking brief as viewed:",N)}};return{currentBrief:t,shouldShowPopup:s,hasUnseenBrief:a,loading:o,openBrief:()=>{i(!0)},closeBrief:()=>{i(!1),x()},dismissBrief:async()=>{if(!(!e||!t))try{const{data:N}=await J.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();N?await J.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",N.id):await J.from("levelup_brief_views").insert({brief_id:t.brief.id,user_id:e.id,dismissed_at:new Date().toISOString()}),i(!1),h(!1)}catch(N){console.error("Error dismissing brief:",N)}},refetch:p}};function mht(){const[e,t]=I.useState(!1),[n,s]=I.useState(!1),[i,o]=I.useState(null);I.useEffect(()=>{if(localStorage.getItem("install-banner-dismissed")||window.matchMedia("(display-mode: standalone)").matches||!/iPhone|iPad|iPod|Android/i.test(navigator.userAgent))return;const y=/iPhone|iPad|iPod/i.test(navigator.userAgent);s(y),t(!0);const b=j=>{j.preventDefault(),o(j)};return window.addEventListener("beforeinstallprompt",b),()=>{window.removeEventListener("beforeinstallprompt",b)}},[]);const l=()=>{localStorage.setItem("install-banner-dismissed","true"),t(!1)},a=async()=>{if(i){await i.prompt();const{outcome:h}=await i.userChoice;h==="accepted"&&l(),o(null)}};return e?r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 p-4 bg-primary text-primary-foreground shadow-lg animate-in slide-in-from-bottom duration-300",children:r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"flex-shrink-0 p-2 bg-primary-foreground/10 rounded-full",children:r.jsx(Va,{className:"h-5 w-5"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Add LevelUp to your home screen"}),n?r.jsxs("p",{className:"text-xs opacity-80 flex items-center gap-1",children:["Tap ",r.jsx(KT,{className:"h-3 w-3 inline"}),' then "Add to Home Screen"']}):r.jsx("p",{className:"text-xs opacity-80",children:"Quick access anytime"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!n&&i&&r.jsx(ee,{size:"sm",variant:"secondary",onClick:a,className:"text-xs",children:"Install"}),r.jsx("button",{onClick:l,className:"p-1.5 hover:bg-primary-foreground/10 rounded-full transition-colors","aria-label":"Dismiss",children:r.jsx(bs,{className:"h-4 w-4"})})]})]})}):null}const ght=({children:e,onRefresh:t})=>{const[n,s]=I.useState(!1),[i,o]=I.useState(0),[l,a]=I.useState(!1),h=I.useRef(null),p=I.useRef(0),x=Wr(),y=80,b=120,j=I.useCallback(T=>{const L=h.current;L&&L.scrollTop<=0&&(p.current=T.touches[0].clientY,s(!0))},[]),N=I.useCallback(T=>{if(!n||l)return;const L=h.current;if(!L||L.scrollTop>0){s(!1),o(0);return}const F=T.touches[0].clientY-p.current;if(F>0){const H=Math.min(F*.5,b);o(H),H>10&&T.preventDefault()}},[n,l]),C=I.useCallback(async()=>{if(n)if(s(!1),i>=y&&!l){a(!0),o(y);try{t?await t():await x.invalidateQueries()}catch(T){console.error("Refresh failed:",T)}finally{a(!1),o(0)}}else o(0)},[n,i,l,t,x]),A=Math.min(i/y,1),E=A*180;return r.jsxs("div",{ref:h,className:"h-full overflow-auto",onTouchStart:j,onTouchMove:N,onTouchEnd:C,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:i>0?i:0,opacity:A},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${l?"animate-spin":""}`,style:{transform:l?void 0:`rotate(${E}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:r.jsx(Vl,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:i>0?`translateY(${Math.max(0,i-60)}px)`:void 0,transition:n?void 0:"transform 0.2s ease-out"},children:e})]})},lOe=()=>{const{user:e}=zr(),[t,n]=I.useState(!1),[s,i]=I.useState(!1),[o,l]=I.useState(0),[a,h]=I.useState(!0);I.useEffect(()=>{(async()=>{if(!e){h(!1);return}try{const{data:j}=await J.from("membership_reviews").select("id").eq("user_id",e.id).maybeSingle();if(j){i(!0),n(!1),h(!1);return}const{data:N}=await J.from("profiles").select("login_count").eq("id",e.id).single(),C=(N==null?void 0:N.login_count)||0;l(C);const A=sessionStorage.getItem("review-prompt-dismissed");n(C>=4&&!A)}catch(j){console.error("Error checking review eligibility:",j)}finally{h(!1)}})()},[e]);const p=I.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=I.useCallback(async(b,j)=>{if(!e)return{success:!1,error:"Not authenticated"};try{const{error:N}=await J.from("membership_reviews").insert({user_id:e.id,rating:b,review_text:j});if(N)throw N;const{data:C,error:A}=await J.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",e.id).maybeSingle();A&&console.error("Error fetching current stats:",A);const E=(C==null?void 0:C.spendable_points)||0,T=(C==null?void 0:C.total_points)||0,L=E+25,z=T+25,{error:F}=await J.from("agent_attendance_stats").upsert({user_id:e.id,total_points:z,spendable_points:L,updated_at:new Date().toISOString()},{onConflict:"user_id"});F&&console.error("Error upserting attendance stats:",F);const{error:q}=await J.from("agent_points").insert({user_id:e.id,points:25,reason:"Left a membership review"});return q&&console.error("Error logging points:",q),i(!0),n(!1),{success:!0,pointsAwarded:25}}catch(N){return console.error("Error submitting review:",N),{success:!1,error:N.message}}},[e]),y=I.useCallback(async()=>{if(e)try{await J.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",e.id)}catch(b){console.error("Error updating Google review status:",b)}},[e]);return{shouldShowPrompt:t,hasSubmittedReview:s,loginCount:o,isLoading:a,dismissPrompt:p,submitReview:x,markPostedToGoogle:y}},xht="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",yht=()=>{const{shouldShowPrompt:e,isLoading:t,dismissPrompt:n,submitReview:s,markPostedToGoogle:i}=lOe(),[o,l]=I.useState(!1),[a,h]=I.useState("review"),[p,x]=I.useState(0),[y,b]=I.useState(0),[j,N]=I.useState(""),[C,A]=I.useState(!1),[E,T]=I.useState(!1);if(t||!e&&!E)return null;const L=async()=>{if(p===0){$i({title:"Please select a rating",variant:"destructive"});return}A(!0);const q=await s(p,j);A(!1),q.success?(T(!0),$i({title:"Thank you for your feedback!",description:"Your review helps us improve."}),h("google")):$i({title:"Error submitting review",description:q.error,variant:"destructive"})},z=async q=>{q&&(await navigator.clipboard.writeText(j||`${p} star rating for LevelUp!`),$i({title:"Review copied!",description:"Paste it on Google Reviews."}),await i(),window.open(xht,"_blank")),l(!1),n()},F=()=>{l(!1),n()};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>l(!0),className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-40 flex items-center gap-2 rounded-full bg-primary/90 px-3 py-2 text-xs text-primary-foreground shadow-lg backdrop-blur-sm transition-all hover:bg-primary hover:scale-105 md:bottom-6",children:[r.jsx(vs,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Br,{open:o,onOpenChange:F,children:r.jsx(Fr,{className:"sm:max-w-md",children:a==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(es,{className:"text-center",children:"Your feedback helps us improve the experience for all members."})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsx("div",{className:"flex justify-center gap-1",children:[1,2,3,4,5].map(q=>r.jsx("button",{type:"button",onClick:()=>x(q),onMouseEnter:()=>b(q),onMouseLeave:()=>b(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(vs,{className:$t("h-8 w-8 transition-colors",(y||p)>=q?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},q))}),r.jsx(ps,{placeholder:"Tell us about your experience (optional)",value:j,onChange:q=>N(q.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",onClick:F,className:"flex-1",children:"Maybe Later"}),r.jsx(ee,{onClick:L,disabled:C||p===0,className:"flex-1",children:C?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(es,{className:"text-center",children:"Would you mind sharing your review on Google? It really helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"We'll copy your review so you can easily paste it."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>z(!1),className:"flex-1",children:"No Thanks"}),r.jsx(ee,{onClick:()=>z(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function vht(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(n),i=new Uint8Array(s.length);for(let o=0;o{if(!y){l(!1);return}(async()=>{try{const{data:C,error:A}=await J.functions.invoke("get-vapid-public-key",{body:{}});if(A)throw A;const E=C==null?void 0:C.vapidPublicKey;if(!E)throw new Error("Missing VAPID public key");x(E);const T=await navigator.serviceWorker.register("/push-sw.js");h(T),n(Notification.permission);const L=await T.pushManager.getSubscription();i(!!L)}catch(C){console.error("Error initializing push notifications:",C)}finally{l(!1)}})()},[y]);const b=I.useCallback(async()=>{if(!y||!a||!e)return console.error("Push notifications not supported or user not logged in"),!1;if(!p)return ze.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const N=await a.pushManager.getSubscription();if(N){try{await N.unsubscribe()}catch(z){console.warn("Failed to unsubscribe existing push subscription:",z)}const{error:L}=await J.from("push_subscriptions").delete().eq("user_id",e.id);L&&console.warn("Failed to cleanup push_subscriptions rows:",L)}if(Notification.permission!=="granted"){const L=await Notification.requestPermission();if(n(L),L!=="granted")return L==="denied"?ze.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):ze.error("Notification permission was dismissed. Please try again."),!1}const C=vht(p);let A;try{A=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:C})}catch(L){console.error("PushManager.subscribe() failed:",L);const z=(L==null?void 0:L.message)||String(L);return z.includes("permission")?ze.error("Push permission denied. Check your browser notification settings."):z.includes("key")||z.includes("VAPID")?ze.error("Push configuration error. Please contact support."):z.includes("AbortError")?ze.error("Push subscription was cancelled. Please try again."):ze.error(`Failed to subscribe: ${z}`),!1}const E=A.toJSON(),{error:T}=await J.from("push_subscriptions").upsert({user_id:e.id,endpoint:E.endpoint,p256dh_key:E.keys.p256dh,auth_key:E.keys.auth},{onConflict:"user_id,endpoint"});if(T)throw console.error("Error saving subscription:",T),ze.error("Failed to save notification preferences. Please try again."),T;return i(!0),ze.success("Push notifications enabled!"),!0}catch(N){if(console.error("Error subscribing to push notifications:",N),!(N instanceof Error&&N.message.includes("toast"))){const C=N instanceof Error?N.message:"Unknown error";ze.error("Failed to enable push notifications: "+C)}return!1}finally{l(!1)}},[y,a,e,p]),j=I.useCallback(async()=>{if(!a||!e)return!1;try{l(!0);const N=await a.pushManager.getSubscription();return N&&await N.unsubscribe(),await J.from("push_subscriptions").delete().eq("user_id",e.id),i(!1),ze.success("Push notifications disabled"),!0}catch(N){console.error("Error unsubscribing:",N);const C=N instanceof Error?N.message:"Unknown error";return ze.error("Failed to disable push notifications: "+C),!1}finally{l(!1)}},[a,e]);return{isSupported:y,permission:t,isSubscribed:s,isLoading:o,vapidPublicKey:p,subscribe:b,unsubscribe:j}}const gke="push_notification_prompt_dismissed",_ht=()=>{const{user:e}=zr(),{isSupported:t,isSubscribed:n,isLoading:s,subscribe:i}=cOe(),[o,l]=I.useState(!1),[a,h]=I.useState(!1);I.useEffect(()=>{if(!e||!t||n||s||localStorage.getItem(`${gke}_${e.id}`))return;const b=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(b)},[e,t,n,s]);const p=async()=>{h(!0);const y=await i();h(!1),y&&l(!1)},x=()=>{e&&localStorage.setItem(`${gke}_${e.id}`,"true"),l(!1)};return!t||n?null:r.jsx(Br,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:r.jsx(_g,{className:"h-6 w-6 text-primary"})}),r.jsx(qr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(es,{className:"text-center",children:"Enable push notifications to get alerted when:"})]}),r.jsxs("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New events go live"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Fresh templates are added"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New toolbox resources drop"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Social swag updates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New newsletters arrive"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Posts in your community groups"]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(ee,{onClick:p,disabled:a,className:"w-full",children:a?"Enabling...":"Enable Notifications"}),r.jsx(ee,{variant:"ghost",onClick:x,className:"w-full",children:"Not Now"})]}),r.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can always change this in your Profile settings."})]})})},xke=e=>{let t;const n=new Set,s=(p,x)=>{const y=typeof p=="function"?p(t):p;if(!Object.is(y,t)){const b=t;t=x??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(j=>j(t,b))}},i=()=>t,a={setState:s,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(s,i,a);return a},bht=e=>e?xke(e):xke,wht=e=>e;function jht(e,t=wht){const n=rt.useSyncExternalStore(e.subscribe,rt.useCallback(()=>t(e.getState()),[e,t]),rt.useCallback(()=>t(e.getInitialState()),[e,t]));return rt.useDebugValue(n),n}const kht=e=>{const t=bht(e),n=s=>jht(t,s);return Object.assign(n,t),n},Nht=e=>kht;function Sht(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var o;const l=h=>h===null?null:JSON.parse(h,void 0),a=(o=n.getItem(i))!=null?o:null;return a instanceof Promise?a.then(l):l(a)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const Che=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return Che(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Che(s)(n)}}}},Cht=(e,t)=>(n,s,i)=>{let o={storage:Sht(()=>localStorage),partialize:C=>C,version:0,merge:(C,A)=>({...A,...C}),...t},l=!1;const a=new Set,h=new Set;let p=o.storage;if(!p)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...C)},s,i);const x=()=>{const C=o.partialize({...s()});return p.setItem(o.name,{state:C,version:o.version})},y=i.setState;i.setState=(C,A)=>(y(C,A),x());const b=e((...C)=>(n(...C),x()),s,i);i.getInitialState=()=>b;let j;const N=()=>{var C,A;if(!p)return;l=!1,a.forEach(T=>{var L;return T((L=s())!=null?L:b)});const E=((A=o.onRehydrateStorage)==null?void 0:A.call(o,(C=s())!=null?C:b))||void 0;return Che(p.getItem.bind(p))(o.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==o.version){if(o.migrate){const L=o.migrate(T.state,T.version);return L instanceof Promise?L.then(z=>[!0,z]):[!0,L]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var L;const[z,F]=T;if(j=o.merge(F,(L=s())!=null?L:b),n(j,!0),z)return x()}).then(()=>{E==null||E(j,void 0),j=s(),l=!0,h.forEach(T=>T(j))}).catch(T=>{E==null||E(void 0,T)})};return i.persist={setOptions:C=>{o={...o,...C},C.storage&&(p=C.storage)},clearStorage:()=>{p==null||p.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>N(),hasHydrated:()=>l,onHydrate:C=>(a.add(C),()=>{a.delete(C)}),onFinishHydration:C=>(h.add(C),()=>{h.delete(C)})},o.skipHydration||N(),j||b},Mht=Cht,wse=Nht()(Mht((e,t)=>({cartItems:[],addToCart:(n,s,i=1,o)=>{e(l=>{const a=l.cartItems.findIndex(h=>{var p;return h.product.id===n.id&&((p=h.variant)==null?void 0:p.id)===(s==null?void 0:s.id)});if(a>=0){const h=[...l.cartItems];return h[a].quantity+=i,o&&(h[a].artworkUrl=o),{cartItems:h}}return{cartItems:[...l.cartItems,{product:n,variant:s,quantity:i,artworkUrl:o}]}})},removeFromCart:(n,s)=>{e(i=>({cartItems:i.cartItems.filter(o=>{var l;return!(o.product.id===n&&((l=o.variant)==null?void 0:l.id)===s)})}))},updateQuantity:(n,s,i)=>{e(o=>({cartItems:o.cartItems.map(l=>{var a;return l.product.id===n&&((a=l.variant)==null?void 0:a.id)===s?{...l,quantity:Math.max(1,i)}:l})}))},updateArtwork:(n,s,i)=>{e(o=>({cartItems:o.cartItems.map(l=>{var a;return l.product.id===n&&((a=l.variant)==null?void 0:a.id)===s?{...l,artworkUrl:i}:l})}))},clearCart:()=>e({cartItems:[]}),getItemPrice:n=>{const s=Number(n.product.base_price),i=n.variant?Number(n.variant.price_adjustment):0;return s+i},getSubtotal:()=>{const{cartItems:n,getItemPrice:s}=t();return n.reduce((i,o)=>i+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=t();return n.reduce((s,i)=>s+Number(i.product.shipping_fee)*i.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=t();return n()+s()}}),{name:"marketplace-cart",partialize:e=>({cartItems:e.cartItems})})),dOe=I.createContext({onlineUsers:[],totalOnline:0}),Tht=async e=>{try{const{data:t}=await J.storage.from("avatars").list(`${e}`);if(t&&t.length>0){const{data:n}=J.storage.from("avatars").getPublicUrl(`${e}/${t[0].name}`);return n.publicUrl}}catch{}},Aht=({children:e})=>{const{user:t,brokerageId:n,isAdmin:s}=zr(),[i,o]=I.useState([]),[l,a]=I.useState(null);I.useEffect(()=>{if(!t)return;const p=J.channel("app-presence",{config:{presence:{key:t.id}}});return p.on("presence",{event:"sync"},()=>{const x=p.presenceState(),y=[];Object.entries(x).forEach(([b,j])=>{if(j&&j.length>0){const N=j[0];y.push({id:b,name:N.name||"Unknown",avatarUrl:N.avatarUrl,brokerageId:N.brokerageId,onlineSince:N.onlineSince})}}),o(y)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async x=>{var y;if(x==="SUBSCRIBED"){const{data:b}=await J.from("profiles").select("name, brokerage_id").eq("id",t.id).single(),j=await Tht(t.id);await p.track({name:(b==null?void 0:b.name)||((y=t.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:j,brokerageId:b==null?void 0:b.brokerage_id,onlineSince:new Date().toISOString()})}}),a(p),()=>{p.unsubscribe()}},[t]);const h=i.filter(p=>p.id===(t==null?void 0:t.id)?!1:!!(s||n&&p.brokerageId===n||!n&&!p.brokerageId));return r.jsx(dOe.Provider,{value:{onlineUsers:h,totalOnline:i.length},children:e})},uOe=()=>I.useContext(dOe),yke="dashboard-sidebar-collapsed",Or=({children:e,title:t})=>{var ye,Ie,Ne;const{user:n,signOut:s,isAdmin:i,isBrokerageManager:o,brokerageId:l}=zr(),{avatarUrl:a}=Pge(n==null?void 0:n.id),{isTrial:h,isExpired:p,expiresAt:x}=Gat(n==null?void 0:n.id),{isMarketplaceEnabled:y}=F6e(),{currentBrief:b,shouldShowPopup:j,hasUnseenBrief:N,openBrief:C,closeBrief:A,dismissBrief:E}=pht(),{unreadCount:T}=Kat(),{openCount:L}=Zat(),F=wse(we=>we.cartItems).reduce((we,he)=>we+he.quantity,0),q=ns(),H=Nm(),[K,Z]=I.useState(()=>typeof window<"u"?localStorage.getItem(yke)==="true":!1);I.useEffect(()=>{localStorage.setItem(yke,String(K))},[K]);const[te,ae]=I.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),le=we=>{ae(he=>({...he,[we]:!he[we]}))},ve=we=>we.split(" ").map(he=>he[0]).join("").toUpperCase().slice(0,2),ne=we=>H.pathname===we,ge=we=>we.some(he=>H.pathname===he),ie=({path:we,icon:he,label:xe,badgeCount:be})=>{const Oe=r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ne(we)&&"bg-sidebar-accent text-sidebar-accent-foreground",K?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>q(we),children:[r.jsxs("div",{className:"relative",children:[r.jsx(he,{className:"h-4 w-4 shrink-0"}),K&&be!=null&&be>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]}),!K&&xe,!K&&be!=null&&be>0&&r.jsx("span",{className:"ml-auto flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:be>9?"9+":be})]});return K?r.jsxs(Cg,{delayDuration:0,children:[r.jsx(Mg,{asChild:!0,children:Oe}),r.jsxs(vm,{side:"right",className:"flex items-center gap-2",children:[xe,be!=null&&be>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:be>9?"9+":be})]})]}):Oe},fe=({id:we,label:he,icon:xe,children:be,activePaths:Oe,showBetaBadge:Te,defaultPath:Ve,badgeCount:Fe})=>{if(K){const Me=Ve||Oe[0];return r.jsxs(Cg,{delayDuration:0,children:[r.jsx(Mg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"sm",className:$t("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ge(Oe)&&"text-primary"),onClick:()=>q(Me),children:r.jsxs("div",{className:"relative",children:[r.jsx(xe,{className:"h-4 w-4"}),Fe!=null&&Fe>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]})})}),r.jsxs(vm,{side:"right",className:"flex items-center gap-2",children:[he,Te&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600",children:"Beta"}),Fe!=null&&Fe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Fe>9?"9+":Fe})]})]})}return r.jsxs(NS,{open:te[we],onOpenChange:()=>le(we),children:[r.jsx(SS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ge(Oe)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(xe,{className:"h-4 w-4"}),he,Te&&r.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wide px-1 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("span",{className:"flex items-center gap-1",children:[Fe!=null&&Fe>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Fe>9?"9+":Fe}),r.jsx(Pu,{className:$t("h-4 w-4 transition-transform duration-200",te[we]&&"rotate-180")})]})]})}),r.jsx(CS,{className:"pl-4 space-y-1 mt-1",children:be})]})},de=({isMobile:we=!1})=>{const he=we?!1:K;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:$t("p-3 border-b border-sidebar-border",he?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[he?r.jsx("img",{src:zlt,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:Uje,alt:"LevelUp",className:"h-8 w-auto"}),!we&&r.jsxs(Cg,{delayDuration:0,children:[r.jsx(Mg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>Z(!he),children:r.jsx(qc,{className:$t("h-4 w-4 transition-transform duration-300",he&&"rotate-180")})})}),r.jsx(vm,{side:"right",children:he?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(Jo,{className:"flex-1",children:r.jsxs("nav",{className:$t("p-3 space-y-1",he&&"flex flex-col items-center"),children:[r.jsx(ie,{path:"/dashboard",icon:aS,label:"Dashboard"}),r.jsx(ie,{path:"/events",icon:hm,label:"Events"}),r.jsxs(fe,{id:"agentos",label:"Agent OS",icon:eS,activePaths:["/mission-control","/mission-control/contacts","/mission-control/plans","/mission-control/popbys","/mission-control/video-library","/mission-control/scorecard","/mission-control/listings","/mission-control/pipeline"],showBetaBadge:!0,defaultPath:"/mission-control",children:[r.jsx(ie,{path:"/mission-control",icon:oa,label:"Mission Control"}),r.jsx(ie,{path:"/mission-control/contacts",icon:Vn,label:"Contacts"}),r.jsx(ie,{path:"/mission-control/plans",icon:hm,label:"TouchPlans"}),r.jsx(ie,{path:"/mission-control/pipeline",icon:m1,label:"Deal Pipeline"}),r.jsx(ie,{path:"/mission-control/popbys",icon:Ha,label:"Popbys"}),r.jsx(ie,{path:"/mission-control/video-library",icon:Fi,label:"Video Library"}),r.jsx(ie,{path:"/mission-control/scorecard",icon:ac,label:"Scorecard"}),r.jsx(ie,{path:"/mission-control/listings",icon:na,label:"Listing Exchange"})]}),r.jsxs(fe,{id:"tools",label:"Tools",icon:Dh,activePaths:["/apps","/ai-toolkit","/mission-control/my-card"],defaultPath:"/apps",children:[r.jsx(ie,{path:"/apps",icon:Dh,label:"Apps"}),!he&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/mission-control/my-card"),children:[r.jsx(fm,{className:"h-4 w-4"}),"Digital Card",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),he&&r.jsx(ie,{path:"/mission-control/my-card",icon:fm,label:"Digital Card"})]}),r.jsxs(fe,{id:"marketing",label:"Marketing",icon:gm,activePaths:["/templates","/social-swag-2","/newsletters","/listing-swag"],defaultPath:"/templates",children:[r.jsx(ie,{path:"/templates",icon:hd,label:"Templates"}),!he&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/social-swag-2")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/social-swag-2"),children:[r.jsx(xm,{className:"h-4 w-4"}),"Social Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),he&&r.jsx(ie,{path:"/social-swag-2",icon:xm,label:"Social Swag"}),r.jsx(ie,{path:"/newsletters",icon:Wx,label:"Newsletters"}),i&&!he&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/listing-swag")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/listing-swag"),children:[r.jsx(Do,{className:"h-4 w-4"}),"Listing Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-amber-500 text-white",children:"Beta"})]}),i&&he&&r.jsx(ie,{path:"/listing-swag",icon:Do,label:"Listing Swag"})]}),r.jsxs(fe,{id:"learning",label:"Learning",icon:TT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(ie,{path:"/academy",icon:f1,label:"Academy"}),r.jsx(ie,{path:"/toolbox",icon:Zx,label:"Toolbox"})]}),r.jsxs(fe,{id:"community",label:"Community",icon:Po,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:T,children:[r.jsx(ie,{path:"/community",icon:Vn,label:"Community",badgeCount:T}),r.jsx(ie,{path:"/wishlist",icon:g1,label:"Wishlist",badgeCount:L}),!he&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>window.open("https://www.facebook.com/share/g/1CC6thti2V/","_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(fe,{id:"goods",label:"The Goods",icon:hh,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[y&&!he&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",H.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/marketplace"),children:[r.jsx(hh,{className:"h-4 w-4"}),"Marketplace",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground",children:"New"})]}),y&&he&&r.jsx(ie,{path:"/marketplace",icon:hh,label:"Marketplace"}),r.jsx(ie,{path:"/reward-store",icon:Wa,label:"Reward Store"})]}),r.jsxs(fe,{id:"help",label:"Help & Services",icon:Cx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(ie,{path:"/support",icon:lS,label:"Support"}),r.jsx(ie,{path:"/additional-services",icon:Cs,label:"Additional Services"})]}),i&&r.jsxs(r.Fragment,{children:[!he&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Admin"})}),he?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(ie,{path:"/admin",icon:Gf,label:"Admin Dashboard"})}):r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",H.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/admin"),children:[r.jsx(Gf,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!i&&r.jsxs(r.Fragment,{children:[!he&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"My Brokerage"})}),he?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(ie,{path:"/my-brokerage",icon:na,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{path:"/brokerage/dashboard",icon:fd,label:"Manage Brokerages"}),r.jsx(ie,{path:"/brokerage-resources",icon:yh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/my-brokerage"),children:[r.jsx(na,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage/dashboard"),children:[r.jsx(fd,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/brokerage-resources"),children:[r.jsx(yh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ne("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>q("/profile"),children:[r.jsx(Cc,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:s,children:[r.jsx(uS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(Aht,{children:r.jsx(xI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[h&&p&&r.jsx(Xut,{}),typeof document<"u"&&py.createPortal(r.jsx("aside",{className:$t("hidden md:flex flex-col bg-card border-r border-border fixed top-0 left-0 h-screen z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",K?"w-16":"w-52"),children:r.jsx(de,{})}),document.body),r.jsxs("div",{className:$t("flex-1 flex flex-col h-screen overflow-hidden transition-all duration-300",K?"md:ml-16":"md:ml-52"),children:[r.jsx("header",{className:"sticky top-0 z-40 bg-card border-b border-border flex-shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[r.jsxs(tse,{children:[r.jsx(Lge,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(RT,{className:"h-5 w-5"})})}),r.jsx(kI,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(de,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:Uje,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(mke,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[h&&!p&&x&&r.jsx(Yut,{expiresAt:x,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(mke,{})}),b&&r.jsx(Qut,{hasUnseenBrief:N,onClick:C}),y&&r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",onClick:()=>q("/marketplace/cart"),children:[r.jsx(hh,{className:"h-5 w-5"}),F>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-5 w-5 rounded-full bg-primary text-primary-foreground text-xs font-medium flex items-center justify-center",children:F>99?"99+":F})]}),r.jsx(wut,{}),r.jsx(bhe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Ie=(ye=n==null?void 0:n.user_metadata)==null?void 0:ye.name)==null?void 0:Ie.split(" ")[0])||"User","!"]}),r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsx("button",{className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-full",children:r.jsxs(ci,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Ga,{src:a||void 0}),r.jsx(di,{className:"bg-primary text-primary-foreground font-medium text-sm",children:ve(((Ne=n==null?void 0:n.user_metadata)==null?void 0:Ne.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(ap,{align:"end",className:"w-48",children:[r.jsxs(mo,{onClick:()=>q("/profile"),className:"cursor-pointer",children:[r.jsx(Cc,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsx(pC,{}),r.jsxs(mo,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(uS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(ght,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:e})}),b&&r.jsx(fht,{brief:b,open:j,onClose:A,onDismiss:E}),r.jsx(mht,{}),r.jsx(yht,{}),r.jsx(_ht,{})]})]})})})},Eht=()=>{const{user:e}=zr(),[t,n]=I.useState(!1),[s,i]=I.useState(null),[o,l]=I.useState(""),a=async y=>{var b;if(!(e!=null&&e.email)){ze.error("Please sign in to upgrade");return}n(!0),i(y);try{const{data:j,error:N}=await J.functions.invoke("create-checkout",{body:{tier:y,email:e.email,name:((b=e.user_metadata)==null?void 0:b.full_name)||e.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(N)throw N;if(j!=null&&j.url)window.open(j.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(j){console.error("Checkout error:",j),ze.error(j.message||"Failed to start checkout. Please try again.")}finally{n(!1),i(null)}},h=["Unlimited access to all marketing templates","Complete Academy training library","AI-powered tools and resources","Community forums and support","Exclusive member events and workshops","Deal pipeline & scorecard tracking","Listing exchange access","Social media content library"],p=["Everything in Individual plan","Up to 25 agent seats","Brokerage admin dashboard","Team performance analytics","Custom branding options","Priority support","Agent onboarding tools","Brokerage-wide announcements"],x=["Everything in Brokerage plan","Unlimited agent seats","Dedicated account manager","Advanced analytics & reporting","White-label options","API access","Custom integrations","Enterprise-level support"];return r.jsx(Or,{children:r.jsxs("div",{className:"container max-w-6xl py-8 px-4",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Upgrade Your Membership"}),r.jsx("p",{className:"text-muted-foreground text-lg",children:"Choose the plan that's right for you and unlock the full power of LevelUp"})]}),r.jsxs("div",{className:"max-w-md mx-auto mb-8",children:[r.jsx(Ue,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(at,{id:"coupon",placeholder:"Enter discount code",value:o,onChange:y=>l(y.target.value),className:"mt-1"})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6 mb-8",children:[r.jsxs(Ge,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors relative overflow-hidden",children:[r.jsx("div",{className:"absolute top-0 right-0 bg-primary text-primary-foreground text-xs px-3 py-1 rounded-bl-lg font-medium",children:"Popular"}),r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Vn,{className:"h-7 w-7 text-primary"})}),r.jsx(Qt,{className:"text-xl",children:"Individual Agent"}),r.jsx(En,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:h.map((y,b)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ca,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},b))}),r.jsxs(ee,{className:"w-full",size:"lg",onClick:()=>a("individual_agent"),disabled:t,children:[t&&s==="individual_agent"?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Cs,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ge,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Qt,{className:"text-xl",children:"Brokerage"}),r.jsx(En,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-amber-600",children:"$299"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:p.map((y,b)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ca,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},b))}),r.jsxs(ee,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>a("brokerage_under_25"),disabled:t,children:[t&&s==="brokerage_under_25"?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(na,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ge,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-purple-500/10 flex items-center justify-center",children:r.jsx(na,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Qt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(En,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-purple-600",children:"$499"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:x.map((y,b)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ca,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},b))}),r.jsxs(ee,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>a("brokerage_over_25"),disabled:t,children:[t&&s==="brokerage_over_25"?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(na,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(Ge,{className:"bg-muted/50",children:r.jsxs(Xe,{className:"py-6",children:[r.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Ys,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},Iht=()=>{const{user:e,loading:t,isBrokerageManager:n,brokerageId:s}=zr(),i=ns(),[o,l]=I.useState(""),[a,h]=I.useState(!1),[p,x]=I.useState(!1);I.useEffect(()=>{!t&&!e&&i("/auth")},[e,t,i]),I.useEffect(()=>{!t&&e&&s&&i("/profile?setup=true")},[e,t,s,i]);const y=async()=>{if(!o.trim()){ze.error("Please enter a brokerage name");return}const{data:b}=await J.auth.getSession(),j=b.session;if(!e||!j){ze.error("Please sign in again to create your brokerage."),i("/auth");return}h(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!e,hasSession:!!j,userId:e==null?void 0:e.id});const{data:N,error:C}=await J.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:N,error:C}),C)throw C;if(!(N!=null&&N.ok))throw new Error((N==null?void 0:N.error)||"Failed to create brokerage");h(!1),x(!0),ze.success("Brokerage created! Setting up your account..."),setTimeout(()=>{i("/profile?setup=true")},2e3)}catch(N){console.error("Error creating brokerage:",N),ze.error(N.message||"Failed to create brokerage"),h(!1)}};return t?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p?r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ge,{className:"max-w-lg w-full",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(nn,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Qt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(En,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(qa,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{children:"Brokerage created"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(nn,{className:"w-5 h-5 animate-spin text-primary"}),r.jsx("span",{children:"Assigning you as manager..."})]}),r.jsx("p",{className:"text-center text-sm text-muted-foreground mt-4",children:"You'll be redirected to complete your profile setup in a moment."})]})]})}):r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ge,{className:"max-w-lg w-full",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(na,{className:"w-10 h-10 text-primary"})}),r.jsx(Qt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(En,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(at,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:b=>l(b.target.value),onKeyDown:b=>b.key==="Enter"&&y()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is how your brokerage will appear to your agents"})]}),r.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 space-y-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(Vn,{className:"w-4 h-4 text-primary"}),"What you can do as a Brokerage Manager:"]}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Invite agents to join your brokerage"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Track your team's activity and engagement"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(ee,{onClick:y,className:"w-full",disabled:a||!o.trim(),children:[a?"Creating...":"Create Brokerage",r.jsx(Zo,{className:"w-4 h-4 ml-2"})]})]})]})})},vke=()=>{const e=ns(),[t,n]=I.useState("verifying"),[s,i]=I.useState("");I.useEffect(()=>{(async()=>{try{const{data:{session:a},error:h}=await J.auth.getSession();if(h)throw h;if(a!=null&&a.user){const{data:p}=await J.from("profiles").select("login_count").eq("id",a.user.id).single();if(((p==null?void 0:p.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",a.user.email),n("success");try{await J.functions.invoke("trial-claim-hook",{body:{userId:a.user.id}})}catch(x){console.log("Trial claim hook (non-critical):",x)}setTimeout(()=>{e("/profile?setup=true")},1500)}else setTimeout(()=>{n("already_claimed")},2e3)}catch(a){console.error("Claim error:",a),n("already_claimed")}})()},[e]);const o=()=>{window.location.href="https://dashboard.relevelup.com/auth"};return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ge,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"space-y-1 text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:[t==="verifying"&&r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),t==="success"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),t==="already_claimed"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),t==="error"&&r.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),r.jsxs(Qt,{className:"text-2xl",children:[t==="verifying"&&"Claiming Your Account...",t==="success"&&"Account Claimed!",t==="already_claimed"&&"Account Already Claimed",t==="error"&&"Claim Failed"]}),r.jsxs(En,{children:[t==="verifying"&&"Please wait while we verify your account...",t==="success"&&"Redirecting you to complete your profile...",t==="already_claimed"&&"This account has already been set up. Please log in to access your dashboard.",t==="error"&&s]})]}),(t==="already_claimed"||t==="error")&&r.jsx(Xe,{children:r.jsx(ee,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},Pht=()=>{const e=ns(),[t]=Fd(),[n,s]=I.useState(t.get("code")||""),[i,o]=I.useState(""),[l,a]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(!1),[b,j]=I.useState(!1),[N,C]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState(null),[q,H]=I.useState(null),[K,Z]=I.useState(null);I.useEffect(()=>{const ve=t.get("code");ve&&(s(ve),te(ve))},[t]);const te=async ve=>{C(!0);const{data:ne,error:ge}=await J.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",ve.toUpperCase().trim()).single();if(ge||!ne){ze.error("Invalid invite code"),C(!1);return}if(!ne.is_active){ze.error("This invite code is no longer active"),C(!1);return}if(ne.max_uses&&ne.uses_count>=ne.max_uses){ze.error("This invite code has reached its maximum uses"),C(!1);return}if(ne.expires_at&&new Date(ne.expires_at){ve.preventDefault(),te(n)},le=async ve=>{var ne;if(ve.preventDefault(),!h.trim()){ze.error("Please enter your name");return}if(l.length<6){ze.error("Password must be at least 6 characters");return}j(!0);try{const ge=`${window.location.origin}/`,{data:ie,error:fe}=await J.auth.signUp({email:i.trim(),password:l,options:{emailRedirectTo:ge,data:{name:h.trim()}}});if(fe){fe.message.includes("already registered")?ze.error("This email is already registered. Please sign in instead."):ze.error(fe.message);return}ie.user&&(await J.rpc("add_default_signup_tag",{user_id:ie.user.id}),z?await J.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,brokerageId:z}}):K?await J.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,trialDays:K}}):await J.functions.invoke("assign-brokerage",{body:{userId:ie.user.id,grandfathered:!0}}),T&&await J.from("invite_codes").update({uses_count:((ne=(await J.from("invite_codes").select("uses_count").eq("id",T).single()).data)==null?void 0:ne.uses_count)+1}).eq("id",T),ze.success("Account created! You can now access the dashboard."),e("/dashboard"))}catch(ge){console.error("Signup error:",ge),ze.error("An unexpected error occurred")}finally{j(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ge,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx(Qt,{className:"text-2xl font-bold text-primary",children:q?`Join ${q}`:"Join LevelUp"}),r.jsx(En,{children:A?q?`Create your account to join ${q}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(Xe,{children:A?r.jsxs("form",{onSubmit:le,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Full Name"}),r.jsx(at,{id:"name",type:"text",placeholder:"John Doe",value:h,onChange:ve=>p(ve.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"email",children:"Email"}),r.jsx(at,{id:"email",type:"email",placeholder:"you@example.com",value:i,onChange:ve=>o(ve.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(at,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:ve=>a(ve.target.value),required:!0,minLength:6}),r.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>y(!x),children:x?r.jsx(d1,{className:"h-4 w-4"}):r.jsx(Qo,{className:"h-4 w-4"})})]})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:b,children:b?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(at,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:ve=>s(ve.target.value),required:!0,autoFocus:!0})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:N,children:N?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},Lht="/assets/testimonial-avatar-1-BsCQFauB.jpg",Oht="/assets/testimonial-avatar-2-B6VPVc2t.jpg",Dht="/assets/testimonial-avatar-3-GuEFwYUE.jpg",Rht="/assets/testimonial-avatar-4-98iKMtkB.jpg",Fht="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",zht=[Lht,Oht,Dht,Rht,Fht],Bht=u3({name:nc().trim().min(2,"Name must be at least 2 characters").max(100),email:nc().trim().email("Please enter a valid email address").max(255),phone:nc().trim().min(10,"Please enter a valid phone number").max(20).optional().or(Fje("")),brokerage:nc().trim().max(200).optional().or(Fje(""))}),$ht=[{icon:Df,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:hd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:zs,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Ol,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:wi,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ha,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Uht=[{icon:Vn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Cs,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:ca,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Kh,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:ml,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:ac,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:oa,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Ng,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],qht=[{name:"Sarah M.",role:"Top Producer, RE/MAX",quote:"LevelUp completely transformed how I run my business. The templates alone save me hours every week."},{name:"Mike T.",role:"Brokerage Owner",quote:"Onboarding new agents used to take weeks. Now they're productive from day one with all the training resources."},{name:"Jessica L.",role:"Team Lead",quote:"The community is incredible. I've learned more from other agents here than any conference I've attended."}],Vht=()=>{const e=ns(),[t,n]=I.useState(!1),[s,i]=I.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=I.useState({}),a=async h=>{var x,y;h.preventDefault(),l({});const p=Bht.safeParse(s);if(!p.success){const b={};p.error.errors.forEach(j=>{j.path[0]&&(b[j.path[0]]=j.message)}),l(b);return}n(!0);try{const{data:b,error:j}=await J.functions.invoke("create-trial-signup",{body:{name:s.name.trim(),email:s.email.trim().toLowerCase(),phone:((x=s.phone)==null?void 0:x.trim())||void 0,brokerage:((y=s.brokerage)==null?void 0:y.trim())||void 0}});if(j){console.error("Trial signup error:",j),ze.error(j.message||"Something went wrong. Please try again.");return}if(b!=null&&b.error){ze.error(b.error);return}ze.success("🎉 Welcome aboard! Check your email to claim your account."),e("/trial/success")}catch(b){console.error("Trial signup error:",b),ze.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Start Your Free 7-Day Trial | LevelUp Dashboard"}),r.jsx("meta",{name:"description",content:"Take LevelUp for a free 7-day test drive. No credit card required. The all-in-one platform for real estate agents and brokerages."}),r.jsx("meta",{property:"og:title",content:"Start Your Free 7-Day Trial | LevelUp"}),r.jsx("meta",{property:"og:description",content:"Take LevelUp for a free 7-day test drive. No credit card required."}),r.jsx("meta",{property:"og:type",content:"website"})]}),r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:nte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var h;return(h=document.getElementById("features"))==null?void 0:h.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{onClick:()=>e("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-8 text-center lg:text-left",children:[r.jsx("div",{className:"flex justify-center lg:justify-start",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-24 md:h-32 drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium",children:[r.jsx(Cs,{className:"h-4 w-4 text-yellow-400"}),r.jsx("span",{children:"7-Day Free Trial • No Credit Card Required"})]}),r.jsxs("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white leading-tight font-sans",children:["Take LevelUp for a"," ",r.jsx("span",{className:"italic",children:"Free Test Drive"})]}),r.jsxs("p",{className:"text-lg md:text-xl text-white/80 max-w-xl mx-auto lg:mx-0 font-sans",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Ya,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"No credit card required"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Ya,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"Full access to all features"})]})]}),r.jsxs("div",{className:"flex items-center gap-4 justify-center lg:justify-start pt-4",children:[r.jsx("div",{className:"flex -space-x-3",children:zht.map((h,p)=>r.jsx("img",{src:h,alt:`Agent ${p+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},p))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(h=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},h))}),r.jsx("p",{className:"text-sm text-white/60",children:"Trusted by 3,000+ agents"})]})]})]}),r.jsx("div",{className:"lg:pl-8",children:r.jsx(Ge,{className:"bg-white shadow-2xl border-0",children:r.jsxs(Xe,{className:"p-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:r.jsx(wg,{className:"h-8 w-8 text-white"})}),r.jsx("h2",{className:"text-2xl font-bold text-foreground font-sans",children:"Start Your Free Trial"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Get instant access • No credit card needed"})]}),r.jsxs("form",{onSubmit:a,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Full Name *"}),r.jsx(at,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:h=>i({...s,name:h.target.value}),required:!0}),o.name&&r.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"email",children:"Email Address *"}),r.jsx(at,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:h=>i({...s,email:h.target.value}),required:!0}),o.email&&r.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"phone",children:"Phone Number"}),r.jsx(at,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:h=>i({...s,phone:h.target.value})}),o.phone&&r.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(at,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:h=>i({...s,brokerage:h.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(ee,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:t,children:t?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(Zo,{className:"ml-2 h-5 w-5"})]})}),r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["By signing up, you agree to our"," ",r.jsx("a",{href:"/terms-of-service",className:"text-[#4a6b6d] hover:underline",children:"Terms"})," ","and"," ",r.jsx("a",{href:"/privacy-policy",className:"text-[#4a6b6d] hover:underline",children:"Privacy Policy"})]})]})]})})})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:$ht.map((h,p)=>r.jsxs(Ge,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Gt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(h.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Qt,{className:"text-xl font-sans",children:h.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:h.description})})]},p))})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Cs,{className:"w-4 h-4"}),"Included with Your Trial"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:Uht.map((h,p)=>r.jsxs(Ge,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(h.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Qt,{className:"text-lg font-semibold text-white",children:h.title})]}),r.jsx(Xe,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:h.description})})]},p))})]})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4 font-sans",children:"Loved by Top Producers"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what agents are saying about LevelUp"})]}),r.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:qht.map((h,p)=>r.jsx(Ge,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(Xe,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',h.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:h.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:h.role})]})]})},p))})]})}),r.jsx("section",{className:"py-16 bg-muted/30",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-wrap justify-center gap-8 md:gap-16",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Kf,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Secure & Private"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Bank-level encryption"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Ng,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Fast Setup"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Start in 2 minutes"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Vn,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Expert Support"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Real estate pros"})]})]})]})})}),r.jsx("section",{id:"free-trial",className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs(Ge,{className:"bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] border-0 shadow-2xl overflow-hidden relative",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs(Xe,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(ee,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),size:"lg",className:"h-14 px-8 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 rounded-full",children:["Start Your Free Trial Now",r.jsx(Zo,{className:"ml-2 h-5 w-5"})]})]})]})})}),r.jsx("footer",{className:"bg-[#1e3a4c] py-12",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-6",children:[r.jsx("img",{src:Mge,alt:"LevelUp",className:"h-8"}),r.jsxs("div",{className:"flex gap-6 text-sm text-white/60",children:[r.jsx("a",{href:"/privacy-policy",className:"hover:text-white transition-colors",children:"Privacy Policy"}),r.jsx("a",{href:"/terms-of-service",className:"hover:text-white transition-colors",children:"Terms of Service"})]}),r.jsx("p",{className:"text-sm text-white/40",children:"© 2025 LevelUp Consulting Group. All rights reserved."})]})})})]})]})},Hht=()=>{const e=ns();return r.jsxs(r.Fragment,{children:[r.jsx(np,{children:r.jsx("title",{children:"Welcome to LevelUp! | Check Your Email"})}),r.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:nte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(ee,{onClick:()=>e("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})}),r.jsxs("section",{className:"relative pt-24 pb-12 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden flex-1 flex items-center",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsx("div",{className:"flex justify-center",children:r.jsx(Ge,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(Xe,{className:"p-8 md:p-12 text-center",children:[r.jsxs("div",{className:"relative inline-block mb-8",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] flex items-center justify-center",children:r.jsx(Ya,{className:"h-12 w-12 text-white"})}),r.jsx("div",{className:"absolute -top-2 -right-2 w-10 h-10 rounded-full bg-yellow-500 flex items-center justify-center animate-bounce",children:r.jsx(Sc,{className:"h-5 w-5 text-white"})})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-4 font-sans",children:"You're In! 🎉"}),r.jsx("p",{className:"text-xl text-muted-foreground mb-8",children:"Your 7-day LevelUp adventure starts now!"}),r.jsxs("div",{className:"bg-[#4a6b6d]/10 rounded-xl p-6 mb-8",children:[r.jsxs("div",{className:"flex items-center justify-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(Ys,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Check Your Inbox"})]}),r.jsx("p",{className:"text-muted-foreground",children:"We just sent you a magic link to claim your account and set up your password. Click the link in your email to get started!"})]}),r.jsxs("div",{className:"text-left space-y-3 mb-8",children:[r.jsx("p",{className:"text-sm text-muted-foreground font-medium uppercase tracking-wide",children:"What happens next:"}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"1"})}),r.jsx("p",{className:"text-foreground",children:"Check your email for the welcome message"})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"2"})}),r.jsx("p",{className:"text-foreground",children:'Click "Claim Your Account" to set your password'})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"3"})}),r.jsx("p",{className:"text-foreground",children:"Start exploring all the features!"})]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Didn't receive the email? Check your spam folder or"," ",r.jsx("button",{onClick:()=>e("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),r.jsxs(ee,{onClick:()=>e("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(Zo,{className:"ml-2 h-4 w-4"})]})]})})})})]}),r.jsx("footer",{className:"bg-[#1e3a4c] py-8",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[r.jsx("img",{src:Mge,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Wht=u3({viewerName:nc().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:nc().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:nc().max(20,"Phone must be less than 20 characters").optional(),message:nc().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Ght({shareToken:e,agentName:t,hasContact:n}){const[s,i]=I.useState(!1),[o,l]=I.useState(!1),[a,h]=I.useState(null),p=hse({resolver:fse(Wht),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async y=>{i(!0),h(null);try{const{data:b,error:j}=await J.functions.invoke("video-reply-notify",{body:{shareToken:e,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(j)throw new Error(j.message);if(!(b!=null&&b.success))throw new Error((b==null?void 0:b.error)||"Failed to send reply");l(!0)}catch(b){console.error("Failed to submit reply:",b),h(b.message||"Something went wrong. Please try again.")}finally{i(!1)}};return o?r.jsx(Ge,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(Xe,{className:"py-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:r.jsx(Ya,{className:"h-8 w-8 text-primary"})}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Message Sent!"}),r.jsxs("p",{className:"text-muted-foreground",children:[t?`${t} will`:"They'll"," get back to you soon."]})]})}):r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Ol,{className:"h-5 w-5 text-primary"}),r.jsx(Qt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(En,{children:n?`Have a question or want to connect? Send ${t||"them"} a message.`:`Interested? Share your info and ${t||"your agent"} will be in touch.`})]}),r.jsx(Xe,{children:r.jsx(pse,{...p,children:r.jsxs("form",{onSubmit:p.handleSubmit(x),className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsx(Ml,{control:p.control,name:"viewerName",render:({field:y})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Your Name *"}),r.jsx(wl,{children:r.jsx(at,{placeholder:"John Smith",...y})}),r.jsx(wu,{})]})}),r.jsx(Ml,{control:p.control,name:"viewerEmail",render:({field:y})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Email *"}),r.jsx(wl,{children:r.jsx(at,{type:"email",placeholder:"john@example.com",...y})}),r.jsx(wu,{})]})})]}),!n&&r.jsx(Ml,{control:p.control,name:"viewerPhone",render:({field:y})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Phone (optional)"}),r.jsx(wl,{children:r.jsx(at,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx(wu,{})]})}),r.jsx(Ml,{control:p.control,name:"message",render:({field:y})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Message *"}),r.jsx(wl,{children:r.jsx(ps,{placeholder:n?"Thanks for the video! I had a question about...":"I'm interested in learning more about...",className:"min-h-[100px] resize-none",...y})}),r.jsx(wu,{})]})}),a&&r.jsx("p",{className:"text-sm text-destructive",children:a}),r.jsx(ee,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Kht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsxs("div",{className:"absolute inset-0 opacity-[0.08]",children:[r.jsx("div",{className:"absolute top-0 left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[16%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[32%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[48%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[64%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[80%] left-0 right-0 h-[8%] bg-red-600"})]}),r.jsx("div",{className:"absolute top-0 left-0 w-[35%] h-[45%] bg-blue-900/10 rounded-br-3xl"}),r.jsx(vs,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(vs,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(vs,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(Ux,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Zht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-500/5 via-transparent to-blue-500/5"}),r.jsxs("div",{className:"absolute top-[10%] left-[15%] w-32 h-32",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-red-400/20 animate-ping",style:{animationDuration:"3s"}}),r.jsx(Cs,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 text-red-400/40"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[20%] w-24 h-24",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-blue-400/20 animate-ping",style:{animationDuration:"4s",animationDelay:"1s"}}),r.jsx(vs,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 text-blue-400/40 fill-blue-400/20"})]}),r.jsxs("div",{className:"absolute top-[20%] left-[50%] w-20 h-20",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border border-white/10 animate-ping",style:{animationDuration:"3.5s",animationDelay:"0.5s"}}),r.jsx(Cs,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 text-amber-400/40"})]}),r.jsx(vs,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(vs,{className:"absolute bottom-[15%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse",style:{animationDelay:"0.5s"}}),r.jsx(Ux,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),Yht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-200/20 via-rose-100/10 to-purple-200/15"}),r.jsx("div",{className:"absolute top-[5%] left-[5%] opacity-20",children:r.jsx(im,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(im,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(im,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(im,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(oa,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(oa,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-300/40 fill-pink-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(oa,{className:"absolute top-[10%] left-[60%] w-4 h-4 text-rose-400/30 fill-rose-400/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx("div",{className:"absolute top-[8%] left-[45%] w-8 h-8 rounded-full bg-pink-300/10 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[30%] w-6 h-6 rounded-full bg-rose-300/10 blur-sm"})]}),Xht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/5 via-slate-800/3 to-indigo-900/5"}),r.jsx("div",{className:"absolute top-[5%] right-[10%] opacity-15",children:r.jsxs("div",{className:"w-12 h-24 relative",children:[r.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-10 h-3 bg-blue-600 rounded-full"}),r.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-[20px] border-r-[20px] border-t-[60px] border-l-transparent border-r-transparent border-t-blue-500"})]})}),r.jsx(Pl,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(vs,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(Pl,{className:"absolute bottom-[20%] right-[8%] w-14 h-14 text-indigo-500/12"}),r.jsx("div",{className:"absolute top-[3%] left-[40%] opacity-12",children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tr-none rotate-6"}),r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tl-none -rotate-6"})]})}),r.jsx(vs,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(vs,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),Qht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-pink-100/20 via-purple-100/15 to-sky-100/20"}),r.jsx("div",{className:"absolute top-[5%] left-[8%] w-12 h-16 rounded-full bg-gradient-to-b from-pink-300/25 to-pink-400/18 rotate-12"}),r.jsx("div",{className:"absolute top-[8%] right-[12%] w-10 h-14 rounded-full bg-gradient-to-b from-purple-300/25 to-purple-400/18 -rotate-6"}),r.jsx("div",{className:"absolute bottom-[18%] left-[15%] w-11 h-15 rounded-full bg-gradient-to-b from-sky-300/20 to-sky-400/12 rotate-6"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-12 h-16 rounded-full bg-gradient-to-b from-yellow-300/20 to-yellow-400/12 -rotate-12"}),r.jsx("div",{className:"absolute top-[10%] left-[10%] w-6 h-1 bg-white/30 rounded-full rotate-12"}),r.jsx("div",{className:"absolute top-[12%] right-[15%] w-5 h-1 bg-white/25 rounded-full -rotate-6"}),r.jsx(im,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(im,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(tS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),Jht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/12 via-purple-900/8 to-slate-900/12"}),r.jsx(gj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(gj,{className:"absolute top-[10%] right-[12%] w-12 h-12 text-purple-400/20 animate-pulse"}),r.jsxs("div",{className:"absolute bottom-[18%] left-[8%]",children:[r.jsx("div",{className:"w-14 h-12 rounded-full bg-orange-500/20"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-4 bg-green-600/25 rounded-t-full"})]}),r.jsxs("div",{className:"absolute bottom-[22%] right-[12%]",children:[r.jsx("div",{className:"w-12 h-10 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 w-1.5 h-3 bg-green-600/20 rounded-t-full"})]}),r.jsx("div",{className:"absolute top-[15%] left-[40%] opacity-20",children:r.jsx("svg",{viewBox:"0 0 24 12",className:"w-10 h-5 text-slate-800 fill-current",children:r.jsx("path",{d:"M12 6c-2-4-6-6-12-6 4 2 6 4 6 6s-2 4-6 6c6 0 10-2 12-6zm0 0c2-4 6-6 12-6-4 2-6 4-6 6s2 4 6 6c-6 0-10-2-12-6z"})})}),r.jsx(Cs,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Cs,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),eft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-900/8 via-green-900/5 to-emerald-900/8"}),r.jsx(b1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(b1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(b1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx(q0,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(q0,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(q0,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(q0,{className:"absolute top-[8%] left-[70%] w-8 h-8 text-blue-200/20 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[12%] left-[10%] w-5 h-5 rounded-full bg-red-500/25"}),r.jsx("div",{className:"absolute top-[15%] right-[15%] w-4 h-4 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"absolute top-[20%] left-[55%] w-4 h-4 rounded-full bg-green-500/20"}),r.jsx(vs,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),tft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/10 via-amber-800/6 to-red-900/10"}),r.jsx("div",{className:"absolute top-[5%] left-[10%] w-10 h-8 rounded-full bg-orange-500/25 rotate-45"}),r.jsx("div",{className:"absolute top-[10%] right-[15%] w-8 h-6 rounded-full bg-red-500/20 -rotate-12"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-7 h-5 rounded-full bg-amber-500/22 rotate-30"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-10 h-7 rounded-full bg-yellow-600/18 -rotate-45"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-9 h-6 rounded-full bg-orange-600/15 rotate-12"}),r.jsxs("div",{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2",children:[r.jsx("div",{className:"w-16 h-14 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-5 bg-green-600/18 rounded-t-full"})]}),r.jsx(oa,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(oa,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),rft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-900/8 via-amber-900/4 to-purple-900/8"}),r.jsx(vs,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(vs,{className:"absolute top-[8%] right-[12%] w-10 h-10 text-amber-400/30 fill-amber-400/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(vs,{className:"absolute top-[15%] left-[40%] w-7 h-7 text-yellow-300/25 fill-yellow-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(vs,{className:"absolute top-[12%] right-[35%] w-8 h-8 text-amber-300/28 fill-amber-300/18 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[20%] left-[25%] w-4 h-4 rounded-full bg-pink-400/30"}),r.jsx("div",{className:"absolute top-[18%] right-[30%] w-3 h-3 rounded-full bg-sky-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[60%] w-2.5 h-2.5 rounded-full bg-emerald-400/30"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-3 h-3 rounded-full bg-purple-400/30"}),r.jsx(Cs,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(Sc,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(Sc,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),nft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsxs("div",{className:"absolute bottom-[12%] left-1/2 -translate-x-1/2 flex items-end gap-3",children:[r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2.5 h-20 bg-blue-500/22 rounded-full"})," ",r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"})]}),r.jsx("div",{className:"absolute bottom-[38%] left-[calc(50%-42px)] w-3 h-4 bg-yellow-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[35%] left-[calc(50%-28px)] w-2.5 h-3 bg-yellow-300/25 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[40%] left-[calc(50%-14px)] w-3 h-4 bg-amber-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[45%] left-1/2 -translate-x-1/2 w-4 h-5 bg-yellow-400/35 rounded-full blur-sm"}),r.jsx(vs,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Cs,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Cs,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),sft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/12 via-emerald-900/6 to-teal-900/10"}),r.jsx(Ox,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(Ox,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(Ox,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(Ox,{className:"absolute bottom-[22%] right-[10%] w-11 h-11 text-emerald-400/18"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-6 h-6 rounded-full bg-yellow-500/30 border-2 border-yellow-600/25"}),r.jsx("div",{className:"absolute top-[20%] right-[28%] w-5 h-5 rounded-full bg-amber-500/25 border-2 border-amber-600/20"}),r.jsx("div",{className:"absolute bottom-[28%] left-[45%] w-5 h-5 rounded-full bg-yellow-400/25 border-2 border-yellow-500/20"}),r.jsx("div",{className:"absolute top-0 right-0 w-48 h-48 opacity-12 rounded-bl-full overflow-hidden",children:r.jsx("div",{className:"absolute inset-0 bg-gradient-to-bl from-red-400/60 via-yellow-400/60 to-green-400/60"})}),r.jsxs("div",{className:"absolute bottom-[10%] right-[5%] opacity-15",children:[r.jsx("div",{className:"w-12 h-8 bg-slate-700 rounded-b-full"}),r.jsx("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 w-10 h-3 bg-slate-600 rounded-full"}),r.jsxs("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 flex gap-0.5",children:[r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-amber-400"}),r.jsx("div",{className:"w-2 h-2 rounded-full bg-yellow-400"})]})]})]}),ift=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsx("div",{className:"absolute top-[8%] left-[12%] w-16 h-16 rounded-full border-4 border-blue-500/18"}),r.jsx("div",{className:"absolute top-[10%] right-[10%] w-14 h-14 rounded-full border-4 border-indigo-500/15"}),r.jsx("div",{className:"absolute bottom-[18%] left-[18%] w-12 h-12 rounded-full border-3 border-sky-500/12"}),r.jsx(vs,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(vs,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(Pl,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(Pl,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(Ux,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),aft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/6 via-rose-900/6 to-purple-900/6"}),r.jsx(Kh,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-amber-400/18"}),r.jsxs("div",{className:"absolute top-[5%] left-[15%]",children:[r.jsx("div",{className:"w-12 h-14 rounded-full bg-rose-400/25"}),r.jsx("div",{className:"w-0.5 h-10 bg-rose-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[3%] left-[25%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-sky-400/25"}),r.jsx("div",{className:"w-0.5 h-12 bg-sky-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[8%] right-[18%]",children:[r.jsx("div",{className:"w-11 h-13 rounded-full bg-purple-400/25"}),r.jsx("div",{className:"w-0.5 h-9 bg-purple-400/18 mx-auto"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[10%]",children:[r.jsx("div",{className:"w-10 h-12 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"w-0.5 h-11 bg-amber-400/18 mx-auto"})]}),r.jsx("div",{className:"absolute top-[20%] left-[35%] w-3 h-3 bg-pink-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[18%] right-[40%] w-2.5 h-2.5 bg-emerald-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-2 h-2 bg-amber-400/35 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[30%] w-2.5 h-2.5 bg-sky-400/35 rounded-full"}),r.jsx(Sc,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(Ha,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),oft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-rose-900/12 via-pink-900/8 to-red-900/12"}),r.jsx(oa,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(oa,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(oa,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(oa,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(oa,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(oa,{className:"absolute top-[20%] right-[35%] w-5 h-5 text-rose-300/35 fill-rose-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(oa,{className:"absolute top-[12%] left-[55%] w-5 h-5 text-red-300/30 fill-red-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(oa,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-400/30 fill-pink-400/15 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[18%] left-[45%] w-8 h-8 rounded-full bg-rose-300/18 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[40%] w-6 h-6 rounded-full bg-pink-300/15 blur-sm"})]}),lft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsxs("div",{className:"absolute top-[5%] right-[12%]",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-yellow-400/25 blur-sm"}),r.jsx(_1,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-14 h-14 text-amber-400/45"})]}),r.jsx("div",{className:"absolute bottom-[12%] left-[20%] w-20 h-10 bg-slate-800/12 rounded-full blur-md"}),r.jsx(_1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(Cs,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(_1,{className:"absolute bottom-[22%] right-[25%] w-8 h-8 text-orange-400/25"}),r.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[15%] bg-gradient-to-t from-amber-900/10 to-transparent"})]}),cft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-cyan-900/6 to-emerald-900/10"}),r.jsx(fi,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(fi,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(Yh,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(Yh,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(oa,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(oa,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(Cs,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(Sc,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),dft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-900/10 via-teal-900/6 to-cyan-900/10"}),r.jsx(Sc,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(Sc,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(Yh,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(fi,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(Cs,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Cs,{className:"absolute top-[20%] right-[32%] w-7 h-7 text-cyan-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-3 h-3 bg-amber-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-2.5 h-2.5 bg-teal-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[28%] left-[35%] w-2 h-2 bg-emerald-400/30 rounded-full"})]}),uft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsx(Yh,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(Yh,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(Yh,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(fi,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(Sc,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(Cs,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(vs,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),hft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-emerald-900/6 to-green-900/10"}),r.jsx(fi,{className:"absolute bottom-[10%] left-[50%] -translate-x-1/2 w-20 h-20 text-teal-500/22"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-12 h-10 bg-amber-400/18 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[20%] left-[20%] w-10 h-8 bg-orange-400/15 rounded-sm"}),r.jsx("div",{className:"absolute bottom-[16%] right-[15%] w-11 h-9 bg-amber-300/18 rounded-sm"}),r.jsx(Yh,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(oa,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(Cs,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(c1,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),_ke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute top-4 left-[10%] w-3 h-3 bg-amber-400/60 rounded-full animate-pulse"}),r.jsx("div",{className:"absolute top-12 right-[15%] w-2 h-2 bg-rose-400/60 rounded-full animate-pulse delay-100"}),r.jsx("div",{className:"absolute top-8 left-[30%] w-2.5 h-2.5 bg-sky-400/60 rounded-full animate-pulse delay-200"}),r.jsx("div",{className:"absolute top-16 right-[25%] w-2 h-2 bg-emerald-400/60 rounded-full animate-pulse delay-300"})]}),fft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(oa,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(oa,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(oa,{className:"absolute top-4 left-[40%] w-2.5 h-2.5 text-rose-400/40 fill-rose-400/20 animate-pulse delay-300"}),r.jsx(oa,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),pft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(c1,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(Cs,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(fi,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),mft=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(fj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(hS,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(fj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),$M=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Cs,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(Sc,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Cs,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),bke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(fi,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Cs,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(fi,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),Mhe=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Cs,{className:"h-5 w-5"}),category:"general",headerText:()=>"Video Message",subText:"A personal video just for you",gradientClasses:"from-background to-muted/30",accentColor:"primary"},{id:"thank_you",name:"Thank You",description:"Express your gratitude",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thank You, ${e}!`:"Thank You!",subText:"Your support means the world to me",gradientClasses:"from-rose-50/70 via-pink-50/50 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(fft,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(AT,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thinking of You, ${e}`:"Thinking of You",subText:"Just wanted to reach out and say hello",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx($M,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(fj,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Hey ${e}!`:"Hey There!",subText:"Just checking in to see how you're doing",gradientClasses:"from-amber-50/70 via-orange-50/50 to-yellow-50/40 dark:from-amber-950/30 dark:via-orange-950/20 dark:to-yellow-950/20",accentColor:"amber",decorativeElement:r.jsx(mft,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(ac,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Market Update for ${e}`:"Market Update",subText:"The latest insights from your local market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue"},{id:"referral_thank_you",name:"Referral Thank You",description:"Thank someone for a referral",icon:r.jsx(Vn,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thank You for the Referral, ${e}!`:"Thank You for the Referral!",subText:"Your trust in me means everything",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx($M,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"So proud of your accomplishment",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(_ke,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(ml,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Welcome to the Neighborhood, ${e}!`:"Welcome to the Neighborhood!",subText:"So excited to have you as our new neighbor",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-sky-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-sky-950/20",accentColor:"teal",decorativeElement:r.jsx(bke,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(hS,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Hey ${e}!`:"Hey There!",subText:"No reason needed – just wanted to connect",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx($M,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(Kh,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Birthday, ${e}!`:"Happy Birthday!",subText:"Wishing you an amazing year ahead",gradientClasses:"from-amber-50/80 via-rose-50/60 to-purple-50/40 dark:from-amber-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"amber",decorativeElement:r.jsx(aft,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Valentine's Day, ${e}!`:"Happy Valentine's Day!",subText:"A heartfelt message from your real estate professional",gradientClasses:"from-rose-50/80 via-pink-50/60 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(oft,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(_1,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Groundhog Day, ${e}!`:"Happy Groundhog Day!",subText:"Wishing you an early spring!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(lft,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(vs,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy New Year, ${e}!`:"Happy New Year!",subText:"Wishing you a year full of success and happiness",gradientClasses:"from-yellow-50/70 via-amber-50/50 to-orange-50/40 dark:from-yellow-950/30 dark:via-amber-950/20 dark:to-orange-950/20",accentColor:"yellow",decorativeElement:r.jsx(rft,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(tS,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Easter, ${e}!`:"Happy Easter!",subText:"Wishing you a joyful celebration",gradientClasses:"from-pink-50/70 via-purple-50/50 to-sky-50/40 dark:from-pink-950/30 dark:via-purple-950/20 dark:to-sky-950/20",accentColor:"pink",decorativeElement:r.jsx(Qht,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(im,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Mother's Day, ${e}!`:"Happy Mother's Day!",subText:"Celebrating the wonderful mothers in our lives",gradientClasses:"from-pink-50/70 via-rose-50/50 to-purple-50/40 dark:from-pink-950/30 dark:via-rose-950/20 dark:to-purple-950/20",accentColor:"pink",decorativeElement:r.jsx(Yht,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Father's Day, ${e}!`:"Happy Father's Day!",subText:"Celebrating the wonderful fathers in our lives",gradientClasses:"from-blue-50/70 via-sky-50/50 to-indigo-50/40 dark:from-blue-950/30 dark:via-sky-950/20 dark:to-indigo-950/20",accentColor:"blue",decorativeElement:r.jsx(Xht,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(Ux,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Memorial Day, ${e}`:"Happy Memorial Day",subText:"Honoring those who served our country",gradientClasses:"from-red-50/60 via-white to-blue-50/60 dark:from-red-950/30 dark:via-slate-950/20 dark:to-blue-950/30",accentColor:"blue",decorativeElement:r.jsx(Kht,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(Zh,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy 4th of July, ${e}!`:"Happy 4th of July!",subText:"Celebrating freedom and independence",gradientClasses:"from-red-50/70 via-white to-blue-50/70 dark:from-red-950/30 dark:via-slate-950/10 dark:to-blue-950/30",accentColor:"red",decorativeElement:r.jsx(Zht,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Labor Day, ${e}!`:"Happy Labor Day!",subText:"Celebrating the hard work that builds our communities",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(ift,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(gj,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Halloween, ${e}!`:"Happy Halloween!",subText:"Have a spooktacular day!",gradientClasses:"from-orange-50/70 via-amber-50/50 to-purple-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-purple-950/30",accentColor:"orange",decorativeElement:r.jsx(Jht,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(oa,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Thanksgiving, ${e}!`:"Happy Thanksgiving!",subText:"Grateful for you and your friendship",gradientClasses:"from-orange-50/70 via-amber-50/50 to-red-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-red-950/20",accentColor:"orange",decorativeElement:r.jsx(tft,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(b1,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Merry Christmas, ${e}!`:"Merry Christmas!",subText:"Wishing you joy and peace this holiday season",gradientClasses:"from-red-50/70 via-green-50/40 to-emerald-50/40 dark:from-red-950/30 dark:via-green-950/20 dark:to-emerald-950/20",accentColor:"red",decorativeElement:r.jsx(eft,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Cs,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Hanukkah, ${e}!`:"Happy Hanukkah!",subText:"Wishing you eight nights of light and joy",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(nft,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(Ox,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy St. Patrick's Day, ${e}!`:"Happy St. Patrick's Day!",subText:"Wishing you the luck of the Irish!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx(sft,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(fi,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Happy Home Anniversary, ${e}!`:"Happy Home Anniversary!",subText:"Celebrating another year in your beautiful home",gradientClasses:"from-teal-50/70 via-cyan-50/50 to-emerald-50/40 dark:from-teal-950/30 dark:via-cyan-950/20 dark:to-emerald-950/20",accentColor:"teal",decorativeElement:r.jsx(cft,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(Sc,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"You're under contract – exciting times ahead!",gradientClasses:"from-emerald-50/70 via-teal-50/50 to-cyan-50/40 dark:from-emerald-950/30 dark:via-teal-950/20 dark:to-cyan-950/20",accentColor:"emerald",decorativeElement:r.jsx(dft,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(zs,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Exciting News, ${e}!`:"Just Listed!",subText:"A new property is now on the market",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-violet-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-violet-950/20",accentColor:"blue",decorativeElement:r.jsx(bke,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(ud,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Just Sold!",subText:"Another successful transaction completed",gradientClasses:"from-emerald-50/70 via-green-50/50 to-teal-50/40 dark:from-emerald-950/30 dark:via-green-950/20 dark:to-teal-950/20",accentColor:"emerald",decorativeElement:r.jsx($M,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(w1,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Great News, ${e}!`:"Price Reduced!",subText:"This property just became more affordable",gradientClasses:"from-orange-50/70 via-amber-50/50 to-yellow-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-yellow-950/20",accentColor:"orange"},{id:"open_house",name:"Open House",description:"Invite to an open house event",icon:r.jsx(c1,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`You're Invited, ${e}!`:"You're Invited!",subText:"Join us for an exclusive open house",gradientClasses:"from-sky-50/70 via-blue-50/50 to-indigo-50/40 dark:from-sky-950/30 dark:via-blue-950/20 dark:to-indigo-950/20",accentColor:"sky",decorativeElement:r.jsx(pft,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(Yh,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"It's official – the keys are yours!",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(uft,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(fi,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Welcome Home, ${e}!`:"Welcome Home!",subText:"Wishing you all the best in your new home",gradientClasses:"from-teal-50/70 via-emerald-50/50 to-green-50/40 dark:from-teal-950/30 dark:via-emerald-950/20 dark:to-green-950/20",accentColor:"teal",decorativeElement:r.jsx(hft,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(pd,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Amazing News, ${e}!`:"Offer Accepted!",subText:"Your offer has been accepted – congratulations!",gradientClasses:"from-green-50/70 via-emerald-50/50 to-teal-50/40 dark:from-green-950/30 dark:via-emerald-950/20 dark:to-teal-950/20",accentColor:"green",decorativeElement:r.jsx($M,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(Pl,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"Congratulations!",subText:"You're pre-approved and ready to find your dream home",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(_ke,{})}],gft=[{id:"general",name:"General Touch",description:"Everyday connection templates"},{id:"holidays",name:"Holidays",description:"Seasonal and holiday greetings"},{id:"transactional",name:"Transactional",description:"Real estate milestone templates"}];function xft(e){return Mhe.filter(t=>t.category===e)}function MS(e){return Mhe.find(t=>t.id===e)||Mhe[0]}function yft(){const{shareToken:e}=Wc(),[t,n]=I.useState(null),[s,i]=I.useState(null),[o,l]=I.useState(null),[a,h]=I.useState(!0),[p,x]=I.useState(null),[y,b]=I.useState(!0);I.useEffect(()=>{const q=()=>{['[id*="lc_text_widget"]','[class*="lc-text-widget"]','[id*="chat-widget"]','[class*="chat-widget"]','iframe[src*="widgets.leadconnectorhq"]','iframe[src*="msgsndr"]',"[data-chat-widget]"].forEach(te=>{document.querySelectorAll(te).forEach(ae=>{ae.style.display="none"})})};q();const H=[setTimeout(q,500),setTimeout(q,1500),setTimeout(q,3e3)],K=new MutationObserver(q);return K.observe(document.body,{childList:!0,subtree:!0}),()=>{H.forEach(clearTimeout),K.disconnect()}},[]),I.useEffect(()=>{(async()=>{if(!e){x("Invalid share link"),h(!1);return}const{data:H,error:K}=await J.from("agent_videos").select("id, title, playback_url, thumbnail_url, preview_url, duration_seconds, share_token, owner_user_id, contact_id, page_template, recipient_name").eq("share_token",e).eq("is_deleted",!1).single();if(K||!H){x("Video not found or has been removed"),h(!1);return}n(H);try{await J.rpc("log_video_view",{p_video_id:H.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(Z){console.warn("Failed to log video view:",Z)}if(H.owner_user_id){const{data:Z}=await J.from("profiles").select("id, name, email, phone").eq("id",H.owner_user_id).single();if(Z){i(Z);try{const{data:te}=await J.storage.from("avatars").list(`${H.owner_user_id}`);if(te&&te.length>0){const{data:ae}=J.storage.from("avatars").getPublicUrl(`${H.owner_user_id}/${te[0].name}`);l(ae.publicUrl)}}catch{}}}h(!1)})()},[e]);const j=q=>{if(!q)return"0:00";const H=Math.floor(q/60),K=q%60;return`${H}:${K.toString().padStart(2,"0")}`},N=q=>q.includes("iframe.mediadelivery.net/play/")?q.replace("/play/","/embed/")+"?autoplay=true&responsive=true":q,C=q=>{if(!q)return"?";const H=q.split(" ");return H.length>=2?`${H[0][0]}${H[1][0]}`.toUpperCase():q.substring(0,2).toUpperCase()},A=MS((t==null?void 0:t.page_template)||"default"),E=(t==null?void 0:t.recipient_name)||null,T=A.headerText(E),z=`https://dashboard.relevelup.com/share/video/${e}`;if(a)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-primary"})});if(p||!t)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(Ge,{className:"max-w-md w-full",children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Video Not Found"}),r.jsx("p",{className:"text-muted-foreground",children:p||"This video is no longer available."})]})})});const F=A.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsx("title",{children:T}),r.jsx("meta",{name:"description",content:A.subText}),r.jsx("meta",{property:"og:title",content:T}),r.jsx("meta",{property:"og:description",content:A.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:z}),t.preview_url&&r.jsx("meta",{property:"og:image",content:t.preview_url}),!t.preview_url&&t.thumbnail_url&&r.jsx("meta",{property:"og:image",content:t.thumbnail_url}),t.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{property:"og:video",content:t.playback_url}),r.jsx("meta",{property:"og:video:type",content:"text/html"}),r.jsx("meta",{property:"og:video:width",content:"1280"}),r.jsx("meta",{property:"og:video:height",content:"720"})]}),r.jsx("meta",{name:"twitter:card",content:"player"}),r.jsx("meta",{name:"twitter:title",content:T}),r.jsx("meta",{name:"twitter:description",content:A.subText}),t.preview_url&&r.jsx("meta",{name:"twitter:image",content:t.preview_url}),t.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{name:"twitter:player",content:t.playback_url}),r.jsx("meta",{name:"twitter:player:width",content:"1280"}),r.jsx("meta",{name:"twitter:player:height",content:"720"})]})]}),r.jsxs("div",{className:$t("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",A.gradientClasses),children:[F&&A.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[F&&r.jsxs("div",{className:"text-center py-4 animate-fade-in",children:[r.jsx("div",{className:"flex justify-center mb-3",children:r.jsx("div",{className:$t("w-14 h-14 rounded-full flex items-center justify-center shadow-sm",A.accentColor==="primary"&&"bg-primary/10 text-primary",A.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",A.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",A.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",A.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",A.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",A.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",A.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",A.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",A.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",A.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",A.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",A.accentColor==="sky"&&"bg-sky-100 text-sky-600 dark:bg-sky-900/50 dark:text-sky-400"),children:r.jsx("div",{className:"scale-150",children:A.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:T}),r.jsx("p",{className:"text-muted-foreground",children:A.subText})]}),s&&r.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card/90 backdrop-blur-sm rounded-lg border shadow-sm",children:[r.jsxs(ci,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Ga,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(di,{className:"bg-primary/10 text-primary font-semibold",children:C(s.name)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:F?"A special video from":"A personal video from"}),r.jsx("h2",{className:"text-lg font-semibold truncate",children:s.name||"Your Agent"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Real Estate Professional"})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[s.phone&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`tel:${s.phone}`,"aria-label":"Call agent",children:r.jsx(ca,{className:"h-4 w-4"})})}),s.email&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`mailto:${s.email}`,"aria-label":"Email agent",children:r.jsx(Ys,{className:"h-4 w-4"})})})]})]}),r.jsx(Ge,{className:"overflow-hidden shadow-lg",children:y&&t.playback_url?r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:r.jsx("iframe",{src:N(t.playback_url),title:t.title||"Video message",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>b(!0),children:[t.preview_url||t.thumbnail_url?r.jsx("img",{src:t.preview_url||t.thumbnail_url||"",alt:t.title?`${t.title} video preview`:"Video message preview",className:"w-full h-full object-cover",onError:q=>{var K;q.currentTarget.style.display="none";const H=(K=q.currentTarget.parentElement)==null?void 0:K.querySelector(".video-fallback");H&&(H.style.display="flex")}}):null,r.jsx("div",{className:"video-fallback w-full h-full items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",style:{display:t.preview_url||t.thumbnail_url?"none":"flex"},children:r.jsx(Fi,{className:"h-16 w-16 text-primary/50"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 group-hover:bg-black/40 transition-colors",children:r.jsx("div",{className:"w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-lg transform group-hover:scale-105 transition-transform",children:r.jsx(dc,{className:"h-10 w-10 text-primary ml-1"})})}),t.duration_seconds&&r.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 text-white text-sm px-2 py-1 rounded",children:j(t.duration_seconds)})]})}),!F&&r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold",children:t.title||"Video Message"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:y?"Enjoy the video!":"Click to play the video"})]}),!y&&r.jsx("div",{className:"flex justify-center",children:r.jsxs(ee,{size:"lg",onClick:()=>b(!0),className:"gap-2",children:[r.jsx(dc,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Ght,{shareToken:e,agentName:(s==null?void 0:s.name)||null,hasContact:!!t.contact_id})]})]})]})}function vft(){return I.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(YJe,{})}function _ft(){const{token:e}=Wc();return I.useEffect(()=>{if(!e)return;const t=`https://relzejiswnotikjgvjhz.supabase.co/functions/v1/video-og-image?token=${e}`;window.location.replace(t)},[e]),r.jsx("main",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[r.jsx(nn,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const bft={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},wft={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},i4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function jft(){var ne,ge,ie,fe;const{slugOrId:e}=Wc(),[t]=Fd(),{data:n,isLoading:s}=f6e(e||""),i=p6e(),o=nit(),l=t.get("ref"),[a,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,N]=I.useState(""),[C,A]=I.useState(!1),[E,T]=I.useState(!1),[L,z]=I.useState(null),[F,q]=I.useState(!1);I.useEffect(()=>{l&&o.mutate(l)},[l]);const H=de=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(de),K=async de=>{if(de.preventDefault(),!(!a.trim()||!y.trim()||!n)){A(!0);try{await i.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:a.trim(),lastName:p.trim(),email:y.trim(),phone:j.trim(),shareToken:l}),T(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(ye){console.error("Lead submission error:",ye),ze.error(`Failed to submit: ${ye.message||"Please try again"}`)}finally{A(!1)}}},Z=(n==null?void 0:n.photos)||[],te=Z.find(de=>de.is_primary)||Z[0],ae=()=>{L!==null&&z(L===0?Z.length-1:L-1)},le=()=>{L!==null&&z(L===Z.length-1?0:L+1)};if(s)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Pr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Pr,{className:"h-10 w-48 mb-6"}),r.jsx(Pr,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Pr,{className:"h-12 w-48"}),r.jsx(Pr,{className:"h-6 w-full"}),r.jsx(Pr,{className:"h-6 w-3/4"})]}),r.jsx(Pr,{className:"h-64"})]})]})]});if(!n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(uo,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(fi,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(ee,{asChild:!0,children:r.jsx(uo,{to:"/public/listings",children:"Browse All Listings"})})]})]});const ve=n.property_address?`${n.property_address} - ${n.city}, ${n.state}`:`${n.city}, ${n.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[ve," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${i4[n.property_type]} in ${n.city}, ${n.state}. ${((ne=n.description)==null?void 0:ne.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:ve}),r.jsx("meta",{property:"og:description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${i4[n.property_type]} in ${n.city}, ${n.state}. View photos, details, and contact the listing agent.`}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:`https://listings.relevelup.com/${n.slug||n.id}`}),te&&r.jsx("meta",{property:"og:image",content:te.photo_url}),te&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${i4[n.property_type]} for sale`}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:ve}),r.jsx("meta",{name:"twitter:description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),te&&r.jsx("meta",{name:"twitter:image",content:te.photo_url}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"geo.region",content:`US-${n.state}`}),r.jsx("meta",{name:"geo.placename",content:n.city}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:n.property_address||`${n.city}, ${n.state} Home`,description:n.description||`${i4[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:Z.map(de=>de.photo_url),address:{"@type":"PostalAddress",streetAddress:n.property_address||void 0,addressLocality:n.city,addressRegion:n.state,addressCountry:"US"},geo:n.neighborhood?{"@type":"GeoCoordinates",name:n.neighborhood}:void 0,offers:{"@type":"Offer",price:n.price,priceCurrency:"USD",availability:n.status==="sold"?"https://schema.org/SoldOut":n.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:n.bedrooms||void 0,numberOfBathroomsTotal:n.bathrooms||void 0,floorSize:n.square_footage?{"@type":"QuantitativeValue",value:n.square_footage,unitCode:"FTK"}:void 0,yearBuilt:n.year_built||void 0,broker:n.agent?{"@type":"RealEstateAgent",name:n.agent.name,email:n.agent.email,worksFor:(ge=n.agent.brokerage)!=null&&ge.name?{"@type":"RealEstateAgent",name:n.agent.brokerage.name}:void 0}:void 0})})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(uo,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(uo,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),Z.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>z(0),children:r.jsx("img",{src:te==null?void 0:te.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${i4[n.property_type]} main photo`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:Z.slice(1,5).map((de,ye)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>z(ye+1),children:[r.jsx("img",{src:de.photo_url,alt:`${n.property_address||n.city} - Photo ${ye+2} of ${Z.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ye===3&&Z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",Z.length-5," more"]})]},de.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Rt,{className:`${bft[n.status]} text-white border-0`,children:wft[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:H(n.price)}),n.property_address&&r.jsx("p",{className:"text-xl font-medium",children:n.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(ml,{className:"h-4 w-4"}),n.city,", ",n.state,n.neighborhood&&` • ${n.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[n.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Hf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),n.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Vf,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),n.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(ym,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),n.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(zs,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Rt,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),i4[n.property_type]]}),n.lot_size&&r.jsxs(Rt,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Rt,{variant:"secondary",children:"HOA"})]}),n.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})]}),n.agent_notes&&n.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.agent_notes})]}),n.mls_link&&r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[n.video&&n.video.playback_url&&r.jsx(Ge,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(Xe,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>q(!0),children:[n.video.thumbnail_url?r.jsx("img",{src:n.video.thumbnail_url,alt:"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/30",children:r.jsx(Fi,{className:"h-12 w-12 text-primary"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 group-hover:bg-black/40 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"h-16 w-16 rounded-full bg-white/90 group-hover:bg-white flex items-center justify-center transition-colors shadow-lg",children:r.jsx(dc,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(ee,{onClick:()=>q(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(dc,{className:"h-4 w-4"}),"Watch Video Tour"]}),n.video.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate",children:n.video.title})]})]})}),n.agent&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Cc,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((ie=n.agent.brokerage)==null?void 0:ie.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(Ge,{className:"border-primary",children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(Xe,{children:E?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(Ys,{className:"h-6 w-6 text-primary"})}),r.jsx("p",{className:"font-medium",children:"Thanks for your interest!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The listing agent will contact you soon."})]}):r.jsxs("form",{onSubmit:K,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"firstName",children:"First Name *"}),r.jsx(at,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:de=>h(de.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"lastName",children:"Last Name"}),r.jsx(at,{id:"lastName",type:"text",placeholder:"Doe",value:p,onChange:de=>x(de.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"email",children:"Email *"}),r.jsx(at,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:de=>b(de.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"phone",children:"Phone"}),r.jsx(at,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:j,onChange:de=>N(de.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:C,children:C?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Br,{open:L!==null,onOpenChange:()=>z(null),children:r.jsxs(Fr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(Hr,{className:"sr-only",children:r.jsx(qr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>z(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(bs,{className:"h-5 w-5"})}),L!==null&&Z[L]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Z[L].photo_url,alt:`Photo ${L+1}`,className:"w-full max-h-[80vh] object-contain"}),Z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:ae,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:le,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Ka,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[L+1," / ",Z.length]})]})]})]})}),r.jsx(Br,{open:F,onOpenChange:q,children:r.jsxs(Fr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(Hr,{className:"sr-only",children:r.jsx(qr,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>q(!1),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(bs,{className:"h-5 w-5"})}),((fe=n==null?void 0:n.video)==null?void 0:fe.playback_url)&&r.jsx("div",{className:"aspect-video w-full",children:r.jsx("iframe",{src:n.video.playback_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function kft(){var o;const{slug:e}=Wc(),{data:t,isLoading:n,error:s}=y6e(e);if(I.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),I.useEffect(()=>{t!=null&&t.id&&Sa(t.id,"card_view")},[t==null?void 0:t.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Pr,{className:"h-28 w-28 rounded-full"}),r.jsx(Pr,{className:"h-6 w-48"}),r.jsx(Pr,{className:"h-4 w-36"})]}),r.jsx(Pr,{className:"h-12 w-full"}),r.jsx(Pr,{className:"h-12 w-full"})]})});if(s||!t)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const i=((o=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(np,{children:[r.jsxs("title",{children:[i," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.positioning_statement||`Connect with ${i}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${i} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:t.positioning_statement||`Connect with ${i}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(Ege,{card:t})]})}function UM({banners:e,autoPlayInterval:t=5e3,className:n}){const[s,i]=I.useState(0),[o,l]=I.useState(!1),a=I.useCallback(()=>{i(y=>(y+1)%e.length)},[e.length]),h=I.useCallback(()=>{i(y=>(y-1+e.length)%e.length)},[e.length]),p=I.useCallback(y=>{i(y)},[]);if(I.useEffect(()=>{if(e.length<=1||o)return;const y=setInterval(a,t);return()=>clearInterval(y)},[e.length,o,t,a]),!e||e.length===0)return null;const x=e[s];return r.jsxs("div",{className:$t("relative w-full overflow-hidden rounded-xl",n),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[r.jsxs("div",{className:"relative aspect-[21/9] md:aspect-[3/1] w-full",children:[r.jsxs("div",{className:"absolute inset-0 transition-opacity duration-500",children:[r.jsx("img",{src:x.image_url,alt:x.title,className:"w-full h-full object-cover"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent"})]}),r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-8 text-white",children:[r.jsx("h2",{className:"text-xl md:text-3xl font-bold mb-2 drop-shadow-lg",children:x.title}),x.description&&r.jsx("p",{className:"text-sm md:text-base text-white/90 mb-4 max-w-2xl drop-shadow",children:x.description}),x.link_url&&r.jsx("a",{href:x.link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:r.jsx(ee,{variant:"secondary",className:"bg-white/90 hover:bg-white text-foreground font-semibold",children:x.link_text||"Learn More"})})]}),e.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:$t("absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:h,children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:$t("absolute right-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:a,children:r.jsx(Ka,{className:"h-6 w-6"})})]})]}),e.length>1&&r.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex gap-2",children:e.map((y,b)=>r.jsx("button",{onClick:()=>p(b),className:$t("w-2 h-2 rounded-full transition-all duration-300",b===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${b+1}`},b))})]})}function Nft(e){return"EST"}function oE(e){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(e),s=Nft();return`${n} ${s}`}function TS(e){const t=new Date,n=new Date(e),s=nke(n,-15),i=nke(n,30);return t>i?"ended":dke(t,{start:n,end:i})?"live":dke(t,{start:s,end:n})?"starting_soon":"upcoming"}function vxe(e){const t=TS(e);return t==="starting_soon"||t==="live"}const wke=vxe,Sft=({events:e,registrations:t,onNavigateToEvents:n})=>{const[s,i]=I.useState(new Date);I.useEffect(()=>{const j=setInterval(()=>{i(new Date)},3e4);return()=>clearInterval(j)},[]);const o=e.filter(j=>vxe(j.event_date));if(o.length===0)return null;const l=o[0],a=TS(l.event_date),h=t.find(j=>j.event_id===l.id),p=(h==null?void 0:h.zoom_join_url)||l.zoom_link,x=!!h,y=a==="live",b=y?{container:"from-red-500/10 via-red-500/5 to-primary/10 border-red-500/30",pulse:"from-red-500/5",indicator:"bg-red-500",text:"text-red-500",button:"bg-red-500 hover:bg-red-600",outlineButton:"border-red-500/50 text-red-500 hover:bg-red-500/10"}:{container:"from-amber-500/10 via-amber-500/5 to-primary/10 border-amber-500/30",pulse:"from-amber-500/5",indicator:"bg-amber-500",text:"text-amber-500",button:"bg-amber-500 hover:bg-amber-600",outlineButton:"border-amber-500/50 text-amber-500 hover:bg-amber-500/10"};return r.jsxs("div",{className:`relative mb-8 overflow-hidden rounded-xl bg-gradient-to-r ${b.container} border`,children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${b.pulse} to-transparent animate-pulse`}),r.jsx("div",{className:"relative p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex items-center justify-center",children:[r.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${b.indicator} opacity-75`}),r.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${b.indicator}`})]}),r.jsx("div",{className:`flex items-center gap-2 ${b.text} font-bold text-sm uppercase tracking-wider`,children:y?r.jsxs(r.Fragment,{children:[r.jsx(bj,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ki,{className:"h-4 w-4"}),"Starting Soon"]})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg text-foreground line-clamp-1",children:l.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:y?`Started at ${oE(new Date(l.event_date))}`:`Starts at ${oE(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(ee,{onClick:()=>window.open(p,"_blank"),className:`${b.button} text-white gap-2`,children:[r.jsx(Fs,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(ee,{variant:"outline",onClick:n,className:`${b.outlineButton} gap-2`,children:[r.jsx(Vn,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var _xe="Progress",bxe=100,[Cft]=Ql(_xe),[Mft,Tft]=Cft(_xe),hOe=I.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:i,getValueLabel:o=Aft,...l}=e;(i||i===0)&&!jke(i)&&console.error(Eft(`${i}`,"Progress"));const a=jke(i)?i:bxe;s!==null&&!kke(s,a)&&console.error(Ift(`${s}`,"Progress"));const h=kke(s,a)?s:null,p=vte(h)?o(h,a):void 0;return r.jsx(Mft,{scope:n,value:h,max:a,children:r.jsx(Rn.div,{"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":vte(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":mOe(h,a),"data-value":h??void 0,"data-max":a,...l,ref:t})})});hOe.displayName=_xe;var fOe="ProgressIndicator",pOe=I.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,i=Tft(fOe,n);return r.jsx(Rn.div,{"data-state":mOe(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...s,ref:t})});pOe.displayName=fOe;function Aft(e,t){return`${Math.round(e/t*100)}%`}function mOe(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function vte(e){return typeof e=="number"}function jke(e){return vte(e)&&!isNaN(e)&&e>0}function kke(e,t){return vte(e)&&!isNaN(e)&&e<=t&&e>=0}function Eft(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${bxe}\`.`}function Ift(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${bxe} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var gOe=hOe,Pft=pOe;const Hc=I.forwardRef(({className:e,value:t,...n},s)=>r.jsx(gOe,{ref:s,className:$t("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:r.jsx(Pft,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Hc.displayName=gOe.displayName;function Lft(){const{user:e,isBrokerageManager:t}=zr(),[n,s]=I.useState([]),[i,o]=I.useState([]),[l,a]=I.useState(!1),[h,p]=I.useState(!0),x=t?"brokerage_manager":"agent";I.useEffect(()=>{if(!(e!=null&&e.id)){p(!1);return}y()},[e==null?void 0:e.id,x]);const y=async()=>{if(e!=null&&e.id)try{const{data:z,error:F}=await J.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(F)throw F;const{data:q,error:H}=await J.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",e.id);if(H)throw H;const{data:K,error:Z}=await J.from("onboarding_checklist_dismissed").select("id").eq("user_id",e.id).maybeSingle();if(Z)throw Z;s(z||[]),o(q||[]),a(!!K),z&&z.length>0&&await b(z,q||[])}catch(z){console.error("Error fetching checklist data:",z)}finally{p(!1)}},b=async(z,F)=>{var Te,Ve;if(!(e!=null&&e.id))return;const q=F.map(Fe=>Fe.item_id),H=z.filter(Fe=>!q.includes(Fe.id));if(H.length===0)return;const[K,Z,te,ae,le,ve,ne,ge,ie,fe,de,ye,Ie,Ne]=await Promise.all([J.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle(),J.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",e.id),J.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",e.id),J.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",e.id),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","template"),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","academy_video"),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","toolbox"),J.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id),J.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),J.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),J.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),J.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),J.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",e.id),J.from("innercircle_contacts").select("id").eq("owner_user_id",e.id)]),we={},he=(Te=K.data)==null?void 0:Te.brokerage_id;we.share_resource=(Z.count||0)>0,we.post_community=(te.count||0)>0,we.register_event=(ae.count||0)>0,we.view_template=(le.count||0)>0,we.watch_academy=(ve.count||0)>0,we.use_toolbox=(ne.count||0)>0,we.launch_app=(ge.count||0)>0,we.add_contact=(ie.count||0)>0,we.create_video=(fe.count||0)>0,we.complete_touch=(de.count||0)>0,we.add_transaction=(ye.count||0)>0,we.add_listing=(Ie.count||0)>0;const xe=((Ve=Ne.data)==null?void 0:Ve.map(Fe=>Fe.id))||[],be=[];he?be.push(J.from("profiles").select("id").eq("brokerage_id",he).neq("id",e.id).then(Fe=>{var Me;we.add_agent=(((Me=Fe.data)==null?void 0:Me.length)||0)>0})):we.add_agent=!1,xe.length>0?(be.push(J.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",xe).then(Fe=>{we.add_plan=(Fe.count||0)>0})),be.push(J.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",xe).then(Fe=>{we.schedule_popby=(Fe.count||0)>0}))):(we.add_plan=!1,we.schedule_popby=!1),await Promise.all(be);const Oe=H.filter(Fe=>we[Fe.action_type]);if(Oe.length>0){const Fe=Oe.map(Qe=>({user_id:e.id,item_id:Qe.id})),{error:Me}=await J.from("onboarding_checklist_progress").upsert(Fe,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!Me){const Qe=Oe.map(Ee=>({item_id:Ee.id,completed_at:new Date().toISOString()}));o(Ee=>[...Ee,...Qe])}}},j=async z=>{if(e!=null&&e.id)try{const{error:F}=await J.from("onboarding_checklist_progress").insert({user_id:e.id,item_id:z});if(F)throw F;o(q=>[...q,{item_id:z,completed_at:new Date().toISOString()}])}catch(F){console.error("Error marking item complete:",F)}},N=async()=>{if(e!=null&&e.id)try{const{error:z}=await J.from("onboarding_checklist_dismissed").insert({user_id:e.id});if(z)throw z;a(!0)}catch(z){console.error("Error dismissing checklist:",z)}},C=i.length,A=n.length,E=A>0&&C>=A,T=A>0?C/A*100:0;return{items:n,progress:i,isDismissed:l,loading:h,completedCount:C,totalCount:A,isComplete:E,progressPercentage:T,isItemComplete:z=>i.some(F=>F.item_id===z),markComplete:j,dismiss:N,refetch:y}}const Oft={add_agent:r.jsx(Vn,{className:"h-4 w-4"}),share_resource:r.jsx(uc,{className:"h-4 w-4"}),post_community:r.jsx(Po,{className:"h-4 w-4"}),register_event:r.jsx(zs,{className:"h-4 w-4"}),view_template:r.jsx(p0,{className:"h-4 w-4"}),watch_academy:r.jsx(f1,{className:"h-4 w-4"}),use_toolbox:r.jsx(Zx,{className:"h-4 w-4"}),launch_app:r.jsx(MT,{className:"h-4 w-4"})};function Dft(){const{items:e,isDismissed:t,loading:n,completedCount:s,totalCount:i,isComplete:o,progressPercentage:l,isItemComplete:a,markComplete:h,dismiss:p}=Lft(),[x,y]=I.useState(!0);return n||t||i===0||o?null:r.jsxs(Ge,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(wg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"Get Started with LevelUp"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Complete these steps to make the most of your membership"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>y(!x),className:"h-8 w-8 p-0",children:x?r.jsx(a1,{className:"h-4 w-4"}):r.jsx(Pu,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(bs,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Progress"}),r.jsxs("span",{className:"font-medium",children:[s," of ",i," complete"]})]}),r.jsx(Hc,{value:l,className:"h-2"})]})]}),x&&r.jsx(Xe,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:e.map(b=>{const j=a(b.id);return r.jsxs("div",{className:$t("flex items-start gap-3 p-3 rounded-lg transition-colors",j?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>!j&&h(b.id),children:[r.jsx("div",{className:"mt-0.5",children:j?r.jsx(Ya,{className:"h-5 w-5 text-primary"}):r.jsx(Lu,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-foreground",children:Oft[b.action_type]||r.jsx(Lu,{className:"h-4 w-4"})}),r.jsx("span",{className:$t("font-medium",j&&"line-through text-muted-foreground"),children:b.title})]}),b.description&&r.jsx("p",{className:$t("text-sm text-muted-foreground mt-1",j&&"line-through"),children:b.description})]})]},b.id)})})})]})}const Ug=()=>Zt({queryKey:["relationship-types"],queryFn:async()=>{const{data:e,error:t}=await J.from("relationship_types").select("*").order("sort_order");if(t)throw t;return e}}),op=e=>{const{user:t}=zr(),n=1e3,s=async i=>{const o=[];let l=0;for(;;){const{data:a,error:h}=await i.range(l,l+n-1);if(h)throw h;const p=a??[];if(o.push(...p),p.length{let i=J.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).order("created_at",{ascending:!1}).order("first_name");return await s(i)},enabled:!!t})},Rft=e=>Zt({queryKey:["innercircle-contact",e],queryFn:async()=>{const{data:t,error:n}=await J.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).eq("id",e).maybeSingle();if(n)throw n;return t},enabled:!!e}),xOe=()=>{const{user:e}=zr();return Zt({queryKey:["innercircle-contact-counts",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return t==null||t.forEach(i=>{var o;(o=i.tags)==null||o.forEach(l=>{s[l.relationship_type_id]=(s[l.relationship_type_id]||0)+1})}),s},enabled:!!e})},wxe=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{tagIds:s,...i}=n,o={...i,birthday:i.birthday||null,home_anniversary:i.home_anniversary||null,owner_user_id:t.id},{data:l,error:a}=await J.from("innercircle_contacts").insert(o).select().single();if(a)throw a;if(s&&s.length>0){const{error:h}=await J.from("innercircle_contact_tags").insert(s.map(p=>({contact_id:l.id,relationship_type_id:p})));if(h)throw h}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),$i({title:"Contact created successfully"})},onError:n=>{$i({title:"Error creating contact",description:n.message,variant:"destructive"})}})},yOe=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{tagIds:s,tags:i,...o}=n,l={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:a,error:h}=await J.from("innercircle_contacts").update(l).eq("id",t).select().single();if(h)throw h;if(s!==void 0&&(await J.from("innercircle_contact_tags").delete().eq("contact_id",t),s.length>0)){const{error:p}=await J.from("innercircle_contact_tags").insert(s.map(x=>({contact_id:t,relationship_type_id:x})));if(p)throw p}return a},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),$i({title:"Contact updated successfully"})},onError:t=>{$i({title:"Error updating contact",description:t.message,variant:"destructive"})}})},vOe=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("innercircle_contacts").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),$i({title:"Contact deleted successfully"})},onError:t=>{$i({title:"Error deleting contact",description:t.message,variant:"destructive"})}})},jxe=()=>Zt({queryKey:["action-types"],queryFn:async()=>{const{data:e,error:t}=await J.from("action_types").select("*").order("sort_order");if(t)throw t;return e}}),Fft=e=>Zt({queryKey:["action-scripts",e],queryFn:async()=>{let t=J.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await t;if(s)throw s;return n}}),zft=()=>Zt({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:e,error:t}=await J.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(t)throw t;return e}}),Bft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({name:n,description:s})=>{const{data:i,error:o}=await J.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:t.id,active:!0,is_template:!1}).select().single();if(o)throw o;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan created successfully"})},onError:n=>{$i({title:"Error creating plan",description:n.message,variant:"destructive"})}})},$ft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:i,error:o}=await J.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!i)throw new Error("Source plan not found");const{data:l,error:a}=await J.from("touchpoint_plans").insert({name:s,description:i.description,owner_user_id:t.id,active:!0,is_template:!1}).select().single();if(a)throw a;if(i.items&&i.items.length>0){const h=i.items.map(x=>({plan_id:l.id,month_number:x.month_number,action_type_id:x.action_type_id,default_script_id:x.default_script_id,notes:x.notes})),{error:p}=await J.from("touchpoint_plan_items").insert(h);if(p)throw p}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{$i({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},Uft=()=>{const e=Wr();return cr({mutationFn:async({id:t,name:n,description:s})=>{const{data:i,error:o}=await J.from("touchpoint_plans").update({name:n,description:s}).eq("id",t).select().single();if(o)throw o;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan updated successfully"})}})},qft=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("touchpoint_plans").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan deleted successfully"})}})},Vft=()=>{const e=Wr();return cr({mutationFn:async({planId:t,items:n})=>{if(await J.from("touchpoint_plan_items").delete().eq("plan_id",t),n.length>0){const{error:s}=await J.from("touchpoint_plan_items").insert(n.map(i=>({plan_id:t,month_number:i.month_number,action_type_id:i.action_type_id,default_script_id:i.default_script_id||null,notes:i.notes})));if(s)throw s}},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),$i({title:"Plan schedule updated"})}})},Hft=()=>{const e=Wr();return cr({mutationFn:async({actionTypeId:t,title:n,scriptBody:s,emailSubject:i,tone:o})=>{const{data:l,error:a}=await J.from("action_scripts").insert({action_type_id:t,title:n,script_body:s,email_subject:i||null,tone:o||null,active:!0}).select().single();if(a)throw a;return l},onSuccess:()=>{e.invalidateQueries({queryKey:["action-scripts"]}),$i({title:"Script created successfully"})},onError:t=>{$i({title:"Error creating script",description:t.message,variant:"destructive"})}})},Wft=()=>{const{user:e}=zr();return Zt({queryKey:["user-plan-enrollments",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return t},enabled:!!e})},Gft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({planId:n,relationshipTypeId:s,active:i})=>{const{data:o}=await J.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:l}=await J.from("user_plan_enrollments").update({active:i}).eq("id",o.id);if(l)throw l}else if(i){const{error:l}=await J.from("user_plan_enrollments").insert({owner_user_id:t.id,plan_id:n,relationship_type_id:s,active:!0,start_date:new Date().toISOString().split("T")[0]});if(l)throw l}},onSuccess:()=>{e.invalidateQueries({queryKey:["user-plan-enrollments"]}),$i({title:"Plan enrollment updated"})}})},jse=(e=7)=>{const{user:t}=zr();return Zt({queryKey:["contact-touch-logs",t==null?void 0:t.id,e],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-e);const{data:s,error:i}=await J.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(i)throw i;return s},enabled:!!t})},_Oe=()=>{const{user:e}=zr();return Zt({queryKey:["contacts-last-touch",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(n)throw n;const s={};return t==null||t.forEach(i=>{s[i.contact_id]||(s[i.contact_id]=i.completed_at)}),s},enabled:!!e})},Kft=(e=90)=>{const{data:t}=op(),{data:n}=_Oe();if(!t||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-e);const i=t.filter(o=>{const l=n[o.id];return l?new Date(l){const e=Wr(),{user:t}=zr();return cr({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:i,notes:o})=>{const{data:l,error:a}=await J.from("contact_touch_logs").insert({owner_user_id:t.id,contact_id:n,action_type_id:s,script_used_id:i,notes:o,completed_at:new Date().toISOString()}).select().single();if(a)throw a;return l},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts-last-touch"]}),e.invalidateQueries({queryKey:["today-actions"]}),$i({title:"Action completed!"})}})},wOe="agentos_weekly_touch_goal",Nke=20,_te=()=>{if(typeof window>"u")return Nke;const e=localStorage.getItem(wOe);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return Nke},jOe=e=>{localStorage.setItem(wOe,e.toString())},kOe=()=>{const{data:e}=jse(7),t=new Date;t.setHours(0,0,0,0);const n=new Date(t);n.setDate(t.getDate()-t.getDay());const s=(e==null?void 0:e.filter(l=>new Date(l.completed_at)>=n).length)||0;let i=0;if(e&&e.length>0){const l=new Set(e.map(h=>new Date(h.completed_at).toDateString()));let a=new Date(t);for(;l.has(a.toDateString());)i++,a.setDate(a.getDate()-1)}const o=_te();return{actionsThisWeek:s,weeklyGoal:o,streak:i,progress:Math.min(s/o*100,100)}},Zft=()=>{const{user:e}=zr();return Zt({queryKey:["contact-plan-cycles",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("contact_plan_cycles").select(` *, contact:innercircle_contacts(*), plan:touchpoint_plans( *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) ) `);if(n)throw n;return t},enabled:!!e})},Yft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async()=>{const{data:n}=await J.from("user_plan_enrollments").select("*").eq("active",!0);if(!n||n.length===0)return;const{data:s}=await J.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!s)return;const{data:i}=await J.from("contact_plan_cycles").select("contact_id, plan_id"),o=new Set((i==null?void 0:i.map(a=>`${a.contact_id}-${a.plan_id}`))||[]),l=[];for(const a of s)for(const h of a.tags||[]){const p=n.find(x=>x.relationship_type_id===h.relationship_type_id);p&&!o.has(`${a.id}-${p.plan_id}`)&&l.push({contact_id:a.id,plan_id:p.plan_id,relationship_type_id:h.relationship_type_id})}if(l.length>0){const{error:a}=await J.from("contact_plan_cycles").insert(l);if(a)throw a}return l.length},onSuccess:n=>{e.invalidateQueries({queryKey:["contact-plan-cycles"]}),n&&n>0&&$i({title:`${n} contact(s) enrolled in plans`})}})},NOe=()=>{const{user:e}=zr(),{data:t}=Zft(),{data:n}=jse(30);return Zt({queryKey:["today-actions",e==null?void 0:e.id,t==null?void 0:t.length,n==null?void 0:n.length],queryFn:async()=>{var b;if(!t||t.length===0)return[];const s=new Date,i=[],o=new Date(s.getFullYear(),s.getMonth(),1),l=new Set((n==null?void 0:n.filter(j=>new Date(j.completed_at)>=o).map(j=>`${j.contact_id}-${j.action_type_id}`))||[]);for(const j of t){if(!((b=j.plan)!=null&&b.items)||j.plan.items.length===0||!j.contact)continue;const N=new Date(j.cycle_start_date),A=Math.floor((s.getTime()-N.getTime())/(30.44*24*60*60*1e3))%12+1,E=j.plan.items.find(T=>T.month_number===A);if(E&&E.action_type){const T=`${j.contact_id}-${E.action_type_id}`;if(!l.has(T)){const{data:L}=await J.from("relationship_types").select("name").eq("id",j.relationship_type_id).single();i.push({contact:j.contact,actionType:E.action_type,script:E.default_script||void 0,planName:j.plan.name,relationshipTypeName:(L==null?void 0:L.name)||"",monthNumber:A})}}}const a=5,h=s.getDate(),p=i.sort((j,N)=>j.contact.first_name.localeCompare(N.contact.first_name)),x=(h-1)%Math.max(1,p.length);return[...p.slice(x),...p.slice(0,x)].slice(0,a)},enabled:!!e&&!!t})};function Xft(){const e=ns(),{data:t,isLoading:n}=NOe(),{data:s}=op(),i=kOe(),[o,l]=I.useState(_te()),[a,h]=I.useState(""),[p,x]=I.useState(!1);I.useEffect(()=>{l(_te())},[]);const y=()=>{const q=parseInt(a,10);if(isNaN(q)||q<1){$i({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(q),jOe(q),x(!1),$i({title:"Goal updated",description:`Weekly touch goal set to ${q}`})},b=()=>{h(o.toString()),x(!0)},j=of(new Date),N=Hl(j,7),C=q=>{if(!q)return null;const H=new Date(q);return new Date(j.getFullYear(),H.getMonth(),H.getDate())},A=(s==null?void 0:s.map(q=>{const H=C(q.birthday),K=C(q.home_anniversary),Z=[];return H&&H>=j&&H<=N&&Z.push({contact:q,type:"birthday",date:H,isToday:Zl(H,j)}),K&&K>=j&&K<=N&&Z.push({contact:q,type:"anniversary",date:K,isToday:Zl(K,j)}),Z}).flat().sort((q,H)=>q.date.getTime()-H.date.getTime()).slice(0,3))||[],E=(s==null?void 0:s.filter(q=>{const H=C(q.birthday),K=C(q.home_anniversary);return H&&Zl(H,j)||K&&Zl(K,j)}).length)||0,T=(t==null?void 0:t.length)||0,L=E+T,z=(i==null?void 0:i.actionsThisWeek)||0,F=(i==null?void 0:i.streak)||0;return n?r.jsx(Ge,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):r.jsxs(Ge,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Qt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:F>0&&r.jsxs(Rt,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(Zh,{className:"h-3 w-3"}),F," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[L>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[L," tasks"]})," for today"]}):"No tasks for today",z>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:z})," touches this week"]})]})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),e("/mission-control/contacts?new=true")},children:[r.jsx(Jh,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),e("/mission-control")},children:[r.jsx(ca,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:q=>{q.stopPropagation(),e("/mission-control/video/record")},children:[r.jsx(Fi,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),e("/mission-control/popbys")},children:[r.jsx(ml,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:q=>{q.stopPropagation(),e("/mission-control/pipeline")},children:[r.jsx(m1,{className:"h-3.5 w-3.5"}),"Pipeline"]})]}),r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kx,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Br,{open:p,onOpenChange:x,children:[r.jsx(zo,{asChild:!0,children:r.jsx("button",{onClick:b,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(fd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Fr,{className:"sm:max-w-[360px]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Set Weekly Goal"}),r.jsx(es,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(at,{id:"weekly-goal",type:"number",min:"1",value:a,onChange:q=>h(q.target.value),placeholder:"20",onKeyDown:q=>{q.key==="Enter"&&y()}})]}),r.jsx(ee,{onClick:y,className:"w-full",children:"Save Goal"})]})]})]})]}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-primary",children:z}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(Hc,{value:Math.min(z/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),z>=o&&r.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5 flex items-center gap-1",children:[r.jsx("span",{children:"🎉"})," Goal achieved! Keep the momentum going."]}),z0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-z," more to hit your weekly goal"]})]}),A.length>0&&r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Kh,{className:"h-4 w-4 text-pink-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Upcoming Milestones"})]}),r.jsx("div",{className:"space-y-2",children:A.map((q,H)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${q.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:K=>{K.stopPropagation(),e(`/mission-control/contacts/${q.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[q.type==="birthday"?r.jsx(Kh,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(fi,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[q.contact.first_name," ",q.contact.last_name]}),q.isToday&&r.jsx(Rt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-pink-500/20 text-pink-600",children:"Today!"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.isToday?q.type==="birthday"?"🎂":"🏠":xn(q.date,"EEE, MMM d")}),r.jsx(Ka,{className:"h-3 w-3"})]})]},`${q.contact.id}-${q.type}-${H}`))})]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>e("/mission-control"),children:["Open Agent OS",r.jsx(Zo,{className:"h-4 w-4"})]})]})]})}const SOe=()=>Zt({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:e,error:t}=await J.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(t)throw t;return(e==null?void 0:e.enabled)??!1}}),COe=e=>{const{user:t,brokerageId:n}=zr();return Zt({queryKey:["listings",e,n],queryFn:async()=>{let s=J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0);e!=null&&e.status&&(s=s.eq("status",e.status)),e!=null&&e.propertyType&&(s=s.eq("property_type",e.propertyType)),e!=null&&e.city&&(s=s.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(s=s.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(s=s.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(s=s.eq("open_to_referrals",!0));const{data:i,error:o}=await s;if(o)throw o;let l=i||[];if(n){const{data:a}=await J.from("profiles").select("id").eq("brokerage_id",n);if(a&&a.length>0){const h=a.map(y=>y.id);let p=J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("share_with_brokerage",!0).eq("is_public",!1).in("agent_id",h);e!=null&&e.status&&(p=p.eq("status",e.status)),e!=null&&e.propertyType&&(p=p.eq("property_type",e.propertyType)),e!=null&&e.city&&(p=p.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(p=p.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(p=p.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(p=p.eq("open_to_referrals",!0));const{data:x}=await p;if(x){const y=new Set(l.map(j=>j.id)),b=x.filter(j=>!y.has(j.id));l=[...l,...b]}}}switch(e==null?void 0:e.sortBy){case"updated":l.sort((a,h)=>new Date(h.updated_at).getTime()-new Date(a.updated_at).getTime());break;case"price_asc":l.sort((a,h)=>a.price-h.price);break;case"price_desc":l.sort((a,h)=>h.price-a.price);break;default:l.sort((a,h)=>new Date(h.created_at).getTime()-new Date(a.created_at).getTime())}return l}})},kxe=()=>{const{user:e}=zr();return Zt({queryKey:["my-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await J.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})},MOe=e=>{const{user:t}=zr();return Zt({queryKey:["listing",e],queryFn:async()=>{const{data:n,error:s}=await J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds) `).eq("id",e).single();if(s)throw s;return t&&await J.from("listing_views").insert({listing_id:e,viewer_id:t.id}),n},enabled:!!e})},Qft=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s,error:i}=await J.from("listings").insert({...n,agent_id:t.id}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Jft=()=>{const e=Wr();return cr({mutationFn:async({agentId:t,...n})=>{const{data:s,error:i}=await J.from("listings").insert({...n,agent_id:t}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["brokerage-listings"]})}})},ept=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("listings").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["listing",t.id]})}})},TOe=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("listings").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},tpt=()=>{const e=Wr();return cr({mutationFn:async({listingId:t,photoUrl:n,isPrimary:s=!1})=>{const{data:i,error:o}=await J.from("listing_photos").insert({listing_id:t,photo_url:n,is_primary:s}).select().single();if(o)throw o;return i},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t.listing_id]}),e.invalidateQueries({queryKey:["my-listings"]})}})},rpt=()=>{const e=Wr();return cr({mutationFn:async({photoId:t,listingId:n})=>{const{error:s}=await J.from("listing_photos").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t]}),e.invalidateQueries({queryKey:["my-listings"]})}})},npt=()=>{const{user:e}=zr();return Zt({queryKey:["saved-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await J.from("listing_saves").select(` *, listing:listings( *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id) ) `).eq("agent_id",e.id);if(n)throw n;return t},enabled:!!e})},AOe=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await J.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await J.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await J.from("listing_saves").insert({listing_id:n,agent_id:t.id}),{saved:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["saved-listings"]}),e.invalidateQueries({queryKey:["listings"]})}})},EOe=e=>{const{user:t}=zr();return Zt({queryKey:["listing-saved",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await J.from("listing_saves").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},spt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await J.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await J.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await J.from("listing_follows").insert({listing_id:n,agent_id:t.id}),{following:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["listing-following"]})}})},ipt=e=>{const{user:t}=zr();return Zt({queryKey:["listing-following",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await J.from("listing_follows").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},apt=()=>{const{user:e}=zr();return cr({mutationFn:async({listingId:t,shareType:n})=>{if(!e)throw new Error("Not authenticated");const{error:s}=await J.from("listing_shares").insert({listing_id:t,sharing_agent_id:e.id,share_type:n});if(s)throw s}})},opt=()=>{const{user:e}=zr();return Zt({queryKey:["my-referrals",e==null?void 0:e.id],queryFn:async()=>{if(!e)return{sent:[],received:[]};const[t,n]=await Promise.all([J.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",e.id).order("created_at",{ascending:!1}),J.from("listing_referrals").select(` *, sender:profiles!listing_referrals_sender_agent_id_fkey(id, name, email), listing:listings(*,photos:listing_photos(*)) `).eq("listing_agent_id",e.id).order("created_at",{ascending:!1})]);return{sent:t.data||[],received:n.data||[]}},enabled:!!e})},lpt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({listingId:n,listingAgentId:s,buyerName:i,buyerType:o,notes:l})=>{if(!t)throw new Error("Not authenticated");const{data:a,error:h}=await J.from("listing_referrals").insert({listing_id:n,sender_agent_id:t.id,listing_agent_id:s,buyer_name:i,buyer_type:o,notes:l}).select().single();if(h)throw h;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["my-referrals"]})}})},cpt=()=>Zt({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:e}=await J.from("listing_shares").select("sharing_agent_id, profiles!listing_shares_agent_id_fkey(name)").order("created_at",{ascending:!1}),t=new Map;e==null||e.forEach(l=>{var p;const a=l.sharing_agent_id;if(!a)return;const h=t.get(a);h?h.count++:t.set(a,{name:((p=l.profiles)==null?void 0:p.name)||"Unknown",count:1})});const n=Array.from(t.entries()).map(([l,a])=>({agentId:l,...a})).sort((l,a)=>a.count-l.count).slice(0,10),{data:s}=await J.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),i=new Map;s==null||s.forEach(l=>{var h;const a=i.get(l.agent_id);a?a.count++:i.set(l.agent_id,{name:((h=l.agent)==null?void 0:h.name)||"Unknown",count:1})});const o=Array.from(i.entries()).map(([l,a])=>({agentId:l,...a})).sort((l,a)=>a.count-l.count).slice(0,10);return{topSharers:n,topListers:o}}}),dpt=()=>{const{user:e,brokerageId:t}=zr();return Zt({queryKey:["brokerage-listings",t],queryFn:async()=>{if(!e||!t)return[];const{data:n}=await J.from("profiles").select("id").eq("brokerage_id",t);if(!n||n.length===0)return[];const s=n.map(l=>l.id),{data:i,error:o}=await J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).in("agent_id",s).eq("is_approved",!0).order("created_at",{ascending:!1});if(o)throw o;return i},enabled:!!e&&!!t})},upt=({className:e,variant:t="default"})=>r.jsx(Rt,{variant:"outline",className:$t("text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0 h-4",t==="default"?"border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10":"border-muted-foreground/30 text-muted-foreground",e),children:"Beta"}),hpt={coming_soon:"bg-amber-500/10 text-amber-600 border-amber-200",active:"bg-emerald-500/10 text-emerald-600 border-emerald-200",under_contract:"bg-blue-500/10 text-blue-600 border-blue-200",sold:"bg-purple-500/10 text-purple-600 border-purple-200",withdrawn:"bg-muted text-muted-foreground border-border"},fpt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function ppt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function mpt(){const e=ns(),{data:t,isLoading:n}=SOe(),{data:s,isLoading:i}=COe({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(s==null?void 0:s.filter(x=>x.is_approved&&x.is_public))||[],l=o.filter(x=>x.is_featured),a=o.filter(x=>!x.is_featured),h=[...l,...a].slice(0,6),p=n||i;return!p&&!t?null:p?r.jsx(Ge,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),r.jsx(upt,{})]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Zo,{className:"h-4 w-4"})]})]}),h.length===0?r.jsx(Ge,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(fi,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No listings available yet"}),r.jsx(ee,{variant:"link",size:"sm",onClick:()=>e("/mission-control/listings/new"),className:"mt-2",children:"Add the first listing"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:h.map(x=>{var b,j;const y=((b=x.photos)==null?void 0:b.find(N=>N.is_primary))||((j=x.photos)==null?void 0:j[0]);return r.jsxs("div",{onClick:()=>e(`/mission-control/listings/${x.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden relative",children:[y!=null&&y.photo_url?r.jsx("img",{src:y.photo_url,alt:`${x.city}, ${x.state}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(fi,{className:"h-8 w-8 text-muted-foreground/50"})}),x.is_featured&&r.jsx("div",{className:"absolute top-1.5 left-1.5",children:r.jsxs(Rt,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(vs,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Rt,{className:`text-[10px] px-1.5 py-0.5 ${hpt[x.status]}`,children:fpt[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:ppt(x.price)}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[x.city,", ",x.state]}),(x.bedrooms||x.bathrooms)&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[x.bedrooms&&`${x.bedrooms} bed`,x.bedrooms&&x.bathrooms&&" · ",x.bathrooms&&`${x.bathrooms} bath`]})]})]},x.id)})})]})}function IOe(e=10,t){return Zt({queryKey:["event-leaderboard",e,t],queryFn:async()=>{const{data:n}=await J.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(b=>b.user_id))||[]);let i=null;if(t){const{data:b}=await J.from("profiles").select("id").eq("brokerage_id",t);i=new Set((b==null?void 0:b.map(j=>j.id))||[])}const{data:o,error:l}=await J.from("agent_attendance_stats").select("user_id, total_points, total_events_attended, current_streak").order("total_points",{ascending:!1}).limit(e+s.size+50);if(l)throw l;if(!o||o.length===0)return[];let a=o.filter(b=>!s.has(b.user_id));i&&(a=a.filter(b=>i.has(b.user_id)));const h=a.slice(0,e),p=h.map(b=>b.user_id),{data:x}=await J.from("profiles").select("id, name").in("id",p),y=new Map((x==null?void 0:x.map(b=>[b.id,{name:b.name}]))||[]);return h.map(b=>({user_id:b.user_id,total_points:b.total_points,total_events_attended:b.total_events_attended,current_streak:b.current_streak,profile:y.get(b.user_id)||null}))}})}function POe(e){return Zt({queryKey:["user-attendance-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await J.from("agent_attendance_stats").select("*").eq("user_id",e).single();if(n&&n.code!=="PGRST116")throw n;return t},enabled:!!e})}function LOe(e){return Zt({queryKey:["user-badges",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await J.from("agent_badges").select("*").eq("user_id",e).order("earned_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function OOe(e,t){return Zt({queryKey:["user-rank",e,t],queryFn:async()=>{if(!e)return null;const{data:n}=await J.from("agent_attendance_stats").select("total_points").eq("user_id",e).single();if(!n)return null;const{data:s}=await J.from("user_roles").select("user_id").eq("role","admin"),i=new Set((s==null?void 0:s.map(h=>h.user_id))||[]),{data:o,error:l}=await J.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(l)throw l;let a=(o==null?void 0:o.filter(h=>!i.has(h.user_id)))||[];if(t){const{data:h}=await J.from("profiles").select("id").eq("brokerage_id",t),p=new Set((h==null?void 0:h.map(x=>x.id))||[]);a=a.filter(x=>p.has(x.user_id))}return a.length+1},enabled:!!e})}function gpt(){const{user:e,brokerageId:t,isAdmin:n}=zr();ns();const s=!!t,[i,o]=I.useState("brokerage"),l=()=>{if(n)return null;if(s)return i==="global"?null:t},{data:a,isLoading:h}=IOe(5,l()),{data:p}=POe(e==null?void 0:e.id),{data:x}=OOe(e==null?void 0:e.id,l()),{data:y}=LOe(e==null?void 0:e.id),b=n||s,j=()=>n?"Agent Leaderboard":s?i==="global"?"All LevelUp":"My Brokerage":"My Points";if(h)return r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Qt,{className:"text-base flex items-center gap-2",children:[r.jsx(Wa,{className:"h-4 w-4 text-yellow-500"}),j()]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-2",children:[...Array(b?5:3)].map((C,A)=>r.jsx(Pr,{className:"h-10 w-full"},A))})})]});const N=C=>C===0?r.jsx(Wa,{className:"h-4 w-4 text-yellow-500 mx-auto"}):C===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):C===2?r.jsx("span",{className:"text-sm font-medium text-amber-600",children:"3"}):r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:C+1});if(b){const C=(a==null?void 0:a.slice(0,5))||[];return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs(Qt,{className:"text-base flex items-center gap-2",children:[r.jsx(Wa,{className:"h-4 w-4 text-yellow-500"}),j()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(ee,{variant:i==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(ee,{variant:i==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(Xe,{children:[!n&&p&&r.jsx("div",{className:"mb-3 p-2 rounded-lg bg-primary/5 border border-primary/10",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Your Rank:"}),r.jsxs("span",{className:"font-bold text-primary",children:["#",x||"-"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsxs("span",{children:[r.jsx("strong",{className:"text-primary",children:p.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:p.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[C.map((A,E)=>{var T,L,z;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${A.user_id===(e==null?void 0:e.id)?"bg-primary/10 border border-primary/20":E===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:N(E)}),r.jsx(ci,{className:"h-6 w-6",children:r.jsx(di,{className:"text-xs",children:((L=(T=A.profile)==null?void 0:T.name)==null?void 0:L.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((z=A.profile)==null?void 0:z.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:A.total_points})]},A.user_id)}),C.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(uo,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ha,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ka,{className:"h-4 w-4"})]})]})]})}return r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Qt,{className:"text-base flex items-center gap-2",children:[r.jsx(Wa,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(Xe,{children:p?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:p.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Total Points"})]}),r.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:p.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events Attended"})]})]}),r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Current Streak"})]}),r.jsxs("span",{className:"font-bold text-orange-500",children:[p.current_streak," 🔥"]})]}),y&&y.length>0&&r.jsxs("div",{className:"pt-2 border-t",children:[r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx(Pl,{className:"h-3 w-3 text-muted-foreground"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Badges"})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.slice(0,4).map(C=>r.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-yellow-500/10 text-yellow-600 border border-yellow-500/20",children:C.badge_name},C.id)),y.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",y.length-4," more"]})]})]}),r.jsxs(uo,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ha,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Ka,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(vs,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(uo,{to:"/reward-store",className:"mt-3 inline-flex items-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ha,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Ka,{className:"h-4 w-4"})]})]})})]})}const kse=()=>Zt({queryKey:["lead-sources"],queryFn:async()=>{const{data:e,error:t}=await J.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}}),xpt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await J.from("lead_sources").insert({name:n,owner_user_id:t==null?void 0:t.id,sort_order:100}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["lead-sources"]}),ze.success("Lead source added")},onError:n=>{ze.error("Failed to add lead source"),console.error(n)}})},Nxe=(e,t)=>{const{user:n,isAdmin:s}=zr(),i=s&&t?t:n==null?void 0:n.id;return Zt({queryKey:["scorecard-transactions",e,i],queryFn:async()=>{let o=J.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",i).order("close_date",{ascending:!1});e&&(o=o.gte("close_date",`${e}-01-01`).lte("close_date",`${e}-12-31`));const{data:l,error:a}=await o;if(a)throw a;return l},enabled:!!i})},DOe=e=>{const{user:t,isAdmin:n}=zr(),s=n&&e?e:t==null?void 0:t.id;return Zt({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:i,error:o}=await J.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",s).order("close_date",{ascending:!1});if(o)throw o;return i},enabled:!!s})},Nse=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await J.from("scorecard_transactions").insert({...n,owner_user_id:t.id}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction added")},onError:n=>{ze.error("Failed to add transaction"),console.error(n)}})},ypt=()=>{const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("scorecard_transactions").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction updated")},onError:t=>{ze.error("Failed to update transaction"),console.error(t)}})},vpt=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("scorecard_transactions").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction deleted")},onError:t=>{ze.error("Failed to delete transaction"),console.error(t)}})},ROe=(e,t)=>{const{user:n,isAdmin:s}=zr(),i=s&&t?t:n==null?void 0:n.id;return Zt({queryKey:["scorecard-goals",e,i],queryFn:async()=>{const{data:o,error:l}=await J.from("scorecard_goals").select("*").eq("owner_user_id",i).eq("year",e).maybeSingle();if(l)throw l;return o},enabled:!!i})},_pt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await J.from("scorecard_goals").upsert({...n,owner_user_id:t.id},{onConflict:"owner_user_id,year"}).select().single();if(i)throw i;return s},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["scorecard-goals",s.year]}),ze.success("Goals saved")},onError:n=>{ze.error("Failed to save goals"),console.error(n)}})},Sse=()=>{const{user:e}=zr();return Zt({queryKey:["scorecard-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("scorecard_settings").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t},enabled:!!(e!=null&&e.id)})},bpt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{data:s,error:i}=await J.from("scorecard_settings").upsert({...n,user_id:t.id},{onConflict:"user_id"}).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-settings"]}),ze.success("Settings saved")},onError:n=>{ze.error("Failed to save settings"),console.error(n)}})},FOe=(e,t)=>{const{data:n,isLoading:s}=Nxe(e,t),{data:i,isLoading:o}=DOe(t),{data:l}=Sse(),a=(l==null?void 0:l.show_commission)??!0,h=p=>{if(!p||p.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const x=p.filter(z=>z.transaction_type==="buyer").length,y=p.filter(z=>z.transaction_type==="seller").length,b=p.reduce((z,F)=>z+Number(F.sale_price),0),j=p.reduce((z,F)=>z+(Number(F.commission_amount)||0),0),N={};p.forEach(z=>{var q;const F=((q=z.lead_source)==null?void 0:q.name)||"Unknown";N[F]=(N[F]||0)+1});const C=Object.entries(N).map(([z,F])=>({name:z,count:F})).sort((z,F)=>F.count-z.count),A=C[0]||null,E={};p.forEach(z=>{const F=new Date(z.close_date).toLocaleString("default",{month:"short"});E[F]=(E[F]||0)+1});const L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(z=>({month:z,count:E[z]||0}));return{totalTransactions:p.length,buyerCount:x,sellerCount:y,totalVolume:b,averagePrice:p.length>0?b/p.length:0,totalCommission:a?j:0,topLeadSource:A,transactionsByMonth:L,leadSourceBreakdown:C}};return{yearStats:h(n),lifetimeStats:h(i),isLoading:s||o,showCommission:a}},wpt=()=>{const{isAdmin:e}=zr();return Zt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:t,error:n}=await J.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(n)throw n;const s=[...new Set(t.map(l=>l.owner_user_id))],{data:i,error:o}=await J.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return i},enabled:e})},y0={recency:40,touchpoints:30,transactions:20},Ske={warm:70,cooling:40};function jpt(e){return e===null?0:e<=14?y0.recency:e<=30?y0.recency*.85:e<=60?y0.recency*.65:e<=90?y0.recency*.4:e<=180?y0.recency*.2:y0.recency*.05}function kpt(e){const t=Math.min(e/12,1);return Math.round(y0.touchpoints*t)}function Npt(e){return e?y0.transactions:0}function Spt(){return 0}function Cpt(e){return e>=Ske.warm?"warm":e>=Ske.cooling?"cooling":"at-risk"}function Sxe(){const{data:e,isLoading:t}=op(),{data:n}=_Oe(),{data:s}=jse(365),{data:i}=DOe(),o=I.useMemo(()=>{if(!e)return[];const a=new Date,h=but(a),p={};s==null||s.forEach(y=>{new Date(y.completed_at)>=h&&(p[y.contact_id]=(p[y.contact_id]||0)+1)});const x=new Set((i==null?void 0:i.filter(y=>y.contact_id).map(y=>y.contact_id))||[]);return e.map(y=>{const b=(n==null?void 0:n[y.id])||null,j=b?gC(a,new Date(b)):null,N=p[y.id]||0,C=x.has(y.id),A=jpt(j),E=kpt(N),T=Npt(C),L=Spt(),z=Math.round(A+E+T+L),F={score:z,status:Cpt(z),breakdown:{recency:Math.round(A),touchpoints:Math.round(E),transactions:Math.round(T),referrals:Math.round(L)},lastTouchDate:b,daysSinceTouch:j,touchCountLast12Months:N,hasTransaction:C};return{...y,relationshipScore:F}})},[e,n,s,i]),l=I.useMemo(()=>{const a=o.filter(b=>b.relationshipScore.status==="warm").length,h=o.filter(b=>b.relationshipScore.status==="cooling").length,p=o.filter(b=>b.relationshipScore.status==="at-risk").length,x=o.length,y=x>0?Math.round(o.reduce((b,j)=>b+j.relationshipScore.score,0)/x):0;return{warm:a,cooling:h,atRisk:p,total:x,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:t}}function zOe(){const e=ns(),{stats:t,contactsWithScores:n,isLoading:s}=Sxe();if(s)return r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Pr,{className:"h-5 w-40"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(Pr,{className:"h-20 w-full"}),r.jsx(Pr,{className:"h-16 w-full"})]})]});if(t.total===0)return r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Qt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(ee,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>e("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const i=Math.round(t.warm/t.total*100),o=Math.round(t.cooling/t.total*100),l=Math.round(t.atRisk/t.total*100),a=n.filter(h=>h.relationshipScore.status==="at-risk").sort((h,p)=>h.relationshipScore.score-p.relationshipScore.score).slice(0,3);return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Qt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Zf,{className:"h-5 w-5 text-emerald-500"}),"Relationship Health"]}),r.jsx("span",{className:"text-2xl font-bold",children:t.averageScore})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Average score across ",t.total," contacts"]})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsx("span",{children:"Warm"})]}),r.jsxs("span",{className:"font-medium",children:[t.warm," (",i,"%)"]})]}),r.jsx(Hc,{value:i,className:"h-2 bg-muted [&>div]:bg-emerald-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-amber-500"}),r.jsx("span",{children:"Cooling Off"})]}),r.jsxs("span",{className:"font-medium",children:[t.cooling," (",o,"%)"]})]}),r.jsx(Hc,{value:o,className:"h-2 bg-muted [&>div]:bg-amber-500"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-red-500"}),r.jsx("span",{children:"At Risk"})]}),r.jsxs("span",{className:"font-medium",children:[t.atRisk," (",l,"%)"]})]}),r.jsx(Hc,{value:l,className:"h-2 bg-muted [&>div]:bg-red-500"})]})]}),a.length>0&&r.jsxs("div",{className:"pt-3 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(w1,{className:"h-4 w-4 text-red-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}),r.jsx("div",{className:"space-y-2",children:a.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-red-500/5 hover:bg-red-500/10 cursor-pointer transition-colors",onClick:()=>e(`/mission-control/contacts/${h.id}`),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),r.jsxs("span",{className:"text-sm",children:[h.first_name," ",h.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:h.relationshipScore.daysSinceTouch===null?"Never":`${h.relationshipScore.daysSinceTouch}d`}),r.jsx(Ka,{className:"h-3 w-3"})]})]},h.id))})]}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>e("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Ka,{className:"h-4 w-4 ml-1"})]})]})]})}const Mpt=()=>{var ne,ge;const{user:e,isAdmin:t}=zr(),n=ns(),[s,i]=I.useState([]),[o,l]=I.useState([]),[a,h]=I.useState([]),[p,x]=I.useState([]),[y,b]=I.useState([]),[j,N]=I.useState([]),[C,A]=I.useState(new Set),[E,T]=I.useState([]),[L,z]=I.useState([]),[F,q]=I.useState([]),[H,K]=I.useState(!0);I.useEffect(()=>{Z()},[e]);const Z=async()=>{var ie,fe,de,ye;try{const[Ie,Ne,we,he,xe,be,Oe,Te,Ve,Fe]=await Promise.all([J.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),J.from("app_tiles").select("*").order("name"),J.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),J.from("events").select("*").order("event_date",{ascending:!0}),J.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e==null?void 0:e.id),J.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),J.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.from("additional_services").select("id, name, description, preview_image_url, signup_link_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),Me=((ie=Ie.data)==null?void 0:ie.map(et=>et.tag))||[],Qe=new Set(((fe=we.data)==null?void 0:fe.map(et=>et.app_id))||[]);A(Qe);const Ye=(((de=Ne.data)==null?void 0:de.filter(et=>!et.required_tags||et.required_tags.length===0?!0:et.required_tags.some(nt=>Me.includes(nt))))||[]).sort((et,nt)=>et.name==="LevelUp Members Portal"?-1:nt.name==="LevelUp Members Portal"?1:0);i(Ye.slice(0,6));const me=((ye=he.data)==null?void 0:ye.filter(et=>TS(et.event_date)!=="ended"))||[];l(me.slice(0,4)),T(xe.data||[]),h(be.data||[]),x(Oe.data||[]),b(Te.data||[]),N(Ve.data||[]);const mt=Fe.data||[];z(mt.filter(et=>et.placement==="top")),q(mt.filter(et=>et.placement==="between"))}catch(Ie){console.error("Error loading dashboard:",Ie),ze.error("Failed to load dashboard data")}finally{K(!1)}},te=async ie=>{var de;const fe=window.open("about:blank","_blank");try{await J.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:ie.app_id,app_name:ie.name,user_agent:navigator.userAgent});const{data:ye,error:Ie}=await J.functions.invoke("sso-launch",{body:{app_id:ie.app_id}});if(Ie)throw Ie;ye!=null&&ye.redirect_url?fe&&!fe.closed?(fe.location.href=ye.redirect_url,(de=fe.focus)==null||de.call(fe)):window.location.assign(ye.redirect_url):(fe==null||fe.close(),ze.error("Launch link unavailable"))}catch(ye){fe==null||fe.close(),console.error("Error launching app:",ye),ze.error("Failed to launch app")}},ae=ie=>E==null?void 0:E.some(fe=>fe.event_id===ie),le=ie=>{const fe=E==null?void 0:E.find(de=>de.event_id===ie);return fe==null?void 0:fe.zoom_join_url};if(H)return r.jsx(Or,{title:"Dashboard",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading your dashboard..."})]})})});const ve=ie=>F.filter(fe=>fe.section_after===ie);return r.jsxs(Or,{title:"Dashboard",children:[r.jsx(Sft,{events:o,registrations:E,onNavigateToEvents:()=>n("/events")}),L.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(UM,{banners:L})}),r.jsx(Dft,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((ge=(ne=e==null?void 0:e.user_metadata)==null?void 0:ne.name)==null?void 0:ge.split(" ")[0])||"there","!"]}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Are you ready to LevelUp today?"})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-8",children:[r.jsx(Xft,{}),r.jsx(zOe,{}),r.jsx(gpt,{})]}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Upcoming Events"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Zo,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(Ge,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(zs,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"})]})})}):r.jsx("div",{className:"bg-card rounded-xl border border-border overflow-hidden divide-y divide-border max-w-full",children:o.map(ie=>{const fe=ae(ie.id),de=le(ie.id)||ie.zoom_link;return r.jsxs("div",{className:`flex items-start gap-3 sm:gap-4 p-3 sm:p-4 hover:bg-muted/50 transition-colors cursor-pointer group ${wke(ie.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[wke(ie.event_date)?r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-red-500/10 flex flex-col items-center justify-center relative",children:[r.jsx("span",{className:"absolute inline-flex h-3 w-3 top-1 right-1 animate-ping rounded-full bg-red-500 opacity-75"}),r.jsx(bj,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"text-[10px] font-bold text-red-500 uppercase mt-0.5",children:"Live"})]}):r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-primary/10 flex flex-col items-center justify-center",children:[r.jsx("span",{className:"text-[10px] sm:text-xs font-medium text-primary uppercase",children:new Intl.DateTimeFormat("en-US",{month:"short",timeZone:"America/New_York"}).format(new Date(ie.event_date))}),r.jsx("span",{className:"text-lg sm:text-xl font-bold text-primary",children:new Intl.DateTimeFormat("en-US",{day:"numeric",timeZone:"America/New_York"}).format(new Date(ie.event_date))})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"font-medium text-sm sm:text-base text-foreground group-hover:text-primary transition-colors line-clamp-2 sm:truncate",children:ie.title}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground mt-0.5",children:[new Intl.DateTimeFormat("en-US",{weekday:"long",timeZone:"America/New_York"}).format(new Date(ie.event_date))," at ",oE(new Date(ie.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:fe?r.jsxs(ee,{size:"sm",variant:"default",className:"gap-1",onClick:ye=>{ye.stopPropagation(),window.open(de,"_blank")},children:[r.jsx(Fs,{className:"h-3.5 w-3.5"}),"Join"]}):r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground group-hover:text-primary transition-colors",children:[r.jsx("span",{className:"text-sm",children:"Register"}),r.jsx(Ka,{className:"h-4 w-4"})]})})]},ie.id)})})]}),ve("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(UM,{banners:ve("events")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Academy Videos"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Zo,{className:"h-4 w-4"})]})]}),y.length===0?r.jsx(Ge,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Df,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No academy videos available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:y.map(ie=>r.jsxs("div",{onClick:()=>n(`/academy/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden relative",children:[ie.thumbnail_url?r.jsx("img",{src:ie.thumbnail_url,alt:ie.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Df,{className:"h-8 w-8 text-muted-foreground/50"})}),ie.duration&&r.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:ie.duration})]}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:ie.title})})]},ie.id))})]}),ve("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(UM,{banners:ve("academy")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Resource Kits"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Zo,{className:"h-4 w-4"})]})]}),p.length===0?r.jsx(Ge,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(qx,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No resource kits available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:p.map(ie=>r.jsxs("div",{onClick:()=>n(`/toolbox/${ie.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.featured_image_url?r.jsx("img",{src:ie.featured_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(qx,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),ve("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(UM,{banners:ve("toolbox")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"New Templates"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Zo,{className:"h-4 w-4"})]})]}),a.length===0?r.jsx(Ge,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(u1,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No templates available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map(ie=>r.jsxs("div",{onClick:()=>n("/templates"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(u1,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name})})]},ie.id))})]}),ve("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(UM,{banners:ve("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(mpt,{})}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Your Apps"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Zo,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(Ge,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(um,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No apps available"})]})})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(ie=>{const fe=C.has(ie.id);return r.jsxs("div",{onClick:()=>te(ie),className:"group flex items-start gap-4 p-5 bg-card rounded-xl border border-border cursor-pointer transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:ie.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:ie.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ie.description})]}),fe&&r.jsx(um,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},ie.id)})})]}),r.jsxs("section",{className:"mt-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Additional Services"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Zo,{className:"h-4 w-4"})]})]}),j.length===0?r.jsx(Ge,{className:"bg-muted/30 border-dashed",children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Cs,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional services available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:j.map(ie=>r.jsxs("div",{onClick:()=>window.open(ie.signup_link_url,"_blank"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden",children:ie.preview_image_url?r.jsx("img",{src:ie.preview_image_url,alt:ie.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Cs,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsxs("div",{className:"p-3",children:[r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ie.name}),ie.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:ie.description})]})]},ie.id))})]})]})};var Cse="Switch",[Tpt]=Ql(Cse),[Apt,Ept]=Tpt(Cse),BOe=I.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:i,defaultChecked:o,required:l,disabled:a,value:h="on",onCheckedChange:p,form:x,...y}=e,[b,j]=I.useState(null),N=ei(t,L=>j(L)),C=I.useRef(!1),A=b?x||!!b.closest("form"):!0,[E,T]=Ou({prop:i,defaultProp:o??!1,onChange:p,caller:Cse});return r.jsxs(Apt,{scope:n,checked:E,disabled:a,children:[r.jsx(Rn.button,{type:"button",role:"switch","aria-checked":E,"aria-required":l,"data-state":VOe(E),"data-disabled":a?"":void 0,disabled:a,value:h,...y,ref:N,onClick:cn(e.onClick,L=>{T(z=>!z),A&&(C.current=L.isPropagationStopped(),C.current||L.stopPropagation())})}),A&&r.jsx(qOe,{control:b,bubbles:!C.current,name:s,value:h,checked:E,required:l,disabled:a,form:x,style:{transform:"translateX(-100%)"}})]})});BOe.displayName=Cse;var $Oe="SwitchThumb",UOe=I.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,i=Ept($Oe,n);return r.jsx(Rn.span,{"data-state":VOe(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})});UOe.displayName=$Oe;var Ipt="SwitchBubbleInput",qOe=I.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...i},o)=>{const l=I.useRef(null),a=ei(l,o),h=jI(n),p=fI(t);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const N=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(N)}},[h,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});qOe.displayName=Ipt;function VOe(e){return e?"checked":"unchecked"}var HOe=BOe,Ppt=UOe;const Rs=I.forwardRef(({className:e,...t},n)=>r.jsx(HOe,{className:$t("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input 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",e),...t,ref:n,children:r.jsx(Ppt,{className:$t("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")})}));Rs.displayName=HOe.displayName;var Lpt=Object.defineProperty,Opt=(e,t,n)=>t in e?Lpt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vl=(e,t,n)=>Opt(e,typeof t!="symbol"?t+"":t,n);const bte={x:0,y:0,width:0,height:0,unit:"px"},a4=(e,t,n)=>Math.min(Math.max(e,t),n),Dpt=(...e)=>e.filter(t=>t&&typeof t=="string").join(" "),Cke=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function Rpt(e,t,n,s){const i=tg(e,n,s);return e.width&&(i.height=i.width/t),e.height&&(i.width=i.height*t),i.y+i.height>s&&(i.height=s-i.y,i.width=i.height*t),i.x+i.width>n&&(i.width=n-i.x,i.height=i.width/t),e.unit==="%"?v0(i,n,s):i}function Fpt(e,t,n){const s=tg(e,t,n);return s.x=(t-s.width)/2,s.y=(n-s.height)/2,e.unit==="%"?v0(s,t,n):s}function v0(e,t,n){return e.unit==="%"?{...bte,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function tg(e,t,n){return e.unit?e.unit==="px"?{...bte,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...bte,...e,unit:"px"}}function Mke(e,t,n,s,i,o=0,l=0,a=s,h=i){const p={...e};let x=Math.min(o,s),y=Math.min(l,i),b=Math.min(a,s),j=Math.min(h,i);t&&(t>1?(x=l?l*t:x,y=x/t,b=a*t):(y=o?o/t:y,x=y*t,j=h/t)),p.y<0&&(p.height=Math.max(p.height+p.y,y),p.y=0),p.x<0&&(p.width=Math.max(p.width+p.x,x),p.x=0);const N=s-(p.x+p.width);N<0&&(p.x=Math.min(p.x,s-x),p.width+=N);const C=i-(p.y+p.height);if(C<0&&(p.y=Math.min(p.y,i-y),p.height+=C),p.widthb&&((n==="sw"||n=="nw")&&(p.x-=b-p.width),p.width=b),p.height>j&&((n==="nw"||n=="ne")&&(p.y-=j-p.height),p.height=j),t){const A=p.width/p.height;if(At){const E=Math.max(p.height*t,x);(n==="sw"||n=="nw")&&(p.x-=E-p.width),p.width=E}}return p}function zpt(e,t,n,s){const i={...e};return t==="ArrowLeft"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="w"?(i.x-=n,i.width+=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="e"?i.width-=n:s==="se"&&(i.width-=n,i.height-=n):t==="ArrowRight"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="w"?(i.x+=n,i.width-=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="e"?i.width+=n:s==="se"&&(i.width+=n,i.height+=n)),t==="ArrowUp"?s==="nw"?(i.x-=n,i.y-=n,i.width+=n,i.height+=n):s==="n"?(i.y-=n,i.height+=n):s==="ne"?(i.y-=n,i.width+=n,i.height+=n):s==="sw"?(i.x+=n,i.width-=n,i.height-=n):s==="s"?i.height-=n:s==="se"&&(i.width-=n,i.height-=n):t==="ArrowDown"&&(s==="nw"?(i.x+=n,i.y+=n,i.width-=n,i.height-=n):s==="n"?(i.y+=n,i.height-=n):s==="ne"?(i.y+=n,i.width-=n,i.height-=n):s==="sw"?(i.x-=n,i.width+=n,i.height+=n):s==="s"?i.height+=n:s==="se"&&(i.width+=n,i.height+=n)),i}const o4={capture:!0,passive:!1};let Bpt=0;const d0=class Vp extends I.PureComponent{constructor(){super(...arguments),vl(this,"docMoveBound",!1),vl(this,"mouseDownOnCrop",!1),vl(this,"dragStarted",!1),vl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),vl(this,"componentRef",I.createRef()),vl(this,"mediaRef",I.createRef()),vl(this,"resizeObserver"),vl(this,"initChangeCalled",!1),vl(this,"instanceId",`rc-${Bpt++}`),vl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),vl(this,"onCropPointerDown",t=>{const{crop:n,disabled:s}=this.props,i=this.getBox();if(!n)return;const o=tg(n,i.width,i.height);if(s)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=t.target.dataset.ord,a=!!l;let h=t.clientX,p=t.clientY,x=o.x,y=o.y;if(l){const b=t.clientX-i.x,j=t.clientY-i.y;let N=0,C=0;l==="ne"||l=="e"?(N=b-(o.x+o.width),C=j-o.y,x=o.x,y=o.y+o.height):l==="se"||l==="s"?(N=b-(o.x+o.width),C=j-(o.y+o.height),x=o.x,y=o.y):l==="sw"||l=="w"?(N=b-o.x,C=j-(o.y+o.height),x=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(N=b-o.x,C=j-o.y,x=o.x+o.width,y=o.y+o.height),h=x+i.x+N,p=y+i.y+C}this.evData={startClientX:h,startClientY:p,startCropX:x,startCropY:y,clientX:t.clientX,clientY:t.clientY,isResize:a,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),vl(this,"onComponentPointerDown",t=>{const{crop:n,disabled:s,locked:i,keepSelection:o,onChange:l}=this.props,a=this.getBox();if(s||i||o&&n)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=t.clientX-a.x,p=t.clientY-a.y,x={unit:"px",x:h,y:p,width:0,height:0};this.evData={startClientX:t.clientX,startClientY:t.clientY,startCropX:h,startCropY:p,clientX:t.clientX,clientY:t.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(tg(x,a.width,a.height),v0(x,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),vl(this,"onDocPointerMove",t=>{const{crop:n,disabled:s,onChange:i,onDragStart:o}=this.props,l=this.getBox();if(s||!n||!this.mouseDownOnCrop)return;t.cancelable&&t.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(t));const{evData:a}=this;a.clientX=t.clientX,a.clientY=t.clientY;let h;a.isResize?h=this.resizeCrop():h=this.dragCrop(),Cke(n,h)||i(tg(h,l.width,l.height),v0(h,l.width,l.height))}),vl(this,"onComponentKeyDown",t=>{const{crop:n,disabled:s,onChange:i,onComplete:o}=this.props;if(s)return;const l=t.key;let a=!1;if(!n)return;const h=this.getBox(),p=this.makePixelCrop(h),x=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?Vp.nudgeStepLarge:t.shiftKey?Vp.nudgeStepMedium:Vp.nudgeStep;if(l==="ArrowLeft"?(p.x-=x,a=!0):l==="ArrowRight"?(p.x+=x,a=!0):l==="ArrowUp"?(p.y-=x,a=!0):l==="ArrowDown"&&(p.y+=x,a=!0),a){t.cancelable&&t.preventDefault(),p.x=a4(p.x,0,h.width-p.width),p.y=a4(p.y,0,h.height-p.height);const y=tg(p,h.width,h.height),b=v0(p,h.width,h.height);i(y,b),o&&o(y,b)}}),vl(this,"onHandlerKeyDown",(t,n)=>{const{aspect:s=0,crop:i,disabled:o,minWidth:l=0,minHeight:a=0,maxWidth:h,maxHeight:p,onChange:x,onComplete:y}=this.props,b=this.getBox();if(o||!i)return;if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")t.stopPropagation(),t.preventDefault();else return;const j=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?Vp.nudgeStepLarge:t.shiftKey?Vp.nudgeStepMedium:Vp.nudgeStep,N=tg(i,b.width,b.height),C=zpt(N,t.key,j,n),A=Mke(C,s,n,b.width,b.height,l,a,h,p);if(!Cke(i,A)){const E=v0(A,b.width,b.height);x(A,E),y&&y(A,E)}}),vl(this,"onDocPointerDone",t=>{const{crop:n,disabled:s,onComplete:i,onDragEnd:o}=this.props,l=this.getBox();this.unbindDocMove(),!(s||!n)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(t),i&&i(tg(n,l.width,l.height),v0(n,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),vl(this,"onDragFocus",()=>{var t;(t=this.componentRef.current)==null||t.scrollTo(0,0)})}get document(){return document}getBox(){const t=this.mediaRef.current;if(!t)return{x:0,y:0,width:0,height:0};const{x:n,y:s,width:i,height:o}=t.getBoundingClientRect();return{x:n,y:s,width:i,height:o}}componentDidUpdate(t){const{crop:n,onComplete:s}=this.props;if(s&&!t.crop&&n){const{width:i,height:o}=this.getBox();i&&o&&s(tg(n,i,o),v0(n,i,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,o4),this.document.addEventListener("pointerup",this.onDocPointerDone,o4),this.document.addEventListener("pointercancel",this.onDocPointerDone,o4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,o4),this.document.removeEventListener("pointerup",this.onDocPointerDone,o4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,o4),this.docMoveBound=!1)}getCropStyle(){const{crop:t}=this.props;if(t)return{top:`${t.y}${t.unit}`,left:`${t.x}${t.unit}`,width:`${t.width}${t.unit}`,height:`${t.height}${t.unit}`}}dragCrop(){const{evData:t}=this,n=this.getBox(),s=this.makePixelCrop(n),i=t.clientX-t.startClientX,o=t.clientY-t.startClientY;return s.x=a4(t.startCropX+i,0,n.width-s.width),s.y=a4(t.startCropY+o,0,n.height-s.height),s}getPointRegion(t,n,s,i){const{evData:o}=this,l=o.clientX-t.x,a=o.clientY-t.y;let h;i&&n?h=n==="nw"||n==="n"||n==="ne":h=a1?o?[o,o/n]:[l*n,l]:l?[l*n,l]:[o,o/n]}resizeCrop(){const{evData:t}=this,{aspect:n=0,maxWidth:s,maxHeight:i}=this.props,o=this.getBox(),[l,a]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let h=this.makePixelCrop(o);const p=this.getPointRegion(o,t.ord,l,a),x=t.ord||p;let y=t.clientX-t.startClientX,b=t.clientY-t.startClientY;(l&&x==="nw"||x==="w"||x==="sw")&&(y=Math.min(y,-l)),(a&&x==="nw"||x==="n"||x==="ne")&&(b=Math.min(b,-a));const j={unit:"px",x:0,y:0,width:0,height:0};p==="ne"?(j.x=t.startCropX,j.width=y,n?(j.height=j.width/n,j.y=t.startCropY-j.height):(j.height=Math.abs(b),j.y=t.startCropY-j.height)):p==="se"?(j.x=t.startCropX,j.y=t.startCropY,j.width=y,n?j.height=j.width/n:j.height=b):p==="sw"?(j.x=t.startCropX+y,j.y=t.startCropY,j.width=Math.abs(y),n?j.height=j.width/n:j.height=b):p==="nw"&&(j.x=t.startCropX+y,j.width=Math.abs(y),n?(j.height=j.width/n,j.y=t.startCropY-j.height):(j.height=Math.abs(b),j.y=t.startCropY+b));const N=Mke(j,n,p,o.width,o.height,l,a,s,i);return n||Vp.xyOrds.indexOf(x)>-1?h=N:Vp.xOrds.indexOf(x)>-1?(h.x=N.x,h.width=N.width):Vp.yOrds.indexOf(x)>-1&&(h.y=N.y,h.height=N.height),h.x=a4(h.x,0,o.width-h.width),h.y=a4(h.y,0,o.height-h.height),h}renderCropSelection(){const{ariaLabels:t=Vp.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:i,ruleOfThirds:o,crop:l}=this.props,a=this.getCropStyle();if(l)return rt.createElement("div",{style:a,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&&rt.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},rt.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),rt.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),rt.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),rt.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"nw"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"n"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"ne"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"e"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"se"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"s"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"sw"),role:"button"}),rt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"w"),role:"button"})),i&&rt.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:h=>h.stopPropagation()},i(this.state)),o&&rt.createElement(rt.Fragment,null,rt.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),rt.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(t){const n={...bte,...this.props.crop||{}};return tg(n,t.width,t.height)}render(){const{aspect:t,children:n,circularCrop:s,className:i,crop:o,disabled:l,locked:a,style:h,ruleOfThirds:p}=this.props,{cropIsActive:x,newCropIsBeingDrawn:y}=this.state,b=o?this.renderCropSelection():null,j=Dpt("ReactCrop",i,x&&"ReactCrop--active",l&&"ReactCrop--disabled",a&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&t&&"ReactCrop--fixed-aspect",o&&s&&"ReactCrop--circular-crop",o&&p&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",s&&"ReactCrop--no-animate");return rt.createElement("div",{ref:this.componentRef,className:j,style:h},rt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?rt.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},rt.createElement("defs",null,rt.createElement("mask",{id:`hole-${this.instanceId}`},rt.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?rt.createElement("ellipse",{cx:`${o.x+o.width/2}${o.unit}`,cy:`${o.y+o.height/2}${o.unit}`,rx:`${o.width/2}${o.unit}`,ry:`${o.height/2}${o.unit}`,fill:"black"}):rt.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),rt.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,b)}};vl(d0,"xOrds",["e","w"]),vl(d0,"yOrds",["n","s"]),vl(d0,"xyOrds",["nw","ne","se","sw"]),vl(d0,"nudgeStep",1),vl(d0,"nudgeStepMedium",10),vl(d0,"nudgeStepLarge",100),vl(d0,"defaultProps",{ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}});let $pt=d0;var WOe=["PageUp","PageDown"],GOe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],KOe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},f3="Slider",[The,Upt,qpt]=dI(f3),[ZOe]=Ql(f3,[qpt]),[Vpt,Mse]=ZOe(f3),YOe=I.forwardRef((e,t)=>{const{name:n,min:s=0,max:i=100,step:o=1,orientation:l="horizontal",disabled:a=!1,minStepsBetweenThumbs:h=0,defaultValue:p=[s],value:x,onValueChange:y=()=>{},onValueCommit:b=()=>{},inverted:j=!1,form:N,...C}=e,A=I.useRef(new Set),E=I.useRef(0),L=l==="horizontal"?Hpt:Wpt,[z=[],F]=Ou({prop:x,defaultProp:p,onChange:ae=>{var ve;(ve=[...A.current][E.current])==null||ve.focus(),y(ae)}}),q=I.useRef(z);function H(ae){const le=Xpt(z,ae);te(ae,le)}function K(ae){te(ae,E.current)}function Z(){const ae=q.current[E.current];z[E.current]!==ae&&b(z)}function te(ae,le,{commit:ve}={commit:!1}){const ne=tmt(o),ge=rmt(Math.round((ae-s)/o)*o+s,ne),ie=rE(ge,[s,i]);F((fe=[])=>{const de=Zpt(fe,ie,le);if(emt(de,h*o)){E.current=de.indexOf(ie);const ye=String(de)!==String(fe);return ye&&ve&&b(de),ye?de:fe}else return fe})}return r.jsx(Vpt,{scope:e.__scopeSlider,name:n,disabled:a,min:s,max:i,valueIndexToChangeRef:E,thumbs:A.current,values:z,orientation:l,form:N,children:r.jsx(The.Provider,{scope:e.__scopeSlider,children:r.jsx(The.Slot,{scope:e.__scopeSlider,children:r.jsx(L,{"aria-disabled":a,"data-disabled":a?"":void 0,...C,ref:t,onPointerDown:cn(C.onPointerDown,()=>{a||(q.current=z)}),min:s,max:i,inverted:j,onSlideStart:a?void 0:H,onSlideMove:a?void 0:K,onSlideEnd:a?void 0:Z,onHomeKeyDown:()=>!a&&te(s,0,{commit:!0}),onEndKeyDown:()=>!a&&te(i,z.length-1,{commit:!0}),onStepKeyDown:({event:ae,direction:le})=>{if(!a){const ge=WOe.includes(ae.key)||ae.shiftKey&&GOe.includes(ae.key)?10:1,ie=E.current,fe=z[ie],de=o*ge*le;te(fe+de,ie,{commit:!0})}}})})})})});YOe.displayName=f3;var[XOe,QOe]=ZOe(f3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Hpt=I.forwardRef((e,t)=>{const{min:n,max:s,dir:i,inverted:o,onSlideStart:l,onSlideMove:a,onSlideEnd:h,onStepKeyDown:p,...x}=e,[y,b]=I.useState(null),j=ei(t,L=>b(L)),N=I.useRef(void 0),C=sk(i),A=C==="ltr",E=A&&!o||!A&&o;function T(L){const z=N.current||y.getBoundingClientRect(),F=[0,z.width],H=Cxe(F,E?[n,s]:[s,n]);return N.current=z,H(L-z.left)}return r.jsx(XOe,{scope:e.__scopeSlider,startEdge:E?"left":"right",endEdge:E?"right":"left",direction:E?1:-1,size:"width",children:r.jsx(JOe,{dir:C,"data-orientation":"horizontal",...x,ref:j,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:L=>{const z=T(L.clientX);l==null||l(z)},onSlideMove:L=>{const z=T(L.clientX);a==null||a(z)},onSlideEnd:()=>{N.current=void 0,h==null||h()},onStepKeyDown:L=>{const F=KOe[E?"from-left":"from-right"].includes(L.key);p==null||p({event:L,direction:F?-1:1})}})})}),Wpt=I.forwardRef((e,t)=>{const{min:n,max:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:a,onStepKeyDown:h,...p}=e,x=I.useRef(null),y=ei(t,x),b=I.useRef(void 0),j=!i;function N(C){const A=b.current||x.current.getBoundingClientRect(),E=[0,A.height],L=Cxe(E,j?[s,n]:[n,s]);return b.current=A,L(C-A.top)}return r.jsx(XOe,{scope:e.__scopeSlider,startEdge:j?"bottom":"top",endEdge:j?"top":"bottom",size:"height",direction:j?1:-1,children:r.jsx(JOe,{"data-orientation":"vertical",...p,ref:y,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:C=>{const A=N(C.clientY);o==null||o(A)},onSlideMove:C=>{const A=N(C.clientY);l==null||l(A)},onSlideEnd:()=>{b.current=void 0,a==null||a()},onStepKeyDown:C=>{const E=KOe[j?"from-bottom":"from-top"].includes(C.key);h==null||h({event:C,direction:E?-1:1})}})})}),JOe=I.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:a,onStepKeyDown:h,...p}=e,x=Mse(f3,n);return r.jsx(Rn.span,{...p,ref:t,onKeyDown:cn(e.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(a(y),y.preventDefault()):WOe.concat(GOe).includes(y.key)&&(h(y),y.preventDefault())}),onPointerDown:cn(e.onPointerDown,y=>{const b=y.target;b.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(b)?b.focus():s(y)}),onPointerMove:cn(e.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&i(y)}),onPointerUp:cn(e.onPointerUp,y=>{const b=y.target;b.hasPointerCapture(y.pointerId)&&(b.releasePointerCapture(y.pointerId),o(y))})})}),eDe="SliderTrack",tDe=I.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,i=Mse(eDe,n);return r.jsx(Rn.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...s,ref:t})});tDe.displayName=eDe;var Ahe="SliderRange",rDe=I.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,i=Mse(Ahe,n),o=QOe(Ahe,n),l=I.useRef(null),a=ei(t,l),h=i.values.length,p=i.values.map(b=>iDe(b,i.min,i.max)),x=h>1?Math.min(...p):0,y=100-Math.max(...p);return r.jsx(Rn.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...s,ref:a,style:{...e.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});rDe.displayName=Ahe;var Ehe="SliderThumb",nDe=I.forwardRef((e,t)=>{const n=Upt(e.__scopeSlider),[s,i]=I.useState(null),o=ei(t,a=>i(a)),l=I.useMemo(()=>s?n().findIndex(a=>a.ref.current===s):-1,[n,s]);return r.jsx(Gpt,{...e,ref:o,index:l})}),Gpt=I.forwardRef((e,t)=>{const{__scopeSlider:n,index:s,name:i,...o}=e,l=Mse(Ehe,n),a=QOe(Ehe,n),[h,p]=I.useState(null),x=ei(t,T=>p(T)),y=h?l.form||!!h.closest("form"):!0,b=fI(h),j=l.values[s],N=j===void 0?0:iDe(j,l.min,l.max),C=Ypt(s,l.values.length),A=b==null?void 0:b[a.size],E=A?Qpt(A,N,a.direction):0;return I.useEffect(()=>{if(h)return l.thumbs.add(h),()=>{l.thumbs.delete(h)}},[h,l.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${N}% + ${E}px)`},children:[r.jsx(The.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Rn.span,{role:"slider","aria-label":e["aria-label"]||C,"aria-valuemin":l.min,"aria-valuenow":j,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:x,style:j===void 0?{display:"none"}:e.style,onFocus:cn(e.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(sDe,{name:i??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:j},s)]})});nDe.displayName=Ehe;var Kpt="RadioBubbleInput",sDe=I.forwardRef(({__scopeSlider:e,value:t,...n},s)=>{const i=I.useRef(null),o=ei(i,s),l=jI(t);return I.useEffect(()=>{const a=i.current;if(!a)return;const h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==t&&x){const y=new Event("input",{bubbles:!0});x.call(a,t),a.dispatchEvent(y)}},[l,t]),r.jsx(Rn.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});sDe.displayName=Kpt;function Zpt(e=[],t,n){const s=[...e];return s[n]=t,s.sort((i,o)=>i-o)}function iDe(e,t,n){const o=100/(n-t)*(e-t);return rE(o,[0,100])}function Ypt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Xpt(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),s=Math.min(...n);return n.indexOf(s)}function Qpt(e,t,n){const s=e/2,o=Cxe([0,50],[0,s]);return(s-o(t)*n)*n}function Jpt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function emt(e,t){if(t>0){const n=Jpt(e);return Math.min(...n)>=t}return!0}function Cxe(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function tmt(e){return(String(e).split(".")[1]||"").length}function rmt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var aDe=YOe,nmt=tDe,smt=rDe,imt=nDe;const lm=I.forwardRef(({className:e,...t},n)=>r.jsxs(aDe,{ref:n,className:$t("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(nmt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(smt,{className:"absolute h-full bg-primary"})}),r.jsx(imt,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));lm.displayName=aDe.displayName;function amt(e,t,n){return Fpt(Rpt({unit:"%",width:90},n,e,t),e,t)}const Mxe=({open:e,onClose:t,imageSrc:n,onCropComplete:s,aspectRatio:i=1})=>{const o=I.useRef(null),[l,a]=I.useState(),[h,p]=I.useState(),[x,y]=I.useState(1),[b,j]=I.useState(0),N=I.useCallback(E=>{const{width:T,height:L}=E.currentTarget;a(amt(T,L,i))},[i]),C=I.useCallback(async()=>{const E=o.current;if(!E||!h)return;const T=document.createElement("canvas"),L=T.getContext("2d");if(!L)return;const z=E.naturalWidth/E.width,F=E.naturalHeight/E.height,q=400;T.width=q,T.height=q,L.imageSmoothingQuality="high";const H=h.x*z,K=h.y*F,Z=h.width*z,te=h.height*F,ae=b*Math.PI/180,le=T.width/2,ve=T.height/2;return L.save(),L.translate(le,ve),L.rotate(ae),L.scale(x,x),L.translate(-le,-ve),L.drawImage(E,H,K,Z,te,0,0,q,q),L.restore(),new Promise((ne,ge)=>{T.toBlob(ie=>{ie?ne(ie):ge(new Error("Canvas is empty"))},"image/jpeg",.95)})},[h,x,b]),A=async()=>{try{const E=await C();E&&(s(E),t())}catch(E){console.error("Error cropping image:",E)}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Crop Your Photo"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative max-h-[400px] overflow-hidden rounded-lg bg-muted flex items-center justify-center",children:r.jsx($pt,{crop:l,onChange:(E,T)=>a(T),onComplete:E=>p(E),aspect:i,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${x}) rotate(${b}deg)`,maxHeight:"400px",width:"auto"},onLoad:N})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(yS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(lm,{value:[x],min:.5,max:3,step:.1,onValueChange:([E])=>y(E),className:"flex-1"}),r.jsx(xS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(GT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(lm,{value:[b],min:-180,max:180,step:1,onValueChange:([E])=>j(E),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[b,"°"]})]})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(ee,{onClick:A,children:"Save Photo"})]})]})})},omt=()=>{const{user:e}=zr(),{toast:t}=pa(),[n,s]=I.useState(!1),[i,o]=I.useState(!1),[l,a]=I.useState(null);I.useEffect(()=>{e&&h()},[e]);const h=async()=>{s(!0);try{const{data:y}=await J.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",e==null?void 0:e.id).single();y&&a({status:y.subscription_status||"none",productId:y.subscription_product_id,endDate:y.subscription_end_date,isGrandfathered:y.is_grandfathered||!1})}catch(y){console.error("Error loading subscription:",y)}finally{s(!1)}},p=async()=>{o(!0);try{const{data:{session:y}}=await J.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:b,error:j}=await J.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(j)throw j;b!=null&&b.url&&window.open(b.url,"_blank")}catch(y){console.error("Error opening customer portal:",y),t({title:"Error",description:y.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},x=()=>{if(l!=null&&l.isGrandfathered)return r.jsx(Rt,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(Rt,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Rt,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Rt,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Rt,{variant:"secondary",children:"Canceled"});default:return r.jsx(Rt,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(fm,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(fm,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(En,{children:"Manage your subscription and billing"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Status"}),r.jsx("div",{className:"mt-1",children:x()})]}),(l==null?void 0:l.endDate)&&l.status==="active"&&r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),r.jsx("p",{className:"font-medium",children:new Date(l.endDate).toLocaleDateString()})]})]}),l!=null&&l.isGrandfathered?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your account was upgraded from LevelUp 1.0. To update/manage your subscription please reach out to support."}):(l==null?void 0:l.status)==="active"||(l==null?void 0:l.status)==="trialing"?r.jsxs(r.Fragment,{children:[(l==null?void 0:l.status)==="trialing"&&(l==null?void 0:l.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(l.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(ee,{onClick:p,variant:"outline",disabled:i,children:[i?r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Fs,{className:"mr-2 h-4 w-4"}),"Manage Billing"]})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have an active subscription."})]})]})},lmt=()=>{const{user:e}=zr(),t=ns(),{toast:n}=pa(),[s]=Fd(),i=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:a,isLoading:h,subscribe:p,unsubscribe:x}=cOe(),[y,b]=I.useState(!1),[j,N]=I.useState(""),[C,A]=I.useState(!1),[E,T]=I.useState(!1),[L,z]=I.useState(""),[F,q]=I.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}),[H,K]=I.useState(!1),[Z,te]=I.useState(!1),[ae,le]=I.useState({newPassword:"",confirmPassword:""});I.useEffect(()=>{e&&ve()},[e]),I.useEffect(()=>{o&&e&&setTimeout(()=>{var de;(de=document.getElementById("change-password-section"))==null||de.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,e]);const ve=async()=>{var de,ye,Ie;if(!(e!=null&&e.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",e.id);const{data:Ne,error:we}=await J.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("id",e.id).maybeSingle();if(we)throw console.error("Profile query error:",we),we;Ne?(console.log("Profile loaded successfully:",Ne),q({name:Ne.name||"",email:Ne.email||"",title:Ne.title||"",bio:Ne.bio||"",areas_served:Ne.areas_served||"",years_experience:((de=Ne.years_experience)==null?void 0:de.toString())||"",instagram_url:Ne.instagram_url||"",facebook_url:Ne.facebook_url||"",linkedin_url:Ne.linkedin_url||""}),K(Ne.digest_opt_out||!1)):(console.warn("No profile found for user"),q({name:((ye=e.user_metadata)==null?void 0:ye.name)||((Ie=e.email)==null?void 0:Ie.split("@")[0])||"",email:e.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}));const{data:he}=await J.storage.from("avatars").list(`${e.id}`);if(he&&he.length>0){const{data:xe}=J.storage.from("avatars").getPublicUrl(`${e.id}/${he[0].name}`);N(xe.publicUrl)}}catch(Ne){console.error("Error loading profile:",Ne),n({title:"Error",description:Ne.message||"Failed to load profile",variant:"destructive"})}},ne=de=>{var Ne;const ye=(Ne=de.target.files)==null?void 0:Ne[0];if(!ye)return;const Ie=new FileReader;Ie.onloadend=()=>{z(Ie.result),T(!0)},Ie.readAsDataURL(ye),de.target.value=""},ge=async de=>{if(e){A(!0);try{const{data:ye}=await J.storage.from("avatars").list(`${e.id}`);ye&&ye.length>0&&await J.storage.from("avatars").remove(ye.map(xe=>`${e.id}/${xe.name}`));const Ne=`${e.id}/avatar.jpg`,{error:we}=await J.storage.from("avatars").upload(Ne,de,{upsert:!0,contentType:"image/jpeg"});if(we)throw we;const{data:he}=J.storage.from("avatars").getPublicUrl(Ne);N(`${he.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(ye){console.error("Error uploading avatar:",ye),n({title:"Error",description:ye.message||"Failed to upload photo",variant:"destructive"})}finally{A(!1)}}},ie=async()=>{if(!F.name.trim()||!F.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}b(!0);try{const{error:de}=await J.from("profiles").update({name:F.name.trim(),email:F.email.trim(),title:F.title.trim()||null,bio:F.bio.trim()||null,areas_served:F.areas_served.trim()||null,years_experience:F.years_experience?parseInt(F.years_experience):null,instagram_url:F.instagram_url.trim()||null,facebook_url:F.facebook_url.trim()||null,linkedin_url:F.linkedin_url.trim()||null}).eq("id",e==null?void 0:e.id);if(de)throw de;n({title:"Success",description:"Profile updated successfully"})}catch(de){console.error("Error updating profile:",de),n({title:"Error",description:de.message||"Failed to update profile",variant:"destructive"})}finally{b(!1)}},fe=async()=>{if(!ae.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(ae.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(ae.newPassword!==ae.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}b(!0);try{const{error:de}=await J.auth.updateUser({password:ae.newPassword});if(de)throw de;n({title:"Success",description:"Password updated successfully"}),le({newPassword:"",confirmPassword:""}),i&&setTimeout(()=>t("/dashboard"),1e3)}catch(de){console.error("Error updating password:",de),n({title:"Error",description:de.message||"Failed to update password",variant:"destructive"})}finally{b(!1)}};return r.jsx(Or,{title:i?"Complete Your Profile":o?"Reset Your Password":"Profile Settings",description:i?"Welcome! Please complete your profile setup":o?"Please set a new password for your account":"Manage your account information and password",children:r.jsxs("div",{className:"mx-auto max-w-4xl",children:[!i&&!o&&r.jsx("div",{className:"mb-6",children:r.jsxs(ee,{variant:"outline",onClick:()=>{var de;(de=document.getElementById("change-password-section"))==null||de.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(xj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Profile Photo"}),r.jsx(En,{children:"Upload a professional photo for your profile"})]}),r.jsxs(Xe,{className:"flex items-center gap-6",children:[r.jsxs(ci,{className:"h-24 w-24",children:[r.jsx(Ga,{src:j}),r.jsx(di,{className:"text-2xl",children:F.name.split(" ").map(de=>de[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ne,disabled:C}),r.jsxs(ee,{variant:"outline",onClick:()=>{var de;return(de=document.getElementById("avatar-upload"))==null?void 0:de.click()},disabled:C,children:[r.jsx(no,{className:"mr-2 h-4 w-4"}),C?"Uploading...":"Upload Photo"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload an image and crop it to your liking."})]})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Personal Information"}),r.jsx(En,{children:"Update your profile details"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",value:F.name,onChange:de=>q({...F,name:de.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"email",children:"Email"}),r.jsx(at,{id:"email",type:"email",value:F.email,onChange:de=>q({...F,email:de.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Job Title"}),r.jsx(at,{id:"title",value:F.title,onChange:de=>q({...F,title:de.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"bio",children:"Bio"}),r.jsx(at,{id:"bio",value:F.bio,onChange:de=>q({...F,bio:de.target.value}),placeholder:"A short description about yourself",maxLength:500})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(at,{id:"areas_served",value:F.areas_served,onChange:de=>q({...F,areas_served:de.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(at,{id:"years_experience",type:"number",min:"0",value:F.years_experience,onChange:de=>q({...F,years_experience:de.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(at,{value:F.linkedin_url,onChange:de=>q({...F,linkedin_url:de.target.value}),placeholder:"LinkedIn URL"}),r.jsx(at,{value:F.instagram_url,onChange:de=>q({...F,instagram_url:de.target.value}),placeholder:"Instagram URL"}),r.jsx(at,{value:F.facebook_url,onChange:de=>q({...F,facebook_url:de.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(ee,{onClick:ie,disabled:y,children:[r.jsx(jg,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(Ge,{id:"change-password-section",children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:i?"Set Your Password":"Change Password"}),r.jsx(En,{children:i?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"newPassword",children:"New Password"}),r.jsx(at,{id:"newPassword",type:"password",value:ae.newPassword,onChange:de=>le({...ae,newPassword:de.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(at,{id:"confirmPassword",type:"password",value:ae.confirmPassword,onChange:de=>le({...ae,confirmPassword:de.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(ee,{onClick:fe,disabled:y,children:[r.jsx(jg,{className:"mr-2 h-4 w-4"}),i?"Complete Setup":"Update Password"]}),i&&r.jsx(ee,{variant:"outline",onClick:()=>t("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[a?r.jsx(_g,{className:"h-5 w-5"}):r.jsx(cj,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(En,{children:"Receive browser notifications when new content is added"})]}),r.jsx(Xe,{children:l?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:a?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:a?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx(Rs,{checked:a,onCheckedChange:de=>{de?p():x()},disabled:h})]}):r.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"Push notifications are not supported in this browser."}),r.jsxs("p",{className:"text-xs",children:[r.jsx("strong",{children:"Desktop:"})," Use Chrome, Firefox, or Edge.",r.jsx("br",{}),r.jsx("strong",{children:"iPhone/iPad:"}),' Open this site in Safari, tap the Share button, then "Add to Home Screen". Push notifications will work from the installed app.']})]})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[H?r.jsx(DT,{className:"h-5 w-5"}):r.jsx(Ys,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(En,{children:"Manage your email subscription settings"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:H?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(Rs,{checked:!H,onCheckedChange:async de=>{te(!0);try{const{error:ye}=await J.from("profiles").update({digest_opt_out:!de}).eq("id",e==null?void 0:e.id);if(ye)throw ye;K(!de),n({title:de?"Subscribed":"Unsubscribed",description:de?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(ye){n({title:"Error",description:ye.message||"Failed to update preference",variant:"destructive"})}finally{te(!1)}},disabled:Z})]})})]}),r.jsx(omt,{})]}),r.jsx(Mxe,{open:E,onClose:()=>T(!1),imageSrc:L,onCropComplete:ge,aspectRatio:1})]})})};var cmt="AspectRatio",oDe=I.forwardRef((e,t)=>{const{ratio:n=1/1,style:s,...i}=e;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx(Rn.div,{...i,ref:t,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});oDe.displayName=cmt;var dmt=oDe;const umt=dmt;function hmt(){const{user:e}=zr(),t=Wr(),[n,s]=I.useState(!1),[i,o]=I.useState(!1),{data:l,isLoading:a}=Zt({queryKey:["calendar-token",e==null?void 0:e.id],queryFn:async()=>{const{data:N,error:C}=await J.from("profiles").select("calendar_token").eq("id",e==null?void 0:e.id).single();if(C)throw C;return N},enabled:!!e&&i}),h=cr({mutationFn:async()=>{const N=new Uint8Array(12);crypto.getRandomValues(N);const C=btoa(String.fromCharCode(...N)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:A}=await J.from("profiles").update({calendar_token:C}).eq("id",e==null?void 0:e.id);if(A)throw A;return C},onSuccess:()=>{t.invalidateQueries({queryKey:["calendar-token",e==null?void 0:e.id]}),ze.success("Calendar subscription URL generated!")},onError:N=>{ze.error("Failed to generate calendar URL: "+N.message)}}),p=l!=null&&l.calendar_token?`https://dashboard.relevelup.com/api/calendar/${l.calendar_token}.ics`:null,x=async()=>{p&&(await navigator.clipboard.writeText(p),s(!0),ze.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},y=()=>{p&&(window.location.href=p.replace("https://","webcal://"))},b=()=>{if(p){const N=p.replace("https://","webcal://"),C=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(N)}`;window.open(C,"_blank")}},j=()=>{if(p){const N=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(p)}&name=Level%20Up%20Events`;window.open(N,"_blank")}};return r.jsxs(Br,{open:i,onOpenChange:o,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(es,{children:"Add all Level Up events to your personal calendar. Events will sync automatically and update when we add or change events."})]}),r.jsx("div",{className:"space-y-4 py-4",children:a?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):p?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Your Calendar URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:p,readOnly:!0,className:"text-xs font-mono"}),r.jsx(ee,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx(Ca,{className:"h-4 w-4 text-green-500"}):r.jsx(pl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Quick Add"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:y,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"})}),"Add to Apple Calendar",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:b,children:[r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("path",{d:"M19.5 22h-15A2.5 2.5 0 0 1 2 19.5v-15A2.5 2.5 0 0 1 4.5 2H9v2H4.5a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V15h2v4.5a2.5 2.5 0 0 1-2.5 2.5z"}),r.jsx("path",{d:"M12 2v8.5a1.5 1.5 0 0 0 1.5 1.5H22V2h-10z",fill:"#4285F4"}),r.jsx("path",{d:"M12 12V2H4.5A2.5 2.5 0 0 0 2 4.5V12h10z",fill:"#34A853"}),r.jsx("path",{d:"M2 12v7.5A2.5 2.5 0 0 0 4.5 22H12v-10H2z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 22h7.5a2.5 2.5 0 0 0 2.5-2.5V12h-10v10z",fill:"#EA4335"})]}),"Add to Google Calendar",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:j,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V12zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.81v-2.72zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z"})}),"Add to Outlook",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Events sync automatically. If your membership expires, the calendar will show as empty."})]}):r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate your personal calendar subscription URL to get started."}),r.jsx(ee,{onClick:()=>h.mutate(),disabled:h.isPending,className:"w-full",children:h.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(zs,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var Tse="Tabs",[fmt]=Ql(Tse,[h3]),lDe=h3(),[pmt,Txe]=fmt(Tse),cDe=I.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:i,defaultValue:o,orientation:l="horizontal",dir:a,activationMode:h="automatic",...p}=e,x=sk(a),[y,b]=Ou({prop:s,onChange:i,defaultProp:o??"",caller:Tse});return r.jsx(pmt,{scope:n,baseId:Vc(),value:y,onValueChange:b,orientation:l,dir:x,activationMode:h,children:r.jsx(Rn.div,{dir:x,"data-orientation":l,...p,ref:t})})});cDe.displayName=Tse;var dDe="TabsList",uDe=I.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...i}=e,o=Txe(dDe,n),l=lDe(n);return r.jsx(Bge,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Rn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});uDe.displayName=dDe;var hDe="TabsTrigger",fDe=I.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:i=!1,...o}=e,l=Txe(hDe,n),a=lDe(n),h=gDe(l.baseId,s),p=xDe(l.baseId,s),x=s===l.value;return r.jsx($ge,{asChild:!0,...a,focusable:!i,active:x,children:r.jsx(Rn.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:h,...o,ref:t,onMouseDown:cn(e.onMouseDown,y=>{!i&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:cn(e.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:cn(e.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!i&&y&&l.onValueChange(s)})})})});fDe.displayName=hDe;var pDe="TabsContent",mDe=I.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:i,children:o,...l}=e,a=Txe(pDe,n),h=gDe(a.baseId,s),p=xDe(a.baseId,s),x=s===a.value,y=I.useRef(x);return I.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),r.jsx(pc,{present:i||x,children:({present:b})=>r.jsx(Rn.div,{"data-state":x?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":h,hidden:!b,id:p,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:y.current?"0s":void 0},children:b&&o})})});mDe.displayName=pDe;function gDe(e,t){return`${e}-trigger-${t}`}function xDe(e,t){return`${e}-content-${t}`}var mmt=cDe,yDe=uDe,vDe=fDe,_De=mDe;const ba=mmt,fa=I.forwardRef(({className:e,...t},n)=>r.jsx(yDe,{ref:n,className:$t("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));fa.displayName=yDe.displayName;const ln=I.forwardRef(({className:e,...t},n)=>r.jsx(vDe,{ref:n,className:$t("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",e),...t}));ln.displayName=vDe.displayName;const An=I.forwardRef(({className:e,...t},n)=>r.jsx(_De,{ref:n,className:$t("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));An.displayName=_De.displayName;const gmt={first_timer:vs,regular:Hx,dedicated:Pl,veteran:Wa,streak_master:Zh,century:Wa},xmt={first_timer:"bg-green-500/10 text-green-500 border-green-500/20",regular:"bg-blue-500/10 text-blue-500 border-blue-500/20",dedicated:"bg-purple-500/10 text-purple-500 border-purple-500/20",veteran:"bg-amber-500/10 text-amber-500 border-amber-500/20",streak_master:"bg-orange-500/10 text-orange-500 border-orange-500/20",century:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20"};function Tke(e){return e===1?r.jsx(Wa,{className:"h-5 w-5 text-yellow-500"}):e===2?r.jsx(Hx,{className:"h-5 w-5 text-gray-400"}):e===3?r.jsx(Pl,{className:"h-5 w-5 text-amber-600"}):r.jsx("span",{className:"w-5 text-center text-sm font-medium text-muted-foreground",children:e})}function bDe({showUserStats:e=!0,compact:t=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:i}=zr(),{data:o,isLoading:l}=IOe(t?5:10,n),{data:a}=POe(i==null?void 0:i.id),{data:h}=OOe(i==null?void 0:i.id),{data:p}=LOe(i==null?void 0:i.id);return l?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Pr,{className:"h-12 w-full"},y))})})]}):r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(Xe,{children:[e&&a&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Your Stats"}),h&&r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:["Rank #",h]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-primary",children:a.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Points"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold",children:a.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Zh,{className:"h-4 w-4 text-orange-500"}),r.jsx("div",{className:"text-lg font-bold",children:a.current_streak}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),p&&p.length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[p.slice(0,4).map(x=>{const y=gmt[x.badge_type]||vs;return r.jsxs(Rt,{variant:"outline",className:`text-xs ${xmt[x.badge_type]||""}`,title:x.badge_description||"",children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),x.badge_name]},x.id)}),p.length>4&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:["+",p.length-4," more"]})]})]}),r.jsxs(ba,{defaultValue:"points",className:"w-full",children:[r.jsxs(fa,{className:"w-full mb-3",children:[r.jsx(ln,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(ln,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(An,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((x,y)=>{var b,j,N;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:Tke(y+1)}),r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"text-xs",children:((j=(b=x.profile)==null?void 0:b.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((N=x.profile)==null?void 0:N.name)||"Unknown",x.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_events_attended," events"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold text-primary",children:x.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},x.user_id)}),(!o||o.length===0)&&r.jsx("div",{className:"text-center text-muted-foreground py-4 text-sm",children:"No attendance data yet. Attend an event to get on the leaderboard!"})]})}),r.jsx(An,{value:"events",className:"mt-0",children:r.jsx("div",{className:"space-y-2",children:[...o||[]].sort((x,y)=>y.total_events_attended-x.total_events_attended).map((x,y)=>{var b,j,N;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(i==null?void 0:i.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:Tke(y+1)}),r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"text-xs",children:((j=(b=x.profile)==null?void 0:b.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((N=x.profile)==null?void 0:N.name)||"Unknown",x.user_id===(i==null?void 0:i.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_points," points"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold",children:x.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},x.user_id)})})})]})]})]})}function ymt(){const e=ns(),{user:t,isAdmin:n}=zr(),s=Wr(),{data:i,isLoading:o}=Zt({queryKey:["public-events"],queryFn:async()=>{const{data:C,error:A}=await J.from("events").select("*").order("event_date",{ascending:!0});if(A)throw A;return C}}),{data:l}=Zt({queryKey:["my-registrations"],queryFn:async()=>{if(!t)return[];const{data:C,error:A}=await J.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t.id);if(A)throw A;return C},enabled:!!t}),{data:a}=Zt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:C,error:A}=await J.from("event_registrations").select("event_id");if(A)throw A;const E={};return C.forEach(T=>{E[T.event_id]=(E[T.event_id]||0)+1}),E}}),h=cr({mutationFn:async C=>{const{data:A,error:E}=await J.functions.invoke("zoom-register",{body:{event_id:C}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:C=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),C!=null&&C.join_url?ze.success("Successfully registered! You'll receive a Zoom confirmation email."):ze.success("Successfully registered for the event!")},onError:C=>{ze.error("Failed to register: "+C.message)}}),p=cr({mutationFn:async C=>{const{data:A,error:E}=await J.functions.invoke("zoom-unregister",{body:{event_id:C}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),ze.success("Registration cancelled and removed from Zoom")},onError:C=>{ze.error("Failed to cancel: "+C.message)}}),x=C=>l==null?void 0:l.some(A=>A.event_id===C),y=C=>{const A=l==null?void 0:l.find(E=>E.event_id===C);return A==null?void 0:A.zoom_join_url},b=C=>C.capacity?((a==null?void 0:a[C.id])||0)>=C.capacity:!1,j=(i==null?void 0:i.filter(C=>TS(C.event_date)!=="ended"))||[],N=(i==null?void 0:i.filter(C=>TS(C.event_date)==="ended"))||[];return r.jsx(Or,{title:"Events",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Events"}),r.jsx("p",{className:"text-muted-foreground",children:"Browse and register for upcoming events"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(hmt,{}),n&&r.jsx(ee,{variant:"outline",onClick:()=>e("/admin/events"),children:"Manage Events"})]})]}),r.jsxs("div",{className:`grid grid-cols-1 ${n?"lg:grid-cols-3":""} gap-6`,children:[r.jsxs("div",{className:n?"lg:col-span-2":"",children:[o?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading events..."}):j.length===0?r.jsx(Ge,{className:"text-center py-12",children:r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:j.map(C=>{const A=TS(C.event_date),E=vxe(C.event_date),T=A==="live",L=A==="starting_soon";return r.jsxs(Ge,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${T?"border-red-500 ring-2 ring-red-500/20":L?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>e(`/events/${C.id}`),children:[E&&r.jsxs("div",{className:`${T?"bg-red-500":"bg-amber-500"} text-white px-3 py-1.5 flex items-center gap-2 text-sm font-medium`,children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),T?r.jsxs(r.Fragment,{children:[r.jsx(bj,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ki,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),C.image_url&&r.jsx(umt,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:C.image_url,alt:C.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Gt,{children:[r.jsx(Qt,{className:"line-clamp-2",children:C.title}),C.description&&r.jsx(En,{className:"line-clamp-2",children:C.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(Xe,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(zs,{className:"h-4 w-4"}),new Intl.DateTimeFormat("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(C.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ki,{className:"h-4 w-4"}),oE(new Date(C.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Vn,{className:"h-4 w-4"}),(a==null?void 0:a[C.id])||0," registered",C.capacity&&` / ${C.capacity} spots`]})]}),r.jsx(oA,{className:"flex gap-2",onClick:z=>z.stopPropagation(),children:x(C.id)?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>p.mutate(C.id),disabled:p.isPending,children:[r.jsx(bs,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(ee,{className:"flex-1",onClick:()=>window.open(y(C.id)||C.zoom_link,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(ee,{className:"w-full",onClick:()=>h.mutate(C.id),disabled:h.isPending||b(C),children:b(C)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(Ca,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},C.id)})}),N.length>0&&r.jsxs("div",{className:"mt-12",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4 text-muted-foreground",children:"Past Events"}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:N.map(C=>r.jsx(Ge,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>e(`/events/${C.id}`),children:r.jsxs(Gt,{children:[r.jsx(Qt,{className:"text-base line-clamp-1",children:C.title}),r.jsx(En,{children:new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(C.event_date))})]})},C.id))})]})]}),n&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(bDe,{showUserStats:!0})})]})]})})}const tce=[{value:"all",label:"All Roles",icon:Vn},{value:"brokerage_manager",label:"Brokerage Managers",icon:rA},{value:"admin",label:"Admins",icon:Kf}];function vmt({open:e,onOpenChange:t,resourceType:n,resourceId:s,resourceTitle:i}){var Me,Qe;const{user:o,isAdmin:l,isBrokerageManager:a}=zr(),[h,p]=I.useState([]),[x,y]=I.useState([]),[b,j]=I.useState([]),[N,C]=I.useState([]),[A,E]=I.useState(""),[T,L]=I.useState(""),[z,F]=I.useState(""),[q,H]=I.useState(!1),[K,Z]=I.useState(!1),[te,ae]=I.useState("agents"),[le,ve]=I.useState("all"),[ne,ge]=I.useState({}),ie=l||a;I.useEffect(()=>{e&&o&&(l?fe():de())},[e,o,l]),I.useEffect(()=>{e||(j([]),C([]),E(""),L(""),F(""),ae("agents"),ve("all"))},[e]);const fe=async()=>{if(o){H(!0);try{const{data:Ee,error:Ye}=await J.from("brokerages").select("id, name").order("name");if(Ye)throw Ye;const me=1e3,mt={};let et=0,nt=!0;for(;nt;){const{data:$e,error:Je}=await J.from("profiles").select("brokerage_id").range(et*me,(et+1)*me-1);if(Je)throw Je;$e==null||$e.forEach(tt=>{tt.brokerage_id&&(mt[tt.brokerage_id]=(mt[tt.brokerage_id]||0)+1)}),nt=($e==null?void 0:$e.length)===me,et++}y((Ee==null?void 0:Ee.map($e=>({...$e,agent_count:mt[$e.id]||0})))||[]);const Ae=[];for(et=0,nt=!0;nt;){const{data:$e,error:Je}=await J.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(et*me,(et+1)*me-1);if(Je)throw Je;$e&&Ae.push(...$e),nt=($e==null?void 0:$e.length)===me,et++}const ht={};for(et=0,nt=!0;nt;){const{data:$e,error:Je}=await J.from("user_roles").select("user_id, role").range(et*me,(et+1)*me-1);if(Je)throw Je;$e==null||$e.forEach(tt=>{ht[tt.user_id]||(ht[tt.user_id]=[]),ht[tt.user_id].push(tt.role)}),nt=($e==null?void 0:$e.length)===me,et++}ge(ht),p(Ae.map($e=>{var Je;return{id:$e.id,name:$e.name,email:$e.email,brokerage_name:((Je=$e.brokerages)==null?void 0:Je.name)||"No Brokerage",roles:ht[$e.id]||[]}}))}catch(Ee){console.error("Error loading data:",Ee),ze.error("Failed to load agents and brokerages")}finally{H(!1)}}},de=async()=>{if(o){H(!0);try{const{data:Ee}=await J.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Ee!=null&&Ee.brokerage_id)){ze.error("You must be part of a brokerage to share resources"),t(!1);return}const{data:Ye,error:me}=await J.from("profiles").select("id, name, email").eq("brokerage_id",Ee.brokerage_id).neq("id",o.id).order("name");if(me)throw me;p(Ye||[])}catch(Ee){console.error("Error loading agents:",Ee),ze.error("Failed to load agents")}finally{H(!1)}}},ye=h.filter(Ee=>{var me;const Ye=Ee.name.toLowerCase().includes(A.toLowerCase())||Ee.email.toLowerCase().includes(A.toLowerCase())||((me=Ee.brokerage_name)==null?void 0:me.toLowerCase().includes(A.toLowerCase()));if(l&&le!=="all"){const mt=ne[Ee.id]||[];return Ye&&mt.includes(le)}return Ye}),Ie=x.filter(Ee=>Ee.name.toLowerCase().includes(T.toLowerCase())),Ne=()=>{b.length===ye.length?j([]):j(ye.map(Ee=>Ee.id))},we=()=>{N.length===Ie.length?C([]):C(Ie.map(Ee=>Ee.id))},he=Ee=>{if(!ie){j([Ee]);return}j(Ye=>Ye.includes(Ee)?Ye.filter(me=>me!==Ee):[...Ye,Ee])},xe=Ee=>{C(Ye=>Ye.includes(Ee)?Ye.filter(me=>me!==Ee):[...Ye,Ee])},be=async()=>{if(!(b.length>0||N.length>0)){ze.error("Please select at least one agent or brokerage to share with");return}Z(!0);try{const{data:Ye,error:me}=await J.functions.invoke("send-share-notification",{body:{recipientIds:b,brokerageIds:N,resourceType:n,resourceId:s,resourceTitle:i,message:z.trim()||void 0}});if(me)throw me;const mt=(Ye==null?void 0:Ye.sharesCreated)||b.length;ze.success(`Shared with ${mt} agent${mt!==1?"s":""}`),t(!1)}catch(Ye){console.error("Error sharing resource:",Ye),ze.error("Failed to share resource")}finally{Z(!1)}},Oe=Ee=>Ee.split(" ").map(Ye=>Ye[0]).join("").toUpperCase().slice(0,2),Te=Ee=>{const Ye=ne[Ee]||[];return Ye.includes("admin")?r.jsx(Rt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):Ye.includes("brokerage_manager")?r.jsx(Rt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Ve=b.length+N.length,Fe=le!=="all"?ye.length:null;return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{className:"flex-shrink-0",children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Lo,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(es,{className:"line-clamp-2",children:['Share "',i,'" with ',l?"agents or brokerages":"agents in your brokerage"]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[l?r.jsxs(ba,{value:te,onValueChange:ae,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(ln,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),b.length>0&&r.jsx(Rt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:b.length})]}),r.jsxs(ln,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),N.length>0&&r.jsx(Rt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:N.length})]})]}),r.jsxs(An,{value:"agents",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name, email, or brokerage...",value:A,onChange:Ee=>E(Ee.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:le,onValueChange:ve,children:[r.jsxs(mn,{className:"w-[180px]",children:[r.jsx(pj,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(_n,{placeholder:"Filter by role"})]}),r.jsx(gn,{children:tce.map(Ee=>r.jsx(Ht,{value:Ee.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ee.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Ee.label})]})},Ee.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:Ne,className:"text-xs h-8",disabled:ye.length===0,children:[r.jsx(Vn,{className:"h-3.5 w-3.5 mr-1.5"}),b.length===ye.length&&ye.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Fe!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Fe," ",(Me=tce.find(Ee=>Ee.value===le))==null?void 0:Me.label]}),r.jsxs("span",{className:"font-medium",children:[b.length," selected"]})]})]}),r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ye.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Vn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:le!=="all"?`No ${(Qe=tce.find(Ee=>Ee.value===le))==null?void 0:Qe.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ye.map(Ee=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${b.includes(Ee.id)?"bg-accent":""}`,onClick:()=>he(Ee.id),children:[r.jsx(cc,{checked:b.includes(Ee.id),onCheckedChange:()=>he(Ee.id),className:"flex-shrink-0"}),r.jsx(ci,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(di,{className:"text-xs bg-primary/10 text-primary",children:Oe(Ee.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ee.name}),Te(Ee.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Ee.email,Ee.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Ee.brokerage_name]})]})]})]},Ee.id))})})]}),r.jsxs(An,{value:"brokerages",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search brokerages...",value:T,onChange:Ee=>L(Ee.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:we,className:"text-xs h-8",disabled:Ie.length===0,children:[r.jsx(na,{className:"h-3.5 w-3.5 mr-1.5"}),N.length===Ie.length&&Ie.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[N.length," selected"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground px-1 flex-shrink-0",children:"Selecting a brokerage will send to all agents in that brokerage."}),r.jsx(Jo,{className:"h-[250px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ie.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(na,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No brokerages found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:Ie.map(Ee=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${N.includes(Ee.id)?"bg-accent":""}`,onClick:()=>xe(Ee.id),children:[r.jsx(cc,{checked:N.includes(Ee.id),onCheckedChange:()=>xe(Ee.id),className:"flex-shrink-0"}),r.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(na,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ee.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ee.agent_count," agent",Ee.agent_count!==1?"s":""]})]})]},Ee.id))})})]})]}):r.jsxs("div",{className:"flex-1 flex flex-col space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search agents...",value:A,onChange:Ee=>E(Ee.target.value),className:"pl-9"})]}),ie&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:Ne,className:"text-xs h-8",disabled:ye.length===0,children:[r.jsx(Vn,{className:"h-3.5 w-3.5 mr-1.5"}),b.length===ye.length&&ye.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[b.length," selected"]})]}),r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ye.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Vn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ye.map(Ee=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${b.includes(Ee.id)?"bg-accent":""}`,onClick:()=>he(Ee.id),children:[r.jsx(cc,{checked:b.includes(Ee.id),onCheckedChange:()=>he(Ee.id),className:"flex-shrink-0"}),r.jsx(ci,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(di,{className:"text-xs bg-primary/10 text-primary",children:Oe(Ee.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Ee.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ee.email})]})]},Ee.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(Ue,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(ps,{id:"message",placeholder:"I thought you might find this useful...",value:z,onChange:Ee=>F(Ee.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ee,{onClick:be,disabled:Ve===0||K,children:K?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function p3({resourceType:e,resourceId:t,resourceTitle:n,variant:s="outline",size:i="sm",className:o=""}){const[l,a]=I.useState(!1),{user:h}=zr();return h?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:s,size:i,onClick:()=>a(!0),className:o,children:[r.jsx(uc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(vmt,{open:l,onOpenChange:a,resourceType:e,resourceId:t,resourceTitle:n})]}):null}function _mt(){const{eventId:e}=Wc(),t=ns(),{user:n}=zr(),[s,i]=I.useState(null),[o,l]=I.useState(null),[a,h]=I.useState(0),[p,x]=I.useState(!0),[y,b]=I.useState(!1);I.useEffect(()=>{e&&j()},[e,n]);const j=async()=>{try{const{data:L,error:z}=await J.from("events").select("*").eq("id",e).single();if(z)throw z;i(L);const{count:F}=await J.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",e);if(h(F||0),n){const{data:q}=await J.from("event_registrations").select("id, zoom_join_url").eq("event_id",e).eq("user_id",n.id).maybeSingle();l(q)}}catch(L){console.error("Error loading event:",L),ze.error("Failed to load event"),t("/events")}finally{x(!1)}},N=async()=>{if(!(!n||!s)){b(!0);try{if(o){const{error:L}=await J.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(L)throw L;ze.success("Successfully cancelled registration"),l(null),h(z=>z-1)}else{const{data:L,error:z}=await J.functions.invoke("zoom-register",{body:{event_id:s.id}});if(z)throw z;ze.success("Successfully registered for event!"),l({id:L.registration_id,zoom_join_url:L.zoom_join_url}),h(F=>F+1)}}catch(L){console.error("Registration error:",L),ze.error(o?"Failed to cancel registration":"Failed to register for event")}finally{b(!1)}}},C=L=>{var z,F,q;if(L.includes("iframe.mediadelivery.net")||L.includes("video.bunnycdn.com")){const H=L.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(H)return`https://iframe.mediadelivery.net/embed/${H[1]}/${H[2]}?autoplay=false&preload=true`}if(L.includes("youtube.com")||L.includes("youtu.be")){const H=L.includes("youtu.be")?(z=L.split("youtu.be/")[1])==null?void 0:z.split("?")[0]:(F=L.split("v=")[1])==null?void 0:F.split("&")[0];if(H)return`https://www.youtube.com/embed/${H}`}if(L.includes("vimeo.com")){const H=(q=L.split("vimeo.com/")[1])==null?void 0:q.split("?")[0];if(H)return`https://player.vimeo.com/video/${H}`}return L};if(p)return r.jsx(Or,{title:"Event",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading event..."})]})})});if(!s)return r.jsx(Or,{title:"Event Not Found",children:r.jsxs("div",{className:"text-center py-16",children:[r.jsx("p",{className:"text-muted-foreground",children:"Event not found"}),r.jsx(ee,{onClick:()=>t("/events"),className:"mt-4",children:"Back to Events"})]})});const A=vut(new Date(s.event_date)),E=s.capacity&&a>=s.capacity,T=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Or,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(ee,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>t("/events"),children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Events"]}),s.image_url&&r.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[r.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"}),A&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Rt,{variant:"secondary",className:"text-lg px-4 py-2",children:"Event Ended"})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground",children:s.title}),r.jsx(p3,{resourceType:"event",resourceId:s.id,resourceTitle:s.title})]}),s.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground dark:prose-invert",dangerouslySetInnerHTML:{__html:s.description}})]}),s.video_url&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"text-lg font-semibold flex items-center gap-2",children:[r.jsx(Df,{className:"h-5 w-5"}),"Event Preview"]}),r.jsx("div",{className:"relative w-full aspect-video rounded-xl overflow-hidden border bg-muted",children:r.jsx("iframe",{src:C(s.video_url),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Event Preview Video"})})]})]}),r.jsx("div",{className:"space-y-4",children:r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(zs,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:new Intl.DateTimeFormat("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(s.event_date))}),r.jsx("p",{className:"text-sm text-muted-foreground",children:oE(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Vn,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[a," / ",s.capacity]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Registered"})]})]}),o&&r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 rounded-lg",children:[r.jsx(qa,{className:"h-5 w-5 text-green-600"}),r.jsx("span",{className:"text-sm font-medium text-green-700",children:"You're registered!"})]}),r.jsxs("div",{className:"space-y-2 pt-2",children:[!A&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{className:"w-full gap-2",onClick:()=>window.open(T,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:N,disabled:y,children:[y?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(ee,{className:"w-full gap-2",onClick:N,disabled:y||(E??!1),children:y?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):E?"Event Full":"Register Now"})}),A&&o&&r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const bmt=()=>{const{user:e,isAdmin:t}=zr(),n=ns(),[s,i]=I.useState([]),[o,l]=I.useState(!0),[a,h]=I.useState(""),[p,x]=I.useState("all"),[y,b]=I.useState(new Set);I.useEffect(()=>{j()},[e]);const j=async()=>{try{const{data:T}=await J.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),L=(T==null?void 0:T.map(te=>te.tag))||[],{data:z,error:F}=await J.from("app_tiles").select("*").order("name");if(F)throw F;const{data:q}=await J.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),H=new Set((q==null?void 0:q.map(te=>te.app_id))||[]);b(H);const Z=((z==null?void 0:z.filter(te=>!te.required_tags||te.required_tags.length===0?!0:te.required_tags.some(ae=>L.includes(ae))))||[]).sort((te,ae)=>te.name==="LevelUp Members Portal"?-1:ae.name==="LevelUp Members Portal"?1:0);i(Z)}catch(T){console.error("Error loading apps:",T),ze.error("Failed to load apps")}finally{l(!1)}},N=async T=>{var z;const L=window.open("about:blank","_blank");try{const{data:F,error:q}=await J.auth.getSession();if(q||!F.session){L==null||L.close(),ze.error("Session expired. Please refresh the page and try again.");return}const H=F.session.access_token;await J.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:T.app_id,app_name:T.name,user_agent:navigator.userAgent});const{data:K,error:Z}=await J.functions.invoke("sso-launch",{body:{app_id:T.app_id},headers:{Authorization:`Bearer ${H}`}});if(Z)throw Z;K!=null&&K.redirect_url?L&&!L.closed?(L.location.href=K.redirect_url,(z=L.focus)==null||z.call(L)):window.location.assign(K.redirect_url):(L==null||L.close(),ze.error("Launch link unavailable"))}catch(F){L==null||L.close(),console.error("Error launching app:",F),ze.error("Failed to launch app. Please try again.")}},C=async(T,L)=>{T.stopPropagation();const z=y.has(L);try{if(z){const{error:F}=await J.from("user_favorites").delete().eq("user_id",e==null?void 0:e.id).eq("app_id",L);if(F)throw F;b(q=>{const H=new Set(q);return H.delete(L),H}),ze.success("Removed from favorites")}else{const{error:F}=await J.from("user_favorites").insert({user_id:e==null?void 0:e.id,app_id:L});if(F)throw F;b(q=>new Set(q).add(L)),ze.success("Added to favorites")}}catch(F){console.error("Error toggling favorite:",F),ze.error("Failed to update favorites")}},A=s.filter(T=>{var z;const L=T.name.toLowerCase().includes(a.toLowerCase())||((z=T.description)==null?void 0:z.toLowerCase().includes(a.toLowerCase()));return p==="favorites"?L&&y.has(T.id):L}),E=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Or,{title:"Apps",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading apps..."})]})})}):r.jsxs(Or,{title:"Apps",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Apps"}),r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:a,onChange:T=>h(T.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:E.map(T=>r.jsxs("button",{onClick:()=>x(T.id),className:$t("pb-3 text-sm font-medium transition-colors relative",p===T.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[T.label,p===T.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},T.id))}),A.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:p==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(um,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No favorites yet"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:"Click the bookmark icon on any app to add it to your favorites"})]}):r.jsxs(r.Fragment,{children:[r.jsx(Gf,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No apps available"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:t?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),t&&r.jsx(ee,{className:"mt-4",onClick:()=>n("/admin/apps"),children:"Add Apps"})]})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:A.map(T=>{const L=y.has(T.id),z=T.name.toLowerCase().includes("agent review")||T.app_id==="agent_review";return r.jsxs("div",{className:"group flex flex-col p-5 bg-card rounded-xl border border-border transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"flex items-start gap-4 cursor-pointer",onClick:()=>N(T),children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:T.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:T.description})]}),r.jsx("button",{className:$t("flex-shrink-0 p-1 transition-colors",L?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:F=>C(F,T.id),children:r.jsx(um,{className:$t("h-5 w-5",L&&"fill-current")})})]}),z&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:F=>F.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},T.id)})})]})},wmt=()=>{const e=ns(),[t,n]=I.useState(""),[s,i]=I.useState("all"),[o,l]=I.useState("all"),[a,h]=I.useState("grid"),{data:p=[]}=Zt({queryKey:["template-categories"],queryFn:async()=>{const{data:E,error:T}=await J.from("template_categories").select("*").order("name");if(T)throw T;return E}}),{data:x=[]}=Zt({queryKey:["template-types"],queryFn:async()=>{const{data:E,error:T}=await J.from("template_types").select("*").order("name");if(T)throw T;return E}}),{data:y=[],isLoading:b}=Zt({queryKey:["canva-templates"],queryFn:async()=>{const{data:E,error:T}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(T)throw T;const{data:L,error:z}=await J.from("template_links").select("*").order("sort_order");if(z)throw z;const{data:F}=await J.from("template_likes").select("template_id"),{data:q}=await J.from("template_comments").select("template_id"),H=new Map;F==null||F.forEach(te=>{H.set(te.template_id,(H.get(te.template_id)||0)+1)});const K=new Map;return q==null||q.forEach(te=>{K.set(te.template_id,(K.get(te.template_id)||0)+1)}),(E||[]).map(te=>({...te,links:(L||[]).filter(ae=>ae.template_id===te.id)||[],likesCount:H.get(te.id)||0,commentsCount:K.get(te.id)||0}))}}),j=y.filter(E=>{var F;const T=E.name.toLowerCase().includes(t.toLowerCase())||((F=E.description)==null?void 0:F.toLowerCase().includes(t.toLowerCase())),L=s==="all"||E.category_id===s,z=o==="all"||E.type_id===o;return T&&L&&z}),N=()=>{n(""),i("all"),l("all")},C=t||s!=="all"||o!=="all",A=E=>{e(`/templates/${E}`)};return r.jsx(Or,{title:"Canva Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Canva Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse and use our collection of professionally designed templates"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search templates...",value:t,onChange:E=>n(E.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:s,onValueChange:i,children:[r.jsx(mn,{className:"w-full sm:w-48",children:r.jsx(_n,{placeholder:"All Categories"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Categories"}),p.map(E=>r.jsx(Ht,{value:E.id,children:E.name},E.id))]})]}),r.jsxs(vn,{value:o,onValueChange:l,children:[r.jsx(mn,{className:"w-full sm:w-48",children:r.jsx(_n,{placeholder:"All Types"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Types"}),x.map(E=>r.jsx(Ht,{value:E.id,children:E.name},E.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[C&&r.jsx(ee,{variant:"outline",size:"sm",onClick:N,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:a==="grid"?"secondary":"outline",size:"icon",onClick:()=>h("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:a==="list"?"secondary":"outline",size:"icon",onClick:()=>h("list"),className:"rounded-full",children:r.jsx(Wf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[j.length," template",j.length!==1?"s":""," found"]}),b&&r.jsx("div",{className:a==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((E,T)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Pr,{className:"h-5 w-16"}),r.jsx(Pr,{className:"h-5 w-20"})]})]})},T))}),!b&&j.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:C?"No templates match your filters":"No templates available yet"}),C&&r.jsx(ee,{variant:"outline",onClick:N,children:"Clear Filters"})]}),!b&&j.length>0&&r.jsx("div",{className:a==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:j.map(E=>r.jsxs(Ge,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${a==="list"?"flex flex-row":""}`,onClick:()=>A(E.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${a==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[E.preview_image_url?r.jsx("img",{src:E.preview_image_url,alt:E.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),E.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(So,{className:"h-3 w-3"}),E.links.length]})})]}),r.jsxs(Xe,{className:`p-4 flex flex-col ${a==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:E.name}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Ene(E.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[E.category&&r.jsx(Rt,{variant:"secondary",className:"text-xs",children:E.category.name}),E.type&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:E.type.name})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),E.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ol,{className:"h-3.5 w-3.5"}),E.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),A(E.id)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Template"]})]})]},E.id))})]})})};var jmt="Separator",Ake="horizontal",kmt=["horizontal","vertical"],wDe=I.forwardRef((e,t)=>{const{decorative:n,orientation:s=Ake,...i}=e,o=Nmt(s)?s:Ake,a=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(Rn.div,{"data-orientation":o,...a,...i,ref:t})});wDe.displayName=jmt;function Nmt(e){return kmt.includes(e)}var jDe=wDe;const Qd=I.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...s},i)=>r.jsx(jDe,{ref:i,decorative:n,orientation:t,className:$t("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Qd.displayName=jDe.displayName;const AI=()=>({trackEngagement:I.useCallback(async(t,n,s,i="view")=>{try{const{data:{user:o}}=await J.auth.getUser();if(!o)return;await J.from("content_engagement_logs").insert({user_id:o.id,resource_type:t,resource_id:n,resource_title:s,action_type:i})}catch(o){console.error("Error tracking engagement:",o)}},[])}),Smt=()=>{const{templateId:e}=Wc(),{user:t,isAdmin:n}=zr(),{toast:s}=pa(),i=Wr(),{trackEngagement:o}=AI(),[l,a]=I.useState(""),{data:h,isLoading:p}=Zt({queryKey:["template-detail",e],queryFn:async()=>{const{data:T,error:L}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",e).single();if(L)throw L;const{data:z}=await J.from("template_links").select("*").eq("template_id",e).order("sort_order"),{data:F}=await J.from("template_guides").select("*").eq("template_id",e).order("sort_order");return{...T,links:z||[],guides:F||[]}},enabled:!!e});I.useEffect(()=>{h&&o("template",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Zt({queryKey:["template-likes",e],queryFn:async()=>{const{data:T,error:L}=await J.from("template_likes").select("*").eq("template_id",e);if(L)throw L;return T},enabled:!!e}),{data:y=[]}=Zt({queryKey:["template-comments",e],queryFn:async()=>{const{data:T,error:L}=await J.from("template_comments").select("*").eq("template_id",e).order("created_at",{ascending:!1});if(L)throw L;const z=[...new Set(T.map(H=>H.user_id))],{data:F}=await J.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(H=>[H.id,H.name]))||[]);return T.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!e}),b=cr({mutationFn:async T=>{const{error:L}=await J.from("template_comments").insert({template_id:e,user_id:t.id,content:T});if(L)throw L},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",e]}),a(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error adding comment",description:T.message,variant:"destructive"})}}),j=cr({mutationFn:async T=>{const{error:L}=await J.from("template_comments").delete().eq("id",T);if(L)throw L},onSuccess:()=>{i.invalidateQueries({queryKey:["template-comments",e]}),s({title:"Comment deleted"})}}),N=cr({mutationFn:async()=>{const T=x.find(L=>L.user_id===(t==null?void 0:t.id));if(T){const{error:L}=await J.from("template_likes").delete().eq("id",T.id);if(L)throw L}else{const{error:L}=await J.from("template_likes").insert({template_id:e,user_id:t.id});if(L)throw L}},onSuccess:()=>{i.invalidateQueries({queryKey:["template-likes",e]})}}),C=x.some(T=>T.user_id===(t==null?void 0:t.id)),A=T=>T.split(" ").map(L=>L[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!l.trim()||!t)&&b.mutate(l.trim())};return p?r.jsx(Or,{title:"Templates",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Or,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(uo,{to:"/templates",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Templates"]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.category&&r.jsx(Rt,{variant:"secondary",children:h.category.name}),h.type&&r.jsx(Rt,{variant:"outline",children:h.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(uo,{to:`/admin/templates?edit=${h.id}`,children:[r.jsx(ha,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(p3,{resourceType:"template",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:C?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${C?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&>p]:mb-4 [&>p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:h.description}})]}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(So,{className:"h-4 w-4"}),h.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_canva"),window.open(T.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:T.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),h.video_url&&r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:h.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),h.guides&&h.guides.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(wi,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:h.guides.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_pdf"),window.open(T.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:T.name}),T.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(T.file_size/1024).toFixed(0)," KB)"]})]}),r.jsx(Va,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ol,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:l,onChange:T=>a(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||b.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(T=>r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:A(T.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(T.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Or,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(So,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Template not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This template may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(uo,{to:"/templates",children:"Back to Templates"})})]})})},Cmt=()=>{const{user:e}=zr(),[t,n]=I.useState(""),[s,i]=I.useState("all"),{data:o=[]}=Zt({queryKey:["academy-categories"],queryFn:async()=>{const{data:b,error:j}=await J.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(j)throw j;return b}}),{data:l=[],isLoading:a}=Zt({queryKey:["academy-videos"],queryFn:async()=>{const{data:b,error:j}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(j)throw j;const{data:N,error:C}=await J.from("academy_resources").select("*").order("sort_order");if(C)throw C;return b.map(E=>({...E,resources:(N==null?void 0:N.filter(T=>T.video_id===E.id))||[]}))}}),{data:h=[]}=Zt({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:b,error:j}=await J.from("academy_video_likes").select("video_id, user_id");if(j)throw j;return b}}),p=l.filter(b=>{var C;const j=t===""||b.title.toLowerCase().includes(t.toLowerCase())||((C=b.description)==null?void 0:C.toLowerCase().includes(t.toLowerCase())),N=s==="all"||b.category_id===s;return j&&N}),x=b=>h.filter(j=>j.video_id===b).length,y=b=>h.some(j=>j.video_id===b&&j.user_id===(e==null?void 0:e.id));return r.jsx(Or,{title:"Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Academy"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"On-demand training videos and resources"})]}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-4",children:r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search videos...",value:t,onChange:b=>n(b.target.value),className:"pl-10"})]})}),r.jsx(ba,{value:s,onValueChange:i,children:r.jsxs(fa,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(ln,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(b=>r.jsx(ln,{value:b.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:b.name},b.id))]})}),a?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p.length===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"No videos found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:t?"Try adjusting your search terms":"Check back soon for new content"})]})}):r.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:p.map(b=>r.jsx(uo,{to:`/academy/${b.id}`,children:r.jsxs(Ge,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[r.jsxs("div",{className:"relative aspect-video bg-muted",children:[b.thumbnail_url?r.jsx("img",{src:b.thumbnail_url,alt:b.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:r.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/90 flex items-center justify-center",children:r.jsx(dc,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),b.duration&&r.jsxs("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-2 py-1 rounded flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),b.duration]})]}),r.jsxs(Gt,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Qt,{className:"text-lg line-clamp-2",children:b.title})}),b.category&&r.jsx(Rt,{variant:"secondary",className:"w-fit",children:b.category.name})]}),r.jsxs(Xe,{className:"pt-0",children:[b.description&&r.jsx(En,{className:"line-clamp-2",children:b.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:`h-4 w-4 ${y(b.id)?"fill-primary text-primary":""}`}),x(b.id)]}),b.resources&&b.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(wi,{className:"h-4 w-4"}),b.resources.length]})]})]})]})},b.id))})]})})},Mmt=(e,t)=>{if(t==="bunny_stream"){let n=e.replace("iframe.mediadelivery.net","player.mediadelivery.net");return n.includes("?")||(n+="?autoplay=false&loop=false&muted=false&preload=true&responsive=true"),n}if(t==="youtube"){const n=/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=e.match(n);if(s)return`https://www.youtube.com/embed/${s[1]}`}if(t==="vimeo"){const n=/vimeo\.com\/(?:video\/)?(\d+)/,s=e.match(n);if(s)return`https://player.vimeo.com/video/${s[1]}`}if(t==="loom"){const n=/loom\.com\/share\/([a-zA-Z0-9]+)/,s=e.match(n);if(s)return`https://www.loom.com/embed/${s[1]}`}return e},Tmt=()=>{const{videoId:e}=Wc();ns();const{user:t}=zr(),{toast:n}=pa(),s=Wr(),{trackEngagement:i}=AI(),[o,l]=I.useState(""),{data:a,isLoading:h}=Zt({queryKey:["academy-video",e],queryFn:async()=>{const{data:T,error:L}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",e).eq("is_published",!0).single();if(L)throw L;const{data:z}=await J.from("academy_resources").select("*").eq("video_id",e).order("sort_order");return{...T,resources:z||[]}},enabled:!!e});I.useEffect(()=>{a&&i("academy_video",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:p=[]}=Zt({queryKey:["academy-video-likes",e],queryFn:async()=>{const{data:T,error:L}=await J.from("academy_video_likes").select("*").eq("video_id",e);if(L)throw L;return T},enabled:!!e}),{data:x=[]}=Zt({queryKey:["academy-video-comments",e],queryFn:async()=>{const{data:T,error:L}=await J.from("academy_video_comments").select("*").eq("video_id",e).order("created_at",{ascending:!1});if(L)throw L;const z=[...new Set(T.map(H=>H.user_id))],{data:F}=await J.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(H=>[H.id,H.name]))||[]);return T.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!e}),y=cr({mutationFn:async T=>{const{error:L}=await J.from("academy_video_comments").insert({video_id:e,user_id:t.id,content:T});if(L)throw L},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",e]}),l(""),n({title:"Comment added!"})},onError:T=>{n({title:"Error adding comment",description:T.message,variant:"destructive"})}}),b=cr({mutationFn:async T=>{const{error:L}=await J.from("academy_video_comments").delete().eq("id",T);if(L)throw L},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",e]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const T=p.find(L=>L.user_id===(t==null?void 0:t.id));if(T){const{error:L}=await J.from("academy_video_likes").delete().eq("id",T.id);if(L)throw L}else{const{error:L}=await J.from("academy_video_likes").insert({video_id:e,user_id:t.id});if(L)throw L}},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-likes",e]})}}),N=p.some(T=>T.user_id===(t==null?void 0:t.id)),C=T=>{switch(T==null?void 0:T.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},A=T=>T.split(" ").map(L=>L[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!o.trim()||!t)&&y.mutate(o.trim())};return h?r.jsx(Or,{title:"Academy",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Or,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(uo,{to:"/academy",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Academy"]})}),r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",style:{paddingTop:"56.25%"},children:["youtube","vimeo","loom","bunny_stream"].includes(a.video_type)?r.jsx("iframe",{src:Mmt(a.video_url,a.video_type),loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,height:"100%",width:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white gap-4",children:[r.jsx(Fi,{className:"h-16 w-16 opacity-50"}),r.jsx(ee,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open Video"]})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title}),a.category&&r.jsx(Rt,{variant:"secondary",children:a.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(p3,{resourceType:"academy_video",resourceId:a.id,resourceTitle:a.title}),r.jsxs(ee,{variant:N?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!t||j.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${N?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.resources&&a.resources.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(wi,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:a.resources.map(T=>r.jsxs("a",{href:T.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted transition-colors",children:[r.jsx("span",{className:"text-2xl",children:C(T.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:T.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:T.file_type})]}),r.jsx(Va,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ol,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),t?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:T=>l(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(T=>r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:A(T.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(T.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Or,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Video not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This video may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(uo,{to:"/academy",children:"Back to Academy"})})]})})};function Amt(){const e=ns(),[t,n]=I.useState(""),{data:s,isLoading:i}=Zt({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:j,error:N}=await J.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(N)throw N;return j}}),{data:o}=Zt({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:j,error:N}=await J.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(N)throw N;return j}}),{data:l}=Zt({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:j,error:N}=await J.from("resource_kit_likes").select("kit_id");if(N)throw N;return j}}),{data:a}=Zt({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:j,error:N}=await J.from("resource_kit_comments").select("kit_id");if(N)throw N;return j}}),h=s==null?void 0:s.filter(j=>{var N;return j.name.toLowerCase().includes(t.toLowerCase())||((N=j.description)==null?void 0:N.toLowerCase().includes(t.toLowerCase()))}),p=j=>(o==null?void 0:o.filter(N=>N.kit_id===j))||[],x=j=>(l==null?void 0:l.filter(N=>N.kit_id===j).length)||0,y=j=>(a==null?void 0:a.filter(N=>N.kit_id===j).length)||0,b=j=>{e(`/toolbox/${j}`)};return r.jsx(Or,{title:"Toolbox",description:"Download resource kits and tools to help grow your business",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Toolbox"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Download resource kits and tools to help grow your business"})]}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search resource kits...",value:t,onChange:j=>n(j.target.value),className:"pl-10"})]}),!i&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(h==null?void 0:h.length)||0," resource kit",(h==null?void 0:h.length)!==1?"s":""," available"]}),i?r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((j,N)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"}),r.jsx(Pr,{className:"h-4 w-2/3"})]})},N))}):(h==null?void 0:h.length)===0?r.jsxs(Ge,{className:"p-12 text-center",children:[r.jsx(Dl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resource kits found"}),r.jsx("p",{className:"text-muted-foreground",children:t?"Try adjusting your search terms":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:h==null?void 0:h.map(j=>{const N=p(j.id).length,C=x(j.id),A=y(j.id);return r.jsxs(Ge,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>b(j.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:j.featured_image_url?r.jsx("img",{src:j.featured_image_url,alt:j.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Dl,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:j.name}),j.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:Ene(j.description)}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(wi,{className:"h-4 w-4"}),N," file",N!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),C]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ol,{className:"h-3.5 w-3.5"}),A]})]})]})]})]},j.id)})})]})})}const Emt=()=>{const{kitId:e}=Wc(),{user:t,isAdmin:n}=zr(),{toast:s}=pa(),i=Wr(),{trackEngagement:o}=AI(),[l,a]=I.useState(""),{data:h,isLoading:p}=Zt({queryKey:["resource-kit-detail",e],queryFn:async()=>{const{data:L,error:z}=await J.from("resource_kits").select("*").eq("id",e).eq("is_published",!0).single();if(z)throw z;const{data:F}=await J.from("resource_kit_files").select("*").eq("kit_id",e).order("sort_order"),{data:q}=await J.from("resource_kit_links").select("*").eq("kit_id",e).order("sort_order");return{...L,files:F||[],links:q||[]}},enabled:!!e});I.useEffect(()=>{h&&o("toolbox",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Zt({queryKey:["resource-kit-likes",e],queryFn:async()=>{const{data:L,error:z}=await J.from("resource_kit_likes").select("*").eq("kit_id",e);if(z)throw z;return L},enabled:!!e}),{data:y=[]}=Zt({queryKey:["resource-kit-comments",e],queryFn:async()=>{const{data:L,error:z}=await J.from("resource_kit_comments").select("*").eq("kit_id",e).order("created_at",{ascending:!1});if(z)throw z;const F=[...new Set(L.map(K=>K.user_id))],{data:q}=await J.from("profiles").select("id, name").in("id",F),H=new Map((q==null?void 0:q.map(K=>[K.id,K.name]))||[]);return L.map(K=>({...K,user_name:H.get(K.user_id)||"Unknown User"}))},enabled:!!e}),b=cr({mutationFn:async L=>{const{error:z}=await J.from("resource_kit_comments").insert({kit_id:e,user_id:t.id,content:L});if(z)throw z},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",e]}),a(""),s({title:"Comment added!"})},onError:L=>{s({title:"Error adding comment",description:L.message,variant:"destructive"})}}),j=cr({mutationFn:async L=>{const{error:z}=await J.from("resource_kit_comments").delete().eq("id",L);if(z)throw z},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-comments",e]}),s({title:"Comment deleted"})}}),N=cr({mutationFn:async()=>{const L=x.find(z=>z.user_id===(t==null?void 0:t.id));if(L){const{error:z}=await J.from("resource_kit_likes").delete().eq("id",L.id);if(z)throw z}else{const{error:z}=await J.from("resource_kit_likes").insert({kit_id:e,user_id:t.id});if(z)throw z}},onSuccess:()=>{i.invalidateQueries({queryKey:["resource-kit-likes",e]})}}),C=x.some(L=>L.user_id===(t==null?void 0:t.id)),A=L=>L.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),E=L=>L?L<1024?L+" B":L<1024*1024?(L/1024).toFixed(1)+" KB":(L/(1024*1024)).toFixed(1)+" MB":"",T=L=>{L.preventDefault(),!(!l.trim()||!t)&&b.mutate(l.trim())};return p?r.jsx(Or,{title:"Toolbox",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Or,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(uo,{to:"/toolbox",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Toolbox"]})}),h.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:h.featured_image_url,alt:h.name,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(uo,{to:`/admin/toolbox?edit=${h.id}`,children:[r.jsx(ha,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(p3,{resourceType:"resource_kit",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:C?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${C?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:h.description}})]}),h.files&&h.files.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(wi,{className:"h-4 w-4"}),"Included Resources (",h.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.files.map(L=>r.jsxs("a",{href:L.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_pdf"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(wi,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:L.name}),L.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:E(L.file_size)})]})]}),r.jsx(Va,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},L.id))})]})}),h.links&&h.links.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Canva Templates (",h.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(L=>r.jsxs("a",{href:L.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_canva"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-purple-500/10",children:r.jsx(Fs,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:L.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},L.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ol,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:l,onChange:L=>a(L.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||b.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(L=>r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:A(L.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:L.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(L.created_at),{addSuffix:!0})}),L.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(L.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content})]})]})})},L.id))})]})]})}):r.jsx(Or,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Dl,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource kit not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource kit may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(uo,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Imt=()=>{const e=ns(),[t,n]=I.useState(""),[s,i]=I.useState("grid"),{data:o=[],isLoading:l}=Zt({queryKey:["social-swag"],queryFn:async()=>{const{data:p,error:x}=await J.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:y,error:b}=await J.from("social_swag_links").select("*").order("sort_order");if(b)throw b;const{data:j}=await J.from("social_swag_likes").select("swag_id"),{data:N}=await J.from("social_swag_comments").select("swag_id"),C=new Map;j==null||j.forEach(T=>{C.set(T.swag_id,(C.get(T.swag_id)||0)+1)});const A=new Map;return N==null||N.forEach(T=>{A.set(T.swag_id,(A.get(T.swag_id)||0)+1)}),(p||[]).map(T=>({...T,links:(y||[]).filter(L=>L.swag_id===T.id)||[],likesCount:C.get(T.id)||0,commentsCount:A.get(T.id)||0}))}}),a=o.filter(p=>{var y;return p.title.toLowerCase().includes(t.toLowerCase())||((y=p.description)==null?void 0:y.toLowerCase().includes(t.toLowerCase()))}),h=p=>{e(`/social-swag/${p}`)};return r.jsx(Or,{title:"Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Social Swag"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse our collection of social media content and graphics"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search social swag...",value:t,onChange:p=>n(p.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx(Wf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," item",a.length!==1?"s":""," found"]}),l&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((p,x)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"})]})},x))}),!l&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No items match your search":"No social swag available yet"}),t&&r.jsx(ee,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&a.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(p=>r.jsxs(Ge,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>h(p.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[p.preview_image_url?r.jsx("img",{src:p.preview_image_url,alt:p.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),p.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(So,{className:"h-3 w-3"}),p.links.length]})})]}),r.jsxs(Xe,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:p.title}),p.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:p.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),p.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ol,{className:"h-3.5 w-3.5"}),p.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),h(p.id)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Details"]})]})]},p.id))})]})})};var Ti=function(){return Ti=Object.assign||function(t){for(var n,s=1,i=arguments.length;s1&&(h||!p),y=t>1&&(p||!h),b=function(){s&&o(s)},j=function(){i&&o(i)};return r.jsx(ugt,{displayMonth:e.displayMonth,hideNext:x,hidePrevious:y,nextMonth:i,previousMonth:s,onPreviousClick:b,onNextClick:j})}function hgt(e){var t,n=el(),s=n.classNames,i=n.disableNavigation,o=n.styles,l=n.captionLayout,a=n.components,h=(t=a==null?void 0:a.CaptionLabel)!==null&&t!==void 0?t:SDe,p;return i?p=r.jsx(h,{id:e.id,displayMonth:e.displayMonth}):l==="dropdown"?p=r.jsx(Eke,{displayMonth:e.displayMonth,id:e.id}):l==="dropdown-buttons"?p=r.jsxs(r.Fragment,{children:[r.jsx(Eke,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),r.jsx(Ike,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):p=r.jsxs(r.Fragment,{children:[r.jsx(h,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(Ike,{displayMonth:e.displayMonth,id:e.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:p})}function fgt(e){var t=el(),n=t.footer,s=t.styles,i=t.classNames.tfoot;return n?r.jsx("tfoot",{className:i,style:s.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:n})})}):r.jsx(r.Fragment,{})}function pgt(e,t,n){for(var s=n?ly(new Date):af(new Date,{locale:e,weekStartsOn:t}),i=[],o=0;o<7;o++){var l=Hl(s,o);i.push(l)}return i}function mgt(){var e=el(),t=e.classNames,n=e.styles,s=e.showWeekNumber,i=e.locale,o=e.weekStartsOn,l=e.ISOWeek,a=e.formatters.formatWeekdayName,h=e.labels.labelWeekday,p=pgt(i,o,l);return r.jsxs("tr",{style:n.head_row,className:t.head_row,children:[s&&r.jsx("td",{style:n.head_cell,className:t.head_cell}),p.map(function(x,y){return r.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":h(x,{locale:i}),children:a(x,{locale:i})},y)})]})}function ggt(){var e,t=el(),n=t.classNames,s=t.styles,i=t.components,o=(e=i==null?void 0:i.HeadRow)!==null&&e!==void 0?e:mgt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function xgt(e){var t=el(),n=t.locale,s=t.formatters.formatDay;return r.jsx(r.Fragment,{children:s(e.date,{locale:n})})}var Axe=I.createContext(void 0);function ygt(e){if(!EI(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return r.jsx(Axe.Provider,{value:t,children:e.children})}return r.jsx(vgt,{initialProps:e.initialProps,children:e.children})}function vgt(e){var t=e.initialProps,n=e.children,s=t.selected,i=t.min,o=t.max,l=function(p,x,y){var b,j;(b=t.onDayClick)===null||b===void 0||b.call(t,p,x,y);var N=!!(x.selected&&i&&(s==null?void 0:s.length)===i);if(!N){var C=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!C){var A=s?kDe([],s):[];if(x.selected){var E=A.findIndex(function(T){return Zl(p,T)});A.splice(E,1)}else A.push(p);(j=t.onSelect)===null||j===void 0||j.call(t,A,p,x,y)}}},a={disabled:[]};s&&a.disabled.push(function(p){var x=o&&s.length>o-1,y=s.some(function(b){return Zl(b,p)});return!!(x&&!y)});var h={selected:s,onDayClick:l,modifiers:a};return r.jsx(Axe.Provider,{value:h,children:n})}function Exe(){var e=I.useContext(Axe);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function _gt(e,t){var n=t||{},s=n.from,i=n.to;return s&&i?Zl(i,e)&&Zl(s,e)?void 0:Zl(i,e)?{from:i,to:void 0}:Zl(s,e)?void 0:xte(s,e)?{from:e,to:i}:{from:s,to:e}:i?xte(e,i)?{from:i,to:e}:{from:e,to:i}:s?yse(e,s)?{from:e,to:s}:{from:s,to:e}:{from:e,to:void 0}}var Ixe=I.createContext(void 0);function bgt(e){if(!II(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(Ixe.Provider,{value:t,children:e.children})}return r.jsx(wgt,{initialProps:e.initialProps,children:e.children})}function wgt(e){var t=e.initialProps,n=e.children,s=t.selected,i=s||{},o=i.from,l=i.to,a=t.min,h=t.max,p=function(j,N,C){var A,E;(A=t.onDayClick)===null||A===void 0||A.call(t,j,N,C);var T=_gt(j,s);(E=t.onSelect)===null||E===void 0||E.call(t,T,j,N,C)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],l?(x.range_end=[l],Zl(o,l)||(x.range_middle=[{after:o,before:l}])):x.range_end=[o]):l&&(x.range_start=[l],x.range_end=[l]),a&&(o&&!l&&x.disabled.push({after:Yle(o,a-1),before:Hl(o,a-1)}),o&&l&&x.disabled.push({after:o,before:Hl(o,a-1)}),!o&&l&&x.disabled.push({after:Yle(l,a-1),before:Hl(l,a-1)})),h){if(o&&!l&&(x.disabled.push({before:Hl(o,-h+1)}),x.disabled.push({after:Hl(o,h-1)})),o&&l){var y=om(l,o)+1,b=h-y;x.disabled.push({before:Yle(o,b)}),x.disabled.push({after:Hl(l,b)})}!o&&l&&(x.disabled.push({before:Hl(l,-h+1)}),x.disabled.push({after:Hl(l,h-1)}))}return r.jsx(Ixe.Provider,{value:{selected:s,onDayClick:p,modifiers:x},children:n})}function Pxe(){var e=I.useContext(Ixe);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function uee(e){return Array.isArray(e)?kDe([],e):e!==void 0?[e]:[]}function jgt(e){var t={};return Object.entries(e).forEach(function(n){var s=n[0],i=n[1];t[s]=uee(i)}),t}var km;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(km||(km={}));var kgt=km.Selected,mx=km.Disabled,Ngt=km.Hidden,Sgt=km.Today,rce=km.RangeEnd,nce=km.RangeMiddle,sce=km.RangeStart,Cgt=km.Outside;function Mgt(e,t,n){var s,i=(s={},s[kgt]=uee(e.selected),s[mx]=uee(e.disabled),s[Ngt]=uee(e.hidden),s[Sgt]=[e.today],s[rce]=[],s[nce]=[],s[sce]=[],s[Cgt]=[],s);return e.fromDate&&i[mx].push({before:e.fromDate}),e.toDate&&i[mx].push({after:e.toDate}),EI(e)?i[mx]=i[mx].concat(t.modifiers[mx]):II(e)&&(i[mx]=i[mx].concat(n.modifiers[mx]),i[sce]=n.modifiers[sce],i[nce]=n.modifiers[nce],i[rce]=n.modifiers[rce]),i}var TDe=I.createContext(void 0);function Tgt(e){var t=el(),n=Exe(),s=Pxe(),i=Mgt(t,n,s),o=jgt(t.modifiers),l=Ti(Ti({},i),o);return r.jsx(TDe.Provider,{value:l,children:e.children})}function ADe(){var e=I.useContext(TDe);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Agt(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Egt(e){return!!(e&&typeof e=="object"&&"from"in e)}function Igt(e){return!!(e&&typeof e=="object"&&"after"in e)}function Pgt(e){return!!(e&&typeof e=="object"&&"before"in e)}function Lgt(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Ogt(e,t){var n,s=t.from,i=t.to;if(s&&i){var o=om(i,s)<0;o&&(n=[i,s],s=n[0],i=n[1]);var l=om(e,s)>=0&&om(i,e)>=0;return l}return i?Zl(i,e):s?Zl(s,e):!1}function Dgt(e){return axe(e)}function Rgt(e){return Array.isArray(e)&&e.every(axe)}function Fgt(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(Dgt(n))return Zl(e,n);if(Rgt(n))return n.includes(e);if(Egt(n))return Ogt(e,n);if(Lgt(n))return n.dayOfWeek.includes(e.getDay());if(Agt(n)){var s=om(n.before,e),i=om(n.after,e),o=s>0,l=i<0,a=xte(n.before,n.after);return a?l&&o:o||l}return Igt(n)?om(e,n.after)>0:Pgt(n)?om(n.before,e)>0:typeof n=="function"?n(e):!1})}function Lxe(e,t,n){var s=Object.keys(t).reduce(function(o,l){var a=t[l];return Fgt(e,a)&&o.push(l),o},[]),i={};return s.forEach(function(o){return i[o]=!0}),n&&!pxe(e,n)&&(i.outside=!0),i}function zgt(e,t){for(var n=vh(e[0]),s=gse(e[e.length-1]),i,o,l=n;l<=s;){var a=Lxe(l,t),h=!a.disabled&&!a.hidden;if(!h){l=Hl(l,1);continue}if(a.selected)return l;a.today&&!o&&(o=l),i||(i=l),l=Hl(l,1)}return o||i}var Bgt=365;function EDe(e,t){var n=t.moveBy,s=t.direction,i=t.context,o=t.modifiers,l=t.retry,a=l===void 0?{count:0,lastFocused:e}:l,h=i.weekStartsOn,p=i.fromDate,x=i.toDate,y=i.locale,b={day:Hl,week:Uw,month:wh,year:mct,startOfWeek:function(A){return i.ISOWeek?ly(A):af(A,{locale:y,weekStartsOn:h})},endOfWeek:function(A){return i.ISOWeek?b8e(A):oxe(A,{locale:y,weekStartsOn:h})}},j=b[n](e,s==="after"?1:-1);s==="before"&&p?j=gct([p,j]):s==="after"&&x&&(j=xct([x,j]));var N=!0;if(o){var C=Lxe(j,o);N=!C.disabled&&!C.hidden}return N?j:a.count>Bgt?a.lastFocused:EDe(j,{moveBy:n,direction:s,context:i,modifiers:o,retry:Ti(Ti({},a),{count:a.count+1})})}var IDe=I.createContext(void 0);function $gt(e){var t=PI(),n=ADe(),s=I.useState(),i=s[0],o=s[1],l=I.useState(),a=l[0],h=l[1],p=zgt(t.displayMonths,n),x=i??(a&&t.isDateDisplayed(a))?a:p,y=function(){h(i),o(void 0)},b=function(A){o(A)},j=el(),N=function(A,E){if(i){var T=EDe(i,{moveBy:A,direction:E,context:j,modifiers:n});Zl(i,T)||(t.goToDate(T,i),b(T))}},C={focusedDay:i,focusTarget:x,blur:y,focus:b,focusDayAfter:function(){return N("day","after")},focusDayBefore:function(){return N("day","before")},focusWeekAfter:function(){return N("week","after")},focusWeekBefore:function(){return N("week","before")},focusMonthBefore:function(){return N("month","before")},focusMonthAfter:function(){return N("month","after")},focusYearBefore:function(){return N("year","before")},focusYearAfter:function(){return N("year","after")},focusStartOfWeek:function(){return N("startOfWeek","before")},focusEndOfWeek:function(){return N("endOfWeek","after")}};return r.jsx(IDe.Provider,{value:C,children:e.children})}function Oxe(){var e=I.useContext(IDe);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Ugt(e,t){var n=ADe(),s=Lxe(e,n,t);return s}var Dxe=I.createContext(void 0);function qgt(e){if(!Ase(e.initialProps)){var t={selected:void 0};return r.jsx(Dxe.Provider,{value:t,children:e.children})}return r.jsx(Vgt,{initialProps:e.initialProps,children:e.children})}function Vgt(e){var t=e.initialProps,n=e.children,s=function(o,l,a){var h,p,x;if((h=t.onDayClick)===null||h===void 0||h.call(t,o,l,a),l.selected&&!t.required){(p=t.onSelect)===null||p===void 0||p.call(t,void 0,o,l,a);return}(x=t.onSelect)===null||x===void 0||x.call(t,o,o,l,a)},i={selected:t.selected,onDayClick:s};return r.jsx(Dxe.Provider,{value:i,children:n})}function PDe(){var e=I.useContext(Dxe);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Hgt(e,t){var n=el(),s=PDe(),i=Exe(),o=Pxe(),l=Oxe(),a=l.focusDayAfter,h=l.focusDayBefore,p=l.focusWeekAfter,x=l.focusWeekBefore,y=l.blur,b=l.focus,j=l.focusMonthBefore,N=l.focusMonthAfter,C=l.focusYearBefore,A=l.focusYearAfter,E=l.focusStartOfWeek,T=l.focusEndOfWeek,L=function(fe){var de,ye,Ie,Ne;Ase(n)?(de=s.onDayClick)===null||de===void 0||de.call(s,e,t,fe):EI(n)?(ye=i.onDayClick)===null||ye===void 0||ye.call(i,e,t,fe):II(n)?(Ie=o.onDayClick)===null||Ie===void 0||Ie.call(o,e,t,fe):(Ne=n.onDayClick)===null||Ne===void 0||Ne.call(n,e,t,fe)},z=function(fe){var de;b(e),(de=n.onDayFocus)===null||de===void 0||de.call(n,e,t,fe)},F=function(fe){var de;y(),(de=n.onDayBlur)===null||de===void 0||de.call(n,e,t,fe)},q=function(fe){var de;(de=n.onDayMouseEnter)===null||de===void 0||de.call(n,e,t,fe)},H=function(fe){var de;(de=n.onDayMouseLeave)===null||de===void 0||de.call(n,e,t,fe)},K=function(fe){var de;(de=n.onDayPointerEnter)===null||de===void 0||de.call(n,e,t,fe)},Z=function(fe){var de;(de=n.onDayPointerLeave)===null||de===void 0||de.call(n,e,t,fe)},te=function(fe){var de;(de=n.onDayTouchCancel)===null||de===void 0||de.call(n,e,t,fe)},ae=function(fe){var de;(de=n.onDayTouchEnd)===null||de===void 0||de.call(n,e,t,fe)},le=function(fe){var de;(de=n.onDayTouchMove)===null||de===void 0||de.call(n,e,t,fe)},ve=function(fe){var de;(de=n.onDayTouchStart)===null||de===void 0||de.call(n,e,t,fe)},ne=function(fe){var de;(de=n.onDayKeyUp)===null||de===void 0||de.call(n,e,t,fe)},ge=function(fe){var de;switch(fe.key){case"ArrowLeft":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?a():h();break;case"ArrowRight":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?h():a();break;case"ArrowDown":fe.preventDefault(),fe.stopPropagation(),p();break;case"ArrowUp":fe.preventDefault(),fe.stopPropagation(),x();break;case"PageUp":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?C():j();break;case"PageDown":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?A():N();break;case"Home":fe.preventDefault(),fe.stopPropagation(),E();break;case"End":fe.preventDefault(),fe.stopPropagation(),T();break}(de=n.onDayKeyDown)===null||de===void 0||de.call(n,e,t,fe)},ie={onClick:L,onFocus:z,onBlur:F,onKeyDown:ge,onKeyUp:ne,onMouseEnter:q,onMouseLeave:H,onPointerEnter:K,onPointerLeave:Z,onTouchCancel:te,onTouchEnd:ae,onTouchMove:le,onTouchStart:ve};return ie}function Wgt(){var e=el(),t=PDe(),n=Exe(),s=Pxe(),i=Ase(e)?t.selected:EI(e)?n.selected:II(e)?s.selected:void 0;return i}function Ggt(e){return Object.values(km).includes(e)}function Kgt(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(s){var i=e.modifiersClassNames[s];if(i)n.push(i);else if(Ggt(s)){var o=e.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Zgt(e,t){var n=Ti({},e.styles.day);return Object.keys(t).forEach(function(s){var i;n=Ti(Ti({},n),(i=e.modifiersStyles)===null||i===void 0?void 0:i[s])}),n}function Ygt(e,t,n){var s,i,o,l=el(),a=Oxe(),h=Ugt(e,t),p=Hgt(e,h),x=Wgt(),y=!!(l.onDayClick||l.mode!=="default");I.useEffect(function(){var q;h.outside||a.focusedDay&&y&&Zl(a.focusedDay,e)&&((q=n.current)===null||q===void 0||q.focus())},[a.focusedDay,e,n,y,h.outside]);var b=Kgt(l,h).join(" "),j=Zgt(l,h),N=!!(h.outside&&!l.showOutsideDays||h.hidden),C=(o=(i=l.components)===null||i===void 0?void 0:i.DayContent)!==null&&o!==void 0?o:xgt,A=r.jsx(C,{date:e,displayMonth:t,activeModifiers:h}),E={style:j,className:b,children:A,role:"gridcell"},T=a.focusTarget&&Zl(a.focusTarget,e)&&!h.outside,L=a.focusedDay&&Zl(a.focusedDay,e),z=Ti(Ti(Ti({},E),(s={disabled:h.disabled,role:"gridcell"},s["aria-selected"]=h.selected,s.tabIndex=L||T?0:-1,s)),p),F={isButton:y,isHidden:N,activeModifiers:h,selectedDays:x,buttonProps:z,divProps:E};return F}function Xgt(e){var t=I.useRef(null),n=Ygt(e.date,e.displayMonth,t);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(wte,Ti({name:"day",ref:t},n.buttonProps)):r.jsx("div",Ti({},n.divProps))}function Qgt(e){var t=e.number,n=e.dates,s=el(),i=s.onWeekNumberClick,o=s.styles,l=s.classNames,a=s.locale,h=s.labels.labelWeekNumber,p=s.formatters.formatWeekNumber,x=p(Number(t),{locale:a});if(!i)return r.jsx("span",{className:l.weeknumber,style:o.weeknumber,children:x});var y=h(Number(t),{locale:a}),b=function(j){i(t,n,j)};return r.jsx(wte,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:b,children:x})}function Jgt(e){var t,n,s=el(),i=s.styles,o=s.classNames,l=s.showWeekNumber,a=s.components,h=(t=a==null?void 0:a.Day)!==null&&t!==void 0?t:Xgt,p=(n=a==null?void 0:a.WeekNumber)!==null&&n!==void 0?n:Qgt,x;return l&&(x=r.jsx("td",{className:o.cell,style:i.cell,children:r.jsx(p,{number:e.weekNumber,dates:e.dates})})),r.jsxs("tr",{className:o.row,style:i.row,children:[x,e.dates.map(function(y){return r.jsx("td",{className:o.cell,style:i.cell,role:"presentation",children:r.jsx(h,{displayMonth:e.displayMonth,date:y})},bdt(y))})]})}function Pke(e,t,n){for(var s=n!=null&&n.ISOWeek?b8e(t):oxe(t,n),i=n!=null&&n.ISOWeek?ly(e):af(e,n),o=om(s,i),l=[],a=0;a<=o;a++)l.push(Hl(i,a));var h=l.reduce(function(p,x){var y=n!=null&&n.ISOWeek?lxe(x):dxe(x,n),b=p.find(function(j){return j.weekNumber===y});return b?(b.dates.push(x),p):(p.push({weekNumber:y,dates:[x]}),p)},[]);return h}function ext(e,t){var n=Pke(vh(e),gse(e),t);if(t!=null&&t.useFixedWeeks){var s=jdt(e,t);if(s<6){var i=n[n.length-1],o=i.dates[i.dates.length-1],l=Uw(o,6-s),a=Pke(Uw(o,1),l,t);n.push.apply(n,a)}}return n}function txt(e){var t,n,s,i=el(),o=i.locale,l=i.classNames,a=i.styles,h=i.hideHead,p=i.fixedWeeks,x=i.components,y=i.weekStartsOn,b=i.firstWeekContainsDate,j=i.ISOWeek,N=ext(e.displayMonth,{useFixedWeeks:!!p,ISOWeek:j,locale:o,weekStartsOn:y,firstWeekContainsDate:b}),C=(t=x==null?void 0:x.Head)!==null&&t!==void 0?t:ggt,A=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Jgt,E=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:fgt;return r.jsxs("table",{id:e.id,className:l.table,style:a.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!h&&r.jsx(C,{}),r.jsx("tbody",{className:l.tbody,style:a.tbody,children:N.map(function(T){return r.jsx(A,{displayMonth:e.displayMonth,dates:T.dates,weekNumber:T.weekNumber},T.weekNumber)})}),r.jsx(E,{displayMonth:e.displayMonth})]})}function rxt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var nxt=rxt()?I.useLayoutEffect:I.useEffect,ice=!1,sxt=0;function Lke(){return"react-day-picker-".concat(++sxt)}function ixt(e){var t,n=e??(ice?Lke():null),s=I.useState(n),i=s[0],o=s[1];return nxt(function(){i===null&&o(Lke())},[]),I.useEffect(function(){ice===!1&&(ice=!0)},[]),(t=e??i)!==null&&t!==void 0?t:void 0}function axt(e){var t,n,s=el(),i=s.dir,o=s.classNames,l=s.styles,a=s.components,h=PI().displayMonths,p=ixt(s.id?"".concat(s.id,"-").concat(e.displayIndex):void 0),x=s.id?"".concat(s.id,"-grid-").concat(e.displayIndex):void 0,y=[o.month],b=l.month,j=e.displayIndex===0,N=e.displayIndex===h.length-1,C=!j&&!N;i==="rtl"&&(t=[j,N],N=t[0],j=t[1]),j&&(y.push(o.caption_start),b=Ti(Ti({},b),l.caption_start)),N&&(y.push(o.caption_end),b=Ti(Ti({},b),l.caption_end)),C&&(y.push(o.caption_between),b=Ti(Ti({},b),l.caption_between));var A=(n=a==null?void 0:a.Caption)!==null&&n!==void 0?n:hgt;return r.jsxs("div",{className:y.join(" "),style:b,children:[r.jsx(A,{id:p,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(txt,{id:x,"aria-labelledby":p,displayMonth:e.displayMonth})]},e.displayIndex)}function oxt(e){var t=el(),n=t.classNames,s=t.styles;return r.jsx("div",{className:n.months,style:s.months,children:e.children})}function lxt(e){var t,n,s=e.initialProps,i=el(),o=Oxe(),l=PI(),a=I.useState(!1),h=a[0],p=a[1];I.useEffect(function(){i.initialFocus&&o.focusTarget&&(h||(o.focus(o.focusTarget),p(!0)))},[i.initialFocus,h,o.focus,o.focusTarget,o]);var x=[i.classNames.root,i.className];i.numberOfMonths>1&&x.push(i.classNames.multiple_months),i.showWeekNumber&&x.push(i.classNames.with_weeknumber);var y=Ti(Ti({},i.styles.root),i.style),b=Object.keys(s).filter(function(N){return N.startsWith("data-")}).reduce(function(N,C){var A;return Ti(Ti({},N),(A={},A[C]=s[C],A))},{}),j=(n=(t=s.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:oxt;return r.jsx("div",Ti({className:x.join(" "),style:y,dir:i.dir,id:i.id,nonce:s.nonce,title:s.title,lang:s.lang},b,{children:r.jsx(j,{children:l.displayMonths.map(function(N,C){return r.jsx(axt,{displayIndex:C,displayMonth:N},C)})})}))}function cxt(e){var t=e.children,n=Pmt(e,["children"]);return r.jsx(Qmt,{initialProps:n,children:r.jsx(lgt,{children:r.jsx(qgt,{initialProps:n,children:r.jsx(ygt,{initialProps:n,children:r.jsx(bgt,{initialProps:n,children:r.jsx(Tgt,{children:r.jsx($gt,{children:t})})})})})})})}function dxt(e){return r.jsx(cxt,Ti({},e,{children:r.jsx(lxt,{initialProps:e})}))}function Z1({className:e,classNames:t,showOutsideDays:n=!0,...s}){return r.jsx(dxt,{showOutsideDays:n,className:$t("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:$t(eE({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:$t(eE({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...i})=>r.jsx(qc,{className:"h-4 w-4"}),IconRight:({...i})=>r.jsx(Ka,{className:"h-4 w-4"})},...s})}Z1.displayName="Calendar";var Ese="Popover",[LDe]=Ql(Ese,[zg]),LI=zg(),[uxt,ov]=LDe(Ese),ODe=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:i,onOpenChange:o,modal:l=!1}=e,a=LI(t),h=I.useRef(null),[p,x]=I.useState(!1),[y,b]=Ou({prop:s,defaultProp:i??!1,onChange:o,caller:Ese});return r.jsx(pI,{...a,children:r.jsx(uxt,{scope:t,contentId:Vc(),triggerRef:h,open:y,onOpenChange:b,onOpenToggle:I.useCallback(()=>b(j=>!j),[b]),hasCustomAnchor:p,onCustomAnchorAdd:I.useCallback(()=>x(!0),[]),onCustomAnchorRemove:I.useCallback(()=>x(!1),[]),modal:l,children:n})})};ODe.displayName=Ese;var DDe="PopoverAnchor",hxt=I.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=ov(DDe,n),o=LI(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:a}=i;return I.useEffect(()=>(l(),()=>a()),[l,a]),r.jsx(t3,{...o,...s,ref:t})});hxt.displayName=DDe;var RDe="PopoverTrigger",FDe=I.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=ov(RDe,n),o=LI(n),l=ei(t,i.triggerRef),a=r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":qDe(i.open),...s,ref:l,onClick:cn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:r.jsx(t3,{asChild:!0,...o,children:a})});FDe.displayName=RDe;var Rxe="PopoverPortal",[fxt,pxt]=LDe(Rxe,{forceMount:void 0}),zDe=e=>{const{__scopePopover:t,forceMount:n,children:s,container:i}=e,o=ov(Rxe,t);return r.jsx(fxt,{scope:t,forceMount:n,children:r.jsx(pc,{present:n||o.open,children:r.jsx(YC,{asChild:!0,container:i,children:s})})})};zDe.displayName=Rxe;var xC="PopoverContent",BDe=I.forwardRef((e,t)=>{const n=pxt(xC,e.__scopePopover),{forceMount:s=n.forceMount,...i}=e,o=ov(xC,e.__scopePopover);return r.jsx(pc,{present:s||o.open,children:o.modal?r.jsx(gxt,{...i,ref:t}):r.jsx(xxt,{...i,ref:t})})});BDe.displayName=xC;var mxt=D1("PopoverContent.RemoveScroll"),gxt=I.forwardRef((e,t)=>{const n=ov(xC,e.__scopePopover),s=I.useRef(null),i=ei(t,s),o=I.useRef(!1);return I.useEffect(()=>{const l=s.current;if(l)return qne(l)},[]),r.jsx(_I,{as:mxt,allowPinchZoom:!0,children:r.jsx($De,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cn(e.onCloseAutoFocus,l=>{var a;l.preventDefault(),o.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:cn(e.onPointerDownOutside,l=>{const a=l.detail.originalEvent,h=a.button===0&&a.ctrlKey===!0,p=a.button===2||h;o.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:cn(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),xxt=I.forwardRef((e,t)=>{const n=ov(xC,e.__scopePopover),s=I.useRef(!1),i=I.useRef(!1);return r.jsx($De,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,a;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:o=>{var h,p;(h=e.onInteractOutside)==null||h.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),$De=I.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:a,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:x,...y}=e,b=ov(xC,n),j=LI(n);return $ne(),r.jsx(vI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:o,children:r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:a,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:r.jsx(mI,{"data-state":qDe(b.open),role:"dialog",id:b.contentId,...j,...y,ref:t,style:{...y.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)"}})})})}),UDe="PopoverClose",yxt=I.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=ov(UDe,n);return r.jsx(Rn.button,{type:"button",...s,ref:t,onClick:cn(e.onClick,()=>i.onOpenChange(!1))})});yxt.displayName=UDe;var vxt="PopoverArrow",_xt=I.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,i=LI(n);return r.jsx(gI,{...i,...s,ref:t})});_xt.displayName=vxt;function qDe(e){return e?"open":"closed"}var bxt=ODe,wxt=FDe,jxt=zDe,VDe=BDe;const Du=bxt,Ru=wxt,nu=I.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},i)=>r.jsx(jxt,{children:r.jsx(VDe,{ref:i,align:t,sideOffset:n,className:$t("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",e),...s})}));nu.displayName=VDe.displayName;const kxt=XC("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"}}),Fxe=I.forwardRef(({className:e,variant:t,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:$t(kxt({variant:t}),e),...n}));Fxe.displayName="Alert";const Nxt=I.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:$t("mb-1 font-medium leading-none tracking-tight",e),...t}));Nxt.displayName="AlertTitle";const zxe=I.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:$t("text-sm [&_p]:leading-relaxed",e),...t}));zxe.displayName="AlertDescription";function Sxt({open:e,onOpenChange:t,imageUrl:n,imageId:s,defaultCaption:i="",swagItemId:o,reelId:l}){const a=Wr(),[h,p]=I.useState(i),[x,y]=I.useState([]),[b,j]=I.useState(null),[N,C]=I.useState("now"),[A,E]=I.useState(rke(cke(new Date),1)),[T,L]=I.useState("12"),[z,F]=I.useState("00"),[q,H]=I.useState("PM");I.useEffect(()=>{if(e){p(i),C("now"),y([]);const he=rke(cke(new Date),1);E(he);const xe=he.getHours();L(String(xe>12?xe-12:xe===0?12:xe)),F("00"),H(xe>=12?"PM":"AM")}},[e,i]);const K=()=>{if(!A)return null;let he=parseInt(T);const xe=parseInt(z);return q==="PM"&&he!==12&&(he+=12),q==="AM"&&he===12&&(he=0),A8e(T8e(A,he),xe)},{data:Z,isLoading:te}=Zt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:he}}=await J.auth.getUser();if(!he)return[];const{data:xe,error:be}=await J.from("social_accounts").select("*").eq("user_id",he.id).eq("is_active",!0).order("platform",{ascending:!0});if(be)throw be;return console.log("Fetched social accounts for posting:",xe),xe},enabled:e,staleTime:0}),ae=cr({mutationFn:async({accountId:he,platform:xe})=>{j(he);const{data:be,error:Oe}=await J.functions.invoke("social-post",{body:{platform:xe,accountId:he,imageUrl:n,caption:h}});if(Oe)throw Oe;if(be!=null&&be.error)throw new Error(be.error);return be},onSuccess:he=>{const xe=he.platform==="facebook"?"Facebook":he.platform==="instagram"?"Instagram":he.platform==="linkedin"?"LinkedIn":"Google Business";ze.success(`Posted to ${xe}!`)},onError:he=>{ze.error(`Failed to post: ${he.message}`)},onSettled:()=>{j(null)}}),le=cr({mutationFn:async({accountId:he,platform:xe,scheduledFor:be})=>{const{data:{user:Oe}}=await J.auth.getUser();if(!Oe)throw new Error("Not authenticated");const{error:Te}=await J.from("scheduled_posts").insert({user_id:Oe.id,social_account_id:he,platform:xe,image_url:n,caption:h,swag_item_id:o||null,reel_id:l||null,scheduled_for:be.toISOString(),status:"scheduled"});if(Te)throw Te;return{platform:xe}},onSuccess:he=>{const xe=he.platform==="facebook"?"Facebook":he.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Post scheduled for ${xe}!`)},onError:he=>{ze.error(`Failed to schedule: ${he.message}`)}}),ve=async()=>{if(x.length===0){ze.error("Please select at least one account");return}if(N==="schedule"){const he=K();if(!he||he<=new Date){ze.error("Please select a future date and time");return}for(const xe of x){const be=Z==null?void 0:Z.find(Oe=>Oe.id===xe);be&&await le.mutateAsync({accountId:xe,platform:be.platform,scheduledFor:he})}a.invalidateQueries({queryKey:["scheduled-posts"]}),ze.success(`${x.length} post(s) scheduled for ${xn(he,"PPp")}`)}else for(const he of x){const xe=Z==null?void 0:Z.find(be=>be.id===he);xe&&await ae.mutateAsync({accountId:he,platform:xe.platform})}a.invalidateQueries({queryKey:["scheduled-posts"]}),p(""),y([]),t(!1)},ne=he=>{y(xe=>xe.includes(he)?xe.filter(be=>be!==he):[...xe,he])},ge=(Z==null?void 0:Z.filter(he=>he.platform==="facebook"))||[],ie=(Z==null?void 0:Z.filter(he=>he.platform==="instagram"))||[],fe=(Z==null?void 0:Z.filter(he=>he.platform==="linkedin"))||[],de=(Z==null?void 0:Z.filter(he=>he.platform==="google_business"))||[],ye=((Z==null?void 0:Z.length)||0)>0,Ie=ae.isPending||le.isPending,Ne=Array.from({length:12},(he,xe)=>String(xe+1)),we=["00","15","30","45"];return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create Social Post"}),r.jsx(es,{children:"Share this image to your connected social accounts"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-full max-w-[200px] mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:n,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"caption",children:"Caption"}),r.jsx(ps,{id:"caption",placeholder:"Write a caption for your post...",value:h,onChange:he=>p(he.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{children:"Publish Time"}),r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[r.jsx("button",{type:"button",onClick:()=>C("now"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",N==="now"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Post Now"}),r.jsx("button",{type:"button",onClick:()=>C("schedule"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",N==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),N==="schedule"&&r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!A&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),A?xn(A,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(nu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:A,onSelect:E,disabled:he=>her.jsx(Ht,{value:he,children:he},he))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(vn,{value:z,onValueChange:F,children:[r.jsx(mn,{className:"w-[70px]",children:r.jsx(_n,{})}),r.jsx(gn,{children:we.map(he=>r.jsx(Ht,{value:he,children:he},he))})]}),r.jsxs(vn,{value:q,onValueChange:he=>H(he),children:[r.jsx(mn,{className:"w-[70px]",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"AM",children:"AM"}),r.jsx(Ht,{value:"PM",children:"PM"})]})]})]})]}),A&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",xn(K()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{children:"Post to"}),te&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(nn,{className:"h-6 w-6 animate-spin"})}),!te&&!ye&&r.jsxs(Fxe,{children:[r.jsx(El,{className:"h-4 w-4"}),r.jsxs(zxe,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(uo,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(fd,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),ge.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(Od,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),ge.map(he=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(he.id),onCheckedChange:()=>ne(he.id),disabled:b===he.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Ga,{src:he.profile_picture_url||""}),r.jsx(di,{children:r.jsx(Od,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:he.page_name||he.platform_username}),b===he.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},he.id))]}),ie.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(eu,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),ie.map(he=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(he.id),onCheckedChange:()=>ne(he.id),disabled:b===he.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Ga,{src:he.profile_picture_url||""}),r.jsx(di,{children:r.jsx(eu,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",he.platform_username]}),b===he.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},he.id))]}),fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(mm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),fe.map(he=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(he.id),onCheckedChange:()=>ne(he.id),disabled:b===he.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Ga,{src:he.profile_picture_url||""}),r.jsx(di,{children:r.jsx(mm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:he.platform_username}),b===he.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},he.id))]}),de.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(ml,{className:"h-4 w-4 text-red-600"})," Google Business"]}),de.map(he=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(cc,{checked:x.includes(he.id),onCheckedChange:()=>ne(he.id),disabled:b===he.id}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Ga,{src:he.profile_picture_url||""}),r.jsx(di,{children:r.jsx(ml,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:he.page_name||he.platform_username}),b===he.id&&r.jsx(nn,{className:"h-4 w-4 animate-spin"})]},he.id))]})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{onClick:ve,disabled:x.length===0||Ie,className:"gap-2",children:[Ie?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):N==="schedule"?r.jsx(zs,{className:"h-4 w-4"}):r.jsx(Lo,{className:"h-4 w-4"}),N==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}var HDe="AlertDialog",[Cxt]=Ql(HDe,[fPe]),my=fPe(),WDe=e=>{const{__scopeAlertDialog:t,...n}=e,s=my(t);return r.jsx(Hne,{...s,...n,modal:!0})};WDe.displayName=HDe;var Mxt="AlertDialogTrigger",GDe=I.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=my(n);return r.jsx(Cge,{...i,...s,ref:t})});GDe.displayName=Mxt;var Txt="AlertDialogPortal",KDe=e=>{const{__scopeAlertDialog:t,...n}=e,s=my(t);return r.jsx(Wne,{...s,...n})};KDe.displayName=Txt;var Axt="AlertDialogOverlay",ZDe=I.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=my(n);return r.jsx(l3,{...i,...s,ref:t})});ZDe.displayName=Axt;var AS="AlertDialogContent",[Ext,Ixt]=Cxt(AS),Pxt=iAe("AlertDialogContent"),YDe=I.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...i}=e,o=my(n),l=I.useRef(null),a=ei(t,l),h=I.useRef(null);return r.jsx(gst,{contentName:AS,titleName:XDe,docsSlug:"alert-dialog",children:r.jsx(Ext,{scope:n,cancelRef:h,children:r.jsxs(c3,{role:"alertdialog",...o,...i,ref:a,onOpenAutoFocus:cn(i.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=h.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[r.jsx(Pxt,{children:s}),r.jsx(Oxt,{contentRef:l})]})})})});YDe.displayName=AS;var XDe="AlertDialogTitle",QDe=I.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=my(n);return r.jsx(bI,{...i,...s,ref:t})});QDe.displayName=XDe;var JDe="AlertDialogDescription",eRe=I.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=my(n);return r.jsx(wI,{...i,...s,ref:t})});eRe.displayName=JDe;var Lxt="AlertDialogAction",tRe=I.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=my(n);return r.jsx(Gne,{...i,...s,ref:t})});tRe.displayName=Lxt;var rRe="AlertDialogCancel",nRe=I.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:i}=Ixt(rRe,n),o=my(n),l=ei(t,i);return r.jsx(Gne,{...o,...s,ref:l})});nRe.displayName=rRe;var Oxt=({contentRef:e})=>{const t=`\`${AS}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${AS}\` by passing a \`${JDe}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, 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 \`${AS}\`. 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. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return I.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Dxt=WDe,Rxt=GDe,Fxt=KDe,sRe=ZDe,iRe=YDe,aRe=tRe,oRe=nRe,lRe=QDe,cRe=eRe;const fh=Dxt,W0=Rxt,zxt=Fxt,dRe=I.forwardRef(({className:e,...t},n)=>r.jsx(sRe,{className:$t("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",e),...t,ref:n}));dRe.displayName=sRe.displayName;const ju=I.forwardRef(({className:e,...t},n)=>r.jsxs(zxt,{children:[r.jsx(dRe,{}),r.jsx(iRe,{ref:n,className:$t("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",e),...t})]}));ju.displayName=iRe.displayName;const ku=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",e),...t});ku.displayName="AlertDialogHeader";const Nu=({className:e,...t})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Nu.displayName="AlertDialogFooter";const Su=I.forwardRef(({className:e,...t},n)=>r.jsx(lRe,{ref:n,className:$t("text-lg font-semibold",e),...t}));Su.displayName=lRe.displayName;const Cu=I.forwardRef(({className:e,...t},n)=>r.jsx(cRe,{ref:n,className:$t("text-sm text-muted-foreground",e),...t}));Cu.displayName=cRe.displayName;const Jd=I.forwardRef(({className:e,...t},n)=>r.jsx(aRe,{ref:n,className:$t(eE(),e),...t}));Jd.displayName=aRe.displayName;const Mu=I.forwardRef(({className:e,...t},n)=>r.jsx(oRe,{ref:n,className:$t(eE({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Mu.displayName=oRe.displayName;function Bxt(){const e=Wr(),[t,n]=I.useState(void 0),[s,i]=I.useState("all"),[o,l]=I.useState(null),[a,h]=I.useState(""),[p,x]=I.useState(void 0),[y,b]=I.useState("12"),[j,N]=I.useState("00"),[C,A]=I.useState("PM"),{data:E=[],isLoading:T}=Zt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:de,error:ye}=await J.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(ye)throw ye;return de}}),L=E.filter(de=>{if(s!=="all"&&de.status!==s)return!1;if(t&&de.scheduled_for){const ye=new Date(de.scheduled_for);if(!Zl(ye,t))return!1}return!0}),z=E.filter(de=>de.scheduled_for).map(de=>of(new Date(de.scheduled_for))),F=cr({mutationFn:async de=>{const{error:ye}=await J.from("scheduled_posts").update({caption:de.caption,scheduled_for:de.scheduled_for}).eq("id",de.id);if(ye)throw ye},onSuccess:()=>{ze.success("Post updated!"),e.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:de=>{ze.error(`Failed to update: ${de.message}`)}}),q=cr({mutationFn:async de=>{const{error:ye}=await J.from("scheduled_posts").update({status:"cancelled"}).eq("id",de);if(ye)throw ye},onSuccess:()=>{ze.success("Post cancelled"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{ze.error(`Failed to cancel: ${de.message}`)}}),H=cr({mutationFn:async de=>{const{error:ye}=await J.from("scheduled_posts").delete().eq("id",de);if(ye)throw ye},onSuccess:()=>{ze.success("Post deleted"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{ze.error(`Failed to delete: ${de.message}`)}}),K=cr({mutationFn:async de=>{const{data:ye,error:Ie}=await J.functions.invoke("social-post",{body:{platform:de.platform,accountId:de.social_account_id,imageUrl:de.image_url,caption:de.caption}});if(Ie)throw Ie;if(ye!=null&&ye.error)throw new Error(ye.error);return await J.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:ye.postId}).eq("id",de.id),ye},onSuccess:de=>{const ye=de.platform==="facebook"?"Facebook":de.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Posted to ${ye}!`),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:de=>{ze.error(`Failed to post: ${de.message}`)}}),Z=de=>{if(l(de),h(de.caption||""),de.scheduled_for){const ye=new Date(de.scheduled_for);x(ye);const Ie=ye.getHours();b(String(Ie>12?Ie-12:Ie===0?12:Ie)),N(String(ye.getMinutes()).padStart(2,"0")),A(Ie>=12?"PM":"AM")}},te=()=>{if(!o||!p)return;let de=parseInt(y);const ye=parseInt(j);C==="PM"&&de!==12&&(de+=12),C==="AM"&&de===12&&(de=0);const Ie=A8e(T8e(p,de),ye);F.mutate({id:o.id,caption:a,scheduled_for:Ie.toISOString()})},ae=de=>{switch(de){case"facebook":return r.jsx(Od,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(eu,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(mm,{className:"h-4 w-4 text-blue-700"});default:return null}},le=de=>{switch(de){case"scheduled":return r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Rt,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(qa,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Rt,{variant:"destructive",className:"gap-1",children:[r.jsx(zc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Rt,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(El,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Rt,{variant:"outline",children:de})}},ve=Array.from({length:12},(de,ye)=>String(ye+1)),ne=["00","15","30","45"],ge=E.filter(de=>de.status==="scheduled").length,ie=E.filter(de=>de.status==="posted").length,fe=E.filter(de=>de.status==="scheduled"&&de.scheduled_for&&kdt(new Date(de.scheduled_for))).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs(Ge,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ge}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(Ge,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:fe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(Ge,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ie}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),r.jsxs(Ge,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:E.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})]}),r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs(Ge,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(hm,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Z1,{mode:"single",selected:t,onSelect:n,className:$t("pointer-events-auto"),modifiers:{hasPost:z},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),t&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>n(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(de=>r.jsx(ee,{variant:s===de?"default":"outline",size:"sm",onClick:()=>i(de),className:"capitalize",children:de},de))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!T&&L.length===0&&r.jsxs(Ge,{className:"p-8 text-center",children:[r.jsx(zs,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("h3",{className:"font-medium mb-2",children:"No posts found"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:t?`No posts scheduled for ${xn(t,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:L.map(de=>{var ye,Ie;return r.jsx(Ge,{className:"overflow-hidden",children:r.jsxs("div",{className:"flex flex-col sm:flex-row",children:[r.jsx("div",{className:"sm:w-32 h-32 sm:h-auto bg-muted flex-shrink-0",children:r.jsx("img",{src:de.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(Xe,{className:"flex-1 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ae(de.platform),r.jsx("span",{className:"font-medium",children:((ye=de.social_accounts)==null?void 0:ye.page_name)||((Ie=de.social_accounts)==null?void 0:Ie.platform_username)||"Unknown"}),le(de.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[de.status==="scheduled"&&r.jsxs(xI,{children:[r.jsxs(Cg,{children:[r.jsx(Mg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Z(de),children:r.jsx(ha,{className:"h-4 w-4"})})}),r.jsx(vm,{children:"Edit post"})]}),r.jsxs(Cg,{children:[r.jsx(Mg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>K.mutate(de),disabled:K.isPending,children:K.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(Lo,{className:"h-4 w-4"})})}),r.jsx(vm,{children:"Post now"})]}),r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Cancel this scheduled post?"}),r.jsx(Cu,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Keep"}),r.jsx(Jd,{onClick:()=>q.mutate(de.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Jd,{onClick:()=>H.mutate(de.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(de.status==="posted"||de.status==="cancelled"||de.status==="failed")&&r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Delete this post?"}),r.jsx(Cu,{children:"This will permanently remove this post from your history."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>H.mutate(de.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),de.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:de.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),de.status==="posted"&&de.posted_at?`Posted ${xn(new Date(de.posted_at),"PPp")}`:de.scheduled_for?`Scheduled for ${xn(new Date(de.scheduled_for),"PPp")}`:"Not scheduled"]}),de.status==="failed"&&de.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",de.error_message]})]})]})},de.id)})})]})]}),r.jsx(Br,{open:!!o,onOpenChange:de=>!de&&l(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Scheduled Post"}),r.jsx(es,{children:"Update the caption or reschedule this post"})]}),o&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-32 mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:o.image_url,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Caption"}),r.jsx(ps,{value:a,onChange:de=>h(de.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(Ue,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!p&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),p?xn(p,"PPP"):"Pick a date"]})}),r.jsx(nu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:p,onSelect:x,disabled:de=>der.jsx(Ht,{value:de,children:de},de))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(vn,{value:j,onValueChange:N,children:[r.jsx(mn,{className:"w-[70px]",children:r.jsx(_n,{})}),r.jsx(gn,{children:ne.map(de=>r.jsx(Ht,{value:de,children:de},de))})]}),r.jsxs(vn,{value:C,onValueChange:de=>A(de),children:[r.jsx(mn,{className:"w-[70px]",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"AM",children:"AM"}),r.jsx(Ht,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(ee,{onClick:te,disabled:F.isPending,children:[F.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function kL(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var uRe={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE */(function(e,t){(function(n){e.exports=n()})(function(){return function n(s,i,o){function l(p,x){if(!i[p]){if(!s[p]){var y=typeof kL=="function"&&kL;if(!x&&y)return y(p,!0);if(a)return a(p,!0);var b=new Error("Cannot find module '"+p+"'");throw b.code="MODULE_NOT_FOUND",b}var j=i[p]={exports:{}};s[p][0].call(j.exports,function(N){var C=s[p][1][N];return l(C||N)},j,j.exports,n,s,i,o)}return i[p].exports}for(var a=typeof kL=="function"&&kL,h=0;h>2,j=(3&p)<<4|x>>4,N=1>6:64,C=2>4,x=(15&b)<<4|(j=a.indexOf(h.charAt(C++)))>>2,y=(3&j)<<6|(N=a.indexOf(h.charAt(C++))),T[A++]=p,j!==64&&(T[A++]=x),N!==64&&(T[A++]=y);return T}},{"./support":30,"./utils":32}],2:[function(n,s,i){var o=n("./external"),l=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),h=n("./stream/DataLengthProbe");function p(x,y,b,j,N){this.compressedSize=x,this.uncompressedSize=y,this.crc32=b,this.compression=j,this.compressedContent=N}p.prototype={getContentWorker:function(){var x=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),y=this;return x.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new l(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},p.createWorkerFrom=function(x,y,b){return x.pipe(new a).pipe(new h("uncompressedSize")).pipe(y.compressWorker(b)).pipe(new h("compressedSize")).withStreamInfo("compression",y)},s.exports=p},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,i){var o=n("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,i){var o=n("./utils"),l=function(){for(var a,h=[],p=0;p<256;p++){a=p;for(var x=0;x<8;x++)a=1&a?3988292384^a>>>1:a>>>1;h[p]=a}return h}();s.exports=function(a,h){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(p,x,y,b){var j=l,N=b+y;p^=-1;for(var C=b;C>>8^j[255&(p^x[C])];return-1^p}(0|h,a,a.length,0):function(p,x,y,b){var j=l,N=b+y;p^=-1;for(var C=b;C>>8^j[255&(p^x.charCodeAt(C))];return-1^p}(0|h,a,a.length,0):0}},{"./utils":32}],5:[function(n,s,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(n,s,i){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),a=n("./utils"),h=n("./stream/GenericWorker"),p=o?"uint8array":"array";function x(y,b){h.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=b,this.meta={}}i.magic="\b\0",a.inherits(x,h),x.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(p,y.data),!1)},x.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(b){y.push({data:b,meta:y.meta})}},i.compressWorker=function(y){return new x("Deflate",y)},i.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,i){function o(j,N){var C,A="";for(C=0;C>>=8;return A}function l(j,N,C,A,E,T){var L,z,F=j.file,q=j.compression,H=T!==p.utf8encode,K=a.transformTo("string",T(F.name)),Z=a.transformTo("string",p.utf8encode(F.name)),te=F.comment,ae=a.transformTo("string",T(te)),le=a.transformTo("string",p.utf8encode(te)),ve=Z.length!==F.name.length,ne=le.length!==te.length,ge="",ie="",fe="",de=F.dir,ye=F.date,Ie={crc32:0,compressedSize:0,uncompressedSize:0};N&&!C||(Ie.crc32=j.crc32,Ie.compressedSize=j.compressedSize,Ie.uncompressedSize=j.uncompressedSize);var Ne=0;N&&(Ne|=8),H||!ve&&!ne||(Ne|=2048);var we=0,he=0;de&&(we|=16),E==="UNIX"?(he=798,we|=function(be,Oe){var Te=be;return be||(Te=Oe?16893:33204),(65535&Te)<<16}(F.unixPermissions,de)):(he=20,we|=function(be){return 63&(be||0)}(F.dosPermissions)),L=ye.getUTCHours(),L<<=6,L|=ye.getUTCMinutes(),L<<=5,L|=ye.getUTCSeconds()/2,z=ye.getUTCFullYear()-1980,z<<=4,z|=ye.getUTCMonth()+1,z<<=5,z|=ye.getUTCDate(),ve&&(ie=o(1,1)+o(x(K),4)+Z,ge+="up"+o(ie.length,2)+ie),ne&&(fe=o(1,1)+o(x(ae),4)+le,ge+="uc"+o(fe.length,2)+fe);var xe="";return xe+=` \0`,xe+=o(Ne,2),xe+=q.magic,xe+=o(L,2),xe+=o(z,2),xe+=o(Ie.crc32,4),xe+=o(Ie.compressedSize,4),xe+=o(Ie.uncompressedSize,4),xe+=o(K.length,2),xe+=o(ge.length,2),{fileRecord:y.LOCAL_FILE_HEADER+xe+K+ge,dirRecord:y.CENTRAL_FILE_HEADER+o(he,2)+xe+o(ae.length,2)+"\0\0\0\0"+o(we,4)+o(A,4)+K+ge+ae}}var a=n("../utils"),h=n("../stream/GenericWorker"),p=n("../utf8"),x=n("../crc32"),y=n("../signature");function b(j,N,C,A){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=N,this.zipPlatform=C,this.encodeFileName=A,this.streamFiles=j,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(b,h),b.prototype.push=function(j){var N=j.meta.percent||0,C=this.entriesCount,A=this._sources.length;this.accumulate?this.contentBuffer.push(j):(this.bytesWritten+=j.data.length,h.prototype.push.call(this,{data:j.data,meta:{currentFile:this.currentFile,percent:C?(N+100*(C-A-1))/C:100}}))},b.prototype.openedSource=function(j){this.currentSourceOffset=this.bytesWritten,this.currentFile=j.file.name;var N=this.streamFiles&&!j.file.dir;if(N){var C=l(j,N,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:C.fileRecord,meta:{percent:0}})}else this.accumulate=!0},b.prototype.closedSource=function(j){this.accumulate=!1;var N=this.streamFiles&&!j.file.dir,C=l(j,N,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(C.dirRecord),N)this.push({data:function(A){return y.DATA_DESCRIPTOR+o(A.crc32,4)+o(A.compressedSize,4)+o(A.uncompressedSize,4)}(j),meta:{percent:100}});else for(this.push({data:C.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},b.prototype.flush=function(){for(var j=this.bytesWritten,N=0;N=this.index;h--)p=(p<<8)+this.byteAt(h);return this.index+=a,p},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},s.exports=l},{"../utils":32}],19:[function(n,s,i){var o=n("./Uint8ArrayReader");function l(a){o.call(this,a)}n("../utils").inherits(l,o),l.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,i){var o=n("./DataReader");function l(a){o.call(this,a)}n("../utils").inherits(l,o),l.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},l.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},l.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},l.prototype.readData=function(a){this.checkOffset(a);var h=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,s,i){var o=n("./ArrayReader");function l(a){o.call(this,a)}n("../utils").inherits(l,o),l.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,h},s.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,i){var o=n("../utils"),l=n("../support"),a=n("./ArrayReader"),h=n("./StringReader"),p=n("./NodeBufferReader"),x=n("./Uint8ArrayReader");s.exports=function(y){var b=o.getTypeOf(y);return o.checkSupport(b),b!=="string"||l.uint8array?b==="nodebuffer"?new p(y):l.uint8array?new x(o.transformTo("uint8array",y)):new a(o.transformTo("array",y)):new h(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,i){var o=n("./GenericWorker"),l=n("../utils");function a(h){o.call(this,"ConvertWorker to "+h),this.destType=h}l.inherits(a,o),a.prototype.processChunk=function(h){this.push({data:l.transformTo(this.destType,h.data),meta:h.meta})},s.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,i){var o=n("./GenericWorker"),l=n("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,o),a.prototype.processChunk=function(h){this.streamInfo.crc32=l(h.data,this.streamInfo.crc32||0),this.push(h)},s.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,i){var o=n("../utils"),l=n("./GenericWorker");function a(h){l.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}o.inherits(a,l),a.prototype.processChunk=function(h){if(h){var p=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=p+h.data.length}l.prototype.processChunk.call(this,h)},s.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,i){var o=n("../utils"),l=n("./GenericWorker");function a(h){l.call(this,"DataWorker");var p=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(x){p.dataIsReady=!0,p.data=x,p.max=x&&x.length||0,p.type=o.getTypeOf(x),p.isPaused||p._tickAndRepeat()},function(x){p.error(x)})}o.inherits(a,l),a.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,p=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,p);break;case"uint8array":h=this.data.subarray(this.index,p);break;case"array":case"nodebuffer":h=this.data.slice(this.index,p)}return this.index=p,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,i){function o(l){this.name=l||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,a){return this._listeners[l].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,a){if(this._listeners[l])for(var h=0;h "+l:l}},s.exports=o},{}],29:[function(n,s,i){var o=n("../utils"),l=n("./ConvertWorker"),a=n("./GenericWorker"),h=n("../base64"),p=n("../support"),x=n("../external"),y=null;if(p.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function b(N,C){return new x.Promise(function(A,E){var T=[],L=N._internalType,z=N._outputType,F=N._mimeType;N.on("data",function(q,H){T.push(q),C&&C(H)}).on("error",function(q){T=[],E(q)}).on("end",function(){try{var q=function(H,K,Z){switch(H){case"blob":return o.newBlob(o.transformTo("arraybuffer",K),Z);case"base64":return h.encode(K);default:return o.transformTo(H,K)}}(z,function(H,K){var Z,te=0,ae=null,le=0;for(Z=0;Z"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(o),i.blob=l.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!n("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,i){for(var o=n("./utils"),l=n("./support"),a=n("./nodejsUtils"),h=n("./stream/GenericWorker"),p=new Array(256),x=0;x<256;x++)p[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;p[254]=p[254]=1;function y(){h.call(this,"utf-8 decode"),this.leftOver=null}function b(){h.call(this,"utf-8 encode")}i.utf8encode=function(j){return l.nodebuffer?a.newBufferFrom(j,"utf-8"):function(N){var C,A,E,T,L,z=N.length,F=0;for(T=0;T>>6:(A<65536?C[L++]=224|A>>>12:(C[L++]=240|A>>>18,C[L++]=128|A>>>12&63),C[L++]=128|A>>>6&63),C[L++]=128|63&A);return C}(j)},i.utf8decode=function(j){return l.nodebuffer?o.transformTo("nodebuffer",j).toString("utf-8"):function(N){var C,A,E,T,L=N.length,z=new Array(2*L);for(C=A=0;C>10&1023,z[A++]=56320|1023&E)}return z.length!==A&&(z.subarray?z=z.subarray(0,A):z.length=A),o.applyFromCharCode(z)}(j=o.transformTo(l.uint8array?"uint8array":"array",j))},o.inherits(y,h),y.prototype.processChunk=function(j){var N=o.transformTo(l.uint8array?"uint8array":"array",j.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var C=N;(N=new Uint8Array(C.length+this.leftOver.length)).set(this.leftOver,0),N.set(C,this.leftOver.length)}else N=this.leftOver.concat(N);this.leftOver=null}var A=function(T,L){var z;for((L=L||T.length)>T.length&&(L=T.length),z=L-1;0<=z&&(192&T[z])==128;)z--;return z<0||z===0?L:z+p[T[z]]>L?z:L}(N),E=N;A!==N.length&&(l.uint8array?(E=N.subarray(0,A),this.leftOver=N.subarray(A,N.length)):(E=N.slice(0,A),this.leftOver=N.slice(A,N.length))),this.push({data:i.utf8decode(E),meta:j.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=y,o.inherits(b,h),b.prototype.processChunk=function(j){this.push({data:i.utf8encode(j.data),meta:j.meta})},i.Utf8EncodeWorker=b},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,i){var o=n("./support"),l=n("./base64"),a=n("./nodejsUtils"),h=n("./external");function p(C){return C}function x(C,A){for(var E=0;E>8;this.dir=!!(16&this.externalFileAttributes),j==0&&(this.dosPermissions=63&this.externalFileAttributes),j==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var j=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=j.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=j.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=j.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=j.readInt(4))}},readExtraFields:function(j){var N,C,A,E=j.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});j.index+4>>6:(j<65536?b[A++]=224|j>>>12:(b[A++]=240|j>>>18,b[A++]=128|j>>>12&63),b[A++]=128|j>>>6&63),b[A++]=128|63&j);return b},i.buf2binstring=function(y){return x(y,y.length)},i.binstring2buf=function(y){for(var b=new o.Buf8(y.length),j=0,N=b.length;j>10&1023,T[N++]=56320|1023&C)}return x(T,N)},i.utf8border=function(y,b){var j;for((b=b||y.length)>y.length&&(b=y.length),j=b-1;0<=j&&(192&y[j])==128;)j--;return j<0||j===0?b:j+h[y[j]]>b?j:b}},{"./common":41}],43:[function(n,s,i){s.exports=function(o,l,a,h){for(var p=65535&o|0,x=o>>>16&65535|0,y=0;a!==0;){for(a-=y=2e3>>1:l>>>1;a[h]=l}return a}();s.exports=function(l,a,h,p){var x=o,y=p+h;l^=-1;for(var b=p;b>>8^x[255&(l^a[b])];return-1^l}},{}],46:[function(n,s,i){var o,l=n("../utils/common"),a=n("./trees"),h=n("./adler32"),p=n("./crc32"),x=n("./messages"),y=0,b=4,j=0,N=-2,C=-1,A=4,E=2,T=8,L=9,z=286,F=30,q=19,H=2*z+1,K=15,Z=3,te=258,ae=te+Z+1,le=42,ve=113,ne=1,ge=2,ie=3,fe=4;function de(me,mt){return me.msg=x[mt],mt}function ye(me){return(me<<1)-(4me.avail_out&&(et=me.avail_out),et!==0&&(l.arraySet(me.output,mt.pending_buf,mt.pending_out,et,me.next_out),me.next_out+=et,mt.pending_out+=et,me.total_out+=et,me.avail_out-=et,mt.pending-=et,mt.pending===0&&(mt.pending_out=0))}function we(me,mt){a._tr_flush_block(me,0<=me.block_start?me.block_start:-1,me.strstart-me.block_start,mt),me.block_start=me.strstart,Ne(me.strm)}function he(me,mt){me.pending_buf[me.pending++]=mt}function xe(me,mt){me.pending_buf[me.pending++]=mt>>>8&255,me.pending_buf[me.pending++]=255&mt}function be(me,mt){var et,nt,Ae=me.max_chain_length,ht=me.strstart,$e=me.prev_length,Je=me.nice_match,tt=me.strstart>me.w_size-ae?me.strstart-(me.w_size-ae):0,ft=me.window,jt=me.w_mask,Nt=me.prev,Et=me.strstart+te,vt=ft[ht+$e-1],rr=ft[ht+$e];me.prev_length>=me.good_match&&(Ae>>=2),Je>me.lookahead&&(Je=me.lookahead);do if(ft[(et=mt)+$e]===rr&&ft[et+$e-1]===vt&&ft[et]===ft[ht]&&ft[++et]===ft[ht+1]){ht+=2,et++;do;while(ft[++ht]===ft[++et]&&ft[++ht]===ft[++et]&&ft[++ht]===ft[++et]&&ft[++ht]===ft[++et]&&ft[++ht]===ft[++et]&&ft[++ht]===ft[++et]&&ft[++ht]===ft[++et]&&ft[++ht]===ft[++et]&&httt&&--Ae!=0);return $e<=me.lookahead?$e:me.lookahead}function Oe(me){var mt,et,nt,Ae,ht,$e,Je,tt,ft,jt,Nt=me.w_size;do{if(Ae=me.window_size-me.lookahead-me.strstart,me.strstart>=Nt+(Nt-ae)){for(l.arraySet(me.window,me.window,Nt,Nt,0),me.match_start-=Nt,me.strstart-=Nt,me.block_start-=Nt,mt=et=me.hash_size;nt=me.head[--mt],me.head[mt]=Nt<=nt?nt-Nt:0,--et;);for(mt=et=Nt;nt=me.prev[--mt],me.prev[mt]=Nt<=nt?nt-Nt:0,--et;);Ae+=Nt}if(me.strm.avail_in===0)break;if($e=me.strm,Je=me.window,tt=me.strstart+me.lookahead,ft=Ae,jt=void 0,jt=$e.avail_in,ft=Z)for(ht=me.strstart-me.insert,me.ins_h=me.window[ht],me.ins_h=(me.ins_h<=Z&&(me.ins_h=(me.ins_h<=Z)if(nt=a._tr_tally(me,me.strstart-me.match_start,me.match_length-Z),me.lookahead-=me.match_length,me.match_length<=me.max_lazy_match&&me.lookahead>=Z){for(me.match_length--;me.strstart++,me.ins_h=(me.ins_h<=Z&&(me.ins_h=(me.ins_h<=Z&&me.match_length<=me.prev_length){for(Ae=me.strstart+me.lookahead-Z,nt=a._tr_tally(me,me.strstart-1-me.prev_match,me.prev_length-Z),me.lookahead-=me.prev_length-1,me.prev_length-=2;++me.strstart<=Ae&&(me.ins_h=(me.ins_h<me.pending_buf_size-5&&(et=me.pending_buf_size-5);;){if(me.lookahead<=1){if(Oe(me),me.lookahead===0&&mt===y)return ne;if(me.lookahead===0)break}me.strstart+=me.lookahead,me.lookahead=0;var nt=me.block_start+et;if((me.strstart===0||me.strstart>=nt)&&(me.lookahead=me.strstart-nt,me.strstart=nt,we(me,!1),me.strm.avail_out===0)||me.strstart-me.block_start>=me.w_size-ae&&(we(me,!1),me.strm.avail_out===0))return ne}return me.insert=0,mt===b?(we(me,!0),me.strm.avail_out===0?ie:fe):(me.strstart>me.block_start&&(we(me,!1),me.strm.avail_out),ne)}),new Fe(4,4,8,4,Te),new Fe(4,5,16,8,Te),new Fe(4,6,32,32,Te),new Fe(4,4,16,16,Ve),new Fe(8,16,32,32,Ve),new Fe(8,16,128,128,Ve),new Fe(8,32,128,256,Ve),new Fe(32,128,258,1024,Ve),new Fe(32,258,258,4096,Ve)],i.deflateInit=function(me,mt){return Ye(me,mt,T,15,8,0)},i.deflateInit2=Ye,i.deflateReset=Ee,i.deflateResetKeep=Qe,i.deflateSetHeader=function(me,mt){return me&&me.state?me.state.wrap!==2?N:(me.state.gzhead=mt,j):N},i.deflate=function(me,mt){var et,nt,Ae,ht;if(!me||!me.state||5>8&255),he(nt,nt.gzhead.time>>16&255),he(nt,nt.gzhead.time>>24&255),he(nt,nt.level===9?2:2<=nt.strategy||nt.level<2?4:0),he(nt,255&nt.gzhead.os),nt.gzhead.extra&&nt.gzhead.extra.length&&(he(nt,255&nt.gzhead.extra.length),he(nt,nt.gzhead.extra.length>>8&255)),nt.gzhead.hcrc&&(me.adler=p(me.adler,nt.pending_buf,nt.pending,0)),nt.gzindex=0,nt.status=69):(he(nt,0),he(nt,0),he(nt,0),he(nt,0),he(nt,0),he(nt,nt.level===9?2:2<=nt.strategy||nt.level<2?4:0),he(nt,3),nt.status=ve);else{var $e=T+(nt.w_bits-8<<4)<<8;$e|=(2<=nt.strategy||nt.level<2?0:nt.level<6?1:nt.level===6?2:3)<<6,nt.strstart!==0&&($e|=32),$e+=31-$e%31,nt.status=ve,xe(nt,$e),nt.strstart!==0&&(xe(nt,me.adler>>>16),xe(nt,65535&me.adler)),me.adler=1}if(nt.status===69)if(nt.gzhead.extra){for(Ae=nt.pending;nt.gzindex<(65535&nt.gzhead.extra.length)&&(nt.pending!==nt.pending_buf_size||(nt.gzhead.hcrc&&nt.pending>Ae&&(me.adler=p(me.adler,nt.pending_buf,nt.pending-Ae,Ae)),Ne(me),Ae=nt.pending,nt.pending!==nt.pending_buf_size));)he(nt,255&nt.gzhead.extra[nt.gzindex]),nt.gzindex++;nt.gzhead.hcrc&&nt.pending>Ae&&(me.adler=p(me.adler,nt.pending_buf,nt.pending-Ae,Ae)),nt.gzindex===nt.gzhead.extra.length&&(nt.gzindex=0,nt.status=73)}else nt.status=73;if(nt.status===73)if(nt.gzhead.name){Ae=nt.pending;do{if(nt.pending===nt.pending_buf_size&&(nt.gzhead.hcrc&&nt.pending>Ae&&(me.adler=p(me.adler,nt.pending_buf,nt.pending-Ae,Ae)),Ne(me),Ae=nt.pending,nt.pending===nt.pending_buf_size)){ht=1;break}ht=nt.gzindexAe&&(me.adler=p(me.adler,nt.pending_buf,nt.pending-Ae,Ae)),ht===0&&(nt.gzindex=0,nt.status=91)}else nt.status=91;if(nt.status===91)if(nt.gzhead.comment){Ae=nt.pending;do{if(nt.pending===nt.pending_buf_size&&(nt.gzhead.hcrc&&nt.pending>Ae&&(me.adler=p(me.adler,nt.pending_buf,nt.pending-Ae,Ae)),Ne(me),Ae=nt.pending,nt.pending===nt.pending_buf_size)){ht=1;break}ht=nt.gzindexAe&&(me.adler=p(me.adler,nt.pending_buf,nt.pending-Ae,Ae)),ht===0&&(nt.status=103)}else nt.status=103;if(nt.status===103&&(nt.gzhead.hcrc?(nt.pending+2>nt.pending_buf_size&&Ne(me),nt.pending+2<=nt.pending_buf_size&&(he(nt,255&me.adler),he(nt,me.adler>>8&255),me.adler=0,nt.status=ve)):nt.status=ve),nt.pending!==0){if(Ne(me),me.avail_out===0)return nt.last_flush=-1,j}else if(me.avail_in===0&&ye(mt)<=ye(et)&&mt!==b)return de(me,-5);if(nt.status===666&&me.avail_in!==0)return de(me,-5);if(me.avail_in!==0||nt.lookahead!==0||mt!==y&&nt.status!==666){var Je=nt.strategy===2?function(tt,ft){for(var jt;;){if(tt.lookahead===0&&(Oe(tt),tt.lookahead===0)){if(ft===y)return ne;break}if(tt.match_length=0,jt=a._tr_tally(tt,0,tt.window[tt.strstart]),tt.lookahead--,tt.strstart++,jt&&(we(tt,!1),tt.strm.avail_out===0))return ne}return tt.insert=0,ft===b?(we(tt,!0),tt.strm.avail_out===0?ie:fe):tt.last_lit&&(we(tt,!1),tt.strm.avail_out===0)?ne:ge}(nt,mt):nt.strategy===3?function(tt,ft){for(var jt,Nt,Et,vt,rr=tt.window;;){if(tt.lookahead<=te){if(Oe(tt),tt.lookahead<=te&&ft===y)return ne;if(tt.lookahead===0)break}if(tt.match_length=0,tt.lookahead>=Z&&0tt.lookahead&&(tt.match_length=tt.lookahead)}if(tt.match_length>=Z?(jt=a._tr_tally(tt,1,tt.match_length-Z),tt.lookahead-=tt.match_length,tt.strstart+=tt.match_length,tt.match_length=0):(jt=a._tr_tally(tt,0,tt.window[tt.strstart]),tt.lookahead--,tt.strstart++),jt&&(we(tt,!1),tt.strm.avail_out===0))return ne}return tt.insert=0,ft===b?(we(tt,!0),tt.strm.avail_out===0?ie:fe):tt.last_lit&&(we(tt,!1),tt.strm.avail_out===0)?ne:ge}(nt,mt):o[nt.level].func(nt,mt);if(Je!==ie&&Je!==fe||(nt.status=666),Je===ne||Je===ie)return me.avail_out===0&&(nt.last_flush=-1),j;if(Je===ge&&(mt===1?a._tr_align(nt):mt!==5&&(a._tr_stored_block(nt,0,0,!1),mt===3&&(Ie(nt.head),nt.lookahead===0&&(nt.strstart=0,nt.block_start=0,nt.insert=0))),Ne(me),me.avail_out===0))return nt.last_flush=-1,j}return mt!==b?j:nt.wrap<=0?1:(nt.wrap===2?(he(nt,255&me.adler),he(nt,me.adler>>8&255),he(nt,me.adler>>16&255),he(nt,me.adler>>24&255),he(nt,255&me.total_in),he(nt,me.total_in>>8&255),he(nt,me.total_in>>16&255),he(nt,me.total_in>>24&255)):(xe(nt,me.adler>>>16),xe(nt,65535&me.adler)),Ne(me),0=et.w_size&&(ht===0&&(Ie(et.head),et.strstart=0,et.block_start=0,et.insert=0),ft=new l.Buf8(et.w_size),l.arraySet(ft,mt,jt-et.w_size,et.w_size,0),mt=ft,jt=et.w_size),$e=me.avail_in,Je=me.next_in,tt=me.input,me.avail_in=jt,me.next_in=0,me.input=mt,Oe(et);et.lookahead>=Z;){for(nt=et.strstart,Ae=et.lookahead-(Z-1);et.ins_h=(et.ins_h<>>=Z=K>>>24,L-=Z,(Z=K>>>16&255)===0)ge[x++]=65535&K;else{if(!(16&Z)){if(!(64&Z)){K=z[(65535&K)+(T&(1<>>=Z,L-=Z),L<15&&(T+=ne[h++]<>>=Z=K>>>24,L-=Z,!(16&(Z=K>>>16&255))){if(!(64&Z)){K=F[(65535&K)+(T&(1<>>=Z,L-=Z,(Z=x-y)>3,T&=(1<<(L-=te<<3))-1,o.next_in=h,o.next_out=x,o.avail_in=h>>24&255)+(le>>>8&65280)+((65280&le)<<8)+((255&le)<<24)}function T(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function L(le){var ve;return le&&le.state?(ve=le.state,le.total_in=le.total_out=ve.total=0,le.msg="",ve.wrap&&(le.adler=1&ve.wrap),ve.mode=N,ve.last=0,ve.havedict=0,ve.dmax=32768,ve.head=null,ve.hold=0,ve.bits=0,ve.lencode=ve.lendyn=new o.Buf32(C),ve.distcode=ve.distdyn=new o.Buf32(A),ve.sane=1,ve.back=-1,b):j}function z(le){var ve;return le&&le.state?((ve=le.state).wsize=0,ve.whave=0,ve.wnext=0,L(le)):j}function F(le,ve){var ne,ge;return le&&le.state?(ge=le.state,ve<0?(ne=0,ve=-ve):(ne=1+(ve>>4),ve<48&&(ve&=15)),ve&&(ve<8||15=fe.wsize?(o.arraySet(fe.window,ve,ne-fe.wsize,fe.wsize,0),fe.wnext=0,fe.whave=fe.wsize):(ge<(ie=fe.wsize-fe.wnext)&&(ie=ge),o.arraySet(fe.window,ve,ne-ge,ie,fe.wnext),(ge-=ie)?(o.arraySet(fe.window,ve,ne-ge,ge,0),fe.wnext=ge,fe.whave=fe.wsize):(fe.wnext+=ie,fe.wnext===fe.wsize&&(fe.wnext=0),fe.whave>>8&255,ne.check=a(ne.check,ht,2,0),we=Ne=0,ne.mode=2;break}if(ne.flags=0,ne.head&&(ne.head.done=!1),!(1&ne.wrap)||(((255&Ne)<<8)+(Ne>>8))%31){le.msg="incorrect header check",ne.mode=30;break}if((15&Ne)!=8){le.msg="unknown compression method",ne.mode=30;break}if(we-=4,me=8+(15&(Ne>>>=4)),ne.wbits===0)ne.wbits=me;else if(me>ne.wbits){le.msg="invalid window size",ne.mode=30;break}ne.dmax=1<>8&1),512&ne.flags&&(ht[0]=255&Ne,ht[1]=Ne>>>8&255,ne.check=a(ne.check,ht,2,0)),we=Ne=0,ne.mode=3;case 3:for(;we<32;){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>8&255,ht[2]=Ne>>>16&255,ht[3]=Ne>>>24&255,ne.check=a(ne.check,ht,4,0)),we=Ne=0,ne.mode=4;case 4:for(;we<16;){if(ye===0)break e;ye--,Ne+=ge[fe++]<>8),512&ne.flags&&(ht[0]=255&Ne,ht[1]=Ne>>>8&255,ne.check=a(ne.check,ht,2,0)),we=Ne=0,ne.mode=5;case 5:if(1024&ne.flags){for(;we<16;){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>8&255,ne.check=a(ne.check,ht,2,0)),we=Ne=0}else ne.head&&(ne.head.extra=null);ne.mode=6;case 6:if(1024&ne.flags&&(ye<(be=ne.length)&&(be=ye),be&&(ne.head&&(me=ne.head.extra_len-ne.length,ne.head.extra||(ne.head.extra=new Array(ne.head.extra_len)),o.arraySet(ne.head.extra,ge,fe,be,me)),512&ne.flags&&(ne.check=a(ne.check,ge,be,fe)),ye-=be,fe+=be,ne.length-=be),ne.length))break e;ne.length=0,ne.mode=7;case 7:if(2048&ne.flags){if(ye===0)break e;for(be=0;me=ge[fe+be++],ne.head&&me&&ne.length<65536&&(ne.head.name+=String.fromCharCode(me)),me&&be>9&1,ne.head.done=!0),le.adler=ne.check=0,ne.mode=12;break;case 10:for(;we<32;){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>=7&we,we-=7&we,ne.mode=27;break}for(;we<3;){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>=1)){case 0:ne.mode=14;break;case 1:if(te(ne),ne.mode=20,ve!==6)break;Ne>>>=2,we-=2;break e;case 2:ne.mode=17;break;case 3:le.msg="invalid block type",ne.mode=30}Ne>>>=2,we-=2;break;case 14:for(Ne>>>=7&we,we-=7&we;we<32;){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>16^65535)){le.msg="invalid stored block lengths",ne.mode=30;break}if(ne.length=65535&Ne,we=Ne=0,ne.mode=15,ve===6)break e;case 15:ne.mode=16;case 16:if(be=ne.length){if(ye>>=5,we-=5,ne.ndist=1+(31&Ne),Ne>>>=5,we-=5,ne.ncode=4+(15&Ne),Ne>>>=4,we-=4,286>>=3,we-=3}for(;ne.have<19;)ne.lens[$e[ne.have++]]=0;if(ne.lencode=ne.lendyn,ne.lenbits=7,et={bits:ne.lenbits},mt=p(0,ne.lens,0,19,ne.lencode,0,ne.work,et),ne.lenbits=et.bits,mt){le.msg="invalid code lengths set",ne.mode=30;break}ne.have=0,ne.mode=19;case 19:for(;ne.have>>16&255,Me=65535&Ae,!((Ve=Ae>>>24)<=we);){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>=Ve,we-=Ve,ne.lens[ne.have++]=Me;else{if(Me===16){for(nt=Ve+2;we>>=Ve,we-=Ve,ne.have===0){le.msg="invalid bit length repeat",ne.mode=30;break}me=ne.lens[ne.have-1],be=3+(3&Ne),Ne>>>=2,we-=2}else if(Me===17){for(nt=Ve+3;we>>=Ve)),Ne>>>=3,we-=3}else{for(nt=Ve+7;we>>=Ve)),Ne>>>=7,we-=7}if(ne.have+be>ne.nlen+ne.ndist){le.msg="invalid bit length repeat",ne.mode=30;break}for(;be--;)ne.lens[ne.have++]=me}}if(ne.mode===30)break;if(ne.lens[256]===0){le.msg="invalid code -- missing end-of-block",ne.mode=30;break}if(ne.lenbits=9,et={bits:ne.lenbits},mt=p(x,ne.lens,0,ne.nlen,ne.lencode,0,ne.work,et),ne.lenbits=et.bits,mt){le.msg="invalid literal/lengths set",ne.mode=30;break}if(ne.distbits=6,ne.distcode=ne.distdyn,et={bits:ne.distbits},mt=p(y,ne.lens,ne.nlen,ne.ndist,ne.distcode,0,ne.work,et),ne.distbits=et.bits,mt){le.msg="invalid distances set",ne.mode=30;break}if(ne.mode=20,ve===6)break e;case 20:ne.mode=21;case 21:if(6<=ye&&258<=Ie){le.next_out=de,le.avail_out=Ie,le.next_in=fe,le.avail_in=ye,ne.hold=Ne,ne.bits=we,h(le,xe),de=le.next_out,ie=le.output,Ie=le.avail_out,fe=le.next_in,ge=le.input,ye=le.avail_in,Ne=ne.hold,we=ne.bits,ne.mode===12&&(ne.back=-1);break}for(ne.back=0;Fe=(Ae=ne.lencode[Ne&(1<>>16&255,Me=65535&Ae,!((Ve=Ae>>>24)<=we);){if(ye===0)break e;ye--,Ne+=ge[fe++]<>Qe)])>>>16&255,Me=65535&Ae,!(Qe+(Ve=Ae>>>24)<=we);){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>=Qe,we-=Qe,ne.back+=Qe}if(Ne>>>=Ve,we-=Ve,ne.back+=Ve,ne.length=Me,Fe===0){ne.mode=26;break}if(32&Fe){ne.back=-1,ne.mode=12;break}if(64&Fe){le.msg="invalid literal/length code",ne.mode=30;break}ne.extra=15&Fe,ne.mode=22;case 22:if(ne.extra){for(nt=ne.extra;we>>=ne.extra,we-=ne.extra,ne.back+=ne.extra}ne.was=ne.length,ne.mode=23;case 23:for(;Fe=(Ae=ne.distcode[Ne&(1<>>16&255,Me=65535&Ae,!((Ve=Ae>>>24)<=we);){if(ye===0)break e;ye--,Ne+=ge[fe++]<>Qe)])>>>16&255,Me=65535&Ae,!(Qe+(Ve=Ae>>>24)<=we);){if(ye===0)break e;ye--,Ne+=ge[fe++]<>>=Qe,we-=Qe,ne.back+=Qe}if(Ne>>>=Ve,we-=Ve,ne.back+=Ve,64&Fe){le.msg="invalid distance code",ne.mode=30;break}ne.offset=Me,ne.extra=15&Fe,ne.mode=24;case 24:if(ne.extra){for(nt=ne.extra;we>>=ne.extra,we-=ne.extra,ne.back+=ne.extra}if(ne.offset>ne.dmax){le.msg="invalid distance too far back",ne.mode=30;break}ne.mode=25;case 25:if(Ie===0)break e;if(be=xe-Ie,ne.offset>be){if((be=ne.offset-be)>ne.whave&&ne.sane){le.msg="invalid distance too far back",ne.mode=30;break}Oe=be>ne.wnext?(be-=ne.wnext,ne.wsize-be):ne.wnext-be,be>ne.length&&(be=ne.length),Te=ne.window}else Te=ie,Oe=de-ne.offset,be=ne.length;for(IeH?(Z=Oe[Te+A[ve]],we[he+A[ve]]):(Z=96,0),T=1<>de)+(L-=T)]=K<<24|Z<<16|te|0,L!==0;);for(T=1<>=1;if(T!==0?(Ne&=T-1,Ne+=T):Ne=0,ve++,--xe[le]==0){if(le===ge)break;le=y[b+A[ve]]}if(ie>>7)]}function he(Ae,ht){Ae.pending_buf[Ae.pending++]=255&ht,Ae.pending_buf[Ae.pending++]=ht>>>8&255}function xe(Ae,ht,$e){Ae.bi_valid>E-$e?(Ae.bi_buf|=ht<>E-Ae.bi_valid,Ae.bi_valid+=$e-E):(Ae.bi_buf|=ht<>>=1,$e<<=1,0<--ht;);return $e>>>1}function Te(Ae,ht,$e){var Je,tt,ft=new Array(A+1),jt=0;for(Je=1;Je<=A;Je++)ft[Je]=jt=jt+$e[Je-1]<<1;for(tt=0;tt<=ht;tt++){var Nt=Ae[2*tt+1];Nt!==0&&(Ae[2*tt]=Oe(ft[Nt]++,Nt))}}function Ve(Ae){var ht;for(ht=0;ht>1;1<=$e;$e--)Qe(Ae,ft,$e);for(tt=Et;$e=Ae.heap[1],Ae.heap[1]=Ae.heap[Ae.heap_len--],Qe(Ae,ft,1),Je=Ae.heap[1],Ae.heap[--Ae.heap_max]=$e,Ae.heap[--Ae.heap_max]=Je,ft[2*tt]=ft[2*$e]+ft[2*Je],Ae.depth[tt]=(Ae.depth[$e]>=Ae.depth[Je]?Ae.depth[$e]:Ae.depth[Je])+1,ft[2*$e+1]=ft[2*Je+1]=tt,Ae.heap[1]=tt++,Qe(Ae,ft,1),2<=Ae.heap_len;);Ae.heap[--Ae.heap_max]=Ae.heap[1],function(rr,Ar){var yn,kn,Jr,zn,ks,fr,xs=Ar.dyn_tree,ji=Ar.max_code,mi=Ar.stat_desc.static_tree,La=Ar.stat_desc.has_stree,da=Ar.stat_desc.extra_bits,tl=Ar.stat_desc.extra_base,rl=Ar.stat_desc.max_length,Gs=0;for(zn=0;zn<=A;zn++)rr.bl_count[zn]=0;for(xs[2*rr.heap[rr.heap_max]+1]=0,yn=rr.heap_max+1;yn>=7;tt>>=1)if(1&vt&&Nt.dyn_ltree[2*Et]!==0)return l;if(Nt.dyn_ltree[18]!==0||Nt.dyn_ltree[20]!==0||Nt.dyn_ltree[26]!==0)return a;for(Et=32;Et>>3,(ft=Ae.static_len+3+7>>>3)<=tt&&(tt=ft)):tt=ft=$e+5,$e+4<=tt&&ht!==-1?nt(Ae,ht,$e,Je):Ae.strategy===4||ft===tt?(xe(Ae,2+(Je?1:0),3),Ee(Ae,ae,le)):(xe(Ae,4+(Je?1:0),3),function(Nt,Et,vt,rr){var Ar;for(xe(Nt,Et-257,5),xe(Nt,vt-1,5),xe(Nt,rr-4,4),Ar=0;Ar>>8&255,Ae.pending_buf[Ae.d_buf+2*Ae.last_lit+1]=255&ht,Ae.pending_buf[Ae.l_buf+Ae.last_lit]=255&$e,Ae.last_lit++,ht===0?Ae.dyn_ltree[2*$e]++:(Ae.matches++,ht--,Ae.dyn_ltree[2*(ne[$e]+y+1)]++,Ae.dyn_dtree[2*we(ht)]++),Ae.last_lit===Ae.lit_bufsize-1},i._tr_align=function(Ae){xe(Ae,2,3),be(Ae,L,ae),function(ht){ht.bi_valid===16?(he(ht,ht.bi_buf),ht.bi_buf=0,ht.bi_valid=0):8<=ht.bi_valid&&(ht.pending_buf[ht.pending++]=255&ht.bi_buf,ht.bi_buf>>=8,ht.bi_valid-=8)}(Ae)}},{"../utils/common":41}],53:[function(n,s,i){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,s,i){(function(o){(function(l,a){if(!l.setImmediate){var h,p,x,y,b=1,j={},N=!1,C=l.document,A=Object.getPrototypeOf&&Object.getPrototypeOf(l);A=A&&A.setTimeout?A:l,h={}.toString.call(l.process)==="[object process]"?function(z){process.nextTick(function(){T(z)})}:function(){if(l.postMessage&&!l.importScripts){var z=!0,F=l.onmessage;return l.onmessage=function(){z=!1},l.postMessage("","*"),l.onmessage=F,z}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",L,!1):l.attachEvent("onmessage",L),function(z){l.postMessage(y+z,"*")}):l.MessageChannel?((x=new MessageChannel).port1.onmessage=function(z){T(z.data)},function(z){x.port2.postMessage(z)}):C&&"onreadystatechange"in C.createElement("script")?(p=C.documentElement,function(z){var F=C.createElement("script");F.onreadystatechange=function(){T(z),F.onreadystatechange=null,p.removeChild(F),F=null},p.appendChild(F)}):function(z){setTimeout(T,0,z)},A.setImmediate=function(z){typeof z!="function"&&(z=new Function(""+z));for(var F=new Array(arguments.length-1),q=0;q"u"?o===void 0?this:o:self)}).call(this,typeof Ix<"u"?Ix:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(uRe);var $xt=uRe.exports;const Uxt=za($xt),qxt=()=>{const{isAdmin:e}=zr(),[t,n]=I.useState(null),[s,i]=I.useState(null),[o,l]=I.useState("all"),[a,h]=I.useState(new Set),[p,x]=I.useState(!1),[y,b]=I.useState(!1),[j,N]=I.useState("images"),[C,A]=I.useState(null),{data:E=[],isLoading:T}=Zt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:ye,error:Ie}=await J.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ie)throw Ie;return ye}}),{data:L=[]}=Zt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:ye,error:Ie}=await J.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ie)throw Ie;return ye}}),{data:z=[]}=Zt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:ye,error:Ie}=await J.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ie)throw Ie;return ye}}),{data:F=[]}=Zt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:ye,error:Ie}=await J.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ie)throw Ie;return ye||[]}}),q=F.length>0,H=I.useMemo(()=>o==="all"?null:z.find(ye=>ye.month===o)||null,[o,z]),K=I.useMemo(()=>[...new Set(E.map(Ie=>Ie.month))].sort((Ie,Ne)=>Ne.localeCompare(Ie)),[E]);I.useEffect(()=>{K.length>0&&o==="all"&&l(K[0])},[K,o]);const Z=ye=>{try{const Ie=fxe(ye,"yyyy-MM",new Date);return xn(Ie,"MMMM yyyy")}catch{return ye}},te=I.useMemo(()=>o==="all"?E:E.filter(ye=>ye.month===o),[o,E]),ae=I.useMemo(()=>{var ye;return o==="all"?null:((ye=L.find(Ie=>Ie.month===o))==null?void 0:ye.canva_link)||null},[o,L]),le=async ye=>{try{await navigator.clipboard.writeText(ye),ze.success("Caption copied to clipboard!")}catch{ze.error("Failed to copy caption")}},ve=async(ye,Ie)=>{try{const we=await(await fetch(ye)).blob(),he=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),xe=navigator.canShare&&navigator.canShare({files:[new File([we],"test.jpg",{type:"image/jpeg"})]});if(he&&xe){const be=new File([we],`social-swag-${Ie}.jpg`,{type:"image/jpeg"});await navigator.share({files:[be],title:"Social Swag Image"}),ze.success("Image ready to save!")}else{const be=window.URL.createObjectURL(we),Oe=document.createElement("a");Oe.href=be,Oe.download=`social-swag-${Ie}.jpg`,document.body.appendChild(Oe),Oe.click(),document.body.removeChild(Oe),window.URL.revokeObjectURL(be),ze.success("Image downloaded!")}}catch(Ne){Ne.name!=="AbortError"&&ze.error("Failed to download image")}},ne=ye=>{h(Ie=>{const Ne=new Set(Ie);return Ne.has(ye)?Ne.delete(ye):Ne.add(ye),Ne})},ge=()=>{h(new Set(te.map(ye=>ye.id)))},ie=()=>{h(new Set),x(!1)},fe=async()=>{const ye=te.filter(Ie=>a.has(Ie.id));if(ye.length===0){ze.error("No images selected");return}b(!0),ze.info(`Preparing ${ye.length} images for download...`);try{const Ie=new Uxt,Ne=[...ye].sort((Oe,Te)=>Oe.sort_order-Te.sort_order);for(let Oe=0;Oe{p?ne(ye.id):n(ye)};return r.jsx(Or,{title:"Social Swag 2.0",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/80 to-info p-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[r.jsxs(Rt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Cs,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Rt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Do,{className:"h-3 w-3 mr-1"}),E.length," images"]})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Social Swag 📸"}),r.jsx("p",{className:"text-lg text-primary-foreground/90 max-w-2xl",children:"Ready-to-post social media images delivered to you monthly. Just download, copy the caption, and share with your audience!"})]})]}),e?r.jsxs(ba,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(fa,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(ln,{value:"gallery",className:"gap-2",children:[r.jsx(Do,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(ln,{value:"scheduled",className:"gap-2",children:[r.jsx(hm,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(An,{value:"gallery",className:"space-y-6",children:[e?q?r.jsx(Ge,{className:"border rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(uo,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(Ge,{className:"border-2 border-dashed border-primary/30 bg-gradient-to-r from-pink-500/5 via-purple-500/5 to-blue-500/5 rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Od,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(eu,{className:"h-5 w-5 text-pink-600"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Post directly to social media"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook & Instagram accounts to post images with one click!"})]}),r.jsx(ee,{asChild:!0,className:"gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600",children:r.jsxs(uo,{to:"/social-connections",children:[r.jsx(Xh,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(Ge,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ki,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Od,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(eu,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(ye=>r.jsx("button",{onClick:()=>l(ye),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ye?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(ye)},ye))}),o!=="all"&&(ae?r.jsxs("a",{href:ae,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{N("images"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Do,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{N("reels"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Ad,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:ge,className:"gap-2",children:["Select All (",te.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(bs,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ee,{size:"sm",onClick:fe,disabled:y,className:"gap-2",children:[r.jsx(Va,{className:"h-4 w-4"}),y?"Downloading...":`Download ${a.size} Selected`]}),r.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:"Please ensure your browser allows downloads from the LevelUp Dashboard."})]})]}):r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ca,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(ye=>{const Ie=a.has(ye.id);return r.jsx(Ge,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ie&&"ring-2 ring-primary ring-offset-2"),onClick:()=>de(ye),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ye.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ie?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ie&&r.jsx(Ca,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ye.id)})}),te.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Do,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:H?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ge,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(H),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:H.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Rt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Ad,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ad,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Br,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:t&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:t.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(zs,{className:"h-4 w-4"}),xn(new Date(t.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:t.caption})})]}),r.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[e&&r.jsxs(ee,{onClick:()=>{A({imageUrl:t.image_url,imageId:t.id,caption:t.caption})},className:"w-full gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600 text-white",children:[r.jsx(Lo,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(ee,{variant:"outline",onClick:()=>le(t.caption),className:"flex-1 gap-2",children:[r.jsx(pl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ve(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(Va,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Br,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(ee,{onClick:()=>le(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(pl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(ee,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(Sxt,{open:!!C,onOpenChange:ye=>!ye&&A(null),imageUrl:(C==null?void 0:C.imageUrl)||"",imageId:(C==null?void 0:C.imageId)||"",defaultCaption:(C==null?void 0:C.caption)||"",swagItemId:C==null?void 0:C.imageId})]}),r.jsx(An,{value:"scheduled",children:r.jsx(Bxt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ki,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Od,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(eu,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:K.map(ye=>r.jsx("button",{onClick:()=>l(ye),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ye?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:Z(ye)},ye))}),o!=="all"&&(ae?r.jsxs("a",{href:ae,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",Z(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{N("images"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Do,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{N("reels"),ie()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Ad,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:ge,className:"gap-2",children:["Select All (",te.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:ie,className:"gap-2",children:[r.jsx(bs,{className:"h-4 w-4"}),"Cancel"]}),a.size>0&&r.jsxs(ee,{size:"sm",onClick:fe,disabled:y,className:"gap-2",children:[r.jsx(Va,{className:"h-4 w-4"}),y?"Downloading...":`Download ${a.size} Selected`]})]}):r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ca,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(ye=>{const Ie=a.has(ye.id);return r.jsx(Ge,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ie&&"ring-2 ring-primary ring-offset-2"),onClick:()=>de(ye),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ye.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ie?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ie&&r.jsx(Ca,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ye.id)})}),te.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Do,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:H?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ge,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>i(H),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:H.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Rt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Ad,{className:"h-3 w-3 mr-1"}),"Reel"]})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ad,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Br,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:t&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:t.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(zs,{className:"h-4 w-4"}),xn(new Date(t.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:t.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[r.jsxs(ee,{variant:"outline",onClick:()=>le(t.caption),className:"flex-1 gap-2",children:[r.jsx(pl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ve(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(Va,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Br,{open:!!s,onOpenChange:()=>i(null),children:r.jsx(Fr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(ee,{onClick:()=>le(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(pl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(ee,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},Vxt=()=>{const{swagId:e}=Wc(),{user:t}=zr(),{toast:n}=pa(),s=Wr(),{trackEngagement:i}=AI(),[o,l]=I.useState(""),{data:a,isLoading:h}=Zt({queryKey:["social-swag-detail",e],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag").select("*").eq("id",e).single();if(T)throw T;const{data:L}=await J.from("social_swag_links").select("*").eq("swag_id",e).order("sort_order");return{...E,links:L||[]}},enabled:!!e});I.useEffect(()=>{a&&i("social_swag",a.id,a.title,"view")},[a==null?void 0:a.id]);const{data:p=[]}=Zt({queryKey:["social-swag-likes",e],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag_likes").select("*").eq("swag_id",e);if(T)throw T;return E},enabled:!!e}),{data:x=[]}=Zt({queryKey:["social-swag-comments",e],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag_comments").select("*").eq("swag_id",e).order("created_at",{ascending:!1});if(T)throw T;const L=[...new Set(E.map(q=>q.user_id))],{data:z}=await J.from("profiles").select("id, name").in("id",L),F=new Map((z==null?void 0:z.map(q=>[q.id,q.name]))||[]);return E.map(q=>({...q,user_name:F.get(q.user_id)||"Unknown User"}))},enabled:!!e}),y=cr({mutationFn:async E=>{const{error:T}=await J.from("social_swag_comments").insert({swag_id:e,user_id:t.id,content:E});if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),l(""),n({title:"Comment added!"})},onError:E=>{n({title:"Error adding comment",description:E.message,variant:"destructive"})}}),b=cr({mutationFn:async E=>{const{error:T}=await J.from("social_swag_comments").delete().eq("id",E);if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const E=p.find(T=>T.user_id===(t==null?void 0:t.id));if(E){const{error:T}=await J.from("social_swag_likes").delete().eq("id",E.id);if(T)throw T}else{const{error:T}=await J.from("social_swag_likes").insert({swag_id:e,user_id:t.id});if(T)throw T}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",e]})}}),N=p.some(E=>E.user_id===(t==null?void 0:t.id)),C=E=>E.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),A=E=>{E.preventDefault(),!(!o.trim()||!t)&&y.mutate(o.trim())};return h?r.jsx(Or,{title:"Social Swag",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):a?r.jsx(Or,{title:a.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(uo,{to:"/social-swag",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Social Swag"]})}),a.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:a.preview_image_url,alt:a.title,className:"w-full max-h-[500px] object-contain"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a.title})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(p3,{resourceType:"social_swag",resourceId:a.id,resourceTitle:a.title}),r.jsxs(ee,{variant:N?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!t||j.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${N?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),a.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:a.description}})]}),a.links.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(So,{className:"h-4 w-4"}),a.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:a.links.map(E=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{i("social_swag",a.id,a.title,"click_canva"),window.open(E.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:E.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"})]},E.id))})]})}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ol,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),t?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:E=>l(E.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(E=>r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(di,{className:"text-sm",children:C(E.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:E.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:tu(new Date(E.created_at),{addSuffix:!0})}),E.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(E.id),children:r.jsx(Zn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:E.content})]})]})})},E.id))})]})]})}):r.jsx(Or,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(So,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Item not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This item may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(uo,{to:"/social-swag",children:"Back to Social Swag"})})]})})},Hxt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,l]=I.useState(!0),[a,h]=I.useState(!0),[p,x]=I.useState(!0),y=b=>b.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2);return r.jsx("aside",{className:"w-64 shrink-0 hidden lg:block relative z-0",children:r.jsx("div",{className:"sticky top-4 space-y-4 max-h-[calc(100vh-8rem)] overflow-y-auto overscroll-contain",children:r.jsxs("div",{className:"space-y-2 pr-4",children:[r.jsxs(ee,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(rS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(NS,{open:o,onOpenChange:l,children:[r.jsx(SS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Categories"}),o?r.jsx(Pu,{className:"h-4 w-4"}):r.jsx(Ka,{className:"h-4 w-4"})]})}),r.jsx(CS,{className:"space-y-1 pl-2",children:e.map(b=>r.jsxs(ee,{variant:n===b.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(b.id),children:[r.jsx("span",{className:"mr-2",children:b.icon||"📂"}),r.jsx("span",{className:"truncate",children:b.name})]},b.id))})]}),t.length>0&&r.jsxs(NS,{open:a,onOpenChange:h,children:[r.jsx(SS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Gf,{className:"h-3 w-3"}),"Your Groups"]}),a?r.jsx(Pu,{className:"h-4 w-4"}):r.jsx(Ka,{className:"h-4 w-4"})]})}),r.jsx(CS,{className:"space-y-1 pl-2",children:t.map(b=>r.jsxs(ee,{variant:n===`group:${b.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${b.id}`),children:[r.jsx("span",{className:"mr-2",children:b.icon||"🔒"}),r.jsx("span",{className:"truncate",children:b.name})]},b.id))})]}),r.jsxs(NS,{open:p,onOpenChange:x,children:[r.jsx(SS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Vn,{className:"h-3 w-3"}),"Online Now",i.length>0&&r.jsx("span",{className:"ml-1 bg-green-500 text-white text-xs rounded-full px-1.5 py-0.5 min-w-[20px] text-center",children:i.length})]}),p?r.jsx(Pu,{className:"h-4 w-4"}):r.jsx(Ka,{className:"h-4 w-4"})]})}),r.jsx(CS,{className:"pl-2 space-y-1",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):i.map(b=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-md hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(ci,{className:"h-7 w-7",children:[r.jsx(Ga,{src:b.avatarUrl}),r.jsx(di,{className:"text-xs",children:y(b.name)})]}),r.jsx(Lu,{className:"h-2.5 w-2.5 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"text-sm truncate",children:b.name})]},b.id))})]})]})})})},Wxt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:i})=>{const[o,l]=I.useState(!1),a=p=>p.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),h=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const x=n.replace("group:",""),y=t.find(b=>b.id===x);return y?`🔒 ${y.name}`:"Private Group"}const p=e.find(x=>x.id===n);return p?`${p.icon||"📂"} ${p.name}`:"Category"};return r.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:h()}),r.jsx(Pu,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(ap,{className:"w-56 bg-background border",children:[r.jsxs(mo,{onClick:()=>s("all"),children:[r.jsx(rS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(pC,{}),r.jsx(vhe,{className:"text-xs text-muted-foreground",children:"Categories"}),e.map(p=>r.jsxs(mo,{onClick:()=>s(p.id),children:[r.jsx("span",{className:"mr-2",children:p.icon||"📂"}),p.name]},p.id)),t.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(pC,{}),r.jsxs(vhe,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Gf,{className:"h-3 w-3"}),"Your Groups"]}),t.map(p=>r.jsxs(mo,{onClick:()=>s(`group:${p.id}`),children:[r.jsx("span",{className:"mr-2",children:p.icon||"🔒"}),p.name]},p.id))]})]})]}),r.jsxs(tse,{open:o,onOpenChange:l,children:[r.jsx(Lge,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(Vn,{className:"h-4 w-4"}),i.length>0&&r.jsx("span",{className:"absolute -top-1 -right-1 bg-green-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:i.length})]})}),r.jsxs(kI,{children:[r.jsx(rse,{children:r.jsxs(nse,{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5"}),"Online Now (",i.length,")"]})}),r.jsx(Jo,{className:"h-[calc(100vh-8rem)] mt-4",children:i.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No one else online right now"}):r.jsx("div",{className:"space-y-2",children:i.map(p=>r.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:p.avatarUrl}),r.jsx(di,{children:a(p.name)})]}),r.jsx(Lu,{className:"h-3 w-3 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"font-medium",children:p.name})]},p.id))})})]})]})]})};var ace,Ise="HoverCard",[hRe]=Ql(Ise,[zg]),Pse=zg(),[Gxt,Bxe]=hRe(Ise),fRe=e=>{const{__scopeHoverCard:t,children:n,open:s,defaultOpen:i,onOpenChange:o,openDelay:l=700,closeDelay:a=300}=e,h=Pse(t),p=I.useRef(0),x=I.useRef(0),y=I.useRef(!1),b=I.useRef(!1),[j,N]=Ou({prop:s,defaultProp:i??!1,onChange:o,caller:Ise}),C=I.useCallback(()=>{clearTimeout(x.current),p.current=window.setTimeout(()=>N(!0),l)},[l,N]),A=I.useCallback(()=>{clearTimeout(p.current),!y.current&&!b.current&&(x.current=window.setTimeout(()=>N(!1),a))},[a,N]),E=I.useCallback(()=>N(!1),[N]);return I.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(x.current)},[]),r.jsx(Gxt,{scope:t,open:j,onOpenChange:N,onOpen:C,onClose:A,onDismiss:E,hasSelectionRef:y,isPointerDownOnContentRef:b,children:r.jsx(pI,{...h,children:n})})};fRe.displayName=Ise;var pRe="HoverCardTrigger",mRe=I.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,i=Bxe(pRe,n),o=Pse(n);return r.jsx(t3,{asChild:!0,...o,children:r.jsx(Rn.a,{"data-state":i.open?"open":"closed",...s,ref:t,onPointerEnter:cn(e.onPointerEnter,kte(i.onOpen)),onPointerLeave:cn(e.onPointerLeave,kte(i.onClose)),onFocus:cn(e.onFocus,i.onOpen),onBlur:cn(e.onBlur,i.onClose),onTouchStart:cn(e.onTouchStart,l=>l.preventDefault())})})});mRe.displayName=pRe;var Kxt="HoverCardPortal",[eYt,Zxt]=hRe(Kxt,{forceMount:void 0}),jte="HoverCardContent",gRe=I.forwardRef((e,t)=>{const n=Zxt(jte,e.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=e,o=Bxe(jte,e.__scopeHoverCard);return r.jsx(pc,{present:s||o.open,children:r.jsx(Yxt,{"data-state":o.open?"open":"closed",...i,onPointerEnter:cn(e.onPointerEnter,kte(o.onOpen)),onPointerLeave:cn(e.onPointerLeave,kte(o.onClose)),ref:t})})});gRe.displayName=jte;var Yxt=I.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:l,...a}=e,h=Bxe(jte,n),p=Pse(n),x=I.useRef(null),y=ei(t,x),[b,j]=I.useState(!1);return I.useEffect(()=>{if(b){const N=document.body;return ace=N.style.userSelect||N.style.webkitUserSelect,N.style.userSelect="none",N.style.webkitUserSelect="none",()=>{N.style.userSelect=ace,N.style.webkitUserSelect=ace}}},[b]),I.useEffect(()=>{if(x.current){const N=()=>{j(!1),h.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var A;((A=document.getSelection())==null?void 0:A.toString())!==""&&(h.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",N),()=>{document.removeEventListener("pointerup",N),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!1}}},[h.isPointerDownOnContentRef,h.hasSelectionRef]),I.useEffect(()=>{x.current&&Jxt(x.current).forEach(C=>C.setAttribute("tabindex","-1"))}),r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:cn(o,N=>{N.preventDefault()}),onDismiss:h.onDismiss,children:r.jsx(mI,{...p,...a,onPointerDown:cn(a.onPointerDown,N=>{N.currentTarget.contains(N.target)&&j(!0),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!0}),ref:y,style:{...a.style,userSelect:b?"text":void 0,WebkitUserSelect:b?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),Xxt="HoverCardArrow",Qxt=I.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,i=Pse(n);return r.jsx(gI,{...i,...s,ref:t})});Qxt.displayName=Xxt;function kte(e){return t=>t.pointerType==="touch"?void 0:e()}function Jxt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var eyt=fRe,tyt=mRe,xRe=gRe;const ryt=eyt,nyt=tyt,yRe=I.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},i)=>r.jsx(xRe,{ref:i,align:t,sideOffset:n,className:$t("z-50 w-64 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",e),...s}));yRe.displayName=xRe.displayName;const syt=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"},{type:"laugh",emoji:"😂",label:"Haha"},{type:"wow",emoji:"😮",label:"Wow"},{type:"sad",emoji:"😢",label:"Sad"},{type:"angry",emoji:"😠",label:"Angry"}],iyt=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),vRe=({reactions:e,children:t})=>{if(e.length===0)return r.jsx(r.Fragment,{children:t});const n={};return e.forEach(s=>{n[s.reaction_type]||(n[s.reaction_type]=[]),n[s.reaction_type].push(s)}),r.jsxs(ryt,{openDelay:200,closeDelay:100,children:[r.jsx(nyt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:t})}),r.jsx(yRe,{className:"w-64 p-3 bg-popover border shadow-lg z-50",side:"top",align:"start",children:r.jsx("div",{className:"space-y-3",children:Object.entries(n).map(([s,i])=>{const o=syt.find(l=>l.type===s);return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("span",{className:"text-lg",children:o==null?void 0:o.emoji}),r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[o==null?void 0:o.label," (",i.length,")"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[i.slice(0,10).map(l=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ci,{className:"h-6 w-6",children:[r.jsx(Ga,{src:l.user_avatar||void 0}),r.jsx(di,{className:"text-[10px]",children:iyt(l.user_name||"U")})]}),r.jsx("span",{className:"text-sm text-foreground truncate",children:l.user_name||"Unknown User"})]},l.id)),i.length>10&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",i.length-10," more"]})]})]},s)})})})]})};function ayt({images:e,initialIndex:t=0,open:n,onOpenChange:s}){const[i,o]=I.useState(t),[l,a]=I.useState(!1);I.useEffect(()=>{n&&(o(t),a(!1))},[n,t]);const h=()=>{o(b=>b>0?b-1:e.length-1),a(!1)},p=()=>{o(b=>b{n&&(b.key==="ArrowLeft"&&h(),b.key==="ArrowRight"&&p(),b.key==="Escape"&&s(!1))},[n,e.length]);I.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const y=e[i];return r.jsx(Br,{open:n,onOpenChange:s,children:r.jsxs(Fr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>s(!1),children:r.jsx(bs,{className:"h-6 w-6"})}),e.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:h,children:r.jsx(qc,{className:"h-8 w-8"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:p,children:r.jsx(Ka,{className:"h-8 w-8"})})]}),e.length>1&&r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 text-white text-sm bg-black/50 px-3 py-1 rounded-full",children:[i+1," / ",e.length]}),(y==null?void 0:y.type)==="image"&&r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute top-2 left-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>a(!l),children:l?r.jsx(yS,{className:"h-5 w-5"}):r.jsx(xS,{className:"h-5 w-5"})}),r.jsx("div",{className:$t("flex items-center justify-center w-full h-full min-h-[50vh] p-4",l?"cursor-zoom-out overflow-auto":"cursor-zoom-in"),onClick:()=>(y==null?void 0:y.type)==="image"&&a(!l),children:(y==null?void 0:y.type)==="video"?r.jsx("video",{src:y.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-[85vh] object-contain",onClick:b=>b.stopPropagation()}):r.jsx("img",{src:y==null?void 0:y.url,alt:"",className:$t("object-contain transition-transform duration-200",l?"max-w-none max-h-none scale-150":"max-w-full max-h-[85vh]")})}),e.length>1&&r.jsx("div",{className:"absolute bottom-12 left-1/2 -translate-x-1/2 z-50 flex gap-2 bg-black/50 p-2 rounded-lg max-w-[90vw] overflow-x-auto",children:e.map((b,j)=>r.jsx("button",{onClick:()=>{o(j),a(!1)},className:$t("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",i===j?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:b.type==="video"?r.jsx("video",{src:b.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:b.url,alt:"",className:"w-full h-full object-cover"})},j))})]})})}const NL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],oyt=({commentId:e,reactions:t,currentUserId:n})=>{var p,x;const s=Wr(),[i,o]=I.useState(!1),l=t.find(y=>y.user_id===n),a=cr({mutationFn:async y=>{l?l.reaction_type===y?await J.from("community_comment_reactions").delete().eq("id",l.id):await J.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await J.from("community_comment_reactions").insert({comment_id:e,user_id:n,reaction_type:y})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),h={};return t.forEach(y=>{h[y.reaction_type]=(h[y.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>0&&r.jsx(vRe,{reactions:t,children:r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("div",{className:"flex -space-x-0.5",children:Object.keys(h).slice(0,2).map(y=>{var b;return r.jsx("span",{className:"text-sm",children:(b=NL.find(j=>j.type===y))==null?void 0:b.emoji},y)})}),r.jsx("span",{children:t.length})]})}),n&&r.jsxs(Du,{open:i,onOpenChange:o,children:[r.jsx(Ru,{asChild:!0,children:r.jsx("button",{className:`text-xs hover:text-primary transition-colors ${l?"text-primary font-medium":"text-muted-foreground"}`,children:l?r.jsxs("span",{children:[(p=NL.find(y=>y.type===l.reaction_type))==null?void 0:p.emoji," ",(x=NL.find(y=>y.type===l.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(nu,{className:"w-auto p-1.5 bg-popover border shadow-lg z-50",side:"top",children:r.jsx("div",{className:"flex gap-0.5",children:NL.map(y=>r.jsx("button",{onClick:()=>a.mutate(y.type),className:"text-xl hover:scale-125 transition-transform p-1",title:y.label,children:y.emoji},y.type))})})]})]})};function $xe({content:e,className:t}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,s=[];let i=0,o,l=0;for(;(o=n.exec(e))!==null;){if(o.index>i&&s.push(e.substring(i,o.index)),o[1]){const a=o[1],h=o[2],p=o[3],x=a==="#";s.push(r.jsx(uo,{to:x?`/templates/${p}`:`/profile?user=${p}`,className:$t("font-medium hover:underline",x?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:y=>y.stopPropagation(),children:x?h:`@${h}`},`mention-${l++}`))}else if(o[4]){const a=o[4],h=a.replace(/[.,;:!?)]+$/,""),p=a.slice(h.length);let x;try{const y=new URL(h);x=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{x=h.length>40?h.slice(0,40)+"...":h}s.push(r.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:y=>y.stopPropagation(),children:x},`url-${l++}`)),p&&s.push(p)}i=o.index+o[0].length}return ir.jsx(I.Fragment,{children:a},h))})}function Nte({value:e,onChange:t,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:i="80px",onMentionsChange:o,onTemplatesChange:l,onKeyDown:a,mentionFormat:h="encoded",enableTemplateMentions:p=!1}){const x=I.useRef(null),y=I.useRef(null),[b,j]=I.useState(!1),[N,C]=I.useState("user"),[A,E]=I.useState(""),[T,L]=I.useState(null),[z,F]=I.useState(0),[q,H]=I.useState({top:0,left:0,width:0}),K=I.useRef(new Map),Z=I.useRef(new Map),te=we=>{if(h==="plain"){const Oe=[];return K.current.forEach((Ve,Fe)=>{we.includes(`@${Fe}`)&&Oe.push(Ve)}),[...new Set(Oe)]}const he=/@\[([^\]]+)\]\(([^)]+)\)/g,xe=[];let be;for(;(be=he.exec(we))!==null;)xe.push(be[2]);return[...new Set(xe)]},ae=we=>{if(h==="plain"){const Oe=[];return Z.current.forEach((Ve,Fe)=>{we.includes(`#${Fe}`)&&Oe.push(Ve)}),[...new Set(Oe)]}const he=/#\[([^\]]+)\]\(([^)]+)\)/g,xe=[];let be;for(;(be=he.exec(we))!==null;)xe.push(be[2]);return[...new Set(xe)]};I.useEffect(()=>{if(o){const we=te(e);o(we)}if(l){const we=ae(e);l(we)}},[e,o,l,h]);const{data:le=[],isLoading:ve}=Zt({queryKey:["mention-users",A],queryFn:async()=>{const we=J.from("profiles").select("id, name").limit(8),he=A.length>=1?we.ilike("name",`%${A}%`):we.order("name"),{data:xe,error:be}=await he;if(be)throw be;const Oe=xe.map(Ve=>Ve.id),Te=await R6e(Oe);return xe.map(Ve=>({id:Ve.id,name:Ve.name||"Unknown",avatar_url:Te.get(Ve.id)}))},enabled:b&&N==="user",staleTime:3e4}),{data:ne=[],isLoading:ge}=Zt({queryKey:["mention-templates",A],queryFn:async()=>{let we=J.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);A.length>=1&&(we=we.ilike("name",`%${A}%`));const{data:he,error:xe}=await we;if(xe)throw xe;return he||[]},enabled:b&&N==="template"&&p,staleTime:3e4}),ie=N==="user"?ve:ge,fe=N==="user"?le:ne,de=we=>we.split(" ").map(he=>he[0]).join("").toUpperCase().slice(0,2),ye=we=>{const he=we.target.value,xe=we.target.selectionStart;t(he);const be=he.substring(0,xe),Oe=be.lastIndexOf("@"),Te=p?be.lastIndexOf("#"):-1;let Ve=-1,Fe="user";if(Oe>Te?(Ve=Oe,Fe="user"):Te>Oe&&p&&(Ve=Te,Fe="template"),Ve!==-1){const Me=be.substring(Ve+1),Qe=Me.includes(" "),Ee=Me.includes(` `);if(!Qe&&!Ee&&Me.length<=30){L(Ve),E(Me),C(Fe),j(!0),F(0);return}}j(!1),L(null)},Ie=we=>{if(T===null)return;const he=e.substring(0,T),xe=e.substring(T+A.length+1),be=N==="user"?"@":"#",Oe=h==="plain"?`${be}${we.name} `:`${be}[${we.name}](${we.id}) `;h==="plain"&&(N==="user"?K.current.set(we.name,we.id):Z.current.set(we.name,we.id));const Te=he+Oe+xe;t(Te),j(!1),L(null),E(""),setTimeout(()=>{if(x.current){const Ve=he.length+Oe.length;x.current.focus(),x.current.setSelectionRange(Ve,Ve)}},0)},Ne=we=>{if(!(!b||fe.length===0))switch(we.key){case"ArrowDown":we.preventDefault(),F(he=>(he+1)%fe.length);break;case"ArrowUp":we.preventDefault(),F(he=>(he-1+fe.length)%fe.length);break;case"Enter":fe[z]&&(we.preventDefault(),Ie(fe[z]));break;case"Escape":we.preventDefault(),j(!1);break;case"Tab":fe[z]&&(we.preventDefault(),Ie(fe[z]));break}};return I.useEffect(()=>{const we=he=>{y.current&&!y.current.contains(he.target)&&x.current&&!x.current.contains(he.target)&&j(!1)};return document.addEventListener("mousedown",we),()=>document.removeEventListener("mousedown",we)},[]),I.useEffect(()=>{if(!b)return;const we=()=>{const he=x.current;if(!he)return;const xe=he.getBoundingClientRect();H({top:xe.bottom+4,left:xe.left,width:xe.width})};return we(),window.addEventListener("resize",we),window.addEventListener("scroll",we,!0),()=>{window.removeEventListener("resize",we),window.removeEventListener("scroll",we,!0)}},[b,e]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ps,{ref:x,value:e,onChange:ye,onKeyDown:we=>{Ne(we),we.defaultPrevented||a==null||a(we)},placeholder:n,className:$t("resize-none",s),style:{minHeight:i}}),b&&py.createPortal(r.jsxs("div",{ref:y,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:q.top,left:q.left,width:q.width,maxWidth:"320px"},children:[r.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:N==="user"?"👤 Mention a person":"📋 Link a template"}),ie?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):fe.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:A.length<1?`Type to search ${N==="user"?"people":"templates"}...`:`No ${N==="user"?"users":"templates"} found`}):r.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:fe.map((we,he)=>r.jsx("li",{className:$t("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",he===z?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ie(we),onMouseEnter:()=>F(he),children:N==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(ci,{className:"h-6 w-6",children:[r.jsx(Ga,{src:we.avatar_url}),r.jsx(di,{className:"text-xs",children:de(we.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:we.name})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center overflow-hidden flex-shrink-0",children:we.preview_image_url?r.jsx("img",{src:we.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(hd,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:we.name})]})},we.id))})]}),document.body)]})}function lyt(e){const t=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=t.exec(e))!==null;)n.push(s[2]);return[...new Set(n)]}const Oke=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);function _Re({comment:e,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:l=0}){const a=Wr(),[h,p]=I.useState(!1),[x,y]=I.useState(""),[b,j]=I.useState([]),N=cr({mutationFn:async({content:T,parentCommentId:L})=>{const{data:z,error:F}=await J.from("community_comments").insert({post_id:t,user_id:n,content:T,parent_comment_id:L}).select("id").single();if(F)throw F;const q=b;if(q.length>0&&z){const H=q.filter(K=>K!==n).map(K=>({comment_id:z.id,mentioned_user_id:K,mentioned_by_user_id:n}));H.length>0&&await J.from("community_comment_mentions").insert(H)}},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),y(""),j([]),p(!1)}}),C=cr({mutationFn:async T=>{const{error:L}=await J.from("community_comments").delete().eq("id",T);if(L)throw L},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),A=()=>{x.trim()&&N.mutate({content:x,parentCommentId:e.id})};return r.jsxs("div",{className:l>0?"ml-8 border-l-2 border-muted pl-3":"",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ci,{className:"h-8 w-8 shrink-0",children:[r.jsx(Ga,{src:e.user_avatar||void 0}),r.jsx(di,{className:"text-xs",children:Oke(e.user_name||"U")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"bg-muted rounded-lg px-3 py-2",children:[r.jsx("div",{className:"font-medium text-sm",children:e.user_name}),r.jsx($xe,{content:e.content,className:"text-sm break-words"})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground flex-wrap",children:[r.jsx("span",{children:tu(new Date(e.created_at),{addSuffix:!0})}),r.jsx(oyt,{commentId:e.id,reactions:e.reactions,currentUserId:n}),n&&l<2&&r.jsxs("button",{onClick:()=>p(!h),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(WT,{className:"h-3 w-3"}),"Reply"]}),(e.user_id===n||o)&&r.jsx("button",{onClick:()=>C.mutate(e.id),className:"hover:text-destructive",children:e.user_id!==n?"Remove":"Delete"})]}),h&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(ci,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Ga,{src:s||void 0}),r.jsx(di,{className:"text-xs",children:Oke((i==null?void 0:i.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(Nte,{placeholder:`Reply to ${e.user_name}...`,value:x,onChange:y,onMentionsChange:j,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:A,disabled:!x.trim()||N.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(Lo,{className:"h-3 w-3"})})]})]})]})]}),e.replies&&e.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:e.replies.map(T=>r.jsx(_Re,{comment:T,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:i,canModerate:o,depth:l+1},T.id))})]})}const SL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"},{type:"laugh",emoji:"😂",label:"Haha"},{type:"wow",emoji:"😮",label:"Wow"},{type:"sad",emoji:"😢",label:"Sad"},{type:"angry",emoji:"😠",label:"Angry"}],cyt=()=>{const{user:e,isBrokerageManager:t,managedBrokerages:n,isAdmin:s}=zr(),{avatarUrl:i}=Pge(e==null?void 0:e.id),{onlineUsers:o}=uOe(),{toast:l}=pa(),a=Wr(),h=I.useRef(null),[p,x]=I.useState("all"),[y,b]=I.useState(""),[j,N]=I.useState(""),[C,A]=I.useState(""),[E,T]=I.useState([]),[L,z]=I.useState([]),[F,q]=I.useState(""),[H,K]=I.useState(!1),[Z,te]=I.useState(null),[ae,le]=I.useState(""),[ve,ne]=I.useState(new Set),[ge,ie]=I.useState({}),[fe,de]=I.useState({}),[ye,Ie]=I.useState([]),[Ne,we]=I.useState([]),[he,xe]=I.useState({open:!1,images:[],index:0});I.useEffect(()=>{if(p.startsWith("group:")){const vt=p.replace("group:","");A(vt),N("")}else p!=="all"?(N(p),A("")):(N(""),A(""))},[p]);const{data:be=[]}=Zt({queryKey:["community-categories"],queryFn:async()=>{const{data:vt,error:rr}=await J.from("community_categories").select("*").order("sort_order");if(rr)throw rr;return vt}}),{data:Oe=[]}=Zt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:vt,error:rr}=await J.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(rr)throw rr;return vt}}),Te=20,{data:Ve,isLoading:Fe,hasNextPage:Me,fetchNextPage:Qe,isFetchingNextPage:Ee}=sJe({queryKey:["community-posts",p],initialPageParam:0,queryFn:async({pageParam:vt})=>{var Re;const rr=vt*Te,Ar=rr+Te;let yn=J.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(rr,Ar);if(p.startsWith("group:")){const Ke=p.replace("group:","");yn=yn.eq("private_group_id",Ke)}else p==="all"||(yn=yn.eq("category_id",p).is("private_group_id",null));const{data:kn,error:Jr}=await yn;if(Jr)throw Jr;const zn=((kn==null?void 0:kn.length)||0)>Te,ks=(kn||[]).slice(0,Te);if(ks.length===0)return{posts:[],hasMore:!1,nextPage:vt+1};const fr=ks.map(Ke=>Ke.id),xs=[...new Set(ks.filter(Ke=>Ke.category_id).map(Ke=>Ke.category_id))].filter(Boolean),[ji,mi,La,da,tl]=await Promise.all([xs.length?J.from("community_categories").select("*").in("id",xs):Promise.resolve({data:[]}),J.from("community_post_media").select("*").in("post_id",fr).order("sort_order"),J.from("community_reactions").select("*").in("post_id",fr),J.from("community_comments").select("*").in("post_id",fr).order("created_at",{ascending:!0}),J.from("community_post_resources").select("*").in("post_id",fr)]),rl=ji==null?void 0:ji.data,Gs=mi==null?void 0:mi.data,Zi=La==null?void 0:La.data,Ns=da==null?void 0:da.data,Ei=tl==null?void 0:tl.data,Ii=(Ns||[]).map(Ke=>Ke.id),[Oo,ir]=await Promise.all([Ii.length?J.from("community_comment_reactions").select("*").in("comment_id",Ii):Promise.resolve({data:[]}),(()=>{const Ke=(Ei||[]).filter(bt=>bt.resource_type==="template").map(bt=>bt.resource_id);return Ke.length===0?Promise.resolve({data:[]}):J.from("canva_templates").select("id, name, preview_image_url").in("id",Ke)})()]),xo=(Oo==null?void 0:Oo.data)||[],Tc=(ir==null?void 0:ir.data)||[],yo=new Map(Tc.map(Ke=>[Ke.id,{name:Ke.name,preview_image_url:Ke.preview_image_url}])),ss=Array.from(new Set([...ks.map(Ke=>Ke.user_id),...(Zi||[]).map(Ke=>Ke.user_id),...(Ns||[]).map(Ke=>Ke.user_id),...xo.map(Ke=>Ke.user_id)])),[vo,Bd]=await Promise.all([ss.length?J.from("profiles").select("id, name").in("id",ss):Promise.resolve({data:[]}),R6e(ss)]),_r=new Map(((Re=vo==null?void 0:vo.data)==null?void 0:Re.map(Ke=>[Ke.id,Ke.name]))||[]),Hn=new Map((rl||[]).map(Ke=>[Ke.id,Ke])),kt=Ke=>{const bt=new Map,yt=[];return Ke.forEach(At=>{bt.set(At.id,{...At,user_name:_r.get(At.user_id)||"Unknown User",user_avatar:Bd.get(At.user_id),reactions:xo.filter(Bt=>Bt.comment_id===At.id).map(Bt=>({...Bt,user_name:_r.get(Bt.user_id)||"Unknown User",user_avatar:Bd.get(Bt.user_id)})),replies:[]})}),Ke.forEach(At=>{const Bt=bt.get(At.id);if(At.parent_comment_id&&bt.has(At.parent_comment_id)){const Lt=bt.get(At.parent_comment_id);Lt.replies=Lt.replies||[],Lt.replies.push(Bt)}else yt.push(Bt)}),yt};return{posts:ks.map(Ke=>{const bt=(Ei||[]).filter(yt=>yt.post_id===Ke.id).map(yt=>{let At="",Bt=null;if(yt.resource_type==="template"){const Lt=yo.get(yt.resource_id);At=(Lt==null?void 0:Lt.name)||"Unknown Template",Bt=(Lt==null?void 0:Lt.preview_image_url)||null}return{id:yt.id,resource_type:yt.resource_type,resource_id:yt.resource_id,resource_name:At,resource_preview_url:Bt}});return{...Ke,user_name:_r.get(Ke.user_id)||"Unknown User",user_avatar:Bd.get(Ke.user_id),category:Ke.category_id?Hn.get(Ke.category_id):null,media:(Gs||[]).filter(yt=>yt.post_id===Ke.id),reactions:((Zi||[]).filter(yt=>yt.post_id===Ke.id)||[]).map(yt=>({...yt,user_name:_r.get(yt.user_id)||"Unknown User",user_avatar:Bd.get(yt.user_id)})),comments:kt((Ns||[]).filter(yt=>yt.post_id===Ke.id)),resources:bt}}),hasMore:zn,nextPage:vt+1}},getNextPageParam:vt=>vt.hasMore?vt.nextPage:void 0}),Ye=I.useMemo(()=>(Ve==null?void 0:Ve.pages.flatMap(vt=>vt.posts))??[],[Ve]),me=cr({mutationFn:async()=>{K(!0);const{data:vt,error:rr}=await J.from("community_posts").insert({user_id:e.id,category_id:C?null:j||null,private_group_id:C||null,content:y,link_url:F||null}).select().single();if(rr)throw rr;for(let yn=0;yn0){const yn=ye.filter(kn=>kn!==e.id).map(kn=>({post_id:vt.id,mentioned_user_id:kn,mentioned_by_user_id:e.id}));yn.length>0&&await J.from("community_post_mentions").insert(yn)}const Ar=lyt(y);if(Ar.length>0){const yn=Ar.map(kn=>({post_id:vt.id,resource_type:"template",resource_id:kn}));await J.from("community_post_resources").insert(yn)}return vt},onSuccess:async vt=>{var rr;a.invalidateQueries({queryKey:["community-posts"]}),b(""),Ie([]),we([]),N(""),A(""),T([]),z([]),q(""),l({title:"Post created!"});try{const Ar=((rr=e==null?void 0:e.user_metadata)==null?void 0:rr.name)||"Someone",yn=y.length>50?y.substring(0,50)+"...":y;await J.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Ar}: ${yn}`,url:"/community"}})}catch(Ar){console.error("Failed to send push notification:",Ar)}},onError:vt=>{l({title:"Error creating post",description:vt.message,variant:"destructive"})},onSettled:()=>K(!1)}),mt=cr({mutationFn:async({postId:vt,content:rr})=>{const{error:Ar}=await J.from("community_posts").update({content:rr}).eq("id",vt);if(Ar)throw Ar},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),te(null),le(""),l({title:"Post updated!"})}}),et=cr({mutationFn:async vt=>{const{error:rr}=await J.from("community_posts").delete().eq("id",vt);if(rr)throw rr},onSuccess:()=>{a.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),nt=cr({mutationFn:async({postId:vt,isPinned:rr})=>{const{error:Ar}=await J.from("community_posts").update({is_pinned:!rr,pinned_at:rr?null:new Date().toISOString(),pinned_by:rr?null:e==null?void 0:e.id}).eq("id",vt);if(Ar)throw Ar},onSuccess:(vt,{isPinned:rr})=>{a.invalidateQueries({queryKey:["community-posts"]}),l({title:rr?"Post unpinned":"Post pinned to top"})}}),Ae=cr({mutationFn:async({postId:vt,reactionType:rr})=>{var yn;const Ar=(yn=Ye.find(kn=>kn.id===vt))==null?void 0:yn.reactions.find(kn=>kn.user_id===(e==null?void 0:e.id));Ar?Ar.reaction_type===rr?await J.from("community_reactions").delete().eq("id",Ar.id):await J.from("community_reactions").update({reaction_type:rr}).eq("id",Ar.id):await J.from("community_reactions").insert({post_id:vt,user_id:e.id,reaction_type:rr})},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})}),ht=cr({mutationFn:async({postId:vt,content:rr})=>{const{data:Ar,error:yn}=await J.from("community_comments").insert({post_id:vt,user_id:e.id,content:rr}).select("id").single();if(yn)throw yn;const kn=fe[vt]||[];if(kn.length>0&&Ar){const Jr=kn.filter(zn=>zn!==e.id).map(zn=>({comment_id:Ar.id,mentioned_user_id:zn,mentioned_by_user_id:e.id}));Jr.length>0&&await J.from("community_comment_mentions").insert(Jr)}},onSuccess:(vt,{postId:rr})=>{a.invalidateQueries({queryKey:["community-posts"]}),ie(Ar=>({...Ar,[rr]:""})),de(Ar=>({...Ar,[rr]:[]}))}});cr({mutationFn:async vt=>{const{error:rr}=await J.from("community_comments").delete().eq("id",vt);if(rr)throw rr},onSuccess:()=>a.invalidateQueries({queryKey:["community-posts"]})});const $e=vt=>{const rr=Array.from(vt.target.files||[]);if(rr.length+E.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}T(Ar=>[...Ar,...rr]),rr.forEach(Ar=>{const yn=new FileReader;yn.onloadend=()=>{z(kn=>[...kn,yn.result])},yn.readAsDataURL(Ar)})},Je=vt=>{T(rr=>rr.filter((Ar,yn)=>yn!==vt)),z(rr=>rr.filter((Ar,yn)=>yn!==vt))},tt=vt=>vt.split(" ").map(rr=>rr[0]).join("").toUpperCase().slice(0,2),ft=vt=>{const rr={};return vt.forEach(Ar=>{rr[Ar.reaction_type]=(rr[Ar.reaction_type]||0)+1}),rr},jt=vt=>{var rr;return(rr=vt.find(Ar=>Ar.user_id===(e==null?void 0:e.id)))==null?void 0:rr.reaction_type},Nt=vt=>vt.reduce((rr,Ar)=>rr+1+(Ar.replies?Nt(Ar.replies):0),0),Et=vt=>{if(s)return!0;if(!t||!vt.private_group_id)return!1;const rr=Oe.find(Ar=>Ar.id===vt.private_group_id);return rr!=null&&rr.brokerage_id?n.some(Ar=>Ar.id===rr.brokerage_id):!1};return r.jsx(Or,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(Hxt,{categories:be,privateGroups:Oe,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsxs("div",{className:"flex-1 min-w-0 max-w-2xl mx-auto lg:mx-0 space-y-6",children:[r.jsxs("div",{className:"px-1",children:[r.jsx("h1",{className:"text-4xl lg:text-5xl font-bold text-foreground",children:"Community"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Connect and share with fellow agents"})]}),r.jsx(Wxt,{categories:be,privateGroups:Oe,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:i||void 0}),r.jsx(di,{children:e!=null&&e.email?tt(e.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(Nte,{placeholder:s?"What's on your mind? Use @ to mention someone, # to link a template":"What's on your mind? Use @ to mention someone",value:y,onChange:b,onMentionsChange:Ie,onTemplatesChange:we,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),L.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:L.map((vt,rr)=>{var Ar;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Ar=E[rr])!=null&&Ar.type.startsWith("video/")?r.jsx("video",{src:vt,className:"w-full h-full object-cover"}):r.jsx("img",{src:vt,alt:"",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Je(rr),children:r.jsx(bs,{className:"h-3 w-3"})})]},rr)})}),F&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(at,{value:F,onChange:vt=>q(vt.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>q(""),children:r.jsx(bs,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[r.jsx("input",{type:"file",ref:h,onChange:$e,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var vt;return(vt=h.current)==null?void 0:vt.click()},children:[r.jsx(Do,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var vt;return(vt=h.current)==null?void 0:vt.click()},children:[r.jsx(Fi,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>q("https://"),children:[r.jsx(So,{className:"h-4 w-4 mr-1"}),"Link"]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[Oe.length>0?r.jsxs(vn,{value:C||j||"none",onValueChange:vt=>{vt==="none"?(N(""),A("")):vt.startsWith("group:")?(A(vt.replace("group:","")),N("")):(N(vt),A(""))},children:[r.jsx(mn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(_n,{placeholder:"Select..."})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"No category"}),be.map(vt=>r.jsxs(Ht,{value:vt.id,children:[vt.icon," ",vt.name]},vt.id)),Oe.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground border-t mt-1 pt-1",children:"🔒 Private Groups"}),Oe.map(vt=>r.jsxs(Ht,{value:`group:${vt.id}`,children:[vt.icon||"🔒"," ",vt.name]},vt.id))]})]})]}):r.jsxs(vn,{value:j,onValueChange:N,children:[r.jsx(mn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(_n,{placeholder:"Category"})}),r.jsx(gn,{children:be.map(vt=>r.jsxs(Ht,{value:vt.id,children:[vt.icon," ",vt.name]},vt.id))})]}),r.jsxs(ee,{size:"sm",onClick:()=>me.mutate(),disabled:!y.trim()||H,children:[r.jsx(Lo,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Fe?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((vt,rr)=>r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Pr,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Pr,{className:"h-4 w-32"}),r.jsx(Pr,{className:"h-4 w-full"}),r.jsx(Pr,{className:"h-4 w-3/4"})]})]})})},rr))}):Ye.length===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No posts yet"}),r.jsx("p",{className:"text-muted-foreground",children:"Be the first to start a conversation!"})]})}):r.jsxs("div",{className:"space-y-4",children:[Ye.map(vt=>{var rr,Ar,yn,kn;return r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex gap-3 min-w-0",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:vt.user_avatar||void 0}),r.jsx(di,{children:tt(vt.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:vt.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:tu(new Date(vt.created_at),{addSuffix:!0})}),vt.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:[vt.category.icon," ",vt.category.name]})]})]})]})]}),(vt.user_id===(e==null?void 0:e.id)||Et(vt))&&r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(lg,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",children:[Et(vt)&&vt.private_group_id&&r.jsx(mo,{onClick:()=>nt.mutate({postId:vt.id,isPinned:vt.is_pinned}),children:vt.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(UT,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(v1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),vt.user_id===(e==null?void 0:e.id)&&r.jsxs(mo,{onClick:()=>{te(vt),le(vt.content)},children:[r.jsx(ha,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(mo,{className:"text-destructive",onClick:()=>et.mutate(vt.id),children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),vt.user_id!==(e==null?void 0:e.id)?"Remove (Moderate)":"Delete"]})]})]})]}),vt.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(v1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx($xe,{content:vt.content})}),vt.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${vt.media.length===1?"grid-cols-1":vt.media.length===2?"grid-cols-2":vt.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:vt.media.slice(0,4).map((Jr,zn)=>{const ks=zn===3&&vt.media.length>4,fr=vt.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${vt.media.length===1?"max-h-[500px]":vt.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>xe({open:!0,images:vt.media.map(xs=>({url:xs.media_url,type:xs.media_type==="video"?"video":"image"})),index:zn}),children:[Jr.media_type==="video"?r.jsx("video",{src:Jr.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:Jr.media_url,alt:"",className:"w-full h-full object-cover transition-transform group-hover:scale-105"}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-white",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-8 w-8",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7"})})})}),ks&&r.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:r.jsxs("span",{className:"text-white text-2xl font-bold",children:["+",fr]})})]},Jr.id)})}),vt.link_url&&r.jsxs("a",{href:vt.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[vt.link_image&&r.jsx("div",{className:"aspect-video bg-muted",children:r.jsx("img",{src:vt.link_image,alt:vt.link_title||"Link preview",className:"w-full h-full object-cover",onError:Jr=>{Jr.currentTarget.style.display="none"}})}),r.jsx("div",{className:"p-3",children:vt.link_title?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:vt.link_title}),vt.link_description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:vt.link_description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(vt.link_url).hostname})]}):r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(So,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:vt.link_url})]})})]}),vt.reactions.length>0&&r.jsx(vRe,{reactions:vt.reactions,children:r.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[r.jsx("div",{className:"flex -space-x-1",children:Object.entries(ft(vt.reactions)).slice(0,3).map(([Jr])=>{var zn;return r.jsx("span",{className:"text-base",children:(zn=SL.find(ks=>ks.type===Jr))==null?void 0:zn.emoji},Jr)})}),r.jsx("span",{children:vt.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"flex-1",children:[jt(vt.reactions)?r.jsx("span",{className:"mr-1",children:(rr=SL.find(Jr=>Jr.type===jt(vt.reactions)))==null?void 0:rr.emoji}):r.jsx(pd,{className:"h-4 w-4 mr-1"}),jt(vt.reactions)?(Ar=SL.find(Jr=>Jr.type===jt(vt.reactions)))==null?void 0:Ar.label:"Like"]})}),r.jsx(nu,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:SL.map(Jr=>r.jsx("button",{onClick:()=>Ae.mutate({postId:vt.id,reactionType:Jr.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:Jr.label,children:Jr.emoji},Jr.type))})})]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ne(Jr=>{const zn=new Set(Jr);return zn.has(vt.id)?zn.delete(vt.id):zn.add(vt.id),zn}),children:[r.jsx(Ol,{className:"h-4 w-4 mr-1"}),(()=>{const Jr=Nt(vt.comments);return Jr>0?`Comment (${Jr})`:"Comment"})()]})]}),ve.has(vt.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[vt.comments.map(Jr=>r.jsx(_Re,{comment:Jr,postId:vt.id,currentUserId:e==null?void 0:e.id,currentUserAvatar:i,currentUserEmail:e==null?void 0:e.email,canModerate:Et(vt)},Jr.id)),e&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Ga,{src:i||void 0}),r.jsx(di,{className:"text-xs",children:tt(((yn=e.email)==null?void 0:yn.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(Nte,{placeholder:"Write a comment... (use @ to mention)",value:ge[vt.id]||"",onChange:Jr=>ie(zn=>({...zn,[vt.id]:Jr})),onMentionsChange:Jr=>de(zn=>({...zn,[vt.id]:Jr})),mentionFormat:"plain",onKeyDown:Jr=>{var zn;Jr.defaultPrevented||Jr.key==="Enter"&&!Jr.shiftKey&&((zn=ge[vt.id])!=null&&zn.trim())&&(Jr.preventDefault(),ht.mutate({postId:vt.id,content:ge[vt.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{var Jr;(Jr=ge[vt.id])!=null&&Jr.trim()&&ht.mutate({postId:vt.id,content:ge[vt.id]})},disabled:!((kn=ge[vt.id])!=null&&kn.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(Lo,{className:"h-4 w-4"})})]})]})]})]})},vt.id)}),Me&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(ee,{variant:"outline",onClick:()=>Qe(),disabled:Ee,children:Ee?"Loading…":"Load more posts"})})]}),r.jsx(Br,{open:!!Z,onOpenChange:()=>te(null),children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Edit Post"})}),r.jsx(ps,{value:ae,onChange:vt=>le(vt.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>te(null),children:"Cancel"}),r.jsx(ee,{onClick:()=>{Z&&mt.mutate({postId:Z.id,content:ae})},disabled:!ae.trim(),children:"Save Changes"})]})]})}),r.jsx(ayt,{images:he.images,initialIndex:he.index,open:he.open,onOpenChange:vt=>xe(rr=>({...rr,open:vt}))})]})]})})},l4={open:{label:"Open",icon:Ki,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ol,color:"bg-blue-500"},resolved:{label:"Resolved",icon:qa,color:"bg-green-500"},closed:{label:"Closed",icon:zc,color:"bg-muted-foreground"}},Dke={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function dyt(){const{user:e}=zr(),t=Wr(),[n,s]=I.useState(null),[i,o]=I.useState(""),{data:l=[],isLoading:a}=Zt({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:b}=await J.from("support_tickets").select("*").eq("user_id",e==null?void 0:e.id).order("created_at",{ascending:!1});if(b)throw b;return y},enabled:!!e}),{data:h=[]}=Zt({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:y,error:b}=await J.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(b)throw b;return y},enabled:!!n}),p=cr({mutationFn:async y=>{if(!n||!e)throw new Error("Missing data");const{error:b}=await J.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:y,is_admin_reply:!1});if(b)throw b},onSuccess:()=>{t.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),x=()=>{i.trim()&&p.mutate(i)};if(n){const y=l4[n.status].icon;return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Rt,{variant:"secondary",children:Dke[n.category]}),r.jsxs(Rt,{className:l4[n.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),l4[n.status].label]})]})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(En,{children:["Created on ",xn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Xe,{children:[r.jsx(Jo,{className:"h-[300px] pr-4",children:h.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:h.map(b=>{var j;return r.jsxs("div",{className:`p-4 rounded-lg ${b.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:b.is_admin_reply?"Support Team":((j=b.profiles)==null?void 0:j.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(b.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:b.content})]},b.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:i,onChange:b=>o(b.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:x,disabled:!i.trim()||p.isPending,className:"self-end",children:r.jsx(Lo,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(Xe,{className:"p-6 sm:p-8",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-6",children:[r.jsx("div",{className:"p-4 bg-primary/20 rounded-full",children:r.jsx(Cx,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Need Help?"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Submit a support ticket and our team will get back to you as soon as possible."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsx(bhe,{trigger:r.jsxs(ee,{size:"lg",className:"gap-2",children:[r.jsx(jn,{className:"h-5 w-5"}),"Submit a Ticket"]})}),r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted rounded-lg",children:[r.jsx(ca,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Or text us: ",r.jsx("span",{className:"font-semibold text-foreground",children:"1-866-527-8668"})]})]})]})]})]})})}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Your Tickets"}),r.jsx(bhe,{trigger:r.jsxs(ee,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"New Ticket"]})})]}),a?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):l.length===0?r.jsx(Ge,{className:"border-dashed",children:r.jsxs(Xe,{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets yet"}),r.jsx("p",{className:"text-muted-foreground",children:"You haven't submitted any support tickets. Use the button above to get started!"})]})}):r.jsx("div",{className:"space-y-3",children:l.map(y=>{const b=l4[y.status].icon;return r.jsx(Ge,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(y),children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:y.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Rt,{variant:"outline",className:"text-xs",children:Dke[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Rt,{className:l4[y.status].color,children:[r.jsx(b,{className:"h-3 w-3 mr-1"}),l4[y.status].label]})]})})},y.id)})})]})})}function uyt({open:e,onOpenChange:t}){return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(zs,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Schedule Agent Onboarding"}),r.jsx(es,{children:"Book a one-on-one onboarding session with LevelUp"})]})]})}),e&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/new-agent-onboarding",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Agent Onboarding"})]})})}function hyt({open:e,onOpenChange:t}){const{brokerageId:n}=zr(),[s,i]=I.useState(""),[o,l]=I.useState([]),[a,h]=I.useState(!1),{data:p,isLoading:x}=Zt({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:C,error:A}=await J.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(A)throw A;return C},enabled:e&&!!n}),y=p==null?void 0:p.filter(C=>C.name.toLowerCase().includes(s.toLowerCase())||C.email.toLowerCase().includes(s.toLowerCase())),b=C=>{l(A=>A.includes(C)?A.filter(E=>E!==C):[...A,C])},j=async()=>{if(o.length===0){ze.error("Please select at least one agent");return}h(!0);try{const{data:C,error:A}=await J.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(A)throw A;ze.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),t(!1)}catch(C){console.error("Error sending onboarding link:",C),ze.error(C.message||"Failed to send onboarding link")}finally{h(!1)}},N=C=>{C||(l([]),i("")),t(C)};return r.jsx(Br,{open:e,onOpenChange:N,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Lo,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Send Onboarding Link"}),r.jsx(es,{children:"Select agents to receive the onboarding booking link"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search agents...",value:s,onChange:C=>i(C.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(y==null?void 0:y.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Vn,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:r.jsx("div",{className:"p-2 space-y-1",children:y==null?void 0:y.map(C=>r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>b(C.id),children:[r.jsx(cc,{checked:o.includes(C.id),onCheckedChange:()=>b(C.id)}),r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"text-xs",children:C.name.split(" ").map(A=>A[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:C.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C.email})]})]},C.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),r.jsx(ee,{onClick:j,disabled:o.length===0||a,children:a?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function fyt(){const[e,t]=I.useState(!1),[n,s]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{className:"mb-8",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Vn,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Qt,{children:"Agent Onboarding"}),r.jsx(En,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(ee,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(ee,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(Lo,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(uyt,{open:e,onOpenChange:t}),r.jsx(hyt,{open:n,onOpenChange:s})]})}function pyt({open:e,onOpenChange:t}){return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(Hr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(wg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(qr,{children:"Schedule Launch Meeting"}),r.jsx(es,{children:"Book a private LevelUp information session for your brokerage"})]})]})}),e&&r.jsx("iframe",{src:"https://tidycal.com/jeremycollins/levelup-launch-call",className:"w-full border-0 rounded-lg",style:{height:"600px",minHeight:"500px"},title:"Schedule Launch Meeting"})]})})}function myt(){const[e,t]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{className:"mb-8",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(wg,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Qt,{children:"Launch or ReLaunch Meeting"}),r.jsx(En,{children:"Schedule a private LevelUp information session for your brokerage. Have one of our staff host a meeting to help your team get the most out of all our trainings, tools, and resources."})]})]})}),r.jsx(Xe,{children:r.jsxs(ee,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(wg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(pyt,{open:e,onOpenChange:t})]})}function gyt(){const e=ns(),[t,n]=I.useState(""),[s,i]=I.useState(null),{data:o,isLoading:l}=Zt({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:C,error:A}=await J.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(A)throw A;return C}}),{data:a}=Zt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:C,error:A}=await J.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(A)throw A;return C}}),{data:h}=Zt({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:C,error:A}=await J.from("brokerage_resource_pdfs").select("resource_id");if(A)throw A;return C}}),{data:p}=Zt({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:C,error:A}=await J.from("brokerage_resource_videos").select("resource_id");if(A)throw A;return C}}),{data:x}=Zt({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:C,error:A}=await J.from("brokerage_resource_links").select("resource_id");if(A)throw A;return C}}),y=o==null?void 0:o.filter(C=>{var T;const A=C.title.toLowerCase().includes(t.toLowerCase())||((T=C.description)==null?void 0:T.toLowerCase().includes(t.toLowerCase())),E=!s||C.category_id===s;return A&&E}),b=a==null?void 0:a.filter(C=>o==null?void 0:o.some(A=>A.category_id===C.id)),j=C=>{const A=(h==null?void 0:h.filter(L=>L.resource_id===C).length)||0,E=(p==null?void 0:p.filter(L=>L.resource_id===C).length)||0,T=(x==null?void 0:x.filter(L=>L.resource_id===C).length)||0;return{pdfCount:A,videoCount:E,linkCount:T}},N=C=>{e(`/brokerage-resources/${C}`)};return r.jsx(Or,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(fyt,{}),r.jsx(myt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search resources...",value:t,onChange:C=>n(C.target.value),className:"pl-10"})]}),b&&b.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Rt,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>i(null),children:"All"}),b.map(C=>r.jsx(Rt,{variant:s===C.id?"default":"outline",className:"cursor-pointer",onClick:()=>i(C.id),children:C.name},C.id))]}),!l&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(y==null?void 0:y.length)||0," resource",(y==null?void 0:y.length)!==1?"s":""," available"]}),l?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((C,A)=>r.jsxs(Ge,{children:[r.jsx(Pr,{className:"h-40 w-full"}),r.jsx(Gt,{children:r.jsx(Pr,{className:"h-5 w-3/4"})}),r.jsxs(Xe,{children:[r.jsx(Pr,{className:"h-4 w-full mb-2"}),r.jsx(Pr,{className:"h-4 w-2/3"})]})]},A))}):(y==null?void 0:y.length)===0?r.jsxs(Ge,{className:"p-12 text-center",children:[r.jsx(yh,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resources found"}),r.jsx("p",{className:"text-muted-foreground",children:t||s?"Try adjusting your filters":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:y==null?void 0:y.map(C=>{const{pdfCount:A,videoCount:E,linkCount:T}=j(C.id),L=a==null?void 0:a.find(z=>z.id===C.category_id);return r.jsxs(Ge,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>N(C.id),children:[C.preview_image_url?r.jsx("img",{src:C.preview_image_url,alt:C.title,className:"w-full h-40 object-cover"}):r.jsx("div",{className:"w-full h-40 bg-muted flex items-center justify-center",children:r.jsx(yh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Qt,{className:"text-lg line-clamp-1",children:C.title}),L&&r.jsx(Rt,{variant:"secondary",className:"shrink-0 text-xs",children:L.name})]})}),r.jsxs(Xe,{children:[C.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:C.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[A>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(wi,{className:"h-4 w-4"}),A]}),E>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fi,{className:"h-4 w-4"}),E]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(So,{className:"h-4 w-4"}),T]})]})]})]},C.id)})})]})})}const xyt=()=>{const{resourceId:e}=Wc(),{data:t,isLoading:n}=Zt({queryKey:["brokerage-resource-detail",e],queryFn:async()=>{const{data:i,error:o}=await J.from("brokerage_resources").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;const{data:l}=await J.from("brokerage_resource_pdfs").select("*").eq("resource_id",e).order("sort_order"),{data:a}=await J.from("brokerage_resource_videos").select("*").eq("resource_id",e).order("sort_order"),{data:h}=await J.from("brokerage_resource_links").select("*").eq("resource_id",e).order("sort_order");return{...i,pdfs:l||[],videos:a||[],links:h||[]}},enabled:!!e}),s=i=>i?i<1024?i+" B":i<1024*1024?(i/1024).toFixed(1)+" KB":(i/(1024*1024)).toFixed(1)+" MB":"";return n?r.jsx(Or,{title:"Brokerage Resources",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):t?r.jsx(Or,{title:t.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(uo,{to:"/brokerage-resources",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Resources"]})}),t.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:t.preview_image_url,alt:t.title,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:t.title}),t.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:t.description}})]}),t.videos&&t.videos.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fi,{className:"h-4 w-4"}),"Videos (",t.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:t.videos.map(i=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:i.title}),r.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:i.video_url,className:"absolute top-0 left-0 w-full h-full rounded-lg border",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})]},i.id))})]})}),t.pdfs&&t.pdfs.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(wi,{className:"h-4 w-4"}),"Documents (",t.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.pdfs.map(i=>r.jsxs("a",{href:i.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(wi,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:i.name}),i.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:s(i.file_size)})]})]}),r.jsx(Va,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})}),t.links&&t.links.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Canva Templates (",t.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.links.map(i=>r.jsxs("a",{href:i.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Fs,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:i.title})]}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},i.id))})]})})]})}):r.jsx(Or,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(yh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(uo,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function yyt(){const{onlineUsers:e,totalOnline:t}=uOe();return r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Qt,{className:"text-base flex items-center gap-2",children:[r.jsx(Vn,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Rt,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Lu,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),t," online"]})]})}),r.jsx(Xe,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No other users online right now"}):r.jsx(Jo,{className:"h-[300px] pr-4",children:r.jsx("div",{className:"space-y-3",children:e.map(n=>{var s;return r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(ci,{className:"h-9 w-9",children:[r.jsx(Ga,{src:n.avatarUrl,alt:n.name}),r.jsx(di,{className:"text-xs",children:(s=n.name)==null?void 0:s.split(" ").map(i=>i[0]).join("").slice(0,2).toUpperCase()})]}),r.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-green-500 ring-2 ring-background"})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:n.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Online ",tu(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const Rke={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:Vn,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:JT,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:fm,path:"/admin/subscriptions",color:"bg-gradient-to-br from-green-500/20 to-green-500/10 text-green-600"},{title:"Subscription Discounts",description:"Create and manage coupon codes",icon:Gx,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:uc,path:"/admin/referrals",color:"bg-teal-500/10 text-teal-600"}]},content:{label:"Content",sections:[{title:"Manage Templates",description:"Upload and organize Canva templates",icon:hd,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:f1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:Zx,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Cs,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Cs,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:Wx,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:hm,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:yh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:yh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:aS,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:Dh,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:Ys,path:"/admin/email-templates",color:"bg-sky-500/10 text-sky-600"},{title:"The LevelUp Brief",description:"Create popup briefs with videos, links, and polls",icon:gm,path:"/admin/levelup-brief",color:"bg-gradient-to-br from-primary/20 to-primary/10 text-primary"},{title:"Onboarding Checklist",description:"Manage getting started tasks for new users",icon:ET,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:kg,path:"/admin/marketplace",color:"bg-gradient-to-br from-orange-500/20 to-amber-500/10 text-orange-600"},{title:"Reward Store",description:"Manage reward items agents can redeem with points",icon:Ha,path:"/admin/reward-store",color:"bg-purple-500/10 text-purple-600"},{title:"Agent Points",description:"View agent points, leaderboard, and award bonus points",icon:Wa,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Facebook & Instagram for social posting",icon:Xh,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Agent Cards",description:"Manage digital business cards for agents",icon:Vn,path:"/admin/agent-cards",color:"bg-gradient-to-br from-violet-500/20 to-purple-500/10 text-violet-600"},{title:"Notification Settings",description:"Test and manage push notifications",icon:gm,path:"/admin/notification-settings",color:"bg-rose-500/10 text-rose-600"}]},community:{label:"Community & Support",sections:[{title:"Community Management",description:"Manage categories and private groups",icon:Po,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:lS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:g1,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:vs,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:Ys,path:"/admin/weekly-digest",color:"bg-indigo-500/10 text-indigo-600"}]},insights:{label:"Insights",sections:[{title:"Analytics",description:"View activity logs and platform statistics",icon:ac,path:"/admin/analytics",color:"bg-emerald-500/10 text-emerald-600"}]},"agent-os":{label:"Agent OS",sections:[{title:"Agent OS Control Center",description:"Manage InnerCircle feature: relationship types, action types, scripts, plans & feature flags",icon:oa,path:"/admin/agent-os",color:"bg-gradient-to-br from-rose-500/20 to-pink-500/10 text-rose-600"},{title:"Listing Exchange",description:"Approve, feature, and moderate community listings",icon:fi,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function vyt(){const e=ns();return r.jsx(Or,{title:"Admin Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Admin Dashboard"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage all aspects of your platform"})]}),r.jsx("div",{className:"w-full lg:w-80",children:r.jsx(yyt,{})})]}),r.jsxs(ba,{defaultValue:"users",className:"w-full",children:[r.jsx(fa,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(Rke).map(([t,n])=>r.jsx(ln,{value:t,className:"data-[state=active]:bg-background",children:n.label},t))}),Object.entries(Rke).map(([t,n])=>r.jsx(An,{value:t,className:"mt-6",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.sections.map(s=>r.jsxs(Ge,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>e(s.path),children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(s.icon,{className:"h-5 w-5"})}),r.jsx(Qt,{className:"text-base",children:s.title})]}),r.jsx(Xe,{className:"pt-0",children:r.jsx(En,{className:"text-sm",children:s.description})})]},s.path))})},t))]})]})})}const Vs=I.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:$t("w-full caption-bottom text-sm",e),...t})}));Vs.displayName="Table";const Hs=I.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:$t("[&_tr]:border-b",e),...t}));Hs.displayName="TableHeader";const Ws=I.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:$t("[&_tr:last-child]:border-0",e),...t}));Ws.displayName="TableBody";const _yt=I.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:$t("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));_yt.displayName="TableFooter";const Ir=I.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:$t("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Ir.displayName="TableRow";const It=I.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:$t("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));It.displayName="TableHead";const _t=I.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:$t("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));_t.displayName="TableCell";const byt=I.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:$t("mt-4 text-sm text-muted-foreground",e),...t}));byt.displayName="TableCaption";const wyt=()=>{const{isAdmin:e}=zr(),t=ns(),[n,s]=I.useState([]),[i,o]=I.useState(!0),[l,a]=I.useState(!1),[h,p]=I.useState(null);I.useEffect(()=>{if(!e){t("/dashboard");return}x()},[e]);const x=async()=>{try{const{data:C,error:A}=await J.from("app_tiles").select("*").order("name");if(A)throw A;s(C||[])}catch(C){console.error("Error loading apps:",C),ze.error("Failed to load apps")}finally{o(!1)}},y=async C=>{C.preventDefault();const A=new FormData(C.currentTarget),E={name:A.get("name"),description:A.get("description"),icon:A.get("icon"),app_id:A.get("app_id"),target_url:A.get("target_url"),required_tags:A.get("required_tags").split(",").map(T=>T.trim()).filter(Boolean)};try{if(h){const{error:T}=await J.from("app_tiles").update(E).eq("id",h.id);if(T)throw T;ze.success("App updated successfully")}else{const{error:T}=await J.from("app_tiles").insert([E]);if(T)throw T;ze.success("App created successfully")}a(!1),p(null),x()}catch(T){console.error("Error saving app:",T),ze.error("Failed to save app")}},b=async C=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:A}=await J.from("app_tiles").delete().eq("id",C);if(A)throw A;ze.success("App deleted successfully"),x()}catch(A){console.error("Error deleting app:",A),ze.error("Failed to delete app")}},j=C=>{p(C),a(!0)},N=()=>{p(null),a(!0)};return i?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}):r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/dashboard"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back"]}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Manage Apps"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Create and configure application tiles"})]})]}),r.jsxs(Br,{open:l,onOpenChange:a,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:N,children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:h?"Edit App":"Create New App"}),r.jsx(es,{children:"Configure the application tile settings"})]}),r.jsxs("form",{onSubmit:y,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"App Name"}),r.jsx(at,{id:"name",name:"name",defaultValue:h==null?void 0:h.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"app_id",children:"App ID"}),r.jsx(at,{id:"app_id",name:"app_id",defaultValue:h==null?void 0:h.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:h==null?void 0:h.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(at,{id:"icon",name:"icon",defaultValue:h==null?void 0:h.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"target_url",children:"Target URL"}),r.jsx(at,{id:"target_url",name:"target_url",type:"url",defaultValue:h==null?void 0:h.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(at,{id:"required_tags",name:"required_tags",defaultValue:h==null?void 0:h.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",children:h?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Application Tiles"}),r.jsx(En,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(Xe,{children:n.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsxs(ee,{onClick:N,children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"App ID"}),r.jsx(It,{children:"Target URL"}),r.jsx(It,{children:"Tags"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:n.map(C=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"text-2xl",children:C.icon}),r.jsx(_t,{className:"font-medium",children:C.name}),r.jsx(_t,{className:"font-mono text-sm",children:C.app_id}),r.jsx(_t,{className:"text-sm text-muted-foreground max-w-xs truncate",children:C.target_url}),r.jsx(_t,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:C.required_tags.map(A=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:A},A))})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>j(C),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>b(C.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},C.id))})]})})]})})]})};function qu({title:e,description:t,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(uo,{to:"/admin",children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Admin Dashboard"]})}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:e}),t&&r.jsx("p",{className:"text-muted-foreground",children:t})]}),n]})]})}const Fke=({expiresAt:e,className:t})=>{const n=new Date().getTime(),s=new Date(e).getTime(),i=Math.ceil((s-n)/(1e3*60*60*24));return i<=0?r.jsxs(Rt,{variant:"destructive",className:$t("gap-1",t),children:[r.jsx(Bh,{className:"h-3 w-3"}),"Trial Expired"]}):i<=1?r.jsxs(Rt,{variant:"destructive",className:$t("gap-1",t),children:[r.jsx(Ki,{className:"h-3 w-3"}),"Trial: <1 day left"]}):i<=3?r.jsxs(Rt,{className:$t("gap-1 bg-amber-500 hover:bg-amber-600",t),children:[r.jsx(Ki,{className:"h-3 w-3"}),"Trial: ",i," days left"]}):r.jsxs(Rt,{variant:"secondary",className:$t("gap-1",t),children:[r.jsx(Ki,{className:"h-3 w-3"}),"Trial: ",i," days left"]})},bRe=({open:e,onOpenChange:t,brokerages:n,fixedBrokerageId:s,onSuccess:i})=>{const{toast:o}=pa(),l=I.useRef(null),[a,h]=I.useState([]),[p,x]=I.useState(""),[y,b]=I.useState(!1),[j,N]=I.useState("upload"),[C,A]=I.useState(null),E=()=>{h([]),x(""),N("upload"),A(null),l.current&&(l.current.value="")},T=()=>{E(),t(!1)},L=K=>{const Z=K.split(` `).map(ne=>ne.trim()).filter(ne=>ne);if(Z.length===0)return[];const te=Z[0].toLowerCase(),le=te.includes("first")||te.includes("last")||te.includes("email")||te.includes("name")||te.includes("phone")||te.includes("sms")||te.includes("consent")?Z.slice(1):Z,ve=[];for(const ne of le){const ie=(ne.includes(" ")?ne.split(" "):ne.split(",")).map(fe=>fe.trim().replace(/^["']|["']$/g,""));if(ie.length>=2){let fe="",de="",ye="",Ie="",Ne;if(ie.length===2){const xe=ie[0].split(" ");fe=xe[0]||"",de=xe.slice(1).join(" ")||"",ye=ie[1]}else if(ie.length===3)fe=ie[0],de=ie[1],ye=ie[2];else if(ie.length===4)fe=ie[0],de=ie[1],ye=ie[2],Ie=ie[3];else if(ie.length>=5){fe=ie[0],de=ie[1],ye=ie[2],Ie=ie[3];const xe=ie[4].toLowerCase();Ne=xe==="true"||xe==="yes"||xe==="1"||xe==="y"}const he=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(ye);ve.push({firstName:fe.trim(),lastName:de.trim(),email:ye.trim().toLowerCase(),phone:Ie.trim()||void 0,smsConsent:Ne,isValid:he&&fe.trim().length>0,error:he?fe.trim()?void 0:"Missing name":"Invalid email"})}}return ve},z=K=>{var ae;const Z=(ae=K.target.files)==null?void 0:ae[0];if(!Z)return;const te=new FileReader;te.onload=le=>{var ge;const ve=(ge=le.target)==null?void 0:ge.result,ne=L(ve);if(ne.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}h(ne),N("preview")},te.readAsText(Z)},F=async()=>{const K=a.filter(te=>te.isValid);if(K.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const Z=s||p||null;b(!0);try{const{data:{session:te}}=await J.auth.getSession(),ae=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${te==null?void 0:te.access_token}`},body:JSON.stringify({users:K.map(ve=>({firstName:ve.firstName,lastName:ve.lastName,email:ve.email,phone:ve.phone,smsConsent:ve.smsConsent})),brokerageId:Z})}),le=await ae.json();if(!ae.ok)throw new Error(le.error||"Failed to import users");A(le),N("result"),le.created>0&&i(),o({title:"Import Complete",description:`${le.created} user(s) created successfully.${le.failed>0?` ${le.failed} failed.`:""}`})}catch(te){console.error("Import error:",te),o({title:"Import Failed",description:te.message||"Failed to import users",variant:"destructive"})}finally{b(!1)}},q=a.filter(K=>K.isValid).length,H=a.filter(K=>!K.isValid).length;return r.jsx(Br,{open:e,onOpenChange:T,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(h1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(es,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),j==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:z,className:"hidden"}),r.jsx(no,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(ee,{onClick:()=>{var K;return(K=l.current)==null?void 0:K.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Expected CSV Format:"}),r.jsxs("code",{className:"text-xs block bg-background p-2 rounded",children:["First Name, Last Name, Email, Phone, SMS Consent",r.jsx("br",{}),"John, Doe, john@example.com, 555-123-4567, yes",r.jsx("br",{}),"Jane, Smith, jane@example.com, 555-987-6543, true"]}),r.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Phone and SMS Consent columns are optional. SMS Consent accepts: yes/no, true/false, 1/0, y/n."})]})]}),j==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[!s&&n&&n.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Assign to Brokerage (optional)"}),r.jsxs(vn,{value:p||"none",onValueChange:K=>x(K==="none"?"":K),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select a brokerage..."})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"No brokerage"}),n.map(K=>r.jsx(Ht,{value:K.id,children:K.name},K.id))]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[q," valid"]})]}),H>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(El,{className:"h-4 w-4"}),r.jsxs("span",{children:[H," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"SMS"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ws,{children:a.slice(0,100).map((K,Z)=>r.jsxs(Ir,{children:[r.jsx(_t,{children:K.firstName}),r.jsx(_t,{children:K.lastName}),r.jsx(_t,{children:K.email}),r.jsx(_t,{className:"text-muted-foreground",children:K.phone||"-"}),r.jsx(_t,{className:"text-muted-foreground",children:K.smsConsent===!0?"✓":K.smsConsent===!1?"✗":"-"}),r.jsx(_t,{children:K.isValid?r.jsx(Rt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Rt,{variant:"destructive",children:K.error||"Invalid"})})]},Z))})]}),a.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",a.length," users"]})]})]}),j==="result"&&C&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Ya,{className:"h-12 w-12 mx-auto text-green-500 mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground mt-2",children:[C.created," agent(s) created and invited"]}),C.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[C.failed," failed to create"]})]}),C.errors.length>0&&r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 max-h-40 overflow-auto",children:[r.jsx("p",{className:"font-medium text-destructive text-sm mb-2",children:"Errors:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[C.errors.slice(0,10).map((K,Z)=>r.jsxs("li",{children:["• ",K]},Z)),C.errors.length>10&&r.jsxs("li",{children:["...and ",C.errors.length-10," more"]})]})]})]}),r.jsxs(ri,{children:[j==="upload"&&r.jsx(ee,{variant:"outline",onClick:T,children:"Cancel"}),j==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:E,children:"Back"}),r.jsx(ee,{onClick:F,disabled:y||q===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${q} Agent${q!==1?"s":""}`})]}),j==="result"&&r.jsx(ee,{onClick:T,children:"Done"})]})]})})},jyt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:vs},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:Wa},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:Sc}];function wRe({open:e,onOpenChange:t,userId:n,userName:s}){const[i,o]=I.useState("custom"),[l,a]=I.useState(""),[h,p]=I.useState(""),x=ynt(),y=j=>{o(j.type),a(j.title),p(j.message)},b=async j=>{if(j.preventDefault(),!l.trim()){$i({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:n,celebration_type:i,title:l.trim(),message:h.trim()||void 0}),$i({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),t(!1),a(""),p(""),o("custom")}catch{$i({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Sc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(es,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(Ue,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:jyt.map((j,N)=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>y(j),className:"text-xs",children:[r.jsx(j.icon,{className:"h-3 w-3 mr-1"}),j.title]},N))})]}),r.jsxs("form",{onSubmit:b,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(vn,{value:i,onValueChange:j=>o(j),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:"h-4 w-4"})," Custom"]})}),r.jsx(Ht,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx(Ht,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx(Ht,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ud,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"title",children:"Title *"}),r.jsx(at,{id:"title",value:l,onChange:j=>a(j.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"message",children:"Message (optional)"}),r.jsx(ps,{id:"message",value:h,onChange:j=>p(j.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:x.isPending,children:[r.jsx(Sc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const oce={points_earned:{label:"Points Earned",icon:Wa,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:fi,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:ud,color:"bg-green-500"},custom:{label:"Custom",icon:Cs,color:"bg-purple-500"}};function kyt(){const[e,t]=I.useState(""),[n,s]=I.useState("all"),[i,o]=I.useState("all"),{data:l=[],isLoading:a}=Zt({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:y}=await J.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(y)throw y;const b=[...new Set([...x.map(C=>C.user_id),...x.map(C=>C.created_by).filter(Boolean)])],{data:j}=await J.from("profiles").select("id, name, email").in("id",b),N=new Map((j==null?void 0:j.map(C=>[C.id,C]))||[]);return x.map(C=>{var A,E,T;return{...C,user_name:((A=N.get(C.user_id))==null?void 0:A.name)||"Unknown",user_email:((E=N.get(C.user_id))==null?void 0:E.email)||"",creator_name:C.created_by?((T=N.get(C.created_by))==null?void 0:T.name)||"System":"Auto-triggered"}})}}),h=l.filter(x=>{var N,C;const y=((N=x.user_name)==null?void 0:N.toLowerCase().includes(e.toLowerCase()))||((C=x.user_email)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))||x.title.toLowerCase().includes(e.toLowerCase()),b=n==="all"||x.celebration_type===n,j=i==="all"||i==="seen"&&x.seen_at||i==="unseen"&&!x.seen_at;return y&&b&&j}),p={total:l.length,seen:l.filter(x=>x.seen_at).length,unseen:l.filter(x=>!x.seen_at).length,byType:Object.keys(oce).reduce((x,y)=>(x[y]=l.filter(b=>b.celebration_type===y).length,x),{})};return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:p.total})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:p.seen})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:p.unseen})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:p.byType.custom||0})})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Sc,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(En,{children:"View all celebrations awarded to agents"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by agent name, email, or title...",value:e,onChange:x=>t(x.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:n,onValueChange:s,children:[r.jsx(mn,{className:"w-[180px]",children:r.jsx(_n,{placeholder:"Filter by type"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Types"}),Object.entries(oce).map(([x,y])=>r.jsx(Ht,{value:x,children:y.label},x))]})]}),r.jsxs(vn,{value:i,onValueChange:o,children:[r.jsx(mn,{className:"w-[140px]",children:r.jsx(_n,{placeholder:"Status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Status"}),r.jsx(Ht,{value:"seen",children:"Seen"}),r.jsx(Ht,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Points"}),r.jsx(It,{children:"Created By"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ws,{children:h.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):h.map(x=>{const y=oce[x.celebration_type],b=y.icon;return r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(b,{className:"h-3 w-3"}),y.label]})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.user_name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:x.user_email})]})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.title}),x.message&&r.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:x.message})]})}),r.jsx(_t,{children:x.points_amount?r.jsxs(Rt,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:xn(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(_t,{children:x.seen_at?r.jsx(Rt,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Rt,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),h.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",h.length," of ",l.length," celebrations"]})]})]})]})}const Nyt=()=>{const e=ns(),{user:t,isAdmin:n}=zr(),{startImpersonation:s,isLoading:i}=nPe(),{toast:o}=pa(),[l,a]=I.useState([]),[h,p]=I.useState([]),[x,y]=I.useState([]),[b,j]=I.useState({}),[N,C]=I.useState(!0),[A,E]=I.useState({}),[T,L]=I.useState(!1),[z,F]=I.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[q,H]=I.useState(!1),[K,Z]=I.useState(""),[te,ae]=I.useState(1),[le,ve]=I.useState(50),[ne,ge]=I.useState("all"),[ie,fe]=I.useState("all"),[de,ye]=I.useState("all"),[Ie,Ne]=I.useState("all"),[we,he]=I.useState(!1),[xe,be]=I.useState(!1),[Oe,Te]=I.useState(null),[Ve,Fe]=I.useState(null),[Me,Qe]=I.useState(!1),[Ee,Ye]=I.useState({name:"",email:"",brokerage_id:"",phone:""}),[me,mt]=I.useState(null),[et,nt]=I.useState(!1),[Ae,ht]=I.useState(""),[$e,Je]=I.useState(!1),[tt,ft]=I.useState(!1),[jt,Nt]=I.useState(null),[Et,vt]=I.useState(""),[rr,Ar]=I.useState(!1),[yn,kn]=I.useState(!1),[Jr,zn]=I.useState(null),[ks,fr]=I.useState(!1),[xs,ji]=I.useState(!1),[mi,La]=I.useState(null),[da,tl]=I.useState(""),[rl,Gs]=I.useState(!1),[Zi,Ns]=I.useState({email:"",name:"",password:"",phone:""}),[Ei,Ii]=I.useState(!1),[Oo,ir]=I.useState(!1),[xo,Tc]=I.useState(""),[yo,ss]=I.useState(!1),[vo,Bd]=I.useState(!1),[_r,Hn]=I.useState(""),[kt,je]=I.useState(new Set),[Re,Ke]=I.useState(!1),[bt,yt]=I.useState(!1),[At,Bt]=I.useState(null),[Lt,Ut]=I.useState(!1),[gr,ar]=I.useState(null);I.useEffect(()=>{!t||!n||(tn(),Vr())},[t,n]);const Xr=async()=>{try{const{data:Ct,error:Cr}=await J.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(Cr)throw Cr;const dr={};for(const ws of Ct??[])dr[ws.brokerage_id]||(dr[ws.brokerage_id]=[]),dr[ws.brokerage_id].push(ws.user_id);j(dr)}catch(Ct){console.error("Error loading brokerage manager assignments:",Ct)}},tn=async()=>{try{C(!0);const{data:Ct,error:Cr}=await J.functions.invoke("get-user-details");if(Cr)throw Cr;a(Ct.users||[]),y(Ct.brokerages||[]),await Xr()}catch(Ct){console.error("Error loading members:",Ct),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{C(!1)}},Vr=async()=>{try{const{data:Ct,error:Cr}=await J.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(Cr)throw Cr;p(Ct||[])}catch(Ct){console.error("Error loading apps:",Ct),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},ts=async Ct=>{if(!Ee.name.trim()||!Ee.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Ee.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:dr}=await J.from("profiles").update({name:Ee.name.trim(),email:Ee.email.trim(),brokerage_id:Ee.brokerage_id||null,phone:Ee.phone.trim()||null}).eq("id",Ct);if(dr)throw dr;o({title:"Success",description:"Member details updated successfully"}),Te(null),tn()}catch(dr){console.error("Error updating member:",dr),o({title:"Error",description:dr.message||"Failed to update member",variant:"destructive"})}},Xn=async Ct=>{try{const{data:{session:Cr}}=await J.auth.getSession(),dr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Cr==null?void 0:Cr.access_token}`},body:JSON.stringify({userId:Ct})}),ws=await dr.json();if(!dr.ok)throw new Error(ws.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(Cr){console.error("Error resending welcome email:",Cr),o({title:"Error",description:Cr.message||"Failed to resend welcome email",variant:"destructive"})}},Qn=async(Ct,Cr)=>{try{const{error:dr}=await J.functions.invoke("send-password-reset",{body:{email:Ct,redirectTo:window.location.origin}});if(dr)throw dr;o({title:"Password Reset Sent",description:`Password reset email sent to ${Cr}`})}catch(dr){console.error("Error sending password reset:",dr),o({title:"Error",description:dr.message||"Failed to send password reset email",variant:"destructive"})}},Bs=async(Ct,Cr)=>{if(confirm(`Are you sure you want to delete ${Cr}? This action cannot be undone.`))try{const{data:{session:dr}}=await J.auth.getSession(),ws=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:Ct})}),$s=await ws.json();if(!ws.ok)throw new Error($s.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),tn()}catch(dr){console.error("Error deleting user:",dr),o({title:"Error",description:dr.message||"Failed to delete user",variant:"destructive"})}},Ta=async()=>{if(!z.email||!z.name||!z.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if(z.role==="brokerage_manager"&&!z.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}L(!0);try{const{data:{session:Ct}}=await J.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ct==null?void 0:Ct.access_token}`},body:JSON.stringify(z)}),dr=await Cr.json();if(!Cr.ok)throw new Error(dr.error||"Failed to create user");if(z.role&&z.role!=="user"&&dr.userId){const ws=z.role==="brokerage_manager"?z.brokerage_id:void 0;await Za(dr.userId,z.role,"add",ws)}o({title:"Success",description:`User ${z.email} created successfully`}),F({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),H(!1),tn()}catch(Ct){console.error("Error creating user:",Ct),o({title:"Error",description:Ct.message||"Failed to create user",variant:"destructive"})}finally{L(!1)}},Za=async(Ct,Cr,dr,ws)=>{try{const{data:{session:$s}}=await J.auth.getSession(),Mo={userId:Ct,role:Cr,action:dr};if(Cr==="brokerage_manager"){if(!ws){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}Mo.brokerageId=ws}const io=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${$s==null?void 0:$s.access_token}`},body:JSON.stringify(Mo)}),ao=await io.json();if(!io.ok)throw new Error(ao.error||"Failed to manage user role");o({title:"Success",description:`Role ${dr==="add"?"added":"removed"} successfully`}),tn()}catch($s){console.error("Error managing user role:",$s),o({title:"Error",description:$s.message||"Failed to manage user role",variant:"destructive"})}},Oa=(Ct,Cr)=>Cr.length===0?!0:Cr.some(dr=>Ct.includes(dr)),fo=async(Ct,Cr,dr)=>{const ws=`${Ct}-${Cr.id}`;mt(ws);try{if(dr){const $s=l.find(io=>io.id===Ct),Mo=Cr.required_tags.filter(io=>$s==null?void 0:$s.tags.includes(io));for(const io of Mo){const{error:ao}=await J.from("user_tags").delete().eq("user_id",Ct).eq("tag",io);if(ao)throw ao}o({title:"Access Removed",description:`Removed access to ${Cr.name}`})}else if(Cr.required_tags.length>0){const{error:$s}=await J.from("user_tags").insert({user_id:Ct,tag:Cr.required_tags[0]});if($s)throw $s;o({title:"Access Granted",description:`Granted access to ${Cr.name}`})}await tn()}catch($s){console.error("Error toggling access:",$s),o({title:"Error",description:$s.message||"Failed to update access",variant:"destructive"})}finally{mt(null)}},wa=async()=>{const Ct=Ae.trim();if(!Ct){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(Ct.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(x.find(dr=>dr.name.toLowerCase()===Ct.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Je(!0);try{const{error:dr}=await J.from("brokerages").insert({name:Ct});if(dr)throw dr;o({title:"Success",description:`Brokerage "${Ct}" created successfully`}),ht(""),nt(!1),tn()}catch(dr){console.error("Error creating brokerage:",dr),o({title:"Error",description:dr.message||"Failed to create brokerage",variant:"destructive"})}finally{Je(!1)}},Ks=Ct=>{Nt(Ct),vt(Ct.name),ft(!0)},ma=()=>{Nt(null),vt(""),ft(!1)},zi=async()=>{if(!jt)return;const Ct=Et.trim();if(!Ct){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(Ct.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}Ar(!0);try{const{error:Cr}=await J.from("brokerages").update({name:Ct}).eq("id",jt.id);if(Cr)throw Cr;o({title:"Success",description:"Brokerage updated successfully"}),ma(),tn()}catch(Cr){console.error("Error updating brokerage:",Cr),o({title:"Error",description:Cr.message||"Failed to update brokerage",variant:"destructive"})}finally{Ar(!1)}},Ms=async(Ct,Cr)=>{var dr;if(!Cr||typeof Cr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const ws={userId:Ct,role:"brokerage_manager",action:"add",brokerageId:Cr};console.debug("[assignManagerToBrokerage] payload",ws);const{data:{session:$s}}=await J.auth.getSession(),Mo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${$s==null?void 0:$s.access_token}`},body:JSON.stringify(ws)}),io=await Mo.json();if(!Mo.ok&&!((dr=io.error)!=null&&dr.includes("duplicate")))throw new Error(io.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await tn()}catch(ws){console.error("Error assigning manager:",ws),o({title:"Error",description:ws.message||"Failed to assign manager",variant:"destructive"})}},Ba=Ct=>{zn(Ct),kn(!0)},Nl=async()=>{if(Jr){fr(!0);try{const Ct=l.filter(ws=>ws.brokerage_id===Jr.id),{data:{session:Cr}}=await J.auth.getSession();for(const ws of Ct){const $s=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Cr==null?void 0:Cr.access_token}`},body:JSON.stringify({userId:ws.id})});if(!$s.ok){const Mo=await $s.json();console.error(`Failed to delete user ${ws.email}:`,Mo.error)}}const{error:dr}=await J.from("brokerages").delete().eq("id",Jr.id);if(dr)throw dr;o({title:"Success",description:`Brokerage "${Jr.name}" and ${Ct.length} member(s) deleted`}),kn(!1),zn(null),tn()}catch(Ct){console.error("Error deleting brokerage:",Ct),o({title:"Error",description:Ct.message||"Failed to delete brokerage",variant:"destructive"})}finally{fr(!1)}}},Fl=Ct=>{La(Ct),tl(""),ji(!0)},Ac=()=>{La(null),tl(""),ji(!1)},dp=async Ct=>{try{const{error:Cr}=await J.from("profiles").update({brokerage_id:null}).eq("id",Ct);if(Cr)throw Cr;o({title:"Success",description:"User removed from brokerage"}),tn()}catch(Cr){console.error("Error removing user from brokerage:",Cr),o({title:"Error",description:Cr.message||"Failed to remove user",variant:"destructive"})}},nl=async(Ct,Cr)=>{try{const{error:dr}=await J.from("profiles").update({brokerage_id:Cr}).eq("id",Ct);if(dr)throw dr;o({title:"Success",description:"User added to brokerage"}),tn()}catch(dr){console.error("Error adding user to brokerage:",dr),o({title:"Error",description:dr.message||"Failed to add user",variant:"destructive"})}},_d=async()=>{if(!mi||!Zi.email||!Zi.name||!Zi.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Ii(!0);try{const{data:{session:Ct}}=await J.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ct==null?void 0:Ct.access_token}`},body:JSON.stringify({...Zi,brokerage_id:mi.id,role:"user"})}),dr=await Cr.json();if(!Cr.ok)throw new Error(dr.error||"Failed to create agent");o({title:"Success",description:`Agent ${Zi.email} created successfully`}),Ns({email:"",name:"",password:"",phone:""}),Gs(!1),tn()}catch(Ct){console.error("Error creating agent:",Ct),o({title:"Error",description:Ct.message||"Failed to create agent",variant:"destructive"})}finally{Ii(!1)}},sl=Ct=>l.filter(Cr=>Cr.brokerage_id===Ct),au=Ct=>{const Cr=sl(Ct);if(!da)return Cr;const dr=da.toLowerCase();return Cr.filter(ws=>ws.name.toLowerCase().includes(dr)||ws.email.toLowerCase().includes(dr))},Bo=Ct=>l.filter(Cr=>Cr.brokerage_id!==Ct),uf=l.filter(Ct=>{var Cr;if(K){const dr=K.toLowerCase();if(!(Ct.name.toLowerCase().includes(dr)||Ct.email.toLowerCase().includes(dr)||((Cr=Ct.brokerage_name)==null?void 0:Cr.toLowerCase().includes(dr))))return!1}return!(ne==="claimed"&&!Ct.claimed||ne==="unclaimed"&&Ct.claimed||ie!=="all"&&!Ct.roles.includes(ie)||de==="trial"&&!Ct.is_trial||de==="non-trial"&&Ct.is_trial||Ie==="none"&&Ct.brokerage_id||Ie!=="all"&&Ie!=="none"&&Ct.brokerage_id!==Ie)}),Vu=uf.length,Jl=Math.ceil(Vu/le),up=(te-1)*le,Em=up+le,Kc=uf.slice(up,Em),Hu=Ct=>{Z(Ct),ae(1)},Ec=Ct=>{ve(Ct),ae(1)},Zc=(Ct,Cr)=>{Ct(Cr),ae(1)},bd=async(Ct,Cr)=>{he(!0);try{const dr=l.find(io=>io.id===Ct);if(!dr)return;const ws=dr.trial_expires_at?new Date(dr.trial_expires_at):new Date,$s=new Date(ws.getTime()+Cr*24*60*60*1e3),{error:Mo}=await J.from("profiles").update({trial_expires_at:$s.toISOString()}).eq("id",Ct);if(Mo)throw Mo;o({title:"Trial Extended",description:`Trial extended by ${Cr} days`}),tn()}catch(dr){console.error("Error extending trial:",dr),o({title:"Error",description:dr.message||"Failed to extend trial",variant:"destructive"})}finally{he(!1)}},$d=async Ct=>{be(!0);try{const{error:Cr}=await J.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",Ct);if(Cr)throw Cr;o({title:"Account Converted",description:"User has been converted to a full account"}),tn(),Wu()}catch(Cr){console.error("Error converting trial:",Cr),o({title:"Error",description:Cr.message||"Failed to convert account",variant:"destructive"})}finally{be(!1)}},ou=Ct=>{Fe(Ct),Ye({name:Ct.name,email:Ct.email,brokerage_id:Ct.brokerage_id||"",phone:Ct.phone||""}),Qe(!0)},Wu=()=>{Fe(null),Qe(!1),Ye({name:"",email:"",brokerage_id:"",phone:""})},hp=async()=>{Ve&&(await ts(Ve.id),Wu())},by=Ct=>{je(Cr=>{const dr=new Set(Cr);return dr.has(Ct)?dr.delete(Ct):dr.add(Ct),dr})},fp=()=>{if(kt.size===Kc.length&&Kc.every(Ct=>kt.has(Ct.id))){const Ct=new Set(kt);Kc.forEach(Cr=>Ct.delete(Cr.id)),je(Ct)}else{const Ct=new Set(kt);Kc.forEach(Cr=>Ct.add(Cr.id)),je(Ct)}},pp=()=>{je(new Set)},fk=async()=>{if(kt.size===0)return;Ke(!0);let Ct=0,Cr=0;try{const{data:{session:dr}}=await J.auth.getSession();for(const ws of kt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:ws})})).ok?Ct++:Cr++}catch{Cr++}o({title:"Bulk Email Complete",description:`Sent ${Ct} emails${Cr>0?`, ${Cr} failed`:""}`}),pp()}catch(dr){o({title:"Error",description:dr.message||"Failed to send emails",variant:"destructive"})}finally{Ke(!1)}},Hg=async()=>{if(kt.size===0)return;Ke(!0);let Ct=0,Cr=0;try{const{data:{session:dr}}=await J.auth.getSession();for(const ws of kt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({userId:ws})})).ok?Ct++:Cr++}catch{Cr++}o({title:"Bulk Password Reset Complete",description:`Sent ${Ct} reset emails${Cr>0?`, ${Cr} failed`:""}`}),pp()}catch(dr){o({title:"Error",description:dr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ke(!1)}},Yc=async()=>{if(kt.size===0)return;const Ct=l.filter($s=>kt.has($s.id)).map($s=>$s.name).slice(0,5).join(", "),Cr=kt.size>5?` and ${kt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${kt.size} users (${Ct}${Cr})? This action cannot be undone.`))return;Ke(!0);let dr=0,ws=0;try{const{data:{session:$s}}=await J.auth.getSession();for(const Mo of kt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${$s==null?void 0:$s.access_token}`},body:JSON.stringify({userId:Mo})})).ok?dr++:ws++}catch{ws++}o({title:"Bulk Delete Complete",description:`Deleted ${dr} users${ws>0?`, ${ws} failed`:""}`}),pp(),tn()}catch($s){o({title:"Error",description:$s.message||"Failed to delete users",variant:"destructive"})}finally{Ke(!1)}},wy=async()=>{yt(!0);try{const{data:{session:Ct}}=await J.auth.getSession(),Cr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ct==null?void 0:Ct.access_token}`}});if(!Cr.ok){const ws=await Cr.json();throw new Error(ws.error||"Failed to sync phones")}const dr=await Cr.json();o({title:"Phone Sync Complete",description:`Pulled ${dr.summary.pulledFromGHL} from GHL, pushed ${dr.summary.pushedToGHL} to GHL, ${dr.summary.alreadySynced} already synced`}),tn()}catch(Ct){o({title:"Error",description:Ct.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{yt(!1)}},mp=async(Ct,Cr)=>{Bt(Ct);try{const{data:{session:dr}}=await J.auth.getSession(),{data:ws}=await J.from("profiles").select("phone").eq("id",Ct).single(),$s=(ws==null?void 0:ws.phone)||"",Mo=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${dr==null?void 0:dr.access_token}`},body:JSON.stringify({email:Cr,action:"update",phone:$s||void 0})});if(!Mo.ok){const ao=await Mo.json();throw new Error(ao.error||"Failed to sync with GHL")}const io=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(Cr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:$s?`Phone ${$s} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),tn()}catch(dr){o({title:"Error",description:dr.message||"Failed to sync phone",variant:"destructive"})}finally{Bt(null)}},Gu=async Ct=>{await s(Ct)},A3=()=>{if(kt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const Ct=l.filter(ao=>kt.has(ao.id)),Cr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],dr=Ct.map(ao=>[ao.name,ao.email,ao.phone||"",ao.brokerage_name||"",ao.roles.join("; "),ao.claimed?"Claimed":"Unclaimed",new Date(ao.created_at).toLocaleDateString()]),ws=[Cr.join(","),...dr.map(ao=>ao.map(Wg=>`"${(Wg||"").replace(/"/g,'""')}"`).join(","))].join(` `),$s=new Blob([ws],{type:"text/csv"}),Mo=URL.createObjectURL($s),io=document.createElement("a");io.href=Mo,io.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,io.click(),URL.revokeObjectURL(Mo),o({title:"Export complete",description:`Exported ${Ct.length} member(s)`})};return N?r.jsx(Or,{title:"Members",children:r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(Or,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Member Management",description:"Manage users, roles, and permissions"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:wy,disabled:bt,children:[bt?r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(ca,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:bt?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:bt?"Syncing...":"Sync GHL"})]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>ir(!0),children:[r.jsx(h1,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Import CSV"}),r.jsx("span",{className:"sm:hidden",children:"Import"})]}),r.jsxs(Br,{open:q,onOpenChange:H,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(Jh,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Add Member"}),r.jsx("span",{className:"sm:hidden",children:"Add"})]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New User"}),r.jsx(es,{children:"Add a new user to the system. They'll be able to sign in immediately."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",placeholder:"John Doe",value:z.name,onChange:Ct=>F({...z,name:Ct.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"email",children:"Email"}),r.jsx(at,{id:"email",type:"email",placeholder:"john@example.com",value:z.email,onChange:Ct=>F({...z,email:Ct.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"password",children:"Password"}),r.jsx(at,{id:"password",type:"password",placeholder:"Min 6 characters",value:z.password,onChange:Ct=>F({...z,password:Ct.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(at,{id:"phone",type:"tel",placeholder:"555-123-4567",value:z.phone,onChange:Ct=>F({...z,phone:Ct.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{htmlFor:"brokerage",children:["Brokerage",z.role==="brokerage_manager"?" (required)":""]}),r.jsxs(vn,{value:z.brokerage_id||"none",onValueChange:Ct=>F({...z,brokerage_id:Ct==="none"?"":Ct}),children:[r.jsx(mn,{id:"brokerage",children:r.jsx(_n,{placeholder:z.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"None"}),x.map(Ct=>r.jsx(Ht,{value:Ct.id,children:Ct.name},Ct.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"role",children:"Role"}),r.jsxs(vn,{value:z.role,onValueChange:Ct=>F({...z,role:Ct}),children:[r.jsx(mn,{id:"role",children:r.jsx(_n,{placeholder:"Select role"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"user",children:"User"}),r.jsx(Ht,{value:"moderator",children:"Moderator"}),r.jsx(Ht,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx(Ht,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(vn,{value:z.trial_days||"none",onValueChange:Ct=>F({...z,trial_days:Ct==="none"?"":Ct}),children:[r.jsx(mn,{id:"trial_days",children:r.jsx(_n,{placeholder:"No trial (full access)"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"No trial (full access)"}),r.jsx(Ht,{value:"7",children:"7-day trial"}),r.jsx(Ht,{value:"30",children:"30-day trial"}),r.jsx(Ht,{value:"60",children:"60-day trial"}),r.jsx(Ht,{value:"90",children:"90-day trial"}),r.jsx(Ht,{value:"365",children:"1-year trial"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Trial accounts don't require a credit card. Access expires after the trial period."})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>H(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ta,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(ba,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"members",children:"Members"}),r.jsx(ln,{value:"brokerages",children:"Brokerages"}),r.jsx(ln,{value:"access",children:"Access Matrix"}),r.jsx(ln,{value:"celebrations",children:"Celebrations"})]}),r.jsxs(An,{value:"members",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search members...",value:K,onChange:Ct=>Hu(Ct.target.value),className:"pl-10 h-9"})]}),r.jsxs(vn,{value:ne,onValueChange:Ct=>Zc(ge,Ct),children:[r.jsx(mn,{className:"w-[130px] h-9",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Status"}),r.jsx(Ht,{value:"claimed",children:"Active"}),r.jsx(Ht,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(vn,{value:ie,onValueChange:Ct=>Zc(fe,Ct),children:[r.jsx(mn,{className:"w-[130px] h-9",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Roles"}),r.jsx(Ht,{value:"admin",children:"Admin"}),r.jsx(Ht,{value:"brokerage_manager",children:"Manager"}),r.jsx(Ht,{value:"user",children:"User"})]})]}),r.jsxs(vn,{value:de,onValueChange:Ct=>Zc(ye,Ct),children:[r.jsx(mn,{className:"w-[130px] h-9",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Users"}),r.jsx(Ht,{value:"trial",children:"Trial Only"}),r.jsx(Ht,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(vn,{value:Ie,onValueChange:Ct=>Zc(Ne,Ct),children:[r.jsx(mn,{className:"w-[150px] h-9",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Brokerages"}),r.jsx(Ht,{value:"none",children:"No Brokerage"}),x.map(Ct=>r.jsx(Ht,{value:Ct.id,children:Ct.name},Ct.id))]})]}),(K||ne!=="all"||ie!=="all"||de!=="all"||Ie!=="all")&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{Z(""),ge("all"),fe("all"),ye("all"),Ne("all"),ae(1)},children:[r.jsx(bs,{className:"h-4 w-4 mr-1"}),"Clear"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",up+1,"-",Math.min(Em,Vu)," of ",Vu," members"]}),r.jsxs(vn,{value:le.toString(),onValueChange:Ct=>Ec(Number(Ct)),children:[r.jsx(mn,{className:"h-9 w-[110px]",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"50",children:"50 / page"}),r.jsx(Ht,{value:"100",children:"100 / page"}),r.jsx(Ht,{value:"250",children:"250 / page"})]})]})]})]}),kt.size>0&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/10 border border-primary/20 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(g0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[kt.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:fk,disabled:Re,children:[Re?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Ys,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Resend Invite"}),r.jsx("span",{className:"sm:hidden",children:"Invite"})]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:Hg,disabled:Re,children:[Re?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Yh,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Password Reset"}),r.jsx("span",{className:"sm:hidden",children:"Reset"})]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:A3,children:[r.jsx(Va,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Export"}),r.jsx("span",{className:"sm:hidden",children:"CSV"})]}),r.jsxs(ee,{size:"sm",variant:"destructive",onClick:Yc,disabled:Re,children:[Re?r.jsx(nn,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Zn,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Delete"}),r.jsx("span",{className:"sm:hidden",children:"Del"})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:pp,disabled:Re,children:r.jsx(bs,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"w-[50px]",children:r.jsx(cc,{checked:Kc.length>0&&Kc.every(Ct=>kt.has(Ct.id)),onCheckedChange:fp,"aria-label":"Select all on page"})}),r.jsx(It,{className:"font-semibold",children:"Name"}),r.jsx(It,{className:"font-semibold",children:"Brokerage"}),r.jsx(It,{className:"font-semibold",children:"Status"}),r.jsx(It,{className:"font-semibold",children:"Role"}),r.jsx(It,{className:"font-semibold",children:"Last Login"}),r.jsx(It,{className:"w-[100px]"})]})}),r.jsx(Ws,{children:Kc.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Kc.map(Ct=>r.jsxs(Ir,{className:`hover:bg-muted/30 ${kt.has(Ct.id)?"bg-primary/5":""}`,children:[r.jsx(_t,{children:r.jsx(cc,{checked:kt.has(Ct.id),onCheckedChange:()=>by(Ct.id),"aria-label":`Select ${Ct.name}`})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>ou(Ct),className:"text-primary hover:underline font-medium text-left",children:Ct.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Ct.email})]})}),r.jsx(_t,{className:"text-muted-foreground",children:Ct.brokerage_name||"—"}),r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Rt,{variant:Ct.claimed?"default":"secondary",className:Ct.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:Ct.claimed?"Active":"Pending"}),Ct.is_trial&&Ct.trial_expires_at&&r.jsx(Fke,{expiresAt:Ct.trial_expires_at,className:"w-fit"})]})}),r.jsx(_t,{children:Ct.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:Ct.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-muted-foreground",children:Ct.last_sign_in_at?new Date(Ct.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{ar(Ct),Ut(!0)},title:"Send celebration",children:r.jsx(Sc,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>ou(Ct),title:"Edit member",children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>mp(Ct.id,Ct.email),disabled:At===Ct.id,title:"Sync phone with GHL",children:At===Ct.id?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(ca,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Xn(Ct.id),title:"Resend welcome email",children:r.jsx(Ys,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Qn(Ct.email,Ct.name),title:"Send password reset",children:r.jsx(xj,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Gu(Ct.id),disabled:i||Ct.id===(t==null?void 0:t.id),title:Ct.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${Ct.name}`,children:i?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(dS,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Bs(Ct.id,Ct.name),title:"Delete user",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Ct.id))})]})}),Jl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",te," of ",Jl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:te===1,children:"First"}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(Ct=>Math.max(1,Ct-1)),disabled:te===1,children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Jl)},(Ct,Cr)=>{let dr;return Jl<=5||te<=3?dr=Cr+1:te>=Jl-2?dr=Jl-4+Cr:dr=te-2+Cr,r.jsx(ee,{variant:te===dr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ae(dr),children:dr},dr)})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(Ct=>Math.min(Jl,Ct+1)),disabled:te===Jl,children:r.jsx(Ka,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ae(Jl),disabled:te===Jl,children:"Last"})]})]})]}),r.jsx(Br,{open:Me,onOpenChange:Qe,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Member"}),r.jsx(es,{children:"Update member details, roles, and app access"})]}),Ve&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"edit-name",children:"Name"}),r.jsx(at,{id:"edit-name",value:Ee.name,onChange:Ct=>Ye({...Ee,name:Ct.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"edit-email",children:"Email"}),r.jsx(at,{id:"edit-email",type:"email",value:Ee.email,onChange:Ct=>Ye({...Ee,email:Ct.target.value}),maxLength:255})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(at,{id:"edit-phone",type:"tel",value:Ee.phone,onChange:Ct=>Ye({...Ee,phone:Ct.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(vn,{value:Ee.brokerage_id||"none",onValueChange:Ct=>Ye({...Ee,brokerage_id:Ct==="none"?"":Ct}),children:[r.jsx(mn,{id:"edit-brokerage",children:r.jsx(_n,{placeholder:"Select brokerage"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"None"}),x.map(Ct=>r.jsx(Ht,{value:Ct.id,children:Ct.name},Ct.id))]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Roles"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Ve.roles.map(Ct=>r.jsxs(Rt,{variant:"default",className:"gap-1",children:[r.jsx(Kf,{className:"h-3 w-3"}),Ct,Ct==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>Za(Ve.id,Ct,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(bs,{className:"h-3 w-3"})})]},Ct)),Ve.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(vn,{onValueChange:Ct=>Za(Ve.id,Ct,"add"),children:[r.jsx(mn,{className:"w-[200px]",children:r.jsx(_n,{placeholder:"Add role..."})}),r.jsxs(gn,{children:[!Ve.roles.includes("admin")&&r.jsx(Ht,{value:"admin",children:"Admin"}),!Ve.roles.includes("user")&&r.jsx(Ht,{value:"user",children:"User"})]})]}),!Ve.roles.includes("brokerage_manager")&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"To add as brokerage manager, use Brokerages tab → Manage"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"App Access"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Toggle which apps this member can access"}),r.jsx("div",{className:"grid gap-3",children:h.map(Ct=>{const Cr=Oa(Ve.tags,Ct.required_tags),dr=`${Ve.id}-${Ct.id}`,ws=me===dr,$s=Ct.required_tags.length===0;return r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-xl",children:Ct.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:Ct.name}),$s&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:ws?r.jsx(nn,{className:"h-4 w-4 animate-spin text-muted-foreground"}):$s?r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Rs,{checked:Cr,onCheckedChange:()=>fo(Ve.id,Ct,Cr)})})]},Ct.id)})})]}),Ve.is_trial&&r.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Trial Status"]}),r.jsxs("div",{className:"p-4 rounded-lg border bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("div",{children:Ve.trial_expires_at&&r.jsx(Fke,{expiresAt:Ve.trial_expires_at})}),Ve.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Ve.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>bd(Ve.id,7),disabled:we,children:[r.jsx(uj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>bd(Ve.id,14),disabled:we,children:[r.jsx(uj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>bd(Ve.id,30),disabled:we,children:[r.jsx(uj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(ee,{size:"sm",variant:"default",onClick:()=>$d(Ve.id),disabled:xe,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(wj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Ve.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Ve.trial_started_at).toLocaleDateString(),Ve.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Ve.trial_claimed_at).toLocaleDateString()]})]})]})]}),r.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Account Information"}),r.jsxs("div",{className:"text-sm space-y-1 text-muted-foreground",children:[Ve.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Ve.email_confirmed_at).toLocaleString()]}),Ve.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Ve.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Ve.created_at).toLocaleString()]})]})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:Wu,children:"Cancel"}),r.jsx(ee,{onClick:hp,children:"Save Changes"})]})]})}),r.jsxs(An,{value:"access",children:[h.length===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(ee,{onClick:()=>e("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Member Access Matrix"}),r.jsx(En,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),h.map(Ct=>r.jsx("th",{className:"text-center p-4 font-semibold min-w-[120px]",children:r.jsxs("div",{className:"flex flex-col items-center gap-1",children:[r.jsx("span",{className:"text-2xl",children:Ct.icon}),r.jsx("span",{className:"text-sm",children:Ct.name})]})},Ct.id))]})}),r.jsxs("tbody",{children:[Kc.map(Ct=>r.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[r.jsx("td",{className:"p-4 sticky left-0 bg-card z-10",children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ct.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Ct.email})]})}),h.map(Cr=>{const dr=Oa(Ct.tags,Cr.required_tags),ws=`${Ct.id}-${Cr.id}`,$s=me===ws;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:$s?r.jsx(nn,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Rs,{checked:dr,onCheckedChange:()=>fo(Ct.id,Cr,dr),disabled:Cr.required_tags.length===0})})},Cr.id)})]},Ct.id)),Kc.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:h.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Jl>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",up+1,"-",Math.min(Em,Vu)," of ",Vu," • Page ",te," of ",Jl]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(Ct=>Math.max(1,Ct-1)),disabled:te===1,children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(Ct=>Math.min(Jl,Ct+1)),disabled:te===Jl,children:r.jsx(Ka,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(ee,{variant:"outline",onClick:()=>e("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(An,{value:"brokerages",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search brokerages...",value:xo,onChange:Ct=>Tc(Ct.target.value),className:"pl-10"})]}),r.jsxs(Br,{open:et,onOpenChange:nt,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(na,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New Brokerage"}),r.jsx(es,{children:"Add a new brokerage to the system."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(at,{id:"brokerage-name",placeholder:"Enter brokerage name",value:Ae,onChange:Ct=>ht(Ct.target.value),maxLength:100})]})}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>nt(!1),children:"Cancel"}),r.jsx(ee,{onClick:wa,disabled:$e,children:$e?"Creating...":"Create Brokerage"})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(It,{className:"font-semibold",children:"Manager(s)"}),r.jsx(It,{className:"font-semibold",children:"Agents"}),r.jsx(It,{className:"w-[150px]"})]})}),r.jsx(Ws,{children:(()=>{const Ct=x.filter(Cr=>Cr.name.toLowerCase().includes(xo.toLowerCase()));return Ct.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:xo?"No brokerages match your search":"No brokerages found"})}):Ct.map(Cr=>{const dr=l.filter(io=>io.brokerage_id===Cr.id),$s=(b[Cr.id]??[]).map(io=>l.find(ao=>ao.id===io)).filter(Boolean),Mo=dr.length;return r.jsxs(Ir,{className:"hover:bg-muted/30",children:[r.jsx(_t,{children:r.jsx("button",{onClick:()=>Ks(Cr),className:"text-primary hover:underline font-medium",children:Cr.name})}),r.jsx(_t,{children:$s.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:$s.map(io=>r.jsx(Rt,{variant:"secondary",className:"text-xs",children:io.name},io.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(_t,{children:[Mo," member",Mo!==1?"s":""]}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Fl(Cr),children:[r.jsx(Vn,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ks(Cr),title:"Edit brokerage",children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ba(Cr),title:"Delete brokerage",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Cr.id)})})()})]})}),r.jsx(Br,{open:tt,onOpenChange:ft,children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Brokerage"}),r.jsx(es,{children:"Update brokerage details and manage managers"})]}),jt&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(at,{id:"edit-brokerage-name",value:Et,onChange:Ct=>vt(Ct.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{children:"Managers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Click × to remove manager access for this brokerage (keeps them as a member)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{const Cr=(b[jt.id]??[]).map(dr=>l.find(ws=>ws.id===dr)).filter(Boolean);return Cr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):Cr.map(dr=>r.jsxs(Rt,{variant:"default",className:"gap-1",children:[r.jsx(Kf,{className:"h-3 w-3"}),dr.name,r.jsx("button",{onClick:()=>Za(dr.id,"brokerage_manager","remove",jt.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(bs,{className:"h-3 w-3"})})]},dr.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(Du,{open:yo,onOpenChange:ss,children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":yo,className:"w-full justify-between",children:["Search for a member...",r.jsx(_i,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(nu,{className:"w-full p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search by name or email..."}),r.jsxs(H1,{className:"max-h-[200px]",children:[r.jsx(W1,{children:"No members found."}),r.jsx(G1,{children:(()=>{const Ct=new Set(b[jt.id]??[]);return l.filter(Cr=>!Ct.has(Cr.id)&&(n||Cr.brokerage_id===jt.id)).map(Cr=>r.jsxs(K1,{value:`${Cr.name} ${Cr.email}`,onSelect:()=>{Ms(Cr.id,jt.id),ss(!1)},children:[Cr.name," (",Cr.email,")"]},Cr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:l.filter(Ct=>Ct.brokerage_id===jt.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(Ct=>Ct.brokerage_id===jt.id).map(Ct=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:Ct.name}),Ct.roles.includes("brokerage_manager")&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Manager"})]},Ct.id))})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:ma,children:"Cancel"}),r.jsx(ee,{onClick:zi,disabled:rr,children:rr?"Saving...":"Save Changes"})]})]})}),r.jsx(Br,{open:yn,onOpenChange:kn,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(es,{children:['Are you sure you want to delete "',Jr==null?void 0:Jr.name,'"?']})]}),r.jsx("div",{className:"py-4",children:r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-destructive",children:"Warning: This action cannot be undone!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"This will permanently delete:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground list-disc list-inside",children:[r.jsxs("li",{children:['The brokerage "',Jr==null?void 0:Jr.name,'"']}),r.jsxs("li",{children:["All ",l.filter(Ct=>Ct.brokerage_id===(Jr==null?void 0:Jr.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>kn(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Nl,disabled:ks,children:ks?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Br,{open:xs,onOpenChange:ji,children:r.jsxs(Fr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-5 w-5"}),"Manage ",mi==null?void 0:mi.name]}),r.jsx(es,{children:"Add, remove, or manage users in this brokerage"})]}),mi&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search members...",value:da,onChange:Ct=>tl(Ct.target.value),className:"pl-10 h-9"})]}),r.jsxs(Br,{open:rl,onOpenChange:Gs,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(Jh,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Add New Agent"}),r.jsxs(es,{children:["Create a new agent for ",mi.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"agent-name",children:"Name"}),r.jsx(at,{id:"agent-name",placeholder:"John Doe",value:Zi.name,onChange:Ct=>Ns({...Zi,name:Ct.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"agent-email",children:"Email"}),r.jsx(at,{id:"agent-email",type:"email",placeholder:"john@example.com",value:Zi.email,onChange:Ct=>Ns({...Zi,email:Ct.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"agent-password",children:"Password"}),r.jsx(at,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:Zi.password,onChange:Ct=>Ns({...Zi,password:Ct.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(at,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:Zi.phone,onChange:Ct=>Ns({...Zi,phone:Ct.target.value})})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Gs(!1),children:"Cancel"}),r.jsx(ee,{onClick:_d,disabled:Ei,children:Ei?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ue,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(Du,{open:vo,onOpenChange:Bd,children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":vo,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(_i,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(nu,{className:"w-[300px] p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search users...",value:_r,onValueChange:Hn}),r.jsxs(H1,{children:[r.jsx(W1,{children:"No users found."}),r.jsx(G1,{children:Bo(mi.id).filter(Ct=>_r===""||Ct.name.toLowerCase().includes(_r.toLowerCase())||Ct.email.toLowerCase().includes(_r.toLowerCase())).map(Ct=>r.jsxs(K1,{value:`${Ct.name} ${Ct.email}`,onSelect:()=>{nl(Ct.id,mi.id),Bd(!1),Hn("")},children:[Ct.name," (",Ct.email,")"]},Ct.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Name"}),r.jsx(It,{className:"font-semibold",children:"Email"}),r.jsx(It,{className:"font-semibold",children:"Status"}),r.jsx(It,{className:"font-semibold",children:"Role"}),r.jsx(It,{className:"w-[120px]"})]})}),r.jsx(Ws,{children:au(mi.id).length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:da?"No matching members found":"No members in this brokerage"})}):au(mi.id).map(Ct=>r.jsxs(Ir,{className:"hover:bg-muted/30",children:[r.jsx(_t,{className:"font-medium",children:Ct.name}),r.jsx(_t,{className:"text-muted-foreground",children:Ct.email}),r.jsx(_t,{children:Ct.claimed?r.jsx(Rt,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Rt,{variant:"secondary",children:"Pending"})}),r.jsx(_t,{children:Ct.roles.includes("brokerage_manager")?r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(Kf,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!Ct.claimed&&r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Xn(Ct.id),title:"Resend welcome email",children:r.jsx(Ys,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>dp(Ct.id),title:"Remove from brokerage",children:r.jsx(bs,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Gu(Ct.id),disabled:i||Ct.id===(t==null?void 0:t.id),title:Ct.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${Ct.name}`,children:i?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(dS,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Bs(Ct.id,Ct.name),title:"Delete user",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Ct.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[sl(mi.id).length," total member",sl(mi.id).length!==1?"s":""," •",sl(mi.id).filter(Ct=>Ct.roles.includes("brokerage_manager")).length," manager",sl(mi.id).filter(Ct=>Ct.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(ri,{children:r.jsx(ee,{variant:"outline",onClick:Ac,children:"Close"})})]})})]}),r.jsx(An,{value:"celebrations",children:r.jsx(kyt,{})})]})]}),r.jsx(bRe,{open:Oo,onOpenChange:ir,brokerages:x,onSuccess:tn}),gr&&r.jsx(wRe,{open:Lt,onOpenChange:Ct=>{Ut(Ct),Ct||ar(null)},userId:gr.id,userName:gr.name})]})},Syt=()=>{const[e,t]=I.useState([]),[n,s]=I.useState(!0),[i,o]=I.useState(!1),[l,a]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState("");I.useEffect(()=>{N()},[]);const N=async()=>{const{data:F,error:q}=await J.from("invite_codes").select("*").order("created_at",{ascending:!1});q?(ze.error("Failed to load invite codes"),console.error(q)):t(F||[]),s(!1)},C=async F=>{if(F.preventDefault(),!l.trim()){ze.error("Please enter a code");return}o(!0);const{error:q}=await J.from("invite_codes").insert({code:l.trim().toUpperCase(),description:h.trim()||null,max_uses:x?parseInt(x):null,trial_days:b?parseInt(b):null});q?q.code==="23505"?ze.error("This code already exists"):(ze.error("Failed to create invite code"),console.error(q)):(ze.success("Invite code created"),a(""),p(""),y(""),j(""),N()),o(!1)},A=async(F,q)=>{const{error:H}=await J.from("invite_codes").update({is_active:!q}).eq("id",F);H?ze.error("Failed to update code"):t(e.map(K=>K.id===F?{...K,is_active:!q}:K))},E=async F=>{const{error:q}=await J.from("invite_codes").delete().eq("id",F);q?ze.error("Failed to delete code"):(ze.success("Code deleted"),t(e.filter(H=>H.id!==F)))},T="https://dashboard.relevelup.com",L=F=>{const q=`${T}/join?code=${F}`;navigator.clipboard.writeText(q),ze.success("Link copied to clipboard")},z=`${T}/join`;return r.jsx(Or,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Create New Code"}),r.jsxs(En,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:z})]})]}),r.jsx(Xe,{children:r.jsxs("form",{onSubmit:C,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"code",children:"Code"}),r.jsx(at,{id:"code",placeholder:"WELCOME2024",value:l,onChange:F=>a(F.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(Ue,{htmlFor:"description",children:"Description (optional)"}),r.jsx(at,{id:"description",placeholder:"For marketing campaign",value:h,onChange:F=>p(F.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(at,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:F=>y(F.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(at,{id:"trialDays",type:"number",placeholder:"None",value:b,onChange:F=>j(F.target.value),className:"w-28"})]}),r.jsxs(ee,{type:"submit",disabled:i,children:[i?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Active Codes"})}),r.jsx(Xe,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.length===0?r.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No invite codes yet"}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Code"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Uses"}),r.jsx(It,{children:"Trial"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Active"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ws,{children:e.map(F=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-mono font-medium",children:F.code}),r.jsx(_t,{className:"text-muted-foreground",children:F.description||"—"}),r.jsxs(_t,{children:[F.uses_count,F.max_uses&&` / ${F.max_uses}`]}),r.jsx(_t,{children:F.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[F.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-muted-foreground",children:xn(new Date(F.created_at),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx(Rs,{checked:F.is_active,onCheckedChange:()=>A(F.id,F.is_active)})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>L(F.code),title:"Copy invite link",children:r.jsx(pl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>E(F.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},F.id))})]})})]})]})})};function Td(e){this.content=e}Td.prototype={constructor:Td,find:function(e){for(var t=0;t>1}};Td.from=function(e){if(e instanceof Td)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Td(t)};function jRe(e,t,n){for(let s=0;;s++){if(s==e.childCount||s==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(s),o=t.child(s);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let l=0;i.text[l]==o.text[l];l++)n++;return n}if(i.content.size||o.content.size){let l=jRe(i.content,o.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function kRe(e,t,n,s){for(let i=e.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:s};let l=e.child(--i),a=t.child(--o),h=l.nodeSize;if(l==a){n-=h,s-=h;continue}if(!l.sameMarkup(a))return{a:n,b:s};if(l.isText&&l.text!=a.text){let p=0,x=Math.min(l.text.length,a.text.length);for(;pt&&s(h,i+a,o||null,l)!==!1&&h.content.size){let x=a+1;h.nodesBetween(Math.max(0,t-x),Math.min(h.content.size,n-x),s,i+x)}a=p}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,s,i){let o="",l=!0;return this.nodesBetween(t,n,(a,h)=>{let p=a.isText?a.text.slice(Math.max(t,h)-h,n-h):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&p||a.isTextblock)&&s&&(l?l=!1:o+=s),o+=p},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,s=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(i[i.length-1]=n.withText(n.text+s.text),o=1);ot)for(let o=0,l=0;lt&&((ln)&&(a.isText?a=a.cut(Math.max(0,t-l),Math.min(a.text.length,n-l)):a=a.cut(Math.max(0,t-l-1),Math.min(a.content.size,n-l-1))),s.push(a),i+=a.nodeSize),l=h}return new wn(s,i)}cutByIndex(t,n){return t==n?wn.empty:t==0&&n==this.content.length?this:new wn(this.content.slice(t,n))}replaceChild(t,n){let s=this.content[t];if(s==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return i[t]=n,new wn(i,o)}addToStart(t){return new wn([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new wn(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;nthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,s=0;;n++){let i=this.child(n),o=s+i.nodeSize;if(o>=t)return o==t?CL(n+1,o):CL(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return wn.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new wn(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return wn.empty;let n,s=0;for(let i=0;ithis.type.rank&&(n||(n=t.slice(0,i)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=t.slice()),s||n.push(this),n}removeFromSet(t){for(let n=0;ns.type.rank-i.type.rank),n}};Ro.none=[];class Cte extends Error{}class fs{constructor(t,n,s){this.content=t,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let s=SRe(this.content,t+this.openStart,n);return s&&new fs(s,this.openStart,this.openEnd)}removeBetween(t,n){return new fs(NRe(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return fs.empty;let s=n.openStart||0,i=n.openEnd||0;if(typeof s!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fs(wn.fromJSON(t,n.content),s,i)}static maxOpen(t,n=!0){let s=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new fs(t,s,i)}}fs.empty=new fs(wn.empty,0,0);function NRe(e,t,n){let{index:s,offset:i}=e.findIndex(t),o=e.maybeChild(s),{index:l,offset:a}=e.findIndex(n);if(i==t||o.isText){if(a!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(s!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(s,o.copy(NRe(o.content,t-i-1,n-i-1)))}function SRe(e,t,n,s){let{index:i,offset:o}=e.findIndex(t),l=e.maybeChild(i);if(o==t||l.isText)return s&&!s.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=SRe(l.content,t-o-1,n,l);return a&&e.replaceChild(i,l.copy(a))}function Cyt(e,t,n){if(n.openStart>e.depth)throw new Cte("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Cte("Inconsistent open depths");return CRe(e,t,n,0)}function CRe(e,t,n,s){let i=e.index(s),o=e.node(s);if(i==t.index(s)&&s=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function uA(e,t,n,s){let i=(t||e).node(n),o=0,l=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(jj(e.nodeAfter,s),o++));for(let a=o;ai&&Phe(e,t,i+1),l=s.depth>i&&Phe(n,s,i+1),a=[];return uA(null,e,i,a),o&&l&&t.index(i)==n.index(i)?(MRe(o,l),jj(kj(o,TRe(e,t,n,s,i+1)),a)):(o&&jj(kj(o,Mte(e,t,i+1)),a),uA(t,n,i,a),l&&jj(kj(l,Mte(n,s,i+1)),a)),uA(s,null,i,a),new wn(a)}function Mte(e,t,n){let s=[];if(uA(null,e,n,s),e.depth>n){let i=Phe(e,t,n+1);jj(kj(i,Mte(e,t,n+1)),s)}return uA(t,null,n,s),new wn(s)}function Myt(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)i=t.node(o).copy(wn.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}class lE{constructor(t,n,s){this.pos=t,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let s=this.pos-this.path[this.path.length-1],i=t.child(n);return s?t.child(n).cut(s):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let s=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos=0;s--)if(t.pos<=this.end(s)&&(!n||n(this.node(s))))return new Tte(this,t,s);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let s=[],i=0,o=n;for(let l=t;;){let{index:a,offset:h}=l.content.findIndex(o),p=o-h;if(s.push(l,a,i+h),!p||(l=l.child(a),l.isText))break;o=p-1,i+=h+1}return new lE(n,s,o)}static resolveCached(t,n){let s=zke.get(t);if(s)for(let o=0;ot&&this.nodesBetween(t,n,o=>(s.isInSet(o.marks)&&(i=!0),!i)),i}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),ARe(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,s=wn.empty,i=0,o=s.childCount){let l=this.contentMatchAt(t).matchFragment(s,i,o),a=l&&l.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let h=i;hn.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,s)}let i=wn.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,i,s);return o.type.checkAttrs(o.attrs),o}};C1.prototype.text=void 0;class Ate extends C1{constructor(t,n,s,i){if(super(t,n,null,i),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ARe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Ate(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Ate(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function ARe(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class qj{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let s=new Iyt(t,n);if(s.next==null)return qj.empty;let i=ERe(s);s.next&&s.err("Unexpected trailing text");let o=zyt(Fyt(i));return Byt(o,s),o}matchType(t){for(let n=0;np.createAndFill()));for(let p=0;p=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(s){t.push(s);for(let i=0;i{let o=i+(s.validEnd?"*":" ")+" ";for(let l=0;l"+t.indexOf(s.next[l].next);return o}).join(` `)}}qj.empty=new qj(!0);class Iyt{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function ERe(e){let t=[];do t.push(Pyt(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Pyt(e){let t=[];do t.push(Lyt(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Lyt(e){let t=Ryt(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=Oyt(e,t);else break;return t}function Bke(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Oyt(e,t){let n=Bke(e),s=n;return e.eat(",")&&(e.next!="}"?s=Bke(e):s=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:t}}function Dyt(e,t){let n=e.nodeTypes,s=n[t];if(s)return[s];let i=[];for(let o in n){let l=n[o];l.isInGroup(t)&&i.push(l)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function Ryt(e){if(e.eat("(")){let t=ERe(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=Dyt(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function Fyt(e){let t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function s(l,a,h){let p={term:h,to:a};return t[l].push(p),p}function i(l,a){l.forEach(h=>h.to=a)}function o(l,a){if(l.type=="choice")return l.exprs.reduce((h,p)=>h.concat(o(p,a)),[]);if(l.type=="seq")for(let h=0;;h++){let p=o(l.exprs[h],a);if(h==l.exprs.length-1)return p;i(p,a=n())}else if(l.type=="star"){let h=n();return s(a,h),i(o(l.expr,h),h),[s(h)]}else if(l.type=="plus"){let h=n();return i(o(l.expr,a),h),i(o(l.expr,h),h),[s(h)]}else{if(l.type=="opt")return[s(a)].concat(o(l.expr,a));if(l.type=="range"){let h=a;for(let p=0;p{e[l].forEach(({term:a,to:h})=>{if(!a)return;let p;for(let x=0;x{p||i.push([a,p=[]]),p.indexOf(x)==-1&&p.push(x)})})});let o=t[s.join(",")]=new qj(s.indexOf(e.length-1)>-1);for(let l=0;l-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:LRe(this.attrs,t)}create(t=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new C1(this,this.computeAttrs(t),wn.from(n),Ro.setFrom(s))}createChecked(t=null,n,s){return n=wn.from(n),this.checkContent(n),new C1(this,this.computeAttrs(t),n,Ro.setFrom(s))}createAndFill(t=null,n,s){if(t=this.computeAttrs(t),n=wn.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(wn.empty,!0);return o?new C1(this,t,n.append(o),Ro.setFrom(s)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let s=0;s-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;ns[o]=new RRe(o,n,l));let i=n.spec.topNode||"doc";if(!s[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!s.text)throw new RangeError("Every schema needs a 'text' type");for(let o in s.text.attrs)throw new RangeError("The text node type should not have attributes");return s}};function $yt(e,t,n){let s=n.split("|");return i=>{let o=i===null?"null":typeof i;if(s.indexOf(o)<0)throw new RangeError(`Expected value of type ${s} for attribute ${t} on type ${e}, got ${o}`)}}class Uyt{constructor(t,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?$yt(t,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class Lse{constructor(t,n,s,i){this.name=t,this.rank=n,this.schema=s,this.spec=i,this.attrs=DRe(t,i.attrs),this.excluded=null;let o=PRe(this.attrs);this.instance=o?new Ro(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Ro(this,LRe(this.attrs,t))}static compile(t,n){let s=Object.create(null),i=0;return t.forEach((o,l)=>s[o]=new Lse(o,i++,n,l)),s}removeFromSet(t){for(var n=0;n-1}}class FRe{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=Td.from(t.nodes),n.marks=Td.from(t.marks||{}),this.nodes=Uke.compile(this.spec.nodes,this),this.marks=Lse.compile(this.spec.marks,this);let s=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],l=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=s[l]||(s[l]=qj.parse(l,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?qke(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:qke(this,l.split(" "))}this.nodeFromJSON=i=>C1.fromJSON(this,i),this.markFromJSON=i=>Ro.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,s,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Uke){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,s,i)}text(t,n){let s=this.nodes.text;return new Ate(s,s.defaultAttrs,t,Ro.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function qke(e,t){let n=[];for(let s=0;s-1)&&n.push(l=h)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[s]+"'")}return n}function qyt(e){return e.tag!=null}function Vyt(e){return e.style!=null}let hA=class Ohe{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(i=>{if(qyt(i))this.tags.push(i);else if(Vyt(i)){let o=/[^=]*/.exec(i.style)[0];s.indexOf(o)<0&&s.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=t.nodes[i.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let s=new Hke(this,n,!1);return s.addAll(t,Ro.none,n.from,n.to),s.finish()}parseSlice(t,n={}){let s=new Hke(this,n,!0);return s.addAll(t,Ro.none,n.from,n.to),fs.maxOpen(s.finish())}matchTag(t,n,s){for(let i=s?this.tags.indexOf(s)+1:0;it.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(l.getAttrs){let h=l.getAttrs(n);if(h===!1)continue;l.attrs=h||void 0}return l}}}static schemaRules(t){let n=[];function s(i){let o=i.priority==null?50:i.priority,l=0;for(;l{s(l=Wke(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(l=>{s(l=Wke(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Ohe(t,Ohe.schemaRules(t)))}};const zRe={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},Hyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},BRe={ol:!0,ul:!0},cE=1,Dhe=2,fA=4;function Vke(e,t,n){return t!=null?(t?cE:0)|(t==="full"?Dhe:0):e&&e.whitespace=="pre"?cE|Dhe:n&~fA}class ML{constructor(t,n,s,i,o,l){this.type=t,this.attrs=n,this.marks=s,this.solid=i,this.options=l,this.content=[],this.activeMarks=Ro.none,this.match=o||(l&fA?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(wn.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,i;return(i=s.findWrapping(t.type))?(this.match=s,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&cE)){let s=this.content[this.content.length-1],i;if(s&&s.isText&&(i=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=wn.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(wn.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!zRe.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Hke{constructor(t,n,s){this.parser=t,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,l=Vke(null,n.preserveWhitespace,0)|(s?fA:0);i?o=new ML(i.type,i.attrs,Ro.none,!0,n.topMatch||i.type.contentMatch,l):s?o=new ML(null,null,Ro.none,!0,null,l):o=new ML(t.schema.topNodeType,null,Ro.none,!0,null,l),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let s=t.nodeValue,i=this.top,o=i.options&Dhe?"full":this.localPreserveWS||(i.options&cE)>0,{schema:l}=this.parser;if(o==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,` `);else if(l.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(l.linebreakReplacement.create())){let a=s.split(/\r?\n|\r/);for(let h=0;h!h.clearMark(p)):n=n.concat(this.parser.schema.marks[h.mark].create(h.attrs)),h.consuming===!1)a=h;else break}}return n}addElementByRule(t,n,s,i){let o,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),s,t.nodeName=="BR")||this.leafFallback(t,s);else{let h=this.enter(l,n.attrs||null,s,n.preserveWhitespace);h&&(o=!0,s=h)}else{let h=this.parser.schema.marks[n.mark];s=s.concat(h.create(n.attrs))}let a=this.top;if(l&&l.isLeaf)this.findInside(t);else if(i)this.addElement(t,s,i);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(h=>this.insertNode(h,s,!1));else{let h=t;typeof n.contentElement=="string"?h=t.querySelector(n.contentElement):typeof n.contentElement=="function"?h=n.contentElement(t):n.contentElement&&(h=n.contentElement),this.findAround(t,h,!0),this.addAll(h,s),this.findAround(t,h,!1)}o&&this.sync(a)&&this.open--}addAll(t,n,s,i){let o=s||0;for(let l=s?t.childNodes[s]:t.firstChild,a=i==null?null:t.childNodes[i];l!=a;l=l.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(l,n);this.findAtPoint(t,o)}findPlace(t,n,s){let i,o;for(let l=this.open,a=0;l>=0;l--){let h=this.nodes[l],p=h.findWrapping(t);if(p&&(!i||i.length>p.length+a)&&(i=p,o=h,!p.length))break;if(h.solid){if(s)break;a+=2}}if(!i)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(p.type):Gke(p.type,t))?(h=p.addToSet(h),!1):!0),this.nodes.push(new ML(t,n,h,i,null,a)),this.open++,s}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=cE)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let i=s.length-1;i>=0;i--)t+=s[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let s=0;s-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),s=this.options.context,i=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(i?0:1),l=(a,h)=>{for(;a>=0;a--){let p=n[a];if(p==""){if(a==n.length-1||a==0)continue;for(;h>=o;h--)if(l(a-1,h))return!0;return!1}else{let x=h>0||h==0&&i?this.nodes[h].type:s&&h>=o?s.node(h-o).type:null;if(!x||x.name!=p&&!x.isInGroup(p))return!1;h--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}}function Wyt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let s=t.nodeType==1?t.nodeName.toLowerCase():null;s&&BRe.hasOwnProperty(s)&&n?(n.appendChild(t),t=n):s=="li"?n=t:s&&(n=null)}}function Gyt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Wke(e){let t={};for(let n in e)t[n]=e[n];return t}function Gke(e,t){let n=t.schema.nodes;for(let s in n){let i=n[s];if(!i.allowsMarkType(e))continue;let o=[],l=a=>{o.push(a);for(let h=0;h{if(o.length||l.marks.length){let a=0,h=0;for(;a=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(t,n,s={}){let i=this.marks[t.type.name];return i&&hee(cce(s),i(t,n),null,t.attrs)}static renderSpec(t,n,s=null,i){return hee(t,n,s,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ok(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=Kke(t.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(t){return Kke(t.marks)}}function Kke(e){let t={};for(let n in e){let s=e[n].spec.toDOM;s&&(t[n]=s)}return t}function cce(e){return e.document||window.document}const Zke=new WeakMap;function Kyt(e){let t=Zke.get(e);return t===void 0&&Zke.set(e,t=Zyt(e)),t}function Zyt(e){let t=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")t||(t=[]),t.push(s);else for(let i=0;i-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 l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let a,h=n?e.createElementNS(n,i):e.createElement(i),p=t[1],x=1;if(p&&typeof p=="object"&&p.nodeType==null&&!Array.isArray(p)){x=2;for(let y in p)if(p[y]!=null){let b=y.indexOf(" ");b>0?h.setAttributeNS(y.slice(0,b),y.slice(b+1),p[y]):y=="style"&&h.style?h.style.cssText=p[y]:h.setAttribute(y,p[y])}}for(let y=x;yx)throw new RangeError("Content hole must be the only child of its parent node");return{dom:h,contentDOM:h}}else{let{dom:j,contentDOM:N}=hee(e,b,n,s);if(h.appendChild(j),N){if(a)throw new RangeError("Multiple content holes");a=N}}}return{dom:h,contentDOM:a}}const $Re=65535,URe=Math.pow(2,16);function Yyt(e,t){return e+t*URe}function Yke(e){return e&$Re}function Xyt(e){return(e-(e&$Re))/URe}const qRe=1,VRe=2,fee=4,HRe=8;class Rhe{constructor(t,n,s){this.pos=t,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&HRe)>0}get deletedBefore(){return(this.delInfo&(qRe|fee))>0}get deletedAfter(){return(this.delInfo&(VRe|fee))>0}get deletedAcross(){return(this.delInfo&fee)>0}}class Vh{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Vh.empty)return Vh.empty}recover(t){let n=0,s=Yke(t);if(!this.inverted)for(let i=0;it)break;let p=this.ranges[a+o],x=this.ranges[a+l],y=h+p;if(t<=y){let b=p?t==h?-1:t==y?1:n:n,j=h+i+(b<0?0:x);if(s)return j;let N=t==(n<0?h:y)?null:Yyt(a/3,t-h),C=t==h?VRe:t==y?qRe:fee;return(n<0?t!=h:t!=y)&&(C|=HRe),new Rhe(j,C,N)}i+=x-p}return s?t+i:new Rhe(t+i,0,null)}touches(t,n){let s=0,i=Yke(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;at)break;let p=this.ranges[a+o],x=h+p;if(t<=x&&a==i*3)return!0;s+=this.ranges[a+l]-p}return!1}forEach(t){let n=this.inverted?2:1,s=this.inverted?1:2;for(let i=0,o=0;i=0;n--){let i=t.getMirror(n);this.appendMap(t._maps[n].invert(),i!=null&&i>n?s-i-1:void 0)}}invert(){let t=new dE;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let s=this.from;so&&h!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return Nc.fromReplace(t,this.from,this.to,o)}invert(){return new pg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new G0(n.pos,s.pos,this.mark)}merge(t){return t instanceof G0&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new G0(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new G0(n.from,n.to,t.markFromJSON(n.mark))}}iu.jsonID("addMark",G0);class pg extends iu{constructor(t,n,s){super(),this.from=t,this.to=n,this.mark=s}apply(t){let n=t.slice(this.from,this.to),s=new fs(Uxe(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return Nc.fromReplace(t,this.from,this.to,s)}invert(){return new G0(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new pg(n.pos,s.pos,this.mark)}merge(t){return t instanceof pg&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new pg(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new pg(n.from,n.to,t.markFromJSON(n.mark))}}iu.jsonID("removeMark",pg);class K0 extends iu{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Nc.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Nc.fromReplace(t,this.pos,this.pos+1,new fs(wn.from(s),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let i=0;is.pos?null:new md(n.pos,s.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new md(n.from,n.to,n.gapFrom,n.gapTo,fs.fromJSON(t,n.slice),n.insert,!!n.structure)}}iu.jsonID("replaceAround",md);function Fhe(e,t,n){let s=e.resolve(t),i=n-t,o=s.depth;for(;i>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,i--;if(i>0){let l=s.node(o).maybeChild(s.indexAfter(o));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function Qyt(e,t,n,s){let i=[],o=[],l,a;e.doc.nodesBetween(t,n,(h,p,x)=>{if(!h.isInline)return;let y=h.marks;if(!s.isInSet(y)&&x.type.allowsMarkType(s.type)){let b=Math.max(p,t),j=Math.min(p+h.nodeSize,n),N=s.addToSet(y);for(let C=0;Ce.step(h)),o.forEach(h=>e.step(h))}function Jyt(e,t,n,s){let i=[],o=0;e.doc.nodesBetween(t,n,(l,a)=>{if(!l.isInline)return;o++;let h=null;if(s instanceof Lse){let p=l.marks,x;for(;x=s.isInSet(p);)(h||(h=[])).push(x),p=x.removeFromSet(p)}else s?s.isInSet(l.marks)&&(h=[s]):h=l.marks;if(h&&h.length){let p=Math.min(a+l.nodeSize,n);for(let x=0;xe.step(new pg(l.from,l.to,l.style)))}function qxe(e,t,n,s=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),l=[],a=t+1;for(let h=0;h=0;h--)e.step(l[h])}function e0t(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function m3(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let s=e.depth,i=0,o=0;;--s){let l=e.$from.node(s),a=e.$from.index(s)+i,h=e.$to.indexAfter(s)-o;if(sn;N--)C||s.index(N)>0?(C=!0,x=wn.from(s.node(N).copy(x)),y++):h--;let b=wn.empty,j=0;for(let N=o,C=!1;N>n;N--)C||i.after(N+1)=0;l--){if(s.size){let a=n[l].type.contentMatch.matchFragment(s);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=wn.from(n[l].type.create(n[l].attrs,s))}let i=t.start,o=t.end;e.step(new md(i,o,i,o,new fs(s,0,0),n.length,!0))}function i0t(e,t,n,s,i){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(l,a)=>{let h=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(s,h)&&a0t(e.doc,e.mapping.slice(o).map(a),s)){let p=null;if(s.schema.linebreakReplacement){let j=s.whitespace=="pre",N=!!s.contentMatch.matchType(s.schema.linebreakReplacement);j&&!N?p=!1:!j&&N&&(p=!0)}p===!1&&GRe(e,l,a,o),qxe(e,e.mapping.slice(o).map(a,1),s,void 0,p===null);let x=e.mapping.slice(o),y=x.map(a,1),b=x.map(a+l.nodeSize,1);return e.step(new md(y,b,y+1,b-1,new fs(wn.from(s.create(h,null,l.marks)),0,0),1,!0)),p===!0&&WRe(e,l,a,o),!1}})}function WRe(e,t,n,s){t.forEach((i,o)=>{if(i.isText){let l,a=/\r?\n|\r/g;for(;l=a.exec(i.text);){let h=e.mapping.slice(s).map(n+1+o+l.index);e.replaceWith(h,h+1,t.type.schema.linebreakReplacement.create())}}})}function GRe(e,t,n,s){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let l=e.mapping.slice(s).map(n+1+o);e.replaceWith(l,l+1,t.type.schema.text(` `))}})}function a0t(e,t,n){let s=e.resolve(t),i=s.index();return s.parent.canReplaceWith(i,i+1,n)}function o0t(e,t,n,s,i){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let l=n.create(s,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,l);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new md(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new fs(wn.from(l),0,0),1,!0))}function Yx(e,t,n=1,s){let i=e.resolve(t),o=i.depth-n,l=s&&s[s.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let p=i.depth-1,x=n-2;p>o;p--,x--){let y=i.node(p),b=i.index(p);if(y.type.spec.isolating)return!1;let j=y.content.cutByIndex(b,y.childCount),N=s&&s[x+1];N&&(j=j.replaceChild(0,N.type.create(N.attrs)));let C=s&&s[x]||y;if(!y.canReplace(b+1,y.childCount)||!C.type.validContent(j))return!1}let a=i.indexAfter(o),h=s&&s[0];return i.node(o).canReplaceWith(a,a,h?h.type:i.node(o+1).type)}function l0t(e,t,n=1,s){let i=e.doc.resolve(t),o=wn.empty,l=wn.empty;for(let a=i.depth,h=i.depth-n,p=n-1;a>h;a--,p--){o=wn.from(i.node(a).copy(o));let x=s&&s[p];l=wn.from(x?x.type.create(x.attrs,l):i.node(a).copy(l))}e.step(new od(t,t,new fs(o.append(l),n,n),!0))}function lv(e,t){let n=e.resolve(t),s=n.index();return KRe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function c0t(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:s}=e.type.schema;for(let i=0;i0?(o=s.node(i+1),a++,l=s.node(i).maybeChild(a)):(o=s.node(i).maybeChild(a-1),l=s.node(i+1)),o&&!o.isTextblock&&KRe(o,l)&&s.node(i).canReplace(a,a+1))return t;if(i==0)break;t=n<0?s.before(i):s.after(i)}}function d0t(e,t,n){let s=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),l=o.node().type;if(i&&l.inlineContent){let x=l.whitespace=="pre",y=!!l.contentMatch.matchType(i);x&&!y?s=!1:!x&&y&&(s=!0)}let a=e.steps.length;if(s===!1){let x=e.doc.resolve(t+n);GRe(e,x.node(),x.before(),a)}l.inlineContent&&qxe(e,t+n-1,l,o.node().contentMatchAt(o.index()),s==null);let h=e.mapping.slice(a),p=h.map(t-n);if(e.step(new od(p,h.map(t+n,-1),fs.empty,!0)),s===!0){let x=e.doc.resolve(p);WRe(e,x.node(),x.before(),e.steps.length)}return e}function u0t(e,t,n){let s=e.resolve(t);if(s.parent.canReplaceWith(s.index(),s.index(),n))return t;if(s.parentOffset==0)for(let i=s.depth-1;i>=0;i--){let o=s.index(i);if(s.node(i).canReplaceWith(o,o,n))return s.before(i+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let i=s.depth-1;i>=0;i--){let o=s.indexAfter(i);if(s.node(i).canReplaceWith(o,o,n))return s.after(i+1);if(o=0;l--){let a=l==s.depth?0:s.pos<=(s.start(l+1)+s.end(l+1))/2?-1:1,h=s.index(l)+(a>0?1:0),p=s.node(l),x=!1;if(o==1)x=p.canReplace(h,h,i);else{let y=p.contentMatchAt(h).findWrapping(i.firstChild.type);x=y&&p.canReplaceWith(h,h,y[0])}if(x)return a==0?s.pos:a<0?s.before(l+1):s.after(l+1)}return null}function Dse(e,t,n=t,s=fs.empty){if(t==n&&!s.size)return null;let i=e.resolve(t),o=e.resolve(n);return YRe(i,o,s)?new od(t,n,s):new h0t(i,o,s).fit()}function YRe(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class h0t{constructor(t,n,s){this.$from=t,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=wn.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=wn.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let p=this.findFittable();p?this.placeNodes(p):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,i=this.close(t<0?this.$to:s.doc.resolve(t));if(!i)return null;let o=this.placed,l=s.depth,a=i.depth;for(;l&&a&&o.childCount==1;)o=o.firstChild.content,l--,a--;let h=new fs(o,l,a);return t>-1?new md(s.pos,t,this.$to.pos,this.$to.end(),h,n):h.size||s.pos!=this.$to.pos?new od(s.pos,i.pos,h):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,i=this.unplaced.openEnd;s1&&(i=0),o.type.spec.isolating&&i<=s){t=s;break}n=o.content}for(let n=1;n<=2;n++)for(let s=n==1?t:this.unplaced.openStart;s>=0;s--){let i,o=null;s?(o=uce(this.unplaced.content,s-1).firstChild,i=o.content):i=this.unplaced.content;let l=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:h,match:p}=this.frontier[a],x,y=null;if(n==1&&(l?p.matchType(l.type)||(y=p.fillBefore(wn.from(l),!1)):o&&h.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:a,parent:o,inject:y};if(n==2&&l&&(x=p.findWrapping(l.type)))return{sliceDepth:s,frontierDepth:a,parent:o,wrap:x};if(o&&p.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:s}=this.unplaced,i=uce(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new fs(t,n+1,Math.max(s,i.size+n>=t.size-s?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:s}=this.unplaced,i=uce(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new fs(fT(t,n-1,1),n-1,o?n-1:s)}else this.unplaced=new fs(fT(t,n,1),n,s)}placeNodes({sliceDepth:t,frontierDepth:n,parent:s,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let C=0;C1||h==0||C.content.size)&&(y=A,x.push(XRe(C.mark(b.allowedMarks(C.marks)),p==1?h:0,p==a.childCount?j:-1)))}let N=p==a.childCount;N||(j=-1),this.placed=pT(this.placed,n,wn.from(x)),this.frontier[n].match=y,N&&j<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let C=0,A=a;C1&&i==this.$to.end(--s);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:s,type:i}=this.frontier[n],o=n=0;a--){let{match:h,type:p}=this.frontier[a],x=hce(t,a,p,h,!0);if(!x||x.childCount)continue e}return{depth:n,fit:l,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=pT(this.placed,n.depth,n.fit)),t=n.move;for(let s=n.depth+1;s<=t.depth;s++){let i=t.node(s),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(s));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,s){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=pT(this.placed,this.depth,wn.from(t.create(n,s))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(wn.empty,!0);n.childCount&&(this.placed=pT(this.placed,this.frontier.length,n))}}function fT(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(fT(e.firstChild.content,t-1,n)))}function pT(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(pT(e.lastChild.content,t-1,n)))}function uce(e,t){for(let n=0;n1&&(s=s.replaceChild(0,XRe(s.firstChild,t-1,s.childCount==1?n-1:0))),t>0&&(s=e.type.contentMatch.fillBefore(s).append(s),n<=0&&(s=s.append(e.type.contentMatch.matchFragment(s).fillBefore(wn.empty,!0)))),e.copy(s)}function hce(e,t,n,s,i){let o=e.node(t),l=i?e.indexAfter(t):e.index(t);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let a=s.fillBefore(o.content,!0,l);return a&&!f0t(n,o.content,l)?a:null}function f0t(e,t,n){for(let s=n;s0;b--,j--){let N=i.node(b).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;l.indexOf(b)>-1?a=b:i.before(b)==j&&l.splice(1,0,-b)}let h=l.indexOf(a),p=[],x=s.openStart;for(let b=s.content,j=0;;j++){let N=b.firstChild;if(p.push(N),j==s.openStart)break;b=N.content}for(let b=x-1;b>=0;b--){let j=p[b],N=p0t(j.type);if(N&&!j.sameMarkup(i.node(Math.abs(a)-1)))x=b;else if(N||!j.type.isTextblock)break}for(let b=s.openStart;b>=0;b--){let j=(b+x+1)%(s.openStart+1),N=p[j];if(N)for(let C=0;C=0&&(e.replace(t,n,s),!(e.steps.length>y));b--){let j=l[b];j<0||(t=i.before(j),n=o.after(j))}}function QRe(e,t,n,s,i){if(ts){let o=i.contentMatchAt(0),l=o.fillBefore(e).append(e);e=l.append(o.matchFragment(l).fillBefore(wn.empty,!0))}return e}function g0t(e,t,n,s){if(!s.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=u0t(e.doc,t,s.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new fs(wn.from(s),0,0))}function x0t(e,t,n){let s=e.doc.resolve(t),i=e.doc.resolve(n),o=JRe(s,i);for(let l=0;l0&&(h||s.node(a-1).canReplace(s.index(a-1),i.indexAfter(a-1))))return e.delete(s.before(a),i.after(a))}for(let l=1;l<=s.depth&&l<=i.depth;l++)if(t-s.start(l)==s.depth-l&&n>s.end(l)&&i.end(l)-n!=i.depth-l&&s.start(l-1)==i.start(l-1)&&s.node(l-1).canReplace(s.index(l-1),i.index(l-1)))return e.delete(s.before(l),n);e.delete(t,n)}function JRe(e,t){let n=[],s=Math.min(e.depth,t.depth);for(let i=s;i>=0;i--){let o=e.start(i);if(ot.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(o==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==o-1)&&n.push(i)}return n}class ES extends iu{constructor(t,n,s){super(),this.pos=t,this.attr=n,this.value=s}apply(t){let n=t.nodeAt(this.pos);if(!n)return Nc.fail("No node at attribute step's position");let s=Object.create(null);for(let o in n.attrs)s[o]=n.attrs[o];s[this.attr]=this.value;let i=n.type.create(s,null,n.marks);return Nc.fromReplace(t,this.pos,this.pos+1,new fs(wn.from(i),0,n.isLeaf?0:1))}getMap(){return Vh.empty}invert(t){return new ES(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ES(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ES(n.pos,n.attr,n.value)}}iu.jsonID("attr",ES);class uE extends iu{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let s=t.type.create(n,t.content,t.marks);return Nc.ok(s)}getMap(){return Vh.empty}invert(t){return new uE(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new uE(n.attr,n.value)}}iu.jsonID("docAttr",uE);let yC=class extends Error{};yC=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};yC.prototype=Object.create(Error.prototype);yC.prototype.constructor=yC;yC.prototype.name="TransformError";class eFe{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new dE}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new yC(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,s=fs.empty){let i=Dse(this.doc,t,n,s);return i&&this.step(i),this}replaceWith(t,n,s){return this.replace(t,n,new fs(wn.from(s),0,0))}delete(t,n){return this.replace(t,n,fs.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,s){return m0t(this,t,n,s),this}replaceRangeWith(t,n,s){return g0t(this,t,n,s),this}deleteRange(t,n){return x0t(this,t,n),this}lift(t,n){return t0t(this,t,n),this}join(t,n=1){return d0t(this,t,n),this}wrap(t,n){return s0t(this,t,n),this}setBlockType(t,n=t,s,i=null){return i0t(this,t,n,s,i),this}setNodeMarkup(t,n,s=null,i){return o0t(this,t,n,s,i),this}setNodeAttribute(t,n,s){return this.step(new ES(t,n,s)),this}setDocAttribute(t,n){return this.step(new uE(t,n)),this}addNodeMark(t,n){return this.step(new K0(t,n)),this}removeNodeMark(t,n){let s=this.doc.nodeAt(t);if(!s)throw new RangeError("No node at position "+t);if(n instanceof Ro)n.isInSet(s.marks)&&this.step(new Vj(t,n));else{let i=s.marks,o,l=[];for(;o=n.isInSet(i);)l.push(new Vj(t,o)),i=o.removeFromSet(i);for(let a=l.length-1;a>=0;a--)this.step(l[a])}return this}split(t,n=1,s){return l0t(this,t,n,s),this}addMark(t,n,s){return Qyt(this,t,n,s),this}removeMark(t,n,s){return Jyt(this,t,n,s),this}clearIncompatible(t,n,s){return qxe(this,t,n,s),this}}const fce=Object.create(null);class la{constructor(t,n,s){this.$anchor=t,this.$head=n,this.ranges=s||[new y0t(t.min(n),t.max(n))]}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 t=this.ranges;for(let n=0;n=0;o--){let l=n<0?b4(t.node(0),t.node(o),t.before(o+1),t.index(o),n,s):b4(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,s);if(l)return l}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new tf(t.node(0))}static atStart(t){return b4(t,t,0,0,1)||new tf(t)}static atEnd(t){return b4(t,t,t.content.size,t.childCount,-1)||new tf(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=fce[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(t,n)}static jsonID(t,n){if(t in fce)throw new RangeError("Duplicate use of selection JSON ID "+t);return fce[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Ui.between(this.$anchor,this.$head).getBookmark()}}la.prototype.visible=!0;class y0t{constructor(t,n){this.$from=t,this.$to=n}}let Qke=!1;function Jke(e){!Qke&&!e.parent.inlineContent&&(Qke=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Ui extends la{constructor(t,n=t){Jke(t),Jke(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let s=t.resolve(n.map(this.head));if(!s.parent.inlineContent)return la.near(s);let i=t.resolve(n.map(this.anchor));return new Ui(i.parent.inlineContent?i:s,s)}replace(t,n=fs.empty){if(super.replace(t,n),n==fs.empty){let s=this.$from.marksAcross(this.$to);s&&t.ensureMarks(s)}}eq(t){return t instanceof Ui&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Rse(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ui(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,s=n){let i=t.resolve(n);return new this(i,s==n?i:t.resolve(s))}static between(t,n,s){let i=t.pos-n.pos;if((!s||i)&&(s=i>=0?1:-1),!n.parent.inlineContent){let o=la.findFrom(n,s,!0)||la.findFrom(n,-s,!0);if(o)n=o.$head;else return la.near(n,s)}return t.parent.inlineContent||(i==0?t=n:(t=(la.findFrom(t,-s,!0)||la.findFrom(t,s,!0)).$anchor,t.pos0?0:1);i>0?l=0;l+=i){let a=t.child(l);if(a.isAtom){if(!o&&si.isSelectable(a))return si.create(e,n-(i<0?a.nodeSize:0))}else{let h=b4(e,a,n+i,i<0?a.childCount:0,i,o);if(h)return h}n+=a.nodeSize*i}return null}function eNe(e,t,n){let s=e.steps.length-1;if(s{l==null&&(l=x)}),e.setSelection(la.near(e.doc.resolve(l),n))}const tNe=1,TL=2,rNe=4;class _0t extends eFe{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=TL,this}ensureMarks(t){return Ro.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&TL)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~TL,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let s=this.selection;return n&&(t=t.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||Ro.none))),s.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,s){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(s==null&&(s=n),!t)return this.deleteRange(n,s);let o=this.storedMarks;if(!o){let l=this.doc.resolve(n);o=s==n?l.marks():l.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(n,s,i.text(t,o)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(la.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=rNe,this}get scrolledIntoView(){return(this.updated&rNe)>0}}function nNe(e,t){return!t||!e?e:e.bind(t)}class mT{constructor(t,n,s){this.name=t,this.init=nNe(n.init,s),this.apply=nNe(n.apply,s)}}const b0t=[new mT("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new mT("selection",{init(e,t){return e.selection||la.atStart(t.doc)},apply(e){return e.selection}}),new mT("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,s){return s.selection.$cursor?e.storedMarks:null}}),new mT("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class pce{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=b0t.slice(),n&&n.forEach(s=>{if(this.pluginsByKey[s.key])throw new RangeError("Adding different instances of a keyed plugin ("+s.key+")");this.plugins.push(s),this.pluginsByKey[s.key]=s,s.spec.state&&this.fields.push(new mT(s.key,s.spec.state,s))})}}class D4{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let s=0;ss.toJSON())),t&&typeof t=="object")for(let s in t){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[s],o=i.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,s){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new pce(t.schema,t.plugins),o=new D4(i);return i.fields.forEach(l=>{if(l.name=="doc")o.doc=C1.fromJSON(t.schema,n.doc);else if(l.name=="selection")o.selection=la.fromJSON(o.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(s)for(let a in s){let h=s[a],p=h.spec.state;if(h.key==l.name&&p&&p.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[l.name]=p.fromJSON.call(h,t,n[a],o);return}}o[l.name]=l.init(t,o)}}),o}}function tFe(e,t,n){for(let s in e){let i=e[s];i instanceof Function?i=i.bind(t):s=="handleDOMEvents"&&(i=tFe(i,t,{})),n[s]=i}return n}class zd{constructor(t){this.spec=t,this.props={},t.props&&tFe(t.props,this,this.props),this.key=t.key?t.key.key:rFe("plugin")}getState(t){return t[this.key]}}const mce=Object.create(null);function rFe(e){return e in mce?e+"$"+ ++mce[e]:(mce[e]=0,e+"$")}class df{constructor(t="key"){this.key=rFe(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Id=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},vC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let zhe=null;const kx=function(e,t,n){let s=zhe||(zhe=document.createRange());return s.setEnd(e,n??e.nodeValue.length),s.setStart(e,t||0),s},w0t=function(){zhe=null},Hj=function(e,t,n,s){return n&&(sNe(e,t,n,s,-1)||sNe(e,t,n,s,1))},j0t=/^(img|br|input|textarea|hr)$/i;function sNe(e,t,n,s,i){for(var o;;){if(e==n&&t==s)return!0;if(t==(i<0?0:Ff(e))){let l=e.parentNode;if(!l||l.nodeType!=1||OI(e)||j0t.test(e.nodeName)||e.contentEditable=="false")return!1;t=Id(e)+(i<0?0:1),e=l}else if(e.nodeType==1){let l=e.childNodes[t+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)t+=i;else return!1;else e=l,t=i<0?Ff(e):0}else return!1}}function Ff(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function k0t(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Ff(e)}else if(e.parentNode&&!OI(e))t=Id(e),e=e.parentNode;else return null}}function N0t(e,t){for(;;){if(e.nodeType==3&&t2),Pf=_C||(Lg?/Mac/.test(Lg.platform):!1),iFe=Lg?/Win/.test(Lg.platform):!1,Dx=/Android \d/.test(cv),DI=!!iNe&&"webkitFontSmoothing"in iNe.documentElement.style,T0t=DI?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function A0t(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function gx(e,t){return typeof e=="number"?e:e[t]}function E0t(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,s=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*s}}function aNe(e,t,n){let s=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(l.nodeType!=1){l=vC(l);continue}let a=l,h=a==o.body,p=h?A0t(o):E0t(a),x=0,y=0;if(t.topp.bottom-gx(s,"bottom")&&(y=t.bottom-t.top>p.bottom-p.top?t.top+gx(i,"top")-p.top:t.bottom-p.bottom+gx(i,"bottom")),t.leftp.right-gx(s,"right")&&(x=t.right-p.right+gx(i,"right")),x||y)if(h)o.defaultView.scrollBy(x,y);else{let j=a.scrollLeft,N=a.scrollTop;y&&(a.scrollTop+=y),x&&(a.scrollLeft+=x);let C=a.scrollLeft-j,A=a.scrollTop-N;t={left:t.left-C,top:t.top-A,right:t.right-C,bottom:t.bottom-A}}let b=h?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(b))break;l=b=="absolute"?l.offsetParent:vC(l)}}function I0t(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),s,i;for(let o=(t.left+t.right)/2,l=n+1;l=n-20){s=a,i=h.top;break}}return{refDOM:s,refTop:i,stack:aFe(e.dom)}}function aFe(e){let t=[],n=e.ownerDocument;for(let s=e;s&&(t.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),e!=n);s=vC(s));return t}function P0t({refDOM:e,refTop:t,stack:n}){let s=e?e.getBoundingClientRect().top:0;oFe(n,s==0?0:s-t)}function oFe(e,t){for(let n=0;n=a){l=Math.max(N.bottom,l),a=Math.min(N.top,a);let C=N.left>t.left?N.left-t.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>t.top&&!h&&N.left<=t.left&&N.right>=t.left&&(h=x,p={left:Math.max(N.left,Math.min(N.right,t.left)),top:N.top});!n&&(t.left>=N.right&&t.top>=N.top||t.left>=N.left&&t.top>=N.bottom)&&(o=y+1)}}return!n&&h&&(n=h,i=p,s=0),n&&n.nodeType==3?O0t(n,i):!n||s&&n.nodeType==1?{node:e,offset:o}:lFe(n,i)}function O0t(e,t){let n=e.nodeValue.length,s=document.createRange(),i;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return s.detach(),i||{node:e,offset:0}}function Wxe(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function D0t(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left(l.left+l.right)/2?1:-1}return e.docView.posFromDOM(s,i,o)}function F0t(e,t,n,s){let i=-1;for(let o=t,l=!1;o!=e.dom;){let a=e.docView.nearestDesc(o,!0),h;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((h=a.dom.getBoundingClientRect()).width||h.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!l&&h.left>s.left||h.top>s.top?i=a.posBefore:(!l&&h.right-1?i:e.docView.posFromDOM(t,n,-1)}function cFe(e,t,n){let s=e.childNodes.length;if(s&&n.topt.top&&i++}let p;DI&&i&&s.nodeType==1&&(p=s.childNodes[i-1]).nodeType==1&&p.contentEditable=="false"&&p.getBoundingClientRect().top>=t.top&&i--,s==e.dom&&i==s.childNodes.length-1&&s.lastChild.nodeType==1&&t.top>s.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(i==0||s.nodeType!=1||s.childNodes[i-1].nodeName!="BR")&&(a=F0t(e,s,i,t))}a==null&&(a=R0t(e,l,t));let h=e.docView.nearestDesc(l,!0);return{pos:a,inside:h?h.posAtStart-h.border:-1}}function oNe(e){return e.top=0&&i==s.nodeValue.length?(h--,x=1):n<0?h--:p++,qM(u0(kx(s,h,p),x),x<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==Ff(s))){let h=s.childNodes[i-1];if(h.nodeType==1)return gce(h.getBoundingClientRect(),!1)}if(o==null&&i=0)}if(o==null&&i&&(n<0||i==Ff(s))){let h=s.childNodes[i-1],p=h.nodeType==3?kx(h,Ff(h)-(l?0:1)):h.nodeType==1&&(h.nodeName!="BR"||!h.nextSibling)?h:null;if(p)return qM(u0(p,1),!1)}if(o==null&&i=0)}function qM(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function gce(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function uFe(e,t,n){let s=e.state,i=e.root.activeElement;s!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{s!=t&&e.updateState(s),i!=e.dom&&i&&i.focus()}}function $0t(e,t,n){let s=t.selection,i=n=="up"?s.$from:s.$to;return uFe(e,t,()=>{let{node:o}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let l=dFe(e,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let h;if(a.nodeType==1)h=a.getClientRects();else if(a.nodeType==3)h=kx(a,0,a.nodeValue.length).getClientRects();else continue;for(let p=0;px.top+1&&(n=="up"?l.top-x.top>(x.bottom-l.top)*2:x.bottom-l.bottom>(l.bottom-x.top)*2))return!1}}return!0})}const U0t=/[\u0590-\u08ac]/;function q0t(e,t,n){let{$head:s}=t.selection;if(!s.parent.isTextblock)return!1;let i=s.parentOffset,o=!i,l=i==s.parent.content.size,a=e.domSelection();return a?!U0t.test(s.parent.textContent)||!a.modify?n=="left"||n=="backward"?o:l:uFe(e,t,()=>{let{focusNode:h,focusOffset:p,anchorNode:x,anchorOffset:y}=e.domSelectionRange(),b=a.caretBidiLevel;a.modify("move",n,"character");let j=s.depth?e.docView.domAfterPos(s.before()):e.dom,{focusNode:N,focusOffset:C}=e.domSelectionRange(),A=N&&!j.contains(N.nodeType==1?N:N.parentNode)||h==N&&p==C;try{a.collapse(x,y),h&&(h!=x||p!=y)&&a.extend&&a.extend(h,p)}catch{}return b!=null&&(a.caretBidiLevel=b),A}):s.pos==s.start()||s.pos==s.end()}let lNe=null,cNe=null,dNe=!1;function V0t(e,t,n){return lNe==t&&cNe==n?dNe:(lNe=t,cNe=n,dNe=n=="up"||n=="down"?$0t(e,t,n):q0t(e,t,n))}const Qf=0,uNe=1,qw=2,Og=3;class RI{constructor(t,n,s,i){this.parent=t,this.children=n,this.dom=s,this.contentDOM=i,this.dirty=Qf,s.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,s){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;nId(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??s>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let s=!0,i=t;i;i=i.parentNode){let o=this.getDesc(i),l;if(o&&(!n||o.node))if(s&&(l=o.nodeDOM)&&!(l.nodeType==1?l.contains(t.nodeType==1?t:t.parentNode):l==t))s=!1;else return o}}getDesc(t){let n=t.pmViewDesc;for(let s=n;s;s=s.parent)if(s==this)return n}posFromDOM(t,n,s){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,n,s)}return-1}descAt(t){for(let n=0,s=0;nt||l instanceof fFe){i=t-o;break}o=a}if(i)return this.children[s].domFromPos(i-this.children[s].border,n);for(let o;s&&!(o=this.children[s-1]).size&&o instanceof hFe&&o.side>=0;s--);if(n<=0){let o,l=!0;for(;o=s?this.children[s-1]:null,!(!o||o.dom.parentNode==this.contentDOM);s--,l=!1);return o&&n&&l&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?Id(o.dom)+1:0}}else{let o,l=!0;for(;o=s=x&&n<=p-h.border&&h.node&&h.contentDOM&&this.contentDOM.contains(h.contentDOM))return h.parseRange(t,n,x);t=l;for(let y=a;y>0;y--){let b=this.children[y-1];if(b.size&&b.dom.parentNode==this.contentDOM&&!b.emptyChildAt(1)){i=Id(b.dom)+1;break}t-=b.size}i==-1&&(i=0)}if(i>-1&&(p>n||a==this.children.length-1)){n=p;for(let x=a+1;xN&&ln){let N=a;a=h,h=N}let j=document.createRange();j.setEnd(h.node,h.offset),j.setStart(a.node,a.offset),p.removeAllRanges(),p.addRange(j)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let s=0,i=0;i=s:ts){let a=s+o.border,h=l-o.border;if(t>=a&&n<=h){this.dirty=t==s||n==l?qw:uNe,t==a&&n==h&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Og:o.markDirty(t-a,n-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?qw:Og}s=l}this.dirty=qw}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let s=t==1?qw:uNe;n.dirty{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(l.nodeType!=1){let a=document.createElement("span");a.appendChild(l),l=a}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(t,[],l,null),this.widget=n,this.widget=n,o=this}matchesWidget(t){return this.dirty==Qf&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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 H0t extends RI{constructor(t,n,s,i){super(t,[],n,null),this.textDOM=s,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Wj extends RI{constructor(t,n,s,i,o){super(t,[],s,i),this.mark=n,this.spec=o}static create(t,n,s,i){let o=i.nodeViews[n.type.name],l=o&&o(n,i,s);return(!l||!l.dom)&&(l=ok.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new Wj(t,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Og||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Og&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Qf){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=Vhe(o,0,t,s));for(let a=0;a{if(!h)return l;if(h.parent)return h.parent.posBeforeChild(h)},s,i),x=p&&p.dom,y=p&&p.contentDOM;if(n.isText){if(!x)x=document.createTextNode(n.text);else if(x.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else x||({dom:x,contentDOM:y}=ok.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!y&&!n.isText&&x.nodeName!="BR"&&(x.hasAttribute("contenteditable")||(x.contentEditable="false"),n.type.spec.draggable&&(x.draggable=!0));let b=x;return x=gFe(x,s,n),p?h=new W0t(t,n,s,i,x,y||null,b,p,o,l+1):n.isText?new zse(t,n,s,i,x,b,o):new T1(t,n,s,i,x,y||null,b,o,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let s=this.children[n];if(this.dom.contains(s.dom.parentNode)){t.contentElement=s.dom.parentNode;break}}t.contentElement||(t.getContent=()=>wn.empty)}return t}matchesNode(t,n,s){return this.dirty==Qf&&t.eq(this.node)&&Ete(n,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let s=this.node.inlineContent,i=n,o=t.composing?this.localCompositionInfo(t,n):null,l=o&&o.pos>-1?o:null,a=o&&o.pos<0,h=new K0t(this,l&&l.node,t);X0t(this.node,this.innerDeco,(p,x,y)=>{p.spec.marks?h.syncToMarks(p.spec.marks,s,t):p.type.side>=0&&!y&&h.syncToMarks(x==this.node.childCount?Ro.none:this.node.child(x).marks,s,t),h.placeWidget(p,t,i)},(p,x,y,b)=>{h.syncToMarks(p.marks,s,t);let j;h.findNodeMatch(p,x,y,b)||a&&t.state.selection.from>i&&t.state.selection.to-1&&h.updateNodeAt(p,x,y,j,t)||h.updateNextNode(p,x,y,t,b,i)||h.addNode(p,x,y,t,i),i+=p.nodeSize}),h.syncToMarks([],s,t),this.node.isTextblock&&h.addTextblockHacks(),h.destroyRest(),(h.changed||this.dirty==qw)&&(l&&this.protectLocalComposition(t,l),pFe(this.contentDOM,this.children,t),_C&&Q0t(this.dom))}localCompositionInfo(t,n){let{from:s,to:i}=t.state.selection;if(!(t.state.selection instanceof Ui)||sn+this.node.content.size)return null;let o=t.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,a=J0t(this.node.content,l,s-n,i-n);return a<0?null:{node:o,pos:a,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:s,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let l=new H0t(this,o,n,i);t.input.compositionNodes.push(l),this.children=Vhe(this.children,s,s+i.length,t,l)}update(t,n,s,i){return this.dirty==Og||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,s,i),!0)}updateInner(t,n,s,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=s,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Qf}updateOuterDeco(t){if(Ete(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=mFe(this.dom,this.nodeDOM,qhe(this.outerDeco,this.node,n),qhe(t,this.node,n)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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}}function hNe(e,t,n,s,i){gFe(s,t,e);let o=new T1(void 0,e,t,n,s,s,s,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class zse extends T1{constructor(t,n,s,i,o,l,a){super(t,n,s,i,o,null,l,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,s,i){return this.dirty==Og||this.dirty!=Qf&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Qf||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=Qf,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,s){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,s)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,s){let i=this.node.cut(t,n),o=document.createTextNode(i.text);return new zse(this.parent,i,this.outerDeco,this.innerDeco,o,o,s)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Og)}get domAtom(){return!1}isText(t){return this.node.text==t}}class fFe extends RI{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Qf&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class W0t extends T1{constructor(t,n,s,i,o,l,a,h,p,x){super(t,n,s,i,o,l,a,p,x),this.spec=h}update(t,n,s,i){if(this.dirty==Og)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,n,s);return o&&this.updateInner(t,n,s,i),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,s,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,s,i){this.spec.setSelection?this.spec.setSelection(t,n,s.root):super.setSelection(t,n,s,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function pFe(e,t,n){let s=e.firstChild,i=!1;for(let o=0;o>1,l=Math.min(o,t.length);for(;i-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let h=Wj.create(this.top,t[o],n,s);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,s,i){let o=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(t,n,s))o=this.top.children.indexOf(l,this.index);else for(let a=this.index,h=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(s){let p=n.children[s-1];if(p instanceof Wj)n=p,s=p.children.length;else{a=p,s--;break}}else{if(n==t)break e;s=n.parent.children.indexOf(n),n=n.parent}let h=a.node;if(h){if(h!=e.child(i-1))break;--i,o.set(a,i),l.push(a)}}return{index:i,matched:o,matches:l.reverse()}}function Y0t(e,t){return e.type.side-t.type.side}function X0t(e,t,n,s){let i=t.locals(e),o=0;if(i.length==0){for(let p=0;po;)a.push(i[l++]);let N=o+b.nodeSize;if(b.isText){let A=N;l!A.inline):a.slice();s(b,C,t.forChild(o,b),j),o=N}}function Q0t(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function J0t(e,t,n,s){for(let i=0,o=0;i=n){if(o>=s&&h.slice(s-t.length-a,s-a)==t)return s-t.length;let p=a=0&&p+t.length+a>=n)return a+p;if(n==s&&h.length>=s+t.length-a&&h.slice(s-a,s-a+t.length)==t)return s}}return-1}function Vhe(e,t,n,s,i){let o=[];for(let l=0,a=0;l=n||x<=t?o.push(h):(pn&&o.push(h.slice(n-p,h.size,s)))}return o}function Gxe(e,t=null){let n=e.domSelectionRange(),s=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&i.size==0,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let a=s.resolve(l),h,p;if(Fse(n)){for(h=l;i&&!i.node;)i=i.parent;let y=i.node;if(i&&y.isAtom&&si.isSelectable(y)&&i.parent&&!(y.isInline&&S0t(n.focusNode,n.focusOffset,i.dom))){let b=i.posBefore;p=new si(l==b?a:s.resolve(b))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let y=l,b=l;for(let j=0;j{(n.anchorNode!=s||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!xFe(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function t1t(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,s=n.nodeName=="IMG";s?t.collapse(n.parentNode,Id(n)+1):t.collapse(n,0),!s&&!e.state.selection.visible&&_h&&M1<=11&&(n.disabled=!0,n.disabled=!1)}function yFe(e,t){if(t instanceof si){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(xNe(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else xNe(e)}function xNe(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Kxe(e,t,n,s){return e.someProp("createSelectionBetween",i=>i(e,t,n))||Ui.between(t,n,s)}function yNe(e){return e.editable&&!e.hasFocus()?!1:vFe(e)}function vFe(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function r1t(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Hj(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Hhe(e,t){let{$anchor:n,$head:s}=e.selection,i=t>0?n.max(s):n.min(s),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&la.findFrom(o,t)}function _0(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function vNe(e,t,n){let s=e.state.selection;if(s instanceof Ui)if(n.indexOf("s")>-1){let{$head:i}=s,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=e.state.doc.resolve(i.pos+o.nodeSize*(t<0?-1:1));return _0(e,new Ui(s.$anchor,l))}else if(s.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=Hhe(e.state,t);return i&&i instanceof si?_0(e,i):!1}else if(!(Pf&&n.indexOf("m")>-1)){let i=s.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,l;if(!o||o.isText)return!1;let a=t<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(l=e.docView.descAt(a))&&!l.contentDOM?si.isSelectable(o)?_0(e,new si(t<0?e.state.doc.resolve(i.pos-o.nodeSize):i)):DI?_0(e,new Ui(e.state.doc.resolve(t<0?a:a+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof si&&s.node.isInline)return _0(e,new Ui(t>0?s.$to:s.$from));{let i=Hhe(e.state,t);return i?_0(e,i):!1}}}function Ite(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function mA(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function d4(e,t){return t<0?n1t(e):s1t(e)}function n1t(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let i,o,l=!1;for(Xf&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let a=n.childNodes[s-1];if(mA(a,-1))i=n,o=--s;else if(a.nodeType==3)n=a,s=n.nodeValue.length;else break}}else{if(_Fe(n))break;{let a=n.previousSibling;for(;a&&mA(a,-1);)i=n.parentNode,o=Id(a),a=a.previousSibling;if(a)n=a,s=Ite(n);else{if(n=n.parentNode,n==e.dom)break;s=0}}}l?Whe(e,n,s):i&&Whe(e,i,o)}function s1t(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let i=Ite(n),o,l;for(;;)if(s{e.state==i&&Xx(e)},50)}function _Ne(e,t){let n=e.state.doc.resolve(t);if(!(cd||iFe)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),l=(o.top+o.bottom)/2;if(l>i.top&&l1)return o.lefti.top&&l1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function bNe(e,t,n){let s=e.state.selection;if(s instanceof Ui&&!s.empty||n.indexOf("s")>-1||Pf&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=s;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=Hhe(e.state,t);if(l&&l instanceof si)return _0(e,l)}if(!i.parent.inlineContent){let l=t<0?i:o,a=s instanceof tf?la.near(l,t):la.findFrom(l,t);return a?_0(e,a):!1}return!1}function wNe(e,t){if(!(e.state.selection instanceof Ui))return!0;let{$head:n,$anchor:s,empty:i}=e.state.selection;if(!n.sameParent(s))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let l=e.state.tr;return t<0?l.delete(n.pos-o.nodeSize,n.pos):l.delete(n.pos,n.pos+o.nodeSize),e.dispatch(l),!0}return!1}function jNe(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function o1t(e){if(!su||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let s=t.firstChild;jNe(e,s,"true"),setTimeout(()=>jNe(e,s,"false"),20)}return!1}function l1t(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function c1t(e,t){let n=t.keyCode,s=l1t(t);if(n==8||Pf&&n==72&&s=="c")return wNe(e,-1)||d4(e,-1);if(n==46&&!t.shiftKey||Pf&&n==68&&s=="c")return wNe(e,1)||d4(e,1);if(n==13||n==27)return!0;if(n==37||Pf&&n==66&&s=="c"){let i=n==37?_Ne(e,e.state.selection.from)=="ltr"?-1:1:-1;return vNe(e,i,s)||d4(e,i)}else if(n==39||Pf&&n==70&&s=="c"){let i=n==39?_Ne(e,e.state.selection.from)=="ltr"?1:-1:1;return vNe(e,i,s)||d4(e,i)}else{if(n==38||Pf&&n==80&&s=="c")return bNe(e,-1,s)||d4(e,-1);if(n==40||Pf&&n==78&&s=="c")return o1t(e)||bNe(e,1,s)||d4(e,1);if(s==(Pf?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Zxe(e,t){e.someProp("transformCopied",j=>{t=j(t,e)});let n=[],{content:s,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){i--,o--;let j=s.firstChild;n.push(j.type.name,j.attrs!=j.type.defaultAttrs?j.attrs:null),s=j.content}let l=e.someProp("clipboardSerializer")||ok.fromSchema(e.state.schema),a=SFe(),h=a.createElement("div");h.appendChild(l.serializeFragment(s,{document:a}));let p=h.firstChild,x,y=0;for(;p&&p.nodeType==1&&(x=NFe[p.nodeName.toLowerCase()]);){for(let j=x.length-1;j>=0;j--){let N=a.createElement(x[j]);for(;h.firstChild;)N.appendChild(h.firstChild);h.appendChild(N),y++}p=h.firstChild}p&&p.nodeType==1&&p.setAttribute("data-pm-slice",`${i} ${o}${y?` -${y}`:""} ${JSON.stringify(n)}`);let b=e.someProp("clipboardTextSerializer",j=>j(t,e))||t.content.textBetween(0,t.content.size,` `);return{dom:h,text:b,slice:t}}function bFe(e,t,n,s,i){let o=i.parent.type.spec.code,l,a;if(!n&&!t)return null;let h=!!t&&(s||o||!n);if(h){if(e.someProp("transformPastedText",b=>{t=b(t,o||s,e)}),o)return a=new fs(wn.from(e.state.schema.text(t.replace(/\r\n?/g,` `))),0,0),e.someProp("transformPasted",b=>{a=b(a,e,!0)}),a;let y=e.someProp("clipboardTextParser",b=>b(t,i,s,e));if(y)a=y;else{let b=i.marks(),{schema:j}=e.state,N=ok.fromSchema(j);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(C=>{let A=l.appendChild(document.createElement("p"));C&&A.appendChild(N.serializeNode(j.text(C,b)))})}}else e.someProp("transformPastedHTML",y=>{n=y(n,e)}),l=f1t(n),DI&&p1t(l);let p=l&&l.querySelector("[data-pm-slice]"),x=p&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute("data-pm-slice")||"");if(x&&x[3])for(let y=+x[3];y>0;y--){let b=l.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;l=b}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||hA.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(h||x),context:i,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!d1t.test(b.parentNode.nodeName)?{ignore:!0}:null}})),x)a=m1t(kNe(a,+x[1],+x[2]),x[4]);else if(a=fs.maxOpen(u1t(a.content,i),!0),a.openStart||a.openEnd){let y=0,b=0;for(let j=a.content.firstChild;y{a=y(a,e,h)}),a}const d1t=/^(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 u1t(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),o,l=[];if(e.forEach(a=>{if(!l)return;let h=i.findWrapping(a.type),p;if(!h)return l=null;if(p=l.length&&o.length&&jFe(h,o,a,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=kFe(l[l.length-1],o.length));let x=wFe(a,h);l.push(x),i=i.matchType(x.type),o=h}}),l)return wn.from(l)}return e}function wFe(e,t,n=0){for(let s=t.length-1;s>=n;s--)e=t[s].create(null,wn.from(e));return e}function jFe(e,t,n,s,i){if(i1&&(o=0),i=n&&(a=t<0?l.contentMatchAt(0).fillBefore(a,o<=i).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(wn.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(a))}function kNe(e,t,n){return tn})),yce.createHTML(e)):e}function f1t(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=SFe().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),i;if((i=s&&NFe[s[1].toLowerCase()])&&(e=i.map(o=>"<"+o+">").join("")+e+i.map(o=>"").reverse().join("")),n.innerHTML=h1t(e),i)for(let o=0;o=0;a-=2){let h=n.nodes[s[a]];if(!h||h.hasRequiredAttrs())break;i=wn.from(h.create(s[a+1],i)),o++,l++}return new fs(i,o,l)}const Fu={},zu={},g1t={touchstart:!0,touchmove:!0};class x1t{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function y1t(e){for(let t in Fu){let n=Fu[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=s=>{_1t(e,s)&&!Yxe(e,s)&&(e.editable||!(s.type in zu))&&n(e,s)},g1t[t]?{passive:!0}:void 0)}su&&e.dom.addEventListener("input",()=>null),Khe(e)}function Z0(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function v1t(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Khe(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=s=>Yxe(e,s))})}function Yxe(e,t){return e.someProp("handleDOMEvents",n=>{let s=n[t.type];return s?s(e,t)||t.defaultPrevented:!1})}function _1t(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function b1t(e,t){!Yxe(e,t)&&Fu[t.type]&&(e.editable||!(t.type in zu))&&Fu[t.type](e,t)}zu.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!MFe(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Dx&&cd&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),_C&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let s=Date.now();e.input.lastIOSEnter=s,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==s&&(e.someProp("handleKeyDown",i=>i(e,Lw(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",s=>s(e,n))||c1t(e,n)?n.preventDefault():Z0(e,"key")};zu.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};zu.keypress=(e,t)=>{let n=t;if(MFe(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Pf&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let s=e.state.selection;if(!(s instanceof Ui)||!s.$from.sameParent(s.$to)){let i=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",l=>l(e,s.$from.pos,s.$to.pos,i,o))&&e.dispatch(o()),n.preventDefault()}};function Bse(e){return{left:e.clientX,top:e.clientY}}function w1t(e,t){let n=t.x-e.clientX,s=t.y-e.clientY;return n*n+s*s<100}function Xxe(e,t,n,s,i){if(s==-1)return!1;let o=e.state.doc.resolve(s);for(let l=o.depth+1;l>0;l--)if(e.someProp(t,a=>l>o.depth?a(e,n,o.nodeAfter,o.before(l),i,!0):a(e,n,o.node(l),o.before(l),i,!1)))return!0;return!1}function IS(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let s=e.state.tr.setSelection(t);s.setMeta("pointer",!0),e.dispatch(s)}function j1t(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),s=n.nodeAfter;return s&&s.isAtom&&si.isSelectable(s)?(IS(e,new si(n)),!0):!1}function k1t(e,t){if(t==-1)return!1;let n=e.state.selection,s,i;n instanceof si&&(s=n.node);let o=e.state.doc.resolve(t);for(let l=o.depth+1;l>0;l--){let a=l>o.depth?o.nodeAfter:o.node(l);if(si.isSelectable(a)){s&&n.$from.depth>0&&l>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(l);break}}return i!=null?(IS(e,si.create(e.state.doc,i)),!0):!1}function N1t(e,t,n,s,i){return Xxe(e,"handleClickOn",t,n,s)||e.someProp("handleClick",o=>o(e,t,s))||(i?k1t(e,n):j1t(e,n))}function S1t(e,t,n,s){return Xxe(e,"handleDoubleClickOn",t,n,s)||e.someProp("handleDoubleClick",i=>i(e,t,s))}function C1t(e,t,n,s){return Xxe(e,"handleTripleClickOn",t,n,s)||e.someProp("handleTripleClick",i=>i(e,t,s))||M1t(e,n,s)}function M1t(e,t,n){if(n.button!=0)return!1;let s=e.state.doc;if(t==-1)return s.inlineContent?(IS(e,Ui.create(s,0,s.content.size)),!0):!1;let i=s.resolve(t);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(l.inlineContent)IS(e,Ui.create(s,a+1,a+1+l.content.size));else if(si.isSelectable(l))IS(e,si.create(s,a));else continue;return!0}}function Qxe(e){return Pte(e)}const CFe=Pf?"metaKey":"ctrlKey";Fu.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let s=Qxe(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&w1t(n,e.input.lastClick)&&!n[CFe]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let l=e.posAtCoords(Bse(n));l&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new T1t(e,l,n,!!s)):(o=="doubleClick"?S1t:C1t)(e,l.pos,l.inside,n)?n.preventDefault():Z0(e,"pointer"))};class T1t{constructor(t,n,s,i){this.view=t,this.pos=n,this.event=s,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!s[CFe],this.allowDefault=s.shiftKey;let o,l;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),l=n.inside;else{let x=t.state.doc.resolve(n.pos);o=x.parent,l=x.depth?x.before():0}const a=i?null:s.target,h=a?t.docView.nearestDesc(a,!0):null;this.target=h&&h.nodeDOM.nodeType==1?h.nodeDOM:null;let{selection:p}=t.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||p instanceof si&&p.from<=l&&p.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Xf&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Z0(t,"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(()=>Xx(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Bse(t))),this.updateAllowDefault(t),this.allowDefault||!n?Z0(this.view,"pointer"):N1t(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||su&&this.mightDrag&&!this.mightDrag.node.isAtom||cd&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(IS(this.view,la.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Z0(this.view,"pointer")}move(t){this.updateAllowDefault(t),Z0(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Fu.touchstart=e=>{e.input.lastTouch=Date.now(),Qxe(e),Z0(e,"pointer")};Fu.touchmove=e=>{e.input.lastTouch=Date.now(),Z0(e,"pointer")};Fu.contextmenu=e=>Qxe(e);function MFe(e,t){return e.composing?!0:su&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const A1t=Dx?5e3:-1;zu.compositionstart=zu.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Ui&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||cd&&iFe&&E1t(e)))e.markCursor=e.state.storedMarks||n.marks(),Pte(e,!0),e.markCursor=null;else if(Pte(e,!t.selection.empty),Xf&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=e.domSelectionRange();for(let i=s.focusNode,o=s.focusOffset;i&&i.nodeType==1&&o!=0;){let l=o<0?i.lastChild:i.childNodes[o-1];if(!l)break;if(l.nodeType==3){let a=e.domSelection();a&&a.collapse(l,l.nodeValue.length);break}else i=l,o=-1}}e.input.composing=!0}TFe(e,A1t)};function E1t(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let s=t.childNodes[n];return s.nodeType==1&&s.contentEditable=="false"}zu.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,TFe(e,20))};function TFe(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Pte(e),t))}function AFe(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=P1t());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function I1t(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=k0t(t.focusNode,t.focusOffset),s=N0t(t.focusNode,t.focusOffset);if(n&&s&&n!=s){let i=s.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||s==o)return o;if(!i||!i.isText(s.nodeValue))return s;if(e.input.compositionNode==s){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return s}}return n||s}function P1t(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Pte(e,t=!1){if(!(Dx&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),AFe(e),t||e.docView&&e.docView.dirty){let n=Gxe(e),s=e.state.selection;return n&&!n.eq(s)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function L1t(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),s.removeAllRanges(),s.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const hE=_h&&M1<15||_C&&T0t<604;Fu.copy=zu.cut=(e,t)=>{let n=t,s=e.state.selection,i=n.type=="cut";if(s.empty)return;let o=hE?null:n.clipboardData,l=s.content(),{dom:a,text:h}=Zxe(e,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",h)):L1t(e,a),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function O1t(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function D1t(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,s=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(s.contentEditable="true"),s.style.cssText="position: fixed; left: -10000px; top: 10px",s.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),s.parentNode&&s.parentNode.removeChild(s),n?fE(e,s.value,null,i,t):fE(e,s.textContent,s.innerHTML,i,t)},50)}function fE(e,t,n,s,i){let o=bFe(e,t,n,s,e.state.selection.$from);if(e.someProp("handlePaste",h=>h(e,i,o||fs.empty)))return!0;if(!o)return!1;let l=O1t(o),a=l?e.state.tr.replaceSelectionWith(l,s):e.state.tr.replaceSelection(o);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function EFe(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}zu.paste=(e,t)=>{let n=t;if(e.composing&&!Dx)return;let s=hE?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;s&&fE(e,EFe(s),s.getData("text/html"),i,n)?n.preventDefault():D1t(e,n)};class IFe{constructor(t,n,s){this.slice=t,this.move=n,this.node=s}}const R1t=Pf?"altKey":"ctrlKey";function PFe(e,t){let n=e.someProp("dragCopies",s=>!s(t));return n??!t[R1t]}Fu.dragstart=(e,t)=>{let n=t,s=e.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(Bse(n)),l;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof si?i.to-1:i.to))){if(s&&s.mightDrag)l=si.create(e.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let y=e.docView.nearestDesc(n.target,!0);y&&y.node.type.spec.draggable&&y!=e.docView&&(l=si.create(e.state.doc,y.posBefore))}}let a=(l||e.state.selection).content(),{dom:h,text:p,slice:x}=Zxe(e,a);(!n.dataTransfer.files.length||!cd||sFe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(hE?"Text":"text/html",h.innerHTML),n.dataTransfer.effectAllowed="copyMove",hE||n.dataTransfer.setData("text/plain",p),e.dragging=new IFe(x,PFe(e,n),l)};Fu.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};zu.dragover=zu.dragenter=(e,t)=>t.preventDefault();zu.drop=(e,t)=>{try{F1t(e,t,e.dragging)}finally{e.dragging=null}};function F1t(e,t,n){if(!t.dataTransfer)return;let s=e.posAtCoords(Bse(t));if(!s)return;let i=e.state.doc.resolve(s.pos),o=n&&n.slice;o?e.someProp("transformPasted",j=>{o=j(o,e,!1)}):o=bFe(e,EFe(t.dataTransfer),hE?null:t.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&PFe(e,t));if(e.someProp("handleDrop",j=>j(e,t,o||fs.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?ZRe(e.state.doc,i.pos,o):i.pos;a==null&&(a=i.pos);let h=e.state.tr;if(l){let{node:j}=n;j?j.replace(h):h.deleteSelection()}let p=h.mapping.map(a),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=h.doc;if(x?h.replaceRangeWith(p,p,o.content.firstChild):h.replaceRange(p,p,o),h.doc.eq(y))return;let b=h.doc.resolve(p);if(x&&si.isSelectable(o.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(o.content.firstChild))h.setSelection(new si(b));else{let j=h.mapping.map(a);h.mapping.maps[h.mapping.maps.length-1].forEach((N,C,A,E)=>j=E),h.setSelection(Kxe(e,b,h.doc.resolve(j)))}e.focus(),e.dispatch(h.setMeta("uiEvent","drop"))}Fu.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Xx(e)},20))};Fu.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Fu.beforeinput=(e,t)=>{if(cd&&Dx&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:s}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=s||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,Lw(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in zu)Fu[e]=zu[e];function pE(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Lte{constructor(t,n){this.toDOM=t,this.spec=n||Nj,this.side=this.spec.side||0}map(t,n,s,i){let{pos:o,deleted:l}=t.mapResult(n.from+i,this.side<0?-1:1);return l?null:new $f(o-s,o-s,this)}valid(){return!0}eq(t){return this==t||t instanceof Lte&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&pE(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class A1{constructor(t,n){this.attrs=t,this.spec=n||Nj}map(t,n,s,i){let o=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-s,l=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-s;return o>=l?null:new $f(o,l,this)}valid(t,n){return n.from=t&&(!o||o(a.spec))&&s.push(a.copy(a.from+i,a.to+i))}for(let l=0;lt){let a=this.children[l]+1;this.children[l+2].findInner(t-a,n-a,s,i+a,o)}}map(t,n,s){return this==Gd||t.maps.length==0?this:this.mapInner(t,n,0,0,s||Nj)}mapInner(t,n,s,i,o){let l;for(let a=0;a{let p=h+s,x;if(x=OFe(n,a,p)){for(i||(i=this.children.slice());oa&&y.to=t){this.children[a]==t&&(s=this.children[a+2]);break}let o=t+1,l=o+n.content.size;for(let a=0;ao&&h.type instanceof A1){let p=Math.max(o,h.from)-o,x=Math.min(l,h.to)-o;pi.map(t,n,Nj));return M0.from(s)}forChild(t,n){if(n.isLeaf)return Fc.empty;let s=[];for(let i=0;in instanceof Fc)?t:t.reduce((n,s)=>n.concat(s instanceof Fc?s:s.members),[]))}}forEachSet(t){for(let n=0;n{let A=C-N-(j-b);for(let E=0;ET+x-y)continue;let L=a[E]+x-y;j>=L?a[E+1]=b<=L?-2:-1:b>=x&&A&&(a[E]+=A,a[E+1]+=A)}y+=A}),x=n.maps[p].map(x,-1)}let h=!1;for(let p=0;p=s.content.size){h=!0;continue}let b=n.map(e[p+1]+o,-1),j=b-i,{index:N,offset:C}=s.content.findIndex(y),A=s.maybeChild(N);if(A&&C==y&&C+A.nodeSize==j){let E=a[p+2].mapInner(n,A,x+1,e[p]+o+1,l);E!=Gd?(a[p]=y,a[p+1]=j,a[p+2]=E):(a[p+1]=-2,h=!0)}else h=!0}if(h){let p=B1t(a,e,t,n,i,o,l),x=Ote(p,s,0,l);t=x.local;for(let y=0;yn&&l.to{let p=OFe(e,a,h+n);if(p){o=!0;let x=Ote(p,a,n+h+1,s);x!=Gd&&i.push(h,h+a.nodeSize,x)}});let l=LFe(o?DFe(e):e,-n).sort(Sj);for(let a=0;a0;)t++;e.splice(t,0,n)}function vce(e){let t=[];return e.someProp("decorations",n=>{let s=n(e.state);s&&s!=Gd&&t.push(s)}),e.cursorWrapper&&t.push(Fc.create(e.state.doc,[e.cursorWrapper.deco])),M0.from(t)}const $1t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},U1t=_h&&M1<=11;class q1t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class V1t{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new q1t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),U1t&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.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,$1t)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;nthis.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(yNe(this.view)){if(this.suppressingSelectionUpdates)return Xx(this.view);if(_h&&M1<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Hj(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,s;for(let o=t.focusNode;o;o=vC(o))n.add(o);for(let o=t.anchorNode;o;o=vC(o))if(n.has(o)){s=o;break}let i=s&&this.view.docView.nearestDesc(s);if(i&&i.ignoreMutation({type:"selection",target:s.nodeType==3?s.parentNode:s}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let s=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&yNe(t)&&!this.ignoreSelectionChange(s),o=-1,l=-1,a=!1,h=[];if(t.editable)for(let x=0;xy.nodeName=="BR");if(x.length==2){let[y,b]=x;y.parentNode&&y.parentNode.parentNode==b.parentNode?b.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let b of x){let j=b.parentNode;j&&j.nodeName=="LI"&&(!y||G1t(t,y)!=j)&&b.remove()}}}else if((cd||su)&&h.some(x=>x.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let x of h)if(x.nodeName=="BR"&&x.parentNode){let y=x.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&x.parentNode.removeChild(x)}}let p=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(o>-1&&(t.docView.markDirty(o,l),H1t(t)),this.handleDOMChange(o,l,a,h),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(s)||Xx(t),this.currentSelection.set(s))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let s=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(s==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!s||s.ignoreMutation(t))return null;if(t.type=="childList"){for(let x=0;xi;A--){let E=s.childNodes[A-1],T=E.pmViewDesc;if(E.nodeName=="BR"&&!T){o=A;break}if(!T||T.size)break}let y=e.state.doc,b=e.someProp("domParser")||hA.fromSchema(e.state.schema),j=y.resolve(l),N=null,C=b.parse(s,{topNode:j.parent,topMatch:j.parent.contentMatchAt(j.index()),topOpen:!0,from:i,to:o,preserveWhitespace:j.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:Z1t,context:j});if(p&&p[0].pos!=null){let A=p[0].pos,E=p[1]&&p[1].pos;E==null&&(E=A),N={anchor:A+l,head:E+l}}return{doc:C,sel:N,from:l,to:a}}function Z1t(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(su&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||su&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Y1t=/^(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 X1t(e,t,n,s,i){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let H=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,K=Gxe(e,H);if(K&&!e.state.selection.eq(K)){if(cd&&Dx&&e.input.lastKeyCode===13&&Date.now()-100te(e,Lw(13,"Enter"))))return;let Z=e.state.tr.setSelection(K);H=="pointer"?Z.setMeta("pointer",!0):H=="key"&&Z.scrollIntoView(),o&&Z.setMeta("composition",o),e.dispatch(Z)}return}let l=e.state.doc.resolve(t),a=l.sharedDepth(n);t=l.before(a+1),n=e.state.doc.resolve(n).after(a+1);let h=e.state.selection,p=K1t(e,t,n),x=e.state.doc,y=x.slice(p.from,p.to),b,j;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Dx)&&i.some(H=>H.nodeType==1&&!Y1t.test(H.nodeName))&&(!N||N.endA>=N.endB)&&e.someProp("handleKeyDown",H=>H(e,Lw(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!N)if(s&&h instanceof Ui&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))N={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let H=ANe(e,e.state.doc,p.sel);if(H&&!H.eq(e.state.selection)){let K=e.state.tr.setSelection(H);o&&K.setMeta("composition",o),e.dispatch(K)}}return}e.state.selection.frome.state.selection.from&&N.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?N.start=e.state.selection.from:N.endA=e.state.selection.to-2&&e.state.selection.to<=p.to&&(N.endB+=e.state.selection.to-N.endA,N.endA=e.state.selection.to)),_h&&M1<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>p.from&&p.doc.textBetween(N.start-p.from-1,N.start-p.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let C=p.doc.resolveNoCache(N.start-p.from),A=p.doc.resolveNoCache(N.endB-p.from),E=x.resolve(N.start),T=C.sameParent(A)&&C.parent.inlineContent&&E.end()>=N.endA;if((_C&&e.input.lastIOSEnter>Date.now()-225&&(!T||i.some(H=>H.nodeName=="DIV"||H.nodeName=="P"))||!T&&C.posH(e,Lw(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>N.start&&J1t(x,N.start,N.endA,C,A)&&e.someProp("handleKeyDown",H=>H(e,Lw(8,"Backspace")))){Dx&&cd&&e.domObserver.suppressSelectionUpdates();return}cd&&N.endB==N.start&&(e.input.lastChromeDelete=Date.now()),Dx&&!T&&C.start()!=A.start()&&A.parentOffset==0&&C.depth==A.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==N.endA&&(N.endB-=2,A=p.doc.resolveNoCache(N.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(H){return H(e,Lw(13,"Enter"))})},20));let L=N.start,z=N.endA,F=H=>{let K=H||e.state.tr.replace(L,z,p.doc.slice(N.start-p.from,N.endB-p.from));if(p.sel){let Z=ANe(e,K.doc,p.sel);Z&&!(cd&&e.composing&&Z.empty&&(N.start!=N.endB||e.input.lastChromeDeleteXx(e),20));let H=F(e.state.tr.delete(L,z)),K=x.resolve(N.start).marksAcross(x.resolve(N.endA));K&&H.ensureMarks(K),e.dispatch(H)}else if(N.endA==N.endB&&(q=Q1t(C.parent.content.cut(C.parentOffset,A.parentOffset),E.parent.content.cut(E.parentOffset,N.endA-E.start())))){let H=F(e.state.tr);q.type=="add"?H.addMark(L,z,q.mark):H.removeMark(L,z,q.mark),e.dispatch(H)}else if(C.parent.child(C.index()).isText&&C.index()==A.index()-(A.textOffset?0:1)){let H=C.parent.textBetween(C.parentOffset,A.parentOffset),K=()=>F(e.state.tr.insertText(H,L,z));e.someProp("handleTextInput",Z=>Z(e,L,z,H,K))||e.dispatch(K())}else e.dispatch(F());else e.dispatch(F())}function ANe(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Kxe(e,t.resolve(n.anchor),t.resolve(n.head))}function Q1t(e,t){let n=e.firstChild.marks,s=t.firstChild.marks,i=n,o=s,l,a,h;for(let x=0;xx.mark(a.addToSet(x.marks));else if(i.length==0&&o.length==1)a=o[0],l="remove",h=x=>x.mark(a.removeFromSet(x.marks));else return null;let p=[];for(let x=0;xn||_ce(l,!0,!1)0&&(t||e.indexAfter(s)==e.node(s).childCount);)s--,i++,t=!1;if(n){let o=e.node(s).maybeChild(e.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function evt(e,t,n,s,i){let o=e.findDiffStart(t,n);if(o==null)return null;let{a:l,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(i=="end"){let h=Math.max(0,o-Math.min(l,a));s-=l+h-o}if(l=l?o-s:0;o-=h,o&&o=a?o-s:0;o-=h,o&&o=56320&&t<=57343&&n>=55296&&n<=56319}class RFe{constructor(t,n){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 x1t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(DNe),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=LNe(this),PNe(this),this.nodeViews=ONe(this),this.docView=hNe(this.state.doc,INe(this),vce(this),this.dom,this),this.domObserver=new V1t(this,(s,i,o,l)=>X1t(this,s,i,o,l)),this.domObserver.start(),y1t(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Khe(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(DNe),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let s in this._props)n[s]=this._props[s];n.state=this.state;for(let s in t)n[s]=t[s];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var s;let i=this.state,o=!1,l=!1;t.storedMarks&&this.composing&&(AFe(this),l=!0),this.state=t;let a=i.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let j=ONe(this);rvt(j,this.nodeViews)&&(this.nodeViews=j,o=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Khe(this),this.editable=LNe(this),PNe(this);let h=vce(this),p=INe(this),x=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",y=o||!this.docView.matchesNode(t.doc,p,h);(y||!t.selection.eq(i.selection))&&(l=!0);let b=x=="preserve"&&l&&this.dom.style.overflowAnchor==null&&I0t(this);if(l){this.domObserver.stop();let j=y&&(_h||cd)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&tvt(i.selection,t.selection);if(y){let N=cd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=I1t(this)),(o||!this.docView.update(t.doc,p,h,this))&&(this.docView.updateOuterDeco(p),this.docView.destroy(),this.docView=hNe(t.doc,p,h,this.dom,this)),N&&!this.trackWrites&&(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&r1t(this))?Xx(this,j):(yFe(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((s=this.dragging)===null||s===void 0)&&s.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),x=="reset"?this.dom.scrollTop=0:x=="to selection"?this.scrollToSelection():b&&P0t(b)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof si){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&aNe(this,n.getBoundingClientRect(),t)}else aNe(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(o))==s.node&&(i=o)}this.dragging=new IFe(t.slice,t.move,i<0?void 0:si.create(this.state.doc,i))}someProp(t,n){let s=this._props&&this._props[t],i;if(s!=null&&(i=n?n(s):s))return i;for(let l=0;ln.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return z0t(this,t)}coordsAtPos(t,n=1){return dFe(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,s=-1){let i=this.docView.posFromDOM(t,n,s);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return V0t(this,n||this.state,t)}pasteHTML(t,n){return fE(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return fE(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Zxe(this,t)}destroy(){this.docView&&(v1t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],vce(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,w0t())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return b1t(this,t)}domSelectionRange(){let t=this.domSelection();return t?su&&this.root.nodeType===11&&C0t(this.dom.ownerDocument)==this.dom&&W1t(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}RFe.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function INe(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let s in n)s=="class"?t.class+=" "+n[s]:s=="style"?t.style=(t.style?t.style+";":"")+n[s]:!t[s]&&s!="contenteditable"&&s!="nodeName"&&(t[s]=String(n[s]))}),t.translate||(t.translate="no"),[$f.node(0,e.state.doc.content.size,t)]}function PNe(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:$f.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function LNe(e){return!e.someProp("editable",t=>t(e.state)===!1)}function tvt(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function ONe(e){let t=Object.create(null);function n(s){for(let i in s)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=s[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function rvt(e,t){let n=0,s=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)s++;return n!=s}function DNe(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Y1={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:"'"},Dte={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nvt=typeof navigator<"u"&&/Mac/.test(navigator.platform),svt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Pd=0;Pd<10;Pd++)Y1[48+Pd]=Y1[96+Pd]=String(Pd);for(var Pd=1;Pd<=24;Pd++)Y1[Pd+111]="F"+Pd;for(var Pd=65;Pd<=90;Pd++)Y1[Pd]=String.fromCharCode(Pd+32),Dte[Pd]=String.fromCharCode(Pd);for(var bce in Y1)Dte.hasOwnProperty(bce)||(Dte[bce]=Y1[bce]);function ivt(e){var t=nvt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||svt&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Dte:Y1)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const avt=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),ovt=typeof navigator<"u"&&/Win/.test(navigator.platform);function lvt(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let s,i,o,l;for(let a=0;ae.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function zFe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const BFe=(e,t,n)=>{let s=zFe(e,n);if(!s)return!1;let i=rye(s);if(!i){let l=s.blockRange(),a=l&&m3(l);return a==null?!1:(t&&t(e.tr.lift(l,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(ZFe(e,i,t,-1))return!0;if(s.parent.content.size==0&&(bC(o,"end")||si.isSelectable(o)))for(let l=s.depth;;l--){let a=Dse(e.doc,s.before(l),s.after(l),fs.empty);if(a&&a.slice.size1)break}return o.isAtom&&i.depth==s.depth-1?(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},uvt=(e,t,n)=>{let s=zFe(e,n);if(!s)return!1;let i=rye(s);return i?$Fe(e,i,t):!1},hvt=(e,t,n)=>{let s=qFe(e,n);if(!s)return!1;let i=nye(s);return i?$Fe(e,i,t):!1};function $Fe(e,t,n){let s=t.nodeBefore,i=s,o=t.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let x=i.lastChild;if(!x)return!1;i=x}let l=t.nodeAfter,a=l,h=t.pos+1;for(;!a.isTextblock;h++){if(a.type.spec.isolating)return!1;let x=a.firstChild;if(!x)return!1;a=x}let p=Dse(e.doc,o,h,fs.empty);if(!p||p.from!=o||p instanceof od&&p.slice.size>=h-o)return!1;if(n){let x=e.tr.step(p);x.setSelection(Ui.create(x.doc,o)),n(x.scrollIntoView())}return!0}function bC(e,t,n=!1){for(let s=e;s;s=t=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(n&&s.childCount!=1)return!1}return!1}const UFe=(e,t,n)=>{let{$head:s,empty:i}=e.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):s.parentOffset>0)return!1;o=rye(s)}let l=o&&o.nodeBefore;return!l||!si.isSelectable(l)?!1:(t&&t(e.tr.setSelection(si.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function rye(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function qFe(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset{let s=qFe(e,n);if(!s)return!1;let i=nye(s);if(!i)return!1;let o=i.nodeAfter;if(ZFe(e,i,t,1))return!0;if(s.parent.content.size==0&&(bC(o,"start")||si.isSelectable(o))){let l=Dse(e.doc,s.before(),s.after(),fs.empty);if(l&&l.slice.size{let{$head:s,empty:i}=e.selection,o=s;if(!i)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):s.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let n=e.selection,s=n instanceof si,i;if(s){if(n.node.isTextblock||!lv(e.doc,n.from))return!1;i=n.from}else if(i=Ose(e.doc,n.from,-1),i==null)return!1;if(t){let o=e.tr.join(i);s&&o.setSelection(si.create(o.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},pvt=(e,t)=>{let n=e.selection,s;if(n instanceof si){if(n.node.isTextblock||!lv(e.doc,n.to))return!1;s=n.to}else if(s=Ose(e.doc,n.to,1),s==null)return!1;return t&&t(e.tr.join(s).scrollIntoView()),!0},mvt=(e,t)=>{let{$from:n,$to:s}=e.selection,i=n.blockRange(s),o=i&&m3(i);return o==null?!1:(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)},WFe=(e,t)=>{let{$head:n,$anchor:s}=e.selection;return!n.parent.type.spec.code||!n.sameParent(s)?!1:(t&&t(e.tr.insertText(` `).scrollIntoView()),!0)};function sye(e){for(let t=0;t{let{$head:n,$anchor:s}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(s))return!1;let i=n.node(-1),o=n.indexAfter(-1),l=sye(i.contentMatchAt(o));if(!l||!i.canReplaceWith(o,o,l))return!1;if(t){let a=n.after(),h=e.tr.replaceWith(a,a,l.createAndFill());h.setSelection(la.near(h.doc.resolve(a),1)),t(h.scrollIntoView())}return!0},GFe=(e,t)=>{let n=e.selection,{$from:s,$to:i}=n;if(n instanceof tf||s.parent.inlineContent||i.parent.inlineContent)return!1;let o=sye(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let l=(!s.parentOffset&&i.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Yx(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),i=s&&m3(s);return i==null?!1:(t&&t(e.tr.lift(s,i).scrollIntoView()),!0)};function xvt(e){return(t,n)=>{let{$from:s,$to:i}=t.selection;if(t.selection instanceof si&&t.selection.node.isBlock)return!s.parentOffset||!Yx(t.doc,s.pos)?!1:(n&&n(t.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],l,a,h=!1,p=!1;for(let j=s.depth;;j--)if(s.node(j).isBlock){h=s.end(j)==s.pos+(s.depth-j),p=s.start(j)==s.pos-(s.depth-j),a=sye(s.node(j-1).contentMatchAt(s.indexAfter(j-1))),o.unshift(h&&a?{type:a}:null),l=j;break}else{if(j==1)return!1;o.unshift(null)}let x=t.tr;(t.selection instanceof Ui||t.selection instanceof tf)&&x.deleteSelection();let y=x.mapping.map(s.pos),b=Yx(x.doc,y,o.length,o);if(b||(o[0]=a?{type:a}:null,b=Yx(x.doc,y,o.length,o)),!b)return!1;if(x.split(y,o.length,o),!h&&p&&s.node(l).type!=a){let j=x.mapping.map(s.before(l)),N=x.doc.resolve(j);a&&s.node(l-1).canReplaceWith(N.index(),N.index()+1,a)&&x.setNodeMarkup(x.mapping.map(s.before(l)),a)}return n&&n(x.scrollIntoView()),!0}}const yvt=xvt(),vvt=(e,t)=>{let{$from:n,to:s}=e.selection,i,o=n.sharedDepth(s);return o==0?!1:(i=n.before(o),t&&t(e.tr.setSelection(si.create(e.doc,i))),!0)};function _vt(e,t,n){let s=t.nodeBefore,i=t.nodeAfter,o=t.index();return!s||!i||!s.type.compatibleContent(i.type)?!1:!s.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-s.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||lv(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function ZFe(e,t,n,s){let i=t.nodeBefore,o=t.nodeAfter,l,a,h=i.type.spec.isolating||o.type.spec.isolating;if(!h&&_vt(e,t,n))return!0;let p=!h&&t.parent.canReplace(t.index(),t.index()+1);if(p&&(l=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(l[0]||o.type).validEnd){if(n){let j=t.pos+o.nodeSize,N=wn.empty;for(let E=l.length-1;E>=0;E--)N=wn.from(l[E].create(null,N));N=wn.from(i.copy(N));let C=e.tr.step(new md(t.pos-1,j,t.pos,j,new fs(N,1,0),l.length,!0)),A=C.doc.resolve(j+2*l.length);A.nodeAfter&&A.nodeAfter.type==i.type&&lv(C.doc,A.pos)&&C.join(A.pos),n(C.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&h?null:la.findFrom(t,1),y=x&&x.$from.blockRange(x.$to),b=y&&m3(y);if(b!=null&&b>=t.depth)return n&&n(e.tr.lift(y,b).scrollIntoView()),!0;if(p&&bC(o,"start",!0)&&bC(i,"end")){let j=i,N=[];for(;N.push(j),!j.isTextblock;)j=j.lastChild;let C=o,A=1;for(;!C.isTextblock;C=C.firstChild)A++;if(j.canReplace(j.childCount,j.childCount,C.content)){if(n){let E=wn.empty;for(let L=N.length-1;L>=0;L--)E=wn.from(N[L].copy(E));let T=e.tr.step(new md(t.pos-N.length,t.pos+o.nodeSize,t.pos+A,t.pos+o.nodeSize-A,new fs(E,N.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function YFe(e){return function(t,n){let s=t.selection,i=e<0?s.$from:s.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(t.tr.setSelection(Ui.create(t.doc,e<0?i.start(o):i.end(o)))),!0):!1}}const bvt=YFe(-1),wvt=YFe(1);function jvt(e,t=null){return function(n,s){let{$from:i,$to:o}=n.selection,l=i.blockRange(o),a=l&&Vxe(l,e,t);return a?(s&&s(n.tr.wrap(l,a).scrollIntoView()),!0):!1}}function RNe(e,t=null){return function(n,s){let i=!1;for(let o=0;o{if(i)return!1;if(!(!h.isTextblock||h.hasMarkup(e,t)))if(h.type==e)i=!0;else{let x=n.doc.resolve(p),y=x.index();i=x.parent.canReplaceWith(y,y+1,e)}})}if(!i)return!1;if(s){let o=n.tr;for(let l=0;l=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let h=l.resolve(t.start-2);o=new Tte(h,h,t.depth),t.endIndex=0;x--)o=wn.from(n[x].type.create(n[x].attrs,o));e.step(new md(t.start-(s?2:0),t.end,t.start,t.end,new fs(o,0,0),n.length,!0));let l=0;for(let x=0;xl.childCount>0&&l.firstChild.type==e);return o?n?s.node(o.depth-1).type==e?Mvt(t,n,e,o):Tvt(t,n,o):!0:!1}}function Mvt(e,t,n,s){let i=e.tr,o=s.end,l=s.$to.end(s.depth);oC;N--)j-=i.child(N).nodeSize,s.delete(j-1,j+1);let o=s.doc.resolve(n.start),l=o.nodeAfter;if(s.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,h=n.endIndex==i.childCount,p=o.node(-1),x=o.index(-1);if(!p.canReplace(x+(a?0:1),x+1,l.content.append(h?wn.empty:wn.from(i))))return!1;let y=o.pos,b=y+l.nodeSize;return s.step(new md(y-(a?1:0),b+(h?1:0),y+1,b-1,new fs((a?wn.empty:wn.from(i.copy(wn.empty))).append(h?wn.empty:wn.from(i.copy(wn.empty))),a?0:1,h?0:1),a?0:1)),t(s.scrollIntoView()),!0}function Avt(e){return function(t,n){let{$from:s,$to:i}=t.selection,o=s.blockRange(i,p=>p.childCount>0&&p.firstChild.type==e);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let a=o.parent,h=a.child(l-1);if(h.type!=e)return!1;if(n){let p=h.lastChild&&h.lastChild.type==a.type,x=wn.from(p?e.create():null),y=new fs(wn.from(e.create(null,wn.from(a.type.create(null,x)))),p?3:1,0),b=o.start,j=o.end;n(t.tr.step(new md(b-(p?3:1),j,b,j,y,1,!0)).scrollIntoView())}return!0}}function $se(e){const{state:t,transaction:n}=e;let{selection:s}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return s},get doc(){return i},get tr(){return s=n.selection,i=n.doc,o=n.storedMarks,n}}}class Use{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:n,state:s}=this,{view:i}=n,{tr:o}=s,l=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([a,h])=>[a,(...x)=>{const y=h(...x)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),y}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:l}=i,a=[],h=!!t,p=t||o.tr,x=()=>(!h&&n&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(p),a.every(b=>b===!0)),y={...Object.fromEntries(Object.entries(s).map(([b,j])=>[b,(...C)=>{const A=this.buildProps(p,n),E=j(...C)(A);return a.push(E),y}])),run:x};return y}createCan(t){const{rawCommands:n,state:s}=this,i=!1,o=t||s.tr,l=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(n).map(([h,p])=>[h,(...x)=>p(...x)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(t,n=!0){const{rawCommands:s,editor:i,state:o}=this,{view:l}=i,a={tr:t,editor:i,view:l,state:$se({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(s).map(([h,p])=>[h,(...x)=>p(...x)(a)]))}};return a}}let Evt=class{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const s=this.callbacks[t];return s&&s.forEach(i=>i.apply(this,n)),this}off(t,n){const s=this.callbacks[t];return s&&(n?this.callbacks[t]=s.filter(i=>i!==n):delete this.callbacks[t]),this}once(t,n){const s=(...i)=>{this.off(t,s),n.apply(this,i)};return this.on(t,s)}removeAllListeners(){this.callbacks={}}};function Ss(e,t,n){return e.config[t]===void 0&&e.parent?Ss(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?Ss(e.parent,t,n):null}):e.config[t]}function qse(e){const t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),s=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:s}}function XFe(e){const t=[],{nodeExtensions:n,markExtensions:s}=qse(e),i=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage,extensions:i},h=Ss(l,"addGlobalAttributes",a);if(!h)return;h().forEach(x=>{x.types.forEach(y=>{Object.entries(x.attributes).forEach(([b,j])=>{t.push({type:y,name:b,attribute:{...o,...j}})})})})}),i.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage},h=Ss(l,"addAttributes",a);if(!h)return;const p=h();Object.entries(p).forEach(([x,y])=>{const b={...o,...y};typeof(b==null?void 0:b.default)=="function"&&(b.default=b.default()),b!=null&&b.isRequired&&(b==null?void 0:b.default)===void 0&&delete b.default,t.push({type:l.name,name:x,attribute:b})})}),t}function xd(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function yd(...e){return e.filter(t=>!!t).reduce((t,n)=>{const s={...t};return Object.entries(n).forEach(([i,o])=>{if(!s[i]){s[i]=o;return}if(i==="class"){const a=o?String(o).split(" "):[],h=s[i]?s[i].split(" "):[],p=a.filter(x=>!h.includes(x));s[i]=[...h,...p].join(" ")}else if(i==="style"){const a=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],h=s[i]?s[i].split(";").map(x=>x.trim()).filter(Boolean):[],p=new Map;h.forEach(x=>{const[y,b]=x.split(":").map(j=>j.trim());p.set(y,b)}),a.forEach(x=>{const[y,b]=x.split(":").map(j=>j.trim());p.set(y,b)}),s[i]=Array.from(p.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else s[i]=o}),s},{})}function Zhe(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,s)=>yd(n,s),{})}function QFe(e){return typeof e=="function"}function ua(e,t=void 0,...n){return QFe(e)?t?e.bind(t)(...n):e(...n):e}function Ivt(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Pvt(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function FNe(e,t){return"style"in e?e:{...e,getAttrs:n=>{const s=e.getAttrs?e.getAttrs(n):e.attrs;if(s===!1)return!1;const i=t.reduce((o,l)=>{const a=l.attribute.parseHTML?l.attribute.parseHTML(n):Pvt(n.getAttribute(l.name));return a==null?o:{...o,[l.name]:a}},{});return{...s,...i}}}}function zNe(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&Ivt(n)?!1:n!=null))}function Lvt(e,t){var n;const s=XFe(e),{nodeExtensions:i,markExtensions:o}=qse(e),l=(n=i.find(p=>Ss(p,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(p=>{const x=s.filter(E=>E.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:t},b=e.reduce((E,T)=>{const L=Ss(T,"extendNodeSchema",y);return{...E,...L?L(p):{}}},{}),j=zNe({...b,content:ua(Ss(p,"content",y)),marks:ua(Ss(p,"marks",y)),group:ua(Ss(p,"group",y)),inline:ua(Ss(p,"inline",y)),atom:ua(Ss(p,"atom",y)),selectable:ua(Ss(p,"selectable",y)),draggable:ua(Ss(p,"draggable",y)),code:ua(Ss(p,"code",y)),whitespace:ua(Ss(p,"whitespace",y)),linebreakReplacement:ua(Ss(p,"linebreakReplacement",y)),defining:ua(Ss(p,"defining",y)),isolating:ua(Ss(p,"isolating",y)),attrs:Object.fromEntries(x.map(E=>{var T;return[E.name,{default:(T=E==null?void 0:E.attribute)===null||T===void 0?void 0:T.default}]}))}),N=ua(Ss(p,"parseHTML",y));N&&(j.parseDOM=N.map(E=>FNe(E,x)));const C=Ss(p,"renderHTML",y);C&&(j.toDOM=E=>C({node:E,HTMLAttributes:Zhe(E,x)}));const A=Ss(p,"renderText",y);return A&&(j.toText=A),[p.name,j]})),h=Object.fromEntries(o.map(p=>{const x=s.filter(A=>A.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:t},b=e.reduce((A,E)=>{const T=Ss(E,"extendMarkSchema",y);return{...A,...T?T(p):{}}},{}),j=zNe({...b,inclusive:ua(Ss(p,"inclusive",y)),excludes:ua(Ss(p,"excludes",y)),group:ua(Ss(p,"group",y)),spanning:ua(Ss(p,"spanning",y)),code:ua(Ss(p,"code",y)),attrs:Object.fromEntries(x.map(A=>{var E;return[A.name,{default:(E=A==null?void 0:A.attribute)===null||E===void 0?void 0:E.default}]}))}),N=ua(Ss(p,"parseHTML",y));N&&(j.parseDOM=N.map(A=>FNe(A,x)));const C=Ss(p,"renderHTML",y);return C&&(j.toDOM=A=>C({mark:A,HTMLAttributes:Zhe(A,x)})),[p.name,j]}));return new FRe({topNode:l,nodes:a,marks:h})}function jce(e,t){return t.nodes[e]||t.marks[e]||null}function BNe(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function aye(e,t){const n=ok.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const Ovt=(e,t=500)=>{let n="";const s=e.parentOffset;return e.parent.nodesBetween(Math.max(0,s-t),s,(i,o,l,a)=>{var h,p;const x=((p=(h=i.type.spec).toText)===null||p===void 0?void 0:p.call(h,{node:i,pos:o,parent:l,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?x:x.slice(0,Math.max(0,s-o))}),n};function oye(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class Vse{constructor(t){this.find=t.find,this.handler=t.handler}}const Dvt=(e,t)=>{if(oye(t))return t.exec(e);const n=t(e);if(!n)return null;const s=[n.text];return s.index=n.index,s.input=e,s.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),s.push(n.replaceWith)),s};function AL(e){var t;const{editor:n,from:s,to:i,text:o,rules:l,plugin:a}=e,{view:h}=n;if(h.composing)return!1;const p=h.state.doc.resolve(s);if(p.parent.type.spec.code||!((t=p.nodeBefore||p.nodeAfter)===null||t===void 0)&&t.marks.find(b=>b.type.spec.code))return!1;let x=!1;const y=Ovt(p)+o;return l.forEach(b=>{if(x)return;const j=Dvt(y,b.find);if(!j)return;const N=h.state.tr,C=$se({state:h.state,transaction:N}),A={from:s-(j[0].length-o.length),to:i},{commands:E,chain:T,can:L}=new Use({editor:n,state:C});b.handler({state:C,range:A,match:j,commands:E,chain:T,can:L})===null||!N.steps.length||(N.setMeta(a,{transform:N,from:s,to:i,text:o}),h.dispatch(N),x=!0)}),x}function Rvt(e){const{editor:t,rules:n}=e,s=new zd({state:{init(){return null},apply(i,o,l){const a=i.getMeta(s);if(a)return a;const h=i.getMeta("applyInputRules");return!!h&&setTimeout(()=>{let{text:x}=h;typeof x=="string"?x=x:x=aye(wn.from(x),l.schema);const{from:y}=h,b=y+x.length;AL({editor:t,from:y,to:b,text:x,rules:n,plugin:s})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,l,a){return AL({editor:t,from:o,to:l,text:a,rules:n,plugin:s})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&AL({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:s})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?AL({editor:t,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function Fvt(e){return Object.prototype.toString.call(e).slice(8,-1)}function EL(e){return Fvt(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Hse(e,t){const n={...e};return EL(e)&&EL(t)&&Object.keys(t).forEach(s=>{EL(t[s])&&EL(e[s])?n[s]=Hse(e[s],t[s]):n[s]=t[s]}),n}class Dg{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ua(Ss(this,"addOptions",{name:this.name}))),this.storage=ua(Ss(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Dg(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Hse(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Dg(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ua(Ss(n,"addOptions",{name:n.name})),n.storage=ua(Ss(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:s}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(p=>(p==null?void 0:p.type.name)===n.name))return!1;const h=l.find(p=>(p==null?void 0:p.type.name)===n.name);return h&&s.removeStoredMark(h),s.insertText(" ",i.pos),t.view.dispatch(s),!0}return!1}}function zvt(e){return typeof e=="number"}class Bvt{constructor(t){this.find=t.find,this.handler=t.handler}}const $vt=(e,t,n)=>{if(oye(t))return[...e.matchAll(t)];const s=t(e,n);return s?s.map(i=>{const o=[i.text];return o.index=i.index,o.input=e,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Uvt(e){const{editor:t,state:n,from:s,to:i,rule:o,pasteEvent:l,dropEvent:a}=e,{commands:h,chain:p,can:x}=new Use({editor:t,state:n}),y=[];return n.doc.nodesBetween(s,i,(j,N)=>{if(!j.isTextblock||j.type.spec.code)return;const C=Math.max(s,N),A=Math.min(i,N+j.content.size),E=j.textBetween(C-N,A-N,void 0,"");$vt(E,o.find,l).forEach(L=>{if(L.index===void 0)return;const z=C+L.index+1,F=z+L[0].length,q={from:n.tr.mapping.map(z),to:n.tr.mapping.map(F)},H=o.handler({state:n,range:q,match:L,commands:h,chain:p,can:x,pasteEvent:l,dropEvent:a});y.push(H)})}),y.every(j=>j!==null)}let IL=null;const qvt=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function Vvt(e){const{editor:t,rules:n}=e;let s=null,i=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const h=({state:x,from:y,to:b,rule:j,pasteEvt:N})=>{const C=x.tr,A=$se({state:x,transaction:C});if(!(!Uvt({editor:t,state:A,from:Math.max(y-1,0),to:b.b-1,rule:j,pasteEvent:N,dropEvent:a})||!C.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,C}};return n.map(x=>new zd({view(y){const b=N=>{var C;s=!((C=y.dom.parentElement)===null||C===void 0)&&C.contains(N.target)?y.dom.parentElement:null,s&&(IL=t)},j=()=>{IL&&(IL=null)};return window.addEventListener("dragstart",b),window.addEventListener("dragend",j),{destroy(){window.removeEventListener("dragstart",b),window.removeEventListener("dragend",j)}}},props:{handleDOMEvents:{drop:(y,b)=>{if(o=s===y.dom.parentElement,a=b,!o){const j=IL;j!=null&&j.isEditable&&setTimeout(()=>{const N=j.state.selection;N&&j.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(y,b)=>{var j;const N=(j=b.clipboardData)===null||j===void 0?void 0:j.getData("text/html");return l=b,i=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(y,b,j)=>{const N=y[0],C=N.getMeta("uiEvent")==="paste"&&!i,A=N.getMeta("uiEvent")==="drop"&&!o,E=N.getMeta("applyPasteRules"),T=!!E;if(!C&&!A&&!T)return;if(T){let{text:F}=E;typeof F=="string"?F=F:F=aye(wn.from(F),j.schema);const{from:q}=E,H=q+F.length,K=qvt(F);return h({rule:x,state:j,from:q,to:{b:H},pasteEvt:K})}const L=b.doc.content.findDiffStart(j.doc.content),z=b.doc.content.findDiffEnd(j.doc.content);if(!(!zvt(L)||!z||L===z.b))return h({rule:x,state:j,from:L,to:z,pasteEvt:l})}}))}function Hvt(e){const t=e.filter((n,s)=>e.indexOf(n)!==s);return Array.from(new Set(t))}class R4{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=R4.resolve(t),this.schema=Lvt(this.extensions,n),this.setupExtensions()}static resolve(t){const n=R4.sort(R4.flatten(t)),s=Hvt(n.map(i=>i.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),n}static flatten(t){return t.map(n=>{const s={name:n.name,options:n.options,storage:n.storage},i=Ss(n,"addExtensions",s);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(t){return t.sort((s,i)=>{const o=Ss(s,"priority")||100,l=Ss(i,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:jce(n.name,this.schema)},i=Ss(n,"addCommands",s);return i?{...t,...i()}:t},{})}get plugins(){const{editor:t}=this,n=R4.sort([...this.extensions].reverse()),s=[],i=[],o=n.map(l=>{const a={name:l.name,options:l.options,storage:l.storage,editor:t,type:jce(l.name,this.schema)},h=[],p=Ss(l,"addKeyboardShortcuts",a);let x={};if(l.type==="mark"&&Ss(l,"exitable",a)&&(x.ArrowRight=()=>Dg.handleExit({editor:t,mark:l})),p){const C=Object.fromEntries(Object.entries(p()).map(([A,E])=>[A,()=>E({editor:t})]));x={...x,...C}}const y=dvt(x);h.push(y);const b=Ss(l,"addInputRules",a);BNe(l,t.options.enableInputRules)&&b&&s.push(...b());const j=Ss(l,"addPasteRules",a);BNe(l,t.options.enablePasteRules)&&j&&i.push(...j());const N=Ss(l,"addProseMirrorPlugins",a);if(N){const C=N();h.push(...C)}return h}).flat();return[Rvt({editor:t,rules:s}),...Vvt({editor:t,rules:i}),...o]}get attributes(){return XFe(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=qse(this.extensions);return Object.fromEntries(n.filter(s=>!!Ss(s,"addNodeView")).map(s=>{const i=this.attributes.filter(h=>h.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:t,type:xd(s.name,this.schema)},l=Ss(s,"addNodeView",o);if(!l)return[];const a=(h,p,x,y,b)=>{const j=Zhe(h,i);return l()({node:h,view:p,getPos:x,decorations:y,innerDecorations:b,editor:t,extension:s,HTMLAttributes:j})};return[s.name,a]}))}setupExtensions(){this.extensions.forEach(t=>{var n;this.editor.extensionStorage[t.name]=t.storage;const s={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:jce(t.name,this.schema)};t.type==="mark"&&(!((n=ua(Ss(t,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const i=Ss(t,"onBeforeCreate",s),o=Ss(t,"onCreate",s),l=Ss(t,"onUpdate",s),a=Ss(t,"onSelectionUpdate",s),h=Ss(t,"onTransaction",s),p=Ss(t,"onFocus",s),x=Ss(t,"onBlur",s),y=Ss(t,"onDestroy",s);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),h&&this.editor.on("transaction",h),p&&this.editor.on("focus",p),x&&this.editor.on("blur",x),y&&this.editor.on("destroy",y)})}}class Rd{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ua(Ss(this,"addOptions",{name:this.name}))),this.storage=ua(Ss(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Rd(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Hse(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Rd({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ua(Ss(n,"addOptions",{name:n.name})),n.storage=ua(Ss(n,"addStorage",{name:n.name,options:n.options})),n}}function JFe(e,t,n){const{from:s,to:i}=t,{blockSeparator:o=` `,textSerializers:l={}}=n||{};let a="";return e.nodesBetween(s,i,(h,p,x,y)=>{var b;h.isBlock&&p>s&&(a+=o);const j=l==null?void 0:l[h.type.name];if(j)return x&&(a+=j({node:h,pos:p,parent:x,index:y,range:t})),!1;h.isText&&(a+=(b=h==null?void 0:h.text)===null||b===void 0?void 0:b.slice(Math.max(s,p)-p,i-p))}),a}function eze(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const Wvt=Rd.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new zd({key:new df("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:s,selection:i}=t,{ranges:o}=i,l=Math.min(...o.map(x=>x.$from.pos)),a=Math.max(...o.map(x=>x.$to.pos)),h=eze(n);return JFe(s,{from:l,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:h})}}})]}}),Gvt=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),Kvt=(e=!1)=>({commands:t})=>t.setContent("",e),Zvt=()=>({state:e,tr:t,dispatch:n})=>{const{selection:s}=t,{ranges:i}=s;return n&&i.forEach(({$from:o,$to:l})=>{e.doc.nodesBetween(o.pos,l.pos,(a,h)=>{if(a.type.isText)return;const{doc:p,mapping:x}=t,y=p.resolve(x.map(h)),b=p.resolve(x.map(h+a.nodeSize)),j=y.blockRange(b);if(!j)return;const N=m3(j);if(a.type.isTextblock){const{defaultType:C}=y.parent.contentMatchAt(y.index());t.setNodeMarkup(j.start,C)}(N||N===0)&&t.lift(j,N)})}),!0},Yvt=e=>t=>e(t),Xvt=()=>({state:e,dispatch:t})=>GFe(e,t),Qvt=(e,t)=>({editor:n,tr:s})=>{const{state:i}=n,o=i.doc.slice(e.from,e.to);s.deleteRange(e.from,e.to);const l=s.mapping.map(t);return s.insert(l,o.content),s.setSelection(new Ui(s.doc.resolve(Math.max(l-1,0)))),!0},Jvt=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,s=n.$anchor.node();if(s.content.size>0)return!1;const i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s.type){if(t){const a=i.before(o),h=i.after(o);e.delete(a,h).scrollIntoView()}return!0}return!1},e_t=e=>({tr:t,state:n,dispatch:s})=>{const i=xd(e,n.schema),o=t.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===i){if(s){const h=o.before(l),p=o.after(l);t.delete(h,p).scrollIntoView()}return!0}return!1},t_t=e=>({tr:t,dispatch:n})=>{const{from:s,to:i}=e;return n&&t.delete(s,i),!0},r_t=()=>({state:e,dispatch:t})=>tye(e,t),n_t=()=>({commands:e})=>e.keyboardShortcut("Enter"),s_t=()=>({state:e,dispatch:t})=>gvt(e,t);function Rte(e,t,n={strict:!0}){const s=Object.keys(t);return s.length?s.every(i=>n.strict?t[i]===e[i]:oye(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function tze(e,t,n={}){return e.find(s=>s.type===t&&Rte(Object.fromEntries(Object.keys(n).map(i=>[i,s.attrs[i]])),n))}function $Ne(e,t,n={}){return!!tze(e,t,n)}function lye(e,t,n){var s;if(!e||!t)return;let i=e.parent.childAfter(e.parentOffset);if((!i.node||!i.node.marks.some(x=>x.type===t))&&(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some(x=>x.type===t)||(n=n||((s=i.node.marks[0])===null||s===void 0?void 0:s.attrs),!tze([...i.node.marks],t,n)))return;let l=i.index,a=e.start()+i.offset,h=l+1,p=a+i.node.nodeSize;for(;l>0&&$Ne([...e.parent.child(l-1).marks],t,n);)l-=1,a-=e.parent.child(l).nodeSize;for(;h({tr:n,state:s,dispatch:i})=>{const o=dv(e,s.schema),{doc:l,selection:a}=n,{$from:h,from:p,to:x}=a;if(i){const y=lye(h,o,t);if(y&&y.from<=p&&y.to>=x){const b=Ui.create(l,y.from,y.to);n.setSelection(b)}}return!0},a_t=e=>t=>{const n=typeof e=="function"?e(t):e;for(let s=0;s({editor:n,view:s,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};const l=()=>{(cye()||o_t())&&s.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(s.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(s.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!rze(n.state.selection))return l(),!0;const a=nze(i.doc,e)||n.state.selection,h=n.state.selection.eq(a);return o&&(h||i.setSelection(a),h&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},c_t=(e,t)=>n=>e.every((s,i)=>t(s,{...n,index:i})),d_t=(e,t)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),sze=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const s=t[n];s.nodeType===3&&s.nodeValue&&/^(\n\s\s|\n)$/.test(s.nodeValue)?e.removeChild(s):s.nodeType===1&&sze(s)}return e};function PL(e){const t=`${e}`,n=new window.DOMParser().parseFromString(t,"text/html").body;return sze(n)}function mE(e,t,n){if(e instanceof C1||e instanceof wn)return e;n={slice:!0,parseOptions:{},...n};const s=typeof e=="object"&&e!==null,i=typeof e=="string";if(s)try{if(Array.isArray(e)&&e.length>0)return wn.fromArray(e.map(a=>t.nodeFromJSON(a)));const l=t.nodeFromJSON(e);return n.errorOnInvalidContent&&l.check(),l}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),mE("",t,n)}if(i){if(n.errorOnInvalidContent){let l=!1,a="";const h=new FRe({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:p=>(l=!0,a=typeof p=="string"?p:p.outerHTML,null)}]}})});if(n.slice?hA.fromSchema(h).parseSlice(PL(e),n.parseOptions):hA.fromSchema(h).parse(PL(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=hA.fromSchema(t);return n.slice?o.parseSlice(PL(e),n.parseOptions).content:o.parse(PL(e),n.parseOptions)}return mE("",t,n)}function u_t(e,t,n){const s=e.steps.length-1;if(s{l===0&&(l=x)}),e.setSelection(la.near(e.doc.resolve(l),n))}const h_t=e=>!("type"in e),f_t=(e,t,n)=>({tr:s,dispatch:i,editor:o})=>{var l;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const h=A=>{o.emit("contentError",{editor:o,error:A,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{mE(t,o.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(A){h(A)}try{a=mE(t,o.schema,{parseOptions:p,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(A){return h(A),!1}let{from:x,to:y}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},b=!0,j=!0;if((h_t(a)?a:[a]).forEach(A=>{A.check(),b=b?A.isText&&A.marks.length===0:!1,j=j?A.isBlock:!1}),x===y&&j){const{parent:A}=s.doc.resolve(x);A.isTextblock&&!A.type.spec.code&&!A.childCount&&(x-=1,y+=1)}let C;if(b){if(Array.isArray(t))C=t.map(A=>A.text||"").join("");else if(t instanceof wn){let A="";t.forEach(E=>{E.text&&(A+=E.text)}),C=A}else typeof t=="object"&&t&&t.text?C=t.text:C=t;s.insertText(C,x,y)}else C=a,s.replaceWith(x,y,C);n.updateSelection&&u_t(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:x,text:C}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:x,text:C})}return!0},p_t=()=>({state:e,dispatch:t})=>fvt(e,t),m_t=()=>({state:e,dispatch:t})=>pvt(e,t),g_t=()=>({state:e,dispatch:t})=>BFe(e,t),x_t=()=>({state:e,dispatch:t})=>VFe(e,t),y_t=()=>({state:e,dispatch:t,tr:n})=>{try{const s=Ose(e.doc,e.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},v_t=()=>({state:e,dispatch:t,tr:n})=>{try{const s=Ose(e.doc,e.selection.$from.pos,1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},__t=()=>({state:e,dispatch:t})=>uvt(e,t),b_t=()=>({state:e,dispatch:t})=>hvt(e,t);function ize(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function w_t(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let s,i,o,l;for(let a=0;a({editor:t,view:n,tr:s,dispatch:i})=>{const o=w_t(e).split(/-(?!$)/),l=o.find(p=>!["Alt","Ctrl","Meta","Shift"].includes(p)),a=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),h=t.captureTransaction(()=>{n.someProp("handleKeyDown",p=>p(n,a))});return h==null||h.steps.forEach(p=>{const x=p.map(s.mapping);x&&i&&s.maybeStep(x)}),!0};function gE(e,t,n={}){const{from:s,to:i,empty:o}=e.selection,l=t?xd(t,e.schema):null,a=[];e.doc.nodesBetween(s,i,(y,b)=>{if(y.isText)return;const j=Math.max(s,b),N=Math.min(i,b+y.nodeSize);a.push({node:y,from:j,to:N})});const h=i-s,p=a.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>Rte(y.node.attrs,n,{strict:!1}));return o?!!p.length:p.reduce((y,b)=>y+b.to-b.from,0)>=h}const k_t=(e,t={})=>({state:n,dispatch:s})=>{const i=xd(e,n.schema);return gE(n,i,t)?mvt(n,s):!1},N_t=()=>({state:e,dispatch:t})=>KFe(e,t),S_t=e=>({state:t,dispatch:n})=>{const s=xd(e,t.schema);return Cvt(s)(t,n)},C_t=()=>({state:e,dispatch:t})=>WFe(e,t);function Wse(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function UNe(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((s,i)=>(n.includes(i)||(s[i]=e[i]),s),{})}const M_t=(e,t)=>({tr:n,state:s,dispatch:i})=>{let o=null,l=null;const a=Wse(typeof e=="string"?e:e.name,s.schema);return a?(a==="node"&&(o=xd(e,s.schema)),a==="mark"&&(l=dv(e,s.schema)),i&&n.selection.ranges.forEach(h=>{s.doc.nodesBetween(h.$from.pos,h.$to.pos,(p,x)=>{o&&o===p.type&&n.setNodeMarkup(x,void 0,UNe(p.attrs,t)),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&n.addMark(x,x+p.nodeSize,l.create(UNe(y.attrs,t)))})})}),!0):!1},T_t=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),A_t=()=>({tr:e,dispatch:t})=>{if(t){const n=new tf(e.doc);e.setSelection(n)}return!0},E_t=()=>({state:e,dispatch:t})=>UFe(e,t),I_t=()=>({state:e,dispatch:t})=>HFe(e,t),P_t=()=>({state:e,dispatch:t})=>vvt(e,t),L_t=()=>({state:e,dispatch:t})=>wvt(e,t),O_t=()=>({state:e,dispatch:t})=>bvt(e,t);function Yhe(e,t,n={},s={}){return mE(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const D_t=(e,t=!1,n={},s={})=>({editor:i,tr:o,dispatch:l,commands:a})=>{var h,p;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const y=Yhe(e,i.schema,n,{errorOnInvalidContent:(h=s.errorOnInvalidContent)!==null&&h!==void 0?h:i.options.enableContentCheck});return l&&o.replaceWith(0,x.content.size,y).setMeta("preventUpdate",!t),!0}return l&&o.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:x.content.size},e,{parseOptions:n,errorOnInvalidContent:(p=s.errorOnInvalidContent)!==null&&p!==void 0?p:i.options.enableContentCheck})};function aze(e,t){const n=dv(t,e.schema),{from:s,to:i,empty:o}=e.selection,l=[];o?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(s,i,h=>{l.push(...h.marks)});const a=l.find(h=>h.type.name===n.name);return a?{...a.attrs}:{}}function R_t(e,t){const n=new eFe(e);return t.forEach(s=>{s.steps.forEach(i=>{n.step(i)})}),n}function F_t(e){for(let t=0;t{n(i)&&s.push({node:i,pos:o})}),s}function B_t(e,t){for(let n=e.depth;n>0;n-=1){const s=e.node(n);if(t(s))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:s}}}function dye(e){return t=>B_t(t.$from,e)}function $_t(e,t){const n={from:0,to:e.content.size};return JFe(e,n,t)}function U_t(e,t){const n=xd(t,e.schema),{from:s,to:i}=e.selection,o=[];e.doc.nodesBetween(s,i,a=>{o.push(a)});const l=o.reverse().find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function oze(e,t){const n=Wse(typeof t=="string"?t:t.name,e.schema);return n==="node"?U_t(e,t):n==="mark"?aze(e,t):{}}function q_t(e,t=JSON.stringify){const n={};return e.filter(s=>{const i=t(s);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function V_t(e){const t=q_t(e);return t.length===1?t:t.filter((n,s)=>!t.filter((o,l)=>l!==s).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function H_t(e){const{mapping:t,steps:n}=e,s=[];return t.maps.forEach((i,o)=>{const l=[];if(i.ranges.length)i.forEach((a,h)=>{l.push({from:a,to:h})});else{const{from:a,to:h}=n[o];if(a===void 0||h===void 0)return;l.push({from:a,to:h})}l.forEach(({from:a,to:h})=>{const p=t.slice(o).map(a,-1),x=t.slice(o).map(h),y=t.invert().map(p,-1),b=t.invert().map(x);s.push({oldRange:{from:y,to:b},newRange:{from:p,to:x}})})}),V_t(s)}function uye(e,t,n){const s=[];return e===t?n.resolve(e).marks().forEach(i=>{const o=n.resolve(e),l=lye(o,i.type);l&&s.push({mark:i,...l})}):n.nodesBetween(e,t,(i,o)=>{!i||(i==null?void 0:i.nodeSize)===void 0||s.push(...i.marks.map(l=>({from:o,to:o+i.nodeSize,mark:l})))}),s}function pee(e,t,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const i=e.find(o=>o.type===t&&o.name===s);return i?i.attribute.keepOnSplit:!1}))}function Xhe(e,t,n={}){const{empty:s,ranges:i}=e.selection,o=t?dv(t,e.schema):null;if(s)return!!(e.storedMarks||e.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>Rte(y.attrs,n,{strict:!1}));let l=0;const a=[];if(i.forEach(({$from:y,$to:b})=>{const j=y.pos,N=b.pos;e.doc.nodesBetween(j,N,(C,A)=>{if(!C.isText&&!C.marks.length)return;const E=Math.max(j,A),T=Math.min(N,A+C.nodeSize),L=T-E;l+=L,a.push(...C.marks.map(z=>({mark:z,from:E,to:T})))})}),l===0)return!1;const h=a.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>Rte(y.mark.attrs,n,{strict:!1})).reduce((y,b)=>y+b.to-b.from,0),p=a.filter(y=>o?y.mark.type!==o&&y.mark.type.excludes(o):!0).reduce((y,b)=>y+b.to-b.from,0);return(h>0?h+p:h)>=l}function W_t(e,t,n={}){if(!t)return gE(e,null,n)||Xhe(e,null,n);const s=Wse(t,e.schema);return s==="node"?gE(e,t,n):s==="mark"?Xhe(e,t,n):!1}function qNe(e,t){const{nodeExtensions:n}=qse(t),s=n.find(l=>l.name===e);if(!s)return!1;const i={name:s.name,options:s.options,storage:s.storage},o=ua(Ss(s,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function hye(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var s;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((s=e.text)!==null&&s!==void 0?s:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let i=!0;return e.content.forEach(o=>{i!==!1&&(hye(o,{ignoreWhitespace:n,checkChildren:t})||(i=!1))}),i}return!1}function G_t(e){return e instanceof si}function K_t(e,t,n){var s;const{selection:i}=t;let o=null;if(rze(i)&&(o=i.$cursor),o){const a=(s=e.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(a)||!a.some(h=>h.type.excludes(n))}const{ranges:l}=i;return l.some(({$from:a,$to:h})=>{let p=a.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(a.pos,h.pos,(x,y,b)=>{if(p)return!1;if(x.isInline){const j=!b||b.type.allowsMarkType(n),N=!!n.isInSet(x.marks)||!x.marks.some(C=>C.type.excludes(n));p=j&&N}return!p}),p})}const Z_t=(e,t={})=>({tr:n,state:s,dispatch:i})=>{const{selection:o}=n,{empty:l,ranges:a}=o,h=dv(e,s.schema);if(i)if(l){const p=aze(s,h);n.addStoredMark(h.create({...p,...t}))}else a.forEach(p=>{const x=p.$from.pos,y=p.$to.pos;s.doc.nodesBetween(x,y,(b,j)=>{const N=Math.max(j,x),C=Math.min(j+b.nodeSize,y);b.marks.find(E=>E.type===h)?b.marks.forEach(E=>{h===E.type&&n.addMark(N,C,h.create({...E.attrs,...t}))}):n.addMark(N,C,h.create(t))})});return K_t(s,n,h)},Y_t=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),X_t=(e,t={})=>({state:n,dispatch:s,chain:i})=>{const o=xd(e,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:a})=>RNe(o,{...l,...t})(n)?!0:a.clearNodes()).command(({state:a})=>RNe(o,{...l,...t})(a,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Q_t=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,i=Hw(e,0,s.content.size),o=si.create(s,i);t.setSelection(o)}return!0},J_t=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,{from:i,to:o}=typeof e=="number"?{from:e,to:e}:e,l=Ui.atStart(s).from,a=Ui.atEnd(s).to,h=Hw(i,l,a),p=Hw(o,l,a),x=Ui.create(s,h,p);t.setSelection(x)}return!0},e2t=e=>({state:t,dispatch:n})=>{const s=xd(e,t.schema);return Avt(s)(t,n)};function VNe(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const s=n.filter(i=>t==null?void 0:t.includes(i.type.name));e.tr.ensureMarks(s)}}const t2t=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:s,editor:i})=>{const{selection:o,doc:l}=t,{$from:a,$to:h}=o,p=i.extensionManager.attributes,x=pee(p,a.node().type.name,a.node().attrs);if(o instanceof si&&o.node.isBlock)return!a.parentOffset||!Yx(l,a.pos)?!1:(s&&(e&&VNe(n,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const y=h.parentOffset===h.parent.content.size,b=a.depth===0?void 0:F_t(a.node(-1).contentMatchAt(a.indexAfter(-1)));let j=y&&b?[{type:b,attrs:x}]:void 0,N=Yx(t.doc,t.mapping.map(a.pos),1,j);if(!j&&!N&&Yx(t.doc,t.mapping.map(a.pos),1,b?[{type:b}]:void 0)&&(N=!0,j=b?[{type:b,attrs:x}]:void 0),s){if(N&&(o instanceof Ui&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,j),b&&!y&&!a.parentOffset&&a.parent.type!==b)){const C=t.mapping.map(a.before()),A=t.doc.resolve(C);a.node(-1).canReplaceWith(A.index(),A.index()+1,b)&&t.setNodeMarkup(t.mapping.map(a.before()),b)}e&&VNe(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return N},r2t=(e,t={})=>({tr:n,state:s,dispatch:i,editor:o})=>{var l;const a=xd(e,s.schema),{$from:h,$to:p}=s.selection,x=s.selection.node;if(x&&x.isBlock||h.depth<2||!h.sameParent(p))return!1;const y=h.node(-1);if(y.type!==a)return!1;const b=o.extensionManager.attributes;if(h.parent.content.size===0&&h.node(-1).childCount===h.indexAfter(-1)){if(h.depth===2||h.node(-3).type!==a||h.index(-2)!==h.node(-2).childCount-1)return!1;if(i){let E=wn.empty;const T=h.index(-1)?1:h.index(-2)?2:3;for(let K=h.depth-T;K>=h.depth-3;K-=1)E=wn.from(h.node(K).copy(E));const L=h.indexAfter(-1){if(H>-1)return!1;K.isTextblock&&K.content.size===0&&(H=Z+1)}),H>-1&&n.setSelection(Ui.near(n.doc.resolve(H))),n.scrollIntoView()}return!0}const j=p.pos===h.end()?y.contentMatchAt(0).defaultType:null,N={...pee(b,y.type.name,y.attrs),...t},C={...pee(b,h.node().type.name,h.node().attrs),...t};n.delete(h.pos,p.pos);const A=j?[{type:a,attrs:N},{type:j,attrs:C}]:[{type:a,attrs:N}];if(!Yx(n.doc,h.pos,2))return!1;if(i){const{selection:E,storedMarks:T}=s,{splittableMarks:L}=o.extensionManager,z=T||E.$to.parentOffset&&E.$from.marks();if(n.split(h.pos,2,A).scrollIntoView(),!z||!i)return!0;const F=z.filter(q=>L.includes(q.type.name));n.ensureMarks(F)}return!0},kce=(e,t)=>{const n=dye(l=>l.type===t)(e.selection);if(!n)return!0;const s=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(s===void 0)return!0;const i=e.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&lv(e.doc,n.pos)&&e.join(n.pos),!0},Nce=(e,t)=>{const n=dye(l=>l.type===t)(e.selection);if(!n)return!0;const s=e.doc.resolve(n.start).after(n.depth);if(s===void 0)return!0;const i=e.doc.nodeAt(s);return n.node.type===(i==null?void 0:i.type)&&lv(e.doc,s)&&e.join(s),!0},n2t=(e,t,n,s={})=>({editor:i,tr:o,state:l,dispatch:a,chain:h,commands:p,can:x})=>{const{extensions:y,splittableMarks:b}=i.extensionManager,j=xd(e,l.schema),N=xd(t,l.schema),{selection:C,storedMarks:A}=l,{$from:E,$to:T}=C,L=E.blockRange(T),z=A||C.$to.parentOffset&&C.$from.marks();if(!L)return!1;const F=dye(q=>qNe(q.type.name,y))(C);if(L.depth>=1&&F&&L.depth-F.depth<=1){if(F.node.type===j)return p.liftListItem(N);if(qNe(F.node.type.name,y)&&j.validContent(F.node.content)&&a)return h().command(()=>(o.setNodeMarkup(F.pos,j),!0)).command(()=>kce(o,j)).command(()=>Nce(o,j)).run()}return!n||!z||!a?h().command(()=>x().wrapInList(j,s)?!0:p.clearNodes()).wrapInList(j,s).command(()=>kce(o,j)).command(()=>Nce(o,j)).run():h().command(()=>{const q=x().wrapInList(j,s),H=z.filter(K=>b.includes(K.type.name));return o.ensureMarks(H),q?!0:p.clearNodes()}).wrapInList(j,s).command(()=>kce(o,j)).command(()=>Nce(o,j)).run()},s2t=(e,t={},n={})=>({state:s,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,l=dv(e,s.schema);return Xhe(s,l,t)?i.unsetMark(l,{extendEmptyMarkRange:o}):i.setMark(l,t)},i2t=(e,t,n={})=>({state:s,commands:i})=>{const o=xd(e,s.schema),l=xd(t,s.schema),a=gE(s,o,n);let h;return s.selection.$anchor.sameParent(s.selection.$head)&&(h=s.selection.$anchor.parent.attrs),a?i.setNode(l,h):i.setNode(o,{...h,...n})},a2t=(e,t={})=>({state:n,commands:s})=>{const i=xd(e,n.schema);return gE(n,i,t)?s.lift(i):s.wrapIn(i,t)},o2t=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let s=0;s=0;h-=1)l.step(a.steps[h].invert(a.docs[h]));if(o.text){const h=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,e.schema.text(o.text,h))}else l.delete(o.from,o.to)}return!0}}return!1},l2t=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:s,ranges:i}=n;return s||t&&i.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},c2t=(e,t={})=>({tr:n,state:s,dispatch:i})=>{var o;const{extendEmptyMarkRange:l=!1}=t,{selection:a}=n,h=dv(e,s.schema),{$from:p,empty:x,ranges:y}=a;if(!i)return!0;if(x&&l){let{from:b,to:j}=a;const N=(o=p.marks().find(A=>A.type===h))===null||o===void 0?void 0:o.attrs,C=lye(p,h,N);C&&(b=C.from,j=C.to),n.removeMark(b,j,h)}else y.forEach(b=>{n.removeMark(b.$from.pos,b.$to.pos,h)});return n.removeStoredMark(h),!0},d2t=(e,t={})=>({tr:n,state:s,dispatch:i})=>{let o=null,l=null;const a=Wse(typeof e=="string"?e:e.name,s.schema);return a?(a==="node"&&(o=xd(e,s.schema)),a==="mark"&&(l=dv(e,s.schema)),i&&n.selection.ranges.forEach(h=>{const p=h.$from.pos,x=h.$to.pos;let y,b,j,N;n.selection.empty?s.doc.nodesBetween(p,x,(C,A)=>{o&&o===C.type&&(j=Math.max(A,p),N=Math.min(A+C.nodeSize,x),y=A,b=C)}):s.doc.nodesBetween(p,x,(C,A)=>{A=p&&A<=x&&(o&&o===C.type&&n.setNodeMarkup(A,void 0,{...C.attrs,...t}),l&&C.marks.length&&C.marks.forEach(E=>{if(l===E.type){const T=Math.max(A,p),L=Math.min(A+C.nodeSize,x);n.addMark(T,L,l.create({...E.attrs,...t}))}}))}),b&&(y!==void 0&&n.setNodeMarkup(y,void 0,{...b.attrs,...t}),l&&b.marks.length&&b.marks.forEach(C=>{l===C.type&&n.addMark(j,N,l.create({...C.attrs,...t}))}))}),!0):!1},u2t=(e,t={})=>({state:n,dispatch:s})=>{const i=xd(e,n.schema);return jvt(i,t)(n,s)},h2t=(e,t={})=>({state:n,dispatch:s})=>{const i=xd(e,n.schema);return kvt(i,t)(n,s)};var f2t=Object.freeze({__proto__:null,blur:Gvt,clearContent:Kvt,clearNodes:Zvt,command:Yvt,createParagraphNear:Xvt,cut:Qvt,deleteCurrentNode:Jvt,deleteNode:e_t,deleteRange:t_t,deleteSelection:r_t,enter:n_t,exitCode:s_t,extendMarkRange:i_t,first:a_t,focus:l_t,forEach:c_t,insertContent:d_t,insertContentAt:f_t,joinBackward:g_t,joinDown:m_t,joinForward:x_t,joinItemBackward:y_t,joinItemForward:v_t,joinTextblockBackward:__t,joinTextblockForward:b_t,joinUp:p_t,keyboardShortcut:j_t,lift:k_t,liftEmptyBlock:N_t,liftListItem:S_t,newlineInCode:C_t,resetAttributes:M_t,scrollIntoView:T_t,selectAll:A_t,selectNodeBackward:E_t,selectNodeForward:I_t,selectParentNode:P_t,selectTextblockEnd:L_t,selectTextblockStart:O_t,setContent:D_t,setMark:Z_t,setMeta:Y_t,setNode:X_t,setNodeSelection:Q_t,setTextSelection:J_t,sinkListItem:e2t,splitBlock:t2t,splitListItem:r2t,toggleList:n2t,toggleMark:s2t,toggleNode:i2t,toggleWrap:a2t,undoInputRule:o2t,unsetAllMarks:l2t,unsetMark:c2t,updateAttributes:d2t,wrapIn:u2t,wrapInList:h2t});const p2t=Rd.create({name:"commands",addCommands(){return{...f2t}}}),m2t=Rd.create({name:"drop",addProseMirrorPlugins(){return[new zd({key:new df("tiptapDrop"),props:{handleDrop:(e,t,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:s})}}})]}}),g2t=Rd.create({name:"editable",addProseMirrorPlugins(){return[new zd({key:new df("editable"),props:{editable:()=>this.editor.options.editable}})]}}),x2t=new df("focusEvents"),y2t=Rd.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new zd({key:x2t,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const s=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(s),!1},blur:(t,n)=>{e.isFocused=!1;const s=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(s),!1}}}})]}}),v2t=Rd.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:a})=>{const{selection:h,doc:p}=a,{empty:x,$anchor:y}=h,{pos:b,parent:j}=y,N=y.parent.isTextblock&&b>0?a.doc.resolve(b-1):y,C=N.parent.type.spec.isolating,A=y.pos-y.parentOffset,E=C&&N.parent.childCount===1?A===y.pos:la.atStart(p).from===b;return!x||!j.type.isTextblock||j.textContent.length||!E||E&&y.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...s},o={...s,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return cye()||ize()?o:i},addProseMirrorPlugins(){return[new zd({key:new df("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(C=>C.getMeta("composition")))return;const s=e.some(C=>C.docChanged)&&!t.doc.eq(n.doc),i=e.some(C=>C.getMeta("preventClearDocument"));if(!s||i)return;const{empty:o,from:l,to:a}=t.selection,h=la.atStart(t.doc).from,p=la.atEnd(t.doc).to;if(o||!(l===h&&a===p)||!hye(n.doc))return;const b=n.tr,j=$se({state:n,transaction:b}),{commands:N}=new Use({editor:this.editor,state:j});if(N.clearNodes(),!!b.steps.length)return b}})]}}),_2t=Rd.create({name:"paste",addProseMirrorPlugins(){return[new zd({key:new df("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),b2t=Rd.create({name:"tabindex",addProseMirrorPlugins(){return[new zd({key:new df("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ow{get name(){return this.node.type.name}constructor(t,n,s=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=t,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,s=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}n=this.from+1,s=this.to-1}this.editor.commands.insertContentAt({from:n,to:s},t)}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 t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Ow(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Ow(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Ow(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,s)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,l=this.pos+s+(o?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!i&&a.depth<=this.depth)return;const h=new Ow(a,this.editor,i,i?n:null);i&&(h.actualDepth=this.depth+1),t.push(new Ow(a,this.editor,i,i?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let s=null,i=this.parent;for(;i&&!s;){if(i.node.type.name===t)if(Object.keys(n).length>0){const o=i.node.attrs,l=Object.keys(n);for(let a=0;a{s&&i.length>0||(l.node.type.name===t&&o.every(h=>n[h]===l.node.attrs[h])&&i.push(l),!(s&&i.length>0)&&(i=i.concat(l.querySelectorAll(t,n,s))))}),i}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}}const w2t=`.ProseMirror { position: relative; } .ProseMirror { word-wrap: break-word; white-space: pre-wrap; white-space: break-spaces; -webkit-font-variant-ligatures: none; font-variant-ligatures: none; font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ } .ProseMirror [contenteditable="false"] { white-space: normal; } .ProseMirror [contenteditable="false"] [contenteditable="true"] { white-space: pre-wrap; } .ProseMirror pre { white-space: pre-wrap; } img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; width: 0 !important; height: 0 !important; } .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; } .ProseMirror-gapcursor:after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid black; animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; } @keyframes ProseMirror-cursor-blink { to { visibility: hidden; } } .ProseMirror-hideselection *::selection { background: transparent; } .ProseMirror-hideselection *::-moz-selection { background: transparent; } .ProseMirror-hideselection * { caret-color: transparent; } .ProseMirror-focused .ProseMirror-gapcursor { display: block; } .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 }`;function j2t(e,t,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style",""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}class k2t extends Evt{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:s,moved:i})=>this.options.onDrop(n,s,i)),this.on("paste",({event:n,slice:s})=>this.options.onPaste(n,s)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=j2t(w2t,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,n){const s=QFe(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}unregisterPlugin(t){if(this.isDestroyed)return;const n=this.state.plugins;let s=n;if([].concat(t).forEach(o=>{const l=typeof o=="string"?`${o}$`:o.key;s=s.filter(a=>!a.key.startsWith(l))}),n.length===s.length)return;const i=this.state.reconfigure({plugins:s});return this.view.updateState(i),i}createExtensionManager(){var t,n;const i=[...this.options.enableCoreExtensions?[g2t,Wvt.configure({blockSeparator:(n=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),p2t,y2t,v2t,b2t,m2t,_2t].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 R4(i,this)}createCommandManager(){this.commandManager=new Use({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let n;try{n=Yhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(l){if(!(l instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(l.message))throw l;this.emit("contentError",{editor:this,error:l,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=Yhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=nze(n,this.options.autofocus);this.view=new RFe(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:D4.create({doc:n,selection:s||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(l=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(l)});return}const n=this.state.apply(t),s=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),s&&this.emit("selectionUpdate",{editor:this,transaction:t});const i=t.getMeta("focus"),o=t.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return oze(this.state,t)}isActive(t,n){const s=typeof t=="string"?t:null,i=typeof t=="string"?n:t;return W_t(this.state,s,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return aye(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=` `,textSerializers:s={}}=t||{};return $_t(this.state.doc,{blockSeparator:n,textSerializers:{...eze(this.schema),...s}})}get isEmpty(){return hye(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelector(t,n))||null}$nodes(t,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelectorAll(t,n))||null}$pos(t){const n=this.state.doc.resolve(t);return new Ow(n,this)}get $doc(){return this.$pos(0)}}function wC(e){return new Vse({find:e.find,handler:({state:t,range:n,match:s})=>{const i=ua(e.getAttributes,void 0,s);if(i===!1||i===null)return null;const{tr:o}=t,l=s[s.length-1],a=s[0];if(l){const h=a.search(/\S/),p=n.from+a.indexOf(l),x=p+l.length;if(uye(n.from,n.to,t.doc).filter(j=>j.mark.type.excluded.find(C=>C===e.type&&C!==j.mark.type)).filter(j=>j.to>p).length)return null;xn.from&&o.delete(n.from+h,p);const b=n.from+h+l.length;o.addMark(n.from+h,b,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function N2t(e){return new Vse({find:e.find,handler:({state:t,range:n,match:s})=>{const i=ua(e.getAttributes,void 0,s)||{},{tr:o}=t,l=n.from;let a=n.to;const h=e.type.create(i);if(s[1]){const p=s[0].lastIndexOf(s[1]);let x=l+p;x>a?x=a:a=x+s[1].length;const y=s[0][s[0].length-1];o.insertText(y,l+s[0].length-1),o.replaceWith(x,a,h)}else if(s[0]){const p=e.type.isInline?l:l-1;o.insert(p,e.type.create(i)).delete(o.mapping.map(l),o.mapping.map(a))}o.scrollIntoView()}})}function Qhe(e){return new Vse({find:e.find,handler:({state:t,range:n,match:s})=>{const i=t.doc.resolve(n.from),o=ua(e.getAttributes,void 0,s)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function xE(e){return new Vse({find:e.find,handler:({state:t,range:n,match:s,chain:i})=>{const o=ua(e.getAttributes,void 0,s)||{},l=t.tr.delete(n.from,n.to),h=l.doc.resolve(n.from).blockRange(),p=h&&Vxe(h,e.type,o);if(!p)return null;if(l.wrap(h,p),e.keepMarks&&e.editor){const{selection:y,storedMarks:b}=t,{splittableMarks:j}=e.editor.extensionManager,N=b||y.$to.parentOffset&&y.$from.marks();if(N){const C=N.filter(A=>j.includes(A.type.name));l.ensureMarks(C)}}if(e.keepAttributes){const y=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(y,o).run()}const x=l.doc.resolve(n.from-1).nodeBefore;x&&x.type===e.type&&lv(l.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(s,x))&&l.join(n.from-1)}})}let Tm=class Jhe{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ua(Ss(this,"addOptions",{name:this.name}))),this.storage=ua(Ss(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Jhe(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Hse(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Jhe(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ua(Ss(n,"addOptions",{name:n.name})),n.storage=ua(Ss(n,"addStorage",{name:n.name,options:n.options})),n}};function Gj(e){return new Bvt({find:e.find,handler:({state:t,range:n,match:s,pasteEvent:i})=>{const o=ua(e.getAttributes,void 0,s,i);if(o===!1||o===null)return null;const{tr:l}=t,a=s[s.length-1],h=s[0];let p=n.to;if(a){const x=h.search(/\S/),y=n.from+h.indexOf(a),b=y+a.length;if(uye(n.from,n.to,t.doc).filter(N=>N.mark.type.excluded.find(A=>A===e.type&&A!==N.mark.type)).filter(N=>N.to>y).length)return null;bn.from&&l.delete(n.from+x,y),p=n.from+x+a.length,l.addMark(n.from+x,p,e.type.create(o||{})),l.removeStoredMark(e.type)}}})}function S2t(e,t){const{selection:n}=e,{$from:s}=n;if(n instanceof si){const o=s.index();return s.parent.canReplaceWith(o,o+1,t)}let i=s.depth;for(;i>=0;){const o=s.index(i);if(s.node(i).contentMatchAt(o).matchType(t))return!0;i-=1}return!1}function C2t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lze={exports:{}},Sce={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var HNe;function M2t(){if(HNe)return Sce;HNe=1;var e=rt;function t(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function a(y,b){var j=b(),N=s({inst:{value:j,getSnapshot:b}}),C=N[0].inst,A=N[1];return o(function(){C.value=j,C.getSnapshot=b,h(C)&&A({inst:C})},[y,j,b]),i(function(){return h(C)&&A({inst:C}),y(function(){h(C)&&A({inst:C})})},[y]),l(j),j}function h(y){var b=y.getSnapshot;y=y.value;try{var j=b();return!n(y,j)}catch{return!0}}function p(y,b){return b()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:a;return Sce.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,Sce}lze.exports=M2t();var fye=lze.exports;const T2t=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},A2t=({contentComponent:e})=>{const t=fye.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return rt.createElement(rt.Fragment,null,Object.values(t))};function E2t(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,s){t={...t,[n]:$me.createPortal(s.reactElement,s.element,n)},e.forEach(i=>i())},removeRenderer(n){const s={...t};delete s[n],t=s,e.forEach(i=>i())}}}class I2t extends rt.Component{constructor(t){var n;super(t),this.editorContentRef=rt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=t.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=E2t(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const t=this.props.editor;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,innerRef:n,...s}=this.props;return rt.createElement(rt.Fragment,null,rt.createElement("div",{ref:T2t(n,this.editorContentRef),...s}),(t==null?void 0:t.contentComponent)&&rt.createElement(A2t,{contentComponent:t.contentComponent}))}}const P2t=I.forwardRef((e,t)=>{const n=rt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return rt.createElement(I2t,{key:n,innerRef:t,...e})}),cze=rt.memo(P2t);var L2t=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var s,i,o;if(Array.isArray(t)){if(s=t.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(s=t.length,s!=n.length)return!1;for(i=s;i--!==0;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),s=o.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=s;i--!==0;){var l=o[i];if(!(l==="_owner"&&t.$$typeof)&&!e(t[l],n[l]))return!1}return!0}return t!==t&&n!==n},O2t=C2t(L2t),dze={exports:{}},Cce={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var WNe;function D2t(){if(WNe)return Cce;WNe=1;var e=rt,t=fye;function n(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,a=e.useMemo,h=e.useDebugValue;return Cce.useSyncExternalStoreWithSelector=function(p,x,y,b,j){var N=o(null);if(N.current===null){var C={hasValue:!1,value:null};N.current=C}else C=N.current;N=a(function(){function E(q){if(!T){if(T=!0,L=q,q=b(q),j!==void 0&&C.hasValue){var H=C.value;if(j(H,q))return z=H}return z=q}if(H=z,s(L,q))return H;var K=b(q);return j!==void 0&&j(H,K)?H:(L=q,z=K)}var T=!1,L,z,F=y===void 0?null:y;return[function(){return E(x())},F===null?void 0:function(){return E(F())}]},[x,y,b,j]);var A=i(p,N[0],N[1]);return l(function(){C.hasValue=!0,C.value=A},[A]),h(A),A},Cce}dze.exports=D2t();var R2t=dze.exports;const F2t=typeof window<"u"?I.useLayoutEffect:I.useEffect;class z2t{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 n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},s=this.editor;return s.on("transaction",n),()=>{s.off("transaction",n)}}}}function B2t(e){var t;const[n]=I.useState(()=>new z2t(e.editor)),s=R2t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:O2t);return F2t(()=>n.watch(e.editor),[e.editor,n]),I.useDebugValue(s),s}const $2t=!1,efe=typeof window>"u",U2t=efe||!!(typeof window<"u"&&window.next);class pye{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,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(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?efe||U2t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(i,...s)},onBlur:(...s)=>{var i,o;return(o=(i=this.options.current).onBlur)===null||o===void 0?void 0:o.call(i,...s)},onCreate:(...s)=>{var i,o;return(o=(i=this.options.current).onCreate)===null||o===void 0?void 0:o.call(i,...s)},onDestroy:(...s)=>{var i,o;return(o=(i=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(i,...s)},onFocus:(...s)=>{var i,o;return(o=(i=this.options.current).onFocus)===null||o===void 0?void 0:o.call(i,...s)},onSelectionUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(i,...s)},onTransaction:(...s)=>{var i,o;return(o=(i=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(i,...s)},onUpdate:(...s)=>{var i,o;return(o=(i=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(i,...s)},onContentError:(...s)=>{var i,o;return(o=(i=this.options.current).onContentError)===null||o===void 0?void 0:o.call(i,...s)},onDrop:(...s)=>{var i,o;return(o=(i=this.options.current).onDrop)===null||o===void 0?void 0:o.call(i,...s)},onPaste:(...s)=>{var i,o;return(o=(i=this.options.current).onPaste)===null||o===void 0?void 0:o.call(i,...s)}};return new k2t(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((i,o)=>{var l;return i===((l=n.extensions)===null||l===void 0?void 0:l[o])}):t[s]===n[s])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?pye.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((s,i)=>s===t[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}}function uze(e={},t=[]){const n=I.useRef(e);n.current=e;const[s]=I.useState(()=>new pye(n)),i=fye.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return I.useDebugValue(i),I.useEffect(s.onRender(t)),B2t({editor:i,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),i}const q2t=I.createContext({editor:null});q2t.Consumer;const V2t=I.createContext({onDragStart:void 0}),H2t=()=>I.useContext(V2t);rt.forwardRef((e,t)=>{const{onDragStart:n}=H2t(),s=e.as||"div";return rt.createElement(s,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});const W2t=/^\s*>\s$/,G2t=Tm.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[xE({find:W2t,type:this.type})]}}),K2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Z2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Y2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,X2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Q2t=Dg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[wC({find:K2t,type:this.type}),wC({find:Y2t,type:this.type})]},addPasteRules(){return[Gj({find:Z2t,type:this.type}),Gj({find:X2t,type:this.type})]}}),J2t="listItem",GNe="textStyle",KNe=/^\s*([-+*])\s$/,ebt=Tm.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:e}){return["ul",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(J2t,this.editor.getAttributes(GNe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=xE({find:KNe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xE({find:KNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(GNe),editor:this.editor})),[e]}}),tbt=/(^|[^`])`([^`]+)`(?!`)/,rbt=/(^|[^`])`([^`]+)`(?!`)/g,nbt=Dg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[wC({find:tbt,type:this.type})]},addPasteRules(){return[Gj({find:rbt,type:this.type})]}}),sbt=/^```([a-z]+)?[\s\n]$/,ibt=/^~~~([a-z]+)?[\s\n]$/,abt=Tm.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",yd(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type)return!1;const o=s.parentOffset===s.parent.nodeSize-2,l=s.parent.textContent.endsWith(` `);return!o||!l?!1:e.chain().command(({tr:a})=>(a.delete(s.pos-2,s.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:s}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:s.nodeAt(a)?e.commands.command(({tr:p})=>(p.setSelection(la.near(s.resolve(a))),!0)):e.commands.exitCode()}}},addInputRules(){return[Qhe({find:sbt,type:this.type,getAttributes:e=>({language:e[1]})}),Qhe({find:ibt,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new zd({key:new df("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),s=t.clipboardData.getData("vscode-editor-data"),i=s?JSON.parse(s):void 0,o=i==null?void 0:i.mode;if(!n||!o)return!1;const{tr:l,schema:a}=e.state,h=a.text(n.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},h)),l.selection.$from.parent.type!==this.type&&l.setSelection(Ui.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),e.dispatch(l),!0}}})]}}),obt=Tm.create({name:"doc",topNode:!0,content:"block+"});function lbt(e={}){return new zd({view(t){return new cbt(t,e)}})}class cbt{constructor(t,n){var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=l=>{this[i](l)};return t.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,s,i=this.editorView.dom,o=i.getBoundingClientRect(),l=o.width/i.offsetWidth,a=o.height/i.offsetHeight;if(n){let y=t.nodeBefore,b=t.nodeAfter;if(y||b){let j=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(j){let N=j.getBoundingClientRect(),C=y?N.bottom:N.top;y&&b&&(C=(C+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let A=this.width/2*a;s={left:N.left,right:N.right,top:C-A,bottom:C+A}}}}if(!s){let y=this.editorView.coordsAtPos(this.cursorPos),b=this.width/2*l;s={left:y.left-b,right:y.left+b,top:y.top,bottom:y.bottom}}let h=this.editorView.dom.offsetParent;this.element||(this.element=h.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let p,x;if(!h||h==document.body&&getComputedStyle(h).position=="static")p=-pageXOffset,x=-pageYOffset;else{let y=h.getBoundingClientRect(),b=y.width/h.offsetWidth,j=y.height/h.offsetHeight;p=y.left-h.scrollLeft*b,x=y.top-h.scrollTop*j}this.element.style.left=(s.left-p)/l+"px",this.element.style.top=(s.top-x)/a+"px",this.element.style.width=(s.right-s.left)/l+"px",this.element.style.height=(s.bottom-s.top)/a+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=s&&s.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,t):i;if(n&&!o){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ZRe(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const dbt=Rd.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[lbt(this.options)]}});class Gl extends la{constructor(t){super(t,t)}map(t,n){let s=t.resolve(n.map(this.head));return Gl.valid(s)?new Gl(s):la.near(s)}content(){return fs.empty}eq(t){return t instanceof Gl&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Gl(t.resolve(n.pos))}getBookmark(){return new mye(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!ubt(t)||!hbt(t))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let i=n.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,n,s=!1){e:for(;;){if(!s&&Gl.valid(t))return t;let i=t.pos,o=null;for(let l=t.depth;;l--){let a=t.node(l);if(n>0?t.indexAfter(l)0){o=a.child(n>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;i+=n;let h=t.doc.resolve(i);if(Gl.valid(h))return h}for(;;){let l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!si.isSelectable(o)){t=t.doc.resolve(i+o.nodeSize*n),s=!1;continue e}break}o=l,i+=n;let a=t.doc.resolve(i);if(Gl.valid(a))return a}return null}}}Gl.prototype.visible=!1;Gl.findFrom=Gl.findGapCursorFrom;la.jsonID("gapcursor",Gl);class mye{constructor(t){this.pos=t}map(t){return new mye(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Gl.valid(n)?new Gl(n):la.near(n)}}function hze(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function ubt(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),s=e.node(t);if(n==0){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||hze(i.type))return!0;if(i.inlineContent)return!1}}return!0}function hbt(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),s=e.node(t);if(n==s.childCount){if(s.type.spec.isolating)return!0;continue}for(let i=s.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||hze(i.type))return!0;if(i.inlineContent)return!1}}return!0}function fbt(){return new zd({props:{decorations:xbt,createSelectionBetween(e,t,n){return t.pos==n.pos&&Gl.valid(n)?new Gl(n):null},handleClick:mbt,handleKeyDown:pbt,handleDOMEvents:{beforeinput:gbt}}})}const pbt=FFe({ArrowLeft:LL("horiz",-1),ArrowRight:LL("horiz",1),ArrowUp:LL("vert",-1),ArrowDown:LL("vert",1)});function LL(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(s,i,o){let l=s.selection,a=t>0?l.$to:l.$from,h=l.empty;if(l instanceof Ui){if(!o.endOfTextblock(n)||a.depth==0)return!1;h=!1,a=s.doc.resolve(t>0?a.after():a.before())}let p=Gl.findGapCursorFrom(a,t,h);return p?(i&&i(s.tr.setSelection(new Gl(p))),!0):!1}}function mbt(e,t,n){if(!e||!e.editable)return!1;let s=e.state.doc.resolve(t);if(!Gl.valid(s))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&si.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Gl(s))),!0)}function gbt(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Gl))return!1;let{$from:n}=e.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!s)return!1;let i=wn.empty;for(let l=s.length-1;l>=0;l--)i=wn.from(s[l].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new fs(i,0,0));return o.setSelection(Ui.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function xbt(e){if(!(e.selection instanceof Gl))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Fc.create(e.doc,[$f.widget(e.selection.head,t,{key:"gapcursor"})])}const ybt=Rd.create({name:"gapCursor",addProseMirrorPlugins(){return[fbt()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=ua(Ss(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),vbt=Tm.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",yd(this.options.HTMLAttributes,e)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:s})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:a}=s.extensionManager,h=o||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:p,dispatch:x})=>{if(x&&h&&l){const y=h.filter(b=>a.includes(b.type.name));p.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),_bt=Tm.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,yd(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Qhe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var Fte=200,gd=function(){};gd.prototype.append=function(t){return t.length?(t=gd.from(t),!this.length&&t||t.length=n?gd.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};gd.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};gd.prototype.forEach=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(t,n,s,0):this.forEachInvertedInner(t,n,s,0)};gd.prototype.map=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var i=[];return this.forEach(function(o,l){return i.push(t(o,l))},n,s),i};gd.from=function(t){return t instanceof gd?t:t&&t.length?new fze(t):gd.empty};var fze=function(e){function t(s){e.call(this),this.values=s}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new t(this.values.slice(i,o))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,o,l,a){for(var h=o;h=l;h--)if(i(this.values[h],a+h)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=Fte)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=Fte)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(gd);gd.empty=new fze([]);var bbt=function(e){function t(n,s){e.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(s){return sa&&this.right.forEachInner(s,Math.max(i-a,0),Math.min(this.length,o)-a,l+a)===!1)return!1},t.prototype.forEachInvertedInner=function(s,i,o,l){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(s,i-a,Math.max(o,a)-a,l+a)===!1||o=o?this.right.slice(s-o,i-o):this.left.slice(s,o).append(this.right.slice(0,i-o))},t.prototype.leafAppend=function(s){var i=this.right.leafAppend(s);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(s){var i=this.left.leafPrepend(s);if(i)return new t(i,this.right)},t.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new t(this.left,new t(this.right,s)):new t(this,s)},t}(gd);const wbt=500;class nm{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let i,o;n&&(i=this.remapping(s,this.items.length),o=i.maps.length);let l=t.tr,a,h,p=[],x=[];return this.items.forEach((y,b)=>{if(!y.step){i||(i=this.remapping(s,b+1),o=i.maps.length),o--,x.push(y);return}if(i){x.push(new rg(y.map));let j=y.step.map(i.slice(o)),N;j&&l.maybeStep(j).doc&&(N=l.mapping.maps[l.mapping.maps.length-1],p.push(new rg(N,void 0,void 0,p.length+x.length))),o--,N&&i.appendMap(N,o)}else l.maybeStep(y.step);if(y.selection)return a=i?y.selection.map(i.slice(o)):y.selection,h=new nm(this.items.slice(0,s).append(x.reverse().concat(p)),this.eventCount-1),!1},this.items.length,0),{remaining:h,transform:l,selection:a}}addTransform(t,n,s,i){let o=[],l=this.eventCount,a=this.items,h=!i&&a.length?a.get(a.length-1):null;for(let x=0;xkbt&&(a=jbt(a,p),l-=p),new nm(a.append(o),l)}remapping(t,n){let s=new dE;return this.items.forEach((i,o)=>{let l=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?s.maps.length-i.mirrorOffset:void 0;s.appendMap(i.map,l)},t,n),s}addMaps(t){return this.eventCount==0?this:new nm(this.items.append(t.map(n=>new rg(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let s=[],i=Math.max(0,this.items.length-n),o=t.mapping,l=t.steps.length,a=this.eventCount;this.items.forEach(b=>{b.selection&&a--},i);let h=n;this.items.forEach(b=>{let j=o.getMirror(--h);if(j==null)return;l=Math.min(l,j);let N=o.maps[j];if(b.step){let C=t.steps[j].invert(t.docs[j]),A=b.selection&&b.selection.map(o.slice(h+1,j));A&&a++,s.push(new rg(N,C,A))}else s.push(new rg(N))},i);let p=[];for(let b=n;bwbt&&(y=y.compress(this.items.length-s.length)),y}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),s=n.maps.length,i=[],o=0;return this.items.forEach((l,a)=>{if(a>=t)i.push(l),l.selection&&o++;else if(l.step){let h=l.step.map(n.slice(s)),p=h&&h.getMap();if(s--,p&&n.appendMap(p,s),h){let x=l.selection&&l.selection.map(n.slice(s));x&&o++;let y=new rg(p.invert(),h,x),b,j=i.length-1;(b=i.length&&i[j].merge(y))?i[j]=b:i.push(y)}}else l.map&&s--},this.items.length,0),new nm(gd.from(i.reverse()),o)}}nm.empty=new nm(gd.empty,0);function jbt(e,t){let n;return e.forEach((s,i)=>{if(s.selection&&t--==0)return n=i,!1}),e.slice(n)}class rg{constructor(t,n,s,i){this.map=t,this.step=n,this.selection=s,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new rg(n.getMap().invert(),n,this.selection)}}}class b0{constructor(t,n,s,i,o){this.done=t,this.undone=n,this.prevRanges=s,this.prevTime=i,this.prevComposition=o}}const kbt=20;function Nbt(e,t,n,s){let i=n.getMeta(Cj),o;if(i)return i.historyState;n.getMeta(Mbt)&&(e=new b0(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(l&&l.getMeta(Cj))return l.getMeta(Cj).redo?new b0(e.done.addTransform(n,void 0,s,mee(t)),e.undone,ZNe(n.mapping.maps),e.prevTime,e.prevComposition):new b0(e.done,e.undone.addTransform(n,void 0,s,mee(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),h=e.prevTime==0||!l&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-s.newGroupDelay||!Sbt(n,e.prevRanges)),p=l?Mce(e.prevRanges,n.mapping):ZNe(n.mapping.maps);return new b0(e.done.addTransform(n,h?t.selection.getBookmark():void 0,s,mee(t)),nm.empty,p,n.time,a??e.prevComposition)}else return(o=n.getMeta("rebased"))?new b0(e.done.rebased(n,o),e.undone.rebased(n,o),Mce(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new b0(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Mce(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Sbt(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((s,i)=>{for(let o=0;o=t[o]&&(n=!0)}),n}function ZNe(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((s,i,o,l)=>t.push(o,l));return t}function Mce(e,t){if(!e)return null;let n=[];for(let s=0;s{let i=Cj.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(s){let o=Cbt(i,n,e);o&&s(t?o.scrollIntoView():o)}return!0}}const mze=pze(!1,!0),gze=pze(!0,!0),Abt=Rd.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>mze(e,t),redo:()=>({state:e,dispatch:t})=>gze(e,t)}},addProseMirrorPlugins(){return[Tbt(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()}}}),Ebt=Tm.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",yd(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!S2t(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$from:s,$to:i}=n,o=e();return s.parentOffset===0?o.insertContentAt({from:Math.max(s.pos-1,0),to:i.pos},{type:this.name}):G_t(n)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:a})=>{var h;if(a){const{$to:p}=l.selection,x=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(Ui.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(si.create(l.doc,p.pos)):l.setSelection(Ui.create(l.doc,p.pos));else{const y=(h=p.parent.type.contentMatch.defaultType)===null||h===void 0?void 0:h.create();y&&(l.insert(x,y),l.setSelection(Ui.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[N2t({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Ibt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Pbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Lbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Obt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Dbt=Dg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[wC({find:Ibt,type:this.type}),wC({find:Lbt,type:this.type})]},addPasteRules(){return[Gj({find:Pbt,type:this.type}),Gj({find:Obt,type:this.type})]}}),Rbt=Tm.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",yd(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Fbt="listItem",XNe="textStyle",QNe=/^(\d+)\.\s$/,zbt=Tm.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",yd(this.options.HTMLAttributes,n),0]:["ol",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Fbt,this.editor.getAttributes(XNe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=xE({find:QNe,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=xE({find:QNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(XNe)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Bbt=Tm.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),$bt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ubt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qbt=Dg.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[wC({find:$bt,type:this.type})]},addPasteRules(){return[Gj({find:Ubt,type:this.type})]}}),Vbt=Tm.create({name:"text",group:"inline"}),xze=Rd.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(Q2t.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(G2t.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(ebt.configure(this.options.bulletList)),this.options.code!==!1&&e.push(nbt.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(abt.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(obt.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(dbt.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(ybt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(vbt.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(_bt.configure(this.options.heading)),this.options.history!==!1&&e.push(Abt.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(Ebt.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Dbt.configure(this.options.italic)),this.options.listItem!==!1&&e.push(Rbt.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(zbt.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Bbt.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(qbt.configure(this.options.strike)),this.options.text!==!1&&e.push(Vbt.configure(this.options.text)),e}}),Hbt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Wbt="ελ1υ2бг1ел3дети4ею2католик6ом3мкд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",tfe="numeric",rfe="ascii",nfe="alpha",gA="asciinumeric",gT="alphanumeric",sfe="domain",yze="emoji",Gbt="scheme",Kbt="slashscheme",Ace="whitespace";function Zbt(e,t){return e in t||(t[e]=[]),t[e]}function Ww(e,t,n){t[tfe]&&(t[gA]=!0,t[gT]=!0),t[rfe]&&(t[gA]=!0,t[nfe]=!0),t[gA]&&(t[gT]=!0),t[nfe]&&(t[gT]=!0),t[gT]&&(t[sfe]=!0),t[yze]&&(t[sfe]=!0);for(const s in t){const i=Zbt(s,n);i.indexOf(e)<0&&i.push(e)}}function Ybt(e,t){const n={};for(const s in t)t[s].indexOf(e)>=0&&(n[s]=!0);return n}function dh(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}dh.groups={};dh.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let s=0;se.ta(t,n,s,i),Bl=(e,t,n,s,i)=>e.tr(t,n,s,i),JNe=(e,t,n,s,i)=>e.ts(t,n,s,i),Cn=(e,t,n,s,i)=>e.tt(t,n,s,i),bx="WORD",ife="UWORD",vze="ASCIINUMERICAL",_ze="ALPHANUMERICAL",yE="LOCALHOST",afe="TLD",ofe="UTLD",gee="SCHEME",j4="SLASH_SCHEME",gye="NUM",lfe="WS",xye="NL",xA="OPENBRACE",yA="CLOSEBRACE",zte="OPENBRACKET",Bte="CLOSEBRACKET",$te="OPENPAREN",Ute="CLOSEPAREN",qte="OPENANGLEBRACKET",Vte="CLOSEANGLEBRACKET",Hte="FULLWIDTHLEFTPAREN",Wte="FULLWIDTHRIGHTPAREN",Gte="LEFTCORNERBRACKET",Kte="RIGHTCORNERBRACKET",Zte="LEFTWHITECORNERBRACKET",Yte="RIGHTWHITECORNERBRACKET",Xte="FULLWIDTHLESSTHAN",Qte="FULLWIDTHGREATERTHAN",Jte="AMPERSAND",ere="APOSTROPHE",tre="ASTERISK",w0="AT",rre="BACKSLASH",nre="BACKTICK",sre="CARET",T0="COLON",yye="COMMA",ire="DOLLAR",ng="DOT",are="EQUALS",vye="EXCLAMATION",Tf="HYPHEN",vA="PERCENT",ore="PIPE",lre="PLUS",cre="POUND",_A="QUERY",_ye="QUOTE",bze="FULLWIDTHMIDDLEDOT",bye="SEMI",sg="SLASH",bA="TILDE",dre="UNDERSCORE",wze="EMOJI",ure="SYM";var jze=Object.freeze({__proto__:null,ALPHANUMERICAL:_ze,AMPERSAND:Jte,APOSTROPHE:ere,ASCIINUMERICAL:vze,ASTERISK:tre,AT:w0,BACKSLASH:rre,BACKTICK:nre,CARET:sre,CLOSEANGLEBRACKET:Vte,CLOSEBRACE:yA,CLOSEBRACKET:Bte,CLOSEPAREN:Ute,COLON:T0,COMMA:yye,DOLLAR:ire,DOT:ng,EMOJI:wze,EQUALS:are,EXCLAMATION:vye,FULLWIDTHGREATERTHAN:Qte,FULLWIDTHLEFTPAREN:Hte,FULLWIDTHLESSTHAN:Xte,FULLWIDTHMIDDLEDOT:bze,FULLWIDTHRIGHTPAREN:Wte,HYPHEN:Tf,LEFTCORNERBRACKET:Gte,LEFTWHITECORNERBRACKET:Zte,LOCALHOST:yE,NL:xye,NUM:gye,OPENANGLEBRACKET:qte,OPENBRACE:xA,OPENBRACKET:zte,OPENPAREN:$te,PERCENT:vA,PIPE:ore,PLUS:lre,POUND:cre,QUERY:_A,QUOTE:_ye,RIGHTCORNERBRACKET:Kte,RIGHTWHITECORNERBRACKET:Yte,SCHEME:gee,SEMI:bye,SLASH:sg,SLASH_SCHEME:j4,SYM:ure,TILDE:bA,TLD:afe,UNDERSCORE:dre,UTLD:ofe,UWORD:ife,WORD:bx,WS:lfe});const xx=/[a-z]/,VM=new RegExp("\\p{L}","u"),Ece=new RegExp("\\p{Emoji}","u"),yx=/\d/,Ice=/\s/,e4e="\r",Pce=` `,Xbt="️",Qbt="‍",Lce="";let OL=null,DL=null;function Jbt(e=[]){const t={};dh.groups=t;const n=new dh;OL==null&&(OL=t4e(Hbt)),DL==null&&(DL=t4e(Wbt)),Cn(n,"'",ere),Cn(n,"{",xA),Cn(n,"}",yA),Cn(n,"[",zte),Cn(n,"]",Bte),Cn(n,"(",$te),Cn(n,")",Ute),Cn(n,"<",qte),Cn(n,">",Vte),Cn(n,"(",Hte),Cn(n,")",Wte),Cn(n,"「",Gte),Cn(n,"」",Kte),Cn(n,"『",Zte),Cn(n,"』",Yte),Cn(n,"<",Xte),Cn(n,">",Qte),Cn(n,"&",Jte),Cn(n,"*",tre),Cn(n,"@",w0),Cn(n,"`",nre),Cn(n,"^",sre),Cn(n,":",T0),Cn(n,",",yye),Cn(n,"$",ire),Cn(n,".",ng),Cn(n,"=",are),Cn(n,"!",vye),Cn(n,"-",Tf),Cn(n,"%",vA),Cn(n,"|",ore),Cn(n,"+",lre),Cn(n,"#",cre),Cn(n,"?",_A),Cn(n,'"',_ye),Cn(n,"/",sg),Cn(n,";",bye),Cn(n,"~",bA),Cn(n,"_",dre),Cn(n,"\\",rre),Cn(n,"・",bze);const s=Bl(n,yx,gye,{[tfe]:!0});Bl(s,yx,s);const i=Bl(s,xx,vze,{[gA]:!0}),o=Bl(s,VM,_ze,{[gT]:!0}),l=Bl(n,xx,bx,{[rfe]:!0});Bl(l,yx,i),Bl(l,xx,l),Bl(i,yx,i),Bl(i,xx,i);const a=Bl(n,VM,ife,{[nfe]:!0});Bl(a,xx),Bl(a,yx,o),Bl(a,VM,a),Bl(o,yx,o),Bl(o,xx),Bl(o,VM,o);const h=Cn(n,Pce,xye,{[Ace]:!0}),p=Cn(n,e4e,lfe,{[Ace]:!0}),x=Bl(n,Ice,lfe,{[Ace]:!0});Cn(n,Lce,x),Cn(p,Pce,h),Cn(p,Lce,x),Bl(p,Ice,x),Cn(x,e4e),Cn(x,Pce),Bl(x,Ice,x),Cn(x,Lce,x);const y=Bl(n,Ece,wze,{[yze]:!0});Cn(y,"#"),Bl(y,Ece,y),Cn(y,Xbt,y);const b=Cn(y,Qbt);Cn(b,"#"),Bl(b,Ece,y);const j=[[xx,l],[yx,i]],N=[[xx,null],[VM,a],[yx,o]];for(let C=0;CC[0]>A[0]?1:-1);for(let C=0;C=0?T[sfe]=!0:xx.test(A)?yx.test(A)?T[gA]=!0:T[rfe]=!0:T[tfe]=!0,JNe(n,A,A,T)}return JNe(n,"localhost",yE,{ascii:!0}),n.jd=new dh(ure),{start:n,tokens:Object.assign({groups:t},jze)}}function kze(e,t){const n=ewt(t.replace(/[A-Z]/g,a=>a.toLowerCase())),s=n.length,i=[];let o=0,l=0;for(;l=0&&(y+=n[l].length,b++),p+=n[l].length,o+=n[l].length,l++;o-=y,l-=b,p-=y,i.push({t:x.t,v:t.slice(o-p,o),s:o-p,e:o})}return i}function ewt(e){const t=[],n=e.length;let s=0;for(;s56319||s+1===n||(o=e.charCodeAt(s+1))<56320||o>57343?e[s]:e.slice(s,s+2);t.push(l),s+=l.length}return t}function o0(e,t,n,s,i){let o;const l=t.length;for(let a=0;a=0;)o++;if(o>0){t.push(n.join(""));for(let l=parseInt(e.substring(s,s+o),10);l>0;l--)n.pop();s+=o}else n.push(e[s]),s++}return t}const vE={defaultProtocol:"http",events:null,format:r4e,formatHref:r4e,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function wye(e,t=null){let n=Object.assign({},vE);e&&(n=Object.assign(n,e instanceof wye?e.o:e));const s=n.ignoreTags,i=[];for(let o=0;on?s.substring(0,n)+"…":s},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=vE.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),s=e.get("formatHref",n,this),i=e.get("tagName",n,t),o=this.toFormattedString(e),l={},a=e.get("className",n,t),h=e.get("target",n,t),p=e.get("rel",n,t),x=e.getObj("attributes",n,t),y=e.getObj("events",n,t);return l.href=s,a&&(l.class=a),h&&(l.target=h),p&&(l.rel=p),x&&Object.assign(l,x),{tagName:i,attributes:l,content:o,eventListeners:y}}};function Gse(e,t){class n extends Nze{constructor(i,o){super(i,o),this.t=e}}for(const s in t)n.prototype[s]=t[s];return n.t=e,n}const n4e=Gse("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),s4e=Gse("text"),twt=Gse("nl"),RL=Gse("url",{isLink:!0,toHref(e=vE.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==yE&&e[1].t===T0}}),Nf=e=>new dh(e);function rwt({groups:e}){const t=e.domain.concat([Jte,tre,w0,rre,nre,sre,ire,are,Tf,gye,vA,ore,lre,cre,sg,ure,bA,dre]),n=[ere,T0,yye,ng,vye,vA,_A,_ye,bye,qte,Vte,xA,yA,Bte,zte,$te,Ute,Hte,Wte,Gte,Kte,Zte,Yte,Xte,Qte],s=[Jte,ere,tre,rre,nre,sre,ire,are,Tf,xA,yA,vA,ore,lre,cre,_A,sg,ure,bA,dre],i=Nf(),o=Cn(i,bA);aa(o,s,o),aa(o,e.domain,o);const l=Nf(),a=Nf(),h=Nf();aa(i,e.domain,l),aa(i,e.scheme,a),aa(i,e.slashscheme,h),aa(l,s,o),aa(l,e.domain,l);const p=Cn(l,w0);Cn(o,w0,p),Cn(a,w0,p),Cn(h,w0,p);const x=Cn(o,ng);aa(x,s,o),aa(x,e.domain,o);const y=Nf();aa(p,e.domain,y),aa(y,e.domain,y);const b=Cn(y,ng);aa(b,e.domain,y);const j=Nf(n4e);aa(b,e.tld,j),aa(b,e.utld,j),Cn(p,yE,j);const N=Cn(y,Tf);Cn(N,Tf,N),aa(N,e.domain,y),aa(j,e.domain,y),Cn(j,ng,b),Cn(j,Tf,N);const C=Cn(j,T0);aa(C,e.numeric,n4e);const A=Cn(l,Tf),E=Cn(l,ng);Cn(A,Tf,A),aa(A,e.domain,l),aa(E,s,o),aa(E,e.domain,l);const T=Nf(RL);aa(E,e.tld,T),aa(E,e.utld,T),aa(T,e.domain,l),aa(T,s,o),Cn(T,ng,E),Cn(T,Tf,A),Cn(T,w0,p);const L=Cn(T,T0),z=Nf(RL);aa(L,e.numeric,z);const F=Nf(RL),q=Nf();aa(F,t,F),aa(F,n,q),aa(q,t,F),aa(q,n,q),Cn(T,sg,F),Cn(z,sg,F);const H=Cn(a,T0),K=Cn(h,T0),Z=Cn(K,sg),te=Cn(Z,sg);aa(a,e.domain,l),Cn(a,ng,E),Cn(a,Tf,A),aa(h,e.domain,l),Cn(h,ng,E),Cn(h,Tf,A),aa(H,e.domain,F),Cn(H,sg,F),Cn(H,_A,F),aa(te,e.domain,F),aa(te,t,F),Cn(te,sg,F);const ae=[[xA,yA],[zte,Bte],[$te,Ute],[qte,Vte],[Hte,Wte],[Gte,Kte],[Zte,Yte],[Xte,Qte]];for(let le=0;le=0&&b++,i++,x++;if(b<0)i-=x,i0&&(o.push(Oce(s4e,t,l)),l=[]),i-=b,x-=b;const j=y.t,N=n.slice(i-x,i);o.push(Oce(j,t,N))}}return l.length>0&&o.push(Oce(s4e,t,l)),o}function Oce(e,t,n){const s=n[0].s,i=n[n.length-1].e,o=t.slice(s,i);return new e(o,n)}const swt=typeof console<"u"&&console&&console.warn||(()=>{}),iwt="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ul={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function awt(){return dh.groups={},ul.scanner=null,ul.parser=null,ul.tokenQueue=[],ul.pluginQueue=[],ul.customSchemes=[],ul.initialized=!1,ul}function i4e(e,t=!1){if(ul.initialized&&swt(`linkifyjs: already initialized - will not register custom scheme "${e}" ${iwt}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`);ul.customSchemes.push([e,t])}function owt(){ul.scanner=Jbt(ul.customSchemes);for(let e=0;e{const i=t.some(p=>p.docChanged)&&!n.doc.eq(s.doc),o=t.some(p=>p.getMeta("preventAutolink"));if(!i||o)return;const{tr:l}=s,a=R_t(n.doc,[...t]);if(H_t(a).forEach(({newRange:p})=>{const x=z_t(s.doc,p,j=>j.isTextblock);let y,b;if(x.length>1)y=x[0],b=s.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(x.length){const j=s.doc.textBetween(p.from,p.to," "," ");if(!cwt.test(j))return;y=x[0],b=s.doc.textBetween(y.pos,p.to,void 0," ")}if(y&&b){const j=b.split(lwt).filter(Boolean);if(j.length<=0)return!1;const N=j[j.length-1],C=y.pos+b.lastIndexOf(N);if(!N)return!1;const A=jye(N).map(E=>E.toObject(e.defaultProtocol));if(!uwt(A))return!1;A.filter(E=>E.isLink).map(E=>({...E,from:C+E.start+1,to:C+E.end+1})).filter(E=>s.schema.marks.code?!s.doc.rangeHasMark(E.from,E.to,s.schema.marks.code):!0).filter(E=>e.validate(E.value)).filter(E=>e.shouldAutoLink(E.value)).forEach(E=>{uye(E.from,E.to,s.doc).some(T=>T.mark.type===e.type)||l.addMark(E.from,E.to,e.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function fwt(e){return new zd({key:new df("handleClickLink"),props:{handleClick:(t,n,s)=>{var i,o;if(s.button!==0||!t.editable)return!1;let l=s.target;const a=[];for(;l.nodeName!=="DIV";)a.push(l),l=l.parentNode;if(!a.find(b=>b.nodeName==="A"))return!1;const h=oze(t.state,e.type.name),p=s.target,x=(i=p==null?void 0:p.href)!==null&&i!==void 0?i:h.href,y=(o=p==null?void 0:p.target)!==null&&o!==void 0?o:h.target;return p&&x?(window.open(x,y),!0):!1}}})}function pwt(e){return new zd({key:new df("handlePasteLink"),props:{handlePaste:(t,n,s)=>{const{state:i}=t,{selection:o}=i,{empty:l}=o;if(l)return!1;let a="";s.content.forEach(p=>{a+=p.textContent});const h=Sze(a,{defaultProtocol:e.defaultProtocol}).find(p=>p.isLink&&p.value===a);return!a||!h?!1:e.editor.commands.setMark(e.type,{href:h.href})}}})}function l_(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(s=>{const i=typeof s=="string"?s:s.scheme;i&&n.push(i)}),!e||e.replace(dwt,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Cze=Dg.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 `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){i4e(e);return}i4e(e.scheme,e.optionalSlashes)})},onDestroy(){awt()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!l_(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!l_(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!l_(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",yd(this.options.HTMLAttributes,e),0]:["a",yd(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!l_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!l_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Gj({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:s}=this.options,i=Sze(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!l_(l,n),protocols:n,defaultProtocol:s}));i.length&&i.forEach(o=>t.push({text:o.value,data:{href:o.href},index:o.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(hwt({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:i=>!!l_(i,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(fwt({type:this.type})),this.options.linkOnPaste&&e.push(pwt({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),Mze=Rd.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:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).every(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).every(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},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")}}}),mwt=e=>{if(!e.children.length)return;const t=e.querySelectorAll("span");t&&t.forEach(n=>{var s,i;const o=n.getAttribute("style"),l=(i=(s=n.parentElement)===null||s===void 0?void 0:s.closest("span"))===null||i===void 0?void 0:i.getAttribute("style");n.setAttribute("style",`${l};${o}`)})},Tze=Dg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&mwt(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",yd(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(n,s)=>{if(n.isTextblock)return!0;n.marks.filter(i=>i.type===this.type).some(i=>Object.values(i.attrs).some(o=>!!o))||e.removeMark(s,s+n.nodeSize,this.type)}),!0}}}});function gy({content:e,onChange:t,placeholder:n="Enter content...",minHeight:s="150px"}){const[i,o]=I.useState(!1),[l,a]=I.useState(""),[h,p]=I.useState(!0),x=uze({extensions:[xze,Cze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),Mze.configure({types:["heading","paragraph"]}),Tze],content:e,onUpdate:({editor:N})=>{t(N.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n}}});I.useEffect(()=>{x&&e!==x.getHTML()&&x.commands.setContent(e)},[e,x]);const y=()=>{if(!x)return;const N=x.getAttributes("link").href||"",C=x.getAttributes("link").target;a(N),p(C==="_blank"),o(!0)},b=()=>{x&&(l===""?x.chain().focus().extendMarkRange("link").unsetLink().run():x.chain().focus().extendMarkRange("link").setLink({href:l,target:h?"_blank":null,rel:h?"noopener noreferrer nofollow":null}).run(),o(!1),a(""))},j=()=>{x&&x.chain().focus().extendMarkRange("link").unsetLink().run()};return x?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),className:x.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(PT,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),className:x.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(LT,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBold().run(),className:x.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(J4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleItalic().run(),className:x.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(iS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBulletList().run(),className:x.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(Wf,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleOrderedList().run(),className:x.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(cS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("left").run(),className:x.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("center").run(),className:x.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(Y4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("right").run(),className:x.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(Q4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:y,className:x.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(So,{className:"h-4 w-4"})}),x.isActive("link")&&r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:j,title:"Remove Link",children:r.jsx(So,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().undo().run(),disabled:!x.can().undo(),title:"Undo",children:r.jsx(gS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().redo().run(),disabled:!x.can().redo(),title:"Redo",children:r.jsx(pS,{className:"h-4 w-4"})})]}),r.jsx(cze,{editor:x,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none",style:{minHeight:s}})]}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"link-url",children:"URL"}),r.jsx(at,{id:"link-url",value:l,onChange:N=>a(N.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Rs,{id:"link-new-tab",checked:h,onCheckedChange:p}),r.jsx(Ue,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{type:"button",onClick:b,children:l?"Apply Link":"Remove Link"})]})]})})]}):null}const Kse=async e=>{try{const{data:t,error:n}=await J.from("push_notification_settings").select("is_enabled").eq("setting_key",e).maybeSingle();return n?(console.error("Error checking notification setting:",n),!0):(t==null?void 0:t.is_enabled)??!0}catch(t){return console.error("Error checking notification setting:",t),!0}},FI=async e=>{try{const{data:t,error:n}=await J.functions.invoke("send-push-notification",{body:e});return n?(console.error("Error sending notification:",n),{success:!1,error:n}):(console.log("Notification sent:",t),{success:!0,data:t})}catch(t){return console.error("Error sending notification:",t),{success:!1,error:t}}},gwt=async(e,t)=>await Kse("new_templates")?FI({title:"New Template Available",body:`Check out the new template: ${e}`,url:`/templates/${t}`}):(console.log("New template notifications are disabled"),{success:!1,skipped:!0}),xwt=async(e,t)=>FI({title:"New Academy Video",body:`New video added: ${e}`,url:`/academy/${t}`}),ywt=async(e,t)=>await Kse("new_events")?FI({title:"New Event",body:`New event: ${e}`,url:`/events/${t}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),vwt=async(e,t)=>await Kse("new_toolbox")?FI({title:"New Resource Kit",body:`New resource kit available: ${e}`,url:`/toolbox/${t}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),cfe=async(e,t)=>await Kse("new_social_swag")?FI({title:"New Social Swag",body:`New social swag available: ${e}`,url:`/social-swag/${t}`}):(console.log("New social swag notifications are disabled"),{success:!1,skipped:!0}),FL={title:"",description:"",image_url:"",video_url:"",event_date:void 0,event_time:"12:00",zoom_link:"",zoom_meeting_id:"",capacity:"",is_published:!1,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0};function _wt(){const e=ns(),t=Wr(),[n,s]=I.useState(!1),[i,o]=I.useState(null),[l,a]=I.useState(FL),[h,p]=I.useState(null),[x,y]=I.useState(null),[b,j]=I.useState(!1),N=I.useRef(null),[C,A]=I.useState(!1),[E,T]=I.useState(null),[L,z]=I.useState(!1),[F,q]=I.useState(null),[H,K]=I.useState(null),[Z,te]=I.useState(!0),[ae,le]=I.useState(""),{data:ve,isLoading:ne}=Zt({queryKey:["admin-events"],queryFn:async()=>{const{data:Ae,error:ht}=await J.from("events").select("*").order("event_date",{ascending:!0});if(ht)throw ht;return Ae}}),{data:ge}=Zt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:Ae,error:ht}=await J.from("event_registrations").select("event_id");if(ht)throw ht;const $e={};return Ae.forEach(Je=>{$e[Je.event_id]=($e[Je.event_id]||0)+1}),$e}}),{data:ie,isLoading:fe}=Zt({queryKey:["event-registrations-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Ae,error:ht}=await J.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",E.id).order("registered_at",{ascending:!1});if(ht)throw ht;if(!Ae||Ae.length===0)return[];const $e=Ae.map(ft=>ft.user_id).filter(Boolean);let Je=[];if($e.length>0){const{data:ft,error:jt}=await J.from("profiles").select("id, name, email").in("id",$e);if(jt)throw jt;Je=ft||[]}const tt=new Map((Je==null?void 0:Je.map(ft=>[ft.id,ft]))||[]);return Ae.map(ft=>({...ft,profiles:ft.user_id&&tt.get(ft.user_id)||null}))},enabled:!!E}),{data:de,isLoading:ye}=Zt({queryKey:["event-attendees-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Ae,error:ht}=await J.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",E.id).order("created_at",{ascending:!1});if(ht)throw ht;if(!Ae||Ae.length===0)return[];const $e=Ae.map(Nt=>Nt.user_id).filter(Boolean);let Je=[];if($e.length>0){const{data:Nt,error:Et}=await J.from("profiles").select("id, name, email").in("id",$e);if(Et)throw Et;Je=Nt||[]}const{data:tt}=await J.from("agent_points").select("user_id").eq("event_id",E.id),ft=new Set((tt==null?void 0:tt.map(Nt=>Nt.user_id))||[]),jt=new Map((Je==null?void 0:Je.map(Nt=>[Nt.id,Nt]))||[]);return Ae.map(Nt=>({...Nt,profiles:Nt.user_id&&jt.get(Nt.user_id)||null,points_awarded:Nt.user_id?ft.has(Nt.user_id):!1}))},enabled:!!E}),Ie=Ae=>{T(Ae),A(!0)},Ne=cr({mutationFn:async Ae=>{const{data:{session:ht}}=await J.auth.getSession();if(!ht)throw new Error("Not authenticated");const $e=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ht.access_token}`},body:JSON.stringify({event_id:Ae})}),Je=await $e.json();if(!$e.ok)throw new Error(Je.error||"Failed to sync");return Je},onSuccess:Ae=>{t.invalidateQueries({queryKey:["event-registrations-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-registrations-count"]}),ze.success(Ae.message)},onError:Ae=>{ze.error("Failed to sync: "+Ae.message)}}),we=cr({mutationFn:async Ae=>{const{data:{session:ht}}=await J.auth.getSession();if(!ht)throw new Error("Not authenticated");const $e=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ht.access_token}`},body:JSON.stringify({event_id:Ae})}),Je=await $e.json();if(!$e.ok)throw new Error(Je.error||"Failed to sync attendees");return Je},onSuccess:Ae=>{t.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]}),Ae!=null&&Ae.message?ze.success(Ae.message):ze.success(`Synced ${Ae.synced||0} attendees. ${Ae.points_awarded||0} points awarded!`)},onError:Ae=>{ze.error("Failed to sync attendees: "+Ae.message)}}),he=cr({mutationFn:async({eventId:Ae,testMode:ht})=>{const{data:{session:$e}}=await J.auth.getSession();if(!$e)throw new Error("Not authenticated");const Je=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${$e.access_token}`},body:JSON.stringify({event_id:Ae,test_mode:ht})}),tt=await Je.json();if(!Je.ok)throw new Error(tt.error||"Failed to send reminders");return tt},onSuccess:Ae=>{Ae.test?ze.success(Ae.message||"Test email sent!"):ze.success(Ae.message||`Reminder emails sent to ${Ae.sent} registrants!`)},onError:Ae=>{ze.error("Failed to send reminders: "+Ae.message)}}),{data:xe}=Zt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let Ae=[],ht=0;const $e=1e3;for(;;){const{data:Je,error:tt}=await J.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(ht,ht+$e-1);if(tt)throw tt;if(!Je||Je.length===0||(Ae=[...Ae,...Je],Je.length<$e))break;ht+=$e}return Ae},enabled:L}),be=cr({mutationFn:async({attendeeId:Ae,userId:ht,zoomEmail:$e,shouldSaveAlias:Je})=>{const{error:tt}=await J.from("event_attendees").update({user_id:ht}).eq("id",Ae);if(tt)throw tt;if(Je&&$e){const{error:jt}=await J.from("zoom_email_aliases").upsert({user_id:ht,zoom_email:$e.toLowerCase()},{onConflict:"zoom_email"});jt&&console.error("Failed to save alias:",jt)}const ft=E==null?void 0:E.id;if(ft){const{data:jt}=await J.from("user_roles").select("id").eq("user_id",ht).eq("role","admin").single();if(!jt){const{data:Nt}=await J.from("agent_points").select("id").eq("user_id",ht).eq("event_id",ft).single();Nt||(await J.rpc("award_attendance_points",{p_user_id:ht,p_event_id:ft,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await J.rpc("check_and_award_badges",{p_user_id:ht}))}}return{userId:ht,zoomEmail:$e,shouldSaveAlias:Je}},onSuccess:Ae=>{t.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]});let ht="Attendee linked and points awarded!";Ae.shouldSaveAlias&&Ae.zoomEmail&&(ht+=` Email "${Ae.zoomEmail}" will be auto-matched in the future.`),ze.success(ht),z(!1),q(null),K(null),le("")},onError:Ae=>{ze.error("Failed to link attendee: "+Ae.message)}}),Oe=Ae=>{q(Ae),K(null),te(!0),le(""),z(!0)},Te=()=>{!F||!H||be.mutate({attendeeId:F.id,userId:H,zoomEmail:F.zoom_email,shouldSaveAlias:Z})},Ve=(xe==null?void 0:xe.filter(Ae=>{var $e,Je;if(!ae)return!0;const ht=ae.toLowerCase();return(($e=Ae.name)==null?void 0:$e.toLowerCase().includes(ht))||((Je=Ae.email)==null?void 0:Je.toLowerCase().includes(ht))}))||[],Fe=async Ae=>{const ht=Ae.name.split(".").pop(),Je=`${`${crypto.randomUUID()}.${ht}`}`,{error:tt}=await J.storage.from("event-images").upload(Je,Ae);if(tt)throw tt;const{data:{publicUrl:ft}}=J.storage.from("event-images").getPublicUrl(Je);return ft},Me=Ae=>{var $e;const ht=($e=Ae.target.files)==null?void 0:$e[0];if(ht){if(ht.size>5*1024*1024){ze.error("Image must be less than 5MB");return}p(ht),y(URL.createObjectURL(ht))}},Qe=()=>{p(null),y(null),a({...l,image_url:""}),N.current&&(N.current.value="")},Ee=cr({mutationFn:async Ae=>{j(!0);let ht=Ae.image_url;h&&(ht=await Fe(h)||"");const $e=new Date(Ae.event_date),[Je,tt]=Ae.event_time.split(":");$e.setHours(parseInt(Je),parseInt(tt));const ft=[new Date($e)];if(Ae.is_recurring&&Ae.recurrence_end_date){let vt=new Date($e);for(;Ae.recurrence_pattern==="weekly"?vt=Uw(vt,1):Ae.recurrence_pattern==="biweekly"?vt=Uw(vt,2):vt=wh(vt,1),!(vt>Ae.recurrence_end_date);)ft.push(new Date(vt))}const jt=ft.map(vt=>({title:Ae.title,description:Ae.description||null,image_url:ht||null,video_url:Ae.video_url||null,event_date:vt.toISOString(),zoom_link:Ae.zoom_link,zoom_meeting_id:Ae.zoom_meeting_id||null,capacity:Ae.capacity?parseInt(Ae.capacity):null,is_published:Ae.is_published})),{data:Nt,error:Et}=await J.from("events").insert(jt).select();if(Et)throw Et;return Nt&&Nt.length>0&&ywt(Ae.title,Nt[0].id),ft.length},onSuccess:Ae=>{t.invalidateQueries({queryKey:["admin-events"]}),ze.success(Ae>1?`${Ae} recurring events created successfully`:"Event created successfully"),s(!1),a(FL),p(null),y(null),j(!1)},onError:Ae=>{ze.error("Failed to create event: "+Ae.message),j(!1)}}),Ye=cr({mutationFn:async({id:Ae,data:ht})=>{j(!0);let $e=ht.image_url;h&&($e=await Fe(h)||"");const Je=new Date(ht.event_date),[tt,ft]=ht.event_time.split(":");Je.setHours(parseInt(tt),parseInt(ft));const{error:jt}=await J.from("events").update({title:ht.title,description:ht.description||null,image_url:$e||null,video_url:ht.video_url||null,event_date:Je.toISOString(),zoom_link:ht.zoom_link,zoom_meeting_id:ht.zoom_meeting_id||null,capacity:ht.capacity?parseInt(ht.capacity):null,is_published:ht.is_published}).eq("id",Ae);if(jt)throw jt},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event updated successfully"),s(!1),o(null),a(FL),p(null),y(null),j(!1)},onError:Ae=>{ze.error("Failed to update event: "+Ae.message),j(!1)}}),me=cr({mutationFn:async Ae=>{const{error:ht}=await J.from("events").delete().eq("id",Ae);if(ht)throw ht},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event deleted successfully")},onError:Ae=>{ze.error("Failed to delete event: "+Ae.message)}}),mt=Ae=>{var $e;const ht=new Date(Ae.event_date);o(Ae),a({title:Ae.title,description:Ae.description||"",image_url:Ae.image_url||"",video_url:Ae.video_url||"",event_date:ht,event_time:xn(ht,"HH:mm"),zoom_link:Ae.zoom_link,zoom_meeting_id:Ae.zoom_meeting_id||"",capacity:(($e=Ae.capacity)==null?void 0:$e.toString())||"",is_published:Ae.is_published,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0}),y(Ae.image_url||null),p(null),s(!0)},et=Ae=>{if(Ae.preventDefault(),!l.event_date){ze.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){ze.error("Please select an end date for recurring events");return}i?Ye.mutate({id:i.id,data:l}):Ee.mutate(l)},nt=()=>{s(!1),o(null),a(FL),p(null),y(null)};return r.jsx("div",{className:"min-h-screen bg-background p-6",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>e("/dashboard"),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Event Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage upcoming events"})]})]}),r.jsxs(Ge,{className:"mb-6",children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Qt,{children:"All Events"}),r.jsxs(Br,{open:n,onOpenChange:Ae=>!Ae&&nt(),children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:i?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:et,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title *"}),r.jsx(at,{id:"title",value:l.title,onChange:Ae=>a({...l,title:Ae.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:l.description,onChange:Ae=>a({...l,description:Ae}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Event Image"}),r.jsx("input",{type:"file",ref:N,accept:"image/*",onChange:Me,className:"hidden"}),x?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:x,alt:"Event preview",className:"w-full h-32 object-cover rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:Qe,children:r.jsx(bs,{className:"h-4 w-4"})})]}):r.jsxs(ee,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var Ae;return(Ae=N.current)==null?void 0:Ae.click()},children:[r.jsx(no,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm",children:"Click to upload image"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Date *"}),r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),l.event_date?xn(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(nu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:l.event_date,onSelect:Ae=>a({...l,event_date:Ae}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"time",children:"Time *"}),r.jsx(at,{id:"time",type:"time",value:l.event_time,onChange:Ae=>a({...l,event_time:Ae.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(at,{id:"zoom_link",value:l.zoom_link,onChange:Ae=>a({...l,zoom_link:Ae.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(at,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:Ae=>a({...l,zoom_meeting_id:Ae.target.value}),placeholder:"e.g., 1234567890 (find in Zoom dashboard)"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional: Enter the numeric meeting ID for automatic Zoom registration"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(at,{id:"video_url",value:l.video_url,onChange:Ae=>a({...l,video_url:Ae.target.value}),placeholder:"YouTube, Vimeo, or Bunny.net embed URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a preview/promo video for this event"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(at,{id:"capacity",type:"number",value:l.capacity,onChange:Ae=>a({...l,capacity:Ae.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),!i&&r.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(HT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ue,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(Rs,{id:"is_recurring",checked:l.is_recurring,onCheckedChange:Ae=>a({...l,is_recurring:Ae})})]}),l.is_recurring&&r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Frequency"}),r.jsxs(vn,{value:l.recurrence_pattern,onValueChange:Ae=>a({...l,recurrence_pattern:Ae}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"weekly",children:"Weekly"}),r.jsx(Ht,{value:"biweekly",children:"Every 2 Weeks"}),r.jsx(Ht,{value:"monthly",children:"Monthly"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Repeat Until"}),r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?xn(l.recurrence_end_date,"PPP"):"Pick end date"]})}),r.jsx(nu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:l.recurrence_end_date,onSelect:Ae=>a({...l,recurrence_end_date:Ae}),disabled:Ae=>Ae<(l.event_date||new Date),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),l.event_date&&l.recurrence_end_date&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["This will create ",(()=>{let Ae=1,ht=new Date(l.event_date);for(;ht=l.recurrence_pattern==="weekly"?Uw(ht,1):l.recurrence_pattern==="biweekly"?Uw(ht,2):wh(ht,1),!(ht>l.recurrence_end_date);)Ae++;return Ae})()," events with the same Zoom link"]})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{htmlFor:"is_published",children:"Published"}),r.jsx(Rs,{id:"is_published",checked:l.is_published,onCheckedChange:Ae=>a({...l,is_published:Ae})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:nt,className:"flex-1",children:"Cancel"}),r.jsx(ee,{type:"submit",className:"flex-1",disabled:Ee.isPending||Ye.isPending||b,children:b?"Uploading...":i?"Update Event":l.is_recurring&&l.event_date&&l.recurrence_end_date?"Create Recurring Events":"Create Event"})]})]})]})]})]}),r.jsx(Xe,{children:ne?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(ve==null?void 0:ve.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Date & Time"}),r.jsx(It,{children:"Registrations"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:ve==null?void 0:ve.map(Ae=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:Ae.title}),r.jsx(_t,{children:xn(new Date(Ae.event_date),"PPP p")}),r.jsx(_t,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ie(Ae),children:[r.jsx(Vn,{className:"h-4 w-4"}),(ge==null?void 0:ge[Ae.id])||0,Ae.capacity&&` / ${Ae.capacity}`]})}),r.jsx(_t,{children:r.jsx("span",{className:$t("px-2 py-1 rounded-full text-xs font-medium",Ae.is_published?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"),children:Ae.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(Ae.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>mt(Ae),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&me.mutate(Ae.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},Ae.id))})]})})]}),r.jsx(Br,{open:C,onOpenChange:A,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5"}),E==null?void 0:E.title]}),r.jsx(es,{children:"View registrations and attendees for this event"})]}),r.jsxs("div",{className:"flex items-center justify-end mb-4 gap-2 flex-wrap",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>he.mutate({eventId:E.id,testMode:!0}),disabled:he.isPending,children:[r.jsx(Ys,{className:$t("h-4 w-4 mr-2",he.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>he.mutate({eventId:E.id}),disabled:he.isPending||!(ie!=null&&ie.length),children:[r.jsx(Ys,{className:$t("h-4 w-4 mr-2",he.isPending&&"animate-spin")}),he.isPending?"Sending...":"Send Reminder to All"]}),(E==null?void 0:E.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Ne.mutate(E.id),disabled:Ne.isPending,children:[r.jsx(Vl,{className:$t("h-4 w-4 mr-2",Ne.isPending&&"animate-spin")}),Ne.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(ee,{variant:"default",size:"sm",onClick:()=>we.mutate(E.id),disabled:we.isPending,children:[r.jsx(Wa,{className:$t("h-4 w-4 mr-2",we.isPending&&"animate-spin")}),we.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(ba,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsxs(ln,{value:"registrations",className:"gap-2",children:[r.jsx(Vn,{className:"h-4 w-4"}),"Registrations (",(ie==null?void 0:ie.length)||0,")"]}),r.jsxs(ln,{value:"attendees",className:"gap-2",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Attendees (",(de==null?void 0:de.length)||0,")"]})]}),r.jsx(An,{value:"registrations",className:"mt-4",children:fe?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(ie==null?void 0:ie.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Registered"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ws,{children:ie==null?void 0:ie.map(Ae=>{var tt,ft;const ht=((tt=Ae.profiles)==null?void 0:tt.name)||Ae.zoom_name||"Unknown",$e=((ft=Ae.profiles)==null?void 0:ft.email)||Ae.zoom_email||null,Je=!Ae.user_id;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ht,Je&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(_t,{children:$e?r.jsxs("a",{href:`mailto:${$e}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Ys,{className:"h-3 w-3"}),$e]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(_t,{className:"text-muted-foreground text-sm",children:xn(new Date(Ae.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(_t,{children:Ae.zoom_join_url?r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Registered"}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Ae.id)})})]})}),r.jsx(An,{value:"attendees",className:"mt-4",children:ye?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(de==null?void 0:de.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):r.jsxs(r.Fragment,{children:[(de==null?void 0:de.filter(Ae=>!Ae.user_id).length)>0&&r.jsxs("div",{className:"mb-6 p-4 border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(El,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),r.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",de==null?void 0:de.filter(Ae=>!Ae.user_id).length,")"]})]}),r.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 mb-3",children:"These attendees couldn't be matched to a profile. Link them to award points."}),r.jsx("div",{className:"space-y-2",children:de==null?void 0:de.filter(Ae=>!Ae.user_id).map(Ae=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium text-sm",children:Ae.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Ae.zoom_email||"No email"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Oe(Ae),className:"gap-1",children:[r.jsx(Xh,{className:"h-3 w-3"}),"Link to Profile"]})]},Ae.id))})]}),r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Points"})]})}),r.jsx(Ws,{children:de==null?void 0:de.filter(Ae=>Ae.user_id).map(Ae=>{var Je,tt;const ht=((Je=Ae.profiles)==null?void 0:Je.name)||Ae.zoom_name||"Unknown",$e=((tt=Ae.profiles)==null?void 0:tt.email)||Ae.zoom_email||null;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ht,Ae.manually_added&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:"Manual"})]})}),r.jsx(_t,{children:$e?r.jsxs("a",{href:`mailto:${$e}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Ys,{className:"h-3 w-3"}),$e]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(_t,{children:Ae.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Ki,{className:"h-3 w-3"}),Ae.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(_t,{children:Ae.points_awarded?r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:[r.jsx(Wa,{className:"h-3 w-3"}),"+10 pts"]}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Ae.id)})})]})]})})]})]})}),r.jsx(Br,{open:L,onOpenChange:z,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Xh,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(es,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),F&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm font-medium",children:F.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:F.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name or email...",value:ae,onChange:Ae=>le(Ae.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Ve.length===0?r.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No profiles found"}):r.jsx("div",{className:"divide-y",children:Ve.slice(0,20).map(Ae=>r.jsxs("button",{type:"button",onClick:()=>K(Ae.id),className:$t("w-full p-3 text-left hover:bg-muted/50 transition-colors",H===Ae.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:Ae.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Ae.email})]},Ae.id))})}),F.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(cc,{id:"save-alias",checked:Z,onCheckedChange:Ae=>te(Ae)}),r.jsx("label",{htmlFor:"save-alias",className:"text-sm text-muted-foreground cursor-pointer",children:"Remember this email for future auto-matching"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),r.jsx(ee,{onClick:Te,disabled:!H||be.isPending,children:be.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const bwt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=Fd(),[o,l]=I.useState(!1),[a,h]=I.useState(null),[p,x]=I.useState({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),[y,b]=I.useState(null),[j,N]=I.useState(0),[C,A]=I.useState(!1),[E,T]=I.useState(null),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,K]=I.useState(""),[Z,te]=I.useState(!1),[ae,le]=I.useState(!1),{data:ve=[]}=Zt({queryKey:["template-categories"],queryFn:async()=>{const{data:Ye,error:me}=await J.from("template_categories").select("*").order("name");if(me)throw me;return Ye}}),{data:ne=[]}=Zt({queryKey:["template-types"],queryFn:async()=>{const{data:Ye,error:me}=await J.from("template_types").select("*").order("name");if(me)throw me;return Ye}}),{data:ge=[],isLoading:ie}=Zt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:Ye,error:me}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(me)throw me;const{data:mt,error:et}=await J.from("template_links").select("*").order("sort_order");if(et)throw et;const{data:nt,error:Ae}=await J.from("template_guides").select("*").order("sort_order");if(Ae)throw Ae;return Ye.map($e=>({...$e,links:(mt==null?void 0:mt.filter(Je=>Je.template_id===$e.id))||[],guides:(nt==null?void 0:nt.filter(Je=>Je.template_id===$e.id))||[]}))}});I.useEffect(()=>{const Ye=s.get("edit");if(Ye&&ge.length>0){const me=ge.find(mt=>mt.id===Ye);me&&(we(me),i({},{replace:!0}))}},[ge,s]);const fe=cr({mutationFn:async Ye=>{const{data:me,error:mt}=await J.from("template_categories").insert({name:Ye}).select().single();if(mt)throw mt;return me},onSuccess:Ye=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...p,category_id:Ye.id}),q(""),te(!1),t({title:"Category added"})},onError:Ye=>{t({title:"Error adding category",description:Ye.message,variant:"destructive"})}}),de=cr({mutationFn:async Ye=>{const{data:me,error:mt}=await J.from("template_types").insert({name:Ye}).select().single();if(mt)throw mt;return me},onSuccess:Ye=>{n.invalidateQueries({queryKey:["template-types"]}),x({...p,type_id:Ye.id}),K(""),le(!1),t({title:"Type added"})},onError:Ye=>{t({title:"Error adding type",description:Ye.message,variant:"destructive"})}}),ye=cr({mutationFn:async Ye=>{var Ae;let me=Ye.existingImageUrl;if(Ye.image){const ht=Ye.image.name.split(".").pop(),$e=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ht}`,{error:Je}=await J.storage.from("template-previews").upload($e,Ye.image);if(Je)throw Je;const{data:tt}=J.storage.from("template-previews").getPublicUrl($e);me=tt.publicUrl}const mt={name:Ye.template.name,description:Ye.template.description||null,category_id:Ye.template.category_id||null,type_id:Ye.template.type_id||null,preview_image_url:me,video_url:Ye.videoUrl||null,publish_date:Ye.template.publish_date?new Date(Ye.template.publish_date).toISOString():new Date().toISOString(),created_by:e==null?void 0:e.id};let et=Ye.templateId;if(et){const{error:ht}=await J.from("canva_templates").update(mt).eq("id",et);if(ht)throw ht;const{error:$e}=await J.from("template_links").delete().eq("template_id",et);if($e)throw $e;const Je=((Ae=Ye.existingGuides)==null?void 0:Ae.map(jt=>jt.id).filter(Boolean))||[],tt=Ye.template.guides.map(jt=>jt.id).filter(Boolean),ft=Je.filter(jt=>!tt.includes(jt));ft.length>0&&await J.from("template_guides").delete().in("id",ft)}else{const{data:ht,error:$e}=await J.from("canva_templates").insert(mt).select().single();if($e)throw $e;et=ht.id,gwt(Ye.template.name,ht.id)}const nt=Ye.template.links.filter(ht=>ht.title.trim()&&ht.canva_share_link.trim());if(nt.length>0){const ht=nt.map((Je,tt)=>({template_id:et,title:Je.title.trim(),canva_share_link:Je.canva_share_link.trim(),sort_order:tt})),{error:$e}=await J.from("template_links").insert(ht);if($e)throw $e}for(let ht=0;ht{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),Ne(),l(!1),t({title:a?"Template updated":"Template created"})},onError:Ye=>{t({title:"Error saving template",description:Ye.message,variant:"destructive"})}}),Ie=cr({mutationFn:async Ye=>{const{error:me}=await J.from("canva_templates").delete().eq("id",Ye);if(me)throw me},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),t({title:"Template deleted"})},onError:Ye=>{t({title:"Error deleting template",description:Ye.message,variant:"destructive"})}}),Ne=()=>{x({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),T(null),z(""),h(null),te(!1),le(!1),q(""),K(""),b(null),N(0),A(!1)},we=Ye=>{var me;h(Ye),x({name:Ye.name,description:Ye.description||"",category_id:Ye.category_id||"",type_id:Ye.type_id||"",publish_date:Ye.publish_date?new Date(Ye.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:Ye.links&&Ye.links.length>0?Ye.links.map(mt=>({id:mt.id,title:mt.title,canva_share_link:mt.canva_share_link,sort_order:mt.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((me=Ye.guides)==null?void 0:me.map(mt=>({id:mt.id,name:mt.name,file_url:mt.file_url,file_type:mt.file_type,file_size:mt.file_size,sort_order:mt.sort_order})))||[],video_url:Ye.video_url||""}),z(Ye.preview_image_url||""),b(null),l(!0)},he=Ye=>{var mt;const me=(mt=Ye.target.files)==null?void 0:mt[0];me&&(T(me),z(URL.createObjectURL(me)))},xe=()=>{x({...p,links:[...p.links,{title:"",canva_share_link:"",sort_order:p.links.length}]})},be=Ye=>{if(p.links.length<=1)return;const me=p.links.filter((mt,et)=>et!==Ye);x({...p,links:me})},Oe=(Ye,me,mt)=>{const et=[...p.links];et[Ye]={...et[Ye],[me]:mt},x({...p,links:et})},Te=Ye=>{const me=Ye.target.files;if(!me)return;const mt=Array.from(me).map((et,nt)=>({name:et.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:et.type,file_size:et.size,sort_order:p.guides.length+nt,file:et}));x({...p,guides:[...p.guides,...mt]}),Ye.target.value=""},Ve=Ye=>{const me=p.guides.filter((mt,et)=>et!==Ye);x({...p,guides:me})},Fe=(Ye,me)=>{const mt=[...p.guides];mt[Ye]={...mt[Ye],name:me},x({...p,guides:mt})},Me=async()=>{if(!y)return null;A(!0),N(0);try{const{data:Ye,error:me}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:p.name||y.name}});if(me)throw new Error(me.message);const{videoId:mt,libraryId:et}=Ye,{data:nt,error:Ae}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:mt}});if(Ae)throw new Error(Ae.message);const ht=new XMLHttpRequest;return await new Promise((Je,tt)=>{ht.upload.addEventListener("progress",ft=>{if(ft.lengthComputable){const jt=Math.round(ft.loaded/ft.total*100);N(jt)}}),ht.addEventListener("load",()=>{ht.status>=200&&ht.status<300?Je():tt(new Error(`Upload failed with status ${ht.status}`))}),ht.addEventListener("error",()=>tt(new Error("Upload failed"))),ht.open("PUT",nt.uploadUrl),ht.setRequestHeader("AccessKey",nt.apiKey),ht.send(y)}),`https://player.mediadelivery.net/embed/${et}/${mt}`}catch(Ye){return console.error("Bunny upload error:",Ye),t({title:"Video upload failed",description:Ye instanceof Error?Ye.message:"Unknown error",variant:"destructive"}),null}finally{A(!1)}},Qe=Ye=>{var mt;const me=(mt=Ye.target.files)==null?void 0:mt[0];me&&b(me),Ye.target.value=""},Ee=async Ye=>{if(Ye.preventDefault(),!p.name.trim()){t({title:"Please enter a template name",variant:"destructive"});return}if(p.links.filter(et=>et.title.trim()&&et.canva_share_link.trim()).length===0){t({title:"Please add at least one Canva link",variant:"destructive"});return}let mt=p.video_url;if(y){const et=await Me();if(!et)return;mt=et}ye.mutate({template:p,image:E,existingImageUrl:(a==null?void 0:a.preview_image_url)||null,templateId:a==null?void 0:a.id,existingGuides:a==null?void 0:a.guides,videoUrl:mt})};return r.jsx(Or,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Manage Templates",description:"Create and manage Canva templates"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ge.length})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ve.length})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ne.length})})]})]}),r.jsxs(Br,{open:o,onOpenChange:Ye=>{l(Ye),Ye||Ne()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:a?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Ee,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Name *"}),r.jsx(at,{id:"name",value:p.name,onChange:Ye=>x({...p,name:Ye.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:p.description,onChange:Ye=>x({...p,description:Ye}),placeholder:"Brief description of the template",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{children:"Canva Links *"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:xe,className:"gap-1",children:[r.jsx(jn,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:p.links.map((Ye,me)=>r.jsxs("div",{className:"flex gap-2 items-start p-3 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(at,{value:Ye.title,onChange:mt=>Oe(me,"title",mt.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(at,{value:Ye.canva_share_link,onChange:mt=>Oe(me,"canva_share_link",mt.target.value),placeholder:"https://www.canva.com/design/..."})]}),p.links.length>1&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>be(me),children:r.jsx(bs,{className:"h-4 w-4"})})]},me))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Category"}),Z?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:F,onChange:Ye=>q(Ye.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>F.trim()&&fe.mutate(F.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{te(!1),q("")},children:r.jsx(bs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(vn,{value:p.category_id,onValueChange:Ye=>x({...p,category_id:Ye}),children:[r.jsx(mn,{className:"flex-1",children:r.jsx(_n,{placeholder:"Select category"})}),r.jsx(gn,{children:ve.map(Ye=>r.jsx(Ht,{value:Ye.id,children:Ye.name},Ye.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>te(!0),children:r.jsx(jn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Template Type"}),ae?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:H,onChange:Ye=>K(Ye.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>H.trim()&&de.mutate(H.trim()),disabled:de.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{le(!1),K("")},children:r.jsx(bs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(vn,{value:p.type_id,onValueChange:Ye=>x({...p,type_id:Ye}),children:[r.jsx(mn,{className:"flex-1",children:r.jsx(_n,{placeholder:"Select type"})}),r.jsx(gn,{children:ne.map(Ye=>r.jsx(Ht,{value:Ye.id,children:Ye.name},Ye.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>le(!0),children:r.jsx(jn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(at,{id:"publish_date",type:"date",value:p.publish_date,onChange:Ye=>x({...p,publish_date:Ye.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates are sorted by publish date (newest first) on the member page"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[L?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:L,alt:"Preview",className:"w-full h-full object-cover"}),r.jsx(ee,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{T(null),z("")},children:r.jsx(bs,{className:"h-3 w-3"})})]}):r.jsx("div",{className:"w-32 h-24 rounded-lg border-2 border-dashed border-muted-foreground/25 flex items-center justify-center",children:r.jsx(Do,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(at,{type:"file",accept:"image/*",onChange:he,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Upload a preview image for this template"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{children:"Video (Optional)"}),p.video_url&&!y?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Fi,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x({...p,video_url:""}),className:"text-destructive hover:text-destructive",children:"Remove"})]}),r.jsx("div",{className:"aspect-video max-w-md rounded-lg overflow-hidden border",children:r.jsx("iframe",{src:p.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):C?r.jsxs("div",{className:"space-y-2 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",j,"%"]})]}),r.jsx(Hc,{value:j,className:"h-2"})]}):y?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Fi,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:y.name}),r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(y.size/1024/1024).toFixed(1)," MB"]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>b(null),children:r.jsx(bs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(at,{type:"file",accept:"video/*",onChange:Qe,className:"hidden"}),r.jsxs("div",{className:"flex items-center justify-center gap-2 p-6 border-2 border-dashed rounded-lg hover:border-primary/50 transition-colors",children:[r.jsx(Fi,{className:"h-8 w-8 text-muted-foreground/50"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to upload a video"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a video to embed on the template page (Bunny.net)"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(at,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Te,className:"hidden"}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(no,{className:"h-3 w-3"}),"Add Files"]})})]})]}),p.guides.length>0?r.jsx("div",{className:"space-y-2",children:p.guides.map((Ye,me)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(wi,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(at,{value:Ye.name,onChange:mt=>Fe(me,mt.target.value),placeholder:"Guide name",className:"flex-1"}),Ye.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(Ye.file_size/1024).toFixed(0)," KB"]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Ve(me),children:r.jsx(bs,{className:"h-4 w-4"})})]},Ye.id||me))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>{l(!1),Ne()},children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:ye.isPending,children:ye.isPending?"Saving...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:ie?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):ge.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:ge.map(Ye=>{var me,mt,et,nt,Ae;return r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:Ye.preview_image_url?r.jsx("img",{src:Ye.preview_image_url,alt:Ye.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Do,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(_t,{className:"font-medium",children:Ye.name}),r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Rt,{variant:"secondary",children:[((me=Ye.links)==null?void 0:me.length)||0," link",(((mt=Ye.links)==null?void 0:mt.length)||0)!==1?"s":""]}),(((et=Ye.guides)==null?void 0:et.length)||0)>0&&r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(wi,{className:"h-3 w-3"}),(nt=Ye.guides)==null?void 0:nt.length," guide",(((Ae=Ye.guides)==null?void 0:Ae.length)||0)!==1?"s":""]})]})}),r.jsx(_t,{children:Ye.category?r.jsx(Rt,{variant:"secondary",children:Ye.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(_t,{children:Ye.type?r.jsx(Rt,{variant:"outline",children:Ye.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(_t,{className:"text-muted-foreground",children:new Date(Ye.publish_date).toLocaleDateString()}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"icon",variant:"ghost",onClick:()=>we(Ye),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Ie.mutate(Ye.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Ye.id)})})]})})})]})})},wwt=[{value:"bunny_stream",label:"Bunny.net Stream (Upload)"},{value:"youtube",label:"YouTube"},{value:"vimeo",label:"Vimeo"},{value:"google_drive",label:"Google Drive"},{value:"amazon_s3",label:"Amazon S3"},{value:"loom",label:"Loom"},{value:"other",label:"Other"}],jwt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=I.useState(!1),[o,l]=I.useState(null),[a,h]=I.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,b]=I.useState(""),[j,N]=I.useState([]),[C,A]=I.useState([]),[E,T]=I.useState([]),[L,z]=I.useState(""),[F,q]=I.useState(!1),[H,K]=I.useState(null),[Z,te]=I.useState(0),[ae,le]=I.useState(!1),[ve,ne]=I.useState(null),{data:ge=[]}=Zt({queryKey:["academy-categories"],queryFn:async()=>{const{data:Me,error:Qe}=await J.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(Qe)throw Qe;return Me}}),{data:ie=[],isLoading:fe}=Zt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:Me,error:Qe}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(Qe)throw Qe;const{data:Ee,error:Ye}=await J.from("academy_resources").select("*").order("sort_order");if(Ye)throw Ye;return Me.map(mt=>({...mt,resources:(Ee==null?void 0:Ee.filter(et=>et.video_id===mt.id))||[]}))}}),de=cr({mutationFn:async Me=>{const{data:Qe,error:Ee}=await J.from("academy_categories").insert({name:Me,sort_order:ge.length}).select().single();if(Ee)throw Ee;return Qe},onSuccess:Me=>{n.invalidateQueries({queryKey:["academy-categories"]}),h({...a,category_id:Me.id}),z(""),q(!1),t({title:"Category added"})},onError:Me=>{t({title:"Error adding category",description:Me.message,variant:"destructive"})}}),ye=cr({mutationFn:async Me=>{let Qe=Me.existingThumbnailUrl;if(Me.thumbnail){const me=Me.thumbnail.name.split(".").pop(),mt=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${me}`,{error:et}=await J.storage.from("academy-resources").upload(mt,Me.thumbnail);if(et)throw et;const{data:nt}=J.storage.from("academy-resources").getPublicUrl(mt);Qe=nt.publicUrl}const Ee={title:Me.video.title,description:Me.video.description||null,video_url:Me.video.video_url,video_type:Me.video.video_type,duration:Me.video.duration||null,thumbnail_url:Qe,category_id:Me.video.category_id||null,publish_date:Me.video.publish_date?new Date(Me.video.publish_date).toISOString():new Date().toISOString(),is_published:Me.video.is_published,created_by:e==null?void 0:e.id};let Ye=Me.videoId;if(Ye){const{error:me}=await J.from("academy_videos").update(Ee).eq("id",Ye);if(me)throw me}else{const{data:me,error:mt}=await J.from("academy_videos").insert(Ee).select().single();if(mt)throw mt;Ye=me.id,xwt(Me.video.title,me.id)}if(Me.resourcesToDelete.length>0){const{error:me}=await J.from("academy_resources").delete().in("id",Me.resourcesToDelete);if(me)throw me}for(let me=0;me{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),we(),i(!1),t({title:o?"Video updated":"Video created"})},onError:Me=>{t({title:"Error saving video",description:Me.message,variant:"destructive"})}}),Ie=cr({mutationFn:async Me=>{const{error:Qe}=await J.from("academy_videos").delete().eq("id",Me);if(Qe)throw Qe},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),t({title:"Video deleted"})},onError:Me=>{t({title:"Error deleting video",description:Me.message,variant:"destructive"})}}),Ne=cr({mutationFn:async({id:Me,is_published:Qe})=>{const{error:Ee}=await J.from("academy_videos").update({is_published:Qe}).eq("id",Me);if(Ee)throw Ee},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]})},onError:Me=>{t({title:"Error updating video",description:Me.message,variant:"destructive"})}}),we=()=>{h({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),b(""),N([]),A([]),T([]),l(null),q(!1),z(""),K(null),te(0),le(!1),ne(null)},he=Me=>{l(Me),h({title:Me.title,description:Me.description||"",video_url:Me.video_url,video_type:Me.video_type,duration:Me.duration||"",category_id:Me.category_id||"",publish_date:Me.publish_date?new Date(Me.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:Me.is_published}),b(Me.thumbnail_url||""),A(Me.resources||[]),N([]),T([]),i(!0)},xe=Me=>{var Ee;const Qe=(Ee=Me.target.files)==null?void 0:Ee[0];Qe&&(x(Qe),b(URL.createObjectURL(Qe)))},be=Me=>{const Qe=Me.target.files;if(Qe){const Ee=Array.from(Qe).map(Ye=>({file:Ye,title:Ye.name.replace(/\.[^/.]+$/,"")}));N([...j,...Ee])}Me.target.value=""},Oe=Me=>{N(j.filter((Qe,Ee)=>Ee!==Me))},Te=Me=>{T([...E,Me]),A(C.filter(Qe=>Qe.id!==Me))},Ve=async()=>{if(!H)return null;le(!0),te(0);try{const{data:Me,error:Qe}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:a.title||H.name}});if(Qe)throw new Error(Qe.message);const{videoId:Ee,libraryId:Ye}=Me;ne(Ee);const{data:me,error:mt}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ee}});if(mt)throw new Error(mt.message);const et=new XMLHttpRequest;return await new Promise((Ae,ht)=>{et.upload.addEventListener("progress",$e=>{if($e.lengthComputable){const Je=Math.round($e.loaded/$e.total*100);te(Je)}}),et.addEventListener("load",()=>{et.status>=200&&et.status<300?Ae():ht(new Error(`Upload failed with status ${et.status}`))}),et.addEventListener("error",()=>ht(new Error("Upload failed"))),et.open("PUT",me.uploadUrl),et.setRequestHeader("AccessKey",me.apiKey),et.send(H)}),`https://player.mediadelivery.net/embed/${Ye}/${Ee}`}catch(Me){return console.error("Bunny upload error:",Me),t({title:"Video upload failed",description:Me instanceof Error?Me.message:"Unknown error",variant:"destructive"}),null}finally{le(!1)}},Fe=async Me=>{if(Me.preventDefault(),!a.title.trim()){t({title:"Please enter a video title",variant:"destructive"});return}let Qe=a.video_url;if(a.video_type==="bunny_stream"&&H&&!o){const Ee=await Ve();if(!Ee)return;Qe=Ee}else if(!a.video_url.trim()&&a.video_type!=="bunny_stream"){t({title:"Please enter a video URL",variant:"destructive"});return}else if(a.video_type==="bunny_stream"&&!H&&!a.video_url&&!o){t({title:"Please select a video file to upload",variant:"destructive"});return}ye.mutate({video:{...a,video_url:Qe},thumbnail:p,existingThumbnailUrl:(o==null?void 0:o.thumbnail_url)||null,videoId:o==null?void 0:o.id,newResources:j,resourcesToDelete:E})};return r.jsx(Or,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Manage Academy",description:"Create and manage training videos and resources"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.length})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.filter(Me=>Me.is_published).length})})]})]}),r.jsxs(Br,{open:s,onOpenChange:Me=>{i(Me),Me||we()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:Fe,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title *"}),r.jsx(at,{id:"title",value:a.title,onChange:Me=>h({...a,title:Me.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:a.description,onChange:Me=>h({...a,description:Me}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Video Type"}),r.jsxs(vn,{value:a.video_type,onValueChange:Me=>{h({...a,video_type:Me,video_url:""}),K(null)},disabled:ae,children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:wwt.map(Me=>r.jsx(Ht,{value:Me.value,children:Me.label},Me.value))})]})]}),a.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Ue,{children:["Upload Video File ",!o&&"*"]}),o&&a.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:a.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsx(at,{type:"file",accept:"video/*",onChange:Me=>{var Ee;const Qe=(Ee=Me.target.files)==null?void 0:Ee[0];Qe&&K(Qe)},disabled:ae}),H&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Fi,{className:"h-4 w-4"}),H.name," (",(H.size/(1024*1024)).toFixed(1)," MB)"]}),ae&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Hc,{value:Z,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[Z,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(at,{id:"video_url",value:a.video_url,onChange:Me=>h({...a,video_url:Me.target.value}),placeholder:"https://...",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"duration",children:"Duration"}),r.jsx(at,{id:"duration",value:a.duration,onChange:Me=>h({...a,duration:Me.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(at,{id:"publish_date",type:"date",value:a.publish_date,onChange:Me=>h({...a,publish_date:Me.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Category"}),F?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:L,onChange:Me=>z(Me.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>L.trim()&&de.mutate(L.trim()),disabled:de.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),z("")},children:r.jsx(bs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(vn,{value:a.category_id,onValueChange:Me=>h({...a,category_id:Me}),children:[r.jsx(mn,{className:"flex-1",children:r.jsx(_n,{placeholder:"Select category"})}),r.jsx(gn,{children:ge.map(Me=>r.jsx(Ht,{value:Me.id,children:Me.name},Me.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!0),children:r.jsx(jn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[y&&r.jsx("img",{src:y,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(at,{type:"file",accept:"image/*",onChange:xe,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Recommended: 16:9 aspect ratio"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{children:"Resource Files"}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(no,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:be,className:"hidden"})]})})]}),(C.length>0||j.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[C.map(Me=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:Me.title}),r.jsx(Rt,{variant:"outline",className:"text-xs",children:Me.file_type}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>Te(Me.id),className:"text-destructive hover:text-destructive",children:r.jsx(bs,{className:"h-4 w-4"})})]},Me.id)),j.map((Me,Qe)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(at,{value:Me.title,onChange:Ee=>{const Ye=[...j];Ye[Qe].title=Ee.target.value,N(Ye)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>Oe(Qe),className:"text-destructive hover:text-destructive",children:r.jsx(bs,{className:"h-4 w-4"})})]},Qe))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"is_published",checked:a.is_published,onCheckedChange:Me=>h({...a,is_published:Me})}),r.jsx(Ue,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(ri,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:ae,children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:ye.isPending||ae,children:ae?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):ye.isPending?"Saving...":o?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:fe?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):ie.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No videos yet"}),r.jsx("p",{className:"text-sm",children:"Add your first academy video"})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(Ws,{children:ie.map(Me=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Me.thumbnail_url?r.jsx("img",{src:Me.thumbnail_url,alt:"",className:"w-16 h-10 object-cover rounded"}):r.jsx("div",{className:"w-16 h-10 bg-muted rounded flex items-center justify-center",children:r.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:Me.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:Me.video_type.replace("_"," ")})]})]})}),r.jsx(_t,{children:Me.category?r.jsx(Rt,{variant:"outline",children:Me.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(_t,{children:Me.duration||"-"}),r.jsx(_t,{children:Me.resources&&Me.resources.length>0?r.jsxs(Rt,{variant:"secondary",children:[Me.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(_t,{children:new Date(Me.publish_date).toLocaleDateString()}),r.jsx(_t,{children:r.jsx(Rs,{checked:Me.is_published,onCheckedChange:Qe=>Ne.mutate({id:Me.id,is_published:Qe})})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>he(Me),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Ie.mutate(Me.id),className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Me.id))})]})})})]})})};function kwt(){var Ne,we,he;const e=Wr(),[t,n]=Fd(),[s,i]=I.useState(!1),[o,l]=I.useState(null),[a,h]=I.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,b]=I.useState(""),[j,N]=I.useState([]),[C,A]=I.useState([]),[E,T]=I.useState(null),{data:L,isLoading:z}=Zt({queryKey:["resource-kits"],queryFn:async()=>{const{data:xe,error:be}=await J.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(be)throw be;return xe}}),{data:F}=Zt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:xe,error:be}=await J.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(be)throw be;return xe}}),{data:q}=Zt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:xe,error:be}=await J.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(be)throw be;return xe}});I.useEffect(()=>{const xe=t.get("edit");if(xe&&L&&L.length>0&&F&&q){const be=L.find(Oe=>Oe.id===xe);be&&(K(be),n({},{replace:!0}))}},[L,F,q,t]);const H=()=>{h({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),b(""),N([]),A([]),l(null)},K=xe=>{l(xe),h({name:xe.name,description:xe.description||"",publish_date:xe.publish_date.split("T")[0],is_published:xe.is_published}),b(xe.featured_image_url||"");const be=(F==null?void 0:F.filter(Te=>Te.kit_id===xe.id))||[];N(be.map(Te=>({id:Te.id,name:Te.name,file_url:Te.file_url,file_type:Te.file_type,file_size:Te.file_size,sort_order:Te.sort_order})));const Oe=(q==null?void 0:q.filter(Te=>Te.kit_id===xe.id))||[];A(Oe.map(Te=>({id:Te.id,title:Te.title,canva_share_link:Te.canva_share_link,sort_order:Te.sort_order}))),i(!0)},Z=xe=>{var Oe;const be=(Oe=xe.target.files)==null?void 0:Oe[0];be&&(x(be),b(URL.createObjectURL(be)))},te=()=>{N([...j,{name:"",file_url:"",sort_order:j.length}])},ae=xe=>{N(j.filter((be,Oe)=>Oe!==xe))},le=(xe,be,Oe)=>{const Te=[...j];Te[xe]={...Te[xe],[be]:Oe},N(Te)},ve=()=>{A([...C,{title:"",canva_share_link:"",sort_order:C.length}])},ne=xe=>{A(C.filter((be,Oe)=>Oe!==xe))},ge=(xe,be,Oe)=>{const Te=[...C];Te[xe]={...Te[xe],[be]:Oe},A(Te)},ie=(xe,be)=>{var Te;const Oe=(Te=be.target.files)==null?void 0:Te[0];if(Oe){const Ve=[...j],Fe=Oe.name.replace(/\.[^/.]+$/,"");Ve[xe]={...Ve[xe],file:Oe,file_type:Oe.type,file_size:Oe.size,name:Ve[xe].name||Fe},N(Ve)}},fe=cr({mutationFn:async()=>{let xe=(o==null?void 0:o.featured_image_url)||null;if(p){const Fe=p.name.split(".").pop(),Me=`${Date.now()}.${Fe}`,{error:Qe}=await J.storage.from("resource-kits").upload(`featured/${Me}`,p);if(Qe)throw Qe;const{data:Ee}=J.storage.from("resource-kits").getPublicUrl(`featured/${Me}`);xe=Ee.publicUrl}const be={name:a.name,description:a.description||null,featured_image_url:xe,publish_date:a.publish_date,is_published:a.is_published};let Oe;const Te=!o,Ve=(o==null?void 0:o.is_published)||!1;if(o){const{error:Fe}=await J.from("resource_kits").update(be).eq("id",o.id);if(Fe)throw Fe;Oe=o.id;const Me=(F==null?void 0:F.filter(et=>et.kit_id===o.id).map(et=>et.id))||[],Qe=j.filter(et=>et.id).map(et=>et.id),Ee=Me.filter(et=>!Qe.includes(et));Ee.length>0&&await J.from("resource_kit_files").delete().in("id",Ee);const Ye=(q==null?void 0:q.filter(et=>et.kit_id===o.id).map(et=>et.id))||[],me=C.filter(et=>et.id).map(et=>et.id),mt=Ye.filter(et=>!me.includes(et));mt.length>0&&await J.from("resource_kit_links").delete().in("id",mt)}else{const{data:Fe,error:Me}=await J.from("resource_kits").insert(be).select().single();if(Me)throw Me;Oe=Fe.id}for(let Fe=0;Fe{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),e.invalidateQueries({queryKey:["resource-kit-links"]}),ze.success(o?"Resource kit updated":"Resource kit created"),xe.isPublished&&(xe.isNewKit||!xe.wasPublished)&&vwt(xe.kitName,xe.kitId),i(!1),H()},onError:xe=>{ze.error("Failed to save resource kit: "+xe.message)}}),de=cr({mutationFn:async xe=>{const{error:be}=await J.from("resource_kits").delete().eq("id",xe);if(be)throw be},onSuccess:()=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),ze.success("Resource kit deleted")},onError:xe=>{ze.error("Failed to delete: "+xe.message)}}),ye=xe=>{if(xe.preventDefault(),!a.name){ze.error("Please enter a name");return}fe.mutate()},Ie=xe=>(F==null?void 0:F.filter(be=>be.kit_id===xe).length)||0;return r.jsx(Or,{title:"Toolbox Management",description:"Create and manage resource kits for agents",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(L==null?void 0:L.length)||0})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(L==null?void 0:L.filter(xe=>xe.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{H(),i(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Files"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:z?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(L==null?void 0:L.length)===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):L==null?void 0:L.map(xe=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[xe.featured_image_url?r.jsx("img",{src:xe.featured_image_url,alt:xe.name,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Dl,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:xe.name}),xe.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:xe.description})]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),Ie(xe.id)]})}),r.jsx(_t,{children:xn(new Date(xe.publish_date),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${xe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:xe.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const be=(F==null?void 0:F.filter(Te=>Te.kit_id===xe.id))||[],Oe=(q==null?void 0:q.filter(Te=>Te.kit_id===xe.id))||[];T({...xe,files:be,links:Oe})},children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>K(xe),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&de.mutate(xe.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},xe.id))})]})})}),r.jsx(Br,{open:s,onOpenChange:i,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:ye,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Featured Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[y?r.jsx("img",{src:y,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(Dl,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(at,{type:"file",accept:"image/*",onChange:Z})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Name *"}),r.jsx(at,{id:"name",value:a.name,onChange:xe=>h({...a,name:xe.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:a.description,onChange:xe=>h({...a,description:xe}),placeholder:"Brief description of this resource kit",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(at,{id:"publish_date",type:"date",value:a.publish_date,onChange:xe=>h({...a,publish_date:xe.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Rs,{checked:a.is_published,onCheckedChange:xe=>h({...a,is_published:xe})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:a.is_published?"Visible to agents":"Hidden from agents"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ue,{children:"Resource Files"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:te,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),j.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No files added yet. Click "Add File" to include resources.'}):r.jsx("div",{className:"space-y-3",children:j.map((xe,be)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["File ",be+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ae(be),children:r.jsx(bs,{className:"h-4 w-4"})})]}),r.jsx(at,{placeholder:"File name (e.g., Getting Started Guide)",value:xe.name,onChange:Oe=>le(be,"name",Oe.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(at,{type:"file",onChange:Oe=>ie(be,Oe),className:"flex-1"}),xe.file_url&&!xe.file&&r.jsx("a",{href:xe.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),xe.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},be))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ue,{children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),C.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No Canva links added yet. Click "Add Canva Link" to include templates.'}):r.jsx("div",{className:"space-y-3",children:C.map((xe,be)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["Canva Link ",be+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ne(be),children:r.jsx(bs,{className:"h-4 w-4"})})]}),r.jsx(at,{placeholder:"Link title (e.g., Social Media Post Template)",value:xe.title,onChange:Oe=>ge(be,"title",Oe.target.value)}),r.jsx(at,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:xe.canva_share_link,onChange:Oe=>ge(be,"canva_share_link",Oe.target.value)})]},be))})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:fe.isPending,children:fe.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Br,{open:!!E,onOpenChange:()=>T(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:E==null?void 0:E.name})}),r.jsxs("div",{className:"space-y-4",children:[(E==null?void 0:E.featured_image_url)&&r.jsx("img",{src:E.featured_image_url,alt:E.name,className:"w-full h-48 object-cover rounded-lg"}),(E==null?void 0:E.description)&&r.jsx("p",{className:"text-muted-foreground",children:E.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((Ne=E==null?void 0:E.files)==null?void 0:Ne.length)||0,")"]}),((we=E==null?void 0:E.files)==null?void 0:we.length)===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No files in this kit"}):r.jsx("div",{className:"space-y-2",children:(he=E==null?void 0:E.files)==null?void 0:he.map(xe=>r.jsxs("a",{href:xe.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(wi,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:xe.name})]},xe.id))})]}),(E==null?void 0:E.links)&&E.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",E.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:E.links.map(xe=>r.jsxs("a",{href:xe.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(So,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:xe.title})]},xe.id))})]})]})]})})]})})}const Nwt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=I.useState(!1),[o,l]=I.useState(null),[a,h]=I.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[p,x]=I.useState(null),[y,b]=I.useState(""),{data:j=[],isLoading:N}=Zt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:K,error:Z}=await J.from("social_swag").select("*").order("publish_date",{ascending:!1});if(Z)throw Z;const{data:te,error:ae}=await J.from("social_swag_links").select("*").order("sort_order");if(ae)throw ae;return K.map(ve=>({...ve,links:(te==null?void 0:te.filter(ne=>ne.swag_id===ve.id))||[]}))}}),C=cr({mutationFn:async K=>{let Z=K.existingImageUrl;if(K.image){const ge=K.image.name.split(".").pop(),ie=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ge}`,{error:fe}=await J.storage.from("template-previews").upload(ie,K.image);if(fe)throw fe;const{data:de}=J.storage.from("template-previews").getPublicUrl(ie);Z=de.publicUrl}const te={title:K.item.title,description:K.item.description||null,preview_image_url:Z,publish_date:K.item.publish_date?new Date(K.item.publish_date).toISOString():new Date().toISOString(),is_published:K.item.is_published,created_by:e==null?void 0:e.id};let ae=K.itemId;const le=!ae,ve=(o==null?void 0:o.is_published)||!1;if(ae){const{error:ge}=await J.from("social_swag").update(te).eq("id",ae);if(ge)throw ge;await J.from("social_swag_links").delete().eq("swag_id",ae)}else{const{data:ge,error:ie}=await J.from("social_swag").insert(te).select().single();if(ie)throw ie;ae=ge.id}const ne=K.item.links.filter(ge=>ge.title.trim()&&ge.canva_share_link.trim());if(ne.length>0){const ge=ne.map((fe,de)=>({swag_id:ae,title:fe.title.trim(),canva_share_link:fe.canva_share_link.trim(),sort_order:de})),{error:ie}=await J.from("social_swag_links").insert(ge);if(ie)throw ie}return{itemId:ae,itemTitle:K.item.title,isNewItem:le,wasPublished:ve,isPublished:K.item.is_published}},onSuccess:K=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:o?"Item updated":"Item created"}),K.isPublished&&(K.isNewItem||!K.wasPublished)&&cfe(K.itemTitle,K.itemId),i(!1),E()},onError:K=>{t({title:"Error saving item",description:K.message,variant:"destructive"})}}),A=cr({mutationFn:async K=>{const{error:Z}=await J.from("social_swag").delete().eq("id",K);if(Z)throw Z},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:"Item deleted"})},onError:K=>{t({title:"Error deleting item",description:K.message,variant:"destructive"})}}),E=()=>{h({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),x(null),b(""),l(null)},T=K=>{l(K),h({title:K.title,description:K.description||"",publish_date:K.publish_date?new Date(K.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:K.is_published,links:K.links&&K.links.length>0?K.links.map(Z=>({id:Z.id,title:Z.title,canva_share_link:Z.canva_share_link,sort_order:Z.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),b(K.preview_image_url||""),i(!0)},L=K=>{var te;const Z=(te=K.target.files)==null?void 0:te[0];Z&&(x(Z),b(URL.createObjectURL(Z)))},z=()=>{h({...a,links:[...a.links,{title:"",canva_share_link:"",sort_order:a.links.length}]})},F=K=>{if(a.links.length<=1)return;const Z=a.links.filter((te,ae)=>ae!==K);h({...a,links:Z})},q=(K,Z,te)=>{const ae=[...a.links];ae[K]={...ae[K],[Z]:te},h({...a,links:ae})},H=K=>{if(K.preventDefault(),!a.title.trim()){t({title:"Title is required",variant:"destructive"});return}C.mutate({item:a,image:p,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Or,{title:"Manage Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Manage Social Swag",description:"Create and manage social media content"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(K=>K.is_published).length})})]})]}),r.jsxs(Br,{open:s,onOpenChange:K=>{i(K),K||E()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:H,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title *"}),r.jsx(at,{id:"title",value:a.title,onChange:K=>h({...a,title:K.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:a.description,onChange:K=>h({...a,description:K}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(at,{id:"publish_date",type:"date",value:a.publish_date,onChange:K=>h({...a,publish_date:K.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Rs,{id:"is_published",checked:a.is_published,onCheckedChange:K=>h({...a,is_published:K})}),r.jsx(Ue,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),b("")},children:r.jsx(bs,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Do,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(at,{type:"file",accept:"image/*",onChange:L,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:z,children:[r.jsx(jn,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),a.links.map((K,Z)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4 pb-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",Z+1]}),a.links.length>1&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>F(Z),children:r.jsx(bs,{className:"h-3 w-3"})})]}),r.jsx(at,{placeholder:"Link title (e.g., Instagram Post)",value:K.title,onChange:te=>q(Z,"title",te.target.value)}),r.jsx(at,{placeholder:"Canva share link",value:K.canva_share_link,onChange:te=>q(Z,"canva_share_link",te.target.value)})]})},Z))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:C.isPending,children:C.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:N?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):j.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No items yet. Click "Add Item" to create your first one.'}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:j.map(K=>{var Z;return r.jsxs(Ir,{children:[r.jsx(_t,{children:K.preview_image_url?r.jsx("img",{src:K.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Do,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(_t,{className:"font-medium",children:K.title}),r.jsxs(_t,{children:[((Z=K.links)==null?void 0:Z.length)||0," links"]}),r.jsx(_t,{children:new Date(K.publish_date).toLocaleDateString()}),r.jsx(_t,{children:r.jsx(Rt,{variant:K.is_published?"default":"secondary",children:K.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${K.id}`,"_blank"),children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(K),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&A.mutate(K.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},K.id)})})]})})})]})})},Swt=()=>{const e=Wr(),[t,n]=I.useState("all"),[s,i]=I.useState(!1),[o,l]=I.useState(xn(new Date,"yyyy-MM")),[a,h]=I.useState([]),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,N]=I.useState(!1),[C,A]=I.useState(xn(new Date,"yyyy-MM")),[E,T]=I.useState(null),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,K]=I.useState(""),[Z,te]=I.useState(!1),{data:ae=[],isLoading:le}=Zt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Me,error:Qe}=await J.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Qe)throw Qe;return Me}}),{data:ve=[]}=Zt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Me,error:Qe}=await J.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Qe)throw Qe;return Me}}),{data:ne=[]}=Zt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Me,error:Qe}=await J.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Qe)throw Qe;return Me}}),ge=[...new Set(ae.map(Me=>Me.month))].sort((Me,Qe)=>Qe.localeCompare(Me)),ie=t==="all"?ae:ae.filter(Me=>Me.month===t),fe=Me=>{const Qe=fxe(Me,"yyyy-MM",new Date);return xn(Qe,"MMMM yyyy")},de=Me=>{const Ee=Array.from(Me.target.files||[]).slice(0,16-a.length).map(Ye=>({file:Ye,preview:URL.createObjectURL(Ye),caption:""}));h(Ye=>[...Ye,...Ee].slice(0,16))},ye=Me=>{h(Qe=>{const Ee=[...Qe];return URL.revokeObjectURL(Ee[Me].preview),Ee.splice(Me,1),Ee})},Ie=(Me,Qe)=>{h(Ee=>{const Ye=[...Ee];return Ye[Me]={...Ye[Me],caption:Qe},Ye})},Ne=async()=>{if(a.length===0){ze.error("Please add at least one image");return}if(a.filter(Qe=>!Qe.caption.trim()).length>0){ze.error("Please add captions to all images");return}x(!0);try{for(let Qe=0;Qe{const Qe=Me.image_url.split("/social-swag-2/");Qe[1]&&await J.storage.from("social-swag-2").remove([Qe[1]]);const{error:Ee}=await J.from("social_swag_2").delete().eq("id",Me.id);if(Ee)throw Ee},onSuccess:()=>{ze.success("Image deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>{ze.error("Failed to delete image")}}),he=cr({mutationFn:async({month:Me,link:Qe})=>{const{error:Ee}=await J.from("social_swag_2_months").upsert({month:Me,canva_link:Qe||null},{onConflict:"month"});if(Ee)throw Ee},onSuccess:()=>{ze.success("Canva link updated"),b(null),e.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>{ze.error("Failed to update Canva link")}}),xe=Me=>{var Qe;return((Qe=ve.find(Ee=>Ee.month===Me))==null?void 0:Qe.canva_link)||""},be=Me=>ne.find(Qe=>Qe.month===Me)||null,Oe=Me=>{var Ee;const Qe=(Ee=Me.target.files)==null?void 0:Ee[0];Qe&&(T(Qe),z(URL.createObjectURL(Qe)))},Te=()=>{L&&URL.revokeObjectURL(L),T(null),z(""),q(""),K("")},Ve=async()=>{if(!E){ze.error("Please select an image");return}te(!0);try{const Me=E.name.split(".").pop(),Qe=`reels/${C}-${Date.now()}.${Me}`,{error:Ee}=await J.storage.from("social-swag-2").upload(Qe,E);if(Ee)throw Ee;const{data:{publicUrl:Ye}}=J.storage.from("social-swag-2").getPublicUrl(Qe),{error:me}=await J.from("social_swag_2_reels").upsert({month:C,image_url:Ye,canva_link:H||null,caption:F||null},{onConflict:"month"});if(me)throw me;ze.success("Reel uploaded successfully!"),cfe(`${fe(C)} Reel`,"social-swag-2"),Te(),N(!1),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Me){console.error("Reel upload error:",Me),ze.error("Failed to upload reel")}finally{te(!1)}},Fe=cr({mutationFn:async Me=>{const Qe=Me.image_url.split("/social-swag-2/");Qe[1]&&await J.storage.from("social-swag-2").remove([Qe[1]]);const{error:Ee}=await J.from("social_swag_2_reels").delete().eq("id",Me.id);if(Ee)throw Ee},onSuccess:()=>{ze.success("Reel deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>{ze.error("Failed to delete reel")}});return r.jsx(Or,{title:"Admin - Social Swag 2.0",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Social Swag 2.0"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage monthly social media images and captions"})]}),r.jsxs(Br,{open:s,onOpenChange:i,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Fr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Month"}),r.jsx(at,{type:"month",value:o,onChange:Me=>l(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{children:["Images (",a.length,"/16)"]}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:de,className:"hidden",id:"swag-upload",disabled:a.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(no,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select images (max 16)"})]})]})]}),a.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:a.map((Me,Qe)=>r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"relative aspect-[4/5] rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:Me.preview,alt:`Upload ${Qe+1}`,className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>ye(Qe),children:r.jsx(bs,{className:"h-3 w-3"})})]}),r.jsx(ps,{placeholder:"Caption...",value:Me.caption,onChange:Ee=>Ie(Qe,Ee.target.value),className:"text-xs h-20"})]},Qe))}),r.jsx(ee,{onClick:Ne,disabled:p||a.length===0,className:"w-full gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4"}),"Upload ",a.length," Images"]})})]})]})]}),r.jsxs(Br,{open:j,onOpenChange:Me=>{N(Me),Me||Te()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Fr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Month"}),r.jsx(at,{type:"month",value:C,onChange:Me=>A(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Reel Preview Image"}),L?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:L,alt:"Reel preview",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(L),T(null),z("")},children:r.jsx(bs,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:Oe,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(Ad,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Canva Download Link"}),r.jsx(at,{value:H,onChange:Me=>K(Me.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Caption"}),r.jsx(ps,{value:F,onChange:Me=>q(Me.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(ee,{onClick:Ve,disabled:Z||!E,className:"w-full gap-2",children:Z?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ae.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ge.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(ba,{value:t,onValueChange:n,children:r.jsxs(fa,{children:[r.jsx(ln,{value:"all",children:"All"}),ge.map(Me=>r.jsx(ln,{value:Me,children:fe(Me)},Me))]})}),t!=="all"&&r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(So,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Ue,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",fe(t)]}),(y==null?void 0:y.month)===t?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(at,{value:y.link,onChange:Me=>b({...y,link:Me.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(ee,{size:"sm",onClick:()=>he.mutate(y),children:"Save"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>b(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:xe(t)||"No link set"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>b({month:t,link:xe(t)}),children:"Edit"})]})]})]})})}),t!=="all"&&r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(Ad,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(Ue,{className:"text-sm text-muted-foreground",children:["Reel for ",fe(t)]}),(()=>{const Me=be(t);return Me?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:Me.image_url,alt:"Reel preview",className:"w-16 h-28 object-cover rounded"}),r.jsxs("div",{className:"flex-1 text-sm",children:[r.jsx("p",{className:"line-clamp-2",children:Me.caption||"No caption"}),Me.canva_link&&r.jsx("a",{href:Me.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(ee,{variant:"destructive",size:"sm",onClick:()=>Fe.mutate(Me),children:r.jsx(Zn,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),le?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):ie.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Do,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images yet. Upload some!"})]}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:ie.map(Me=>r.jsxs(Ge,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative aspect-[4/5]",children:[r.jsx("img",{src:Me.image_url,alt:"Social swag",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:()=>we.mutate(Me),children:r.jsx(Zn,{className:"h-4 w-4"})})]}),r.jsx(Xe,{className:"p-3",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:Me.caption})})]},Me.id))})]})})},Cwt=()=>{const{toast:e}=pa(),t=Wr(),[n,s]=I.useState("categories"),[i,o]=I.useState(!1),[l,a]=I.useState(null),[h,p]=I.useState({name:"",description:"",icon:""}),[x,y]=I.useState(!1),[b,j]=I.useState(null),[N,C]=I.useState({name:"",description:"",icon:""}),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState(""),{data:q=[],isLoading:H}=Zt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Fe,error:Me}=await J.from("community_categories").select("*").order("sort_order");if(Me)throw Me;return Fe}}),{data:K=[],isLoading:Z}=Zt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Fe,error:Me}=await J.from("community_private_groups").select("*").order("sort_order");if(Me)throw Me;return Fe}}),{data:te=[]}=Zt({queryKey:["admin-group-members",T==null?void 0:T.id],queryFn:async()=>{if(!T)return[];const{data:Fe,error:Me}=await J.from("community_private_group_members").select("*").eq("group_id",T.id);if(Me)throw Me;return Fe},enabled:!!T}),{data:ae=[]}=Zt({queryKey:["admin-all-profiles"],queryFn:async()=>{let Me=[],Qe=0,Ee=!0;for(;Ee;){const{data:Ye,error:me}=await J.from("profiles").select("id, name, email, brokerage_id").order("name").range(Qe,Qe+1e3-1);if(me)throw me;Ye&&Ye.length>0?(Me=[...Me,...Ye],Qe+=1e3,Ee=Ye.length===1e3):Ee=!1}return Me}}),{data:le=[]}=Zt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Fe,error:Me}=await J.from("brokerages").select("*").order("name");if(Me)throw Me;return Fe}}),ve=cr({mutationFn:async Fe=>{if(Fe.id){const{error:Me}=await J.from("community_categories").update({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null}).eq("id",Fe.id);if(Me)throw Me}else{const Me=Math.max(...q.map(Ee=>Ee.sort_order),0),{error:Qe}=await J.from("community_categories").insert({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null,sort_order:Me+1});if(Qe)throw Qe}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),a(null),p({name:"",description:"",icon:""}),e({title:l?"Category updated!":"Category created!"})},onError:Fe=>{e({title:"Error",description:Fe.message,variant:"destructive"})}}),ne=cr({mutationFn:async Fe=>{const{error:Me}=await J.from("community_categories").delete().eq("id",Fe);if(Me)throw Me},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),e({title:"Category deleted"})}}),ge=cr({mutationFn:async({id:Fe,direction:Me})=>{const Qe=q.findIndex(Ee=>Ee.id===Fe);if(Me==="up"&&Qe>0){const Ee=q[Qe-1],Ye=q[Qe];await J.from("community_categories").update({sort_order:Ye.sort_order}).eq("id",Ee.id),await J.from("community_categories").update({sort_order:Ee.sort_order}).eq("id",Ye.id)}else if(Me==="down"&&Qet.invalidateQueries({queryKey:["admin-community-categories"]})}),ie=cr({mutationFn:async Fe=>{if(Fe.id){const{error:Me}=await J.from("community_private_groups").update({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null}).eq("id",Fe.id);if(Me)throw Me}else{const Me=Math.max(...K.map(Ee=>Ee.sort_order),0),{error:Qe}=await J.from("community_private_groups").insert({name:Fe.name,description:Fe.description||null,icon:Fe.icon||null,sort_order:Me+1});if(Qe)throw Qe}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),j(null),C({name:"",description:"",icon:""}),e({title:b?"Private group updated!":"Private group created!"})},onError:Fe=>{e({title:"Error",description:Fe.message,variant:"destructive"})}}),fe=cr({mutationFn:async Fe=>{const{error:Me}=await J.from("community_private_groups").delete().eq("id",Fe);if(Me)throw Me},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),e({title:"Private group deleted"})}}),de=cr({mutationFn:async({id:Fe,direction:Me})=>{const Qe=K.findIndex(Ee=>Ee.id===Fe);if(Me==="up"&&Qe>0){const Ee=K[Qe-1],Ye=K[Qe];await J.from("community_private_groups").update({sort_order:Ye.sort_order}).eq("id",Ee.id),await J.from("community_private_groups").update({sort_order:Ee.sort_order}).eq("id",Ye.id)}else if(Me==="down"&&Qet.invalidateQueries({queryKey:["admin-private-groups"]})}),ye=cr({mutationFn:async({groupId:Fe,userId:Me,isMember:Qe})=>{if(Qe){const{error:Ee}=await J.from("community_private_group_members").delete().eq("group_id",Fe).eq("user_id",Me);if(Ee)throw Ee}else{const{error:Ee}=await J.from("community_private_group_members").insert({group_id:Fe,user_id:Me});if(Ee)throw Ee}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ie=cr({mutationFn:async({groupId:Fe,brokerageId:Me,isMember:Qe})=>{if(Qe){const{error:Ee}=await J.from("community_private_group_members").delete().eq("group_id",Fe).eq("brokerage_id",Me);if(Ee)throw Ee}else{const{error:Ee}=await J.from("community_private_group_members").insert({group_id:Fe,brokerage_id:Me});if(Ee)throw Ee}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ne=Fe=>{a(Fe),p({name:Fe.name,description:Fe.description||"",icon:Fe.icon||""}),o(!0)},we=()=>{a(null),p({name:"",description:"",icon:""}),o(!0)},he=Fe=>{j(Fe),C({name:Fe.name,description:Fe.description||"",icon:Fe.icon||""}),y(!0)},xe=()=>{j(null),C({name:"",description:"",icon:""}),y(!0)},be=Fe=>{L(Fe),F(""),E(!0)},Oe=Fe=>te.some(Me=>Me.user_id===Fe),Te=Fe=>te.some(Me=>Me.brokerage_id===Fe),Ve=ae.filter(Fe=>Fe.name.toLowerCase().includes(z.toLowerCase())||Fe.email.toLowerCase().includes(z.toLowerCase()));return r.jsx(Or,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(ba,{value:n,onValueChange:s,children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"categories",children:"Public Categories"}),r.jsxs(ln,{value:"private-groups",children:[r.jsx(Gf,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(An,{value:"categories",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Categories visible to all community members"}),r.jsxs(ee,{onClick:we,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Ws,{children:H?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):q.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):q.map((Fe,Me)=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Me===0,onClick:()=>ge.mutate({id:Fe.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Me===q.length-1,onClick:()=>ge.mutate({id:Fe.id,direction:"down"}),children:"↓"})]})}),r.jsx(_t,{className:"text-2xl",children:Fe.icon||"📁"}),r.jsx(_t,{className:"font-medium",children:Fe.name}),r.jsx(_t,{className:"text-muted-foreground",children:Fe.description||"—"}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ne(Fe),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ne.mutate(Fe.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},Fe.id))})]})})})]}),r.jsxs(An,{value:"private-groups",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Private groups visible only to assigned members or brokerages"}),r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(na,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(ee,{onClick:xe,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[120px]",children:"Members"}),r.jsx(It,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(Ws,{children:Z?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):K.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):K.map((Fe,Me)=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Me===0,onClick:()=>de.mutate({id:Fe.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:Me===K.length-1,onClick:()=>de.mutate({id:Fe.id,direction:"down"}),children:"↓"})]})}),r.jsx(_t,{className:"text-2xl",children:Fe.icon||"🔒"}),r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Fe.name,Fe.brokerage_id?r.jsxs(Rt,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:[r.jsx(Gf,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(_t,{className:"text-muted-foreground",children:Fe.description||"—"}),r.jsx(_t,{children:r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>be(Fe),children:[r.jsx(Vn,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[!Fe.brokerage_id&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>he(Fe),children:r.jsx(ha,{className:"h-4 w-4"})}),!Fe.brokerage_id&&r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&fe.mutate(Fe.id)},children:r.jsx(Zn,{className:"h-4 w-4"})}),Fe.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Fe.id))})]})})})]})]}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:l?"Edit Category":"Create Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(at,{value:h.icon,onChange:Fe=>p(Me=>({...Me,icon:Fe.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(at,{value:h.name,onChange:Fe=>p(Me=>({...Me,name:Fe.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ps,{value:h.description,onChange:Fe=>p(Me=>({...Me,description:Fe.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{onClick:()=>ve.mutate({...h,id:l==null?void 0:l.id}),disabled:!h.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Br,{open:x,onOpenChange:y,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:b?"Edit Private Group":"Create Private Group"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(at,{value:N.icon,onChange:Fe=>C(Me=>({...Me,icon:Fe.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(at,{value:N.name,onChange:Fe=>C(Me=>({...Me,name:Fe.target.value})),placeholder:"e.g., Pioneers",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ps,{value:N.description,onChange:Fe=>C(Me=>({...Me,description:Fe.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(ee,{onClick:()=>ie.mutate({...N,id:b==null?void 0:b.id}),disabled:!N.name.trim(),children:b?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Br,{open:A,onOpenChange:E,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ba,{defaultValue:"brokerages",children:[r.jsxs(fa,{className:"w-full",children:[r.jsx(ln,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(ln,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(An,{value:"brokerages",className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select brokerages to grant all their agents access to this private group."}),r.jsx(Jo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[le.map(Fe=>r.jsxs("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(cc,{checked:Te(Fe.id),onCheckedChange:()=>{T&&Ie.mutate({groupId:T.id,brokerageId:Fe.id,isMember:Te(Fe.id)})}}),r.jsx("span",{className:"font-medium",children:Fe.name})]}),r.jsxs(Rt,{variant:"secondary",children:[ae.filter(Me=>Me.brokerage_id===Fe.id).length," agents"]})]},Fe.id)),le.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(An,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search users...",value:z,onChange:Fe=>F(Fe.target.value),className:"pl-9"})]}),r.jsx(Jo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Ve.map(Fe=>r.jsx("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(cc,{checked:Oe(Fe.id),onCheckedChange:()=>{T&&ye.mutate({groupId:T.id,userId:Fe.id,isMember:Oe(Fe.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Fe.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Fe.email})]})]})},Fe.id)),Ve.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No users found"})]})})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(ee,{onClick:()=>E(!1),children:"Done"})})]})]})})]})})},a4e=e=>{switch(e){case"academy_video":return r.jsx(dc,{className:"h-3 w-3"});case"template":return r.jsx(wi,{className:"h-3 w-3"});case"toolbox":return r.jsx(Dl,{className:"h-3 w-3"});case"newsletter":return r.jsx(Wx,{className:"h-3 w-3"});case"social_swag":return r.jsx(Cs,{className:"h-3 w-3"});default:return r.jsx(Fs,{className:"h-3 w-3"})}},Mwt=e=>{switch(e){case"academy_video":return"Academy";case"template":return"Template";case"toolbox":return"Toolbox";case"newsletter":return"Newsletter";case"social_swag":return"Social Swag";default:return e}},Twt=e=>{switch(e){case"view":return"Viewed";case"click_canva":return"Clicked Canva";case"click_pdf":return"Downloaded PDF";case"click_video":return"Watched Video";case"click_link":return"Clicked Link";case"click_drive":return"Clicked Drive";default:return e}},Awt=()=>{const{toast:e}=pa(),[t,n]=I.useState([]),[s,i]=I.useState([]),[o,l]=I.useState([]),[a,h]=I.useState(!0),[p,x]=I.useState(""),[y,b]=I.useState(null),[j,N]=I.useState([]),[C,A]=I.useState([]);I.useEffect(()=>{E()},[]);const E=async()=>{try{h(!0);const{data:F,error:q}=await J.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(q)throw q;const{data:H,error:K}=await J.from("content_engagement_logs").select(` id, user_id, resource_type, resource_id, resource_title, action_type, created_at `).order("created_at",{ascending:!1}).limit(5e3);if(K)throw K;const Z=[...new Set((H==null?void 0:H.map(ie=>ie.user_id))||[])],{data:te}=await J.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",Z),ae=new Map((te==null?void 0:te.map(ie=>[ie.id,ie]))||[]),le=(F==null?void 0:F.map(ie=>{var fe,de,ye,Ie;return{id:ie.id,user_id:ie.user_id,app_name:ie.app_name,launched_at:ie.launched_at,user_name:((fe=ie.profiles)==null?void 0:fe.name)||"Unknown",user_email:((de=ie.profiles)==null?void 0:de.email)||"Unknown",brokerage_name:((Ie=(ye=ie.profiles)==null?void 0:ye.brokerages)==null?void 0:Ie.name)||null}}))||[],ve=(H==null?void 0:H.map(ie=>{var de;const fe=ae.get(ie.user_id);return{id:ie.id,user_id:ie.user_id,resource_type:ie.resource_type,resource_id:ie.resource_id,resource_title:ie.resource_title,action_type:ie.action_type,created_at:ie.created_at,user_name:(fe==null?void 0:fe.name)||"Unknown",user_email:(fe==null?void 0:fe.email)||"Unknown",brokerage_name:((de=fe==null?void 0:fe.brokerages)==null?void 0:de.name)||null}}))||[];n(le),i(ve);const ne=new Map;le.forEach(ie=>{if(!ne.has(ie.user_id))ne.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:"app",last_activity_name:ie.app_name,last_activity_at:ie.launched_at,total_app_launches:1,total_content_views:0});else{const fe=ne.get(ie.user_id);fe.total_app_launches++,new Date(ie.launched_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type="app",fe.last_activity_name=ie.app_name,fe.last_activity_at=ie.launched_at)}}),ve.forEach(ie=>{if(!ne.has(ie.user_id))ne.set(ie.user_id,{user_id:ie.user_id,user_name:ie.user_name,user_email:ie.user_email,brokerage_name:ie.brokerage_name,last_activity_type:ie.resource_type,last_activity_name:ie.resource_title,last_activity_at:ie.created_at,total_app_launches:0,total_content_views:1});else{const fe=ne.get(ie.user_id);fe.total_content_views++,new Date(ie.created_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type=ie.resource_type,fe.last_activity_name=ie.resource_title,fe.last_activity_at=ie.created_at)}});const ge=Array.from(ne.values()).sort((ie,fe)=>new Date(fe.last_activity_at).getTime()-new Date(ie.last_activity_at).getTime());l(ge)}catch(F){console.error("Error loading activity:",F),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{h(!1)}},T=F=>{b({id:F.user_id,name:F.user_name,email:F.user_email});const q=t.filter(K=>K.user_id===F.user_id),H=s.filter(K=>K.user_id===F.user_id);N(q),A(H)},L=()=>{b(null),N([]),A([])},z=o.filter(F=>{var H;if(!p)return!0;const q=p.toLowerCase();return F.user_name.toLowerCase().includes(q)||F.user_email.toLowerCase().includes(q)||((H=F.brokerage_name)==null?void 0:H.toLowerCase().includes(q))});return a?r.jsx(Ge,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"User Activity"}),r.jsx(En,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name, email, or brokerage...",value:p,onChange:F=>x(F.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"Last Activity"}),r.jsx(It,{children:"Last Active"}),r.jsx(It,{className:"text-right",children:"Apps"}),r.jsx(It,{className:"text-right",children:"Content"})]})}),r.jsx(Ws,{children:z.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):z.map(F=>r.jsxs(Ir,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>T(F),children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:F.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:F.user_email})]})}),r.jsx(_t,{children:F.brokerage_name?r.jsx(Rt,{variant:"outline",children:F.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(_t,{children:r.jsx("div",{className:"flex items-center gap-2",children:F.last_activity_type==="app"?r.jsxs(Rt,{variant:"secondary",children:[r.jsx(Fs,{className:"h-3 w-3 mr-1"}),F.last_activity_name]}):r.jsxs(Rt,{variant:"outline",className:"flex items-center gap-1",children:[a4e(F.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:F.last_activity_name})]})})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:tu(new Date(F.last_activity_at),{addSuffix:!0})}),r.jsx(_t,{className:"text-right",children:r.jsx(Rt,{variant:"outline",children:F.total_app_launches})}),r.jsx(_t,{className:"text-right",children:r.jsx(Rt,{variant:"outline",children:F.total_content_views})})]},F.user_id))})]})})]})]}),r.jsx(Br,{open:!!y,onOpenChange:F=>!F&&L(),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(es,{children:y==null?void 0:y.email})]}),r.jsxs(ba,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsxs(ln,{value:"content",children:["Content (",C.length,")"]}),r.jsxs(ln,{value:"apps",children:["App Launches (",j.length,")"]})]}),r.jsx(An,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ws,{children:C.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):C.map(F=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs(Rt,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[a4e(F.resource_type),Mwt(F.resource_type)]})}),r.jsx(_t,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:F.resource_title})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"secondary",children:Twt(F.action_type)})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:tu(new Date(F.created_at),{addSuffix:!0})})]},F.id))})]})})}),r.jsx(An,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ws,{children:j.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):j.map(F=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsx(Rt,{variant:"secondary",children:F.app_name})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:tu(new Date(F.launched_at),{addSuffix:!0})})]},F.id))})]})})})]})]})})]})},Ewt=()=>{const{toast:e}=pa(),[t,n]=I.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,i]=I.useState(!0);I.useEffect(()=>{o()},[]);const o=async()=>{try{i(!0);const{count:l}=await J.from("profiles").select("*",{count:"exact",head:!0}),{count:a}=await J.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),h=(l||0)-(a||0),{count:p}=await J.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await J.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:b}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),j=new Date;j.setMonth(j.getMonth()-1);const{count:N}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",j.toISOString()),{data:C}=await J.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),A=new Set(C==null?void 0:C.map(E=>E.user_id)).size;n({totalUsers:l||0,activeUsers:a||0,pendingUsers:h,totalBrokerages:p||0,totalLaunches:x||0,launchesThisWeek:b||0,launchesThisMonth:N||0,uniqueActiveThisWeek:A})}catch(l){console.error("Error loading analytics:",l),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{i(!1)}};return s?r.jsx(Ge,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(Vn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalUsers}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.activeUsers," active, ",t.pendingUsers," pending"]})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.activeUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:t.totalUsers>0?`${Math.round(t.activeUsers/t.totalUsers*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ki,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.pendingUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(na,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalBrokerages}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(yg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(yg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(yg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(Zf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},o4e={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},l4e={event:"bg-blue-100 text-blue-800",template:"bg-purple-100 text-purple-800",academy_video:"bg-green-100 text-green-800",resource_kit:"bg-orange-100 text-orange-800",newsletter:"bg-pink-100 text-pink-800",social_swag:"bg-yellow-100 text-yellow-800"};function Aze({brokerageOnly:e=!1,brokerageId:t}){const[n,s]=I.useState([]),[i,o]=I.useState(!0),[l,a]=I.useState(""),[h,p]=I.useState("all");I.useEffect(()=>{x()},[t]);const x=async()=>{o(!0);try{let E=[];if(e&&t){const{data:Z}=await J.from("profiles").select("id").eq("brokerage_id",t);if(E=(Z==null?void 0:Z.map(te=>te.id))||[],E.length===0){s([]),o(!1);return}}let T=J.from("resource_shares").select("*").order("created_at",{ascending:!1});e&&E.length>0&&(T=T.or(`sender_id.in.(${E.join(",")}),recipient_id.in.(${E.join(",")})`));const{data:L,error:z}=await T;if(z)throw z;const F=new Set;L==null||L.forEach(Z=>{F.add(Z.sender_id),F.add(Z.recipient_id)});const{data:q}=await J.from("profiles").select("id, name, email").in("id",Array.from(F)),H=new Map((q==null?void 0:q.map(Z=>[Z.id,Z]))||[]),K=(L==null?void 0:L.map(Z=>({...Z,sender:H.get(Z.sender_id),recipient:H.get(Z.recipient_id)})))||[];s(K)}catch(E){console.error("Error loading shares:",E)}finally{o(!1)}},y=n.filter(E=>{var z,F;const T=l===""||E.resource_title.toLowerCase().includes(l.toLowerCase())||((z=E.sender)==null?void 0:z.name.toLowerCase().includes(l.toLowerCase()))||((F=E.recipient)==null?void 0:F.name.toLowerCase().includes(l.toLowerCase())),L=h==="all"||E.resource_type===h;return T&&L}),b=n.length,j=new Set(n.map(E=>E.sender_id)).size,N=new Set(n.map(E=>E.recipient_id)).size,C=n.length>0?Math.round(n.filter(E=>E.is_read).length/n.length*100):0,A=n.reduce((E,T)=>(E[T.resource_type]=(E[T.resource_type]||0)+1,E),{});return i?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((E,T)=>r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Pr,{className:"h-4 w-20"})}),r.jsx(Xe,{children:r.jsx(Pr,{className:"h-8 w-16"})})]},T))}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-6",children:r.jsx(Pr,{className:"h-[300px]"})})})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(uc,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:b})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx(Vn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(Zf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:N})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[C,"%"]})})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(A).map(([E,T])=>r.jsxs(Rt,{variant:"secondary",className:l4e[E],children:[o4e[E],": ",T]},E)),Object.keys(A).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Share History"}),r.jsxs(En,{children:["All resource shares ",e?"in your brokerage":"across the platform"]})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:E=>a(E.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:h,onValueChange:p,children:[r.jsx(mn,{className:"w-[180px]",children:r.jsx(_n,{placeholder:"Resource type"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Types"}),r.jsx(Ht,{value:"event",children:"Events"}),r.jsx(Ht,{value:"template",children:"Templates"}),r.jsx(Ht,{value:"academy_video",children:"Academy Videos"}),r.jsx(Ht,{value:"resource_kit",children:"Resource Kits"}),r.jsx(Ht,{value:"newsletter",children:"Newsletters"}),r.jsx(Ht,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(Jo,{className:"h-[400px]",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Sender"}),r.jsx(It,{children:"Recipient"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Ws,{children:y.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(E=>{var T,L;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium max-w-[200px] truncate",children:E.resource_title}),r.jsx(_t,{children:r.jsx(Rt,{variant:"secondary",className:l4e[E.resource_type],children:o4e[E.resource_type]})}),r.jsx(_t,{children:((T=E.sender)==null?void 0:T.name)||"Unknown"}),r.jsx(_t,{children:((L=E.recipient)==null?void 0:L.name)||"Unknown"}),r.jsx(_t,{children:r.jsx(Rt,{variant:E.is_read?"default":"outline",children:E.is_read?"Read":"Unread"})}),r.jsx(_t,{className:"text-muted-foreground",children:xn(new Date(E.created_at),"MMM d, yyyy")})]},E.id)})})]})})]})]})]})}const Iwt=()=>r.jsx(Or,{title:"Analytics",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Analytics & Activity"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Platform-wide usage statistics and user activity"})]}),r.jsxs(ba,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"analytics",children:"Analytics"}),r.jsx(ln,{value:"activity",children:"Activity"}),r.jsx(ln,{value:"shares",children:"Shares"})]}),r.jsx(An,{value:"analytics",className:"space-y-4",children:r.jsx(Ewt,{})}),r.jsx(An,{value:"activity",className:"space-y-4",children:r.jsx(Awt,{})}),r.jsx(An,{value:"shares",className:"space-y-4",children:r.jsx(Aze,{})})]})]})});function Pwt(){const e=Wr(),[t,n]=I.useState(!1),[s,i]=I.useState(null),[o,l]=I.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[a,h]=I.useState(null),[p,x]=I.useState(""),[y,b]=I.useState([]),[j,N]=I.useState([]),[C,A]=I.useState([]),[E,T]=I.useState(!1),[L,z]=I.useState(null),[F,q]=I.useState(""),{data:H,isLoading:K}=Zt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Ee,error:Ye}=await J.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(Ye)throw Ye;return Ee}}),{data:Z}=Zt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Ee,error:Ye}=await J.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ee}}),{data:te}=Zt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Ee,error:Ye}=await J.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ee}}),{data:ae}=Zt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Ee,error:Ye}=await J.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ee}}),{data:le,isLoading:ve}=Zt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Ee,error:Ye}=await J.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(Ye)throw Ye;return Ee}}),ne=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),h(null),x(""),b([]),N([]),A([]),i(null),q("")},ge=Ee=>{i(Ee),l({title:Ee.title,description:Ee.description||"",publish_date:Ee.publish_date.split("T")[0],is_published:Ee.is_published,category_id:Ee.category_id||""}),x(Ee.preview_image_url||""),q("");const Ye=(Z==null?void 0:Z.filter(et=>et.resource_id===Ee.id))||[];b(Ye.map(et=>({id:et.id,name:et.name,file_url:et.file_url,file_size:et.file_size,sort_order:et.sort_order})));const me=(te==null?void 0:te.filter(et=>et.resource_id===Ee.id))||[];N(me.map(et=>({id:et.id,title:et.title,video_url:et.video_url,sort_order:et.sort_order})));const mt=(ae==null?void 0:ae.filter(et=>et.resource_id===Ee.id))||[];A(mt.map(et=>({id:et.id,title:et.title,canva_share_link:et.canva_share_link,sort_order:et.sort_order}))),n(!0)},ie=Ee=>{var me;const Ye=(me=Ee.target.files)==null?void 0:me[0];Ye&&(h(Ye),x(URL.createObjectURL(Ye)))},fe=()=>{b([...y,{name:"",file_url:"",sort_order:y.length}])},de=Ee=>{b(y.filter((Ye,me)=>me!==Ee))},ye=(Ee,Ye,me)=>{const mt=[...y];if(Ye==="file"&&me instanceof File){const et=me.name.replace(/\.[^/.]+$/,"");mt[Ee]={...mt[Ee],file:me,file_size:me.size,name:mt[Ee].name||et}}else mt[Ee]={...mt[Ee],[Ye]:me};b(mt)},Ie=()=>{N([...j,{title:"",video_url:"",sort_order:j.length}])},Ne=Ee=>{N(j.filter((Ye,me)=>me!==Ee))},we=(Ee,Ye,me)=>{const mt=[...j];Ye==="file"&&me instanceof File?mt[Ee]={...mt[Ee],file:me}:mt[Ee]={...mt[Ee],[Ye]:me},N(mt)},he=()=>{A([...C,{title:"",canva_share_link:"",sort_order:C.length}])},xe=Ee=>{A(C.filter((Ye,me)=>me!==Ee))},be=(Ee,Ye,me)=>{const mt=[...C];mt[Ee]={...mt[Ee],[Ye]:me},A(mt)},Oe=async(Ee,Ye)=>{try{const me=await J.functions.invoke("bunny-upload",{body:{action:"create",title:Ee.name}});if(me.error)throw me.error;const{videoId:mt,uploadUrl:et,libraryId:nt}=me.data,Ae=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:mt,libraryId:nt}});if(Ae.error)throw Ae.error;const{uploadUrl:ht,apiKey:$e}=Ae.data,Je=new XMLHttpRequest;return Je.open("PUT",ht,!0),Je.setRequestHeader("AccessKey",$e),Je.upload.onprogress=tt=>{if(tt.lengthComputable){const ft=Math.round(tt.loaded/tt.total*100),jt=[...j];jt[Ye]={...jt[Ye],uploadProgress:ft},N(jt)}},await new Promise((tt,ft)=>{Je.onload=()=>Je.status>=200&&Je.status<300?tt():ft(new Error("Upload failed")),Je.onerror=()=>ft(new Error("Upload failed")),Je.send(Ee)}),`https://iframe.mediadelivery.net/embed/${nt}/${mt}`}catch(me){throw console.error("Bunny upload error:",me),me}},Te=cr({mutationFn:async Ee=>{const{data:Ye,error:me}=await J.from("brokerage_resource_categories").insert({name:Ee,sort_order:(le==null?void 0:le.length)||0}).select().single();if(me)throw me;return Ye},onSuccess:Ee=>{e.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Ee.id}),q(""),ze.success("Category created")},onError:Ee=>{ze.error("Failed to create category: "+Ee.message)}}),Ve=cr({mutationFn:async()=>{T(!0);let Ee=(s==null?void 0:s.preview_image_url)||null;if(a){const mt=a.name.split(".").pop(),et=`${Date.now()}.${mt}`,{error:nt}=await J.storage.from("brokerage-resources").upload(`previews/${et}`,a);if(nt)throw nt;const{data:Ae}=J.storage.from("brokerage-resources").getPublicUrl(`previews/${et}`);Ee=Ae.publicUrl}const Ye={title:o.title,description:o.description||null,preview_image_url:Ee,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let me;if(s){const{error:mt}=await J.from("brokerage_resources").update(Ye).eq("id",s.id);if(mt)throw mt;me=s.id;const et=(Z==null?void 0:Z.filter(Nt=>Nt.resource_id===s.id).map(Nt=>Nt.id))||[],nt=y.filter(Nt=>Nt.id).map(Nt=>Nt.id),Ae=et.filter(Nt=>!nt.includes(Nt));Ae.length>0&&await J.from("brokerage_resource_pdfs").delete().in("id",Ae);const ht=(te==null?void 0:te.filter(Nt=>Nt.resource_id===s.id).map(Nt=>Nt.id))||[],$e=j.filter(Nt=>Nt.id).map(Nt=>Nt.id),Je=ht.filter(Nt=>!$e.includes(Nt));Je.length>0&&await J.from("brokerage_resource_videos").delete().in("id",Je);const tt=(ae==null?void 0:ae.filter(Nt=>Nt.resource_id===s.id).map(Nt=>Nt.id))||[],ft=C.filter(Nt=>Nt.id).map(Nt=>Nt.id),jt=tt.filter(Nt=>!ft.includes(Nt));jt.length>0&&await J.from("brokerage_resource_links").delete().in("id",jt)}else{const{data:mt,error:et}=await J.from("brokerage_resources").insert(Ye).select().single();if(et)throw et;me=mt.id}for(let mt=0;mt{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success(s?"Resource updated":"Resource created"),n(!1),ne(),T(!1)},onError:Ee=>{ze.error("Failed to save resource: "+Ee.message),T(!1)}}),Fe=cr({mutationFn:async Ee=>{const{error:Ye}=await J.from("brokerage_resources").delete().eq("id",Ee);if(Ye)throw Ye},onSuccess:()=>{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success("Resource deleted")},onError:Ee=>{ze.error("Failed to delete: "+Ee.message)}}),Me=Ee=>{if(Ee.preventDefault(),!o.title){ze.error("Please enter a title");return}Ve.mutate()},Qe=Ee=>{const Ye=(Z==null?void 0:Z.filter(et=>et.resource_id===Ee).length)||0,me=(te==null?void 0:te.filter(et=>et.resource_id===Ee).length)||0,mt=(ae==null?void 0:ae.filter(et=>et.resource_id===Ee).length)||0;return{pdfCount:Ye,videoCount:me,linkCount:mt}};return r.jsx(Or,{title:"Brokerage Resources Management",description:"Create and manage resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(H==null?void 0:H.length)||0})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(H==null?void 0:H.filter(Ee=>Ee.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{ne(),n(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Content"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:K?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(H==null?void 0:H.length)===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):H==null?void 0:H.map(Ee=>{const{pdfCount:Ye,videoCount:me,linkCount:mt}=Qe(Ee.id),et=le==null?void 0:le.find(nt=>nt.id===Ee.category_id);return r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ee.preview_image_url?r.jsx("img",{src:Ee.preview_image_url,alt:Ee.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(yh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ee.title}),Ee.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ee.description})]})]})}),r.jsx(_t,{children:et?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:et.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(wi,{className:"h-3.5 w-3.5"}),Ye]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fi,{className:"h-3.5 w-3.5"}),me]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(So,{className:"h-3.5 w-3.5"}),mt]})]})}),r.jsx(_t,{children:xn(new Date(Ee.publish_date),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Ee.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Ee.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const nt=(Z==null?void 0:Z.filter($e=>$e.resource_id===Ee.id))||[],Ae=(te==null?void 0:te.filter($e=>$e.resource_id===Ee.id))||[],ht=(ae==null?void 0:ae.filter($e=>$e.resource_id===Ee.id))||[];z({...Ee,pdfs:nt,videos:Ae,links:ht})},children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>ge(Ee),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Fe.mutate(Ee.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},Ee.id)})})]})})}),r.jsx(Br,{open:t,onOpenChange:n,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:Me,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[p?r.jsx("img",{src:p,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(yh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(at,{type:"file",accept:"image/*",onChange:ie})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title *"}),r.jsx(at,{id:"title",value:o.title,onChange:Ee=>l({...o,title:Ee.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{className:"flex items-center gap-2",children:[r.jsx(Gx,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(vn,{value:o.category_id,onValueChange:Ee=>l({...o,category_id:Ee}),children:[r.jsx(mn,{className:"flex-1",children:r.jsx(_n,{placeholder:"Select a category"})}),r.jsx(gn,{children:le==null?void 0:le.map(Ee=>r.jsx(Ht,{value:Ee.id,children:Ee.name},Ee.id))})]}),o.category_id&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(bs,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{placeholder:"Or create new category...",value:F,onChange:Ee=>q(Ee.target.value),className:"flex-1"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",disabled:!F.trim()||Te.isPending,onClick:()=>Te.mutate(F.trim()),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:o.description,onChange:Ee=>l({...o,description:Ee}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(at,{id:"publish_date",type:"date",value:o.publish_date,onChange:Ee=>l({...o,publish_date:Ee.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Rs,{checked:o.is_published,onCheckedChange:Ee=>l({...o,is_published:Ee})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ue,{className:"flex items-center gap-2",children:[r.jsx(wi,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Ee,Ye)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(at,{placeholder:"PDF Name",value:Ee.name,onChange:me=>ye(Ye,"name",me.target.value),className:"flex-1"}),r.jsx(at,{type:"file",accept:".pdf",onChange:me=>{var et;const mt=(et=me.target.files)==null?void 0:et[0];mt&&ye(Ye,"file",mt)},className:"flex-1"}),Ee.file_url&&!Ee.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>de(Ye),children:r.jsx(bs,{className:"h-4 w-4"})})]},Ye))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ue,{className:"flex items-center gap-2",children:[r.jsx(Fi,{className:"h-4 w-4"}),"Videos (",j.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Ie,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),j.map((Ee,Ye)=>r.jsxs("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(at,{placeholder:"Video Title",value:Ee.title,onChange:me=>we(Ye,"title",me.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>Ne(Ye),children:r.jsx(bs,{className:"h-4 w-4"})})]}),r.jsx(at,{type:"file",accept:"video/*",onChange:me=>{var et;const mt=(et=me.target.files)==null?void 0:et[0];mt&&we(Ye,"file",mt)}}),Ee.uploadProgress!==void 0&&Ee.uploadProgress>0&&r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${Ee.uploadProgress}%`}})}),Ee.video_url&&!Ee.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},Ye))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ue,{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-4 w-4"}),"Canva Links (",C.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:he,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),C.map((Ee,Ye)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(at,{placeholder:"Link Title",value:Ee.title,onChange:me=>be(Ye,"title",me.target.value),className:"flex-1"}),r.jsx(at,{placeholder:"Canva Share Link",value:Ee.canva_share_link,onChange:me=>be(Ye,"canva_share_link",me.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>xe(Ye),children:r.jsx(bs,{className:"h-4 w-4"})})]},Ye))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:Ve.isPending||E,children:Ve.isPending||E?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Br,{open:!!L,onOpenChange:()=>z(null),children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:L==null?void 0:L.title})}),L&&r.jsxs("div",{className:"space-y-4",children:[L.preview_image_url&&r.jsx("img",{src:L.preview_image_url,alt:L.title,className:"w-full h-48 object-cover rounded-lg"}),L.description&&r.jsx("p",{className:"text-muted-foreground",children:L.description}),L.pdfs&&L.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(wi,{className:"h-4 w-4"}),"PDF Documents (",L.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:L.pdfs.map(Ee=>r.jsx("a",{href:Ee.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Ee.name},Ee.id))})]}),L.videos&&L.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Fi,{className:"h-4 w-4"}),"Videos (",L.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:L.videos.map(Ee=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Ee.title})},Ee.id))})]}),L.links&&L.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(So,{className:"h-4 w-4"}),"Canva Links (",L.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:L.links.map(Ee=>r.jsx("a",{href:Ee.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Ee.title},Ee.id))})]})]})]})})]})})}const Eze=[{value:"events",label:"After Events Section"},{value:"academy",label:"After Academy Section"},{value:"toolbox",label:"After Toolbox Section"},{value:"templates",label:"After Templates Section"},{value:"apps",label:"After Apps Section"}];function Lwt(){const[e,t]=I.useState([]),[n,s]=I.useState(!0),[i,o]=I.useState(!1),[l,a]=I.useState(!1),[h,p]=I.useState(null),[x,y]=I.useState(!1),[b,j]=I.useState(!1),[N,C]=I.useState(""),[A,E]=I.useState(""),[T,L]=I.useState(""),[z,F]=I.useState(""),[q,H]=I.useState("Learn More"),[K,Z]=I.useState("top"),[te,ae]=I.useState(""),[le,ve]=I.useState(!0),[ne,ge]=I.useState(""),[ie,fe]=I.useState("");I.useEffect(()=>{de()},[]);const de=async()=>{try{const{data:Te,error:Ve}=await J.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Ve)throw Ve;t(Te||[])}catch(Te){ze.error("Failed to load banners: "+Te.message)}finally{s(!1)}},ye=()=>{C(""),E(""),L(""),F(""),H("Learn More"),Z("top"),ae(""),ve(!0),ge(""),fe(""),p(null)},Ie=Te=>{p(Te),C(Te.title),E(Te.description||""),L(Te.image_url),F(Te.link_url||""),H(Te.link_text||"Learn More"),Z(Te.placement),ae(Te.section_after||""),ve(Te.is_active),ge(Te.start_date?xn(new Date(Te.start_date),"yyyy-MM-dd'T'HH:mm"):""),fe(Te.end_date?xn(new Date(Te.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},Ne=async Te=>{var Fe;const Ve=(Fe=Te.target.files)==null?void 0:Fe[0];if(Ve){y(!0);try{const Me=Ve.name.split(".").pop(),Qe=`${Date.now()}.${Me}`,{error:Ee}=await J.storage.from("banner-images").upload(Qe,Ve);if(Ee)throw Ee;const{data:{publicUrl:Ye}}=J.storage.from("banner-images").getPublicUrl(Qe);L(Ye),ze.success("Image uploaded successfully")}catch(Me){ze.error("Failed to upload image: "+Me.message)}finally{y(!1)}}},we=async()=>{if(!N.trim()||!T){ze.error("Please fill in required fields (title and image)");return}j(!0);try{const Te={title:N.trim(),description:A.trim()||null,image_url:T,link_url:z.trim()||null,link_text:q.trim()||"Learn More",placement:K,section_after:K==="between"?te:null,is_active:le,start_date:ne?new Date(ne).toISOString():null,end_date:ie?new Date(ie).toISOString():null};if(h){const{error:Ve}=await J.from("dashboard_banners").update(Te).eq("id",h.id);if(Ve)throw Ve;ze.success("Banner updated successfully")}else{const Ve=e.filter(Me=>Me.placement===K).length,{error:Fe}=await J.from("dashboard_banners").insert({...Te,sort_order:Ve});if(Fe)throw Fe;ze.success("Banner created successfully")}o(!1),ye(),de()}catch(Te){ze.error("Failed to save banner: "+Te.message)}finally{j(!1)}},he=async()=>{if(h)try{const{error:Te}=await J.from("dashboard_banners").delete().eq("id",h.id);if(Te)throw Te;ze.success("Banner deleted successfully"),a(!1),p(null),de()}catch(Te){ze.error("Failed to delete banner: "+Te.message)}},xe=async Te=>{try{const{error:Ve}=await J.from("dashboard_banners").update({is_active:!Te.is_active}).eq("id",Te.id);if(Ve)throw Ve;ze.success(Te.is_active?"Banner deactivated":"Banner activated"),de()}catch(Ve){ze.error("Failed to update banner: "+Ve.message)}},be=e.filter(Te=>Te.placement==="top"),Oe=e.filter(Te=>Te.placement==="between");return n?r.jsx(Or,{title:"Dashboard Management",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):r.jsxs(Or,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(En,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Br,{open:i&&K==="top",onOpenChange:Te=>{Te||ye(),o(Te),Te&&Z("top")},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{ye(),Z("top")},children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[h?"Edit":"Create"," Banner"]}),r.jsx(es,{children:"Configure the banner's content and display settings"})]}),r.jsx(c4e,{title:N,setTitle:C,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:H,placement:K,setPlacement:Z,sectionAfter:te,setSectionAfter:ae,isActive:le,setIsActive:ve,startDate:ne,setStartDate:ge,endDate:ie,setEndDate:fe,handleImageUpload:Ne,uploading:x,showPlacementOptions:!1}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),ye()},children:"Cancel"}),r.jsx(ee,{onClick:we,disabled:b,children:b?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Xe,{children:be.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hero banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:be.map(Te=>r.jsx(d4e,{banner:Te,onEdit:()=>Ie(Te),onDelete:()=>{p(Te),a(!0)},onToggleActive:()=>xe(Te)},Te.id))})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(En,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Br,{open:i&&K==="between",onOpenChange:Te=>{Te||ye(),o(Te),Te&&Z("between")},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{ye(),Z("between")},children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[h?"Edit":"Create"," Section Banner"]}),r.jsx(es,{children:"Configure where this banner appears between sections"})]}),r.jsx(c4e,{title:N,setTitle:C,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:H,placement:K,setPlacement:Z,sectionAfter:te,setSectionAfter:ae,isActive:le,setIsActive:ve,startDate:ne,setStartDate:ge,endDate:ie,setEndDate:fe,handleImageUpload:Ne,uploading:x,showPlacementOptions:!0}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),ye()},children:"Cancel"}),r.jsx(ee,{onClick:we,disabled:b,children:b?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(Xe,{children:Oe.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No section banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Oe.map(Te=>r.jsx(d4e,{banner:Te,onEdit:()=>Ie(Te),onDelete:()=>{p(Te),a(!0)},onToggleActive:()=>xe(Te),showSection:!0},Te.id))})})]})]}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Delete Banner"}),r.jsxs(es,{children:['Are you sure you want to delete "',h==null?void 0:h.title,'"? This action cannot be undone.']})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:he,children:"Delete"})]})]})})]})}function c4e({title:e,setTitle:t,description:n,setDescription:s,imageUrl:i,linkUrl:o,setLinkUrl:l,linkText:a,setLinkText:h,placement:p,setPlacement:x,sectionAfter:y,setSectionAfter:b,isActive:j,setIsActive:N,startDate:C,setStartDate:A,endDate:E,setEndDate:T,handleImageUpload:L,uploading:z,showPlacementOptions:F}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title *"}),r.jsx(at,{id:"title",placeholder:"Banner headline...",value:e,onChange:q=>t(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",placeholder:"Optional banner description...",value:n,onChange:q=>s(q.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(at,{type:"file",accept:"image/*",onChange:L,disabled:z,className:"flex-1"}),z&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),i&&r.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:r.jsx("img",{src:i,alt:"Preview",className:"w-full h-40 object-cover"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(at,{id:"linkUrl",placeholder:"https://...",value:o,onChange:q=>l(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"linkText",children:"Button Text"}),r.jsx(at,{id:"linkText",placeholder:"Learn More",value:a,onChange:q=>h(q.target.value)})]})]}),F&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Placement"}),r.jsxs(vn,{value:y,onValueChange:b,children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select section placement..."})}),r.jsx(gn,{children:Eze.map(q=>r.jsx(Ht,{value:q.value,children:q.label},q.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(at,{id:"startDate",type:"datetime-local",value:C,onChange:q=>A(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(at,{id:"endDate",type:"datetime-local",value:E,onChange:q=>T(q.target.value)})]})]}),r.jsx("div",{className:"flex items-center justify-between pt-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"isActive",checked:j,onCheckedChange:N}),r.jsx(Ue,{htmlFor:"isActive",children:"Active"})]})})]})}function d4e({banner:e,onEdit:t,onDelete:n,onToggleActive:s,showSection:i=!1}){var l;const o=(l=Eze.find(a=>a.value===e.section_after))==null?void 0:l.label;return r.jsxs("div",{className:"flex items-center gap-4 p-3 border rounded-lg bg-card hover:bg-accent/50 transition-colors",children:[r.jsx(p1,{className:"h-5 w-5 text-muted-foreground cursor-grab"}),r.jsx("img",{src:e.image_url,alt:e.title,className:"w-24 h-14 object-cover rounded"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"font-medium truncate",children:e.title}),!e.is_active&&r.jsx(Rt,{variant:"secondary",children:"Inactive"}),e.start_date&&new Date(e.start_date)>new Date&&r.jsx(Rt,{variant:"outline",children:"Scheduled"})]}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:e.description}),i&&o&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.link_url&&r.jsx("a",{href:e.link_url,target:"_blank",rel:"noopener noreferrer",children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(Fs,{className:"h-4 w-4"})})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:s,children:e.is_active?r.jsx(Qo,{className:"h-4 w-4"}):r.jsx(d1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:t,children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]})}const zL={open:{label:"Open",icon:Ki,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ol,color:"bg-blue-500"},resolved:{label:"Resolved",icon:qa,color:"bg-green-500"},closed:{label:"Closed",icon:zc,color:"bg-muted-foreground"}},u4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Owt(){var q,H;const{user:e}=zr(),t=Wr(),[n,s]=I.useState(null),[i,o]=I.useState(""),[l,a]=I.useState("all"),[h,p]=I.useState("all"),[x,y]=I.useState(!1),{data:b=[],isLoading:j}=Zt({queryKey:["admin-support-tickets",l,h],queryFn:async()=>{let K=J.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(K=K.eq("status",l)),h!=="all"&&(K=K.eq("category",h));const{data:Z,error:te}=await K;if(te)throw te;return Z}}),{data:N=[]}=Zt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:K,error:Z}=await J.from("user_roles").select("user_id").eq("role","admin");if(Z)throw Z;const te=K.map(ie=>ie.user_id),{data:ae,error:le}=await J.from("profiles").select("id, name, email").in("id",te);if(le)throw le;const{data:ve,error:ne}=await J.from("support_notification_settings").select("user_id, receive_notifications");if(ne)throw ne;const ge=new Map((ve==null?void 0:ve.map(ie=>[ie.user_id,ie.receive_notifications]))||[]);return ae.map(ie=>({...ie,receives_notifications:ge.get(ie.id)||!1}))}}),{data:C=[]}=Zt({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:K,error:Z}=await J.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(Z)throw Z;return K},enabled:!!n}),A=cr({mutationFn:async({userId:K,enabled:Z})=>{const{data:te}=await J.from("support_notification_settings").select("id").eq("user_id",K).maybeSingle();if(te){const{error:ae}=await J.from("support_notification_settings").update({receive_notifications:Z}).eq("user_id",K);if(ae)throw ae}else{const{error:ae}=await J.from("support_notification_settings").insert({user_id:K,receive_notifications:Z});if(ae)throw ae}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-users-notifications"]}),ze.success("Notification settings updated")},onError:()=>{ze.error("Failed to update settings")}}),E=cr({mutationFn:async({ticketId:K,status:Z})=>{const{error:te}=await J.from("support_tickets").update({status:Z}).eq("id",K);if(te)throw te},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),ze.success("Status updated")},onError:()=>{ze.error("Failed to update status")}}),T=cr({mutationFn:async({ticketId:K,assignedTo:Z})=>{const{error:te}=await J.from("support_tickets").update({assigned_to:Z}).eq("id",K);if(te)throw te},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),ze.success("Ticket assigned")},onError:()=>{ze.error("Failed to assign ticket")}}),L=cr({mutationFn:async K=>{var te,ae;if(!n||!e)throw new Error("Missing data");const{error:Z}=await J.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:K,is_admin_reply:!0});if(Z)throw Z;try{await J.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:K,userEmail:(te=n.profiles)==null?void 0:te.email,userName:(ae=n.profiles)==null?void 0:ae.name}})}catch(le){console.error("Failed to send reply notification:",le)}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),z=()=>{i.trim()&&L.mutate(i)};I.useEffect(()=>{const K=J.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{J.removeChannel(K)}},[t]);const F=b.filter(K=>K.status==="open").length;return n?(zL[n.status].icon,r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Rt,{variant:"secondary",children:u4e[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((q=n.profiles)==null?void 0:q.name)||"Unknown"," (",(H=n.profiles)==null?void 0:H.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm",children:"Status"})}),r.jsx(Xe,{children:r.jsxs(vn,{value:n.status,onValueChange:K=>{E.mutate({ticketId:n.id,status:K}),s({...n,status:K})},children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"open",children:"Open"}),r.jsx(Ht,{value:"in_progress",children:"In Progress"}),r.jsx(Ht,{value:"resolved",children:"Resolved"}),r.jsx(Ht,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm",children:"Assigned To"})}),r.jsx(Xe,{children:r.jsxs(vn,{value:n.assigned_to||"unassigned",onValueChange:K=>{const Z=K==="unassigned"?null:K;T.mutate({ticketId:n.id,assignedTo:Z}),s({...n,assigned_to:Z})},children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Unassigned"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"unassigned",children:"Unassigned"}),N.map(K=>r.jsx(Ht,{value:K.id,children:K.name},K.id))]})]})})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(En,{children:["Created on ",xn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Conversation"})}),r.jsxs(Xe,{children:[r.jsx(Jo,{className:"h-[300px] pr-4",children:C.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:C.map(K=>{var Z,te;return r.jsxs("div",{className:`p-4 rounded-lg ${K.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:K.is_admin_reply?`${((Z=K.profiles)==null?void 0:Z.name)||"Admin"} (Support)`:((te=K.profiles)==null?void 0:te.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(K.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:K.content})]},K.id)})})}),r.jsx(Qd,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:i,onChange:K=>o(K.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:z,disabled:!i.trim()||L.isPending,className:"self-end",children:r.jsx(Lo,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Support Tickets"}),r.jsxs("p",{className:"text-muted-foreground",children:["Manage support requests from agents",F>0&&r.jsxs(Rt,{variant:"destructive",className:"ml-2",children:[F," open"]})]})]}),r.jsxs(Br,{open:x,onOpenChange:y,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(fd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Email Notification Settings"}),r.jsx(es,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:N.map(K=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:K.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:K.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[K.receives_notifications?r.jsx(_g,{className:"h-4 w-4 text-primary"}):r.jsx(cj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Rs,{checked:K.receives_notifications,onCheckedChange:Z=>A.mutate({userId:K.id,enabled:Z})})]})]},K.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(ba,{value:l,onValueChange:a,className:"w-auto",children:r.jsxs(fa,{children:[r.jsx(ln,{value:"all",children:"All"}),r.jsx(ln,{value:"open",children:"Open"}),r.jsx(ln,{value:"in_progress",children:"In Progress"}),r.jsx(ln,{value:"resolved",children:"Resolved"}),r.jsx(ln,{value:"closed",children:"Closed"})]})}),r.jsxs(vn,{value:h,onValueChange:p,children:[r.jsx(mn,{className:"w-[180px]",children:r.jsx(_n,{placeholder:"All Categories"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Categories"}),r.jsx(Ht,{value:"general",children:"General Support"}),r.jsx(Ht,{value:"technology",children:"Technology Support"}),r.jsx(Ht,{value:"crm",children:"CRM Support"}),r.jsx(Ht,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:j?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):b.length===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"text-center py-12",children:[r.jsx(Ol,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets found"}),r.jsx("p",{className:"text-muted-foreground",children:"No support tickets match the current filters."})]})}):r.jsx("div",{className:"space-y-3",children:b.map(K=>{var te,ae;const Z=zL[K.status].icon;return r.jsx(Ge,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(K),children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:K.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(Rt,{variant:"outline",className:"text-xs",children:u4e[K.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(te=K.profiles)==null?void 0:te.name," • ",xn(new Date(K.created_at),"MMM d, yyyy")]}),K.assigned_to&&r.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(Cc,{className:"h-3 w-3"}),((ae=N.find(le=>le.id===K.assigned_to))==null?void 0:ae.name)||"Assigned"]})]})]}),r.jsxs(Rt,{className:zL[K.status].color,children:[r.jsx(Z,{className:"h-3 w-3 mr-1"}),zL[K.status].label]})]})})},K.id)})})})]})]})})}const Dwt=Rd.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function Rwt({content:e,onChange:t,variables:n}){const s=uze({extensions:[xze,Cze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),Mze.configure({types:["heading","paragraph"]}),Tze,Dwt],content:e,onUpdate:({editor:l})=>{t(l.getHTML())}});I.useEffect(()=>{s&&e!==s.getHTML()&&s.commands.setContent(e)},[e,s]);const i=l=>{s&&s.chain().focus().insertContent(`{{${l.key}}}`).run()},o=()=>{if(!s)return;const l=s.getAttributes("link").href,a=window.prompt("URL",l);if(a!==null){if(a===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:a}).run()}};return s?r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-2 border-b bg-muted/30",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(J4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(iS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(Wf,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(cS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("center").run(),className:s.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(Y4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(Q4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(So,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(hj,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(gS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(pS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(nA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(ap,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(mo,{onClick:()=>i(l),className:"flex flex-col items-start",children:[r.jsx("span",{className:"font-medium",children:l.label}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:`{{${l.key}}}`}),l.description&&r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:l.description})]},l.key))})]})]}),r.jsx(cze,{editor:s,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"}),n.length>0&&r.jsxs("div",{className:"border-t p-3 bg-muted/20",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Available variables (click to copy):"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(l=>r.jsx(Rt,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 font-mono text-xs",onClick:()=>{navigator.clipboard.writeText(`{{${l.key}}}`)},children:`{{${l.key}}}`},l.key))})]})]}):null}function Fwt(){const e=Wr(),[t,n]=I.useState(null),[s,i]=I.useState(null),[o,l]=I.useState(""),[a,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(!0),[j,N]=I.useState("visual"),{data:C,isLoading:A}=Zt({queryKey:["email-templates"],queryFn:async()=>{const{data:F,error:q}=await J.from("email_templates").select("*").order("name");if(q)throw q;return F.map(H=>({...H,available_variables:H.available_variables||[]}))}}),E=cr({mutationFn:async F=>{const{error:q}=await J.from("email_templates").update({subject:F.subject,body_html:F.body_html,description:F.description,is_active:F.is_active}).eq("id",F.id);if(q)throw q},onSuccess:()=>{e.invalidateQueries({queryKey:["email-templates"]}),ze.success("Email template updated successfully"),n(null)},onError:F=>{ze.error("Failed to update template: "+F.message)}}),T=F=>{n(F),l(F.subject),h(F.body_html),x(F.description||""),b(F.is_active),N("visual")},L=()=>{t&&E.mutate({id:t.id,subject:o,body_html:a,description:p,is_active:y})},z=(F,q)=>{let H=F;return q.forEach(K=>{const Z=`{{${K.key}}}`,te=`[${K.label}]`;H=H.replace(new RegExp(Z.replace(/[{}]/g,"\\$&"),"g"),te)}),H};return t?r.jsxs(Or,{title:"Edit Email Template",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{variant:"outline",onClick:()=>i(t),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{onClick:L,disabled:E.isPending,children:[r.jsx(jg,{className:"h-4 w-4 mr-2"}),E.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-5 w-5"}),t.name]}),r.jsxs(En,{className:"mt-1",children:["Template slug: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:t.slug})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ue,{htmlFor:"active-toggle",children:"Active"}),r.jsx(Rs,{id:"active-toggle",checked:y,onCheckedChange:b})]})]})}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:p,onChange:F=>x(F.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"subject",children:"Email Subject"}),r.jsx(at,{id:"subject",value:o,onChange:F=>l(F.target.value),placeholder:"Email subject line"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["You can use variables like ","{{name}}"," in the subject"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{children:"Email Body"}),r.jsx(ba,{value:j,onValueChange:F=>N(F),children:r.jsxs(fa,{className:"h-8",children:[r.jsxs(ln,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(yj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(ln,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(hj,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),j==="visual"?r.jsx(Rwt,{content:a,onChange:h,variables:t.available_variables}):r.jsx(ps,{value:a,onChange:F=>h(F.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Br,{open:!!s,onOpenChange:()=>i(null),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Email Preview"}),r.jsxs(es,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(a,t.available_variables)}})})]})})]}):r.jsx(Or,{title:"Email Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Email Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and customize system email templates"})]}),A?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((F,q)=>r.jsx(Ge,{children:r.jsxs(Gt,{children:[r.jsx(Pr,{className:"h-5 w-48"}),r.jsx(Pr,{className:"h-4 w-96"})]})},q))}):r.jsx("div",{className:"grid gap-4",children:C==null?void 0:C.map(F=>r.jsxs(Ge,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Qt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(Ys,{className:"h-5 w-5 text-muted-foreground"}),F.name,!F.is_active&&r.jsx(Rt,{variant:"secondary",children:"Inactive"})]}),r.jsx(En,{children:F.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>i(F),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{size:"sm",onClick:()=>T(F),children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:F.subject})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Variables:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:F.available_variables.map(q=>r.jsx(Rt,{variant:"outline",className:"font-mono text-xs",children:`{{${q.key}}}`},q.key))})]})]})})]},F.id))}),r.jsx(Br,{open:!!s&&!t,onOpenChange:()=>i(null),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(es,{children:["Subject: ",s==null?void 0:s.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),s&&r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(s.body_html,s.available_variables)}})})]})})]})})}const zwt=({brokerageId:e})=>{var vo,Bd;const{toast:t}=pa(),[n,s]=I.useState([]),[i,o]=I.useState(!0),[l,a]=I.useState(""),[h,p]=I.useState("all"),[x,y]=I.useState(new Set),[b,j]=I.useState(!1),[N,C]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState({email:"",name:"",password:"",phone:""}),[z,F]=I.useState(!1),[q,H]=I.useState(null),[K,Z]=I.useState(!1),[te,ae]=I.useState(!1),[le,ve]=I.useState(!1),[ne,ge]=I.useState(""),[ie,fe]=I.useState(!1),[de,ye]=I.useState([]),[Ie,Ne]=I.useState(!1),[we,he]=I.useState(!1),[xe,be]=I.useState(null),[Oe,Te]=I.useState({name:"",phone:"",email:""}),[Ve,Fe]=I.useState(!1),[Me,Qe]=I.useState(!1),[Ee,Ye]=I.useState(null),[me,mt]=I.useState("asc"),[et,nt]=I.useState(!1),[Ae,ht]=I.useState(null),[$e,Je]=I.useState(!1),[tt,ft]=I.useState(null),[jt,Nt]=I.useState(""),[Et,vt]=I.useState(!1),[rr,Ar]=I.useState(null);I.useEffect(()=>{kn(),yn()},[e]);const yn=async()=>{try{const{data:_r,error:Hn}=await J.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",e);if(Hn)throw Hn;ye((_r==null?void 0:_r.map(kt=>kt.user_id))||[])}catch(_r){console.error("Error loading brokerage managers:",_r)}},kn=async()=>{try{o(!0);const{data:_r,error:Hn}=await J.functions.invoke("get-brokerage-agents",{body:{brokerageId:e}});if(Hn)throw Hn;s(_r.agents||[])}catch(_r){console.error("Error loading agents:",_r),t({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},Jr=async()=>{if(!T.email||!T.name||!T.password){t({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}E(!0);try{const{data:{session:_r}}=await J.auth.getSession(),Hn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({...T,brokerageId:e})}),kt=await Hn.json();if(!Hn.ok)throw new Error(kt.error||"Failed to create agent");t({title:"Success",description:`Agent ${T.email} created successfully`}),L({email:"",name:"",password:"",phone:""}),C(!1),kn()}catch(_r){console.error("Error creating agent:",_r),t({title:"Error",description:_r.message||"Failed to create agent",variant:"destructive"})}finally{E(!1)}},zn=async _r=>{try{const{data:{session:Hn}}=await J.auth.getSession(),kt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Hn==null?void 0:Hn.access_token}`},body:JSON.stringify({userId:_r})}),je=await kt.json();if(!kt.ok)throw new Error(je.error||"Failed to resend welcome email");t({title:"Success",description:"Welcome email sent successfully"})}catch(Hn){console.error("Error resending welcome email:",Hn),t({title:"Error",description:Hn.message||"Failed to resend welcome email",variant:"destructive"})}},ks=async(_r,Hn)=>{try{const{error:kt}=await J.functions.invoke("send-password-reset",{body:{email:_r,redirectTo:window.location.origin}});if(kt)throw kt;t({title:"Password Reset Sent",description:`Password reset email sent to ${Hn}`})}catch(kt){console.error("Error sending password reset:",kt),t({title:"Error",description:kt.message||"Failed to send password reset email",variant:"destructive"})}},fr=_r=>{H(_r),F(!0)},xs=_r=>{be(_r),Te({name:_r.name,phone:_r.phone||"",email:_r.email}),he(!0)},ji=async()=>{if(!xe)return;if(!Oe.name.trim()){t({title:"Error",description:"Name is required",variant:"destructive"});return}const _r=Oe.email.trim().toLowerCase()!==xe.email.toLowerCase();Fe(!0);try{if(_r){if(!Oe.email.trim())throw new Error("Email is required");Qe(!0);const{data:{session:kt}}=await J.auth.getSession(),je=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.access_token}`},body:JSON.stringify({agentId:xe.id,newEmail:Oe.email.trim(),brokerageId:e})}),Re=await je.json();if(Qe(!1),!je.ok)throw new Error(Re.error||"Failed to update email")}const{error:Hn}=await J.from("profiles").update({name:Oe.name.trim(),phone:Oe.phone.trim()||null}).eq("id",xe.id);if(Hn)throw Hn;t({title:"Success",description:"Agent profile updated successfully"}),he(!1),be(null),kn()}catch(Hn){console.error("Error updating agent:",Hn),t({title:"Error",description:Hn.message||"Failed to update agent",variant:"destructive"})}finally{Fe(!1),Qe(!1)}},mi=async()=>{if(!ne){t({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}fe(!0);try{const{data:{session:_r}}=await J.auth.getSession(),Hn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({userId:ne,role:"brokerage_manager",action:"add",brokerageId:e})}),kt=await Hn.json();if(!Hn.ok)throw new Error(kt.error||"Failed to add brokerage manager");t({title:"Success",description:"Brokerage manager added successfully"}),ve(!1),ge(""),yn()}catch(_r){console.error("Error adding brokerage manager:",_r),t({title:"Error",description:_r.message||"Failed to add brokerage manager",variant:"destructive"})}finally{fe(!1)}},La=async _r=>{try{const{data:{session:Hn}}=await J.auth.getSession(),kt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Hn==null?void 0:Hn.access_token}`},body:JSON.stringify({userId:_r,role:"brokerage_manager",action:"remove",brokerageId:e})}),je=await kt.json();if(!kt.ok)throw new Error(je.error||"Failed to remove brokerage manager");t({title:"Success",description:"Brokerage manager role removed"}),yn()}catch(Hn){console.error("Error removing brokerage manager:",Hn),t({title:"Error",description:Hn.message||"Failed to remove brokerage manager",variant:"destructive"})}},da=_r=>de.includes(_r),tl=_r=>{ft(_r),Nt(""),Je(!0)},rl=async()=>{if(!(!tt||!jt)){if(jt.length<6){t({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}vt(!0);try{const{data:{session:_r}}=await J.auth.getSession(),Hn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({agentId:tt.id,brokerageId:e,action:"set_password",newPassword:jt})}),kt=await Hn.json();if(!Hn.ok)throw new Error(kt.error||"Failed to set password");t({title:"Success",description:`Password set for ${tt.name}`}),Je(!1),ft(null),Nt("")}catch(_r){console.error("Error setting password:",_r),t({title:"Error",description:_r.message||"Failed to set password",variant:"destructive"})}finally{vt(!1)}}},Gs=async _r=>{Ar(_r.id);try{const{data:{session:Hn}}=await J.auth.getSession(),kt=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Hn==null?void 0:Hn.access_token}`},body:JSON.stringify({agentId:_r.id,brokerageId:e,action:"claim_account"})}),je=await kt.json();if(!kt.ok)throw new Error(je.error||"Failed to claim account");t({title:"Success",description:`Account claimed for ${_r.name}`}),kn()}catch(Hn){console.error("Error claiming account:",Hn),t({title:"Error",description:Hn.message||"Failed to claim account",variant:"destructive"})}finally{Ar(null)}},Zi=async()=>{if(q){Z(!0);try{const{data:{session:_r}}=await J.auth.getSession(),Hn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${_r==null?void 0:_r.access_token}`},body:JSON.stringify({userId:q.id,brokerageId:e})}),kt=await Hn.json();if(!Hn.ok)throw new Error(kt.error||"Failed to remove agent");t({title:"Success",description:`${q.name} has been removed from your brokerage`}),F(!1),H(null),kn()}catch(_r){console.error("Error removing agent:",_r),t({title:"Error",description:_r.message||"Failed to remove agent",variant:"destructive"})}finally{Z(!1)}}},Ns=_r=>{const Hn=_r.trim().split(" ");return Hn.length>1?Hn[Hn.length-1].toLowerCase():_r.toLowerCase()},Ei=_r=>{Ee===_r?mt(me==="asc"?"desc":"asc"):(Ye(_r),mt("asc"))},Ii=_r=>Ee!==_r?r.jsx($x,{className:"ml-1 h-4 w-4"}):me==="asc"?r.jsx(vg,{className:"ml-1 h-4 w-4"}):r.jsx(i1,{className:"ml-1 h-4 w-4"}),Oo=n.filter(_r=>{if(h==="active"&&!_r.claimed||h==="pending"&&_r.claimed)return!1;if(!l)return!0;const Hn=l.toLowerCase();return _r.name.toLowerCase().includes(Hn)||_r.email.toLowerCase().includes(Hn)}),ir=[...Oo].sort((_r,Hn)=>{if(!Ee)return 0;let kt=0;return Ee==="name"?kt=Ns(_r.name).localeCompare(Ns(Hn.name)):Ee==="status"&&(kt=_r.claimed===Hn.claimed?0:_r.claimed?-1:1),me==="asc"?kt:-kt});Oo.filter(_r=>_r.claimed&&!da(_r.id));const xo=_r=>{y(Hn=>{const kt=new Set(Hn);return kt.has(_r)?kt.delete(_r):kt.add(_r),kt})},Tc=()=>{x.size===ir.length?y(new Set):y(new Set(ir.map(_r=>_r.id)))},yo=()=>{y(new Set)},ss=async()=>{const _r=Array.from(x);if(_r.length===0)return;j(!0);let Hn=0,kt=0;try{const{data:{session:je}}=await J.auth.getSession();for(const Re of _r)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${je==null?void 0:je.access_token}`},body:JSON.stringify({userId:Re})})).ok?Hn++:kt++}catch{kt++}Hn>0?t({title:"Success",description:`Welcome emails sent to ${Hn} agent${Hn>1?"s":""}${kt>0?` (${kt} failed)`:""}`}):t({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),yo()}catch(je){console.error("Error bulk sending welcome emails:",je),t({title:"Error",description:je.message||"Failed to send welcome emails",variant:"destructive"})}finally{j(!1)}};return i?r.jsx(Ge,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Agents"}),r.jsx(En,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>ve(!0),children:[r.jsx(Kf,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ae(!0),children:[r.jsx(h1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(ee,{onClick:()=>C(!0),children:[r.jsx(Jh,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search agents...",value:l,onChange:_r=>a(_r.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:h,onValueChange:_r=>p(_r),children:[r.jsx(mn,{className:"w-[160px]",children:r.jsx(_n,{placeholder:"Filter by status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Agents"}),r.jsx(Ht,{value:"active",children:"Active"}),r.jsx(Ht,{value:"pending",children:"Pending"})]})]})]}),x.size>0&&r.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border bg-muted/50 p-3",children:[r.jsxs("span",{className:"text-sm font-medium",children:[x.size," agent",x.size>1?"s":""," selected"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:ss,disabled:b,children:[r.jsx(Ys,{className:"mr-2 h-4 w-4"}),b?"Sending...":"Resend Welcome Email"]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:yo,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(cc,{checked:ir.length>0&&x.size===ir.length,onCheckedChange:Tc,"aria-label":"Select all"})}),r.jsx(It,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ei("name"),children:["Name (Last)",Ii("name")]})}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Ei("status"),children:["Status",Ii("status")]})}),r.jsx(It,{children:"Actions"})]})}),r.jsx(Ws,{children:ir.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):ir.map(_r=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsx(cc,{checked:x.has(_r.id),onCheckedChange:()=>xo(_r.id),"aria-label":`Select ${_r.name}`})}),r.jsx(_t,{className:"font-medium",children:_r.name}),r.jsx(_t,{children:_r.email}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[_r.claimed?r.jsx(Rt,{variant:"default",children:"Active"}):r.jsx(Rt,{variant:"secondary",children:"Pending"}),da(_r.id)&&r.jsxs(Rt,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(ZT,{className:"mr-1 h-3 w-3"}),"Manager"]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{ht(_r),nt(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(Sc,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>xs(_r),title:"Edit agent",children:r.jsx(ha,{className:"h-4 w-4"})}),!_r.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>zn(_r.id),title:"Resend welcome email",children:r.jsx(Ys,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>Gs(_r),title:"Claim account for agent",disabled:rr===_r.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(wj,{className:"h-4 w-4"})})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>tl(_r),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(Gf,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>ks(_r.email,_r.name),title:"Send password reset email",children:r.jsx(xj,{className:"h-4 w-4"})}),da(_r.id)&&r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>La(_r.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(Kf,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>fr(_r),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},_r.id))})]})})]})]}),r.jsx(Br,{open:N,onOpenChange:C,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Add New Agent"}),r.jsx(es,{children:"Create a new agent account. They'll receive an email to set up their account."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",value:T.name,onChange:_r=>L({...T,name:_r.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"email",children:"Email"}),r.jsx(at,{id:"email",type:"email",value:T.email,onChange:_r=>L({...T,email:_r.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(at,{id:"phone",type:"tel",value:T.phone,onChange:_r=>L({...T,phone:_r.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"password",children:"Temporary Password"}),r.jsx(at,{id:"password",type:"password",value:T.password,onChange:_r=>L({...T,password:_r.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(ee,{onClick:Jr,disabled:A,children:A?"Creating...":"Create Agent"})]})]})}),r.jsx(Br,{open:z,onOpenChange:F,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Remove Agent"}),r.jsxs(es,{children:["Are you sure you want to remove ",r.jsx("strong",{children:q==null?void 0:q.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Zi,disabled:K,children:K?"Removing...":"Remove Agent"})]})]})}),r.jsx(bRe,{open:te,onOpenChange:ae,fixedBrokerageId:e,onSuccess:kn}),r.jsx(Br,{open:le,onOpenChange:ve,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Add Brokerage Manager"}),r.jsx(es,{children:"Promote an existing active agent to brokerage manager. They will be able to manage agents and view analytics."})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(Ue,{children:"Select Agent"}),r.jsxs(Du,{open:Ie,onOpenChange:Ne,children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":Ie,className:"w-full justify-between",children:[ne?((vo=n.find(_r=>_r.id===ne))==null?void 0:vo.name)+" ("+((Bd=n.find(_r=>_r.id===ne))==null?void 0:Bd.email)+")":"Select an agent to promote...",r.jsx(o1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(nu,{className:"w-full p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search by name or email..."}),r.jsxs(H1,{className:"max-h-[200px]",children:[r.jsx(W1,{children:"No eligible agents found."}),r.jsx(G1,{children:n.filter(_r=>!da(_r.id)).map(_r=>r.jsxs(K1,{value:`${_r.name} ${_r.email}`,onSelect:()=>{ge(_r.id),Ne(!1)},children:[r.jsx(Ca,{className:`mr-2 h-4 w-4 ${ne===_r.id?"opacity-100":"opacity-0"}`}),_r.name," (",_r.email,")"]},_r.id))})]})]})})]}),n.filter(_r=>!da(_r.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>ve(!1),children:"Cancel"}),r.jsx(ee,{onClick:mi,disabled:ie||!ne,children:ie?"Adding...":"Add as Manager"})]})]})}),r.jsx(Br,{open:we,onOpenChange:he,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Agent"}),r.jsxs(es,{children:["Update profile information for ",xe==null?void 0:xe.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"edit-name",children:"Name"}),r.jsx(at,{id:"edit-name",value:Oe.name,onChange:_r=>Te({...Oe,name:_r.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"edit-email",children:"Email"}),r.jsx(at,{id:"edit-email",type:"email",value:Oe.email,onChange:_r=>Te({...Oe,email:_r.target.value}),placeholder:"agent@example.com"}),Oe.email.trim().toLowerCase()!==(xe==null?void 0:xe.email.toLowerCase())&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing email will update their login credentials"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(at,{id:"edit-phone",type:"tel",value:Oe.phone,onChange:_r=>Te({...Oe,phone:_r.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>he(!1),children:"Cancel"}),r.jsx(ee,{onClick:ji,disabled:Ve||Me,children:Me?"Updating email...":Ve?"Saving...":"Save Changes"})]})]})}),Ae&&r.jsx(wRe,{open:et,onOpenChange:_r=>{nt(_r),_r||ht(null)},userId:Ae.id,userName:Ae.name}),r.jsx(Br,{open:$e,onOpenChange:Je,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Set Password"}),r.jsxs(es,{children:["Set a new password for ",tt==null?void 0:tt.name,". They will be able to log in with this password immediately."]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"new-password",children:"New Password"}),r.jsx(at,{id:"new-password",type:"password",value:jt,onChange:_r=>Nt(_r.target.value),placeholder:"Enter new password (min 6 characters)"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Make sure to communicate this password to the agent through a secure channel."})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Je(!1),children:"Cancel"}),r.jsx(ee,{onClick:rl,disabled:Et||!jt||jt.length<6,children:Et?"Setting...":"Set Password"})]})]})})]})},Bwt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},$wt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},Uwt=e=>{switch(e){case"academy_video":return r.jsx(Fi,{className:"h-4 w-4"});case"template":return r.jsx(wi,{className:"h-4 w-4"});case"toolbox":return r.jsx(wi,{className:"h-4 w-4"});case"newsletter":return r.jsx(Wx,{className:"h-4 w-4"});case"social_swag":return r.jsx(Cs,{className:"h-4 w-4"});case"event":return r.jsx(zs,{className:"h-4 w-4"});default:return r.jsx(Fs,{className:"h-4 w-4"})}},qwt=({brokerageId:e})=>{const{toast:t}=pa(),[n,s]=I.useState([]),[i,o]=I.useState([]),[l,a]=I.useState([]),[h,p]=I.useState(!0),[x,y]=I.useState(null);I.useEffect(()=>{b()},[e]);const b=async()=>{try{p(!0);const{data:C,error:A}=await J.from("profiles").select("id, name, email").eq("brokerage_id",e);if(A)throw A;const E=C.map(ae=>ae.id),T=new Map(C.map(ae=>[ae.id,ae]));if(E.length===0){s([]),o([]),a([]);return}const{data:L,error:z}=await J.from("activity_logs").select("*").in("user_id",E).order("launched_at",{ascending:!1});if(z)throw z;const F=L.map(ae=>{var le,ve;return{id:ae.id,user_id:ae.user_id,app_name:ae.app_name,launched_at:ae.launched_at,user_name:((le=T.get(ae.user_id))==null?void 0:le.name)||"Unknown",user_email:((ve=T.get(ae.user_id))==null?void 0:ve.email)||"Unknown"}});s(F);const{data:q,error:H}=await J.from("content_engagement_logs").select("*").in("user_id",E).order("created_at",{ascending:!1});if(H)throw H;const K=(q||[]).map(ae=>{var le,ve;return{id:ae.id,user_id:ae.user_id,resource_type:ae.resource_type,resource_id:ae.resource_id,resource_title:ae.resource_title,action_type:ae.action_type,created_at:ae.created_at,user_name:((le=T.get(ae.user_id))==null?void 0:le.name)||"Unknown",user_email:((ve=T.get(ae.user_id))==null?void 0:ve.email)||"Unknown"}});o(K);const Z=new Map;C.forEach(ae=>{Z.set(ae.id,{user_id:ae.id,user_name:ae.name,user_email:ae.email,app_launches:0,content_views:0,last_activity:""})}),F.forEach(ae=>{const le=Z.get(ae.user_id);le&&(le.app_launches++,(!le.last_activity||new Date(ae.launched_at)>new Date(le.last_activity))&&(le.last_activity=ae.launched_at))}),K.forEach(ae=>{const le=Z.get(ae.user_id);le&&(le.content_views++,(!le.last_activity||new Date(ae.created_at)>new Date(le.last_activity))&&(le.last_activity=ae.created_at))});const te=Array.from(Z.values()).filter(ae=>ae.app_launches>0||ae.content_views>0).sort((ae,le)=>new Date(le.last_activity).getTime()-new Date(ae.last_activity).getTime());a(te)}catch(C){console.error("Error loading activity:",C),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{p(!1)}},j=C=>n.filter(A=>A.user_id===C),N=C=>i.filter(A=>A.user_id===C);return h?r.jsx(Ge,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Agent Activity"}),r.jsx(En,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(Xe,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"App Launches"}),r.jsx(It,{className:"text-center",children:"Content Views"}),r.jsx(It,{children:"Last Active"})]})}),r.jsx(Ws,{children:l.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(C=>r.jsxs(Ir,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>y({id:C.user_id,name:C.user_name,email:C.user_email}),children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:C.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:C.user_email})]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(dc,{className:"h-3 w-3"}),C.app_launches]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(wi,{className:"h-3 w-3"}),C.content_views]})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:C.last_activity&&tu(new Date(C.last_activity),{addSuffix:!0})})]},C.user_id))})]})})})]}),r.jsx(Br,{open:!!x,onOpenChange:C=>!C&&y(null),children:r.jsxs(Fr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(es,{children:x==null?void 0:x.email})]}),r.jsxs(ba,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsx(ln,{value:"content",children:"Content Engagement"}),r.jsx(ln,{value:"apps",children:"App Launches"})]}),r.jsx(An,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ws,{children:x&&N(x.id).length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&N(x.id).map(C=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"max-w-[200px] truncate font-medium",children:C.resource_title}),r.jsx(_t,{children:r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[Uwt(C.resource_type),Bwt[C.resource_type]||C.resource_type]})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:$wt[C.action_type]||C.action_type})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:tu(new Date(C.created_at),{addSuffix:!0})})]},C.id))})]})})}),r.jsx(An,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ws,{children:x&&j(x.id).length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&j(x.id).map(C=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:C.app_name})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:tu(new Date(C.launched_at),{addSuffix:!0})})]},C.id))})]})})})]})]})})]})},Vwt=({brokerageId:e})=>{const{toast:t}=pa(),[n,s]=I.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[i,o]=I.useState(!0);I.useEffect(()=>{l()},[e]);const l=async()=>{try{o(!0);const{data:a,error:h}=await J.from("profiles").select("id").eq("brokerage_id",e);if(h)throw h;const p=a.map(F=>F.id),x=p.length;if(p.length===0){o(!1);return}const{data:y,error:b}=await J.from("profiles").select("id, email").in("id",p);if(b)throw b;const{count:j}=await J.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",e).not("last_login","is",null),N=j||0,C=x-N,{count:A}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p),E=new Date;E.setDate(E.getDate()-7);const{count:T}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",E.toISOString()),L=new Date;L.setMonth(L.getMonth()-1);const{count:z}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",L.toISOString());s({totalAgents:x,activeAgents:N,pendingAgents:C,totalLaunches:A||0,launchesThisWeek:T||0,launchesThisMonth:z||0})}catch(a){console.error("Error loading analytics:",a),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return i?r.jsx(Ge,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx(Vn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalAgents}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.activeAgents," active, ",n.pendingAgents," pending"]})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(qa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.activeAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:n.totalAgents>0?`${Math.round(n.activeAgents/n.totalAgents*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ki,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.pendingAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(yg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(yg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Qt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(yg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(Xe,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]})},Hwt=({brokerageId:e})=>{const[t,n]=I.useState([]),[s,i]=I.useState(!0),[o,l]=I.useState(!1),[a,h]=I.useState(!1),[p,x]=I.useState({description:"",maxUses:""});I.useEffect(()=>{y()},[e]);const y=async()=>{try{const{data:E,error:T}=await J.from("invite_codes").select("*").eq("brokerage_id",e).order("created_at",{ascending:!1});if(T)throw T;n(E||[])}catch(E){console.error("Error loading invite codes:",E),ze.error("Failed to load invite links")}finally{i(!1)}},b=()=>Math.random().toString(36).substring(2,8).toUpperCase(),j=async()=>{l(!0);try{const E=b(),{error:T}=await J.from("invite_codes").insert({code:E,description:p.description||null,max_uses:p.maxUses?parseInt(p.maxUses):null,brokerage_id:e,is_active:!0});if(T)throw T;ze.success("Invite link created!"),h(!1),x({description:"",maxUses:""}),y()}catch(E){console.error("Error creating invite code:",E),ze.error("Failed to create invite link")}finally{l(!1)}},N=async E=>{try{const{error:T}=await J.from("invite_codes").delete().eq("id",E);if(T)throw T;ze.success("Invite link deleted"),n(t.filter(L=>L.id!==E))}catch(T){console.error("Error deleting invite code:",T),ze.error("Failed to delete invite link")}},C=async(E,T)=>{try{const{error:L}=await J.from("invite_codes").update({is_active:!T}).eq("id",E);if(L)throw L;n(t.map(z=>z.id===E?{...z,is_active:!T}:z)),ze.success(`Invite link ${T?"deactivated":"activated"}`)}catch(L){console.error("Error toggling invite code:",L),ze.error("Failed to update invite link")}},A=E=>{const T=`${window.location.origin}/join?code=${E}`;navigator.clipboard.writeText(T),ze.success("Link copied to clipboard!")};return s?r.jsx(Ge,{children:r.jsx(Xe,{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(En,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Br,{open:a,onOpenChange:h,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create Invite Link"}),r.jsx(es,{children:"Create a new invite link for agents to join your brokerage"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description (optional)"}),r.jsx(at,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:p.description,onChange:E=>x({...p,description:E.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(at,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:p.maxUses,onChange:E=>x({...p,maxUses:E.target.value})})]}),r.jsx(ee,{onClick:j,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(Xe,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(So,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No invite links yet"}),r.jsx("p",{className:"text-sm",children:"Create one to start inviting agents"})]}):r.jsx("div",{className:"space-y-3",children:t.map(E=>r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-0.5 rounded",children:E.code}),r.jsx(Rt,{variant:E.is_active?"default":"secondary",children:E.is_active?"Active":"Inactive"})]}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:E.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[E.uses_count," uses",E.max_uses&&` / ${E.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>A(E.code),title:"Copy link",children:r.jsx(pl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>C(E.id,E.is_active),title:E.is_active?"Deactivate":"Activate",children:E.is_active?"Disable":"Enable"}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(E.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Zn,{className:"h-4 w-4"})})]})]},E.id))})})]})},Wwt=({open:e,onOpenChange:t,referralCode:n,brokerageId:s,senderName:i,brokerageName:o,onInvitesSent:l})=>{const[a,h]=I.useState(""),[p,x]=I.useState([]),[y,b]=I.useState(""),[j,N]=I.useState(!1),C=z=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z),A=()=>{const z=a.trim().toLowerCase();if(z&&C(z)&&!p.includes(z)){if(p.length>=10){ze.error("Maximum 10 emails per invite");return}x([...p,z]),h("")}else z&&!C(z)?ze.error("Please enter a valid email address"):p.includes(z)&&ze.error("Email already added")},E=z=>{x(p.filter(F=>F!==z))},T=z=>{(z.key==="Enter"||z.key===",")&&(z.preventDefault(),A())},L=async()=>{if(p.length===0){ze.error("Please add at least one email address");return}N(!0);try{const{data:z,error:F}=await J.functions.invoke("send-referral-invite",{body:{emails:p,personalMessage:y.trim()||void 0,referralCode:n,brokerageId:s,senderName:i,brokerageName:o}});if(F)throw F;z.successCount===z.totalCount?ze.success(`${z.successCount} invite${z.successCount>1?"s":""} sent successfully!`):ze.warning(`${z.successCount} of ${z.totalCount} invites sent. Some failed.`),x([]),b(""),t(!1),l==null||l()}catch(z){console.error("Error sending invites:",z),ze.error("Failed to send invites. Please try again.")}finally{N(!1)}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-[550px]",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(es,{children:"Send a personalized email invitation to broker owners you know. They'll receive a beautiful email highlighting LevelUp's features."})]}),r.jsxs("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-lg p-4 flex items-center gap-3",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Ha,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:"Earn $25/month for each referral!"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When they sign up and stay for 30 days, you save on your membership forever."})]})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:a,onChange:z=>h(z.target.value),onKeyDown:T,onBlur:A}),r.jsx(ee,{type:"button",variant:"secondary",onClick:A,children:"Add"})]}),p.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:p.map(z=>r.jsxs(Rt,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[z,r.jsx("button",{type:"button",onClick:()=>E(z),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(bs,{className:"h-3 w-3"})})]},z))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(ps,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:y,onChange:z=>b(z.target.value),rows:3,maxLength:500}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[y.length,"/500 characters"]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Cs,{className:"h-4 w-4 text-primary"}),"What they'll receive:"]}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Beautiful branded email from you"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Your personal message (if added)"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Key LevelUp features for brokerages"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Direct signup link with your referral code"]})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ee,{onClick:L,disabled:p.length===0||j,children:j?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent mr-2"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Send ",p.length>0&&`(${p.length})`," Invite",p.length!==1?"s":""]})})]})]})})},Gwt=({brokerageId:e,refreshTrigger:t})=>{const[n,s]=I.useState([]),[i,o]=I.useState(!0);I.useEffect(()=>{l()},[e,t]);const l=async()=>{try{const{data:h,error:p}=await J.from("referral_invites").select("*").eq("referrer_brokerage_id",e).order("sent_at",{ascending:!1}).limit(20);if(p)throw p;s(h||[])}catch(h){console.error("Error fetching invites:",h)}finally{o(!1)}},a=h=>{switch(h){case"signed_up":return r.jsxs(Rt,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(qa,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Rt,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(zc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Rt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),"Pending"]})}};return i?r.jsx("div",{className:"flex justify-center py-4",children:r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):n.length===0?r.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[r.jsx(Ys,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No invites sent yet"}),r.jsx("p",{className:"text-xs",children:"Start inviting broker friends to earn rewards!"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Recent Invites"}),n.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:h.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",xn(new Date(h.sent_at),"MMM d, yyyy")]})]}),a(h.status)]},h.id))]})},Kwt=()=>{const{brokerageId:e,user:t}=zr(),[n,s]=I.useState(null),[i,o]=I.useState(""),[l,a]=I.useState(""),[h,p]=I.useState([]),[x,y]=I.useState(!0),[b,j]=I.useState(!1),[N,C]=I.useState(0);I.useEffect(()=>{e&&A()},[e]);const A=async()=>{try{const[q,H]=await Promise.all([J.from("brokerages").select("name").eq("id",e).single(),t?J.from("profiles").select("name").eq("id",t.id).single():Promise.resolve({data:null})]);q.data&&o(q.data.name),H.data&&a(H.data.name||"A LevelUp Member");const{data:K}=await J.from("referral_codes").select("code").eq("brokerage_id",e).single();if(K)s(K.code);else{const te=`REF${e==null?void 0:e.slice(0,8).toUpperCase()}`;await J.from("referral_codes").insert({brokerage_id:e,code:te}),s(te)}const{data:Z}=await J.from("referrals").select(` *, referred_user:profiles!referred_user_id(name, email), referred_brokerage:brokerages!referred_brokerage_id(name) `).eq("referrer_brokerage_id",e).order("created_at",{ascending:!1});p(Z||[])}catch(q){console.error("Error fetching referral data:",q)}finally{y(!1)}},E=()=>{const q=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(q),ze.success("Referral link copied to clipboard!")},T=h.filter(q=>q.status==="qualified").length,L=h.filter(q=>q.status==="pending").length,z=T*25,F=Math.max(0,Math.ceil((299-z)/25));return x?null:r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{className:"overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-b",children:r.jsxs("div",{className:"px-6 py-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Ha,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-bold",children:"Referral Rewards Program"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Earn $25/month off your membership for every broker you refer"})]})]}),r.jsx("div",{className:"mt-4 bg-background/80 rounded-lg p-4 border",children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"text-3xl font-bold text-primary",children:["$",z]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),z>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(qa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),F>0&&z<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",F," more = ",r.jsx("span",{className:"text-primary",children:"FREE membership!"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your membership could cost $0/month"})]}),z>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Cs,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(Xe,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(ee,{onClick:()=>j(!0),className:"w-full",size:"lg",children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(ee,{onClick:E,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(pl,{className:"h-4 w-4 mr-2"}),"Copy Referral Link"]})]}),r.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Your Referral Link"}),r.jsxs("code",{className:"block px-3 py-2 bg-background rounded border text-sm break-all",children:["https://dashboard.relevelup.com/?ref=",n]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"text-center p-4 bg-green-50 dark:bg-green-950/20 rounded-lg border border-green-200 dark:border-green-900",children:[r.jsx(ud,{className:"h-5 w-5 mx-auto text-green-600 mb-1"}),r.jsxs("p",{className:"text-2xl font-bold text-green-700 dark:text-green-400",children:["$",z]}),r.jsx("p",{className:"text-xs text-green-600 dark:text-green-500",children:"Monthly Savings"})]}),r.jsxs("div",{className:"text-center p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsx(Vn,{className:"h-5 w-5 mx-auto text-primary mb-1"}),r.jsx("p",{className:"text-2xl font-bold",children:T}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified Referrals"})]}),r.jsxs("div",{className:"text-center p-4 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-900",children:[r.jsx(Ki,{className:"h-5 w-5 mx-auto text-amber-600 mb-1"}),r.jsx("p",{className:"text-2xl font-bold text-amber-700 dark:text-amber-400",children:L}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-500",children:"Pending (30 days)"})]})]}),r.jsxs("div",{className:"bg-muted/30 rounded-lg p-4",children:[r.jsx("h4",{className:"font-semibold text-sm mb-3",children:"How It Works"}),r.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"1"}),r.jsx("p",{children:"Share your referral link or send an invite email to broker friends"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"2"}),r.jsx("p",{children:"They sign up and subscribe to LevelUp"})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:"bg-primary text-primary-foreground rounded-full w-5 h-5 flex items-center justify-center text-xs shrink-0",children:"3"}),r.jsx("p",{children:"After 30 days, you get $25/month off your membership - forever!"})]})]})]}),r.jsx(Gwt,{brokerageId:e,refreshTrigger:N}),h.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),h.slice(0,5).map(q=>{var H,K;return r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsx("span",{className:"text-sm truncate",children:((H=q.referred_brokerage)==null?void 0:H.name)||((K=q.referred_user)==null?void 0:K.email)||"Pending setup"}),r.jsxs(Rt,{variant:q.status==="qualified"?"default":q.status==="pending"?"secondary":"destructive",className:q.status==="qualified"?"bg-green-600":"",children:[q.status==="qualified"&&r.jsx(qa,{className:"h-3 w-3 mr-1"}),q.status]})]},q.id)})]})]})]}),r.jsx(Wwt,{open:b,onOpenChange:j,referralCode:n||"",brokerageId:e||"",senderName:l||"A LevelUp Member",brokerageName:i,onInvitesSent:()=>C(q=>q+1)})]})},Zwt=()=>{const{user:e,isBrokerageManager:t,brokerageId:n,isAdmin:s,managedBrokerages:i,selectedBrokerageId:o,setSelectedBrokerageId:l}=zr(),a=ns(),{toast:h}=pa(),[p,x]=I.useState(""),[y,b]=I.useState(!0),j=o||(i.length>0?i[0].id:n);I.useEffect(()=>{if(!e||!t&&!s){a("/dashboard");return}!o&&i.length>0&&l(i[0].id),j?N():i.length===0&&!n&&b(!1)},[e,t,s,j,a,i,o]);const N=async()=>{if(!j){b(!1);return}try{const{data:C,error:A}=await J.from("brokerages").select("name").eq("id",j).single();if(A)throw A;x(C.name)}catch(C){console.error("Error loading brokerage info:",C),h({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{b(!1)}};return y?r.jsx(Or,{title:"Manage Brokerages",description:"Loading brokerage information...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):j?r.jsx(Or,{title:p||"Manage Brokerages",description:"Brokerage Management Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[i.length>1&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Managing:"}),r.jsxs(vn,{value:o||"",onValueChange:l,children:[r.jsxs(mn,{className:"w-[280px]",children:[r.jsx(na,{className:"mr-2 h-4 w-4"}),r.jsx(_n,{placeholder:"Select brokerage"})]}),r.jsx(gn,{children:i.map(C=>r.jsx(Ht,{value:C.id,children:C.name},C.id))})]})]}),r.jsxs(ba,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(fa,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(ln,{value:"agents",children:"Agents"}),r.jsx(ln,{value:"invite",children:"Invite Links"}),r.jsx(ln,{value:"referrals",children:"Referrals"}),r.jsx(ln,{value:"leaderboard",children:"Leaderboard"}),r.jsx(ln,{value:"activity",children:"Activity"}),r.jsx(ln,{value:"analytics",children:"Analytics"}),r.jsx(ln,{value:"shares",children:"Shares"})]}),r.jsx(An,{value:"agents",className:"space-y-4",children:r.jsx(zwt,{brokerageId:j})}),r.jsx(An,{value:"invite",className:"space-y-4",children:r.jsx(Hwt,{brokerageId:j})}),r.jsx(An,{value:"referrals",className:"space-y-4",children:r.jsx(Kwt,{})}),r.jsx(An,{value:"leaderboard",className:"space-y-4",children:r.jsx(bDe,{brokerageId:j,title:`${p} Event Leaderboard`,showUserStats:!1})}),r.jsx(An,{value:"activity",className:"space-y-4",children:r.jsx(qwt,{brokerageId:j})}),r.jsx(An,{value:"analytics",className:"space-y-4",children:r.jsx(Vwt,{brokerageId:j})}),r.jsx(An,{value:"shares",className:"space-y-4",children:r.jsx(Aze,{brokerageOnly:!0,brokerageId:j})})]})]})}):r.jsx(Or,{title:"Manage Brokerages",description:"Brokerage Management",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(na,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You don't have any brokerages to manage."})]})})};function Ywt({brokerageId:e,canManage:t}){const{user:n}=zr(),[s,i]=I.useState([]),[o,l]=I.useState(!0),[a,h]=I.useState(!1),[p,x]=I.useState(null),[y,b]=I.useState(null),[j,N]=I.useState(!1),[C,A]=I.useState(""),[E,T]=I.useState(""),[L,z]=I.useState(!1),F=async()=>{try{const{data:te,error:ae}=await J.from("brokerage_announcements").select("*").eq("brokerage_id",e).order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(ae)throw ae;const le=te;if(le&&le.length>0){const ve=[...new Set(le.map(fe=>fe.created_by))],{data:ne}=await J.from("profiles").select("id, name, avatar_url").in("id",ve),ge=new Map((ne==null?void 0:ne.map(fe=>[fe.id,fe]))||[]),ie=le.map(fe=>({...fe,author:ge.get(fe.created_by)||{name:"Unknown",avatar_url:null}}));i(ie)}else i([])}catch(te){console.error("Error fetching announcements:",te)}finally{l(!1)}};I.useEffect(()=>{F()},[e]);const q=()=>{A(""),T(""),z(!1),x(null)},H=te=>{te?(x(te),A(te.title),T(te.content),z(te.is_pinned)):q(),h(!0)},K=async()=>{if(!C.trim()||!E.trim()){ze.error("Please fill in all fields");return}N(!0);try{if(p){const{error:te}=await J.from("brokerage_announcements").update({title:C.trim(),content:E.trim(),is_pinned:L,pinned_at:L?new Date().toISOString():null}).eq("id",p.id);if(te)throw te;ze.success("Announcement updated")}else{const{error:te}=await J.from("brokerage_announcements").insert({brokerage_id:e,created_by:n==null?void 0:n.id,title:C.trim(),content:E.trim(),is_pinned:L,pinned_at:L?new Date().toISOString():null});if(te)throw te;ze.success("Announcement created")}h(!1),q(),F()}catch(te){console.error("Error saving announcement:",te),ze.error("Failed to save announcement")}finally{N(!1)}},Z=async()=>{if(y)try{const{error:te}=await J.from("brokerage_announcements").delete().eq("id",y);if(te)throw te;ze.success("Announcement deleted"),F()}catch(te){console.error("Error deleting announcement:",te),ze.error("Failed to delete announcement")}finally{b(null)}};return o?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5 text-primary"}),"Announcements"]}),t&&r.jsxs(ee,{size:"sm",onClick:()=>H(),className:"gap-1",children:[r.jsx(jn,{className:"h-4 w-4"}),"New"]})]}),r.jsx(Xe,{children:s.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No announcements yet"}):r.jsx("div",{className:"space-y-4",children:s.map(te=>{var ae,le,ve,ne;return r.jsx("div",{className:`p-4 rounded-lg border ${te.is_pinned?"bg-primary/5 border-primary/20":"bg-muted/30"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[te.is_pinned&&r.jsx(v1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:te.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:te.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(ci,{className:"h-5 w-5",children:[r.jsx(Ga,{src:((ae=te.author)==null?void 0:ae.avatar_url)||void 0}),r.jsx(di,{className:"text-[10px]",children:((ve=(le=te.author)==null?void 0:le.name)==null?void 0:ve.charAt(0))||"?"})]}),r.jsx("span",{children:(ne=te.author)==null?void 0:ne.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:xn(new Date(te.created_at),"MMM d, yyyy")})]})]}),t&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>H(te),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>b(te.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})},te.id)})})})]}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:p?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title"}),r.jsx(at,{id:"title",value:C,onChange:te=>A(te.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"content",children:"Content"}),r.jsx(ps,{id:"content",value:E,onChange:te=>T(te.target.value),placeholder:"Write your announcement...",rows:4})]}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"pinned",checked:L,onCheckedChange:z}),r.jsxs(Ue,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(v1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{onClick:K,disabled:j,children:j?"Saving...":p?"Update":"Create"})]})]})]})}),r.jsx(fh,{open:!!y,onOpenChange:()=>b(null),children:r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Delete Announcement"}),r.jsx(Cu,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Xwt({brokerageId:e}){const[t,n]=I.useState([]),[s,i]=I.useState(!0),[o,l]=I.useState("");I.useEffect(()=>{(async()=>{try{const{data:p,error:x}=await J.from("profiles").select("id, name, email, phone, avatar_url, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("brokerage_id",e).order("name");if(x)throw x;n(p||[])}catch(p){console.error("Error fetching agents:",p)}finally{i(!1)}})()},[e]);const a=t.filter(h=>{var p,x;return h.name.toLowerCase().includes(o.toLowerCase())||h.email.toLowerCase().includes(o.toLowerCase())||((p=h.title)==null?void 0:p.toLowerCase().includes(o.toLowerCase()))||((x=h.areas_served)==null?void 0:x.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(h=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},h))})})]}):r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5 text-primary"}),"Agent Roster",r.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",t.length,")"]})]}),r.jsxs("div",{className:"relative w-full sm:w-64",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search agents...",value:o,onChange:h=>l(h.target.value),className:"pl-9"})]})]}),r.jsx(Xe,{children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:o?"No agents match your search":"No agents in this brokerage yet"}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:a.map(h=>r.jsx(Qwt,{agent:h},h.id))})})]})}function Qwt({agent:e}){const t=e.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return r.jsxs("div",{className:"group relative bg-card border rounded-xl p-4 hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"flex flex-col items-center text-center mb-3",children:[r.jsxs(ci,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Ga,{src:e.avatar_url||void 0,alt:e.name}),r.jsx(di,{className:"text-lg bg-primary/10 text-primary",children:t})]}),r.jsx("h3",{className:"font-semibold text-sm leading-tight",children:e.name}),e.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.title})]}),e.bio&&r.jsx("p",{className:"text-xs text-muted-foreground text-center line-clamp-2 mb-3",children:e.bio}),r.jsxs("div",{className:"space-y-1.5 mb-3",children:[e.areas_served&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(ml,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:e.areas_served})]}),e.years_experience&&r.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[e.years_experience," ",e.years_experience===1?"year":"years"," experience"]})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.phone&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`tel:${e.phone}`,title:`Call ${e.name}`,children:r.jsx(ca,{className:"h-4 w-4"})})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`mailto:${e.email}`,title:`Email ${e.name}`,children:r.jsx(Ys,{className:"h-4 w-4"})})}),e.linkedin_url&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:e.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:r.jsx(mm,{className:"h-4 w-4"})})}),e.instagram_url&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:e.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:r.jsx(eu,{className:"h-4 w-4"})})})]})]})}function Jwt({brokerageId:e}){const[t,n]=I.useState([]),[s,i]=I.useState(!0);if(I.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await J.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(p)throw p;if(!h||h.length===0){n([]),i(!1);return}const x=h.map(C=>C.id),{data:y,error:b}=await J.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(b)throw b;const j=new Map(h.map(C=>[C.id,C])),N=(y||[]).filter(C=>C.total_points>0).map(C=>{const A=j.get(C.user_id);return{user_id:C.user_id,total_points:C.total_points,name:(A==null?void 0:A.name)||"Unknown",avatar_url:(A==null?void 0:A.avatar_url)||null}});n(N)}catch(h){console.error("Error fetching leaderboard:",h)}finally{i(!1)}})()},[e]),s)return r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(a=>r.jsx("div",{className:"h-12 bg-muted rounded"},a))})})]});const o=a=>a===1?"text-yellow-500":a===2?"text-gray-400":a===3?"text-amber-600":"text-muted-foreground",l=a=>a<=3?r.jsx(Hx,{className:$t("h-5 w-5",o(a))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:a});return r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(Xe,{children:t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No points earned yet. Attend events to earn points!"}):r.jsx("div",{className:"space-y-2",children:t.slice(0,10).map((a,h)=>{const p=a.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),x=h+1;return r.jsxs("div",{className:$t("flex items-center gap-3 p-2 rounded-lg",x<=3&&"bg-muted/50"),children:[r.jsx("div",{className:"w-6 flex justify-center",children:l(x)}),r.jsxs(ci,{className:"h-8 w-8",children:[r.jsx(Ga,{src:a.avatar_url||void 0}),r.jsx(di,{className:"text-xs",children:p})]}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:a.name}),r.jsxs("span",{className:"text-sm font-semibold text-primary",children:[a.total_points.toLocaleString()," pts"]})]},a.user_id)})})})]})}function ejt({brokerageId:e}){const t=ns(),[n,s]=I.useState([]),[i,o]=I.useState(!0);I.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await J.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(p)throw p;if(!h||h.length===0){s([]),o(!1);return}const x=h.map(C=>C.id),y=new Map(h.map(C=>[C.id,C])),{data:b,error:j}=await J.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",x).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(j)throw j;const N=(b||[]).map(C=>({id:C.id,slug:C.slug,property_address:C.property_address,city:C.city,price:C.price,property_type:C.property_type,agent_id:C.agent_id,agent:y.get(C.agent_id)||null,photos:C.listing_photos||[]}));s(N)}catch(h){console.error("Error fetching listings:",h)}finally{o(!1)}})()},[e]);const l=a=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(a);return i?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(a=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},a))})})]}):r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>t("/mission-control/listings"),className:"gap-1",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(Xe,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(fi,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No active listings from your brokerage yet"}),r.jsxs(ee,{size:"sm",onClick:()=>t("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Your First Listing"]})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(a=>r.jsxs("div",{onClick:()=>window.open(`https://listings.relevelup.com/${a.slug||a.id}`,"_blank"),className:"group cursor-pointer border rounded-lg overflow-hidden hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"relative h-24 bg-muted",children:[a.photos&&a.photos.length>0?r.jsx("img",{src:a.photos[0].photo_url,alt:a.property_address||"Listing",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(fi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsx("span",{className:"text-[10px] font-medium bg-primary text-primary-foreground px-1.5 py-0.5 rounded uppercase",children:a.property_type.replace("_"," ")})})]}),r.jsxs("div",{className:"p-2.5",children:[r.jsx("p",{className:"font-semibold text-sm text-primary",children:l(a.price)}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:a.property_address||"Address not available"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:a.city}),a.agent&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",a.agent.name]})]})]},a.id))}),n.length>0&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>t("/mission-control/listings"),children:["View All Listings",r.jsx(Fs,{className:"h-3 w-3 ml-1"})]})]})]})}function tjt(){const{user:e,isAdmin:t,isBrokerageManager:n}=zr(),s=ns(),[i,o]=I.useState(!0),[l,a]=I.useState(null),[h,p]=I.useState(""),[x,y]=I.useState(0),[b,j]=I.useState(!1),[N,C]=I.useState(!1);return I.useEffect(()=>{(async()=>{if(e)try{const{data:E}=await J.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle();if(!(E!=null&&E.brokerage_id)){o(!1);return}a(E.brokerage_id);const{data:T}=await J.from("brokerages").select("name").eq("id",E.brokerage_id).maybeSingle();T&&p(T.name);const{count:L}=await J.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",E.brokerage_id);if(y(L||0),t)j(!0),C(!0);else if(n){const{data:z}=await J.from("brokerage_manager_assignments").select("id").eq("user_id",e.id).eq("brokerage_id",E.brokerage_id).maybeSingle();j(!!z),C(!!z)}}catch(E){console.error("Error fetching brokerage info:",E)}finally{o(!1)}})()},[e,t,n]),i?r.jsx(Or,{title:"My Brokerage",description:"Loading...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):l?r.jsx(Or,{title:h||"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-4 py-2",children:[r.jsx(Vn,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),N&&r.jsxs(ee,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(fi,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(Ywt,{brokerageId:l,canManage:b}),r.jsx(Xwt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(Jwt,{brokerageId:l}),r.jsx(ejt,{brokerageId:l})]})]})}):r.jsx(Or,{title:"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(na,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You're not currently part of a brokerage team."})]})})}function rjt(){const e=ns(),[t,n]=I.useState(""),[s,i]=I.useState("grid"),{data:o,isLoading:l}=Zt({queryKey:["newsletters"],queryFn:async()=>{const{data:L,error:z}=await J.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(z)throw z;return L}}),{data:a}=Zt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:L}=await J.from("newsletter_likes").select("newsletter_id");return L||[]}}),{data:h}=Zt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:L}=await J.from("newsletter_comments").select("newsletter_id");return L||[]}}),{data:p}=Zt({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[L,z,F,q]=await Promise.all([J.from("newsletter_canva_links").select("newsletter_id"),J.from("newsletter_pdfs").select("newsletter_id"),J.from("newsletter_videos").select("newsletter_id"),J.from("newsletter_drive_links").select("newsletter_id")]);return{canva:L.data||[],pdfs:z.data||[],videos:F.data||[],drives:q.data||[]}}}),x=L=>(a==null?void 0:a.filter(z=>z.newsletter_id===L).length)||0,y=L=>(h==null?void 0:h.filter(z=>z.newsletter_id===L).length)||0,b=L=>{var z;return((z=p==null?void 0:p.canva)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},j=L=>{var z;return((z=p==null?void 0:p.pdfs)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},N=L=>{var z;return((z=p==null?void 0:p.videos)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},C=L=>{var z;return((z=p==null?void 0:p.drives)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},A=L=>b(L)+j(L)+N(L)+C(L),E=o==null?void 0:o.filter(L=>{var z;return L.title.toLowerCase().includes(t.toLowerCase())||((z=L.description)==null?void 0:z.toLowerCase().includes(t.toLowerCase()))}),T=L=>{e(`/newsletters/${L}`)};return r.jsx(Or,{title:"Newsletter Content",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Newsletter Content"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Monthly newsletter templates and resources"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search newsletters...",value:t,onChange:L=>n(L.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>i("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>i("list"),className:"rounded-full",children:r.jsx(Wf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(E==null?void 0:E.length)||0," item",(E==null?void 0:E.length)!==1?"s":""," found"]}),l&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((L,z)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-0",children:[r.jsx(Pr,{className:"aspect-[3/2] w-full"}),r.jsxs("div",{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-full"})]})]})},z))}),!l&&(E==null?void 0:E.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(wi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No newsletters match your search":"No newsletters available yet"}),t&&r.jsx(ee,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&E&&E.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-3",children:E.map(L=>{const z=A(L.id),F=b(L.id),q=j(L.id),H=N(L.id);return s==="grid"?r.jsxs(Ge,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(L.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:L.preview_image_url?r.jsx("img",{src:L.preview_image_url,alt:L.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(wi,{className:"h-16 w-16"})})}),r.jsxs(Xe,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:L.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-1 text-xs text-muted-foreground",children:[r.jsx(zs,{className:"h-3 w-3"}),xn(new Date(L.publish_date),"MMM d, yyyy")]})]}),L.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:L.description.replace(/<[^>]*>/g,"")}),z>0&&r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[F>0&&r.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(hd,{className:"h-3 w-3"})," ",F," Template",F>1?"s":""]}),q>0&&r.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Va,{className:"h-3 w-3"})," ",q," PDF",q>1?"s":""]}),H>0&&r.jsxs(Rt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(dc,{className:"h-3 w-3"})," ",H," Video",H>1?"s":""]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground pt-1 border-t border-border/50",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3 w-3"})," ",x(L.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ol,{className:"h-3 w-3"})," ",y(L.id)]})]})]})]},L.id):r.jsx(Ge,{className:"group overflow-hidden hover:shadow-md transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(L.id),children:r.jsxs("div",{className:"flex flex-row",children:[r.jsx("div",{className:"relative overflow-hidden bg-muted w-40 sm:w-48 shrink-0",children:L.preview_image_url?r.jsx("img",{src:L.preview_image_url,alt:L.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground min-h-[100px]",children:r.jsx(wi,{className:"h-10 w-10"})})}),r.jsxs(Xe,{className:"p-4 flex-1 flex flex-col justify-center gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:L.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground",children:[r.jsx(zs,{className:"h-3 w-3"}),xn(new Date(L.publish_date),"MMM d, yyyy")]})]}),L.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:L.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[z>0&&r.jsxs("span",{children:[z," resource",z>1?"s":""]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3 w-3"})," ",x(L.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ol,{className:"h-3 w-3"})," ",y(L.id)]})]})]})]})},L.id)})})]})})}function njt({rows:e}){if(!e||e.length===0)return null;const t=e.filter(n=>n.columns.some(s=>s.title||s.description||s.image_url));return t.length===0?null:r.jsx("div",{className:"space-y-6",children:t.map((n,s)=>{const i=n.columns.filter(o=>o.title||o.description||o.image_url);return i.length===0?null:r.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${i.length}, minmax(0, 1fr))`},children:i.map((o,l)=>r.jsxs(Ge,{className:"overflow-hidden border-border/50",children:[o.image_url&&r.jsx("img",{src:o.image_url,alt:o.title||"",className:"w-full h-40 object-cover"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[o.title&&r.jsx("h4",{className:"font-semibold text-foreground",children:o.title}),o.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})]},l))},s)})})}function sjt(){const{id:e}=Wc(),t=ns(),{user:n}=zr(),{toast:s}=pa(),i=Wr(),{trackEngagement:o}=AI(),[l,a]=I.useState(""),{data:h,isLoading:p}=Zt({queryKey:["newsletter",e],queryFn:async()=>{const{data:F,error:q}=await J.from("newsletter_content").select("*").eq("id",e).single();if(q)throw q;return F},enabled:!!e});I.useEffect(()=>{h&&o("newsletter",h.id,h.title,"view")},[h==null?void 0:h.id]);const{data:x}=Zt({queryKey:["newsletter-drives",e],queryFn:async()=>{const{data:F}=await J.from("newsletter_drive_links").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:y}=Zt({queryKey:["newsletter-pdfs",e],queryFn:async()=>{const{data:F}=await J.from("newsletter_pdfs").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:b}=Zt({queryKey:["newsletter-videos",e],queryFn:async()=>{const{data:F}=await J.from("newsletter_videos").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:j}=Zt({queryKey:["newsletter-canva-links",e],queryFn:async()=>{const{data:F}=await J.from("newsletter_canva_links").select("*").eq("newsletter_id",e).order("sort_order");return F||[]},enabled:!!e}),{data:N}=Zt({queryKey:["newsletter-likes",e],queryFn:async()=>{const{data:F}=await J.from("newsletter_likes").select("*").eq("newsletter_id",e);return F||[]},enabled:!!e}),{data:C}=Zt({queryKey:["newsletter-comments",e],queryFn:async()=>{const{data:F}=await J.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",e).order("created_at",{ascending:!1});return F||[]},enabled:!!e}),A=N==null?void 0:N.some(F=>F.user_id===(n==null?void 0:n.id)),E=cr({mutationFn:async()=>{A?await J.from("newsletter_likes").delete().eq("newsletter_id",e).eq("user_id",n==null?void 0:n.id):await J.from("newsletter_likes").insert({newsletter_id:e,user_id:n==null?void 0:n.id})},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-likes",e]})}}),T=cr({mutationFn:async F=>{const{error:q}=await J.from("newsletter_comments").insert({newsletter_id:e,user_id:n==null?void 0:n.id,content:F});if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",e]}),a(""),s({title:"Comment added"})}}),L=cr({mutationFn:async F=>{const{error:q}=await J.from("newsletter_comments").delete().eq("id",F);if(q)throw q},onSuccess:()=>{i.invalidateQueries({queryKey:["newsletter-comments",e]}),s({title:"Comment deleted"})}}),z=F=>{if(F.includes("player.mediadelivery.net")||F.includes("iframe.mediadelivery.net")){const q=F.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${q[1]}/${q[2]}?autoplay=false`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})}if(F.includes("youtube.com")||F.includes("youtu.be")){const q=F.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${q[1]}`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}return r.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(dc,{className:"h-4 w-4"})," Watch Video"]})};return p?r.jsx(Or,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-32"}),r.jsx(Pr,{className:"h-64 w-full"}),r.jsx(Pr,{className:"h-32 w-full"})]})}):h?r.jsx(Or,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/newsletters"),className:"mb-4",children:[r.jsx(Qa,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),h.preview_image_url&&r.jsx("img",{src:h.preview_image_url,alt:h.title,className:"w-full h-64 md:h-80 object-cover rounded-lg"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:h.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:xn(new Date(h.publish_date),"MMMM d, yyyy")})]}),h.description&&r.jsx("div",{className:"text-lg text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&_p]:mb-4 [&_p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:h.description}}),r.jsx(njt,{rows:h.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(p3,{resourceType:"newsletter",resourceId:h.id,resourceTitle:h.title}),r.jsxs(ee,{variant:A?"default":"outline",size:"sm",onClick:()=>E.mutate(),children:[r.jsx(oa,{className:`h-4 w-4 mr-1 ${A?"fill-current":""}`}),(N==null?void 0:N.length)||0," ",(N==null?void 0:N.length)===1?"Like":"Likes"]})]}),j&&j.length>0&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(Xe,{className:"space-y-2",children:j.map(F=>r.jsxs("a",{href:F.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(hd,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:F.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},F.id))})]}),x&&x.length>0&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(Xe,{className:"space-y-2",children:x.map(F=>r.jsxs("a",{href:F.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Fs,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:F.title})]},F.id))})]}),y&&y.length>0&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(Xe,{className:"space-y-2",children:y.map(F=>r.jsxs("a",{href:F.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(wi,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:F.name}),r.jsx(Va,{className:"h-4 w-4 text-muted-foreground"})]},F.id))})]}),b&&b.length>0&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Videos"})}),r.jsx(Xe,{className:"space-y-6",children:b.map(F=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:F.title}),z(F.video_url)]},F.id))})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"text-lg",children:["Comments (",(C==null?void 0:C.length)||0,")"]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ps,{placeholder:"Write a comment...",value:l,onChange:F=>a(F.target.value),className:"flex-1"}),r.jsx(ee,{onClick:()=>l.trim()&&T.mutate(l),disabled:!l.trim()||T.isPending,children:r.jsx(Lo,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:C==null?void 0:C.map(F=>{var q,H,K;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{children:((H=(q=F.profiles)==null?void 0:q.name)==null?void 0:H[0])||"U"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-sm",children:((K=F.profiles)==null?void 0:K.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(F.created_at),"MMM d, yyyy")}),F.user_id===(n==null?void 0:n.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>L.mutate(F.id),children:r.jsx(Zn,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.content})]})]},F.id)})})]})]})]})}):r.jsx(Or,{title:"Not Found",description:"",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Newsletter not found"}),r.jsx(ee,{variant:"link",onClick:()=>t("/newsletters"),children:"Back to Newsletters"})]})})}function ijt({rows:e,onChange:t}){const[n,s]=I.useState(null),i=()=>{t([...e,{columns:[{title:"",description:""},{title:"",description:""},{title:"",description:""}]}])},o=p=>{t(e.filter((x,y)=>y!==p))},l=(p,x,y,b)=>{const j=[...e];j[p]={...j[p],columns:j[p].columns.map((N,C)=>C===x?{...N,[y]:b}:N)},t(j)},a=async(p,x,y)=>{var N;const b=(N=y.target.files)==null?void 0:N[0];if(!b)return;const j=`${p}-${x}`;s(j);try{const C=`content-blocks/${Date.now()}-${b.name}`,{error:A}=await J.storage.from("newsletter-content").upload(C,b);if(!A){const{data:E}=J.storage.from("newsletter-content").getPublicUrl(C);l(p,x,"image_url",E.publicUrl)}}finally{s(null)}},h=(p,x)=>{l(p,x,"image_url","")};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-base font-medium",children:"Content Blocks (3-Column Rows)"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:i,children:[r.jsx(jn,{className:"mr-1 h-3 w-3"})," Add Row"]})]}),e.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"No content block rows yet. Add a row to create a 3-column layout."}),e.map((p,x)=>r.jsxs(Ge,{className:"relative",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"absolute top-2 right-2 h-6 w-6 text-muted-foreground hover:text-destructive",onClick:()=>o(x),children:r.jsx(bs,{className:"h-4 w-4"})}),r.jsxs(Xe,{className:"p-4 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(p1,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Row ",x+1]})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3",children:p.columns.map((y,b)=>{const j=`${x}-${b}`;return r.jsxs("div",{className:"space-y-2 border border-border/50 rounded-md p-3 bg-muted/20",children:[r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:["Column ",b+1]}),y.image_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:y.image_url,alt:"",className:"w-full h-20 object-cover rounded"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(x,b),children:r.jsx(bs,{className:"h-3 w-3"})})]}):r.jsxs("div",{children:[r.jsx(at,{type:"file",accept:"image/*",className:"hidden",id:`block-img-${j}`,onChange:N=>a(x,b,N)}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"w-full text-xs h-8",disabled:n===j,asChild:!0,children:r.jsx("label",{htmlFor:`block-img-${j}`,className:"cursor-pointer",children:n===j?"Uploading...":r.jsxs(r.Fragment,{children:[r.jsx(Do,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),r.jsx(at,{placeholder:"Title",value:y.title,onChange:N=>l(x,b,"title",N.target.value),className:"h-8 text-sm"}),r.jsx(ps,{placeholder:"Description",value:y.description,onChange:N=>l(x,b,"description",N.target.value),className:"text-sm min-h-[60px] resize-none"})]},b)})})]})]},x))]})}function ajt(){const{toast:e}=pa(),t=Wr(),[n,s]=I.useState(!1),[i,o]=I.useState(null),[l,a]=I.useState({title:"",description:"",publish_date:xn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[h,p]=I.useState(null),[x,y]=I.useState(null),[b,j]=I.useState([]),[N,C]=I.useState([]),[A,E]=I.useState([]),[T,L]=I.useState([]),[z,F]=I.useState([]),[q,H]=I.useState([]),[K,Z]=I.useState(!1),{data:te,isLoading:ae}=Zt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:be,error:Oe}=await J.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(Oe)throw Oe;return be}}),le=cr({mutationFn:async be=>{const{data:Oe,error:Te}=await J.from("newsletter_content").insert({title:be.title,description:be.description||null,preview_image_url:be.preview_image_url,publish_date:be.publish_date,is_published:be.is_published,content_blocks:be.content_blocks}).select().single();if(Te)throw Te;return Oe},onSuccess:async be=>{await ge(be.id),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter created successfully"}),de()},onError:be=>{e({title:"Error creating newsletter",description:be.message,variant:"destructive"})}}),ve=cr({mutationFn:async be=>{const{error:Oe}=await J.from("newsletter_content").update({title:be.title,description:be.description||null,preview_image_url:be.preview_image_url,publish_date:be.publish_date,is_published:be.is_published,content_blocks:be.content_blocks}).eq("id",be.id);if(Oe)throw Oe;return be.id},onSuccess:async be=>{await ge(be),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter updated successfully"}),de()},onError:be=>{e({title:"Error updating newsletter",description:be.message,variant:"destructive"})}}),ne=cr({mutationFn:async be=>{const{error:Oe}=await J.from("newsletter_content").delete().eq("id",be);if(Oe)throw Oe},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter deleted successfully"})},onError:be=>{e({title:"Error deleting newsletter",description:be.message,variant:"destructive"})}}),ge=async be=>{await J.from("newsletter_drive_links").delete().eq("newsletter_id",be),await J.from("newsletter_pdfs").delete().eq("newsletter_id",be),await J.from("newsletter_videos").delete().eq("newsletter_id",be),await J.from("newsletter_canva_links").delete().eq("newsletter_id",be);for(const Oe of q){const Te=`${be}/${Date.now()}-${Oe.file.name}`,{error:Ve}=await J.storage.from("newsletter-content").upload(Te,Oe.file);if(!Ve){const{data:Fe}=J.storage.from("newsletter-content").getPublicUrl(Te);N.push({name:Oe.name,file_url:Fe.publicUrl,file_size:Oe.file.size,sort_order:N.length})}}b.length>0&&await J.from("newsletter_drive_links").insert(b.map((Oe,Te)=>({newsletter_id:be,title:Oe.title,drive_url:Oe.drive_url,sort_order:Te}))),N.length>0&&await J.from("newsletter_pdfs").insert(N.map((Oe,Te)=>({newsletter_id:be,name:Oe.name,file_url:Oe.file_url,file_size:Oe.file_size||null,sort_order:Te}))),A.length>0&&await J.from("newsletter_videos").insert(A.map((Oe,Te)=>({newsletter_id:be,title:Oe.title,video_url:Oe.video_url,sort_order:Te}))),T.length>0&&await J.from("newsletter_canva_links").insert(T.map((Oe,Te)=>({newsletter_id:be,title:Oe.title,canva_share_link:Oe.canva_share_link,sort_order:Te})))},ie=async be=>{o(be),a({title:be.title,description:be.description||"",publish_date:xn(new Date(be.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:be.is_published}),y(be.preview_image_url),F(be.content_blocks||[]);const[Oe,Te,Ve,Fe]=await Promise.all([J.from("newsletter_drive_links").select("*").eq("newsletter_id",be.id).order("sort_order"),J.from("newsletter_pdfs").select("*").eq("newsletter_id",be.id).order("sort_order"),J.from("newsletter_videos").select("*").eq("newsletter_id",be.id).order("sort_order"),J.from("newsletter_canva_links").select("*").eq("newsletter_id",be.id).order("sort_order")]);j(Oe.data||[]),C(Te.data||[]),E(Ve.data||[]),L(Fe.data||[]),H([]),s(!0)},fe=async be=>{const[Oe,Te,Ve,Fe]=await Promise.all([J.from("newsletter_drive_links").select("*").eq("newsletter_id",be.id).order("sort_order"),J.from("newsletter_pdfs").select("*").eq("newsletter_id",be.id).order("sort_order"),J.from("newsletter_videos").select("*").eq("newsletter_id",be.id).order("sort_order"),J.from("newsletter_canva_links").select("*").eq("newsletter_id",be.id).order("sort_order")]);o(null),a({title:`${be.title} (Copy)`,description:be.description||"",publish_date:xn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(be.preview_image_url),F(be.content_blocks||[]),j((Oe.data||[]).map(({id:Me,...Qe})=>Qe)),C((Te.data||[]).map(({id:Me,...Qe})=>Qe)),E((Ve.data||[]).map(({id:Me,...Qe})=>Qe)),L((Fe.data||[]).map(({id:Me,...Qe})=>Qe)),H([]),s(!0)},de=()=>{s(!1),o(null),a({title:"",description:"",publish_date:xn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),p(null),y(null),j([]),C([]),E([]),L([]),F([]),H([])},ye=async be=>{var Te;const Oe=(Te=be.target.files)==null?void 0:Te[0];Oe&&(p(Oe),y(URL.createObjectURL(Oe)))},Ie=async()=>{if(!l.title){e({title:"Title is required",variant:"destructive"});return}Z(!0);let be=x;if(h){const Oe=`previews/${Date.now()}-${h.name}`,{error:Te}=await J.storage.from("newsletter-content").upload(Oe,h);if(!Te){const{data:Ve}=J.storage.from("newsletter-content").getPublicUrl(Oe);be=Ve.publicUrl}}i?ve.mutate({id:i.id,...l,preview_image_url:be,content_blocks:z}):le.mutate({...l,preview_image_url:be,content_blocks:z}),Z(!1)},Ne=()=>j([...b,{title:"",drive_url:"",sort_order:b.length}]),we=()=>E([...A,{title:"",video_url:"",sort_order:A.length}]),he=()=>L([...T,{title:"",canva_share_link:"",sort_order:T.length}]),xe=be=>{const Oe=be.target.files;if(!Oe)return;const Te=Array.from(Oe).map(Ve=>({file:Ve,name:Ve.name.replace(/\.[^/.]+$/,"")}));H([...q,...Te])};return r.jsx(Or,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources"}),r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(te==null?void 0:te.length)||0})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:(te==null?void 0:te.filter(be=>be.is_published).length)||0})})]})]}),r.jsxs(Br,{open:n,onOpenChange:be=>!be&&de(),children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Fr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:i?"Edit Newsletter":"Add Newsletter"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Title *"}),r.jsx(at,{value:l.title,onChange:be=>a({...l,title:be.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Publish Date"}),r.jsx(at,{type:"datetime-local",value:l.publish_date,onChange:be=>a({...l,publish_date:be.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:l.description,onChange:be=>a({...l,description:be}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[x&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:x,alt:"Preview",className:"h-20 w-32 object-cover rounded-md"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute -top-2 -right-2 h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{p(null),y(null)},children:r.jsx(bs,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx(at,{type:"file",accept:"image/*",onChange:ye,className:"hidden",id:"preview-upload"}),r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(no,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{checked:l.is_published,onCheckedChange:be=>a({...l,is_published:be})}),r.jsx(Ue,{children:"Published"})]}),r.jsx(ijt,{rows:z,onChange:F}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:he,children:[r.jsx(jn,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),T.map((be,Oe)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(at,{placeholder:"Link title",value:be.title,onChange:Te=>{const Ve=[...T];Ve[Oe].title=Te.target.value,L(Ve)},className:"w-1/3"}),r.jsx(at,{placeholder:"Canva share link",value:be.canva_share_link,onChange:Te=>{const Ve=[...T];Ve[Oe].canva_share_link=Te.target.value,L(Ve)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>L(T.filter((Te,Ve)=>Ve!==Oe)),children:r.jsx(bs,{className:"h-4 w-4"})})]},Oe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Ne,children:[r.jsx(jn,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),b.map((be,Oe)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(at,{placeholder:"Link title",value:be.title,onChange:Te=>{const Ve=[...b];Ve[Oe].title=Te.target.value,j(Ve)},className:"w-1/3"}),r.jsx(at,{placeholder:"Google Drive URL",value:be.drive_url,onChange:Te=>{const Ve=[...b];Ve[Oe].drive_url=Te.target.value,j(Ve)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>j(b.filter((Te,Ve)=>Ve!==Oe)),children:r.jsx(bs,{className:"h-4 w-4"})})]},Oe))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(at,{type:"file",accept:".pdf",multiple:!0,onChange:xe,className:"hidden",id:"pdf-upload"}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(no,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),N.map((be,Oe)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:be.name}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>C(N.filter((Te,Ve)=>Ve!==Oe)),children:r.jsx(bs,{className:"h-4 w-4"})})]},`existing-${Oe}`)),q.map((be,Oe)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(at,{value:be.name,onChange:Te=>{const Ve=[...q];Ve[Oe].name=Te.target.value,H(Ve)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>H(q.filter((Te,Ve)=>Ve!==Oe)),children:r.jsx(bs,{className:"h-4 w-4"})})]},`pending-${Oe}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:we,children:[r.jsx(jn,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),A.map((be,Oe)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(at,{placeholder:"Video title",value:be.title,onChange:Te=>{const Ve=[...A];Ve[Oe].title=Te.target.value,E(Ve)},className:"w-1/3"}),r.jsx(at,{placeholder:"Video URL",value:be.video_url,onChange:Te=>{const Ve=[...A];Ve[Oe].video_url=Te.target.value,E(Ve)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>E(A.filter((Te,Ve)=>Ve!==Oe)),children:r.jsx(bs,{className:"h-4 w-4"})})]},Oe))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(ee,{variant:"outline",onClick:de,children:"Cancel"}),r.jsx(ee,{onClick:Ie,disabled:K||le.isPending||ve.isPending,children:K?"Uploading...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:ae?r.jsx(Ir,{children:r.jsx(_t,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(te==null?void 0:te.length)===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):te==null?void 0:te.map(be=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[be.preview_image_url?r.jsx("img",{src:be.preview_image_url,alt:be.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(wi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:be.title}),be.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:be.description.replace(/<[^>]*>/g,"")})]})]})}),r.jsx(_t,{children:xn(new Date(be.publish_date),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${be.is_published?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"}`,children:be.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>ie(be),title:"Edit",children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>fe(be),title:"Duplicate",children:r.jsx(pl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",title:"Delete",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&ne.mutate(be.id)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},be.id))})]})})})]})})}const h4e={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function ojt(){const{user:e}=zr(),{toast:t}=pa(),n=ns(),s=Wr(),[i,o]=I.useState(""),[l,a]=I.useState("popular"),[h,p]=I.useState(!1),[x,y]=I.useState(""),[b,j]=I.useState(""),[N,C]=I.useState(!1),{data:A=[],isLoading:E}=Zt({queryKey:["wishlist-items",l,N],queryFn:async()=>{let q=J.from("wishlist_items").select("*");N&&e&&(q=q.eq("user_id",e.id)),l==="latest"?q=q.order("created_at",{ascending:!1}):l==="popular"?q=q.order("vote_count",{ascending:!1}):l==="trending"&&(q=q.order("vote_count",{ascending:!1}));const{data:H,error:K}=await q;if(K)throw K;const Z=[...new Set((H==null?void 0:H.map(ie=>ie.user_id))||[])],{data:te}=await J.from("profiles").select("id, name").in("id",Z),ae=new Map((te==null?void 0:te.map(ie=>[ie.id,ie]))||[]);let le=[];if(e){const{data:ie}=await J.from("wishlist_votes").select("item_id").eq("user_id",e.id);le=(ie==null?void 0:ie.map(fe=>fe.item_id))||[]}const ve=(H==null?void 0:H.map(ie=>ie.id))||[],{data:ne}=await J.from("wishlist_comments").select("item_id").in("item_id",ve),ge=new Map;return ne==null||ne.forEach(ie=>{ge.set(ie.item_id,(ge.get(ie.item_id)||0)+1)}),H==null?void 0:H.map(ie=>{const fe=ae.get(ie.user_id),de=(fe==null?void 0:fe.name)||"Unknown";return{...ie,user_name:de,user_initials:de.split(" ").map(ye=>ye[0]).join("").toUpperCase().slice(0,2),has_voted:le.includes(ie.id),comment_count:ge.get(ie.id)||0}})}}),T=cr({mutationFn:async({title:q,description:H})=>{const{error:K}=await J.from("wishlist_items").insert({user_id:e.id,title:q,description:H});if(K)throw K},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),p(!1),y(""),j(""),t({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:q=>{t({title:"Error",description:q.message,variant:"destructive"})}}),L=cr({mutationFn:async({itemId:q,hasVoted:H})=>{if(H){const{error:K}=await J.from("wishlist_votes").delete().eq("item_id",q).eq("user_id",e.id);if(K)throw K;return{itemId:q,wasAdded:!1}}else{const{error:K}=await J.from("wishlist_votes").insert({item_id:q,user_id:e.id});if(K)throw K;return{itemId:q,wasAdded:!0}}},onSuccess:async q=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),q!=null&&q.wasAdded){const H=A.find(Z=>Z.id===q.itemId),K=((H==null?void 0:H.vote_count)||0)+1;J.functions.invoke("wishlist-notify",{body:{itemId:q.itemId,voteCount:K}}).catch(console.error)}},onError:q=>{t({title:"Error",description:q.message,variant:"destructive"})}}),z=A.filter(q=>q.title.toLowerCase().includes(i.toLowerCase())||q.description.toLowerCase().includes(i.toLowerCase())),F=()=>{if(!x.trim()||!b.trim()){t({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}T.mutate({title:x.trim(),description:b.trim()})};return r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(g1,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold",children:"Wishlist"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Share ideas and vote on what we build next"})]})]}),r.jsxs(Br,{open:h,onOpenChange:p,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Submit a New Idea"})}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title"}),r.jsx(at,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:q=>y(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:b,onChange:q=>j(q.target.value),rows:4})]}),r.jsx(ee,{onClick:F,className:"w-full",disabled:T.isPending,children:T.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Idea"})]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search ideas...",value:i,onChange:q=>o(q.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(ba,{value:l,onValueChange:q=>a(q),children:r.jsxs(fa,{children:[r.jsx(ln,{value:"popular",children:"Most Popular"}),r.jsx(ln,{value:"latest",children:"Latest"}),r.jsx(ln,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(ee,{variant:N?"default":"outline",size:"sm",onClick:()=>C(!N),children:N?"Show All Ideas":"My Ideas"})}),E?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):z.length===0?r.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[r.jsx(g1,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),r.jsxs(ee,{onClick:()=>p(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:z.map(q=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${q.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:H=>{H.stopPropagation(),L.mutate({itemId:q.id,hasVoted:q.has_voted||!1})},className:$t("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",q.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(vg,{className:$t("h-4 w-4",q.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:q.vote_count})]}),r.jsx(ci,{className:"h-10 w-10 bg-primary/20",children:r.jsx(di,{className:"bg-primary/20 text-primary text-sm font-medium",children:q.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:q.title}),r.jsx(Rt,{className:$t("text-xs",h4e[q.status].color),children:h4e[q.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:q.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(q.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Po,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:q.comment_count})]})]})},q.id))})]})})}const f4e={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}};function ljt(){const{itemId:e}=Wc(),t=ns(),{user:n}=zr(),{toast:s}=pa(),i=Wr(),[o,l]=I.useState(""),{data:a=!1}=Zt({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:A,error:E}=await J.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!E&&!!A},enabled:!!n}),{data:h,isLoading:p}=Zt({queryKey:["wishlist-item",e],queryFn:async()=>{const{data:A,error:E}=await J.from("wishlist_items").select("*").eq("id",e).single();if(E)throw E;const{data:T}=await J.from("profiles").select("name").eq("id",A.user_id).single();let L=!1;if(n){const{data:z}=await J.from("wishlist_votes").select("id").eq("item_id",e).eq("user_id",n.id).maybeSingle();L=!!z}return{...A,user_name:(T==null?void 0:T.name)||"Unknown",user_initials:((T==null?void 0:T.name)||"U").split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),has_voted:L}}}),{data:x=[],isLoading:y}=Zt({queryKey:["wishlist-comments",e],queryFn:async()=>{const{data:A,error:E}=await J.from("wishlist_comments").select("*").eq("item_id",e).order("created_at",{ascending:!0});if(E)throw E;const T=[...new Set((A==null?void 0:A.map(F=>F.user_id))||[])],{data:L}=await J.from("profiles").select("id, name").in("id",T),z=new Map((L==null?void 0:L.map(F=>[F.id,F]))||[]);return A==null?void 0:A.map(F=>{const q=z.get(F.user_id),H=(q==null?void 0:q.name)||"Unknown";return{...F,user_name:H,user_initials:H.split(" ").map(K=>K[0]).join("").toUpperCase().slice(0,2)}})}}),b=cr({mutationFn:async A=>{if(A){const{error:E}=await J.from("wishlist_votes").delete().eq("item_id",e).eq("user_id",n.id);if(E)throw E;return{wasAdded:!1}}else{const{error:E}=await J.from("wishlist_votes").insert({item_id:e,user_id:n.id});if(E)throw E;return{wasAdded:!0}}},onSuccess:async A=>{if(i.invalidateQueries({queryKey:["wishlist-item",e]}),i.invalidateQueries({queryKey:["wishlist-items"]}),A!=null&&A.wasAdded&&h){const E=(h.vote_count||0)+1;J.functions.invoke("wishlist-notify",{body:{itemId:e,voteCount:E}}).catch(console.error)}},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),j=cr({mutationFn:async A=>{const{error:E}=await J.from("wishlist_comments").insert({item_id:e,user_id:n.id,content:A});if(E)throw E},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",e]}),l(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),N=cr({mutationFn:async A=>{const{error:E}=await J.from("wishlist_comments").delete().eq("id",A);if(E)throw E},onSuccess:()=>{i.invalidateQueries({queryKey:["wishlist-comments",e]}),s({title:"Comment deleted"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),C=()=>{o.trim()&&j.mutate(o.trim())};return p?r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Pr,{className:"h-8 w-32 mb-6"}),r.jsx(Pr,{className:"h-48 w-full mb-6"}),r.jsx(Pr,{className:"h-32 w-full"})]})}):h?r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/wishlist"),className:"mb-4",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Wishlist"]}),r.jsx("div",{className:"bg-card border rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:()=>b.mutate(h.has_voted),className:$t("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",h.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(vg,{className:$t("h-5 w-5",h.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:h.vote_count}),r.jsx("span",{className:"text-xs",children:"votes"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:h.title}),r.jsx(Rt,{className:$t("text-xs",f4e[h.status].color),children:f4e[h.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:h.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(ci,{className:"h-6 w-6",children:r.jsx(di,{className:"bg-primary/20 text-primary text-xs",children:h.user_initials})}),r.jsx("span",{children:h.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(h.created_at).toLocaleDateString()})]})]})]})}),r.jsxs("div",{className:"bg-card border rounded-lg p-6",children:[r.jsxs("h2",{className:"text-lg font-semibold mb-4",children:["Comments (",x.length,")"]}),r.jsxs("div",{className:"flex gap-3 mb-6",children:[r.jsx(Nte,{placeholder:a?"Share your thoughts... Use # to link templates":"Share your thoughts on this idea...",value:o,onChange:l,minHeight:"60px",mentionFormat:"encoded",enableTemplateMentions:a}),r.jsx(ee,{onClick:C,disabled:!o.trim()||j.isPending,size:"icon",className:"h-auto",children:j.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(Lo,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(A=>r.jsx(Pr,{className:"h-20 w-full"},A))}):x.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No comments yet. Be the first to share your thoughts!"}):r.jsx("div",{className:"space-y-4",children:x.map(A=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{className:"bg-primary/20 text-primary text-xs",children:A.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium text-sm",children:A.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(A.created_at).toLocaleDateString()})]}),r.jsx($xe,{content:A.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===A.user_id&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>N.mutate(A.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]},A.id))})]})]})}):r.jsx(Or,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Item not found"}),r.jsx(ee,{variant:"link",onClick:()=>t("/wishlist"),children:"Go back to Wishlist"})]})})}const p4e={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}},m4e=["open","under_review","planned","in_progress","launched","declined"];function cjt(){const{toast:e}=pa(),t=ns(),n=Wr(),[s,i]=I.useState(""),[o,l]=I.useState("all"),[a,h]=I.useState(!1),[p,x]=I.useState(null),{data:y=[],isLoading:b}=Zt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:E,error:T}=await J.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(T)throw T;const L=[...new Set((E==null?void 0:E.map(Z=>Z.user_id))||[])],{data:z}=await J.from("profiles").select("id, name, email").in("id",L),F=new Map((z==null?void 0:z.map(Z=>[Z.id,Z]))||[]),q=(E==null?void 0:E.map(Z=>Z.id))||[],{data:H}=await J.from("wishlist_comments").select("item_id").in("item_id",q),K=new Map;return H==null||H.forEach(Z=>{K.set(Z.item_id,(K.get(Z.item_id)||0)+1)}),E==null?void 0:E.map(Z=>{const te=F.get(Z.user_id);return{...Z,user_name:(te==null?void 0:te.name)||"Unknown",user_email:(te==null?void 0:te.email)||"",comment_count:K.get(Z.id)||0}})}}),j=cr({mutationFn:async({itemId:E,status:T})=>{const{error:L}=await J.from("wishlist_items").update({status:T}).eq("id",E);if(L)throw L},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),e({title:"Status updated!"})},onError:E=>{e({title:"Error",description:E.message,variant:"destructive"})}}),N=cr({mutationFn:async E=>{const{error:T}=await J.from("wishlist_items").delete().eq("id",E);if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),h(!1),x(null),e({title:"Item deleted!"})},onError:E=>{e({title:"Error",description:E.message,variant:"destructive"})}}),C=y.filter(E=>{const T=E.title.toLowerCase().includes(s.toLowerCase())||E.description.toLowerCase().includes(s.toLowerCase())||E.user_name.toLowerCase().includes(s.toLowerCase()),L=o==="all"||E.status===o;return T&&L}),A={total:y.length,open:y.filter(E=>E.status==="open").length,inProgress:y.filter(E=>E.status==="in_progress").length,launched:y.filter(E=>E.status==="launched").length,highVotes:y.filter(E=>E.vote_count>=10).length};return r.jsx(Or,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>t("/admin"),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Wishlist Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Review and manage community ideas"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Ideas"}),r.jsx("p",{className:"text-2xl font-bold",children:A.total})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Open"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:A.open})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-bold text-orange-600",children:A.inProgress})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Launched"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:A.launched})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"10+ Votes"}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:A.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search ideas, users...",value:s,onChange:E=>i(E.target.value),className:"pl-10"})]}),r.jsxs(vn,{value:o,onValueChange:E=>l(E),children:[r.jsx(mn,{className:"w-[180px]",children:r.jsx(_n,{placeholder:"Filter by status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Statuses"}),m4e.map(E=>r.jsx(Ht,{value:E,children:p4e[E].label},E))]})]})]}),b?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(E=>r.jsx(Pr,{className:"h-16 w-full"},E))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-[60px]",children:"Votes"}),r.jsx(It,{children:"Title"}),r.jsx(It,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(It,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Ws,{children:C.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):C.map(E=>r.jsxs(Ir,{className:$t(E.vote_count>=10&&"bg-primary/5"),children:[r.jsx(_t,{children:r.jsx(Rt,{variant:E.vote_count>=10?"default":"secondary",children:E.vote_count})}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:E.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:E.description})]})}),r.jsx(_t,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:E.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:E.user_email})]})}),r.jsx(_t,{className:"hidden sm:table-cell",children:E.comment_count}),r.jsx(_t,{children:r.jsxs(vn,{value:E.status,onValueChange:T=>j.mutate({itemId:E.id,status:T}),children:[r.jsx(mn,{className:"w-[140px] h-8",children:r.jsx(_n,{})}),r.jsx(gn,{children:m4e.map(T=>r.jsx(Ht,{value:T,children:p4e[T].label},T))})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${E.id}`,"_blank"),children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(E.id),h(!0)},children:r.jsx(Zn,{className:"h-4 w-4"})})]})})]},E.id))})]})}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Delete Wishlist Item"})}),r.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to delete this idea? This will also delete all votes and comments."}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:()=>p&&N.mutate(p),disabled:N.isPending,children:N.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function djt(){const{user:e}=zr(),[t,n]=I.useState([]),[s,i]=I.useState(!0),[o,l]=I.useState(!1),[a,h]=I.useState(null),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,N]=I.useState(""),[C,A]=I.useState(""),[E,T]=I.useState(""),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,K]=I.useState(!1),[Z,te]=I.useState(""),[ae,le]=I.useState("once"),[ve,ne]=I.useState([]),[ge,ie]=I.useState([]),[fe,de]=I.useState(!1),[ye,Ie]=I.useState(!1),[Ne,we]=I.useState([]),[he,xe]=I.useState({total:0,dismissed:0});I.useEffect(()=>{be()},[]);const be=async()=>{const{data:ft,error:jt}=await J.from("levelup_briefs").select("*").order("created_at",{ascending:!1});jt?(ze.error("Failed to fetch briefs"),console.error(jt)):n(ft||[]),i(!1)},Oe=()=>{N(""),A(""),T(""),z(""),q(""),K(!1),te(new Date().toISOString().slice(0,16)),le("once"),ne([]),ie([]),h(null)},Te=()=>{Oe(),l(!0)},Ve=async ft=>{h(ft),N(ft.title),A(ft.description||""),T(ft.video_url||""),z(ft.graphic_url||""),q(ft.graphic_link_url||""),K(ft.is_published),te(ft.publish_date.slice(0,16)),le(ft.show_frequency);const{data:jt}=await J.from("levelup_brief_links").select("*").eq("brief_id",ft.id).order("sort_order");ne((jt==null?void 0:jt.map(Et=>({title:Et.title,url:Et.url})))||[]);const{data:Nt}=await J.from("levelup_brief_polls").select("*").eq("brief_id",ft.id).order("sort_order");if(Nt){const Et=[];for(const vt of Nt){const{data:rr}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",vt.id).order("sort_order");Et.push({question:vt.question,poll_type:vt.poll_type,options:(rr==null?void 0:rr.map(Ar=>Ar.option_text))||[]})}ie(Et)}l(!0)},Fe=async ft=>{var Nt;const jt=(Nt=ft.target.files)==null?void 0:Nt[0];if(jt){de(!0);try{const Et=await J.functions.invoke("bunny-upload",{body:{action:"create",title:jt.name.replace(/\.[^/.]+$/,"")}});if(Et.error)throw Et.error;const{videoId:vt,libraryId:rr}=Et.data,Ar=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:vt}});if(Ar.error)throw Ar.error;const{uploadUrl:yn,apiKey:kn}=Ar.data,Jr=new XMLHttpRequest;await new Promise((ks,fr)=>{Jr.upload.addEventListener("progress",xs=>{if(xs.lengthComputable){const ji=Math.round(xs.loaded/xs.total*100);console.log("Upload progress:",ji)}}),Jr.addEventListener("load",()=>{Jr.status>=200&&Jr.status<300?ks():fr(new Error(`Upload failed with status ${Jr.status}`))}),Jr.addEventListener("error",()=>fr(new Error("Upload failed"))),Jr.open("PUT",yn),Jr.setRequestHeader("AccessKey",kn),Jr.send(jt)});const zn=`https://player.mediadelivery.net/embed/${rr}/${vt}`;T(zn),ze.success("Video uploaded successfully! It may take a few minutes to process.")}catch(Et){console.error("Upload error:",Et),ze.error("Failed to upload video")}finally{de(!1)}}},Me=async()=>{if(!j.trim()){ze.error("Title is required");return}try{let ft;if(a){const{error:jt}=await J.from("levelup_briefs").update({title:j,description:C||null,video_url:E||null,graphic_url:L||null,graphic_link_url:F||null,is_published:H,publish_date:Z,show_frequency:ae}).eq("id",a.id);if(jt)throw jt;ft=a.id,await J.from("levelup_brief_links").delete().eq("brief_id",ft);const{data:Nt}=await J.from("levelup_brief_polls").select("id").eq("brief_id",ft);if(Nt)for(const Et of Nt)await J.from("levelup_brief_poll_options").delete().eq("poll_id",Et.id);await J.from("levelup_brief_polls").delete().eq("brief_id",ft)}else{const{data:jt,error:Nt}=await J.from("levelup_briefs").insert({title:j,description:C||null,video_url:E||null,graphic_url:L||null,graphic_link_url:F||null,is_published:H,publish_date:Z,show_frequency:ae,created_by:e==null?void 0:e.id}).select().single();if(Nt)throw Nt;ft=jt.id}if(ve.length>0){const jt=ve.map((Nt,Et)=>({brief_id:ft,title:Nt.title,url:Nt.url,sort_order:Et}));await J.from("levelup_brief_links").insert(jt)}for(let jt=0;jt0){const rr=Nt.options.map((Ar,yn)=>({poll_id:Et.id,option_text:Ar,sort_order:yn}));await J.from("levelup_brief_poll_options").insert(rr)}}ze.success(a?"Brief updated":"Brief created"),l(!1),Oe(),be()}catch(ft){console.error("Error saving brief:",ft),ze.error("Failed to save brief")}},Qe=async ft=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:jt}=await J.from("levelup_briefs").delete().eq("id",ft);if(jt)throw jt;ze.success("Brief deleted"),be()}catch(jt){console.error("Error deleting brief:",jt),ze.error("Failed to delete brief")}},Ee=async ft=>{b(ft);const{count:jt}=await J.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",ft.id),{count:Nt}=await J.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",ft.id).not("dismissed_at","is",null);xe({total:jt||0,dismissed:Nt||0});const{data:Et}=await J.from("levelup_brief_polls").select("*").eq("brief_id",ft.id).order("sort_order");if(Et){const vt=[];for(const rr of Et){const{data:Ar}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",rr.id).order("sort_order"),{data:yn}=await J.from("levelup_brief_poll_responses").select("option_id").eq("poll_id",rr.id),kn={};let Jr=0;Ar&&Ar.forEach(zn=>{const ks=(yn==null?void 0:yn.filter(fr=>fr.option_id===zn.id).length)||0;kn[zn.id]=ks,Jr+=ks}),vt.push({...rr,options:Ar||[],results:kn,totalResponses:rr.poll_type==="single"?new Set(yn==null?void 0:yn.map(zn=>zn.option_id)).size:Jr})}we(vt)}x(!0)},Ye=()=>{ne([...ve,{title:"",url:""}])},me=(ft,jt,Nt)=>{const Et=[...ve];Et[ft][jt]=Nt,ne(Et)},mt=ft=>{ne(ve.filter((jt,Nt)=>Nt!==ft))},et=()=>{ie([...ge,{question:"",poll_type:"single",options:["",""]}])},nt=(ft,jt)=>{const Nt=[...ge];Nt[ft].question=jt,ie(Nt)},Ae=(ft,jt)=>{const Nt=[...ge];Nt[ft].poll_type=jt,ie(Nt)},ht=ft=>{const jt=[...ge];jt[ft].options.push(""),ie(jt)},$e=(ft,jt,Nt)=>{const Et=[...ge];Et[ft].options[jt]=Nt,ie(Et)},Je=(ft,jt)=>{const Nt=[...ge];Nt[ft].options=Nt[ft].options.filter((Et,vt)=>vt!==jt),ie(Nt)},tt=ft=>{ie(ge.filter((jt,Nt)=>Nt!==ft))};return r.jsxs(Or,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(ee,{onClick:Te,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Frequency"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:s?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):t.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):t.map(ft=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:ft.title}),r.jsx(_t,{children:r.jsx(Rt,{variant:ft.is_published?"default":"secondary",children:ft.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"capitalize",children:ft.show_frequency.replace("_"," ")}),r.jsx(_t,{children:xn(new Date(ft.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ee(ft),children:r.jsx(ac,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ve(ft),children:r.jsx(rc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Qe(ft.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},ft.id))})]})})})]}),r.jsx(Br,{open:o,onOpenChange:l,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:a?"Edit Brief":"Create New Brief"})}),r.jsxs(ba,{defaultValue:"content",className:"w-full",children:[r.jsxs(fa,{className:"grid w-full grid-cols-4",children:[r.jsx(ln,{value:"content",children:"Content"}),r.jsx(ln,{value:"media",children:"Media"}),r.jsx(ln,{value:"links",children:"Links"}),r.jsx(ln,{value:"polls",children:"Polls"})]}),r.jsxs(An,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Title *"}),r.jsx(at,{value:j,onChange:ft=>N(ft.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:C,onChange:ft=>A(ft),placeholder:"Brief overview for agents...",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Publish Date"}),r.jsx(at,{type:"datetime-local",value:Z,onChange:ft=>te(ft.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Show Frequency"}),r.jsxs(vn,{value:ae,onValueChange:le,children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"once",children:"Once (until dismissed)"}),r.jsx(Ht,{value:"every_login",children:"Every login"}),r.jsx(Ht,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Rs,{checked:H,onCheckedChange:K}),r.jsx(Ue,{children:"Publish immediately"})]})]}),r.jsxs(An,{value:"media",className:"space-y-6 mt-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Video (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(at,{type:"file",accept:"video/*",onChange:Fe,disabled:fe})}),fe&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Or paste embed URL"}),r.jsx(at,{value:E,onChange:ft=>T(ft.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),E&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:E,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),r.jsxs("div",{className:"border-t pt-4 space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Graphic / Image (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(at,{type:"file",accept:"image/*",onChange:async ft=>{var Nt;const jt=(Nt=ft.target.files)==null?void 0:Nt[0];if(jt){Ie(!0);try{const Et=jt.name.split(".").pop(),vt=`brief-graphics/${Date.now()}.${Et}`,{error:rr}=await J.storage.from("banner-images").upload(vt,jt,{upsert:!0});if(rr)throw rr;const{data:Ar}=J.storage.from("banner-images").getPublicUrl(vt);z(Ar.publicUrl),ze.success("Image uploaded!")}catch(Et){console.error(Et),ze.error("Failed to upload image")}finally{Ie(!1)}}},disabled:ye})}),ye&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Or paste Image URL"}),r.jsx(at,{value:L,onChange:ft=>z(ft.target.value),placeholder:"https://example.com/image.png"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Click-through Link (optional)"}),r.jsx(at,{value:F,onChange:ft=>q(ft.target.value),placeholder:"https://example.com/landing-page"})]}),L&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted border",children:r.jsx("img",{src:L,alt:"Brief graphic preview",className:"w-full object-contain max-h-64"})})]})]}),r.jsxs(An,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ue,{children:"Quick Links"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:Ye,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),ve.map((ft,jt)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(at,{value:ft.title,onChange:Nt=>me(jt,"title",Nt.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(at,{value:ft.url,onChange:Nt=>me(jt,"url",Nt.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>mt(jt),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]},jt)),ve.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(An,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(Ue,{children:"Polls"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:et,children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),ge.map((ft,jt)=>r.jsx(Ge,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(at,{value:ft.question,onChange:Nt=>nt(jt,Nt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(vn,{value:ft.poll_type,onValueChange:Nt=>Ae(jt,Nt),children:[r.jsx(mn,{className:"w-32",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"single",children:"Single"}),r.jsx(Ht,{value:"multi",children:"Multi-select"})]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>tt(jt),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[ft.options.map((Nt,Et)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:Nt,onChange:vt=>$e(jt,Et,vt.target.value),placeholder:`Option ${Et+1}`}),ft.options.length>2&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Je(jt,Et),children:r.jsx(Zn,{className:"h-4 w-4 text-muted-foreground"})})]},Et)),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ht(jt),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},jt)),ge.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:Me,children:a?"Update Brief":"Create Brief"})]})]})}),r.jsx(Br,{open:p,onOpenChange:x,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Results: ",y==null?void 0:y.title]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-2xl font-bold",children:he.total})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(Xe,{children:r.jsx("p",{className:"text-2xl font-bold",children:he.dismissed})})]})]}),Ne.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),Ne.map(ft=>r.jsxs(Ge,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:ft.question}),r.jsx("div",{className:"space-y-2",children:ft.options.map(jt=>{const Nt=ft.results[jt.id]||0,Et=ft.totalResponses>0?Math.round(Nt/ft.totalResponses*100):0;return r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:jt.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[Nt," (",Et,"%)"]})]}),r.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${Et}%`}})})]},jt.id)})})]},ft.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const ujt=()=>{const{user:e}=zr(),{toast:t}=pa(),n=Wr(),[s,i]=I.useState(!1),[o,l]=I.useState(null),[a,h]=I.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,b]=I.useState(""),{data:j=[],isLoading:N}=Zt({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:F,error:q}=await J.from("additional_services").select("*").order("publish_date",{ascending:!1});if(q)throw q;return F}}),C=cr({mutationFn:async F=>{let q=F.existingImageUrl;if(F.image){const K=F.image.name.split(".").pop(),Z=`${Date.now()}-${Math.random().toString(36).substring(7)}.${K}`,{error:te}=await J.storage.from("service-images").upload(Z,F.image);if(te)throw te;const{data:ae}=J.storage.from("service-images").getPublicUrl(Z);q=ae.publicUrl}const H={name:F.item.name,description:F.item.description||null,preview_image_url:q,signup_link_url:F.item.signup_link_url,publish_date:F.item.publish_date?new Date(F.item.publish_date).toISOString():new Date().toISOString(),is_published:F.item.is_published,created_by:e==null?void 0:e.id};if(F.itemId){const{error:K}=await J.from("additional_services").update(H).eq("id",F.itemId);if(K)throw K}else{const{error:K}=await J.from("additional_services").insert(H);if(K)throw K}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:o?"Service updated":"Service created"}),i(!1),E()},onError:F=>{t({title:"Error saving service",description:F.message,variant:"destructive"})}}),A=cr({mutationFn:async F=>{const{error:q}=await J.from("additional_services").delete().eq("id",F);if(q)throw q},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:"Service deleted"})},onError:F=>{t({title:"Error deleting service",description:F.message,variant:"destructive"})}}),E=()=>{h({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),b(""),l(null)},T=F=>{l(F),h({name:F.name,description:F.description||"",signup_link_url:F.signup_link_url,publish_date:F.publish_date?new Date(F.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:F.is_published}),b(F.preview_image_url||""),i(!0)},L=F=>{var H;const q=(H=F.target.files)==null?void 0:H[0];q&&(x(q),b(URL.createObjectURL(q)))},z=F=>{if(F.preventDefault(),!a.name.trim()){t({title:"Name is required",variant:"destructive"});return}if(!a.signup_link_url.trim()){t({title:"Signup link URL is required",variant:"destructive"});return}C.mutate({item:a,image:p,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Or,{title:"Manage Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(Xe,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(F=>F.is_published).length})})]})]}),r.jsxs(Br,{open:s,onOpenChange:F=>{i(F),F||E()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Name *"}),r.jsx(at,{id:"name",value:a.name,onChange:F=>h({...a,name:F.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(gy,{content:a.description,onChange:F=>h({...a,description:F}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(at,{id:"signup_link_url",type:"url",value:a.signup_link_url,onChange:F=>h({...a,signup_link_url:F.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(at,{id:"publish_date",type:"date",value:a.publish_date,onChange:F=>h({...a,publish_date:F.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Rs,{id:"is_published",checked:a.is_published,onCheckedChange:F=>h({...a,is_published:F})}),r.jsx(Ue,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),b("")},children:r.jsx(bs,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Do,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(at,{type:"file",accept:"image/*",onChange:L,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:C.isPending,children:C.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:N?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):j.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No services yet. Click "Add Service" to create your first one.'}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Signup Link"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:j.map(F=>r.jsxs(Ir,{children:[r.jsx(_t,{children:F.preview_image_url?r.jsx("img",{src:F.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Do,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(_t,{className:"font-medium",children:F.name}),r.jsx(_t,{children:r.jsxs("a",{href:F.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Fs,{className:"h-3 w-3"}),"Link"]})}),r.jsx(_t,{children:new Date(F.publish_date).toLocaleDateString()}),r.jsx(_t,{children:r.jsx(Rt,{variant:F.is_published?"default":"secondary",children:F.is_published?"Published":"Draft"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(F),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&A.mutate(F.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},F.id))})]})})})]})})};function hjt(){const{toast:e}=pa(),[t,n]=I.useState([]),[s,i]=I.useState(!0),[o,l]=I.useState(!1),[a,h]=I.useState(!1),[p,x]=I.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});I.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:A,error:E}=await J.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(E)throw E;n(A.coupons||[])}catch(A){console.error("Error fetching coupons:",A),e({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{i(!1)}},b=async()=>{if(!p.name){e({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(p.discountType==="percent"&&!p.percentOff){e({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(p.discountType==="amount"&&!p.amountOff){e({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(p.duration==="repeating"&&!p.durationInMonths){e({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}l(!0);try{const A={action:"create",name:p.name,duration:p.duration,promotion_code:p.promotionCode.trim()||void 0};p.discountType==="percent"?A.percent_off=parseFloat(p.percentOff):(A.amount_off=Math.round(parseFloat(p.amountOff)*100),A.currency="usd"),p.duration==="repeating"&&(A.duration_in_months=parseInt(p.durationInMonths));const{data:E,error:T}=await J.functions.invoke("stripe-manage-coupons",{body:A});if(T)throw T;e({title:"Success",description:"Coupon created successfully"}),h(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(A){console.error("Error creating coupon:",A),e({title:"Error",description:A.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},j=async A=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:E}=await J.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:A}});if(E)throw E;e({title:"Success",description:"Coupon deleted successfully"}),y()}catch(E){console.error("Error deleting coupon:",E),e({title:"Error",description:E.message||"Failed to delete coupon",variant:"destructive"})}},N=A=>A.percent_off?`${A.percent_off}% off`:A.amount_off?`$${(A.amount_off/100).toFixed(2)} off`:"N/A",C=A=>{switch(A.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${A.duration_in_months} months`;default:return A.duration}};return r.jsx(Or,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Br,{open:a,onOpenChange:h,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(jn,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New Coupon"}),r.jsx(es,{children:"Create a discount coupon that can be applied to subscriptions"})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Promotion Code (what users will type)"}),r.jsx(at,{placeholder:"e.g., BROKERAGE50",value:p.promotionCode,onChange:A=>x({...p,promotionCode:A.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Coupon Name (internal label)"}),r.jsx(at,{placeholder:"e.g., 50% Off Brokerage Launch",value:p.name,onChange:A=>x({...p,name:A.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Discount Type"}),r.jsxs(vn,{value:p.discountType,onValueChange:A=>{const E=A==="amount"&&p.duration==="forever"?"once":p.duration;x({...p,discountType:A,duration:E})},children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(fS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx(Ht,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(ud,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),p.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(at,{type:"number",min:"1",max:"100",placeholder:"20",value:p.percentOff,onChange:A=>x({...p,percentOff:A.target.value})}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Amount Off (USD)"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(at,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:p.amountOff,onChange:A=>x({...p,amountOff:A.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Duration"}),r.jsxs(vn,{value:p.duration,onValueChange:A=>x({...p,duration:A}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"once",children:"Once (first payment only)"}),r.jsx(Ht,{value:"repeating",children:"Multiple months"}),r.jsxs(Ht,{value:"forever",disabled:p.discountType==="amount",children:["Forever ",p.discountType==="amount"&&"(% discounts only)"]})]})]}),p.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),p.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Number of Months"}),r.jsx(at,{type:"number",min:"1",placeholder:"3",value:p.durationInMonths,onChange:A=>x({...p,durationInMonths:A.target.value})})]}),r.jsx(ee,{onClick:b,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Active Coupons"}),r.jsx(En,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(Xe,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No coupons created yet. Create your first coupon to get started."}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Promo Code"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Discount"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Redemptions"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:t.map(A=>{var E;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-mono font-medium",children:((E=A.promotion_codes)==null?void 0:E.length)>0?A.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(_t,{children:A.name||"-"}),r.jsx(_t,{children:N(A)}),r.jsx(_t,{children:C(A)}),r.jsx(_t,{children:A.times_redeemed}),r.jsx(_t,{children:r.jsx(Rt,{variant:A.valid?"default":"secondary",children:A.valid?"Active":"Inactive"})}),r.jsx(_t,{className:"text-right",children:r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>j(A.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})})]},A.id)})})]})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"How to Use Coupons"})}),r.jsxs(Xe,{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"1. Create a coupon above with your desired discount."}),r.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),r.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),r.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const Dce={prod_Tc07cYplXUGNkm:{name:"Individual Agent",price:"$39/mo",type:"individual"},prod_Tc08MupgoVySDG:{name:"Brokerage (Under 25)",price:"$299/mo",type:"brokerage"},prod_Tc09N1tJ4RrAFn:{name:"Brokerage (Over 25)",price:"$499/mo",type:"brokerage"}};function fjt(){const[e,t]=I.useState(""),[n,s]=I.useState("all"),[i,o]=I.useState(null),{data:l,isLoading:a,refetch:h}=Zt({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:N,error:C}=await J.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(C)throw C;return N}}),{data:p}=Zt({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:N,error:C}=await J.from("brokerages").select("*").order("name");if(C)throw C;return await Promise.all((N||[]).map(async E=>{const{data:T}=await J.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",E.id),{data:L}=await J.from("user_roles").select("user_id").eq("role","brokerage_manager"),z=(L==null?void 0:L.map(H=>H.user_id))||[],F=(T==null?void 0:T.filter(H=>z.includes(H.id)))||[],q=(T==null?void 0:T.length)||0;return{...E,managers:F,agentCount:q}}))}}),x=N=>{if(N.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(N.brokerage_id&&!N.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(N.is_trial&&N.trial_expires_at)return new Date(N.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(N.subscription_status==="active"||N.subscription_status==="trialing"){const C=Dce[N.subscription_product_id];return{status:(C==null?void 0:C.name)||"Active",badge:N.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return N.subscription_status==="canceled"||N.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},y=l==null?void 0:l.filter(N=>{var A,E;if(!(((A=N.name)==null?void 0:A.toLowerCase().includes(e.toLowerCase()))||((E=N.email)==null?void 0:E.toLowerCase().includes(e.toLowerCase()))))return!1;switch(x(N),n){case"active":return N.subscription_status==="active";case"trialing":return N.subscription_status==="trialing"||N.is_trial&&new Date(N.trial_expires_at)>new Date;case"grandfathered":return N.is_grandfathered;case"brokerage":return N.brokerage_id&&!N.subscription_product_id&&!N.is_grandfathered;case"expired":return N.subscription_status==="canceled"||N.subscription_status==="past_due"||N.is_trial&&new Date(N.trial_expires_at)<=new Date;case"none":return!N.subscription_status||N.subscription_status==="none";default:return!0}}),b={totalUsers:(l==null?void 0:l.length)||0,activeSubscriptions:(l==null?void 0:l.filter(N=>N.subscription_status==="active").length)||0,trials:(l==null?void 0:l.filter(N=>N.subscription_status==="trialing"||N.is_trial&&new Date(N.trial_expires_at)>new Date).length)||0,grandfathered:(l==null?void 0:l.filter(N=>N.is_grandfathered).length)||0,brokerageMembers:(l==null?void 0:l.filter(N=>N.brokerage_id&&!N.subscription_product_id&&!N.is_grandfathered).length)||0,individualSubscribers:(l==null?void 0:l.filter(N=>N.subscription_status==="active"&&N.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(l==null?void 0:l.filter(N=>N.subscription_status==="active"&&(N.subscription_product_id==="prod_Tc08MupgoVySDG"||N.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},j=N=>{window.open(`https://dashboard.stripe.com/customers/${N}`,"_blank")};return r.jsx(Or,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(ee,{onClick:()=>h(),variant:"outline",size:"sm",children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Refresh"]})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Users"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:b.totalUsers})]})}),r.jsx(Ge,{className:"border-green-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fm,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Paid"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-green-600",children:b.activeSubscriptions})]})}),r.jsx(Ge,{className:"border-blue-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Trials"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:b.trials})]})}),r.jsx(Ge,{className:"border-purple-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(l1,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Grandfathered"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-purple-600",children:b.grandfathered})]})}),r.jsx(Ge,{className:"border-orange-500/50",children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Members"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-orange-600",children:b.brokerageMembers})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Individual"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:b.individualSubscribers})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:b.brokerageSubscribers})]})})]}),r.jsxs(ba,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"users",children:"All Users"}),r.jsx(ln,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(An,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name or email...",value:e,onChange:N=>t(N.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:n,onValueChange:N=>s(N),children:[r.jsx(mn,{className:"w-[200px]",children:r.jsx(_n,{placeholder:"Filter by status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Users"}),r.jsx(Ht,{value:"active",children:"Active Subscriptions"}),r.jsx(Ht,{value:"trialing",children:"Trials"}),r.jsx(Ht,{value:"grandfathered",children:"Grandfathered"}),r.jsx(Ht,{value:"brokerage",children:"Brokerage Members"}),r.jsx(Ht,{value:"expired",children:"Expired/Canceled"}),r.jsx(Ht,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Plan"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"End Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:a?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(N=>{var E,T;const C=x(N),A=Dce[N.subscription_product_id];return r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:N.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:N.email})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:C.variant,children:C.badge})}),r.jsx(_t,{children:r.jsx("span",{className:"text-sm",children:N.is_grandfathered?"Legacy Access":N.brokerage_id&&!N.subscription_product_id?"Brokerage Subscription":(A==null?void 0:A.name)||C.status})}),r.jsx(_t,{children:(E=N.brokerages)!=null&&E.name?r.jsx("span",{className:"text-sm",children:N.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(_t,{children:N.subscription_end_date?r.jsx("span",{className:"text-sm",children:xn(new Date(N.subscription_end_date),"MMM d, yyyy")}):N.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",xn(new Date(N.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[N.stripe_customer_id&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>j(N.stripe_customer_id),children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsxs(Br,{children:[r.jsx(zo,{asChild:!0,children:r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o(N),children:"Details"})}),r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Subscription Details"}),r.jsxs(es,{children:[N.name," (",N.email,")"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),r.jsx(Rt,{variant:C.variant,className:"mt-1",children:C.badge})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),r.jsx("p",{className:"font-medium",children:N.is_grandfathered?"Grandfathered (Legacy)":N.brokerage_id&&!N.subscription_product_id?"Brokerage Subscription":(A==null?void 0:A.name)||"None"})]}),N.brokerage_id&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),r.jsx("p",{className:"font-medium",children:((T=N.brokerages)==null?void 0:T.name)||"Unknown"})]}),N.subscription_end_date&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period End"}),r.jsx("p",{className:"font-medium",children:xn(new Date(N.subscription_end_date),"MMMM d, yyyy")})]}),N.trial_expires_at&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Expires"}),r.jsx("p",{className:"font-medium",children:xn(new Date(N.trial_expires_at),"MMMM d, yyyy")})]}),N.stripe_customer_id&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Stripe Customer ID"}),r.jsx("p",{className:"font-mono text-sm",children:N.stripe_customer_id})]})]}),N.stripe_customer_id&&r.jsxs(ee,{className:"w-full",onClick:()=>j(N.stripe_customer_id),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},N.id)})})]})})})]}),r.jsx(An,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:p==null?void 0:p.map(N=>{var A,E;const C=(A=N.managers)==null?void 0:A.some(T=>T.subscription_status==="active"&&(T.subscription_product_id==="prod_Tc08MupgoVySDG"||T.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:r.jsx(na,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:N.name}),r.jsxs(En,{children:[N.agentCount," agents"]})]})]}),r.jsx(Rt,{variant:C?"default":"outline",children:C?"Active Subscription":"No Active Subscription"})]})}),r.jsx(Xe,{children:((E=N.managers)==null?void 0:E.length)>0?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),N.managers.map(T=>{const L=Dce[T.subscription_product_id];return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.email})]}),r.jsx("div",{className:"text-right",children:L?r.jsxs("div",{children:[r.jsx(Rt,{variant:"default",children:L.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:L.price})]}):r.jsx(Rt,{variant:"outline",children:"No Subscription"})})]},T.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},N.id)})})})]})]})})}function pjt(){const[e,t]=I.useState([]),[n,s]=I.useState(!0),[i,o]=I.useState(""),[l,a]=I.useState("all"),[h,p]=I.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:N,error:C}=await J.from("referrals").select(` *, referrer_brokerage:brokerages!referrer_brokerage_id(name), referred_brokerage:brokerages!referred_brokerage_id(name), referred_user:profiles!referred_user_id(name, email) `).order("created_at",{ascending:!1});if(C)throw C;t(N||[]);const A=(N==null?void 0:N.filter(L=>L.status==="qualified").length)||0,E=(N==null?void 0:N.filter(L=>L.status==="pending").length)||0,T=(N==null?void 0:N.filter(L=>L.status==="cancelled").length)||0;p({total:(N==null?void 0:N.length)||0,qualified:A,pending:E,cancelled:T,totalDiscounts:A*25})}catch(N){console.error("Error fetching referrals:",N),ze.error("Failed to load referrals")}finally{s(!1)}},y=async()=>{try{ze.loading("Processing qualifications...");const{error:N}=await J.functions.invoke("process-referral-qualifications");if(N)throw N;ze.dismiss(),ze.success("Qualifications processed successfully"),x()}catch(N){ze.dismiss(),console.error("Error processing qualifications:",N),ze.error("Failed to process qualifications")}},b=e.filter(N=>{var E,T,L,z,F,q;const C=((T=(E=N.referrer_brokerage)==null?void 0:E.name)==null?void 0:T.toLowerCase().includes(i.toLowerCase()))||((z=(L=N.referred_brokerage)==null?void 0:L.name)==null?void 0:z.toLowerCase().includes(i.toLowerCase()))||((q=(F=N.referred_user)==null?void 0:F.email)==null?void 0:q.toLowerCase().includes(i.toLowerCase())),A=l==="all"||N.status===l;return C&&A}),j=N=>{switch(N){case"qualified":return r.jsxs(Rt,{className:"bg-green-100 text-green-800",children:[r.jsx(qa,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Rt,{variant:"secondary",children:[r.jsx(Ki,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Rt,{variant:"destructive",children:[r.jsx(zc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Rt,{children:N})}};return r.jsx(Or,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(ee,{onClick:y,variant:"outline",children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Process Qualifications"]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qa,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ud,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",h.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"All Referrals"}),r.jsx(En,{children:"View and manage all referral relationships"})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by brokerage or email...",value:i,onChange:N=>o(N.target.value),className:"pl-10"})]}),r.jsxs(vn,{value:l,onValueChange:a,children:[r.jsx(mn,{className:"w-[180px]",children:r.jsx(_n,{placeholder:"Filter by status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Statuses"}),r.jsx(Ht,{value:"pending",children:"Pending"}),r.jsx(Ht,{value:"qualified",children:"Qualified"}),r.jsx(Ht,{value:"cancelled",children:"Cancelled"})]})]})]}),n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Referrer"}),r.jsx(It,{children:"Referred"}),r.jsx(It,{children:"Signup Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Qualified Date"}),r.jsx(It,{children:"Discount"})]})}),r.jsx(Ws,{children:b.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):b.map(N=>{var C,A,E,T;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:((C=N.referrer_brokerage)==null?void 0:C.name)||"Unknown"}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{children:((A=N.referred_brokerage)==null?void 0:A.name)||((E=N.referred_user)==null?void 0:E.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(T=N.referred_user)==null?void 0:T.email})]})}),r.jsx(_t,{children:xn(new Date(N.signup_date),"MMM d, yyyy")}),r.jsx(_t,{children:j(N.status)}),r.jsx(_t,{children:N.qualified_date?xn(new Date(N.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(_t,{children:N.discount_applied?r.jsx(Rt,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},N.id)})})]})]})]})]})})}const Rce=[{value:"add_agent",label:"Add Agent"},{value:"share_resource",label:"Share Resource"},{value:"post_community",label:"Post in Community"},{value:"register_event",label:"Register for Event"},{value:"view_template",label:"View Template"},{value:"watch_academy",label:"Watch Academy Video"},{value:"use_toolbox",label:"Use Toolbox"},{value:"launch_app",label:"Launch App"},{value:"add_contact",label:"Add Contact"},{value:"add_plan",label:"Add Touchpoint Plan"},{value:"create_video",label:"Create Video"},{value:"complete_touch",label:"Complete Touch"},{value:"add_transaction",label:"Add Transaction"},{value:"add_listing",label:"Add Listing"},{value:"schedule_popby",label:"Schedule Pop-by"}],mjt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function gjt(){const[e,t]=I.useState([]),[n,s]=I.useState(!0),[i,o]=I.useState(!1),[l,a]=I.useState(null),[h,p]=I.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:T,error:L}=await J.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(L)throw L;t(T||[])}catch(T){console.error("Error fetching checklist items:",T),ze.error("Failed to load checklist items")}finally{s(!1)}},y=()=>{a(null),p({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},b=T=>{a(T),p({title:T.title,description:T.description||"",action_type:T.action_type,target_role:T.target_role,is_active:T.is_active}),o(!0)},j=async()=>{if(!h.title.trim()){ze.error("Title is required");return}try{if(l){const{error:T}=await J.from("onboarding_checklist_items").update({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active}).eq("id",l.id);if(T)throw T;ze.success("Checklist item updated")}else{const T=e.filter(z=>z.target_role===h.target_role).reduce((z,F)=>Math.max(z,F.sort_order),-1),{error:L}=await J.from("onboarding_checklist_items").insert({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active,sort_order:T+1});if(L)throw L;ze.success("Checklist item created")}o(!1),x()}catch(T){console.error("Error saving checklist item:",T),ze.error("Failed to save checklist item")}},N=async T=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:L}=await J.from("onboarding_checklist_items").delete().eq("id",T);if(L)throw L;ze.success("Checklist item deleted"),x()}catch(L){console.error("Error deleting checklist item:",L),ze.error("Failed to delete checklist item")}},C=async T=>{try{const{error:L}=await J.from("onboarding_checklist_items").update({is_active:!T.is_active}).eq("id",T.id);if(L)throw L;ze.success(T.is_active?"Item deactivated":"Item activated"),x()}catch(L){console.error("Error toggling item:",L),ze.error("Failed to update item")}},A=e.filter(T=>T.target_role==="brokerage_manager"),E=e.filter(T=>T.target_role==="agent");return r.jsxs(Or,{title:"Onboarding Checklist",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Onboarding Checklist"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage checklist items shown to new users on their dashboard"})]}),r.jsxs(ee,{onClick:y,className:"gap-2",children:[r.jsx(jn,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Rt,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(Xe,{children:A.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:A.map((T,L)=>{var z;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"text-muted-foreground",children:L+1}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:((z=Rce.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(_t,{children:r.jsx(Rs,{checked:T.is_active,onCheckedChange:()=>C(T)})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(T),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>N(T.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Rt,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(Xe,{children:E.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:E.map((T,L)=>{var z;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"text-muted-foreground",children:L+1}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:((z=Rce.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(_t,{children:r.jsx(Rs,{checked:T.is_active,onCheckedChange:()=>C(T)})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(T),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>N(T.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:l?"Edit Checklist Item":"Add Checklist Item"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title *"}),r.jsx(at,{id:"title",value:h.title,onChange:T=>p({...h,title:T.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:h.description,onChange:T=>p({...h,description:T.target.value}),placeholder:"Optional description for the checklist item",rows:2})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Target Role"}),r.jsxs(vn,{value:h.target_role,onValueChange:T=>p({...h,target_role:T}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:mjt.map(T=>r.jsx(Ht,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Action Type"}),r.jsxs(vn,{value:h.action_type,onValueChange:T=>p({...h,action_type:T}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:Rce.map(T=>r.jsx(Ht,{value:T.value,children:T.label},T.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"is_active",checked:h.is_active,onCheckedChange:T=>p({...h,is_active:T})}),r.jsx(Ue,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{onClick:j,children:l?"Save Changes":"Create Item"})]})]})})]})}function xjt(){const[e,t]=I.useState(""),[n,s]=I.useState("all"),[i,o]=I.useState("name"),[l,a]=I.useState("asc"),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(""),[N,C]=I.useState(""),{data:A}=Zt({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:Z,error:te}=await J.from("brokerages").select("id, name").order("name");if(te)throw te;return Z}}),E=async Z=>{let ae=[],le=0,ve=!0;for(;ve;){const{data:ne,error:ge}=await Z(le,le+1e3-1);if(ge)throw ge;ne&&ne.length>0?(ae=[...ae,...ne],le+=1e3,ve=ne.length===1e3):ve=!1}return ae},{data:T,isLoading:L}=Zt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const Z=await E((Ne,we)=>J.from("profiles").select("id, name, email, brokerage_id, created_at").range(Ne,we)),{data:te}=await J.from("brokerages").select("id, name"),ae=new Map((te==null?void 0:te.map(Ne=>[Ne.id,Ne.name]))||[]),{data:le}=await J.rpc("get_admin_contact_counts"),ve=new Map;le==null||le.forEach(Ne=>{ve.set(Ne.owner_user_id,Ne.contact_count)});const{data:ne}=await J.rpc("get_admin_video_counts"),ge=new Map;ne==null||ne.forEach(Ne=>{ge.set(Ne.owner_user_id,Ne.video_count)});const{data:ie}=await J.rpc("get_admin_popby_counts"),fe=new Map;ie==null||ie.forEach(Ne=>{fe.set(Ne.owner_user_id,Ne.popby_count)});const{data:de}=await J.rpc("get_admin_listing_counts"),ye=new Map;return de==null||de.forEach(Ne=>{ye.set(Ne.agent_id,Ne.listing_count)}),Z.map(Ne=>({id:Ne.id,name:Ne.name||"Unknown",email:Ne.email||"",brokerage_id:Ne.brokerage_id,brokerage_name:Ne.brokerage_id&&ae.get(Ne.brokerage_id)||null,contact_count:ve.get(Ne.id)||0,video_count:ge.get(Ne.id)||0,popby_count:fe.get(Ne.id)||0,listing_count:ye.get(Ne.id)||0,created_at:Ne.created_at}))}}),z=I.useMemo(()=>{if(!T)return[];let Z=T.filter(te=>{const ae=e.toLowerCase(),le=!e||te.name.toLowerCase().includes(ae)||te.email.toLowerCase().includes(ae),ve=n==="all"||n==="none"&&!te.brokerage_id||te.brokerage_id===n,ne=parseInt(h)||0,ge=parseInt(x)||0,ie=parseInt(b)||0,fe=parseInt(N)||0,de=te.contact_count>=ne&&te.video_count>=ge&&te.popby_count>=ie&&te.listing_count>=fe;return le&&ve&&de});return Z.sort((te,ae)=>{let le=0;return i==="name"?le=te.name.localeCompare(ae.name):le=te[i]-ae[i],l==="asc"?le:-le}),Z},[T,e,n,i,l,h,x,b,N]),F=Z=>{i===Z?a(l==="asc"?"desc":"asc"):(o(Z),a("desc"))},q=()=>{const Z=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings"],te=z.map(ge=>[ge.name,ge.email,ge.brokerage_name||"None",ge.contact_count,ge.video_count,ge.popby_count,ge.listing_count]),ae=[Z.join(","),...te.map(ge=>ge.map(ie=>`"${ie}"`).join(","))].join(` `),le=new Blob([ae],{type:"text/csv"}),ve=URL.createObjectURL(le),ne=document.createElement("a");ne.href=ve,ne.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ne.click(),URL.revokeObjectURL(ve)},H=I.useMemo(()=>z.length?z.reduce((Z,te)=>({contacts:Z.contacts+te.contact_count,videos:Z.videos+te.video_count,popbys:Z.popbys+te.popby_count,listings:Z.listings+te.listing_count}),{contacts:0,videos:0,popbys:0,listings:0}):{contacts:0,videos:0,popbys:0,listings:0},[z]),K=({field:Z,children:te})=>r.jsx(It,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>F(Z),children:r.jsxs("div",{className:"flex items-center gap-1",children:[te,r.jsx($x,{className:`h-3 w-3 ${i===Z?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(En,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:q,children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name or email...",value:e,onChange:Z=>t(Z.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(vn,{value:n,onValueChange:s,children:[r.jsxs(mn,{children:[r.jsx(na,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(_n,{placeholder:"Brokerage"})]}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Brokerages"}),r.jsx(Ht,{value:"none",children:"No Brokerage"}),A==null?void 0:A.map(Z=>r.jsx(Ht,{value:Z.id,children:Z.name},Z.id))]})]})}),r.jsx("div",{children:r.jsx(at,{type:"number",placeholder:"Min contacts",value:h,onChange:Z=>p(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(at,{type:"number",placeholder:"Min videos",value:x,onChange:Z=>y(Z.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(at,{type:"number",placeholder:"Min popbys",value:b,onChange:Z=>j(Z.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-5 text-sm",children:[r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:z.length}),r.jsx("div",{className:"text-muted-foreground",children:"Users"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.contacts.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Contacts"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.videos.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Videos"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.popbys.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Popbys"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.listings.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]})]}),L?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(K,{field:"name",children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Brokerage"}),r.jsx(K,{field:"contact_count",children:"Contacts"}),r.jsx(K,{field:"video_count",children:"Videos"}),r.jsx(K,{field:"popby_count",children:"Popbys"}),r.jsx(K,{field:"listing_count",children:"Listings"})]})}),r.jsx(Ws,{children:z.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):z.map(Z=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:Z.name}),r.jsx(_t,{className:"text-muted-foreground",children:Z.email}),r.jsx(_t,{children:Z.brokerage_name?r.jsx(Rt,{variant:"secondary",children:Z.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.contact_count>0?"default":"outline",children:Z.contact_count})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.video_count>0?"default":"outline",children:Z.video_count})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.popby_count>0?"default":"outline",children:Z.popby_count})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.listing_count>0?"default":"outline",children:Z.listing_count})})]},Z.id))})]})})]})]})}function yjt(){pa(),Wr();const[e,t]=I.useState("user-analytics"),{data:n}=Zt({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:j,error:N}=await J.from("feature_flags").select("*").order("key");if(N)throw N;return j}}),{data:s,isLoading:i}=Zt({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:j,error:N}=await J.from("relationship_types").select("*").order("sort_order");if(N)throw N;return j}}),{data:o,isLoading:l}=Zt({queryKey:["admin-action-types"],queryFn:async()=>{const{data:j,error:N}=await J.from("action_types").select("*").order("sort_order");if(N)throw N;return j}}),{data:a,isLoading:h}=Zt({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:j,error:N}=await J.from("action_scripts").select("*, action_type:action_types(*)");if(N)throw N;return j}}),{data:p,isLoading:x}=Zt({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:j,error:N}=await J.from("touchpoint_plans").select("*").order("name");if(N)throw N;return j}}),{data:y,isLoading:b}=Zt({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:j,error:N}=await J.from("popby_items").select("*").is("owner_user_id",null).order("name");if(N)throw N;return j}});return r.jsx(Or,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(ba,{value:e,onValueChange:t,children:[r.jsxs(fa,{className:"grid w-full grid-cols-9",children:[r.jsxs(ln,{value:"user-analytics",className:"gap-2",children:[r.jsx(ac,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(ln,{value:"relationship-types",className:"gap-2",children:[r.jsx(Vn,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(ln,{value:"action-types",className:"gap-2",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(ln,{value:"scripts",className:"gap-2",children:[r.jsx(wi,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(ln,{value:"video-scripts",className:"gap-2",children:[r.jsx(Ad,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(ln,{value:"plans",className:"gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(ln,{value:"popbys",className:"gap-2",children:[r.jsx(Ha,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(ln,{value:"settings",className:"gap-2",children:[r.jsx(fd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(ln,{value:"feature-flags",className:"gap-2",children:[r.jsx(Ux,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx(An,{value:"user-analytics",className:"mt-6",children:r.jsx(xjt,{})}),r.jsx(An,{value:"relationship-types",className:"mt-6",children:r.jsx(vjt,{types:s||[],isLoading:i})}),r.jsx(An,{value:"action-types",className:"mt-6",children:r.jsx(_jt,{types:o||[],isLoading:l})}),r.jsx(An,{value:"scripts",className:"mt-6",children:r.jsx(bjt,{scripts:a||[],actionTypes:o||[],isLoading:h})}),r.jsx(An,{value:"video-scripts",className:"mt-6",children:r.jsx(Njt,{})}),r.jsx(An,{value:"plans",className:"mt-6",children:r.jsx(wjt,{plans:p||[],actionTypes:o||[],scripts:a||[],isLoading:x})}),r.jsx(An,{value:"popbys",className:"mt-6",children:r.jsx(kjt,{items:y||[],isLoading:b})}),r.jsx(An,{value:"settings",className:"mt-6",children:r.jsx(Sjt,{})}),r.jsx(An,{value:"feature-flags",className:"mt-6",children:r.jsx(jjt,{flags:n||[]})})]})]})})}function vjt({types:e,isLoading:t}){const{toast:n}=pa(),s=Wr(),[i,o]=I.useState(null),[l,a]=I.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await J.from("relationship_types").update({name:x.name,description:x.description,icon:x.icon}).eq("id",x.id);if(y)throw y}else{const{error:y}=await J.from("relationship_types").insert([{name:x.name,description:x.description,icon:x.icon,sort_order:e.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-relationship-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await J.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Relationship Types"}),r.jsx(En,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(ee,{onClick:()=>{o(null),a(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-12"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ws,{children:e.map(x=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsx(p1,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(_t,{className:"font-medium",children:x.name}),r.jsx(_t,{className:"text-muted-foreground",children:x.description}),r.jsx(_t,{children:r.jsx(Rs,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(_t,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),a(!0)},children:r.jsx(ha,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[i?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:i==null?void 0:i.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"icon",children:"Icon"}),r.jsx(at,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function _jt({types:e,isLoading:t}){const{toast:n}=pa(),s=Wr(),[i,o]=I.useState(null),[l,a]=I.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await J.from("action_types").update({name:x.name,description:x.description,icon:x.icon,color:x.color}).eq("id",x.id);if(y)throw y}else{const{error:y}=await J.from("action_types").insert([{name:x.name,description:x.description,icon:x.icon,color:x.color,sort_order:e.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-action-types"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await J.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Action Types"}),r.jsx(En,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(ee,{onClick:()=>{o(null),a(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Color"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ws,{children:e.map(x=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:x.name}),r.jsx(_t,{className:"text-muted-foreground",children:x.description}),r.jsx(_t,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(_t,{children:r.jsx(Rs,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(_t,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),a(!0)},children:r.jsx(ha,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[i?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:i==null?void 0:i.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon"),color:y.get("color")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||""})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"icon",children:"Icon"}),r.jsx(at,{id:"icon",name:"icon",defaultValue:(i==null?void 0:i.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"color",children:"Color"}),r.jsx(at,{id:"color",name:"color",type:"color",defaultValue:(i==null?void 0:i.color)||"#6366f1"})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function bjt({scripts:e,actionTypes:t,isLoading:n}){const{toast:s}=pa(),i=Wr(),[o,l]=I.useState(null),[a,h]=I.useState(!1),p=cr({mutationFn:async y=>{if(y.id){const{error:b}=await J.from("action_scripts").update({title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:y.active}).eq("id",y.id);if(b)throw b}else{const{error:b}=await J.from("action_scripts").insert([{title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:!0}]);if(b)throw b}},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),h(!1),l(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),x=cr({mutationFn:async y=>{const{error:b}=await J.from("action_scripts").delete().eq("id",y);if(b)throw b},onSuccess:()=>{i.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Script Library"}),r.jsx(En,{children:"Create and manage scripts for each action type"})]}),r.jsxs(ee,{onClick:()=>{l(null),h(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Xe,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Tone"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ws,{children:e.map(y=>{var b;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:y.title}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",children:((b=y.action_type)==null?void 0:b.name)||"Unknown"})}),r.jsx(_t,{className:"text-muted-foreground",children:y.tone}),r.jsx(_t,{children:r.jsx(Rt,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(_t,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{l(y),h(!0)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const b=new FormData(y.currentTarget);p.mutate({id:o==null?void 0:o.id,title:b.get("title"),action_type_id:b.get("action_type_id"),tone:b.get("tone"),script_body:b.get("script_body"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"title",children:"Title"}),r.jsx(at,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(vn,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select action type"})}),r.jsx(gn,{children:t.map(y=>r.jsx(Ht,{value:y.id,children:y.name},y.id))})]})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(at,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ps,{id:"script_body",name:"script_body",defaultValue:o==null?void 0:o.script_body,rows:8,required:!0,placeholder:`Use {{FirstName}}, {{LastName}}, and {{AgentName}} as placeholders. Example: Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in...`})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:p.isPending,children:[p.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function wjt({plans:e,actionTypes:t,scripts:n,isLoading:s}){const{toast:i}=pa(),o=Wr(),[l,a]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(null),[b,j]=I.useState(!1),[N,C]=I.useState(null),[A,E]=I.useState(null),{data:T}=Zt({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:Z,error:te}=await J.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(te)throw te;return Z},enabled:!!x}),L=cr({mutationFn:async Z=>{if(Z.id){const{error:te}=await J.from("touchpoint_plans").update({name:Z.name,description:Z.description,active:Z.active}).eq("id",Z.id);if(te)throw te}else{const{error:te}=await J.from("touchpoint_plans").insert([{name:Z.name,description:Z.description,active:!0}]);if(te)throw te}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),p(!1),a(null),i({title:"Saved successfully"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),z=cr({mutationFn:async Z=>{if(Z.id){const{error:te}=await J.from("touchpoint_plan_items").update({action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}).eq("id",Z.id);if(te)throw te}else{const{error:te}=await J.from("touchpoint_plan_items").insert([{plan_id:Z.plan_id,month_number:Z.month_number,action_type_id:Z.action_type_id,default_script_id:Z.default_script_id,notes:Z.notes}]);if(te)throw te}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),i({title:"Item saved"})}}),F=cr({mutationFn:async Z=>{const{error:te}=await J.from("touchpoint_plan_items").delete().eq("id",Z);if(te)throw te},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),q=cr({mutationFn:async Z=>{const{data:te,error:ae}=await J.from("action_scripts").insert([{...Z,active:!0}]).select().single();if(ae)throw ae;return te},onSuccess:async Z=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),N&&await z.mutateAsync({id:N.itemId,plan_id:x,month_number:N.month,action_type_id:N.actionTypeId,default_script_id:Z.id}),j(!1),C(null),i({title:"Script created and assigned"})},onError:Z=>{i({title:"Error",description:Z.message,variant:"destructive"})}}),H=(Z,te,ae)=>{C({month:Z,actionTypeId:te,itemId:ae}),j(!0)},K=Z=>n.find(te=>te.id===Z);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Touchpoint Plans"}),r.jsx(En,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(ee,{onClick:()=>{a(null),p(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(Xe,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(Z=>r.jsxs(Ge,{className:`cursor-pointer transition-colors ${x===Z.id?"border-primary":""}`,onClick:()=>y(Z.id),children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Qt,{className:"text-base",children:Z.name}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:te=>{te.stopPropagation(),a(Z),p(!0)},children:r.jsx(ha,{className:"h-4 w-4"})})]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:Z.description}),r.jsx(Rt,{variant:Z.active?"default":"secondary",className:"mt-2",children:Z.active?"Active":"Inactive"})]})]},Z.id))})})]}),x&&r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Plan Schedule"}),r.jsx(En,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(Xe,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(Z,te)=>te+1).map(Z=>{const te=T==null?void 0:T.find(ve=>ve.month_number===Z),ae=te!=null&&te.default_script_id?K(te.default_script_id):null,le=n.filter(ve=>ve.action_type_id===(te==null?void 0:te.action_type_id)&&ve.active);return r.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"w-20 font-medium text-sm",children:["Month ",Z]}),r.jsxs(vn,{value:(te==null?void 0:te.action_type_id)||"none",onValueChange:ve=>{ve==="none"&&te?F.mutate(te.id):ve!=="none"&&z.mutate({id:te==null?void 0:te.id,plan_id:x,month_number:Z,action_type_id:ve,default_script_id:null})},children:[r.jsx(mn,{className:"w-40",children:r.jsx(_n,{placeholder:"No action"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"No action"}),t.filter(ve=>ve.active).map(ve=>r.jsx(Ht,{value:ve.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[ve.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ve.color}}),ve.name]})},ve.id))]})]}),te&&r.jsxs(r.Fragment,{children:[r.jsxs(vn,{value:te.default_script_id||"none",onValueChange:ve=>{E(null),z.mutate({id:te.id,default_script_id:ve==="none"?null:ve})},children:[r.jsx(mn,{className:"w-56",children:r.jsx(_n,{placeholder:"Select script"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"No default script"}),le.map(ve=>r.jsxs(Ht,{value:ve.id,children:[ve.title," ",ve.tone&&`(${ve.tone})`]},ve.id))]})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>H(Z,te.action_type_id,te.id),children:[r.jsx(jn,{className:"h-3 w-3 mr-1"}),"New Script"]}),ae&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>E((A==null?void 0:A.id)===ae.id?null:ae),children:(A==null?void 0:A.id)===ae.id?"Hide":"Preview"})]})]}),A&&(te==null?void 0:te.default_script_id)===A.id&&r.jsxs("div",{className:"ml-24 p-3 bg-muted rounded-lg text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Rt,{variant:"outline",children:A.title}),A.tone&&r.jsx(Rt,{variant:"secondary",children:A.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:A.script_body})]})]},Z)})})})]}),r.jsx(Br,{open:h,onOpenChange:p,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const te=new FormData(Z.currentTarget);L.mutate({id:l==null?void 0:l.id,name:te.get("name"),description:te.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",name:"name",defaultValue:l==null?void 0:l.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:L.isPending,children:[L.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Br,{open:b,onOpenChange:j,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create New Script"}),r.jsxs(es,{children:["Create a script for Month ",N==null?void 0:N.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:Z=>{Z.preventDefault();const te=new FormData(Z.currentTarget);q.mutate({title:te.get("title"),action_type_id:N.actionTypeId,tone:te.get("tone"),script_body:te.get("script_body")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script_title",children:"Title"}),r.jsx(at,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script_tone",children:"Tone"}),r.jsx(at,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ps,{id:"script_body",name:"script_body",rows:6,required:!0,placeholder:"Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in..."})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:q.isPending,children:[q.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function jjt({flags:e}){const{toast:t}=pa(),n=Wr(),s=async(i,o)=>{const{error:l}=await J.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",i.id);l?t({title:"Error",description:l.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),t({title:"Flag updated"}))};return r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Feature Flags"}),r.jsx(En,{children:"Control which features are enabled for members"})]}),r.jsx(Xe,{children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Flag"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Notes"}),r.jsx(It,{children:"Last Updated"})]})}),r.jsx(Ws,{children:e.map(i=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-mono text-sm",children:i.key}),r.jsx(_t,{children:r.jsx(Rs,{checked:i.enabled,onCheckedChange:o=>s(i,{enabled:o})})}),r.jsx(_t,{children:r.jsx(at,{defaultValue:i.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==i.notes&&s(i,{notes:o.target.value})}})}),r.jsx(_t,{className:"text-muted-foreground text-sm",children:new Date(i.updated_at).toLocaleDateString()})]},i.id))})]})})]})}function kjt({items:e,isLoading:t}){const{toast:n}=pa(),s=Wr(),[i,o]=I.useState(null),[l,a]=I.useState(!1),h=cr({mutationFn:async y=>{if(y.id){const{error:b}=await J.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(b)throw b}else{const{error:b}=await J.from("popby_items").insert([{name:y.name,description:y.description,owner_user_id:null}]);if(b)throw b}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),a(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),p=async y=>{await J.from("popby_items").update({is_active:!y.is_active}).eq("id",y.id),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]})},x=async y=>{await J.from("popby_items").delete().eq("id",y),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),n({title:"Deleted successfully"})};return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Popby Ideas"}),r.jsx(En,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(ee,{onClick:()=>{o(null),a(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(Xe,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ha,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No popby ideas yet. Add your first one!"})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ws,{children:e.map(y=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:y.name}),r.jsx(_t,{className:"text-muted-foreground",children:y.description}),r.jsx(_t,{children:r.jsx(Rs,{checked:y.is_active,onCheckedChange:()=>p(y)})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(y),a(!0)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[i?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const b=new FormData(y.currentTarget);h.mutate({id:i==null?void 0:i.id,name:b.get("name"),description:b.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",name:"name",defaultValue:i==null?void 0:i.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(i==null?void 0:i.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function Njt(){var j;const{toast:e}=pa(),t=Wr(),[n,s]=I.useState(null),[i,o]=I.useState(!1),{data:l,isLoading:a}=Zt({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:N,error:C}=await J.from("video_script_categories").select("*").order("sort_order");if(C)throw C;return N}}),{data:h,isLoading:p}=Zt({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:N,error:C}=await J.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(C)throw C;return N}}),x=cr({mutationFn:async N=>{var C,A;if(N.id){const{error:E}=await J.from("video_scripts").update({title:N.title,script_text:N.script_text,category_id:N.category_id,tags:((C=N.tags)==null?void 0:C.split(",").map(T=>T.trim()).filter(Boolean))||[]}).eq("id",N.id);if(E)throw E}else{const{error:E}=await J.from("video_scripts").insert([{title:N.title,script_text:N.script_text,category_id:N.category_id||null,tags:((A=N.tags)==null?void 0:A.split(",").map(T=>T.trim()).filter(Boolean))||[]}]);if(E)throw E}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),s(null),e({title:"Video script saved!"})},onError:N=>e({title:"Error",description:N.message,variant:"destructive"})}),y=async N=>{await J.from("video_scripts").update({is_active:!N.is_active}).eq("id",N.id),t.invalidateQueries({queryKey:["admin-video-scripts"]})},b=async N=>{confirm("Delete this video script?")&&(await J.from("video_scripts").delete().eq("id",N),t.invalidateQueries({queryKey:["admin-video-scripts"]}),e({title:"Script deleted"}))};return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Video Scripts"}),r.jsx(En,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(ee,{onClick:()=>{s(null),o(!0)},children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(Xe,{children:p?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ws,{children:h==null?void 0:h.map(N=>{var C;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:N.title}),r.jsx(_t,{className:"text-muted-foreground",children:((C=N.category)==null?void 0:C.name)||"Uncategorized"}),r.jsx(_t,{children:r.jsx(Rs,{checked:N.is_active,onCheckedChange:()=>y(N)})}),r.jsxs(_t,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{s(N),o(!0)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(N.id),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]},N.id)})})]})}),r.jsx(Br,{open:i,onOpenChange:o,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:N=>{N.preventDefault();const C=new FormData(N.currentTarget);x.mutate({id:n==null?void 0:n.id,title:C.get("title"),script_text:C.get("script_text"),category_id:C.get("category_id")||null,tags:C.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"title",children:"Title"}),r.jsx(at,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"category_id",children:"Category"}),r.jsxs(vn,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select category"})}),r.jsx(gn,{children:l==null?void 0:l.map(N=>r.jsx(Ht,{value:N.id,children:N.name},N.id))})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script_text",children:"Script Text"}),r.jsx(ps,{id:"script_text",name:"script_text",defaultValue:n==null?void 0:n.script_text,rows:6,required:!0,placeholder:"Enter the teleprompter script..."})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(at,{id:"tags",name:"tags",defaultValue:((j=n==null?void 0:n.tags)==null?void 0:j.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(ri,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function Sjt(){const{toast:e}=pa(),[t,n]=I.useState(""),[s,i]=I.useState(!0),[o,l]=I.useState(!1);I.useEffect(()=>{(async()=>{i(!0);try{const{data:p}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();p!=null&&p.value&&n(p.value)}catch(p){console.error("Error fetching settings:",p)}i(!1)})()},[]);const a=async()=>{l(!0);try{await J.from("settings").upsert({key:"mapbox_public_token",value:t.trim()}),e({title:"Mapbox token saved!"})}catch{e({title:"Error saving token",variant:"destructive"})}l(!1)};return s?r.jsx(Ge,{children:r.jsx(Xe,{className:"flex justify-center py-8",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(ml,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(En,{children:"Configure the map feature for popbys"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(at,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:t,onChange:h=>n(h.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"}),". This token will be used by all agents for the popby map feature."]})]}),r.jsxs(ee,{onClick:a,disabled:o,children:[o&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),t&&r.jsx(Rt,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const Cjt=()=>{const[e,t]=I.useState(""),[n,s]=I.useState("grid"),i=ns(),{data:o=[],isLoading:l}=Zt({queryKey:["additional-services"],queryFn:async()=>{const{data:h,error:p}=await J.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(p)throw p;return h}}),a=o.filter(h=>{var x;return h.name.toLowerCase().includes(e.toLowerCase())||((x=h.description)==null?void 0:x.toLowerCase().includes(e.toLowerCase()))});return r.jsx(Or,{title:"Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Additional Services"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Explore our additional services and offerings"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search services...",value:e,onChange:h=>t(h.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>t(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(Wf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.length," service",a.length!==1?"s":""," found"]}),l&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(4)].map((h,p)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"})]})},p))}),!l&&a.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No services match your search":"No additional services available yet"}),e&&r.jsx(ee,{variant:"outline",onClick:()=>t(""),children:"Clear Search"})]}),!l&&a.length>0&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:a.map(h=>r.jsxs(Ge,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>i(`/additional-services/${h.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:h.preview_image_url?r.jsx("img",{src:h.preview_image_url,alt:h.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Cs,{className:"h-8 w-8"})})}),r.jsxs(Xe,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:h.name}),h.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:Ene(h.description)})]})]},h.id))})]})})},Mjt=()=>{const{serviceId:e}=Wc(),t=ns(),{data:n,isLoading:s}=Zt({queryKey:["additional-service",e],queryFn:async()=>{const{data:i,error:o}=await J.from("additional_services").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;return i},enabled:!!e});return s?r.jsx(Or,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Pr,{className:"h-8 w-48"}),r.jsx(Pr,{className:"h-64 w-full rounded-lg"}),r.jsx(Pr,{className:"h-24 w-full"})]})}):n?r.jsx(Or,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/additional-services"),className:"gap-2",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(Ge,{className:"overflow-hidden",children:r.jsx("div",{className:"relative bg-muted",children:n.preview_image_url?r.jsx("img",{src:n.preview_image_url,alt:n.name,className:"w-full h-auto max-h-[500px] object-contain mx-auto"}):r.jsx("div",{className:"w-full h-64 flex items-center justify-center text-muted-foreground",children:r.jsx(Cs,{className:"h-16 w-16"})})})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:n.name}),r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[r.jsx(zs,{className:"h-4 w-4 mr-1"}),"Published ",xn(new Date(n.publish_date),"MMMM d, yyyy")]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:n.description}}),r.jsx("div",{className:"pt-4 border-t",children:r.jsxs(ee,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Fs,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Or,{title:"Not Found",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center py-12",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Service Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"The service you're looking for doesn't exist or has been removed."}),r.jsxs(ee,{onClick:()=>t("/additional-services"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},HM=[{id:"content-calendar",name:"Social Media Content Calendar Generator",iframe:``},{id:"property-promotion",name:"Property Promotion AI Tool",iframe:''},{id:"bio-boost",name:"Realtor Bio-Boost",iframe:''},{id:"market-report",name:"Market Report & Video Script Generator",iframe:''},{id:"property-description",name:"Property Description Writer",iframe:''},{id:"newsletter-generator",name:"Local Real Estate Newsletter Generator",iframe:''}];function Tjt(){const[e,t]=I.useState(HM[0].id),n=HM.find(s=>s.id===e)||HM[0];return r.jsx(Or,{title:"AI Toolkit",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(eS,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"AI Toolkit"}),r.jsx("p",{className:"text-muted-foreground",children:"Powerful AI tools to boost your real estate business"})]})]}),r.jsx("div",{className:"md:hidden",children:r.jsxs(vn,{value:e,onValueChange:t,children:[r.jsx(mn,{className:"w-full",children:r.jsx(_n,{placeholder:"Select a tool"})}),r.jsx(gn,{children:HM.map(s=>r.jsx(Ht,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(ba,{value:e,onValueChange:t,className:"w-full",children:r.jsx(fa,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:HM.map(s=>r.jsx(ln,{value:s.id,className:"flex-1 min-w-[150px] text-xs lg:text-sm whitespace-normal h-auto py-2",children:s.name},s.id))})})}),r.jsx("div",{className:"flex justify-center",children:r.jsx("div",{className:"w-full max-w-[700px]",dangerouslySetInnerHTML:{__html:n.iframe}})})]})})}const g4e="agent-os-onboarding-completed",BL=[{icon:wg,iconColor:"text-white",bgGradient:"from-primary via-primary/80 to-purple-600",title:"Welcome to Agent OS",description:"You've unlocked a powerful new tool designed to help you build stronger relationships and close more deals. Agent OS is currently in beta, and we're excited for you to try it!",highlights:["Manage your most important relationships","Stay in touch with automated reminders","Track your transactions and goals","Maximize referrals from your sphere"]},{icon:Ng,iconColor:"text-white",bgGradient:"from-pink-500 via-rose-500 to-red-500",title:"InnerCircle Home",description:"Your daily command center. See today's action items, track your momentum streak, and get a snapshot of your relationship health—all at a glance.",highlights:["Today's touchpoints and special dates","Momentum stats and streak tracking","Relationship health overview","Quick access to all features"]},{icon:Vn,iconColor:"text-white",bgGradient:"from-blue-500 via-indigo-500 to-purple-500",title:"Contacts",description:"Import and organize your sphere of influence. Tag contacts by relationship type (Top 25, Past Clients, Referral Partners, etc.) to prioritize your outreach.",highlights:["Import contacts via CSV","Tag by relationship type","Track birthdays and home anniversaries","See relationship health scores"]},{icon:hm,iconColor:"text-white",bgGradient:"from-emerald-500 via-teal-500 to-cyan-500",title:"Touchpoint Plans",description:"Assign automated touchpoint schedules to your contact groups. Each plan tells you exactly who to reach out to and when—with pre-written scripts to make it easy.",highlights:["Pre-built 12-month plans","Create your own custom plans","Scripts for calls, texts, and emails","Automatic daily action items"]},{icon:Ha,iconColor:"text-white",bgGradient:"from-orange-500 via-amber-500 to-yellow-500",title:"Popbys",description:"Pop-by visits are one of the most powerful ways to stay top-of-mind. Track your gift drop-offs and see who's due for a visit on the map.",highlights:["Track pop-by gift ideas","Set visit frequency by contact type","Log completed pop-bys","Map view for route planning"]},{icon:ac,iconColor:"text-white",bgGradient:"from-purple-500 via-violet-500 to-indigo-500",title:"Scorecard",description:"Track your transactions, set goals, and see your progress over time. Know exactly where your business stands and where your deals are coming from.",highlights:["Log buyer and seller transactions","Set and track annual goals","See your top lead sources","Export data for your records"]}],Ajt=()=>{const[e,t]=I.useState(!1),[n,s]=I.useState(0),[i,o]=I.useState(!1);I.useEffect(()=>{if(!localStorage.getItem(g4e)){const N=setTimeout(()=>t(!0),500);return()=>clearTimeout(N)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):h()},a=()=>{h()},h=()=>{localStorage.setItem(g4e,"true"),t(!1)},p=BL[n],x=p.icon,y=n===BL.length-1,b=j=>{j||h(),t(j)};return r.jsx(Br,{open:e,onOpenChange:b,children:r.jsxs(Fr,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[r.jsxs("div",{className:`relative bg-gradient-to-br ${p.bgGradient} p-8 pb-12 transition-all duration-500`,children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[r.jsx("div",{className:"absolute -top-4 -right-4 w-32 h-32 bg-white/10 rounded-full blur-2xl animate-pulse"}),r.jsx("div",{className:"absolute -bottom-8 -left-8 w-40 h-40 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl"})]}),r.jsxs("div",{className:`relative mx-auto flex h-20 w-20 items-center justify-center transition-all duration-300 ${i?"scale-75 opacity-0":"scale-100 opacity-100"}`,children:[r.jsx("div",{className:"absolute inset-0 bg-white/20 rounded-2xl blur-xl"}),r.jsx("div",{className:"relative flex h-20 w-20 items-center justify-center rounded-2xl bg-white/20 backdrop-blur-sm border border-white/30 shadow-2xl",children:r.jsx(x,{className:`h-10 w-10 ${p.iconColor} drop-shadow-lg`})})]}),n===0&&r.jsxs("div",{className:"absolute top-4 right-4 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm border border-white/30 text-white text-xs font-medium flex items-center gap-1.5",children:[r.jsx(Cs,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(Hr,{className:"text-center sm:text-center pb-2",children:[r.jsx(qr,{className:`text-2xl font-bold transition-all duration-300 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.title}),r.jsx(es,{className:`text-base pt-2 transition-all duration-300 delay-75 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.description})]}),p.highlights&&r.jsx("div",{className:`space-y-2.5 py-4 transition-all duration-300 delay-100 ${i?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.highlights.map((j,N)=>r.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+N*50}ms`},children:[r.jsx("div",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gradient-to-br ${p.bgGradient} shadow-sm`,children:r.jsx(Ca,{className:"h-3.5 w-3.5 text-white"})}),r.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:j})]},N))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:BL.map((j,N)=>r.jsx("button",{onClick:()=>{N!==n&&(o(!0),setTimeout(()=>{s(N),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${N===n?"w-8 bg-gradient-to-r "+p.bgGradient:N{const{user:e}=zr();return Zt({queryKey:["contact-snoozes",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return t},enabled:!!e})},Ijt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async({contactId:n,days:s})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const i=Hl(new Date,s);await J.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await J.from("contact_snoozes").insert({contact_id:n,owner_user_id:t.id,snoozed_until:i.toISOString()});if(o)throw o},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),e.invalidateQueries({queryKey:["popby-logs"]}),$i({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{$i({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},Pjt=()=>{const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("contact_snoozes").delete().eq("contact_id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),$i({title:"Snooze cancelled"})},onError:t=>{$i({title:"Error cancelling snooze",description:t.message,variant:"destructive"})}})},Ljt=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function Nye({open:e,onOpenChange:t,contactId:n,contactName:s}){const[i,o]=I.useState(null),l=Ijt(),a=async()=>{i&&(await l.mutateAsync({contactId:n,days:i}),o(null),t(!1))},h=p=>xn(Hl(new Date,p),"MMM d, yyyy");return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(es,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:Ljt.map(p=>r.jsxs("button",{type:"button",onClick:()=>o(p.days),className:$t("w-full flex items-center justify-between p-3 rounded-lg border transition-colors",i===p.days?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50"),children:[r.jsx("span",{className:"font-medium",children:p.label}),r.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(zs,{className:"h-3.5 w-3.5"}),"Until ",h(p.days)]})]},p.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ee,{onClick:a,disabled:!i||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const Ojt={Crown:l1,FileText:wi,Users:Vn,Globe:Vx,Star:vs,Phone:ca,MessageSquare:Po,PenTool:_j,Video:Fi,Gift:Ha};function Djt({actions:e,onMarkComplete:t,onViewScript:n,isLoading:s,buildSmsLink:i,buildEmailLink:o}){const l=ns(),[a,h]=I.useState("name"),[p,x]=I.useState("asc"),[y,b]=I.useState(null),[j,N]=I.useState(""),C=z=>{a===z?x(F=>F==="asc"?"desc":"asc"):(h(z),x("asc"))},A=I.useMemo(()=>[...e].sort((z,F)=>{var H,K;let q=0;switch(a){case"name":{const Z=`${z.contact.first_name} ${z.contact.last_name||""}`.toLowerCase(),te=`${F.contact.first_name} ${F.contact.last_name||""}`.toLowerCase();q=Z.localeCompare(te);break}case"relationship_type":q=(z.relationshipTypeName||"").localeCompare(F.relationshipTypeName||"");break;case"action_type":q=(((H=z.actionType)==null?void 0:H.name)||"").localeCompare(((K=F.actionType)==null?void 0:K.name)||"");break;case"last_touch":q=(z.monthNumber||0)-(F.monthNumber||0);break}return p==="asc"?q:-q}),[e,a,p]),E=z=>Ojt[z||"Phone"]||ca,T=({field:z,children:F})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>C(z),children:[F,a===z?p==="asc"?r.jsx(vg,{className:"ml-2 h-4 w-4"}):r.jsx(i1,{className:"ml-2 h-4 w-4"}):r.jsx($x,{className:"ml-2 h-4 w-4 opacity-50"})]}),L=(z,F,q)=>{b(z),N(`${F} ${q||""}`.trim())};return e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[180px]",children:r.jsx(T,{field:"name",children:"Contact"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(T,{field:"relationship_type",children:"Type"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(T,{field:"action_type",children:"Action"})}),r.jsx(It,{className:"w-[130px]",children:"Phone"}),r.jsx(It,{className:"w-[200px]",children:"Quick Actions"})]})}),r.jsx(Ws,{children:A.map((z,F)=>{var ae,le,ve,ne,ge,ie;const q=z.isSpecialDate,H=z.specialDateType,K=q?H==="birthday"?Kh:fi:E(((ae=z.actionType)==null?void 0:ae.icon)||null),Z=z.contact.phone,te=z.contact.email;return r.jsxs(Ir,{className:$t("hover:bg-muted/50 transition-colors",q&&H==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",q&&H==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(_t,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>l(`/mission-control/contacts/${z.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[z.contact.first_name," ",z.contact.last_name]})})}),r.jsx(_t,{children:z.relationshipTypeName?r.jsx(Rt,{variant:"secondary",className:"text-xs",children:z.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(_t,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:q?r.jsx(Rt,{className:$t("gap-1",H==="birthday"&&"bg-pink-500 hover:bg-pink-600",H==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:H==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(Kh,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(fi,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(K,{className:"h-3 w-3"}),(le=z.actionType)==null?void 0:le.name]})})}),r.jsx(_t,{children:Z?r.jsx("span",{className:"text-sm font-mono",children:z.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[Z&&r.jsx("a",{href:`tel:${z.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(ca,{className:"h-3.5 w-3.5"})}),Z&&r.jsx("a",{href:i(z.contact.phone,(ve=z.script)==null?void 0:ve.script_body,z.contact),className:"p-1.5 rounded bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 transition-colors",title:"Text",children:r.jsx(Po,{className:"h-3.5 w-3.5"})}),te&&r.jsx("a",{href:o(z.contact.email,(ne=z.script)==null?void 0:ne.script_body,(ge=z.script)==null?void 0:ge.email_subject,(ie=z.actionType)==null?void 0:ie.name,z.contact),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Email",children:r.jsx(Ys,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>L(z.contact.id,z.contact.first_name,z.contact.last_name),title:"Snooze",children:r.jsx(Qh,{className:"h-3.5 w-3.5"})}),r.jsxs(ee,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var fe;return t(z.contact.id,z.actionType.id,(fe=z.script)==null?void 0:fe.id)},disabled:s,children:[r.jsx(Ya,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${z.contact.id}-${F}`)})})]})}),r.jsx(Nye,{open:!!y,onOpenChange:z=>!z&&b(null),contactId:y||"",contactName:j})]})}const x4e={Crown:l1,FileText:wi,Users:Vn,Globe:Vx,Star:vs,Phone:ca,MessageSquare:Po,PenTool:_j,Video:Fi,Gift:Ha},Rjt={"Top 25":"bg-primary text-primary-foreground","Past Client":"bg-sky-500 text-white","Referral Partner":"bg-orange-500 text-white",Sphere:"bg-emerald-500 text-white",VIP:"bg-amber-500 text-white"};function Fjt(){const e=ns(),{user:t}=zr(),{data:n}=Ug(),{data:s}=xOe(),{data:i}=op(),{data:o}=jxe(),{data:l}=NOe(),a=Yft(),h=kOe(),p=Kft(90),x=bOe(),[y,b]=I.useState(null),[j,N]=I.useState(null),[C,A]=I.useState(!1),[E,T]=I.useState(""),[L,z]=I.useState(!1),[F,q]=I.useState(""),[H,K]=I.useState(_te()),[Z,te]=I.useState("cards"),ae=()=>{const Me=parseInt(F,10);if(isNaN(Me)||Me<1){$i({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}K(Me),jOe(Me),z(!1),$i({title:"Goal updated",description:`Weekly touch goal set to ${Me}`})},le=()=>{q(H.toString()),z(!0)};I.useEffect(()=>{(async()=>{if(!(t!=null&&t.id))return;const{data:Qe}=await J.from("profiles").select("name").eq("id",t.id).single();Qe!=null&&Qe.name&&T(Qe.name.split(" ")[0])})()},[t==null?void 0:t.id]),I.useEffect(()=>{a.mutate()},[]);const ve=of(new Date),ne=Hl(ve,7),ge=Me=>{if(!Me)return null;const Qe=new Date(Me);return new Date(ve.getFullYear(),Qe.getMonth(),Qe.getDate())},ie=(i==null?void 0:i.filter(Me=>{const Qe=ge(Me.birthday),Ee=ge(Me.home_anniversary);return Qe&&Zl(Qe,ve)||Ee&&Zl(Ee,ve)}))||[],fe=(i==null?void 0:i.filter(Me=>{if(!Me.birthday&&!Me.home_anniversary)return!1;const Qe=Ee=>{if(!Ee)return!1;const Ye=ge(Ee);return Ye?xte(Ye,ve)&&yse(Ye,ne):!1};return Qe(Me.birthday)||Qe(Me.home_anniversary)}).slice(0,5))||[],de=ie.map(Me=>{var me,mt,et;const Qe=ge(Me.birthday),Ee=Qe&&Zl(Qe,ve),Ye=(o==null?void 0:o.find(nt=>nt.name==="Call"))||(o==null?void 0:o[0]);return{contact:Me,actionType:Ye||{id:"special-date",name:Ee?"Birthday Call":"Anniversary Call",icon:Ee?"Cake":"Home",color:Ee?"#EC4899":"#8B5CF6",description:Ee?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Ee?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((et=(mt=(me=Me.tags)==null?void 0:me[0])==null?void 0:mt.relationship_type)==null?void 0:et.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Ee?"birthday":"anniversary"}}),Ie=l!==void 0?l||[]:(i==null?void 0:i.slice(0,5).map((Me,Qe)=>{var Ye,me,mt;const Ee=o==null?void 0:o[Qe%((o==null?void 0:o.length)||1)];return Ee?{contact:Me,actionType:Ee,planName:"Quick Touch",relationshipTypeName:((mt=(me=(Ye=Me.tags)==null?void 0:Ye[0])==null?void 0:me.relationship_type)==null?void 0:mt.name)||"",monthNumber:0}:null}).filter(Boolean))||[],Ne=[...de,...Ie],we=async(Me,Qe,Ee)=>{await x.mutateAsync({contactId:Me,actionTypeId:Qe,scriptUsedId:Ee}),A(!1),N(null)},he=Me=>{Me.script?(N(Me),A(!0)):we(Me.contact.id,Me.actionType.id)},xe=Me=>x4e[Me||"Phone"]||ca,be=Me=>x4e[Me||"Users"]||Vn,Oe=(Me,Qe)=>Me.replace(/\{\{FirstName\}\}/g,Qe.first_name).replace(/\{\{LastName\}\}/g,Qe.last_name||"").replace(/\{\{AgentName\}\}/g,E||"there"),Te=(Me,Qe)=>({Call:`Thinking of you, ${Qe}!`,Text:`Quick hello, ${Qe}`,Email:`Checking in, ${Qe}`,"Handwritten Note":`A note for ${Qe}`,Video:`Video message for ${Qe}`,Gift:`Something special for you, ${Qe}`})[Me]||`Hello ${Qe}!`,Ve=(Me,Qe,Ee)=>{const Ye=`sms:${Me}`;if(Qe&&Ee){const me=Oe(Qe,Ee);return`${Ye}?body=${encodeURIComponent(me)}`}return Ye},Fe=(Me,Qe,Ee,Ye,me)=>{const mt=`mailto:${Me}`,et=[];if(me){const nt=Ee||Te(Ye||"Email",me.first_name);if(et.push(`subject=${encodeURIComponent(nt)}`),Qe){const Ae=Oe(Qe,me);et.push(`body=${encodeURIComponent(Ae)}`)}}return et.length>0?`${mt}?${et.join("&")}`:mt};return r.jsxs(Or,{title:"Mission Control",description:"Your relationship-first contact system",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Mission Control"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Your Sphere"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:n==null?void 0:n.filter(Me=>Me.active).map(Me=>{const Qe=be(Me.icon),Ee=(s==null?void 0:s[Me.id])||0,Ye=y===Me.id,me=Rjt[Me.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{Ye?(b(null),e("/mission-control/contacts")):(b(Me.id),e(`/mission-control/contacts?type=${Me.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Ye?me:"bg-card hover:bg-accent"} `,children:[r.jsx(Qe,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:Me.name}),r.jsxs("div",{className:`text-sm ${Ye?"opacity-90":"text-muted-foreground"}`,children:[Ee," Contacts"]})]})]},Me.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(ee,{onClick:()=>e("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Ad,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(ee,{onClick:()=>e("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Ka,{className:"h-4 w-4 ml-1"})]}),r.jsx(ee,{variant:"outline",onClick:()=>e("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(ee,{variant:"outline",onClick:()=>e("/mission-control/plans"),className:"w-full",children:"Manage Plans"})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Today in Your InnerCircle"}),l!==void 0&&r.jsxs(Rt,{variant:"outline",className:"gap-1",children:[r.jsx(Cs,{className:"h-3 w-3"}),"Plan-based"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-1 border rounded-lg p-0.5",children:[r.jsx(ee,{variant:Z==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>te("cards"),title:"Card view",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:Z==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>te("table"),title:"Table view",children:r.jsx(Wf,{className:"h-4 w-4"})})]})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:Ne.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."}),r.jsx(ee,{variant:"outline",className:"mt-4",onClick:()=>e("/mission-control/plans"),children:"Manage Plans"})]}):Z==="table"?r.jsx(Djt,{actions:Ne,onMarkComplete:we,onViewScript:he,isLoading:x.isPending,buildSmsLink:Ve,buildEmailLink:Fe}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[Ne.map((Me,Qe)=>{var ht,$e,Je,tt,ft,jt,Nt;const Ee=Me.isSpecialDate,Ye=Me.specialDateType,me=Ee?Ye==="birthday"?Kh:fi:xe(((ht=Me.actionType)==null?void 0:ht.icon)||null),mt=Me.contact.phone,et=Me.contact.email,nt=Ee?Ye==="birthday"?"#EC4899":"#8B5CF6":(($e=Me.actionType)==null?void 0:$e.color)||"#3B82F6",Ae=Ee?Ye==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Je=Me.actionType)==null?void 0:Je.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Ee?"ring-2 ring-offset-2":""}`,style:Ee?{"--tw-ring-color":nt}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:nt},children:[r.jsx(me,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:Ae})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>e(`/mission-control/contacts/${Me.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[Me.contact.first_name," ",Me.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[mt&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${Me.contact.phone}`,className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-primary/10 hover:bg-primary/20 text-primary rounded text-xs font-medium transition-colors",title:"Call",children:[r.jsx(ca,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:Ve(Me.contact.phone,(tt=Me.script)==null?void 0:tt.script_body,Me.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 rounded text-xs font-medium transition-colors",title:"Text",children:[r.jsx(Po,{className:"h-3 w-3"}),"Text"]})]}),et&&r.jsxs("a",{href:Fe(Me.contact.email,(ft=Me.script)==null?void 0:ft.script_body,(jt=Me.script)==null?void 0:jt.email_subject,(Nt=Me.actionType)==null?void 0:Nt.name,Me.contact),className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 rounded text-xs font-medium transition-colors",title:"Email",children:[r.jsx(Ys,{className:"h-3 w-3"}),"Email"]})]}),!mt&&!et&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Me.relationshipTypeName&&r.jsx(Rt,{variant:"secondary",className:"text-xs",children:Me.relationshipTypeName}),Me.monthNumber>0&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:["Month ",Me.monthNumber]})]}),Me.script&&r.jsx(ee,{size:"sm",variant:"outline",className:"w-full",onClick:()=>he(Me),children:"View Script"}),r.jsx(ee,{size:"sm",className:"w-full",onClick:()=>{var Et;return we(Me.contact.id,Me.actionType.id,(Et=Me.script)==null?void 0:Et.id)},disabled:x.isPending,children:"Mark Complete"})]})]},Me.contact.id+Qe)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"h-full w-full",children:[r.jsx(lg,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(ap,{children:r.jsx(mo,{onClick:()=>e("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ge,{className:"md:col-span-2",children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qt,{className:"text-lg",children:"Momentum"}),r.jsxs(Br,{open:L,onOpenChange:z,children:[r.jsx(zo,{asChild:!0,children:r.jsx("button",{onClick:le,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(fd,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Fr,{className:"sm:max-w-[360px]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Set Weekly Goal"}),r.jsx(es,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(at,{id:"weekly-goal-ic",type:"number",min:"1",value:F,onChange:Me=>q(Me.target.value),placeholder:"20",onKeyDown:Me=>{Me.key==="Enter"&&ae()}})]}),r.jsx(ee,{onClick:ae,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(Hc,{value:Math.min(h.actionsThisWeek/H*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Zh,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[h.actionsThisWeek," / ",H]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),h.streak>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-lg",children:"🔥"}),r.jsx("span",{className:"font-medium",children:"Great Job!"}),r.jsxs("span",{className:"text-muted-foreground",children:["Keep Your Streak Going! (",h.streak," days)"]})]})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(Xe,{className:"space-y-3",children:[fe.length>0?fe.map(Me=>{const Qe=Me.birthday,Ee=Me.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Qe?r.jsx("span",{className:"text-lg",children:"🎂"}):r.jsx("span",{className:"text-lg",children:"🏠"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium",children:[Me.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",Qe?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Qe&&Me.birthday&&xn(new Date(Me.birthday),"MMM d"),Ee&&Me.home_anniversary&&xn(new Date(Me.home_anniversary),"MMM d")]})]})]},Me.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),p.count>0&&r.jsxs("button",{onClick:()=>e("/mission-control/contacts?filter=not-touched-90"),className:"flex items-start gap-2 text-sm pt-2 border-t w-full text-left hover:bg-accent/50 -mx-4 px-4 py-2 rounded-md transition-colors",children:[r.jsx(Ki,{className:"h-4 w-4 text-orange-500 mt-0.5"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium text-orange-600 dark:text-orange-400",children:[p.count," Contact",p.count!==1?"s":""]}),r.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(zOe,{})]})]}),r.jsx(Br,{open:C,onOpenChange:A,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsx(Hr,{children:r.jsx(qr,{className:"flex items-center gap-2",children:j&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:j.actionType.color||"#3B82F6"}}),j.actionType.name," Script"]})})}),j&&j.script&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["For: ",r.jsxs("span",{className:"font-medium text-foreground",children:[j.contact.first_name," ",j.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Oe(j.script.script_body,j.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>A(!1),children:"Close"}),r.jsx(ee,{className:"flex-1",onClick:()=>{var Me;return we(j.contact.id,j.actionType.id,(Me=j.script)==null?void 0:Me.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(Ajt,{})]})}const Ize=()=>{const{user:e}=zr();return Zt({queryKey:["popby-items",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("popby_items").select("*").or(`owner_user_id.is.null,owner_user_id.eq.${e==null?void 0:e.id}`).eq("is_active",!0).order("name");if(n)throw n;return t},enabled:!!e})},Zse=e=>{const{user:t}=zr();return Zt({queryKey:["popby-logs",t==null?void 0:t.id,e],queryFn:async()=>{let n=J.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(e){const o=new Date;o.setDate(o.getDate()-e),n=n.gte("completed_at",o.toISOString())}const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!t})},Sye=()=>{const{user:e}=zr();return Zt({queryKey:["relationship-type-popby-defaults",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("relationship_type_popby_defaults").select("*");if(n)throw n;return t},enabled:!!e})},Pze=()=>{const{user:e}=zr();return Zt({queryKey:["contact-popby-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("contact_popby_settings").select("*");if(n)throw n;return t},enabled:!!e})},Lze=()=>{const{data:e}=op(),{data:t}=Ug(),{data:n}=Zse(),{data:s}=Pze(),{data:i}=Sye(),o=new Map;n==null||n.forEach(x=>{const y=o.get(x.contact_id);(!y||new Date(x.completed_at)>new Date(y))&&o.set(x.contact_id,x.completed_at)});const l=new Map;i==null||i.forEach(x=>l.set(x.relationship_type_id,x.frequency_days));const a=new Map;s==null||s.filter(x=>x.is_active).forEach(x=>{a.set(x.contact_id,x.frequency_days)});const h=of(new Date);return(e||[]).map(x=>{let y=90;if(a.has(x.id))y=a.get(x.id);else if(x.tags&&x.tags.length>0){const A=x.tags.map(E=>l.get(E.relationship_type_id)).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}const b=o.get(x.id)||null,j=b?gC(h,of(new Date(b))):null,N=j===null||j>=y,C=N&&j!==null?j-y:0;return{...x,lastPopby:b,daysSinceLastPopby:j,frequencyDays:y,isDue:N,daysOverdue:C}}).sort((x,y)=>y.daysOverdue-x.daysOverdue)},Oze=()=>Lze().filter(t=>t.isDue),zjt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await J.from("popby_items").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-items"]}),$i({title:"Popby item created!"})},onError:n=>{$i({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},Dze=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await J.from("popby_logs").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-logs"]}),$i({title:"Popby logged!"})},onError:n=>{$i({title:"Error logging popby",description:n.message,variant:"destructive"})}})},Bjt=()=>{const e=Wr(),{user:t}=zr();return cr({mutationFn:async n=>{const{error:s}=await J.from("relationship_type_popby_defaults").upsert({...n,owner_user_id:t==null?void 0:t.id},{onConflict:"relationship_type_id,owner_user_id"});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),$i({title:"Frequency updated!"})},onError:n=>{$i({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},$jt=()=>{const{data:e}=Zse(30),t=Oze(),n=new Date;n.setDate(n.getDate()-7);const s=(e==null?void 0:e.filter(o=>new Date(o.completed_at)>=n).length)||0,i=(e==null?void 0:e.length)||0;return{thisWeekCount:s,thisMonthCount:i,dueCount:t.length}};function Ujt(){const{user:e}=zr();return Zt({queryKey:["contact-touch-logs",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function Rze(e){const{data:t}=Ujt(),{data:n}=Pze(),{data:s}=Sye(),{data:i}=Ejt();return I.useMemo(()=>{const o=i==null?void 0:i.find(A=>A.contact_id===e.id),l=o?new Date(o.snoozed_until):null,a=of(new Date);if(l&&!yse(l,a))return{nextTouchDate:l,daysUntil:gC(l,a),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const p=((t==null?void 0:t.filter(A=>A.contact_id===e.id))||[]).sort((A,E)=>new Date(E.completed_at).getTime()-new Date(A.completed_at).getTime())[0],x=p?new Date(p.completed_at):null;let y=90;const b=n==null?void 0:n.find(A=>A.contact_id===e.id&&A.is_active);if(b)y=b.frequency_days;else if(e.tags&&e.tags.length>0){const A=e.tags.map(E=>{const T=s==null?void 0:s.find(L=>L.relationship_type_id===E.relationship_type_id);return T==null?void 0:T.frequency_days}).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const j=Hl(of(x),y),N=gC(j,a);let C;return N<0?C="overdue":N<=7?C="due-soon":C="on-track",{nextTouchDate:j,daysUntil:N,status:C,frequencyDays:y,lastTouchDate:x,snoozedUntil:null}},[e,t,n,s,i])}function dfe({contact:e}){const t=Rze(e),s=(()=>{switch(t.status){case"overdue":return{variant:"destructive",icon:El,text:`${Math.abs(t.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Ki,text:t.daysUntil===0?"Due today":`Due in ${t.daysUntil} days`,className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"};case"on-track":return{variant:"secondary",icon:Ya,text:`Next touch in ${t.daysUntil} days`,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"snoozed":return{variant:"secondary",icon:Qh,text:`Snoozed until ${xn(t.snoozedUntil,"MMM d")}`,className:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300"};case"never-touched":return{variant:"outline",icon:zs,text:"Never touched",className:"border-dashed"}}})(),i=s.icon;return r.jsxs(Rt,{variant:s.variant,className:$t("gap-1",s.className),children:[r.jsx(i,{className:"h-3 w-3"}),s.text]})}function qjt({contact:e,onLogTouch:t,onSnooze:n}){const s=Rze(e),i=Pjt(),[o,l]=I.useState(!1),a=()=>{switch(s.status){case"overdue":return"text-destructive";case"due-soon":return"text-amber-600 dark:text-amber-400";case"on-track":return"text-emerald-600 dark:text-emerald-400";case"snoozed":return"text-slate-600 dark:text-slate-400";case"never-touched":return"text-muted-foreground"}},h=()=>{switch(s.status){case"overdue":return r.jsx(El,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Ki,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(Ya,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(Qh,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(zs,{className:"h-5 w-5 text-muted-foreground"})}},p=()=>{switch(s.status){case"overdue":return`${Math.abs(s.daysUntil)} days overdue`;case"due-soon":return s.daysUntil===0?"Due today!":`Due in ${s.daysUntil} days`;case"on-track":return`On track - ${s.daysUntil} days remaining`;case"snoozed":return`Snoozed for ${s.daysUntil} more days`;case"never-touched":return"No touches logged yet"}},x=async()=>{await i.mutateAsync(e.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Qt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(Xe,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[h(),r.jsx("span",{className:$t("font-medium",a()),children:p()})]}),s.status==="snoozed"&&s.snoozedUntil&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",xn(s.snoozedUntil,"MMMM d, yyyy")]}),s.status!=="snoozed"&&s.nextTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Scheduled:"})," ",xn(s.nextTouchDate,"MMMM d, yyyy")]}),s.lastTouchDate&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Last touch:"})," ",xn(s.lastTouchDate,"MMM d, yyyy")]}),s.status!=="snoozed"&&r.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",s.frequencyDays," days"]}),s.status==="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:i.isPending,children:[r.jsx(bs,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),t&&r.jsx(ee,{size:"sm",className:"flex-1",onClick:t,children:"Log Touch"})]}),s.status!=="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[r.jsx(Qh,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&t&&r.jsx(ee,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:t,children:"Log Touch"})]})]})]}),r.jsx(Nye,{open:o,onOpenChange:l,contactId:e.id,contactName:`${e.first_name} ${e.last_name||""}`.trim()})]})}const Fce=768;function g3(){const[e,t]=I.useState(void 0);return I.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Fce-1}px)`),s=()=>{t(window.innerWidthn.removeEventListener("change",s)},[]),!!e}const Vjt={warm:{label:"Warm",emoji:"🟢",bgClass:"bg-emerald-500",textClass:"text-emerald-600 dark:text-emerald-400",borderClass:"border-emerald-500",bgLightClass:"bg-emerald-500/10"},cooling:{label:"Cooling Off",emoji:"🟡",bgClass:"bg-amber-500",textClass:"text-amber-600 dark:text-amber-400",borderClass:"border-amber-500",bgLightClass:"bg-amber-500/10"},"at-risk":{label:"At Risk",emoji:"🔴",bgClass:"bg-red-500",textClass:"text-red-600 dark:text-red-400",borderClass:"border-red-500",bgLightClass:"bg-red-500/10"}},Hjt={sm:{dot:"h-2 w-2",text:"text-xs",badge:"px-1.5 py-0.5 gap-1"},md:{dot:"h-2.5 w-2.5",text:"text-sm",badge:"px-2 py-1 gap-1.5"},lg:{dot:"h-3 w-3",text:"text-base",badge:"px-3 py-1.5 gap-2"}};function y4e({score:e,showScore:t=!1,showTooltip:n=!0,size:s="sm",className:i}){const o=Vjt[e.status],l=Hjt[s],a=r.jsxs("div",{className:$t("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,l.badge,l.text,i),children:[r.jsx("span",{className:$t("rounded-full",o.bgClass,l.dot)}),t?r.jsx("span",{children:e.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(xI,{children:r.jsxs(Cg,{children:[r.jsx(Mg,{asChild:!0,children:a}),r.jsx(vm,{side:"top",className:"w-64 p-3",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-semibold",children:"Relationship Score"}),r.jsxs("span",{className:$t("font-bold",o.textClass),children:[e.score,"/100"]})]}),r.jsx(Hc,{value:e.score,className:"h-2"}),r.jsxs("div",{className:"space-y-1.5 text-xs",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Recency"}),r.jsxs("span",{children:[e.breakdown.recency,"/40"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Touchpoints (12mo)"}),r.jsxs("span",{children:[e.breakdown.touchpoints,"/30"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Transactions"}),r.jsxs("span",{children:[e.breakdown.transactions,"/20"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Referrals"}),r.jsxs("span",{children:[e.breakdown.referrals,"/10"]})]})]}),e.daysSinceTouch!==null&&r.jsxs("p",{className:"text-xs text-muted-foreground pt-1 border-t",children:["Last contact: ",e.daysSinceTouch===0?"Today":`${e.daysSinceTouch} days ago`]}),e.daysSinceTouch===null&&r.jsx("p",{className:"text-xs text-muted-foreground pt-1 border-t italic",children:"Never contacted"})]})})]})}):a}const Wjt=[{key:"first_name",label:"First Name",required:!0},{key:"last_name",label:"Last Name",required:!1},{key:"email",label:"Email",required:!1},{key:"phone",label:"Phone",required:!1},{key:"address",label:"Street Address",required:!1},{key:"city",label:"City",required:!1},{key:"state",label:"State",required:!1},{key:"zip",label:"Zip Code",required:!1},{key:"spouse_name",label:"Spouse Name",required:!1},{key:"spouse_email",label:"Spouse Email",required:!1},{key:"company_name",label:"Company",required:!1},{key:"job_title",label:"Job Title",required:!1},{key:"birthday",label:"Birthday",required:!1},{key:"home_anniversary",label:"Home Anniversary",required:!1},{key:"notes",label:"Notes",required:!1}],Gjt=({open:e,onOpenChange:t,relationshipTypes:n,onSuccess:s})=>{const{user:i}=zr(),{toast:o}=pa(),l=I.useRef(null),[a,h]=I.useState("upload"),[p,x]=I.useState([]),[y,b]=I.useState([]),[j,N]=I.useState({}),[C,A]=I.useState([]),[E,T]=I.useState([]),[L,z]=I.useState(!1),[F,q]=I.useState(null),H=()=>{h("upload"),x([]),b([]),N({}),A([]),T([]),q(null),l.current&&(l.current.value="")},K=()=>{H(),t(!1)},Z=fe=>{const de=fe.split(` `).map(we=>we.trim()).filter(we=>we);if(de.length===0)return{headers:[],data:[]};const ye=we=>{const he=[];let xe="",be=!1;for(let Oe=0;Oe{var Ie;const de=(Ie=fe.target.files)==null?void 0:Ie[0];if(!de)return;const ye=new FileReader;ye.onload=Ne=>{var Oe;const we=(Oe=Ne.target)==null?void 0:Oe.result,{headers:he,data:xe}=Z(we);if(he.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(he),b(xe);const be={};he.forEach(Te=>{const Ve=Te.toLowerCase().replace(/[_\s-]/g,"");Ve.includes("firstname")||Ve==="first"?be.first_name=Te:Ve.includes("lastname")||Ve==="last"?be.last_name=Te:Ve.includes("email")?be.email=Te:Ve.includes("phone")||Ve.includes("mobile")||Ve.includes("cell")?be.phone=Te:Ve.includes("address")||Ve.includes("street")?be.address=Te:Ve==="city"?be.city=Te:Ve==="state"||Ve==="province"?be.state=Te:Ve==="zip"||Ve==="zipcode"||Ve==="postalcode"?be.zip=Te:Ve.includes("spouse")&&Ve.includes("email")?be.spouse_email=Te:Ve.includes("spouse")||Ve.includes("partner")?be.spouse_name=Te:Ve.includes("company")||Ve.includes("organization")||Ve.includes("business")?be.company_name=Te:Ve.includes("jobtitle")||Ve.includes("title")||Ve.includes("position")?be.job_title=Te:Ve.includes("birthday")||Ve.includes("dob")||Ve.includes("birthdate")?be.birthday=Te:Ve.includes("anniversary")||Ve.includes("homeanniversary")?be.home_anniversary=Te:(Ve.includes("notes")||Ve.includes("comment"))&&(be.notes=Te)}),N(be),h("mapping")},ye.readAsText(de)},ae=(fe,de)=>{N(ye=>{if(de==="none"){const{[fe]:Ie,...Ne}=ye;return Ne}return{...ye,[fe]:de}})},le=fe=>{A(de=>de.includes(fe)?de.filter(ye=>ye!==fe):[...de,fe])},ve=()=>{const fe=y.map(de=>{const ye=we=>{const he=j[we];if(!he)return"";const xe=p.indexOf(he);return xe>=0?(de[xe]||"").trim():""},Ie=ye("first_name"),Ne=Ie.length>0;return{first_name:Ie,last_name:ye("last_name"),email:ye("email"),phone:ye("phone"),address:ye("address"),city:ye("city"),state:ye("state"),zip:ye("zip"),spouse_name:ye("spouse_name"),spouse_email:ye("spouse_email"),company_name:ye("company_name"),job_title:ye("job_title"),birthday:ye("birthday"),home_anniversary:ye("home_anniversary"),notes:ye("notes"),isValid:Ne,error:Ne?void 0:"First name is required"}});T(fe),h("preview")},ne=async()=>{if(!(i!=null&&i.id))return;const fe=E.filter(Ne=>Ne.isValid);if(fe.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}z(!0);let de=0,ye=0,Ie=0;try{for(const Ne of fe)try{let we=null;if(Ne.email){const{data:xe}=await J.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("email",Ne.email).maybeSingle();we=xe}if(!we&&Ne.phone){const{data:xe}=await J.from("innercircle_contacts").select("id").eq("owner_user_id",i.id).eq("phone",Ne.phone).maybeSingle();we=xe}const he={owner_user_id:i.id,first_name:Ne.first_name,last_name:Ne.last_name||null,email:Ne.email||null,phone:Ne.phone||null,address:Ne.address||null,city:Ne.city||null,state:Ne.state||null,zip:Ne.zip||null,spouse_name:Ne.spouse_name||null,spouse_email:Ne.spouse_email||null,company_name:Ne.company_name||null,job_title:Ne.job_title||null,birthday:Ne.birthday||null,home_anniversary:Ne.home_anniversary||null,notes:Ne.notes||null};if(we)await J.from("innercircle_contacts").update(he).eq("id",we.id),ye++;else{const{data:xe}=await J.from("innercircle_contacts").insert(he).select("id").single();xe&&C.length>0&&await J.from("innercircle_contact_tags").insert(C.map(be=>({contact_id:xe.id,relationship_type_id:be}))),de++}}catch(we){console.error("Error importing contact:",we),Ie++}q({created:de,updated:ye,failed:Ie}),h("result"),(de>0||ye>0)&&s(),o({title:"Import Complete",description:`${de} created, ${ye} updated${Ie>0?`, ${Ie} failed`:""}.`})}catch(Ne){console.error("Import error:",Ne),o({title:"Import Failed",description:Ne.message||"Failed to import contacts",variant:"destructive"})}finally{z(!1)}},ge=E.filter(fe=>fe.isValid).length,ie=E.filter(fe=>!fe.isValid).length;return r.jsx(Br,{open:e,onOpenChange:K,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(h1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(es,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),a==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:te,className:"hidden"}),r.jsx(no,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(ee,{onClick:()=>{var fe;return(fe=l.current)==null?void 0:fe.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),r.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:"First Name, Last Name, Email, Phone, Street Address, City, State, Zip, Spouse Name, Company, Job Title, Birthday, Home Anniversary, Notes"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{const fe=`First Name,Last Name,Email,Phone,Street Address,City,State,Zip,Spouse Name,Company,Job Title,Birthday,Home Anniversary,Notes John,Doe,john@example.com,555-123-4567,123 Main St,Austin,TX,78701,Jane Doe,ABC Realty,Real Estate Agent,1985-06-15,2020-03-22,Met at open house`,de=new Blob([fe],{type:"text/csv"}),ye=URL.createObjectURL(de),Ie=document.createElement("a");Ie.href=ye,Ie.download="contact_import_template.csv",Ie.click(),URL.revokeObjectURL(ye)},children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),a==="mapping"&&r.jsxs("div",{className:"flex-1 overflow-auto space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:Wjt.map(fe=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(Ue,{className:"w-40 text-sm",children:[fe.label,fe.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(vn,{value:j[fe.key]||"none",onValueChange:de=>ae(fe.key,de),children:[r.jsx(mn,{className:"w-48",children:r.jsx(_n,{placeholder:"Select column..."})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"-- Not mapped --"}),p.map(de=>r.jsx(Ht,{value:de,children:de},de))]})]})]},fe.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(fe=>r.jsx(Rt,{variant:C.includes(fe.id)?"default":"outline",className:"cursor-pointer",onClick:()=>le(fe.id),children:fe.name},fe.id))})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:r.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",y.length," row(s) found in CSV"]})})]}),a==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[ge," valid"]})]}),ie>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(El,{className:"h-4 w-4"}),r.jsxs("span",{children:[ie," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ws,{children:E.slice(0,100).map((fe,de)=>r.jsxs(Ir,{children:[r.jsx(_t,{children:fe.first_name}),r.jsx(_t,{children:fe.last_name}),r.jsx(_t,{children:fe.email}),r.jsx(_t,{children:fe.phone}),r.jsx(_t,{children:fe.isValid?r.jsx(Rt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Rt,{variant:"destructive",children:fe.error||"Invalid"})})]},de))})]}),E.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",E.length," contacts"]})]})]}),a==="result"&&F&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(Ya,{className:"h-12 w-12 mx-auto text-green-500"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground",children:[F.created," contact(s) created, ",F.updated," updated"]}),F.failed>0&&r.jsxs("p",{className:"text-destructive",children:[F.failed," failed to import"]})]}),r.jsxs(ri,{children:[a==="upload"&&r.jsx(ee,{variant:"outline",onClick:K,children:"Cancel"}),a==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:H,children:"Back"}),r.jsx(ee,{onClick:ve,disabled:!j.first_name,children:"Continue"})]}),a==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h("mapping"),children:"Back"}),r.jsx(ee,{onClick:ne,disabled:L||ge===0,children:L?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${ge} Contact${ge!==1?"s":""}`})]}),a==="result"&&r.jsx(ee,{onClick:K,children:"Done"})]})]})})};function Kjt(){return"contacts"in navigator&&"ContactsManager"in window}function Zjt(e){const t=[],n=e.split("BEGIN:VCARD").filter(s=>s.trim());for(const s of n){const i=s.split(/\r?\n/);let o="",l="",a="",h="",p="";for(const x of i){const y=x.replace(/^\s+/,"");if(y.startsWith("N:")||y.startsWith("N;")){const j=y.substring(y.indexOf(":")+1).split(";");l=(j[0]||"").trim(),o=(j[1]||"").trim()}if((y.startsWith("FN:")||y.startsWith("FN;"))&&!o){const j=y.substring(y.indexOf(":")+1).trim().split(" ");o=j[0]||"",l=j.slice(1).join(" ")}(y.startsWith("EMAIL")||y.match(/^item\d+\.EMAIL/i))&&!a&&(a=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("TEL")||y.match(/^item\d+\.TEL/i))&&!h&&(h=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!p&&(p=y.substring(y.indexOf(":")+1).split(";").map(N=>N.trim()).filter(Boolean).join(", "))}(o||l)&&t.push({first_name:o,last_name:l,email:a,phone:h,address:p})}return t}function Yjt({open:e,onOpenChange:t,onComplete:n}){const{user:s}=zr(),{data:i}=op(),o=wxe(),l=I.useRef(null),[a,h]=I.useState("choose"),[p,x]=I.useState([]),[y,b]=I.useState(new Set),[j,N]=I.useState(0),[C,A]=I.useState(0),E=Kjt(),T=I.useCallback(ae=>{if(!i)return ae;const le=new Set(i.filter(ne=>ne.email).map(ne=>ne.email.toLowerCase())),ve=new Set(i.filter(ne=>ne.phone).map(ne=>ne.phone.replace(/\D/g,"")));return ae.map(ne=>{var fe,de;const ge=(fe=ne.email)==null?void 0:fe.toLowerCase(),ie=(de=ne.phone)==null?void 0:de.replace(/\D/g,"");return ge&&le.has(ge)?{...ne,isDuplicate:!0,duplicateField:"email"}:ie&&ie.length>=7&&ve.has(ie)?{...ne,isDuplicate:!0,duplicateField:"phone"}:ne})},[i]),L=async()=>{try{const ae=["name","email","tel","address"],le=await navigator.contacts.select(ae,{multiple:!0});if(!le||le.length===0)return;const ve=le.map(ie=>{var ye,Ie,Ne,we;const de=(((ye=ie.name)==null?void 0:ye[0])||"").split(" ");return{first_name:de[0]||"",last_name:de.slice(1).join(" "),email:((Ie=ie.email)==null?void 0:Ie[0])||"",phone:((Ne=ie.tel)==null?void 0:Ne[0])||"",address:(we=ie.address)!=null&&we[0]?[ie.address[0].streetAddress,ie.address[0].city,ie.address[0].region,ie.address[0].postalCode].filter(Boolean).join(", "):""}}),ne=T(ve);x(ne);const ge=new Set;ne.forEach((ie,fe)=>{ie.isDuplicate||ge.add(fe)}),b(ge),h("preview")}catch(ae){console.error("Contact Picker error:",ae),$i({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},z=ae=>{var ne;const le=(ne=ae.target.files)==null?void 0:ne[0];if(!le)return;const ve=new FileReader;ve.onload=ge=>{var Ie;const ie=(Ie=ge.target)==null?void 0:Ie.result,fe=Zjt(ie);if(fe.length===0){$i({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const de=T(fe);x(de);const ye=new Set;de.forEach((Ne,we)=>{Ne.isDuplicate||ye.add(we)}),b(ye),h("preview")},ve.readAsText(le),l.current&&(l.current.value="")},F=async()=>{const ae=p.filter((ve,ne)=>y.has(ne));if(ae.length===0)return;h("importing");let le=0;for(const ve of ae)try{await o.mutateAsync({first_name:ve.first_name,last_name:ve.last_name||void 0,email:ve.email||void 0,phone:ve.phone||void 0,address:ve.address||void 0}),le++,A(Math.round(le/ae.length*100))}catch(ne){console.error(`Failed to import ${ve.first_name} ${ve.last_name}:`,ne)}N(le),h("done")},q=ae=>{b(le=>{const ve=new Set(le);return ve.has(ae)?ve.delete(ae):ve.add(ae),ve})},H=()=>{y.size===p.length?b(new Set):b(new Set(p.map((ae,le)=>le)))},K=ae=>{ae||(h("choose"),x([]),b(new Set),N(0),A(0),a==="done"&&n()),t(ae)},Z=p.filter(ae=>ae.isDuplicate).length,te=y.size;return r.jsx(Br,{open:e,onOpenChange:K,children:r.jsxs(Fr,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(xm,{className:"h-5 w-5 text-primary"}),a==="choose"&&"Import Phone Contacts",a==="preview"&&"Select Contacts to Import",a==="importing"&&"Importing Contacts...",a==="done"&&"Import Complete"]}),a==="choose"&&r.jsx(es,{children:"Add contacts from your phone directly into Agent OS."})]}),a==="choose"&&r.jsxs("div",{className:"space-y-4 pt-2",children:[E&&r.jsxs(ee,{onClick:L,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(xm,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Select from Phone"}),r.jsx("div",{className:"text-xs opacity-80",children:"Pick contacts directly from your device"})]})]}),r.jsxs("div",{className:"relative",children:[E&&r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),E&&r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),r.jsxs(ee,{variant:E?"outline":"default",onClick:()=>{var ae;return(ae=l.current)==null?void 0:ae.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(no,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Upload Contact File"}),r.jsx("div",{className:"text-xs opacity-80",children:E?"Import a .vcf file exported from your Contacts app":"Export contacts from your phone as a .vcf file, then upload here"})]})]}),r.jsx("input",{ref:l,type:"file",accept:".vcf,.vcard",onChange:z,className:"hidden"}),!E&&r.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{className:"font-medium",children:"How to export contacts:"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"iPhone:"}),r.jsx("p",{className:"text-xs",children:'Open Contacts → select contacts → Share → choose "Export vCard"'})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"Android:"}),r.jsx("p",{className:"text-xs",children:"Open Contacts → Menu → Export → save as .vcf file"})]})]})]}),a==="preview"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("span",{children:[p.length," contact",p.length!==1?"s":""," found",Z>0&&r.jsxs("span",{className:"text-amber-600 ml-1",children:["(",Z," already exist)"]})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:H,children:y.size===p.length?"Deselect All":"Select All"})]}),r.jsx(Jo,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:p.map((ae,le)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ae.isDuplicate?"opacity-60":""}`,onClick:()=>q(le),children:[r.jsx(cc,{checked:y.has(le),onCheckedChange:()=>q(le),className:"mt-0.5"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:[ae.first_name," ",ae.last_name]}),ae.isDuplicate&&r.jsxs(Rt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-amber-500/10 text-amber-600 border-amber-200",children:["Exists (",ae.duplicateField,")"]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[ae.phone&&r.jsx("div",{children:ae.phone}),ae.email&&r.jsx("div",{className:"truncate",children:ae.email})]})]})]},le))})}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>h("choose"),children:"Back"}),r.jsxs(ee,{onClick:F,disabled:te===0,children:["Import ",te," Contact",te!==1?"s":""]})]})]}),a==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(nn,{className:"h-8 w-8 animate-spin text-primary"}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"font-medium",children:"Importing contacts..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[C,"% complete"]})]}),r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${C}%`}})})]}),a==="done"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-emerald-500/10 flex items-center justify-center",children:r.jsx(Ca,{className:"h-6 w-6 text-emerald-600"})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"font-semibold text-lg",children:[j," contact",j!==1?"s":""," imported!"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Your contacts are now in Agent OS and ready for touchpoint plans."})]}),r.jsx(ee,{onClick:()=>K(!1),className:"mt-2",children:"Done"})]})]})})}function Xjt(){const e=ns(),[t]=Fd(),{user:n}=zr(),s=g3(),i=Wr(),o=t.get("type"),l=t.get("filter")??t.get("status"),a=t.get("new")==="true",{contactsWithScores:h,isLoading:p}=Sxe(),{data:x}=Ug(),y=wxe(),b=yOe(),j=vOe(),[N,C]=I.useState(""),[A,E]=I.useState(o||"all"),[T,L]=I.useState(l||"all"),[z,F]=I.useState("name"),[q,H]=I.useState(a),[K,Z]=I.useState(null),[te,ae]=I.useState(!1),[le,ve]=I.useState(!1),[ne,ge]=I.useState(null),[ie,fe]=I.useState("");I.useEffect(()=>{if(!(n!=null&&n.id))return;const xe=J.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{i.invalidateQueries({queryKey:["innercircle-contacts"]}),i.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{J.removeChannel(xe)}},[i,n==null?void 0:n.id]),I.useEffect(()=>{l&&L(l)},[l]);const[de,ye]=I.useState({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]});I.useEffect(()=>{a&&H(!0)},[a]),I.useEffect(()=>{var xe;K&&ye({first_name:K.first_name||"",last_name:K.last_name||"",email:K.email||"",phone:K.phone||"",address:K.address||"",city:K.city||"",state:K.state||"",zip_code:K.zip_code||"",birthday:K.birthday||"",home_anniversary:K.home_anniversary||"",spouse_name:K.spouse_name||"",spouse_email:K.spouse_email||"",notes:K.notes||"",tagIds:((xe=K.tags)==null?void 0:xe.map(be=>be.relationship_type_id))||[]})},[K]);const Ie=I.useMemo(()=>{if(!h)return[];let xe=h.filter(be=>{var Ve,Fe,Me;const Oe=N===""||`${be.first_name} ${be.last_name}`.toLowerCase().includes(N.toLowerCase())||((Ve=be.email)==null?void 0:Ve.toLowerCase().includes(N.toLowerCase()))||((Fe=be.phone)==null?void 0:Fe.includes(N)),Te=A==="all"||((Me=be.tags)==null?void 0:Me.some(Qe=>Qe.relationship_type_id===A));return Oe&&Te});return T==="not-touched-90"?xe=xe.filter(be=>{const Oe=be.relationshipScore.daysSinceTouch;return Oe===null||Oe>90}):T==="at-risk"?xe=xe.filter(be=>be.relationshipScore.status==="at-risk"):T==="cooling"?xe=xe.filter(be=>be.relationshipScore.status==="cooling"):T==="warm"&&(xe=xe.filter(be=>be.relationshipScore.status==="warm")),xe=[...xe].sort((be,Oe)=>{switch(z){case"last-touched":{const Te=be.relationshipScore.lastTouchDate,Ve=Oe.relationshipScore.lastTouchDate;return!Te&&!Ve?0:Te?Ve?new Date(Te).getTime()-new Date(Ve).getTime():1:-1}case"next-touch":{const Te=be.relationshipScore.daysSinceTouch,Ve=Oe.relationshipScore.daysSinceTouch;return Te===null&&Ve===null?0:Te===null?-1:Ve===null?1:Ve-Te}case"score":return be.relationshipScore.score-Oe.relationshipScore.score;case"date-added":{const Te=be.created_at,Ve=Oe.created_at;return!Te&&!Ve?0:Te?Ve?new Date(Ve).getTime()-new Date(Te).getTime():-1:1}case"name":default:{const Te=`${be.first_name||""} ${be.last_name||""}`.toLowerCase(),Ve=`${Oe.first_name||""} ${Oe.last_name||""}`.toLowerCase();return Te.localeCompare(Ve)}}}),xe},[h,N,A,T,z]),Ne=()=>{ye({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},we=async xe=>{xe.preventDefault(),K?(await b.mutateAsync({id:K.id,...de}),Z(null)):(await y.mutateAsync(de),H(!1)),Ne()},he=async xe=>{confirm("Are you sure you want to delete this contact?")&&await j.mutateAsync(xe)};return r.jsx(Or,{title:"Contacts",description:"Manage your InnerCircle contacts",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Contacts"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsx("div",{className:"flex items-center gap-4",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control"),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name, email, or phone...",value:N,onChange:xe=>C(xe.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:A,onValueChange:E,children:[r.jsx(mn,{className:"w-[160px]",children:r.jsx(_n,{placeholder:"Filter by type"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Types"}),x==null?void 0:x.filter(xe=>xe.active).map(xe=>r.jsx(Ht,{value:xe.id,children:xe.name},xe.id))]})]}),r.jsxs(vn,{value:T,onValueChange:L,children:[r.jsx(mn,{className:"w-[160px]",children:r.jsx(_n,{placeholder:"Filter by status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Status"}),r.jsx(Ht,{value:"warm",children:"🟢 Warm"}),r.jsx(Ht,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx(Ht,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(vn,{value:z,onValueChange:F,children:[r.jsx(mn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($x,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(_n,{placeholder:"Sort by"})]})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"name",children:"Name (A-Z)"}),r.jsx(Ht,{value:"last-touched",children:"Last Touched"}),r.jsx(Ht,{value:"next-touch",children:"Next Touch Due"}),r.jsx(Ht,{value:"score",children:"Relationship Score"}),r.jsx(Ht,{value:"date-added",children:"Date Added"})]})]}),r.jsxs(ee,{onClick:()=>H(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ae(!0),children:[r.jsx(no,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ve(!0),children:[r.jsx(xm,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),s?r.jsx("div",{className:"space-y-3",children:p?r.jsx(Ge,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):Ie.length===0?r.jsx(Ge,{className:"p-6 text-center text-muted-foreground",children:N||A!=="all"||T!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):Ie.map(xe=>{var Oe;const{relationshipScore:be}=xe;return r.jsx(Ge,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const Te=new URLSearchParams;N&&Te.set("search",N),A!=="all"&&Te.set("type",A),T!=="all"&&Te.set("filter",T);const Ve=Te.toString();e(`/mission-control/contacts/${xe.id}${Ve?`?${Ve}`:""}`)},children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("h3",{className:"font-semibold text-base truncate",children:[xe.first_name," ",xe.last_name]}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[xe.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Ys,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:xe.email})]}),xe.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(ca,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:xe.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(y4e,{score:be,size:"sm"}),r.jsx(dfe,{contact:xe}),(Oe=xe.tags)==null?void 0:Oe.map(Te=>{var Ve;return r.jsx(Rt,{variant:"secondary",className:"text-xs",children:(Ve=Te.relationship_type)==null?void 0:Ve.name},Te.id)})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[be.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),xn(new Date(be.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),xe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(zs,{className:"h-3 w-3"}),xn(new Date(xe.birthday),"MMM d")]}),xe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(fi,{className:"h-3 w-3"}),xn(new Date(xe.home_anniversary),"MMM d")]})]})]}),r.jsxs("div",{className:"flex flex-col gap-1 ml-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",title:"Snooze Touch",onClick:Te=>{Te.stopPropagation(),ge(xe.id),fe(`${xe.first_name} ${xe.last_name||""}`.trim())},children:r.jsx(Qh,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Te=>{Te.stopPropagation(),Z(xe)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Te=>{Te.stopPropagation(),he(xe.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]})})},xe.id)})}):r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0 overflow-x-auto",children:r.jsxs(Vs,{className:"min-w-[600px]",children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Contact Info"}),r.jsx(It,{children:"Relationship Types"}),r.jsx(It,{children:"Last Contact"}),r.jsx(It,{children:"Important Dates"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Ws,{children:p?r.jsx(Ir,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8",children:"Loading contacts..."})}):Ie.length===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:N||A!=="all"||T!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):Ie.map(xe=>{var Oe;const{relationshipScore:be}=xe;return r.jsxs(Ir,{className:"cursor-pointer hover:bg-accent/50",onClick:()=>{const Te=new URLSearchParams;N&&Te.set("search",N),A!=="all"&&Te.set("type",A),T!=="all"&&Te.set("status",T);const Ve=Te.toString();e(`/mission-control/contacts/${xe.id}${Ve?`?${Ve}`:""}`)},children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[xe.first_name," ",xe.last_name]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(y4e,{score:be,size:"sm"}),r.jsx(dfe,{contact:xe})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[xe.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ys,{className:"h-3 w-3"}),xe.email]}),xe.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(ca,{className:"h-3 w-3"}),xe.phone]})]})}),r.jsx(_t,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:(Oe=xe.tags)==null?void 0:Oe.map(Te=>{var Ve;return r.jsx(Rt,{variant:"secondary",className:"text-xs",children:(Ve=Te.relationship_type)==null?void 0:Ve.name},Te.id)})})}),r.jsx(_t,{children:r.jsx("div",{className:"text-sm",children:be.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ki,{className:"h-3 w-3"}),xn(new Date(be.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(_t,{children:r.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[xe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(zs,{className:"h-3 w-3"}),xn(new Date(xe.birthday),"MMM d")]}),xe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(fi,{className:"h-3 w-3"}),xn(new Date(xe.home_anniversary),"MMM d")]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",title:"Snooze Touch",onClick:Te=>{Te.stopPropagation(),ge(xe.id),fe(`${xe.first_name} ${xe.last_name||""}`.trim())},children:r.jsx(Qh,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:Te=>{Te.stopPropagation(),Z(xe)},children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:Te=>{Te.stopPropagation(),he(xe.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},xe.id)})})]})})}),r.jsx(Br,{open:q||!!K,onOpenChange:xe=>{xe||(H(!1),Z(null),Ne())},children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:K?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:we,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"first_name",children:"First Name *"}),r.jsx(at,{id:"first_name",value:de.first_name,onChange:xe=>ye({...de,first_name:xe.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"last_name",children:"Last Name"}),r.jsx(at,{id:"last_name",value:de.last_name,onChange:xe=>ye({...de,last_name:xe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"email",children:"Email"}),r.jsx(at,{id:"email",type:"email",value:de.email,onChange:xe=>ye({...de,email:xe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"phone",children:"Phone"}),r.jsx(at,{id:"phone",value:de.phone,onChange:xe=>ye({...de,phone:xe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"address",children:"Address"}),r.jsx(at,{id:"address",value:de.address,onChange:xe=>ye({...de,address:xe.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"city",children:"City"}),r.jsx(at,{id:"city",value:de.city,onChange:xe=>ye({...de,city:xe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"state",children:"State"}),r.jsx(at,{id:"state",value:de.state,onChange:xe=>ye({...de,state:xe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"zip_code",children:"Zip"}),r.jsx(at,{id:"zip_code",value:de.zip_code,onChange:xe=>ye({...de,zip_code:xe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"birthday",children:"Birthday"}),r.jsx(at,{id:"birthday",type:"date",value:de.birthday,onChange:xe=>ye({...de,birthday:xe.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(at,{id:"home_anniversary",type:"date",value:de.home_anniversary,onChange:xe=>ye({...de,home_anniversary:xe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(at,{id:"spouse_name",value:de.spouse_name,onChange:xe=>ye({...de,spouse_name:xe.target.value}),placeholder:"Spouse/partner name"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(at,{id:"spouse_email",type:"email",value:de.spouse_email,onChange:xe=>ye({...de,spouse_email:xe.target.value}),placeholder:"Spouse/partner email"})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(xe=>xe.active).map(xe=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(cc,{checked:de.tagIds.includes(xe.id),onCheckedChange:be=>{ye(be?{...de,tagIds:[...de.tagIds,xe.id]}:{...de,tagIds:de.tagIds.filter(Oe=>Oe!==xe.id)})}}),r.jsx("span",{className:"text-sm",children:xe.name})]},xe.id))})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:de.notes,onChange:xe=>ye({...de,notes:xe.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>{H(!1),Z(null),Ne()},children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:y.isPending||b.isPending,children:[K?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(Gjt,{open:te,onOpenChange:ae,relationshipTypes:(x==null?void 0:x.filter(xe=>xe.active))||[],onSuccess:()=>{ae(!1)}}),r.jsx(Yjt,{open:le,onOpenChange:ve,onComplete:()=>ve(!1)}),r.jsx(Nye,{open:!!ne,onOpenChange:xe=>{xe||ge(null)},contactId:ne||"",contactName:ie})]})})}function Qjt(){return Zt({queryKey:["video-script-categories"],queryFn:async()=>{const{data:e,error:t}=await J.from("video_script_categories").select("*").order("sort_order");if(t)throw t;return e}})}function Jjt(e){return Zt({queryKey:["video-scripts",e],queryFn:async()=>{let t=J.from("video_scripts").select("*, category:video_script_categories(*)").eq("is_active",!0).order("title");const{data:n,error:s}=await t;if(s)throw s;return n}})}function ekt(){const{user:e}=zr();return Zt({queryKey:["user-video-scripts",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await J.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",e.id).order("title");if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function tkt(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:i}=await J.from("user_video_scripts").insert([{owner_user_id:e.id,source_script_id:n.id,category_id:n.category_id,title:n.title,script_text:n.script_text,tags:n.tags,is_custom:!1}]).select().single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["user-video-scripts"]})}})}function rkt(e){const{user:t}=zr();return Zt({queryKey:["agent-videos",t==null?void 0:t.id,e],queryFn:async()=>{if(!(t!=null&&t.id))return[];let n=J.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",t.id).order("created_at",{ascending:!1});n=n.eq("is_deleted",!1);const{data:s,error:i}=await n;if(i)throw i;return s},enabled:!!(t!=null&&t.id)})}function nkt(e){return Zt({queryKey:["agent-video",e],queryFn:async()=>{const{data:t,error:n}=await J.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function Fze(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:i}=await J.from("agent_videos").insert([{owner_user_id:e.id,contact_id:n.contact_id,bunny_video_id:n.bunny_video_id,playback_url:n.playback_url,thumbnail_url:n.thumbnail_url,preview_url:n.preview_url,duration_seconds:n.duration_seconds,file_size_mb:n.file_size_mb||0,title:n.title,notes:n.notes,task_id:n.task_id,status:n.status||"processing",touch_type:n.touch_type||"video",page_template:"default"}]).select("*, share_token").single();if(i)throw i;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function skt(){const e=Wr();return cr({mutationFn:async({id:t,bunnyVideoId:n,hardDelete:s=!1})=>{if(console.log("Deleting video:",{id:t,bunnyVideoId:n,hardDelete:s}),n){console.log("Calling bunny-upload delete for videoId:",n);const{data:i,error:o}=await J.functions.invoke("bunny-upload",{body:{action:"delete",videoId:n,isAgentVideo:!0}});o?console.error("Failed to delete from Bunny:",o):console.log("Bunny delete response:",i)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",t);const{error:i}=await J.from("agent_videos").delete().eq("id",t);if(i)throw i}else{console.log("Soft deleting from database:",t);const{error:i}=await J.from("agent_videos").update({is_deleted:!0}).eq("id",t);if(i)throw i}console.log("Video deletion complete")},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function Cye(){const{user:e}=zr();return Zt({queryKey:["storage-usage",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return null;const{data:t,error:n}=await J.from("agent_storage_usage").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t||{user_id:e.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(e!=null&&e.id)})}function ikt(){const{data:e,isLoading:t}=Cye(),n=e?e.total_storage_mb0?e.total_storage_mb/e.max_storage_mb*100:0,o=i>=80;return{canRecord:n,remainingMb:s,usagePercent:i,isNearLimit:o,storage:e,isLoading:t}}async function akt(e){const{data:t,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:e,isAgentVideo:!0}});if(n)throw n;return t}async function okt(e){const{data:t,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}async function lkt(e){const{data:t,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"status",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}function ckt(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async({contactId:n,videoId:s,notes:i})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:o}=await J.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:l,error:a}=await J.from("contact_touch_logs").insert([{owner_user_id:e.id,contact_id:n,action_type_id:o.id,notes:i||`Quick Video Touch - Video ID: ${s}`}]).select().single();if(a)throw a;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts"]})}})}function dkt(e){return Zt({queryKey:["contact-video-replies",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await J.from("video_replies").select(` *, video:agent_videos(id, title, thumbnail_url, playback_url) `).eq("contact_id",e).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function ukt({videoId:e}){var l;const{data:t,isLoading:n,error:s}=nkt(e);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Pr,{className:"w-full aspect-video rounded-lg"}),r.jsx(Pr,{className:"h-4 w-1/3"})]});if(s||!t||t.is_deleted)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Bh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-medium",children:"Video Unavailable"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video has been deleted or is no longer available."})]});const i=a=>{let h=a;return h.includes("iframe.mediadelivery.net/play/")&&(h=h.replace("/play/","/embed/"),h+=(h.includes("?")?"&":"?")+"autoplay=true&responsive=true"),h},o=(l=t.playback_url)==null?void 0:l.includes("iframe.mediadelivery.net");return r.jsxs("div",{className:"space-y-4",children:[t.playback_url?r.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:o?r.jsx("iframe",{src:i(t.playback_url),title:t.title||"Video preview",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:t.playback_url,controls:!0,autoPlay:!0,className:"absolute top-0 left-0 w-full h-full object-contain"})}):r.jsx("div",{className:"w-full aspect-video bg-muted rounded-lg flex items-center justify-center",children:r.jsx("p",{className:"text-muted-foreground",children:"Video is still processing..."})}),t.title&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:t.title}),t.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.notes})]})]})}function hkt(){var be,Oe;const{contactId:e}=Wc(),t=ns(),[n]=Fd(),s=n.get("search")||"",i=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:a}=Rft(e||""),{data:h}=Ug(),{data:p}=jxe(),{data:x}=jse(365),{data:y}=Zse(365),{data:b}=dkt(e),{contactsWithScores:j}=Sxe(),N=yOe(),C=vOe(),A=bOe(),[E,T]=I.useState(!1),[L,z]=I.useState({}),[F,q]=I.useState(!1),[H,K]=I.useState(null),[Z,te]=I.useState(""),[ae,le]=I.useState(null),ve=Te=>{if(!Te)return null;const Ve=Te.match(/Video ID:\s*([a-f0-9-]+)/i);return Ve?Ve[1]:null},ne=I.useMemo(()=>{if(!j)return[];let Te=j.filter(Ve=>{var Qe,Ee,Ye;const Fe=s===""||`${Ve.first_name} ${Ve.last_name}`.toLowerCase().includes(s.toLowerCase())||((Qe=Ve.email)==null?void 0:Qe.toLowerCase().includes(s.toLowerCase()))||((Ee=Ve.phone)==null?void 0:Ee.includes(s)),Me=i==="all"||((Ye=Ve.tags)==null?void 0:Ye.some(me=>me.relationship_type_id===i));return Fe&&Me});return o==="not-touched-90"?Te=Te.filter(Ve=>{const Fe=Ve.relationshipScore.daysSinceTouch;return Fe===null||Fe>90}):o==="at-risk"?Te=Te.filter(Ve=>Ve.relationshipScore.status==="at-risk"):o==="cooling"?Te=Te.filter(Ve=>Ve.relationshipScore.status==="cooling"):o==="warm"&&(Te=Te.filter(Ve=>Ve.relationshipScore.status==="warm")),Te.map(Ve=>Ve.id)},[j,s,i,o]),ge=ne.indexOf(e||""),ie=ge>0?ne[ge-1]:null,fe=ge1&&ge!==-1,ye=Te=>{const Ve=new URLSearchParams;s&&Ve.set("search",s),i!=="all"&&Ve.set("type",i),o!=="all"&&Ve.set("status",o);const Fe=Ve.toString();return`/mission-control/contacts/${Te}${Fe?`?${Fe}`:""}`},Ie=I.useMemo(()=>{const Te=((x==null?void 0:x.filter(Fe=>Fe.contact_id===e))||[]).map(Fe=>{var Qe,Ee;const Me=ve(Fe.notes);return{id:Fe.id,type:"touch",completed_at:Fe.completed_at,name:((Qe=Fe.action_type)==null?void 0:Qe.name)||"Touch",color:((Ee=Fe.action_type)==null?void 0:Ee.color)||"#3B82F6",notes:Fe.notes,videoId:Me}}),Ve=((y==null?void 0:y.filter(Fe=>Fe.contact_id===e))||[]).map(Fe=>({id:Fe.id,type:"popby",completed_at:Fe.completed_at,name:"Pop-by",color:"#F97316",notes:Fe.notes,videoId:null}));return[...Te,...Ve].sort((Fe,Me)=>new Date(Me.completed_at).getTime()-new Date(Fe.completed_at).getTime())},[x,y,e]),Ne=()=>{var Te;l&&(z({first_name:l.first_name||"",last_name:l.last_name||"",email:l.email||"",phone:l.phone||"",address:l.address||"",city:l.city||"",state:l.state||"",zip_code:l.zip_code||"",birthday:l.birthday||"",home_anniversary:l.home_anniversary||"",spouse_name:l.spouse_name||"",spouse_email:l.spouse_email||"",company_name:l.company_name||"",job_title:l.job_title||"",notes:l.notes||"",tagIds:((Te=l.tags)==null?void 0:Te.map(Ve=>Ve.relationship_type_id))||[]}),T(!0))},we=async()=>{await N.mutateAsync({id:e,...L}),T(!1)},he=async()=>{confirm("Are you sure you want to delete this contact?")&&(await C.mutateAsync(e),t("/mission-control/contacts"))},xe=async()=>{H&&(await A.mutateAsync({contactId:e,actionTypeId:H,notes:Z}),q(!1),K(null),te(""))};return a?r.jsx(Or,{title:"Contact Details",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):l?r.jsx(Or,{title:`${l.first_name} ${l.last_name||""}`,description:"Contact details and activity",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/contacts"),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),de&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ie&&t(ye(ie)),disabled:!ie,className:"px-2",children:[r.jsx(qc,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only sm:not-sr-only sm:ml-1",children:"Prev"})]}),r.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[ge+1," of ",ne.length]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>fe&&t(ye(fe)),disabled:!fe,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Ka,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[r.jsxs(ee,{variant:"default",onClick:()=>t(`/mission-control/video/record?contact_id=${e}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Fi,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Br,{open:F,onOpenChange:q,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(jn,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:p==null?void 0:p.filter(Te=>Te.active).map(Te=>r.jsxs("button",{onClick:()=>K(Te.id),className:` p-3 rounded-lg border text-left transition-all ${H===Te.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Te.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Te.description})]},Te.id))})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(ps,{id:"action-notes",value:Z,onChange:Te=>te(Te.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(ee,{onClick:xe,disabled:!H||A.isPending,className:"w-full",children:[r.jsx(Ca,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(ee,{variant:"outline",onClick:Ne,children:[r.jsx(rc,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:he,children:r.jsx(Zn,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"bg-card border rounded-lg p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold",children:[l.first_name," ",l.last_name||""]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[l.email&&r.jsxs("a",{href:`mailto:${l.email}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(Ys,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.email})]}),l.phone&&r.jsxs("a",{href:`tel:${l.phone}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(ca,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.phone})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(dfe,{contact:l}),(be=l.tags)==null?void 0:be.map(Te=>{const Ve=h==null?void 0:h.find(Fe=>Fe.id===Te.relationship_type_id);return Ve?r.jsx(Rt,{variant:"secondary",className:"text-xs",children:Ve.name},Te.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ge,{className:"md:col-span-2",children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Contact Information"})}),r.jsx(Xe,{children:E?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"first_name",children:"First Name"}),r.jsx(at,{id:"first_name",value:L.first_name,onChange:Te=>z({...L,first_name:Te.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"last_name",children:"Last Name"}),r.jsx(at,{id:"last_name",value:L.last_name,onChange:Te=>z({...L,last_name:Te.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"email",children:"Email"}),r.jsx(at,{id:"email",type:"email",value:L.email,onChange:Te=>z({...L,email:Te.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"phone",children:"Phone"}),r.jsx(at,{id:"phone",value:L.phone,onChange:Te=>z({...L,phone:Te.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"address",children:"Street Address"}),r.jsx(at,{id:"address",value:L.address,onChange:Te=>z({...L,address:Te.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx(Ue,{htmlFor:"city",children:"City"}),r.jsx(at,{id:"city",value:L.city,onChange:Te=>z({...L,city:Te.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"state",children:"State"}),r.jsx(at,{id:"state",value:L.state,onChange:Te=>z({...L,state:Te.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(at,{id:"zip_code",value:L.zip_code,onChange:Te=>z({...L,zip_code:Te.target.value}),placeholder:"12345"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"birthday",children:"Birthday"}),r.jsx(at,{id:"birthday",type:"date",value:L.birthday,onChange:Te=>z({...L,birthday:Te.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(at,{id:"home_anniversary",type:"date",value:L.home_anniversary,onChange:Te=>z({...L,home_anniversary:Te.target.value})})]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(at,{id:"spouse_name",value:L.spouse_name,onChange:Te=>z({...L,spouse_name:Te.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(at,{id:"spouse_email",type:"email",value:L.spouse_email,onChange:Te=>z({...L,spouse_email:Te.target.value}),placeholder:"Enter spouse email"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"company_name",children:"Company"}),r.jsx(at,{id:"company_name",value:L.company_name,onChange:Te=>z({...L,company_name:Te.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"job_title",children:"Job Title"}),r.jsx(at,{id:"job_title",value:L.job_title,onChange:Te=>z({...L,job_title:Te.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:h==null?void 0:h.filter(Te=>Te.active).map(Te=>{var Ve;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(cc,{checked:(Ve=L.tagIds)==null?void 0:Ve.includes(Te.id),onCheckedChange:Fe=>{var Me;z(Fe?{...L,tagIds:[...L.tagIds||[],Te.id]}:{...L,tagIds:(Me=L.tagIds)==null?void 0:Me.filter(Qe=>Qe!==Te.id)})}}),r.jsx("span",{className:"text-sm",children:Te.name})]},Te.id)})})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:L.notes,onChange:Te=>z({...L,notes:Te.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{onClick:we,disabled:N.isPending,children:"Save Changes"}),r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ie.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",xn(new Date(Ie[0].completed_at),"MMM d, yyyy")," ","(",Ie[0].name,")"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[l.email&&r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(Ys,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`mailto:${l.email}`,className:"text-primary hover:underline truncate",children:l.email})]}),l.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ca,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`tel:${l.phone}`,className:"text-primary hover:underline",children:l.phone})]})]}),(l.address||l.city||l.state||l.zip_code)&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(ml,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{className:"flex flex-col",children:[l.address&&r.jsx("span",{children:l.address}),(l.city||l.state||l.zip_code)&&r.jsxs("span",{className:"text-muted-foreground",children:[[l.city,l.state].filter(Boolean).join(", "),l.zip_code&&` ${l.zip_code}`]})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.birthday&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",xn(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",xn(new Date(l.home_anniversary),"MMMM d")]})]})]}),(l.spouse_name||l.spouse_email||l.company_name||l.job_title)&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(l.spouse_name||l.spouse_email)&&r.jsxs("div",{className:"space-y-1",children:[l.spouse_name&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Spouse: ",l.spouse_name]})]}),l.spouse_email&&r.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[r.jsx(Ys,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:`mailto:${l.spouse_email}`,className:"text-primary hover:underline",children:l.spouse_email})]})]}),(l.company_name||l.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:l.job_title&&l.company_name?`${l.job_title} at ${l.company_name}`:l.job_title||l.company_name})]})]})]}),r.jsx(Qd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(Oe=l.tags)!=null&&Oe.length?l.tags.map(Te=>{var Ve;return r.jsx(Rt,{variant:"secondary",children:(Ve=Te.relationship_type)==null?void 0:Ve.name},Te.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:l.notes})]})]})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(qjt,{contact:l,onLogTouch:()=>q(!0)}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Activity Log"})}),r.jsx(Xe,{children:Ie.length>0?r.jsx("div",{className:"space-y-4",children:Ie.map(Te=>{var Ve;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[r.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:Te.color},children:Te.type==="popby"?r.jsx(Ha,{className:"h-4 w-4"}):(Ve=Te.name)==null?void 0:Ve.charAt(0)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:Te.name}),Te.videoId&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>le(Te.videoId),children:[r.jsx(dc,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:xn(new Date(Te.completed_at),"MMM d, yyyy h:mm a")}),Te.notes&&!Te.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Te.notes})]})]},Te.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),b&&b.length>0&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Po,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:b.map(Te=>{var Ve,Fe;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Ve=Te.video)!=null&&Ve.thumbnail_url?r.jsx("img",{src:Te.video.thumbnail_url,alt:Te.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>le(Te.video_id)}):r.jsx("div",{className:"h-12 w-16 bg-muted rounded flex items-center justify-center cursor-pointer hover:bg-muted/80 transition-colors",onClick:()=>le(Te.video_id),children:r.jsx(Fi,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:["Replied to: ",((Fe=Te.video)==null?void 0:Fe.title)||"Untitled Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>le(Te.video_id),children:[r.jsx(dc,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:xn(new Date(Te.created_at),"MMM d, yyyy h:mm a")}),Te.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Te.message,'"']})]})]},Te.id)})})})]})]}),r.jsx(Br,{open:!!ae,onOpenChange:Te=>!Te&&le(null),children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Video Preview"})}),ae&&r.jsx(ukt,{videoId:ae})]})})]})]})}):r.jsx(Or,{title:"Contact Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This contact was not found."}),r.jsx(ee,{onClick:()=>t("/mission-control/contacts"),children:"Back to Contacts"})]})})}const v4e={Crown:l1,FileText:wi,Users:Vn,Globe:Vx,Star:vs,Phone:ca,MessageSquare:Po,PenTool:_j,Video:Fi,Gift:Ha},zce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function fkt(){var jt,Nt;const e=ns(),{user:t}=zr(),{data:n}=Ug(),{data:s}=zft(),{data:i}=Wft(),{data:o}=xOe(),{data:l}=jxe(),{data:a}=Fft(),h=Gft(),p=Bft(),x=Uft(),y=qft(),b=Vft(),j=Hft(),N=$ft(),[C,A]=I.useState(null),[E,T]=I.useState(!1),[L,z]=I.useState(null),[F,q]=I.useState(""),[H,K]=I.useState(""),[Z,te]=I.useState([]),[ae,le]=I.useState(null),[ve,ne]=I.useState(null),[ge,ie]=I.useState(!1),[fe,de]=I.useState(""),[ye,Ie]=I.useState(""),[Ne,we]=I.useState(""),[he,xe]=I.useState(""),be=(Et,vt)=>i==null?void 0:i.some(rr=>rr.plan_id===Et&&rr.relationship_type_id===vt&&rr.active),Oe=Et=>i==null?void 0:i.find(vt=>vt.relationship_type_id===Et&&vt.active),Te=async(Et,vt)=>{const rr=be(Et,vt);await h.mutateAsync({planId:Et,relationshipTypeId:vt,active:!rr})},Ve=(s==null?void 0:s.filter(Et=>Et.active&&!Et.owner_user_id))||[],Fe=(s==null?void 0:s.filter(Et=>Et.owner_user_id===(t==null?void 0:t.id)))||[],Me=n==null?void 0:n.find(Et=>Et.id===C),Qe=C?Oe(C):null,Ee=s==null?void 0:s.find(Et=>Et.id===(Qe==null?void 0:Qe.plan_id)),Ye=async()=>{if(!F.trim())return;const Et=await p.mutateAsync({name:F,description:H});Et&&Z.length>0&&await b.mutateAsync({planId:Et.id,items:Z}),et()},me=async()=>{!F.trim()||!L||(await x.mutateAsync({id:L,name:F,description:H}),await b.mutateAsync({planId:L,items:Z}),et())},mt=Et=>{var vt;z(Et.id),q(Et.name),K(Et.description||""),te(((vt=Et.items)==null?void 0:vt.map(rr=>({month_number:rr.month_number,action_type_id:rr.action_type_id,default_script_id:rr.default_script_id||void 0,notes:rr.notes||void 0})))||[]),T(!0)},et=()=>{T(!1),z(null),q(""),K(""),te([])},nt=(Et,vt)=>{ne(vt)},Ae=(Et,vt,rr)=>{te(Ar=>[...Ar.filter(kn=>kn.month_number!==Et),{month_number:Et,action_type_id:vt,default_script_id:rr}]),le(null),ne(null)},ht=Et=>{te(vt=>vt.filter(rr=>rr.month_number!==Et))},$e=async()=>{if(!fe.trim()||!ye.trim()||!ve)return;const Et=await j.mutateAsync({actionTypeId:ve,title:fe,scriptBody:ye,emailSubject:Ne||void 0,tone:he||void 0});Et&&ae!==null&&Ae(ae,ve,Et.id),ie(!1),de(""),Ie(""),we(""),xe("")},Je=ve?a==null?void 0:a.filter(Et=>Et.action_type_id===ve&&Et.active):[],tt=Et=>v4e[Et||"Phone"]||ca,ft=Et=>v4e[Et||"Users"]||Vn;return r.jsxs(Or,{title:"Touchpoint Plans",description:"Assign plans to your contact groups",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Touchpoint Plans"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control"),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(ee,{onClick:()=>T(!0),className:"w-full sm:w-auto",children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Custom Plan"]})]}),r.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Your Contact Groups"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a group to assign a touchpoint plan"}),n==null?void 0:n.filter(Et=>Et.active).map(Et=>{const vt=ft(Et.icon),rr=(o==null?void 0:o[Et.id])||0,Ar=Oe(Et.id),yn=s==null?void 0:s.find(Jr=>Jr.id===(Ar==null?void 0:Ar.plan_id)),kn=C===Et.id;return r.jsxs("button",{onClick:()=>A(Et.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${kn?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(vt,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium",children:Et.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[rr," contacts"]})]}),yn?r.jsxs(Rt,{variant:"secondary",className:"text-xs",children:[r.jsx(qa,{className:"h-3 w-3 mr-1"}),yn.name.split(" ")[0]]}):r.jsx(Rt,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},Et.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:C&&Me?r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[(()=>{const Et=ft(Me.icon);return r.jsx(Et,{className:"h-5 w-5"})})(),Me.name," Touchpoint Plan"]}),r.jsxs(En,{children:["Choose a plan for your ",Me.name," contacts"]})]}),r.jsxs(Xe,{className:"space-y-6",children:[Ee&&r.jsxs("div",{className:"p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"font-medium flex items-center gap-2",children:[r.jsx(qa,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Ee.name]}),Ee.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ee.description})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>Te(Ee.id,C),children:"Disable"})]}),Ee.items&&Ee.items.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:zce.map((Et,vt)=>{var kn,Jr;const rr=((kn=Ee.items)==null?void 0:kn.filter(zn=>zn.month_number===vt+1))||[],Ar=(Jr=rr[0])==null?void 0:Jr.action_type,yn=Ar?tt(Ar.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${rr.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:Et}),yn&&r.jsx(yn,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Ar==null?void 0:Ar.color)||"#3B82F6"}})]},vt)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Ee?"Switch to a Different Plan":"Choose a Plan"}),Ve.length>0&&r.jsxs("div",{className:"space-y-2 mb-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"Pre-built Templates"}),Ve.map(Et=>{var rr;const vt=(Ee==null?void 0:Ee.id)===Et.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${vt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Et.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((rr=Et.items)==null?void 0:rr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:N.isPending,onClick:()=>{const Ar=`${Et.name} (Copy)`;N.mutate({sourcePlanId:Et.id,newName:Ar})},children:r.jsx(pl,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:vt?"outline":"default",disabled:vt||h.isPending,onClick:()=>Te(Et.id,C),children:vt?"Active":"Use This"})]})]},Et.id)})]}),Fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Fe.map(Et=>{var rr;const vt=(Ee==null?void 0:Ee.id)===Et.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${vt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Et.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((rr=Et.items)==null?void 0:rr.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>mt(Et),children:r.jsx(m0,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(Et.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})}),r.jsx(ee,{size:"sm",variant:vt?"outline":"default",disabled:vt||h.isPending,onClick:()=>Te(Et.id,C),children:vt?"Active":"Use This"})]})]},Et.id)})]}),Ve.length===0&&Fe.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No plans available. Create a custom plan to get started."})]})]})]}):r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(zs,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a contact group to view and assign plans"})]})})})]}),r.jsx(Ge,{className:"bg-muted/50",children:r.jsx(Xe,{className:"py-4",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.jsx("strong",{children:"How it works:"})," When you assign a plan to a contact group, those contacts will appear in your daily suggested actions based on the plan's schedule."]})})})]}),r.jsx(Br,{open:E,onOpenChange:Et=>{Et?T(!0):et()},children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:L?"Edit Touchpoint Plan":"Create Custom Touchpoint Plan"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(at,{id:"plan-name",value:F,onChange:Et=>q(Et.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(ps,{id:"plan-description",value:H,onChange:Et=>K(Et.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"12-Month Schedule"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Click on a month to add a touchpoint"}),r.jsx("div",{className:"grid grid-cols-6 gap-2",children:zce.map((Et,vt)=>{const rr=vt+1,Ar=Z.find(Jr=>Jr.month_number===rr),yn=Ar?l==null?void 0:l.find(Jr=>Jr.id===Ar.action_type_id):null,kn=yn?tt(yn.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>le(ae===rr?null:rr),className:` w-full p-3 rounded-lg border text-center transition-all ${Ar?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${ae===rr?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:Et}),kn?r.jsx(kn,{className:"h-5 w-5 mx-auto mt-1",style:{color:(yn==null?void 0:yn.color)||"#3B82F6"}}):r.jsx(jn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Ar&&r.jsx("button",{type:"button",onClick:Jr=>{Jr.stopPropagation(),ht(rr)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(bs,{className:"h-3 w-3"})})]},vt)})}),ae!==null&&!ve&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"text-sm font-medium mb-2",children:["Step 1: Select action for ",zce[ae-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(Et=>Et.active).map(Et=>{const vt=tt(Et.icon);return r.jsxs("button",{type:"button",onClick:()=>nt(ae,Et.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(vt,{className:"h-4 w-4",style:{color:Et.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:Et.name})]},Et.id)})})]}),ae!==null&&ve&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-sm font-medium",children:"Step 2: Select a script (optional)"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ne(null),children:[r.jsx(qc,{className:"h-4 w-4 mr-1"})," Back"]})]}),r.jsxs("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-1",children:[r.jsx("button",{type:"button",onClick:()=>Ae(ae,ve),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"No Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Use without a predefined script"})]})}),Je==null?void 0:Je.map(Et=>r.jsx("button",{type:"button",onClick:()=>Ae(ae,ve,Et.id),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:Et.title}),Et.tone&&r.jsx(Rt,{variant:"secondary",className:"text-xs mt-1",children:Et.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[Et.script_body.substring(0,100),"..."]})]})},Et.id)),r.jsxs("button",{type:"button",onClick:()=>ie(!0),className:"w-full flex items-center gap-3 p-3 rounded-lg border border-dashed bg-background hover:bg-accent transition-colors text-left",children:[r.jsx(jn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"Create Custom Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Write your own script for this action"})]})]})]})]})]}),Z.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.length," touchpoint",Z.length!==1?"s":""," per year"]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:et,children:"Cancel"}),r.jsxs(ee,{onClick:L?me:Ye,disabled:!F.trim()||p.isPending||x.isPending,children:[r.jsx(jg,{className:"h-4 w-4 mr-2"}),L?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Br,{open:ge,onOpenChange:ie,children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script-title",children:"Script Title"}),r.jsx(at,{id:"script-title",value:fe,onChange:Et=>de(Et.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(vn,{value:he,onValueChange:xe,children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select tone..."})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"friendly",children:"Friendly"}),r.jsx(Ht,{value:"professional",children:"Professional"}),r.jsx(Ht,{value:"casual",children:"Casual"}),r.jsx(Ht,{value:"formal",children:"Formal"})]})]})]}),((Nt=(jt=l==null?void 0:l.find(Et=>Et.id===ve))==null?void 0:jt.name)==null?void 0:Nt.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(at,{id:"script-email-subject",value:Ne,onChange:Et=>we(Et.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(Ue,{htmlFor:"script-body",children:"Script Content"}),r.jsx(ps,{id:"script-body",value:ye,onChange:Et=>Ie(Et.target.value),placeholder:"Write your script here... You can use {{FirstName}} and {{LastName}} as placeholders.",rows:6}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Tip: Use ","{{FirstName}}"," and ","{{LastName}}"," as placeholders"]})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>ie(!1),children:"Cancel"}),r.jsxs(ee,{onClick:$e,disabled:!fe.trim()||!ye.trim()||j.isPending,children:[r.jsx(jg,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const pkt="0dde5abb-0005-4c8c-a471-30d0cbc9e280",mkt=[{value:"30",label:"Monthly (30 days)"},{value:"60",label:"Bi-Monthly (60 days)"},{value:"90",label:"Quarterly (90 days)"},{value:"180",label:"Twice a Year (180 days)"},{value:"365",label:"Yearly (365 days)"}];function gkt(){const e=ns(),t=Oze(),{data:n}=Ize(),{data:s}=Ug(),{data:i}=Sye(),{data:o}=Zse(90),{data:l}=op(),a=$jt(),h=Dze(),p=zjt(),x=Bjt(),{data:y=[],isLoading:b}=Zt({queryKey:["popby-templates"],queryFn:async()=>{const{data:ge,error:ie}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",pkt).order("publish_date",{ascending:!1});if(ie)throw ie;const{data:fe}=await J.from("template_likes").select("template_id"),{data:de}=await J.from("template_comments").select("template_id"),ye=new Map;fe==null||fe.forEach(Ne=>{ye.set(Ne.template_id,(ye.get(Ne.template_id)||0)+1)});const Ie=new Map;return de==null||de.forEach(Ne=>{Ie.set(Ne.template_id,(Ie.get(Ne.template_id)||0)+1)}),(ge||[]).map(Ne=>({...Ne,likesCount:ye.get(Ne.id)||0,commentsCount:Ie.get(Ne.id)||0}))}}),j=ge=>{const ie=l==null?void 0:l.find(fe=>fe.id===ge);return ie?`${ie.first_name} ${ie.last_name||""}`.trim():"Unknown"},N=ge=>{if(!ge)return null;const ie=n==null?void 0:n.find(fe=>fe.id===ge);return(ie==null?void 0:ie.name)||null},[C,A]=I.useState(null),[E,T]=I.useState(!1),[L,z]=I.useState(!1),[F,q]=I.useState(!1),[H,K]=I.useState({popby_item_id:"",notes:""}),[Z,te]=I.useState({name:"",description:""}),ae=async()=>{C&&(await h.mutateAsync({contact_id:C.id,popby_item_id:H.popby_item_id||void 0,notes:H.notes||void 0}),T(!1),A(null),K({popby_item_id:"",notes:""}))},le=async()=>{Z.name.trim()&&(await p.mutateAsync({name:Z.name.trim(),description:Z.description.trim()||void 0}),q(!1),te({name:"",description:""}))},ve=async(ge,ie)=>{await x.mutateAsync({relationship_type_id:ge,frequency_days:parseInt(ie)})},ne=ge=>{var fe;const ie=i==null?void 0:i.find(de=>de.relationship_type_id===ge);return((fe=ie==null?void 0:ie.frequency_days)==null?void 0:fe.toString())||"90"};return r.jsx(Or,{title:"Popbys",description:"Drop off gifts to stay top of mind",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Popbys"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:a.thisWeekCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:a.thisMonthCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-amber-500",children:a.dueCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Now"})]})})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ee,{onClick:()=>e("/mission-control/popbys/map"),children:[r.jsx(ml,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(ee,{variant:"outline",onClick:()=>z(!0),children:[r.jsx(fd,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(ee,{variant:"outline",onClick:()=>q(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(ba,{defaultValue:"due",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"due",children:"Due for Popby"}),r.jsx(ln,{value:"activity",children:"Recent Activity"}),r.jsx(ln,{value:"library",children:"Popby Library"}),r.jsx(ln,{value:"templates",children:"Popby Templates"})]}),r.jsx(An,{value:"due",className:"space-y-4 mt-4",children:!t||t.length===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ha,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No contacts due for a popby right now!"}),r.jsx("p",{className:"text-sm mt-1",children:"Great job staying connected."})]})}):r.jsx("div",{className:"space-y-3",children:t.map(ge=>r.jsx(Ge,{className:"hover:shadow-md transition-shadow",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium",children:[ge.first_name," ",ge.last_name]}),ge.daysOverdue>0&&r.jsxs(Rt,{variant:"destructive",className:"text-xs",children:[ge.daysOverdue,"+ days overdue"]}),ge.daysSinceLastPopby===null&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Never visited"})]}),r.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-muted-foreground",children:[ge.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ml,{className:"h-3 w-3"}),ge.city||ge.address]}),ge.tags&&ge.tags.length>0&&r.jsx("span",{children:ge.tags.map(ie=>{var fe;return(fe=ie.relationship_type)==null?void 0:fe.name}).join(", ")})]}),ge.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",xn(new Date(ge.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[ge.phone&&r.jsx(ee,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${ge.phone}`,children:r.jsx(ca,{className:"h-4 w-4"})})}),r.jsxs(ee,{size:"sm",onClick:()=>{A(ge),T(!0)},children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},ge.id))})}),r.jsx(An,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ki,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby activity yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Start logging popbys to see your history here."})]})}):r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(Xe,{className:"space-y-3",children:o.map(ge=>r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:r.jsx(Ha,{className:"h-5 w-5 text-orange-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium",children:j(ge.contact_id)}),N(ge.popby_item_id)&&r.jsx(Rt,{variant:"secondary",className:"text-xs",children:N(ge.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:xn(new Date(ge.completed_at),"MMM d, yyyy h:mm a")}),ge.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ge.notes})]})]},ge.id))})]})}),r.jsx(An,{value:"library",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[n==null?void 0:n.map(ge=>r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Ha,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:ge.name}),ge.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ge.description}),!ge.owner_user_id&&r.jsx(Rt,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},ge.id)),r.jsx(Ge,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>q(!0),children:r.jsx(Xe,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(jn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(An,{value:"templates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:[y.length," template",y.length!==1?"s":""," found"]}),b&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(4)].map((ge,ie)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Pr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Pr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Pr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Pr,{className:"h-5 w-16"}),r.jsx(Pr,{className:"h-5 w-20"})]})]})},ie))}),!b&&y.length===0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Dl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby templates available yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!b&&y.length>0&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:y.map(ge=>r.jsxs(Ge,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>e(`/templates/${ge.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:ge.preview_image_url?r.jsx("img",{src:ge.preview_image_url,alt:ge.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"})}),r.jsxs(Xe,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:ge.name}),ge.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Ene(ge.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"PopBys"})}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),ge.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ol,{className:"h-3.5 w-3.5"}),ge.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:ie=>{ie.stopPropagation(),e(`/templates/${ge.id}`)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Template"]})]})]},ge.id))})]})]}),r.jsx(Br,{open:E,onOpenChange:T,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Log Popby for ",C==null?void 0:C.first_name," ",C==null?void 0:C.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Popby Item (optional)"}),r.jsxs(vn,{value:H.popby_item_id,onValueChange:ge=>K(ie=>({...ie,popby_item_id:ge})),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select a popby item..."})}),r.jsx(gn,{children:n==null?void 0:n.map(ge=>r.jsx(Ht,{value:ge.id,children:ge.name},ge.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:H.notes,onChange:ge=>K(ie=>({...ie,notes:ge.target.value}))})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(ee,{onClick:ae,disabled:h.isPending,children:"Log Popby"})]})]})}),r.jsx(Br,{open:L,onOpenChange:z,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Popby Frequency Settings"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Set default popby frequency for each relationship type. You can override these per-contact."}),s==null?void 0:s.map(ge=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(Ue,{className:"font-medium",children:ge.name}),r.jsxs(vn,{value:ne(ge.id),onValueChange:ie=>ve(ge.id,ie),children:[r.jsx(mn,{className:"w-[180px]",children:r.jsx(_n,{})}),r.jsx(gn,{children:mkt.map(ie=>r.jsx(Ht,{value:ie.value,children:ie.label},ie.value))})]})]},ge.id))]}),r.jsx(ri,{children:r.jsx(ee,{onClick:()=>z(!1),children:"Done"})})]})}),r.jsx(Br,{open:F,onOpenChange:q,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Name *"}),r.jsx(at,{placeholder:"e.g., Homemade cookies",value:Z.name,onChange:ge=>te(ie=>({...ie,name:ge.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(ps,{placeholder:"Optional description...",value:Z.description,onChange:ge=>te(ie=>({...ie,description:ge.target.value}))})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(ee,{onClick:le,disabled:!Z.name.trim()||p.isPending,children:"Add Item"})]})]})})]})})}var zze={exports:{}};(function(e,t){(function(n,s){e.exports=s()})(Ix,function(){var n,s,i;function o(a,h){if(!n)n=h;else if(!s)s=h;else{var p="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+n+")(sharedChunk); ("+s+")(sharedChunk); self.onerror = null;",x={};n(x),i=h(x),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([p],{type:"text/javascript"})))}}o(["exports"],function(a){var h=1e-6,p=typeof Float32Array<"u"?Float32Array:Array;function x(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=u*k-v*g;return S?(f[0]=k*(S=1/S),f[1]=-g*S,f[2]=-v*S,f[3]=u*S,f):null}function y(){var f=new p(9);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[5]=0,f[6]=0,f[7]=0),f[0]=1,f[4]=1,f[8]=1,f}function b(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=c[4],P=c[5],R=c[6],$=c[7],W=c[8];return f[0]=S*W-P*$,f[1]=v*$-g*W,f[2]=g*P-v*S,f[3]=P*R-k*W,f[4]=u*W-v*R,f[5]=v*k-u*P,f[6]=k*$-S*R,f[7]=g*R-u*$,f[8]=u*S-g*k,f}function j(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],P=c[4],R=c[5],$=c[6],W=c[7],G=c[8],X=u[0],re=u[1],se=u[2],pe=u[3],Ce=u[4],Se=u[5],De=u[6],Be=u[7],We=u[8];return f[0]=X*g+re*S+se*$,f[1]=X*v+re*P+se*W,f[2]=X*k+re*R+se*G,f[3]=pe*g+Ce*S+Se*$,f[4]=pe*v+Ce*P+Se*W,f[5]=pe*k+Ce*R+Se*G,f[6]=De*g+Be*S+We*$,f[7]=De*v+Be*P+We*W,f[8]=De*k+Be*R+We*G,f}function N(){var f=new p(16);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=0,f[12]=0,f[13]=0,f[14]=0),f[0]=1,f[5]=1,f[10]=1,f[15]=1,f}function C(f){var c=new p(16);return c[0]=f[0],c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=f[6],c[7]=f[7],c[8]=f[8],c[9]=f[9],c[10]=f[10],c[11]=f[11],c[12]=f[12],c[13]=f[13],c[14]=f[14],c[15]=f[15],c}function A(f){return f[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function E(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=c[4],P=c[5],R=c[6],$=c[7],W=c[8],G=c[9],X=c[10],re=c[11],se=c[12],pe=c[13],Ce=c[14],Se=c[15],De=u*P-g*S,Be=u*R-v*S,We=u*$-k*S,dt=g*R-v*P,it=g*$-k*P,gt=v*$-k*R,St=W*pe-G*se,Tt=W*Ce-X*se,Kt=W*Se-re*se,Dt=G*Ce-X*pe,tr=G*Se-re*pe,or=X*Se-re*Ce,lr=De*or-Be*tr+We*Dt+dt*Kt-it*Tt+gt*St;return lr?(f[0]=(P*or-R*tr+$*Dt)*(lr=1/lr),f[1]=(v*tr-g*or-k*Dt)*lr,f[2]=(pe*gt-Ce*it+Se*dt)*lr,f[3]=(X*it-G*gt-re*dt)*lr,f[4]=(R*Kt-S*or-$*Tt)*lr,f[5]=(u*or-v*Kt+k*Tt)*lr,f[6]=(Ce*We-se*gt-Se*Be)*lr,f[7]=(W*gt-X*We+re*Be)*lr,f[8]=(S*tr-P*Kt+$*St)*lr,f[9]=(g*Kt-u*tr-k*St)*lr,f[10]=(se*it-pe*We+Se*De)*lr,f[11]=(G*We-W*it-re*De)*lr,f[12]=(P*Tt-S*Dt-R*St)*lr,f[13]=(u*Dt-g*Tt+v*St)*lr,f[14]=(pe*Be-se*dt-Ce*De)*lr,f[15]=(W*dt-G*Be+X*De)*lr,f):null}function T(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],P=c[4],R=c[5],$=c[6],W=c[7],G=c[8],X=c[9],re=c[10],se=c[11],pe=c[12],Ce=c[13],Se=c[14],De=c[15],Be=u[0],We=u[1],dt=u[2],it=u[3];return f[0]=Be*g+We*P+dt*G+it*pe,f[1]=Be*v+We*R+dt*X+it*Ce,f[2]=Be*k+We*$+dt*re+it*Se,f[3]=Be*S+We*W+dt*se+it*De,f[4]=(Be=u[4])*g+(We=u[5])*P+(dt=u[6])*G+(it=u[7])*pe,f[5]=Be*v+We*R+dt*X+it*Ce,f[6]=Be*k+We*$+dt*re+it*Se,f[7]=Be*S+We*W+dt*se+it*De,f[8]=(Be=u[8])*g+(We=u[9])*P+(dt=u[10])*G+(it=u[11])*pe,f[9]=Be*v+We*R+dt*X+it*Ce,f[10]=Be*k+We*$+dt*re+it*Se,f[11]=Be*S+We*W+dt*se+it*De,f[12]=(Be=u[12])*g+(We=u[13])*P+(dt=u[14])*G+(it=u[15])*pe,f[13]=Be*v+We*R+dt*X+it*Ce,f[14]=Be*k+We*$+dt*re+it*Se,f[15]=Be*S+We*W+dt*se+it*De,f}function L(f,c,u){var g,v,k,S,P,R,$,W,G,X,re,se,pe=u[0],Ce=u[1],Se=u[2];return c===f?(f[12]=c[0]*pe+c[4]*Ce+c[8]*Se+c[12],f[13]=c[1]*pe+c[5]*Ce+c[9]*Se+c[13],f[14]=c[2]*pe+c[6]*Ce+c[10]*Se+c[14],f[15]=c[3]*pe+c[7]*Ce+c[11]*Se+c[15]):(v=c[1],k=c[2],S=c[3],P=c[4],R=c[5],$=c[6],W=c[7],G=c[8],X=c[9],re=c[10],se=c[11],f[0]=g=c[0],f[1]=v,f[2]=k,f[3]=S,f[4]=P,f[5]=R,f[6]=$,f[7]=W,f[8]=G,f[9]=X,f[10]=re,f[11]=se,f[12]=g*pe+P*Ce+G*Se+c[12],f[13]=v*pe+R*Ce+X*Se+c[13],f[14]=k*pe+$*Ce+re*Se+c[14],f[15]=S*pe+W*Ce+se*Se+c[15]),f}function z(f,c,u){var g=u[0],v=u[1],k=u[2];return f[0]=c[0]*g,f[1]=c[1]*g,f[2]=c[2]*g,f[3]=c[3]*g,f[4]=c[4]*v,f[5]=c[5]*v,f[6]=c[6]*v,f[7]=c[7]*v,f[8]=c[8]*k,f[9]=c[9]*k,f[10]=c[10]*k,f[11]=c[11]*k,f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15],f}function F(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[4],S=c[5],P=c[6],R=c[7],$=c[8],W=c[9],G=c[10],X=c[11];return c!==f&&(f[0]=c[0],f[1]=c[1],f[2]=c[2],f[3]=c[3],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[4]=k*v+$*g,f[5]=S*v+W*g,f[6]=P*v+G*g,f[7]=R*v+X*g,f[8]=$*v-k*g,f[9]=W*v-S*g,f[10]=G*v-P*g,f[11]=X*v-R*g,f}function q(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],S=c[1],P=c[2],R=c[3],$=c[8],W=c[9],G=c[10],X=c[11];return c!==f&&(f[4]=c[4],f[5]=c[5],f[6]=c[6],f[7]=c[7],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v-$*g,f[1]=S*v-W*g,f[2]=P*v-G*g,f[3]=R*v-X*g,f[8]=k*g+$*v,f[9]=S*g+W*v,f[10]=P*g+G*v,f[11]=R*g+X*v,f}function H(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],S=c[1],P=c[2],R=c[3],$=c[4],W=c[5],G=c[6],X=c[7];return c!==f&&(f[8]=c[8],f[9]=c[9],f[10]=c[10],f[11]=c[11],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v+$*g,f[1]=S*v+W*g,f[2]=P*v+G*g,f[3]=R*v+X*g,f[4]=$*v-k*g,f[5]=W*v-S*g,f[6]=G*v-P*g,f[7]=X*v-R*g,f}function K(f,c){return f[0]=c[0],f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=c[1],f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=c[2],f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function Z(f,c,u){var g,v,k,S=u[0],P=u[1],R=u[2],$=Math.sqrt(S*S+P*P+R*R);return $0&&(k=1/Math.sqrt(k)),f[0]=c[0]*k,f[1]=c[1]*k,f[2]=c[2]*k,f}function Me(f,c){return f[0]*c[0]+f[1]*c[1]+f[2]*c[2]}function Qe(f,c,u){var g=c[0],v=c[1],k=c[2],S=u[0],P=u[1],R=u[2];return f[0]=v*R-k*P,f[1]=k*S-g*R,f[2]=g*P-v*S,f}function Ee(f,c,u,g){var v=c[0],k=c[1],S=c[2];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=S+g*(u[2]-S),f}function Ye(f,c,u){var g=c[0],v=c[1],k=c[2],S=u[3]*g+u[7]*v+u[11]*k+u[15];return f[0]=(u[0]*g+u[4]*v+u[8]*k+u[12])/(S=S||1),f[1]=(u[1]*g+u[5]*v+u[9]*k+u[13])/S,f[2]=(u[2]*g+u[6]*v+u[10]*k+u[14])/S,f}function me(f,c,u){var g=c[0],v=c[1],k=c[2];return f[0]=g*u[0]+v*u[3]+k*u[6],f[1]=g*u[1]+v*u[4]+k*u[7],f[2]=g*u[2]+v*u[5]+k*u[8],f}function mt(f,c,u){var g=u[0],v=u[1],k=u[2],S=u[3],P=c[0],R=c[1],$=c[2],W=v*$-k*R,G=k*P-g*$,X=g*R-v*P;return f[0]=P+S*(W+=W)+v*(X+=X)-k*(G+=G),f[1]=R+S*G+k*W-g*X,f[2]=$+S*X+g*G-v*W,f}function et(f){return f[0]=0,f[1]=0,f[2]=0,f}function nt(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var Ae=ye,ht=Ie,$e=ge;function Je(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function tt(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f[2]=c[2]*u,f[3]=c[3]*u,f}function ft(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=u*u+g*g+v*v+k*k;return S>0&&(S=1/Math.sqrt(S)),f[0]=u*S,f[1]=g*S,f[2]=v*S,f[3]=k*S,f}function jt(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3];return f[0]=u[0]*g+u[4]*v+u[8]*k+u[12]*S,f[1]=u[1]*g+u[5]*v+u[9]*k+u[13]*S,f[2]=u[2]*g+u[6]*v+u[10]*k+u[14]*S,f[3]=u[3]*g+u[7]*v+u[11]*k+u[15]*S,f}function Nt(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),f[3]=1,f}function Et(f){return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f}function vt(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R+S*P,f[1]=v*R+k*P,f[2]=k*R-v*P,f[3]=S*R-g*P,f}function rr(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R-k*P,f[1]=v*R+S*P,f[2]=k*R+g*P,f[3]=S*R-v*P,f}ve(),Je();var Ar,yn,kn,Jr=ft,zn=(Ar=ve(),yn=ie(1,0,0),kn=ie(0,1,0),function(f,c,u){var g=Me(c,u);return g<-.999999?(Qe(Ar,yn,c),$e(Ar)<1e-6&&Qe(Ar,kn,c),Fe(Ar,Ar),function(v,k,S){S*=.5;var P=Math.sin(S);v[0]=P*k[0],v[1]=P*k[1],v[2]=P*k[2],v[3]=Math.cos(S)}(f,Ar,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(Qe(Ar,c,u),f[0]=Ar[0],f[1]=Ar[1],f[2]=Ar[2],f[3]=1+g,Jr(f,f))});function ks(){var f=new p(2);return p!=Float32Array&&(f[0]=0,f[1]=0),f}function fr(f,c){var u=new p(2);return u[0]=f,u[1]=c,u}function xs(f,c,u){return f[0]=c,f[1]=u,f}function ji(f,c,u){return f[0]=c[0]+u[0],f[1]=c[1]+u[1],f}function mi(f,c,u){return f[0]=c[0]-u[0],f[1]=c[1]-u[1],f}function La(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f}function da(f){var c=f[0],u=f[1];return Math.sqrt(c*c+u*u)}function tl(f,c){var u=c[0],g=c[1],v=u*u+g*g;return v>0&&(v=1/Math.sqrt(v)),f[0]=c[0]*v,f[1]=c[1]*v,f}function rl(f,c){return f[0]*c[0]+f[1]*c[1]}Nt(),Nt(),y();var Gs,Zi,Ns=mi;function Ei(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}ks();var Ii=function(){if(Zi)return Gs;function f(c,u,g,v){this.cx=3*c,this.bx=3*(g-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*u,this.by=3*(v-u)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=u,this.p2x=g,this.p2y=v}return Zi=1,Gs=f,f.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,u){if(u===void 0&&(u=1e-6),c<0)return 0;if(c>1)return 1;for(var g=c,v=0;v<8;v++){var k=this.sampleCurveX(g)-c;if(Math.abs(k)k?P=g:R=g,g=.5*(R-P)+P;return g},solve:function(c,u){return this.sampleCurveY(this.solveCurveX(c,u))}},Gs}(),Oo=Ei(Ii);function ir(f,c){this.x=f,this.y=c}function xo(f,c){if(Array.isArray(f)){if(!Array.isArray(c)||f.length!==c.length)return!1;for(let u=0;u=1)return 1;const c=f*f,u=c*f;return 4*(f<.5?u:3*(f-c)+u-.75)}function Hn(f,c,u,g){const v=new Oo(f,c,u,g);return function(k){return v.solve(k)}}const kt=Hn(.25,.1,.25,1);function je(f,c,u){return Math.min(u,Math.max(c,f))}function Re(f,c,u){return(u=je((u-f)/(c-f),0,1))*u*(3-2*u)}function Ke(f,c,u){const g=u-c,v=((f-c)%g+g)%g+c;return v===c?u:v}function bt(f,c,u){if(!f.length)return u(null,[]);let g=f.length;const v=new Array(f.length);let k=null;f.forEach((S,P)=>{c(S,(R,$)=>{R&&(k=R),v[P]=$,--g==0&&u(k,v)})})}let yt=1;function At(){return yt++}function Bt(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log2(f)))}function Lt(f,c){f.forEach(u=>{c[u]&&(c[u]=c[u].bind(c))})}function Ut(f,c,u){const g={};for(const v in f)g[v]=c.call(this,f[v],v,f);return g}function gr(f,c,u){const g={};for(const v in f)c.call(this,f[v],v,f)&&(g[v]=f[v]);return g}function ar(f){return Array.isArray(f)?f.map(ar):typeof f=="object"&&f?Ut(f,ar):f}function Xr(f,c){for(let u=0;u=0)return!0;return!1}const tn={};function Vr(f){tn[f]||(typeof console<"u"&&console.warn(f),tn[f]=!0)}function ts(f,c,u){return(u.y-f.y)*(c.x-f.x)>(c.y-f.y)*(u.x-f.x)}function Xn(f){let c=0;for(let u,g,v=0,k=f.length,S=k-1;v@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(u,g,v,k)=>{const S=v||k;return c[g]=!S||S.toLowerCase(),""}),c["max-age"]){const u=parseInt(c["max-age"],10);isNaN(u)?delete c["max-age"]:c["max-age"]=u}return c}let Za=null;function Oa(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function fo(f,c,u,g){for(;c>1;f[v]>1;f[v]<=g?c=v+1:u=v}return c}function Ks(f){return f>0?1/(1.001-f):1+f}function ma(f){return f>0?1-1/(1.001-f):-f}function zi(f,c,u){return(f-c.min)*(u.max-u.min)/(c.max-c.min)+u.min}const Ms={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(!Ms.API_URL)return null;try{const f=new URL(Ms.API_URL);return f.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":f.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Ba(f){return Ms.API_URL_REGEX.test(f)}function Nl(f){return Ms.API_SPRITE_REGEX.test(f)}let Fl,Ac,dp,nl,_d,sl;function au(){return Fl==null&&(Fl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Fl}const Bo={now:()=>nl!==void 0?nl:performance.now(),setNow(f){nl=f},restoreNow(){nl=void 0},frame(f){const c=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(f,c=0){const{width:u,height:g}=f;_d||(_d=document.createElement("canvas"));const v=_d.getContext("2d",{willReadFrequently:!0});if(!v)throw new Error("failed to create canvas 2d context");return(u>_d.width||g>_d.height)&&(_d.width=u,_d.height=g),v.clearRect(-c,-c,u+2*c,g+2*c),v.drawImage(f,0,0,u,g),v.getImageData(-c,-c,u+2*c,g+2*c)},resolveURL:f=>(Ac||(Ac=document.createElement("a")),Ac.href=f,Ac.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(dp==null&&(dp=window.matchMedia("(prefers-reduced-motion: reduce)")),dp.matches)},hasCanvasFingerprintNoise(){if(sl!==void 0)return sl;if(!au())return sl=!1,!1;const f=new OffscreenCanvas(85,1),c=f.getContext("2d",{willReadFrequently:!0});let u=0;for(let v=0;v0?`?${k}`:""}`}const Jl="mapbox-tiles";let up=500,Em=50;const Kc=["language","worldview","jobid"];let Hu,Ec;function Zc(){try{return caches}catch{}}function bd(){const f=Zc();f&&Hu==null&&(Hu=f.open(Jl))}let $d=1/0;const ou={supported:!1,testSupport:function(f){!by&&hp&&(fp?fk(f):Wu=f)}};let Wu,hp,by=!1,fp=!1;const pp=typeof self<"u"?self:{};function fk(f){const c=f.createTexture();f.bindTexture(f.TEXTURE_2D,c);try{if(f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,hp),f.isContextLost())return;ou.supported=!0}catch{}f.deleteTexture(c),by=!0}pp.document&&(hp=pp.document.createElement("img"),hp.onload=function(){Wu&&fk(Wu),Wu=null,fp=!0},hp.onerror=function(){by=!0,Wu=null},hp.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Hg={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(Hg);class Yc extends Error{constructor(c,u,g){u===401&&Ba(g)&&(c+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(c),this.status=u,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const wy=Bs()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,mp=function(f,c){if(!(/^file:/.test(u=f.url)||/^file:/.test(wy())&&!/^\w+:/.test(u))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,v){const k=new AbortController,S=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:wy(),referrerPolicy:g.referrerPolicy,signal:k.signal});let P=!1,R=!1;const $=(W=S.url).indexOf("sku=")>0&&Ba(W);var W;g.type==="json"&&S.headers.set("Accept","application/json");const G=(re,se,pe)=>{if(R)return;if(re&&re.message!=="SecurityError"&&Vr(re.toString()),se&&pe)return X(se);const Ce=Date.now();fetch(S).then(Se=>{if(Se.ok){const De=$?Se.clone():null;return X(Se,De,Ce)}return v(new Yc(Se.statusText,Se.status,g.url))}).catch(Se=>{Se.name!=="AbortError"&&v(new Error(`${Se.message} ${g.url}`))})},X=(re,se,pe)=>{(g.type==="arrayBuffer"?re.arrayBuffer():g.type==="json"?re.json():re.text()).then(Ce=>{R||(se&&pe&&function(Se,De,Be){if(bd(),Hu==null)return;const We=Ta(De.headers.get("Cache-Control")||"");if(We["no-store"])return;const dt={status:De.status,statusText:De.statusText,headers:new Headers};De.headers.forEach((St,Tt)=>dt.headers.set(Tt,St)),We["max-age"]&&dt.headers.set("Expires",new Date(Be+1e3*We["max-age"]).toUTCString());const it=dt.headers.get("Expires");if(!it||new Date(it).getTime()-Be<42e4)return;let gt=Vu(Se.url,{persistentParams:Kc});if(De.status===206){const St=Se.headers.get("Range");if(!St)return;dt.status=200,gt=uf(gt,{range:St})}(function(St,Tt){if(Ec===void 0)try{new Response(new ReadableStream),Ec=!0}catch{Ec=!1}Ec?Tt(St.body):St.blob().then(Tt).catch(Kt=>Vr(Kt.message))})(De,St=>{const Tt=new Response((Kt=De.status)!==200&&Kt!==404&&[101,103,204,205,304].includes(Kt)?null:St,dt);var Kt;bd(),Hu!=null&&Hu.then(Dt=>Dt.put(gt,Tt)).catch(Dt=>Vr(Dt.message))})}(S,se,pe),P=!0,v(null,Ce,re.headers))}).catch(Ce=>{R||v(new Error(Ce.message))})};return $?function(re,se){if(bd(),Hu==null)return se(null);Hu.then(pe=>{let Ce=Vu(re.url,{persistentParams:Kc});const Se=re.headers.get("Range");Se&&(Ce=uf(Ce,{range:Se})),pe.match(Ce).then(De=>{const Be=function(We){if(!We)return!1;const dt=new Date(We.headers.get("Expires")||0),it=Ta(We.headers.get("Cache-Control")||"");return Number(dt)>Date.now()&&!it["no-cache"]}(De);pe.delete(Ce).catch(se),Be&&pe.put(Ce,De.clone()).catch(se),se(null,De,Be)}).catch(se)}).catch(se)}(S,G):G(null,null),{cancel:()=>{R=!0,P||k.abort()}}}(f,c);if(Bs(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,c,void 0,!0)}var u;return function(g,v){const k=new XMLHttpRequest;k.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(k.responseType="arraybuffer");for(const S in g.headers)k.setRequestHeader(S,g.headers[S]);return g.type==="json"&&(k.responseType="text",k.setRequestHeader("Accept","application/json")),k.withCredentials=g.credentials==="include",k.onerror=()=>{v(new Error(k.statusText))},k.onload=()=>{if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let S=k.response;if(g.type==="json")try{S=JSON.parse(k.response)}catch(R){return v(R)}const P=new Headers;k.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(R=>{const $=R.split(": "),W=$.shift(),G=$.join(": ");P.append(W,G)}),v(null,S,P)}else v(new Yc(k.statusText,k.status,g.url))},k.send(g.body),{cancel:()=>k.abort()}}(f,c)},Gu=function(f,c){return mp(Object.assign(f,{type:"arrayBuffer"}),c)};function A3(f){const c=document.createElement("a");return c.href=f,c.protocol===location.protocol&&c.host===location.host}const Ct="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Cr,dr;Cr=[],dr=0;const ws=function(f,c){if(ou.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),dr>=Ms.MAX_PARALLEL_IMAGE_REQUESTS){const k={requestParameters:f,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return Cr.push(k),k}dr++;let u=!1;const g=()=>{if(!u)for(u=!0,dr--;Cr.length&&dr{g(),k?c(k):S&&(self.createImageBitmap?function(R,$){const W=new Blob([new Uint8Array(R)],{type:"image/png"});createImageBitmap(W).then(G=>{$(null,G)}).catch(G=>{$(new Error(`Could not load image because of ${G.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(S,(R,$)=>c(R,$,P)):function(R,$){const W=new Image;W.onload=()=>{$(null,W),URL.revokeObjectURL(W.src),W.onload=null,requestAnimationFrame(()=>{W.src=Ct})},W.onerror=()=>$(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 G=new Blob([new Uint8Array(R)],{type:"image/png"});W.src=R.byteLength?URL.createObjectURL(G):Ct}(S,(R,$)=>c(R,$,P)))});return{cancel:()=>{v.cancel(),g()}}};var $s,Mo,io,ao={exports:{}},Wg={exports:{}},mv={exports:{}},E3=function(){if(io)return ao.exports;io=1;var f=($s||($s=1,Wg.exports=function(u,g){var v,k,S,P,R,$,W,G;for(k=u.length-(v=3&u.length),S=g,R=3432918353,$=461845907,G=0;G>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295)<<13|S>>>19))+((5*(S>>>16)&65535)<<16)&4294967295))+((58964+(P>>>16)&65535)<<16);switch(W=0,v){case 3:W^=(255&u.charCodeAt(G+2))<<16;case 2:W^=(255&u.charCodeAt(G+1))<<8;case 1:S^=W=(65535&(W=(W=(65535&(W^=255&u.charCodeAt(G)))*R+(((W>>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295}return S^=u.length,S=2246822507*(65535&(S^=S>>>16))+((2246822507*(S>>>16)&65535)<<16)&4294967295,S=3266489909*(65535&(S^=S>>>13))+((3266489909*(S>>>16)&65535)<<16)&4294967295,(S^=S>>>16)>>>0}),Wg.exports),c=(Mo||(Mo=1,mv.exports=function(u,g){for(var v,k=u.length,S=g^k,P=0;k>=4;)v=1540483477*(65535&(v=255&u.charCodeAt(P)|(255&u.charCodeAt(++P))<<8|(255&u.charCodeAt(++P))<<16|(255&u.charCodeAt(++P))<<24))+((1540483477*(v>>>16)&65535)<<16),S=1540483477*(65535&S)+((1540483477*(S>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),k-=4,++P;switch(k){case 3:S^=(255&u.charCodeAt(P+2))<<16;case 2:S^=(255&u.charCodeAt(P+1))<<8;case 1:S=1540483477*(65535&(S^=255&u.charCodeAt(P)))+((1540483477*(S>>>16)&65535)<<16)}return S=1540483477*(65535&(S^=S>>>13))+((1540483477*(S>>>16)&65535)<<16),(S^=S>>>15)>>>0}),mv.exports);return ao.exports=f,ao.exports.murmur3=f,ao.exports.murmur2=c,ao.exports}(),pk=Ei(E3);class hf{constructor(c,...u){Object.assign(this,u[0]||{}),this.type=c}}class gv extends hf{constructor(c,u={}){super("error",Object.assign({error:c},u))}}function I3(f,c,u){u[f]&&u[f].indexOf(c)!==-1||(u[f]=u[f]||[],u[f].push(c))}function Im(f,c,u){if(u&&u[f]){const g=u[f].indexOf(c);g!==-1&&u[f].splice(g,1)}}class Gg{on(c,u){return this._listeners=this._listeners||{},I3(c,u,this._listeners),this}off(c,u){return Im(c,u,this._listeners),Im(c,u,this._oneTimeListeners),this}once(c,u){return u?(this._oneTimeListeners=this._oneTimeListeners||{},I3(c,u,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,u){const g=typeof c=="string"?new hf(c,u):c,v=g.type;if(this.listens(v)){g.target=this;const k=this._listeners&&this._listeners[v]?this._listeners[v].slice():[];for(const R of k)R.call(this,g);const S=this._oneTimeListeners&&this._oneTimeListeners[v]?this._oneTimeListeners[v].slice():[];for(const R of S)Im(v,R,this._oneTimeListeners),R.call(this,g);const P=this._eventedParent;if(P){const R=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,R),P.fire(g)}}else g instanceof gv&&console.error(g.error);return this}listens(c){return!!(this._listeners&&this._listeners[c]&&this._listeners[c].length>0||this._oneTimeListeners&&this._oneTimeListeners[c]&&this._oneTimeListeners[c].length>0||this._eventedParent&&this._eventedParent.listens(c))}setEventedParent(c,u){return this._eventedParent=c,this._eventedParentData=u,this}}class Ic{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new Ic(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[u,g]=c.split("");return new Ic({name:u,iconsetId:g})}static isEqual(c,u){return c.name===u.name&&c.iconsetId===u.iconsetId}toString(){return Ic.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var mk,xv={},Ku=function(){if(mk)return xv;mk=1;var f={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 c(k){return(k=Math.round(k))<0?0:k>255?255:k}function u(k){return c(k[k.length-1]==="%"?parseFloat(k)/100*255:parseInt(k))}function g(k){return(S=k[k.length-1]==="%"?parseFloat(k)/100:parseFloat(k))<0?0:S>1?1:S;var S}function v(k,S,P){return P<0?P+=1:P>1&&(P-=1),6*P<1?k+(S-k)*P*6:2*P<1?S:3*P<2?k+(S-k)*(2/3-P)*6:k}try{xv.parseCSSColor=function(k){var S,P=k.replace(/ /g,"").toLowerCase();if(P in f)return f[P].slice();if(P[0]==="#")return P.length===4?(S=parseInt(P.substr(1),16))>=0&&S<=4095?[(3840&S)>>4|(3840&S)>>8,240&S|(240&S)>>4,15&S|(15&S)<<4,1]:null:P.length===7&&(S=parseInt(P.substr(1),16))>=0&&S<=16777215?[(16711680&S)>>16,(65280&S)>>8,255&S,1]:null;var R=P.indexOf("("),$=P.indexOf(")");if(R!==-1&&$+1===P.length){var W=P.substr(0,R),G=P.substr(R+1,$-(R+1)).split(","),X=1;switch(W){case"rgba":if(G.length!==4)return null;X=g(G.pop());case"rgb":return G.length!==3?null:[u(G[0]),u(G[1]),u(G[2]),X];case"hsla":if(G.length!==4)return null;X=g(G.pop());case"hsl":if(G.length!==3)return null;var re=(parseFloat(G[0])%360+360)%360/360,se=g(G[1]),pe=g(G[2]),Ce=pe<=.5?pe*(se+1):pe+se-pe*se,Se=2*pe-Ce;return[c(255*v(Se,Ce,re+1/3)),c(255*v(Se,Ce,re)),c(255*v(Se,Ce,re-1/3)),X];default:return null}}return null}}catch{}return xv}();class ki{constructor(c,u,g,v=1){this.r=c,this.g=u,this.b=g,this.a=v}static parse(c){if(!c)return;if(c instanceof ki)return c;if(typeof c!="string")return;const u=Ku.parseCSSColor(c);return u?new ki(u[0]/255,u[1]/255,u[2]/255,u[3]):void 0}toString(){const[c,u,g,v]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*u)},${Math.round(255*g)},${v})`}toNonPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new KI(c,u,g,v,k)}toPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new ZI(c,u*k,g*k,v*k,k)}clone(){return new ki(this.r,this.g,this.b,this.a)}}class GI{constructor(c,u,g,v,k,S=!1){if(this.premultiplied=!1,this.premultiplied=S,c){const P=c.image.height,R=P*P;this.premultiplied?(u=k===0?0:u/k*(P-1),g=k===0?0:g/k*(P-1),v=k===0?0:v/k*(P-1)):(u*=P-1,g*=P-1,v*=P-1);const $=Math.floor(u),W=Math.floor(g),G=Math.floor(v),X=Math.ceil(u),re=Math.ceil(g),se=Math.ceil(v),pe=u-$,Ce=g-W,Se=v-G,De=c.image.data,Be=4*($+W*R+G*P),We=4*($+W*R+se*P),dt=4*($+re*R+G*P),it=4*($+re*R+se*P),gt=4*(X+W*R+G*P),St=4*(X+W*R+se*P),Tt=4*(X+re*R+G*P),Kt=4*(X+re*R+se*P);if(Be<0||Kt>=De.length)throw new Error("out of range");this.r=Fn(Fn(Fn(De[Be],De[We],Se),Fn(De[dt],De[it],Se),Ce),Fn(Fn(De[gt],De[St],Se),Fn(De[Tt],De[Kt],Se),Ce),pe)/255*(this.premultiplied?k:1),this.g=Fn(Fn(Fn(De[Be+1],De[We+1],Se),Fn(De[dt+1],De[it+1],Se),Ce),Fn(Fn(De[gt+1],De[St+1],Se),Fn(De[Tt+1],De[Kt+1],Se),Ce),pe)/255*(this.premultiplied?k:1),this.b=Fn(Fn(Fn(De[Be+2],De[We+2],Se),Fn(De[dt+2],De[it+2],Se),Ce),Fn(Fn(De[gt+2],De[St+2],Se),Fn(De[Tt+2],De[Kt+2],Se),Ce),pe)/255*(this.premultiplied?k:1),this.a=k}else this.r=u,this.g=g,this.b=v,this.a=k}toArray(){const{r:c,g:u,b:g,a:v}=this;return[255*c,255*u,255*g,v]}toHslaArray(){let{r:c,g:u,b:g,a:v}=this;if(this.premultiplied){if(v===0)return[0,0,0,0];const se=1/v;c*=se,u*=se,g*=se}const k=Math.min(Math.max(c,0),1),S=Math.min(Math.max(u,0),1),P=Math.min(Math.max(g,0),1),R=Math.min(k,S,P),$=Math.max(k,S,P),W=$-R,G=.5*(R+$);if(W===0)return[0,0,100*G,v];const X=G>.5?W/(2-$-R):W/($+R);let re;switch($){case k:re=60*((S-P)/W+(SFn(g,c[v],u))}ki.black=new ki(0,0,0,1),ki.white=new ki(1,1,1,1),ki.transparent=new ki(0,0,0,0),ki.red=new ki(1,0,0,1),ki.blue=new ki(0,0,1,1);var yv=Object.freeze({__proto__:null,array:P3,color:function(f,c,u){return new ki(Fn(f.r,c.r,u),Fn(f.g,c.g,u),Fn(f.b,c.b,u),Fn(f.a,c.a,u))},number:Fn});class Zu extends Error{constructor(c,u){super(u),this.message=u,this.key=c}}class jy{constructor(c,u=[]){this.parent=c,this.bindings={};for(const[g,v]of u)this.bindings[g]=v}concat(c){return new jy(this,c)}get(c){if(this.bindings[c])return this.bindings[c];if(this.parent)return this.parent.get(c);throw new Error(`${c} not found in scope.`)}has(c){return!!this.bindings[c]||!!this.parent&&this.parent.has(c)}}const Nh={kind:"null"},pn={kind:"number"},Zs={kind:"string"},Pi={kind:"boolean"},wd={kind:"color"},ff={kind:"object"},bi={kind:"value"},gk={kind:"collator"},vv={kind:"formatted"},_v={kind:"resolvedImage"};function mc(f,c){return{kind:"array",itemType:f,N:c}}function To(f){if(f.kind==="array"){const c=To(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const Gie=[Nh,pn,Zs,Pi,wd,vv,ff,mc(bi),_v];function Pm(f,c){if(c.kind==="error")return null;if(f.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Pm(f.itemType,c.itemType))&&(typeof f.N!="number"||f.N===c.N))return null}else{if(f.kind===c.kind)return null;if(f.kind==="value"){for(const u of Gie)if(!Pm(u,c))return null}}return`Expected ${To(f)} but found ${To(c)} instead.`}function L3(f,c){return c.some(u=>u.kind===f.kind)}function bv(f,c){return c.some(u=>u==="null"?f===null:u==="array"?Array.isArray(f):u==="object"?f&&!Array.isArray(f)&&typeof f=="object":u===typeof f)}function xk(f,c){return f.kind==="array"&&c.kind==="array"?f.N===c.N&&xk(f.itemType,c.itemType):f.kind===c.kind}class O3{constructor(c,u,g){this.sensitivity=c?u?"variant":"case":u?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(c,u){return this.collator.compare(c,u)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class yk{constructor(c,u,g,v,k){this.text=c.normalize?c.normalize():c,this.image=u,this.scale=g,this.fontStack=v,this.textColor=k}}class Xc{constructor(c){this.sections=c}static fromString(c){return new Xc([new yk(c,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(c=>c.text.length!==0||!!c.image&&c.image.hasPrimary())}static factory(c){return c instanceof Xc?c:Xc.fromString(c)}toString(){return this.sections.length===0?"":this.sections.map(c=>c.text).join("")}serialize(){const c=["format"];for(const u of this.sections){if(u.image){const v=u.image.getPrimary().id.toString();c.push(["image",v]);continue}c.push(u.text);const g={};u.fontStack&&(g["text-font"]=["literal",u.fontStack.split(",")]),u.scale&&(g["font-scale"]=u.scale),u.textColor&&(g["text-color"]=["rgba"].concat(u.textColor.toNonPremultipliedRenderColor(null).toArray())),c.push(g)}return c}}class gp{constructor(c,u={}){this.id=Ic.from(c),this.params=u.params,this.sx=u.sx||1,this.sy=u.sy||1}toString(){return JSON.stringify(this)}static parse(c){let u,g,v,k;try{({id:u,params:g,sx:v,sy:k}=JSON.parse(c)||{})}catch{return null}return u?new gp(u,{params:g,sx:v,sy:k}):null}scaleSelf(c,u=c){return this.sx*=c,this.sy*=u,this}}class Qc{constructor(c,u,g,v,k=!1){this.primaryId=Ic.from(c),this.primaryOptions=u,g&&(this.secondaryId=Ic.from(g)),this.secondaryOptions=v,this.available=k}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new gp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new gp(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?Qc.build({name:c}):c}static build(c,u,g,v){return!c||typeof c=="object"&&!("name"in c)?null:new Qc(c,g,u,v)}}function Kg(f,c,u,g){return typeof f=="number"&&f>=0&&f<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof u=="number"&&u>=0&&u<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,c,u,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,c,u,g]:[f,c,u]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ky(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof ki||f instanceof O3||f instanceof Xc||f instanceof Qc)return!0;if(Array.isArray(f)){for(const c of f)if(!ky(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!ky(f[c]))return!1;return!0}return!1}function gl(f){if(f===null)return Nh;if(typeof f=="string")return Zs;if(typeof f=="boolean")return Pi;if(typeof f=="number")return pn;if(f instanceof ki)return wd;if(f instanceof O3)return gk;if(f instanceof Xc)return vv;if(f instanceof Qc)return _v;if(Array.isArray(f)){const c=f.length;let u;for(const g of f){const v=gl(g);if(u){if(u===v)continue;u=bi;break}u=v}return mc(u||bi,c)}return ff}function Yu(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof Xc||f instanceof Qc||f instanceof ki?f.toString():JSON.stringify(f)}class xp{constructor(c,u){this.type=c,this.value=u}static parse(c,u){if(c.length!==2)return u.error(`'literal' expression requires exactly one argument, but found ${c.length-1} instead.`);if(!ky(c[1]))return u.error("invalid value");const g=c[1];let v=gl(g);const k=u.expectedType;return v.kind!=="array"||v.N!==0||!k||k.kind!=="array"||typeof k.N=="number"&&k.N!==0||(v=k),new xp(v,g)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof ki?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Xc?this.value.serialize():this.value}}class il{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const D3={string:Zs,number:pn,boolean:Pi,object:ff};class Sh{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");let g,v=1;const k=c[0];if(k==="array"){let P,R;if(c.length>2){const $=c[1];if(typeof $!="string"||!($ in D3)||$==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);P=D3[$],v++}else P=bi;if(c.length>3){if(c[2]!==null&&(typeof c[2]!="number"||c[2]<0||c[2]!==Math.floor(c[2])))return u.error('The length argument to "array" must be a positive integer literal',2);R=c[2],v++}g=mc(P,R)}else g=D3[k];const S=[];for(;vc.outputDefined())}serialize(){const c=this.type,u=[c.kind];if(c.kind==="array"){const g=c.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){u.push(g.kind);const v=c.N;(typeof v=="number"||this.args.length>1)&&u.push(v)}}return u.concat(this.args.map(g=>g.serialize()))}}class pf{constructor(c){this.type=vv,this.sections=c}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[1];if(!Array.isArray(g)&&typeof g=="object")return u.error("First argument must be an image or text section.");const v=[];let k=!1;for(let S=1;S<=c.length-1;++S){const P=c[S];if(k&&typeof P=="object"&&!Array.isArray(P)){k=!1;let R=null;if(P["font-scale"]&&(R=u.parseObjectValue(P["font-scale"],S,"font-scale",pn),!R))return null;let $=null;if(P["text-font"]&&($=u.parseObjectValue(P["text-font"],S,"text-font",mc(Zs)),!$))return null;let W=null;if(P["text-color"]&&(W=u.parseObjectValue(P["text-color"],S,"text-color",wd),!W))return null;const G=v[v.length-1];G.scale=R,G.font=$,G.textColor=W}else{const R=u.parse(c[S],S,bi);if(!R)return null;const $=R.type.kind;if($!=="string"&&$!=="value"&&$!=="null"&&$!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");k=!0,v.push({content:R,scale:null,font:null,textColor:null})}}return new pf(v)}evaluate(c){return new Xc(this.sections.map(u=>{const g=u.content.evaluate(c);return xk(gl(g),_v)?new yk("",g,null,null,null):new yk(Yu(g),null,u.scale?u.scale.evaluate(c):null,u.font?u.font.evaluate(c).join(","):null,u.textColor?u.textColor.evaluate(c):null)}))}eachChild(c){for(const u of this.sections)c(u.content),u.scale&&c(u.scale),u.font&&c(u.font),u.textColor&&c(u.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const u of this.sections){c.push(u.content.serialize());const g={};u.scale&&(g["font-scale"]=u.scale.serialize()),u.font&&(g["text-font"]=u.font.serialize()),u.textColor&&(g["text-color"]=u.textColor.serialize()),c.push(g)}return c}}class is{constructor(c,u,g,v){this._imageWarnHistory={},this.type=_v,this.namePrimary=c,this.nameSecondary=u,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),v&&(this.paramsSecondary=v.params,this.iconsetIdSecondary=v.iconset?v.iconset.id:void 0)}static parse(c,u){if(c.length<2)return u.error("Expected two or more arguments.");let g=1;const v=[];function k(){if(gIc.isEqual(S,k)),v.available){const S=v.getSecondary()?v.getSecondary().id:null;S&&(v.available=c.availableImages.some(P=>Ic.isEqual(P,S)))}}return v}eachChild(c){if(c(this.namePrimary),this.paramsPrimary)for(const u in this.paramsPrimary)this.paramsPrimary[u]&&c(this.paramsPrimary[u]);if(this.nameSecondary&&(c(this.nameSecondary),this.paramsSecondary))for(const u in this.paramsSecondary)this.paramsSecondary[u]&&c(this.paramsSecondary[u])}outputDefined(){return!1}serializeOptions(c,u){const g={};if(u&&(g.iconset={id:u}),c){g.params={};for(const v in c)c[v]&&(g.params[v]=c[v].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const c=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const u=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);u&&c.push(u)}if(this.nameSecondary&&(c.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const u=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);u&&c.push(u)}return c}}function un(f){return $n(f)?"string":Ny(f)?"number":_k(f)?"boolean":Array.isArray(f)?"array":f===null?"null":vk(f)?"object":typeof f}function vk(f){return f!=null&&!Array.isArray(f)&&typeof f!="function"&&!(f instanceof String||f instanceof Number||f instanceof Boolean)&&typeof f=="object"}function $n(f){return typeof f=="string"||f instanceof String}function Ny(f){return typeof f=="number"||f instanceof Number}function _k(f){return typeof f=="boolean"||f instanceof Boolean}const Bn={"to-boolean":Pi,"to-color":wd,"to-number":pn,"to-string":Zs};class mf{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[0],v=[];let k=Nh;if(g==="to-array"){if(!Array.isArray(c[1]))return null;const S=c[1].length;if(u.expectedType){if(u.expectedType.kind!=="array")return u.error(`Expected ${u.expectedType.kind} but found array.`);k=mc(u.expectedType.itemType,S)}else{if(!(S>0&&ky(c[1][0])))return null;k=mc(gl(c[1][0]),S)}for(let P=0;P4?`Invalid rbga value ${JSON.stringify(u)}: expected an array containing either three or four numeric values.`:Kg(u[0],u[1],u[2],u[3]),!g))return new ki(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new il(g||`Could not parse color from value '${typeof u=="string"?u:String(JSON.stringify(u))}'`)}if(this.type.kind==="number"){let u=null;for(const g of this.args){if(u=g.evaluate(c),u===null)return 0;const v=Number(u);if(!isNaN(v))return v}throw new il(`Could not convert ${JSON.stringify(u)} to number.`)}return this.type.kind==="formatted"?Xc.fromString(Yu(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?Qc.build(Yu(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(u=>u.evaluate(c)):Yu(this.args[0].evaluate(c))}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){if(this.type.kind==="formatted")return new pf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new is(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(u=>{c.push(u.serialize())}),c}}const R3=["Unknown","Point","LineString","Polygon"];class bk{constructor(c,u,g){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=c,this.options=u,this.iconImageUseTheme=g}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?R3[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(c){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const c=this.featureDistanceData.center,u=this.featureDistanceData.scale,{x:g,y:v}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*u-c[0])+this.featureDistanceData.bearing[1]*(v*u-c[1])}return 0}parseColor(c){let u=this._parseColorCache[c];return u||(u=this._parseColorCache[c]=ki.parse(c)),u}getConfig(c){return this.options?this.options.get(c):null}}class Jc{constructor(c,u,g,v,k){this.name=c,this.type=u,this._evaluate=g,this.args=v,this._overloadIndex=k}evaluate(c){if(!this._evaluate){const u=Jc.definitions[this.name];this._evaluate=Array.isArray(u)?u[2]:u.overloads[this._overloadIndex][1]}return this._evaluate(c,this.args)}eachChild(c){this.args.forEach(c)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(c=>c.serialize()))}static parse(c,u){const g=c[0],v=Jc.definitions[g];if(!v)return u.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const k=Array.isArray(v)?v[0]:v.type,S=Array.isArray(v)?[[v[1],v[2]]]:v.overloads,P=[];let R=null,$=-1;for(const[W,G]of S){if(Array.isArray(W)&&W.length!==c.length-1)continue;P.push(W),$++,R=new Pk(u.registry,u.path,null,u.scope,void 0,u._scope,u.options,u.iconImageUseTheme);const X=[];let re=!1;for(let se=1;seX)).map(wk).join(" | "),G=[];for(let X=1;Xu;){if(g-u>600){const R=g-u+1,$=c-u+1,W=Math.log(R),G=.5*Math.exp(2*W/3),X=.5*Math.sqrt(W*G*(R-G)/R)*($-R/2<0?-1:1);jk(f,c,Math.max(u,Math.floor(c-$*G/R+X)),Math.min(g,Math.floor(c+(R-$)*G/R+X)),v)}const k=f[c];let S=u,P=g;for(Ch(f,u,c),v(f[g],k)>0&&Ch(f,u,g);S0;)P--}v(f[u],k)===0?Ch(f,u,P):(P++,Ch(f,P,g)),P<=c&&(u=P+1),c<=P&&(g=P-1)}}function Ch(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function F3(f,c){return fc?1:0}function Lm(f){let c=0;for(let u,g,v=0,k=f.length,S=k-1;v=c[2]||f[1]<=c[1]||f[3]>=c[3])}function Kie(f,c,u){const g=f[0]-c[0],v=f[1]-c[1],k=f[0]-u[0],S=f[1]-u[1];return g*S-k*v==0&&g*k<=0&&v*S<=0}function Sy(f,c,u=!1){let g=!1;for(let P=0,R=c.length;P(v=f)[1]!=(S=se)[1]>v[1]&&v[0]<(S[0]-k[0])*(v[1]-k[1])/(S[1]-k[1])+k[0]&&(g=!g)}}var v,k,S;return g}function jv(f,c,u,g){const v=g[0]-u[0],k=g[1]-u[1],S=(f[0]-u[0])*k-v*(f[1]-u[1]),P=(c[0]-u[0])*k-v*(c[1]-u[1]);return S>0&&P<0||S<0&&P>0}function kv(f,c,u,g){return(v=[g[0]-u[0],g[1]-u[1]])[0]*(k=[c[0]-f[0],c[1]-f[1]])[1]-v[1]*k[0]!=0&&!(!jv(f,c,u,g)||!jv(u,g,f,c));var v,k}function yp(f){const c=new ir(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),u=new ir(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of f[0])c.x>g.x&&(c.x=g.x),c.y>g.y&&(c.y=g.y),u.xu[2]){const v=.5*g;let k=f[0]-u[0]>v?-g:u[0]-f[0]>v?g:0;k===0&&(k=f[0]-u[2]>v?-g:u[2]-f[0]>v?g:0),f[0]+=k}Xu(c,f)}function JI(f,c,u,g){const v=Math.pow(2,g.z)*Om,k=[g.x*Om,g.y*Om],S=[];if(!f)return S;for(const P of f)for(const R of P){const $=[R.x+k[0],R.y+k[1]];QI($,c,u,v),S.push($)}return S}function kk(f,c,u,g){const v=Math.pow(2,g.z)*Om,k=[g.x*Om,g.y*Om],S=[];if(!f)return S;for(const R of f){const $=[];for(const W of R){const G=[W.x+k[0],W.y+k[1]];Xu(c,G),$.push(G)}S.push($)}if(c[2]-c[0]<=v/2){(P=c)[0]=P[1]=1/0,P[2]=P[3]=-1/0;for(const R of S)for(const $ of R)QI($,c,u,v)}var P;return S}class Rm{constructor(c,u){this.type=Pi,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${c.length-1} instead.`);if(ky(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let v=0;vu)return Nk(k,S,(u-(g-P))/P)}return c[c.length-1]}pointToSegmentDistance(c,u,g){let[v,k]=u,S=lu(g[0]-v)*this.kx,P=(g[1]-k)*this.ky;if(S!==0||P!==0){const R=(lu(c[0]-v)*this.kx*S+(c[1]-k)*this.ky*P)/(S*S+P*P);R>1?(v=g[0],k=g[1]):R>0&&(v+=S/this.kx*R,k+=P/this.ky*R)}return S=lu(c[0]-v)*this.kx,P=(c[1]-k)*this.ky,Math.sqrt(S*S+P*P)}pointOnLine(c,u){let g=1/0,v=c[0][0],k=c[0][1],S=0,P=0;for(let R=0;R1?($=c[R+1][0],W=c[R+1][1]):re>0&&($+=G/this.kx*re,W+=X/this.ky*re)),G=lu(u[0]-$)*this.kx,X=(u[1]-W)*this.ky;const se=G*G+X*X;sek.index||v.index===k.index&&v.t>k.t){const $=v;v=k,k=$}const S=[v.point],P=v.index+1,R=k.index;!$3(g[P],S[0])&&P<=R&&S.push(g[P]);for(let $=P+1;$<=R;$++)S.push(g[$]);return $3(g[R],k.point)||S.push(k.point),S}lineSliceAlong(c,u,g){let v=0;const k=[];for(let S=0;Sc&&k.length===0&&k.push(Nk(P,R,(c-(v-$))/$)),v>=u)return k.push(Nk(P,R,(u-(v-$))/$)),k;v>c&&k.push(R)}return k}bufferPoint(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[0]+v,c[1]+g]}bufferBBox(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[2]+v,c[3]+g]}insideBBox(c,u){return lu(c[0]-u[0])>=0&&lu(c[0]-u[2])<=0&&c[1]>=u[1]&&c[1]<=u[3]}}function $3(f,c){return f[0]===c[0]&&f[1]===c[1]}function Nk(f,c,u){const g=lu(c[0]-f[0]);return[f[0]+g*u,f[1]+(c[1]-f[1])*u]}function lu(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class Sk{constructor(c=[],u=(g,v)=>gv?1:0){if(this.data=c,this.length=this.data.length,this.compare=u,this.length>0)for(let g=(this.length>>1)-1;g>=0;g--)this._down(g)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:u,compare:g}=this,v=u[c];for(;c>0;){const k=c-1>>1,S=u[k];if(g(v,S)>=0)break;u[c]=S,c=k}u[c]=v}_down(c){const{data:u,compare:g}=this,v=this.length>>1,k=u[c];for(;c=0)break;u[c]=u[S],c=S}u[c]=k}}var Mr=8192;function U3(f,c){return c.dist-f.dist}const Ck=100,Mk=50;function q3(f){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==f.length)return!1;for(let u=0;u=f[0]&&f[1]f[1])return[null,null];const u=Sv(f);if(c){if(u===2)return[f,null];const g=Math.floor(u/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(u===1)return[f,null];const g=Math.floor(u/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function Zg(f,c){const u=[1/0,1/0,-1/0,-1/0];if(!gf(c,f.length))return u;for(let g=c[0];g<=c[1];++g)Xu(u,f[g]);return u}function Yg(f){const c=[1/0,1/0,-1/0,-1/0];for(let u=0;uc[2]&&(g=f[0]-c[2]),f[1]>c[3]&&(v=f[1]-c[3]),f[3]=g)return g;if(wv(v,k)){if(W3(f,c))return 0}else if(W3(c,f))return 0;let S=g;for(const P of f)for(let R=0,$=P.length,W=$-1;R<$;W=R++)for(const G of c)for(let X=0,re=G.length,se=re-1;X=k)continue;const W=$.range1;if(Sv(W)<=P){if(!gf(W,f.length))return NaN;if(c){const G=eae(f,W,u,g);if((k=Math.min(k,G))===0)return k}else for(let G=W[0];G<=W[1];++G){const X=Jie(f[G],u,g);if((k=Math.min(k,X))===0)return k}}else{const G=V3(W,c);if(G[0]!==null){const X=Fm(Zg(f,G[0]),R,g);X=S)continue;const G=W.range1,X=W.range2;if(Sv(G)<=R&&Sv(X)<=$){if(!gf(G,f.length)||!gf(X,u.length))return NaN;if(c&&g?S=Math.min(S,Xs(f,G,u,X,v)):c||g?c&&!g?S=Math.min(S,H3(u,X,f,G,v)):!c&&g&&(S=Math.min(S,H3(f,G,u,X,v))):S=Math.min(S,Qie(f,G,u,X,v)),S===0)return S}else{const re=V3(G,c),se=V3(X,g);ja(P,S,v,f,u,re[0],se[0]),ja(P,S,v,f,u,re[0],se[1]),ja(P,S,v,f,u,re[1],se[0]),ja(P,S,v,f,u,re[1],se[1])}}return S}function G3(f,c,u,g,v=1/0){let k=v;const S=Zg(f,[0,f.length-1]);for(const P of u)if(!(k!==1/0&&Fm(S,Zg(P,[0,P.length-1]),g)>=k)&&(k=Math.min(k,nP(f,c,P,!0,g,k)),k===0))return k;return k}function Ek(f,c,u,g,v=1/0){let k=v;const S=Zg(f,[0,f.length-1]);for(const P of u){if(k!==1/0&&Fm(S,Yg(P),g)>=k)continue;const R=rae(f,c,P,g,k);if(isNaN(R))return R;if((k=Math.min(k,R))===0)return k}return k}function K3(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class Xg{constructor(c,u){this.type=pn,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'distance' expression requires either one argument, but found ' ${c.length-1} instead.`);if(ky(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let v=0;v{c&&!Ty(u)&&(c=!1)}),c}function Cv(f){if(f instanceof Jc&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(u=>{c&&!Cv(u)&&(c=!1)}),c}function Ay(f,c){if(f instanceof Jc&&c.indexOf(f.name)>=0)return!1;let u=!0;return f.eachChild(g=>{u&&!Ay(g,c)&&(u=!1)}),u}function sP(f,c,u){return[f,c,u].filter(Boolean).join("")}function Z3(f,c){switch(f){case"string":return Yu(c);case"number":return+c;case"boolean":return!!c;case"color":return ki.parse(c);case"formatted":return Xc.fromString(Yu(c));case"resolvedImage":return Qc.build(Yu(c))}return c}function iP(f,c,u,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fu&&(f=u),f}class Ey{constructor(c,u,g,v=!1){this.type=c,this.key=u,this.scope=g,this.featureConstant=v}static parse(c,u){let g=u.expectedType;if(g==null&&(g=bi),c.length<2||c.length>3)return u.error("Invalid number of arguments for 'config' expression.");const v=u.parse(c[1],1);if(!(v instanceof xp))return u.error("Key name of 'config' expression must be a string literal.");let k,S=!0;const P=Yu(v.value);if(c.length>=3){const R=u.parse(c[2],2);if(!(R instanceof xp))return u.error("Scope of 'config' expression must be a string literal.");k=Yu(R.value)}if(u.options){const R=sP(P,k,u._scope),$=u.options.get(R);$&&(S=Ty($.value||$.default))}return new Ey(g,P,k,S)}evaluate(c){const u=sP(this.key,this.scope,c.scope),g=c.getConfig(u);if(!g)return null;const{type:v,value:k,values:S,minValue:P,maxValue:R,stepValue:$}=g,W=g.default.evaluate(c);let G=W;if(k){const X=c.scope;c.scope=(X||"").split("").slice(1).join(""),G=k.evaluate(c),c.scope=X}return v&&(G=Z3(v,G)),G===void 0||P===void 0&&R===void 0&&$===void 0||(typeof G=="number"?G=iP(G,P,R,$):Array.isArray(G)&&(G=G.map(X=>typeof X=="number"?iP(X,P,R,$):X))),k!==void 0&&G!==void 0&&S&&!S.includes(G)&&(G=W,v&&(G=Z3(v,G))),(v&&v!==this.type||G!==void 0&&!xk(gl(G),this.type))&&(G=Z3(this.type.kind,G)),G}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class Ik{constructor(c,u){this.type=u.type,this.name=c,this.boundExpression=u}static parse(c,u){if(c.length!==2||typeof c[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");const g=c[1];return u.scope.has(g)?new Ik(g,u.scope.get(g)):u.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(c){return this.boundExpression.evaluate(c)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Pk{constructor(c,u=[],g,v=new jy,k=[],S,P,R){this.registry=c,this.path=u,this.key=u.map($=>typeof $=="string"?`['${$}']`:`[${$}]`).join(""),this.scope=v,this.errors=k,this.expectedType=g,this._scope=S,this.options=P,this.iconImageUseTheme=R}parse(c,u,g,v,k={}){return u||g?this.concat(u,null,g,v)._parse(c,k):this._parse(c,k)}parseObjectValue(c,u,g,v,k,S={}){return this.concat(u,g,v,k)._parse(c,S)}_parse(c,u){function g(v,k,S){return S==="assert"?new Sh(k,[v]):S==="coerce"?new mf(k,[v]):v}if(c!==null&&typeof c!="string"&&typeof c!="boolean"&&typeof c!="number"||(c=["literal",c]),Array.isArray(c)){if(c.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const v=typeof c[0]=="string"?this.registry[c[0]]:void 0;if(v){let k=v.parse(c,this);if(!k)return null;if(this.expectedType){const S=this.expectedType,P=k.type;if(S.kind!=="string"&&S.kind!=="number"&&S.kind!=="boolean"&&S.kind!=="object"&&S.kind!=="array"||P.kind!=="value")if(S.kind!=="color"&&S.kind!=="formatted"&&S.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string"){if(this.checkSubtype(S,P))return null}else k=g(k,S,u.typeAnnotation||"coerce");else k=g(k,S,u.typeAnnotation||"assert")}if(!(k instanceof xp)&&k.type.kind!=="resolvedImage"&&Y3(k)){const S=new bk(this._scope,this.options,this.iconImageUseTheme);try{k=new xp(k.type,k.evaluate(S))}catch(P){return this.error(P.message),null}}return k}return mf.parse(["to-array",c],this)}return this.error(c===void 0?"'undefined' value invalid. Use null instead.":typeof c=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof c} instead.`)}concat(c,u,g,v){let k=typeof c=="number"?this.path.concat(c):this.path;k=typeof u=="string"?k.concat(u):k;const S=v?this.scope.concat(v):this.scope;return new Pk(this.registry,k,g||null,S,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...u){const g=`${this.key}${u.map(v=>`[${v}]`).join("")}`;this.errors.push(new Zu(g,c))}checkSubtype(c,u){const g=Pm(c,u);return g&&this.error(g),g}}function Y3(f){if(f instanceof Ik)return Y3(f.boundExpression);if(f instanceof Jc&&f.name==="error"||f instanceof Sl||f instanceof Rm||f instanceof Xg||f instanceof Ey)return!1;const c=f instanceof mf||f instanceof Sh;let u=!0;return f.eachChild(g=>{u=c?u&&Y3(g):u&&g instanceof xp}),!!u&&Ty(f)&&Ay(f,["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 Lk(f,c){const u=f.length-1;let g,v,k=0,S=u,P=0;for(;k<=S;)if(P=Math.floor((k+S)/2),g=f[P],v=f[P+1],g<=c){if(P===u||cc))throw new il("Input is not a number.");S=P-1}return 0}class Mv{constructor(c,u,g){this.type=c,this.input=u,this.labels=[],this.outputs=[];for(const[v,k]of g)this.labels.push(v),this.outputs.push(k)}static parse(c,u){if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if((c.length-1)%2!=0)return u.error("Expected an even number of arguments.");const g=u.parse(c[1],1,pn);if(!g)return null;const v=[];let k=null;u.expectedType&&u.expectedType.kind!=="value"&&(k=u.expectedType);for(let S=1;S=P)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',$);const G=u.parse(R,W,k);if(!G)return null;k=k||G.type,v.push([P,G])}return new Mv(k,g,v)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;return v>=u[k-1]?g[k-1].evaluate(c):g[Lk(u,v)].evaluate(c)}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){const c=["step",this.input.serialize()];for(let u=0;u0&&c.push(this.labels[u]),c.push(this.outputs[u].serialize());return c}}const aP=.95047,oP=1.08883,lP=4/29,Iy=6/29,cP=3*Iy*Iy,nae=Iy*Iy*Iy,sae=Math.PI/180,iae=180/Math.PI;function X3(f){return f>nae?Math.pow(f,1/3):f/cP+lP}function Q3(f){return f>Iy?f*f*f:cP*(f-lP)}function J3(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function e5(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function dP(f){const c=e5(f.r),u=e5(f.g),g=e5(f.b),v=X3((.4124564*c+.3575761*u+.1804375*g)/aP),k=X3((.2126729*c+.7151522*u+.072175*g)/1);return{l:116*k-16,a:500*(v-k),b:200*(k-X3((.0193339*c+.119192*u+.9503041*g)/oP)),alpha:f.a}}function Ok(f){let c=(f.l+16)/116,u=isNaN(f.a)?c:c+f.a/500,g=isNaN(f.b)?c:c-f.b/200;return c=1*Q3(c),u=aP*Q3(u),g=oP*Q3(g),new ki(J3(3.2404542*u-1.5371385*c-.4985314*g),J3(-.969266*u+1.8760108*c+.041556*g),J3(.0556434*u-.2040259*c+1.0572252*g),f.alpha)}function Dk(f,c,u){const g=c-f;return f+u*(g>180||g<-180?g-360*Math.round(g/360):g)}const Py={forward:dP,reverse:Ok,interpolate:function(f,c,u){return{l:Fn(f.l,c.l,u),a:Fn(f.a,c.a,u),b:Fn(f.b,c.b,u),alpha:Fn(f.alpha,c.alpha,u)}}},Tv={forward:function(f){const{l:c,a:u,b:g}=dP(f),v=Math.atan2(g,u)*iae;return{h:v<0?v+360:v,c:Math.sqrt(u*u+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*sae,u=f.c;return Ok({l:f.l,a:Math.cos(c)*u,b:Math.sin(c)*u,alpha:f.alpha})},interpolate:function(f,c,u){return{h:Dk(f.h,c.h,u),c:Fn(f.c,c.c,u),l:Fn(f.l,c.l,u),alpha:Fn(f.alpha,c.alpha,u)}}};var uP=Object.freeze({__proto__:null,hcl:Tv,lab:Py});class cu{constructor(c,u,g,v,k){this.type=c,this.operator=u,this.interpolation=g,this.input=v,this.labels=[],this.outputs=[];for(const[S,P]of k)this.labels.push(S),this.outputs.push(P)}static interpolationFactor(c,u,g,v){let k=0;if(c.name==="exponential")k=Rk(u,c.base,g,v);else if(c.name==="linear")k=Rk(u,1,g,v);else if(c.name==="cubic-bezier"){const S=c.controlPoints;k=new Oo(S[0],S[1],S[2],S[3]).solve(Rk(u,1,g,v))}return k}static parse(c,u){let[g,v,k,...S]=c;if(!Array.isArray(v)||v.length===0)return u.error("Expected an interpolation type expression.",1);if(v[0]==="linear")v={name:"linear"};else if(v[0]==="exponential"){const $=v[1];if(typeof $!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);v={name:"exponential",base:$}}else{if(v[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(v[0])}`,1,0);{const $=v.slice(1);if($.length!==4||$.some(W=>typeof W!="number"||W<0||W>1))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);v={name:"cubic-bezier",controlPoints:$}}}if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length-1>3&&(c.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(k=u.parse(k,2,pn),!k)return null;const P=[];let R=null;g==="interpolate-hcl"||g==="interpolate-lab"?R=wd:u.expectedType&&u.expectedType.kind!=="value"&&(R=u.expectedType);for(let $=0;$=W)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const se=u.parse(G,re,R);if(!se)return null;R=R||se.type,P.push([W,se])}return R.kind==="number"||R.kind==="color"||R.kind==="array"&&R.itemType.kind==="number"&&typeof R.N=="number"?new cu(R,g,v,k,P):u.error(`Type ${To(R)} is not interpolatable.`)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;if(v>=u[k-1])return g[k-1].evaluate(c);const S=Lk(u,v),P=cu.interpolationFactor(this.interpolation,v,u[S],u[S+1]),R=g[S].evaluate(c),$=g[S+1].evaluate(c);return this.operator==="interpolate"?yv[this.type.kind.toLowerCase()](R,$,P):this.operator==="interpolate-hcl"?Tv.reverse(Tv.interpolate(Tv.forward(R),Tv.forward($),P)):Py.reverse(Py.interpolate(Py.forward(R),Py.forward($),P))}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){let c;c=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const u=[this.operator,c,this.input.serialize()];for(let g=0;gPm(v,P.type));return new Av(S?bi:g,k)}evaluate(c){let u,g=null,v=0;for(const k of this.args){if(v++,g=k.evaluate(c),g&&g instanceof Qc&&!g.available&&(u||(u=g),g=null,v===this.args.length))return u;if(g!==null)break}return g}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){const c=["coalesce"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class vp{constructor(c,u){this.type=u.type,this.bindings=[].concat(c),this.result=u}evaluate(c){return this.result.evaluate(c)}eachChild(c){for(const u of this.bindings)c(u[1]);c(this.result)}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found ${c.length-1} instead.`);const g=[];for(let k=1;k=g.length)throw new il("Array index out of bounds: index exceeds array size");if(u!==Math.floor(u))throw new il("Array index must be an integer. Use at-interpolated for fractional indices");return g[u]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class zk{constructor(c,u,g){this.type=c,this.index=u,this.input=g}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,pn),v=u.parse(c[2],2,mc(u.expectedType||bi));return g&&v?new zk(v.type.itemType,g,v):null}evaluate(c){const u=this.index.evaluate(c),g=this.input.evaluate(c);if(u<0)throw new il(`Array index out of bounds: ${u} < 0.`);if(u>g.length-1)throw new il(`Array index out of bounds: ${u} > ${g.length-1}.`);if(u===Math.floor(u))return g[u];const v=Math.floor(u),k=Math.ceil(u),S=g[v],P=g[k];if(typeof S!="number"||typeof P!="number")throw new il(`Cannot interpolate between non-number values at index ${u}.`);const R=u-v;return S*(1-R)+P*R}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class t5{constructor(c,u){this.type=Pi,this.needle=c,this.haystack=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,bi),v=u.parse(c[2],2,bi);return g&&v?L3(g.type,[Pi,Zs,pn,Nh,bi])?new t5(g,v):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${To(g.type)} instead`):null}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!bv(u,["boolean","string","number","null"]))throw new il(`Expected first argument to be of type boolean, string, number or null, but found ${To(gl(u))} instead.`);if(!bv(g,["string","array"]))throw new il(`Expected second argument to be of type array or string, but found ${To(gl(g))} instead.`);return g.indexOf(u)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Ly{constructor(c,u,g){this.type=pn,this.needle=c,this.haystack=u,this.fromIndex=g}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,bi),v=u.parse(c[2],2,bi);if(!g||!v)return null;if(!L3(g.type,[Pi,Zs,pn,Nh,bi]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${To(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,pn);return k?new Ly(g,v,k):null}return new Ly(g,v)}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(!bv(u,["boolean","string","number","null"]))throw new il(`Expected first argument to be of type boolean, string, number or null, but found ${To(gl(u))} instead.`);if(!bv(g,["string","array"]))throw new il(`Expected second argument to be of type array or string, but found ${To(gl(g))} instead.`);if(this.fromIndex){const v=this.fromIndex.evaluate(c);return g.indexOf(u,v)}return g.indexOf(u)}eachChild(c){c(this.needle),c(this.haystack),this.fromIndex&&c(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const c=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),c]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Ev{constructor(c,u,g,v,k,S){this.inputType=c,this.type=u,this.input=g,this.cases=v,this.outputs=k,this.otherwise=S}static parse(c,u){if(c.length<5)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length%2!=1)return u.error("Expected an even number of arguments.");let g,v;u.expectedType&&u.expectedType.kind!=="value"&&(v=u.expectedType);const k={},S=[];for(let $=2;$Number.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof se=="number"&&Math.floor(se)!==se)return X.error("Numeric branch labels must be integer values.");if(g){if(X.checkSubtype(g,gl(se)))return null}else g=gl(se);if(k[String(se)]!==void 0)return X.error("Branch labels must be unique.");k[String(se)]=S.length}const re=u.parse(G,$,v);if(!re)return null;v=v||re.type,S.push(re)}const P=u.parse(c[1],1,bi);if(!P)return null;const R=u.parse(c[c.length-1],c.length-1,v);return R?P.type.kind!=="value"&&u.concat(1).checkSubtype(g,P.type)?null:new Ev(g,v,P,k,S,R):null}evaluate(c){const u=this.input.evaluate(c);return(xk(gl(u),this.inputType)&&this.outputs[this.cases[u]]||this.otherwise).evaluate(c)}eachChild(c){c(this.input),this.outputs.forEach(c),c(this.otherwise)}outputDefined(){return this.outputs.every(c=>c.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["match",this.input.serialize()],u=Object.keys(this.cases).sort(),g=[],v={};for(const S of u){const P=v[this.cases[S]];P===void 0?(v[this.cases[S]]=g.length,g.push([this.cases[S],[S]])):g[P][1].push(S)}const k=S=>this.inputType.kind==="number"?Number(S):S;for(const[S,P]of g)c.push(P.length===1?k(P[0]):P.map(k)),c.push(this.outputs[S].serialize());return c.push(this.otherwise.serialize()),c}}class Iv{constructor(c,u,g){this.type=c,this.branches=u,this.otherwise=g}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found only ${c.length-1}.`);if(c.length%2!=0)return u.error("Expected an odd number of arguments.");let g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);const v=[];for(let S=1;Su.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class Bk{constructor(c,u,g,v){this.type=c,this.input=u,this.beginIndex=g,this.endIndex=v}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,bi),v=u.parse(c[2],2,pn);if(!g||!v)return null;if(!L3(g.type,[mc(bi),Zs,bi]))return u.error(`Expected first argument to be of type array or string, but found ${To(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,pn);return k?new Bk(g.type,g,v,k):null}return new Bk(g.type,g,v)}evaluate(c){const u=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!bv(u,["string","array"]))throw new il(`Expected first argument to be of type array or string, but found ${To(gl(u))} instead.`);if(this.endIndex){const v=this.endIndex.evaluate(c);return u.slice(g,v)}return u.slice(g)}eachChild(c){c(this.input),c(this.beginIndex),this.endIndex&&c(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const c=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),c]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class r5{constructor(c,u){this.type=mc(Zs),this.str=c,this.delimiter=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,Zs),v=u.parse(c[2],2,Zs);return g&&v?new r5(g,v):void 0}evaluate(c){const u=this.str.evaluate(c),g=this.delimiter.evaluate(c);return u.split(g)}eachChild(c){c(this.str),c(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function n5(f,c){return f==="=="||f==="!="?c.kind==="boolean"||c.kind==="string"||c.kind==="number"||c.kind==="null"||c.kind==="value":c.kind==="string"||c.kind==="number"||c.kind==="value"}function s5(f,c,u,g){return g.compare(c,u)===0}function Oy(f,c,u){const g=f!=="=="&&f!=="!=";return class Bze{constructor(k,S,P){this.type=Pi,this.lhs=k,this.rhs=S,this.collator=P,this.hasUntypedArgument=k.type.kind==="value"||S.type.kind==="value"}static parse(k,S){if(k.length!==3&&k.length!==4)return S.error("Expected two or three arguments.");const P=k[0];let R=S.parse(k[1],1,bi);if(!R)return null;if(!n5(P,R.type))return S.concat(1).error(`"${P}" comparisons are not supported for type '${To(R.type)}'.`);let $=S.parse(k[2],2,bi);if(!$)return null;if(!n5(P,$.type))return S.concat(2).error(`"${P}" comparisons are not supported for type '${To($.type)}'.`);if(R.type.kind!==$.type.kind&&R.type.kind!=="value"&&$.type.kind!=="value")return S.error(`Cannot compare types '${To(R.type)}' and '${To($.type)}'.`);g&&(R.type.kind==="value"&&$.type.kind!=="value"?R=new Sh($.type,[R]):R.type.kind!=="value"&&$.type.kind==="value"&&($=new Sh(R.type,[$])));let W=null;if(k.length===4){if(R.type.kind!=="string"&&$.type.kind!=="string"&&R.type.kind!=="value"&&$.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(W=S.parse(k[3],3,gk),!W)return null}return new Bze(R,$,W)}evaluate(k){const S=this.lhs.evaluate(k),P=this.rhs.evaluate(k);if(g&&this.hasUntypedArgument){const R=gl(S),$=gl(P);if(R.kind!==$.kind||R.kind!=="string"&&R.kind!=="number")throw new il(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${R.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const R=gl(S),$=gl(P);if(R.kind!=="string"||$.kind!=="string")return c(k,S,P)}return this.collator?u(k,S,P,this.collator.evaluate(k)):c(k,S,P)}eachChild(k){k(this.lhs),k(this.rhs),this.collator&&k(this.collator)}outputDefined(){return!0}serialize(){const k=[f];return this.eachChild(S=>{k.push(S.serialize())}),k}}}const aae=Oy("==",function(f,c,u){return c===u},s5),oae=Oy("!=",function(f,c,u){return c!==u},function(f,c,u,g){return!s5(0,c,u,g)}),hP=Oy("<",function(f,c,u){return c",function(f,c,u){return c>u},function(f,c,u,g){return g.compare(c,u)>0}),$k=Oy("<=",function(f,c,u){return c<=u},function(f,c,u,g){return g.compare(c,u)<=0}),lae=Oy(">=",function(f,c,u){return c>=u},function(f,c,u,g){return g.compare(c,u)>=0});class Uk{constructor(c,u,g,v,k,S){this.type=Zs,this.number=c,this.locale=u,this.currency=g,this.unit=v,this.minFractionDigits=k,this.maxFractionDigits=S}static parse(c,u){if(c.length!==3)return u.error("Expected two arguments.");const g=u.parse(c[1],1,pn);if(!g)return null;const v=c[2];if(typeof v!="object"||Array.isArray(v))return u.error("NumberFormat options argument must be an object.");let k=null;if(v.locale&&(k=u.parseObjectValue(v.locale,2,"locale",Zs),!k))return null;let S=null;if(v.currency&&(S=u.parseObjectValue(v.currency,2,"currency",Zs),!S))return null;let P=null;if(v.unit&&(P=u.parseObjectValue(v.unit,2,"unit",Zs),!P))return null;let R=null;if(v["min-fraction-digits"]&&(R=u.parseObjectValue(v["min-fraction-digits"],2,"min-fraction-digits",pn),!R))return null;let $=null;return v["max-fraction-digits"]&&($=u.parseObjectValue(v["max-fraction-digits"],2,"max-fraction-digits",pn),!$)?null:new Uk(g,k,S,P,R,$)}evaluate(c){return new Intl.NumberFormat(this.locale?this.locale.evaluate(c):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(c):void 0,unit:this.unit?this.unit.evaluate(c):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(c):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(c):void 0}).format(this.number.evaluate(c))}eachChild(c){c(this.number),this.locale&&c(this.locale),this.currency&&c(this.currency),this.unit&&c(this.unit),this.minFractionDigits&&c(this.minFractionDigits),this.maxFractionDigits&&c(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const c={};return this.locale&&(c.locale=this.locale.serialize()),this.currency&&(c.currency=this.currency.serialize()),this.unit&&(c.unit=this.unit.serialize()),this.minFractionDigits&&(c["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(c["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),c]}}class i5{constructor(c){this.type=pn,this.input=c}static parse(c,u){if(c.length!==2)return u.error(`Expected 1 argument, but found ${c.length-1} instead.`);const g=u.parse(c[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?u.error(`Expected argument of type string or array, but found ${To(g.type)} instead.`):new i5(g):null}evaluate(c){const u=this.input.evaluate(c);if(typeof u=="string"||Array.isArray(u))return u.length;throw new il(`Expected value to be of type string or array, but found ${To(gl(u))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(u=>{c.push(u.serialize())}),c}}function pP(f){return function(){f=1831565813+(f|=0)|0;let c=Math.imul(f^f>>>15,1|f);return c=c+Math.imul(c^c>>>7,61|c)^c,((c^c>>>14)>>>0)/4294967296}}const Dy={"==":aae,"!=":oae,">":fP,"<":hP,">=":lae,"<=":$k,array:Sh,at:Fk,"at-interpolated":zk,boolean:Sh,case:Iv,coalesce:Av,collator:Sl,format:pf,image:is,in:t5,"index-of":Ly,interpolate:cu,"interpolate-hcl":cu,"interpolate-lab":cu,length:i5,let:vp,literal:xp,match:Ev,number:Sh,"number-format":Uk,object:Sh,slice:Bk,step:Mv,string:Sh,"to-boolean":mf,"to-color":mf,"to-number":mf,"to-string":mf,var:Ik,within:Rm,distance:Xg,config:Ey,split:r5};function a5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,S=Kg(c,u,g,k);if(S)throw new il(S);return new ki(c/255,u/255,g/255,k)}function o5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,S=function($,W,G,X){return typeof $=="number"&&$>=0&&$<=360?typeof W=="number"&&W>=0&&W<=100&&typeof G=="number"&&G>=0&&G<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[$,W,G,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[$,W,G,X]:[$,W,G]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[$,W,G,X]:[$,W,G]).join(", ")}]: 'h' must be between 0 and 360.`}(c,u,g,k);if(S)throw new il(S);const P=`hsla(${c}, ${u}%, ${g}%, ${k})`,R=ki.parse(P);if(!R)throw new il(`Failed to parse HSLA color: ${P}`);return R}function mP(f,c){return f in c}function l5(f,c){const u=c[f];return u===void 0?null:u}function Bm(f){return{type:f}}function Qg(f){if(f instanceof Ey)return new Set([f.key]);let c=new Set;return f.eachChild(u=>{c=new Set([...c,...Qg(u)])}),c}function qk(f){if(f instanceof Jc&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(u=>{!c&&qk(u)&&(c=!0)}),c}function gP(f){return{result:"success",value:f}}function $m(f){return{result:"error",value:f}}function c5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Pv(f){return f["property-type"]==="data-driven"}function xP(f){return c5(f.expression,"measure-light")}function yP(f){return c5(f.expression,"zoom")}function Vk(f){return!!f.expression&&f.expression.interpolated}function Hk(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function vP(f){return f}function _P(f,c){const u=c.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",v=g||!(g||f.property!==void 0),k=f.type||(Vk(c)?"exponential":"interval");if(u&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map($=>[$[0],ki.parse($[1])])),f.default=ki.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!uP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let S,P,R;if(k==="exponential")S=bP;else if(k==="interval")S=dae;else if(k==="categorical"){S=cae,P=Object.create(null);for(const $ of f.stops)P[$[0]]=$[1];R=typeof f.stops[0][0]}else{if(k!=="identity")throw new Error(`Unknown function type "${k}"`);S=wP}if(g){const $={},W=[];for(let re=0;rere[0]),evaluate:({zoom:re},se)=>bP({stops:G,base:f.base},c,re).evaluate(re,se)}}if(v){const $=k==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:$,interpolationFactor:cu.interpolationFactor.bind(void 0,$),zoomStops:f.stops.map(W=>W[0]),evaluate:({zoom:W})=>S(f,c,W,P,R)}}return{kind:"source",evaluate($,W){const G=W&&W.properties?W.properties[f.property]:void 0;return G===void 0?xf(f.default,c.default):S(f,c,G,P,R)}}}function xf(f,c,u){return f!==void 0?f:c!==void 0?c:u!==void 0?u:void 0}function cae(f,c,u,g,v){return xf(typeof u===v?g[u]:void 0,f.default,c.default)}function dae(f,c,u){if(!Ny(u))return xf(f.default,c.default);const g=f.stops.length;if(g===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[g-1][0])return f.stops[g-1][1];const v=Lk(f.stops.map(k=>k[0]),u);return f.stops[v][1]}function bP(f,c,u){const g=f.base!==void 0?f.base:1;if(!Ny(u))return xf(f.default,c.default);const v=f.stops.length;if(v===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[v-1][0])return f.stops[v-1][1];const k=Lk(f.stops.map(W=>W[0]),u),S=function(W,G,X,re){const se=re-X,pe=W-X;return se===0?0:G===1?pe/se:(Math.pow(G,pe)-1)/(Math.pow(G,se)-1)}(u,g,f.stops[k][0],f.stops[k+1][0]),P=f.stops[k][1],R=f.stops[k+1][1];let $=yv[c.type]||vP;if(f.colorSpace&&f.colorSpace!=="rgb"){const W=uP[f.colorSpace];$=(G,X)=>W.reverse(W.interpolate(W.forward(G),W.forward(X),S))}return typeof P.evaluate=="function"?{evaluate(...W){const G=P.evaluate.apply(void 0,W),X=R.evaluate.apply(void 0,W);if(G!==void 0&&X!==void 0)return $(G,X,S)}}:$(P,R,S)}function wP(f,c,u){return c.type==="color"?u=ki.parse(u):c.type==="formatted"?u=Xc.fromString(u.toString()):c.type==="resolvedImage"?u=Qc.build(u.toString()):un(u)===c.type||c.type==="enum"&&c.values[u]||(u=void 0),xf(u,f.default,c.default)}Jc.register(Dy,{error:[{kind:"error"},[Zs],(f,[c])=>{throw new il(c.evaluate(f))}],typeof:[Zs,[bi],(f,[c])=>To(gl(c.evaluate(f)))],"to-rgba":[mc(pn,4),[wd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[mc(pn,4),[wd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[wd,[pn,pn,pn],a5],rgba:[wd,[pn,pn,pn,pn],a5],hsl:[wd,[pn,pn,pn],o5],hsla:[wd,[pn,pn,pn,pn],o5],has:{type:Pi,overloads:[[[Zs],(f,[c])=>mP(c.evaluate(f),f.properties())],[[Zs,ff],(f,[c,u])=>mP(c.evaluate(f),u.evaluate(f))]]},get:{type:bi,overloads:[[[Zs],(f,[c])=>l5(c.evaluate(f),f.properties())],[[Zs,ff],(f,[c,u])=>l5(c.evaluate(f),u.evaluate(f))]]},"feature-state":[bi,[Zs],(f,[c])=>l5(c.evaluate(f),f.featureState||{})],properties:[ff,[],f=>f.properties()],"geometry-type":[Zs,[],f=>f.geometryType()],worldview:[Zs,[],f=>f.globals.worldview||""],"is-active-floor":[Pi,Bm(Zs),(f,c)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const u=f.globals.activeFloors;return c.some(g=>{const v=g.evaluate(f);return u.has(v)})}],id:[bi,[],f=>f.id()],zoom:[pn,[],f=>f.globals.zoom],pitch:[pn,[],f=>f.globals.pitch||0],"distance-from-center":[pn,[],f=>f.distanceFromCenter()],"measure-light":[pn,[Zs],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[pn,[],f=>f.globals.heatmapDensity||0],"line-progress":[pn,[],f=>f.globals.lineProgress||0],"raster-value":[pn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[pn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[pn,[],f=>f.globals.skyRadialProgress||0],accumulated:[bi,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[pn,Bm(pn),(f,c)=>{let u=0;for(const g of c)u+=g.evaluate(f);return u}],"*":[pn,Bm(pn),(f,c)=>{let u=1;for(const g of c)u*=g.evaluate(f);return u}],"-":{type:pn,overloads:[[[pn,pn],(f,[c,u])=>c.evaluate(f)-u.evaluate(f)],[[pn],(f,[c])=>-c.evaluate(f)]]},"/":[pn,[pn,pn],(f,[c,u])=>c.evaluate(f)/u.evaluate(f)],"%":[pn,[pn,pn],(f,[c,u])=>c.evaluate(f)%u.evaluate(f)],ln2:[pn,[],()=>Math.LN2],pi:[pn,[],()=>Math.PI],e:[pn,[],()=>Math.E],"^":[pn,[pn,pn],(f,[c,u])=>Math.pow(c.evaluate(f),u.evaluate(f))],sqrt:[pn,[pn],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[pn,[pn],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[pn,[pn],(f,[c])=>Math.log(c.evaluate(f))],log2:[pn,[pn],(f,[c])=>Math.log2(c.evaluate(f))],sin:[pn,[pn],(f,[c])=>Math.sin(c.evaluate(f))],cos:[pn,[pn],(f,[c])=>Math.cos(c.evaluate(f))],tan:[pn,[pn],(f,[c])=>Math.tan(c.evaluate(f))],asin:[pn,[pn],(f,[c])=>Math.asin(c.evaluate(f))],acos:[pn,[pn],(f,[c])=>Math.acos(c.evaluate(f))],atan:[pn,[pn],(f,[c])=>Math.atan(c.evaluate(f))],min:[pn,Bm(pn),(f,c)=>Math.min(...c.map(u=>u.evaluate(f)))],max:[pn,Bm(pn),(f,c)=>Math.max(...c.map(u=>u.evaluate(f)))],abs:[pn,[pn],(f,[c])=>Math.abs(c.evaluate(f))],round:[pn,[pn],(f,[c])=>{const u=c.evaluate(f);return u<0?-Math.round(-u):Math.round(u)}],floor:[pn,[pn],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[pn,[pn],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[Pi,[Zs,bi],(f,[c,u])=>f.properties()[c.value]===u.value],"filter-id-==":[Pi,[bi],(f,[c])=>f.id()===c.value],"filter-type-==":[Pi,[Zs],(f,[c])=>f.geometryType()===c.value],"filter-<":[Pi,[Zs,bi],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g{const u=f.id(),g=c.value;return typeof u==typeof g&&u":[Pi,[Zs,bi],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>v}],"filter-id->":[Pi,[bi],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>g}],"filter-<=":[Pi,[Zs,bi],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g<=v}],"filter-id-<=":[Pi,[bi],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u<=g}],"filter->=":[Pi,[Zs,bi],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>=v}],"filter-id->=":[Pi,[bi],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>=g}],"filter-has":[Pi,[bi],(f,[c])=>c.value in f.properties()],"filter-has-id":[Pi,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Pi,[mc(Zs)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[Pi,[mc(bi)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[Pi,[Zs,mc(bi)],(f,[c,u])=>u.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[Pi,[Zs,mc(bi)],(f,[c,u])=>function(g,v,k,S){for(;k<=S;){const P=k+S>>1;if(v[P]===g)return!0;v[P]>g?S=P-1:k=P+1}return!1}(f.properties()[c.value],u.value,0,u.value.length-1)],all:{type:Pi,overloads:[[[Pi,Pi],(f,[c,u])=>c.evaluate(f)&&u.evaluate(f)],[Bm(Pi),(f,c)=>{for(const u of c)if(!u.evaluate(f))return!1;return!0}]]},any:{type:Pi,overloads:[[[Pi,Pi],(f,[c,u])=>c.evaluate(f)||u.evaluate(f)],[Bm(Pi),(f,c)=>{for(const u of c)if(u.evaluate(f))return!0;return!1}]]},"!":[Pi,[Pi],(f,[c])=>!c.evaluate(f)],"is-supported-script":[Pi,[Zs],(f,[c])=>{const u=f.globals&&f.globals.isSupportedScript;return!u||u(c.evaluate(f))}],upcase:[Zs,[Zs],(f,[c])=>c.evaluate(f).toUpperCase()],downcase:[Zs,[Zs],(f,[c])=>c.evaluate(f).toLowerCase()],concat:[Zs,Bm(bi),(f,c)=>c.map(u=>Yu(u.evaluate(f))).join("")],"resolved-locale":[Zs,[gk],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[pn,[pn,pn,bi],(f,c)=>{const[u,g,v]=c.map(S=>S.evaluate(f));if(u>g||u===g)return u;let k;if(typeof v=="string")k=function(S){let P=0;if(S.length===0)return P;for(let R=0;RJSON.stringify(G)).join(", ")}, but found ${JSON.stringify(W)} instead.`);return W}catch(W){const G=W;return this._warningHistory[G.message]||(this._warningHistory[G.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${G.message}`)),this._defaultValue}}}function Lv(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in Dy}function Um(f,c,u,g,v){const k=new Pk(Dy,[],c?function(P){const R={color:wd,string:Zs,number:pn,enum:Zs,boolean:Pi,formatted:vv,resolvedImage:_v};return P.type==="array"?mc(R[P.value]||bi,P.length):R[P.type]}(c):void 0,void 0,void 0,u,g,v),S=k.parse(f,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return S?gP(new Wk(S,c,u,g,v)):$m(k.errors)}class Ry{constructor(c,u,g,v){this.kind=c,this._styleExpression=u,this.isLightConstant=g,this.isLineProgressConstant=v,this.isStateDependent=c!=="constant"&&!Cv(u.expression),this.configDependencies=Qg(u.expression),this.isIndoorDependent=qk(u.expression)}evaluateWithoutErrorHandling(c,u,g,v,k,S){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,S)}evaluate(c,u,g,v,k,S,P){return this._styleExpression.evaluate(c,u,g,v,k,S,void 0,void 0,P)}}class Jg{constructor(c,u,g,v,k,S){this.kind=c,this.zoomStops=g,this._styleExpression=u,this.isStateDependent=c!=="camera"&&!Cv(u.expression),this.isIndoorDependent=qk(u.expression),this.isLightConstant=k,this.isLineProgressConstant=S,this.configDependencies=Qg(u.expression),this.interpolationType=v}evaluateWithoutErrorHandling(c,u,g,v,k,S){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,S)}evaluate(c,u,g,v,k,S){return this._styleExpression.evaluate(c,u,g,v,k,S)}interpolationFactor(c,u,g){return this.interpolationType?cu.interpolationFactor(this.interpolationType,c,u,g):0}}function d5(f,c,u,g,v){if((f=Um(f,c,u,g,v)).result==="error")return f;const k=f.value.expression,S=Ty(k);if(!S&&!Pv(c))return $m([new Zu("","data expressions not supported")]);const P=Ay(k,["zoom","pitch","distance-from-center"]);if(!P&&!yP(c))return $m([new Zu("","zoom expressions not supported")]);const R=Ay(k,["measure-light"]);if(!R&&!xP(c))return $m([new Zu("","measure-light expression not supported")]);const $=Ay(k,["line-progress"]);if(!$&&!function(X){return c5(X.expression,"line-progress")}(c))return $m([new Zu("","line-progress expression not supported")]);const W=c.expression&&c.expression.relaxZoomRestriction,G=Mh(k);return G||P||W?G instanceof Zu?$m([G]):G instanceof cu&&!Vk(c)?$m([new Zu("",'"interpolate" expressions cannot be used with this property')]):gP(G?new Jg(S&&$?"camera":"composite",f.value,G.labels,G instanceof cu?G.interpolation:void 0,R,$):new Ry(S&&$?"constant":"source",f.value,R,$)):$m([new Zu("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Gk{constructor(c,u){this._parameters=c,this._specification=u,Object.assign(this,_P(this._parameters,this._specification))}static deserialize(c){return new Gk(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Mh(f){let c=null;if(f instanceof vp)c=Mh(f.result);else if(f instanceof Av){for(const u of f.args)if(c=Mh(u),c)break}else(f instanceof Mv||f instanceof cu)&&f.input instanceof Jc&&f.input.name==="zoom"&&(c=f);return c instanceof Zu||f.eachChild(u=>{const g=Mh(u);g instanceof Zu?c=g:c&&g&&c!==g&&(c=new Zu("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var u5,jP,kP=function(){if(jP)return u5;jP=1,u5=c;var f=3;function c(u,g,v){var k=this.cells=[];if(u instanceof ArrayBuffer){this.arrayBuffer=u;var S=new Int32Array(this.arrayBuffer);u=S[0],this.d=(g=S[1])+2*(v=S[2]);for(var P=0;P=X[pe+0]&&k>=X[pe+1])?(R[se]=!0,P.push(G[se])):R[se]=!1}}},c.prototype._forEachCell=function(u,g,v,k,S,P,R,$){for(var W=this._convertToCellCoord(u),G=this._convertToCellCoord(g),X=this._convertToCellCoord(v),re=this._convertToCellCoord(k),se=W;se<=X;se++)for(var pe=G;pe<=re;pe++){var Ce=this.d*pe+se;if((!$||$(this._convertFromCellCoord(se),this._convertFromCellCoord(pe),this._convertFromCellCoord(se+1),this._convertFromCellCoord(pe+1)))&&S.call(this,u,g,v,k,Ce,P,R,$))return}},c.prototype._convertFromCellCoord=function(u){return(u-this.padding)/this.scale},c.prototype._convertToCellCoord=function(u){return Math.max(0,Math.min(this.d-1,Math.floor(u*this.scale)+this.padding))},c.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var u=this.cells,g=f+this.cells.length+1+1,v=0,k=0;k=0||(v[k]=_p(f[k],c)));f instanceof Error&&(v.message=f.message)}if(v.$name)throw new Error("$name property is reserved for worker serialization logic.");return g!=="Object"&&(v.$name=g),v}throw new Error("can't serialize object of type "+typeof f)}function qm(f){if(f==null||typeof f=="boolean"||typeof f=="number"||typeof f=="string"||f instanceof Boolean||f instanceof Number||f instanceof String||f instanceof Date||f instanceof RegExp||Ov(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(qm);if(typeof f=="object"){const c=f.$name||"Object";if(c==="Map"){const v=f.entries||[],k=new Map;for(let S=0;Sf>=128&&f<=255,Arabic:f=>f>=1536&&f<=1791,"Arabic Supplement":f=>f>=1872&&f<=1919,"Arabic Extended-A":f=>f>=2208&&f<=2303,"Hangul Jamo":f=>f>=4352&&f<=4607,"Unified Canadian Aboriginal Syllabics":f=>f>=5120&&f<=5759,Khmer:f=>f>=6016&&f<=6143,"Unified Canadian Aboriginal Syllabics Extended":f=>f>=6320&&f<=6399,"General Punctuation":f=>f>=8192&&f<=8303,"Letterlike Symbols":f=>f>=8448&&f<=8527,"Number Forms":f=>f>=8528&&f<=8591,"Miscellaneous Technical":f=>f>=8960&&f<=9215,"Control Pictures":f=>f>=9216&&f<=9279,"Optical Character Recognition":f=>f>=9280&&f<=9311,"Enclosed Alphanumerics":f=>f>=9312&&f<=9471,"Geometric Shapes":f=>f>=9632&&f<=9727,"Miscellaneous Symbols":f=>f>=9728&&f<=9983,"Miscellaneous Symbols and Arrows":f=>f>=11008&&f<=11263,"CJK Radicals Supplement":f=>f>=11904&&f<=12031,"Kangxi Radicals":f=>f>=12032&&f<=12255,"Ideographic Description Characters":f=>f>=12272&&f<=12287,"CJK Symbols and Punctuation":f=>f>=12288&&f<=12351,Hiragana:f=>f>=12352&&f<=12447,Katakana:f=>f>=12448&&f<=12543,Bopomofo:f=>f>=12544&&f<=12591,"Hangul Compatibility Jamo":f=>f>=12592&&f<=12687,Kanbun:f=>f>=12688&&f<=12703,"Bopomofo Extended":f=>f>=12704&&f<=12735,"CJK Strokes":f=>f>=12736&&f<=12783,"Katakana Phonetic Extensions":f=>f>=12784&&f<=12799,"Enclosed CJK Letters and Months":f=>f>=12800&&f<=13055,"CJK Compatibility":f=>f>=13056&&f<=13311,"CJK Unified Ideographs Extension A":f=>f>=13312&&f<=19903,"Yijing Hexagram Symbols":f=>f>=19904&&f<=19967,"CJK Unified Ideographs":f=>f>=19968&&f<=40959,"Yi Syllables":f=>f>=40960&&f<=42127,"Yi Radicals":f=>f>=42128&&f<=42191,"Hangul Jamo Extended-A":f=>f>=43360&&f<=43391,"Hangul Syllables":f=>f>=44032&&f<=55215,"Hangul Jamo Extended-B":f=>f>=55216&&f<=55295,"Private Use Area":f=>f>=57344&&f<=63743,"CJK Compatibility Ideographs":f=>f>=63744&&f<=64255,"Arabic Presentation Forms-A":f=>f>=64336&&f<=65023,"Vertical Forms":f=>f>=65040&&f<=65055,"CJK Compatibility Forms":f=>f>=65072&&f<=65103,"Small Form Variants":f=>f>=65104&&f<=65135,"Arabic Presentation Forms-B":f=>f>=65136&&f<=65279,"Halfwidth and Fullwidth Forms":f=>f>=65280&&f<=65519,Osage:f=>f>=66736&&f<=66815,"CJK Unified Ideographs Extension B":f=>f>=131072&&f<=173791};function Dv(f){for(const c of f)if(Kk(c.charCodeAt(0)))return!0;return!1}function h5(f){for(const c of f)if(!NP(c.charCodeAt(0)))return!1;return!0}function NP(f){return!(Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f))}function Kk(f){return!(f!==746&&f!==747&&(f<4352||!(Tn["Bopomofo Extended"](f)||Tn.Bopomofo(f)||Tn["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||Tn["CJK Compatibility Ideographs"](f)||Tn["CJK Compatibility"](f)||Tn["CJK Radicals Supplement"](f)||Tn["CJK Strokes"](f)||!(!Tn["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||Tn["CJK Unified Ideographs Extension A"](f)||Tn["CJK Unified Ideographs"](f)||Tn["Enclosed CJK Letters and Months"](f)||Tn["Hangul Compatibility Jamo"](f)||Tn["Hangul Jamo Extended-A"](f)||Tn["Hangul Jamo Extended-B"](f)||Tn["Hangul Jamo"](f)||Tn["Hangul Syllables"](f)||Tn.Hiragana(f)||Tn["Ideographic Description Characters"](f)||Tn.Kanbun(f)||Tn["Kangxi Radicals"](f)||Tn["Katakana Phonetic Extensions"](f)||Tn.Katakana(f)&&f!==12540||!(!Tn["Halfwidth and Fullwidth Forms"](f)||f===65288||f===65289||f===65293||f>=65306&&f<=65310||f===65339||f===65341||f===65343||f>=65371&&f<=65503||f===65507||f>=65512&&f<=65519)||!(!Tn["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||Tn["Unified Canadian Aboriginal Syllabics"](f)||Tn["Unified Canadian Aboriginal Syllabics Extended"](f)||Tn["Vertical Forms"](f)||Tn["Yijing Hexagram Symbols"](f)||Tn["Yi Syllables"](f)||Tn["Yi Radicals"](f))))}function Zk(f){return!(Kk(f)||function(c){return!!(Tn["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||Tn["General Punctuation"](c)&&(c===8214||c===8224||c===8225||c===8240||c===8241||c===8251||c===8252||c===8258||c===8263||c===8264||c===8265||c===8273)||Tn["Letterlike Symbols"](c)||Tn["Number Forms"](c)||Tn["Miscellaneous Technical"](c)&&(c>=8960&&c<=8967||c>=8972&&c<=8991||c>=8996&&c<=9e3||c===9003||c>=9085&&c<=9114||c>=9150&&c<=9165||c===9167||c>=9169&&c<=9179||c>=9186&&c<=9215)||Tn["Control Pictures"](c)&&c!==9251||Tn["Optical Character Recognition"](c)||Tn["Enclosed Alphanumerics"](c)||Tn["Geometric Shapes"](c)||Tn["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||Tn["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||Tn["CJK Symbols and Punctuation"](c)||Tn.Katakana(c)||Tn["Private Use Area"](c)||Tn["CJK Compatibility Forms"](c)||Tn["Small Form Variants"](c)||Tn["Halfwidth and Fullwidth Forms"](c)||c===8734||c===8756||c===8757||c>=9984&&c<=10087||c>=10102&&c<=10131||c===65532||c===65533)}(f))}function Yk(f){return Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function f5(f){return f>=1424&&f<=2303||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function bp(f,c){return!(!c&&f5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||Tn.Khmer(f))}function uae(f){for(const c of f)if(f5(c.charCodeAt(0)))return!0;return!1}const Ud={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let p5=null,ed=Ud.unavailable,wp=null;const Rv=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(ed=Ud.error),p5&&p5(f)};function Xk(){Qk.fire(new hf("pluginStateChange",{pluginStatus:ed,pluginURL:wp}))}const Qk=new Gg,Fv=function(){return ed},SP=function(){if(ed!==Ud.deferred||!wp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ed=Ud.loading,Xk(),wp&&Gu({url:wp},f=>{f?Rv(f):(ed=Ud.loaded,Xk())})},jp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ed===Ud.loaded||jp.applyArabicShaping!=null,isLoading:()=>ed===Ud.loading,setState(f){ed=f.pluginStatus,wp=f.pluginURL},isParsing:()=>ed===Ud.parsing,isParsed:()=>ed===Ud.parsed,getPluginURL:()=>wp};class Ji{constructor(c,u){this.zoom=c,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.transition=u.transition,this.pitch=u.pitch,this.brightness=u.brightness,this.worldview=u.worldview,this.activeFloors=u.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(c){return function(u,g){for(const v of u)if(!bp(v.charCodeAt(0),g))return!1;return!0}(c,jp.isLoaded())}}class Jk{constructor(c,u,g,v,k){this.property=c,this.value=u,this.expression=function(S,P,R,$,W){if(Hk(S))return new Gk(S,P);if(Lv(S)||Array.isArray(S)&&S.length>0){const G=d5(S,P,R,$,W);if(G.result==="error")throw new Error(G.value.map(X=>`${X.key}: ${X.message}`).join(", "));return G.value}{let G=S;return typeof S=="string"&&P.type==="color"&&(G=ki.parse(S)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>G}}}(u===void 0?c.specification.default:u,c.specification,g,v,k)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,u,g,v){return this.property.possiblyEvaluate(this,c,u,g,v)}}class m5{constructor(c,u,g,v){this.property=c,this.value=new Jk(c,void 0,u,g,v)}transitioned(c,u){return new MP(this.property,this.value,u,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new MP(this.property,this.value,null,{},0)}}class CP{constructor(c,u,g,v){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=u,this._options=g,this._iconImageUseTheme=v,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return ar(this._values[c].value.value)}setValue(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new m5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new Jk(this._values[c].property,u===null?void 0:ar(u),this._scope,this._options,this._iconImageUseTheme),this._values[c].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[c].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[c].value.isIndoorDependent())}setTransitionOrValue(c,u){u&&(this._options=u);const g=this._properties.properties;if(c)for(const v in c){const k=c[v];if(v.endsWith("-transition")){const S=v.slice(0,-11);g[S]&&this.setTransition(S,k)}else g.hasOwnProperty(v)&&this.setValue(v,k)}}getTransition(c){return ar(this._values[c].transition)}setTransition(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new m5(this._values[c].property)),this._values[c].transition=ar(u)||void 0}serialize(){const c={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(c[u]=g);const v=this.getTransition(u);v!==void 0&&(c[`${u}-transition`]=v)}return c}transitioned(c,u){const g=new TP(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].transitioned(c,u._values[v]);return g}untransitioned(){const c=new TP(this._properties);for(const u of Object.keys(this._values))c._values[u]=this._values[u].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class MP{constructor(c,u,g,v,k){const S=v.delay||0,P=v.duration||0;k=k||0,this.property=c,this.value=u,this.begin=k+S,this.end=this.begin+P,c.specification.transition&&(v.delay||v.duration)&&(this.prior=g)}possiblyEvaluate(c,u,g){const v=c.now||0,k=this.value.possiblyEvaluate(c,u,g),S=this.prior;if(S){if(v>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(v":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function EP(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function eN(f){if(Array.isArray(f))return f.map(eN);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const c={};for(const u in f)c[u]=eN(f[u]);return c}return EP(f)}function yf(f){if(f===!0||f===!1)return!0;if(!Array.isArray(f)||f.length===0)return!1;switch(f[0]){case"has":return f.length>=2&&f[1]!=="$id"&&f[1]!=="$type";case"in":return f.length>=3&&(typeof f[1]!="string"||Array.isArray(f[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return f.length!==3||Array.isArray(f[1])||Array.isArray(f[2]);case"any":case"all":for(const c of f.slice(1))if(!yf(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function tN(f,c="",u=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};yf(f)||(f=rN(f));const v=f;let k=!0;try{k=function(W){if(!zy(W))return W;let G=eN(W);return IP(G),G=sx(G),G}(v)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(v,null,2)} `)}let S=null,P=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){P=Ft[`filter_${g}`];const W=Um(k,P,c,u);if(W.result==="error")throw new Error(W.value.map(G=>`${G.key}: ${G.message}`).join(", "));S=(G,X,re)=>W.value.evaluate(G,X,{},re)}let R=null,$=null;if(k!==v){const W=Um(v,P,c,u);if(W.result==="error")throw new Error(W.value.map(G=>`${G.key}: ${G.message}`).join(", "));R=(G,X,re,se,pe)=>W.value.evaluate(G,X,{},re,void 0,void 0,se,pe),$=!Ty(W.value.expression)}return{filter:S,dynamicFilter:R||void 0,needGeometry:PP(k),needFeature:!!$}}function sx(f){if(!Array.isArray(f))return f;const c=function(u){if(hae.has(u[0])){for(let g=1;gsx(u))}function IP(f){let c=!1;const u=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function fae(f,c){return fc?1:0}function PP(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?nN(f[1],f[2],c):c==="any"?(u=f.slice(1),["any"].concat(u.map(rN))):c==="all"?["all"].concat(f.slice(1).map(rN)):c==="none"?["all"].concat(f.slice(1).map(rN).map(zv)):c==="in"?sN(f[1],f.slice(2)):c==="!in"?zv(sN(f[1],f.slice(2))):c==="has"?iN(f[1]):c!=="!has"||zv(iN(f[1]));var u}function nN(f,c,u){switch(f){case"$type":return[`filter-type-${u}`,c];case"$id":return[`filter-id-${u}`,c];default:return[`filter-${u}`,f,c]}}function sN(f,c){if(c.length===0)return!1;switch(f){case"$type":return["filter-type-in",["literal",c]];case"$id":return["filter-id-in",["literal",c]];default:return c.length>200&&!c.some(u=>typeof u!=typeof c[0])?["filter-in-large",f,["literal",c.sort(fae)]]:["filter-in-small",f,["literal",c]]}}function iN(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function zv(f){return["!",f]}const ix="";function Th(f,c){return c?`${f}${ix}${c}`:f}let LP;const OP=()=>LP||(LP=new $a({"icon-size":new Lr(Ft.layout_symbol["icon-size"]),"icon-image":new Lr(Ft.layout_symbol["icon-image"]),"icon-rotate":new Lr(Ft.layout_symbol["icon-rotate"]),"icon-offset":new Lr(Ft.layout_symbol["icon-offset"]),"text-size":new Lr(Ft.layout_symbol["text-size"]),"text-rotate":new Lr(Ft.layout_symbol["text-rotate"]),"text-offset":new Lr(Ft.layout_symbol["text-offset"])}));class DP{constructor(c,u,g,v,k,S){const P=Um(c,Ft.appearance.condition);if(P.result==="success"&&(this.condition=P.value),this.name=u,g){this.properties=new rx(OP()),this.unevaluatedLayout=new AP(OP(),v,k,S);for(const R in g)this.unevaluatedLayout.setValue(R,g[R])}}isActive(c){return!(this.condition||!c.isHidden||this.name!=="hidden")||this.condition.evaluate(c.globals,c.feature,c.featureState,c.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(c){return this.properties.get(c)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(c){return this.unevaluatedLayout._values[c]}recalculate(c,u,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,u,g))}serialize(){const c={};return c.condition=this.condition.expression.serialize(),this.name&&(c.name=this.name),this.unevaluatedLayout&&(c.properties=this.unevaluatedLayout.serialize()),c}hasIconProperties(){const c=this.hasProperty("icon-image"),u=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),v=this.hasProperty("icon-rotate");return c||u||g||v}hasTextProperties(){const c=this.hasProperty("text-size"),u=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return c||u||g}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const RP="-transition",vf=new Set(["fill","line","background","hillshade","raster"]);class td extends Gg{constructor(c,u,g,v,k,S){if(super(),this.id=c.id,this.fqid=Th(this.id,g),this.type=c.type,this.scope=g,this.lut=v,this.options=k,this.iconImageUseTheme=S,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},c.type!=="custom"){if(this.metadata=c.metadata,this.minzoom=c.minzoom,this.maxzoom=c.maxzoom,c.type&&c.type!=="background"&&c.type!=="sky"&&c.type!=="slot"){this.source=c.source,this.sourceLayer=c["source-layer"],this.filter=c.filter;const P=Um(this.filter,Ft[`filter_${c.type}`]);P.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...P.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||P.value.isIndoorDependent)}if(c.slot&&(this.slot=c.slot),c.appearances&&this.setAppearances(c.appearances),u.layout&&(this._unevaluatedLayout=new AP(u.layout,this.scope,k,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),u.paint){this._transitionablePaint=new CP(u.paint,this.scope,k);for(const P in c.paint)this.setPaintProperty(P,c.paint[P]);for(const P in c.layout)this.setLayoutProperty(P,c.layout[P]);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 rx(u.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&vf.has(this.type)}getLayoutProperty(c){return c==="visibility"?this.visibility:this._unevaluatedLayout.getValue(c)}setLayoutProperty(c,u){if(this.type==="custom"&&c==="visibility")return void(this.visibility=u);const g=this._unevaluatedLayout;g._properties.properties[c]&&(g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),c==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(c){this.appearances=[],c.forEach(u=>{this.appearances.push(new DP(u.condition,u.name,u.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(c){return c.endsWith(RP)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,u){const g=this._transitionablePaint,v=g._properties.properties;if(c.endsWith(RP)){const G=c.slice(0,-11);return v[G]&&g.setTransition(G,u||void 0),!1}if(!v[c])return!1;const k=g._values[c],S=k.value.isDataDriven(),P=k.value;g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const R=g._values[c].value,$=R.isDataDriven(),W=c.endsWith("pattern")||c==="line-dasharray";return $||S||W||this._handleOverridablePaintPropertyUpdate(c,P,R)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,u,g){return null}_handleOverridablePaintPropertyUpdate(c,u,g){return!1}isHidden(c){return!!(this.minzoom&&c=this.maxzoom)||this.visibility==="none"}updateTransitions(c){this._transitioningPaint=this._transitionablePaint.transitioned(c,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(c,u){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,u,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,u)}serialize(){const c={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&&(c.appearances=this.appearances.map(u=>u.serialize())),gr(c,(u,g)=>!(u===void 0||g==="layout"&&!Object.keys(u).length||g==="paint"&&!Object.keys(u).length))}is3D(c){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 c in this.paint._values){const u=this.paint.get(c);if(u instanceof tx&&Pv(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}for(const c of this.appearances)if(!Cv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=tN(this.filter,this.scope,c),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(c){this._stats&&(c.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(c,u,g){return{}}queryRadius(c){}queryIntersectsFeature(c,u,g,v,k,S,P,R,$){}}const FP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Bv{constructor(c,u){this._structArray=c,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const pae=new ArrayBuffer(0);class ga{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(c,u){return c._trim(),u&&c.arrayBuffer&&u.add(c.arrayBuffer),{length:c.length,arrayBuffer:c.arrayBuffer}}static deserialize(c){const u=Object.create(this.prototype);return u.arrayBuffer=c.arrayBuffer,u.length=c.length,c.arrayBuffer?u.capacity=c.arrayBuffer.byteLength/u.bytesPerElement:(u.capacity=0,u.arrayBuffer=pae),u._refreshViews(),u}_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(c){this.reserve(c),this.length=c}reserve(c){if(c>this.capacity){this._reallocCount++,this.capacity=Math.max(c,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}}reserveForAdditional(c){this.reserve(this.length+c)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...c){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...c){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 As(f,c=1){let u=0,g=0;return{members:f.map(v=>{const k=FP[v.type].BYTES_PER_ELEMENT,S=u=zP(u,Math.max(c,k)),P=v.components||1;return g=Math.max(g,k),u+=k*P,{name:v.name,type:v.type,components:P,offset:S}}),size:zP(u,Math.max(g,c)),alignment:c}}function zP(f,c){return Math.ceil(f/c)*c}class Vm extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.int16[v+0]=u,this.int16[v+1]=g,c}}Vm.prototype.bytesPerElement=4,Qr(Vm,"StructArrayLayout2i4");class By extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}By.prototype.bytesPerElement=6,Qr(By,"StructArrayLayout3i6");class $y extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.int16[S+0]=u,this.int16[S+1]=g,this.int16[S+2]=v,this.int16[S+3]=k,c}}$y.prototype.bytesPerElement=8,Qr($y,"StructArrayLayout4i8");class kp extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.float32[1*c+0]=u,c}}kp.prototype.bytesPerElement=4,Qr(kp,"StructArrayLayout1f4");class g5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c,S=2*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.float32[S+1]=v,c}}g5.prototype.bytesPerElement=8,Qr(g5,"StructArrayLayout2i1f8");class x5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}x5.prototype.bytesPerElement=8,Qr(x5,"StructArrayLayout3i8");class y5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=5*c;return this.int16[P+0]=u,this.int16[P+1]=g,this.int16[P+2]=v,this.int16[P+3]=k,this.int16[P+4]=S,c}}y5.prototype.bytesPerElement=10,Qr(y5,"StructArrayLayout5i10");class aN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=6*c,W=12*c,G=3*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.uint8[W+4]=v,this.uint8[W+5]=k,this.uint8[W+6]=S,this.uint8[W+7]=P,this.float32[G+2]=R,c}}aN.prototype.bytesPerElement=12,Qr(aN,"StructArrayLayout2i4ub1f12");class du extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.float32[k+0]=u,this.float32[k+1]=g,this.float32[k+2]=v,c}}du.prototype.bytesPerElement=12,Qr(du,"StructArrayLayout3f12");class jd extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=6*c,R=3*c;return this.uint16[P+0]=u,this.uint16[P+1]=g,this.uint16[P+2]=v,this.uint16[P+3]=k,this.float32[R+2]=S,c}}jd.prototype.bytesPerElement=12,Qr(jd,"StructArrayLayout4ui1f12");class ax extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.uint16[S+0]=u,this.uint16[S+1]=g,this.uint16[S+2]=v,this.uint16[S+3]=k,c}}ax.prototype.bytesPerElement=8,Qr(ax,"StructArrayLayout4ui8");class oN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=6*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.int16[R+3]=k,this.int16[R+4]=S,this.int16[R+5]=P,c}}oN.prototype.bytesPerElement=12,Qr(oN,"StructArrayLayout6i12");class v5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,G,X){const re=this.length;return this.resize(re+1),this.emplace(re,c,u,g,v,k,S,P,R,$,W,G,X)}emplace(c,u,g,v,k,S,P,R,$,W,G,X,re){const se=12*c;return this.int16[se+0]=u,this.int16[se+1]=g,this.int16[se+2]=v,this.int16[se+3]=k,this.uint16[se+4]=S,this.uint16[se+5]=P,this.uint16[se+6]=R,this.uint16[se+7]=$,this.int16[se+8]=W,this.int16[se+9]=G,this.int16[se+10]=X,this.int16[se+11]=re,c}}v5.prototype.bytesPerElement=24,Qr(v5,"StructArrayLayout4i4ui4i24");class _5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=10*c,$=5*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.float32[$+2]=k,this.float32[$+3]=S,this.float32[$+4]=P,c}}_5.prototype.bytesPerElement=20,Qr(_5,"StructArrayLayout3i3f20");class Hm extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.float32[S+0]=u,this.float32[S+1]=g,this.float32[S+2]=v,this.float32[S+3]=k,c}}Hm.prototype.bytesPerElement=16,Qr(Hm,"StructArrayLayout4f16");class lN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint32[1*c+0]=u,c}}lN.prototype.bytesPerElement=4,Qr(lN,"StructArrayLayout1ul4");class uu extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.uint16[v+0]=u,this.uint16[v+1]=g,c}}uu.prototype.bytesPerElement=4,Qr(uu,"StructArrayLayout2ui4");class cN extends ga{_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(c,u,g,v,k,S,P,R,$,W,G,X,re){const se=this.length;return this.resize(se+1),this.emplace(se,c,u,g,v,k,S,P,R,$,W,G,X,re)}emplace(c,u,g,v,k,S,P,R,$,W,G,X,re,se){const pe=20*c,Ce=10*c;return this.int16[pe+0]=u,this.int16[pe+1]=g,this.int16[pe+2]=v,this.int16[pe+3]=k,this.int16[pe+4]=S,this.float32[Ce+3]=P,this.float32[Ce+4]=R,this.float32[Ce+5]=$,this.float32[Ce+6]=W,this.int16[pe+14]=G,this.uint32[Ce+8]=X,this.uint16[pe+18]=re,this.uint16[pe+19]=se,c}}cN.prototype.bytesPerElement=40,Qr(cN,"StructArrayLayout5i4f1i1ul2ui40");class dN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=8*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.int16[$+2]=v,this.int16[$+4]=k,this.int16[$+5]=S,this.int16[$+6]=P,this.int16[$+7]=R,c}}dN.prototype.bytesPerElement=16,Qr(dN,"StructArrayLayout3i2i2i16");class uN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=4*c,R=8*c;return this.float32[P+0]=u,this.float32[P+1]=g,this.float32[P+2]=v,this.int16[R+6]=k,this.int16[R+7]=S,c}}uN.prototype.bytesPerElement=16,Qr(uN,"StructArrayLayout2f1f2i16");class b5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=20*c,$=5*c;return this.uint8[R+0]=u,this.uint8[R+1]=g,this.float32[$+1]=v,this.float32[$+2]=k,this.float32[$+3]=S,this.float32[$+4]=P,c}}b5.prototype.bytesPerElement=20,Qr(b5,"StructArrayLayout2ub4f20");class $o extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.uint16[k+0]=u,this.uint16[k+1]=g,this.uint16[k+2]=v,c}}$o.prototype.bytesPerElement=6,Qr($o,"StructArrayLayout3ui6");class Uy extends ga{_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(c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De,Be,We,dt){const it=this.length;return this.resize(it+1),this.emplace(it,c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De,Be,We,dt)}emplace(c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De,Be,We,dt,it){const gt=30*c,St=15*c,Tt=60*c;return this.int16[gt+0]=u,this.int16[gt+1]=g,this.int16[gt+2]=v,this.float32[St+2]=k,this.float32[St+3]=S,this.uint16[gt+8]=P,this.uint16[gt+9]=R,this.uint32[St+5]=$,this.uint32[St+6]=W,this.uint32[St+7]=G,this.uint16[gt+16]=X,this.uint16[gt+17]=re,this.uint16[gt+18]=se,this.float32[St+10]=pe,this.float32[St+11]=Ce,this.uint8[Tt+48]=Se,this.uint8[Tt+49]=De,this.uint8[Tt+50]=Be,this.uint32[St+13]=We,this.int16[gt+28]=dt,this.uint8[Tt+58]=it,c}}Uy.prototype.bytesPerElement=60,Qr(Uy,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class w5 extends ga{_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(c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De,Be,We,dt,it,gt,St,Tt,Kt,Dt,tr,or,lr,xr,vr,hr){const pr=this.length;return this.resize(pr+1),this.emplace(pr,c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De,Be,We,dt,it,gt,St,Tt,Kt,Dt,tr,or,lr,xr,vr,hr)}emplace(c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De,Be,We,dt,it,gt,St,Tt,Kt,Dt,tr,or,lr,xr,vr,hr,pr){const er=20*c,Yt=40*c,mr=80*c;return this.float32[er+0]=u,this.float32[er+1]=g,this.int16[Yt+4]=v,this.int16[Yt+5]=k,this.int16[Yt+6]=S,this.int16[Yt+7]=P,this.int16[Yt+8]=R,this.int16[Yt+9]=$,this.int16[Yt+10]=W,this.int16[Yt+11]=G,this.int16[Yt+12]=X,this.uint16[Yt+13]=re,this.uint16[Yt+14]=se,this.uint16[Yt+15]=pe,this.uint16[Yt+16]=Ce,this.uint16[Yt+17]=Se,this.uint16[Yt+18]=De,this.uint16[Yt+19]=Be,this.uint16[Yt+20]=We,this.uint16[Yt+21]=dt,this.uint16[Yt+22]=it,this.uint16[Yt+23]=gt,this.uint16[Yt+24]=St,this.uint16[Yt+25]=Tt,this.uint16[Yt+26]=Kt,this.uint16[Yt+27]=Dt,this.uint32[er+14]=tr,this.float32[er+15]=or,this.float32[er+16]=lr,this.float32[er+17]=xr,this.float32[er+18]=vr,this.uint8[mr+76]=hr,this.uint16[Yt+39]=pr,c}}w5.prototype.bytesPerElement=80,Qr(w5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class j5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=6*c;return this.float32[R+0]=u,this.float32[R+1]=g,this.float32[R+2]=v,this.float32[R+3]=k,this.float32[R+4]=S,this.float32[R+5]=P,c}}j5.prototype.bytesPerElement=24,Qr(j5,"StructArrayLayout6f24");class ox extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=5*c;return this.float32[P+0]=u,this.float32[P+1]=g,this.float32[P+2]=v,this.float32[P+3]=k,this.float32[P+4]=S,c}}ox.prototype.bytesPerElement=20,Qr(ox,"StructArrayLayout5f20");class k5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=7*c;return this.float32[$+0]=u,this.float32[$+1]=g,this.float32[$+2]=v,this.float32[$+3]=k,this.float32[$+4]=S,this.float32[$+5]=P,this.float32[$+6]=R,c}}k5.prototype.bytesPerElement=28,Qr(k5,"StructArrayLayout7f28");class N5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,G){const X=this.length;return this.resize(X+1),this.emplace(X,c,u,g,v,k,S,P,R,$,W,G)}emplace(c,u,g,v,k,S,P,R,$,W,G,X){const re=11*c;return this.float32[re+0]=u,this.float32[re+1]=g,this.float32[re+2]=v,this.float32[re+3]=k,this.float32[re+4]=S,this.float32[re+5]=P,this.float32[re+6]=R,this.float32[re+7]=$,this.float32[re+8]=W,this.float32[re+9]=G,this.float32[re+10]=X,c}}N5.prototype.bytesPerElement=44,Qr(N5,"StructArrayLayout11f44");class qy extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$){const W=this.length;return this.resize(W+1),this.emplace(W,c,u,g,v,k,S,P,R,$)}emplace(c,u,g,v,k,S,P,R,$,W){const G=9*c;return this.float32[G+0]=u,this.float32[G+1]=g,this.float32[G+2]=v,this.float32[G+3]=k,this.float32[G+4]=S,this.float32[G+5]=P,this.float32[G+6]=R,this.float32[G+7]=$,this.float32[G+8]=W,c}}qy.prototype.bytesPerElement=36,Qr(qy,"StructArrayLayout9f36");class _f extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.float32[v+0]=u,this.float32[v+1]=g,c}}_f.prototype.bytesPerElement=8,Qr(_f,"StructArrayLayout2f8");class kd extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=6*c;return this.uint32[3*c+0]=u,this.uint16[S+2]=g,this.uint16[S+3]=v,this.uint16[S+4]=k,c}}kd.prototype.bytesPerElement=12,Qr(kd,"StructArrayLayout1ul3ui12");class Wm extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint16[1*c+0]=u,c}}Wm.prototype.bytesPerElement=2,Qr(Wm,"StructArrayLayout1ui2");class S5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce){const Se=this.length;return this.resize(Se+1),this.emplace(Se,c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce)}emplace(c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se){const De=16*c;return this.float32[De+0]=u,this.float32[De+1]=g,this.float32[De+2]=v,this.float32[De+3]=k,this.float32[De+4]=S,this.float32[De+5]=P,this.float32[De+6]=R,this.float32[De+7]=$,this.float32[De+8]=W,this.float32[De+9]=G,this.float32[De+10]=X,this.float32[De+11]=re,this.float32[De+12]=se,this.float32[De+13]=pe,this.float32[De+14]=Ce,this.float32[De+15]=Se,c}}S5.prototype.bytesPerElement=64,Qr(S5,"StructArrayLayout16f64");class hN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=10*c,W=5*c;return this.uint16[$+0]=u,this.uint16[$+1]=g,this.uint16[$+2]=v,this.uint16[$+3]=k,this.float32[W+2]=S,this.float32[W+3]=P,this.float32[W+4]=R,c}}hN.prototype.bytesPerElement=20,Qr(hN,"StructArrayLayout4ui3f20");class C5 extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.int16[1*c+0]=u,c}}C5.prototype.bytesPerElement=2,Qr(C5,"StructArrayLayout1i2");class fN extends ga{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint8[1*c+0]=u,c}}fN.prototype.bytesPerElement=1,Qr(fN,"StructArrayLayout1ub1");class pN extends Bv{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]}}pN.prototype.size=40;class BP extends cN{get(c){return new pN(this,c)}}Qr(BP,"CollisionBoxArray");class mN extends Bv{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(c){this._structArray.uint8[this._pos1+49]=c}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(c){this._structArray.uint8[this._pos1+50]=c}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(c){this._structArray.uint32[this._pos4+13]=c}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(c){this._structArray.uint8[this._pos1+58]=c}}mN.prototype.size=60;class $P extends Uy{get(c){return new mN(this,c)}}Qr($P,"PlacedSymbolArray");class UP extends Bv{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(c){this._structArray.uint32[this._pos4+14]=c}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(c){this._structArray.float32[this._pos4+18]=c}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}UP.prototype.size=80;class M5 extends w5{get(c){return new UP(this,c)}}Qr(M5,"SymbolInstanceArray");class gN extends kp{getoffsetX(c){return this.float32[1*c+0]}}Qr(gN,"GlyphOffsetArray");class qP extends Vm{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}Qr(qP,"SymbolLineVertexArray");class T5 extends Bv{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]}}T5.prototype.size=12;class A5 extends kd{get(c){return new T5(this,c)}}Qr(A5,"FeatureIndexArray");class VP extends uu{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}Qr(VP,"FillExtrusionCentroidArray");class xN extends Bv{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]}}xN.prototype.size=6;class $v extends By{get(c){return new xN(this,c)}}Qr($v,"FillExtrusionWallArray");const HP=As([{name:"a_pos",components:2,type:"Int16"}],4),mae=As([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),WP=As([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Aa{constructor(c=[]){this.segments=c}_prepareSegment(c,u,g,v){let k=this.segments[this.segments.length-1];return c>Aa.MAX_VERTEX_ARRAY_LENGTH&&Vr(`Max vertices per segment is ${Aa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!k||k.vertexLength+c>Aa.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==v)&&(k={vertexOffset:u,primitiveOffset:g,vertexLength:0,primitiveLength:0},v!==void 0&&(k.sortKey=v),this.segments.push(k)),k}prepareSegment(c,u,g,v){return this._prepareSegment(c,u.length,g.length,v)}get(){return this.segments}destroy(){for(const c of this.segments)for(const u in c.vaos)c.vaos[u].destroy()}static simpleSegment(c,u,g,v){return new Aa([{vertexOffset:c,primitiveOffset:u,vertexLength:g,primitiveLength:v,vaos:{},sortKey:0}])}}function yN(f,c){return 256*(f=je(Math.floor(f),0,255))+je(Math.floor(c),0,255)}Aa.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qr(Aa,"SegmentVector");const gae=As([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),xae=As([{name:"a_pattern_b",components:4,type:"Uint16"}]),yae=As([{name:"a_dash",components:4,type:"Uint16"}]);class Uv{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,u,g,v){this.ids.push(E5(c)),this.positions.push(u,g,v)}eachPosition(c,u){const g=E5(c);let v=0,k=this.ids.length-1;for(;v>1;this.ids[S]>=g?k=S:v=S+1}for(;this.ids[v]===g;)u(this.positions[3*v],this.positions[3*v+1],this.positions[3*v+2]),v++}static serialize(c,u){const g=new Float64Array(c.ids),v=new Uint32Array(c.positions);return I5(g,v,0,g.length-1),u&&(u.add(g.buffer),u.add(v.buffer)),{ids:g,positions:v}}static deserialize(c){const u=new Uv;let g;u.ids=c.ids,u.positions=c.positions;for(const v of u.ids)v!==g&&u.uniqueIds.push(v),g=v;return u.indexed=!0,u}}function E5(f){const c=+f;return Number.isSafeInteger(c)?c:pk(String(f))}function I5(f,c,u,g){for(;u>1];let k=u-1,S=g+1;for(;;){do k++;while(f[k]v);if(k>=S)break;vN(f,k,S),vN(c,3*k,3*S),vN(c,3*k+1,3*S+1),vN(c,3*k+2,3*S+2)}S-u`u_${k}`),this.type=g,this.context=v}setUniform(c,u,g,v,k){const S=v.constantOr(this.value);u.set(c,k,S instanceof ki?S.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):S)}getBinding(c,u){return this.type==="color"?new Vv(c):new Uo(c)}}class Vy{constructor(c,u){this.uniformNames=u.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(c,u){this.pixelRatio=c.pixelRatio||1,this.pattern=c.tl.concat(c.br),this.patternTransition=u?u.tl.concat(u.br):this.pattern}setUniform(c,u,g,v,k){let S=null;k!=="u_pattern"&&k!=="u_dash"||(S=this.pattern),k==="u_pattern_b"&&(S=this.patternTransition),k==="u_pixel_ratio"&&(S=this.pixelRatio),S&&u.set(c,k,S)}getBinding(c,u){return u==="u_pattern"||u==="u_pattern_b"||u==="u_dash"?new bN(c):new Uo(c)}}class Sp{constructor(c,u,g,v){this.expression=c,this.type=g,this.maxValue=0,this.paintVertexAttributes=u.map(k=>({name:`a_${k}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new v}populatePaintArray(c,u,g,v,k,S,P,R){const $=this.paintVertexArray.length,W=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Ji(0,{brightness:S,worldview:R}),u,{},k,v,P):this.expression.kind==="constant"&&this.expression.value,G=Wv(this.lutExpression,u,{},v,k,S,P,R);this.paintVertexArray.resize(c),this._setPaintValue($,c,W,G?null:this.context.lut)}updatePaintArray(c,u,g,v,k,S,P,R){const $=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:P,worldview:R},g,v,void 0,k):this.expression.kind==="constant"&&this.expression.value,W=Wv(this.lutExpression,g,v,k,void 0,P,void 0,R);this._setPaintValue(c,u,$,W?null:this.context.lut)}_setPaintValue(c,u,g,v){if(this.type==="color"){const k=P5(g.toPremultipliedRenderColor(v));for(let S=c;S`u_${P}_t`),this.type=g,this.useIntegerZoom=v,this.context=k,this.maxValue=0,this.paintVertexAttributes=u.map(P=>({name:`a_${P}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(c,u,g,v,k,S,P,R){const $=this.expression.evaluate(new Ji(this.context.zoom,{brightness:S,worldview:R}),u,{},k,v,P),W=this.expression.evaluate(new Ji(this.context.zoom+1,{brightness:S,worldview:R}),u,{},k,v,P),G=Wv(this.lutExpression,u,{},v,k,S,P,R),X=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(X,c,$,W,G?null:this.context.lut)}updatePaintArray(c,u,g,v,k,S,P,R){const $=this.expression.evaluate({zoom:this.context.zoom,brightness:P,worldview:R},g,v,void 0,k),W=this.expression.evaluate({zoom:this.context.zoom+1,brightness:P,worldview:R},g,v,void 0,k),G=Wv(this.lutExpression,g,v,k,void 0,P,void 0,R);this._setPaintValue(c,u,$,W,G?null:this.context.lut)}_setPaintValue(c,u,g,v,k){if(this.type==="color"){const S=P5(g.toPremultipliedRenderColor(k)),P=P5(g.toPremultipliedRenderColor(k));for(let R=c;R!0){this.binders={},this._buffers=[],this.context=u;const v=[];for(const k in c.paint._values){const S=c.paint.get(k);if(k.endsWith("-use-theme")||!g(k)||!(S instanceof tx&&Pv(S.property.specification)))continue;const P=wae(k,c.type),R=S.value,$=S.property.specification.type,W=!!S.property.useIntegerZoom,G=k==="line-dasharray"||k.endsWith("pattern"),X=c.paint.get(`${k}-use-theme`),re=k==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||X&&X.value.kind!=="constant";if(R.kind!=="constant"||re)if(R.kind==="source"||re||G){const se=L5(k,$,"source");this.binders[k]=G?new Mp(R,P,$,se,c.id):new Sp(R,P,$,se),v.push(`/a_${k}`)}else{const se=L5(k,$,"composite");this.binders[k]=new Cp(R,P,$,W,u,se),v.push(`/z_${k}`)}else this.binders[k]=G?new Vy(R.value,P):new Gv(R.value,P,$,u),v.push(`/u_${k}`);X&&(this.binders[k].lutExpression=X.value)}this.cacheKey=v.sort().join("")}getMaxValue(c){const u=this.binders[c];return u instanceof Sp||u instanceof Cp?u.maxValue:0}populatePaintArrays(c,u,g,v,k,S,P,R){for(const $ in this.binders){const W=this.binders[$];W.context=this.context,(W instanceof Sp||W instanceof Cp||W instanceof Mp)&&W.populatePaintArray(c,u,g,v,k,S,P,R)}}setConstantPatternPositions(c,u){for(const g in this.binders){const v=this.binders[g];v instanceof Vy&&v.setConstantPatternPositions(c,u)}}getPatternTransitionVertexBuffer(c){const u=this.binders[c];return u instanceof Mp?u.paintTransitionVertexBuffer:null}updatePaintArrays(c,u,g,v,k,S,P,R,$,W){let G=!1;const X=Object.keys(c),re=X.length!==0&&!R,se=re?X:u.uniqueIds;this.context.lut=k.lut;for(const pe in this.binders){const Ce=this.binders[pe];if(Ce.context=this.context,(Ce instanceof Sp||Ce instanceof Cp||Ce instanceof Mp)&&Ce.expression&&Ce.expression.kind&&Ce.expression.kind!=="constant"&&(Ce.expression.isStateDependent===!0||Ce.expression.isLightConstant===!1)){const Se=k.paint.get(pe);Ce.expression=Se.value;for(const De of se){const Be=c[De.toString()];u.eachPosition(De,(We,dt,it)=>{const gt=v.feature(We);Ce.updatePaintArray(dt,it,gt,Be,S,P,$,W)})}if(!re)for(const De of g.uniqueIds){const Be=c[De.toString()];g.eachPosition(De,(We,dt,it)=>{const gt=v.feature(We);Ce.updatePaintArray(dt,it,gt,Be,S,P,$,W)})}G=!0}}return G}defines(){const c=[];for(const u in this.binders){const g=this.binders[u];(g instanceof Gv||g instanceof Vy)&&c.push(...g.uniformNames.map(v=>`#define HAS_UNIFORM_${v}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const u=[];for(const g in this.binders){const v=this.binders[g];if(v instanceof Gv||v instanceof Vy||v instanceof Cp)for(const k of v.uniformNames)u.push({name:k,property:g,binding:v.getBinding(c,k)})}return u}setUniforms(c,u,g,v,k){for(const{name:S,property:P,binding:R}of g)this.binders[P].setUniform(c,R,k,v.get(P),S)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const u=this.binders[c];(u instanceof Sp||u instanceof Cp||u instanceof Mp)&&u.paintVertexBuffer&&this._buffers.push(u.paintVertexBuffer),u instanceof Mp&&u.paintTransitionVertexBuffer&&this._buffers.push(u.paintTransitionVertexBuffer)}}upload(c){for(const u in this.binders){const g=this.binders[u];(g instanceof Sp||g instanceof Cp||g instanceof Mp)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const u=this.binders[c];(u instanceof Sp||u instanceof Cp||u instanceof Mp)&&u.destroy()}}}class Ah{constructor(c,u,g=()=>!0){this.programConfigurations={};for(const v of c)this.programConfigurations[v.id]=new Gm(v,u,g);this.needsUpload=!1,this._featureMap=new Uv,this._featureMapWithoutIds=new Uv,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,u,g,v,k,S,P,R,$){for(const W in this.programConfigurations)this.programConfigurations[W].populatePaintArrays(c,u,v,k,S,P,R,$);u.id!==void 0?this._featureMap.add(u.id,g,this._bufferOffset,c):(this._featureMapWithoutIds.add(this._idlessCounter,g,this._bufferOffset,c),this._idlessCounter+=1),this._bufferOffset=c,this.needsUpload=!0}updatePaintArrays(c,u,g,v,k,S,P,R){for(const $ of g)this.needsUpload=this.programConfigurations[$.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,u,$,v,k,S,P||0,R)||this.needsUpload}get(c){return this.programConfigurations[c]}upload(c){if(this.needsUpload){for(const u in this.programConfigurations)this.programConfigurations[u].upload(c);this.needsUpload=!1}}destroy(){for(const c in this.programConfigurations)this.programConfigurations[c].destroy()}}const bae={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function wae(f,c){return bae[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const jae={"line-pattern":{source:jd,composite:jd},"fill-pattern":{source:jd,composite:jd},"fill-extrusion-pattern":{source:jd,composite:jd},"line-dasharray":{source:ax,composite:ax}},kae={color:{source:_f,composite:Hm},number:{source:kp,composite:_f}};function L5(f,c,u){const g=jae[f];return g&&g[u]||kae[c][u]}Qr(Gv,"ConstantBinder"),Qr(Vy,"PatternConstantBinder"),Qr(Sp,"SourceExpressionBinder"),Qr(Mp,"PatternCompositeBinder"),Qr(Cp,"CompositeExpressionBinder"),Qr(Gm,"ProgramConfiguration",{omit:["_buffers"]}),Qr(Ah,"ProgramConfigurationSet");const gc=Mr/Math.PI/2,Ju=5,kN=6,Nae=16383,Hy=64,O5=[Hy,32,16],eh=-gc,th=gc;function lx(f,c,u,g=gc){return u=ss(u),[f*Math.sin(u)*g,-c*g,f*Math.cos(u)*g]}function Wy(f,c,u){return lx(Math.cos(ss(f)),Math.sin(ss(f)),c,u)}const _=63710088e-1,d=2*Math.PI*_;class m{constructor(c,u){if(isNaN(c)||isNaN(u))throw new Error(`Invalid LngLat object: (${c}, ${u})`);if(this.lng=+c,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new m(Ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const u=Math.PI/180,g=this.lat*u,v=c.lat*u,k=Math.sin(g)*Math.sin(v)+Math.cos(g)*Math.cos(v)*Math.cos((c.lng-this.lng)*u);return _*Math.acos(Math.min(k,1))}toBounds(c=0){const u=360*c/40075017,g=u/Math.cos(Math.PI/180*this.lat);return new w({lng:this.lng-g,lat:this.lat-u},{lng:this.lng+g,lat:this.lat+u})}toEcef(c){return Wy(this.lat,this.lng,gc+c*gc/_)}static convert(c){if(c instanceof m)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new m(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new m(Number("lng"in c?c.lng:c.lon),Number(c.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class w{constructor(c,u){c&&(u?this.setSouthWest(c).setNorthEast(u):Array.isArray(c)&&c.length===4?this.setSouthWest([c[0],c[1]]).setNorthEast([c[2],c[3]]):this.setSouthWest(c[0]).setNorthEast(c[1]))}setNorthEast(c){return this._ne=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}setSouthWest(c){return this._sw=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}extend(c){const u=this._sw,g=this._ne;let v,k;if(c instanceof m)v=c,k=c;else{if(!(c instanceof w))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(w.convert(c)):this.extend(m.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(m.convert(c)):this;if(v=c._sw,k=c._ne,!v||!k)return this}return u||g?(u.lng=Math.min(v.lng,u.lng),u.lat=Math.min(v.lat,u.lat),g.lng=Math.max(k.lng,g.lng),g.lat=Math.max(k.lat,g.lat)):(this._sw=new m(v.lng,v.lat),this._ne=new m(k.lng,k.lat)),this}getCenter(){return new m((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 m(this.getWest(),this.getNorth())}getSouthEast(){return new m(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(c){const{lng:u,lat:g}=m.convert(c);let v=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(v=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&v}static convert(c){if(c)return c instanceof w?c:new w(c)}}const M=0,O=25.5;function D(f){return d*Math.cos(f*Math.PI/180)}function B(f){return(180+f)/360}function V(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function Y(f,c){return f/D(c)}function Q(f){return 360*f-180}function ce(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function oe(f,c){return f*D(ce(c))}const ue=85.051129;function ke(f){return Math.cos(ss(je(f,-ue,ue)))}function _e(f,c){const u=je(c,M,O),g=Math.pow(2,u);return ke(f)*d/(512*g)}function Le(f){return 1/Math.cos(f*Math.PI/180)}function Pe(f,c=0){const u=Math.exp(Math.PI*(1-(f.y+c/Mr)/(1<=R?(Ze(f,c,u,$,W,k,G,P,R),Ze(f,$,W,g,v,G,S,P,R)):f.push(S)}function He(f,c,u){let g=f[0],v=g.x,k=g.y;c(g);const S=[g];for(let P=1;Pf.x+1||gf.y+1)&&Vr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function wt(f,c,u){const g=f.loadGeometry(),v=f.extent,k=Mr/v;if(c&&u&&u.projection.isReprojectedInTileSpace){const S=1<{const re=Q((c.x+X.x/v)/S),se=ce((c.y+X.y/v)/S),pe=W.project(re,se);X.x=(pe.x*P-R)*v,X.y=(pe.y*P-$)*v};for(let X=0;X=v||se.y<0||se.y>=v||(G(se),re.push(se));g[X]=re}}for(const S of g)for(const P of S)st(P,k);return g}function Ot(f,c){return{type:f.type,id:f.id,properties:f.properties,geometry:c?wt(f):[]}}class Pt{constructor(c,u,g,v,k){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=c,this._geometry=-1,this._keys=v,this._values=k,c.readFields(Vt,this,u)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos,g=[];let v,k=1,S=0,P=0,R=0;for(;c.pos>3}if(S--,k===1||k===2)P+=c.readSVarint(),R+=c.readSVarint(),k===1&&(v&&g.push(v),v=[]),v&&v.push(new ir(P,R));else{if(k!==7)throw new Error(`unknown command ${k}`);v&&v.push(v[0].clone())}}return v&&g.push(v),g}bbox(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos;let g=1,v=0,k=0,S=0,P=1/0,R=-1/0,$=1/0,W=-1/0;for(;c.pos>3}if(v--,g===1||g===2)k+=c.readSVarint(),S+=c.readSVarint(),kR&&(R=k),S<$&&($=S),S>W&&(W=S);else if(g!==7)throw new Error(`unknown command ${g}`)}return[P,$,R,W]}toGeoJSON(c,u,g){const v=this.extent*Math.pow(2,g),k=this.extent*c,S=this.extent*u,P=this.loadGeometry();function R(X){return[360*(X.x+k)/v-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+S)/v)*Math.PI))-90]}function $(X){return X.map(R)}let W;if(this.type===1){const X=[];for(const se of P)X.push(se[0]);const re=$(X);W=X.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const X=P.map($);W=X.length===1?{type:"LineString",coordinates:X[0]}:{type:"MultiLineString",coordinates:X}}else{if(this.type!==3)throw new Error("unknown feature type");{const X=function(se){const pe=se.length;if(pe<=1)return[se];const Ce=[];let Se,De;for(let Be=0;Be=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];const u=this._pbf.readVarint()+this._pbf.pos;return new Pt(this._pbf,u,this.extent,this._keys,this._values)}}function br(f,c,u){f===15?c.version=u.readVarint():f===1?c.name=u.readString():f===5?c.extent=u.readVarint():f===2?c._features.push(u.pos):f===3?c._keys.push(u.readString()):f===4&&c._values.push(function(g){let v=null;const k=g.readVarint()+g.pos;for(;g.pos>3;v=S===1?g.readString():S===2?g.readFloat():S===3?g.readDouble():S===4?g.readVarint64():S===5?g.readVarint():S===6?g.readSVarint():S===7?g.readBoolean():null}if(v==null)throw new Error("unknown feature value");return v}(u))}class zt{constructor(c,u){this.layers=c.readFields(Mt,{},u)}}function Mt(f,c,u){if(f===3){const g=new sr(u,u.readVarint()+u.pos);g.length&&(c[g.name]=g)}}const Xt="3d_elevation_id",qt="level";class ur{constructor(){this._valid=!1}reset(c){return this.feature=c,this._valid=!0,this._geometry=c.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(c,u){return this._valid&&c(u(this._geometry)),this}require(c,u,g){return this.get(c,!0,u,g)}optional(c,u,g){return this.get(c,!1,u,g)}success(){return this._valid}get(c,u,g,v){const k=this.feature.properties.hasOwnProperty(c)?+this.feature.properties[c]:void 0;return this._valid&&k!==void 0&&!Number.isNaN(k)?g(v?v(k):k):u&&(this._valid=!1),this}}class Er{constructor(c,u){this.featureFunc=c,this.vertexFunc=u}parseFeature(c,u,g){return this.featureFunc(c,u,g)}parseVertex(c,u,g){return this.vertexFunc(c,u,g)}}const Gr=new Er((f,c,u)=>f.reset(c).require(Xt,g=>{u.id=g}).optional("fixed_height_relative",g=>{u.constantHeight=g},wr.decodeRelativeHeight).geometry(g=>{u.bounds=g},yp).success(),(f,c,u)=>f.reset(c).require(Xt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height_relative",g=>{u.height=g},wr.decodeRelativeHeight).geometry(g=>{u.position=g},wr.getPoint).success()),Sr=new Er((f,c,u)=>f.reset(c).require(Xt,g=>{u.id=g}).optional("fixed_height",g=>{u.constantHeight=g},wr.decodeMetricHeight).geometry(g=>{u.bounds=g},yp).success(),(f,c,u)=>f.reset(c).require(Xt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height",g=>{u.height=g},wr.decodeMetricHeight).geometry(g=>{u.position=g},wr.getPoint).success());class wr{static getPoint(c){return fr(c[0][0].x,c[0][0].y)}static decodeRelativeHeight(c){return 1e-4*c*5}static decodeMetricHeight(c){return 1e-4*c}static getVersionSchema(c){return c?c==="1.0.1"?Sr:void 0:Gr}static parse(c){const u=[],g=[],v=c.length,k=new ur;for(let S=0;S=0);if(k===0)return 0;k!==c.length&&(u=!1)}return u?2:1}function Yn(f,c){for(const u of f.projections){const g=Kr(c,f.points[0],u.axis);if(u.projection[1]g[1])return 0}return 1}function Ls(f,c){let u=0;const g=[0,0,0,0];for(let S=0;S=0&&u++;var v,k;return u}class ui{constructor(c,u){this.points=c||new Array(8).fill([0,0,0]),this.planes=u||new Array(6).fill([0,0,0,0]),this.bounds=dn.fromPoints(this.points),this.projections=[],this.frustumEdges=[Ae([],this.points[2],this.points[3]),Ae([],this.points[0],this.points[3]),Ae([],this.points[4],this.points[0]),Ae([],this.points[5],this.points[1]),Ae([],this.points[6],this.points[2]),Ae([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const v=[0,-g[2],g[1]],k=[g[2],0,-g[0]];this.projections.push({axis:v,projection:Kr(this.points,this.points[0],v)}),this.projections.push({axis:k,projection:Kr(this.points,this.points[0],k)})}}static fromInvProjectionMatrix(c,u,g,v){const k=Math.pow(2,g),S=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map($=>{const W=jt([],$,c),G=1/W[3]/u*k;return(X=W)[0]=(re=W)[0]*(se=[G,G,v?1/W[3]:G,G])[0],X[1]=re[1]*se[1],X[2]=re[2]*se[2],X[3]=re[3]*se[3],X;var X,re,se}),P=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map($=>{const W=Fe([],Qe([],Ae([],S[$[0]],S[$[1]]),Ae([],S[$[2]],S[$[1]]))),G=-Me(W,S[$[1]]);return W.concat(G)}),R=[];for(let $=0;$$[1]||$[0]>R[1])return 0}return 1}containsPoint(c){for(const u of this.planes){const g=u[3];if(Me([u[0],u[1],u[2]],c)+g<0)return!1}return!0}}class dn{static fromPoints(c){const u=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const v of c)Ne(u,u,v),we(g,g,v);return new dn(u,g)}static fromTileIdAndHeight(c,u,g){const v=1<c.max[u]||c.min[u]>this.max[u])return!1;return!0}intersectsAabbXY(c){return!(this.min[0]>c.max[0]||c.min[0]>this.max[0]||this.min[1]>c.max[1]||c.min[1]>this.max[1])}encapsulate(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c.min[u]),this.max[u]=Math.max(this.max[u],c.max[u])}encapsulatePoint(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c[u]),this.max[u]=Math.max(this.max[u],c[u])}closestPoint(c){return[Math.max(Math.min(this.max[0],c[0]),this.min[0]),Math.max(Math.min(this.max[1],c[1]),this.min[1]),Math.max(Math.min(this.max[2],c[2]),this.min[2])]}}Qr(dn,"Aabb");class ii{constructor(c,u){this.feature=c,this.metersToTile=u,this.index=0}get(){const c=this.feature.vertices[this.index],u=this.feature.vertexProps[this.index].dir,g=u[1],v=-u[0],k=(c.extent+1)*this.metersToTile;return[new ir(Math.trunc(c.position[0]+g*k),Math.trunc(c.position[1]+v*k)),new ir(Math.trunc(c.position[0]-g*k),Math.trunc(c.position[1]-v*k))]}next(){this.index++}valid(){return this.index{return P.a0?he(R,R,1/$):fe(R,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let u=0,g=Number.POSITIVE_INFINITY,v=0;const[k,S,P,R,$,W,G]=this._tmpVec2;xs(G,c.x,c.y);const X=new on(G,null);for(let re=0;re0?rl(R,P)/We:0,it=je(dt,0,1),gt=Math.abs((dt-it)*this.edgeProps[re].len);mi($,G,Ce),xs(W,pe[1],-pe[0]);const St=gt+Math.abs(rl($,W));St=0;--S){const P=this.edges[S].a,R=this.edges[S].b,{position:$,height:W,extent:G}=this.vertices[P],{position:X,height:re,extent:se}=this.vertices[R],pe=this.vertexProps[P].dir,Ce=this.vertexProps[R].dir;if(fe(u,$[0]/c,$[1]/c,W),fe(g,X[0]/c,X[1]/c,re),fe(v,pe[1],-pe[0],0),he(v,v,G),fe(k,Ce[1],-Ce[0],0),he(k,k,se),this.distSqLines(ie(u[0]+.5*v[0],u[1]+.5*v[1],u[2]+.5*v[2]),ie(g[0]-.5*k[0],g[1]-.5*k[1],g[2]-.5*k[2]),ie(u[0]-.5*v[0],u[1]-.5*v[1],u[2]-.5*v[2]),ie(g[0]+.5*k[0],g[1]+.5*k[1],g[2]+.5*k[2]))<=.0025000000000000005)continue;const Se=this.vertices.length,De=ji(ks(),$,X);this.vertices.push({position:La(De,De,.5),height:.5*(W+re),extent:.5*(G+se)});const Be=ji(ks(),pe,Ce);this.vertexProps.push({dir:tl(Be,Be)}),this.edges.splice(S,1),this.edgeProps.splice(S,1),this.edges.push({a:P,b:Se}),this.edges.push({a:Se,b:R});const We=mi(ks(),this.vertices[Se].position,$),dt=da(We),it={vec:We,dir:La(ks(),We,1/dt),len:dt};this.edgeProps.push(it),this.edgeProps.push(it)}}distSqLines(c,u,g,v){const k=ye(ve(),u,c),S=ye(ve(),v,g),P=ye(ve(),c,g),R=Me(k,k),$=Me(k,S),W=Me(k,P),G=Me(S,S),X=Me(S,P),re=R*G-$*$;if(re===0)return Oe(Ee(k,g,v,Me(P,S)/Me(S,S)),c);const se=(R*X-$*W)/re;return Oe(Ee(k,c,u,($*X-W*G)/re),Ee(S,g,v,se))}}class gi{static parseFrom(c,u){const g=wr.parse(c);if(!g)return[];let{vertices:v,features:k}=g;const S=1/Pe(u);k.sort((W,G)=>W.id-G.id),v.sort((W,G)=>W.id-G.id||W.idx-G.idx),v=v.filter((W,G,X)=>G===X.findIndex(re=>re.id===W.id&&re.idx===W.idx));const P=new Array;let R=0;const $=v.length;for(const W of k){if(W.constantHeight){P.push(new Wn(W.id,W.bounds,W.constantHeight));continue}for(;R!==$&&v[R].idv.id===g)}}class Li{constructor(c,u){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(u)||(this.zScale=Math.pow(2,u.z-c.z),this.xOffset=(c.x*this.zScale-u.x)*Mr,this.yOffset=(c.y*this.zScale-u.y)*Mr)}constantElevation(c,u){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,u)}pointElevation(c,u,g){const v=this.constantElevation(u,g);return v??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(u.pointElevation(c),g))}computeBiasedHeight(c,u){return u<=0?c:c+u*Re(0,u,c>=0?c:Math.abs(.5*c))}}Qr(Wn,"ElevationFeature");class Ni{constructor(c){this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.projection=c.projection,this.layoutVertexArray=new Vm,this.indexArray=new $o,this.segments=new Aa,this.programConfigurations=new Ah(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new kp),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=this.layers[0],S=[];let P=null;k.type==="circle"&&(P=k.layout.get("circle-sort-key"));for(const{feature:$,id:W,index:G,sourceLayerIndex:X}of c){const re=this.layers[0]._featureFilter.needGeometry,se=Ot($,re);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),se,g))continue;const pe=P?P.evaluate(se,{},g):void 0,Ce={id:W,properties:$.properties,type:$.type,sourceLayerIndex:X,index:G,geometry:re?se.geometry:wt($,g,v),patterns:{},sortKey:pe};S.push(Ce)}P&&S.sort(($,W)=>$.sortKey-W.sortKey);let R=null;v.projection.name==="globe"&&(this.globeExtVertexArray=new oN,R=v.projection);for(const $ of S){const{geometry:W,index:G,sourceLayerIndex:X}=$,re=c[G].feature;this.addFeature($,W,G,u.availableImages,g,R,u.brightness,u.elevationFeatures),u.featureIndex.insert(re,W,G,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,u,g,v,k,S,P){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,HP.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,WP.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,mae.members))),this.programConfigurations.upload(c),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(c,u,g,v,k,S,P,R){let $;this.elevationMode!=="none"&&($=gi.getElevationFeature(c,R));for(const W of u)for(const G of W){const X=G.x,re=G.y;if(X<0||X>=Mr||re<0||re>=Mr)continue;if(S){const Ce=S.projectTilePoint(X,re,k),Se=S.upVector(k,X,re);this.addGlobeExtVertex(Ce,Se),this.addGlobeExtVertex(Ce,Se),this.addGlobeExtVertex(Ce,Se),this.addGlobeExtVertex(Ce,Se)}const se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),pe=se.vertexLength;if(this.addCircleVertex(X,re,-1,-1),this.addCircleVertex(X,re,1,-1),this.addCircleVertex(X,re,1,1),this.addCircleVertex(X,re,-1,1),this.elevationMode!=="none"){const Ce=$?$.pointElevation(new ir(X,re)):0;this.hasElevation=this.hasElevation||Ce!==0;for(let Se=0;Se<4;Se++)this.elevatedLayoutVertexArray.emplaceBack(Ce)}this.indexArray.emplaceBack(pe,pe+1,pe+2),this.indexArray.emplaceBack(pe,pe+2,pe+3),se.vertexLength+=4,se.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,{},v,k,P,void 0,this.worldview)}addCircleVertex(c,u,g,v){this.layoutVertexArray.emplaceBack(2*c+(g+1)/2,2*u+(v+1)/2)}addGlobeExtVertex(c,u){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}}function ni(f,c){for(let u=0;u1){if(xa(f,c))return!0;for(let g=0;g1?u:u.sub(c)._mult(v)._add(c))}function Ea(f,c){let u,g,v,k=!1;for(let S=0;Sc.y!=v.y>c.y&&c.x<(v.x-g.x)*(c.y-g.y)/(v.y-g.y)+g.x&&(k=!k)}return k}function qi(f,c){let u=!1;for(let g=0,v=f.length-1;gc.y!=S.y>c.y&&c.x<(S.x-k.x)*(c.y-k.y)/(S.y-k.y)+k.x&&(u=!u)}return u}function rd(f,c,u,g,v){for(const S of f)if(c<=S.x&&u<=S.y&&g>=S.x&&v>=S.y)return!0;const k=[new ir(c,u),new ir(c,v),new ir(g,v),new ir(g,u)];if(f.length>2){for(const S of k)if(qi(f,S))return!0}for(let S=0;Sv.x&&c.x>v.x||f.yv.y&&c.y>v.y)return!1;const k=ts(f,c,u[0]);return k!==ts(f,c,u[1])||k!==ts(f,c,u[2])||k!==ts(f,c,u[3])}function qo(f,c,u,g,v,k){let S=c.y-f.y,P=f.x-c.x;if(k=k||0){const R=S*S+P*P;if(R===0)return!0;const $=Math.sqrt(R);S/=$,P/=$}return!((u.x-f.x)*S+(u.y-f.y)*P-k<0||(g.x-f.x)*S+(g.y-f.y)*P-k<0||(v.x-f.x)*S+(v.y-f.y)*P-k<0)}function xc(f,c,u,g,v,k,S){return!(qo(f,c,g,v,k,S)||qo(c,u,g,v,k,S)||qo(u,f,g,v,k,S)||qo(g,v,f,c,u,S)||qo(v,k,f,c,u,S)||qo(k,g,f,c,u,S))}function yc(f,c,u){const g=c.paint.get(f).value;return g.kind==="constant"?g.value:u.programConfigurations.get(c.id).getMaxValue(f)}function zl(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function hu(f,c,u,g,v){if(!c[0]&&!c[1])return f;const k=ir.convert(c)._mult(v);u==="viewport"&&k._rotate(-g);const S=[];for(let P=0;P>u&&c.y===this.y>>u}url(c,u){const g=function(k,S,P){var R=oo(256*k,256*(S=Math.pow(2,P)-S-1),P),$=oo(256*(k+1),256*(S+1),P);return R[0]+","+R[1]+","+$[0]+","+$[1]}(this.x,this.y,this.z),v=function(k,S,P){let R,$="";for(let W=k;W>0;W--)R=1<this.canonical.z?new Ra(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ra(c,this.wrap,c,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(c,u=!0){if(this.overscaledZ===c&&u)return this.key;if(c>this.canonical.z)return Ia(this.wrap*+u,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Ia(this.wrap*+u,c,c,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(c){if(c.wrap!==this.wrap)return!1;const u=this.canonical.z-c.canonical.z;return c.overscaledZ===0||c.overscaledZ>u&&c.canonical.y===this.canonical.y>>u}children(c){if(this.overscaledZ>=c)return[new Ra(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const u=this.canonical.z+1,g=2*this.canonical.x,v=2*this.canonical.y;return[new Ra(u,this.wrap,u,g,v),new Ra(u,this.wrap,u,g+1,v),new Ra(u,this.wrap,u,g,v+1),new Ra(u,this.wrap,u,g+1,v+1)]}isLessThan(c){return this.wrapc.wrap)&&(this.overscaledZc.overscaledZ)&&(this.canonical.xc.canonical.x)&&this.canonical.y{let c=f.canonical.x-1,u=f.wrap;return c<0&&(c=(1<{let c=f.canonical.x+1,u=f.wrap;return c===1<new Ra(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Ra(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,v,k,S){const P=Math.sin(k);return g*(Math.sin((1-S)*k)/P)+v*(Math.sin(S*k)/P)}(f.a[c],f.b[c],f.angle,je(u,0,1))+f.center[c]}function Ih(f){if(f.z<=1)return Tp[f.z+2*f.y+f.x];const c=Sae(GP(f));return dn.fromPoints(c)}function Ep(f,c,u){return he(f,f,1-u),xe(f,f,c,u)}function B0e(f,c,u){for(const g of f)Ye(g,g,c),he(g,g,u)}function $0e(f,c,u,g){const v=c/f.worldSize,k=f.globeMatrix;if(u.z<=1){const Tt=Ih(u).getCorners();return B0e(Tt,k,v),dn.fromPoints(Tt)}const S=GP(u,g),P=Sae(S,gc+wf(f._tileCoverLift));B0e(P,k,v);const R=Number.MAX_VALUE,$=[-R,-R,-R],W=[R,R,R];if(S.contains(f.center)){for(const Dt of P)Ne(W,W,Dt),we($,$,Dt);$[2]=0;const Tt=f.point,Kt=[Tt.x*v,Tt.y*v,0];return Ne(W,W,Kt),we($,$,Kt),new dn(W,$)}if(f._tileCoverLift>0){for(const Tt of P)Ne(W,W,Tt),we($,$,Tt);return new dn(W,$)}const G=[k[12]*v,k[13]*v,k[14]*v],X=S.getCenter(),re=je(f.center.lat,-ue,ue),se=je(X.lat,-ue,ue),pe=B(f.center.lng),Ce=V(re);let Se=pe-B(X.lng);const De=Ce-V(se);Se>.5?Se-=1:Se<-.5&&(Se+=1);let Be=0;Math.abs(Se)>Math.abs(De)?Be=Se>=0?1:3:(Be=De>=0?0:2,xe(G,G,[k[4]*v,k[5]*v,k[6]*v],-Math.sin(ss(De>=0?S.getSouth():S.getNorth()))*gc));const We=P[Be],dt=P[(Be+1)%4],it=new Km(We,dt,G),gt=[Ap(it,0)||We[0],Ap(it,1)||We[1],Ap(it,2)||We[2]],St=Zy(f.zoom);if(St>0){const Tt=function({x:Dt,y:tr,z:or},lr,xr,vr,hr){const pr=1/(1<.5?jr=-1:hn<-.5&&(jr=1),er=((er+jr)*lr-(vr*=lr))*xr+vr,Yt=((Yt+jr)*lr-vr)*xr+vr,mr=(mr*lr-(hr*=lr))*xr+hr,Tr=(Tr*lr-hr)*xr+hr,[[er,Tr,0],[Yt,Tr,0],[Yt,mr,0],[er,mr,0]]}(u,c,f._pixelsPerMercatorPixel,pe,Ce);for(let Dt=0;DtMath.PI/2*1.01}const W0e=ss(85),vUe=Math.cos(W0e),_Ue=Math.sin(W0e),bUe=N(),G0e=f=>{const c=[];return f.paint.get("circle-pitch-alignment")==="map"&&c.push("PITCH_WITH_MAP"),f.paint.get("circle-pitch-scale")==="map"&&c.push("SCALE_WITH_MAP"),c};function K0e(f,c,u,g,v,k,S,P,R){if(k&&f.queryGeometry.isAboveHorizon)return!1;k&&(R*=f.pixelToTileUnitsFactor);const $=f.tileID.canonical,W=u.projection.upVectorScale($,u.center.lat,u.worldSize).metersToTile;for(const G of c)for(const X of G){const re=X.add(P),se=v&&u.elevation?u.elevation.exaggeration()*v.getElevationAt(re.x,re.y,!0):0,pe=u.projection.projectTilePoint(re.x,re.y,$);if(se>0){const Be=u.projection.upVector($,re.x,re.y);pe.x+=Be[0]*W*se,pe.y+=Be[1]*W*se,pe.z+=Be[2]*W*se}const Ce=k?re:wUe(pe.x,pe.y,pe.z,g),Se=k?f.tilespaceRays.map(Be=>kUe(Be,se)):f.queryGeometry.screenGeometry,De=jt([],[pe.x,pe.y,pe.z,1],g);if(!S&&k?R*=De[3]/u.cameraToCenterDistance:S&&!k&&(R*=u.cameraToCenterDistance/De[3]),k){const Be=ce((X.y/Mr+$.y)/(1<<$.z));R/=u.projection.pixelsPerMeter(Be,1)/Y(1,Be)}if(as(Se,Ce,R))return!0}return!1}function wUe(f,c,u,g){const v=jt([],[f,c,u,1],g);return new ir(v[0]/v[3],v[1]/v[3])}const Z0e=ie(0,0,0),jUe=ie(0,0,1);function kUe(f,c){const u=ve();return Z0e[2]=c,f.intersectsPlane(Z0e,jUe,u),new ir(u[0],u[1])}class Y0e extends Ni{}let X0e,Q0e,J0e,e1e;function t1e(f,{width:c,height:u},g,v){if(v){if(v instanceof Uint8ClampedArray)v=new Uint8Array(v.buffer);else if(v.length!==c*u*g)throw new RangeError("mismatched image size")}else v=new Uint8Array(c*u*g);return f.width=c,f.height=u,f.data=v,f}function r1e(f,c,u){const{width:g,height:v}=c;g===f.width&&v===f.height||(Aae(f,c,{x:0,y:0},{x:0,y:0},{width:Math.min(f.width,g),height:Math.min(f.height,v)},u,null),f.width=g,f.height=v,f.data=c.data)}function Aae(f,c,u,g,v,k,S,P){if(v.width===0||v.height===0)return c;if(v.width>f.width||v.height>f.height||u.x>f.width-v.width||u.y>f.height-v.height)throw new RangeError("out of range source coordinates for image copy");if(v.width>c.width||v.height>c.height||g.x>c.width-v.width||g.y>c.height-v.height)throw new RangeError("out of range destination coordinates for image copy");const R=f.data,$=c.data,W=k===4&&P;for(let G=0;G{c[f.evaluationKey]=R;const $=f.expression.evaluate(c),W=$?$.toNonPremultipliedRenderColor(null):null;W&&(v.data[S+P+0]=Math.floor(255*W.r),v.data[S+P+1]=Math.floor(255*W.g),v.data[S+P+2]=Math.floor(255*W.b),v.data[S+P+3]=Math.floor(255*W.a))};if(f.clips)for(let S=0,P=0;S80*u){P=f[0],R=f[1];let W=P,G=R;for(let X=u;XW&&(W=re),se>G&&(G=se)}$=Math.max(W-P,G-R),$=$!==0?32767/$:0}return F5(k,S,u,P,R,$,0),S}function s1e(f,c,u,g,v){let k;if(v===function(S,P,R,$){let W=0;for(let G=P,X=R-$;G0)for(let S=c;S=c;S-=g)k=l1e(S/g|0,f[S],f[S+1],k);return k&&SN(k,k.next)&&($5(k),k=k.next),k}function Yv(f,c){if(!f)return f;c||(c=f);let u,g=f;do if(u=!1,g.steiner||!SN(g,g.next)&&Cl(g.prev,g,g.next)!==0)g=g.next;else{if($5(g),g=c=g.prev,g===g.next)break;u=!0}while(u||g!==c);return c}function F5(f,c,u,g,v,k,S){if(!f)return;!S&&k&&function(R,$,W,G){let X=R;do X.z===0&&(X.z=Eae(X.x,X.y,$,W,G)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==R);X.prevZ.nextZ=null,X.prevZ=null,function(re){let se,pe=1;do{let Ce,Se=re;re=null;let De=null;for(se=0;Se;){se++;let Be=Se,We=0;for(let it=0;it0||dt>0&&Be;)We!==0&&(dt===0||!Be||Se.z<=Be.z)?(Ce=Se,Se=Se.nextZ,We--):(Ce=Be,Be=Be.nextZ,dt--),De?De.nextZ=Ce:re=Ce,Ce.prevZ=De,De=Ce;Se=Be}De.nextZ=null,pe*=2}while(se>1)}(X)}(f,g,v,k);let P=f;for(;f.prev!==f.next;){const R=f.prev,$=f.next;if(k?AUe(f,g,v,k):TUe(f))c.push(R.i,f.i,$.i),$5(f),f=$.next,P=$.next;else if((f=$)===P){S?S===1?F5(f=EUe(Yv(f),c),c,u,g,v,k,2):S===2&&IUe(f,c,u,g,v,k):F5(Yv(f),c,u,g,v,k,1);break}}}function TUe(f){const c=f.prev,u=f,g=f.next;if(Cl(c,u,g)>=0)return!1;const v=c.x,k=u.x,S=g.x,P=c.y,R=u.y,$=g.y,W=Math.min(v,k,S),G=Math.min(P,R,$),X=Math.max(v,k,S),re=Math.max(P,R,$);let se=g.next;for(;se!==c;){if(se.x>=W&&se.x<=X&&se.y>=G&&se.y<=re&&z5(v,P,k,R,S,$,se.x,se.y)&&Cl(se.prev,se,se.next)>=0)return!1;se=se.next}return!0}function AUe(f,c,u,g){const v=f.prev,k=f,S=f.next;if(Cl(v,k,S)>=0)return!1;const P=v.x,R=k.x,$=S.x,W=v.y,G=k.y,X=S.y,re=Math.min(P,R,$),se=Math.min(W,G,X),pe=Math.max(P,R,$),Ce=Math.max(W,G,X),Se=Eae(re,se,c,u,g),De=Eae(pe,Ce,c,u,g);let Be=f.prevZ,We=f.nextZ;for(;Be&&Be.z>=Se&&We&&We.z<=De;){if(Be.x>=re&&Be.x<=pe&&Be.y>=se&&Be.y<=Ce&&Be!==v&&Be!==S&&z5(P,W,R,G,$,X,Be.x,Be.y)&&Cl(Be.prev,Be,Be.next)>=0||(Be=Be.prevZ,We.x>=re&&We.x<=pe&&We.y>=se&&We.y<=Ce&&We!==v&&We!==S&&z5(P,W,R,G,$,X,We.x,We.y)&&Cl(We.prev,We,We.next)>=0))return!1;We=We.nextZ}for(;Be&&Be.z>=Se;){if(Be.x>=re&&Be.x<=pe&&Be.y>=se&&Be.y<=Ce&&Be!==v&&Be!==S&&z5(P,W,R,G,$,X,Be.x,Be.y)&&Cl(Be.prev,Be,Be.next)>=0)return!1;Be=Be.prevZ}for(;We&&We.z<=De;){if(We.x>=re&&We.x<=pe&&We.y>=se&&We.y<=Ce&&We!==v&&We!==S&&z5(P,W,R,G,$,X,We.x,We.y)&&Cl(We.prev,We,We.next)>=0)return!1;We=We.nextZ}return!0}function EUe(f,c){let u=f;do{const g=u.prev,v=u.next.next;!SN(g,v)&&a1e(g,u,u.next,v)&&B5(g,v)&&B5(v,g)&&(c.push(g.i,u.i,v.i),$5(u),$5(u.next),u=f=v),u=u.next}while(u!==f);return Yv(u)}function IUe(f,c,u,g,v,k){let S=f;do{let P=S.next.next;for(;P!==S.prev;){if(S.i!==P.i&&RUe(S,P)){let R=o1e(S,P);return S=Yv(S,S.next),R=Yv(R,R.next),F5(S,c,u,g,v,k,0),void F5(R,c,u,g,v,k,0)}P=P.next}S=S.next}while(S!==f)}function PUe(f,c){let u=f.x-c.x;return u===0&&(u=f.y-c.y,u===0)&&(u=(f.next.y-f.y)/(f.next.x-f.x)-(c.next.y-c.y)/(c.next.x-c.x)),u}function LUe(f,c){const u=function(v,k){let S=k;const P=v.x,R=v.y;let $,W=-1/0;if(SN(v,S))return S;do{if(SN(v,S.next))return S.next;if(R<=S.y&&R>=S.next.y&&S.next.y!==S.y){const pe=S.x+(R-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(pe<=P&&pe>W&&(W=pe,$=S.x=S.x&&S.x>=X&&P!==S.x&&i1e(R$.x||S.x===$.x&&OUe($,S)))&&($=S,se=pe)}S=S.next}while(S!==G);return $}(f,c);if(!u)return c;const g=o1e(u,f);return Yv(g,g.next),Yv(u,u.next)}function OUe(f,c){return Cl(f.prev,f,c.prev)<0&&Cl(c.next,f,f.next)<0}function Eae(f,c,u,g,v){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-u)*v|0)|f<<8))|f<<4))|f<<2))|f<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-g)*v|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function DUe(f){let c=f,u=f;do(c.x=(f-S)*(k-P)&&(f-S)*(g-P)>=(u-S)*(c-P)&&(u-S)*(k-P)>=(v-S)*(g-P)}function z5(f,c,u,g,v,k,S,P){return!(f===S&&c===P)&&i1e(f,c,u,g,v,k,S,P)}function RUe(f,c){return f.next.i!==c.i&&f.prev.i!==c.i&&!function(u,g){let v=u;do{if(v.i!==u.i&&v.next.i!==u.i&&v.i!==g.i&&v.next.i!==g.i&&a1e(v,v.next,u,g))return!0;v=v.next}while(v!==u);return!1}(f,c)&&(B5(f,c)&&B5(c,f)&&function(u,g){let v=u,k=!1;const S=(u.x+g.x)/2,P=(u.y+g.y)/2;do v.y>P!=v.next.y>P&&v.next.y!==v.y&&S<(v.next.x-v.x)*(P-v.y)/(v.next.y-v.y)+v.x&&(k=!k),v=v.next;while(v!==u);return k}(f,c)&&(Cl(f.prev,f,c.prev)||Cl(f,c.prev,c))||SN(f,c)&&Cl(f.prev,f,f.next)>0&&Cl(c.prev,c,c.next)>0)}function Cl(f,c,u){return(c.y-f.y)*(u.x-c.x)-(c.x-f.x)*(u.y-c.y)}function SN(f,c){return f.x===c.x&&f.y===c.y}function a1e(f,c,u,g){const v=XP(Cl(f,c,u)),k=XP(Cl(f,c,g)),S=XP(Cl(u,g,f)),P=XP(Cl(u,g,c));return v!==k&&S!==P||!(v!==0||!YP(f,u,c))||!(k!==0||!YP(f,g,c))||!(S!==0||!YP(u,f,g))||!(P!==0||!YP(u,c,g))}function YP(f,c,u){return c.x<=Math.max(f.x,u.x)&&c.x>=Math.min(f.x,u.x)&&c.y<=Math.max(f.y,u.y)&&c.y>=Math.min(f.y,u.y)}function XP(f){return f>0?1:f<0?-1:0}function B5(f,c){return Cl(f.prev,f,f.next)<0?Cl(f,c,f.next)>=0&&Cl(f,f.prev,c)>=0:Cl(f,c,f.prev)<0||Cl(f,f.next,c)<0}function o1e(f,c){const u=Iae(f.i,f.x,f.y),g=Iae(c.i,c.x,c.y),v=f.next,k=c.prev;return f.next=c,c.prev=f,u.next=v,v.prev=u,g.next=u,u.prev=g,k.next=g,g.prev=k,g}function l1e(f,c,u,g){const v=Iae(f,c,u);return g?(v.next=g.next,v.prev=g,g.next.prev=v,g.next=v):(v.prev=v,v.next=v),v}function $5(f){f.next.prev=f.prev,f.prev.next=f.next,f.prevZ&&(f.prevZ.nextZ=f.nextZ),f.nextZ&&(f.nextZ.prevZ=f.prevZ)}function Iae(f,c,u){return{i:f,x:c,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function U5(f,c){const u=f.length;if(u<=1)return[f];const g=[];let v,k;for(let S=0;S1)for(let S=0;S=Mr&&u>=Mr}static evaluate(c){if(c.length===0)return new cx;let u=[];for(const R of c)u.push(...R.portals);if(u.length===0)return new cx;for(const R of u){const $=R.va,W=R.vb;(cx.isOnBorder($.x,W.x)||cx.isOnBorder($.y,W.y))&&(R.type="border")}const g=u.filter(R=>R.type!=="unevaluated"),v=u.filter(R=>R.type==="unevaluated");if(v.length===0)return new cx;v.sort((R,$)=>R.hash===$.hash?R.isTunnel===$.isTunnel?0:R.isTunnel?-1:1:R.hash<$.hash?1:-1),u=g.concat(v);let k=g.length,S=k,P=k;do if(S++,S===u.length||u[k].hash!==u[S].hash){if(S-k==2){PR.hash<$.hash?1:-1),{portals:u}}}Qr(cx,"ElevationPortalGraph"),Qr(d1e,"ElevationPolygons");class zUe{constructor(c,u,g){this.outPositions=c,this.outNormals=u,this.outIndices=g,this.vertexLookup=new Map}addVertex(c,u,g){let v=c[2];g!=null&&(v*=g);const k=`${c[0]},${c[1]},${c[2]},${u[0]},${u[1]},${u[2]}`,S=this.vertexLookup.get(k);if(S!=null)return S;const P=this.outPositions.length;this.vertexLookup.set(k,P);const R=Math.trunc(16384*u[0]),$=Math.trunc(16384*u[1]),W=Math.trunc(16384*u[2]);return this.outPositions.emplaceBack(c[0],c[1],v),this.outNormals.emplaceBack(R,$,W),P}addTriangle(c,u,g){this.outIndices.emplaceBack(c,u,g)}addTriangles(c,u,g){if(c.length===0)return;const v=g.length===1,k=ve(),S=ve();for(let P=0;Pk!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Ah(u,{zoom:g,lut:v},k=>k!=="fill-bridge-guard-rail-color")}addVertices(c,u){const g=this.unevalVertices.length;for(let v=0;v=k.min.x&&G.x<=k.max.x&&G.y>=k.min.y&&G.y<=k.max.y||X.x>=k.min.x&&X.x<=k.max.x&&X.y>=k.min.y&&X.y<=k.max.y||ec(G,X,P))||this.isOnBorder(G.x,X.x)||this.isOnBorder(G.y,X.y))continue;const re=fu.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[W]);let se,pe=this.vertexHashLookup.get(fu.computePosHash(G));pe!=null?se=pe.next:(pe=this.vertexHashLookup.get(fu.computePosHash(X)),se=pe!=null?pe.prev:re),this.unevalEdges.push({polygonIdx:c,a:$,b:W,hash:re,portalHash:se,isTunnel:v,type:"unevaluated",featureInfo:S})}}addPortalCandidates(c,u,g,v,k){if(u.length===0)return;this.portalPolygons.add(c,{geometry:u,zLevel:k});const S=u[0];this.vertexHashLookup.clear();let P=fu.computeEdgeHash(S[S.length-2],S[S.length-1]);for(let R=0;R({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},v=new zUe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const k=u(),S=u(),P=u(),R=(X,re)=>{X.sort((pe,Ce)=>pe.type===re&&Ce.type!==re?-1:pe.type!==re&&Ce.type===re?1:0);const se=X.findIndex(pe=>pe.type!==re);return se>=0?se:X.length};let $=0;this.unevalEdges.length>0&&($=R(this.unevalEdges,"none"),this.constructBridgeStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},this.tileToMeters)),g(P);const W=u(),G=u();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice($),re=R(X,"tunnel")+$;this.unevalEdges.push(...X),this.constructTunnelStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},{min:$,max:re})}g(W),v.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(G),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(S),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(k),this.maskSegments=Aa.simpleSegment(0,G.primitiveOffset,0,G.primitiveLength),this.depthSegments=Aa.simpleSegment(0,S.primitiveOffset,0,S.primitiveLength),this.renderableBridgeSegments=Aa.simpleSegment(0,P.primitiveOffset,0,P.primitiveLength),this.renderableTunnelSegments=Aa.simpleSegment(0,W.primitiveOffset,0,W.primitiveLength),this.shadowCasterSegments=Aa.simpleSegment(0,k.primitiveOffset,0,k.primitiveLength)}update(c,u,g,v,k,S,P,R){this.bridgeProgramConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R),this.tunnelProgramConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,CUe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,MUe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(c),this.tunnelProgramConfigurations.upload(c))}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(c,u,g,v,k){const S=(P,R)=>{for(let $=0;$fe(xr,u[vr].x,u[vr].y,g[vr]*R),G=ve(),X=ve(),re=ve(),se=ve(),pe=ve(),Ce=(xr,vr)=>{const hr=P.get(fu.computePosHash(u[vr])),pr=hr.from,er=hr.to;if(!pr||!er)return;W(G,pr),W(X,vr),W(re,er),et(se),nt(G,X)||(Ae(pe,X,G),Fe(se,pe)),nt(re,X)||(Ae(pe,re,X),de(se,se,Fe(pe,pe)));const Yt=$e(se);return Yt>0?he(xr,se,1/Yt):void 0};let Se=Number.POSITIVE_INFINITY;this.sortSubarray(v,k.min,k.max,(xr,vr)=>xr.featureInfo.featureIndex-vr.featureInfo.featureIndex);const De=ve(),Be=ve(),We=ve(),dt=ve(),it=ve(),gt=ve(),St=ve(),Tt=ve(),Kt=ve(),Dt=[ve(),ve(),ve(),ve()],tr=[ve(),ve(),ve(),ve()],or=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],lr=(xr,vr)=>xr>vr;for(let xr=k.min;xrSe.featureInfo.featureIndex-De.featureInfo.featureIndex;this.sortSubarray(v,k.min,k.max,R),this.sortSubarray(v,S.min,S.max,R);const $=Se=>Fe(Se,Se),W=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],G=(Se,De)=>SeP.hash===R.hash?R.polygonIdx-P.polygonIdx:R.hash>P.hash?1:-1);let g=0,v=0,k=0,S=u[g].polygonIdx;do v++,(v===u.length||u[g].hash!==u[v].hash)&&((v-g==1||u[v-1].polygonIdx!==S)&&(k$.portalHashW.hash?P++:W.hash>$.portalHash?R++:($.type=W.type,P++)}}}isOnBorder(c,u){return c<=0&&u<=0||c>=Mr&&u>=Mr}addFeatureSection(c,u,g,v){return c!==u&&(u=c,g.push({featureIndex:c,vertexStart:v.getVertexCount()}),v.clearVertexLookup()),u}sortSubarray(c,u,g,v){const k=c.slice(u,g);k.sort(v),c.splice(u,k.length,...k)}static computeEdgeHash(c,u){return(c.y===u.y&&c.x>u.x||c.y>u.y)&&([c,u]=[u,c]),BigInt(fu.computePosHash(c))<<32n|BigInt(fu.computePosHash(u))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var u1e,h1e={exports:{}},f1e=(u1e||(u1e=1,function(f){function c(ot,ut){return ot>ut?1:ot0){var fn=yr+Math.floor(Rr/2),bn={key:ut[fn],data:nr[fn],parent:ot};return bn.left=v(bn,ut,nr,yr,fn),bn.right=v(bn,ut,nr,fn+1,Dr),bn}return null}function k(ot,ut,nr,yr,Dr){if(!(nr>=yr)){for(var Rr=ot[nr+yr>>1],fn=nr-1,bn=yr+1;;){do fn++;while(Dr(ot[fn],Rr)<0);do bn--;while(Dr(ot[bn],Rr)>0);if(fn>=bn)break;var Jn=ot[fn];ot[fn]=ot[bn],ot[bn]=Jn,Jn=ut[fn],ut[fn]=ut[bn],ut[bn]=Jn}k(ot,ut,nr,bn,Dr),k(ot,ut,bn+1,yr,Dr)}}u.prototype.rotateLeft=function(ot){var ut=ot.right;ut&&(ot.right=ut.left,ut.left&&(ut.left.parent=ot),ut.parent=ot.parent),ot.parent?ot===ot.parent.left?ot.parent.left=ut:ot.parent.right=ut:this._root=ut,ut&&(ut.left=ot),ot.parent=ut},u.prototype.rotateRight=function(ot){var ut=ot.left;ut&&(ot.left=ut.right,ut.right&&(ut.right.parent=ot),ut.parent=ot.parent),ot.parent?ot===ot.parent.left?ot.parent.left=ut:ot.parent.right=ut:this._root=ut,ut&&(ut.right=ot),ot.parent=ut},u.prototype._splay=function(ot){for(;ot.parent;){var ut=ot.parent;ut.parent?ut.left===ot&&ut.parent.left===ut?(this.rotateRight(ut.parent),this.rotateRight(ut)):ut.right===ot&&ut.parent.right===ut?(this.rotateLeft(ut.parent),this.rotateLeft(ut)):ut.left===ot&&ut.parent.right===ut?(this.rotateRight(ut),this.rotateLeft(ut)):(this.rotateLeft(ut),this.rotateRight(ut)):ut.left===ot?this.rotateRight(ut):this.rotateLeft(ut)}},u.prototype.splay=function(ot){for(var ut,nr,yr,Dr,Rr;ot.parent;)(nr=(ut=ot.parent).parent)&&nr.parent?((yr=nr.parent).left===nr?yr.left=ot:yr.right=ot,ot.parent=yr):(ot.parent=null,this._root=ot),Dr=ot.left,Rr=ot.right,ot===ut.left?(nr&&(nr.left===ut?(ut.right?(nr.left=ut.right,nr.left.parent=nr):nr.left=null,ut.right=nr,nr.parent=ut):(Dr?(nr.right=Dr,Dr.parent=nr):nr.right=null,ot.left=nr,nr.parent=ot)),Rr?(ut.left=Rr,Rr.parent=ut):ut.left=null,ot.right=ut,ut.parent=ot):(nr&&(nr.right===ut?(ut.left?(nr.right=ut.left,nr.right.parent=nr):nr.right=null,ut.left=nr,nr.parent=ut):(Rr?(nr.left=Rr,Rr.parent=nr):nr.left=null,ot.right=nr,nr.parent=ot)),Dr?(ut.right=Dr,Dr.parent=ut):ut.right=null,ot.left=ut,ut.parent=ot)},u.prototype.replace=function(ot,ut){ot.parent?ot===ot.parent.left?ot.parent.left=ut:ot.parent.right=ut:this._root=ut,ut&&(ut.parent=ot.parent)},u.prototype.minNode=function(ot){if(ot===void 0&&(ot=this._root),ot)for(;ot.left;)ot=ot.left;return ot},u.prototype.maxNode=function(ot){if(ot===void 0&&(ot=this._root),ot)for(;ot.right;)ot=ot.right;return ot},u.prototype.insert=function(ot,ut){var nr=this._root,yr=null,Dr=this._compare;if(this._noDuplicates)for(;nr;){if(yr=nr,Dr(nr.key,ot)===0)return;nr=Dr(nr.key,ot)<0?nr.right:nr.left}else for(;nr;)yr=nr,nr=Dr(nr.key,ot)<0?nr.right:nr.left;return nr={key:ot,data:ut,left:null,right:null,parent:yr},yr?Dr(yr.key,nr.key)<0?yr.right=nr:yr.left=nr:this._root=nr,this.splay(nr),this._size++,nr},u.prototype.find=function(ot){for(var ut=this._root,nr=this._compare;ut;){var yr=nr(ut.key,ot);if(yr<0)ut=ut.right;else{if(!(yr>0))return ut;ut=ut.left}}return null},u.prototype.contains=function(ot){for(var ut=this._root,nr=this._compare;ut;){var yr=nr(ot,ut.key);if(yr===0)return!0;ut=yr<0?ut.left:ut.right}return!1},u.prototype.remove=function(ot){var ut=this.find(ot);if(!ut)return!1;if(this.splay(ut),ut.left)if(ut.right){var nr=this.minNode(ut.right);nr.parent!==ut&&(this.replace(nr,nr.right),nr.right=ut.right,nr.right.parent=nr),this.replace(ut,nr),nr.left=ut.left,nr.left.parent=nr}else this.replace(ut,ut.left);else this.replace(ut,ut.right);return this._size--,!0},u.prototype.removeNode=function(ot){if(!ot)return!1;if(this.splay(ot),ot.left)if(ot.right){var ut=this.minNode(ot.right);ut.parent!==ot&&(this.replace(ut,ut.right),ut.right=ot.right,ut.right.parent=ut),this.replace(ot,ut),ut.left=ot.left,ut.left.parent=ut}else this.replace(ot,ot.left);else this.replace(ot,ot.right);return this._size--,!0},u.prototype.erase=function(ot){var ut=this.find(ot);if(ut){this.splay(ut);var nr=ut.left,yr=ut.right,Dr=null;nr&&(nr.parent=null,Dr=this.maxNode(nr),this.splay(Dr),this._root=Dr),yr&&(nr?Dr.right=yr:this._root=yr,yr.parent=Dr),this._size--}},u.prototype.pop=function(){var ot=this._root,ut=null;if(ot){for(;ot.left;)ot=ot.left;ut={key:ot.key,data:ot.data},this.remove(ot.key)}return ut},u.prototype.next=function(ot){var ut=ot;if(ut)if(ut.right)for(ut=ut.right;ut&&ut.left;)ut=ut.left;else for(ut=ot.parent;ut&&ut.right===ot;)ot=ut,ut=ut.parent;return ut},u.prototype.prev=function(ot){var ut=ot;if(ut)if(ut.left)for(ut=ut.left;ut&&ut.right;)ut=ut.right;else for(ut=ot.parent;ut&&ut.left===ot;)ot=ut,ut=ut.parent;return ut},u.prototype.forEach=function(ot){for(var ut=this._root,nr=[],yr=!1,Dr=0;!yr;)ut?(nr.push(ut),ut=ut.left):nr.length>0?(ot(ut=nr.pop(),Dr++),ut=ut.right):yr=!0;return this},u.prototype.range=function(ot,ut,nr,yr){for(var Dr=[],Rr=this._compare,fn=this._root;Dr.length!==0||fn;)if(fn)Dr.push(fn),fn=fn.left;else{if(Rr((fn=Dr.pop()).key,ut)>0)break;if(Rr(fn.key,ot)>=0&&nr.call(yr,fn))return this;fn=fn.right}return this},u.prototype.keys=function(){for(var ot=this._root,ut=[],nr=[],yr=!1;!yr;)ot?(ut.push(ot),ot=ot.left):ut.length>0?(ot=ut.pop(),nr.push(ot.key),ot=ot.right):yr=!0;return nr},u.prototype.values=function(){for(var ot=this._root,ut=[],nr=[],yr=!1;!yr;)ot?(ut.push(ot),ot=ot.left):ut.length>0?(ot=ut.pop(),nr.push(ot.data),ot=ot.right):yr=!0;return nr},u.prototype.at=function(ot){for(var ut=this._root,nr=[],yr=!1,Dr=0;!yr;)if(ut)nr.push(ut),ut=ut.left;else if(nr.length>0){if(ut=nr.pop(),Dr===ot)return ut;Dr++,ut=ut.right}else yr=!0;return null},u.prototype.load=function(ot,ut,nr){if(ot===void 0&&(ot=[]),ut===void 0&&(ut=[]),nr===void 0&&(nr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var yr=ot.length;return nr&&k(ot,ut,0,yr-1,this._compare),this._root=v(null,ot,ut,0,yr),this._size=yr,this},u.prototype.min=function(){var ot=this.minNode(this._root);return ot?ot.key:null},u.prototype.max=function(){var ot=this.maxNode(this._root);return ot?ot.key:null},u.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},u.createTree=function(ot,ut,nr,yr,Dr){return new u(nr,Dr).load(ot,ut,yr)},Object.defineProperties(u.prototype,g);var S=0,P=1,R=2,$=3,W=0,G=1,X=2,re=3;function se(ot,ut,nr){ut===null?(ot.inOut=!1,ot.otherInOut=!0):(ot.isSubject===ut.isSubject?(ot.inOut=!ut.inOut,ot.otherInOut=ut.otherInOut):(ot.inOut=!ut.otherInOut,ot.otherInOut=ut.isVertical()?!ut.inOut:ut.inOut),ut&&(ot.prevInResult=!pe(ut,nr)||ut.isVertical()?ut.prevInResult:ut));var yr=pe(ot,nr);ot.resultTransition=yr?function(Dr,Rr){var fn,bn=!Dr.inOut,Jn=!Dr.otherInOut;switch(Rr){case W:fn=bn&&Jn;break;case G:fn=bn||Jn;break;case re:fn=bn^Jn;break;case X:fn=Dr.isSubject?bn&&!Jn:Jn&&!bn}return fn?1:-1}(ot,nr):0}function pe(ot,ut){switch(ot.type){case S:switch(ut){case W:return!ot.otherInOut;case G:return ot.otherInOut;case X:return ot.isSubject&&ot.otherInOut||!ot.isSubject&&!ot.otherInOut;case re:return!0}break;case R:return ut===W||ut===G;case $:return ut===X;case P:return!1}return!1}var Ce=function(ot,ut,nr,yr,Dr){this.left=ut,this.point=ot,this.otherEvent=nr,this.isSubject=yr,this.type=Dr||S,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},Se={inResult:{configurable:!0}};function De(ot,ut){return ot[0]===ut[0]&&ot[1]===ut[1]}Ce.prototype.isBelow=function(ot){var ut=this.point,nr=this.otherEvent.point;return this.left?(ut[0]-ot[0])*(nr[1]-ot[1])-(nr[0]-ot[0])*(ut[1]-ot[1])>0:(nr[0]-ot[0])*(ut[1]-ot[1])-(ut[0]-ot[0])*(nr[1]-ot[1])>0},Ce.prototype.isAbove=function(ot){return!this.isBelow(ot)},Ce.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},Se.inResult.get=function(){return this.resultTransition!==0},Ce.prototype.clone=function(){var ot=new Ce(this.point,this.left,this.otherEvent,this.isSubject,this.type);return ot.contourId=this.contourId,ot.resultTransition=this.resultTransition,ot.prevInResult=this.prevInResult,ot.isExteriorRing=this.isExteriorRing,ot.inOut=this.inOut,ot.otherInOut=this.otherInOut,ot},Object.defineProperties(Ce.prototype,Se);var Be=11102230246251565e-32,We=134217729,dt=(3+8*Be)*Be;function it(ot,ut,nr,yr,Dr){var Rr,fn,bn,Jn,cs=ut[0],ms=yr[0],Es=0,Ln=0;ms>cs==ms>-cs?(Rr=cs,cs=ut[++Es]):(Rr=ms,ms=yr[++Ln]);var Un=0;if(Escs==ms>-cs?(bn=Rr-((fn=cs+Rr)-cs),cs=ut[++Es]):(bn=Rr-((fn=ms+Rr)-ms),ms=yr[++Ln]),Rr=fn,bn!==0&&(Dr[Un++]=bn);Escs==ms>-cs?(bn=Rr-((fn=Rr+cs)-(Jn=fn-Rr))+(cs-Jn),cs=ut[++Es]):(bn=Rr-((fn=Rr+ms)-(Jn=fn-Rr))+(ms-Jn),ms=yr[++Ln]),Rr=fn,bn!==0&&(Dr[Un++]=bn);for(;Es0!=Es>0)return Ln;var Un=Math.abs(ms+Es);return Math.abs(Ln)>=St*Un?Ln:-function(ti,ai,oi,Si,Hi,Di,hi){var yi,ds,Us,ka,In,Is,Bi,Yi,ea,lo,Xi,Pn,Pa,Ci,ya,Vo,yl,Ao,Eo=ti-Hi,ol=oi-Hi,Sd=ai-Di,Qi=Si-Di;Dt[0]=(ya=(Yi=Eo-(Bi=(Is=We*Eo)-(Is-Eo)))*(lo=Qi-(ea=(Is=We*Qi)-(Is-Qi)))-((Ci=Eo*Qi)-Bi*ea-Yi*ea-Bi*lo))-((Xi=ya-(yl=(Yi=Sd-(Bi=(Is=We*Sd)-(Is-Sd)))*(lo=ol-(ea=(Is=We*ol)-(Is-ol)))-((Vo=Sd*ol)-Bi*ea-Yi*ea-Bi*lo)))+(In=ya-Xi))+(In-yl),Dt[1]=(Pa=Ci-((Pn=Ci+Xi)-(In=Pn-Ci))+(Xi-In))-((Xi=Pa-Vo)+(In=Pa-Xi))+(In-Vo),Dt[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),Dt[3]=Ao;var to=function(Xm,tc){for(var nd=tc[0],mu=1;mu<4;mu++)nd+=tc[mu];return nd}(0,Dt),co=Tt*hi;if(to>=co||-to>=co||(yi=ti-(Eo+(In=ti-Eo))+(In-Hi),Us=oi-(ol+(In=oi-ol))+(In-Hi),ds=ai-(Sd+(In=ai-Sd))+(In-Di),ka=Si-(Qi+(In=Si-Qi))+(In-Di),yi===0&&ds===0&&Us===0&&ka===0)||(co=Kt*hi+dt*Math.abs(to),(to+=Eo*ka+Qi*yi-(Sd*Us+ol*ds))>=co||-to>=co))return to;xr[0]=(ya=(Yi=yi-(Bi=(Is=We*yi)-(Is-yi)))*(lo=Qi-(ea=(Is=We*Qi)-(Is-Qi)))-((Ci=yi*Qi)-Bi*ea-Yi*ea-Bi*lo))-((Xi=ya-(yl=(Yi=ds-(Bi=(Is=We*ds)-(Is-ds)))*(lo=ol-(ea=(Is=We*ol)-(Is-ol)))-((Vo=ds*ol)-Bi*ea-Yi*ea-Bi*lo)))+(In=ya-Xi))+(In-yl),xr[1]=(Pa=Ci-((Pn=Ci+Xi)-(In=Pn-Ci))+(Xi-In))-((Xi=Pa-Vo)+(In=Pa-Xi))+(In-Vo),xr[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),xr[3]=Ao;var qd=it(4,Dt,4,xr,tr);xr[0]=(ya=(Yi=Eo-(Bi=(Is=We*Eo)-(Is-Eo)))*(lo=ka-(ea=(Is=We*ka)-(Is-ka)))-((Ci=Eo*ka)-Bi*ea-Yi*ea-Bi*lo))-((Xi=ya-(yl=(Yi=Sd-(Bi=(Is=We*Sd)-(Is-Sd)))*(lo=Us-(ea=(Is=We*Us)-(Is-Us)))-((Vo=Sd*Us)-Bi*ea-Yi*ea-Bi*lo)))+(In=ya-Xi))+(In-yl),xr[1]=(Pa=Ci-((Pn=Ci+Xi)-(In=Pn-Ci))+(Xi-In))-((Xi=Pa-Vo)+(In=Pa-Xi))+(In-Vo),xr[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),xr[3]=Ao;var Ho=it(qd,tr,4,xr,or);xr[0]=(ya=(Yi=yi-(Bi=(Is=We*yi)-(Is-yi)))*(lo=ka-(ea=(Is=We*ka)-(Is-ka)))-((Ci=yi*ka)-Bi*ea-Yi*ea-Bi*lo))-((Xi=ya-(yl=(Yi=ds-(Bi=(Is=We*ds)-(Is-ds)))*(lo=Us-(ea=(Is=We*Us)-(Is-Us)))-((Vo=ds*Us)-Bi*ea-Yi*ea-Bi*lo)))+(In=ya-Xi))+(In-yl),xr[1]=(Pa=Ci-((Pn=Ci+Xi)-(In=Pn-Ci))+(Xi-In))-((Xi=Pa-Vo)+(In=Pa-Xi))+(In-Vo),xr[2]=Pn-((Ao=Pn+Xi)-(In=Ao-Pn))+(Xi-In),xr[3]=Ao;var kf=it(Ho,or,4,xr,lr);return lr[kf-1]}(Dr,Rr,fn,bn,Jn,cs,Un)}(ot[0],ot[1],ut[0],ut[1],nr[0],nr[1]);return yr>0?-1:yr<0?1:0}function hr(ot,ut){var nr=ot.point,yr=ut.point;return nr[0]>yr[0]?1:nr[0]yr[1]?1:-1:function(Dr,Rr,fn,bn){return Dr.left!==Rr.left?Dr.left?1:-1:vr(fn,Dr.otherEvent.point,Rr.otherEvent.point)!==0?Dr.isBelow(Rr.otherEvent.point)?-1:1:!Dr.isSubject&&Rr.isSubject?1:-1}(ot,ut,nr)}function pr(ot,ut,nr){var yr=new Ce(ut,!1,ot,ot.isSubject),Dr=new Ce(ut,!0,ot.otherEvent,ot.isSubject);return De(ot.point,ot.otherEvent.point)&&console.warn("what is that, a collapsed segment?",ot),yr.contourId=Dr.contourId=ot.contourId,hr(Dr,ot.otherEvent)>0&&(ot.otherEvent.left=!0,Dr.left=!1),ot.otherEvent.otherEvent=Dr,ot.otherEvent=yr,nr.push(Dr),nr.push(yr),nr}function er(ot,ut){return ot[0]*ut[1]-ot[1]*ut[0]}function Yt(ot,ut){return ot[0]*ut[0]+ot[1]*ut[1]}function mr(ot,ut,nr){var yr=function(Jn,cs,ms,Es,Ln){var Un=[cs[0]-Jn[0],cs[1]-Jn[1]],ti=[Es[0]-ms[0],Es[1]-ms[1]];function ai(Is,Bi,Yi){return[Is[0]+Bi*Yi[0],Is[1]+Bi*Yi[1]]}var oi=[ms[0]-Jn[0],ms[1]-Jn[1]],Si=er(Un,ti),Hi=Si*Si,Di=Yt(Un,Un);if(Hi>0){var hi=er(oi,ti)/Si;if(hi<0||hi>1)return null;var yi=er(oi,Un)/Si;return yi<0||yi>1?null:hi===0||hi===1?[ai(Jn,hi,Un)]:yi===0||yi===1?[ai(ms,yi,ti)]:[ai(Jn,hi,Un)]}if((Hi=(Si=er(oi,Un))*Si)>0)return null;var ds=Yt(Un,oi)/Di,Us=ds+Yt(Un,ti)/Di,ka=Math.min(ds,Us),In=Math.max(ds,Us);return ka<=1&&In>=0?ka===1?[ai(Jn,ka>0?ka:0,Un)]:In===0?[ai(Jn,In<1?In:1,Un)]:[ai(Jn,ka>0?ka:0,Un),ai(Jn,In<1?In:1,Un)]:null}(ot.point,ot.otherEvent.point,ut.point,ut.otherEvent.point),Dr=yr?yr.length:0;if(Dr===0||Dr===1&&(De(ot.point,ut.point)||De(ot.otherEvent.point,ut.otherEvent.point))||Dr===2&&ot.isSubject===ut.isSubject)return 0;if(Dr===1)return De(ot.point,yr[0])||De(ot.otherEvent.point,yr[0])||pr(ot,yr[0],nr),De(ut.point,yr[0])||De(ut.otherEvent.point,yr[0])||pr(ut,yr[0],nr),1;var Rr=[],fn=!1,bn=!1;return De(ot.point,ut.point)?fn=!0:hr(ot,ut)===1?Rr.push(ut,ot):Rr.push(ot,ut),De(ot.otherEvent.point,ut.otherEvent.point)?bn=!0:hr(ot.otherEvent,ut.otherEvent)===1?Rr.push(ut.otherEvent,ot.otherEvent):Rr.push(ot.otherEvent,ut.otherEvent),fn&&bn||fn?(ut.type=P,ot.type=ut.inOut===ot.inOut?R:$,fn&&!bn&&pr(Rr[1].otherEvent,Rr[0].point,nr),2):bn?(pr(Rr[0],Rr[1].point,nr),3):Rr[0]!==Rr[3].otherEvent?(pr(Rr[0],Rr[1].point,nr),pr(Rr[1],Rr[2].point,nr),3):(pr(Rr[0],Rr[1].point,nr),pr(Rr[3].otherEvent,Rr[2].point,nr),3)}function Tr(ot,ut){if(ot===ut)return 0;if(vr(ot.point,ot.otherEvent.point,ut.point)!==0||vr(ot.point,ot.otherEvent.point,ut.otherEvent.point)!==0)return De(ot.point,ut.point)?ot.isBelow(ut.otherEvent.point)?-1:1:ot.point[0]===ut.point[0]?ot.point[1]ut.contourId?1:-1:hr(ot,ut)===1?1:-1}var jr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function hn(ot,ut,nr,yr){var Dr,Rr=ot+1,fn=ut[ot].point,bn=ut.length;for(Rryr;)Rr--;return Rr}jr.prototype.isExterior=function(){return this.holeOf==null};var Ur=rn,Zr=rn;function rn(ot,ut){if(!(this instanceof rn))return new rn(ot,ut);if(this.data=ot||[],this.length=this.data.length,this.compare=ut||gs,this.length>0)for(var nr=(this.length>>1)-1;nr>=0;nr--)this._down(nr)}function gs(ot,ut){return otut?1:0}rn.prototype={push:function(ot){this.data.push(ot),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var ot=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),ot}},peek:function(){return this.data[0]},_up:function(ot){for(var ut=this.data,nr=this.compare,yr=ut[ot];ot>0;){var Dr=ot-1>>1,Rr=ut[Dr];if(nr(yr,Rr)>=0)break;ut[ot]=Rr,ot=Dr}ut[ot]=yr},_down:function(ot){for(var ut=this.data,nr=this.compare,yr=this.length>>1,Dr=ut[ot];ot=0)break;ut[ot]=bn,ot=Rr}ut[ot]=Dr}},Ur.default=Zr;var kr=Math.max,sn=Math.min,qn=0;function Os(ot,ut,nr,yr,Dr,Rr){var fn,bn,Jn,cs,ms,Es;for(fn=0,bn=ot.length-1;fn0?Es.left=!0:ms.left=!0;var Ln=Jn[0],Un=Jn[1];Dr[0]=sn(Dr[0],Ln),Dr[1]=sn(Dr[1],Un),Dr[2]=kr(Dr[2],Ln),Dr[3]=kr(Dr[3],Un),yr.push(ms),yr.push(Es)}}var qs=[];function rs(ot,ut,nr){typeof ot[0][0][0]=="number"&&(ot=[ot]),typeof ut[0][0][0]=="number"&&(ut=[ut]);var yr=function(Un,ti,ai){var oi=null;return Un.length*ti.length==0&&(ai===W?oi=qs:ai===X?oi=Un:ai!==G&&ai!==re||(oi=Un.length===0?ti:Un)),oi}(ot,ut,nr);if(yr)return yr===qs?null:yr;var Dr=[1/0,1/0,-1/0,-1/0],Rr=[1/0,1/0,-1/0,-1/0],fn=function(Un,ti,ai,oi,Si){var Hi,Di,hi,yi,ds,Us,ka=new Ur(null,hr);for(hi=0,yi=Un.length;hioi[2]||oi[0]>ai[2]||ai[1]>oi[3]||oi[1]>ai[3])&&(Si===W?Hi=qs:Si===X?Hi=Un:Si!==G&&Si!==re||(Hi=Un.concat(ti))),Hi}(ot,ut,Dr,Rr,nr))return yr===qs?null:yr;for(var bn=function(Un){var ti,ai,oi=function(hi){var yi,ds,Us,ka,In=[];for(ds=0,Us=hi.length;ds0){var Xi=Is[lo];if(Xi.holeOf!=null){var Pn=Xi.holeOf;Is[Pn].holeIds.push(Bi),Yi.holeOf=Pn,Yi.depth=Is[lo].depth}else Is[lo].holeIds.push(Bi),Yi.holeOf=lo,Yi.depth=Is[lo].depth+1}else Yi.holeOf=null,Yi.depth=Is[lo].depth}else Yi.holeOf=null,Yi.depth=0;return Yi}(oi[ti],Hi,hi),ds=function(In){Si[In]=!0,In=oi.length)&&oi[Us];);Hi.push(yi)}};for(ti=0,ai=oi.length;tika||Hi===X&&In.point[0]>oi[2])break;if(In.left){hi=Di=ds.insert(In),Di=Di!==(yi=ds.minNode())?ds.prev(Di):null,hi=ds.next(hi);var Is=Di?Di.key:null;if(se(In,Is,Hi),hi&&mr(In,hi.key,Un)===2&&(se(In,Is,Hi),se(hi.key,In,Hi)),Di&&mr(Di.key,In,Un)===2){var Bi=Di;se(Is,(Bi=Bi!==yi?ds.prev(Bi):null)?Bi.key:null,Hi),se(In,Is,Hi)}}else hi=Di=ds.find(In=In.otherEvent),Di&&hi&&(Di=Di!==yi?ds.prev(Di):null,hi=ds.next(hi),ds.remove(In),hi&&Di&&mr(Di.key,hi.key,Un))}return Us}(fn,0,0,Dr,Rr,nr)),Jn=[],cs=0;cs * @license MIT * @preserve */function QP(f,c,u,g){const v=[],k=g===0?(S,P,R,$,W,G)=>{S.push(new ir(G,R+(G-P)/($-P)*(W-R)))}:(S,P,R,$,W,G)=>{S.push(new ir(P+(G-R)/(W-R)*($-P),G))};for(const S of f){const P=[];for(const R of S){if(R.length<=2)continue;const $=[];for(let X=0;Xc&&k($,re,se,pe,Ce,c):Se>u?De=c&&k($,re,se,pe,Ce,c),De>u&&Se<=u&&k($,re,se,pe,Ce,u)}let W=R[R.length-1];const G=g===0?W.x:W.y;G>=c&&G<=u&&$.push(W),$.length&&(W=$[$.length-1],$[0].x===W.x&&$[0].y===W.y||$.push($[0]),P.push($))}P.length&&v.push(P)}return v}function BUe(f,c){const u=Oae(f),g=Oae([c]),v=f1e.intersection(u,g);return v==null?[]:p1e(v)}function $Ue(f,c){let g=Oae(f,65536);const v=[];for(;c.valid();c.next()){const[k,S]=c.get(),P=k.x*65536,R=k.y*65536,$=S.x*65536,W=S.y*65536,G=$-P,X=W-R,re=Math.hypot(G,X);if(re===0)continue;const se=Math.trunc(X/re*3),pe=-Math.trunc(G/re*3);v.push([[[P,R],[$,W],[$+se,W+pe],[P+se,R+pe],[P,R]]])}return v.length>0&&(g=f1e.diff(g,v)),p1e(g,1/65536)}function Oae(f,c=1){return[f.map(u=>u.map(g=>[g.x*c,g.y*c]))]}function p1e(f,c=1){return f.map(u=>u.map((g,v)=>{const k=g.map(S=>new ir(S[0]*c,S[1]*c).round());return v>0&&k.reverse(),k}))}class Dae{constructor(c,u){this.layoutVertexArray=new Vm,this.indexArray=new $o,this.lineIndexArray=new uu,this.triangleSegments=new Aa,this.lineSegments=new Aa,this.programConfigurations=new Ah(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,u&&(this.elevatedLayoutVertexArray=new kp)}update(c,u,g,v,k,S,P,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,NUe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.lineIndexBuffer=c.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,SUe.members))),this.programConfigurations.upload(c),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(c,u,g,v,k,S,P){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,u,g,v,k,S,void 0,P)}}class Rae{constructor(c){this.zoom=c.zoom,this.pixelRatio=c.pixelRatio,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=c.lut,this.bufferData=new Dae(c,!1),this.elevationBufferData=new Dae(c,!0),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=c.sourceLayerIndex,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Pae("fill",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("fill-sort-key"),S=[];for(const{feature:P,id:R,index:$,sourceLayerIndex:W}of c){const G=this.layers[0]._featureFilter.needGeometry,X=Ot(P,G);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),X,g))continue;const re=k?k.evaluate(X,{},g,u.availableImages):void 0,se={id:R,properties:P.properties,type:P.type,sourceLayerIndex:W,index:$,geometry:G?X.geometry:wt(P,g,v),patterns:{},sortKey:re};S.push(se)}k&&S.sort((P,R)=>P.sortKey-R.sortKey);for(const P of S){const{geometry:R,index:$,sourceLayerIndex:W}=P;if(this.hasPattern){const G=Lae("fill",this.layers,P,this.zoom,this.pixelRatio,u);this.patternFeatures.push(G)}else this.addFeature(P,R,$,g,{},u.availableImages,u.brightness,u.elevationFeatures);u.featureIndex.insert(c[$].feature,R,$,W,this.index)}}update(c,u,g,v,k,S,P){this.bufferData.update(c,u,g,v,k,S,P,this.worldview),this.elevationBufferData.update(c,u,g,v,k,S,P,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,u,g,v,k,S,P,this.worldview)}addFeatures(c,u,g,v,k,S){for(const P of this.patternFeatures)this.addFeature(P,P.geometry,P.index,u,g,v,S,c.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(c){this.bufferData.upload(c),this.elevationBufferData.upload(c),this.elevatedStructures&&this.elevatedStructures.upload(c)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(c,u,g,v,k,S=[],P,R){const $=U5(u,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,$,v,g,R):this.addGeometry($,this.bufferData),this.bufferData.populatePaintArrays(c,g,k,S,v,P,this.worldview),this.elevationBufferData.populatePaintArrays(c,g,k,S,v,P,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,u,g,v,k){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(u,g,v,k,this.worldview))}addElevatedRoadFeature(c,u,g,v,k){const S=new Array,P=gi.getElevationFeature(c,k);if(!P)return void this.addGeometry(u,this.bufferData);{const $=this.clipPolygonsToTile(u,1);$.length>0&&S.push({polygons:$,elevationFeature:P,elevationTileID:g})}const R={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},g),featureIndex:v};for(const $ of S)if($.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new fu($.elevationTileID,this.layers,this.zoom,this.lut));const G=$.elevationFeature.isTunnel();let X=0;c.properties.hasOwnProperty(qt)&&(X=+c.properties[qt]);for(const re of $.polygons)this.elevatedStructures.addPortalCandidates($.elevationFeature.id,re,G,$.elevationFeature,X)}$.elevationFeature.constantHeight==null&&($.polygons=this.prepareElevatedPolygons($.polygons,$.elevationFeature,$.elevationTileID));const W=new Li(g,$.elevationTileID);this.addElevatedGeometry($.polygons,W,$.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,v,R)}}addElevatedGeometry(c,u,g,v,k,S){const P={elevation:g,elevationSampler:u,bias:v,index:k,featureInfo:S},[R,$]=this.addGeometry(c,this.elevationBufferData,P);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:R,max:$}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,R),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,$))}addGeometry(c,u,g){let v=Number.POSITIVE_INFINITY,k=Number.NEGATIVE_INFINITY,S=null;g&&(S=g.elevationSampler.constantElevation(g.elevation,g.bias),S!=null&&(v=S,k=S));const P=(R,$,W)=>{if(g!=null)if($.push(R),S!=null)u.elevatedLayoutVertexArray.emplaceBack(S),W.push(S);else{const G=g.elevationSampler.pointElevation(R,g.elevation,g.bias);u.elevatedLayoutVertexArray.emplaceBack(G),W.push(G),v=Math.min(v,G),k=Math.max(k,G)}};for(const R of c){let $=0;for(const Be of R)$+=Be.length;const W=u.triangleSegments.prepareSegment($,u.layoutVertexArray,u.indexArray),G=W.vertexLength,X=[],re=[],se=[],pe=[],Ce=[],Se=u.layoutVertexArray.length;for(const Be of R){if(Be.length===0)continue;Be!==R[0]&&re.push(X.length/2);const We=u.lineSegments.prepareSegment(Be.length,u.layoutVertexArray,u.lineIndexArray),dt=We.vertexLength;g&&Ce.push(u.layoutVertexArray.length-Se),P(Be[0],se,pe),u.layoutVertexArray.emplaceBack(Be[0].x,Be[0].y),u.lineIndexArray.emplaceBack(dt+Be.length-1,dt),X.push(Be[0].x),X.push(Be[0].y);for(let it=1;it0&&g&&this.elevationMode==="hd-road-base"){const Be=g.elevation.isTunnel(),We=g.elevation.safeArea,dt=this.elevatedStructures.addVertices(se,pe);this.elevatedStructures.addTriangles(De,dt,Be);const it=Ce.length;if(it>0){for(let gt=0;gt=g&&re.max.x<=k&&re.min.y>=v&&re.max.y<=S?R:$).push(X)}if(R.length===c.length)return c;const W=[new ir(g,v),new ir(k,v),new ir(k,S),new ir(g,S),new ir(g,v)],G=R;for(const X of $)G.push(...BUe(X,W));return G}}let m1e,g1e,x1e,y1e;Qr(Rae,"FillBucket",{omit:["layers","patternFeatures"]}),Qr(Dae,"FillBufferData"),Qr(fu,"ElevatedStructures");class JP{constructor(c,u,g,v){if(this.triangleCount=u.length/3,this.min=new ir(0,0),this.max=new ir(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||c.length===0)return;const[k,S]=[c[0].clone(),c[0].clone()];for(let G=1;GG.cellIdx-X.cellIdx||G.triIdx-X.triIdx);let W=0;for(;W<$.length;){const G=$[W].cellIdx,X={start:this.payload.length,len:0};for(;W<$.length&&$[W].cellIdx===G;)++X.len,this.payload.push($[W++].triIdx);this.cells[G]=X}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(c,u){if(this.triangleCount===0||this.cells.length===0||c.x>this.max.x||this.min.x>c.x||c.y>this.max.y||this.min.y>c.y)return;const g=Zm(c.x-this.min.x,this.xScale,this.cellsX),v=Zm(c.y-this.min.y,this.yScale,this.cellsY),k=this.cells[v*this.cellsX+g];if(k){this._lazyInitLookup();for(let S=0;Sthis.max.x||this.min.x>u.x||c.y>this.max.y||this.min.y>u.y)return;this._lazyInitLookup();const v=Zm(c.x-this.min.x,this.xScale,this.cellsX),k=Zm(u.x-this.min.x,this.xScale,this.cellsX),S=Zm(c.y-this.min.y,this.yScale,this.cellsY),P=Zm(u.y-this.min.y,this.yScale,this.cellsY);for(let R=S;R<=P;R++)for(let $=v;$<=k;$++){const W=this.cells[R*this.cellsX+$];if(W)for(let G=0;Gu.fqid),this.index=c.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.footprints=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){for(const g of this.footprints)u.push({footprint:g,id:c})}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=[];for(const{feature:S,id:P,index:R,sourceLayerIndex:$}of c){const W=this.layers[0]._featureFilter.needGeometry,G=Ot(S,W);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:P,properties:S.properties,type:S.type,sourceLayerIndex:$,index:R,geometry:W?G.geometry:wt(S,g,v),patterns:{}};k.push(X)}for(const S of k){const{geometry:P,index:R,sourceLayerIndex:$}=S;this.addFeature(S,P,R,g,{},u.availableImages,u.brightness),u.featureIndex.insert(c[R].feature,P,R,$,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,u,g,v,k,S,P){}destroy(){}addFeature(c,u,g,v,k,S=[],P){for(const R of U5(u,2)){const $=[],W=[],G=[],X=new ir(1/0,1/0),re=new ir(-1/0,-1/0);for(const Ce of R)if(Ce.length!==0){Ce!==R[0]&&G.push(W.length/2);for(let Se=0;SeS===v)===void 0}(g,f.clipScope)}function e6(f,c){return f.x-c.x||f.y-c.y}function w1e(f,c){return e6(f.min,c.min)===0&&e6(f.max,c.max)===0}function Fae(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew ir((R.x+k.x*Mr)*P-S.x*Mr,(R.y+k.y*Mr)*P-S.y*Mr))}return zae(u,v,f.indices,0,f.indices.length,0,0)}function N1e(f,c,u,g){const v=Math.pow(2,g.z-u.z);return new ir((f+u.x*Mr)*v-g.x*Mr,(c+u.y*Mr)*v-g.y*Mr)}function S1e(f,c){const u=[];c.grid.queryPoint(f,u);const g=c.indices,v=c.vertices;for(let k=0;k0&&(g.length>1&&u.push(g),g=[])}return g.length>1&&u.push(g),u}const $ae=Pt.types,XUe=["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"],QUe=["fill-extrusion-flood-light-ground-radius"],JUe=Math.pow(2,13),eqe=Math.pow(2,15)-1,M1e=new ir(0,1),dx=2147483648,T1e=7,A1e=450;function V5(f,c,u,g,v,k,S,P){f.emplaceBack((c<<1)+S,(u<<1)+k,(Math.floor(g*JUe)<<1)+v,Math.round(P))}function H5(f,c,u){f.emplaceBack(c.x*Mr,c.y*Mr,u?1:0)}function r6(f,c,u,g,v,k){f.emplaceBack(c.x,c.y,(u.x<<1)+g,(u.y<<1)+v,k)}function W5(f,c,u){f.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}class E1e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class I1e{constructor(){this.centroidXY=new ir(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 ir(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ir(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new ir(this.max.x-this.min.x,this.max.y-this.min.y)}}class P1e{constructor(){this.acc=new ir(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(c,u){c.min.x===Number.MAX_VALUE&&(c.min.x=c.max.x=u.x,c.min.y=c.max.y=u.y)}appendEdge(c,u,g){this.accCount++,this.acc._add(u);let v=!!this.borders;u.xc.max.x&&(c.max.x=u.x,v=!0),u.yc.max.y&&(c.max.y=u.y,v=!0),((u.x===0||u.x===Mr)&&u.x===g.x)!=((u.y===0||u.y===Mr)&&u.y===g.y)&&this.processBorderOverlap(u,g),v&&this.checkBorderIntersection(u,g)}checkBorderIntersection(c,u){u.x<0!=c.x<0&&this.addBorderIntersection(0,Fn(u.y,c.y,(0-u.x)/(c.x-u.x))),u.x>Mr!=c.x>Mr&&this.addBorderIntersection(1,Fn(u.y,c.y,(Mr-u.x)/(c.x-u.x))),u.y<0!=c.y<0&&this.addBorderIntersection(2,Fn(u.x,c.x,(0-u.y)/(c.y-u.y))),u.y>Mr!=c.y>Mr&&this.addBorderIntersection(3,Fn(u.x,c.x,(Mr-u.y)/(c.y-u.y)))}addBorderIntersection(c,u){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 g=this.borders[c];ug[1]&&(g[1]=u)}processBorderOverlap(c,u){if(c.x===u.x){if(c.y===u.y)return;const g=c.x===0?0:1;this.addBorderIntersection(g,u.y),this.addBorderIntersection(g,c.y)}else{const g=c.y===0?2:3;this.addBorderIntersection(g,u.x),this.addBorderIntersection(g,c.x)}}centroid(){return this.accCount===0?new ir(0,0):new ir(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((c,u)=>c+ +(u[0]!==Number.MAX_VALUE),0):0}}function L1e(f,c){const u=f.add(c)._unit(),g=je(f.x*u.x+f.y*u.y,-1,1);var v,k,S;return v=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(v)))/4*eqe*((k=f).x*(S=c).y-k.y*S.x<0?-1:1)}const tqe=[f=>f.x<0,f=>f.x>Mr,f=>f.y<0,f=>f.y>Mr];function rqe(f,c,u,g){const v=[4];if(g===0)return v;u._mult(g);const k=f.sub(u),S=c.sub(u),P=[f,c,k,S];for(let R=0;R<4;R++)for(const $ of P)if(tqe[R]($)){v.push(R);break}return v}class Uae{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new y5,this.indexArray=new $o,this.programConfigurations=new Ah(c.layers,{zoom:c.zoom,lut:c.lut},u=>QUe.includes(u)),this._segments=new Aa,this.hiddenByLandmarkVertexArray=new fN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Aa}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,u,g,v=!1){const k=c.length;if(k>2){let S=Math.max(0,this._segments.get().length-1);const P=this._segments._prepareSegment(4*k,this.vertexArray.length,2*this._segmentToGroundQuads[S].length);let R;S!==this._segments.get().length-1&&(S++,this._segmentToGroundQuads[S]=[],this._segmentToRegionTriCounts[S]=[0,0,0,0,0]);{const $=c[0],W=c[1];R=L1e($.sub(c[k-1])._perp()._unit(),W.sub($)._perp()._unit())}for(let $=0;$v.region-k.region);for(let g=0;gR+$,0);let P=0;for(let R=0;R<=4;R++){const $=S[R];if($!==0){let W=this.regionSegments[R];W||(W=this.regionSegments[R]=new Aa);const G={vertexOffset:k.vertexOffset,primitiveOffset:k.primitiveOffset+P,vertexLength:k.vertexLength,primitiveLength:$};W.get().push(G)}P+=$}for(let R=0;R0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,GUe.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 c=0;c<=4;c++){const u=this.regionSegments[c];u&&u.destroy()}}}}class n6{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaling=c.overscaling,this.layers=c.layers,this.pixelRatio=c.pixelRatio,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=c.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new $o,this.footprintVertices=new Vm,this.footprintSegments=[],this.layoutVertexArray=new $y,this.centroidVertexArray=new VP,this.wallVertexArray=new $v,this.indexArray=new $o,this.programConfigurations=new Ah(c.layers,{zoom:c.zoom,lut:c.lut},u=>XUe.includes(u)),this.segments=new Aa,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.groundEffect=new Uae(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.features=[],this.hasPattern=Pae("fill-extrusion",this.layers,this.pixelRatio,u),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=Pe(g),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:k,id:S,index:P,sourceLayerIndex:R}of c){const $=this.layers[0]._featureFilter.needGeometry,W=Ot(k,$);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),W,g))continue;const G={id:S,sourceLayerIndex:R,index:P,geometry:$?W.geometry:wt(k,g,v),properties:k.properties,type:k.type,patterns:{}},X=this.layoutVertexArray.length,re=$ae[G.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:k.id,feature:Lae("fill-extrusion",this.layers,G,this.zoom,this.pixelRatio,u)});else if(this.wallMode)for(const se of G.geometry)for(const pe of C1e(se,re))this.addFeature(k.id,G,[pe],P,g,{},u.availableImages,v,u.brightness);else this.addFeature(k.id,G,G.geometry,P,g,{},u.availableImages,v,u.brightness);u.featureIndex.insert(k,G.geometry,P,R,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,u,g,v,k,S){for(const{featureId:P,feature:R}of this.features){const $=$ae[R.type]==="Polygon",{geometry:W}=R;if(this.wallMode)for(const G of W)for(const X of C1e(G,$))this.addFeature(P,R,[X],R.index,u,g,v,k,S);else this.addFeature(P,R,W,R.index,u,g,v,k,S)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,u,g,v,k,S,P){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,this.worldview),this.groundEffect.update(c,u,k,g,v,S,P,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,ZUe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,WUe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,KUe.members,!0)),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}uploadCentroid(c){this.groundEffect.uploadHiddenByLandmark(c),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=c.createVertexBuffer(this.centroidVertexArray,HUe.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(c,u,g,v,k,S,P,R,$){const W=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(u,{})/this.tileToMeter,G=[new ir(0,0),new ir(Mr,Mr)],X=R.projection,re=X.name==="globe",se=this.wallMode||$ae[u.type]==="Polygon",pe=new P1e;pe.centroidDataIndex=this.centroidData.length;const Ce=new I1e;Ce.buildingId=c,u.properties&&u.properties.hasOwnProperty("building_id")&&(Ce.buildingId=u.properties.building_id);const Se=this.layers[0].paint.get("fill-extrusion-base").evaluate(u,{},k)<=0,De=this.layers[0].paint.get("fill-extrusion-height").evaluate(u,{},k);let Be;if(Ce.height=De,Ce.vertexArrayOffset=this.layoutVertexArray.length,Ce.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new oN),this.wallMode){if(re)return void Vr("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;Be=function(Dt){const tr=Dt[0].x===Dt[Dt.length-1].x&&Dt[0].y===Dt[Dt.length-1].y;(function(Zr){let rn=0;const gs=Zr.length;for(let kr=0;kr=0})(Dt)||(Dt=Dt.reverse());const lr={geometry:[],joinNormals:[],indices:[]},xr=[],vr=[],hr=[];let pr=Dt.length;for(;pr>=2&&Dt[pr-1].equals(Dt[pr-2]);)pr--;if(pr<(tr?3:2))return lr;let er,Yt,mr,Tr,jr,hn=0;for(;hn0;let qn="miter";const Os=2;qn==="miter"&&kr>Os&&(qn="bevel"),qn==="bevel"&&(kr>100&&(qn="flipbevel"),kr{const nr=new ir(rs.x,rs.y),yr=new ir(rs.x,rs.y);nr.x+=Oi.x*ut,nr.y+=Oi.y*ut,yr.x-=Oi.x*Math.max(ot,1),yr.y-=Oi.y*Math.max(ot,1),hr.push(Oi),xr.push(nr),vr.push(yr)};if(qn==="miter")rn._mult(kr),qs(er,rn,0,0);else if(qn==="flipbevel")rn=jr.mult(-1),qs(er,rn,0,0),qs(er,rn.mult(-1),0,0);else{const rs=-Math.sqrt(kr*kr-1),Oi=sn?rs:0,ot=sn?0:rs;Yt&&qs(er,Tr,Oi,ot),mr&&qs(er,jr,Oi,ot)}}lr.geometry=[...xr,...vr.reverse(),xr[0]],lr.joinNormals=[...hr,...hr.reverse(),hr[hr.length-1]];const Ur=lr.geometry.length-1;for(let Zr=0;ZrDt<(tr.length-1)/2||Dt===tr.length-1,dt=this.wallMode?[g]:U5(g,500);for(let Dt=dt.length-1;Dt>=0;Dt--){const tr=dt[Dt];(tr.length===0||(it=tr[0]).every(or=>or.x<=0)||it.every(or=>or.x>=Mr)||it.every(or=>or.y<=0)||it.every(or=>or.y>=Mr))&&dt.splice(Dt,1)}var it;let gt;if(re)gt=$1e(dt,G,k);else{gt=[];for(const Dt of dt)gt.push({polygon:Dt,bounds:G})}const St=se?this.edgeRadius:0,Tt=St>0&&this.zoom<17,Kt=(Dt,tr)=>{if(Dt.length===0)return!1;const or=Dt[Dt.length-1];return tr.x===or.x&&tr.y===or.y};for(const{polygon:Dt,bounds:tr}of gt){let or=0,lr=0;for(const pr of Dt)se&&!pr[0].equals(pr[pr.length-1])&&pr.push(pr[0]),lr+=se?pr.length-1:pr.length;const xr=this.segments.prepareSegment((se?5:4)*lr,this.layoutVertexArray,this.indexArray);Ce.footprintSegIdx<0&&(Ce.footprintSegIdx=this.footprintSegments.length),Ce.polygonSegIdx<0&&(Ce.polygonSegIdx=this.polygonSegments.length);const vr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},hr=new E1e;if(hr.vertexOffset=this.footprintVertices.length,hr.indexOffset=3*this.footprintIndices.length,hr.ringIndices=[],se){const pr=[],er=[];or=xr.vertexLength;for(let mr=0;mr4&&F1e(er[er.length-2],er[0],er[1]),mr=St?nqe(er[er.length-2],er[0],er[1],St):0;const Tr=[];let jr,hn,Ur;hn=er[1].sub(er[0])._perp()._unit();let Zr=!0;for(let rn=1,gs=0;rn0?1:0,Oi=kr.dist(sn);if(gs+Oi>32768&&(gs=0),St){Ur=qn.sub(sn)._perp()._unit();let yr=D1e(kr,sn,qn,O1e(hn,Ur),St);isNaN(yr)&&(yr=0);const Dr=sn.sub(kr)._unit();kr=kr.add(Dr.mult(mr))._round(),sn=sn.add(Dr.mult(-yr))._round(),mr=yr,hn=Ur,Se&&this.zoom>=17&&(Kt(Tr,kr)||Tr.push(kr),Kt(Tr,sn)||Tr.push(sn))}const ot=xr.vertexLength,ut=er.length>4&&F1e(kr,sn,qn);let nr=z1e(gs,Yt,Zr);if(V5(this.layoutVertexArray,kr.x,kr.y,qs,rs,0,0,nr),V5(this.layoutVertexArray,kr.x,kr.y,qs,rs,0,1,nr),this.wallMode){const yr=We(rn-1,er),Dr=Be.joinNormals[rn-1];H5(this.wallVertexArray,Dr,yr),H5(this.wallVertexArray,Dr,yr)}if(gs+=Oi,nr=z1e(gs,ut,!Zr),Yt=ut,V5(this.layoutVertexArray,sn.x,sn.y,qs,rs,0,0,nr),V5(this.layoutVertexArray,sn.x,sn.y,qs,rs,0,1,nr),this.wallMode){const yr=We(rn,er),Dr=Be.joinNormals[rn];H5(this.wallVertexArray,Dr,yr),H5(this.wallVertexArray,Dr,yr)}if(xr.vertexLength+=4,this.indexArray.emplaceBack(ot+0,ot+1,ot+2),this.indexArray.emplaceBack(ot+1,ot+3,ot+2),xr.primitiveLength+=2,St){const yr=or+(rn===1?er.length-2:rn-2),Dr=rn===1?or:yr+1;if(this.indexArray.emplaceBack(ot+1,yr,ot+3),this.indexArray.emplaceBack(yr,Dr,ot+3),xr.primitiveLength+=2,jr===void 0&&(jr=ot),!qae(qn,er[rn],tr)){const Rr=rn===er.length-1?jr:xr.vertexLength;this.indexArray.emplaceBack(ot+2,ot+3,Rr),this.indexArray.emplaceBack(ot+3,Rr+1,Rr),this.indexArray.emplaceBack(ot+3,Dr,Rr+1),xr.primitiveLength+=3}Zr=!Zr}if(re){const yr=this.layoutVertexExtArray,Dr=X.projectTilePoint(kr.x,kr.y,k),Rr=X.projectTilePoint(sn.x,sn.y,k),fn=X.upVector(k,kr.x,kr.y),bn=X.upVector(k,sn.x,sn.y);W5(yr,Dr,fn),W5(yr,Dr,fn),W5(yr,Rr,bn),W5(yr,Rr,bn)}}se&&(or+=er.length-1),Se&&St&&this.zoom>=17&&(Tr.length!==0&&Kt(Tr,Tr[0])&&Tr.pop(),this.groundEffect.addData(Tr,tr,W,St>0))}this.footprintSegments.push(hr),vr.triangleCount=this.indexArray.length-vr.triangleArrayOffset,this.polygonSegments.push(vr),++Ce.footprintSegLen,++Ce.polygonSegLen}if(Ce.vertexCount=this.layoutVertexArray.length-Ce.vertexArrayOffset,Ce.groundVertexCount=this.groundEffect.vertexArray.length-Ce.groundVertexArrayOffset,Ce.vertexCount!==0){if(Ce.centroidXY=pe.borders?M1e:this.encodeCentroid(pe,Ce),this.centroidData.push(Ce),pe.borders){this.featuresOnBorder.push(pe);const Dt=this.featuresOnBorder.length-1;for(let tr=0;trthis.featuresOnBorder[u].borders[c][0]-this.featuresOnBorder[g].borders[c][0])}splitToSubtiles(){const c=[];for(let P=0;PMr),W=2*$+(+(R.min.x+R.max.x>Mr)^$);for(let G=0;GP.triangleSegmentIdx===R.triangleSegmentIdx?P.subtile-R.subtile:P.triangleSegmentIdx-R.triangleSegmentIdx);let g=0,v=0,k=0;for(const P of c){if(P.triangleSegmentIdx!==g)break;k++}const S=c.length;for(;v!==c.length;){g=c[v].triangleSegmentIdx;let P=0,R=v,$=v;for(let W=R;W0&&this.triangleSubSegments.push({segment:re,min:G,max:X}),R=$;for(let se=R;se[pe[0]*(1-Se[0])+Ce[0]*Se[0],pe[1]*(1-Se[1])+Ce[1]*Se[1]],re=[],se=[];for(const pe of this.triangleSubSegments){re[0]=pe.min.x/Mr,re[1]=pe.min.y/Mr,se[0]=pe.max.x/Mr,se[1]=pe.max.y/Mr;const Ce=X(W,G,re),Se=X(W,G,se);if(new dn([Ce[0],Ce[1],k],[Se[0],Se[1],S]).intersectsPrecise(g)===0){$&&(v.segments.push($),$=void 0);continue}const De=pe.segment;$&&$.vertexOffset!==De.vertexOffset&&(v.segments.push($),$=void 0),$?($.vertexLength+=De.vertexLength,$.primitiveLength+=De.primitiveLength):$={vertexOffset:De.vertexOffset,primitiveLength:De.primitiveLength,vertexLength:De.vertexLength,primitiveOffset:De.primitiveOffset,sortKey:void 0,vaos:{}}}return $&&v.segments.push($),v}encodeCentroid(c,u){const g=c.centroid(),v=u.span(),k=Math.min(7,Math.round(v.x*this.tileToMeter/10)),S=Math.min(7,Math.round(v.y*this.tileToMeter/10));return new ir(je(g.x,1,Mr-1)<<3|k,je(g.y,1,Mr-1)<<3|S)}encodeBorderCentroid(c){if(!c.borders)return new ir(0,0);const u=c.borders,g=Number.MAX_VALUE;if(u[0][0]!==g||u[1][0]!==g){const v=u[0][0]!==g?0:1;return new ir(6|(u[0][0]!==g?0:65528),(u[v][0]+u[v][1])/2<<3|6)}{const v=u[2][0]!==g?2:3;return new ir((u[v][0]+u[v][1])/2<<3|6,6|(u[2][0]!==g?0:65528))}}showCentroid(c){const u=this.centroidData[c.centroidDataIndex];u.flags&=2147483647,u.centroidXY.x=0,u.centroidXY.y=0,this.writeCentroidToBuffer(u)}writeCentroidToBuffer(c){this.groundEffect.updateHiddenByLandmark(c);const u=c.vertexArrayOffset,g=c.vertexCount+c.vertexArrayOffset,v=c.flags&dx?M1e:c.centroidXY,k=this.centroidVertexArray.geta_centroid_pos0(u);if(this.centroidVertexArray.geta_centroid_pos1(u)!==v.y||k!==v.x){for(let S=u;SR.max.x||R.min.x>S.max.x||S.min.y>R.max.y||R.min.y>S.max.y||S.footprint.buildingIds.has(R.buildingId)&&(R.flags|=dx);else for(const R of this.centroidData)if(!(R.flags&dx||S.min.x>R.max.x||R.min.x>S.max.x||S.min.y>R.max.y||R.min.y>S.max.y))for(let $=0;$u!=re>u&&c<(this.footprintVertices.int16[2*(W+S.vertexOffset)+0]-G)*(u-X)/(re-X)+G&&(v=!v)}P=R}}return v}getHeightAtTileCoord(c,u){let g=Number.NEGATIVE_INFINITY,v=!0;const k=4*(c+Mr)*Mr+(u+Mr);if(this.partLookup.hasOwnProperty(k)){const S=this.partLookup[k];return S?{height:S.height,hidden:!!(S.flags&dx)}:void 0}for(const S of this.centroidData)c>S.max.x||S.min.x>c||u>S.max.y||S.min.y>u||S.height<=g||this.footprintContainsPoint(c,u,S)&&(g=S.height,this.partLookup[k]=S,v=!!(S.flags&dx));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.partLookup[k]=void 0}}function O1e(f,c){const u=f.add(c)._unit();return f.x*u.x+f.y*u.y}function nqe(f,c,u,g){const v=c.sub(f)._perp()._unit(),k=u.sub(c)._perp()._unit();return D1e(f,c,u,O1e(v,k),g)}function D1e(f,c,u,g,v){const k=Math.sqrt(1-g*g);return Math.min(f.dist(c)/3,c.dist(u)/3,v*k/g)}function qae(f,c,u){return f.xu[1].x&&c.x>u[1].x||f.yu[1].y&&c.y>u[1].y}function R1e(f,c){return f.xc[1].x||f.yc[1].y}function F1e(f,c,u){if(f.x<0||f.x>=Mr||c.x<0||c.x>=Mr||u.x<0||u.x>=Mr)return!1;const g=u.sub(c),v=g.perp(),k=f.sub(c);return(g.x*k.x+g.y*k.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(k.x*k.x+k.y*k.y))>-.866&&v.x*k.x+v.y*k.y<0}function z1e(f,c,u){const g=c?2|f:-3&f;return u?1|g:-2&g}function B1e(){const f=Math.PI/32,c=Math.tan(f),u=_;return u*Math.sqrt(1+2*c*c)-u}function $1e(f,c,u){const g=1<{for(const St of it)se.push({polygon:St,bounds:gt})},Ce=Math.ceil(Math.log2(W)),Se=Math.ceil(Math.log2(G)),De=Ce-Se,Be=[];for(let it=0;it0?0:1);for(let it=0;itgt+1?dt.push({polygons:lr,bounds:vr,depth:gt+1}):pe(lr,vr)}if(xr.length){const vr=[new ir(St===0?or:Tt.x,St===1?or:Tt.y),Kt];Be.length>gt+1?dt.push({polygons:xr,bounds:vr,depth:gt+1}):pe(xr,vr)}}return se}(f,c,Math.ceil((k-v)/11.25),Math.ceil((S-P)/11.25),1,(R,$,W)=>{if(R===0)return .5*($+W);{const G=ce((u.y+$/Mr)/g);return(V(.5*(ce((u.y+W/Mr)/g)+G))*g-u.y)*Mr}})}function sqe(f,c,u,g,v,k){const S=Math.pow(2,g.z-v.z);for(let P=0;P=R[S]&&(P=c,R=f),P[S]v&&H1e(P,R,S,v),P[S]k&&H1e(R,P,S,k)}}function s6(f,c,u,g,v,k){const S=[];for(let P=0;P=g&&se.x>=g||(re.x>=g?re=new ir(g,re.y+(g-re.x)/(se.x-re.x)*(se.y-re.y))._round():se.x>=g&&(se=new ir(g,re.y+(g-re.x)/(se.x-re.x)*(se.y-re.y))._round()),re.y>=v&&se.y>=v||(re.y>=v?re=new ir(re.x+(v-re.y)/(se.y-re.y)*(se.x-re.x),v)._round():se.y>=v&&(se=new ir(re.x+(v-re.y)/(se.y-re.y)*(se.x-re.x),v)._round()),$&&re.equals($[$.length-1])||($=[re],S.push($),k&&k.push({progress:{min:Ce+G1e(Se,De,re)*pe,max:1},parentIndex:P,prevPoint:Se,nextPoint:De})),$.push(se),k&&(k[k.length-1].progress.max=Ce+G1e(Se,De,se)*pe,k[k.length-1].nextPoint=De)))))}if(k&&G>0)for(let X=W;X$.t-W.t);let S=0,P=0,R=[];for(g.push(R);S!==f.length;){if(P===k.length){for(;S!==f.length;)R.length!==0&&R[R.length-1].equals(f[S])||R.push(f[S]),S++;break}k[P].t<=S?(R.length!==0&&R[R.length-1].equals(k[P].point)||R.push(k[P].point),Math.trunc(k[P].t),P++):(R.length!==0&&R[R.length-1].equals(f[S])||R.push(f[S]),S++)}}function G1e(f,c,u){return f.x!==c.x?(u.x-f.x)/(c.x-f.x):f.y!==c.y?(u.y-f.y)/(c.y-f.y):0}function G5(f,c){return f.x*c.x+f.y*c.y}function K1e(f,c){if(f.length===1){let u=0;const g=c[u++];let v;for(;!v||g.equals(v);)if(v=c[u++],!v)return 1/0;for(;u{or[0]=lr,or[1]=xr,or[2]=vr,or[3]=1},tr=B1e();re>0&&(re+=tr),se+=tr;for(const or of X){const lr=[],xr=[];for(const vr of or){const hr=vr.x+pe.x,pr=vr.y+pe.y,er=G.projection.projectTilePoint(hr,pr,dt),Yt=G.projection.upVector(dt,vr.x,vr.y);let mr=re,Tr=se;if(Se){const jr=X1e(hr,pr,re,se,Se,De,Be,We);mr+=jr.base,Tr+=jr.top}re!==0?Dt(Tt,er.x+Yt[0]*St*mr,er.y+Yt[1]*St*mr,er.z+Yt[2]*St*mr):Dt(Tt,er.x,er.y,er.z),Dt(Kt,er.x+Yt[0]*St*Tr,er.y+Yt[1]*St*Tr,er.z+Yt[2]*St*Tr),Ye(Tt,Tt,Ce),Ye(Kt,Kt,Ce),lr.push(new Xv(Tt[0],Tt[1],Tt[2])),xr.push(new Xv(Kt[0],Kt[1],Kt[2]))}it.push(lr),gt.push(xr)}return[it,gt]}(f,c,u,g,v,k,S,P,R,$,W):S?function(G,X,re,se,pe,Ce,Se,De,Be){const We=[],dt=[],it=[0,0,0,1];for(const gt of G){const St=[],Tt=[];for(const Kt of gt){const Dt=Kt.x+se.x,tr=Kt.y+se.y,or=X1e(Dt,tr,X,re,Ce,Se,De,Be);it[0]=Dt,it[1]=tr,it[2]=or.base,it[3]=1,jt(it,it,pe),it[3]=Math.max(it[3],1e-5);const lr=new Xv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);it[0]=Dt,it[1]=tr,it[2]=or.top,it[3]=1,jt(it,it,pe),it[3]=Math.max(it[3],1e-5);const xr=new Xv(it[0]/it[3],it[1]/it[3],it[2]/it[3]);St.push(lr),Tt.push(xr)}We.push(St),dt.push(Tt)}return[We,dt]}(c,u,g,v,k,S,P,R,$):function(G,X,re,se,pe){const Ce=[],Se=[],De=pe[8]*X,Be=pe[9]*X,We=pe[10]*X,dt=pe[11]*X,it=pe[8]*re,gt=pe[9]*re,St=pe[10]*re,Tt=pe[11]*re;for(const Kt of G){const Dt=[],tr=[];for(const or of Kt){const lr=or.x+se.x,xr=or.y+se.y,vr=pe[0]*lr+pe[4]*xr+pe[12],hr=pe[1]*lr+pe[5]*xr+pe[13],pr=pe[2]*lr+pe[6]*xr+pe[14],er=pe[3]*lr+pe[7]*xr+pe[15],Yt=vr+De,mr=hr+Be,Tr=pr+We,jr=Math.max(er+dt,1e-5),hn=vr+it,Ur=hr+gt,Zr=pr+St,rn=Math.max(er+Tt,1e-5);Dt.push(new Xv(Yt/jr,mr/jr,Tr/jr)),tr.push(new Xv(hn/rn,Ur/rn,Zr/rn))}Ce.push(Dt),Se.push(tr)}return[Ce,Se]}(c,u,g,v,k)}function X1e(f,c,u,g,v,k,S,P){const R=S*v.getElevationAt(f,c,!0,!0),$=k[0]!==0,W=$?k[1]===0?S*(k[0]/T1e-A1e):S*function(G,X,re){const se=Math.floor(X[0]/8),pe=Math.floor(X[1]/8),Ce=10*(X[0]-8*se),Se=10*(X[1]-8*pe),De=G.getElevationAt(se,pe,!0,!0),Be=G.getMeterToDEM(re),We=Math.floor(.5*(Ce*Be-1)),dt=Math.floor(.5*(Se*Be-1)),it=G.tileCoordToPixel(se,pe),gt=2*We+1,St=2*dt+1,Tt=function(xr,vr,hr,pr,er){return[xr.getElevationAtPixel(vr,hr,!0),xr.getElevationAtPixel(vr+er,hr,!0),xr.getElevationAtPixel(vr,hr+er,!0),xr.getElevationAtPixel(vr+pr,hr+er,!0)]}(G,it.x-We,it.y-dt,gt,St),Kt=Math.abs(Tt[0]-Tt[1]),Dt=Math.abs(Tt[2]-Tt[3]),tr=Math.abs(Tt[0]-Tt[2])+Math.abs(Tt[1]-Tt[3]),or=Math.min(.25,.5*Be*(Kt+Dt)/gt),lr=Math.min(.25,.5*Be*tr/St);return De+Math.max(or*Ce,lr*Se)}(v,k,P):R;return{base:R+(u===0?-1:u),top:$?Math.max(W+g,R+u+2):R+g}}class aqe{constructor(c){this._callback=c,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 oqe{constructor(){this.tasks={},this.taskQueue=[],Lt(["process"],this),this.invoker=new aqe(this.process),this.nextId=0}add(c,u){const g=this.nextId++,v=function({type:k,isSymbolTile:S,zoom:P}){return P=P||0,k==="message"?0:k!=="maybePrepare"||S?k!=="parseTile"||S?k==="parseTile"&&S?300-P:k==="maybePrepare"&&S?400-P:500:200-P:100-P}(u);if(v===0){try{c()}finally{}return null}return this.tasks[g]={fn:c,metadata:u,priority:v,id:g},this.taskQueue.push(g),this.invoker.trigger(),{cancel:()=>{delete this.tasks[g]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(g=>!!this.tasks[g]),!this.taskQueue.length)return;const c=this.pick();if(c===null)return;const u=this.tasks[c];if(delete this.tasks[c],this.taskQueue.length&&this.invoker.trigger(),!u)return;u.fn()}finally{}}pick(){let c=null,u=1/0;for(let v=0;v{g&&delete this.callbacks[P],this.target.postMessage({id:P,type:"",targetMapId:v,sourceMapId:this.mapId})}}}receive(c){const u=c.data;if(!u)return;const g=u.id;if(g&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type===""){const v=this.cancelCallbacks[g];delete this.cancelCallbacks[g],v&&v.cancel()}else if(u.mustQueue||Bs(self)){const v=this.callbacks[g],k=this.scheduler.add(()=>this.processTask(g,u),v&&v.metadata||{type:"message"});k&&(this.cancelCallbacks[g]=k)}else this.processTask(g,u)}processTask(c,u){if(delete this.cancelCallbacks[c],u.type===""){const g=this.callbacks[c];delete this.callbacks[c],g&&(u.error?g(qm(u.error)):g(null,qm(u.data)))}else{const g=new Set,v=u.hasCallback?(S,P)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:S?_p(S):null,data:_p(P,g)},g)}:()=>{},k=qm(u.data);if(this.parent[u.type])this.parent[u.type](u.sourceMapId,k,v);else if(this.parent.getWorkerSource){const S=u.type.split("."),{source:P,scope:R}=k;this.parent.getWorkerSource(u.sourceMapId,S[0],P,R)[S[1]](k,v)}else v(new Error(`Could not find function ${u.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var K5={workerUrl:"",workerClass:null,workerParams:void 0};const Vae="mapboxgl_preloaded_worker_pool";class Qv{constructor(c){this.active={},this.name=c}acquire(c,u=Qv.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Vae]}numActive(){return Object.keys(this.active).length}}Qv.workerCount=2;class CN{constructor(c,u,g="Worker",v=Qv.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=At();const k=this.workerPool.acquire(this.id,v);for(let S=0;S{this.ready=!0})}broadcast(c,u,g){bt(this.actors,(v,k)=>{v.send(c,u,k)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(c=>{c.remove()}),this.actors=[],this.workerPool.release(this.id)}}let Z5,Hae;function i6(){return Z5||(Z5=new Qv),Z5}CN.Actor=Q1e;const Wae=4096;class lqe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Wae),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Wae?-1:(new Int32Array(this.module.heap32.buffer,u,c.length).set(c),u)}createFloatArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Wae?-1:(new Float32Array(this.module.heapF32.buffer,u,c.length).set(c),u)}readStringBuffer(c){let u="";for(;this.module.heapU8[c]!==0;)u+=String.fromCharCode(this.module.heapU8[c]),++c;return u}setStyle(c){const u=c.normalScale;this.module.setStyle(u[0],u[1],u[2],c.tileToMeters)}setAOOptions(c,u){this.module.setAOOptions(c?1:0,u)}setMetricOptions(c,u){this.module.setMetricOptions(c?1:0,u)}setStructuralOptions(c){this.module.setStructuralOptions(c?1:0)}setFacadeOptions(c,u){this.module.setFacadeOptions(c,u?1:0)}setFauxFacadeOptions(c,u,g){this.module.setFauxFacadeOptions(c?1:0,u?1:0,g)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,u){this.memoryStackNextFree=this.memoryStack;for(const P of c){const R=this.createIntArray(P.ringIndices),$=this.createFloatArray(P.coordinates);if(R===-1||$===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(P.id,P.sourceId,P.minHeight,P.height,P.roofType,$,R,P.ringIndices.length-1)}for(const P of u){let R;R=P.entrances?JSON.parse(P.entrances):[];const $=this.createFloatArray(R),W=this.createFloatArray(P.coordinates);if($===-1||W===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(P.sourceId,P.crossPerc,P.distanceToRoad,$,R.length,W,P.coordinates.length)}if(!this.module.generateMesh()){const P=this.module.getLastError();return this.readStringBuffer(P)}const g=this.module.getMeshCount(),v=new Array(g);for(let P=0;Pv.arrayBuffer()).then(v=>{c.buffers[u]=v})}function ave(f,c){const u=f.json.bufferViews[c];return new Uint8Array(f.buffers[u.buffer],u.byteOffset||0,u.byteLength)}function pqe(f,c,u,g){if(f.uri){const v=ive(f.uri,g);return fetch(v).then(k=>k.blob()).then(k=>createImageBitmap(k)).then(k=>{c.images[u]=k})}if(f.bufferView!==void 0){const v=ave(c,f.bufferView),k=new Blob([v],{type:f.mimeType});return createImageBitmap(k).then(S=>{c.images[u]=S})}}function ove(f,c=0,u){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===nve){const W=new Uint32Array(f,c);let G=2;const X=(W[G++]>>2)-3,re=W[G++]>>2;if(G++,g.json=JSON.parse(sve.decode(W.subarray(G,G+re))),G+=re,G{const W=[],G=P&&P.includes(Zae),X=P&&P.includes(l6);if(G&&W.push(function(){if(!Ip)return Y5??(Y5=function(re){let se,pe=null;function Ce(){se=new Uint8Array(pe.buffer)}function Se(){throw new Error("Unexpected Draco error.")}const De={a:{a:Se,d:function(Be,We,dt){return se.copyWithin(Be,We,We+dt)},c:function(Be){const We=se.length,dt=Math.max(Be>>>0,Math.ceil(1.2*We)),it=Math.ceil((dt-We)/65536);try{return pe.grow(it),Ce(),!0}catch{return!1}},b:Se}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,De):re.then(Be=>Be.arrayBuffer()).then(Be=>WebAssembly.instantiate(Be,De))).then(Be=>{const{Rb:We,Qb:dt,P:it,T:gt,X:St,Ja:Tt,La:Kt,Qa:Dt,Va:tr,Wa:or,eb:lr,jb:xr,f:vr,e:hr,yb:pr,zb:er,Ab:Yt,Bb:mr,Db:Tr,Gb:jr}=Be.instance.exports;pe=hr;const hn=(()=>{let Ur=0,Zr=0,rn=0,gs=0;return kr=>{rn&&(We(gs),We(Ur),Zr+=rn,rn=Ur=0),Ur||(Zr+=128,Ur=dt(Zr));const sn=kr.length+7&-8;let qn=Ur;sn>=Zr&&(rn=sn,qn=gs=dt(sn));for(let Os=0;Os{Ip=re,Y5=void 0}))}()),X&&W.push(function(){if(Kae)return;const re=function(se){let pe;const Ce=WebAssembly.instantiateStreaming(se,{}).then(Be=>{pe=Be.instance,pe.exports.__wasm_call_ctors()}),Se={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},De={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Ce,supported:!0,decodeGltfBuffer(Be,We,dt,it,gt,St){(function(Tt,Kt,Dt,tr,or,lr,xr){const vr=Tt.exports.sbrk,hr=tr+3&-4,pr=vr(hr*or),er=vr(lr.length),Yt=new Uint8Array(Tt.exports.memory.buffer);Yt.set(lr,er);const mr=Kt(pr,tr,or,er,lr.length);if(mr===0&&xr&&xr(pr,hr,or),Dt.set(Yt.subarray(pr,pr+tr*or)),vr(pr-vr(0)),mr!==0)throw new Error(`Malformed buffer data: ${mr}`)})(pe,pe.exports[De[gt]],Be,We,dt,it,pe.exports[Se[St]])}}}(fetch(tve()));return re.ready.then(()=>{Kae=re})}()),k)for(let re=0;re{if(G&&S)for(const{primitives:re}of S)for(const se of re)uqe(se,g);if(X&&S&&R)for(const re of R)hqe(re,g);return g})})}function lve(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>ove(c,0,f))}function Yae(f){switch(f){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 Xae(f){switch(f){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 Qae{constructor(c,u,g,v){this.context=c,this.format=g,this.useMipmap=v&&v.useMipmap,this.texture=c.gl.createTexture(),this.update(u,{premultiply:v&&v.premultiply})}update(c,u){const g=c&&c instanceof HTMLVideoElement&&c.width===0?c.videoWidth:c.width,v=c&&c instanceof HTMLVideoElement&&c.height===0?c.videoHeight:c.height,{context:k}=this,{gl:S}=k,{x:P,y:R}=u&&u.position?u.position:{x:0,y:0},$=P+g,W=R+v;!this.size||this.size[0]===$&&this.size[1]===W||(S.bindTexture(S.TEXTURE_2D,null),S.deleteTexture(this.texture),this.texture=S.createTexture(),this.size=null),S.bindTexture(S.TEXTURE_2D,this.texture),k.pixelStoreUnpackFlipY.set(!1),k.pixelStoreUnpack.set(1),k.pixelStoreUnpackPremultiplyAlpha.set(this.format===S.RGBA8&&(!u||u.premultiply!==!1));const G=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&$>0&&W>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max($,W)))+1:1;S.texStorage2D(S.TEXTURE_2D,X,this.format,$,W),this.size=[$,W]}this.size&&(G?S.texSubImage2D(S.TEXTURE_2D,0,P,R,Yae(this.format),Xae(this.format),c):"data"in c&&c.data&&S.texSubImage2D(S.TEXTURE_2D,0,P,R,g,v,Yae(this.format),Xae(this.format),c.data)),this.useMipmap&&S.generateMipmap(S.TEXTURE_2D)}bind(c,u,g=!1){const{context:v}=this,{gl:k}=v;k.bindTexture(k.TEXTURE_2D,this.texture),c!==this.minFilter&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,c),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,this.useMipmap&&!g?c===k.NEAREST?k.NEAREST_MIPMAP_NEAREST:k.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),u!==this.wrapS&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,u),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,u),this.wrapS=u)}bindExtraParam(c,u,g,v,k){const{context:S}=this,{gl:P}=S;P.bindTexture(P.TEXTURE_2D,this.texture),u!==this.magFilter&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MAG_FILTER,u),this.magFilter=u),c!==this.minFilter&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MIN_FILTER,this.useMipmap?c===P.NEAREST?P.NEAREST_MIPMAP_NEAREST:P.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),g!==this.wrapS&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_S,g),this.wrapS=g),v!==this.wrapT&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_T,v),this.wrapT=v),k!==this.compareMode&&(k?(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_COMPARE_MODE,P.COMPARE_REF_TO_TEXTURE),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_COMPARE_FUNC,k)):P.texParameteri(P.TEXTURE_2D,P.TEXTURE_COMPARE_MODE,P.NONE),this.compareMode=k)}destroy(){const{gl:c}=this.context;c.deleteTexture(this.texture),this.texture=null}}class Q5{constructor(c,u){this.context=c,this.texture=u}bind(c,u){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),c!==this.minFilter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,c),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,c),this.minFilter=c),u!==this.wrapS&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,u),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,u),this.wrapS=u)}}const mqe=As([{name:"a_pos_3f",components:3,type:"Float32"}]),gqe=As([{name:"a_color_3f",components:3,type:"Float32"}]),xqe=As([{name:"a_color_4f",components:4,type:"Float32"}]),yqe=As([{name:"a_uv_2f",components:2,type:"Float32"}]),vqe=As([{name:"a_normal_3f",components:3,type:"Float32"}]),_qe=As([{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"}]),bqe=As([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function cve(f,c){const u=c6(f.projection,f.zoom,f.width,f.height),g=function(k,S,P,R,$){const W=new m(P.lng-180*Xy,P.lat),G=new m(P.lng+180*Xy,P.lat),X=k.project(W.lng,W.lat),re=k.project(G.lng,G.lat),se=-Math.atan2(re.y-X.y,re.x-X.x),pe=qe.fromLngLat(P);pe.y=je(pe.y,-1+Xy,1-Xy);const Ce=pe.toLngLat(),Se=k.project(Ce.lng,Ce.lat),De=qe.fromLngLat(Ce);De.x+=Xy;const Be=De.toLngLat(),We=k.project(Be.lng,Be.lat),dt=uve(We.x-Se.x,We.y-Se.y,se),it=qe.fromLngLat(Ce);it.y+=Xy;const gt=it.toLngLat(),St=k.project(gt.lng,gt.lat),Tt=uve(St.x-Se.x,St.y-Se.y,se),Kt=Math.abs(dt.x)/Math.abs(Tt.y),Dt=A([]);H(Dt,Dt,-se*(1-($?0:R)));const tr=A([]);return z(tr,tr,[1,1-(1-Kt)*R,1]),tr[4]=-Tt.x/Tt.y*R,H(tr,tr,se),T(tr,Dt,tr),tr}(f.projection,0,f.center,u,c),v=dve(f);return z(g,g,[v,v,1]),g}function dve(f){const c=f.projection,u=c6(f.projection,f.zoom,f.width,f.height),g=Jae(c,f.center),v=Jae(c,m.convert(c.center));return Math.pow(2,g*u+(1-u)*v)}function c6(f,c,u,g,v=1/0){const k=f.range;if(!k)return 0;const S=Math.min(v,Math.max(u,g)),P=Math.log2(S/1024);return Re(k[0]+P,k[1]+P,c)}const Xy=1/4e4;function Jae(f,c){const u=je(c.lat,-ue,ue),g=new m(c.lng-180*Xy,u),v=new m(c.lng+180*Xy,u),k=f.project(g.lng,u),S=f.project(v.lng,u),P=qe.fromLngLat(g),R=qe.fromLngLat(v),$=S.x-k.x,W=S.y-k.y,G=R.x-P.x,X=R.y-P.y,re=Math.sqrt((G*G+X*X)/($*$+W*W));return Math.log2(re)}function uve(f,c,u){const g=Math.cos(u),v=Math.sin(u);return{x:f*g-c*v,y:f*v+c*g}}function hve(f,c,u){A(f),H(f,f,ss(c[2])),F(f,f,ss(c[0])),q(f,f,ss(c[1])),z(f,f,u),T(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function d6(f,c,u,g,v,k,S,P){const R=[u[0]-c[0],u[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(ge(R)<1e-12||ge($)<1e-12)return Et(f);const W=Qe([],R,$);Fe(W,W),ye($,g,c),R[2]=(k-v)*P,$[2]=(S-v)*P;const G=R;return Qe(G,R,$),Fe(G,G),zn(f,W,G)}function u6(f,c,u=!1){const g=Zy(c.zoom),v=function(k,S,P){const R=S.worldSize,$=[k[12],k[13],k[14]],W=ce($[1]/R),G=Q($[0]/R),X=A([]),re=Y(1,W)*R,se=Y(1,0)*R*_e(W,S.zoom),pe=1/Mae(R);let Ce=se*pe;if(P){const We=c6(S.projection,S.zoom,S.width,S.height,1024);Ce=pe*S.projection.pixelSpaceConversion(S.center.lat,R,We)}const Se=Wy(W,G);de(Se,Se,he([],Fe([],Se),re*Ce*$[2]));const De=function(We){const dt=[We[0],We[1],We[2]];let it=[0,1,0];const gt=Qe([],it,dt);return Qe(it,dt,gt),Te(it)===0&&(it=[0,1,0],Qe(gt,dt,it)),Fe(gt,gt),Fe(it,it),Fe(dt,dt),[gt[0],gt[1],gt[2],0,it[0],it[1],it[2],0,dt[0],dt[1],dt[2],0,We[0],We[1],We[2],1]}(Se);z(X,X,[Ce,Ce,Ce*re]),L(X,X,[-$[0],-$[1],-$[2]]);const Be=T([],S.globeMatrix,De);return T(Be,Be,X),T(Be,Be,k),Be}(f,c,u);if(g>0){const k=function(S,P){const R=P.worldSize,$=Y(1,0)*R*_e(P.center.lat,P.zoom)/Mae(R),W=Y(1,P.center.lat)*R,G=A([]);q(G,G,ss(P.center.lng)),F(G,G,ss(P.center.lat)),L(G,G,[0,0,gc]),z(G,G,[$,$,$*W]);const X=P.point;return L(G,G,[-X.x,-X.y,0]),T(G,G,S),T(G,P.globeMatrix,G)}(f,c);return function(S,P,R){const $=(se,pe,Ce)=>{const Se=ge(se),De=ge(pe),Be=Ep(se,pe,Ce);return he(Be,Be,1/ge(Be)*Fn(Se,De,Ce))},W=$([S[0],S[1],S[2]],[P[0],P[1],P[2]],R),G=$([S[4],S[5],S[6]],[P[4],P[5],P[6]],R),X=$([S[8],S[9],S[10]],[P[8],P[9],P[10]],R),re=Ep([S[12],S[13],S[14]],[P[12],P[13],P[14]],R);return[W[0],W[1],W[2],0,G[0],G[1],G[2],0,X[0],X[1],X[2],0,re[0],re[1],re[2],1]}(v,k,g)}return v}function eoe(f,c,u,g){const v=dn.projectAabbCorners(g,u);let k=Number.MAX_VALUE;for(let P=0;P0||Ce===0&&se[0]*pe[0]+se[1]*pe[1]>=0&&se[0]*se[0]+se[1]*se[1]>pe[0]*pe[0]+pe[1]*pe[1])&&(W=re)}G=W}while(G!==$);return R.length>0&&R.push(R[0]),R}(v);if(ni(f,S))return k}const Jv=64,EN={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function h6(f,c,u,g,v,k,S,P,R,$=!1){const W=u.zoom,G=u.project(g),X=_e(g.lat,W),re=1/X;A(f),L(f,f,[G.x+S[0]*re,G.y+S[1]*re,S[2]]);let se=1,pe=1;const Ce=u.worldSize;if($){if(u.projection.name==="mercator"){let We=0;u.elevation&&(We=u.elevation.getAtPointOrZero(new qe(G.x/Ce,G.y/Ce),0));const dt=jt([],[G.x,G.y,We,1],u.projMatrix)[3]/u.cameraToCenterDistance;se=dt,pe=dt*_e(u.center.lat,W)}else if(u.projection.name==="globe"){const We=u6(f,u),dt=[0,0,0,1];jt(dt,dt,T([],u.projMatrix,We));const it=dt[3]/u.cameraToCenterDistance,gt=Zy(W),St=u.projection.pixelsPerMeter(g.lat,Ce)*_e(g.lat,W),Tt=u.projection.pixelsPerMeter(u.center.lat,Ce)*_e(u.center.lat,W);se=it/Fn(St,ke(u.center.lat),gt),pe=it*X/St,se*=Tt,pe*=Tt}}else se=re;z(f,f,[se,se,pe]);const Se=[...f],De=c.orientation,Be=[];if(hve(Be,[De[0]+(v?v[0]:0),De[1]+(v?v[1]:0),De[2]+(v?v[2]:0)],k),T(f,Se,Be),P&&u.elevation){let We=0;const dt=[];if(R&&u.elevation){We=function(gt,St,Tt,Kt,Dt){const tr=St.elevation;if(!tr)return 0;const or=dn.projectAabbCorners(Tt,Kt),lr=Y(1,Dt.lat)*St.worldSize,xr=function(Zr,rn){const gs=[0,0,1],kr=[{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 sn of kr){const qn=Zr[sn.corners[0]],Os=Zr[sn.corners[1]],qs=Zr[sn.corners[2]],rs=[Os[0]-qn[0],Os[1]-qn[1],rn*(Os[2]-qn[2])],Oi=Qe(rs,rs,[qs[0]-qn[0],qs[1]-qn[1],rn*(qs[2]-qn[2])]);Fe(Oi,Oi),sn.dotProductWithUp=Me(Oi,gs)}return kr.sort((sn,qn)=>sn.dotProductWithUp-qn.dotProductWithUp),kr[0].corners}(or,lr),vr=or[xr[0]],hr=or[xr[1]],pr=or[xr[2]],er=or[xr[3]],Yt=tr.getAtPointOrZero(new qe(vr[0]/St.worldSize,vr[1]/St.worldSize),0),mr=tr.getAtPointOrZero(new qe(hr[0]/St.worldSize,hr[1]/St.worldSize),0),Tr=tr.getAtPointOrZero(new qe(pr[0]/St.worldSize,pr[1]/St.worldSize),0),jr=tr.getAtPointOrZero(new qe(er[0]/St.worldSize,er[1]/St.worldSize),0),hn=(Yt+jr)/2,Ur=(mr+Tr)/2;return hn>Ur?mr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function wqe(f,c,u){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,mqe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,vqe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,yqe.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?gqe:xqe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,bqe.members,!0)),f.segments=Aa.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&J5(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&J5(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&J5(g.normalTexture,c),g.occlusionTexture&&J5(g.occlusionTexture,c,u),g.emissionTexture&&J5(g.emissionTexture,c)}function toe(f,c,u){if(f.meshes)for(const g of f.meshes)wqe(g,c,u);if(f.children)for(const g of f.children)toe(g,c,u)}function f6(f){if(f.meshes)for(const c of f.meshes)c.indexArray.destroy(),c.vertexArray.destroy(),c.colorArray&&c.colorArray.destroy(),c.normalArray&&c.normalArray.destroy(),c.texcoordArray&&c.texcoordArray.destroy(),c.featureArray&&c.featureArray.destroy();if(f.children)for(const c of f.children)f6(c)}function roe(f){if(f.meshes)for(const u of f.meshes)u.vertexBuffer&&(u.vertexBuffer.destroy(),u.indexBuffer.destroy(),u.normalBuffer&&u.normalBuffer.destroy(),u.texcoordBuffer&&u.texcoordBuffer.destroy(),u.colorBuffer&&u.colorBuffer.destroy(),u.pbrBuffer&&u.pbrBuffer.destroy(),u.segments.destroy(),u.material&&((c=u.material).pbrMetallicRoughness.baseColorTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),c.pbrMetallicRoughness.metallicRoughnessTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),c.normalTexture&&c.normalTexture.gfxTexture&&c.normalTexture.gfxTexture.destroy(),c.emissionTexture&&c.emissionTexture.gfxTexture&&c.emissionTexture.gfxTexture.destroy(),c.occlusionTexture&&c.occlusionTexture.gfxTexture&&c.occlusionTexture.gfxTexture.destroy()));var c;if(f.children)for(const u of f.children)roe(u)}function e_(f,c){const u=f.json.bufferViews[c.bufferView],g=o6[c.componentType];return new g(f.buffers[u.buffer],(c.byteOffset||0)+(u.byteOffset||0),c.count*(u.byteStride&&u.byteStride!==X5[c.type]*g.BYTES_PER_ELEMENT?u.byteStride/g.BYTES_PER_ELEMENT:X5[c.type]))}function noe(f,c,u,g){const v=o6[c.componentType],k=function(W){switch(W){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(v),S=f.json.bufferViews[c.bufferView],P=S.byteStride?S.byteStride/v.BYTES_PER_ELEMENT:X5[c.type],R=u.float32,$=R.length/u.capacity;for(let W=0,G=0;W0){for(let Ce=0;Ce0){k.texcoordArray=new _f;const X=c.json.accessors[v.TEXCOORD_0];k.texcoordArray.resize(X.count);const re=e_(c,X);noe(c,X,k.texcoordArray,re)}if(v._FEATURE_ID_RGBA4444!==void 0){const X=c.json.accessors[v._FEATURE_ID_RGBA4444];c.json.extensionsUsed&&c.json.extensionsUsed.includes("EXT_meshopt_compression")&&(k.featureData=e_(c,X))}v._FEATURE_RGBA4444!==void 0&&(k.featureData=new Uint32Array(e_(c,c.json.accessors[v._FEATURE_RGBA4444]).buffer));const G=f.material;return k.material=function(X,re){const{emissiveFactor:se=[0,0,0],alphaMode:pe="OPAQUE",alphaCutoff:Ce=.5,normalTexture:Se,occlusionTexture:De,emissiveTexture:Be,doubleSided:We,name:dt}=X,{baseColorFactor:it=[1,1,1,1],metallicFactor:gt=1,roughnessFactor:St=1,baseColorTexture:Tt,metallicRoughnessTexture:Kt}=X.pbrMetallicRoughness||{},Dt=De?re[De.index]:void 0;if(De&&De.extensions&&De.extensions.KHR_texture_transform&&Dt){const tr=De.extensions.KHR_texture_transform;Dt.offsetScale=[tr.offset[0],tr.offset[1],tr.scale[0],tr.scale[1]]}return{name:dt,pbrMetallicRoughness:{baseColorFactor:new ki(...it),metallicFactor:gt,roughnessFactor:St,baseColorTexture:Tt?re[Tt.index]:void 0,metallicRoughnessTexture:Kt?re[Kt.index]:void 0},doubleSided:We,emissiveFactor:new ki(...se),alphaMode:pe,alphaCutoff:Ce,normalTexture:Se?re[Se.index]:void 0,occlusionTexture:Dt,emissionTexture:Be?re[Be.index]:void 0,defined:X.defined===void 0}}(G!==void 0?c.json.materials[G]:{defined:!1},u),k}function pve(f,c,u){const{matrix:g,rotation:v,translation:k,scale:S,mesh:P,extras:R,children:$,name:W}=f,G={};if(G.name=W,G.localMatrix=g||function(X,re,se,pe){var Ce=re[0],Se=re[1],De=re[2],Be=re[3],We=Ce+Ce,dt=Se+Se,it=De+De,gt=Ce*We,St=Ce*dt,Tt=Ce*it,Kt=Se*dt,Dt=Se*it,tr=De*it,or=Be*We,lr=Be*dt,xr=Be*it,vr=pe[0],hr=pe[1],pr=pe[2];return X[0]=(1-(Kt+tr))*vr,X[1]=(St+xr)*vr,X[2]=(Tt-lr)*vr,X[3]=0,X[4]=(St-xr)*hr,X[5]=(1-(gt+tr))*hr,X[6]=(Dt+or)*hr,X[7]=0,X[8]=(Tt+lr)*pr,X[9]=(Dt-or)*pr,X[10]=(1-(gt+Kt))*pr,X[11]=0,X[12]=se[0],X[13]=se[1],X[14]=se[2],X[15]=1,X}([],v||[0,0,0,1],k||[0,0,0],S||[1,1,1]),G.globalMatrix=C(G.localMatrix),P!==void 0){G.meshes=u[P];const X=G.anchor=[0,0];for(const re of G.meshes){const{min:se,max:pe}=re.aabb;X[0]+=se[0]+pe[0],X[1]+=se[1]+pe[1]}X[0]=Math.floor(X[0]/G.meshes.length/2),X[1]=Math.floor(X[1]/G.meshes.length/2)}if(R&&(R.id&&(G.id=R.id),R.lights&&(G.lights=function(X){if(!X.length)return[];const re=function(De){const Be=atob(De),We=new Uint8Array(Be.length);for(let dt=0;dt1&&g[g.length-1].equals(g[0])&&g.pop();let v=0;for(let S=0;S0&&g.reverse();const k=NN(g.flatMap(S=>[S.x,S.y]),[]);return k.length===0?null:{vertices:g,indices:k}}function Sqe(f,c){const u=[],g=[];let v=0;const k=[];for(const S of f){v=u.length;const P=S.vertexArray.float32,R=S.indexArray.uint16;for(let $=0;$0&&([g[S+1],g[S+2]]=[g[S+2],g[S+1]])}return{vertices:u,indices:g}}function soe(f){const c=function(R,$){const W=[],G=WebGL2RenderingContext;if(R.json.textures)for(const X of R.json.textures){const re={magFilter:G.LINEAR,minFilter:G.NEAREST,wrapS:G.REPEAT,wrapT:G.REPEAT};X.sampler!==void 0&&Object.assign(re,R.json.samplers[X.sampler]),W.push({image:$[X.source],sampler:re,uploaded:!1})}return W}(f,f.images),u=function(R,$){const W=[];for(const G of R.json.meshes){const X=[];for(const re of G.primitives)X.push(jqe(re,R,$));W.push(X)}return W}(f,c),{scenes:g,scene:v,nodes:k}=f.json,S=g?g[v||0].nodes:[...k.keys()],P=[];for(const R of S)P.push(pve(k[R],f,u));return function(R,$,W){const G={},X=new Set;for(let re=0;re0){const re=Array.from(X.values()).sort((se,pe)=>se-pe);for(let se=re.length-1;se>=0;se--)R.splice(re[se],1)}}(P,S,f.json.nodes),P}function Cqe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const c=f.vertexArray.float32,u=f.aabb.min[0]-1,g=f.aabb.min[1]-1,v=Jv/(f.aabb.max[0]-u+2),k=Jv/(f.aabb.max[1]-g+2);for(let S=0;Sf.heightmap[$*Jv+R]&&(f.heightmap[$*Jv+R]=P)}}function mve(f,c,u,g,v){u.reserve(u.length+4*f.length),g.reserve(g.length+10*f.length),v.reserve(v.length+10*f.length);let k=g.length;for(const S of f){const P=Math.min(10,Math.max(4,1.3*S.height))*c,R=[-S.normal[1],S.normal[0],0],$=Math.min(.29,.1*S.width/S.depth),W=S.width-2*S.depth*c*($+.01),G=xe([],S.pos,R,W/2),X=xe([],S.pos,R,-W/2),re=[G[0],G[1],G[2]+S.height],se=[X[0],X[1],X[2]+S.height],pe=xe([],S.normal,R,$);he(pe,pe,P);const Ce=xe([],S.normal,R,-$);he(Ce,Ce,P),de(pe,G,pe),de(Ce,X,Ce),G[2]+=.1,X[2]+=.1,g.emplaceBack(pe[0],pe[1],pe[2]),g.emplaceBack(Ce[0],Ce[1],Ce[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(re[0],re[1],re[2]),g.emplaceBack(se[0],se[1],se[2]),g.emplaceBack(G[0],G[1],G[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(pe[0],pe[1],pe[2]),g.emplaceBack(Ce[0],Ce[1],Ce[2]);const Se=W/P/2;v.emplaceBack(-Se-$,-1,Se,.8),v.emplaceBack(Se+$,-1,Se,.8),v.emplaceBack(-Se,0,Se,1.3),v.emplaceBack(Se,0,Se,1.3),v.emplaceBack(Se+$,-.8,Se,.7),v.emplaceBack(Se+$,-.8,Se,.7),v.emplaceBack(0,0,Se,1.3),v.emplaceBack(0,0,Se,1.3),v.emplaceBack(Se+$,-1.2,Se,.8),v.emplaceBack(Se+$,-1.2,Se,.8),u.emplaceBack(6+k,4+k,8+k),u.emplaceBack(7+k,9+k,5+k),u.emplaceBack(0+k,1+k,2+k),u.emplaceBack(1+k,3+k,2+k),k+=10}}function Mqe(f,c){const u={};u.indexArray=new $o,u.vertexArray=new du,u.colorArray=new Hm,mve(f,c,u.indexArray,u.vertexArray,u.colorArray);const g={defined:!0};g.emissiveFactor=ki.black;const v={};return v.baseColorFactor=ki.white,g.pbrMetallicRoughness=v,u.material=g,u.aabb=new dn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),u}const gve=As([{name:"a_pos_3f",components:3,type:"Float32"}]),Tqe=As([{name:"a_normal_3",components:3,type:"Int16"}]),Aqe=As([{name:"a_centroid_3",components:3,type:"Int16"}]),xve=As([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),Eqe=As([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),Iqe=As([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),Pqe=As([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),Lqe=As([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),Oqe=As([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),yve=Pt.types,p6=32767;function Dqe(f,c){const u=Mr+c;for(const g of f)for(const v of g)if(v.x<-c||v.x>u||v.y<-c||v.y>u)return!1;return!0}function Rqe(f){switch(f){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${f}`)}}class ioe{constructor(){this.layoutVertexArray=new du,this.layoutAttenuationArray=new Hm,this.layoutColorArray=new uu,this.indexArray=new $o,this.indexArrayForConflation=new $o,this.segmentsBucket=new Aa}}class aoe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Aa,this.entranceBloom=new ioe;const u=66560;this.layoutVertexArray=new du,this.layoutVertexArray.reserve(u),this.layoutNormalArray=new By,this.layoutNormalArray.reserve(u),this.layoutCentroidArray=new By,this.layoutCentroidArray.reserve(u),this.layoutColorArray=new uu,this.layoutColorArray.reserve(u),this.layoutFloodLightDataArray=new Wm,this.layoutFloodLightDataArray.reserve(u),this.layoutAOArray=new fN,this.layoutAOArray.reserve(u),this.indexArray=new $o,this.indexArray.reserve(66560),this.indexArrayForConflation=new $o,this.segmentsBucket=new Aa,this.entranceBloom=new ioe,c&&(this.layoutFacadePaintArray=new uu,this.layoutFacadeDataArray=new ax,this.layoutFacadeVerticalRangeArray=new uu)}reserve(c,u,g){this.layoutVertexArray.reserveForAdditional(c),this.layoutCentroidArray.reserveForAdditional(c),this.layoutFloodLightDataArray.reserveForAdditional(c),this.layoutNormalArray.reserveForAdditional(c),this.layoutAOArray.reserveForAdditional(c),this.layoutColorArray.reserveForAdditional(c),this.indexArray.reserveForAdditional(u),g&&(this.layoutFacadePaintArray.reserveForAdditional(c),this.layoutFacadeDataArray.reserveForAdditional(c),this.layoutFacadeVerticalRangeArray.reserveForAdditional(c))}}class vve{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new _f,this.footprintsIndices=new Wm,this.footprintsMin=new ir(1/0,1/0),this.footprintsMax=new ir(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new aoe(!1),this.buildingWithFacade=new aoe(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=c.zoom,this.canonical=c.canonical,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.worldview=c.worldview,this.lut=c.lut,this.programConfigurations=new Ah(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.groundEffect=new Uae(c),this.groundEffect.groundRadiusArray=new kp,this.hasAppearances=null}updateFootprints(c,u){const g=new JP([],[],1),v={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};u.push({footprint:v,id:c})}updateAppearances(c,u,g,v){}prepare(){return function(){if(a6!=null||J1e!=null)return null;if(AN!=null)return AN;const c=fetch(Ms.BUILDING_GEN_URL);return AN=function(u){let g,v,k,S,P;function R(){g=new Uint8Array(P.buffer),v=new Int16Array(P.buffer),k=new Int32Array(P.buffer),S=new Float32Array(P.buffer)}function $(){throw new Error("Unexpected BuildingGen error.")}const W=()=>{},G={a:{a:$,f:function(X){const re=g.length,se=Math.max(X>>>0,Math.ceil(1.2*re)),pe=Math.ceil((se-re)/65536);try{return P.grow(pe),R(),!0}catch{return!1}},g:$,b:W,c:W,d:W,e:W}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(u,G):u.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,G))).then(X=>{const re=X.instance.exports;return(0,re.g)(),P=re.f,R(),new lqe({setStyle:re.h,setAOOptions:re.i,setMetricOptions:re.j,setStructuralOptions:re.k,setFacadeOptions:re.l,setFauxFacadeOptions:re.m,setFacadeClassifierOptions:re.n,addFeature:re.o,addFacade:re.p,generateMesh:re.q,getLastError:re.r,getOuterRingLength:re.s,getMeshCount:re.t,getPositionsPtr:re.u,getPositionsLength:re.v,getNormalsPtr:re.w,getNormalsLength:re.x,getAOPtr:re.y,getAOLength:re.z,getUVPtr:re.A,getUVLength:re.B,getFauxFacadePtr:re.C,getFauxFacadeLength:re.D,getIndicesPtr:re.E,getIndicesLength:re.F,getBuildingPart:re.G,getRingCount:re.H,getRingPtr:re.I,getRingLength:re.J,malloc:re.K,free:re.L,heapU8:g,heap16:v,heap32:k,heapF32:S})})}(c).then(u=>(AN=null,a6=u,a6)).catch(u=>{Vr("Could not load building-gen"),AN=null,J1e=u}),AN}()}populate(c,u,g,v){const k=cqe();if(!k)return;const S=Pe(g);this.tileToMeter=S,this.brightness=u.brightness,k.setStyle({normalScale:[1,-1,S],tileToMeters:S}),k.setAOOptions(!1,.3),k.setMetricOptions(!1,16),k.setStructuralOptions(!0),k.setFacadeClassifierOptions(3);const P=new Map,R=new Map;let $=0;for(const{feature:Se}of c){if(yve[Se.type]!=="LineString"){P.set(Se.id,Se.properties.source_id);continue}const De=this.layers[0]._featureFilter.needGeometry;if(De&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),Se,g))continue;const Be=Ot(Se,De);if(!De&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),Be,g))continue;const We=De?Be.geometry:wt(Se,g,v),dt=[];for(const Tt of We)for(const Kt of Tt)dt.push(Kt.x),dt.push(Kt.y);const it={coordinates:dt,crossPerc:Se.properties.cross_perc,distanceToRoad:Se.properties.distance_to_road,entrances:Se.properties.entrances,sourceId:0},gt=Se.properties.source_id;let St=R.get(gt);St||(St=[],R.set(gt,St)),St.push(it),++$}this.maxHeight=0;const W=new Array,G=new Set,X=Se=>{Se!=null&&G.add(Se)},re=(Se,De)=>{Se!=null&&W.push({buildingId:Se,footprintIndex:De})},se=64*(c.length-$),pe=se/2;this.buildingWithFacade.reserve(se,pe,!0),this.buildingWithoutFacade.reserve(2*se,2*pe,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:Se,id:De,index:Be,sourceLayerIndex:We}of c){if(yve[Se.type]==="LineString")continue;const dt=this.layers[0]._featureFilter.needGeometry;if(dt&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),Se,g))continue;let it=null;if(Se.properties&&Se.properties.hasOwnProperty("building_id")&&(it=Se.properties.building_id,G.has(it)))continue;const gt=Ot(Se,dt);if(!dt&&!this.layers[0]._featureFilter.filter(new Ji(this.zoom),gt,g))continue;const St=dt?gt.geometry:wt(Se,g,v),Tt=U5(St,500);let Kt=!1;for(const Pn of Tt)if(Pn.length!==1){Kt=!0;break}if(Kt){X(it);continue}if(!Dqe(St,163)){X(it);continue}const Dt=this.layers[0],tr=Rqe(Dt.layout.get("building-roof-shape").evaluate(Se,{},g)),or=Dt.layout.get("building-base").evaluate(Se,{},g),lr=Dt.layout.get("building-height").evaluate(Se,{},g),xr=Dt.layout.get("building-flood-light-ground-radius").evaluate(Se,{},g),vr=Dt.paint.get("building-ambient-occlusion-intensity"),hr=xr/this.tileToMeter;Se.properties["building-part"]="roof";const pr=Dt.paint.get("building-color").evaluate(Se,{},this.canonical).toPremultipliedRenderColor(this.lut),er=Dt.paint.get("building-emissive-strength").evaluate(Se,{},this.canonical);Se.properties["building-part"]="wall";const Yt=Dt.paint.get("building-color").evaluate(Se,{},this.canonical).toPremultipliedRenderColor(this.lut),mr=Dt.paint.get("building-emissive-strength").evaluate(Se,{},this.canonical);Se.properties["building-part"]="window";const Tr=Dt.paint.get("building-color").evaluate(Se,{},this.canonical).toPremultipliedRenderColor(this.lut),jr=Dt.paint.get("building-emissive-strength").evaluate(Se,{},this.canonical);Se.properties["building-part"]="door";const hn=Dt.paint.get("building-color").evaluate(Se,{},this.canonical).toPremultipliedRenderColor(this.lut),Ur=Dt.paint.get("building-emissive-strength").evaluate(Se,{},this.canonical);let Zr=Dt.layout.get("building-flood-light-wall-radius").evaluate(Se,{},g);Zr=je(Zr,0,2048);const rn=Zr/2048*p6,gs=P.get(De),kr=R.get(gs)||[],sn=kr.length!==0&&Dt.layout.get("building-facade").evaluate(Se,{},g);k.setFacadeOptions(4,!0),k.setFauxFacadeOptions(sn,!1,1);let qn=0,Os=0,qs=0,rs=0,Oi=0,ot=0,ut=0,nr=0,yr=0,Dr=0,Rr=0;if(sn){let Pn=Math.round(Dt.layout.get("building-facade-floors").evaluate(Se,{},g));if(or===0){Pn=Math.max(1,Pn-(kr.length>0?1:0));let Ci=4;if(lr>100){const ya=[10,13,15];Ci=ya[Se.id?Se.id%ya.length:0]}else lr<=10&&(Ci=3);k.setFacadeOptions(Ci,!0),Oi=(lr<15?1.3:1.61803)*Ci/S}else Oi=or/S;ot=lr/S,Oi=Math.min(Oi,ot),qs=Dt.layout.get("building-facade-unit-width").evaluate(Se,{},g)/S,rs=(ot-Oi)/Pn,k.setFauxFacadeOptions(!0,!0,qs);const Pa=Dt.layout.get("building-facade-window").evaluate(Se,{},g);qn=Pa[0],Os=Pa[1],ut=Math.floor(65535*Math.min(1,Oi/Mr)),nr=Math.floor(65535*Math.min(1,ot/Mr)),yr=Math.floor(255*qn)<<8|Math.floor(255*Os),Dr=Math.floor(65535*Math.min(1,qs/Mr)),Rr=Math.floor(65535*Math.min(1,rs/Mr))}const fn=Array(Tt.length),bn={x:1/0,y:1/0},Jn={x:-1/0,y:-1/0},cs={x:0,y:0};let ms=0;for(let Pn=0;Pn0){const Ci=[],ya=Array(Pa.length+1);ya[0]=0;for(let Vo=0;VoMr||bn.y<0||Jn.y>Mr)&&this.featuresOnBorder.push({featureId:Se.id,footprintIndex:this.footprints.length});{const Pn=NN(Bi,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Pn.length),this.footprintsIndices.uint16.set(Pn,In),this.buildingIds.add(it??Se.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Yi.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Yi.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ea.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ea.y);const Pa={footprintVertexOffset:Is,footprintVertexLength:this.footprintsVertices.length-Is,footprintIndexOffset:In,footprintIndexLength:this.footprintsIndices.length-In,min:Yi,max:ea,hiddenFlags:0,indicesOffset:yi,indicesLength:ka,bloomIndicesOffset:Si,bloomIndicesLength:Hi,groundEffectVertexOffset:lo,groundEffectVertexLength:Xi,hasFauxFacade:sn,height:ds,promoteId:De,feature:gt,parts:ai,buildingBloom:oi},Ci=this.footprints.length;Se.id!==void 0&&this.featureFootprintLookup.set(Se.id,Ci),re(it,Ci),this.footprints.push(Pa)}this.programConfigurations.populatePaintArrays(Ln.layoutVertexArray.length,Se,Be,{},u.availableImages,g,u.brightness),this.groundEffect.addPaintPropertiesData(Se,Be,{},u.availableImages,g,u.brightness),u.featureIndex.insert(Se,St,Be,We,this.index,Di)}W.forEach(({buildingId:Se,footprintIndex:De})=>{G.has(Se)&&(this.footprints[De].hiddenFlags|=4)});const Ce=new Set;this.buildingIds.forEach((Se,De,Be)=>{G.has(Se)||Ce.add(Se)}),this.buildingIds=Ce,this.groundEffect.prepareBorderSegments()}update(c,u,g,v,k,S,P){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P),this.groundEffect.update(c,u,k,g,v,S,P),this.evaluate(this.layers[0],c),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(c){const u=g=>{g.layoutVertexBuffer=c.createVertexBuffer(g.layoutVertexArray,gve.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,Tqe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,Aqe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,Oqe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,Iqe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,Pqe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,gve.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,Lqe.members)),this.uploadUpdatedColorBuffer(c),this.uploadUpdatedIndexBuffer(c)};this.uploaded||(u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){const c=u=>{u.layoutVertexBuffer&&(u.layoutVertexBuffer.destroy(),u.layoutNormalBuffer.destroy(),u.layoutColorBuffer.destroy(),u.segmentsBucket.destroy(),u.indexBuffer&&u.indexBuffer.destroy(),u.entranceBloom.layoutVertexBuffer&&(u.entranceBloom.layoutVertexBuffer.destroy(),u.entranceBloom.layoutColorBuffer.destroy(),u.entranceBloom.layoutAttenuationBuffer.destroy(),u.entranceBloom.indexBuffer.destroy(),u.entranceBloom.segmentsBucket.destroy()))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(c,u,g=!0){let v=!1;const k=g?u:0,S=0|(g?-1:~u);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const P of c){const R=this.footprints[P],$=R.hiddenFlags&S|k;R.hiddenFlags!==$&&(R.hiddenFlags=$,v=!0,this.groundEffect.updateHiddenByLandmarkRange(R.groundEffectVertexOffset,R.groundEffectVertexLength,R.hiddenFlags!==0))}return v&&(this.indexArrayForConflationUploaded=!1),v}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const u=v=>{v.indexArray.length!==0&&(v.indexArrayForConflation.resize(v.indexArray.length),v.indexArrayForConflation.uint16.set(v.indexArray.uint16),v.entranceBloom.indexArrayForConflation.resize(v.entranceBloom.indexArray.length),v.entranceBloom.indexArrayForConflation.uint16.set(v.entranceBloom.indexArray.uint16))};u(this.buildingWithoutFacade),u(this.buildingWithFacade);for(const v of this.footprints){const k=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,S=v.indicesOffset+v.indicesLength;if(v.hiddenFlags!==0){for(let R=v.indicesOffset;R{v.indexArray.length!==0&&(v.indexBuffer?v.indexBuffer.updateData(v.indexArrayForConflation):v.indexBuffer=c.createIndexBuffer(v.indexArrayForConflation,!0),v.entranceBloom.indexBuffer?v.entranceBloom.indexBuffer.updateData(v.entranceBloom.indexArrayForConflation):v.entranceBloom.indexBuffer=c.createIndexBuffer(v.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(c){const u=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=c.createVertexBuffer(g.layoutColorArray,xve.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,Eqe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,xve.members,!0)};u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,u){const g=c.paint.get("building-ambient-occlusion-intensity");for(const v of this.footprints){if(4&v.hiddenFlags)continue;const k=u[v.promoteId],S=v.feature;S.properties["building-part"]="roof";const P=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),R=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="wall";const $=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),W=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="window";const G=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),X=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="door";const re=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),se=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical),pe=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const Se of v.parts){let De,Be=P;Se.part===1?(Be=P,De=R):Se.part===0?(Be=$,De=W):Se.part===2?(Be=G,De=X):Se.part===3&&(Be=re,De=se),De=je(De,0,1);for(let We=0;WeS.max.x||R.max.xS.max.y||R.max.yP.max.x||P.min.x>c||u>P.max.y||P.min.y>u||P.height<=g||Fqe(S,this.footprintsVertices.float32.subarray(2*P.footprintVertexOffset,2*(P.footprintVertexOffset+P.footprintVertexLength)),this.footprintsIndices.uint16.subarray(P.footprintIndexOffset,P.footprintIndexOffset+P.footprintIndexLength))&&(g=P.height,this.footprintLookup[k]=P,v=P.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.footprintLookup[k]=void 0}}function Fqe(f,c,u){for(let g=0;g1&&(R=c[++P]);const W=Math.abs($-R.left),G=Math.abs($-R.right),X=Math.min(W,G);let re;const se=k/g*(v+1);if(R.isDash){const pe=v-Math.abs(se);re=Math.sqrt(X*X+pe*pe)}else re=v-Math.sqrt(X*X+se*se);this.image.data[S+$]=Math.max(0,Math.min(255,re+128))}}}addRegularDash(c,u){for(let R=c.length-1;R>=0;--R){const $=c[R],W=c[R+1];$.zeroLength?c.splice(R,1):W&&W.isDash===$.isDash&&(W.left=$.left,c.splice(R,1))}const g=c[0],v=c[c.length-1];g.isDash===v.isDash&&(g.left=v.left-this.width,v.right=g.right+this.width);const k=this.width*this.nextRow;let S=0,P=c[S];for(let R=0;R1&&(P=c[++S]);const $=Math.abs(R-P.left),W=Math.abs(R-P.right),G=Math.min($,W);this.image.data[k+R]=Math.max(0,Math.min(255,(P.isDash?G:-G)+u+128))}}addDash(c,u){const g=this.getKey(c,u);if(this.positions[g])return this.positions[g];const v=u==="round",k=v?7:0,S=2*k+1;if(this.nextRow+S>this.height)return Vr("LineAtlas out of space"),null;c.length===0&&c.push(1);let P=0;for(let W=0;Wu.fqid),this.index=c.index,this.projection=c.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(u=>{this.gradients[u.id]={}}),this.layoutVertexArray=new aN,this.layoutVertexArray2=new du,this.patternVertexArray=new du,this.indexArray=new $o,this.programConfigurations=new Ah(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Aa,this.maxLineLength=0,this.zOffsetVertexArray=new du,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Mr/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Pae("line",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Pe(g);const S=this.layers[0].layout.get("line-elevation-reference");if(S==="hd-road-markup")this.elevationType="road";else{const X=this.layers[0].layout.get("line-z-offset"),re=X.isConstant()&&!X.constantOr(0);this.elevationType=S!=="sea"&&S!=="ground"&&re?"none":"offset",this.elevationType==="offset"&&S==="none"&&Vr(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const P=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&P!==void 0;const R=[];for(const{feature:X,id:re,index:se,sourceLayerIndex:pe}of c){const Ce=this.layers[0]._featureFilter.needGeometry,Se=Ot(X,Ce);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),Se,g))continue;const De=k?k.evaluate(Se,{},g):void 0,Be={id:re,properties:X.properties,type:X.type,sourceLayerIndex:pe,index:se,geometry:Ce?Se.geometry:wt(X,g,v),patterns:{},sortKey:De};R.push(Be)}k&&R.sort((X,re)=>X.sortKey-re.sortKey);const{lineAtlas:$,featureIndex:W}=u,G=this.addConstantDashes($);for(const X of R){const{geometry:re,index:se,sourceLayerIndex:pe}=X;if(G&&this.addFeatureDashes(X,$),this.hasPattern){const Ce=Lae("line",this.layers,X,this.zoom,this.pixelRatio,u);this.patternFeatures.push(Ce)}else this.addFeature(X,re,se,g,$.positions,u.availableImages,u.brightness,u.elevationFeatures);W.insert(c[se].feature,re,se,pe,this.index)}}addConstantDashes(c){let u=!1;for(const g of this.layers){const v=g.paint.get("line-dasharray").value,k=g.layout.get("line-cap").value;if(v.kind!=="constant"||k.kind!=="constant")u=!0;else{const S=k.value,P=v.value;if(!P)continue;c.addDash(P,S)}}return u}addFeatureDashes(c,u){const g=this.zoom;for(const v of this.layers){const k=v.paint.get("line-dasharray").value,S=v.layout.get("line-cap").value;if(k.kind==="constant"&&S.kind==="constant")continue;let P,R;if(k.kind==="constant"){if(P=k.value,!P)continue}else P=k.evaluate({zoom:g},c);R=S.kind==="constant"?S.value:S.evaluate({zoom:g},c),u.addDash(P,R),c.patterns[v.id]=[u.getKey(P,R)]}}update(c,u,g,v,k,S,P,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R)}addFeatures(c,u,g,v,k,S){for(const P of this.patternFeatures)this.addFeature(P,P.geometry,P.index,u,g,v,S,c.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=c.createVertexBuffer(this.layoutVertexArray2,Vqe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,Wqe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,$qe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,Uqe),this.indexBuffer=c.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(c,u){let g,v;if(u&&u>0?(g=`mapbox_clip_start_${u}`,v=`mapbox_clip_end_${u}`):(g="mapbox_clip_start",v="mapbox_clip_end"),c.properties&&c.properties.hasOwnProperty(g)&&c.properties.hasOwnProperty(v))return{start:+c.properties[g],end:+c.properties[v]}}addFeature(c,u,g,v,k,S,P,R){const $=this.layers[0].layout,W=$.get("line-join").evaluate(c,{}),G=$.get("line-cap").evaluate(c,{}),X=$.get("line-miter-limit"),re=$.get("line-round-limit");this.lineClips=this.lineFeatureClips(c),this.lineFeature=c;const se=!(!c.properties||!c.properties.hasOwnProperty("mapbox_line_metrics"))&&c.properties.mapbox_line_metrics;this.zOffsetValue=$.get("line-z-offset").value;const pe=this.layers[0].paint.get("line-width").value;if(pe.kind!=="constant"&&pe.isLineProgressConstant===!1&&(this.variableWidthValue=pe),this.elevationType==="road"){const Ce=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,u,v,R,W,G,X,re)){const[Se,De]=this.clipRuntimeLinesToTile(u,1);for(let Be=0;Be0?dt.parentIndex:null)}this.fillNonElevatedRoadSegment(Ce)}}else for(let Ce=0;Ce0?Ce:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,k,S,v,P,void 0,this.worldview)}computeSegNextDir(c,u){return c.nextPoint.sub(u.at(-2)).unit()}computeSegPrevDir(c,u){return u[1].sub(c.prevPoint).unit()}clipLinesToTile(c,u){return s6(c,-u,-u,Mr+u,Mr+u)}clipRuntimeLinesToTile(c,u){const g=[];return[s6(c,-u,-u,Mr+u,Mr+u,g),g]}addElevatedRoadFeature(c,u,g,v,k,S,P,R){const $=[],W=gi.getElevationFeature(c,v);if(W){const G=this.clipLinesToTile(u,1),X=this.prepareElevatedLines(G,W,g);for(const re of X)$.push({geometry:re,elevation:W,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if($.length===0)return!1;for(const G of $){const X=this.layoutVertexArray.length;this.addLine(G.geometry,c,g,k,S,P,R);const re=new Li(g,G.elevationTileID);if(G.elevation)for(let se=X;se>1,this.layoutVertexArray.int16[6*se+1]>>1),Ce=re.pointElevation(pe,G.elevation,.05);this.updateHeightRange(Ce),this.zOffsetVertexArray.emplaceBack(Ce,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(c,u,g){if(u.constantHeight!=null)return c;const v=[],k=1/Pe(g);for(const S of c)iqe(S,new ii(u,k),0,v);return v}fillNonElevatedRoadSegment(c){for(let u=c;u0,X=R&&R.progress.max<1;if(this.lineClips){let Tt={min:this.lineClips.start,max:this.lineClips.end},Kt=1;if(R){const or=this.lineClips.end-this.lineClips.start;Tt=function(lr,xr,vr){return{min:zi(lr.min,xr,vr),max:zi(lr.max,xr,vr)}}(R.progress,{min:0,max:1},Tt),or>0&&(Kt=(Tt.max-Tt.min)/or)}const Dt=+u.properties.mapbox_clip_feature_len,tr=+u.properties.mapbox_clip_seg_len;if(Number.isNaN(Dt)||Number.isNaN(tr)){for(let lr=0;lr=2&&c[se-1].equals(c[se-2]);)se--;let pe=0;for(;pe0,er=this.overscaling<=16?15*Mr/(512*this.overscaling):0;if(Kt&&Dt==="round"){if(xrS&&(Dt="bevel"),Dt==="bevel"&&(xr>2&&(Dt="flipbevel"),xr2*er){const Tr=Se.sub(Se.sub(De)._mult(er/Yt)._round());this.updateDistance(De,Tr),this.addCurrentVertex(Tr,We,0,0,Ce,St),De=Tr}this.updateDistance(De,Se),or._mult(xr),this.addCurrentVertex(Se,or,0,0,Ce,St);const mr=Se.dist(Be);if(mr>2*er){const Tr=Se.add(Be.sub(Se)._mult(er/mr)._round());this.updateDistance(Se,Tr),this.addCurrentVertex(Tr,dt,0,0,Ce,St),Se=Tr}}else or._mult(xr),this.addCurrentVertex(Se,or,0,0,Ce,St);else if(Dt==="flipbevel"){if(xr>100)or=dt.mult(-1);else{const Yt=xr*We.add(dt).mag()/We.sub(dt).mag();or._perp()._mult(Yt*(pr?-1:1))}this.addCurrentVertex(Se,or,0,0,Ce,St),this.addCurrentVertex(Se,or.mult(-1),0,0,Ce,St)}else if(Dt==="bevel"||Dt==="fakeround"){St!=null&&De&&this.addCurrentVertex(Se,gt||We,-1,-1,Ce,St);const Yt=Se.dist(De)<=2*er&&Dt!=="bevel",mr=or.mult(pr?1:-1);mr._mult(xr);const Tr=dt.mult(pr?-1:1),jr=We.mult(pr?-1:1),hn=this.evaluateLineProgressFeatures(this.distance);if(St==null&&(this.addHalfVertex(Se,mr.x,mr.y,!1,!pr,0,Ce,hn),Yt||this.addHalfVertex(Se,mr.x+2*jr.x,mr.y+2*jr.y,!1,pr,0,Ce,hn)),Dt==="fakeround"){const Ur=Math.round(180*vr/Math.PI/20);this.addHalfVertex(Se,jr.x,jr.y,!1,pr,0,Ce,hn);for(let Zr=0;Zr1){this.lineSoFar=c.w;const pe=(u.x-c.x)/G,Ce=(u.y-c.y)/G,Se=(u.z-c.z)/G,De=(u.w-c.w)/G;for(let Be=1;Be=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,W),R.primitiveLength++),S?this.e2=W:this.e1=W,$!=null&&this.zOffsetVertexArray.emplaceBack($.zOffset,$.variableWidth,$.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(c,u){this.prevDistance=this.distance,this.distance+=c.dist(u),this.updateScaledDistance()}}function loe(f,c,u){return f.xu||f.yu}let jve,kve;function Nve(f,c,u){return c*(Mr/(f.tileSize*Math.pow(2,u-f.tileID.overscaledZ)))}Qr(ooe,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Sve=(f,c,u)=>(1-u)*f+u*c;function Cve(f,c){return 1/Nve(f,1,c.tileZoom)}function Mve(f,c,u,g){return f.translatePosMatrix(g||c.tileID.projMatrix,c,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const Tve=f=>{const c=[];Ave(f)&&c.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const u=f.paint.get("line-trim-offset");u[0]===0&&u[1]===0||c.push("RENDER_LINE_TRIM_OFFSET"),f.paint.get("line-border-width").constantOr(1)!==0&&c.push("RENDER_LINE_BORDER");const g=f.layout.get("line-join").constantOr("miter")==="none",v=!!f.paint.get("line-pattern").constantOr(1);return g&&v&&c.push("LINE_JOIN_NONE"),c};function Ave(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let coe;const Eve=()=>coe||(coe={layout:jve||(jve=new $a({"line-cap":new Lr(Ft.layout_line["line-cap"]),"line-join":new Lr(Ft.layout_line["line-join"]),"line-miter-limit":new Nr(Ft.layout_line["line-miter-limit"]),"line-round-limit":new Nr(Ft.layout_line["line-round-limit"]),"line-sort-key":new Lr(Ft.layout_line["line-sort-key"]),"line-z-offset":new Lr(Ft.layout_line["line-z-offset"]),"line-elevation-reference":new Nr(Ft.layout_line["line-elevation-reference"]),"line-cross-slope":new Nr(Ft.layout_line["line-cross-slope"]),visibility:new Nr(Ft.layout_line.visibility),"line-width-unit":new Nr(Ft.layout_line["line-width-unit"])})),paint:kve||(kve=new $a({"line-opacity":new Lr(Ft.paint_line["line-opacity"]),"line-color":new Lr(Ft.paint_line["line-color"]),"line-translate":new Nr(Ft.paint_line["line-translate"]),"line-translate-anchor":new Nr(Ft.paint_line["line-translate-anchor"]),"line-width":new Lr(Ft.paint_line["line-width"]),"line-gap-width":new Lr(Ft.paint_line["line-gap-width"]),"line-offset":new Lr(Ft.paint_line["line-offset"]),"line-blur":new Lr(Ft.paint_line["line-blur"]),"line-dasharray":new Lr(Ft.paint_line["line-dasharray"]),"line-pattern":new Lr(Ft.paint_line["line-pattern"]),"line-pattern-cross-fade":new Nr(Ft.paint_line["line-pattern-cross-fade"]),"line-gradient":new nx(Ft.paint_line["line-gradient"]),"line-trim-offset":new Nr(Ft.paint_line["line-trim-offset"]),"line-trim-fade-range":new Nr(Ft.paint_line["line-trim-fade-range"]),"line-trim-color":new Nr(Ft.paint_line["line-trim-color"]),"line-emissive-strength":new Lr(Ft.paint_line["line-emissive-strength"]),"line-border-width":new Lr(Ft.paint_line["line-border-width"]),"line-border-color":new Lr(Ft.paint_line["line-border-color"]),"line-occlusion-opacity":new Nr(Ft.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"})}))},coe);class Yqe extends Lr{possiblyEvaluate(c,u){return u=new Ji(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,transition:u.transition,worldview:u.worldview}),super.possiblyEvaluate(c,u)}evaluate(c,u,g,v){return u=Object.assign({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(c,u,g,v)}}let eM;function Ive(f,c){return c>0?c+2*f:f}const Xqe=As([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Qqe=As([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Jqe=As([{name:"a_projected_pos",components:4,type:"Float32"}],4);As([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const eVe=As([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),tVe=As([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),rVe=As([{name:"a_texb",components:2,type:"Uint16"}]),nVe=As([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),sVe=As([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);As([{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 Pve=As([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),iVe=As([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);As([{name:"triangle",components:3,type:"Uint16"}]),As([{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"}]),As([{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"}]),As([{type:"Float32",name:"offsetX"}]),As([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var xl=24;function aVe(f,c,u){return f.sections.forEach(g=>{g.text=function(v,k,S){const P=k.layout.get("text-transform").evaluate(S,{});return P==="uppercase"?v=v.toLocaleUpperCase():P==="lowercase"&&(v=v.toLocaleLowerCase()),jp.applyArabicShaping&&(v=jp.applyArabicShaping(v)),v}(g.text,c,u)}),f}const tM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function oVe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function lVe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const doe=4294967296,Lve=1/doe,Ove=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let m6=class{constructor(f=new Uint8Array(16)){this.buf=ArrayBuffer.isView(f)?f:new Uint8Array(f),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(f,c,u=this.length){for(;this.pos>3,k=this.pos;this.type=7&g,f(v,c,this),this.pos===k&&this.skip(g)}return c}readMessage(f,c){return this.readFields(f,c,this.readVarint()+this.pos)}readFixed32(){const f=this.dataView.getUint32(this.pos,!0);return this.pos+=4,f}readSFixed32(){const f=this.dataView.getInt32(this.pos,!0);return this.pos+=4,f}readFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*doe;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*doe;return this.pos+=8,f}readFloat(){const f=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,f}readDouble(){const f=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,f}readVarint(f){const c=this.buf;let u,g;return g=c[this.pos++],u=127&g,g<128?u:(g=c[this.pos++],u|=(127&g)<<7,g<128?u:(g=c[this.pos++],u|=(127&g)<<14,g<128?u:(g=c[this.pos++],u|=(127&g)<<21,g<128?u:(g=c[this.pos],u|=(15&g)<<28,function(v,k,S){const P=S.buf;let R,$;if($=P[S.pos++],R=(112&$)>>4,$<128||($=P[S.pos++],R|=(127&$)<<3,$<128)||($=P[S.pos++],R|=(127&$)<<10,$<128)||($=P[S.pos++],R|=(127&$)<<17,$<128)||($=P[S.pos++],R|=(127&$)<<24,$<128)||($=P[S.pos++],R|=(1&$)<<31,$<128))return IN(v,R,k);throw new Error("Expected varint not more than 10 bytes")}(u,f,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const f=this.readVarint();return f%2==1?(f+1)/-2:f/2}readBoolean(){return!!this.readVarint()}readString(){const f=this.readVarint()+this.pos,c=this.pos;return this.pos=f,f-c>=12&&Ove?Ove.decode(this.buf.subarray(c,f)):function(u,g,v){let k="",S=g;for(;S239?4:P>223?3:P>191?2:1;if(S+X>v)break;X===1?P<128&&(G=P):X===2?(R=u[S+1],(192&R)==128&&(G=(31&P)<<6|63&R,G<=127&&(G=null))):X===3?(R=u[S+1],$=u[S+2],(192&R)==128&&(192&$)==128&&(G=(15&P)<<12|(63&R)<<6|63&$,(G<=2047||G>=55296&&G<=57343)&&(G=null))):X===4&&(R=u[S+1],$=u[S+2],W=u[S+3],(192&R)==128&&(192&$)==128&&(192&W)==128&&(G=(15&P)<<18|(63&R)<<12|(63&$)<<6|63&W,(G<=65535||G>=1114112)&&(G=null))),G===null?(G=65533,X=1):G>65535&&(G-=65536,k+=String.fromCharCode(G>>>10&1023|55296),G=56320|1023&G),k+=String.fromCharCode(G),S+=X}return k}(this.buf,c,f)}readBytes(){const f=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,f);return this.pos=f,c}readPackedVarint(f=[],c){const u=this.readPackedEnd();for(;this.pos127;);else if(c===2)this.pos=this.readVarint()+this.pos;else if(c===5)this.pos+=4;else{if(c!==1)throw new Error(`Unimplemented type: ${c}`);this.pos+=8}}writeTag(f,c){this.writeVarint(f<<3|c)}realloc(f){let c=this.length||16;for(;c268435455||f<0?function(c,u){let g,v;if(c>=0?(g=c%4294967296|0,v=c/4294967296|0):(g=~(-c%4294967296),v=~(-c/4294967296),4294967295^g?g=g+1|0:(g=0,v=v+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),function(k,S,P){P.buf[P.pos++]=127&k|128,k>>>=7,P.buf[P.pos++]=127&k|128,k>>>=7,P.buf[P.pos++]=127&k|128,k>>>=7,P.buf[P.pos++]=127&k|128,P.buf[P.pos]=127&(k>>>=7)}(g,0,u),function(k,S){const P=(7&k)<<4;S.buf[S.pos++]|=P|((k>>>=3)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k)))))}(v,u)}(f,this):(this.realloc(4),this.buf[this.pos++]=127&f|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=f>>>7&127))))}writeSVarint(f){this.writeVarint(f<0?2*-f-1:2*f)}writeBoolean(f){this.writeVarint(+f)}writeString(f){f=String(f),this.realloc(4*f.length),this.pos++;const c=this.pos;this.pos=function(g,v,k){for(let S,P,R=0;R55295&&S<57344){if(!P){S>56319||R+1===v.length?(g[k++]=239,g[k++]=191,g[k++]=189):P=S;continue}if(S<56320){g[k++]=239,g[k++]=191,g[k++]=189,P=S;continue}S=P-55296<<10|S-56320|65536,P=null}else P&&(g[k++]=239,g[k++]=191,g[k++]=189,P=null);S<128?g[k++]=S:(S<2048?g[k++]=S>>6|192:(S<65536?g[k++]=S>>12|224:(g[k++]=S>>18|240,g[k++]=S>>12&63|128),g[k++]=S>>6&63|128),g[k++]=63&S|128)}return k}(this.buf,f,this.pos);const u=this.pos-c;u>=128&&Dve(c,u,this),this.pos=c-1,this.writeVarint(u),this.pos+=u}writeFloat(f){this.realloc(4),this.dataView.setFloat32(this.pos,f,!0),this.pos+=4}writeDouble(f){this.realloc(8),this.dataView.setFloat64(this.pos,f,!0),this.pos+=8}writeBytes(f){const c=f.length;this.writeVarint(c),this.realloc(c);for(let u=0;u=128&&Dve(u,g,this),this.pos=u-1,this.writeVarint(g),this.pos+=g}writeMessage(f,c,u){this.writeTag(f,2),this.writeRawMessage(c,u)}writePackedVarint(f,c){c.length&&this.writeMessage(f,cVe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,dVe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,fVe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,uVe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,hVe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,pVe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,mVe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,gVe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,xVe,c)}writeBytesField(f,c){this.writeTag(f,2),this.writeBytes(c)}writeFixed32Field(f,c){this.writeTag(f,5),this.writeFixed32(c)}writeSFixed32Field(f,c){this.writeTag(f,5),this.writeSFixed32(c)}writeFixed64Field(f,c){this.writeTag(f,1),this.writeFixed64(c)}writeSFixed64Field(f,c){this.writeTag(f,1),this.writeSFixed64(c)}writeVarintField(f,c){this.writeTag(f,0),this.writeVarint(c)}writeSVarintField(f,c){this.writeTag(f,0),this.writeSVarint(c)}writeStringField(f,c){this.writeTag(f,2),this.writeString(c)}writeFloatField(f,c){this.writeTag(f,5),this.writeFloat(c)}writeDoubleField(f,c){this.writeTag(f,1),this.writeDouble(c)}writeBooleanField(f,c){this.writeVarintField(f,+c)}};function IN(f,c,u){return u?4294967296*c+(f>>>0):4294967296*(c>>>0)+(f>>>0)}function Dve(f,c,u){const g=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));u.realloc(g);for(let v=u.pos-1;v>=f;v--)u.buf[v+g]=u.buf[v]}function cVe(f,c){for(let u=0;u=0&&g>=c&&g6[this.text.charCodeAt(g)];g--)u--;this.text=this.text.substring(c,u),this.sectionIndex=this.sectionIndex.slice(c,u)}substring(c,u){const g=new PN;return g.text=this.text.substring(c,u),g.sectionIndex=this.sectionIndex.slice(c,u),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((c,u)=>Math.max(c,this.sections[u].scale),0)}addTextSection(c,u){this.text+=c.text,this.sections.push(rM.forText(c.scale,c.fontStack||u));const g=this.sections.length-1;for(let v=0;v=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function hoe(f,c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe=1){const Ce=PN.fromFeature(f,v,pe);G===pu.vertical&&Ce.verticalizePunctuation(X);let Se=[];const De=function(gt,St,Tt,Kt,Dt,tr){if(!gt)return[];const or=[],lr=function(pr,er,Yt,mr,Tr,jr){let hn=0;for(let Ur=0;Ur=0;let vr=0;for(let pr=0;pr0&&oi>rs&&(rs=oi)}else{const ti=Tt[yr.fontStack];if(!ti)continue;ti[Rr]&&(Jn=ti[Rr]);const ai=St[yr.fontStack];if(!ai)continue;const oi=ai.glyphs[Rr];if(!oi)continue;if(bn=oi.metrics,ms=Rr!==8203?xl:0,jr){const Si=ai.ascender!==void 0?Math.abs(ai.ascender):0,Hi=ai.descender!==void 0?Math.abs(ai.descender):0,Di=(Si+Hi)*fn;Oi-u/2;){if(S--,S<0)return!1;P-=f[S].dist(k),k=f[S]}P+=f[S].dist(f[S+1]),S++;const R=[];let $=0;for(;Pg;)$-=R.shift().angleDelta;if($>v)return!1;S++,P+=W.dist(G)}return!0}function Gve(f){let c=0;for(let u=0;u$){const se=($-R)/re,pe=Fn(G.x,X.x,se),Ce=Fn(G.y,X.y,se),Se=new ux(pe,Ce,0,X.angleTo(G),W);return!S||Wve(f,Se,P,S,c)?Se:void 0}R+=re}}function kVe(f,c,u,g,v,k,S,P,R){const $=Kve(g,k,S),W=Zve(g,v),G=W*S,X=f[0].x===0||f[0].x===R||f[0].y===0||f[0].y===R;return c-G=0&&We=0&&dt=0&&X+$<=W){const it=new ux(We,dt,0,De,se);g&&!Wve(f,it,k,g,v)||re.push(it)}}G+=Se}return P||re.length||S||(re=Yve(f,G/2,u,g,v,k,S,!0,R)),re}function Xve(f){let c=0,u=0;for(const S of f)c+=S.w*S.h,u=Math.max(u,S.w);f.sort((S,P)=>P.h-S.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),u),h:1/0}];let v=0,k=0;for(const S of f)for(let P=g.length-1;P>=0;P--){const R=g[P];if(!(S.w>R.w||S.h>R.h)){if(S.x=R.x,S.y=R.y,k=Math.max(k,S.y+S.h),v=Math.max(v,S.x+S.w),S.w===R.w&&S.h===R.h){const $=g.pop();$&&P1?se-1:se,vc.copy(G.data,$,{x:0,y:0},{x:pe,y:Ce},G.data,g),vc.copy(G.data,$,{x:0,y:De-se},{x:pe,y:Ce-se},{width:Se,height:se},g),vc.copy(G.data,$,{x:0,y:0},{x:pe,y:Ce+De},{width:Se,height:se},g),vc.copy(G.data,$,{x:Se-se,y:0},{x:pe-se,y:Ce},{width:se,height:De},g),vc.copy(G.data,$,{x:0,y:0},{x:pe+Se,y:Ce},{width:se,height:De},g),vc.copy(G.data,$,{x:Se-se,y:De-se},{x:pe-se,y:Ce-se},{width:se,height:se},g),vc.copy(G.data,$,{x:0,y:De-se},{x:pe+Se,y:Ce-se},{width:se,height:se},g),vc.copy(G.data,$,{x:0,y:0},{x:pe+Se,y:Ce+De},{width:se,height:se},g),vc.copy(G.data,$,{x:Se-se,y:0},{x:pe-se,y:Ce+De},{width:se,height:se},g)}this.lut=g,this.image=$,this.iconPositions=v,this.patternPositions=k}addImages(c,u,g,v){for(const[k,S]of c.entries()){const{bin:P,imagePosition:R,imageVariant:$}=xoe(k,S,g);u.set(k,R),v.push(P),S.hasRenderCallback&&this.haveRenderCallbacks.push($.id)}}patchUpdatedImages(c,u,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(v=>c.hasImage(v,g)),c.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const v of c.getUpdatedImages(g)){for(const k of this.iconPositions.keys()){const S=gp.parse(k);if(Ic.isEqual(S.id,v)){const P=c.getImage(v,g);this.patchUpdatedImage(this.iconPositions.get(k),P,u,null)}}for(const k of this.patternPositions.keys()){const S=gp.parse(k);if(Ic.isEqual(S.id,v)){const P=c.getImage(v,g);this.patchUpdatedImage(this.patternPositions.get(k),P,u,this.lut)}}}}patchUpdatedImage(c,u,g,v=null){if(!c||!u||c.version===u.version)return;c.version=u.version;const[k,S]=c.tl,P=c.sdf;if(this.lut||P){const R={width:u.data.width,height:u.data.height},$=new vc(R);vc.copy(u.data,$,{x:0,y:0},{x:0,y:0},R,v,P),g.update($,{position:{x:k,y:S}})}else g.update(u.data,{position:{x:k,y:S}})}}Qr(nM,"ImagePosition"),Qr(Qve,"ImageAtlas");const sM=1e20;function Jve(f,c,u,g,v,k,S,P,R){for(let $=c;$-1);R++,k[R]=P,S[R]=$,S[R+1]=sM}for(let P=0,R=0;P{let R=this.entries[k];R||(R=this.entries[k]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let $=R.glyphs[S];if($!==void 0)return void P(null,{stack:k,id:S,glyph:$});if($=this._tinySDF(R,k,S),$)return R.glyphs[S]=$,void P(null,{stack:k,id:S,glyph:$});const W=Math.floor(S/256);if(256*W>65535)return Vr("glyphs > 65535 not supported"),void P(null,{stack:k,id:S,glyph:$});if(R.ranges[W])return void P(null,{stack:k,id:S,glyph:$});let G=R.requests[W];G||(G=R.requests[W]=[],DN.loadGlyphRange(k,W,v,this.requestManager,(X,re)=>{if(re){R.ascender=re.ascender,R.descender=re.descender;for(const se in re.glyphs)this._doesCharSupportLocalGlyph(+se)||(R.glyphs[+se]=re.glyphs[+se]);R.ranges[W]=!0}for(const se of G)se(X,re);delete R.requests[W]})),G.push((X,re)=>{X?P(X):re&&P(null,{stack:k,id:S,glyph:re.glyphs[S]||null})})},(k,S)=>{if(k)u(k);else if(S){const P={};for(const{stack:R,id:$,glyph:W}of S)P[R]===void 0&&(P[R]={}),P[R].glyphs===void 0&&(P[R].glyphs={}),P[R].glyphs[$]=W&&{id:W.id,bitmap:W.bitmap.clone(),metrics:W.metrics},P[R].ascender=this.entries[R].ascender,P[R].descender=this.entries[R].descender;u(null,P)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==yoe.none&&(this.localGlyphMode===yoe.all?!!this.localFontFamily:!!this.localFontFamily&&(Tn["CJK Unified Ideographs"](c)||Tn["Hangul Syllables"](c)||Tn.Hiragana(c)||Tn.Katakana(c)||Tn["CJK Symbols and Punctuation"](c)||Tn["CJK Unified Ideographs Extension A"](c)||Tn["CJK Unified Ideographs Extension B"](c)||Tn.Osage(c)))}_tinySDF(c,u,g){const v=this.localFontFamily;if(!v||!this._doesCharSupportLocalGlyph(g))return;let k=c.tinySDF;if(!k){let pe="400";/bold/i.test(u)?pe="900":/medium/i.test(u)?pe="500":/light/i.test(u)&&(pe="200"),k=c.tinySDF=new DN.TinySDF({fontFamily:v,fontWeight:pe,fontSize:24*Lp,buffer:3*Lp,radius:8*Lp}),k.fontWeight=pe}if(this.localGlyphs[k.fontWeight][g])return this.localGlyphs[k.fontWeight][g];const S=String.fromCodePoint(g),{data:P,width:R,height:$,glyphWidth:W,glyphHeight:G,glyphLeft:X,glyphTop:re,glyphAdvance:se}=k.draw(S);return this.localGlyphs[k.fontWeight][g]={id:g,bitmap:new Yy({width:R,height:$},P),metrics:{width:W/Lp,height:G/Lp,left:X/Lp,top:re/Lp-27,advance:se/Lp,localGlyph:!0}}}}DN.loadGlyphRange=function(f,c,u,g,v){const k=256*c,S=k+255,P=g.transformRequest(g.normalizeGlyphsURL(u).replace("{fontstack}",f).replace("{range}",`${k}-${S}`),Hg.Glyphs);Gu(P,(R,$)=>{if(R)v(R);else if($){const W={},G=function(X){return new m6(X).readFields(yVe,{})}($);for(const X of G.glyphs)W[X.id]=X;v(null,{glyphs:W,ascender:G.ascender,descender:G.descender})}})},DN.TinySDF=class{constructor({fontSize:f=24,buffer:c=3,radius:u=8,cutoff:g=.25,fontFamily:v="sans-serif",fontWeight:k="normal",fontStyle:S="normal",lang:P=null}={}){this.buffer=c,this.cutoff=g,this.radius=u,this.lang=P;const R=this.size=f+4*c,$=this._createCanvas(R),W=this.ctx=$.getContext("2d",{willReadFrequently:!0});W.font=`${S} ${k} ${f}px ${v}`,W.textBaseline="alphabetic",W.textAlign="left",W.fillStyle="black",this.gridOuter=new Float64Array(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Uint16Array(R)}_createCanvas(f){const c=document.createElement("canvas");return c.width=c.height=f,c}draw(f){const{width:c,actualBoundingBoxAscent:u,actualBoundingBoxDescent:g,actualBoundingBoxLeft:v,actualBoundingBoxRight:k}=this.ctx.measureText(f),S=Math.ceil(u),P=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(k-v))),R=Math.min(this.size-this.buffer,S+Math.ceil(g)),$=P+2*this.buffer,W=R+2*this.buffer,G=Math.max($*W,0),X=new Uint8ClampedArray(G),re={data:X,width:$,height:W,glyphWidth:P,glyphHeight:R,glyphTop:S,glyphLeft:0,glyphAdvance:c};if(P===0||R===0)return re;const{ctx:se,buffer:pe,gridInner:Ce,gridOuter:Se}=this;this.lang&&(se.lang=this.lang),se.clearRect(pe,pe,P,R),se.fillText(f,pe,pe+S);const De=se.getImageData(pe,pe,P,R);Se.fill(sM,0,G),Ce.fill(0,0,G);for(let Be=0;Be0?gt*gt:0,Ce[it]=gt<0?gt*gt:0}}Jve(Se,0,0,$,W,$,this.f,this.v,this.z),Jve(Ce,pe,pe,P,R,$,this.f,this.v,this.z);for(let Be=0;Be{const xr=v6(Dt.stretch-De,Be,W,f.left*v),vr=_6(Dt.fixed-it,gt,Dt.stretch,se),hr=v6(tr.stretch-We,dt,G,f.top*v),pr=_6(tr.fixed-St,Tt,tr.stretch,pe),er=v6(or.stretch-De,Be,W,f.left*v),Yt=_6(or.fixed-it,gt,or.stretch,se),mr=v6(lr.stretch-We,dt,G,f.top*v),Tr=_6(lr.fixed-St,Tt,lr.stretch,pe),jr=new ir(xr,hr),hn=new ir(er,hr),Ur=new ir(er,mr),Zr=new ir(xr,mr),rn=new ir(vr/P,pr/P),gs=new ir(Yt/P,Tr/P),kr=c*Math.PI/180;if(kr){const Oi=Math.sin(kr),ot=Math.cos(kr),ut=[ot,-Oi,Oi,ot];jr._matMult(ut),hn._matMult(ut),Zr._matMult(ut),Ur._matMult(ut)}const sn=Dt.stretch+Dt.fixed,qn=or.stretch+or.fixed,Os=tr.stretch+tr.fixed,qs=lr.stretch+lr.fixed,rs=f.imageSecondary;return{tl:jr,tr:hn,bl:Zr,br:Ur,texPrimary:{x:S.paddedRect.x+Ym+sn,y:S.paddedRect.y+Ym+Os,w:qn-sn,h:qs-Os},texSecondary:rs?{x:rs.paddedRect.x+Ym+sn,y:rs.paddedRect.y+Ym+Os,w:qn-sn,h:qs-Os}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:rn,pixelOffsetBR:gs,minFontScaleX:gt/P/W,minFontScaleY:Tt/P/G,isSDF:u}};if(g&&(S.stretchX||S.stretchY)){const Dt=r_e(X,Ce,se),tr=r_e(re,Se,pe);for(let or=0;ork)&&(k=se.x),(!re||se.y>S)&&(S=se.y)}const R=Math.min(k-g,S-v);let $=R/2;const W=new Sk([],MVe);if(R===0)return new ir(g,v);for(let re=g;reG.d||!G.d)&&(G=re,u&&console.log("found best %d after %d probes",Math.round(1e4*re.d)/1e4,X)),re.max-G.d<=c||($=re.h/2,W.push(new RN(re.p.x-$,re.p.y-$,$,f)),W.push(new RN(re.p.x+$,re.p.y-$,$,f)),W.push(new RN(re.p.x-$,re.p.y+$,$,f)),W.push(new RN(re.p.x+$,re.p.y+$,$,f)),X+=4)}return u&&(console.log(`num probes: ${X}`),console.log(`best distance: ${G.d}`)),G.p}function MVe(f,c){return c.max-f.max}class RN{constructor(c,u,g,v){this.p=new ir(c,u),this.h=g,this.d=function(k,S){let P=!1,R=1/0;for(let $=0;$k.y!=pe.y>k.y&&k.x<(pe.x-se.x)*(k.y-se.y)/(pe.y-se.y)+se.x&&(P=!P),R=Math.min(R,eo(k,se,pe))}}return(P?1:-1)*Math.sqrt(R)}(this.p,v),this.max=this.d+this.h*Math.SQRT2}}const TVe=Object.keys,_oe=Number.POSITIVE_INFINITY,AVe=Math.sqrt(2);function Qy(f,c,u,g,v){const k=poe(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],S={top:f.top-k[1],bottom:f.bottom+k[3],left:f.left-k[0],right:f.right+k[2],scaled:!1};return g!==void 0&&function(P,R){P.top*=R,P.bottom*=R,P.left*=R,P.right*=R,P.scaled=!0}(S,g),u&&function(P,R){if(!R)return;const $=ss(R),W=new ir(P.left,P.top),G=new ir(P.right,P.top),X=new ir(P.left,P.bottom),re=new ir(P.right,P.bottom),se=new ir(0,0);W._rotateAround($,se),G._rotateAround($,se),X._rotateAround($,se),re._rotateAround($,se),P.left=Math.min(W.x,G.x,X.x,re.x),P.right=Math.max(W.x,G.x,X.x,re.x),P.top=Math.min(W.y,G.y,X.y,re.y),P.bottom=Math.max(W.y,G.y,X.y,re.y)}(S,u),v&&(S.left+=v[0],S.right+=v[0],S.top+=v[1],S.bottom+=v[1]),c?{top:Math.min(c.top,S.top),bottom:Math.max(c.bottom,S.bottom),left:Math.min(c.left,S.left),right:Math.max(c.right,S.right),scaled:c.scaled||S.scaled}:S}function s_e(f,[c,u]){let g=0,v=0;if(u===_oe){c<0&&(c=0);const k=c/AVe;switch(f){case"top-right":case"top-left":v=k-7;break;case"bottom-right":case"bottom-left":v=7-k;break;case"bottom":v=7-c;break;case"top":v=c-7}switch(f){case"top-right":case"bottom-right":g=-k;break;case"top-left":case"bottom-left":g=k;break;case"left":g=c;break;case"right":g=-c}}else{switch(c=Math.abs(c),u=Math.abs(u),f){case"top-right":case"top-left":case"top":v=u-7;break;case"bottom-right":case"bottom-left":case"bottom":v=7-u}switch(f){case"top-right":case"bottom-right":case"right":g=-c;break;case"top-left":case"bottom-left":case"left":g=c}}return[g,v]}function EVe(f,c,u,g,v,k,S,P,R,$,W,G,X,re){const se=f.layers[0],pe=se.appearances;if(pe.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Ce={iconBBox:null,iconVerticalBBox:null},Se={textBBox:null,textVerticalBBox:null},{baseIconRotate:De,baseTextRotate:Be,iconScaleFactor:We}=function(it,gt,St){const Tt=it.get("icon-rotate").evaluate(gt,{},St),Kt=it.get("text-rotate").evaluate(gt,{},St),[Dt,tr]=it.get("icon-size-scale-range");return{baseIconRotate:Tt,baseTextRotate:Kt,iconScaleFactor:je(1,Dt,tr)}}(g,v,k);c&&(Ce.iconBBox=Qy(c,Ce.iconBBox,De,S),u)&&(Ce.iconVerticalBBox=Qy(u,Ce.iconVerticalBBox,De+90,S));const dt=w6(G.horizontal);dt&&(Se.textBBox=Qy(dt,Se.textBBox,Be,1,re)),G.vertical&&(Se.textVerticalBBox=Qy(G.vertical,Se.textVerticalBBox,Be+90,1,re));for(const it of pe)it.hasIconProperties()&&IVe(Ce,f,se,it,v,k,P,De,S,R,c,$,We,W),it.hasTextProperties()&&PVe(Se,se,it,v,k,re,Be,X,dt,G.vertical);return{iconBBox:Ce.iconBBox,iconVerticalBBox:Ce.iconVerticalBBox,textBBox:Se.textBBox,textVerticalBBox:Se.textVerticalBBox}}function IVe(f,c,u,g,v,k,S,P,R,$,W,G,X,re){const{appearanceIconOffset:se,appearanceIconRotate:pe,appearanceIconSize:Ce}=function(We,dt,it,gt,St,Tt,Kt,Dt){const tr=We.hasProperty("icon-offset")?dt.getAppearanceValueAndResolveTokens(We,"icon-offset",it,gt,[]):null,or=tr&&Array.isArray(tr)?tr:St,lr=We.hasProperty("icon-rotate")?dt.getAppearanceValueAndResolveTokens(We,"icon-rotate",it,gt,[]):null,xr=typeof lr=="number"?lr:Tt,vr=We.hasProperty("icon-size")?dt.getAppearanceValueAndResolveTokens(We,"icon-size",it,gt,[]):null;return{appearanceIconOffset:or,appearanceIconRotate:xr,appearanceIconSize:typeof vr=="number"?vr*Dt.iconScaleFactor:Kt}}(g,u,v,k,S,P,R,$);let Se=null,De=null,Be=null;g.hasProperty("icon-image")?Be=function(We,dt,it,gt,St,Tt,Kt){let Dt=null;const tr=dt.getAppearanceValueAndResolveTokens(it,"icon-image",gt,St,[]);if(tr){const or=We.getResolvedImageFromTokens(tr),lr=it.getUnevaluatedProperty("icon-size"),xr=iM(or,LN(We.zoom,lr,We.worldview),lr,St,We.zoom,gt,We.pixelRatio,Kt,We.worldview);Dt=Tt.get(xr.iconPrimary.toString())}return Dt}(c,u,g,v,k,G,X):W&&(Be=W.imagePrimary),Be&&(Se=x6(Be,null,se,re),c.allowVerticalPlacement&&(De=x6(Be,null,se,re))),Se&&(f.iconBBox=Qy(Se,f.iconBBox,pe,Ce)),De&&(f.iconVerticalBBox=Qy(De,f.iconVerticalBBox,pe+90,Ce))}function PVe(f,c,u,g,v,k,S,P,R,$){const{appearanceTextOffset:W,appearanceTextRotate:G,appearanceTextSize:X}=function(se,pe,Ce,Se,De,Be,We){const dt=se.hasProperty("text-offset")?pe.getAppearanceValueAndResolveTokens(se,"text-offset",Ce,Se,[]):null,it=dt&&Array.isArray(dt)?[dt[0]*xl,dt[1]*xl]:De,gt=se.hasProperty("text-rotate")?pe.getAppearanceValueAndResolveTokens(se,"text-rotate",Ce,Se,[]):null,St=typeof gt=="number"?gt:Be,Tt=se.hasProperty("text-size")?pe.getAppearanceValueAndResolveTokens(se,"text-size",Ce,Se,[]):null;return{appearanceTextOffset:it,appearanceTextRotate:St,appearanceTextSize:typeof Tt=="number"?Tt:We}}(u,c,g,v,k,S,P),re=X/P;R&&(f.textBBox=Qy(R,f.textBBox,G,re,W)),$&&(f.textVerticalBBox=Qy($,f.textVerticalBBox,G+90,re,W))}function b6(f,c,u,g,v,k,S,P,R){if(!c||!c.usvg)return;const $=Hve(g),W=Hve(v),G=k!=="both"&&k!=="width"||!qve(g)?1:W.width/$.width,X=k!=="both"&&k!=="height"||!Vve(g)?1:W.height/$.height;u.scaleSelf(G,X);const re=u.toString();S.set(re,u),P.set(re,c);const{imagePosition:se}=xoe(re,c,t_);R.set(re,se)}function i_e(f,c,u,g,v,k,S,P,R){if(!f)return;const $=function(W,G,X,re,se,pe){if(W.kind==="camera")return W.maxSize;if(W.kind==="composite"){const Ce=G.possiblyEvaluate(new Ji(W.maxZoom,{worldview:pe}),X).evaluate(se,{},X),Se=G.possiblyEvaluate(new Ji(W.minZoom,{worldview:pe}),X).evaluate(se,{},X);return Math.max(Ce,Se)}return G.possiblyEvaluate(new Ji(re,{worldview:pe})).evaluate(se,{},X)}(c,u,g,v,k,R);return f.scaleSelf($*P*S)}function iM(f,c,u,g,v,k,S,P,R){return{iconPrimary:i_e(f.getPrimary(),c,u,g,v,k,S,P,R),iconSecondary:i_e(f.getSecondary(),c,u,g,v,k,S,P,R)}}function LVe(f,c,u){if(!c)return;const g=u.get(f.toString()),v=u.get(c.toString());g&&v&&(g.paddedRect.w===v.paddedRect.w&&g.paddedRect.h===v.paddedRect.h||Vr(`Mismatch in icon variant sizes: ${f.toString()} and ${c.toString()}`),g.usvg!==v.usvg&&Vr(`Mismatch in icon variant image types: ${f.id} and ${c.id}`))}function a_e(f,c,u,g){if(!f)return;const v=c.get(u.toString());if(f.imagePrimary=v,g){const k=c.get(g.toString());f.imageSecondary=k}}function OVe(f,c){for(const u in f.horizontal)o_e(f.horizontal[u],c);o_e(f.vertical,c)}function o_e(f,c){if(f){for(const u of f.positionedLines)for(const g of u.positionedGlyphs)if(g.image!==null){const v=g.image.toString();g.rect=c.get(v).paddedRect}}}function boe(f){switch(f){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function DVe(f,c,u,g,v,k,S,P,R){const $=w6(k.horizontal)||k.vertical,W=u.get("icon-text-fit-padding").evaluate(g,{},v);let G,X=c;return c&&R!=="none"&&(f.allowVerticalPlacement&&k.vertical&&(G=moe(c,k.vertical,R,W,P,S)),$&&(X=moe(c,$,R,W,P,S))),{defaultShapedIcon:X,verticallyShapedIcon:G}}function RVe(f,c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De,Be,We,dt,it,gt){let St=S.textMaxSize.evaluate(c,{},X);St===void 0?St=P*S.textScaleFactor:St*=S.textScaleFactor;const Tt=f.layers[0].layout,Kt=xl,Dt=P*S.textScaleFactor/Kt,tr=w6(u.horizontal)||u.vertical;if(Ce!=="none"&&f.appearanceFeatureData&&c.index18&&mr>2&&(mr>>=1),Math.max(Mr/(512*mr),1)*Tt.get("symbol-spacing")),vr=Tt.get("text-padding")*f.tilePixelRatio,hr=Tt.get("icon-padding")*f.tilePixelRatio,pr=ss(Tt.get("text-max-angle")),er=Tt.get("icon-rotation-alignment")==="map"&&Be!=="point",Yt=xr/2;var mr;f.hasAnyIconTextFit===!1&&Ce!=="none"&&(f.hasAnyIconTextFit=!0);const Tr=c.properties?+c.properties[Xt]:null,jr=Tr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Tr):65535,hn=(Ur,Zr,rn)=>{if(Zr.x<0||Zr.x>=Mr||Zr.y<0||Zr.y>=Mr)return;let gs=null;if(or){const{x:kr,y:sn,z:qn}=re.projectTilePoint(Zr.x,Zr.y,rn);gs={anchor:new ux(kr,sn,qn,0,void 0),up:re.upVector(rn,Zr.x,Zr.y)}}(function(kr,sn,qn,Os,qs,rs,Oi,ot,ut,nr,yr,Dr,Rr,fn,bn,Jn,cs,ms,Es,Ln,Un,ti,ai,oi,Si,Hi,Di,hi,yi,ds,Us,ka,In){const Is=kr.addToLineVertexArray(sn,Os);let Bi,Yi,ea,lo,Xi,Pn,Pa,Ci=0,ya=0,Vo=0,yl=0,Ao=-1,Eo=-1;const ol={};let Sd=pk("");const Qi=qn?qn.anchor:sn,to=hi!=="none";let co=0,qd=0;if(ut._unevaluatedLayout.getValue("text-radial-offset")===void 0){const tc=ut.layout.get("text-offset").evaluate(Un,{},Si);co=tc[0]*xl,qd=tc[1]*xl}else co=ut.layout.get("text-radial-offset").evaluate(Un,{},Si)*xl,qd=_oe;if(kr.allowVerticalPlacement&&qs.vertical){const tc=qs.vertical;if(bn)Pn=woe(tc),ot&&(Pa=woe(ot));else{const nd=ut.layout.get("text-rotate").evaluate(Un,{},Si)+90;ea=j6(nr,Qi,sn,yr,Dr,Rr,tc,fn,nd,Jn,ka),ot&&(lo=j6(nr,Qi,sn,yr,Dr,Rr,ot,ms,nd,null,Us))}}if(rs){const tc=kr.iconSizeData,nd=ut.layout.get("icon-rotate").evaluate(Un,{},Si),mu=voe(rs,nd,ai,to,ti.iconScaleFactor),t0=ot?voe(ot,nd,ai,to,ti.iconScaleFactor):void 0;Yi=j6(nr,Qi,sn,yr,Dr,Rr,rs,ms,nd,null,ds);const VN=function(Fp,jM,S2e,ZHe,C2e,M2e,YHe,XHe){const T2e=Fp.layers[0],A2e=T2e.appearances;let HN=jM.length;if(S2e&&(HN=Math.max(HN,S2e.length)),A2e.length===0)return HN;const[QHe,JHe]=ZHe.get("icon-size-scale-range"),eWe=je(1,QHe,JHe);for(const E2e of A2e){const I2e=E2e.getUnevaluatedProperties();if(I2e._values["icon-image"].value!==void 0){const P2e=T2e.getAppearanceValueAndResolveTokens(E2e,"icon-image",C2e,M2e,[]);if(P2e){const L2e=Fp.getResolvedImageFromTokens(P2e);if(L2e){const O2e=I2e._values["icon-size"],tWe=iM(L2e,LN(Fp.zoom,O2e,Fp.worldview),O2e,M2e,Fp.zoom,C2e,Fp.pixelRatio,eWe,Fp.worldview),rWe=YHe.get(tWe.iconPrimary.toString());HN=Math.max(HN,NVe(rWe,XHe))}}}}return HN}(kr,mu,t0,ut.layout,Un,Si,kr.iconAtlasPositions,to);Ci=4*VN;let Rp=null;tc.kind==="source"?(Rp=[Pp*ut.layout.get("icon-size").evaluate(Un,{},Si)*ti.iconScaleFactor],Rp[0]>hx&&Vr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${aM}. Reduce your "icon-size".`)):tc.kind==="composite"&&(Rp=[Pp*ti.compositeIconSizes[0].evaluate(Un,{},Si)*ti.iconScaleFactor,Pp*ti.compositeIconSizes[1].evaluate(Un,{},Si)*ti.iconScaleFactor],(Rp[0]>hx||Rp[1]>hx)&&Vr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${aM}. Reduce your "icon-size".`)),kr.addSymbols(kr.icon,mu,Rp,Ln,Es,Un,void 0,qn,sn,Is.lineStartIndex,Is.lineLength,-1,oi,Si,Hi,Di,kr.symbolInstances.length,VN),Ao=kr.icon.placedSymbolArray.length-1,t0&&(ya=4*VN,kr.addSymbols(kr.icon,t0,Rp,Ln,Es,Un,pu.vertical,qn,sn,Is.lineStartIndex,Is.lineLength,-1,oi,Si,Hi,Di,kr.symbolInstances.length,VN),Eo=kr.icon.placedSymbolArray.length-1)}for(const tc in qs.horizontal){const nd=tc,mu=qs.horizontal[nd];Bi||(Sd=pk(mu.text),bn?Xi=woe(mu):Bi=j6(nr,Qi,sn,yr,Dr,Rr,mu,fn,ut.layout.get("text-rotate").evaluate(Un,{},Si),Jn,ka));const t0=mu.positionedLines.length===1;if(Vo+=l_e(kr,qn,sn,mu,Oi,ut,bn,Un,Jn,Is,qs.vertical?pu.horizontal:pu.horizontalOnly,t0?TVe(qs.horizontal):[nd],ol,Ao,ti,oi,Si,kr.symbolInstances.length,Hi),t0)break}qs.vertical&&(yl+=l_e(kr,qn,sn,qs.vertical,Oi,ut,bn,Un,Jn,Is,pu.vertical,["vertical"],ol,Eo,ti,oi,Si,kr.symbolInstances.length,Hi));let Ho=-1;const kf=(tc,nd)=>tc?Math.max(tc,nd):nd;Ho=kf(Xi,Ho),Ho=kf(Pn,Ho),Ho=kf(Pa,Ho);const Xm=Ho>-1?1:0;kr.glyphOffsetArray.length>=65535&&Vr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Un.sortKey!==void 0&&kr.addToSortKeyRanges(kr.symbolInstances.length,Un.sortKey),kr.symbolInstances.emplaceBack(sn.x,sn.y,Qi.x,Qi.y,Qi.z,ol.right>=0?ol.right:-1,ol.center>=0?ol.center:-1,ol.left>=0?ol.left:-1,ol.vertical>=0?ol.vertical:-1,Ao,Eo,Sd,Bi!==void 0?Bi:kr.collisionBoxArray.length,Bi!==void 0?Bi+1:kr.collisionBoxArray.length,ea!==void 0?ea:kr.collisionBoxArray.length,ea!==void 0?ea+1:kr.collisionBoxArray.length,Yi!==void 0?Yi:kr.collisionBoxArray.length,Yi!==void 0?Yi+1:kr.collisionBoxArray.length,lo||kr.collisionBoxArray.length,lo?lo+1:kr.collisionBoxArray.length,yr,Vo,yl,Ci,ya,Xm,0,co,qd,Ho,0,to?1:0,yi)})(f,Zr,gs,Ur,u,g,k,v,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,vr,De,$,0,hr,er,Se,c,S,W,G,X,se,pe,Ce,jr,We,dt,it)};if(Be==="line")for(const Ur of s6(c.geometry,0,0,Mr,Mr)){const Zr=kVe(Ur,xr,pr,u.vertical||tr,g,Kt,lr,f.overscaling,Mr);for(const rn of Zr)tr&&FVe(f,tr.text,Yt,rn)||hn(Ur,rn,X)}else if(Be==="line-center"){for(const Ur of c.geometry)if(Ur.length>1){const Zr=jVe(Ur,pr,u.vertical||tr,g,Kt,lr);Zr&&hn(Ur,Zr,X)}}else if(c.type==="Polygon")for(const Ur of U5(c.geometry,0)){const Zr=CVe(Ur,16);hn(Ur[0],new ux(Zr.x,Zr.y,0,0,void 0),X)}else if(c.type==="LineString")for(const Ur of c.geometry)hn(Ur,new ux(Ur[0].x,Ur[0].y,0,0,void 0),X);else if(c.type==="Point")for(const Ur of c.geometry)for(const Zr of Ur)hn([Zr],new ux(Zr.x,Zr.y,0,0,void 0),X)}const aM=255,hx=aM*Pp;function l_e(f,c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De){const Be=function(it,gt,St,Tt,Kt,Dt,tr,or){const lr=[];if(gt.positionedLines.length===0)return lr;const xr=Tt.layout.get("text-rotate").evaluate(Dt,{})*Math.PI/180,vr=function(mr){const Tr=mr[0],jr=mr[1],hn=Tr*jr;return hn>0?[Tr,-jr]:hn<0?[-Tr,jr]:Tr===0?[jr,Tr]:[jr,-Tr]}(St);let hr=Math.abs(gt.top-gt.bottom);for(const mr of gt.positionedLines)hr-=mr.lineOffset;const pr=gt.positionedLines.length,er=hr/pr;let Yt=gt.top-St[1];for(let mr=0;mrhx&&Vr(`${f.layerIds[0]}: Value for "text-size" is >= ${aM}. Reduce your "text-size".`)):We.kind==="composite"&&(dt=[Pp*se.compositeTextSizes[0].evaluate(P,{},Ce)*se.textScaleFactor,Pp*se.compositeTextSizes[1].evaluate(P,{},Ce)*se.textScaleFactor],(dt[0]>hx||dt[1]>hx)&&Vr(`${f.layerIds[0]}: Value for "text-size" is >= ${aM}. Reduce your "text-size".`)),f.addSymbols(f.text,Be,dt,R,S,P,W,c,u,$.lineStartIndex,$.lineLength,re,pe,Ce,De,!1,Se,Be.length);for(const it of G)X[it]=f.text.placedSymbolArray.length-1;return 4*Be.length}function w6(f){for(const c in f)return f[c];return null}function j6(f,c,u,g,v,k,S,P,R,$,W){let G,X,re,se;if(G=W?W.top:S.top,X=W?W.bottom:S.bottom,re=W?W.left:S.left,se=W?W.right:S.right,poe(S)&&S.collisionPadding){const pe=S.collisionPadding;re-=pe[0],G-=pe[1],se+=pe[2],X+=pe[3]}if(R){const pe=new ir(re,G),Ce=new ir(se,G),Se=new ir(re,X),De=new ir(se,X),Be=ss(R);let We=new ir(0,0);$&&(We=new ir($[0],$[1])),pe._rotateAround(Be,We),Ce._rotateAround(Be,We),Se._rotateAround(Be,We),De._rotateAround(Be,We),re=Math.min(pe.x,Ce.x,Se.x,De.x),se=Math.max(pe.x,Ce.x,Se.x,De.x),G=Math.min(pe.y,Ce.y,Se.y,De.y),X=Math.max(pe.y,Ce.y,Se.y,De.y)}return f.emplaceBack(c.x,c.y,c.z,u.x,u.y,re,G,se,X,P,g,v,k),f.length-1}function woe(f){poe(f)&&f.collisionPadding&&(f.top-=f.collisionPadding[1],f.bottom+=f.collisionPadding[3]);const c=f.bottom-f.top;return c>0?Math.max(10,c):null}function FVe(f,c,u,g){const v=f.compareText;if(c in v){const k=v[c];for(let S=k.length-1;S>=0;S--)if(g.dist(k[S])Be&&(We(it,lr,St,Tt,tr,or),We(lr,gt,tr,or,Kt,Dt))}We(G,X,g,k,v,k),We(X,re,v,k,v,S),We(re,se,v,S,g,S),We(se,G,g,S,g,k),pe-=Be,Ce-=Be,Se+=Be,De+=Be;const dt=1/Math.max(Se-pe,De-Ce);return{scale:dt,x:pe*dt,y:Ce*dt,x2:Se*dt,y2:De*dt,projection:c}}function d_e(f,{x:c,y:u},g=0){return new ir(((c-g)*f.scale-f.x)*Mr,(u*f.scale-f.y)*Mr)}const zVe=A(new Float32Array(16));class Jy{constructor(c){this.spec=c,this.name=c.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(c,u){return{x:0,y:0,z:0}}unproject(c,u){return new m(0,0)}projectTilePoint(c,u,g){return{x:c,y:u,z:0}}locationPoint(c,u,g,v=!0){return c._coordinatePoint(c.locationCoordinate(u,g),v)}pixelsPerMeter(c,u){return Y(1,c)*u}pixelSpaceConversion(c,u,g){return 1}farthestPixelDistance(c){return c_e(c,c.pixelsPerMeter)}pointCoordinate(c,u,g,v){const k=c.horizonLineFromTop(!1),S=new ir(u,Math.max(k,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(S,v))}pointCoordinate3D(c,u,g){const v=new ir(u,g);if(c.elevation)return c.elevation.pointCoordinate(v);{const k=this.pointCoordinate(c,v.x,v.y,0);return[k.x,k.y,k.z]}}isPointAboveHorizon(c,u){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,u.x,u.y);const g=c.horizonLineFromTop();return u.y0?u<-FN+g&&(u=-FN+g):u>FN-g&&(u=FN-g);const S=k/Math.pow(N6(u),v);let P=S*Math.sin(v*c),R=k-S*Math.cos(v*c);return P=.5*(P/Math.PI+.5),R=.5*(R/Math.PI+.5),{x:P,y:this.southernCenter?R:1-R,z:0}}unproject(c,u){c=(2*c-.5)*Math.PI,this.southernCenter&&(u=1-u),u=(2*(1-u)-.5)*Math.PI;const{n:g,f:v}=this,k=v-u,S=Math.sign(k),P=Math.sign(g)*Math.sqrt(c*c+k*k);let R=Math.atan2(c,Math.abs(k))*S;k*g<0&&(R-=Math.PI*Math.sign(c)*S);const $=je(vo(R/g)+this.center[0],-180,180),W=je(vo(2*Math.atan(Math.pow(v/P,1/g))-FN),-ue,ue);return new m($,this.southernCenter?-W:W)}}class u_e extends Jy{constructor(c){super(c),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(c,u){return{x:B(c),y:V(u),z:0}}unproject(c,u){const g=Q(c),v=ce(u);return new m(g,v)}}const h_e=ss(ue);class VVe extends Jy{project(c,u){const g=(u=ss(u))*u,v=g*g;return{x:.5*((c=ss(c))*(.8707-.131979*g+v*(v*(.003971*g-.001529*v)-.013791))/Math.PI+.5),y:1-.5*(u*(1.007226+g*(.015085+v*(.028874*g-.044475-.005916*v)))/Math.PI+1),z:0}}unproject(c,u){c=(2*c-.5)*Math.PI;let g=u=(2*(1-u)-1)*Math.PI,v=25,k=0,S=g*g;do{S=g*g;const $=S*S;k=(g*(1.007226+S*(.015085+$*(.028874*S-.044475-.005916*$)))-u)/(1.007226+S*(.045255+$*(.259866*S-.311325-.005916*11*$))),g=je(g-k,-h_e,h_e)}while(Math.abs(k)>1e-6&&--v>0);S=g*g;const P=je(vo(c/(.8707+S*(S*(S*S*S*(.003971-.001529*S)-.013791)-.131979))),-180,180),R=vo(g);return new m(P,R)}}const f_e=ss(ue);class HVe extends Jy{project(c,u){u=ss(u),c=ss(c);const g=Math.cos(u),v=2/Math.PI,k=Math.acos(g*Math.cos(c/2)),S=Math.sin(k)/k,P=.5*(c*v+2*g*Math.sin(c/2)/S)||0,R=.5*(u+Math.sin(u)/S)||0;return{x:.5*(P/Math.PI+.5),y:1-.5*(R/Math.PI+1),z:0}}unproject(c,u){let g=c=(2*c-.5)*Math.PI,v=u=(2*(1-u)-1)*Math.PI,k=25;const S=1e-6;let P=0,R=0;do{const $=Math.cos(v),W=Math.sin(v),G=2*W*$,X=W*W,re=$*$,se=Math.cos(g/2),pe=Math.sin(g/2),Ce=2*se*pe,Se=pe*pe,De=1-re*se*se,Be=De?1/De:0,We=De?Math.acos($*se)*Math.sqrt(1/De):0,dt=.5*(2*We*$*pe+2*g/Math.PI)-c,it=.5*(We*W+v)-u,gt=.5*Be*(re*Se+We*$*se*X)+1/Math.PI,St=Be*(Ce*G/4-We*W*pe),Tt=.125*Be*(G*pe-We*W*re*Ce),Kt=.5*Be*(X*se+We*Se*$)+.5,Dt=St*Tt-Kt*gt;P=(it*St-dt*Kt)/Dt,R=(dt*Tt-it*gt)/Dt,g=je(g-P,-Math.PI,Math.PI),v=je(v-R,-f_e,f_e)}while((Math.abs(P)>S||Math.abs(R)>S)&&--k>0);return new m(vo(g),vo(v))}}class p_e extends Jy{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ss(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(c,u){const{scale:g,cosPhi:v}=this;return{x:ss(c)*v*g+.5,y:-Math.sin(ss(u))/v*g+.5,z:0}}unproject(c,u){const{scale:g,cosPhi:v}=this,k=-(u-.5)/g,S=je(vo((c-.5)/g)/v,-180,180),P=Math.asin(je(k*v,-1,1)),R=je(vo(P),-ue,ue);return new m(S,R)}}class WVe extends u_e{constructor(c){super(c),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(c,u,g){const v=D5(c,u,g);return Ye(v,v,ZP(Ih(g))),{x:v[0],y:v[1],z:v[2]}}locationPoint(c,u,g){const v=Wy(u.lat,u.lng),k=Fe([],v),S=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(u),c._centerAltitude):c._centerAltitude;xe(v,v,k,Y(1,0)*Mr*S);const P=A(new Float64Array(16));return T(P,c.pixelMatrix,c.globeMatrix),Ye(v,v,P),new ir(v[0],v[1])}pixelsPerMeter(c,u){return Y(1,0)*u}pixelSpaceConversion(c,u,g){const v=Y(1,c)*u,k=Fn(Y(1,45)*u,v,g);return this.pixelsPerMeter(c,u)/k}createTileMatrix(c,u,g){const v=Cae(Ih(g.canonical));return T(new Float64Array(16),c.globeMatrix,v)}createInversionMatrix(c,u){const{center:g}=c,v=ZP(Ih(u));return q(v,v,ss(g.lng)),F(v,v,ss(g.lat)),z(v,v,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(v)}pointCoordinate(c,u,g,v){return Ky(c,u,g,!0)||new qe(0,0)}pointCoordinate3D(c,u,g){const v=this.pointCoordinate(c,u,g,0);return[v.x,v.y,v.z]}isPointAboveHorizon(c,u){return!Ky(c,u.x,u.y,!1)}farthestPixelDistance(c){const u=function(v,k){const S=v.cameraToCenterDistance,P=v._centerAltitude*k,R=v._camera,$=v._camera.forward(),W=de([],he([],$,-S),[0,0,P]),G=v.worldSize/(2*Math.PI),X=[0,0,-G],re=v.width/v.height,se=Math.tan(v.fovAboveCenter),pe=he([],R.up(),se),Ce=he([],R.right(),se*re),Se=Fe([],de([],de([],$,pe),Ce)),De=[];let Be;if(new en(W,Se).closestPointOnSphere(X,G,De)){const We=de([],De,X),dt=Ae([],We,W);Be=Math.cos(v.fovAboveCenter)*ge(dt)}else{const We=Ae([],W,X),dt=Ae([],X,W);Fe(dt,dt);const it=ge(We)-G;Be=Math.sqrt(it*(it+2*G));const gt=Math.acos(Be/(G+it))-Math.acos(Me($,dt));Be*=Math.cos(gt)}return 1.01*Be}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=Zy(c.zoom);if(g>0){const v=c_e(c,Y(1,c.center.lat)*c.worldSize),k=c.worldSize/(2*Math.PI),S=Math.max(c.width,c.height)/c.worldSize*Math.PI;return Fn(u,v+k*(1-Math.cos(S)),Math.pow(g,10))}return u}upVector(c,u,g){return D5(u,g,c,1)}upVectorScale(c){return{metersToTile:wf(KP(Ih(c)))}}}function m_e(f){const c=f.parallels,u=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new u_e(f);case"equirectangular":return new UVe(f);case"naturalEarth":return new VVe(f);case"equalEarth":return new $Ve(f);case"winkelTripel":return new HVe(f);case"albers":return u?new p_e(f):new BVe(f);case"lambertConformalConic":return u?new p_e(f):new qVe(f);case"globe":return new WVe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const GVe=Pt.types,KVe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function hM(f,c,u,g,v,k,S,P,R,$,W,G,X){const re=P?Math.min(hx,Math.round(P[0])):0,se=P?Math.min(hx,Math.round(P[1])):0;f.emplaceBack(c,u,Math.round(32*g),Math.round(32*v),k,S,(re<<1)+(R?1:0),0+(se<<1),16*$,16*W,256*G,256*X)}function fM(f,c,u){f.emplaceBack(c,u)}function pM(f,c,u,g,v,k,S){f.emplaceBack(c,u,g,v,k,S)}const S6=(f,c,u,g)=>{for(let v=0;v0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,rVe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,Qqe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||k)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,eVe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,tVe.members,!0)),this.opacityVertexBuffer.itemSize=1),(g||v)&&this.programConfigurations.upload(c))}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())}}Qr(joe,"SymbolBuffers");class koe{constructor(c,u,g){this.layoutVertexArray=new c,this.layoutAttributes=u,this.indexArray=new g,this.segments=new Aa,this.collisionVertexArray=new b5,this.collisionVertexArrayExt=new Hm}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,nVe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,sVe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Qr(koe,"CollisionBuffers");class C6{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(S=>S.fqid),this.index=c.index,this.pixelRatio=c.pixelRatio,this.sourceLayerIndex=c.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=A([]),this.placementViewportMatrix=A([]);const u=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=LN(this.zoom,u["text-size"],this.worldview),this.iconSizeData=LN(this.zoom,u["icon-size"],this.worldview);const g=this.layers[0].layout,v=g.get("symbol-sort-key"),k=g.get("symbol-z-order");this.lut=c.lut,this.canOverlap=g.get("text-allow-overlap")||g.get("icon-allow-overlap")||g.get("text-ignore-placement")||g.get("icon-ignore-placement"),this.sortFeaturesByKey=k!=="viewport-y"&&v.constantOr(1)!==void 0,this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(S=>pu[S]),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=c.sourceID,this.projection=c.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(c){const u=this.layers[0].getAppearances();return!(!u||u.length===0)&&u.some(g=>g.getProperty(c)!=null)}createArrays(){this.text=new joe(new Ah(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new joe(new Ah(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new gN,this.lineVertexArray=new qP,this.symbolInstances=new M5}calculateGlyphDependencies(c,u,g,v,k){for(const S of c){const P=S.codePointAt(0);if(P===void 0)break;if(u[P]=!0,v&&k&&P<=65535){const R=tM[S];R&&(u[R.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,u,g,v,k,S){let P=1;const R=c.getUnevaluatedProperties()._values["icon-size"],$=LN(this.zoom,R,this.worldview),W=ON($,u);if($.kind!=="constant"&&$.kind!=="camera"||(P=W.uSize),$.kind==="composite"){const{minZoom:G,maxZoom:X}=$,re=R.possiblyEvaluate(new Ji(G,{worldview:this.worldview}),v),se=R.possiblyEvaluate(new Ji(X,{worldview:this.worldview}),v),pe=re.evaluate(g,{},v,k);P=pe+(se.evaluate(g,{},v,k)-pe)*W.uSizeT}return $.kind==="source"&&(P=R.possiblyEvaluate(new Ji(this.zoom,{worldview:this.worldview}),v).evaluate(g,{},v,k)),P*S}updateFootprints(c,u){}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!t6(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?Qc.build(c):c}populate(c,u,g,v){const k=this.layers[0],S=k.layout,P=this.projection.name==="globe",R=S.get("text-font"),$=S.get("text-field"),W=S.get("icon-image"),[G,X]=S.get("icon-size-scale-range"),re=je(u.scaleFactor||1,G,X),se=($.value.kind!=="constant"||$.value.value instanceof Xc&&!$.value.value.isEmpty()||$.value.value.toString().length>0)&&(R.value.kind!=="constant"||R.value.value.length>0),pe=W.value.kind!=="constant"||!!W.value.value||Object.keys(W.parameters).length>0,Ce=this.hasAnyAppearanceProperty("icon-image"),Se=S.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!se&&!pe&&!Ce)return;const De=u.iconDependencies,Be=u.glyphDependencies,We=u.availableImages,dt=new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),it=gt=>{const St=gt.id.toString();De.has(St)?De.get(St).push(gt):De.set(St,[gt])};for(const gt of c){const{feature:St,id:Tt,index:Kt,sourceLayerIndex:Dt}=gt,tr=k._featureFilter.needGeometry,or=Ot(St,tr);if(!k._featureFilter.filter(dt,or,g))continue;if(tr||(or.geometry=wt(St,g,v)),P&&St.type!==1&&g.z<=5){const mr=or.geometry,Tr=.98078528056,jr=(hn,Ur)=>Me(D5(hn.x,hn.y,g,1),D5(Ur.x,Ur.y,g,1)){if(!mr.getProperty("icon-image"))return;const Tr=this.getCombinedIconPrimary(mr,vr,or,g,We,er,re);Tr&&it(Tr)}),lr){const mr=R.evaluate(or,{},g).join(","),Tr=S.get("text-rotation-alignment")==="map"&&S.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(pu.vertical)>=0;for(const jr of lr.sections)if(jr.image){const hn=jr.image.getPrimary().scaleSelf(this.pixelRatio),Ur=hn.id.toString(),Zr=De.get(Ur)||[];Zr.push(hn),De.set(Ur,Zr)}else{const hn=Dv(lr.toString()),Ur=jr.fontStack||mr,Zr=Be[Ur]=Be[Ur]||{};this.calculateGlyphDependencies(jr.text,Zr,Tr,this.allowVerticalPlacement,hn)}}}if(S.get("symbol-placement")==="line"&&(this.features=function(gt){const St={},Tt={},Kt=[];let Dt=0;function tr(vr){Kt.push(gt[vr]),Dt++}function or(vr,hr,pr){const er=Tt[vr];return delete Tt[vr],Tt[hr]=er,Kt[er].geometry[0].pop(),Kt[er].geometry[0]=Kt[er].geometry[0].concat(pr[0]),er}function lr(vr,hr,pr){const er=St[hr];return delete St[hr],St[vr]=er,Kt[er].geometry[0].shift(),Kt[er].geometry[0]=pr[0].concat(Kt[er].geometry[0]),er}function xr(vr,hr,pr){const er=pr?hr[0][hr[0].length-1]:hr[0][0];return`${vr}:${er.x}:${er.y}`}for(let vr=0;vrvr.geometry)}(this.features)),S.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",u.elevationFeatures){!this.elevationFeatures&&u.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const gt of u.elevationFeatures)this.elevationFeatureIdToIndex.set(gt.id,this.elevationFeatures.length),this.elevationFeatures.push(gt)}}else S.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((gt,St)=>gt.sortKey-St.sortKey)}getCombinedIconPrimary(c,u,g,v,k,S,P){let R,$;const W=c.getUnevaluatedProperties();if(W._values["icon-image"].value!==void 0){const G=u.getAppearanceValueAndResolveTokens(c,"icon-image",g,v,k);R=this.getResolvedImageFromTokens(G)}else{const G=u.getValueAndResolveTokens("icon-image",g,v,k);R=this.getResolvedImageFromTokens(G)}if(R){const G=W._values["icon-size"]||u._unevaluatedLayout._values["icon-size"];$=iM(R,LN(this.zoom,G,this.worldview),G,v,this.zoom,S,this.pixelRatio,P,this.worldview).iconPrimary}return $}updateAppearanceBasedIconTextures(c,u,g,v){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const k=this.layers[0];let S=!1,P=0;const R=k.layout,[$,W]=R.get("icon-size-scale-range"),G=je(1,$,W);for(let X=0;X=0){const Ce=pe.id,Se=u&&Ce!==void 0?u[String(Ce)]:void 0,De={type:"Point",id:pe.id,properties:pe.properties,geometry:[]},Be=this.layers[0].appearances&&this.layers[0].appearances.find(We=>We.isActive({globals:v,feature:De,canonical:c,featureState:Se}));if(pe.activeAppearance===Be){P+=re.numIconVertices;continue}if(Be){pe.activeAppearance=Be;const We=this.getCombinedIconPrimary(Be,k,De,c,g,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:pe.properties,type:"Point",id:pe.id},G);if(!We)continue;const dt=We.toString(),it=this.iconAtlasPositions&&this.iconAtlasPositions.get(dt);if(it){const gt=k.getAppearanceValueAndResolveTokens(Be,"icon-offset",De,c,g),St=gt&&Array.isArray(gt)?gt:[0,0];let Tt=x6(it,void 0,St,k.layout.get("icon-anchor").evaluate(De,{},c));const Kt=k.getAppearanceValueAndResolveTokens(Be,"icon-rotate",De,c,g),Dt=typeof Kt=="number"?Kt:0,tr=it.sdf,or=k.layout.get("icon-text-fit").constantOr("none");or!=="none"&&pe.textShaping&&pe.iconTextFitPadding&&pe.fontScale&&(Tt=moe(Tt,pe.textShaping,or,pe.iconTextFitPadding,St,pe.fontScale));const lr=this.calculateEffectiveAppearanceIconSize(Be,v.zoom,De,c,g,G),xr=0,vr=1+(Math.min(hx,Math.round(lr*Pp))<<1),hr=voe(Tt,Dt,tr,or!=="none",G);pe.isUsingAppearanceVertexData||(pe.isUsingAppearanceVertexData=!0,pe.layoutBasedVertexData=this.icon.getIconVertexData(P,re.numIconVertices));for(let er=0;er0&&(this.icon.updateIconVertexData(P,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(P+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(P+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(P+3,0,0,0,0,0,0,0,0,0,0,0,0),S=!0),P+=re.numIconVertices,pe.activeAppearance=null;else if(pe.isUsingAppearanceVertexData){const dt=pe.layoutBasedVertexData.length/12;for(let it=0;it0||X>0,Ce=re>0,Se=this.elevationFeatures[R.elevationFeatureIndex];if(Se){const De=new ir(R.tileAnchorX,R.tileAnchorY),Be=.075+Se.pointElevation(De);R.zOffset!==Be&&(u=!0,R.zOffset=Be),Be!==0&&(this.hasAnyZOffset=!0);const We=Se.computeSlopeNormal(De,v),dt=zn(Nt(),ie(0,0,1),We);mt($,$,dt),mt(W,W,dt),$[2]*=g,W[2]*=g,$[0]===1&&$[1]===0&&$[2]===0&&W[0]===0&&W[1]===1&&W[2]===0||(k=k||pe,S=S||Ce)}if(pe&&(S6(this.text.orientationVertexArray,G,$,W),S6(this.text.orientationVertexArray,X,$,W)),Ce){const{placedIconSymbolIndex:De,verticalPlacedIconSymbolIndex:Be}=R;De>=0&&S6(this.icon.orientationVertexArray,re,$,W),Be>=0&&S6(this.icon.orientationVertexArray,se,$,W)}}k||(this.text.orientationVertexArray=void 0),S||(this.icon.orientationVertexArray=void 0),u&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(k,S,P)=>{g+=S,g>k.length&&k.resize(g);for(let R=-S;R<0;R++)k.emplace(R+g,P)},u=(k,S,P)=>{v+=S,v>k.length&&k.resize(v);for(let R=-S;R<0;R++)k.emplace(R+v,P)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,v=0;for(let k=0;k0;if((P>0||R>0)&&(c(this.text.zOffsetVertexArray,P,W),c(this.text.zOffsetVertexArray,R,W)),G){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:re}=S;X>=0&&u(this.icon.zOffsetVertexArray,$,W),re>=0&&u(this.icon.zOffsetVertexArray,S.numVerticalIconVertices,W)}}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(c,u,g,v,k){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(c),this.iconCollisionBox.upload(c)),this.text.upload(c,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(S=>S.appearances&&S.appearances.length>0)),this.icon.upload(c,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(c,u,g,v){return!!(c&&u&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,u,g,v)&&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=m_e(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,u){const g=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:v,y:k}of u)this.lineVertexArray.emplaceBack(v,k);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe,Ce,Se,De){const Be=c.indexArray,We=c.layoutVertexArray,dt=c.globeExtVertexArray,it=c.segments.prepareSegment(4*De,We,Be,this.canOverlap?S.sortKey:void 0),gt=this.glyphOffsetArray.length,St=it.vertexLength,Tt=this.allowVerticalPlacement&&P===pu.vertical?Math.PI/2:0,Kt=S.text&&S.text.sections;for(let or=0;or=0?u.rightJustifiedTextSymbolIndex:u.centerJustifiedTextSymbolIndex>=0?u.centerJustifiedTextSymbolIndex:u.leftJustifiedTextSymbolIndex>=0?u.leftJustifiedTextSymbolIndex:u.verticalPlacedTextSymbolIndex>=0?u.verticalPlacedTextSymbolIndex:v),S=goe(this.textSizeData,c,k)/xl;return this.tilePixelRatio*S}getSymbolInstanceIconSize(c,u,g){const v=this.icon.placedSymbolArray.get(g),k=goe(this.iconSizeData,c,v);return this.tilePixelRatio*k}_commitDebugCollisionVertexUpdate(c,u,g,v){c.emplaceBack(u,-g,-g,v),c.emplaceBack(u,g,-g,v),c.emplaceBack(u,g,g,v),c.emplaceBack(u,-g,g,v)}_updateTextDebugCollisionBoxes(c,u,g,v,k,S,P){for(let R=v;R0}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(c,u){const g=c.placedSymbolArray.get(u),v=g.vertexStartIndex+4*g.numGlyphs;for(let k=g.vertexStartIndex;kv[P]-v[R]||k[R]-k[P]),S}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let c=0;cthis.symbolInstances.get(u).zOffset-this.symbolInstances.get(c).zOffset)}addToSortKeyRanges(c,u){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===u?g.symbolInstanceEnd=c+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:c,symbolInstanceEnd:c+1})}sortFeatures(c){if(this.sortFeaturesByY&&this.sortedAngle!==c&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(c),this.sortedAngle=c,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const u of this.symbolInstanceIndexes){const g=this.symbolInstances.get(u);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:v,centerJustifiedTextSymbolIndex:k,leftJustifiedTextSymbolIndex:S,verticalPlacedTextSymbolIndex:P,placedIconSymbolIndex:R,verticalPlacedIconSymbolIndex:$}=g;v>=0&&this.addIndicesForPlacedSymbol(this.text,v),k>=0&&k!==v&&this.addIndicesForPlacedSymbol(this.text,k),S>=0&&S!==k&&S!==v&&this.addIndicesForPlacedSymbol(this.text,S),P>=0&&this.addIndicesForPlacedSymbol(this.text,P),R>=0&&this.addIndicesForPlacedSymbol(this.icon,R),$>=0&&this.addIndicesForPlacedSymbol(this.icon,$)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(c){const u=this.symbolInstances.get(this.text.symbolInstanceIndices[c]).elevationFeatureIndex;let g;return this.elevationFeatures&&ug in f?String(f[g]):"")}let x_e,y_e,Noe;Qr(C6,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),C6.addDynamicAttributes=zN;class v_e{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Nh,this.defaultValue=c}evaluate(c){if(c.formattedSection){const u=this.defaultValue.property.overrides;if(u&&u.hasOverride(c.formattedSection))return u.getOverride(c.formattedSection)}return c.feature&&c.featureState?this.defaultValue.evaluate(c.feature,c.featureState):this.defaultValue.property.specification.default}eachChild(c){this.defaultValue.isConstant()||c(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qr(v_e,"FormatSectionOverride",{omit:["defaultValue"]});const Soe=()=>Noe||(Noe={layout:x_e||(x_e=new $a({"symbol-placement":new Nr(Ft.layout_symbol["symbol-placement"]),"symbol-spacing":new Nr(Ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Nr(Ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Lr(Ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Nr(Ft.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Nr(Ft.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Nr(Ft.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Nr(Ft.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Nr(Ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new Nr(Ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Nr(Ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new Lr(Ft.layout_symbol["icon-size"]),"icon-size-scale-range":new Nr(Ft.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Lr(Ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Lr(Ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new Lr(Ft.layout_symbol["icon-image"]),"icon-image-use-theme":new Nr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Lr(Ft.layout_symbol["icon-rotate"]),"icon-padding":new Nr(Ft.layout_symbol["icon-padding"]),"icon-keep-upright":new Nr(Ft.layout_symbol["icon-keep-upright"]),"icon-offset":new Lr(Ft.layout_symbol["icon-offset"]),"icon-anchor":new Lr(Ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Nr(Ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Nr(Ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Nr(Ft.layout_symbol["text-rotation-alignment"]),"text-field":new Lr(Ft.layout_symbol["text-field"]),"text-font":new Lr(Ft.layout_symbol["text-font"]),"text-size":new Lr(Ft.layout_symbol["text-size"]),"text-size-scale-range":new Nr(Ft.layout_symbol["text-size-scale-range"]),"text-max-width":new Lr(Ft.layout_symbol["text-max-width"]),"text-line-height":new Lr(Ft.layout_symbol["text-line-height"]),"text-letter-spacing":new Lr(Ft.layout_symbol["text-letter-spacing"]),"text-justify":new Lr(Ft.layout_symbol["text-justify"]),"text-radial-offset":new Lr(Ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Nr(Ft.layout_symbol["text-variable-anchor"]),"text-anchor":new Lr(Ft.layout_symbol["text-anchor"]),"text-max-angle":new Nr(Ft.layout_symbol["text-max-angle"]),"text-writing-mode":new Nr(Ft.layout_symbol["text-writing-mode"]),"text-rotate":new Lr(Ft.layout_symbol["text-rotate"]),"text-padding":new Nr(Ft.layout_symbol["text-padding"]),"text-keep-upright":new Nr(Ft.layout_symbol["text-keep-upright"]),"text-transform":new Lr(Ft.layout_symbol["text-transform"]),"text-offset":new Lr(Ft.layout_symbol["text-offset"]),"text-allow-overlap":new Nr(Ft.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Nr(Ft.layout_symbol["text-ignore-placement"]),"text-optional":new Nr(Ft.layout_symbol["text-optional"]),visibility:new Nr(Ft.layout_symbol.visibility)})),paint:y_e||(y_e=new $a({"icon-opacity":new Lr(Ft.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Lr(Ft.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Lr(Ft.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Lr(Ft.paint_symbol["text-emissive-strength"]),"icon-color":new Lr(Ft.paint_symbol["icon-color"]),"icon-halo-color":new Lr(Ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new Lr(Ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Lr(Ft.paint_symbol["icon-halo-blur"]),"icon-translate":new Nr(Ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new Nr(Ft.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Nr(Ft.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Lr(Ft.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Lr(Ft.paint_symbol["text-occlusion-opacity"]),"text-color":new Lr(Ft.paint_symbol["text-color"],{runtimeType:wd,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Lr(Ft.paint_symbol["text-halo-color"]),"text-halo-width":new Lr(Ft.paint_symbol["text-halo-width"]),"text-halo-blur":new Lr(Ft.paint_symbol["text-halo-blur"]),"text-translate":new Nr(Ft.paint_symbol["text-translate"]),"text-translate-anchor":new Nr(Ft.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Nr(Ft.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Nr(Ft.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Nr(Ft.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Nr(Ft.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Lr(Ft.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"})}))},Noe);class M6 extends td{constructor(c,u,g,v){super(c,Soe(),u,g,v,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=A([]),this.hasOcclusionOpacityProperties=c.paint!==void 0&&("icon-occlusion-opacity"in c.paint||"text-occlusion-opacity"in c.paint)}_handleSpecialPaintPropertyUpdate(c){c!=="icon-occlusion-opacity"&&c!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(c,u){super.recalculate(c,u),this.appearances&&this.appearances.forEach(v=>{v.recalculate(c,u,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 g=this.layout.get("text-writing-mode");if(g){const v=[];for(const k of g)v.indexOf(k)<0&&v.push(k);this.layout._values["text-writing-mode"]=v}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(c,u,g,v){return this._saturation===c&&this._contrast===u&&this._brightnessMin===g&&this._brightnessMax===v||(this._colorAdjustmentMatrix=function(k,S,P,R){k=ma(k),S=Ks(S);const $=N(),W=k/3,G=1-2*W,X=[G,W,W,0,W,G,W,0,W,W,G,0,0,0,0,1],re=.5-.5*S,se=R-P;return T($,[se,0,0,0,0,se,0,0,0,0,se,0,P,P,P,1],[S,0,0,0,0,S,0,0,0,0,S,0,re,re,re,1]),T($,$,X),$}(c,u,g,v),this._saturation=c,this._contrast=u,this._brightnessMin=g,this._brightnessMax=v),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,u,g,v){const k=this.layout.get(c).evaluate(u,{},g,v),S=this._unevaluatedLayout._values[c];return S.isDataDriven()||Lv(S.value)||!k?k:g_e(u.properties,k)}getAppearanceValueAndResolveTokens(c,u,g,v,k){const S=c.getProperty(u);if(!S)return;const P=S.evaluate(g,{},v,k),R=c.getUnevaluatedProperties()._values[u];return R.isDataDriven()||Lv(R.value)||!P||typeof P!="string"?P:g_e(g.properties,P)}createBucket(c){return new C6(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of Soe().paint.overridableProperties){if(!M6.hasPaintOverride(this.layout,c))continue;const u=this.paint.get(c),g=new v_e(u),v=new Wk(g,u.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let k=null;k=u.value.kind==="constant"||u.value.kind==="source"?new Ry("source",v):new Jg("composite",v,u.value.zoomStops,u.value.interpolationType),this.paint._values[c]=new tx(u.property,k,u.parameters)}}_handleOverridablePaintPropertyUpdate(c,u,g){return!(!this.layout||u.isDataDriven()||g.isDataDriven())&&M6.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,u){const g=c.get("text-field"),v=Soe().paint.properties[u];let k=!1;const S=P=>{for(const R of P)if(v.overrides&&v.overrides.hasOverride(R))return void(k=!0)};if(g.value.kind==="constant"&&g.value.value instanceof Xc)S(g.value.value.sections);else if(g.value.kind==="source"){const P=$=>{k||($ instanceof xp&&gl($.value)===vv?S($.value.sections):$ instanceof pf?S($.sections):$.eachChild(P))},R=g.value;R._styleExpression&&P(R._styleExpression.expression)}return k}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,u,g){return{config:new Gm(this,{zoom:u,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let __e,b_e,w_e,j_e;var Coe=As([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function T6(f,c,u,g,v,k,S,P){const R=[f,c,1,u,g,1,v,k,1],$=[S,P,1],W=b([],R),[G,X,re]=me($,$,W);return j(R,R,[G,0,0,0,X,0,0,0,re])}function k_e(f,c,u,g,v,k,S,P){const R=function($,W,G,X,re,se,pe,Ce){const Se=T6(0,0,1,0,1,1,0,1),De=T6($,W,G,X,re,se,pe,Ce);return j(De,De,b([],Se))}(f,c,u,g,v,k,S,P);return[R[2]/R[8]/Mr,R[5]/R[8]/Mr]}function A6(f){return[f[0],Math.min(Math.max(f[1],-ue),ue)]}class N_e extends Gg{constructor(c,u,g,v){super(),this.id=c,this.dispatcher=g,this.coordinates=u.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(v),this.options=u,this._dirty=!1}load(c,u){if(this._loaded=u||!1,this.fire(new hf("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=ws(this.map._requestManager.transformRequest(this.url,Hg.Image),(g,v)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new gv(g)):v&&(this.image=v instanceof HTMLImageElement?Bo.getImageData(v):v,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,c&&(this.coordinates=c),this._finishLoading())})}loaded(){return this._loaded}updateImage(c){return c.url?(this._imageRequest&&c.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=c.url,this.load(c.coordinates,this._loaded),this):this}setTexture(c){if(!(c.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Q5(this.map.painter.context,c.handle),this.width=c.dimensions[0],this.height=c.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new hf("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(c){this.map=c,this.load()}onRemove(c){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Q5||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(c){if(this.coordinates=c,this._boundsArray=void 0,this._unsupportedCoords=!1,!c.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let u=c[0][1],g=c[0][1];for(const k of c)k[1]>g&&(g=k[1]),k[1]ue?this.onNorthPole=!0:v<-ue&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const k=c.map(qe.fromLngLat);this.tileID=function(S){let P=1/0,R=1/0,$=-1/0,W=-1/0;for(const pe of S)P=Math.min(P,pe.x),R=Math.min(R,pe.y),$=Math.max($,pe.x),W=Math.max(W,pe.y);const G=Math.max($-P,W-R),X=Math.max(0,Math.floor(-Math.log2(G))),re=Math.pow(2,X);let se=Math.floor((P+$)/2*re);return se>1&&(se-=1),new Vi(X,se,Math.floor((R+W)/2*re))}(k),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new hf("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Q5||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(c){for(const Se in this.tiles){const De=this.tiles[Se];De.state!=="loaded"&&(De.state="loaded",De.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const u=oM(new Vi(0,0,0),this.map.transform.projection),g=[u.projection.project(this.coordinates[0][0],this.coordinates[0][1]),u.projection.project(this.coordinates[1][0],this.coordinates[1][1]),u.projection.project(this.coordinates[2][0],this.coordinates[2][1]),u.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(Se){const De=Se[1].x-Se[0].x,Be=Se[1].y-Se[0].y,We=Se[2].x-Se[1].x,dt=Se[2].y-Se[1].y,it=Se[3].x-Se[2].x,gt=Se[3].y-Se[2].y,St=Se[0].x-Se[3].x,Tt=Se[0].y-Se[3].y,Kt=De*dt-We*Be,Dt=We*gt-it*dt,tr=it*Tt-St*gt,or=St*Be-De*Tt;return Kt>0&&Dt>0&&tr>0&&or>0||Kt<0&&Dt<0&&tr<0&&or<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const v=oM(this.tileID,this.map.transform.projection),[k,S,P,R]=this.coordinates.map(Se=>{const De=v.projection.project(Se[0],Se[1]);return d_e(v,De)._round()});this.perspectiveTransform=k_e(k.x,k.y,S.x,S.y,P.x,P.y,R.x,R.y);const $=this._boundsArray=new $y;$.emplaceBack(k.x,k.y,0,0),$.emplaceBack(S.x,S.y,Mr,0),$.emplaceBack(R.x,R.y,0,Mr),$.emplaceBack(P.x,P.y,Mr,Mr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,Coe.members),this.boundsSegments=Aa.simpleSegment(0,0,4,2);const W=[],G=[A6((X=this.coordinates)[0]),A6(X[1]),A6(X[2]),A6(X[3])];var X;const[re,se,pe,Ce]=function(Se){let De=Se[0][0],Be=De,We=Se[0][1],dt=We;for(let it=1;itBe&&(Be=Se[it][0]),Se[it][1]dt&&(dt=Se[it][1]);return[De,We,Be-De,dt-We]}(G);{const Se=new $y,[De,Be,We,dt]=function(hr){let pr=hr[0].x,er=pr,Yt=hr[0].y,mr=Yt;for(let Tr=1;Trer&&(er=hr[Tr].x),hr[Tr].ymr&&(mr=hr[Tr].y);return[pr,Yt,er-pr,mr-Yt]}(g),it=hr=>[(hr.x-De)/We,(hr.y-Be)/dt],[gt,St,Tt,Kt]=g.map(it),Dt=function(hr,pr,er,Yt,mr,Tr,jr,hn){const Ur=T6(0,0,1,0,1,1,0,1);return j(Ur,Ur,b([],T6(hr,pr,er,Yt,mr,Tr,jr,hn)))}(gt[0],gt[1],St[0],St[1],Tt[0],Tt[1],Kt[0],Kt[1]);this.elevatedGlobePerspectiveTransform=k_e(gt[0],gt[1],St[0],St[1],Tt[0],Tt[1],Kt[0],Kt[1]);const tr=(hr,pr)=>{W.push(hr.lng);const er=Math.round((hr.lng-re)/pe*Mr),Yt=Math.round((hr.lat-se)/Ce*Mr),mr=it(pr),Tr=me([],[mr[0],mr[1],1],Dt),jr=Math.round(Tr[0]/Tr[2]*Mr),hn=Math.round(Tr[1]/Tr[2]*Mr);Se.emplaceBack(er,Yt,jr,hn)},or=g[3].x-g[0].x,lr=g[3].y-g[0].y,xr=g[2].x-g[1].x,vr=g[2].y-g[1].y;for(let hr=0;hr<65;hr++){const pr=hr/64,er=[g[0].x+pr*or,g[0].y+pr*lr],Yt=[g[1].x+pr*xr,g[1].y+pr*vr],mr=Yt[0]-er[0],Tr=Yt[1]-er[1];for(let jr=0;jr<65;jr++){const hn=jr/64,Ur={x:er[0]+mr*hn,y:er[1]+Tr*hn};tr(u.projection.unproject(Ur.x,Ur.y),Ur)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(Se,Coe.members)}{this.maxLongitudeTriangleSize=0;let Se=[],De=new $o;const Be=(We,dt,it)=>{De.emplaceBack(We,dt,it);const gt=W[We],St=W[dt],Tt=W[it],Kt=Math.min(Math.min(gt,St),Tt),Dt=Math.max(Math.max(gt,St),Tt)-Kt;Dt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Dt),Se.push(Kt+Dt/2)};for(let We=0;We<64;We++)for(let dt=0;dt<64;dt++){const it=65*We+dt,gt=it+1,St=it+65,Tt=St+1;Be(it,St,gt),Be(gt,St,Tt)}[Se,De]=function(We,dt){const it=Array.from({length:We.length},(Tt,Kt)=>Kt);it.sort((Tt,Kt)=>We[Tt]-We[Kt]);const gt=[],St=new $o;for(let Tt=0;Tt{S.segments.push({vertexOffset:0,primitiveOffset:G,vertexLength:u.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},R=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-v)<=R){const G=wa(g,0,g.length,v+R);return G===g.length||P(G,fo(g,G+1,g.length,v+360-R)-G),S}vMr?v-Mr:v,new ir(Math.trunc(v),Math.trunc(g[u+1]))}translationForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+4],g[u+5],g[u+6]]}rotationScaleForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+10],g[u+11],g[u+12],g[u+13],g[u+14],g[u+15]]}transformForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+4],g[u+10],g[u+11],g[u+12],g[u+5],g[u+13],g[u+14],g[u+15],g[u+6],0,0,0,1]}}class Aoe{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaledZ=this.canonical.z+Math.log2(c.overscaling),this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.projection=c.projection,this.index=c.index,this.worldview=c.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.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=c.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.tileToMeter=Pe(g);const k=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:S,id:P,index:R,sourceLayerIndex:$}of c){const W=P??(S.properties&&S.properties.hasOwnProperty("id")?S.properties.id:void 0),G=Ot(S,k);if(!this.layers[0]._featureFilter.filter(new Ji(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),G,g))continue;const X={id:W,sourceLayerIndex:$,index:R,geometry:k?G.geometry:wt(S,g,v),properties:S.properties,type:S.type,patterns:{}},re=this.addFeature(X,X.geometry,G);re&&u.featureIndex.insert(S,X.geometry,R,$,this.index,this.instancesPerModel[re].instancedDataArray.length,Mr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,u=this.layers[0].scope;let g=0;for(const v of this.modelUris){const k=c.getModel(v,u);if(!k)continue;const S=this.instancesPerModel[v];if(S){const P=.5*be(k.aabb.max,k.aabb.min)*S.maxScale+S.maxXYTranslationDistance,R=Math.min(Mr,Math.max(P/this.tileToMeter,Mr/32));g=Math.max(R,g)}}return g}update(c,u,g,v){for(const k in this.instancesPerModel){const S=this.instancesPerModel[k];for(const P in c)S.idToFeaturesIndex.hasOwnProperty(P)&&(this.evaluate(S.features[S.idToFeaturesIndex[P]],c[P],S,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];for(const v of g.features){const k=this.layers[0],S=v.feature,P=this.canonical,R=k.paint.get("model-rotation").evaluate(S,{},P),$=k.paint.get("model-scale").evaluate(S,{},P),W=k.paint.get("model-translation").evaluate(S,{},P);nt(v.rotation,R)&&nt(v.scale,$)&&nt(v.translation,W)||(this.evaluate(v,v.featureStates,g,!0),c=!0)}}return c}updateReplacement(c,u,g,v){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const k=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(t6(this.activeReplacements,k))return!1;this.activeReplacements=k;let S=!1;for(const P in this.instancesPerModel){const R=this.instancesPerModel[P],$=R.instancedDataArray;for(const W of R.features){const G=W.instancedDataOffset,X=W.instancedDataCount;for(let re=0;reMr;pe=Ce?pe-Mr:pe;const Se=Math.floor(pe),De=Math.floor($.float32[se+1]);let Be=!1;for(const We of this.activeReplacements)if(!b1e(We,g,P_e.Model,v)&&!(We.min.x>Se||Se>We.max.x||We.min.y>De||De>We.max.y)&&(Be=S1e(N1e(Se,De,c.canonical,We.footprintTileId.canonical),We.footprint),Be))break;$.float32[se]=Be?pe+Mr:pe,S=S||Be!==Ce}}}return S}isEmpty(){for(const c in this.instancesPerModel)if(this.instancesPerModel[c].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(c){if(!this.uploaded)for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=c.createVertexBuffer(g.instancedDataArray,_qe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(c){for(const g in this.instancesPerModel){const v=this.instancesPerModel[g];v.instancedDataArray.length!==0&&v.instancedDataBuffer&&v.instancedDataBuffer.destroy()}const u=this.layers[0].modelManager;if(c&&u&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)u.removeModel(g,"",!0)}addFeature(c,u,g){const v=this.layers[0],k=v.layout.get("model-id").evaluate(g,{},this.canonical);if(!k)return Vr(`modelId is not evaluated for layer ${v.id} and it is not going to get rendered.`),k;(Toe(k,!1)||this.styleDefinedModelURLs[k]!==void 0)&&(this.modelUris.includes(k)||this.modelUris.push(k)),this.instancesPerModel[k]||(this.instancesPerModel[k]=new O_e);const S=this.instancesPerModel[k],P=S.instancedDataArray,R=new L_e(g,P.length);for(const $ of u)for(const W of $){if(W.x<0||W.x>=Mr||W.y<0||W.y>=Mr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Mr,re=this.lookupDim*(W.y*X|0)+W.x*X|0;if(this.lookup){if(this.lookup[re]!==0)continue;this.lookup[re]=1}}this.instanceCount++;const G=P.length;P.resize(G+1),S.instancesEvaluatedElevation.push(0),P.float32[16*G]=W.x,P.float32[16*G+1]=W.y}return R.instancedDataCount=S.instancedDataArray.length-R.instancedDataOffset,R.instancedDataCount>0&&(c.id&&(S.idToFeaturesIndex[c.id]=S.features.length),S.features.push(R),this.evaluate(R,{},S,!1)),k}getModelUris(){return this.modelUris}evaluate(c,u,g,v){const k=this.layers[0],S=c.feature,P=this.canonical,R=c.rotation=k.paint.get("model-rotation").evaluate(S,u,P),$=c.scale=k.paint.get("model-scale").evaluate(S,u,P),W=c.translation=k.paint.get("model-translation").evaluate(S,u,P),G=Object.assign({},k.paint.get("model-color").evaluate(S,u,P));G.a=k.paint.get("model-color-mix-intensity").evaluate(S,u,P);const X=[];this.maxVerticalOffset0?Math.sqrt(re):0;g.maxScale=Math.max(Math.max(g.maxScale,$[0]),Math.max($[1],$[2])),g.maxXYTranslationDistance=Math.max(g.maxXYTranslationDistance,se),this.maxScale=Math.max(Math.max(this.maxScale,$[0]),Math.max($[1],$[2])),hve(X,R,$);const pe=Math.round(100*G.a)+G.b/1.05;for(let Ce=0;Ce10?this.tileToMeter:Pe(P,dt)),Be[De+4]=W[0],Be[De+5]=W[1],Be[De+6]=W[2]+We,Be[De+7]=X[0],Be[De+8]=X[1],Be[De+9]=X[2],Be[De+10]=X[4],Be[De+11]=X[5],Be[De+12]=X[6],Be[De+13]=X[8],Be[De+14]=X[9],Be[De+15]=X[10],g.instancesEvaluatedElevation[Se]=W[2]}}}let D_e,R_e;Qr(Aoe,"ModelBucket",{omit:["layers"]}),Qr(O_e,"PerModelAttributes"),Qr(L_e,"ModelFeature");class BN{constructor(c,u,g){this._demTile=c,this._dem=this._demTile.dem,this._scale=u,this._offset=g}static create(c,u,g){const v=g||c.findDEMTileFor(u);if(!v||!v.dem)return;const k=v.dem,S=v.tileID,P=1<$.fqid),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id),this.modelTraits|=EN.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,v&&(this.modelTraits|=EN.HasMapboxMeshFeatures),k&&(this.modelTraits|=EN.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=S,this.worldview=R,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const $ of u)this.nodesInfo.push(new $_e($)),z_e($,P.featureIndexArray.length,P.grid),P.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,P.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(c,u){for(const g of this.getNodesInfo()){const v=g.node;v.footprint&&u.push({footprint:v.footprint,id:c})}}updateAppearances(c,u,g,v){}update(c){const u=Object.keys(c).length!==0;if(u&&!this.stateDependentLayers.length)return;const g=u?this.stateDependentLayers:this.layers;if(!xo(c,this.states))for(const v of g)this.evaluate(v,c);this.states=structuredClone(c)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(c){if(!this.needsUpload)return;const u=this.getNodesInfo();for(const g of u){const v=g.node;this.uploaded?this.updatePbrBuffer(v):toe(v,c,!0)}for(const g of u)f6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let u=!1;if(!c.meshes)return u;for(const g of c.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),u=!0);return u}needsReEvaluation(c,u,g){const v=c.transform.projectionOptions,k=c.style.getBrightness(),S=this.brightness!==k;if(!this.uploaded||this.dirty||v.name!==this.projection.name||mM(g.paint.get("model-color").value,S)||mM(g.paint.get("model-color-mix-intensity").value,S)||mM(g.paint.get("model-roughness").value,S)||mM(g.paint.get("model-emissive-strength").value,S)||mM(g.paint.get("model-height-based-emissive-strength-multiplier").value,S)){this.projection=v,this.brightness=k;const P=this.getNodesInfo();for(const R of P)R.state=null;return!0}return!1}evaluateTransform(c,u){if(c.transform.zoom===this.zoom)return;this.zoom=c.transform.zoom;const g=this.getNodesInfo(),v=this.id.canonical;for(const k of g){const S=k.feature;k.evaluatedTranslation=u.paint.get("model-translation").evaluate(S,{},v),k.evaluatedScale=u.paint.get("model-scale").evaluate(S,{},v)}}evaluate(c,u){const g=this.getNodesInfo();for(const v of g){if(!v.node.meshes)continue;const k=v.feature,S=u&&u[k.id];if(xo(S,v.state))continue;v.state=structuredClone(S);const P=v.node.meshes&&v.node.meshes[0].featureData,R=v.evaluatedColor[2],$=v.evaluatedRMEA[2],W=this.id.canonical;if(v.hasTranslucentParts=!1,P){for(let G=0;G=it)continue;const hr=Eoe[vr],pr=Math.abs(hr);pr>Dt&&(Kt=hr,Dt=pr,tr=xr,or=lr)}if(Dt>.1){const lr=1-(it+.5*Math.abs(tr*or))/se;let xr=u._dem.get(St,gt)+Kt*lr;const vr=u._dem.get(St+tr,gt+or),hr=u._dem.get(St-tr,gt-or,!0);(xr-vr)*(xr-hr)>0&&(xr=(vr+hr)/2),Eoe[Tt]=u._dem.set(St,gt,xr),r_[Tt]=it}}}}}P&&(u._demTile.needsDEMTextureUpload=!0,u._dem._timestamp=Bo.now())}setFilter(c){this.filter=c?tN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new Ji(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const u of c)f6(u.node),roe(u.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped());for(const v of this.getNodesInfo()){const k=v.node.footprint;v.hiddenByReplacement=!!k&&!g.find(S=>S.footprint===k)}}getHeightAtTileCoord(c,u){const g=[],v=[0,0,0],k=A([]);for(const S of this.getNodesInfo()){const P=S.node.meshes[0],R=P.transformedAabb;if(cR.max[0]||u>R.max[1])continue;if(S.node.hidden===!0)return{height:1/0,maxHeight:S.feature.properties.height,hidden:!1,verticalScale:S.evaluatedScale[2]};E(k,S.node.globalMatrix),v[0]=c,v[1]=u,Ye(v,v,k);const $=(v[0]-P.aabb.min[0])/(P.aabb.max[0]-P.aabb.min[0])*Jv|0,W=Math.min(63,(v[1]-P.aabb.min[1])/(P.aabb.max[1]-P.aabb.min[1])*Jv|0)*Jv+Math.min(63,$),G=P.heightmap[W];if(!(G<0&&S.node.footprint))return S.hiddenByReplacement?void 0:{height:G,maxHeight:S.feature.properties.height,hidden:!1,verticalScale:S.evaluatedScale[2]};if(S.node.footprint.grid.query(new ir(c,u),new ir(c,u),g),g.length>0)return{height:void 0,maxHeight:S.feature.properties.height,hidden:S.hiddenByReplacement,verticalScale:S.evaluatedScale[2]}}}}function mM(f,c){return f instanceof Ry&&!f.isLightConstant&&c}function QVe(f,c,u,g,v,k,S,P){let R=(61440&c|(61440&c)>>4)>>8,$=(3840&c|(3840&c)>>4)>>4,W=240&c|(240&c)>>4;u[3]>0&&(R=Fn(R,255*u[0],u[3]),$=Fn($,255*u[1],u[3]),W=Fn(W,255*u[2],u[3]));const G=R<<8|$,X=W<<8|Math.floor(255*g[3]),re=function(it){const gt=je(it,0,2);return Math.min(Math.round(.5*gt*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],se=je(v[0],0,1),pe=je(v[1],0,1),Ce=je(v[2],0,1),Se=je(v[3],0,1);let De,Be,We,dt;if(se!==pe&&S!==k&&pe!==se){const it=S-k;Be=1/(it*(pe-se)),We=-(k+it*se)/(it*(pe-se));const gt=je(v[4],-1,1);dt=Math.pow(10,gt),De=255*Ce<<8|255*Se}else De=65535,Be=0,We=1,dt=1;if(f.emplaceBack(G,X,re,De,Be,We,dt),P){const it=P.length;P.clear();for(let gt=0;gt>16&65535,W=k?R>>16&65535:65535&R,G=(15&W)<8?15&W:0,X=f.evaluatedRMEA[G],re=f.evaluatedColor[G],se=f.emissionHeightBasedParams[G];let pe;if(P&&G===2&&g.lights&&(pe=new hN,pe.resize(10*g.lights.length)),QVe(S.featureArray,$,re,X,se,S.aabb.min[2],S.aabb.max[2],pe),pe&&P){P=!1;const Ce=g.meshes[g.lightMeshIndex];Ce.featureArray=pe,Ce.featureArray._trim()}}S.featureArray._trim(),v++}}Qr(I6,"Tiled3dModelBucket",{omit:["layers"]}),Qr($_e,"Tiled3dModelFeature");const eHe=["id","tile","layer","source","sourceLayer","state"];class n_{constructor(c,u,g,v,k){this.type="Feature",this._vectorTileFeature=c,this._z=u,this._x=g,this._y=v,this.properties=c?c.properties:{},this.id=k}clone(){const c=new n_(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(c.state=Object.assign({},this.state)),this.layer&&(c.layer=Object.assign({},this.layer)),this.source&&(c.source=this.source),this.sourceLayer&&(c.sourceLayer=this.sourceLayer),c}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(c){this._geometry=c}toJSON(){const c={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const u of eHe)this[u]!==void 0&&(c[u]=this[u]);return c}}class s_ extends Gg{constructor(c,u,g,v){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=u,this._modelsInfo=new Map}load(){const c=[];for(const u in this._options.models){const g=this._options.models[u],v=this._modelsInfo.get(u);if(v){const k=v.model;k.position=g.position!=null?new m(g.position[0],g.position[1]):new m(0,0),k.orientation=g.orientation!=null?g.orientation:[0,0,0],v.modelSpec=g,s_.applyModelSpecification(k,g),k.computeBoundsAndApplyParent(),this.models.push(k)}else{const k=lve(this.map._requestManager.transformRequest(g.uri,Hg.Model).url).then(S=>{if(!S)return;const P=soe(S),R=new fve(u,g.uri,g.position,g.orientation,P);s_.applyModelSpecification(R,g),R.computeBoundsAndApplyParent(),this.models.push(R),this._modelsInfo.set(u,{modelSpec:g,model:R})}).catch(S=>{this.fire(new gv(new Error(`Could not load model ${u} from ${g.uri}: ${S.message}`)))});c.push(k)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new hf("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(u=>{this._loaded=!0,this.fire(new gv(new Error(`Could not load models: ${u.message}`)))})}static applyModelSpecification(c,u){u.nodeOverrides&&s_.convertNodeOverrides(c,u.nodeOverrides),u.materialOverrides&&s_.convertMaterialOverrides(c,u.materialOverrides),u.nodeOverrideNames&&(c.nodeOverrideNames=[...u.nodeOverrideNames]),u.materialOverrideNames&&(c.materialOverrideNames=[...u.materialOverrideNames]),u.featureProperties&&(c.featureProperties=u.featureProperties)}static convertNodeOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.nodeOverrideNames=[];for(const g of u)c.nodeOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={orientation:[0,0,0]};if(v.hasOwnProperty("orientation")){const S=v.orientation;S&&(k.orientation=S)}c.nodeOverrides.set(g,k)})}static convertMaterialOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.materialOverrideNames=[];for(const g of u)c.materialOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={color:new ki(1,1,1),colorMix:0,emissionStrength:0,opacity:1},S=v["model-color"];S!==void 0&&(k.color.r=S[0],k.color.g=S[1],k.color.b=S[2]);const P=v["model-color-mix-intensity"];P!==void 0&&(k.colorMix=P);const R=v["model-emissive-strength"];R!==void 0&&(k.emissionStrength=R);const $=v["model-opacity"];$!==void 0&&(k.opacity=$),c.materialOverrides.set(g,k)})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,u){}serialize(){return this._options}setProperty(c,u){return!1}reload(){const c=Th(this.id,this.scope);this.map.style.clearSource(c),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(c){this.models=[];const u=new Map;for(const g in c){const v=c[g];if(this._modelsInfo.has(g)){const k=this._modelsInfo.get(g);k&&k.modelSpec.uri===v.uri&&u.set(g,k)}}this._modelsInfo=u,this._options.models=c,this._loaded=!1,this.load()}}function Ioe(f,c,u,g){const v=1<We.polygon).flat());const Ce=re?P:null,[Se,De]=Y1e(k,g,G,W,$,S,Ce,X,se,k.center.lat,f.tileID.canonical),Be=f.queryGeometry;return Z1e(Se,De,Be.isPointQuery()?Be.screenBounds:Be.screenGeometry)}},building:class extends td{constructor(f,c,u,g){super(f,{layout:_ve||(_ve=new $a({visibility:new Nr(Ft.layout_building.visibility),"building-facade":new Lr(Ft.layout_building["building-facade"]),"building-facade-floors":new Lr(Ft.layout_building["building-facade-floors"]),"building-facade-unit-width":new Lr(Ft.layout_building["building-facade-unit-width"]),"building-facade-window":new Lr(Ft.layout_building["building-facade-window"]),"building-roof-shape":new Lr(Ft.layout_building["building-roof-shape"]),"building-height":new Lr(Ft.layout_building["building-height"]),"building-base":new Lr(Ft.layout_building["building-base"]),"building-flood-light-wall-radius":new Lr(Ft.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Lr(Ft.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Lr(Ft.layout_building["building-flip-roof-orientation"])})),paint:bve||(bve=new $a({"building-opacity":new Nr(Ft.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Nr(Ft.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Nr(Ft.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Nr(Ft.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Nr(Ft.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Nr(Ft.paint_building["building-vertical-scale"]),"building-cast-shadows":new Nr(Ft.paint_building["building-cast-shadows"]),"building-color":new Lr(Ft.paint_building["building-color"]),"building-emissive-strength":new Lr(Ft.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Nr(Ft.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Nr(Ft.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Nr(Ft.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Nr(Ft.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Nr(Ft.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Lr({type:"string",default:"default","property-type":"data-driven"})}))},c,u,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new vve(f)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(f){return!0}queryRadius(f){return 0}queryIntersectsFeature(f,c,u,g,v,k,S,P,R){let $=this.layout.get("building-height").evaluate(c,u);const W=this.layout.get("building-base").evaluate(c,u),G=f.tile.getBucket(this).getFootprint(c);if(G){if(G.hiddenFlags!==0)return!1;$=G.height}const[X,re]=Y1e(k,g,W,$,new ir(0,0),S,null,[0,0],1,k.center.lat,f.tileID.canonical),se=f.queryGeometry;return Z1e(X,re,se.isPointQuery()?se.screenBounds:se.screenGeometry)}},line:class extends td{constructor(f,c,u,g){const v=Eve();super(f,v,c,u,g),v.layout&&(this.layout=new rx(v.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(f){if(f==="line-gradient"){const c=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=c._styleExpression&&c._styleExpression.expression instanceof Mv,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(f,c){super.recalculate(f,c),this.paint._values["line-floorwidth"]=(()=>{if(eM)return eM;const u=Eve();return eM=new Yqe(u.paint.properties["line-width"].specification),eM.useIntegerZoom=!0,eM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new ooe(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,u){const g=Tve(this);return{config:new Gm(this,{zoom:c,lut:u}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,u=Ive(yc("line-width",this,c),yc("line-gap-width",this,c)),g=yc("line-offset",this,c);return u/2+Math.abs(g)+zl(this.paint.get("line-translate"))}queryIntersectsFeature(f,c,u,g,v,k){if(f.queryGeometry.isAboveHorizon)return!1;const S=hu(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,f.pixelToTileUnitsFactor),P=f.pixelToTileUnitsFactor/2*Ive(this.paint.get("line-width").evaluate(c,u),this.paint.get("line-gap-width").evaluate(c,u)),R=this.paint.get("line-offset").evaluate(c,u);return R&&(g=function($,W){const G=[],X=new ir(0,0);for(let re=0;re<$.length;re++){const se=$[re],pe=[];for(let Ce=0;Ce=3){for(let se=0;se>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function mHe(f,c,u){f===1?(c.rgb_color=D6(u.readVarint()),c.paint="rgb_color"):f===2?(c.linear_gradient_idx=u.readVarint(),c.paint="linear_gradient_idx"):f===3?(c.radial_gradient_idx=u.readVarint(),c.paint="radial_gradient_idx"):f===5?u.readPackedFloat(c.dasharray):f===6?c.dashoffset=u.readFloat():f===7?c.miterlimit=u.readFloat():f===8?c.opacity=u.readVarint():f===9?c.width=u.readFloat():f===10?c.linecap=u.readVarint():f===11&&(c.linejoin=u.readVarint())}function gHe(f,c,u){f===1?c.transform=O6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(H_e(u,u.readVarint()+u.pos)):f===4?c.x1=u.readFloat():f===5?c.y1=u.readFloat():f===6?c.x2=u.readFloat():f===7&&(c.y2=u.readFloat())}function H_e(f,c){return f.readFields(xHe,{offset:0,opacity:255,rgb_color:Poe},c)}function xHe(f,c,u){f===1?c.offset=u.readFloat():f===2?c.opacity=u.readVarint():f===3&&(c.rgb_color=D6(u.readVarint()))}function yHe(f,c,u){f===1?c.transform=O6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(H_e(u,u.readVarint()+u.pos)):f===4?c.cx=u.readFloat():f===5?c.cy=u.readFloat():f===6?c.r=u.readFloat():f===7?c.fx=u.readFloat():f===8?c.fy=u.readFloat():f===9&&(c.fr=u.readFloat())}function vHe(f,c,u){f===1?c.transform=O6(u,u.readVarint()+u.pos):f===2?c.clip_path_idx=u.readVarint():f===3&&c.children.push(L6(u,u.readVarint()+u.pos))}function _He(f,c,u){f===1?c.left=c.top=u.readFloat():f===2?c.width=c.height=u.readFloat():f===3?c.top=u.readFloat():f===4?c.height=u.readFloat():f===5?c.mask_type=u.readVarint():f===6?c.mask_idx=u.readVarint():f===7&&c.children.push(L6(u,u.readVarint()+u.pos))}class bHe{static calculate(c={},u=[]){const g=new Map,v=new Map;if(Object.keys(c).length===0)return g;u.forEach(k=>{v.set(k.name,k.rgb_color||new ki(0,0,0))});for(const[k,S]of Object.entries(c))v.has(k)?g.set(v.get(k).toString(),S):console.warn(`Ignoring unknown image variable "${k}"`);return g}}function $N(f,c=255,u){const g=c/255,v=f.toString(),k=u.has(v)?u.get(v).clone():f.clone();return k.a*=g,k.toString()}function xM(f,c){if(!au()){const u=document.createElement("canvas");return u.width=f,u.height=c,u}return new OffscreenCanvas(f,c)}let Doe,yM=null;function Roe(f,c,u,g,v){for(const k of g.children)W_e(f,c,u,k,v)}function W_e(f,c,u,g,v){g.group?(f.save(),function(k,S,P,R,$){const W=R.mask_idx!=null?P.masks[R.mask_idx]:null,G=R.clip_path_idx!=null?P.clip_paths[R.clip_path_idx]:null;if(R.transform&&(S=UN(R.transform).preMultiplySelf(S)),!function(se,pe,Ce){return se.opacity!==255||pe||Ce}(R,G!=null,W!=null))return void Roe(k,S,P,R,$);const X=xM(k.canvas.width,k.canvas.height),re=X.getContext("2d");Roe(re,S,P,R,$),G&&J_e(re,S,P,G),W&&e2e(re,S,P,W,$),k.globalAlpha=R.opacity/255,k.drawImage(X,0,0)}(f,c,u,g.group,v),f.restore()):g.path&&(f.save(),function(k,S,P,R,$){k.setTransform(S),R.paint_order===nHe.PAINT_ORDER_FILL_AND_STROKE?(G_e(k,P,R,$),Z_e(k,P,R,$)):(Z_e(k,P,R,$),G_e(k,P,R,$))}(f,c,u,g.path,v),f.restore())}function G_e(f,c,u,g){const v=u.fill;if(!v)return;const k=v.opacity/255;switch(f.save(),f.beginPath(),t2e(u,f),v.paint){case"rgb_color":f.fillStyle=$N(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":{const S=c.linear_gradients[v.linear_gradient_idx];S.transform&&f.setTransform(UN(S.transform).preMultiplySelf(f.getTransform())),f.fillStyle=Y_e(f,S,k,g);break}case"radial_gradient_idx":{const S=c.radial_gradients[v.radial_gradient_idx];S.transform&&f.setTransform(UN(S.transform).preMultiplySelf(f.getTransform())),f.fillStyle=X_e(f,S,k,g)}}f.fill(K_e(u)),f.restore()}function K_e(f){return f.rule===Loe.PATH_RULE_NON_ZERO?"nonzero":f.rule===Loe.PATH_RULE_EVEN_ODD?"evenodd":void 0}function Z_e(f,c,u,g){const v=u.stroke;if(!v)return;const k=r2e(u);f.lineWidth=v.width,f.miterLimit=v.miterlimit,f.setLineDash(v.dasharray),f.lineDashOffset=v.dashoffset;const S=v.opacity/255;switch(v.paint){case"rgb_color":f.strokeStyle=$N(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=Y_e(f,c.linear_gradients[v.linear_gradient_idx],S,g,!0);break;case"radial_gradient_idx":f.strokeStyle=X_e(f,c.radial_gradients[v.radial_gradient_idx],S,g,!0)}switch(v.linejoin){case P6.LINE_JOIN_MITER_CLIP:case P6.LINE_JOIN_MITER:f.lineJoin="miter";break;case P6.LINE_JOIN_ROUND:f.lineJoin="round";break;case P6.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(v.linecap){case Ooe.LINE_CAP_BUTT:f.lineCap="butt";break;case Ooe.LINE_CAP_ROUND:f.lineCap="round";break;case Ooe.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(k)}function Y_e(f,c,u,g,v=!1){if(c.stops.length===1){const X=c.stops[0];return $N(X.rgb_color,X.opacity*u,g)}const{x1:k,y1:S,x2:P,y2:R}=c;let $=new DOMPoint(k,S),W=new DOMPoint(P,R);if(v){const X=UN(c.transform);$=X.transformPoint($),W=X.transformPoint(W)}const G=f.createLinearGradient($.x,$.y,W.x,W.y);for(const X of c.stops)G.addColorStop(X.offset,$N(X.rgb_color,X.opacity*u,g));return G}function X_e(f,c,u,g,v=!1){if(c.stops.length===1){const Se=c.stops[0];return $N(Se.rgb_color,Se.opacity*u,g)}const k=UN(c.transform),{fx:S,fy:P,fr:R,cx:$,cy:W,r:G}=c;let X=new DOMPoint(S,P),re=new DOMPoint($,W),se=R,pe=G;if(v){X=k.transformPoint(X),re=k.transformPoint(re);const Se=(k.a+k.d)/2;se=R*Se,pe=c.r*Se}const Ce=f.createRadialGradient(X.x,X.y,se,re.x,re.y,pe);for(const Se of c.stops)Ce.addColorStop(Se.offset,$N(Se.rgb_color,Se.opacity*u,g));return Ce}function Q_e(f,c,u,g){const v=g.transform?UN(g.transform).preMultiplySelf(c):c,k=xM(f.canvas.width,f.canvas.height),S=k.getContext("2d");for(const R of g.children)if(R.group)Q_e(S,v,u,R.group);else if(R.path){const $=R.path,W=new Path2D;W.addPath(r2e($),v),S.fill(W,K_e($))}const P=g.clip_path_idx!=null?u.clip_paths[g.clip_path_idx]:null;P&&J_e(S,v,u,P),f.globalCompositeOperation="source-over",f.drawImage(k,0,0)}function J_e(f,c,u,g){const v=xM(f.canvas.width,f.canvas.height);Q_e(v.getContext("2d"),c,u,g),f.globalCompositeOperation="destination-in",f.drawImage(v,0,0)}function e2e(f,c,u,g,v){if(g.children.length===0)return;const k=g.mask_idx!=null?u.masks[g.mask_idx]:null;k&&e2e(f,c,u,k,v);const S=f.canvas.width,P=f.canvas.height,R=xM(S,P),$=R.getContext("2d"),W=g.width,G=g.height,X=g.left,re=g.top,se=new Path2D,pe=new Path2D;pe.rect(X,re,W,G),se.addPath(pe,c),$.clip(se);for(const De of g.children)W_e($,c,u,De,v);const Ce=$.getImageData(0,0,S,P),Se=Ce.data;if(g.mask_type===U_e.MASK_TYPE_LUMINANCE)for(let De=0;Dec[S])return null}else{const P=1/g[S];let R=(f[S]-u[S])*P,$=(c[S]-u[S])*P;if(R>$){const W=R;R=$,$=W}if(R>v&&(v=R),$k)return null}return v}function i2e(f,c,u,g,v,k,S,P,R,$,W){const G=g-f,X=v-c,re=k-u,se=S-f,pe=P-c,Ce=R-u,Se=W[1]*Ce-W[2]*pe,De=W[2]*se-W[0]*Ce,Be=W[0]*pe-W[1]*se,We=G*Se+X*De+re*Be;if(Math.abs(We)<1e-15)return null;const dt=1/We,it=$[0]-f,gt=$[1]-c,St=$[2]-u,Tt=(it*Se+gt*De+St*Be)*dt;if(Tt<0||Tt>1)return null;const Kt=gt*re-St*X,Dt=St*G-it*re,tr=it*X-gt*G,or=(W[0]*Kt+W[1]*Dt+W[2]*tr)*dt;return or<0||Tt+or>1?null:(se*Kt+pe*Dt+Ce*tr)*dt}function a2e(f,c,u){return(f-c)/(u-c)}function o2e(f,c,u,g,v,k,S,P,R){const $=1<{const De=Ce?1:0,Be=(re+1)*pe-De,We=se*pe,dt=(se+1)*pe-De;Se[0]=re*pe,Se[1]=We,Se[2]=Be,Se[3]=dt};let G=new n2e(R);const X=[];for(let re=0;re=1;R/=2){const re=P[P.length-1];G=new n2e(R);for(let se=0;se0;){const{idx:se,t:pe,nodex:Ce,nodey:Se,depth:De}=re.pop();if(this.leaves[se]){o2e(Ce,Se,De,c,u,g,v,G,X);const We=1<=vr[2])return pe}continue}let Be=0;for(let We=0;We=$[W[St]]&&(W.splice(St,0,We),gt=!0);gt||(W[Be]=We),Be++}}for(let We=0;We=this.dim+1||u<-1||u>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(u+1)*this.stride+(c+1)}static pack(c,u){const g=[0,0,0,0],v=F6.getUnpackVector(u);let k=Math.floor((c+v[3])/v[2]);return g[2]=k%256,k=Math.floor(k/256),g[1]=k%256,k=Math.floor(k/256),g[0]=k,g}getPixels(){return new n1e({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,u,g){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let v=u*this.dim,k=u*this.dim+this.dim,S=g*this.dim,P=g*this.dim+this.dim;switch(u){case-1:v=k-1;break;case 1:k=v+1}switch(g){case-1:S=P-1;break;case 1:P=S+1}const R=-u*this.dim,$=-g*this.dim;for(let W=S;W=1;g--){const v=g===1?1:0,k=g===2?1:0;for(let S=0;S>>1^-(1&f[c]);return f}function OHe(f,c){switch(c){case"uint32":return f;case"uint16":for(let u=0;u>4|(61440&g)>>8|(240&v)<<4|61440&v,f[u+1]=15&g|(3840&g)>>4|(15&v)<<8|(3840&v)<<4}return f;case"uint8":for(let u=0;u>6|(192&v)>>4|(192&k)>>2|192&S,f[u+1]=(48&g)>>4|(48&v)>>2|48&k|(48&S)<<2,f[u+2]=(12&g)>>2|12&v|(12&k)<<2|(12&S)<<4,f[u+3]=3&g|(3&v)<<2|(3&k)<<4|(3&S)<<6}return f;default:throw new Error(`Invalid pixel format, "${c}"`)}}Qr(F6,"DEMData"),Qr(l2e,"DemMinMaxQuadTree",{omit:["dem"]});var Ph=Uint8Array,vM=Uint16Array,DHe=Int32Array,d2e=new Ph([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]),u2e=new Ph([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]),RHe=new Ph([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h2e=function(f,c){for(var u=new vM(31),g=0;g<31;++g)u[g]=c+=1<>1|(21845&al)<<1;m2e[al]=((65280&(qN=(61680&(qN=(52428&qN)>>2|(13107&qN)<<2))>>4|(3855&qN)<<4))>>8|(255&qN)<<8)>>1}var _M=function(f,c,u){for(var g=f.length,v=0,k=new vM(c);v>R]=$;return S},bM=new Ph(288);for(al=0;al<144;++al)bM[al]=8;for(al=144;al<256;++al)bM[al]=9;for(al=256;al<280;++al)bM[al]=7;for(al=280;al<288;++al)bM[al]=8;var g2e=new Ph(32);for(al=0;al<32;++al)g2e[al]=5;var BHe=_M(bM,9),$He=_M(g2e,5),zoe=function(f){for(var c=f[0],u=1;uc&&(c=f[u]);return c},Op=function(f,c,u){var g=c/8|0;return(f[g]|f[g+1]<<8)>>(7&c)&u},Boe=function(f,c){var u=c/8|0;return(f[u]|f[u+1]<<8|f[u+2]<<16)>>(7&c)},UHe=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Dp=function(f,c,u){var g=new Error(c||UHe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Dp),!u)throw g;return g},qHe=new Ph(0),VHe=typeof TextDecoder<"u"&&new TextDecoder;try{VHe.decode(qHe,{stream:!0})}catch{}const HHe={gzip_data:"gzip"};class jf extends Error{constructor(c){super(c),this.name="MRTError"}}const WHe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},x2e={uint32:1,uint16:2,uint8:4},GHe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let $oe;class z6{constructor(c=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=c}getLayer(c){const u=this.layers[c];if(!u)throw new jf(`Layer '${c}' not found`);return u}getHeaderLength(c){const u=new Uint8Array(c),g=new DataView(c);if(u[0]!==13)throw new jf("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(c){const u=new Uint8Array(c),g=this.getHeaderLength(c);if(u.length= ${g} but got buffer of length ${u.length}`);const v=new $oe(u.subarray(0,g)).readFields(NHe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==v.x||this.y!==v.y||this.z!==v.z))throw new jf(`Invalid attempt to parse header ${v.z}/${v.x}/${v.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=v.x,this.y=v.y,this.z=v.z;for(const k of v.layers)this.layers[k.name]=new y2e(k,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const u=[],g=this.getLayer(c.layerName);for(let v of c.blockIndices){const k=g.dataIndex[v],S=k.firstByte-c.firstByte,P=k.lastByte-c.firstByte;if(g._blocksInProgress.has(v))continue;const R={layerName:g.name,firstByte:S,lastByte:P,pixelFormat:g.pixelFormat,blockIndex:v,blockShape:[k.bands.length].concat(g.bandShape),buffer:g.buffer,codec:k.codec.codec,filters:k.filters.map($=>$.filter)};g._blocksInProgress.add(v),u.push(R)}return new v2e(u,()=>{u.forEach(v=>g._blocksInProgress.delete(v.blockIndex))},(v,k)=>{if(u.forEach(S=>g._blocksInProgress.delete(S.blockIndex)),v)throw v;k.forEach(S=>{this.getLayer(S.layerName).processDecodedData(S)})})}}class y2e{constructor({version:c,name:u,units:g,tileSize:v,pixelFormat:k,buffer:S,dataIndex:P},R){if(this.version=c,this.version!==1)throw new jf(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=u,this.units=g,this.tileSize=v,this.buffer=S,this.pixelFormat=WHe[k],this.dataIndex=P,this.bandShape=[v+2*S,v+2*S,x2e[this.pixelFormat]],this._decodedBlocks=new R6(R?R.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return x2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:c})=>c).flat()}processDecodedData(c){const u=c.blockIndex.toString();this._decodedBlocks.get(u)||this._decodedBlocks.put(u,c.data)}getBlockForBand(c){let u=0;switch(typeof c){case"string":for(const[g,v]of this.dataIndex.entries()){for(const[k,S]of v.bands.entries())if(S===c)return{bandIndex:u+k,blockIndex:g,blockBandIndex:k};u+=v.bands.length}break;case"number":for(const[g,v]of this.dataIndex.entries()){if(c>=u&&cthis.cacheSize)throw new jf(`Number of blocks to decode (${k.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:u,lastByte:g,blockIndices:v}}hasBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0}hasDataForBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0&&!!this._decodedBlocks.get(u.toString())}getBandView(c){const{blockIndex:u,blockBandIndex:g}=this.getBlockForBand(c);if(u<0)throw new jf(`Band not found: ${JSON.stringify(c)}`);const v=this._decodedBlocks.get(u.toString());if(!v)throw new jf(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const k=this.dataIndex[u],S=this.bandShape.reduce(($,W)=>$*W,1),P=g*S,R=v.subarray(P,P+S);return{data:R,bytes:new Uint8Array(R.buffer).subarray(R.byteOffset,R.byteOffset+R.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:k.offset,scale:k.scale}}}z6.setPbf=function(f){$oe=f};class v2e{constructor(c,u,g){this.tasks=c,this._onCancel=u,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,u){this._finalized||(this._onComplete(c,u),this._finalized=!0)}}z6.performDecoding=function(f,c){const u=new Uint8Array(f);return Promise.all(c.tasks.map(g=>{const{layerName:v,firstByte:k,lastByte:S,pixelFormat:P,blockShape:R,blockIndex:$,filters:W,codec:G}=g,X=u.subarray(k,S+1),re=new Uint32Array(R[0]*R[1]*R[2]);let se;if(G!=="gzip_data")throw new jf(`Unhandled codec: ${G}`);return se=function(pe,Ce){if(!globalThis.DecompressionStream&&Ce==="gzip_data")return Promise.resolve(((We=function(gt){gt[0]==31&>[1]==139&>[2]==8||Dp(6,"invalid gzip data");var St=gt[3],Tt=10;4&St&&(Tt+=2+(gt[10]|gt[11]<<8));for(var Kt=(St>>3&1)+(St>>4&1);Kt>0;Kt-=!gt[Tt++]);return Tt+(2&St)}(Be=pe))+8>Be.length&&Dp(6,"invalid gzip data"),function(gt,St,Tt,Kt){var Dt=gt.length;if(!Dt||St.f&&!St.l)return Tt||new Ph(0);var tr=!Tt,or=tr||St.i!=2,lr=St.i;tr&&(Tt=new Ph(3*Dt));var xr,vr,hr=function(Di){var hi=Tt.length;if(Di>hi){var yi=new Ph(Math.max(2*hi,Di));yi.set(Tt),Tt=yi}},pr=St.f||0,er=St.p||0,Yt=St.b||0,mr=St.l,Tr=St.d,jr=St.m,hn=St.n,Ur=8*Dt;do{if(!mr){pr=Op(gt,er,1);var Zr=Op(gt,er+1,3);if(er+=3,!Zr){var rn=gt[(nr=4+((er+7)/8|0))-4]|gt[nr-3]<<8,gs=nr+rn;if(gs>Dt){lr&&Dp(0);break}or&&hr(Yt+rn),Tt.set(gt.subarray(nr,gs),Yt),St.b=Yt+=rn,St.p=er=8*gs,St.f=pr;continue}if(Zr==1)mr=BHe,Tr=$He,jr=9,hn=5;else if(Zr==2){var kr=Op(gt,er,31)+257,sn=Op(gt,er+10,15)+4,qn=kr+Op(gt,er+5,31)+1;er+=14;for(var Os=new Ph(qn),qs=new Ph(19),rs=0;rs>4)<16)Os[rs++]=nr;else{var Dr=0,Rr=0;for(nr==16?(Rr=3+Op(gt,er,3),er+=2,Dr=Os[rs-1]):nr==17?(Rr=3+Op(gt,er,7),er+=3):nr==18&&(Rr=11+Op(gt,er,127),er+=7);Rr--;)Os[rs++]=Dr}}var fn=Os.subarray(0,kr),bn=Os.subarray(kr);jr=zoe(fn),hn=zoe(bn),mr=_M(fn,jr),Tr=_M(bn,hn)}else Dp(1);if(er>Ur){lr&&Dp(0);break}}or&&hr(Yt+131072);for(var Jn=(1<>4;if((er+=15&Dr)>Ur){lr&&Dp(0);break}if(Dr||Dp(2),Es<256)Tt[Yt++]=Es;else{if(Es==256){ms=er,mr=null;break}var Ln=Es-254;Es>264&&(Ln=Op(gt,er,(1<<(ai=d2e[rs=Es-257]))-1)+p2e[rs],er+=ai);var Un=Tr[Boe(gt,er)&cs],ti=Un>>4;if(Un||Dp(3),er+=15&Un,bn=zHe[ti],ti>3){var ai=u2e[ti];bn+=Boe(gt,er)&(1<Ur){lr&&Dp(0);break}or&&hr(Yt+131072);var oi=Yt+Ln;if(Ytxr.length)&&(vr=xr.length),new Ph(xr.subarray(0,vr))):Tt.subarray(0,Yt)}(Be.subarray(We,-8),{i:2},new Ph(((Se=Be)[(De=Se.length)-4]|Se[De-3]<<8|Se[De-2]<<16|Se[De-1]<<24)>>>0))));var Se,De,Be,We;const dt=HHe[Ce];if(!dt)throw new Error(`Unhandled codec: ${Ce}`);const it=new globalThis.DecompressionStream(dt);return new Response(new Blob([pe]).stream().pipeThrough(it)).arrayBuffer().then(gt=>new Uint8Array(gt))}(X,G).then(pe=>(function(Ce,Se){Ce.readFields(EHe,Se)}(new $oe(pe),re),new GHe[P](re.buffer))),se.then(pe=>{for(let Ce=W.length-1;Ce>=0;Ce--)switch(W[Ce]){case"delta_filter":PHe(pe,R);break;case"zigzag_filter":LHe(pe);break;case"bitshuffle_filter":OHe(pe,P);break;default:throw new jf(`Unhandled filter "${W[Ce]}"`)}return{layerName:v,blockIndex:$,data:pe}}).catch(pe=>{throw pe})}))},Qr(v2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Qr(z6,"MapboxRasterTile"),Qr(y2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class _2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let u=0;u=0&&X[3]>=0&&$.insert(R,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new zt(new m6(this.rawTileData)).layers,this.sourceLayerCoder=new _2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const c in this.vtLayers)this.vtFeatures[c]=[]}return this.vtLayers}query(c,u){const{tilespaceGeometry:g,transform:v,tileTransform:k,pixelPosMatrix:S,availableImages:P,worldview:R}=u;this.loadVTLayers(),this.serializedLayersCache.clear();const $=u.queryRadius?u.queryRadius:0,W=g.bufferedTilespaceBounds,G=this.grid.query(W.min.x,W.min.y,W.max.x,W.max.y,(pe,Ce,Se,De)=>rd(g.bufferedTilespaceGeometry,pe-$,Ce-$,Se+$,De+$));G.sort(KHe);let X=null;v.elevation&&G.length>0&&(X=BN.create(v.elevation,this.tileID));const re={};let se;for(let pe=0;pe(De||(De=wt(Be,this.tileID.canonical,k)),We.queryIntersectsFeature(g,Be,dt,De,this.z,v,S,X,it)))}return re}loadMatchingFeature(c,u,g,v,k,S){const{featureIndex:P,bucketIndex:R,sourceLayerIndex:$,layoutVertexArrayOffset:W}=u,G=this.bucketLayerIDs[R],X=g.layers,re=Object.keys(X);if(re.length&&!Xr(re,G))return;const se=g.sourceCache,pe=this.sourceLayerCoder.decode($),Ce=this.vtLayers[pe].feature(P),Se=this.getId(Ce,pe);for(let De=0;De`${P.key}: ${P.message}`).join(", ");return void Vr(`Failed to create expression for promoteId: ${S}`)}this.promoteIdExpression=k.value}g=this.promoteIdExpression.evaluate({zoom:0},c)}else g=c.properties[v];typeof g=="boolean"&&(g=Number(g))}return g}}function w2e(f,c,u,g,v){return Ut(f,(k,S)=>{const P=c instanceof rx?c.get(S):null;return P&&P.evaluate?P.evaluate(u,g,void 0,v):P})}function KHe(f,c){return c-f}Qr(b2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const j2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Uoe{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[u,g]=new Uint8Array(c,0,2);if(u!==219)throw new Error("Data does not appear to be in a KDBush format.");const v=g>>4;if(v!==1)throw new Error(`Got v${v} data when expected v1.`);const k=j2e[15&g];if(!k)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(c,2,1),[P]=new Uint32Array(c,4,1);return new Uoe(P,S,k,c)}constructor(c,u=64,g=Float64Array,v){if(isNaN(c)||c<0)throw new Error(`Unpexpected numItems value: ${c}.`);this.numItems=+c,this.nodeSize=Math.min(Math.max(+u,2),65535),this.ArrayType=g,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const k=j2e.indexOf(this.ArrayType),S=2*c*this.ArrayType.BYTES_PER_ELEMENT,P=c*this.IndexArrayType.BYTES_PER_ELEMENT,R=(8-P%8)%8;if(k<0)throw new Error(`Unexpected typed array class: ${g}.`);v&&v instanceof ArrayBuffer?(this.data=v,this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+P+R,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+S+P+R),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+P+R,2*c),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=u,new Uint32Array(this.data,4,1)[0]=c)}add(c,u){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=c,this.coords[this._pos++]=u,g}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return qoe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,u,g,v){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:S,nodeSize:P}=this,R=[0,k.length-1,0],$=[];for(;R.length;){const W=R.pop()||0,G=R.pop()||0,X=R.pop()||0;if(G-X<=P){for(let Ce=X;Ce<=G;Ce++){const Se=S[2*Ce],De=S[2*Ce+1];Se>=c&&Se<=g&&De>=u&&De<=v&&$.push(k[Ce])}continue}const re=X+G>>1,se=S[2*re],pe=S[2*re+1];se>=c&&se<=g&&pe>=u&&pe<=v&&$.push(k[re]),(W===0?c<=se:u<=pe)&&(R.push(X),R.push(re-1),R.push(1-W)),(W===0?g>=se:v>=pe)&&(R.push(re+1),R.push(G),R.push(1-W))}return $}within(c,u,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:k,nodeSize:S}=this,P=[0,v.length-1,0],R=[],$=g*g;for(;P.length;){const W=P.pop()||0,G=P.pop()||0,X=P.pop()||0;if(G-X<=S){for(let Ce=X;Ce<=G;Ce++)N2e(k[2*Ce],k[2*Ce+1],c,u)<=$&&R.push(v[Ce]);continue}const re=X+G>>1,se=k[2*re],pe=k[2*re+1];N2e(se,pe,c,u)<=$&&R.push(v[re]),(W===0?c-g<=se:u-g<=pe)&&(P.push(X),P.push(re-1),P.push(1-W)),(W===0?c+g>=se:u+g>=pe)&&(P.push(re+1),P.push(G),P.push(1-W))}return R}}function qoe(f,c,u,g,v,k){if(v-g<=u)return;const S=g+v>>1;k2e(f,c,S,g,v,k),qoe(f,c,u,g,S-1,1-k),qoe(f,c,u,S+1,v,1-k)}function k2e(f,c,u,g,v,k){for(;v>g;){if(v-g>600){const $=v-g+1,W=u-g+1,G=Math.log($),X=.5*Math.exp(2*G/3),re=.5*Math.sqrt(G*X*($-X)/$)*(W-$/2<0?-1:1);k2e(f,c,u,Math.max(g,Math.floor(u-W*X/$+re)),Math.min(v,Math.floor(u+($-W)*X/$+re)),k)}const S=c[2*u+k];let P=g,R=v;for(wM(f,c,g,u),c[2*v+k]>S&&wM(f,c,g,v);PS;)R--}c[2*g+k]===S?wM(f,c,g,R):(R++,wM(f,c,R,v)),R<=u&&(g=R+1),u<=R&&(v=R-1)}}function wM(f,c,u,g){Voe(f,u,g),Voe(c,2*u,2*g),Voe(c,2*u+1,2*g+1)}function Voe(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function N2e(f,c,u,g){const v=f-u,k=c-g;return v*v+k*k}a.$=_k,a.A=gp,a.B=Th,a.C=2,a.D=CN,a.E=Gg,a.F=nM,a.G=Xve,a.H=vk,a.I=Ic,a.J=EP,a.K=un,a.L=Ny,a.M=Vk,a.N=Pv,a.O=yP,a.P=ir,a.Q=Lv,a.R=Hg,a.S=eN,a.T=Qae,a.U=Um,a.V=E6,a.W=d5,a.X=Ay,a.Y=Ty,a.Z=Cv,a._=Jc,a.a=function(f){return Ms.API_CDN_URL_REGEX.test(f)},a.a$=ce,a.a0=$n,a.a1=Ku,a.a2=yf,a.a3=class extends E6{},a.a4=Hk,a.a5=xP,a.a6=Ft,a.a7=function(f){const c=f.value;return c?$n(c)?Toe(c,!0)?[]:[new E6(f.key,c,`invalid url "${c}"`)]:[new E6(f.key,c,`string expected, "${un(c)}" found`)]:[]},a.a8=CP,a.a9=$a,a.aA=je,a.aB=T,a.aC=jt,a.aD=gc,a.aE=qi,a.aF=B,a.aG=He,a.aH=function(f,c){const u={};for(let g=0;g{g(k,S)},c):g(k,S),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=u((k,S)=>{v.result=[k,S];for(const P of v.callbacks)this.scheduler?this.scheduler.add(()=>{P(k,S)},c):P(k,S);setTimeout(()=>delete this.entries[f],3e3)})),()=>{v.result||(v.callbacks=v.callbacks.filter(k=>k!==g),v.callbacks.length||(v.cancel(),delete this.entries[f]))}}},a.aL=function(f,c,u){const g=JSON.stringify(f.request);return f.data&&(this.deduped.entries[g]={result:[null,f.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:f.isSymbolTile,zoom:f.tileZoom},v=>{const k=Gu(f.request,(S,P,R)=>{S?v(S):P&&v(null,{rawData:P,vectorTile:u?void 0:new zt(new m6(P)),responseHeaders:new Map(R.entries())})});return()=>{k.cancel(),v()}},c)},a.aM=function(f){return f?{cacheControl:f.get("Cache-Control"),expires:f.get("Expires")}:{cacheControl:void 0,expires:void 0}},a.aN=Yc,a.aO=function(f){$d++,$d>Em&&(f.getActor().send("enforceCacheSizeLimit",up),$d=0)},a.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},a.aQ=Ra,a.aR=S_e,a.aS=I_e,a.aT=m,a.aU=N_e,a.aV=function(f,c){const u=document.createElement("video");u.muted=!0,u.onloadstart=function(){c(null,u)};for(let g=0;g{}}},a.aW=Q5,a.aX=s_,a.aY=Lt,a.aZ=oM,a.a_=Q,a.aa=Nr,a.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return Qn(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u),azimuthal:Fn(f.azimuthal,c.azimuthal,u),polar:Fn(f.polar,c.polar,u)}}},a.ac=Ji,a.ad=Jg,a.ae=qe,a.af=Ye,a.ag=ge,a.ah=Re,a.ai=rx,a.aj=Zy,a.ak=Fn,a.al=Mr,a.am=P3,a.an=ss,a.ao=ki,a.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([u,g]){const v=Qn([1,u,g]);return{x:v.x,y:v.y,z:v.z}}(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u)}}},a.aq=function(f,c,u=0,g=!0){const v=new ir(u,u),k=f.sub(v),S=c.add(v),P=[k,new ir(S.x,k.y),S,new ir(k.x,S.y)];return g&&P.push(k.clone()),P},a.ar=function(f,c){const u=[];for(let g=0;g1)return!1;const u=c.getSource().maxzoom,g=1<1)return c;const v=g.getSource().maxzoom,k=1<{const P=this.getAtTileOffset(f,v,k,S),R=g.upVector(f.canonical,v.x,v.y);return he(R,R,P*g.upVectorScale(f.canonical,c,u).metersToTile),R}}getForTilePoints(f,c,u,g){if(this.isUsingMockSource())return!1;const v=BN.create(this,f,g);return!!v&&(c.forEach(k=>{k[2]=this.exaggeration()*v.getElevationAt(k[0],k[1],u)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(f);if(!c||!c.dem)return null;const u=c.dem.tree,g=c.tileID,v=1<0&&(g+=(f[v]-0)*(f[v]-0)),c[v]<0&&(g+=(0-c[v])*(0-c[v]));return g},a.c0=S1e,a.c1=foe,a.c2=s_e,a.c3=boe,a.c4=Uoe,a.c5=he,a.c6=$e,a.c7=Et,a.c8=function(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R+v*P,f[1]=v*R-g*P,f[2]=k*R+S*P,f[3]=S*R-k*P,f},a.c9=vt,a.cA=ve,a.cB=ui,a.cC=dve,a.cD=Vi,a.cE=$0e,a.cF=function(f,c,u,g,v,k,S,P,R){if(R.name==="globe")return $0e(f,c,new Vi(u,g,v),!1);const $=oM({z:u,x:g,y:v},R);return new dn([(k+$.x/$.scale)*c,c*($.y/$.scale),S],[(k+$.x2/$.scale)*c,c*($.y2/$.scale),P])},a.cG=function(f,c,u){return f[0]=Math.min(c[0],u[0]),f[1]=Math.min(c[1],u[1]),f[2]=Math.min(c[2],u[2]),f[3]=Math.min(c[3],u[3]),f},a.cH=function(f,c,u){return f[0]=Math.max(c[0],u[0]),f[1]=Math.max(c[1],u[1]),f[2]=Math.max(c[2],u[2]),f[3]=Math.max(c[3],u[3]),f},a.cI=function(f){const c=Math.round((f+45+360)%360/90)%4;return Bd[c]},a.cJ=ue,a.cK=tt,a.cL=kN,a.cM=function(f){const c=A(new Float64Array(16));T(c,f.pixelMatrix,f.globeMatrix);const u=[0,eh,0],g=[0,th,0];return Ye(u,u,c),Ye(g,g,c),[u[0]>0&&u[0]<=f.width&&u[1]>0&&u[1]<=f.height&&!Tae(f,new m(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!Tae(f,new m(f.center.lat,-90))]},a.cN=function(f,c){const{scale:u}=f.tileTransform,g=u*Mr/(f.tileSize*Math.pow(2,c.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(v,k,S){var P=k[1],R=k[2],$=k[3],W=S[0],G=S[1];return v[0]=k[0]*W,v[1]=P*W,v[2]=R*G,v[3]=$*G,v}(new Float32Array(4),c.inverseAdjustmentMatrix,[g,g])},a.cO=c6,a.cP=le,a.cQ=cve,a.cR=function(f){const c=cve(f,!0);return x([],[c[0],c[1],c[4],c[5]])},a.cS=z,a.cT=$r,a.cU=F,a.cV=function(f){const{x:c,y:u}=f.point,{lng:g,lat:v}=f._center;return V0e(c,u,f.worldSize,g,v)},a.cW=Ie,a.cX=vo,a.cY=Ia,a.cZ=ec,a.c_=Ju,a.ca=Oa,a.cb=function(f,c){return f[0]=-c[0],f[1]=-c[1],f[2]=-c[2],f[3]=c[3],f},a.cc=ae,a.cd=function(f,c,u,g,v){var k=1/Math.tan(c/2);if(f[0]=k/u,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=k,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=-1,f[12]=0,f[13]=0,f[15]=0,v!=null&&v!==1/0){var S=1/(g-v);f[10]=(v+g)*S,f[14]=2*v*g*S}else f[10]=-1,f[14]=-2*g;return f},a.ce=function(f,c,u,g,v,k,S){var P=1/(c-u),R=1/(g-v),$=1/(k-S);return f[0]=-2*P,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*R,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*$,f[11]=0,f[12]=(c+u)*P,f[13]=(v+g)*R,f[14]=(S+k)*$,f[15]=1,f},a.cf=Y,a.cg=function(f,c,u){f[4*c+0]=u[0],f[4*c+1]=u[1],f[4*c+2]=u[2],f[4*c+3]=u[3]},a.ch=_N,a.ci=qv,a.cj=Uo,a.ck=bf,a.cl=Hv,a.cm=m_e,a.cn=function(){var f=new p(4);return p!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f},a.co=function(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R+k*P,f[1]=v*R+S*P,f[2]=g*-P+k*R,f[3]=v*-P+S*R,f},a.cp=function(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]&&f[3]===c[3]},a.cq=nt,a.cr=function(f){var c=f[0],u=f[1],g=f[2],v=f[3];return Math.sqrt(c*c+u*u+g*g+v*v)},a.cs=Jr,a.ct=mt,a.cu=_o,a.cv=3,a.cw=2,a.cx=7,a.cy=6,a.cz=Ee,a.d=function(f){return Ms.API_TILEJSON_REGEX.test(f)},a.d$=class{constructor(f,c,u,g){this.context=f,this.format=g,this.size=u,this.texture=f.gl.createTexture();const[v,k,S]=this.size,{gl:P}=f;P.bindTexture(P.TEXTURE_3D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&P.texImage3D(P.TEXTURE_3D,0,this.format,v,k,S,0,Yae(this.format),Xae(this.format),c.data)}bind(f,c){const{context:u}=this,{gl:g}=u;g.bindTexture(g.TEXTURE_3D,this.texture),f!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,f),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,f),this.minFilter=f),c!==this.wrapS&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_S,c),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_T,c),this.wrapS=c)}destroy(){const{gl:f}=this.context;f.deleteTexture(this.texture),this.texture=null}},a.d0=function(f){return f*f*f*f*f},a.d1=D,a.d2=45,a.d3=bN,a.d4=function(f,c,u){const g=Math.sqrt(f*f+c*c+u*u),v=g>0?Math.acos(u/g)*yo:0;let k=f!==0||c!==0?Math.atan2(-c,-f)*yo+90:0;return k<0&&(k+=360),[g,k,v]},a.d5=ie,a.d6=Qn,a.d7=Pe,a.d8=de,a.d9=dn,a.dA=function(f){return f({pluginStatus:ed,pluginURL:wp}),Qk.on("pluginStateChange",f),f},a.dB=Vv,a.dC=class extends Np{constructor(f){super(f),this.current=wN}set(f,c,u){if(this.fetchUniformLocation(f,c)){for(let g=0;g<9;g++)if(u[g]!==this.current[g]){this.current=u,this.gl.uniformMatrix3fv(this.location,!1,u);break}}}},a.dD=_r,a.dE=function(f,c,u){const g=Zy(u.zoom),v=f.style.map._antialias,k=f.terrain&&f.terrain.exaggeration()>0;return g===0&&!v&&!k},a.dF=function(f){const c=f.pixelsPerMeter,u=c/Y(1,f.center.lat),g=A(new Float64Array(16));return L(g,g,[f.point.x,f.point.y,0]),z(g,g,[u,u,c]),Float32Array.from(g)},a.dG=GP,a.dH=function(f){const c=ue-5;f=je(f,-c,c)/c*90;const u=Math.pow(Math.abs(Math.sin(ss(f))),3);return Math.round(u*(O5.length-1))},a.dI=function(f,c,u,g){const v=c.getNorth(),k=c.getSouth(),S=c.getWest(),P=c.getEast(),R=1<0){const se=180/g;j(re,re,[se/$+1,0,0,0,se/W+1,0,-.5*se/G,.5*se/X,1])}return re[2]=R,re[5]=f.x,re[8]=f.y,re},a.dJ=Ih,a.dK=function(f,c,u){const g=A(new Float64Array(16)),v=(c/(1<({u_matrix:new Hv(f),u_texsize:new bf(f),u_pixels_to_tile_units:new jN(f),u_device_pixel_ratio:new Uo(f),u_width_scale:new Uo(f),u_floor_width_scale:new Uo(f),u_image:new _N(f),u_units_to_pixels:new bf(f),u_tile_units_to_pixels:new Uo(f),u_alpha_discard_threshold:new Uo(f),u_trim_offset:new bf(f),u_trim_fade_range:new bf(f),u_trim_color:new bN(f),u_zbias_factor:new Uo(f),u_tile_to_meter:new Uo(f),u_ground_shadow_factor:new qv(f),u_pattern_transition:new Uo(f)}),a.dX=f=>({u_matrix:new Hv(f),u_pixels_to_tile_units:new jN(f),u_device_pixel_ratio:new Uo(f),u_width_scale:new Uo(f),u_floor_width_scale:new Uo(f),u_units_to_pixels:new bf(f),u_dash_image:new _N(f),u_gradient_image:new _N(f),u_image_height:new Uo(f),u_texsize:new bf(f),u_tile_units_to_pixels:new Uo(f),u_alpha_discard_threshold:new Uo(f),u_trim_offset:new bf(f),u_trim_fade_range:new bf(f),u_trim_color:new bN(f),u_zbias_factor:new Uo(f),u_tile_to_meter:new Uo(f),u_ground_shadow_factor:new qv(f)}),a.dY=f=>({u_camera_to_center_distance:new Uo(f),u_extrude_scale:new jN(f),u_device_pixel_ratio:new Uo(f),u_matrix:new Hv(f),u_inv_rot_matrix:new Hv(f),u_merc_center:new bf(f),u_tile_id:new qv(f),u_zoom_transition:new Uo(f),u_up_dir:new qv(f),u_emissive_strength:new Uo(f)}),a.dZ=uN,a.d_=iVe,a.da=ye,a.db=function(f){return[Math.pow(f[0],1/2.2),Math.pow(f[1],1/2.2),Math.pow(f[2],1/2.2)]},a.dc=lve,a.dd=soe,a.de=fve,a.df=Toe,a.dg=function(f,c){return f.readFields(sHe,{icons:[]},c)},a.dh=i6,a.di=DN,a.dj=yoe,a.dk=wy,a.dl=Rv,a.dm=Vu,a.dn=pk,a.dp=ar,a.dq=function(f){const c=f.indexOf(ix);return c>=0?f.slice(0,c):f},a.dr=function(f){return f.indexOf(ix)>=0},a.ds=function(f){const c=f.lastIndexOf(ix);return c>=0?f.slice(c+1):""},a.dt=function(f){const c=[],u=f.id;return u===void 0&&c.push({message:`layers.${u}: missing required property "id"`}),f.render===void 0&&c.push({message:`layers.${u}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&c.push({message:`layers.${u}: property "renderingMode" must be either "2d" or "3d"`}),c},a.du=function(f,c,u,g){return f.type==="custom"?new XVe(f,c):new rHe[f.type](f,c,u,g)},a.dv=gr,a.dw=function(f){const c=f.indexOf(ix);return c>=0?f.slice(c+1):""},a.dx=class extends n_{constructor(f,c){super(f._vectorTileFeature,f._z,f._x,f._y,f.id),f.state&&(this.state=Object.assign({},f.state)),this.target=c.target,this.namespace=c.namespace,c.properties&&(this.properties=c.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=f.source,this.sourceLayer=f.sourceLayer,this.layer=f.layer)}toJSON(){const f=super.toJSON();return f.target=this.target,f.namespace=this.namespace,f}},a.dy=Qk,a.dz=mp,a.e=Ms,a.e$=fe,a.e0=G0e,a.e1=(f,c,u,g,v,k)=>{const S=f.transform,P=S.projection.name==="globe";let R;if(k.paint.get("circle-pitch-alignment")==="map")if(P){const W=q0e(S.zoom,c.canonical)*S._pixelsPerMercatorPixel;R=Float32Array.from([W,0,0,W])}else R=S.calculatePixelsToTileUnitsMatrix(u);else R=new Float32Array([S.pixelsToGLUnits[0],0,0,S.pixelsToGLUnits[1]]);const $={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(S.projection),u_matrix:f.translatePosMatrix(c.projMatrix,u,k.paint.get("circle-translate"),k.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Bo.devicePixelRatio,u_extrude_scale:R,u_inv_rot_matrix:bUe,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:k.paint.get("circle-emissive-strength")};if(P){$.u_inv_rot_matrix=g,$.u_merc_center=v,$.u_tile_id=[c.canonical.x,c.canonical.y,1<{const W=f.transform,G=W.pitch<15?Sve(.07,.7,je((14-W.zoom)/5,0,1)):.07,X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Mve(f,c,u,g),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:W.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:v,u_width_scale:k,u_floor_width_scale:S,u_image:0,u_tile_units_to_pixels:Cve(c,W),u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:P,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:G,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:R,u_pattern_transition:$}},a.e5=(f,c,u,g,v,k,S,P,R,$)=>{const W=f.transform,G=W.calculatePixelsToTileUnitsMatrix(c),X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=W.pitch<15?Sve(.07,.7,je((14-W.zoom)/5,0,1)):.07;return{u_matrix:Mve(f,c,u,g),u_pixels_to_tile_units:G,u_device_pixel_ratio:k,u_width_scale:S,u_floor_width_scale:P,u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:Ave(u)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Cve(c,f.transform),u_alpha_discard_threshold:0,u_trim_offset:R,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:re,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:$}},a.e6=Bt,a.e7=R5,a.e8=oe,a.e9=nh,a.eA=function(f,c){var u=2*Math.acos(c[3]),g=Math.sin(u/2);return g>h?(f[0]=c[0]/g,f[1]=c[1]/g,f[2]=c[2]/g):(f[0]=1,f[1]=0,f[2]=0),u},a.eB=Ioe,a.eC=h6,a.eD=u6,a.eE=[1,1,1],a.eF=BN,a.eG=Je,a.eH=function(f,c,u,g){var v=c[0],k=c[1],S=c[2],P=c[3];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=S+g*(u[2]-S),f[3]=P+g*(u[3]-P),f},a.eI=EN,a.eJ=uu,a.eK=_f,a.eL=function(f,c,u,g,v,k,S,P,R,$,W,G,X,re,se,pe){var Ce=new p(16);return Ce[0]=f,Ce[1]=c,Ce[2]=u,Ce[3]=g,Ce[4]=v,Ce[5]=k,Ce[6]=S,Ce[7]=P,Ce[8]=R,Ce[9]=$,Ce[10]=W,Ce[11]=G,Ce[12]=X,Ce[13]=re,Ce[14]=se,Ce[15]=pe,Ce},a.eM=_,a.eN=qy,a.eO=N5,a.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ir(1/0,1/0),max:new ir(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(f,c=!1){const u=j1e(new ir(0,0),new ir(Mr,Mr),f),g=[];if(c&&!Fae(u,this._globalClipBounds))return g;for(const v of this._activeRegions){if(v.hiddenByOverlap||!Fae(u,v))continue;const k=YUe(v.min,v.max,f);g.push({min:k.min,max:k.max,sourceId:this._sourceIds[v.priority],footprint:v.footprint,footprintTileId:v.tileId,order:v.order,clipMask:v.clipMask,clipScope:v.clipScope})}return g}setSources(f){this._setSources(f.map(c=>({getSourceId:()=>c.cache.id,getFootprints:()=>{const u=[];for(const g of c.cache.getVisibleCoordinates()){const v=c.cache.getTile(g).buckets[c.layer];v&&v.updateFootprints(g.toUnwrapped(),u)}return u},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(f){const c=f.getFootprints();if(c.length===0)return;const u=f.getOrder(),g=f.getClipMask(),v=f.getClipScope();for(const k of c){if(!k.footprint)continue;const S=j1e(k.footprint.min,k.footprint.max,k.id);this._activeRegions.push({min:S.min,max:S.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:k.id,footprint:k.footprint,order:u,clipMask:g,clipScope:v})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,u)=>c.priority-u.priority||e6(c.min,u.min)||e6(c.max,u.max)||c.order-u.order||c.clipMask-u.clipMask||function(g,v){const k=(S,P)=>S+P;return g.length-v.length||g.reduce(k,"").localeCompare(v.reduce(k,""))}(c.clipScope,u.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let c=0;for(;!f&&c!==this._activeRegions.length;){const u=this._activeRegions[c],g=this._prevRegions[c];f=u.priority!==g.priority||!w1e(u,g)||u.order!==g.order||u.clipMask!==g.clipMask||!xo(u.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const u of this._activeRegions)u.order!==q5&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,u.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,u.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,u.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,u.max.y));const c=u=>{const g=this._activeRegions;if(u>=g.length)return u;const v=g[u].priority;for(;u1){let u=0,g=c(u);for(;u!==g;){let v=u;const k=u;for(;v!==g;){const S=this._activeRegions[v];S.hiddenByOverlap=!1;for(let P=0;P=0;c--)this._addSource(f[c]);this._computeReplacement()}},a.eQ=q5,a.eR=class{constructor(f){this._createGrid(f),this._createPoles(f)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const f of this._poleSegments)f.destroy();for(const f of this._gridSegments)f.withSkirts.destroy(),f.withoutSkirts.destroy()}_fillGridMeshWithLods(f,c){const u=new Vm,g=new $o,v=[],k=f+1+2,S=c[0]+1,P=c[0]+1+(1+c.length),R=($,W,G)=>{let X=$===k-1?$-2:$===0?$:$-1;return X+=G?24575:0,[X,W]};for(let $=0;$0?(Ce=2*Math.sqrt(pe+1),f[3]=.25*Ce,f[0]=(G-re)/Ce,f[1]=(X-R)/Ce,f[2]=(P-$)/Ce):S>W&&S>se?(Ce=2*Math.sqrt(1+S-W-se),f[3]=(G-re)/Ce,f[0]=.25*Ce,f[1]=(P+$)/Ce,f[2]=(X+R)/Ce):W>se?(Ce=2*Math.sqrt(1+W-S-se),f[3]=(X-R)/Ce,f[0]=(P+$)/Ce,f[1]=.25*Ce,f[2]=(G+re)/Ce):(Ce=2*Math.sqrt(1+se-S-W),f[3]=(P-$)/Ce,f[0]=(X+R)/Ce,f[1]=(G+re)/Ce,f[2]=.25*Ce),f},a.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(c,u)=>String.fromCharCode(+("0x"+u))))},a.f0=function([f,c,u]){const g=Math.hypot(f,c,u),v=Math.atan2(f,u),k=.5*Math.PI-Math.acos(-c/g);return new m(vo(v),vo(k))},a.f1=ft,a.f2=Jae,a.f3=function(f){const c=f.navigator?f.navigator.userAgent:null;return!!function(u){if(Za==null){const g=u.navigator?u.navigator.userAgent:null;Za=!!u.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return Za}(f)&&!(!c||!(c.match("Version/15.4")||c.match("Version/15.5")||c.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},a.f4=function(f,c){up=f,Em=c},a.f5=Tae,a.f6=H0e,a.f7=function(f){const c=[0,0,0],u=A(new Float64Array(16));return T(u,f.pixelMatrix,f.globeMatrix),Ye(c,c,u),new ir(c[0],c[1])},a.f8=function(){const f=Z5;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Vae),Z5=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},a.f9=function(){i6().acquire(Vae)},a.fA=F6,a.fB=Pt,a.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==nve){const u=new Uint32Array(f,0,7),[,,g,v,k,S]=u;c=u.byteLength+v+k+S+k,(g!==f.byteLength||c>=f.byteLength)&&Vr("Invalid b3dm header information.")}return ove(f,c)},a.fD=function(f,c){const u=soe(f);for(const g of u){for(const v of g.meshes)Cqe(v);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(Mqe(g.lights,c)))}return u},a.fE=I6,a.fF=Bs,a.fG=Q1e,a.fH=jp,a.fI=Ud,a.fJ=function(f){bd(),Hu!=null&&Hu.then(c=>{c.keys().then(u=>{for(let g=0;gVr(v.message))}).catch(u=>Vr(u.message))}).catch(c=>Vr(c.message))},a.fa=Fv,a.fb=function(f,c,u=!1){if(ed===Ud.deferred||ed===Ud.loading||ed===Ud.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");wp=Bo.resolveURL(f),ed=Ud.deferred,p5=c,Xk(),u||SP()},a.fc=function(f){MN=Bo.resolveURL(f),TN||(TN=new CN(i6(),new Gg)),TN.broadcast("setMeshoptUrl",MN)},a.fd=tve,a.fe=function(f){Gae=Bo.resolveURL(f),TN||(TN=new CN(i6(),new Gg)),TN.broadcast("setDracoUrl",Gae)},a.ff=eve,a.fg=K5,a.fh=function(f){const c=Zc();if(!c)return;const u=c.delete(Jl);f&&u.then(()=>f()).catch(f)},a.fi=Qv,a.fj=Qr,a.fk=Yy,a.fl=Lp,a.fm=_2e,a.fn=b2e,a.fo=wve,a.fp=Xt,a.fq="hd_road_elevation",a.fr=gi,a.fs=Ut,a.ft=cx,a.fu=xoe,a.fv=t_,a.fw=function(f,c,u,g,v,k,S,P=1,R,$,W){f.createArrays(),f.tilePixelRatio=Mr/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const G=f.layers[0].layout,X=f.layers[0]._unevaluatedLayout._values,re={};re.scaleFactor=P,re.textSizeScaleRange=G.get("text-size-scale-range"),re.iconSizeScaleRange=G.get("icon-size-scale-range");const[se,pe]=re.textSizeScaleRange,[Ce,Se]=re.iconSizeScaleRange;re.textScaleFactor=je(re.scaleFactor,se,pe),re.iconScaleFactor=je(re.scaleFactor,Ce,Se);const De=X["text-size"],Be=X["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Tt,maxZoom:Kt}=f.textSizeData;re.compositeTextSizes=[De.possiblyEvaluate(new Ji(Tt,{worldview:W}),k),De.possiblyEvaluate(new Ji(Kt,{worldview:W}),k)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Tt,maxZoom:Kt}=f.iconSizeData;re.compositeIconSizes=[Be.possiblyEvaluate(new Ji(Tt,{worldview:W}),k),Be.possiblyEvaluate(new Ji(Kt,{worldview:W}),k)]}re.layoutTextSize=De.possiblyEvaluate(new Ji(S+1,{worldview:W}),k),re.layoutIconSize=Be.possiblyEvaluate(new Ji(S+1,{worldview:W}),k),re.textMaxSize=De.possiblyEvaluate(new Ji(18,{worldview:W}),k);const We=G.get("symbol-placement"),dt=G.get("text-rotation-alignment")==="map"&&We!=="point",it=G.get("text-size");let gt=!1;const St=[];for(const Tt of f.features){const Kt=G.get("text-font").evaluate(Tt,{},k).join(","),Dt=it.evaluate(Tt,{},k)*re.textScaleFactor,tr=re.layoutTextSize.evaluate(Tt,{},k)*re.textScaleFactor,or=re.layoutIconSize.evaluate(Tt,{},k)*re.iconScaleFactor,lr={horizontal:{},vertical:void 0},xr=Tt.text;let vr,hr=[0,0];if(xr){const rs=xr.toString(),Oi=G.get("text-letter-spacing").evaluate(Tt,{},k)*xl,ot=G.get("text-line-height").evaluate(Tt,{},k)*xl,ut=h5(rs)?Oi:0,nr=G.get("text-anchor").evaluate(Tt,{},k),yr=G.get("text-variable-anchor");if(!yr){const Jn=G.get("text-radial-offset").evaluate(Tt,{},k);if(Jn)hr=s_e(nr,[Jn*xl,_oe]);else{const cs=G.get("text-offset").evaluate(Tt,{},k);hr=[cs[0]*xl,cs[1]*xl]}}let Dr=dt?"center":G.get("text-justify").evaluate(Tt,{},k);const Rr=We==="point",fn=Rr?G.get("text-max-width").evaluate(Tt,{},k)*xl:1/0,bn=Jn=>{f.allowVerticalPlacement&&Dv(rs)&&(lr.vertical=hoe(xr,c,u,v,Kt,fn,ot,nr,Jn,ut,hr,pu.vertical,!0,tr,Dt,R))};if(!dt&&yr){const Jn=Dr==="auto"?yr.map(ms=>boe(ms)):[Dr];let cs=!1;for(let ms=0;ms=0||!Dv(rs)){const Jn=hoe(xr,c,u,v,Kt,fn,ot,nr,Dr,ut,hr,pu.horizontal,!1,tr,Dt,R);Jn&&(lr.horizontal[Dr]=Jn)}bn(Rr?"left":Dr)}}let pr,er,Yt,mr,Tr,jr,hn=!1;const Ur=G.get("icon-text-fit").evaluate(Tt,{},k);if(Tt.icon&&Tt.icon.hasPrimary()){const rs=iM(Tt.icon,f.iconSizeData,X["icon-size"],k,f.zoom,Tt,R,re.iconScaleFactor,W);pr=rs.iconPrimary,Yt=rs.iconSecondary;const Oi=pr.toString();if(er=g.get(Oi),er&&(Tr=G.get("icon-offset").evaluate(Tt,{},k),jr=G.get("icon-anchor").evaluate(Tt,{},k),vr=x6(v.get(Oi),Yt?v.get(Yt.toString()):void 0,Tr,jr),hn=er.sdf,f.sdfIcons===void 0?f.sdfIcons=er.sdf:f.sdfIcons!==er.sdf&&Vr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(er.pixelRatio!==f.pixelRatio||G.get("icon-rotate").constantOr(1)!==0)&&(f.iconsNeedLinear=!0)),Yt){const ot=Yt.toString();mr=g.get(ot)}}gt=gt||!(!Tt.icon||!Tt.icon.hasSecondary());const Zr=w6(lr.horizontal)||lr.vertical;f.iconsInText||(f.iconsInText=!!Zr&&Zr.iconsInText);const rn=tr*re.textScaleFactor/xl,{defaultShapedIcon:gs,verticallyShapedIcon:kr}=DVe(f,vr,G,Tt,k,lr,rn,Tr,Ur);Ur!=="none"&&vr&&(qve(vr)||Vve(vr))&&(b6(0,er,pr,vr,gs,Ur,$,g,v),b6(0,mr,Yt,vr,gs,Ur,$,g,v),kr&&(b6(0,er,pr,vr,kr,Ur,$,g,v),b6(0,mr,Yt,vr,kr,Ur,$,g,v))),vr=gs;const{iconBBox:sn,iconVerticalBBox:qn,textBBox:Os,textVerticalBBox:qs}=EVe(f,vr,kr,G,Tt,k,or,Tr,re,v,jr,lr,tr,hr);St.push({feature:Tt,shapedTextOrientations:lr,shapedText:Zr,shapedIcon:vr,iconPrimary:pr,iconSecondary:Yt,iconOffset:Tr,iconAnchor:jr,verticallyShapedIcon:kr,layoutTextSize:tr,layoutIconSize:or,textOffset:hr,isSDFIcon:hn,iconTextFit:Ur,iconCollisionBounds:sn,iconVerticalCollisionBounds:qn,textCollisionBounds:Os,textVerticalCollisionBounds:qs})}return{featureData:St,sizes:re,hasAnySecondaryIcon:gt,textAlongLine:dt,symbolPlacement:We}},a.fx=Qve,a.fy=function(f,c,u,g,v,k,S,P,R,$){f.iconAtlasPositions=$.iconPositions;const{featureData:W,hasAnySecondaryIcon:G,sizes:X,textAlongLine:re,symbolPlacement:se}=c;for(const pe of W){const{shapedIcon:Ce,verticallyShapedIcon:Se,feature:De,shapedTextOrientations:Be,shapedText:We,layoutTextSize:dt,textOffset:it,isSDFIcon:gt,iconPrimary:St,iconSecondary:Tt,iconTextFit:Kt,iconOffset:Dt,iconCollisionBounds:tr,iconVerticalCollisionBounds:or,textCollisionBounds:lr}=pe;a_e(Ce,$.iconPositions,St,Tt),a_e(Se,$.iconPositions,St,Tt),OVe(Be,$.iconPositions),LVe(St,Tt,$.iconPositions),(We||Ce)&&RVe(f,De,Be,Ce,Se,R,X,dt,0,it,gt,g,v,S,P,G,Kt,Dt,re,se,tr,or,lr)}u&&f.generateCollisionDebugBuffers(k,f.collisionBoxArray,X.textScaleFactor)},a.fz=zt,a.g=function(f,c){return mp(Object.assign(f,{method:"GET"}),c)},a.h=function(f){return f.indexOf("mapbox:")===0},a.i=function(f){return Ms.API_STYLE_REGEX.test(f)&&!Nl(f)},a.j=Ba,a.k=ou,a.l=function(f){return decodeURIComponent(atob(f).split("").map(c=>"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)).join(""))},a.m=function(f,c){return mp(Object.assign(f,{type:"json"}),c)},a.n=ws,a.o=Bo,a.p=function(f,c){return mp(Object.assign(f,{method:"POST"}),c)},a.q=vc,a.r=au,a.s=function(f){try{const c=self[f];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}},a.t=function(){return Hae||(Hae=new Qv("ImageRasterizer")),Hae},a.u=function(){return function f(c){return c?(c^Math.random()*(16>>c/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,f)}()},a.v=function(f){return!!f&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(f)},a.w=Vr,a.x=Foe,a.y=gv,a.z=hf}),o(["./shared"],function(a){function h(kt){const je=kt?kt.url.toString():void 0;return je?performance.getEntriesByName(je):[]}function p(kt){if(typeof kt=="number"||typeof kt=="boolean"||typeof kt=="string"||kt==null)return JSON.stringify(kt);if(Array.isArray(kt)){let Re="[";for(const Ke of kt)Re+=`${p(Ke)},`;return`${Re}]`}let je="{";for(const Re of Object.keys(kt).sort())je+=`${Re}:${p(kt[Re])},`;return`${je}}`}function x(kt){let je="";for(const Re of a.bx)je+=`/${p(kt[Re])}`;return je}class y{constructor(je){this.keyCache={},this._layers={},this._layerConfigs={},je&&this.replace(je)}replace(je,Re){this._layerConfigs={},this._layers={},this.update(je,[],Re)}update(je,Re,Ke){this._options=Ke;for(const yt of je)this._layerConfigs[yt.id]=yt,(this._layers[yt.id]=a.du(yt,this.scope,null,this._options)).compileFilter(Ke),this.keyCache[yt.id]&&delete this.keyCache[yt.id];for(const yt of Re)delete this.keyCache[yt],delete this._layerConfigs[yt],delete this._layers[yt];this.familiesBySource={};const bt=function(yt,At){const Bt={};for(let Ut=0;Utthis._layers[Xr.id]),Bt=At[0];if(Bt.visibility==="none")continue;const Lt=Bt.source||"";let Ut=this.familiesBySource[Lt];Ut||(Ut=this.familiesBySource[Lt]={});const gr=Bt.sourceLayer||"_geojsonTileLayer";let ar=Ut[gr];ar||(ar=Ut[gr]=[]),ar.push(At)}}}const b=1*a.fl;class j{constructor(je){const Re={},Ke=[];for(const Bt in je){const Lt=je[Bt],Ut=Re[Bt]={};for(const gr in Lt.glyphs){const ar=Lt.glyphs[+gr];if(!ar||ar.bitmap.width===0||ar.bitmap.height===0)continue;const Xr=ar.metrics.localGlyph?b:1,tn={x:0,y:0,w:ar.bitmap.width+2*Xr,h:ar.bitmap.height+2*Xr};Ke.push(tn),Ut[gr]=tn}}const{w:bt,h:yt}=a.G(Ke),At=new a.fk({width:bt||1,height:yt||1});for(const Bt in je){const Lt=je[Bt];for(const Ut in Lt.glyphs){const gr=Lt.glyphs[+Ut];if(!gr||gr.bitmap.width===0||gr.bitmap.height===0)continue;const ar=Re[Bt][Ut],Xr=gr.metrics.localGlyph?b:1;a.fk.copy(gr.bitmap,At,{x:0,y:0},{x:ar.x+Xr,y:ar.y+Xr},gr.bitmap)}}this.image=At,this.positions=Re}}function N(kt,je,Re){kt[je]?Re&&(kt[je].center=Re):kt[je]={floorIds:new Set,center:Re||[0,0],floors:{}}}function C(kt,je,Re,Ke){for(const bt of je)N(kt,bt),kt[bt].floors[Re]=Ke,kt[bt].floorIds.add(Re)}function A(kt){return{id:kt.properties.id.toString(),center:kt.properties.center.toString().split(";").map(Number)}}function E(kt){return{id:kt.properties.id.toString(),isDefault:!!kt.properties.is_default&&kt.properties.is_default,connections:kt.properties.connected_floor_ids?new Set(kt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:kt.properties.conflicted_floor_ids?new Set(kt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:kt.properties.building_ids?new Set(kt.properties.building_ids.toString().split(";")):new Set,name:kt.properties.name.toString(),zIndex:kt.properties.z_index}}function T(kt,je){return je.every(Re=>kt.properties&&kt.properties[Re]!=null)}function L(kt){return T(kt,["type","id","name"])&&kt.properties.type==="building"}function z(kt){return T(kt,["type","id","name","z_index"])&&kt.properties.type==="floor"}a.fj(j,"GlyphAtlas");class F{constructor(je){this.tileID=new a.aQ(je.tileID.overscaledZ,je.tileID.wrap,je.tileID.canonical.z,je.tileID.canonical.x,je.tileID.canonical.y),this.tileZoom=je.tileZoom,this.uid=je.uid,this.zoom=je.zoom,this.lut=je.lut,this.canonical=je.tileID.canonical,this.pixelRatio=je.pixelRatio,this.tileSize=je.tileSize,this.source=je.source,this.scope=je.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=je.showCollisionBoxes,this.collectResourceTiming=!!je.request&&je.request.collectResourceTiming,this.promoteId=je.promoteId,this.isSymbolTile=je.isSymbolTile,this.tileTransform=a.aZ(je.tileID.canonical,je.projection),this.projection=je.projection,this.worldview=je.worldview,this.localizableLayerIds=je.localizableLayerIds,this.brightness=je.brightness,this.extraShadowCaster=!!je.extraShadowCaster,this.tessellationStep=je.tessellationStep,this.scaleFactor=je.scaleFactor,this.worldview=je.worldview,this.indoor=je.indoor}parse(je,Re,Ke,bt,yt,At){this.status="parsing",this.data=je,this.collisionBoxArray=new a.b3;const Bt=new a.fm(Object.keys(je.layers).sort()),Lt=new a.fn(this.tileID,this.promoteId);Lt.bucketLayerIDs=[];const Ut={},gr=new a.fo(256,256),ar={featureIndex:Lt,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:gr,availableImages:Ke,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const ts=this.indoor.indoorState.activeFloorsVisible,Xn=function(Qn,Bs,Ta){const Za=function(wa,Ks){if(!wa)return a.w("No source layers defined in indoor specification"),Ks;if(wa.size===0)return Ks;const ma=wa.difference(Ks);for(const zi of ma)a.w(`Missing source layer required in indoor specification: ${zi}`);return Ks.intersection(Ks)}(Bs.sourceLayers,new Set(Object.keys(Qn.layers))),Oa=Bs.indoorState,fo=function(wa,Ks,ma,zi){const Ms=new Set,Ba=new Set,Nl=new Set,Fl=new Map,Ac={},dp=nl=>{const _d=Fl.get(nl)||new Set;for(const sl of Ms)if((Fl.get(sl)||new Set).has(nl)||_d.has(sl))return!0;return!1};for(const nl of Ks){const _d=wa.layers[nl];if(_d)for(let sl=0;sl<_d.length;sl++){const au=_d.feature(sl);if(L(au)){const{id:Bo,center:uf}=A(au);N(Ac,Bo,uf),Ms.add(Bo)}else if(z(au)){const{id:Bo,isDefault:uf,connections:Vu,conflicts:Jl,buildings:up,name:Em,zIndex:Kc}=E(au);C(Ac,up,Bo,{name:Em,zIndex:Kc}),Fl.set(Bo,Jl),(Bo===zi||Vu.has(zi))&&Ms.add(Bo),Ba.add(Bo),uf&&Nl.add(Bo)}}else a.w(`indoor source layer not found: ${nl}`)}if(ma)for(const nl of ma)Ba.has(nl)&&(dp(nl)||Ms.add(nl));for(const nl of Nl)Ms.has(nl)||dp(nl)||Ms.add(nl);return{buildings:Ac,activeFloors:Ms}}(Qn,Za,Oa.lastActiveFloors,Oa.selectedFloorId);return Ta.send("setIndoorData",fo),fo}(je,this.indoor,yt);ar.activeFloors=ts?Xn.activeFloors:void 0}const Xr=[],tn=Re.familiesBySource[this.source];for(const ts in tn){const Xn=je.layers[ts];if(!Xn)continue;let Qn=!1,Bs=!1,Ta=!1;for(const Ks of tn[ts])Ks[0].type==="symbol"?Qn=!0:Bs=!0,Ks[0].is3D()&&Ks[0].type!=="model"&&(Ta=!0);if(this.extraShadowCaster&&!Ta||this.isSymbolTile===!0&&!Qn||this.isSymbolTile===!1&&!Bs)continue;Xn.version===1&&a.w(`Vector tile source "${this.source}" layer "${ts}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Za=Bt.encode(ts),Oa=[],fo=this.localizableLayerIds&&this.localizableLayerIds.has(ts);let wa=!1;for(let Ks=0,ma=0;Ks=ma.maxzoom||ma.visibility==="none")continue;q(Ks,this.zoom,ar.brightness,Ke,this.worldview);const zi=Ut[ma.id]=ma.createBucket({index:Lt.bucketLayerIDs.length,layers:Ks,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Za,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:bt,worldview:this.worldview,localizable:fo});Lt.bucketLayerIDs.push(Ks.map(Ba=>a.B(Ba.id,Ba.scope)));let Ms=zi.prepare?zi.prepare():null;Ms!=null?(Ms=Ms.then(()=>zi.populate(Oa,ar,this.tileID.canonical,this.tileTransform)),Xr.push(Ms)):zi.populate(Oa,ar,this.tileID.canonical,this.tileTransform)}}const Vr=()=>{let ts,Xn,Qn,Bs,Ta,Za;gr.trim();const Oa={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},fo=()=>{if(ts)return this.status="done",At(ts);if(this.extraShadowCaster)this.status="done",At(null,{buckets:Object.values(Ut).filter(Ks=>!Ks.isEmpty()),featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ar.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Xn&&Qn&&Bs){const Ks=new j(Xn),ma=new Map;for(const[Ba,Nl]of Qn.entries()){const{imagePosition:Fl}=a.fu(Ba,Nl,a.fv);ma.set(Ba,Fl)}const zi={};for(const Ba in Ut){const Nl=Ut[Ba];Nl instanceof a.b4&&(q(Nl.layers,this.zoom,ar.brightness,Ke,this.worldview),zi[Ba]=a.fw(Nl,Xn,Ks.positions,Qn,ma,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Ta,this.worldview))}const Ms={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(yt,Qn,Ta,()=>{Ms.iconsPending=!1,wa(zi,Ks,Ms)}),this.rasterizeIfNeeded(yt,Bs,Za,()=>{Ms.patternsPending=!1,wa(zi,Ks,Ms)})}},wa=(Ks,ma,zi,Ms)=>{if(zi.iconsPending||zi.patternsPending)return;const Ba=new a.fx(Qn,Bs,this.lut);for(const Nl in Ut){const Fl=Ut[Nl];if(Nl in Ks)a.fy(Fl,Ks[Nl],this.showCollisionBoxes,Ke,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Qn,Ba);else if(Fl.hasPattern&&(Fl instanceof a.ba||Fl instanceof a.bb||Fl instanceof a.ea)){q(Fl.layers,this.zoom,ar.brightness,Ke,this.worldview);const Ac=Object.fromEntries(Ba.patternPositions);Fl.addFeatures(ar,this.tileID.canonical,Ac,Ke,this.tileTransform,this.brightness)}}this.status="done",At(null,{buckets:Object.values(Ut).filter(Nl=>!Nl.isEmpty()),featureIndex:Lt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ma.image,lineAtlas:gr,imageAtlas:Ba,brightness:ar.brightness})};if(!this.extraShadowCaster){const Ks=a.fs(ar.glyphDependencies,Ms=>Object.keys(Ms).map(Number));Object.keys(Ks).length?yt.send("getGlyphs",{uid:this.uid,stacks:Ks},(Ms,Ba)=>{ts||(ts=Ms,Xn=Ba,fo())},void 0,!1,Oa):Xn={};const ma=Array.from(ar.iconDependencies.keys()).map(Ms=>a.I.parse(Ms));ma.length?yt.send("getImages",{images:ma,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ms,Ba)=>{ts||(ts=Ms,Qn=new Map,Ta=this.updateImageMapAndGetImageTaskQueue(Qn,Ba,ar.iconDependencies),fo())},void 0,!1,Oa):(Qn=new Map,Ta=new Map);const zi=Array.from(ar.patternDependencies.keys()).map(Ms=>a.I.parse(Ms));zi.length?yt.send("getImages",{images:zi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ms,Ba)=>{ts||(ts=Ms,Bs=new Map,Za=this.updateImageMapAndGetImageTaskQueue(Bs,Ba,ar.patternDependencies),fo())},void 0,!1,Oa):(Bs=new Map,Za=new Map)}if(ar.elevationFeatures&&ar.elevationFeatures.length>0){const Ks=[];for(const zi of Object.values(Ut))if(zi instanceof a.bb){const Ms=zi.getUnevaluatedPortalGraph();Ms&&Ks.push(Ms)}const ma=a.ft.evaluate(Ks);for(const zi of Object.values(Ut))if(zi instanceof a.bb){const Ms=je.layers[Bt.decode(zi.sourceLayerIndex)];zi.setEvaluatedPortalGraph(ma,Ms,this.tileID.canonical,ar.availableImages,ar.brightness)}}fo()};Xr.length>0?Promise.allSettled(Xr).then(Vr).catch(At):Vr()}updateParameters(je){this.scaleFactor=je.scaleFactor,this.showCollisionBoxes=je.showCollisionBoxes,this.projection=je.projection,this.brightness=je.brightness,this.tileTransform=a.aZ(je.tileID.canonical,je.projection),this.extraShadowCaster=je.extraShadowCaster,this.lut=je.lut,this.worldview=je.worldview,this.indoor=je.indoor}rasterizeIfNeeded(je,Re,Ke,bt){Array.from(Re.values()).some(yt=>yt.usvg)?this.rasterize(je,Re,Ke,bt):bt()}updateImageMapAndGetImageTaskQueue(je,Re,Ke){const bt=new Map;for(const yt of Re.keys()){const At=Ke.get(yt)||[];for(const Bt of At){const Lt=Bt.toString(),Ut=Re.get(Bt.id.toString());Ut.usvg?bt.has(Lt)||(bt.set(Lt,Bt),je.set(Lt,Object.assign({},Ut))):je.set(Lt,Ut)}}return bt}rasterize(je,Re,Ke,bt){this.rasterizeTask=je.send("rasterizeImages",{scope:this.scope,tasks:Ke},(yt,At)=>{if(!yt)for(const[Bt,Lt]of At.entries()){const Ut=Object.assign(Re.get(Bt),{data:Lt});Re.set(Bt,Ut)}bt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function q(kt,je,Re,Ke,bt){const yt=new a.ac(je,{brightness:Re,worldview:bt});for(const At of kt)At.recalculate(yt,Ke)}class H extends a.E{constructor(je,Re,Ke,bt,yt,At,Bt){super(),this.actor=je,this.layerIndex=Re,this.availableImages=Ke,this.availableModels=bt,this.loadVectorData=At||a.aL,this.loading={},this.loaded={},this.deduped=new a.aK(je.scheduler),this.isSpriteLoaded=yt,this.scheduler=je.scheduler,this.brightness=Bt}loadTile(je,Re){const Ke=je.uid,bt=je&&je.request,yt=bt&&bt.collectResourceTiming,At=this.loading[Ke]=new F(je);At.abort=this.loadVectorData(je,(Bt,Lt)=>{const Ut=!this.loading[Ke];if(delete this.loading[Ke],At.cancelRasterize(),Ut||Bt||!Lt)return At.status="done",Ut||(this.loaded[Ke]=At),Re(Bt);const gr=Lt.rawData,ar={},Xr=a.aM(Lt.responseHeaders);Xr&&Xr.expires&&(ar.expires=Xr.expires),Xr&&Xr.cacheControl&&(ar.cacheControl=Xr.cacheControl),At.vectorTile=Lt.vectorTile||new a.fz(new a.bt(gr));const tn=()=>{At.parse(At.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Vr,ts)=>{if(Vr||!ts)return Re(Vr);const Xn={};if(yt){const Qn=h(bt);Qn.length>0&&(Xn.resourceTiming=JSON.parse(JSON.stringify(Qn)))}Re(null,Object.assign({rawTileData:gr.slice(0),responseHeaders:Lt.responseHeaders},ts,ar,Xn))})};this.isSpriteLoaded?tn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(tn,{type:"parseTile",isSymbolTile:je.isSymbolTile,zoom:je.tileZoom}):tn()}),this.loaded=this.loaded||{},this.loaded[Ke]=At})}reloadTile(je,Re){const Ke=this.loaded,bt=je.uid;if(Ke&&Ke[bt]){const yt=Ke[bt];yt.updateParameters(je);const At=(Bt,Lt)=>{const Ut=yt.reloadCallback;Ut&&(delete yt.reloadCallback,yt.parse(yt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ut)),Re(Bt,Lt)};yt.status==="parsing"?yt.reloadCallback=At:yt.status==="done"&&(yt.vectorTile?yt.parse(yt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,At):At())}else Re(null,void 0)}abortTile(je,Re){const Ke=je.uid,bt=this.loading[Ke];bt&&(bt.abort&&bt.abort(),delete this.loading[Ke]),Re()}removeTile(je,Re){const Ke=this.loaded,bt=je.uid;Ke&&Ke[bt]&&delete Ke[bt],Re()}}class K{loadTile(je,Re){const{uid:Ke,encoding:bt,rawImageData:yt,padding:At}=je,Bt=ImageBitmap&&yt instanceof ImageBitmap?this.getImageData(yt,At):yt;Re(null,new a.fA(Ke,Bt,bt,At<1))}reloadTile(je,Re){Re(null,null)}abortTile(je,Re){Re()}removeTile(je,Re){Re()}getImageData(je,Re){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(je.width,je.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=je.width,this.offscreenCanvas.height=je.height,this.offscreenCanvasContext.drawImage(je,0,0,je.width,je.height);const Ke=this.offscreenCanvasContext.getImageData(-Re,-Re,je.width+2*Re,je.height+2*Re);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ke}}a.bs.setPbf(a.bt);class Z{constructor(je){this._mrt=new a.bs(je.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=je.uid,this.tileID=je.tileID,this.source=je.source}parse(je,Re){const Ke=this._mrt;this.status="parsing",this._entireBuffer=je;try{Ke.parseHeader(je),this._isHeaderLoaded=!0;const bt=[];for(const yt in Ke.layers){const At=Ke.getLayer(yt),Bt=At.getDataRange(At.getBandList()),Lt=Ke.createDecodingTask(Bt),Ut=je.slice(Bt.firstByte,Bt.lastByte+1),gr=a.bs.performDecoding(Ut,Lt).then(ar=>Lt.complete(null,ar)).catch(ar=>Lt.complete(ar,null));bt.push(gr)}Promise.allSettled(bt).then(()=>Re(null,Ke)).catch(yt=>Re(yt))}catch(bt){Re(bt)}}}class te{constructor(je){this.actor=je,this.loading={},this.loaded={}}loadTile(je,Re){const Ke=je.uid,bt=je.request,yt=this.loading[Ke]=new Z(je),{cancel:At}=a.bu(bt,(Bt,Lt,Ut)=>{const gr=!this.loading[Ke];if(delete this.loading[Ke],gr||Bt||!Lt)return yt.status="done",gr||(this.loaded[Ke]=yt),Re(Bt);yt.parse(Lt,(ar,Xr)=>{if(ar||!Xr)return Re(ar);Re(null,Xr,Ut)}),this.loaded[Ke]=yt});yt.abort=At}reloadTile(je,Re){Re(null,void 0)}abortTile(je,Re){const Ke=je.uid,bt=this.loading[Ke];bt&&(bt.abort&&bt.abort(),delete this.loading[Ke]),Re()}removeTile(je,Re){const Ke=je.uid;this.loaded[Ke]&&delete this.loaded[Ke],Re()}decodeRasterArray(je,Re){a.bs.performDecoding(je.buffer,je.task).then(Ke=>Re(null,Ke)).catch(Ke=>Re(Ke))}}const ae=a.fB.prototype.toGeoJSON;class le{constructor(je){this._feature=je,this.extent=a.al,this.type=je.type,this.properties=je.tags,"id"in je&&!isNaN(je.id)&&(this.id=parseInt(je.id,10))}loadGeometry(){if(this._feature.type===1){const je=[];for(const Re of this._feature.geometry)je.push([new a.P(Re[0],Re[1])]);return je}{const je=[];for(const Re of this._feature.geometry){const Ke=[];for(const bt of Re)Ke.push(new a.P(bt[0],bt[1]));je.push(Ke)}return je}}toGeoJSON(je,Re,Ke){return ae.call(this,je,Re,Ke)}}class ve{constructor(je,Re){this.name=je,this.extent=a.al,this.length=Re.length,this._jsonFeatures=Re}feature(je){return new le(this._jsonFeatures[je])}}class ne{constructor(je){this.layers={},this.extent=a.al;for(const Re of Object.keys(je))this.layers[Re]=new ve(Re,je[Re])}}const ge=64/4096,ie=128;class fe{constructor(){this.features=new Map}clear(){this.features.clear()}load(je=[],Re){for(const Ke of je){const bt=Ke.id;if(bt==null)continue;let yt=this.features.get(bt);yt&&this.updateCache(yt,Re),Ke.geometry?(yt=ye(Ke),this.updateCache(yt,Re),this.features.set(bt,yt)):this.features.delete(bt),this.updateCache(yt,Re)}}updateCache(je,Re){for(const{canonical:Ke,uid:bt}of Object.values(Re)){const{z:yt,x:At,y:Bt}=Ke;de(je,Math.pow(2,yt),At,Bt)&&delete Re[bt]}}getTile(je,Re,Ke){const bt=Math.pow(2,je),yt=[];for(const At of this.features.values())de(At,bt,Re,Ke)&&yt.push(he(At,bt,Re,Ke));return{features:yt}}getFeatures(){return[...this.features.values()]}}function de({minX:kt,minY:je,maxX:Re,maxY:Ke},bt,yt,At){return kt<(yt+1+ge)/bt&&je<(At+1+ge)/bt&&Re>(yt-ge)/bt&&Ke>(At-ge)/bt}function ye(kt){const{id:je,geometry:Re,properties:Ke}=kt;if(!Re)return;if(Re.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:bt,coordinates:yt}=Re,At={id:je,type:1,geometry:[],tags:Ke,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},Bt=At.geometry;if(bt==="Point")Ie(yt,Bt,At);else if(bt==="MultiPoint")for(const Lt of yt)Ie(Lt,Bt,At);else if(bt==="LineString")At.type=2,Ne(yt,Bt,At);else if(bt==="MultiLineString")At.type=2,we(yt,Bt,At);else if(bt==="Polygon")At.type=3,we(yt,Bt,At,!0);else{if(bt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");At.type=3;for(const Lt of yt)we(Lt,Bt,At,!0)}return At}function Ie([kt,je],Re,Ke){const bt=a.aF(kt);let yt=a.aJ(je);yt=yt<0?0:yt>1?1:yt,Re.push(bt,yt),Ke.minX=Math.min(Ke.minX,bt),Ke.minY=Math.min(Ke.minY,yt),Ke.maxX=Math.max(Ke.maxX,bt),Ke.maxY=Math.max(Ke.maxY,yt)}function Ne(kt,je,Re,Ke=!1,bt=!1){const yt=[];for(const At of kt)Ie(At,yt,Re);je.push(yt),Ke&&function(At,Bt){let Lt=0;for(let Ut=0,gr=At.length,ar=gr-2;Ut0===Bt)for(let Ut=0,gr=At.length;Ut=At&&ar>=At||(Ut>=At?(gr+=Math.round(Vr*((At-Ut)/tn)),Ut=At):ar>=At&&(Xr=gr+Math.round(Vr*((At-Ut)/tn)),ar=At),gr>=At&&Xr>=At||(gr>=At?(Ut+=Math.round(tn*((At-gr)/Vr)),gr=At):Xr>=At&&(ar=Ut+Math.round(tn*((At-gr)/Vr)),Xr=At),Bt&&Ut===Bt[Bt.length-1][0]&&gr===Bt[Bt.length-1][1]||(Bt=[[Ut,gr]],bt.push(Bt)),Bt.push([ar,Xr])))))}}function be(kt,je,Re,Ke,bt){const yt=(Re-ge)/je,At=(Ke-ge)/je,Bt=(Re+1+ge)/je,Lt=(Ke+1+ge)/je;function Ut(Xr,tn){let Vr=0;return XrBt&&(Vr|=2),tnLt&&(Vr|=8),Vr}let gr=[];for(let Xr=1;Xr<=8;Xr*=2){let tn=kt[kt.length-2],Vr=kt[kt.length-1],ts=!(Ut(tn,Vr)&Xr);for(let Xn=0;Xn>31}function Qe(kt,je){const{geometry:Re,type:Ke}=kt;let bt=0,yt=0;if(Ke===1){je.writeVarint(Fe(1,Re.length));for(const At of Re){const Bt=At[0]-bt,Lt=At[1]-yt;je.writeVarint(Me(Bt)),je.writeVarint(Me(Lt)),bt+=Bt,yt+=Lt}}else for(const At of Re){je.writeVarint(Fe(1,1));const Bt=At.length-(Ke===3?1:0);for(let Lt=0;Ltkt},me=Math.fround||(mt=new Float32Array(1),kt=>(mt[0]=+kt,mt[0]));var mt;const et=3,nt=5,Ae=6;class ht{constructor(je){this.options=Object.assign(Object.create(Ye),je),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(je){const{log:Re,minZoom:Ke,maxZoom:bt}=this.options;Re&&console.time("total time");const yt=`prepare ${je.length} points`;Re&&console.time(yt),this.points=je;const At=[];for(let Lt=0;Lt=Ke;Lt--){const Ut=+Date.now();Bt=this.trees[Lt]=this._createTree(this._cluster(Bt,Lt)),Re&&console.log("z%d: %d clusters in %dms",Lt,Bt.numItems,+Date.now()-Ut)}return Re&&console.timeEnd("total time"),this}getClusters(je,Re){let Ke=((je[0]+180)%360+360)%360-180;const bt=Math.max(-90,Math.min(90,je[1]));let yt=je[2]===180?180:((je[2]+180)%360+360)%360-180;const At=Math.max(-90,Math.min(90,je[3]));if(je[2]-je[0]>=360)Ke=-180,yt=180;else if(Ke>yt){const ar=this.getClusters([Ke,bt,180,At],Re),Xr=this.getClusters([-180,bt,yt,At],Re);return ar.concat(Xr)}const Bt=this.trees[this._limitZoom(Re)],Lt=Bt.range(tt(Ke),ft(At),tt(yt),ft(bt)),Ut=Bt.data,gr=[];for(const ar of Lt){const Xr=this.stride*ar;gr.push(Ut[Xr+nt]>1?$e(Ut,Xr,this.clusterProps):this.points[Ut[Xr+et]])}return gr}getChildren(je){const Re=this._getOriginId(je),Ke=this._getOriginZoom(je),bt="No cluster with the specified id.",yt=this.trees[Ke];if(!yt)throw new Error(bt);const At=yt.data;if(Re*this.stride>=At.length)throw new Error(bt);const Bt=this.options.radius/(this.options.extent*Math.pow(2,Ke-1)),Lt=yt.within(At[Re*this.stride],At[Re*this.stride+1],Bt),Ut=[];for(const gr of Lt){const ar=gr*this.stride;At[ar+4]===je&&Ut.push(At[ar+nt]>1?$e(At,ar,this.clusterProps):this.points[At[ar+et]])}if(Ut.length===0)throw new Error(bt);return Ut}getLeaves(je,Re,Ke){const bt=[];return this._appendLeaves(bt,je,Re=Re||10,Ke=Ke||0,0),bt}getTile(je,Re,Ke){const bt=this.trees[this._limitZoom(je)],yt=Math.pow(2,je),{extent:At,radius:Bt}=this.options,Lt=Bt/At,Ut=(Ke-Lt)/yt,gr=(Ke+1+Lt)/yt,ar={features:[]};return this._addTileFeatures(bt.range((Re-Lt)/yt,Ut,(Re+1+Lt)/yt,gr),bt.data,Re,Ke,yt,ar),Re===0&&this._addTileFeatures(bt.range(1-Lt/yt,Ut,1,gr),bt.data,yt,Ke,yt,ar),Re===yt-1&&this._addTileFeatures(bt.range(0,Ut,Lt/yt,gr),bt.data,-1,Ke,yt,ar),ar.features.length?ar:null}getClusterExpansionZoom(je){let Re=this._getOriginZoom(je)-1;for(;Re<=this.options.maxZoom;){const Ke=this.getChildren(je);if(Re++,Ke.length!==1)break;je=Ke[0].properties.cluster_id}return Re}_appendLeaves(je,Re,Ke,bt,yt){const At=this.getChildren(Re);for(const Bt of At){const Lt=Bt.properties;if(Lt&&Lt.cluster?yt+Lt.point_count<=bt?yt+=Lt.point_count:yt=this._appendLeaves(je,Lt.cluster_id,Ke,bt,yt):yt1;let gr,ar,Xr;if(Ut)gr=Je(Re,Lt,this.clusterProps),ar=Re[Lt],Xr=Re[Lt+1];else{const ts=this.points[Re[Lt+et]];gr=ts.properties;const[Xn,Qn]=ts.geometry.coordinates;ar=tt(Xn),Xr=ft(Qn)}const tn={type:1,geometry:[[Math.round(this.options.extent*(ar*yt-Ke)),Math.round(this.options.extent*(Xr*yt-bt))]],tags:gr};let Vr;Vr=Ut||this.options.generateId?Re[Lt+et]:this.points[Re[Lt+et]].id,Vr!==void 0&&(tn.id=Vr),At.features.push(tn)}}_limitZoom(je){return Math.max(this.options.minZoom,Math.min(Math.floor(+je),this.options.maxZoom+1))}_cluster(je,Re){const{radius:Ke,extent:bt,reduce:yt,minPoints:At}=this.options,Bt=Ke/(bt*Math.pow(2,Re)),Lt=je.data,Ut=[],gr=this.stride;for(let ar=0;arRe&&(Xn+=Lt[Bs+nt])}if(Xn>ts&&Xn>=At){let Qn,Bs=Xr*ts,Ta=tn*ts,Za=-1;const Oa=(ar/gr<<5)+(Re+1)+this.points.length;for(const fo of Vr){const wa=fo*gr;if(Lt[wa+2]<=Re)continue;Lt[wa+2]=Re;const Ks=Lt[wa+nt];Bs+=Lt[wa]*Ks,Ta+=Lt[wa+1]*Ks,Lt[wa+4]=Oa,yt&&(Qn||(Qn=this._map(Lt,ar,!0),Za=this.clusterProps.length,this.clusterProps.push(Qn)),yt(Qn,this._map(Lt,wa)))}Lt[ar+4]=Oa,Ut.push(Bs/Xn,Ta/Xn,1/0,Oa,-1,Xn),yt&&Ut.push(Za)}else{for(let Qn=0;Qn1)for(const Qn of Vr){const Bs=Qn*gr;if(!(Lt[Bs+2]<=Re)){Lt[Bs+2]=Re;for(let Ta=0;Ta>5}_getOriginZoom(je){return(je-this.points.length)%32}_map(je,Re,Ke){if(je[Re+nt]>1){const At=this.clusterProps[je[Re+Ae]];return Ke?Object.assign({},At):At}const bt=this.points[je[Re+et]].properties,yt=this.options.map(bt);return Ke&&yt===bt?Object.assign({},yt):yt}}function $e(kt,je,Re){return{type:"Feature",id:kt[je+et],properties:Je(kt,je,Re),geometry:{type:"Point",coordinates:[(Ke=kt[je],360*(Ke-.5)),jt(kt[je+1])]}};var Ke}function Je(kt,je,Re){const Ke=kt[je+nt],bt=Ke>=1e4?`${Math.round(Ke/1e3)}k`:Ke>=1e3?Math.round(Ke/100)/10+"k":Ke,yt=kt[je+Ae],At=yt===-1?{}:Object.assign({},Re[yt]);return Object.assign(At,{cluster:!0,cluster_id:kt[je+et],point_count:Ke,point_count_abbreviated:bt})}function tt(kt){return kt/360+.5}function ft(kt){const je=Math.sin(kt*Math.PI/180),Re=.5-.25*Math.log((1+je)/(1-je))/Math.PI;return Re<0?0:Re>1?1:Re}function jt(kt){const je=(180-360*kt)*Math.PI/180;return 360*Math.atan(Math.exp(je))/Math.PI-90}function Nt(kt,je,Re,Ke){let bt=Ke;const yt=je+(Re-je>>1);let At,Bt=Re-je;const Lt=kt[je],Ut=kt[je+1],gr=kt[Re],ar=kt[Re+1];for(let Xr=je+3;Xrbt)At=Xr,bt=tn;else if(tn===bt){const Vr=Math.abs(Xr-yt);VrKe&&(At-je>3&&Nt(kt,je,At,Ke),kt[At+2]=bt,Re-At>3&&Nt(kt,At,Re,Ke))}function Et(kt,je,Re,Ke,bt,yt){let At=bt-Re,Bt=yt-Ke;if(At!==0||Bt!==0){const Lt=((kt-Re)*At+(je-Ke)*Bt)/(At*At+Bt*Bt);Lt>1?(Re=bt,Ke=yt):Lt>0&&(Re+=At*Lt,Ke+=Bt*Lt)}return At=kt-Re,Bt=je-Ke,At*At+Bt*Bt}function vt(kt,je,Re,Ke){const bt={id:kt??null,type:je,geometry:Re,tags:Ke,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(je==="Point"||je==="MultiPoint"||je==="LineString")rr(bt,Re);else if(je==="Polygon")rr(bt,Re[0]);else if(je==="MultiLineString")for(const yt of Re)rr(bt,yt);else if(je==="MultiPolygon")for(const yt of Re)rr(bt,yt[0]);return bt}function rr(kt,je){for(let Re=0;Re0&&(At+=Ke?(bt*gr-Ut*yt)/2:Math.sqrt(Math.pow(Ut-bt,2)+Math.pow(gr-yt,2))),bt=Ut,yt=gr}const Bt=je.length-3;je[2]=1,Nt(je,0,Bt,Re),je[Bt+2]=1,je.size=Math.abs(At),je.start=0,je.end=je.size}function Jr(kt,je,Re,Ke){for(let bt=0;bt1?1:Re}function fr(kt,je,Re,Ke,bt,yt,At,Bt){if(Ke/=je,yt>=(Re/=je)&&At=Ke)return null;const Lt=[];for(const Ut of kt){const gr=Ut.geometry;let ar=Ut.type;const Xr=bt===0?Ut.minX:Ut.minY,tn=bt===0?Ut.maxX:Ut.maxY;if(Xr>=Re&&tn=Ke)continue;let Vr=[];if(ar==="Point"||ar==="MultiPoint")xs(gr,Vr,Re,Ke,bt);else if(ar==="LineString")ji(gr,Vr,Re,Ke,bt,!1,Bt.lineMetrics);else if(ar==="MultiLineString")La(gr,Vr,Re,Ke,bt,!1);else if(ar==="Polygon")La(gr,Vr,Re,Ke,bt,!0);else if(ar==="MultiPolygon")for(const ts of gr){const Xn=[];La(ts,Xn,Re,Ke,bt,!0),Xn.length&&Vr.push(Xn)}if(Vr.length){if(Bt.lineMetrics&&ar==="LineString"){for(const ts of Vr)Lt.push(vt(Ut.id,ar,ts,Ut.tags));continue}ar!=="LineString"&&ar!=="MultiLineString"||(Vr.length===1?(ar="LineString",Vr=Vr[0]):ar="MultiLineString"),ar!=="Point"&&ar!=="MultiPoint"||(ar=Vr.length===3?"Point":"MultiPoint"),Lt.push(vt(Ut.id,ar,Vr,Ut.tags))}}return Lt.length?Lt:null}function xs(kt,je,Re,Ke,bt){for(let yt=0;yt=Re&&At<=Ke&&da(je,kt[yt],kt[yt+1],kt[yt+2])}}function ji(kt,je,Re,Ke,bt,yt,At){let Bt=mi(kt);const Lt=bt===0?tl:rl;let Ut,gr,ar=kt.start;for(let Xn=0;XnRe&&(gr=Lt(Bt,Qn,Bs,Za,Oa,Re),At&&(Bt.start=ar+Ut*gr)):fo>Ke?wa=Re&&(gr=Lt(Bt,Qn,Bs,Za,Oa,Re),Ks=!0),wa>Ke&&fo<=Ke&&(gr=Lt(Bt,Qn,Bs,Za,Oa,Ke),Ks=!0),!yt&&Ks&&(At&&(Bt.end=ar+Ut*gr),je.push(Bt),Bt=mi(kt)),At&&(ar+=Ut)}let Xr=kt.length-3;const tn=kt[Xr],Vr=kt[Xr+1],ts=bt===0?tn:Vr;ts>=Re&&ts<=Ke&&da(Bt,tn,Vr,kt[Xr+2]),Xr=Bt.length-3,yt&&Xr>=3&&(Bt[Xr]!==Bt[0]||Bt[Xr+1]!==Bt[1])&&da(Bt,Bt[0],Bt[1],Bt[2]),Bt.length&&je.push(Bt)}function mi(kt){const je=[];return je.size=kt.size,je.start=kt.start,je.end=kt.end,je}function La(kt,je,Re,Ke,bt,yt){for(const At of kt)ji(At,je,Re,Ke,bt,yt,!1)}function da(kt,je,Re,Ke){kt.push(je,Re,Ke)}function tl(kt,je,Re,Ke,bt,yt){const At=(yt-je)/(Ke-je);return da(kt,yt,Re+(bt-Re)*At,1),At}function rl(kt,je,Re,Ke,bt,yt){const At=(yt-Re)/(bt-Re);return da(kt,je+(Ke-je)*At,yt,1),At}function Gs(kt,je){const Re=[];for(let Ke=0;Ke0&&je.size<(bt?At:Ke))return void(Re.numPoints+=je.length/3);const Bt=[];for(let Lt=0;LtAt)&&(Re.numSimplified++,Bt.push(je[Lt],je[Lt+1])),Re.numPoints++;bt&&function(Lt,Ut){let gr=0;for(let ar=0,Xr=Lt.length,tn=Xr-2;ar0===Ut)for(let ar=0,Xr=Lt.length;ar24)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 bt=function(yt,At){const Bt=[];if(yt.type==="FeatureCollection")for(let Lt=0;Lt1&&console.time("creation"),tn=this.tiles[Xr]=Ii(je,Re,Ke,bt,Ut),this.tileCoords.push({z:Re,x:Ke,y:bt}),gr)){gr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Re,Ke,bt,tn.numFeatures,tn.numPoints,tn.numSimplified),console.timeEnd("creation"));const Ks=`z${Re}`;this.stats[Ks]=(this.stats[Ks]||0)+1,this.total++}if(tn.source=je,yt==null){if(Re===Ut.indexMaxZoom||tn.numPoints<=Ut.indexMaxPoints)continue}else{if(Re===Ut.maxZoom||Re===yt)continue;if(yt!=null){const Ks=yt-Re;if(Ke!==At>>Ks||bt!==Bt>>Ks)continue}}if(tn.source=null,je.length===0)continue;gr>1&&console.time("clipping");const Vr=.5*Ut.buffer/Ut.extent,ts=.5-Vr,Xn=.5+Vr,Qn=1+Vr;let Bs=null,Ta=null,Za=null,Oa=null,fo=fr(je,ar,Ke-Vr,Ke+Xn,0,tn.minX,tn.maxX,Ut),wa=fr(je,ar,Ke+ts,Ke+Qn,0,tn.minX,tn.maxX,Ut);je=null,fo&&(Bs=fr(fo,ar,bt-Vr,bt+Xn,1,tn.minY,tn.maxY,Ut),Ta=fr(fo,ar,bt+ts,bt+Qn,1,tn.minY,tn.maxY,Ut),fo=null),wa&&(Za=fr(wa,ar,bt-Vr,bt+Xn,1,tn.minY,tn.maxY,Ut),Oa=fr(wa,ar,bt+ts,bt+Qn,1,tn.minY,tn.maxY,Ut),wa=null),gr>1&&console.timeEnd("clipping"),Lt.push(Bs||[],Re+1,2*Ke,2*bt),Lt.push(Ta||[],Re+1,2*Ke,2*bt+1),Lt.push(Za||[],Re+1,2*Ke+1,2*bt),Lt.push(Oa||[],Re+1,2*Ke+1,2*bt+1)}}getTile(je,Re,Ke){je=+je,Re=+Re,Ke=+Ke;const bt=this.options,{extent:yt,debug:At}=bt;if(je<0||je>24)return null;const Bt=1<1&&console.log("drilling down to z%d-%d-%d",je,Re,Ke);let Ut,gr=je,ar=Re,Xr=Ke;for(;!Ut&&gr>0;)gr--,ar>>=1,Xr>>=1,Ut=this.tiles[yo(gr,ar,Xr)];return Ut&&Ut.source?(At>1&&(console.log("found parent tile z%d-%d-%d",gr,ar,Xr),console.time("drilling down")),this.splitTile(Ut.source,gr,ar,Xr,je,Re,Ke),At>1&&console.timeEnd("drilling down"),this.tiles[Lt]?Ns(this.tiles[Lt],yt):null):null}}function yo(kt,je,Re){return 32*((1<Ut.tags&&"3d_elevation_id"in Ut.tags&&"source"in Ut.tags&&Ut.tags.source==="elevation",yt=Ke.features.filter(Ut=>bt(Ut));let At={_geojsonTileLayer:Ke.features};yt.length>0&&(At={_geojsonTileLayer:Ke.features.filter(Ut=>!bt(Ut)),hd_road_elevation:yt});const Bt=new ne(At),Lt=function(Ut){const gr=new a.bt;for(const ar of Object.keys(Ut))gr.writeMessage(3,Oe,{name:ar,features:Ut[ar]});return gr.finish()}(At).buffer;je(null,{vectorTile:Bt,rawData:Lt})}class vo extends H{constructor(je,Re,Ke,bt,yt,At,Bt){super(je,Re,Ke,bt,yt,ss,Bt),At&&(this.loadGeoJSON=At),this._dynamicIndex=new fe}loadData(je,Re){const Ke=je&&je.request,bt=Ke&&Ke.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(je,(yt,At)=>{if(yt||!At)return Re(yt);if(typeof At!="object")return Re(new Error(`Input data given to '${je.source}' is not a valid GeoJSON object.`));{try{if(je.filter){const Lt=a.U(je.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Lt.result==="error")throw new Error(Lt.value.map(Ut=>`${Ut.key}: ${Ut.message}`).join(", "));At.features=At.features.filter(Ut=>Lt.value.evaluate({zoom:0},Ut))}je.dynamic?(At.type==="Feature"&&(At={type:"FeatureCollection",features:[At]}),je.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(At.features,this.loaded),je.cluster&&(At.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=je.cluster?new ht(function({superclusterOptions:Lt,clusterProperties:Ut}){if(!Ut||!Lt)return Lt;const gr={},ar={},Xr={accumulated:null,zoom:0},tn={properties:null},Vr=Object.keys(Ut);for(const ts of Vr){const[Xn,Qn]=Ut[ts],Bs=a.U(Qn),Ta=a.U(typeof Xn=="string"?[Xn,["accumulated"],["get",ts]]:Xn);gr[ts]=Bs.value,ar[ts]=Ta.value}return Lt.map=ts=>{tn.properties=ts;const Xn={};for(const Qn of Vr)Xn[Qn]=gr[Qn].evaluate(Xr,tn);return Xn},Lt.reduce=(ts,Xn)=>{tn.properties=Xn;for(const Qn of Vr)Xr.accumulated=ts[Qn],ts[Qn]=ar[Qn].evaluate(Xr,tn)},Lt}(je)).load(At.features):je.dynamic?this._dynamicIndex:function(Lt,Ut){return new Tc(Lt,Ut)}(At,je.geojsonVtOptions)}catch(Lt){return Re(Lt)}const Bt={};if(bt){const Lt=h(Ke);Lt&&(Bt.resourceTiming={},Bt.resourceTiming[je.source]=JSON.parse(JSON.stringify(Lt)))}Re(null,Bt)}})}reloadTile(je,Re){const Ke=this.loaded;return Ke&&Ke[je.uid]?je.partial?Re(null,void 0):super.reloadTile(je,Re):this.loadTile(je,Re)}loadGeoJSON(je,Re){if(je.request)a.m(je.request,Re);else{if(typeof je.data!="string")return Re(new Error(`Input data given to '${je.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Re(null,JSON.parse(je.data))}catch{return Re(new Error(`Input data given to '${je.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(je,Re){try{Re(null,this._geoJSONIndex.getClusterExpansionZoom(je.clusterId))}catch(Ke){Re(Ke)}}getClusterChildren(je,Re){try{Re(null,this._geoJSONIndex.getChildren(je.clusterId))}catch(Ke){Re(Ke)}}getClusterLeaves(je,Re){try{Re(null,this._geoJSONIndex.getLeaves(je.clusterId,je.limit,je.offset))}catch(Ke){Re(Ke)}}}class Bd{constructor(je,Re,Ke){this.tileID=new a.aQ(je.tileID.overscaledZ,je.tileID.wrap,je.tileID.canonical.z,je.tileID.canonical.x,je.tileID.canonical.y),this.tileZoom=je.tileZoom,this.uid=je.uid,this.zoom=je.zoom,this.canonical=je.tileID.canonical,this.pixelRatio=je.pixelRatio,this.tileSize=je.tileSize,this.source=je.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=je.projection,this.brightness=Re,this.worldview=Ke}parse(je,Re,Ke,bt){this.status="parsing";const yt=new a.aQ(Ke.tileID.overscaledZ,Ke.tileID.wrap,Ke.tileID.canonical.z,Ke.tileID.canonical.x,Ke.tileID.canonical.y),At=[],Bt=Re.familiesBySource[Ke.source],Lt=new a.fn(yt,Ke.promoteId);Lt.bucketLayerIDs=[],Lt.is3DTile=!0,a.fC(je).then(Ut=>{if(!Ut)return bt(new Error("Could not parse tile"));const gr=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ut.json.asset.extras&&Ut.json.asset.extras.MAPBOX_mesh_features,ar=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("EXT_meshopt_compression"),Xr=new a.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const tn in Bt)for(const Vr of Bt[tn]){const ts=Vr[0];Lt.bucketLayerIDs.push(Vr.map(Bs=>a.B(Bs.id,Bs.scope))),ts.recalculate(Xr,[]);const Xn=a.fD(Ut,1/a.d7(Ke.tileID.canonical)),Qn=new a.fE(Vr,Xn,yt,gr,ar,this.brightness,Lt,this.worldview);gr||(Qn.needsUpload=!0),At.push(Qn),Qn.evaluate(ts)}this.status="done",bt(null,{buckets:At,featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ut=>bt(new Error(Ut.message)))}}class _r{constructor(je,Re,Ke,bt,yt,At,Bt,Lt){this.actor=je,this.layerIndex=Re,this.availableImages=Ke,this.availableModels=bt,this.brightness=Bt,this.loading={},this.loaded={},this.worldview=Lt}loadTile(je,Re){const Ke=je.uid,bt=this.loading[Ke]=new Bd(je,this.brightness,this.worldview);a.bu(je.request,(yt,At)=>{const Bt=!this.loading[Ke];return delete this.loading[Ke],Bt||yt?(bt.status="done",Bt||(this.loaded[Ke]=bt),Re(yt)):At&&At.byteLength!==0?void bt.parse(At,this.layerIndex,je,(Lt,Ut)=>{bt.status="done",this.loaded=this.loaded||{},this.loaded[Ke]=bt,Lt||!Ut?Re(Lt):Re(null,Ut)}):(bt.status="done",this.loaded[Ke]=bt,Re())})}reloadTile(je,Re){const Ke=this.loaded,bt=je.uid;if(Ke&&Ke[bt]){const yt=Ke[bt];yt.projection=je.projection,yt.brightness=je.brightness;const At=(Bt,Lt)=>{yt.reloadCallback&&(delete yt.reloadCallback,this.loadTile(je,Re)),Re(Bt,Lt)};yt.status==="parsing"?yt.reloadCallback=At:yt.status==="done"&&this.loadTile(je,Re)}}abortTile(je,Re){const Ke=je.uid;this.loading[Ke]&&delete this.loading[Ke],Re()}removeTile(je,Re){const Ke=this.loaded,bt=je.uid;Ke&&Ke[bt]&&delete Ke[bt],Re()}}class Hn{constructor(je){this.self=je,this.actor=new a.fG(je,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new a.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=a.cm({name:"mercator"}),this.workerSourceTypes={vector:H,geojson:vo,"raster-dem":K,"raster-array":te,"batched-model":_r},this.workerSources={},this.self.registerWorkerSource=(Re,Ke)=>{if(this.workerSourceTypes[Re])throw new Error(`Worker source with name "${Re}" already registered.`);this.workerSourceTypes[Re]=Ke},this.self.registerRTLTextPlugin=Re=>{if(a.fH.isParsed())throw new Error("RTL text plugin already registered.");a.fH.setState({pluginStatus:a.fI.parsed,pluginURL:a.fH.getPluginURL()}),a.fH.applyArabicShaping=Re.applyArabicShaping,a.fH.processBidirectionalText=Re.processBidirectionalText,a.fH.processStyledBidirectionalText=Re.processStyledBidirectionalText;for(const Ke of this.rtlPluginParsingListeners)Ke(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(je,Re,Ke){delete this.layerIndexes[je],delete this.availableImages[je],delete this.availableModels[je],delete this.workerSources[je],Ke()}checkIfReady(je,Re,Ke){Ke()}setReferrer(je,Re){this.referrer=Re}spriteLoaded(je,Re){this.isSpriteLoaded[je]||(this.isSpriteLoaded[je]={});const{scope:Ke,isLoaded:bt}=Re;if(this.isSpriteLoaded[je][Ke]=bt,this.workerSources[je]&&this.workerSources[je][Ke])for(const yt in this.workerSources[je][Ke]){const At=this.workerSources[je][Ke][yt];for(const Bt in At){const Lt=At[Bt];Lt instanceof H&&(Lt.isSpriteLoaded=bt,Lt.fire(new a.z("isSpriteLoaded")))}}}setImages(je,Re,Ke){this.availableImages[je]||(this.availableImages[je]={});const{scope:bt,images:yt}=Re;if(this.availableImages[je][bt]=yt,this.workerSources[je]&&this.workerSources[je][bt]){for(const At in this.workerSources[je][bt]){const Bt=this.workerSources[je][bt][At];for(const Lt in Bt)Bt[Lt].availableImages=yt}Ke()}else Ke()}setModels(je,{scope:Re,models:Ke},bt){if(this.availableModels[je]||(this.availableModels[je]={}),this.availableModels[je][Re]=Ke,this.workerSources[je]&&this.workerSources[je][Re]){for(const yt in this.workerSources[je][Re]){const At=this.workerSources[je][Re][yt];for(const Bt in At)At[Bt].availableModels=Ke}bt()}else bt()}setProjection(je,Re){this.projections[je]=a.cm(Re)}setBrightness(je,Re,Ke){this.brightness=Re,Ke()}setWorldview(je,Re,Ke){this.worldview=Re,Ke()}setLayers(je,Re,Ke){this.getLayerIndex(je,Re.scope).replace(Re.layers,Re.options),Ke()}updateLayers(je,Re,Ke){this.getLayerIndex(je,Re.scope).update(Re.layers,Re.removedIds,Re.options),Ke()}loadTile(je,Re,Ke){Re.projection=this.projections[je]||this.defaultProjection,this.getWorkerSource(je,Re.type,Re.source,Re.scope).loadTile(Re,Ke)}decodeRasterArray(je,Re,Ke){this.getWorkerSource(je,Re.type,Re.source,Re.scope).decodeRasterArray(Re,Ke)}reloadTile(je,Re,Ke){Re.projection=this.projections[je]||this.defaultProjection,this.getWorkerSource(je,Re.type,Re.source,Re.scope).reloadTile(Re,Ke)}abortTile(je,Re,Ke){this.getWorkerSource(je,Re.type,Re.source,Re.scope).abortTile(Re,Ke)}removeTile(je,Re,Ke){this.getWorkerSource(je,Re.type,Re.source,Re.scope).removeTile(Re,Ke)}removeSource(je,Re,Ke){if(!(this.workerSources[je]&&this.workerSources[je][Re.scope]&&this.workerSources[je][Re.scope][Re.type]&&this.workerSources[je][Re.scope][Re.type][Re.source]))return;const bt=this.workerSources[je][Re.scope][Re.type][Re.source];delete this.workerSources[je][Re.scope][Re.type][Re.source],bt.removeSource!==void 0?bt.removeSource(Re,Ke):Ke()}loadWorkerSource(je,Re,Ke){try{this.self.importScripts(Re.url),Ke()}catch(bt){Ke(bt)}}syncRTLPluginState(je,Re,Ke){if(a.fH.isParsed())Ke(null,!0);else if(a.fH.isParsing())this.rtlPluginParsingListeners.push(Ke);else try{a.fH.setState(Re);const bt=a.fH.getPluginURL();!a.fH.isLoaded()||a.fH.isParsed()||a.fH.isParsing()||bt==null||(a.fH.setState({pluginStatus:a.fI.parsing,pluginURL:a.fH.getPluginURL()}),this.self.importScripts(bt),a.fH.isParsed()?Ke(null,!0):this.rtlPluginParsingListeners.push(Ke))}catch(bt){Ke(bt)}}setDracoUrl(je,Re){this.dracoUrl=Re}getAvailableImages(je,Re){this.availableImages[je]||(this.availableImages[je]={});let Ke=this.availableImages[je][Re];return Ke||(Ke=[]),Ke}getAvailableModels(je,Re){this.availableModels[je]||(this.availableModels[je]={});let Ke=this.availableModels[je][Re];return Ke||(Ke={}),Ke}getLayerIndex(je,Re){this.layerIndexes[je]||(this.layerIndexes[je]={});let Ke=this.layerIndexes[je][Re];return Ke||(Ke=this.layerIndexes[je][Re]=new y,Ke.scope=Re),Ke}getWorkerSource(je,Re,Ke,bt){const yt=this.workerSources;return yt[je]||(yt[je]={}),yt[je][bt]||(yt[je][bt]={}),yt[je][bt][Re]||(yt[je][bt][Re]={}),this.isSpriteLoaded[je]||(this.isSpriteLoaded[je]={}),yt[je][bt][Re][Ke]||(yt[je][bt][Re][Ke]=new this.workerSourceTypes[Re]({send:(At,Bt,Lt,Ut,gr,ar)=>this.actor.send(At,Bt,Lt,je,gr,ar),scheduler:this.actor.scheduler},this.getLayerIndex(je,bt),this.getAvailableImages(je,bt),this.getAvailableModels(je,bt),this.isSpriteLoaded[je][bt],void 0,this.brightness,this.worldview)),yt[je][bt][Re][Ke]}rasterizeImagesWorker(je,Re,Ke){const bt=new Map;for(const[yt,{image:At,imageVariant:Bt}]of Re.tasks.entries()){const Lt=this.imageRasterizer.rasterize(Bt,At,Re.scope,je);bt.set(yt,Lt)}Ke(void 0,bt)}removeRasterizedImages(je,Re,Ke){this.imageRasterizer.removeImagesFromCacheByIds(Re.imageIds,Re.scope,je),Ke()}enforceCacheSizeLimit(je,Re){a.fJ(Re)}getWorkerPerformanceMetrics(je,Re,Ke){Ke(void 0,void 0)}}return a.fF(self)&&(self.worker=new Hn(self)),Hn}),o(["./shared"],function(a){var h="3.17.0";const p={create:"create",load:"load",fullLoad:"fullLoad"},x={mark(_){performance.mark(_)},measure(_,d,m){performance.measure(_,d,m)}};function y(_){const d=_.name.split("?")[0];return a.a(d)&&d.includes("mapbox-gl.js")?"javascript":a.a(d)&&d.includes("mapbox-gl.css")?"css":a.b(d)?"fontRange":a.c(d)?"sprite":a.i(d)?"style":a.d(d)?"tilejson":"other"}var b,j={},N=function(){if(b)return j;function _(w){return!d(w)}function d(w){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var O,D,B=new Blob([""],{type:"text/javascript"}),V=URL.createObjectURL(B);try{D=new Worker(V),O=!0}catch{O=!1}return D&&D.terminate(),URL.revokeObjectURL(V),O}()?function(){var O=document.createElement("canvas");O.width=O.height=1;var D=O.getContext("2d");if(!D)return!1;var B=D.getImageData(0,0,1,1);return B&&B.width===O.width}()?(m[M=w&&w.failIfMajorPerformanceCaveat]===void 0&&(m[M]=function(O){var D,B=function(V){var Y=document.createElement("canvas"),Q=Object.create(_.webGLContextAttributes);return Q.failIfMajorPerformanceCaveat=V,Y.getContext("webgl2",Q)}(O);if(!B)return!1;try{D=B.createShader(B.VERTEX_SHADER)}catch{return!1}return!(!D||B.isContextLost())&&(B.shaderSource(D,"void main() {}"),B.compileShader(D),B.getShaderParameter(D,B.COMPILE_STATUS)===!0)}(M)),m[M]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var M}b=1,j.supported=_,j.notSupportedReason=d;var m={};return _.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},j}();function C(_,d,m){const w=document.createElement(_);return d!=null&&(w.className=d),m&&m.appendChild(w),w}function A(_,d,m){const w=document.createElementNS("http://www.w3.org/2000/svg",_);for(const M of Object.keys(d))w.setAttributeNS(null,M,String(d[M]));return m&&m.appendChild(w),w}const E=typeof document<"u"?document.documentElement&&document.documentElement.style:null,T=E&&E.userSelect!==void 0?"userSelect":"WebkitUserSelect";let L;function z(){E&&T&&(L=E[T],E[T]="none")}function F(){E&&T&&(E[T]=L)}function q(_){_.preventDefault(),_.stopPropagation(),window.removeEventListener("click",q,!0)}function H(){window.addEventListener("click",q,!0),window.setTimeout(()=>{window.removeEventListener("click",q,!0)},0)}function K(_,d){const m=_.getBoundingClientRect();return ae(_,m,d)}function Z(_,d){const m=_.getBoundingClientRect(),w=[];for(let M=0;Mthis._skuTokenExpiresAt}transformRequest(d,m){return this._transformRequestFn&&this._transformRequestFn(d,m)||{url:d}}normalizeStyleURL(d,m){if(!a.h(d))return d;const w=ie(d);return w.params.push(`sdk=js-${h}`),w.path=`/styles/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeGlyphsURL(d,m){if(!a.h(d))return d;const w=ie(d);return w.path=`/fonts/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeModelURL(d,m){if(!a.h(d))return d;const w=ie(d);return w.path=`/models/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeSourceURL(d,m,w,M){if(!a.h(d))return d;const O=ie(d);return O.path=`/v4/${O.authority}.json`,O.params.push("secure"),w&&O.params.push(`language=${w}`),M&&O.params.push(`worldview=${M}`),this._makeAPIURL(O,this._customAccessToken||m)}normalizeIconsetURL(d,m){const w=ie(d);return a.h(d)?(w.path=`/styles/v1${w.path}/iconset.pbf`,this._makeAPIURL(w,this._customAccessToken||m)):fe(w)}normalizeSpriteURL(d,m,w,M){const O=ie(d);return a.h(d)?(O.path=`/styles/v1${O.path}/sprite${m}${w}`,this._makeAPIURL(O,this._customAccessToken||M)):(O.path+=`${m}${w}`,fe(O))}normalizeTileURL(d,m,w){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!a.h(d))return d;const M=ie(d);M.path=M.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${m||w&&M.authority!=="raster"&&w===512?"@2x":""}${a.k.supported?".webp":"$1"}`),M.authority==="raster"?M.path=`/${a.e.RASTER_URL_PREFIX}${M.path}`:M.authority==="rasterarrays"?M.path=`/${a.e.RASTERARRAYS_URL_PREFIX}${M.path}`:M.authority==="3dtiles"?M.path=`/${a.e.TILES3D_URL_PREFIX}${M.path}`:(M.path=M.path.replace(/^.+\/v4\//,"/"),M.path=`/${a.e.TILE_URL_VERSION}${M.path}`);const O=this._customAccessToken||function(D){for(const B of D){const V=B.match(/^access_token=(.*)$/);if(V)return V[1]}return null}(M.params)||a.e.ACCESS_TOKEN;return a.e.REQUIRE_ACCESS_TOKEN&&O&&this._skuToken&&M.params.push(`sku=${this._skuToken}`),this._makeAPIURL(M,O)}canonicalizeTileURL(d,m){const w=ie(d);if(!w.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!w.path.match(/\.[\w]+$/))return d;let M="mapbox://";w.path.match(/^\/raster\/v1\//)?M+=`raster/${w.path.replace(`/${a.e.RASTER_URL_PREFIX}/`,"")}`:w.path.match(/^\/rasterarrays\/v1\//)?M+=`rasterarrays/${w.path.replace(`/${a.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:M+=`tiles/${w.path.replace(`/${a.e.TILE_URL_VERSION}/`,"")}`;let O=w.params;return m&&(O=O.filter(D=>!D.match(/^access_token=/))),O.length&&(M+=`?${O.join("&")}`),M}canonicalizeTileset(d,m){const w=!!m&&a.h(m),M=[];for(const O of d.tiles||[])a.j(O)?M.push(this.canonicalizeTileURL(O,w)):M.push(O);return M}_makeAPIURL(d,m){const w="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",M=ie(a.e.API_URL);if(d.protocol=M.protocol,d.authority=M.authority,d.protocol==="http"){const O=d.params.indexOf("secure");O>=0&&d.params.splice(O,1)}if(M.path!=="/"&&(d.path=`${M.path}${d.path}`),!a.e.REQUIRE_ACCESS_TOKEN)return fe(d);if(m=m||a.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!m)throw new Error(`An API access token is required to use Mapbox GL. ${w}`);if(m[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${w}`)}return d.params=d.params.filter(O=>O.indexOf("access_token")===-1),d.params.push(`access_token=${m||""}`),fe(d)}}const ge=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ie(_){const d=_.match(ge);if(!d)throw new Error("Unable to parse URL object");return{protocol:d[1],authority:d[2],path:d[3]||"/",params:d[4]?d[4].split("&"):[]}}function fe(_){const d=_.params.length?`?${_.params.join("&")}`:"";return`${_.protocol}://${_.authority}${_.path}${d}`}const de="mapbox.eventData";function ye(_){if(!_)return null;const d=_.split(".");if(!d||d.length!==3)return null;try{return JSON.parse(a.l(d[1]))}catch{return null}}class Ie{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const m=ye(a.e.ACCESS_TOKEN);let w="";return w=m&&m.u?a.f(m.u):a.e.ACCESS_TOKEN||"",d?`${de}.${d}:${w}`:`${de}:${w}`}fetchEventData(){const d=a.s("localStorage"),m=this.getStorageKey(),w=this.getStorageKey("uuid"),M=this.getStorageKey("uuidTimestamp");if(d)try{const O=localStorage.getItem(m);O&&(this.eventData=JSON.parse(O));const D=localStorage.getItem(w);D&&(this.anonId=D);const B=localStorage.getItem(M);B&&(this.anonIdTimestamp=Number(B));const V=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(m,JSON.stringify(this.eventData)),D&&localStorage.setItem(M,D.toString())}catch{a.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,m,w,M){if(!a.e.EVENTS_URL)return;const O=ie(a.e.EVENTS_URL);O.params.push(`access_token=${M||a.e.ACCESS_TOKEN||""}`);const D={event:this.type,created:new Date(d).toISOString()},B=m?Object.assign(D,m):D,V={url:fe(O),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=a.p(V,Y=>{this.pendingRequest=null,w(Y),this.saveEventData(),this.processRequests(M)})}queueRequest(d,m){this.queue.push(d),this.processRequests(m)}}class Ne extends Ie{constructor(d){super("metrics"),d&&(this.data=d)}postMetricsEvent(d){if(!a.e.EVENTS_URL||!d&&!a.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID();const m=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:m},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:m,payload:w}=this.queue.shift();this.postEvent(m,w,()=>{},d)}}const we=new class extends Ie{constructor(_){super("appUserTurnstile"),this._customAccessToken=_}postTurnstileEvent(_,d){a.e.EVENTS_URL&&a.e.ACCESS_TOKEN&&Array.isArray(_)&&_.some(m=>a.h(m)||a.j(m))&&this.queueRequest(Date.now(),d)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=ye(a.e.ACCESS_TOKEN),m=d?d.u:a.e.ACCESS_TOKEN;let w=m!==this.eventData.tokenU;a.v(this.anonId)||(this.refreshUUID(),w=!0);const M=this.queue.shift();if(this.eventData.lastSuccess){const O=new Date(this.eventData.lastSuccess),D=new Date(M),B=(M-this.eventData.lastSuccess)/864e5;w=w||B>=1||B<-1||O.getDate()!==D.getDate()}else w=!0;w?this.postEvent(M,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:le,"enabled.telemetry":!1,userId:this.anonId},O=>{O||(this.eventData.lastSuccess=M,this.eventData.tokenU=m)},_):this.processRequests()}},he=we.postTurnstileEvent.bind(we),xe=new class extends Ie{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(_,d,m,w){this.skuToken=d,this.errorCb=w,a.e.EVENTS_URL&&(m||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},m):this.errorCb(new Error(ve)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID(),this.postEvent(m,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:le,skuToken:this.skuToken,userId:this.anonId},w=>{w?this.errorCb(w):d&&(this.success[d]=!0)},_))}remove(){this.errorCb=null}},be=xe.postMapLoadEvent.bind(xe),Oe=new class extends Ie{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(_){let d=this.mapInstanceIdMap.get(_);return d||(d=a.u(),this.mapInstanceIdMap.set(_,d)),d}getEventId(_){const d=this.eventIdPerMapInstanceMap.get(_)||0;return this.eventIdPerMapInstanceMap.set(_,d+1),d}postStyleLoadEvent(_,d){const{map:m,style:w,importedStyles:M}=d;if(!a.e.EVENTS_URL||!_&&!a.e.ACCESS_TOKEN)return;const O=this.getMapInstanceId(m),D={mapInstanceId:O,eventId:this.getEventId(O),style:w};M.length&&(D.importedStyles=M),this.queueRequest({timestamp:Date.now(),payload:D},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:m}=this.queue.shift();this.postEvent(d,m,()=>{},_)}},Te=Oe.postStyleLoadEvent.bind(Oe),Ve=new Ne({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Fe=Ve.postMetricsEvent.bind(Ve),Me=new Ne({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Qe=Me.postMetricsEvent.bind(Me),Ee=new class extends Ie{constructor(){super("gljs.performance")}postPerformanceEvent(_,d){a.e.EVENTS_URL&&(_||a.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:m}=this.queue.shift(),w=function(M){const O=performance.getEntriesByType("resource"),D=performance.getEntriesByType("mark"),B=function(ue){const ke={};if(ue){for(const _e in ue)if(_e!=="other")for(const Le of ue[_e]){const Pe=`${_e}ResolveRangeMin`,qe=`${_e}ResolveRangeMax`,Ze=`${_e}RequestCount`,He=`${_e}RequestCachedCount`;ke[Pe]=Math.min(ke[Pe]||1/0,Le.startTime),ke[qe]=Math.max(ke[qe]||-1/0,Le.responseEnd);const xt=ct=>{ke[ct]===void 0&&(ke[ct]=0),++ke[ct]};Le.transferSize!==void 0&&Le.transferSize===0&&xt(He),xt(Ze)}}return ke}(function(ue,ke){const _e={};if(ue)for(const Le of ue){const Pe=ke(Le);_e[Pe]===void 0&&(_e[Pe]=[]),_e[Pe].push(Le)}return _e}(O,y)),V=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,Q=Y?Y.effectiveType:void 0,ce={counters:[],metadata:[],attributes:[]},oe=(ue,ke,_e)=>{_e!=null&&ue.push({name:ke,value:_e.toString()})};for(const ue in B)oe(ce.counters,ue,B[ue]);if(M.interactionRange[0]!==1/0&&M.interactionRange[1]!==-1/0&&(oe(ce.counters,"interactionRangeMin",M.interactionRange[0]),oe(ce.counters,"interactionRangeMax",M.interactionRange[1])),D)for(const ue of Object.values(p)){const ke=D.find(_e=>_e.name===ue);ke&&oe(ce.counters,ue,ke.startTime)}return oe(ce.counters,"visibilityHidden",M.visibilityHidden),oe(ce.attributes,"style",function(ue){if(ue)for(const ke of ue){const _e=ke.name.split("?")[0];if(a.i(_e)){const Le=_e.split("/").slice(-2);if(Le.length===2)return`mapbox://styles/${Le[0]}/${Le[1]}`}}}(O)),oe(ce.attributes,"terrainEnabled",M.terrainEnabled?"true":"false"),oe(ce.attributes,"fogEnabled",M.fogEnabled?"true":"false"),oe(ce.attributes,"projection",M.projection),oe(ce.attributes,"zoom",M.zoom),oe(ce.metadata,"devicePixelRatio",V),oe(ce.metadata,"connectionEffectiveType",Q),oe(ce.metadata,"navigatorUserAgent",navigator.userAgent),oe(ce.metadata,"screenWidth",window.screen.width),oe(ce.metadata,"screenHeight",window.screen.height),oe(ce.metadata,"windowWidth",window.innerWidth),oe(ce.metadata,"windowHeight",window.innerHeight),oe(ce.metadata,"mapWidth",M.width/V),oe(ce.metadata,"mapHeight",M.height/V),oe(ce.metadata,"webglRenderer",M.renderer),oe(ce.metadata,"webglVendor",M.vendor),oe(ce.metadata,"sdkVersion",h),oe(ce.metadata,"sdkIdentifier","mapbox-gl-js"),ce}(m);for(const M of w.metadata);for(const M of w.counters);for(const M of w.attributes);this.postEvent(d,w,()=>{},_)}},Ye=Ee.postPerformanceEvent.bind(Ee),me=new class extends Ie{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(_,d,m,w){if(!a.e.API_URL||!a.e.SESSION_PATH)return;const M=ie(a.e.API_URL+a.e.SESSION_PATH);M.params.push(`sku=${d||""}`),M.params.push(`access_token=${w||a.e.ACCESS_TOKEN||""}`);const O={url:fe(M),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a.g(O,D=>{this.pendingRequest=null,m(D),this.saveEventData(),this.processRequests(w)})}getSessionAPI(_,d,m,w){this.skuToken=d,this.errorCb=w,a.e.SESSION_PATH&&a.e.API_URL&&(m||a.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},m):this.errorCb(new Error(ve)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||this.getSession(m,this.skuToken,w=>{w?this.errorCb(w):d&&(this.success[d]=!0)},_)}remove(){this.errorCb=null}},mt=me.getSessionAPI.bind(me),et=new Set;function nt(_,d){d?et.add(_):et.delete(_)}class Ae{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(d,m){this._updatedSourceCaches[d]=m,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const m=d.scope;this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._updatedLayers[m].add(d.id),this.setDirty()}removeLayer(d){const m=d.scope;this._removedLayers[m]=this._removedLayers[m]||{},this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._removedLayers[m][d.id]=d,this._updatedLayers[m].delete(d.id),this._updatedPaintProps.delete(d.fqid),this.setDirty()}getRemovedLayer(d){return this._removedLayers[d.scope]?this._removedLayers[d.scope][d.id]:null}discardLayerRemoval(d){this._removedLayers[d.scope]&&delete this._removedLayers[d.scope][d.id]}getLayerUpdatesByScope(){const d={};for(const m in this._updatedLayers)d[m]=d[m]||{},d[m].updatedIds=Array.from(this._updatedLayers[m].values());for(const m in this._removedLayers)d[m]=d[m]||{},d[m].removedIds=Object.keys(this._removedLayers[m]);return d}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(d){this._updatedPaintProps.add(d.fqid),this.setDirty()}getUpdatedImages(d){return this._updatedImages[d]?Array.from(this._updatedImages[d].values()):[]}updateImage(d,m){this._updatedImages[m]=this._updatedImages[m]||new Set,this._updatedImages[m].add(a.I.toString(d)),this.setDirty()}resetUpdatedImages(d){this._updatedImages[d]&&this._updatedImages[d].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function ht(_){const{userImage:d}=_;return!!(d&&d.render&&d.render())&&(_.data.replace(new Uint8Array(d.data.buffer)),!0)}class $e extends a.E{constructor(d){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=d,d!=="raster"&&a.r()&&(this.imageRasterizerDispatcher=new a.D(a.t(),this,"Image Rasterizer Worker",1))}addScope(d){this.loaded.set(d,!1),this.imageProviders.set(d,new Map),this.images.set(d,new Map),this.updatedImages.set(d,new Set),this.callbackDispatchedThisFrame.set(d,new Set),this.patterns.set(d,new Map),this.atlasImage.set(d,new a.q({width:1,height:1}))}removeScope(d){this.loaded.delete(d),this.imageProviders.delete(d),this.images.delete(d),this.updatedImages.delete(d),this.callbackDispatchedThisFrame.delete(d),this.patterns.delete(d),this.atlasImage.delete(d);const m=this.atlasTexture.get(d);m&&(m.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,m){this.imageProviders.has(m)||this.imageProviders.set(m,new Map),this.imageProviders.get(m).set(d.id,d)}removeImageProvider(d,m){this.imageProviders.has(m)&&this.imageProviders.get(m).delete(d)}getPendingImageProviders(){const d=[];for(const m of this.imageProviders.values())for(const w of m.values())w.hasPendingRequests()&&d.push(w);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new a.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,m){if(this.loaded.get(m)!==d&&(this.loaded.set(m,d),d)){for(const{ids:w,callback:M}of this.requestors)this._notify(w,m,M);this.requestors=[]}}hasImage(d,m){return!!this.getImage(d,m)}getImage(d,m){return this.images.get(m).get(d.toString())}addImage(d,m,w){this._validate(d,w)&&this.images.get(m).set(d.toString(),w)}_validate(d,m){let w=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),w=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),w=!1),this._validateContent(m.content,m)||(this.fire(new a.y(new Error(`Image "${d.name}" has invalid "content" value`))),w=!1),w}_validateStretch(d,m){if(!d)return!0;let w=0;for(const M of d){if(M[0]a.I.from(m))}getImages(d,m,w){const M=[],O=[],D=this.imageProviders.get(m);for(const Q of d){if(!Q.iconsetId){M.push(Q);continue}const ce=D.get(Q.iconsetId);ce&&(this.getImage(Q,m)?O.push(Q):ce.addPendingRequest(Q))}if(M.length===0)return void this._notify(O,m,w);let B=!0;const V=!!this.loaded.get(m),Y=this.images.get(m);if(!V)for(const Q of M)Y.has(Q.toString())||(B=!1);V||B?this._notify(M,m,w):this.requestors.push({ids:M,scope:m,callback:w})}rasterizeImages(d,m){const w=new Map,{tasks:M,scope:O}=d;for(const[D,B]of M.entries()){const V=this.getImage(B.id,O);V&&w.set(D,{image:V,imageVariant:B})}this._rasterizeImages(O,w,m)}_rasterizeImages(d,m,w){if(a.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:m,scope:d},w);else{const M=new Map;for(const[O,{image:D,imageVariant:B}]of m.entries())M.set(O,this.imageRasterizer.rasterize(B,D,d,0));w(void 0,M)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,m,w){const M=this.images.get(m),O=new Map;for(const D of d){if(!M.get(D.toString())){if(D.iconsetId)continue;this.fire(new a.z("styleimagemissing",{id:D.name}))}const B=M.get(D.toString());if(!B){a.w(`Image "${D.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 V={data:B.usvg?null:B.data.clone(),pixelRatio:B.pixelRatio,sdf:B.sdf,usvg:B.usvg,version:B.version,stretchX:B.stretchX,stretchY:B.stretchY,content:B.content,hasRenderCallback:!!(B.userImage&&B.userImage.render)};B.usvg&&Object.assign(V,{width:B.icon.usvg_tree.width,height:B.icon.usvg_tree.height}),O.set(a.I.toString(D),V)}w(null,O)}getPixelSize(d){const{width:m,height:w}=this.atlasImage.get(d);return{width:m,height:w}}getPattern(d,m,w){const M=d.toString(),O=this.patterns.get(m),D=O.get(M),B=this.getImage(d,m);if(!B)return null;if(D){if(D.position.version===B.version)return D.position;D.position.version=B.version}else{if(B.usvg&&!B.data){const V=this.getPatternInFlightId(M,m);if(this.patternsInFlight.has(V))return null;this.patternsInFlight.add(V);const Y=new a.A(d).scaleSelf(a.o.devicePixelRatio),Q=new Map([[Y.toString(),{image:B,imageVariant:Y}]]);return this._rasterizeImages(m,Q,(ce,oe)=>this.storePatternImage(Y,m,B,w,oe)),null}this.storePattern(d,m,B)}return this._updatePatternAtlas(m,w),O.get(M).position}getPatternInFlightId(d,m){return a.B(d,m)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,m,w,M,O){const D=d.toString(),B=O?O.get(D):void 0;B&&(w.data=B,this.storePattern(d.id,m,w),this._updatePatternAtlas(m,M),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),m)))}storePattern(d,m,w){const M={w:w.data.width+2*a.C,h:w.data.height+2*a.C,x:0,y:0},O=new a.F(M,w,a.C);this.patterns.get(m).set(d.toString(),{bin:M,position:O})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,m){const w=d.gl;let M=this.atlasTexture.get(m);M?this.dirty&&(M.update(this.atlasImage.get(m)),this.dirty=!1):(M=new a.T(d,this.atlasImage.get(m),w.RGBA8),this.atlasTexture.set(m,M)),M.bind(w.LINEAR,w.CLAMP_TO_EDGE)}_updatePatternAtlas(d,m){const w=this.patterns.get(d),M=Array.from(w.values()).map(({bin:Y})=>Y),{w:O,h:D}=a.G(M),B=this.atlasImage.get(d);B.resize({width:O||1,height:D||1});const V=this.images.get(d);for(const[Y,{bin:Q,position:ce}]of w.entries()){let oe=ce.padding;const ue=Q.x+oe,ke=Q.y+oe,_e=V.get(Y).data,Le=_e.width,Pe=_e.height;oe=oe>1?oe-1:oe,a.q.copy(_e,B,{x:0,y:0},{x:ue,y:ke},{width:Le,height:Pe},m),a.q.copy(_e,B,{x:0,y:Pe-oe},{x:ue,y:ke-oe},{width:Le,height:oe},m),a.q.copy(_e,B,{x:0,y:0},{x:ue,y:ke+Pe},{width:Le,height:oe},m),a.q.copy(_e,B,{x:Le-oe,y:0},{x:ue-oe,y:ke},{width:oe,height:Pe},m),a.q.copy(_e,B,{x:0,y:0},{x:ue+Le,y:ke},{width:oe,height:Pe},m),a.q.copy(_e,B,{x:Le-oe,y:Pe-oe},{x:ue-oe,y:ke-oe},{width:oe,height:oe},m),a.q.copy(_e,B,{x:0,y:Pe-oe},{x:ue+Le,y:ke-oe},{width:oe,height:oe},m),a.q.copy(_e,B,{x:0,y:0},{x:ue+Le,y:ke+Pe},{width:oe,height:oe},m),a.q.copy(_e,B,{x:Le-oe,y:0},{x:ue-oe,y:ke+Pe},{width:oe,height:oe},m)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,m){const w=this.images.get(m);for(const M of d){if(this.callbackDispatchedThisFrame.get(m).has(M.toString()))continue;this.callbackDispatchedThisFrame.get(m).add(M.toString());const O=w.get(M.toString());ht(O)&&this.updateImage(M,m,O)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Je(_){const d=_.value,m=_.valueSpec,w=_.style,M=_.styleSpec,O=_.key,D=_.arrayElementValidator||Gs;if(!Array.isArray(d))return[new a.V(O,d,`array expected, ${a.K(d)} found`)];if(m.length&&d.length!==m.length)return[new a.V(O,d,`array length ${m.length} expected, length ${d.length} found`)];if(m["min-length"]&&d.lengthM)return[new a.V(d,m,`${m} is greater than the maximum value ${M}`)]}return[]}function ft(_){const d=_.key,m=_.value;if(!a.H(m))return[new a.V(d,m,`object expected, ${a.K(m)} found`)];const w=_.valueSpec,M=a.J(m.type);let O,D,B,V={};const Y=M!=="categorical"&&m.property===void 0,Q=!Y,ce=function(_e){const Le=_e.stops;return Array.isArray(Le)&&Array.isArray(Le[0])&&a.H(Le[0][0])}(m),oe=Zi({key:_.key,value:_.value,valueSpec:_.styleSpec.function,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{stops:function(_e){if(M==="identity")return[new a.V(_e.key,_e.value,'identity function may not have a "stops" property')];let Le=[];const Pe=_e.value;return Le=Le.concat(Je({key:_e.key,value:Pe,valueSpec:_e.valueSpec,style:_e.style,styleSpec:_e.styleSpec,arrayElementValidator:ue})),Array.isArray(Pe)&&Pe.length===0&&Le.push(new a.V(_e.key,Pe,"array must have at least one stop")),Le},default:function(_e){return Gs({key:_e.key,value:_e.value,valueSpec:w,style:_e.style,styleSpec:_e.styleSpec})}}});return M==="identity"&&Y&&oe.push(new a.V(_.key,_.value,'missing required property "property"')),M==="identity"||m.stops||oe.push(new a.V(_.key,_.value,'missing required property "stops"')),M==="exponential"&&w.expression&&!a.M(w)&&oe.push(new a.V(_.key,_.value,"exponential functions not supported")),_.styleSpec.$version>=8&&(Q&&!a.N(w)?oe.push(new a.V(_.key,_.value,"property functions not supported")):Y&&!a.O(w)&&oe.push(new a.V(_.key,_.value,"zoom functions not supported"))),M!=="categorical"&&!ce||m.property!==void 0||oe.push(new a.V(_.key,_.value,'"property" property is required')),oe;function ue(_e){let Le=[];const Pe=_e.value,qe=_e.key;if(!Array.isArray(Pe))return[new a.V(qe,Pe,`array expected, ${a.K(Pe)} found`)];if(Pe.length!==2)return[new a.V(qe,Pe,`array length 2 expected, length ${Pe.length} found`)];if(ce){if(!a.H(Pe[0]))return[new a.V(qe,Pe,`object expected, ${a.K(Pe[0])} found`)];const Ze=Pe[0];if(Ze.zoom===void 0)return[new a.V(qe,Pe,"object stop key must have zoom")];if(Ze.value===void 0)return[new a.V(qe,Pe,"object stop key must have value")];const He=a.J(Ze.zoom);if(typeof He!="number")return[new a.V(qe,Ze.zoom,"stop zoom values must be numbers")];if(B&&B>He)return[new a.V(qe,Ze.zoom,"stop zoom values must appear in ascending order")];He!==B&&(B=He,D=void 0,V={}),Le=Le.concat(Zi({key:`${qe}[0]`,value:Pe[0],valueSpec:{zoom:{}},style:_e.style,styleSpec:_e.styleSpec,objectElementValidators:{zoom:tt,value:ke}}))}else Le=Le.concat(ke({key:`${qe}[0]`,value:Pe[0],style:_e.style,styleSpec:_e.styleSpec},Pe));return a.Q(a.S(Pe[1]))?Le.concat([new a.V(`${qe}[1]`,Pe[1],"expressions are not allowed in function stops.")]):Le.concat(Gs({key:`${qe}[1]`,value:Pe[1],valueSpec:w,style:_e.style,styleSpec:_e.styleSpec}))}function ke(_e,Le){const Pe=a.K(_e.value),qe=a.J(_e.value),Ze=_e.value!==null?_e.value:Le;if(O){if(Pe!==O)return[new a.V(_e.key,Ze,`${Pe} stop domain type must match previous stop domain type ${O}`)]}else O=Pe;if(Pe!=="number"&&Pe!=="string"&&Pe!=="boolean"&&typeof qe!="number"&&typeof qe!="string"&&typeof qe!="boolean")return[new a.V(_e.key,Ze,"stop domain value must be a number, string, or boolean")];if(Pe!=="number"&&M!=="categorical"){let He=`number expected, ${Pe} found`;return a.N(w)&&M===void 0&&(He+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new a.V(_e.key,Ze,He)]}return M!=="categorical"||Pe!=="number"||typeof qe=="number"&&isFinite(qe)&&Math.floor(qe)===qe?M!=="categorical"&&Pe==="number"&&typeof qe=="number"&&typeof D=="number"&&D!==void 0&&qenew a.V(`${_.key}${w.key}`,_.value,w.message));const m=d.value.expression||d.value._styleExpression.expression;if(_.expressionContext==="property"&&_.propertyKey==="text-font"&&!m.outputDefined())return[new a.V(_.key,_.value,`Invalid data expression for "${_.propertyKey}". Output values must be contained as literals within the expression.`)];if(_.expressionContext==="property"&&_.propertyType==="layout"&&!a.Z(m))return[new a.V(_.key,_.value,'"feature-state" data expressions are not supported with layout properties.')];if(_.expressionContext==="filter")return Nt(m,_);if(_.expressionContext==="appearance")return Et(m,_);if(_.expressionContext&&_.expressionContext.indexOf("cluster")===0){if(!a.X(m,["zoom","feature-state"]))return[new a.V(_.key,_.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(_.expressionContext==="cluster-initial"&&!a.Y(m))return[new a.V(_.key,_.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Nt(_,d){const m=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.delete(M);if(m.size===0)return[];const w=[];return _ instanceof a._&&m.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(_.eachChild(M=>{w.push(...Nt(M,d))}),w)}function Et(_,d){const m=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.add(M);if(m.size===0)return[];const w=[];return _ instanceof a._&&!m.has(_.name)?[new a.V(d.key,d.value,`["${_.name}"] is not an allowed parameter`)]:(_.eachChild(M=>{w.push(...Et(M,d))}),w)}function vt(_){const d=_.key,m=_.value,w=_.valueSpec,M=[];return Array.isArray(w.values)?w.values.indexOf(a.J(m))===-1&&M.push(new a.V(d,m,`expected one of [${w.values.join(", ")}], ${JSON.stringify(m)} found`)):Object.keys(w.values).indexOf(a.J(m))===-1&&M.push(new a.V(d,m,`expected one of [${Object.keys(w.values).join(", ")}], ${JSON.stringify(m)} found`)),M}function rr(_){return a.a2(a.S(_.value))?jt(Object.assign({},_,{expressionContext:"filter",valueSpec:_.styleSpec[`filter_${_.layerType||"fill"}`]})):Ar(_)}function Ar(_){const d=_.value,m=_.key;if(!Array.isArray(d))return[new a.V(m,d,`array expected, ${a.K(d)} found`)];if(d.length<1)return[new a.V(m,d,"filter array must have at least 1 element")];const w=_.styleSpec;let M=vt({key:`${m}[0]`,value:d[0],valueSpec:w.filter_operator});const O=()=>{d.length>=2&&(a.a0(d[1])||M.push(new a.V(`${m}[1]`,d[1],`string expected, ${a.K(d[1])} found`)));for(let D=2;D":case">=":d.length>=2&&a.J(d[1])==="$type"&&M.push(new a.V(m,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&M.push(new a.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"==":case"!=":d.length!==3&&M.push(new a.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"in":case"!in":O();break;case"any":case"all":case"none":for(let D=1;D{Y in m&&d.push(new a.V(w,m[Y],`"${Y}" is prohibited for ref layers`))}),M.layers.forEach(Y=>{a.J(Y.id)===B&&(V=Y)}),V?V.ref?d.push(new a.V(w,m.ref,"ref cannot reference another ref layer")):D=a.J(V.type):typeof B=="string"&&d.push(new a.V(w,m.ref,`ref layer "${B}" not found`))}else if(D!=="background"&&D!=="sky"&&D!=="slot")if(m.source)if(a.a0(m.source)){const V=M.sources&&M.sources[m.source],Y=V&&a.J(V.type);V?Y==="vector"&&D==="raster"?d.push(new a.V(w,m.source,`layer "${m.id}" requires a raster source`)):Y==="raster"&&D!=="raster"?d.push(new a.V(w,m.source,`layer "${m.id}" requires a vector source`)):Y!=="vector"||m["source-layer"]?Y==="raster-dem"&&D!=="hillshade"?d.push(new a.V(w,m.source,"raster-dem source can only be used with layer type 'hillshade'.")):Y!=="raster-array"||["raster","raster-particle"].includes(D)?D==="line"&&m.paint&&(m.paint["line-gradient"]||m.paint["line-trim-offset"])&&Y==="geojson"&&!V.lineMetrics?d.push(new a.V(w,m,`layer "${m.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):D==="raster-particle"&&Y!=="raster-array"&&d.push(new a.V(w,m.source,`layer "${m.id}" requires a 'raster-array' source.`)):d.push(new a.V(w,m.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new a.V(w,m,`layer "${m.id}" must specify a "source-layer"`)):d.push(new a.V(w,m.source,`source "${m.source}" not found`))}else d.push(new a.V(`${w}.source`,m.source,'"source" must be a string'));else d.push(new a.V(w,m,'missing required property "source"'));return d=d.concat(Zi({key:w,value:m,valueSpec:O.layer,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Gs({key:`${w}.type`,value:m.type,valueSpec:O.layer.type,style:_.style,styleSpec:_.styleSpec,object:m,objectKey:"type"}),filter:V=>rr(Object.assign({layerType:D},V)),layout:V=>Zi({layer:m,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>Jr(Object.assign({layerType:D},Y))}}),paint:V=>Zi({layer:m,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>kn(Object.assign({layerType:D,layer:m},Y))}}),appearances(V){const Y=Je({key:V.key,value:V.value,valueSpec:V.valueSpec,style:V.style,styleSpec:V.styleSpec,arrayElementValidator:oe=>function(ue){const{key:ke,layer:_e,layerType:Le}=ue,Pe=a.J(ue.value),qe=a.J(Pe.name),Ze=a.J(Pe.condition),He=Zi({key:ke,value:Pe,valueSpec:ue.styleSpec.appearance,style:ue.style,styleSpec:ue.styleSpec,objectElementValidators:{condition:xt=>function(ct){const pt=[];return pt.push(...jt({key:ct.key,value:ct.object.condition,valueSpec:a.a6.appearance.condition,expressionContext:"appearance"})),pt}(Object.assign({layer:_e,layerType:Le},xt)),properties:xt=>function(ct){const pt=[],{styleSpec:lt,layer:st,layerType:wt}=ct,Ot=lt[`paint_${wt}`],Pt=lt[`layout_${wt}`],Vt=ct.object[ct.objectKey];for(const Wt in Vt){const sr=Wt in Ot?"paint":Wt in Pt?"layout":void 0;if(!sr){pt.push(new a.V(ct.key,Wt,`unknown property "${Wt}" for layer type "${wt}"`));continue}const br=Object.assign({},ct,{key:`${ct.key}.${Wt}`,object:Vt,objectKey:Wt,layer:st,layerType:wt,value:Vt[Wt],valueSpec:sr==="paint"?Ot[Wt]:Pt[Wt]});pt.push(...yn(br,sr))}return pt}(Object.assign({layer:_e,layerType:Le},xt))}});return qe!=="hidden"&&Ze===void 0&&He.push(new a.V(ue.key,"name",'Appearance with name different than "hidden" must have a condition')),He}(Object.assign({layerType:D,layer:m},oe))}),Q=Array.isArray(V.value)?V.value:[],ce=new Set;return Q.forEach((oe,ue)=>{const ke=a.J(oe.name);if(ke)if(ce.has(ke)){const _e=a.J(m.id);Y.push(new a.V(V.key,ke,`Duplicated appearance name "${ke}" for layer "${_e}"`))}else ce.add(ke)}),Y}}})),d}function ks({key:_,value:d}){return a.a0(d)?[]:[new a.V(_,d,`string expected, ${a.K(d)} found`)]}const fr={promoteId:function _({key:d,value:m}){if(a.a0(m))return ks({key:d,value:m});if(Array.isArray(m)){const M=[],O=a.S(m),D=a.U(O);return D.result==="error"&&D.value.forEach(B=>{M.push(new a.V(`${d}${B.key}`,null,`${B.message}`))}),a.X(D.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"])||M.push(new a.V(`${d}`,null,"promoteId expression should be only feature dependent")),M}if(!a.H(m))return[new a.V(d,m,`string, expression or object expected, "${a.K(m)}" found`)];const w=[];for(const M in m)w.push(..._({key:`${d}.${M}`,value:m[M]}));return w}};function xs(_){const d=_.value,m=_.key,w=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(m,d,`object expected, ${a.K(d)} found`)];if(!("type"in d))return[new a.V(m,d,'"type" is required')];const O=a.J(d.type);let D=[];switch(["vector","raster","raster-dem","raster-array"].includes(O)&&("url"in d||"tiles"in d||D.push(new a.a3(m,d,'Either "url" or "tiles" is required.'))),O){case"vector":case"raster":case"raster-dem":case"raster-array":return D=D.concat(Zi({key:m,value:d,valueSpec:w[`source_${O.replace("-","_")}`],style:_.style,styleSpec:w,objectElementValidators:fr})),D;case"geojson":if(D=Zi({key:m,value:d,valueSpec:w.source_geojson,style:M,styleSpec:w,objectElementValidators:fr}),"cluster"in d&&"clusterProperties"in d){if(!a.H(d.clusterProperties))return[new a.V(`${m}.clusterProperties`,d,`object expected, ${a.K(d)} found`)];for(const B in d.clusterProperties){const V=d.clusterProperties[B];if(!Array.isArray(V))return[new a.V(`${m}.clusterProperties.${B}`,V,"array expected")];const[Y,Q]=V,ce=typeof Y=="string"?[Y,["accumulated"],["get",B]]:Y;D.push(...jt({key:`${m}.${B}.map`,value:Q,expressionContext:"cluster-map"})),D.push(...jt({key:`${m}.${B}.reduce`,value:ce,expressionContext:"cluster-reduce"}))}}return D;case"video":return Zi({key:m,value:d,valueSpec:w.source_video,style:M,styleSpec:w});case"image":return Zi({key:m,value:d,valueSpec:w.source_image,style:M,styleSpec:w});case"canvas":return[new a.V(m,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return vt({key:`${m}.type`,value:d.type,valueSpec:{values:ji(w)}})}}function ji(_){return _.source.reduce((d,m)=>{const w=_[m];return w.type.type==="enum"&&(d=d.concat(Object.keys(w.type.values||{}))),d},[])}function mi(_){const d=_.value,m=_.styleSpec,w=m.light,M=_.style;if(d===void 0)return[];if(!a.H(d))return[new a.V("light",d,`object expected, ${a.K(d)} found`)];let O=[];for(const D in d){const B=D.match(/^(.*)-transition$/),V=D.match(/^(.*)-use-theme$/);O=O.concat(V&&w[V[1]]?Gs({key:D,value:d[D],valueSpec:{type:"string"},style:M,styleSpec:m}):B&&w[B[1]]&&w[B[1]].transition?Gs({key:D,value:d[D],valueSpec:m.transition,style:M,styleSpec:m}):w[D]?Gs({key:D,value:d[D],valueSpec:w[D],style:M,styleSpec:m}):[new a.V(D,d[D],`unknown property "${D}"`)])}return O}function La(_){const d=_.value;if(!d)return[];const m=_.key;if(!a.H(d))return[new a.V(m,d,`object expected, ${a.K(d)} found`)];let w=[];const M=_.styleSpec,O=M["light-3d"],D=_.style,B=_.style.lights;for(const Q of["type","id"])if(!(Q in d))return w=w.concat([new a.V(m,d,`missing property "${Q}"`)]),w;if(!a.a0(d.type))return w=w.concat([new a.V(`${m}.type`,d.type,"string expected")]),w;if(B)for(let Q=0;Q<_.arrayIndex;Q++){const ce=a.J(d.type),oe=B[Q];a.J(oe.type)===ce&&w.push(new a.V(m,d.id,`duplicate light type "${d.type}", previously defined at line ${oe.id.__line__}`))}const V=`properties_light_${d.type}`;if(!(V in M))return w=w.concat([new a.V(`${m}.type`,d,`Invalid light type ${d.type}`)]),w;const Y=M[V];for(const Q in d)if(Q==="properties"){const ce=d[Q];if(!a.H(ce))return w=w.concat([new a.V("properties",ce,`object expected, ${a.K(ce)} found`)]),w;for(const oe in ce){const ue=oe.match(/^(.*)-transition$/),ke=oe.match(/^(.*)-use-theme$/);w=w.concat(ke&&Y[ke[1]]?Gs({key:Q,value:ce[oe],valueSpec:{type:"string"},style:D,styleSpec:M}):ue&&Y[ue[1]]&&Y[ue[1]].transition?Gs({key:Q,value:d[Q],valueSpec:M.transition,style:D,styleSpec:M}):Y[oe]?Gs({key:oe,value:ce[oe],valueSpec:Y[oe],style:D,styleSpec:M}):[new a.a3(_.key,ce[oe],`unknown property "${oe}"`)])}}else w=w.concat(O[Q]?Gs({key:Q,value:d[Q],valueSpec:O[Q],style:D,styleSpec:M}):[new a.a3(Q,d[Q],`unknown property "${Q}"`)]);return w}function da(_){const d=_.value,m=_.key,w=_.style,M=_.styleSpec,O=M.terrain;if(d==null)return[];if(!a.H(d))return[new a.V("terrain",d,`object expected, ${a.K(d)} found`)];let D=[];for(const B in d){const V=B.match(/^(.*)-transition$/),Y=B.match(/^(.*)-use-theme$/);D=D.concat(Y&&O[Y[1]]?Gs({key:B,value:d[B],valueSpec:{type:"string"},style:w,styleSpec:M}):V&&O[V[1]]&&O[V[1]].transition?Gs({key:B,value:d[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Gs({key:B,value:d[B],valueSpec:O[B],style:w,styleSpec:M}):[new a.a3(B,d[B],`unknown property "${B}"`)])}if(d.source)if(a.a0(d.source)){const B=w.sources&&w.sources[d.source],V=B&&a.J(B.type);B?V!=="raster-dem"&&D.push(new a.V(`${m}.source`,d.source,`terrain cannot be used with a source of type ${V}, it only be used with a "raster-dem" source type`)):D.push(new a.V(`${m}.source`,d.source,`source "${d.source}" not found`))}else D.push(new a.V(`${m}.source`,d.source,"source must be a string"));else D.push(new a.V(m,d,'terrain is missing required property "source"'));return D}function tl(_){const d=_.value,m=_.style,w=_.styleSpec,M=w.fog;if(d===void 0)return[];if(!a.H(d))return[new a.V("fog",d,`object expected, ${a.K(d)} found`)];let O=[];for(const D in d){const B=D.match(/^(.*)-transition$/),V=D.match(/^(.*)-use-theme$/);O=O.concat(V&&M[V[1]]?Gs({key:D,value:d[D],valueSpec:{type:"string"},style:m,styleSpec:w}):B&&M[B[1]]&&M[B[1]].transition?Gs({key:D,value:d[D],valueSpec:w.transition,style:m,styleSpec:w}):M[D]?Gs({key:D,value:d[D],valueSpec:M[D],style:m,styleSpec:w}):[new a.a3(D,d[D],`unknown property "${D}"`)])}return O}const rl={"*":()=>[],array:Je,boolean:function(_){const d=_.value,m=_.key;return a.$(d)?[]:[new a.V(m,d,`boolean expected, ${a.K(d)} found`)]},number:tt,color:function({key:_,value:d}){return a.a0(d)?a.a1.parseCSSColor(d)===null?[new a.V(_,d,`color expected, "${d}" found`)]:[]:[new a.V(_,d,`color expected, ${a.K(d)} found`)]},enum:vt,filter:rr,function:ft,layer:zn,object:Zi,source:xs,model:a.a7,light:mi,"light-3d":La,terrain:da,fog:tl,string:ks,formatted:function(_){return ks(_).length===0?[]:jt(_)},resolvedImage:function(_){return ks(_).length===0?[]:jt(_)},projection:function(_){const d=_.value,m=_.styleSpec,w=m.projection,M=_.style;if(a.H(d)){let O=[];for(const D in d)O=O.concat(Gs({key:D,value:d[D],valueSpec:w[D],style:M,styleSpec:m}));return O}return a.a0(d)?[]:[new a.V("projection",d,`object or string expected, ${a.K(d)} found`)]},import:function(_){const d=_.key,{value:m,styleSpec:w}=_;if(!a.H(m))return[new a.V(d,m,"import must be an object")];const{data:M,...O}=m;Object.defineProperty(O,"__line__",{value:m.__line__,enumerable:!1});let D=Zi(Object.assign({},_,{value:O,valueSpec:w.import}));return a.J(O.id)===""&&D.push(new a.V(`${_.key}.id`,O,"import id can't be an empty string")),M&&(D=D.concat(Ei(M,w,{key:`${_.key}.data`}))),D},iconset:function(_){const d=_.value,m=_.key,w=_.styleSpec,M=_.style;if(!a.H(d))return[new a.V(m,d,"object expected")];if(!d.type)return[new a.V(m,d,'"type" is required')];const O=a.J(d.type);let D=[];if(D=D.concat(Zi({key:m,value:d,valueSpec:w[`iconset_${O}`],style:M,styleSpec:w})),function(B,V){return!(B!=="source"||!V.source)}(O,d)){const B=M.sources&&M.sources[d.source],V=B&&a.J(B.type);B?V!=="raster-array"&&D.push(new a.V(m,d.source,`iconset cannot be used with a source of type ${String(V)}, it only be used with a "raster-array" source type`)):D.push(new a.V(m,d.source,`source "${d.source}" not found`))}return D}};function Gs(_,d=!1){const m=_.value,w=_.valueSpec,M=_.styleSpec;if(w.expression){if(a.a4(a.J(m)))return ft(_);if(a.Q(a.S(m)))return jt(_)}if(w.type&&rl[w.type]){const O=rl[w.type](_);return d===!0&&O.length>0&&Array.isArray(_.value)?jt(_):O}return Zi(Object.assign({},_,{valueSpec:w.type?M[w.type]:w}))}function Zi(_){const d=_.key,m=_.value,w=_.valueSpec||{},M=_.objectElementValidators||{},O=_.style,D=_.styleSpec;if(!a.H(m))return[new a.V(d,m,`object expected, ${a.K(m)} found`)];let B=[];for(const V in m){const Y=V.split(".")[0];let Q;M[Y]?Q=M[Y]:w[Y]?Q=Gs:M["*"]?Q=M["*"]:w["*"]&&(Q=Gs),Q?B=B.concat(Q({key:(d&&`${d}.`)+V,value:m[V],valueSpec:w[Y]||w["*"],style:O,styleSpec:D,object:m,objectKey:V},m)):B.push(new a.a3(d,m[V],`unknown property "${V}"`))}for(const V in w){if(M[V])continue;const Y=w[V];Y.required&&Y.default===void 0&&m[V]===void 0&&B.push(new a.V(d,m,`missing required property "${V}"`))}return B}function Ns({key:_,value:d}){const m=ks({key:_,value:d});if(m.length)return m;const w=d;return w.indexOf("{fontstack}")===-1&&m.push(new a.V(_,d,'"glyphs" url must include a "{fontstack}" token')),w.indexOf("{range}")===-1&&m.push(new a.V(_,d,'"glyphs" url must include a "{range}" token')),m}function Ei(_,d=a.a6,m={}){return Zi({key:m.key||"",value:_,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:_,objectElementValidators:{glyphs:Ns}})}function Ii(_,d=a.a6){return Re(Ei(_,d))}const Oo=_=>Re(xs(_)),ir=_=>Re(mi(_)),xo=_=>Re(La(_)),Tc=_=>Re(da(_)),yo=_=>Re(tl(_)),ss=_=>Re(function(d){const m=d.value,w=d.style,M=d.styleSpec,O=M.snow;if(m===void 0)return[];if(!a.H(m))return[new a.V("snow",m,`object expected, ${a.K(m)} found`)];let D=[];for(const B in m){const V=B.match(/^(.*)-transition$/);D=D.concat(V&&O[V[1]]&&O[V[1]].transition?Gs({key:B,value:m[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Gs({key:B,value:m[B],valueSpec:O[B],style:w,styleSpec:M}):[new a.a3(B,m[B],`unknown property "${B}"`)])}return D}(_)),vo=_=>Re(function(d){const m=d.value,w=d.style,M=d.styleSpec,O=M.rain;if(m===void 0)return[];if(!a.H(m))return[new a.V("rain",m,`object expected, ${a.K(m)} found`)];let D=[];for(const B in m){const V=B.match(/^(.*)-transition$/);D=D.concat(V&&O[V[1]]&&O[V[1]].transition?Gs({key:B,value:m[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Gs({key:B,value:m[B],valueSpec:O[B],style:w,styleSpec:M}):[new a.a3(B,m[B],`unknown property "${B}"`)])}return D}(_)),Bd=_=>Re(zn(_)),_r=_=>Re(rr(_)),Hn=_=>Re(kn(_)),kt=_=>Re(Jr(_)),je=_=>Re(a.a7(_));function Re(_){return _.slice().sort((d,m)=>d.line&&m.line?d.line-m.line:0)}function Ke(_,d){let m=!1;if(d&&d.length)for(const w of d)w instanceof a.a3?a.w(w.message):(_.fire(new a.y(new Error(w.message))),m=!0);return m}const bt=a.a6.light;let yt;class At extends a.E{constructor(d,m="flat"){super(),this._transitionable=new a.a8(yt||(yt=new a.a9({anchor:new a.aa(bt.anchor),position:new a.ab(bt.position),color:new a.aa(bt.color),intensity:new a.aa(bt.intensity)}))),this.setLight(d,m),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,m,w={}){this._validate(ir,d,w)||(this._transitionable.setTransitionOrValue(d),this.id=m)}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,w){return(!w||w.validate!==!1)&&Ke(this,d.call(Ii,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}const Bt=a.a6.terrain;let Lt=class extends a.E{constructor(_,d,m,w,M){super(),this.scope=m,this._transitionable=new a.a8(new a.a9({source:new a.aa(Bt.source),exaggeration:new a.aa(Bt.exaggeration)}),m,w),this._transitionable.setTransitionOrValue(_,w),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=M}get(){return this._transitionable.serialize()}set(_,d){this._transitionable.setTransitionOrValue(_,d)}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}getExaggeration(_){return this._transitioning.possiblyEvaluate(new a.ac(_,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const _=this._transitionable._values.exaggeration;if(!_)return null;const d=_.value.expression;if(!d)return null;let m=-1,w=-1,M=1;for(const O of d.zoomStops)M=d.evaluate(new a.ac(O,{worldview:this.worldview})),M>.01?(m=O,w=-1):w=O;return M<.01&&m>0&&w>m?[m,w]:null}isZoomDependent(){const _=this._transitionable._values.exaggeration;return _!=null&&_.value!=null&&_.value.expression!=null&&_.value.expression instanceof a.ad}};const Ut=45,gr=65,ar=.05;function Xr(_,d,m,w){const M=a.ah(Ut,gr,m),[O,D]=tn(_,w);let B=1-Math.min(1,Math.exp((d-O)/(D-O)*-6));return B*=B*B,B=Math.min(1,1.00747*B),B*M*_.alpha}function tn(_,d){const m=.5/Math.tan(.5*d);return[_.range[0]+m,_.range[1]+m]}function Vr(_,d,m,w,M){const O=a.af([],[d,m,w],M.mercatorFogMatrix);return Xr(_,a.ag(O),M.pitch,M._fov)}function ts(_,d,m,w,M,O,D){const B=[[m,w,0],[M,w,0],[M,O,0],[m,O,0]];let V=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const Q of B){const ce=a.af([],Q,d),oe=a.ag(ce);V=Math.min(V,oe),Y=Math.max(Y,oe)}return[Xr(_,V,D.pitch,D._fov),Xr(_,Y,D.pitch,D._fov)]}const Xn=a.a6.fog;class Qn extends a.E{constructor(d,m,w,M){super();const O=new a.a9({range:new a.aa(Xn.range),color:new a.aa(Xn.color),"color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new a.aa(Xn["high-color"]),"high-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new a.aa(Xn["space-color"]),"space-color-use-theme":new a.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new a.aa(Xn["horizon-blend"]),"star-intensity":new a.aa(Xn["star-intensity"]),"vertical-range":new a.aa(Xn["vertical-range"])});this._transitionable=new a.a8(O,w,new Map(M)),this.set(d,M),this._transitioning=this._transitionable.untransitioned(),this._transform=m,this.properties=new a.ai(O),this.scope=w}get state(){const d=this._transform,m=d.projection.name==="globe",w=a.aj(d.zoom),M=this.properties.get("range"),O=[.5,3];return{range:m?[a.ak(O[0],M[0],w),a.ak(O[1],M[1],w)]:M,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,m,w={}){if(this._validate(yo,d,w))return;const M=Object.assign({},d);for(const O of Object.keys(Xn))M[O]===void 0&&(M[O]=Xn[O].default);this._options=M,this._transitionable.setTransitionOrValue(this._options,m)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const m=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.ah(Ut,gr,d))*m.a}getOpacityAtLatLng(d,m){return this._transform.projection.supportsFog?function(w,M,O){const D=a.ae.fromLngLat(M),B=O.elevation?O.elevation.getAtPointOrZero(D):0;return Vr(w,D.x,D.y,B,O)}(this.state,d,m):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const m=this._transform.calculateFogTileMatrix(d.toUnwrapped());return ts(this.state,m,0,0,a.al,a.al,this._transform)}getOpacityForBounds(d,m,w,M,O){return this._transform.projection.supportsFog?ts(this.state,d,m,w,M,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?tn(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const m=[4,5,6,7];for(const w of m){const M=d.points[w];let O;if(M[2]>=0)O=M;else{const D=d.points[w-4];O=a.am(D,M,D[2]/(D[2]-M[2]))}if(Vr(this.state,O[0],O[1],0,this._transform)>=ar)return!0}return!1}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,w){return(!w||w.validate!==!1)&&Ke(this,d.call(Ii,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}}let Bs,Ta,Za,Oa,fo=class extends a.E{constructor(_,d,m,w){super();const M=Bs||(Bs=new a.a9({density:new a.aa(a.a6.snow.density),intensity:new a.aa(a.a6.snow.intensity),color:new a.aa(a.a6.snow.color),opacity:new a.aa(a.a6.snow.opacity),vignette:new a.aa(a.a6.snow.vignette),"vignette-color":new a.aa(a.a6.snow["vignette-color"]),"center-thinning":new a.aa(a.a6.snow["center-thinning"]),direction:new a.aa(a.a6.snow.direction),"flake-size":new a.aa(a.a6.snow["flake-size"])}));this._transitionable=new a.a8(M,m,new Map(w)),this.set(_,w),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=m}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),w=a.an(m[0]),M=-Math.max(a.an(m[1]),.01),O=[Math.cos(w)*Math.cos(M),Math.sin(w)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette"),B=this.properties.get("vignette-color");return B.a=D,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:O,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:B}}get(){return this._transitionable.serialize()}set(_,d,m={}){if(this._validate(ss,_,m))return;const w=Object.assign({},_),M=a.a6.snow;for(const O of Object.keys(M))w[O]===void 0&&(w[O]=M[O].default);this._options=w,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,m){return(!m||m.validate!==!1)&&Ke(this,_.call(Ii,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}},wa=class extends a.E{constructor(_,d,m,w){super();const M=Ta||(Ta=new a.a9({density:new a.aa(a.a6.rain.density),intensity:new a.aa(a.a6.rain.intensity),color:new a.aa(a.a6.rain.color),opacity:new a.aa(a.a6.rain.opacity),vignette:new a.aa(a.a6.rain.vignette),"vignette-color":new a.aa(a.a6.rain["vignette-color"]),"center-thinning":new a.aa(a.a6.rain["center-thinning"]),direction:new a.aa(a.a6.rain.direction),"droplet-size":new a.aa(a.a6.rain["droplet-size"]),"distortion-strength":new a.aa(a.a6.rain["distortion-strength"])}));this._transitionable=new a.a8(M,m,new Map(w)),this.set(_,w),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ai(M),this.scope=m}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),w=a.an(m[0]),M=-Math.max(a.an(m[1]),.01),O=[Math.cos(w)*Math.cos(M),Math.sin(w)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette-color");return D.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.ao(d.r,d.g,d.b,d.a*_),direction:O,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:D}}get(){return this._transitionable.serialize()}set(_,d,m={}){if(this._validate(vo,_,m))return;const w=Object.assign({},_),M=a.a6.rain;for(const O of Object.keys(M))w[O]===void 0&&(w[O]=M[O].default);this._options=w,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,m){return(!m||m.validate!==!1)&&Ke(this,_.call(Ii,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:a.a6})))}};class Ks extends a.E{constructor(d,m,w,M){super(),this.scope=w,this._options=d,this.properties=new a.ai(m),this._transitionable=new a.a8(m,w,new Map(M)),this._transitionable.setTransitionOrValue(d.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(d){this._transitionable.setTransitionOrValue(this._options.properties,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(d,m){this._options=d,this._transitionable.setTransitionOrValue(d.properties,m)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ma{constructor(d,m,w){this.screenBounds=d,this.cameraPoint=w.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=m,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,w)}static createFromScreenPoints(d,m){let w,M;if(d instanceof a.P||typeof d[0]=="number"){const O=a.P.convert(d);w=[O],M=m.isPointAboveHorizon(O)}else{const O=a.P.convert(d[0]),D=a.P.convert(d[1]),B=O.add(D)._div(2);w=[O,D],M=a.aq(O,D).every(V=>m.isPointAboveHorizon(V))&&m.isPointAboveHorizon(B)}return new ma(w,M,m)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return a.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const m=this.screenBounds[0],w=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(m,w,0,!1);return this.cameraPoint.y>w.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x=w.x?M[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(M[3]=this.cameraPoint)),a.ar(M,d)}bufferedCameraGeometryGlobe(d){const m=this.screenBounds[0],w=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],M=a.aq(m,w,d),O=this.cameraPoint.clone();switch(3*((O.y>m.y)+(O.y>w.y))+((O.x>m.x)+(O.x>w.x))){case 0:M[0]=O,M[4]=O.clone();break;case 1:M.splice(1,0,O);break;case 2:M[1]=O;break;case 3:M.splice(4,0,O);break;case 5:M.splice(2,0,O);break;case 6:M[3]=O;break;case 7:M.splice(3,0,O);break;case 8:M[2]=O}return M}containsTile(d,m,w,M=0){const O=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/m._pixelsPerMercatorPixel+1,D=w?this._bufferedCameraMercator(O,m):this._bufferedScreenMercator(O,m);let B=d.tileID.wrap+(D.unwrapped?M:0);const V=D.polygon.map(Le=>a.as(d.tileTransform,Le,B));if(!a.at(V,0,0,a.al,a.al))return;B=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?M:0);const Y=this.screenGeometryMercator.polygon.map(Le=>a.au(d.tileTransform,Le,B)),Q=Y.map(Le=>new a.P(Le[0],Le[1])),ce=m.getFreeCameraOptions().position||new a.ae(0,0,0),oe=a.au(d.tileTransform,ce,B),ue=Y.map(Le=>{const Pe=a.av(Le,Le,oe);return a.aw(Pe,Pe),new a.ax(oe,Pe)}),ke=a.ay(d,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:Q,tilespaceRays:ue,bufferedTilespaceGeometry:V,bufferedTilespaceBounds:(_e=a.az(V),_e.min.x=a.aA(_e.min.x,0,a.al),_e.min.y=a.aA(_e.min.y,0,a.al),_e.max.x=a.aA(_e.max.x,0,a.al),_e.max.y=a.aA(_e.max.y,0,a.al),_e),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:ke};var _e}_bufferedScreenMercator(d,m){const w=Ba(d);if(this._screenRaycastCache[w])return this._screenRaycastCache[w];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),m):{polygon:this.bufferedScreenGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._screenRaycastCache[w]=M,M}}_bufferedCameraMercator(d,m){const w=Ba(d);if(this._cameraRaycastCache[w])return this._cameraRaycastCache[w];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),m):{polygon:this.bufferedCameraGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._cameraRaycastCache[w]=M,M}}_projectAndResample(d,m){const w=function(O,D){const B=a.aB([],D.pixelMatrix,D.globeMatrix),V=[0,-a.aD,0,1],Y=[0,a.aD,0,1],Q=[0,0,0,1];a.aC(V,V,B),a.aC(Y,Y,B),a.aC(Q,Q,B);const ce=new a.P(V[0]/V[3],V[1]/V[3]),oe=new a.P(Y[0]/Y[3],Y[1]/Y[3]),ue=a.aE(O,ce)&&V[3]1?zi(O.slice(0,Le),D):[],Ze=Lenew a.P(Ms(pt.x),pt.y)),Ze=Ze.map(pt=>new a.P(Ms(pt.x),pt.y));const He=[...qe];He.length===0&&He.push(Ze[Ze.length-1]);const xt=a.ak(He[He.length-1].y,(Ze.length===0?qe[0]:Ze[0]).y,Pe);let ct;return ct=ue?[new a.P(0,xt),new a.P(0,0),new a.P(1,0),new a.P(1,xt)]:[new a.P(1,xt),new a.P(1,1),new a.P(0,1),new a.P(0,xt)],He.push(...ct),Ze.length===0?He.push(qe[0]):He.push(...Ze),{polygon:He.map(pt=>new a.ae(pt.x,pt.y)),unwrapped:!1}}(d,m);if(w)return w;const M=function(O,D){let B=!1,V=-1/0,Y=0;for(let ce=0;ceV&&(V=O[ce].x,Y=ce);for(let ce=0;ce.5&&(ue.x{ce.x-=1}),{polygon:O,unwrapped:B}}(zi(d,m).map(O=>new a.P(Ms(O.x),O.y)),m);return{polygon:M.polygon.map(O=>new a.ae(O.x,O.y)),unwrapped:M.unwrapped}}}function zi(_,d){return a.aG(_,m=>{const w=d.pointCoordinate3D(m);m.x=w.x,m.y=w.y},1/256)}function Ms(_){return _<0?1+_%1:_%1}function Ba(_){return 100*_|0}function Nl(_,d,m,w,M){const O=function(B,V){if(B)return M(B);if(V){if(_.url&&V.tiles&&_.tiles&&delete _.tiles,V.variants){if(!Array.isArray(V.variants))return M(new Error("variants must be an array"));for(const Q of V.variants){if(Q==null||typeof Q!="object"||Q.constructor!==Object)return M(new Error("variant must be an object"));if(!Array.isArray(Q.capabilities))return M(new Error("capabilities must be an array"));if(Q.capabilities.length===1&&Q.capabilities[0]==="meshopt"){V=Object.assign(V,Q);break}}}const Y=a.aH(Object.assign({},V,_),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);Y.tiles=d.canonicalizeTileset(Y,_.url),M(null,Y)}},D=function(B,V,Y){if(!B)return null;if(!V&&!Y)return B;Y=Y||B.worldview_default;const Q=Object.values(B.language||{});if(Q.length===0)return null;const ce=Object.values(B.worldview||{});if(ce.length===0)return null;const oe=Q.every(ke=>ke===V),ue=ce.every(ke=>ke===Y);return oe&&ue?B:V in(B.language_options||{})||Y in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(_.data,m,w);return D?a.o.frame(()=>O(null,D)):_.url?a.m(d.transformRequest(d.normalizeSourceURL(_.url,null,m,w),a.R.Source),O):a.o.frame(()=>{const{data:B,...V}=_;O(null,V)})}function Fl(_,d){const m=Math.pow(2,d.z),w=Math.floor(a.aF(_.getWest())*m),M=Math.floor(a.aJ(_.getNorth())*m),O=Math.ceil(a.aF(_.getEast())*m),D=Math.ceil(a.aJ(_.getSouth())*m);return d.x>=w&&d.x=M&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,M)m&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${m}`),w&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${w}`),this.fire(new a.y(M));else if(O){if(Object.assign(this,O),this.hasWorldviews=!!O.worldview_options,O.worldview_default&&(this.worldviewDefault=O.worldview_default),O.vector_layers){this.vectorLayers=O.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const D of O.vector_layers)this.vectorLayerIds.push(D.id),O.worldview&&O.worldview[D.source]&&this.localizableLayerIds.add(D.id)}this.tileBounds=Ac.fromTileJSON(O),he(O.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}d&&d(M)})}loaded(){return this._loaded}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(d,m){const w=d.tileID.canonical.url(this.tiles,this.scheme),M=this.map._requestManager.normalizeTileURL(w),O=this.map._requestManager.transformRequest(M,a.R.Tile),D=this.map.style?this.map.style.getLut(this.scope):null,B=D?{image:D.image.clone()}:null,V={request:O,data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,lut:B,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:d.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:d.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&&a.h(w)&&(V.localizableLayerIds=this.localizableLayerIds),V.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=m:d.request=d.actor.send("reloadTile",V,Y.bind(this));else if(d.actor=this._tileWorkers[M]=this._tileWorkers[M]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",V,Y.bind(this),void 0,!0);else{const Q=a.aL.call({deduped:this._deduped},V,(ce,oe)=>{if(ce||!oe)Y.call(this,ce);else{const ue=a.aM(oe.responseHeaders);V.data={rawData:oe.rawData.slice(0),expires:ue.expires,cacheControl:ue.cacheControl},d.actor&&d.actor.send("loadTile",V,Y.bind(this),void 0,!0)}},!0);d.request={cancel:Q}}function Y(Q,ce){return delete d.request,d.aborted?m(null):Q&&Q instanceof a.aN&&Q.status!==404?m(Q):(ce&&ce.resourceTiming&&(d.resourceTiming=ce.resourceTiming),this.map._refreshExpiredTiles&&ce&&d.setExpiryData(ce),d.loadVectorData(ce,this.map.painter),a.aO(this.dispatcher),m(null,ce),void(d.reloadCallback&&(this.loadTile(d,d.reloadCallback),d.reloadCallback=null)))}}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){d.actor&&d.actor.send("removeTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope}),d.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class nl extends a.E{constructor(d,m,w,M){super(),this.id=d,this.dispatcher=w,this.setEventedParent(M),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"},m),Object.assign(this,a.aH(m,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const m=this.map.getWorldview();this._tileJSONRequest=Nl(this._options,this.map._requestManager,null,m,(w,M)=>{this._tileJSONRequest=null,this._loaded=!0,w?this.fire(new a.y(w)):M&&(Object.assign(this,M),M.raster_layers&&(this.rasterLayers=M.raster_layers,this.rasterLayerIds=this.rasterLayers.map(O=>O.id)),this.tileBounds=Ac.fromTileJSON(M),he(M.tiles),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(w)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}loadTile(d,m){const w=a.o.devicePixelRatio>=2,M=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),w,this.tileSize);d.request=a.n(this.map._requestManager.transformRequest(M,a.R.Tile),(O,D,B)=>{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(O)return d.state="errored",m(O);if(!D)return m(null);const V=a.aM(B);this.map._refreshExpiredTiles&&d.setExpiryData(V),d.setTexture(D,this.map.painter),d.state="loaded",a.aO(this.dispatcher),m(null)})}abortTile(d,m){d.request&&(d.request.cancel(),delete d.request),m&&m()}unloadTile(d,m){d.texture&&d.texture instanceof a.T?(d.destroy(!1),d.texture&&d.texture instanceof a.T&&this.map.painter.saveTileTexture(d.texture)):d.destroy(),m&&m()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function _d([_,d],m,w,{scaled:M=!0}={}){const{tileSize:O,buffer:D}=w,{x:B,y:V,z:Y}=m;if(!isFinite(B)||!isFinite(V)||!isFinite(Y))throw new Error("Invalid MRT header");const Q=2**Y,ce=Q*a.aF(_),oe=Q*a.aJ(d);return function([ue,ke],_e,{scaled:Le=!0}={}){if(!_e)throw new Error("bandView is undefined");const{data:Pe,tileSize:qe,buffer:Ze,offset:He,scale:xt,dimension:ct}=_e;if(ue<-Ze||ue>qe+Ze||ke<-Ze||ke>qe+Ze)throw new Error(`Point (${ue}, ${ke}) out of bounds for tileSize=${qe}, buffer=${Ze}`);const pt=(ke+Ze)*(qe+2*Ze)+(ue+Ze);if(new Uint32Array(Pe.buffer)[pt]===4294967295)return null;let lt=[];lt=Le?[]:new _e.data.constructor(ct);for(let st=0;st{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(B)return B.name==="AbortError"?void 0:(d.state="errored",m(B));if(this.map._refreshExpiredTiles&&V){const Q=a.aM(Y);d.setExpiryData(Q)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!V)return m(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=V}m(null)};d.request=this.partial?d.fetchHeader(void 0,D.bind(this)):d.actor.send("loadTile",O,D.bind(this),void 0,!0)}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){const w=d.texturePerLayer;if(d.flushAllQueues(),w.size){d.destroy(!1);for(const M of w.values())this.map.painter.saveTileTexture(M)}else d.destroy()}prepareTile(d,m,w,M){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(m,w,M,(O,D)=>{if(O)return d.state="errored",this.fire(new a.y(O)),void this.triggerRepaint(d);D&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(w,D,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const m=this.rasterLayers.find(({id:O})=>O===d),w=m&&m.fields,M=w&&w.bands&&w.bands;return M?M[0]:0}getTextureDescriptor(d,m,w){if(!d)return;const M=m.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!M)return;let O=null;m instanceof a.aR?O=m.paint.get("raster-array-band"):m instanceof a.aS&&(O=m.paint.get("raster-particle-array-band"));const D=O||this.getInitialBand(M);if(D==null)return;if(!d.textureDescriptorPerLayer.get(m.id))return void this.prepareTile(d,M,m.id,D);if(d.updateNeeded(m.id,D)&&!w)return;const B=d.textureDescriptorPerLayer.get(m.id);return Object.assign({},B,{texture:d.texturePerLayer.get(m.id)})}getImages(d,m){const w=new Map;for(const M of d)for(const O of m){const[D,B]=O.split("/"),V=M.getLayer(D);if(!V||!V.hasBand(B)||!V.hasDataForBand(B))continue;const{bytes:Y,tileSize:Q,buffer:ce}=V.getBandView(B),oe=Q+2*ce,ue={data:new a.q({width:oe,height:oe},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};w.set(O,ue)}return w}queryRasterArrayValueByBandId(d,m,w){const M=m._mrt;return new Promise(O=>{const D={},B=new Set;for(const[V,Y]of Object.entries(M.layers)){if(w.layerName&&V!==w.layerName)continue;const Q={};D[V]=Q;for(const{bands:ce}of Y.dataIndex)for(const oe of ce)w.bands&&!w.bands.includes(oe)||(B.add(a.B(V,oe)),m.fetchBand(V,null,oe,ue=>{a.o.frame(()=>{Q[oe]=ue?null:_d([d.lng,d.lat],M,Y.getBandView(oe)),B.delete(a.B(V,oe)),B.size===0&&O(D)})},!1))}B.size===0&&O(D)})}_loadTileForQuery(d,m){if(this._loadTileLoaded[d.uid])return void m(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(m);this._loadTilePending[d.uid]=[m];const w=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),M=this.map._requestManager.transformRequest(w,a.R.Tile);d.actor.send("loadTile",{request:M,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(O,D,B)=>{if(O)return this._loadTilePending[d.uid].forEach(V=>V(O,null)),void delete this._loadTilePending[d.uid];if(!D)return this._loadTilePending[d.uid].forEach(V=>V(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&D){const V=a.aM(B);d.setExpiryData(V)}d._mrt=D,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(V=>V(null,D)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,m,w){return new Promise((M,O)=>{this._loadTileForQuery(m,(D,B)=>{D?O(D):M(B?this.queryRasterArrayValueByBandId(d,m,w):null)})})}queryRasterArrayValue(d,m){const w=a.aT.convert(d),M=this.findLoadedParent(w);return M&&M._mrt?m.bands||!this.partial?this.queryRasterArrayValueByBandId(w,M,m):this.queryRasterArrayValueByAllBands(w,M,m):Promise.resolve(null)}findLoadedParent(d){const m=a.ae.fromLngLat(d,this.map.transform.tileSize),w=this.maxzoom+1,M=1<0&&(B[new a.aQ(_.overscaledZ,M,d.z,w,d.y-1).key]={backfilled:!1},B[new a.aQ(_.overscaledZ,_.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},B[new a.aQ(_.overscaledZ,D,d.z,O,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,w)this.fire(new a.y(w));else{const O={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&M&&M.resourceTiming&&M.resourceTiming[this.id]&&(O.resourceTiming=M.resourceTiming[this.id]),_&&(this._partialReload=!0),this.fire(new a.z("data",O)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(_),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_),this._updateWorkerData()}loadTile(_,d){const m=_.actor?"reloadTile":"loadTile";_.actor=this.actor;const w=this.map.style?this.map.style.getLut(this.scope):null,M=w?{image:w.image.clone()}:null,O=this._partialReload,D={type:this.type,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:M,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:_.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:O,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};_.request=this.actor.send(m,D,(B,V)=>O&&!V?(_.state="loaded",d(null)):(delete _.request,_.destroy(!1),_.aborted?d(null):B?d(B):(_.loadVectorData(V,this.map.painter,m==="reloadTile"),d(null))),void 0,m==="loadTile")}abortTile(_){_.request&&(_.request.cancel(),delete _.request),_.aborted=!0}unloadTile(_,d){this.actor.send("removeTile",{uid:_.uid,type:this.type,source:this.id,scope:this.scope}),_.destroy()}onRemove(_){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends a.aU{constructor(_,d,m,w){super(_,d,m,w),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const _=this.options;this.urls=[];for(const d of _.urls)this.urls.push(this.map._requestManager.transformRequest(d,a.R.Source).url);a.aV(this.urls,(d,m)=>{this._loaded=!0,d?this.fire(new a.y(d)):m&&(this.video=m,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(_){if(this.video){const d=this.video.seekable;_d.end(0)?this.fire(new a.y(new a.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=_}}getVideo(){return this.video}onAdd(_){this.map||(this.map=_,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 _=this.map.painter.context,d=_.gl;this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(_,this.video,d.RGBA8),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(_)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:a.aU,model:a.aX,"batched-model":class extends a.E{constructor(_,d,m,w){super(),this.type="batched-model",this.id=_,this.tileSize=512,this._options=d,this.tiles=this._options.tiles,this.maxzoom=d.maxzoom||19,this.minzoom=d.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=m,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(w)}onAdd(_){this.map=_,this.load()}reload(){this.cancelTileJSONRequest();const _=a.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(_))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(_){this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"}));const d=Array.isArray(this.map._language)?this.map._language.join():this.map._language,m=this.map.getWorldview();this._tileJSONRequest=Nl(this._options,this.map._requestManager,d,m,(w,M)=>{this._tileJSONRequest=null,this._loaded=!0,w?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),m&&m.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${m}`),this.fire(new a.y(w))):M&&(Object.assign(this,M),M.bounds&&(this.tileBounds=new Ac(M.bounds,this.minzoom,this.maxzoom)),he(M.tiles,this.map._requestManager._customAccessToken),this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))),_&&_(w)})}hasTransition(){return!1}hasTile(_){return!this.tileBounds||this.tileBounds.contains(_.canonical)}loaded(){return this._loaded}loadTile(_,d){const m=this.map._requestManager.normalizeTileURL(_.tileID.canonical.url(this.tiles,this.scheme)),w={request:this.map._requestManager.transformRequest(m,a.R.Tile),data:void 0,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,tileSize:this.tileSize*_.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:_.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:a.o.devicePixelRatio,promoteId:this.promoteId};if(_.actor&&_.state!=="expired")if(_.state==="loading")_.reloadCallback=d;else{if(_.buckets){const O=Object.values(_.buckets);for(const D of O)D.dirty=!0;return void(_.state="loaded")}_.request=_.actor.send("reloadTile",w,M.bind(this))}else _.actor=this.dispatcher.getActor(),_.request=_.actor.send("loadTile",w,M.bind(this),void 0,!0);function M(O,D){return _.aborted?d(null):O&&O.status!==404?d(O):(this.map._refreshExpiredTiles&&D&&_.setExpiryData(D),_.loadModelData(D,this.map.painter),_.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends a.aU{constructor(_,d,m,w){super(_,d,m,w),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(O=>typeof O!="number"))||this.fire(new a.y(new a.V(`sources.${_}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new a.y(new a.V(`sources.${_}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new a.y(new a.V(`sources.${_}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new a.y(new a.V(`sources.${_}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(_){this.map=_,this.load(),this.canvas&&this.animate&&this.play()}onRemove(_){this.pause()}prepare(){let _=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,_=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,_=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!_&&!this._playing||this.texture instanceof a.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(d,this.canvas,d.gl.RGBA8,{premultiply:!0}),this._prepareData(d)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const _ of[this.canvas.width,this.canvas.height])if(isNaN(_)||_<=0)return!0;return!1}},custom:class extends a.E{constructor(_,d,m,w){super(),this.id=_,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=d,this.setEventedParent(w),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Ac(this._implementation.bounds,this.minzoom,this.maxzoom)),d.update=this._update.bind(this),d.clearTiles=this._clearTiles.bind(this),d.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,a.aH(d,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return a.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(_){this.map=_,this._loaded=!1,this.fire(new a.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(_),this.load()}onRemove(_){this._implementation.onRemove&&this._implementation.onRemove(_)}hasTile(_){if(this._implementation.hasTile){const{x:d,y:m,z:w}=_.canonical;return this._implementation.hasTile({x:d,y:m,z:w})}return!this.tileBounds||this.tileBounds.contains(_.canonical)}loadTile(_,d){const{x:m,y:w,z:M}=_.tileID.canonical,O=new AbortController;_.request=Promise.resolve(this._implementation.loadTile({x:m,y:w,z:M},{signal:O.signal})).then((function(D){return delete _.request,_.aborted?(_.state="unloaded",d(null)):D===void 0?(_.state="errored",d(null)):D===null?(this.loadTileData(_,{width:this.tileSize,height:this.tileSize,data:null}),_.state="loaded",d(null)):function(B){return B instanceof ImageData||B instanceof HTMLCanvasElement||B instanceof ImageBitmap||B instanceof HTMLImageElement}(D)?(this.loadTileData(_,D),_.state="loaded",void d(null)):(_.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(D=>{D.name!=="AbortError"&&(_.state="errored",d(D))}),_.request.cancel=()=>O.abort()}loadTileData(_,d){_.setTexture(d,this.map.painter)}unloadTile(_,d){if(_.texture&&_.texture instanceof a.T?(_.destroy(!1),_.texture&&_.texture instanceof a.T&&this.map.painter.saveTileTexture(_.texture)):_.destroy(),this._implementation.unloadTile){const{x:m,y:w,z:M}=_.tileID.canonical;this._implementation.unloadTile({x:m,y:w,z:M})}d&&d()}abortTile(_,d){_.request&&_.request.cancel&&(_.request.cancel(),delete _.request),d&&d()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(_=>({x:_.canonical.x,y:_.canonical.y,z:_.canonical.z}))}_clearTiles(){const _=a.B(this.id,this.scope);this.map.style.clearSource(_)}_update(){this.fire(new a.z("data",{dataType:"source",sourceDataType:"content"}))}}},Bo=function(_,d,m,w){const M=new au[d.type](_,d,m,w);if(M.id!==_)throw new Error(`Expected Source id to be ${_} instead of ${M.id}`);return a.aY(["load","abort","unload","serialize","prepare"],M),M};function uf(_,d,m=""){return`${m}:${d.id||""}:${d.layer.id}:${function(w){if("layerId"in w)return`layer:${w.layerId}`;{const{featuresetId:M,importId:O}=w;return`featureset:${M}${O?`:import:${O}`:""}`}}(_.target)}`}function Vu(_,d,m,w=""){if(_.uniqueFeatureID){const M=uf(_,d,w);if(m.has(M))return!0;m.add(M)}return!1}function Jl(_,d,m,w,M=!1){const O=d.sourceCache.transform,D=d.sourceCache.tilesIn(_,d.has3DLayers,M);D.sort(Kc);const B=[];for(const V of D){const Y=V.tile.queryRenderedFeatures(d,V,m,w,O,M);Object.keys(Y).length&&B.push({wrappedTileID:V.tile.tileID.wrapped().key,queryResults:Y})}for(const V in d.layers){const Y=d.layers[V];if(Y.styleLayer){const Q=Y.styleLayer.queryRenderedFeatures(_,d.sourceCache,w);Object.keys(Q).length&&B.push({wrappedTileID:0,queryResults:Q})}}return B.length===0?{}:function(V){const Y={},Q={};for(const ce of V){const oe=ce.queryResults,ue=ce.wrappedTileID,ke=Q[ue]=Q[ue]||{};for(const _e in oe){const Le=oe[_e],Pe=ke[_e]=ke[_e]||{},qe=Y[_e]=Y[_e]||[];for(const Ze of Le)Pe[Ze.featureIndex]||(Pe[Ze.featureIndex]=!0,qe.push(Ze))}}return Y}(B)}function up(_,d,m,w,M,O){const D={},B=w.queryRenderedSymbols(_),V=[];for(const Y of Object.keys(B).map(Number))V.push(M[Y]);V.sort(Kc);for(const Y of V){const Q=Y.featureIndex.lookupSymbolFeatures(B[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,m,O);for(const ce in Q){const oe=D[ce]=D[ce]||[],ue=Q[ce];ue.sort((ke,_e)=>{const Le=Y.featureSortOrder;if(Le){const Pe=Le.indexOf(ke.featureIndex);return Le.indexOf(_e.featureIndex)-Pe}return _e.featureIndex-ke.featureIndex});for(const ke of ue)oe.push(ke)}}return D}function Em(_,d){const m=_.getRenderableIds().map(O=>_.getTileByID(O)),w=[],M={};for(let O=0;Od.getLayer(O)).filter(Boolean);if(M.length!==0){w.layers=M,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(O=>M.filter(D=>D.id===O)[0]));for(const O of M)m[O.fqid]=w}}return m}const Ec=32,Zc=33,bd=new Uint16Array(8184);for(let _=0;_<2046;_++){let d=_+2,m=0,w=0,M=0,O=0,D=0,B=0;for(1&d?M=O=D=Ec:m=w=B=Ec;(d>>=1)>1;){const Y=m+M>>1,Q=w+O>>1;1&d?(M=m,O=w,m=D,w=B):(m=M,w=O,M=D,O=B),D=Y,B=Q}const V=4*_;bd[V+0]=m,bd[V+1]=w,bd[V+2]=M,bd[V+3]=O}const $d=new Uint16Array(2178),ou=new Uint8Array(1089),Wu=new Uint16Array(1089);function hp(_){return _===0?-.03125:_===32?.03125:0}const by={type:2,extent:a.al,loadGeometry:()=>[[new a.P(0,0),new a.P(a.al+1,0),new a.P(a.al+1,a.al+1),new a.P(0,a.al+1),new a.P(0,0)]]};class fp{constructor(d,m,w,M,O,D){this.tileID=d,this.uid=a.b2(),this.uses=0,this.tileSize=m,this.tileZoom=w,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=O,M&&M.style&&(this._lastUpdatedBrightness=M.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",M&&M.transform&&(this.projection=M.transform.projection),this.worldview=D,this._hasAppearances=null}registerFadeDuration(d){const m=d+this.timeAdded;mw)M=!1;else if(m)if(this.expirationTimew.appearances&&w.appearances.length>0))return!0;return!1}updateBuckets(d,m){if(!this.latestFeatureIndex||!d.style)return;const w=d.style.listImages(),M=d.style.getBrightness();for(const O in this.buckets){if(!d.style.hasLayer(O))continue;const D=this.buckets[O],B=D.layers[0],V=B.sourceLayer||"_geojsonTileLayer",Y=d.style.getLayerSourceCache(B);let Q={};Y&&(Q=Y._state.getState(V,void 0));const ce=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},oe=Object.keys(Q).length>0&&!m;D.hasAppearances=D.layers.some(_e=>_e.appearances&&_e.appearances.length>0);const ue=oe?D.stateDependentLayers:D.layers;if(oe&&D.stateDependentLayers.length!==0||m){const _e=this.latestFeatureIndex.loadVTLayers();D.update(Q,_e[V],w,ce,ue,m,M)}if(oe&&D.stateDependentLayers.length!==0||m||D.hasAppearances){const _e={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};D.updateAppearances(this.tileID.canonical,Q,w,_e)}(D instanceof a.ba||D instanceof a.bb)&&d._terrain&&d._terrain.enabled&&Y&&D.uploadPending()&&d._terrain._clearRenderCacheForTile(Y.id,this.tileID);const ke=d&&d.style&&d.style.getOwnLayer(O);ke&&(this.queryPadding=Math.max(this.queryPadding,ke.queryRadius(D)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Le--){const Pe=4*Le,qe=bd[Pe+0],Ze=bd[Pe+1],He=bd[Pe+2],xt=bd[Pe+3],ct=qe+He>>1,pt=Ze+xt>>1,lt=ct+pt-Ze,st=pt+qe-ct,wt=Ze*Zc+qe,Ot=xt*Zc+He,Pt=pt*Zc+ct,Vt=Math.hypot(($d[2*wt+0]+$d[2*Ot+0])/2-$d[2*Pt+0],($d[2*wt+1]+$d[2*Ot+1])/2-$d[2*Pt+1])>=16;ou[Pt]=ou[Pt]||(Vt?1:0),Le<1022&&(ou[Pt]=ou[Pt]||ou[(Ze+st>>1)*Zc+(qe+lt>>1)]||ou[(xt+st>>1)*Zc+(He+lt>>1)])}const ce=new a.b1,oe=new a.b0;let ue=0;function ke(Le,Pe){const qe=Pe*Zc+Le;return Wu[qe]===0&&(ce.emplaceBack($d[2*qe+0],$d[2*qe+1],Le*a.al/Ec,Pe*a.al/Ec),Wu[qe]=++ue),Wu[qe]-1}function _e(Le,Pe,qe,Ze,He,xt){const ct=Le+qe>>1,pt=Pe+Ze>>1;if(Math.abs(Le-He)+Math.abs(Pe-xt)>1&&ou[pt*Zc+ct])_e(He,xt,Le,Pe,ct,pt),_e(qe,Ze,He,xt,ct,pt);else{const lt=ke(Le,Pe),st=ke(qe,Ze),wt=ke(He,xt);oe.emplaceBack(lt,st,wt)}}return _e(0,0,Ec,Ec,Ec,0),_e(Ec,Ec,0,0,0,Ec),{vertices:ce,indices:oe}}(this.tileID.canonical,m);M=D.vertices,O=D.indices}else{M=new a.b1,O=new a.b0;for(const{x:B,y:V}of w)M.emplaceBack(B,V,0,0);const D=a.bh(M.int16.subarray(0,4*M.length),void 0,4);for(let B=0;B0&&(V=a.bl(new Float64Array(16),m.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,M,m,D,V,B),this._makeGlobeTileDebugTextBuffer(d,M,m,D,V,B)}_globePoint(d,m,w,M,O,D,B){let V=a.bm(d,m,w);if(D){const Y=1<.5?ue=-1:oe<-.5&&(ue=1);let ke=(d/a.al+w.x)/Y+ue,_e=(m/a.al+w.y)/Y;ke=(ke-Q)*M._pixelsPerMercatorPixel+Q,_e=(_e-ce)*M._pixelsPerMercatorPixel+ce;const Le=[ke*M.worldSize,_e*M.worldSize,0];a.af(Le,Le,D),V=a.bn(V,Le,B)}return a.af(V,V,O)}_makeGlobeTileDebugBorderBuffer(d,m,w,M,O,D){const B=new a.bd,V=new a.be,Y=new a.bo,Q=(oe,ue,ke,_e,Le)=>{const Pe=(ke-oe)/(Le-1),qe=(_e-ue)/(Le-1),Ze=B.length;for(let He=0;Hece*ue+ke;for(let ue=0;ue{if(O)m(O);else try{const V=w.getHeaderLength(D);if(V>d)return void(this.request=this.fetchHeader(V,m));w.parseHeader(D),this._isHeaderLoaded=!0;let Y=0;for(const Q of Object.values(w.layers))Y=Math.max(Y,Q.dataIndex[Q.dataIndex.length-1].lastByte);D.byteLength>=Y&&(this.entireBuffer=D),m(null,this.entireBuffer||D,B)}catch(V){m(V)}}),this.request}fetchBandForRender(d,m,w,M){this.fetchBand(d,m,w,O=>{if(O)return void M(O);this.updateTextureDescriptor(d,m,w);const D=this.textureDescriptorPerLayer.get(m);M(null,D?D.img:null)})}fetchBand(d,m,w,M,O=!0){const D=this._mrt;if(!this._isHeaderLoaded||!D)return void M(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void M(new Error("Can't fetch tile band without an actor"));let V;const Y=a.B(String(w),a.B(this.tileID.key,d));let Q=this._taskQueue.get(Y);Q?Q.add(M):(Q=new Set,Q.add(M),this._taskQueue.set(Y,Q));const ce=(_e,Le)=>{V.complete(_e,Le),_e?M(_e):(Q.forEach(Pe=>Pe(null,Le)),this._taskQueue.delete(Y))},oe=(_e,Le)=>{if(_e)return M(_e);const Pe=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Le,task:V},ce,void 0,!0);if(m!==null){const qe=this._workQueuePerLayer.get(m)||[];qe.push(()=>{Pe&&Pe.cancel(),V.cancel()}),this._workQueuePerLayer.has(m)||this._workQueuePerLayer.set(m,qe)}};let ue;try{ue=D.getLayer(d)}catch(_e){if(this.state==="reloading")return;throw _e}if(!ue)return void M(new Error(`Unknown sourceLayer "${d}"`));if(ue.hasDataForBand(w))return Q.forEach(_e=>_e(null,null)),void this._taskQueue.delete(Y);const ke=ue.getDataRange([w]);if(V=D.createDecodingTask(ke),!V||V.tasks.length)if(m!==null&&this.flushQueues(m),this.entireBuffer)oe(null,this.entireBuffer.slice(ke.firstByte,ke.lastByte+1));else{const _e=Object.assign({},this.requestParams,{headers:{Range:`bytes=${ke.firstByte}-${ke.lastByte}`}}),Le=a.bu(_e,oe);if(m!==null){const Pe=this._fetchQueuePerLayer.get(m)||[];Pe.push(()=>{Le.cancel(),V.cancel()}),this._fetchQueuePerLayer.has(m)||this._fetchQueuePerLayer.set(m,Pe)}}}updateNeeded(d,m){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==m||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,m,w){if(!this._mrt)return;const M=this._mrt.getLayer(d);if(!M||!M.hasBand(w)||!M.hasDataForBand(w))return;const{bytes:O,tileSize:D,buffer:B,offset:V,scale:Y}=M.getBandView(w),Q=D+2*B,ce=new a.q({width:Q,height:Q},O),oe=this.texturePerLayer.get(m);oe&&oe instanceof a.T&&oe.update(ce,{premultiply:!1}),this.textureDescriptorPerLayer.set(m,{layer:d,band:w,img:ce,buffer:B,offset:V,tileSize:D,format:M.pixelFormat,mix:[Y,256*Y,65536*Y,16777216*Y]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const m of this.texturePerLayer.values())m&&m instanceof a.T&&m.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 fk{constructor(d,m){this.max=d,this.onRemove=m,this.reset()}reset(){for(const d in this.data)for(const m of this.data[d])m.timeout&&clearTimeout(m.timeout),this.onRemove(m.value);return this.data={},this.order=[],this}add(d,m,w){const M=d.wrapped().key;this.data[M]===void 0&&(this.data[M]=[]);const O={value:m,timeout:void 0};if(w!==void 0&&(O.timeout=setTimeout(()=>{this.remove(d,O)},w)),this.data[M].push(O),this.order.push(M),this.order.length>this.max){const D=this._getAndRemoveByKey(this.order[0]);D&&this.onRemove(D)}return this}has(d){return d.wrapped().key in this.data}getAndRemove(d){return this.has(d)?this._getAndRemoveByKey(d.wrapped().key):null}_getAndRemoveByKey(d){const m=this.data[d].shift();return m.timeout&&clearTimeout(m.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),m.value}getByKey(d){const m=this.data[d];return m?m[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,m){if(!this.has(d))return this;const w=d.wrapped().key,M=m===void 0?0:this.data[w].indexOf(m),O=this.data[w][M];return this.data[w].splice(M,1),O.timeout&&clearTimeout(O.timeout),this.data[w].length===0&&delete this.data[w],this.onRemove(O.value),this.order.splice(this.order.indexOf(w),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}filter(d){const m=[];for(const w in this.data)for(const M of this.data[w])d(M.value)||m.push(M);for(const w of m)this.remove(w.value.tileID,w)}}class Hg{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,m,w){const M=String(m);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][M]=this.stateChanges[d][M]||{},Object.assign(this.stateChanges[d][M],w),this.deletedStates[d]===null){this.deletedStates[d]={};for(const O in this.state[d])O!==M&&(this.deletedStates[d][O]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][M]===null){this.deletedStates[d][M]={};for(const O in this.state[d][M])w[O]||(this.deletedStates[d][M][O]=null)}else for(const O in w)this.deletedStates[d]&&this.deletedStates[d][M]&&this.deletedStates[d][M][O]===null&&delete this.deletedStates[d][M][O]}removeFeatureState(d,m,w){if(this.deletedStates[d]===null)return;const M=String(m);if(this.deletedStates[d]=this.deletedStates[d]||{},w&&m!==void 0)this.deletedStates[d][M]!==null&&(this.deletedStates[d][M]=this.deletedStates[d][M]||{},this.deletedStates[d][M][w]=null);else if(m!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][M])for(w in this.deletedStates[d][M]={},this.stateChanges[d][M])this.deletedStates[d][M][w]=null;else this.deletedStates[d][M]=null;else this.deletedStates[d]=null}getState(d,m){const w=this.state[d]||{},M=this.stateChanges[d]||{},O=this.deletedStates[d];if(O===null)return{};if(m!==void 0){const B=String(m),V=Object.assign({},w[B],M[B]);if(O){const Y=O[m];if(Y===null)return{};for(const Q in Y)delete V[Q]}return V}const D=Object.assign({},w,M);if(O)for(const B in O)delete D[B];return D}initializeTileState(d,m){d.refreshFeatureState(m)}coalesceChanges(d,m){const w={};for(const M in this.stateChanges){this.state[M]=this.state[M]||{};const O={};for(const D in this.stateChanges[M])this.state[M][D]||(this.state[M][D]={}),Object.assign(this.state[M][D],this.stateChanges[M][D]),O[D]=this.state[M][D];w[M]=O}for(const M in this.deletedStates){this.state[M]=this.state[M]||{};const O={};if(this.deletedStates[M]===null)for(const D in this.state[M])O[D]={},this.state[M][D]={};else for(const D in this.deletedStates[M]){if(this.deletedStates[M][D]===null)this.state[M][D]={};else if(this.state[M][D])for(const B of Object.keys(this.deletedStates[M][D]))delete this.state[M][D][B];O[D]=this.state[M][D]}w[M]=w[M]||{},Object.assign(w[M],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(w).length!==0)for(const M in d)d[M].refreshFeatureState(m)}}class Yc extends a.E{constructor(d,m,w){super(),this.id=d,this._onlySymbols=w,m.on("data",M=>{M.dataType==="source"&&M.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&M.dataType==="source"&&M.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),m.on("error",()=>{this._sourceErrored=!0}),this._source=m,this._tiles={},this._cache=new fk(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=m.minTileCacheSize,this._maxTileCacheSize=m.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Hg,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(d){this.map=d,this._minTileCacheSize=this._minTileCacheSize===void 0&&d?d._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&d?d._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const d in this._tiles)if(!this._tiles[d].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const d=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,d&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(d,m){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,m)}_unloadTile(d){if(this._source.unloadTile)return this._source.unloadTile(d)}_abortTile(d){if(this._source.abortTile)return this._source.abortTile(d)}serialize(){return this._source.serialize()}prepare(d){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const m in this._tiles){const w=this._tiles[m];w.upload(d,this.map?this.map.painter:void 0),w.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(d=>d.tileID).sort(wy).map(d=>d.key)}getRenderableIds(d,m){const w=[];for(const M in this._tiles)this._isIdRenderable(+M,d,m)&&w.push(this._tiles[M]);return d?w.sort((M,O)=>{const D=M.tileID,B=O.tileID,V=new a.P(D.canonical.x,D.canonical.y)._rotate(this.transform.angle),Y=new a.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return D.overscaledZ-B.overscaledZ||Y.y-V.y||Y.x-V.x}).map(M=>M.tileID.key):w.map(M=>M.tileID).sort(wy).map(M=>M.key)}hasRenderableParent(d){const m=this.findLoadedParent(d,0);return!!m&&this._isIdRenderable(m.tileID.key)}_isIdRenderable(d,m,w){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(m||!this._tiles[d].holdingForFade())&&(w||!this._shadowCasterTiles[d])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const d in this._tiles)this._tiles[d].state!=="errored"&&this._reloadTile(+d,"reloading")}}_reloadTile(d,m){const w=this._tiles[d];w&&(w.state!=="loading"&&(w.state=m),this._loadTile(w,this._tileLoaded.bind(this,w,d,m)))}_tileLoaded(d,m,w,M,O){if(M){if(d.state="errored",M.status!==404)this._source.fire(new a.y(M,{tile:d}));else{if(this._source.fire(new a.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:d})),!(d.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const B=this.map.painter.terrain;this.update(this.transform,B.getScaledDemTileSize(),!0),B.resetTileLookupCache(this.id)}else this.update(this.transform)}return}d.timeAdded=a.o.now(),w==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(m,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let D=new Map;O&&O.responseHeaders&&(D=O.responseHeaders),this._source.fire(new a.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:D}))}_backfillDEM(d){const m=this.getRenderableIds();for(let M=0;M1||(Math.abs(D)>1&&(Math.abs(D+V)===1?D+=V:Math.abs(D-V)===1&&(D-=V)),O.dem&&M.dem&&(M.dem.backfillBorder(O.dem,D,B),M.neighboringTiles&&M.neighboringTiles[Y]&&(M.neighboringTiles[Y].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,m,w,M){for(const O in this._tiles){let D=this._tiles[O];if(M[O]||!D.hasData()||D.tileID.overscaledZ<=m||D.tileID.overscaledZ>w)continue;let B=D.tileID;for(;D&&D.tileID.overscaledZ>m+1;){const Y=D.tileID.scaledTo(D.tileID.overscaledZ-1);D=this._tiles[Y.key],D&&D.hasData()&&(B=Y)}let V=B;for(;V.overscaledZ>m;)if(V=V.scaledTo(V.overscaledZ-1),d[V.key]){M[B.key]=B;break}}}findLoadedParent(d,m){if(d.key in this._loadedParentTiles){const w=this._loadedParentTiles[d.key];return w&&w.tileID.overscaledZ>=m?w:null}for(let w=d.overscaledZ-1;w>=m;w--){const M=d.scaledTo(w),O=this._getLoadedTile(M);if(O)return O}}_getLoadedTile(d){const m=this._tiles[d.key];return m&&m.hasData()?m:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,m){m=m||this._source.tileSize;const w=Math.ceil(d.width/m)+1,M=Math.ceil(d.height/m)+1,O=Math.floor(w*M*5),D=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,O):O,B=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,D):D;this._cache.setMaxSize(B)}handleWrapJump(d){const m=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,m){const w={};for(const M in this._tiles){const O=this._tiles[M];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+m),w[O.tileID.key]=O}this._tiles=w;for(const M in this._timers)clearTimeout(this._timers[M]),delete this._timers[M];for(const M in this._tiles)this._setTileReloadTimer(+M,this._tiles[M])}}update(d,m,w,M,O){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!w)return;this.updateCacheSize(d,m),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const D=this._source.type==="batched-model";let B,V=this._source.maxzoom;const Y=this.map&&this.map.painter?this.map.painter._terrain:null;if(Y&&Y.sourceCache===this&&Y.attenuationRange()){const oe=Y.attenuationRange()[0],ue=Math.floor(oe)-Math.log2(Y.getDemUpscale());V>ue&&(V=ue)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(oe=>new a.aQ(oe.canonical.z,oe.wrap,oe.canonical.z,oe.canonical.x,oe.canonical.y));else if(this.tileCoverLift!==0){const oe=d.clone();oe.tileCoverLift=this.tileCoverLift,B=oe.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!w,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.minzoom<=1&&d.projection.name==="globe"&&(B.push(new a.aQ(1,0,1,0,0)),B.push(new a.aQ(1,0,1,1,0)),B.push(new a.aQ(1,0,1,0,1)),B.push(new a.aQ(1,0,1,1,1)))}else if(B=d.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!w,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.hasTile){const oe=this._source.hasTile.bind(this._source);B=B.filter(ue=>oe(ue))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!mp(this._source.type)){const oe=d.coveringZoomLevel({tileSize:m||this._source.tileSize,roundZoom:this._source.roundZoom&&!w}),ue=Math.min(oe,this._source.maxzoom);if(D){const ke=d.extendTileCover(B,ue);for(const _e of ke)B.push(_e)}else if(O){const ke=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(ue),ue);for(const _e of ke)B.push(_e)}else if(this.castsShadows&&M){const ke=d.extendTileCover(B,ue,M,16);for(const _e of ke)this._shadowCasterTiles[_e.key]=!0,B.push(_e)}}const Q=this._updateRetainedTiles(B);if(mp(this._source.type)&&B.length!==0){const oe={},ue={},ke=Object.keys(Q);for(const Le of ke){const Pe=Q[Le],qe=this._tiles[Le];if(!qe||qe.fadeEndTime&&qe.fadeEndTime<=a.o.now())continue;const Ze=this.findLoadedParent(Pe,Math.max(Pe.overscaledZ-Yc.maxOverzooming,this._source.minzoom));Ze&&(this._addTile(Ze.tileID),oe[Ze.tileID.key]=Ze.tileID),ue[Le]=Pe}const _e=B[B.length-1].overscaledZ;for(const Le in this._tiles){const Pe=this._tiles[Le];if(Q[Le]||!Pe.hasData())continue;let qe=Pe.tileID;for(;qe.overscaledZ>_e;){qe=qe.scaledTo(qe.overscaledZ-1);const Ze=this._tiles[qe.key];if(Ze&&Ze.hasData()&&ue[qe.key]){Q[Le]=Pe.tileID;break}}}for(const Le in oe)Q[Le]||(this._coveredTiles[Le]=!0,Q[Le]=oe[Le])}for(const oe in Q)this._tiles[oe].clearFadeHold();const ce=a.bv(this._tiles,Q);for(const oe of ce){const ue=this._tiles[oe];ue.hasSymbolBuckets&&!ue.holdingForFade()?ue.setHoldDuration(this.map._fadeDuration):ue.hasSymbolBuckets&&!ue.symbolFadeFinished()||this._removeTile(+oe)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const d in this._tiles)this._tiles[d].holdingForFade()&&this._removeTile(+d)}_updateRetainedTiles(d){const m={};if(d.length===0)return m;const w={},M=d.reduce((Y,Q)=>Math.min(Y,Q.overscaledZ),1/0),O=d[0].overscaledZ,D=Math.max(O-Yc.maxOverzooming,this._source.minzoom),B=Math.max(O+Yc.maxUnderzooming,this._source.minzoom),V={};for(const Y of d){const Q=this._addTile(Y);m[Y.key]=Y,Q.hasData()||M=this._source.maxzoom){const oe=Y.children(this._source.maxzoom)[0],ue=this.getTile(oe);if(ue&&ue.hasData()){m[oe.key]=oe;continue}}else{const oe=Y.children(this._source.maxzoom);if(m[oe[0].key]&&m[oe[1].key]&&m[oe[2].key]&&m[oe[3].key])continue}let ce=Q.wasRequested();for(let oe=Y.overscaledZ-1;oe>=D;--oe){const ue=Y.scaledTo(oe);if(w[ue.key]||(w[ue.key]=!0,Q=this.getTile(ue),!Q&&ce&&(Q=this._addTile(ue)),Q&&(m[ue.key]=ue,ce=Q.wasRequested(),Q.hasData())))break}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const m=[];let w,M=this._tiles[d].tileID;for(;M.overscaledZ>0;){if(M.key in this._loadedParentTiles){w=this._loadedParentTiles[M.key];break}m.push(M.key);const O=M.scaledTo(M.overscaledZ-1);if(w=this._getLoadedTile(O),w)break;M=O}for(const O of m)this._loadedParentTiles[O]=w}}_addTile(d){let m=this._tiles[d.key];if(m)return m.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),m;m=this._cache.getAndRemove(d),m&&(this._setTileReloadTimer(d.key,m),m.tileID=d,this._state.initializeTileState(m,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,m)));const w=!!m;if(!w){const M=this.map?this.map.painter:null,O=this._source.tileSize*d.overscaleFactor();m=this._source.type==="raster-array"?new pp(d,O,this.transform.tileZoom,M,this._isRaster):new fp(d,O,this.transform.tileZoom,M,this._isRaster,this._source.worldview),this._loadTile(m,this._tileLoaded.bind(this,m,d.key,m.state))}return m.uses++,this._tiles[d.key]=m,w||this._source.fire(new a.z("dataloading",{tile:m,coord:m.tileID,dataType:"source"})),m}_setTileReloadTimer(d,m){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const w=m.getExpiryTimeout();w&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},w))}_removeTile(d){const m=this._tiles[d];m&&(m.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),m.uses>0||(m.hasData()&&m.state!=="reloading"||m.state==="empty"?this._cache.add(m.tileID,m,m.getExpiryTimeout()):(m.aborted=!0,this._abortTile(m),this._unloadTile(m))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const d in this._tiles)this._removeTile(+d);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(d,m,w){const M=[],O=this.transform;if(!O)return M;const D=O.projection.name==="globe",B=a.aF(O.center.lng);for(const V in this._tiles){const Y=this._tiles[V];if(w&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let Q;if(D){const ce=Y.tileID.canonical;if(ce.z===0){const oe=[Math.abs(a.aA(B,...Gu(ce,-1))-B),Math.abs(a.aA(B,...Gu(ce,1))-B)];Q=[0,2*oe.indexOf(Math.min(...oe))-1]}else{const oe=[Math.abs(a.aA(B,...Gu(ce,-1))-B),Math.abs(a.aA(B,...Gu(ce,0))-B),Math.abs(a.aA(B,...Gu(ce,1))-B)];Q=[oe.indexOf(Math.min(...oe))-1]}}else Q=[0];for(const ce of Q){const oe=d.containsTile(Y,O,m,ce);oe&&M.push(oe)}}return M}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,m){const w=this.getRenderableIds(d,m).map(O=>this._tiles[O].tileID),M=this.transform.projection.name==="globe";for(const O of w)O.projMatrix=this.transform.calculateProjMatrix(O.toUnwrapped()),O.expandedProjMatrix=M?this.transform.calculateProjMatrix(O.toUnwrapped(),!1,!0):O.projMatrix;return w}sortCoordinatesByDistance(d){const m=d.slice(),w=this.transform._camera.position,M=this.transform._camera.forward(),O={};for(const D of m){const B=1/(1<O[D.key]-O[B.key]),m}hasTransition(){if(this._source.hasTransition())return!0;if(mp(this._source.type))for(const d in this._tiles){const m=this._tiles[d];if(m.fadeEndTime!==void 0&&m.fadeEndTime>=a.o.now())return!0}return!1}setFeatureState(d,m,w){this._state.updateState(d=d||"_geojsonTileLayer",m,w)}removeFeatureState(d,m,w){this._state.removeFeatureState(d=d||"_geojsonTileLayer",m,w)}getFeatureState(d,m){return this._state.getState(d=d||"_geojsonTileLayer",m)}setDependencies(d,m,w){const M=this._tiles[d];M&&M.setDependencies(m,w)}reloadTilesForDependencies(d,m){for(const w in this._tiles)this._tiles[w].hasDependency(d,m)&&this._reloadTile(+w,"reloading");this._cache.filter(w=>!w.hasDependency(d,m))}_preloadTiles(d,m){if(!this._sourceLoaded){const V=()=>{this._sourceLoaded&&(this._source.off("data",V),this._preloadTiles(d,m))};return void this._source.on("data",V)}const w=new Map,M=Array.isArray(d)?d:[d],O=this.map.painter.terrain,D=this.usedForTerrain&&O?O.getScaledDemTileSize():this._source.tileSize;for(const V of M){const Y=V.coveringTiles({tileSize:D,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const Q of Y)w.set(Q.key,Q);this.usedForTerrain&&V.updateElevation(!1)}const B=Array.from(w.values());a.bw(B,(V,Y)=>{const Q=new fp(V,this._source.tileSize*V.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(Q,ce=>{this._source.type==="raster-dem"&&Q.dem&&this._backfillDEM(Q),Y(ce,Q)})},m)}}function wy(_,d){const m=Math.abs(2*_.wrap)-+(_.wrap<0),w=Math.abs(2*d.wrap)-+(d.wrap<0);return _.overscaledZ-d.overscaledZ||w-m||d.canonical.y-_.canonical.y||d.canonical.x-_.canonical.x}function mp(_){return _==="raster"||_==="image"||_==="video"||_==="custom"}function Gu(_,d){const m=1<<_.z;return[_.x/m+d,(_.x+1)/m+d]}Yc.maxOverzooming=10,Yc.maxUnderzooming=3;class A3{constructor(d){this.style=d,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const d=!1,m=!1;for(const w in this.style._mergedLayers){const M=this.style._mergedLayers[w];if(M.type==="fill-extrusion"||M.type==="building")this.layers.push({layer:M,visible:d,visibilityChanged:m});else if(M.type==="model"){const O=this.style.getLayerSource(M);O&&O.type==="batched-model"&&this.layers.push({layer:M,visible:d,visibilityChanged:m})}}}onNewFrame(d){this.layersGotHidden=!1;for(const m of this.layers){const w=m.layer;let M=!1;w.type==="fill-extrusion"?M=!w.isHidden(d)&&w.paint.get("fill-extrusion-opacity")>0:w.type==="building"?M=!w.isHidden(d)&&w.paint.get("building-opacity")>0:w.type==="model"&&(M=!w.isHidden(d)&&w.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!M&&m.visible,m.visible=M}}updateZOffset(d,m){this.currentBuildingBuckets=[];for(const M of this.layers){const O=M.layer,D=this.style.getLayerSourceCache(O);let B=1;O.type==="fill-extrusion"?B=M.visible?O.paint.get("fill-extrusion-vertical-scale"):0:O.type==="building"&&(B=M.visible?O.paint.get("building-vertical-scale"):0);let V=D?D.getTile(m):null;if(!V&&D)for(const Y in D._tiles){const Q=D._tiles[Y];if(m.canonical.isChildOf(Q.tileID.canonical)){V=Q;break}}this.currentBuildingBuckets.push({bucket:V?V.getBucket(O):null,tileID:V?V.tileID:m,verticalScale:B})}d.hasAnyZOffset=!1;let w=!1;for(let M=0;M{w in d&&(m[w]=d[w])}),m}function Cr(_){_=_.slice();const d=Object.create(null);for(let m=0;m<_.length;m++)d[_[m].id]=_[m];for(let m=0;m<_.length;m++)"ref"in _[m]&&(_[m]=Ct(_[m],d[_[m].ref]));return _}const dr={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 ws(_,d,m){m.push({command:dr.addSource,args:[_,d[_]]})}function $s(_,d,m){d.push({command:dr.removeSource,args:[_]}),m[_]=!0}function Mo(_,d,m,w){$s(_,m,w),ws(_,d,m)}function io(_,d,m){let w;for(w in _[m])if(_[m].hasOwnProperty(w)&&w!=="data"&&!a.by(_[m][w],d[m][w]))return!1;for(w in d[m])if(d[m].hasOwnProperty(w)&&w!=="data"&&!a.by(_[m][w],d[m][w]))return!1;return!0}function ao(_,d,m,w,M,O){let D;for(D in d=d||{},_=_||{})_.hasOwnProperty(D)&&(a.by(_[D],d[D])||m.push({command:O,args:[w,D,d[D],M]}));for(D in d)d.hasOwnProperty(D)&&!_.hasOwnProperty(D)&&(a.by(_[D],d[D])||m.push({command:O,args:[w,D,d[D],M]}))}function Wg(_){return _.id}function mv(_,d){return _[d.id]=d,_}function E3(_,d,m){const w=d.createTileMatrix(_,_.worldSize,m.toUnwrapped());return a.aB(new Float32Array(16),_.projMatrix,w)}function pk(_,d,m){if(d.projection.name===m.projection.name)return _.projMatrix;const w=m.clone();return w.setProjection(d.projection),E3(w,d.getProjection(),_)}function hf(_,d,m){return d.name===m.projection.name?_.projMatrix:E3(m,d,_)}class gv{constructor(d,m){this.reset(d,m)}reset(d,m){this.points=d||[],this._distances=[0];for(let w=1;w0?(M-D)/B:0;return this.points[O].mult(1-V).add(this.points[m].mult(V))}}class I3{constructor(d,m,w){const M=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(d/w),this.yCellCount=Math.ceil(m/w);for(let D=0;Dthis.width||M<0||m>this.height)return!O&&[];const B=[];if(d<=0&&m<=0&&this.width<=w&&this.height<=M){if(O)return!0;for(let V=0;V0:B}_queryCircle(d,m,w,M,O){const D=d-w,B=d+w,V=m-w,Y=m+w;if(B<0||D>this.width||Y<0||V>this.height)return!M&&[];const Q=[];return this._forEachCell(D,V,B,Y,this._queryCellCircle,Q,{hitTest:M,circle:{x:d,y:m,radius:w},seenUids:{box:{},circle:{}}},O),M?Q.length>0:Q}query(d,m,w,M,O){return this._query(d,m,w,M,!1,O)}hitTest(d,m,w,M,O){return this._query(d,m,w,M,!0,O)}hitTestCircle(d,m,w,M){return this._queryCircle(d,m,w,!0,M)}_queryCell(d,m,w,M,O,D,B,V){const Y=B.seenUids,Q=this.boxCells[O];if(Q!==null){const oe=this.bboxes;for(const ue of Q)if(!Y.box[ue]){Y.box[ue]=!0;const ke=4*ue;if(d<=oe[ke+2]&&m<=oe[ke+3]&&w>=oe[ke+0]&&M>=oe[ke+1]&&(!V||V(this.boxKeys[ue]))){if(B.hitTest)return D.push(!0),!0;D.push({key:this.boxKeys[ue],x1:oe[ke],y1:oe[ke+1],x2:oe[ke+2],y2:oe[ke+3]})}}}const ce=this.circleCells[O];if(ce!==null){const oe=this.circles;for(const ue of ce)if(!Y.circle[ue]){Y.circle[ue]=!0;const ke=3*ue;if(this._circleAndRectCollide(oe[ke],oe[ke+1],oe[ke+2],d,m,w,M)&&(!V||V(this.circleKeys[ue]))){if(B.hitTest)return D.push(!0),!0;{const _e=oe[ke],Le=oe[ke+1],Pe=oe[ke+2];D.push({key:this.circleKeys[ue],x1:_e-Pe,y1:Le-Pe,x2:_e+Pe,y2:Le+Pe})}}}}}_queryCellCircle(d,m,w,M,O,D,B,V){const Y=B.circle,Q=B.seenUids,ce=this.boxCells[O];if(ce!==null){const ue=this.bboxes;for(const ke of ce)if(!Q.box[ke]){Q.box[ke]=!0;const _e=4*ke;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,ue[_e+0],ue[_e+1],ue[_e+2],ue[_e+3])&&(!V||V(this.boxKeys[ke])))return D.push(!0),!0}}const oe=this.circleCells[O];if(oe!==null){const ue=this.circles;for(const ke of oe)if(!Q.circle[ke]){Q.circle[ke]=!0;const _e=3*ke;if(this._circlesCollide(ue[_e],ue[_e+1],ue[_e+2],Y.x,Y.y,Y.radius)&&(!V||V(this.circleKeys[ke])))return D.push(!0),!0}}}_forEachCell(d,m,w,M,O,D,B,V){const Y=this._convertToXCellCoord(d),Q=this._convertToYCellCoord(m),ce=this._convertToXCellCoord(w),oe=this._convertToYCellCoord(M);for(let ue=Y;ue<=ce;ue++)for(let ke=Q;ke<=oe;ke++)if(O.call(this,d,m,w,M,this.xCellCount*ke+ue,D,B,V))return}_convertToXCellCoord(d){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(d*this.xScale)))}_convertToYCellCoord(d){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(d*this.yScale)))}_circlesCollide(d,m,w,M,O,D){const B=M-d,V=O-m,Y=w+D;return Y*Y>B*B+V*V}_circleAndRectCollide(d,m,w,M,O,D,B){const V=(D-M)/2,Y=Math.abs(d-(M+V));if(Y>V+w)return!1;const Q=(B-O)/2,ce=Math.abs(m-(O+Q));if(ce>Q+w)return!1;if(Y<=V||ce<=Q)return!0;const oe=Y-V,ue=ce-Q;return oe*oe+ue*ue<=w*w}}const Im={unknown:0,flipRequired:1,flipNotRequired:2},Gg=Math.tan(85*Math.PI/180);function Ic(_,d,m,w,M,O,D){const B=a.bC();if(m)if(O.name==="globe"){const V=a.bD(M,d);a.aB(B,B,V)}else{const V=a.bE([],D);B[0]=V[0],B[1]=V[1],B[4]=V[2],B[5]=V[3],w||a.bB(B,B,M.angle)}else a.aB(B,M.labelPlaneMatrix,_);return B}function mk(_,d,m,w,M,O,D){const B=Ic(_,d,m,w,M,O,D);return O.name==="globe"&&m||(B[2]=B[6]=B[10]=B[14]=0),B}function xv(_,d,m,w,M,O,D){if(m){if(O.name==="globe"){const B=Ic(_,d,m,w,M,O,D);return a.bl(B,B),a.aB(B,_,B),B}{const B=a.bz(_),V=a.bA([]);return V[0]=D[0],V[1]=D[1],V[4]=D[2],V[5]=D[3],a.aB(B,B,V),w||a.bB(B,B,-M.angle),B}}return M.glCoordMatrix}function Ku(_,d,m,w){const M=[_,d,m,1];m?a.aC(M,M,w):pn(M,M,w);const O=M[3];return M[0]/=O,M[1]/=O,M[2]/=O,M}function ki(_,d){return Math.min(.5+_/d*.5,1.5)}function GI(_,d){const m=_[0]/_[3],w=_[1]/_[3];return m>=-d[0]&&m<=d[0]&&w>=-d[1]&&w<=d[1]}function KI(_,d,m,w,M,O,D,B,V,Y,Q=1){const ce=m.transform,oe=w?_.textSizeData:_.iconSizeData,ue=a.bK(oe,m.transform.zoom,Q),ke=ce.projection.name==="globe",_e=[256/m.width*2+1,256/m.height*2+1],Le=w?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;Le.clear();let Pe=null;ke&&(Pe=w?_.text.globeExtVertexArray:_.icon.globeExtVertexArray);const qe=_.lineVertexArray,Ze=w?_.text.placedSymbolArray:_.icon.placedSymbolArray,He=m.transform.width/m.transform.height;let xt,ct=!1;for(let pt=0;ptMath.abs(m)?{useVertical:!0}:_===a.bL.vertical?w>0?{needsFlipping:!0}:null:d!==Im.unknown&&function(M,O){return M===0||Math.abs(O/M)>Gg}(m,w)?d===Im.flipRequired?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function P3(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le,Pe,qe,Ze){const He=d/24,xt=_.lineOffsetX*He,ct=_.lineOffsetY*He,{lineStartIndex:pt,glyphStartIndex:lt,numGlyphs:st,segment:wt,writingMode:Ot,flipState:Pt}=_,Vt=pt+_.lineLength,Wt=sr=>{if(Q){const[Xt,qt,ur]=sr.up,Er=Y.length;a.bN(Q,Er+0,Xt,qt,ur),a.bN(Q,Er+1,Xt,qt,ur),a.bN(Q,Er+2,Xt,qt,ur),a.bN(Q,Er+3,Xt,qt,ur)}const[br,zt,Mt]=sr.point;a.bO(Y,br,zt,Mt,sr.angle)};if(st>1){const sr=ZI(He,B,xt,ct,m,ce,oe,_,V,O,ue,_e,!1,Le,Pe,qe,Ze);if(!sr)return{notEnoughRoom:!0};if(w&&!m){let[br,zt,Mt]=sr.first.point,[Xt,qt,ur]=sr.last.point;[br,zt]=Ku(br,zt,Mt,D),[Xt,qt]=Ku(Xt,qt,ur,D);const Er=Fn(Ot,Pt,(Xt-br)*ke,qt-zt);if(_.flipState=Er&&Er.needsFlipping?Im.flipRequired:Im.flipNotRequired,Er)return Er}Wt(sr.first);for(let br=lt+1;br0?Xt:Zu(oe,Mt,br,1,M,void 0,Le,Pe.canonical),ur=Fn(Ot,Pt,(qt[0]-br[0])*ke,qt[1]-br[1]);if(_.flipState=ur&&ur.needsFlipping?Im.flipRequired:Im.flipNotRequired,ur)return ur}const sr=jy(He*B.getoffsetX(lt),xt,ct,m,ce,oe,wt,pt,Vt,V,O,ue,_e,!1,!1,Le,Pe,qe,Ze);if(!sr)return{notEnoughRoom:!0};Wt(sr)}return{}}function yv(_,d,m,w,M){const{x:O,y:D,z:B}=w.projectTilePoint(_.x,_.y,d);if(!M)return Ku(O,D,B,m);const[V,Y,Q]=M.getElevation(_,M.elevation,M.elevationFeature);return Ku(O+V,D+Y,B+Q,m)}function Zu(_,d,m,w,M,O,D,B){const V=yv(_.sub(d)._unit()._add(_),B,M,D,O);return a.av(V,m,V),a.aw(V,V),a.bH(V,m,V,w)}function jy(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le,Pe,qe){const Ze=w?_-d:_+d;let He=Ze>0?1:-1,xt=0;w&&(He*=-1,xt=Math.PI),He<0&&(xt+=Math.PI);let ct=B+D+(He>0?0:1)|0,pt=M,lt=M,st=0,wt=0;const Ot=Math.abs(Ze),Pt=[],Vt=[];let Wt=O,sr=Wt,br=a.bF([]);const zt=()=>Zu(sr,Wt,lt,Ot-st+1,Q,oe,_e,Le.canonical);for(;st+wt<=Ot;){if(ct+=He,ct=V)return null;if(lt=pt,sr=Wt,Pt.push(lt),ue&&Vt.push(sr),Wt=new a.P(Y.getx(ct),Y.gety(ct)),pt=ce[ct],!pt){const en=yv(Wt,Le.canonical,Q,_e,oe);pt=en[3]>0?ce[ct]=en:zt()}st+=wt;const wr=a.av([],pt,lt),on=a.bG(lt,pt);if(m&&on>0&&wt>0&&a.bJ(br,wr)/(wt*on)0,Ze),pt=Y*ct.perspectiveRatio,lt=(w.x1*m+B.x-w.padding)*pt+ct.point.x,st=(w.y1*m+B.y-w.padding)*pt+ct.point.y,wt=(w.x2*m+B.x+w.padding)*pt+ct.point.x,Ot=(w.y2*m+B.y+w.padding)*pt+ct.point.y,Pt=ct.perspectiveRatio<=.55||ct.occluded;return!this.isInsideGrid(lt,st,wt,Ot)||!V&&this.grid.hitTest(lt,st,wt,Ot,ce)||Pt?{box:[],offscreen:!1,occluded:ct.occluded}:{box:[lt,st,wt,Ot],offscreen:this.isOffscreen(lt,st,wt,Ot),occluded:!1}}placeCollisionCircles(d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le){const Pe=[],qe=this.transform.elevation,Ze=d.getProjection(),He=d.elevationType==="road",xt=!!qe||He,ct=a.bV.getAtTileOffsetFunc(Le,this.transform.center.lat,this.transform.worldSize,Ze),pt=new a.P(w.tileAnchorX,w.tileAnchorY),lt=new a.P(w.tileAnchorX,w.tileAnchorY);let{x:st,y:wt,z:Ot}=Ze.projectTilePoint(lt.x,lt.y,Le.canonical),Pt=null;if(xt){const on=He?d.getElevationFeatureForText(M):null;Pt={getElevation:ct,elevation:qe,elevationFeature:on};const[en,$r,Kr]=ct(pt,qe,on);st+=en,wt+=$r,Ot+=Kr}const Vt=Ze.name==="globe",Wt=this.projectAndGetPerspectiveRatio(V,st,wt,Ot,Le,Vt||!!qe||this.transform.pitch>0,Ze),{perspectiveRatio:sr}=Wt,br=(oe?B/sr:B*sr)/a.bY,zt=Ku(st,wt,Ot,Y),Mt=w.lineOffsetX*br,Xt=w.lineOffsetY*br,qt=a.an(d.layers[0].layout.get("text-max-angle")),ur=Math.cos(qt),Er=Wt.signedDistanceFromCamera>0?ZI(br,D,Mt,Xt,He&&w.flipState===1,zt,lt,w,O,Y,{},xt&&!oe?Pt:null,oe&&xt,Ze,Le,oe,ur):null;let Gr=!1,Sr=!1,wr=!0;if(Er&&!Wt.occluded){const on=.5*ke*sr+_e,en=new a.P(-100,-100),$r=new a.P(this.screenRightBoundary,this.screenBottomBoundary),Kr=new gv,{first:Nn,last:Yn}=Er,Ls=Nn.path.length;let ui=[];for(let Wn=Ls-1;Wn>=1;Wn--)ui.push(Nn.path[Wn]);for(let Wn=1;Wn(xt&&!Vt&&(Li=ct(NiWn[3]<=0)&&(ui=[]));let ii=[];if(ui.length>0){let Wn=1/0,gi=-1/0,Li=1/0,Ni=-1/0;for(const ni of ui)Wn=Math.min(Wn,ni[0]),Li=Math.min(Li,ni[1]),gi=Math.max(gi,ni[0]),Ni=Math.max(Ni,ni[1]);gi>=en.x&&Wn<=$r.x&&Ni>=en.y&&Li<=$r.y&&(ii=[ui.map(ni=>new a.P(ni[0],ni[1]))],(Wn$r.x||Li$r.y)&&(ii=a.bW(ii,en.x,en.y,$r.x,$r.y)))}for(const Wn of ii){Kr.reset(Wn,.25*on);let gi=0;gi=Kr.length<=.5*on?1:Math.ceil(Kr.paddedLength/dn)+1;for(let Li=0;Li0?(a.aC(V,V,d),this.fogState&&O&&B.name!=="globe"&&(Y=function(oe,ue,ke,_e,Le,Pe){const qe=Pe.calculateFogTileMatrix(Le),Ze=[ue,ke,_e];return a.af(Ze,Ze,qe),Xr(oe,a.ag(Ze),Pe.pitch,Pe._fov)}(this.fogState,m,w,M,O.toUnwrapped(),this.transform)>.9)):pn(V,V,d);const Q=V[3];return{point:new a.P((V[0]/Q+1)/2*this.transform.width+Zs,(-V[1]/Q+1)/2*this.transform.height+Zs),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/Q*.5,1.5),signedDistanceFromCamera:Q,occluded:D&&V[2]>Q||Y}}isOffscreen(d,m,w,M){return w=this.screenRightBoundary||Mthis.screenBottomBoundary}isInsideGrid(d,m,w,M){return w>=0&&d=0&&mw.collisionGroupID===m}}return this.collisionGroups[d]}}function mc(_,d,m,w,M){const{horizontalAlign:O,verticalAlign:D}=a.c1(_),B=-(O-.5)*d,V=-(D-.5)*m,Y=a.c2(_,w);return new a.P(B+Y[0]*M,V+Y[1]*M)}function To(_,d,m,w,M){const O=new a.P(_,d);return m&&O._rotate(w?M:-M),O}class Gie{constructor(d,m,w,M,O,D){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Pi(this.transform,O),this.buildingIndex=D,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new _v(w),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,m,w,M,O=1){const D=w.getBucket(m),B=w.latestFeatureIndex;if(!D||!B||m.fqid!==D.layerIds[0])return;const V=D.layers[0].layout,Y=D.layers[0].paint,Q=w.collisionBoxArray,ce=Math.pow(2,this.transform.zoom-w.tileID.overscaledZ),oe=w.tileSize/a.al,ue=w.tileID.toUnwrapped();this.transform.setProjection(D.projection);const ke=(_e=w.tileID,Le=D.getProjection(),Pe=this.transform,Le.name===this.projection?Pe.calculateProjMatrix(_e.toUnwrapped()):E3(Pe,Le,_e));var _e,Le,Pe;const qe=V.get("text-pitch-alignment")==="map",Ze=V.get("text-rotation-alignment")==="map";m.compileFilter(m.options);const He=m.dynamicFilter(),xt=m.dynamicFilterNeedsFeature(),ct=this.transform.calculatePixelsToTileUnitsMatrix(w),pt=mk(ke,w.tileID.canonical,qe,Ze,this.transform,D.getProjection(),ct);let lt=null;const st=D.getProjection().createInversionMatrix(this.transform,w.tileID.canonical);if(qe){const Mt=xv(ke,w.tileID.canonical,qe,Ze,this.transform,D.getProjection(),ct);lt=a.aB([],this.transform.labelPlaneMatrix,Mt)}let wt=null;He&&w.latestFeatureIndex&&(wt={unwrappedTileID:ue,dynamicFilter:He,dynamicFilterNeedsFeature:xt}),this.retainedQueryData[D.bucketInstanceId]=new vv(D.bucketInstanceId,B,D.sourceLayerIndex,D.index,w.tileID);const[Ot,Pt]=D.layers[0].layout.get("text-size-scale-range"),Vt=a.aA(O,Ot,Pt),[Wt,sr]=V.get("icon-size-scale-range"),br=a.aA(O,Wt,sr),zt={bucket:D,layout:V,paint:Y,posMatrix:ke,invMatrix:st,mercatorCenter:[a.aF(this.transform.center.lng),a.aJ(this.transform.center.lat)],textLabelPlaneMatrix:pt,labelToScreenMatrix:lt,clippingData:wt,scale:ce,textPixelRatio:oe,holdingForFade:w.holdingForFade(),collisionBoxArray:Q,partiallyEvaluatedTextSize:a.bK(D.textSizeData,this.transform.zoom,Vt),partiallyEvaluatedIconSize:a.bK(D.iconSizeData,this.transform.zoom,br),collisionGroup:this.collisionGroups.get(D.sourceID),latestFeatureIndex:w.latestFeatureIndex};if(M)for(const Mt of D.sortKeyRanges){const{sortKey:Xt,symbolInstanceStart:qt,symbolInstanceEnd:ur}=Mt;d.push({sortKey:Xt,symbolInstanceStart:qt,symbolInstanceEnd:ur,parameters:zt})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:D.symbolInstances.length,parameters:zt})}attemptAnchorPlacement(d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le,Pe,qe,Ze,He,xt){const{textOffset0:ct,textOffset1:pt,crossTileID:lt}=_e,st=[ct,pt],wt=mc(d,D,B,st,V),Ot=this.collisionIndex.placeCollisionBox(Pe,V,m,w,M,O,To(wt.x,wt.y,Y,Q,this.transform.angle),ke,ce,oe,ue.predicate);if(Ze){const Pt=Pe.getSymbolInstanceIconSize(xt,this.transform.zoom,_e.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Pe,Pt,Ze,w,M,O,To(wt.x,wt.y,Y,Q,this.transform.angle),ke,ce,oe,ue.predicate).box.length===0)return}if(Ot.box.length>0){let Pt;return this.prevPlacement&&this.prevPlacement.variableOffsets[lt]&&this.prevPlacement.placements[lt]&&this.prevPlacement.placements[lt].text&&(Pt=this.prevPlacement.variableOffsets[lt].anchor),this.variableOffsets[lt]={textOffset:st,width:D,height:B,anchor:d,textScale:V,prevAnchor:Pt},this.markUsedJustification(Pe,d,_e,qe),Pe.allowVerticalPlacement&&(this.markUsedOrientation(Pe,qe,_e),this.placedOrientations[lt]=qe),{shift:wt,placedGlyphBoxes:Ot}}}placeLayerBucketPart(d,m,w,M,O=1){const{bucket:D,layout:B,paint:V,posMatrix:Y,textLabelPlaneMatrix:Q,labelToScreenMatrix:ce,clippingData:oe,textPixelRatio:ue,mercatorCenter:ke,invMatrix:_e,holdingForFade:Le,collisionBoxArray:Pe,partiallyEvaluatedTextSize:qe,partiallyEvaluatedIconSize:Ze,collisionGroup:He,latestFeatureIndex:xt}=d.parameters,ct=B.get("text-optional"),pt=B.get("icon-optional"),lt=B.get("text-allow-overlap"),st=B.get("icon-allow-overlap"),wt=B.get("text-rotation-alignment")==="map",Ot=B.get("icon-rotation-alignment")==="map",Pt=B.get("text-pitch-alignment")==="map",Vt=V.get("symbol-z-offset"),Wt=B.get("symbol-elevation-reference")==="sea",sr=B.get("symbol-placement"),[br,zt]=B.get("text-size-scale-range"),[Mt,Xt]=B.get("icon-size-scale-range"),qt=a.aA(O,br,zt),ur=a.aA(O,Mt,Xt),Er=B.get("text-variable-anchor"),Gr=wt&&sr!=="point",Sr=Ot&&sr!=="point",wr=Er&&D.hasTextData(),on=D.hasIconTextFit()&&wr&&D.hasIconData();this.transform.setProjection(D.projection);const en=wr||Gr,$r=Sr||on;let Kr=lt&&(st||!D.hasIconData()||pt),Nn=st&&(lt||!D.hasTextData()||ct);const Yn=!Vt.isConstant();!D.collisionArrays&&Pe&&D.deserializeCollisionBoxes(Pe),w&&M&&D.updateCollisionDebugBuffers(this.transform.zoom,Pe,qt,ur);const Ls=(dn,ii,Wn)=>{const{crossTileID:gi,numVerticalGlyphVertices:Li}=dn;let Ni=null;if(oe&&oe.dynamicFilterNeedsFeature||Yn){const Ua=this.retainedQueryData[D.bucketInstanceId];Ni=xt.loadFeature({featureIndex:dn.featureIndex,bucketIndex:Ua.bucketIndex,sourceLayerIndex:Ua.sourceLayerIndex,layoutVertexArrayOffset:0});const oo=Ni.properties?Ni.properties.worldview:null;if(D.localizable&&D.worldview&&typeof oo=="string")if(oo==="all")Ni.properties.$localized=!0;else{if(!oo.split(",").includes(D.worldview))return;Ni.properties.$localized=!0,Ni.properties.worldview=D.worldview}}if(oe&&!(0,oe.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:D.worldview},Ni,this.retainedQueryData[D.bucketInstanceId].tileID.canonical,new a.P(dn.tileAnchorX,dn.tileAnchorY),this.transform.calculateDistanceTileData(oe.unwrappedTileID)))return this.placements[gi]=new bi(!1,!1,!1,!0),void m.add(gi);const ni=Vt.evaluate(Ni,{});if(m.has(gi))return;if(Le)return void(this.placements[gi]=new bi(!1,!1,!1));let as=!1,pi=!1,Da=!0,xa=!1,xi=!1,Qs=null,ls={box:null,offscreen:null,occluded:null},sa={box:null},eo=null,Ea=null,qi=null,rd=0,ec=0,qo=0;Wn.textFeatureIndex?rd=Wn.textFeatureIndex:dn.useRuntimeCollisionCircles&&(rd=dn.featureIndex),Wn.verticalTextFeatureIndex&&(ec=Wn.verticalTextFeatureIndex);const xc=D.elevationFeatures?D.elevationFeatures[dn.elevationFeatureIndex]:void 0,yc=Ua=>{Ua.tileID=this.retainedQueryData[D.bucketInstanceId].tileID;const oo=this.transform.elevation;Ua.elevation=Wt?ni:ni+a.bV.getAtTileOffset(Ua.tileID,new a.P(Ua.tileAnchorX,Ua.tileAnchorY),oo,xc),Ua.elevation+=dn.zOffset},zl=Wn.textBox;if(zl){yc(zl);const Ua=Vi=>{let _o=a.bL.horizontal;if(D.allowVerticalPlacement&&!Vi&&this.prevPlacement){const Ra=this.prevPlacement.placedOrientations[gi];Ra&&(this.placedOrientations[gi]=Ra,_o=Ra,this.markUsedOrientation(D,_o,dn))}return _o},oo=(Vi,_o)=>{if(D.allowVerticalPlacement&&Li>0&&Wn.verticalTextBox){for(const Ra of D.writingModes)if(Ra===a.bL.vertical?(ls=_o(),sa=ls):ls=Vi(),ls&&ls.box&&ls.box.length)break}else ls=Vi()};if(Er){let Vi=Er;if(this.prevPlacement&&this.prevPlacement.variableOffsets[gi]){const Ia=this.prevPlacement.variableOffsets[gi];Vi.indexOf(Ia.anchor)>0&&(Vi=Vi.filter(nh=>nh!==Ia.anchor),Vi.unshift(Ia.anchor))}const _o=(Ia,nh,Kv)=>{const Eh=D.getSymbolInstanceTextSize(qe,dn,this.transform.zoom,ii),Zv=(Ia.x2-Ia.x1)*Eh+2*Ia.padding,Gy=(Ia.y2-Ia.y1)*Eh+2*Ia.padding,wf=dn.hasIconTextFit&&!st?nh:null;wf&&yc(wf);let Tp={box:[],offscreen:!1,occluded:!1};const Ky=lt?2*Vi.length:Vi.length;for(let Km=0;Km=Vi.length,dn,ii,D,Kv,wf,qe,Ze);if(Ap&&(Tp=Ap.placedGlyphBoxes,Tp&&Tp.box&&Tp.box.length)){as=!0,Qs=Ap.shift;break}}return Tp};oo(()=>_o(zl,Wn.iconBox,a.bL.horizontal),()=>{const Ia=Wn.verticalTextBox;return Ia&&yc(Ia),D.allowVerticalPlacement&&!(ls&&ls.box&&ls.box.length)&&Li>0&&Ia?_o(Ia,Wn.verticalIconBox,a.bL.vertical):{box:null,offscreen:null,occluded:null}}),ls&&(as=ls.box,Da=ls.offscreen,xa=ls.occluded);const Ra=Ua(!(!ls||!ls.box));if(!as&&this.prevPlacement){const Ia=this.prevPlacement.variableOffsets[gi];Ia&&(this.variableOffsets[gi]=Ia,this.markUsedJustification(D,Ia.anchor,dn,Ra))}}else{const Vi=(_o,Ra)=>{const Ia=D.getSymbolInstanceTextSize(qe,dn,this.transform.zoom,ii),nh=this.collisionIndex.placeCollisionBox(D,Ia,_o,ke,_e,en,new a.P(0,0),lt,ue,Y,He.predicate);return nh&&nh.box&&nh.box.length&&(this.markUsedOrientation(D,Ra,dn),this.placedOrientations[gi]=Ra),nh};oo(()=>Vi(zl,a.bL.horizontal),()=>{const _o=Wn.verticalTextBox;return D.allowVerticalPlacement&&Li>0&&_o?(yc(_o),Vi(_o,a.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Ua(!!(ls&&ls.box&&ls.box.length))}}if(eo=ls,as=eo&&eo.box&&eo.box.length>0,Da=eo&&eo.offscreen,xa=eo&&eo.occluded,dn.useRuntimeCollisionCircles){const Ua=dn.centerJustifiedTextSymbolIndex>=0?dn.centerJustifiedTextSymbolIndex:dn.verticalPlacedTextSymbolIndex,oo=D.text.placedSymbolArray.get(Ua),Vi=a.bM(D.textSizeData,qe,oo),_o=B.get("text-padding");Ea=this.collisionIndex.placeCollisionCircles(D,lt,oo,Ua,D.lineVertexArray,D.glyphOffsetArray,Vi,Y,Q,ce,w,Pt,He.predicate,dn.collisionCircleDiameter*Vi/a.bY,_o,this.retainedQueryData[D.bucketInstanceId].tileID),as=lt||Ea.circles.length>0&&!Ea.collisionDetected,Da=Da&&Ea.offscreen,xa=Ea.occluded}if(Wn.iconFeatureIndex&&(qo=Wn.iconFeatureIndex),Wn.iconBox){const Ua=oo=>{yc(oo);const Vi=dn.hasIconTextFit&&Qs?To(Qs.x,Qs.y,wt,Pt,this.transform.angle):new a.P(0,0),_o=D.getSymbolInstanceIconSize(Ze,this.transform.zoom,dn.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(D,_o,oo,ke,_e,$r,Vi,st,ue,Y,He.predicate)};sa&&sa.box&&sa.box.length&&Wn.verticalIconBox?(qi=Ua(Wn.verticalIconBox),pi=qi.box.length>0):(qi=Ua(Wn.iconBox),pi=qi.box.length>0),Da=Da&&qi.offscreen,xi=qi.occluded}const hu=ct||dn.numHorizontalGlyphVertices===0&&Li===0,rh=pt||dn.numIconVertices===0;if(hu||rh?rh?hu||(pi=pi&&as):as=pi&&as:pi=as=pi&&as,as&&eo&&eo.box&&this.collisionIndex.insertCollisionBox(eo.box,B.get("text-ignore-placement"),D.bucketInstanceId,sa&&sa.box&&ec?ec:rd,He.ID),pi&&qi&&this.collisionIndex.insertCollisionBox(qi.box,B.get("icon-ignore-placement"),D.bucketInstanceId,qo,He.ID),Ea&&(as&&this.collisionIndex.insertCollisionCircles(Ea.circles,B.get("text-ignore-placement"),D.bucketInstanceId,rd,He.ID),w)){const Ua=D.bucketInstanceId;let oo=this.collisionCircleArrays[Ua];oo===void 0&&(oo=this.collisionCircleArrays[Ua]=new gk);for(let Vi=0;Vi=0;--ii){const Wn=dn[ii];Ls(D.symbolInstances.get(Wn),Wn,D.collisionArrays[Wn])}D.hasAnyZOffset&&a.w(`${D.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(D.hasAnyZOffset){const dn=D.getSortedIndexesByZOffset();for(let ii=0;ii=0&&(d.text.placedSymbolArray.get(O).crossTileID=ce>=0&&O!==ce?0:Y),D>=0&&(d.text.placedSymbolArray.get(D).crossTileID=ce>=0&&D!==ce?0:Y),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=ce>=0&&B!==ce?0:Y),V>=0&&(d.text.placedSymbolArray.get(V).crossTileID=ce>=0&&V!==ce?0:Y)}markUsedOrientation(d,m,w){const M=m===a.bL.horizontal||m===a.bL.horizontalOnly?m:0,O=m===a.bL.vertical?m:0,{leftJustifiedTextSymbolIndex:D,centerJustifiedTextSymbolIndex:B,rightJustifiedTextSymbolIndex:V,verticalPlacedTextSymbolIndex:Y}=w,Q=d.text.placedSymbolArray;D>=0&&(Q.get(D).placedOrientation=M),B>=0&&(Q.get(B).placedOrientation=M),V>=0&&(Q.get(V).placedOrientation=M),Y>=0&&(Q.get(Y).placedOrientation=O)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let w=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const M=m?m.symbolFadeChange(d):1,O=m?m.opacities:{},D=m?m.variableOffsets:{},B=m?m.placedOrientations:{};for(const V in this.placements){const Y=this.placements[V],Q=O[V];Q?(this.opacities[V]=new ff(Q,M,Y.text,Y.icon,null,Y.clipped),w=w||Y.text!==Q.text.placed||Y.icon!==Q.icon.placed):(this.opacities[V]=new ff(null,M,Y.text,Y.icon,Y.skipFade,Y.clipped),w=w||Y.text||Y.icon)}for(const V in O){const Y=O[V];if(!this.opacities[V]){const Q=new ff(Y,M,!1,!1);Q.isHidden()||(this.opacities[V]=Q,w=w||Y.text.placed||Y.icon.placed)}}for(const V in D)this.variableOffsets[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.variableOffsets[V]=D[V]);for(const V in B)this.placedOrientations[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.placedOrientations[V]=B[V]);w?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:d)}updateLayerOpacities(d,m,w,M){M&&(this.lastReplacementSourceUpdateTime=M.updateTime);const O=new Set;for(const D of m){const B=D.getBucket(d);B&&D.latestFeatureIndex&&d.fqid===B.layerIds[0]&&(this.updateBucketOpacities(B,O,D,D.collisionBoxArray,w,M,D.tileID,d.scope),B.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(B,D.tileID),B.elevationType==="road"&&B.updateRoadElevation(D.tileID.canonical),B.updateZOffset())}}updateBucketOpacities(d,m,w,M,O,D,B,V){d.hasTextData()&&d.text.opacityVertexArray.clear(),d.hasIconData()&&d.icon.opacityVertexArray.clear(),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexArray.clear(),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexArray.clear();const Y=d.layers[0].layout,Q=d.layers[0].paint,ce=!!d.layers[0].dynamicFilter(),oe=new ff(null,0,!1,!1,!0),ue=Y.get("text-allow-overlap"),ke=Y.get("icon-allow-overlap"),_e=Y.get("text-variable-anchor"),Le=Y.get("text-rotation-alignment")==="map",Pe=Y.get("text-pitch-alignment")==="map",qe=Q.get("symbol-z-offset"),Ze=Y.get("symbol-elevation-reference")==="sea",He=!qe.isConstant(),xt=new ff(null,0,ue&&(ke||!d.hasIconData()||Y.get("icon-optional")),ke&&(ue||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&M&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(M);const ct=(lt,st,wt)=>{for(let Ot=0;Ot0||Ot>0,Er=Vt>0,Gr=this.placedOrientations[Pt],Sr=Gr===a.bL.vertical,wr=Gr===a.bL.horizontal||Gr===a.bL.horizontalOnly;!ur&&!Er||qt.isHidden()||pt++;let on=!1;if((ur||Er)&&D)for(const en of d.activeReplacements){if(a.bZ(en,O,a.b_.Symbol,V)||en.min.x>Wt||Wt>en.max.x||en.min.y>sr||sr>en.max.y)continue;const $r=a.b$(Wt,sr,B.canonical,en.footprintTileId.canonical);if(on=a.c0($r,en.footprint),on)break}if(ur){const en=on?Kg:Qc(qt.text);ct(d.text,wt,Sr?Kg:en),ct(d.text,Ot,wr?Kg:en);const $r=qt.text.isHidden(),{leftJustifiedTextSymbolIndex:Kr,centerJustifiedTextSymbolIndex:Nn,rightJustifiedTextSymbolIndex:Yn,verticalPlacedTextSymbolIndex:Ls}=st,ui=d.text.placedSymbolArray,dn=$r||Sr?1:0;Kr>=0&&(ui.get(Kr).hidden=dn),Nn>=0&&(ui.get(Nn).hidden=dn),Yn>=0&&(ui.get(Yn).hidden=dn),Ls>=0&&(ui.get(Ls).hidden=$r||wr?1:0);const ii=this.variableOffsets[Pt];ii&&this.markUsedJustification(d,ii.anchor,st,Gr);const Wn=this.placedOrientations[Pt];Wn&&(this.markUsedJustification(d,"left",st,Wn),this.markUsedOrientation(d,Wn,st))}if(Er){const en=on?Kg:Qc(qt.icon),{placedIconSymbolIndex:$r,verticalPlacedIconSymbolIndex:Kr}=st,Nn=d.icon.placedSymbolArray,Yn=qt.icon.isHidden()?1:0;$r>=0&&(ct(d.icon,Vt,Sr?Kg:en),Nn.get($r).hidden=Yn),Kr>=0&&(ct(d.icon,st.numVerticalIconVertices,wr?Kg:en),Nn.get(Kr).hidden=Yn)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const en=d.collisionArrays[lt];if(en){let $r=new a.P(0,0),Kr=!0;if(en.textBox||en.verticalTextBox){if(_e){const Yn=this.variableOffsets[Pt];Yn?($r=mc(Yn.anchor,Yn.width,Yn.height,Yn.textOffset,Yn.textScale),Le&&$r._rotate(Pe?this.transform.angle:-this.transform.angle)):Kr=!1}ce&&(Kr=!qt.clipped),en.textBox&&Pm(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Kr||Sr,Mt,Ze,$r.x,$r.y),en.verticalTextBox&&Pm(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Kr||wr,Mt,Ze,$r.x,$r.y)}const Nn=Kr&&!!(!wr&&en.verticalIconBox);en.iconBox&&Pm(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,Nn,Mt,Ze,st.hasIconTextFit?$r.x:0,st.hasIconTextFit?$r.y:0),en.verticalIconBox&&Pm(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,!Nn,Mt,Ze,st.hasIconTextFit?$r.x:0,st.hasIconTextFit?$r.y:0)}}}if(d.fullyClipped=pt===0,d.sortFeatures(this.transform.angle),this.retainedQueryData[d.bucketInstanceId]&&(this.retainedQueryData[d.bucketInstanceId].featureSortOrder=d.featureSortOrder),d.hasTextData()&&d.text.opacityVertexBuffer&&d.text.opacityVertexBuffer.updateData(d.text.opacityVertexArray),d.hasIconData()&&d.icon.opacityVertexBuffer&&d.icon.opacityVertexBuffer.updateData(d.icon.opacityVertexArray),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexBuffer&&d.iconCollisionBox.collisionVertexBuffer.updateData(d.iconCollisionBox.collisionVertexArray),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexBuffer&&d.textCollisionBox.collisionVertexBuffer.updateData(d.textCollisionBox.collisionVertexArray),d.bucketInstanceId in this.collisionCircleArrays){const lt=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=lt.invProjMatrix,d.placementViewportMatrix=lt.viewportMatrix,d.collisionCircleArray=lt.circles,delete this.collisionCircleArrays[d.bucketInstanceId]}}symbolFadeChange(d){return this.fadeDuration===0?1:(d-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(d){return Math.max(0,(this.transform.zoom-d)/1.5)}hasTransitions(d){return this.stale||d-this.lastPlacementChangeTimed}isStale(){return this.stale}setStale(){this.stale=!0}}function Pm(_,d,m,w,M,O,D){_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0)}const L3=Math.pow(2,25),bv=Math.pow(2,24),xk=Math.pow(2,17),O3=Math.pow(2,16),yk=Math.pow(2,9),Xc=Math.pow(2,8),gp=Math.pow(2,1);function Qc(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const d=_.placed?1:0,m=Math.floor(127*_.opacity);return m*L3+d*bv+m*xk+d*O3+m*yk+d*Xc+m*gp+d}const Kg=0;class ky{constructor(d){this._sortAcrossTiles=d.layout.get("symbol-z-order")!=="viewport-y"&&d.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(d,m,w,M,O,D){const B=this._bucketParts;for(;this._currentTileIndexV.sortKey-Y.sortKey));this._currentPartIndex{const V=a.o.now()-D;return!this._forceFullPlacement&&V>2};for(;this._currentPlacementIndex>=0;){const V=m[d[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(V.type==="symbol"&&V.visibility!=="none"&&(!V.minzoom||V.minzoom<=Y)&&(!V.maxzoom||V.maxzoom>Y)){const Q=V,ce=Q.layout.get("symbol-z-elevate"),oe=Q.layout.get("symbol-sort-key").constantOr(1)!==void 0,ue=Q.layout.get("symbol-z-order"),ke=ue==="viewport-y"||ue==="auto"&&!(ue!=="viewport-y"&&oe),_e=Q.layout.get("text-allow-overlap")||Q.layout.get("icon-allow-overlap")||Q.layout.get("text-ignore-placement")||Q.layout.get("icon-ignore-placement"),Le=ke&&_e,Pe=this._inProgressLayer=this._inProgressLayer||new ky(Q),qe=a.B(V.source,V.scope);if(Pe.continuePlacement(ce||Le?M[qe]:w[qe],this.placement,this._showCollisionBoxes,V,B,O))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const Yu=512/a.al/2;class xp{constructor(d,m,w){this.tileID=d,this.bucketInstanceId=w,this.index=new a.c4(m.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const M=d.canonical.x*a.al,O=d.canonical.y*a.al;for(let D=0;DLe-Pe);for(const Le of _e){const Pe=this.crossTileIDs[Le];if(this.keys[Le]===Q&&!w.has(Pe)){w.add(Pe),Y.crossTileID=Pe;break}}}}}class il{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class D3{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const m=Math.round((d-this.lng)/360);if(m!==0)for(const w in this.indexes){const M=this.indexes[w],O={};for(const D in M){const B=M[D];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+m),O[B.tileID.key]=B}this.indexes[w]=O}this.lng=d}addBucket(d,m,w){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===m.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let O=0;Od.overscaledZ)for(const B in D){const V=D[B];V.tileID.isChildOf(d)&&V.findMatches(m.symbolInstances,d,M)}else{const B=D[d.scaledTo(Number(O)).key];B&&B.findMatches(m.symbolInstances,d,M)}}for(let O=0;O{m[w]=!0});for(const w in this.layerIndexes)m[w]||delete this.layerIndexes[w]}}const pf=771;class is{constructor(d,m,w,M){this.blendFunction=d,this.blendColor=m.toNonPremultipliedRenderColor(null),this.mask=w,this.blendEquation=M}}is.Replace=[1,0,1,0],is.disabled=new is(is.Replace,a.ao.transparent,[!1,!1,!1,!1]),is.unblended=new is(is.Replace,a.ao.transparent,[!0,!0,!0,!0]),is.alphaBlended=new is([1,pf,1,pf],a.ao.transparent,[!0,!0,!0,!0]),is.alphaBlendedNonPremultiplied=new is([770,pf,770,pf],a.ao.transparent,[!0,!0,!0,!0]),is.multiply=new is([774,0,774,0],a.ao.transparent,[!0,!0,!0,!0]),is.additive=new is([1,1,1,1],a.ao.transparent,[!0,!0,!0,!0]);class un{constructor(d,m,w){this.func=d,this.mask=m,this.range=w}}un.ReadOnly=!1,un.ReadWrite=!0,un.disabled=new un(519,un.ReadOnly,[0,1]);const vk=7680;class $n{constructor(d,m,w,M,O,D){this.test=d,this.ref=m,this.mask=w,this.fail=M,this.depthFail=O,this.pass=D}}$n.disabled=new $n({func:519,mask:0},0,0,vk,vk,vk);const Ny=1029,_k=2305;class Bn{constructor(d,m,w){this.enable=d,this.mode=m,this.frontFace=w}}function mf(_,d){const m=a.ca(_,3);a.cc(_,d),a.cg(_,3,m)}function R3(_,d){const m=a.c7([]);return a.c8(m,m,-d),a.c9(m,m,-_),m}function bk(_,d){const m=[_[0],_[1],0],w=[d[0],d[1],0];if(a.ag(m)>=1e-15){const D=a.aw([],m);a.c5(w,D,a.bJ(w,D)),d[0]=w[0],d[1]=w[1]}const M=a.bI([],d,_);if(a.c6(M)<1e-15)return null;const O=Math.atan2(-M[1],M[0]);return R3(Math.atan2(Math.sqrt(_[0]*_[0]+_[1]*_[1]),-_[2]),O)}Bn.disabled=new Bn(!1,Ny,_k),Bn.backCCW=new Bn(!0,Ny,_k),Bn.backCW=new Bn(!0,Ny,2304),Bn.frontCW=new Bn(!0,1028,2304),Bn.frontCCW=new Bn(!0,1028,_k);class Jc{constructor(d,m){this.position=d,this.orientation=m}get position(){return this._position}set position(d){if(d){const m=d instanceof a.ae?d:new a.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(m.x=a.bT(m.x,0,1)),this._position=m}else this._position=null}lookAtPoint(d,m,w){if(this.orientation=null,!this.position)return;const M=this.position,O=w||(this._elevation?this._elevation.getAtPointOrZero(a.ae.fromLngLat(d)):0),D=a.ae.fromLngLat(d,O),B=[D.x-M.x,D.y-M.y,D.z-M.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=bk(B,m)}setPitchBearing(d,m){this.orientation=R3(a.an(d),a.an(-m))}}class wk{constructor(d,m){this._transform=a.bA([]),this.orientation=m,this.position=d}get mercatorPosition(){const d=this.position;return new a.ae(d[0],d[1],d[2])}get position(){const d=a.ca(this._transform,3);return[d[0],d[1],d[2]]}set position(d){var m;d&&a.cg(this._transform,3,[(m=d)[0],m[1],m[2],1])}get orientation(){return this._orientation}set orientation(d){this._orientation=d||a.c7([]),d&&mf(this._transform,this._orientation)}getPitchBearing(){const d=this.forward(),m=this.right();return{bearing:Math.atan2(-m[1],m[0]),pitch:Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2])}}setPitchBearing(d,m){this._orientation=R3(d,m),mf(this._transform,this._orientation)}forward(){const d=a.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=a.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=a.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,m){const w=new Float64Array(16);return a.bl(w,this.getWorldToCamera(d,m)),w}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,m,w){const M=this.position;a.c5(M,M,-d);const O=new Float64Array(16);return a.bq(O,[w,w,w]),a.br(O,O,M),O[10]*=m,O}getWorldToCamera(d,m){const w=new Float64Array(16),M=new Float64Array(4),O=this.position;return a.cb(M,this._orientation),a.c5(O,O,-d),a.cc(w,M),a.br(w,w,O),w[1]*=-1,w[5]*=-1,w[9]*=-1,w[13]*=-1,w[8]*=m,w[9]*=m,w[10]*=m,w[11]*=m,w}getCameraToClipPerspective(d,m,w,M){const O=new Float64Array(16);return a.cd(O,d,m,w,M),O}getCameraToClipOrthographic(d,m,w,M,O,D){const B=new Float64Array(16);return a.ce(B,d,m,w,M,O,D),B}getDistanceToElevation(d,m=!1){const w=d===0?0:a.cf(d,m?a.a$(this.position[1]):this.position[1]),M=this.forward();return(w-this.position[2])/M[2]}clone(){return new wk([...this.position],[...this.orientation])}}const Sl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class jk{constructor(d=0,m=0,w=0,M=0){if(isNaN(d)||d<0||isNaN(m)||m<0||isNaN(w)||w<0||isNaN(M)||M<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=m,this.left=w,this.right=M}interpolate(d,m,w){return m.top!=null&&d.top!=null&&(this.top=a.ak(d.top,m.top,w)),m.bottom!=null&&d.bottom!=null&&(this.bottom=a.ak(d.bottom,m.bottom,w)),m.left!=null&&d.left!=null&&(this.left=a.ak(d.left,m.left,w)),m.right!=null&&d.right!=null&&(this.right=a.ak(d.right,m.right,w)),this}getCenter(d,m){const w=a.aA((this.left+d-this.right)/2,0,d),M=a.aA((this.top+m-this.bottom)/2,0,m);return new a.P(w,M)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new jk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Ch=15;class F3{constructor(d,m,w,M,O,D,B){this.tileSize=512,this._renderWorldCopies=O===void 0||O,this._minZoom=d||0,this._maxZoom=m||22,this._minPitch=w??0,this._maxPitch=M??60,this.setProjection(D),this.setMaxBounds(B),this.width=0,this.height=0,this._center=new a.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new jk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new wk,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 d=new F3(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return d._elevation=this._elevation,d._centerAltitude=this._centerAltitude,d._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,d.tileSize=this.tileSize,d.mercatorFromTransition=this.mercatorFromTransition,d.width=this.width,d.height=this.height,d.cameraElevationReference=this.cameraElevationReference,d._center=this._center,d._setZoom(this.zoom),d._seaLevelZoom=this._seaLevelZoom,d.angle=this.angle,d._fov=this._fov,d._pitch=this._pitch,d._nearZ=this._nearZ,d._farZ=this._farZ,d._averageElevation=this._averageElevation,d._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,d._unmodified=this._unmodified,d._edgeInsets=this._edgeInsets.clone(),d._camera=this._camera.clone(),d._calcMatrices(),d.freezeTileCoverage=this.freezeTileCoverage,d.frustumCorners=this.frustumCorners,d._allowWorldUnderZoom=this._allowWorldUnderZoom,d}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||d===Number.NEGATIVE_INFINITY&&(!m||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const w=this._elevation;m||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&w.exaggeration()&&this._centerAltitudeValidForExaggeration!==w.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*w.exaggeration(),this._centerAltitudeValidForExaggeration=w.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=w.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const d=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(d)}sampleAverageElevation(){if(!this._elevation)return 0;const d=this._elevation,m=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],w=this.horizonLineFromTop();let M=0,O=0;for(let D=0;D{const Le=a.cY(oe,ce,ue,ke,_e);V.has(Le)||(O.push(new a.aQ(ce,oe,ue,ke,_e)),V.add(Le))};for(let ce=0;ceoe.canonical.z)continue;const ue=oe.canonical,ke=oe.overscaledZ,_e=oe.wrap,Le=1<0,Ze=ue.y+10,xt=oe.wrap-(qe?0:1),ct=oe.wrap+(Pe?0:1),pt=qe?ue.x-1:Le-1,lt=Pe?ue.x+1:0;if(D)w[0]<0?(Y(ke,ct,ue.z,lt,ue.y),w[1]<0&&Ze&&(Y(ke,_e,ue.z,ue.x,ue.y+1),Y(ke,ct,ue.z,lt,ue.y+1)),w[1]>0&&He&&(Y(ke,_e,ue.z,ue.x,ue.y-1),Y(ke,ct,ue.z,lt,ue.y-1))):w[0]>0?(Y(ke,xt,ue.z,pt,ue.y),w[1]<0&&Ze&&(Y(ke,_e,ue.z,ue.x,ue.y+1),Y(ke,xt,ue.z,pt,ue.y+1)),w[1]>0&&He&&(Y(ke,_e,ue.z,ue.x,ue.y-1),Y(ke,xt,ue.z,pt,ue.y-1))):w[1]<0&&Ze?Y(ke,_e,ue.z,ue.x,ue.y+1):He&&Y(ke,_e,ue.z,ue.x,ue.y-1);else{const st=oe.visibleQuadrants;1&st&&(Y(ke,xt,ue.z,pt,ue.y),He&&(Y(ke,_e,ue.z,ue.x,ue.y-1),Y(ke,xt,ue.z,pt,ue.y-1))),2&st&&(Y(ke,ct,ue.z,lt,ue.y),He&&(Y(ke,_e,ue.z,ue.x,ue.y-1),Y(ke,ct,ue.z,lt,ue.y-1))),4&st&&(Y(ke,xt,ue.z,pt,ue.y),Ze&&(Y(ke,_e,ue.z,ue.x,ue.y+1),Y(ke,xt,ue.z,pt,ue.y+1))),8&st&&(Y(ke,ct,ue.z,lt,ue.y),Ze&&(Y(ke,_e,ue.z,ue.x,ue.y+1),Y(ke,ct,ue.z,lt,ue.y+1)))}}const Q=[];for(const ce of O)O.some(oe=>ce.isChildOf(oe))||Q.push(ce);if(O=Q.filter(ce=>!d.some(oe=>!!(ce.overscaledZ{const Pe=Le.canonical.x+.5-ue[0],qe=Le.canonical.y+.5-ue[1];return Pe*Pe+qe*qe<_e})}return O}extendTileCoverToNearPlane(d,m,w){const M=[],O=new Set;for(const qe of d)O.add(qe.key);const D=(qe,Ze,He,xt,ct)=>{const pt=a.cY(Ze,qe,He,xt,ct);O.has(pt)||(M.push(new a.aQ(qe,Ze,He,xt,ct)),O.add(pt))},B=d.reduce((qe,Ze)=>Math.max(qe,Ze.overscaledZ),w),V=1<{const He=Math.floor(qe[0]),xt=Math.floor(qe[1]),ct=(qe[0]-He)*a.al,pt=(qe[1]-xt)*a.al,lt=Math.floor(Ze[0]),st=Math.floor(Ze[1]),wt=(Ze[0]-lt)*a.al,Ot=(Ze[1]-st)*a.al;for(let Pt=-1;Pt<=1;Pt++){const Vt=He+Pt;if(!(Vt<0||Vt>=V)){Q.x=ct-Pt*a.al,ce.x=wt-(Vt-lt)*a.al;for(let Wt=-1;Wt<=1;Wt++){const sr=xt+Wt;Q.y=pt-Wt*a.al,ce.y=Ot-(sr-st)*a.al,a.cZ(Q,ce,Y)&&D(B,0,w,Vt,sr)}}}},ue=m.points,ke=ue[a.cv],_e=ue[a.cw],Le=this._projectToGround(ke,ue[a.cx]),Pe=this._projectToGround(_e,ue[a.cy]);return oe(ke,Le),oe(_e,Pe),M}_projectToGround(d,m){return a.cz(a.cA(),d,m,d[2]/(d[2]-m[2]))}coveringTiles(d){let m=this.coveringZoomLevel(d);const w=m,M=this.elevation&&this.elevation.exaggeration(),O=M&&!d.isTerrainDEM,D=this.projection.name==="mercator";if(d.minzoom!==void 0&&md.maxzoom&&(m=d.maxzoom);const B=this.locationCoordinate(this.center),V=this.center.lat,Y=1<{const qt=new a.ae(Mt.x+25e-6,Mt.y,Mt.z),ur=new a.ae(Mt.x,Mt.y+25e-6,Mt.z),Er=Mt.toLngLat(),Gr=qt.toLngLat(),Sr=ur.toLngLat(),wr=this.locationCoordinate(Er),on=this.locationCoordinate(Gr),en=this.locationCoordinate(Sr),$r=Math.hypot(on.x-wr.x,on.y-wr.y),Kr=Math.hypot(en.x-wr.x,en.y-wr.y);return Math.sqrt($r*Kr)*pt/25e-6},st=Mt=>{const Xt=xt,qt=ct;return{aabb:a.cF(this,Y,0,0,0,Mt,qt,Xt,this.projection),zoom:0,x:0,y:0,minZ:qt,maxZ:Xt,wrap:Mt,fullyVisible:!1}},wt=[];let Ot=[];const Pt=m,Vt=d.reparseOverscaled?w:m,Wt=(Le-this._centerAltitude)*_e,sr=Mt=>{if(!this._elevation||!Mt.tileID||!D)return;const Xt=this._elevation.getMinMaxForTile(Mt.tileID),qt=Mt.aabb;Xt?(qt.min[2]=Xt.min,qt.max[2]=Xt.max,qt.center[2]=(qt.min[2]+qt.max[2])/2):(Mt.shouldSplit=zt(Mt),Mt.shouldSplit||(qt.min[2]=qt.max[2]=qt.center[2]=this._centerAltitude))},br=(Mt,Xt)=>{if(.707*Xt{if(Mt.zoom=.9)return!0}else if(O&&(ur=Mt.aabb.distanceZ(Pe)*_e),this.projection.isReprojectedInTileSpace&&w<=5){const Kr=Math.pow(2,Mt.zoom),Nn=lt(new a.ae((Mt.x+.5)/Kr,(Mt.y+.5)/Kr));Er=Nn>.85?1:Nn}if(!D&&!ce){const Kr=Math.sqrt(Xt*Xt+qt*qt+ur*ur);let Nn=(1<0;){const Mt=wt.pop(),Xt=Mt.x,qt=Mt.y;let ur=Mt.fullyVisible;const Er=()=>this.projection.name==="globe"&&(Mt.y===0||Mt.y===(1<>1),on={aabb:D?Mt.aabb.quadrant(Gr):a.cF(this,Y,Mt.zoom+1,Sr,wr,Mt.wrap,Mt.minZ,Mt.maxZ,this.projection),zoom:Mt.zoom+1,x:Sr,y:wr,wrap:Mt.wrap,fullyVisible:ur,tileID:void 0,shouldSplit:void 0,minZ:Mt.minZ,maxZ:Mt.maxZ};O&&!ce&&(on.tileID=new a.aQ(Mt.zoom+1===Pt?Vt:Mt.zoom+1,Mt.wrap,Mt.zoom+1,Sr,wr),sr(on)),wt.push(on)}else{const Gr=Mt.zoom===Pt?Vt:Mt.zoom;if(d.minzoom&&d.minzoom>Gr)continue;let Sr=0;if(!ur){let $r=qe?Mt.aabb.intersectsPrecise(ue):Mt.aabb.intersectsPreciseFlat(ue);if($r===0&&Er()){const Kr=new a.cD(Mt.zoom,Xt,qt);$r=a.cE(this,Y,Kr,!0).intersectsPrecise(ue)}if($r===0)continue;if(d.calculateQuadrantVisibility)if(ue.containsPoint(Mt.aabb.center))Sr=15;else for(let Kr=0;Kr<4;Kr++)Mt.aabb.quadrant(Kr).intersects(ue)!==0&&(Sr|=1<{const ur=[0,0,0,1],Er=[a.al,a.al,0,1],Gr=this.calculateFogTileMatrix(qt.tileID.toUnwrapped());a.aC(ur,ur,Gr),a.aC(Er,Er,Gr);const Sr=a.cG([],ur,Er),wr=a.cH([],ur,Er),on=a.c$(Sr,wr);if(on===0)return!0;let en=!1;const $r=this._elevation;if($r&&on>Mt&&Xt!==0){const Kr=this.calculateProjMatrix(qt.tileID.toUnwrapped());let Nn;d.isTerrainDEM||(Nn=$r.getMinMaxForTile(qt.tileID)),Nn||(Nn={min:ct,max:xt});const Yn=a.cI(this.rotation),Ls=[Yn[0]*a.al,Yn[1]*a.al,Nn.max];a.af(Ls,Ls,Kr),en=(1-Ls[1])*this.height*.5Mt.distanceSq-Xt.distanceSq).map(Mt=>Mt.tileID)}resize(d,m){this.width=d,this.height=m,this.pixelsToGLUnits=[2/d,-2/m],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log2(d)}project(d){const m=a.aA(d.lat,-a.cJ,a.cJ),w=this.projection.project(d.lng,m);return new a.P(w.x*this.worldSize,w.y*this.worldSize)}unproject(d){return this.projection.unproject(d.x/this.worldSize,d.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/a.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,m){let w,M;const O=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;w=(m.x-O.x)/B,M=(m.y-O.y)/B}else{const B=this.pointCoordinate(m),V=this.pointCoordinate(O);w=B.x-V.x,M=B.y-V.y}const D=this.locationCoordinate(d);this.setLocation(new a.ae(D.x-w,D.y-M))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,m){return this.projection.locationPoint(this,d,m)}locationPoint3D(d,m){return this.projection.locationPoint(this,d,m,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,m){return this.coordinateLocation(this.pointCoordinate3D(d,m))}locationCoordinate(d,m){const w=m?a.cf(m,d.lat):void 0,M=this.projection.project(d.lng,d.lat);return new a.ae(M.x,M.y,w)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,m){const w=m??this._centerAltitude,M=[d.x,d.y,0,1],O=[d.x,d.y,1,1];a.aC(M,M,this.pixelMatrixInverse),a.aC(O,O,this.pixelMatrixInverse);const D=O[3];a.cK(M,M,1/M[3]),a.cK(O,O,1/D);const B=M[2],V=O[2];return{p0:M,p1:O,t:B===V?0:(w-B)/(V-B)}}screenPointToMercatorRay(d){const m=[d.x,d.y,0,1],w=[d.x,d.y,1,1];return a.aC(m,m,this.pixelMatrixInverse),a.aC(w,w,this.pixelMatrixInverse),a.cK(m,m,1/m[3]),a.cK(w,w,1/w[3]),m[2]=a.cf(m[2],this._center.lat)*this.worldSize,w[2]=a.cf(w[2],this._center.lat)*this.worldSize,a.cK(m,m,1/this.worldSize),a.cK(w,w,1/this.worldSize),new a.ax([m[0],m[1],m[2]],a.aw([],a.av([],w,m)))}rayIntersectionCoordinate(d){const{p0:m,p1:w,t:M}=d,O=a.cf(m[2],this._center.lat),D=a.cf(w[2],this._center.lat);return new a.ae(a.ak(m[0],w[0],M)/this.worldSize,a.ak(m[1],w[1],M)/this.worldSize,a.ak(O,D,M))}pointCoordinate(d,m=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,m)}pointCoordinate3D(d,m){if(!this.elevation)return this.pointCoordinate(d,m);let w=this.projection.pointCoordinate3D(this,d.x,d.y);if(w)return new a.ae(w[0],w[1],w[2]);let M=0,O=this.horizonLineFromTop();if(d.y>O)return this.pointCoordinate(d,m);const D=.02*O,B=d.clone();for(let V=0;V<10&&O-M>D;V++){B.y=a.ak(M,O,.66);const Y=this.projection.pointCoordinate3D(this,B.x,B.y);Y?(O=B.y,w=Y):M=B.y}return w?new a.ae(w[0],w[1],w[2]):this.pointCoordinate(d)}isPointAboveHorizon(d){return this.projection.isPointAboveHorizon(this,d)}isPointOnSurface(d){if(d.y<0||d.y>this.height||d.x<0||d.x>this.width)return!1;if(this.elevation||this.zoom>=a.cL)return!this.isPointAboveHorizon(d);const m=this.pointCoordinate(d);return m.y>=0&&m.y<=1}_coordinatePoint(d,m){const w=m&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,M=[d.x*this.worldSize,d.y*this.worldSize,w+d.toAltitude(),1];return a.aC(M,M,this.pixelMatrix),M[3]>0?new a.P(M[0]/M[3],M[1]/M[3]):new a.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:m}=this._edgeInsets,w=this.height-this._edgeInsets.bottom,M=this.width-this._edgeInsets.right,O=this.pointLocation3D(new a.P(m,d)),D=this.pointLocation3D(new a.P(M,d)),B=this.pointLocation3D(new a.P(M,w)),V=this.pointLocation3D(new a.P(m,w));let Y=Math.min(O.lng,D.lng,B.lng,V.lng),Q=Math.max(O.lng,D.lng,B.lng,V.lng),ce=Math.min(O.lat,D.lat,B.lat,V.lat),oe=Math.max(O.lat,D.lat,B.lat,V.lat);const ue=Math.pow(2,-this.zoom)/16*270,ke=this.projection.name==="globe"?1:4,_e=(Le,Pe,qe,Ze,He)=>{const xt=(Le+qe)/2,ct=(Pe+Ze)/2,pt=new a.P(xt,ct),{lng:lt,lat:st}=this.pointLocation3D(pt),wt=Math.max(0,Y-lt,ce-st,lt-Q,st-oe);Y=Math.min(Y,lt),Q=Math.max(Q,lt),ce=Math.min(ce,st),oe=Math.max(oe,st),(Heue)&&(_e(Le,Pe,xt,ct,He+1),_e(xt,ct,qe,Ze,He+1))};if(_e(m,d,M,d,1),_e(M,d,M,w,1),_e(M,w,m,w,1),_e(m,w,m,d,1),this.projection.name==="globe"){const[Le,Pe]=a.cM(this);Le?(oe=90,Q=180,Y=-180):Pe&&(ce=-90,Q=180,Y=-180)}return new a.aI(new a.aT(Y,ce),new a.aT(Q,oe))}_getBoundsRectangular(d,m){const{top:w,left:M}=this._edgeInsets,O=this.height-this._edgeInsets.bottom,D=this.width-this._edgeInsets.right,B=new a.P(M,w),V=new a.P(D,w),Y=new a.P(D,O),Q=new a.P(M,O);let ce=this.pointCoordinate(B,d),oe=this.pointCoordinate(V,d);const ue=this.pointCoordinate(Y,m),ke=this.pointCoordinate(Q,m),_e=(Le,Pe)=>(Pe.y-Le.y)/(Pe.x-Le.x);return ce.y>1&&oe.y>=0?ce=new a.ae((1-ke.y)/_e(ke,ce)+ke.x,1):ce.y<0&&oe.y<=1&&(ce=new a.ae(-ke.y/_e(ke,ce)+ke.x,0)),oe.y>1&&ce.y>=0?oe=new a.ae((1-ue.y)/_e(ue,oe)+ue.x,1):oe.y<0&&ce.y<=1&&(oe=new a.ae(-ue.y/_e(ue,oe)+ue.x,0)),new a.aI().extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(oe)).extend(this.coordinateLocation(ke)).extend(this.coordinateLocation(ue))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const m=d.visibleDemTiles.reduce((w,M)=>{if(M.dem){const O=M.dem.tree;w.min=Math.min(w.min,O.minimums[0]),w.max=Math.max(w.max,O.maximums[0])}return w},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(m.min*d.exaggeration(),m.max*d.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(d=!0){const m=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,w=this.height/2-m*(1-this._horizonShift);return d?Math.max(0,w):w}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-a.cJ,this.maxLat=a.cJ,this.minLng=-180,this.maxLng=180,d&&(this.minLat=d.getSouth(),this.maxLat=d.getNorth(),this.minLng=d.getWest(),this.maxLng=d.getEast(),this.maxLngce&&(B=ce-Y),ce-Que&&(D=ue-V),ue-oe{for(let zt=0;zt<16;zt++)Vt[zt]=a.ak(Wt[zt],sr[zt],br)})(B,B,V,a.d0(this.pitch>=Ch?1:this.pitch/Ch))}else B=V;const Y=a.cP([],V,D);let Q=a.cP([],B,D);if(this.projection.isReprojectedInTileSpace){const st=this.locationCoordinate(this.center),wt=a.bA([]);a.br(wt,wt,[st.x*this.worldSize,st.y*this.worldSize,0]),a.aB(wt,wt,a.cQ(this)),a.br(wt,wt,[-st.x*this.worldSize,-st.y*this.worldSize,0]),a.aB(Q,Q,wt),a.aB(Y,Y,wt),this.inverseAdjustmentMatrix=a.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=a.cS([],Q,[this.worldSize,this.worldSize,this.worldSize/O,1]),this.projMatrix=Q,this.invProjMatrix=a.bl(new Float64Array(16),this.projMatrix),m){const st=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);st[8]=2*-d.x/this.width,st[9]=2*d.y/this.height,this.expandedFarZProjMatrix=a.cP([],st,D)}else this.expandedFarZProjMatrix=this.projMatrix;const ce=a.bl([],B);this.frustumCorners=a.cT.fromInvProjectionMatrix(ce,this.horizonLineFromTop(),this.height),this.cameraFrustum=a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!m);const oe=new Float32Array(16);a.bA(oe),a.cS(oe,oe,[1,-1,1]),a.cU(oe,oe,this._pitch),a.bB(oe,oe,this.angle);const ue=a.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=a.bz(ue);const ke=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;ue[8]=2*-d.x/this.width,ue[9]=2*(d.y+ke)/this.height,this.skyboxMatrix=a.aB(oe,ue,oe);const _e=this.point,Le=_e.x,Pe=_e.y,qe=this.width%2/2,Ze=this.height%2/2,He=Math.cos(this.angle),xt=Math.sin(this.angle),ct=Le-Math.round(Le)+He*qe+xt*Ze,pt=Pe-Math.round(Pe)+He*Ze+xt*qe,lt=new Float64Array(Q);if(a.br(lt,lt,[ct>.5?ct-1:ct,pt>.5?pt-1:pt,0]),this.alignedProjMatrix=lt,Q=a.bC(),a.cS(Q,Q,[this.width/2,-this.height/2,1]),a.br(Q,Q,[1,-1,0]),this.labelPlaneMatrix=Q,Q=a.bC(),a.cS(Q,Q,[1,-1,1]),a.br(Q,Q,[-1,-1,0]),a.cS(Q,Q,[2/this.width,2/this.height,1]),this.glCoordMatrix=Q,this.pixelMatrix=a.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},Q=a.bl(new Float64Array(16),this.pixelMatrix),!Q)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=Q,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.cV(this);const st=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.af(st,st,D),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=Q;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,m=this.cameraPixelsPerMeter,w=this._camera.position,M=1/this.height/this._pixelsPerMercatorPixel,O=[d,d,m];a.c5(O,O,M),a.c5(w,w,-1),a.cW(w,w,O);const D=a.bC();a.br(D,D,w),a.cS(D,D,O),this.mercatorFogMatrix=D,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,m,M)}_computeCameraPosition(d){const m=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,w=this._camera.forward(),M=this.point,O=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-d/this.worldSize*this._centerAltitude;return[M.x/this.worldSize-w[0]*O,M.y/this.worldSize-w[1]*O,d/this.worldSize*this._centerAltitude-w[2]*O]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const m=this._maxCameraBoundsDistance()*Math.cos(this._pitch),w=this._camera.position[2],M=d[2];let O=1;this.projection.wrap&&(this.center=this.center.wrap()),M>0&&(O=Math.min((m-w)/M,1)),this._camera.position=a.bH([],this._camera.position,d,O),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,m=this._camera.forward(),{pitch:w,bearing:M}=this._camera.getPitchBearing(),O=a.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,D=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.an(this._maxPitch)),B=Math.max((d[2]-O)/Math.cos(w),D),V=this._zoomFromMercatorZ(B);a.bH(d,d,m,B),this._pitch=a.aA(w,a.an(this.minPitch),a.an(this.maxPitch)),this.angle=a.bT(M,-Math.PI,Math.PI),this._setZoom(a.aA(V,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.ae(d[0],d[1],d[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(d){return Math.pow(2,d)*this.tileSize}_mercatorZfromZoom(d){return this.cameraToCenterDistance/this._worldSizeFromZoom(d)}_minimumHeightOverTerrain(){const d=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(d)}_zoomFromMercatorZ(d){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,d)*this.tileSize))}zoomFromMercatorZAdjusted(d){let m=0,w=a.cL,M=0,O=1/0;for(;w-m>1e-6&&w>m;){const D=m+.5*(w-m),B=this.tileSize*Math.pow(2,D),V=this.getCameraToCenterDistance(this.projection,D,B),Y=this.scaleZoom(V/(Math.max(0,d)*this.tileSize)),Q=Math.abs(D-Y);QY||oe.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.P(0,0),new a.P(this.width,this.height))}zoomDeltaToMovement(d,m){const w=a.ag(a.av([],this._camera.position,d)),M=this._zoomFromMercatorZ(w)+m;return w-this._mercatorZfromZoom(M)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([m,w,M],O){const D=[m,w,M,1];a.aC(D,D,O);const B=D[3]=Math.max(D[3],1e-6);return D[0]/=B,D[1]/=B,D[2]/=B,D}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,d))}}getCameraToCenterDistance(d,m=this.zoom,w=this.worldSize){const M=a.cO(d,m,this.width,this.height,1024),O=d.pixelSpaceConversion(this.center.lat,w,M);let D=.5/Math.tan(.5*this._fov)*this.height*O;return this.isOrthographic&&(D=a.ak(1,D,a.d0(this.pitch>=Ch?1:this.pitch/Ch))),D}getWorldToCameraMatrix(){const d=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&a.aB(d,d,this.globeMatrix),d}getFrustum(d){return a.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d,this.projection.zAxisUnit==="meters")}}const Lm=(_,d)=>{if(d>0&&_.terrain&&a.w("Cutoff is currently disabled on terrain"),d<=0||_.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const m=_.transform,w=Math.max(Math.abs(m._zoom-(_.minCutoffZoom-1)),1),M=m.isLODDisabled(!1)?a.ah(60,45,m.pitch):a.ah(30,15,m.pitch),O=m._farZ-m._nearZ,D=d*m.height,B=((1-(V=M))*m.cameraToCenterDistance+V*(m._farZ+D))*w;var V;return{shouldRenderCutoff:M<1,uniformValues:{u_cutoff_params:[m._nearZ,m._farZ,(B-m._nearZ)/O,(B-D-m._nearZ)/O]}}},Xu=2048;class wv{constructor(d,m){this.aabb=d,this.lastCascade=m}}class Kie{add(d,m){const w=this.receivers[d.key];w!==void 0?(w.aabb.min[0]=Math.min(w.aabb.min[0],m.min[0]),w.aabb.min[1]=Math.min(w.aabb.min[1],m.min[1]),w.aabb.min[2]=Math.min(w.aabb.min[2],m.min[2]),w.aabb.max[0]=Math.max(w.aabb.max[0],m.max[0]),w.aabb.max[1]=Math.max(w.aabb.max[1],m.max[1]),w.aabb.max[2]=Math.max(w.aabb.max[2],m.max[2])):this.receivers[d.key]=new wv(m,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,m,w){const M=a.d9.fromPoints(d.points);let O=0;for(const D in this.receivers){const B=this.receivers[D];if(!B||!M.intersectsAabb(B.aabb))continue;B.aabb.min=M.closestPoint(B.aabb.min),B.aabb.max=M.closestPoint(B.aabb.max);const V=B.aabb.getCorners();for(let Y=0;Y1||oe[1]<-1||oe[1]>1){Q=!1;break}}if(B.lastCascade=Y,O=Math.max(O,Y),Q)break}}return O+1}}class Sy{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Kie,this._depthMode=new un(d.context.gl.LEQUAL,un.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const d of this._cascades)d.texture.destroy(),d.framebuffer.destroy();this._cascades=[]}updateShadowParameters(d,m){const w=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!m||!m.properties)return;const M=m.properties.get("shadow-intensity");if(!m.shadowsEnabled()||M<=0||(this._shadowLayerCount=w.style.order.reduce((ke,_e)=>{const Le=w.style._mergedLayers[_e];return ke+(Le.hasShadowPass()&&!Le.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=w.context,D=Xu,B=Xu;if(this._cascades.length===0||Xu!==this._cascades[0].texture.size[0]){this._cascades=[];for(let ke=0;ke<2;++ke){const _e=w._shadowMapDebug,Le=O.gl,Pe=O.createFramebuffer(D,B,_e?1:0,"texture"),qe=new a.T(O,{width:D,height:B,data:null},Le.DEPTH_COMPONENT16);if(Pe.depthAttachment.set(qe.texture),_e){const Ze=new a.T(O,{width:D,height:B,data:null},Le.RGBA8);Pe.colorAttachment0.set(Ze.texture)}this._cascades.push({framebuffer:Pe,texture:qe,matrix:[],far:0,boundingSphereRadius:0,frustum:new a.cB,scale:0})}}this.shadowDirection=kv(m);let V=0;if(d.elevation){const ke=d.elevation,_e=[1e4,-1e4];ke.visibleDemTiles.filter(Le=>Le.dem).forEach(Le=>{const Pe=Le.dem.tree;_e[0]=Math.min(_e[0],Pe.minimums[0]),_e[1]=Math.max(_e[1],Pe.maximums[0])}),_e[0]!==1e4&&(V=(_e[1]-_e[0])*ke.exaggeration())}const Y=1.5*d.cameraToCenterDistance,Q=3*Y,ce=new Float64Array(16);for(let ke=0;ke=0)return{};const O=function(V,Y,Q){const ce=Q/(1<0&&(a.d8(O[1],O[1],[M[0]*D,0,0]),a.d8(O[2],O[2],[M[0]*D,0,0])),M[1]<0?(a.d8(O[0],O[0],[0,M[1]*D,0]),a.d8(O[1],O[1],[0,M[1]*D,0])):M[1]>0&&(a.d8(O[2],O[2],[0,M[1]*D,0]),a.d8(O[3],O[3],[0,M[1]*D,0]));const B={};return B.vertices=O,B.planes=[jv(O[1],O[0],O[4]),jv(O[2],O[1],O[5]),jv(O[3],O[2],O[6]),jv(O[0],O[3],O[7])],B}addShadowReceiver(d,m,w){this._receivers.add(d,a.d9.fromTileIdAndHeight(d,m,w))}getMaxCascadeForTile(d){const m=this._receivers.get(d);return m&&m.lastCascade?m.lastCascade:0}}function jv(_,d,m){const w=a.av([],m,d),M=a.av([],_,d),O=a.bI([],w,M),D=a.ag(O);return D===0?[0,0,1,0]:(a.c5(O,O,1/D),[O[0],O[1],O[2],-a.bJ(O,d)])}function kv(_){const d=_.properties.get("direction"),m=a.d4(d.x,d.y,d.z);m[2]=a.aA(m[2],0,75);const w=a.d6([m[0],m[1],m[2]]);return a.d5(w.x,w.y,w.z)}function yp(_,d,m){const w=d.properties.get("color-use-theme")==="none",M=d.properties.get("color"),O=d.properties.get("intensity"),D=d.properties.get("direction"),B=[D.x,D.y,D.z],V=m.properties.get("color-use-theme")==="none",Y=m.properties.get("color"),Q=m.properties.get("intensity"),ce=Math.max(a.bJ([0,0,1],B),0),oe=[0,0,0];a.c5(oe,Y.toPremultipliedRenderColor(V?null:_.getLut(d.scope)).toArray01Linear().slice(0,3),Q);const ue=[0,0,0];return a.c5(ue,M.toPremultipliedRenderColor(w?null:_.getLut(m.scope)).toArray01Linear().slice(0,3),ce*O),a.db([oe[0]>0?oe[0]/(oe[0]+ue[0]):0,oe[1]>0?oe[1]/(oe[1]+ue[1]):0,oe[2]>0?oe[2]/(oe[2]+ue[2]):0])}function Om(_,d,m,w,M,O){const D=_.zoom,B=_.scale,V=_.worldSize,Y=1/V,Q=_.aspect,ce=Math.sqrt(1+Q*Q)*Math.tan(.5*_.fovX),oe=ce*ce,ue=w-m,ke=w+m;let _e,Le;oe>ue/ke?(_e=w,Le=w*ce):(_e=.5*ke*(1+oe),Le=.5*Math.sqrt(ue*ue+2*(w*w+m*m)*oe+ke*ke*oe*oe));const Pe=_.projection.pixelsPerMeter(_.center.lat,V),qe=_._camera.getCameraToWorldMercator(),Ze=[0,0,-_e*Y];a.af(Ze,Ze,qe);let He=Le*Y;const xt=_._edgeInsets;if(!(xt.left===0&&xt.top===0&&xt.right===0&&xt.bottom===0||xt.left===xt.right&&xt.top===xt.bottom)){const ur=_._camera.getWorldToCamera(_.worldSize,_.projection.zAxisUnit==="meters"?Pe:1),Er=_._camera.getCameraToClipPerspective(_._fov,_.width/_.height,m,w);Er[8]=2*-_.centerOffset.x/_.width,Er[9]=2*_.centerOffset.y/_.height;const Gr=new Float64Array(16);a.cP(Gr,Er,ur);const Sr=new Float64Array(16);a.bl(Sr,Gr);const wr=a.cB.fromInvProjectionMatrix(Sr,V,D,!0);for(const on of wr.points){const en=((ct=on)[0]/=B,ct[1]/=B,ct[2]=a.cf(ct[2],_._center.lat),ct);He=Math.max(He,a.c6(a.da([],Ze,en)))}}var ct;He*=M/(M-1);const pt=Math.acos(d[2]),lt=Math.atan2(-d[0],-d[1]),st=new wk;st.position=Ze,st.setPitchBearing(pt,lt);const wt=st.getWorldToCamera(V,Pe),Ot=He*V,Pt=Math.min(_._mercatorZfromZoom(17)*V*-2,-2*Ot),Vt=st.getCameraToClipOrthographic(-Ot,Ot,-Ot,Ot,Pt,(Ot+O*Pe)/d[2]),Wt=new Float64Array(16);a.aB(Wt,Vt,wt);const sr=a.d5(Math.floor(1e6*Ze[0])/1e6*V,Math.floor(1e6*Ze[1])/1e6*V,0),br=.5*M,zt=[0,0,0];a.af(zt,sr,Wt),a.c5(zt,zt,br);const Mt=[Math.floor(zt[0]),Math.floor(zt[1]),Math.floor(zt[2])],Xt=[0,0,0];a.av(Xt,zt,Mt),a.c5(Xt,Xt,-1/br);const qt=new Float64Array(16);return a.bA(qt),a.br(qt,qt,Xt),a.aB(Wt,qt,Wt),[Wt,Ot]}class Zie extends a.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,m){return a.dc(this.requestManager.transformRequest(m,a.R.Model).url).then(w=>{if(!w)return;const M=a.dd(w),O=new a.de(d,m,void 0,void 0,M);return O.computeBoundsAndApplyParent(),O}).catch(w=>{if(w&&w.status===404)return null;this.fire(new a.y(new Error(`Could not load model ${d} from ${m}: ${w.message}`)))})}load(d,m,w={forceReload:!1}){this.models[m]||(this.models[m]={});const M=Object.keys(d),O=[],D=[];for(const B of M){const V=d[B];this.hasURLBeenRequested(V)&&!w.forceReload||(this.modelByURL[V]={modelId:B,scope:m},O.push(this.loadModel(B,V)),D.push(B)),this.models[m][B]||(this.models[m][B]={model:null,numReferences:1})}this.numModelsLoading[m]=(this.numModelsLoading[m]||0)+D.length,Promise.allSettled(O).then(B=>{for(let V=0;V{this.fire(new a.y(new Error(`Could not load models: ${B.message}`)))})}isLoaded(){for(const d in this.numModelsLoading)if(this.numModelsLoading[d]>0)return!1;return!0}hasModel(d,m,w={exactIdMatch:!1}){return!!(w.exactIdMatch?this.getModel(d,m):this.getModelByURL(this.modelUris[m][d]))}getModel(d,m){return this.models[m]||(this.models[m]={}),this.models[m][d]?this.models[m][d].model:void 0}getModelByURL(d){if(!d)return null;const m=this.modelByURL[d];return m?this.models[m.scope][m.modelId].model:null}hasModelBeenAdded(d,m){return this.models[m]&&this.models[m][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,m,w){this.models[w]||(this.models[w]={}),this.modelUris[w]||(this.modelUris[w]={});const M=this.requestManager.normalizeModelURL(m);if((this.hasModel(d,w,{exactIdMatch:!0})||this.hasModelBeenAdded(d,w))&&this.modelUris[w][d]===M)this.models[w][d].numReferences++;else if(this.hasURLBeenRequested(M)){const{scope:O,modelId:D}=this.modelByURL[M];this.models[O][D].numReferences++}else this.modelUris[w][d]=M,this.load({[d]:this.modelUris[w][d]},w)}addModelURLs(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const w=this.modelUris[m];for(const M in d)w[M]=this.requestManager.normalizeModelURL(d[M])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const w={};for(const M of d)this.hasModel(M,m,{exactIdMatch:!0})||this.hasURLBeenRequested(M)?this.models[m][M].numReferences++:this.modelUris[m][M]&&!this.hasURLBeenRequested(M)?w[M]=this.modelUris[m][M]:!this.hasURLBeenRequested(M)&&a.df(M,!1)&&(this.modelUris[m][M]=this.requestManager.normalizeModelURL(M),w[M]=this.modelUris[m][M]);this.load(w,m)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,m,w=!1,M=!1){if(this.models[m]&&this.models[m][d]&&(this.models[m][d].numReferences--,this.models[m][d].numReferences===0||M)){const O=this.modelUris[m][d];w||delete this.modelUris[m][d],delete this.modelByURL[O];const D=this.models[m][d].model;if(!D)return;delete this.models[m][d],D.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const m of Object.keys(this.models[d])){const w=this.models[d][m].model;delete this.models[d][m],w&&w.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(d){return this.models[d]||(this.models[d]={}),Object.keys(this.models[d])}upload(d,m){this.models[m]||(this.models[m]={});for(const w in this.models[m])this.models[m][w].model&&this.models[m][w].model.upload(d.context)}}const z3=a.a6.colorTheme,Yie=new a.a9({data:new a.aa(z3.data)});function YI(_){if(!_.metadata||!_.metadata.content_area)return;const d=a.o.devicePixelRatio,{left:m,top:w,width:M,height:O}=_.metadata.content_area,D=m*d,B=w*d;return[D,B,D+M*d,B+O*d]}function XI(_){if(_)return _.map(([d,m])=>[d*a.o.devicePixelRatio,m*a.o.devicePixelRatio])}class B3{constructor(d,m,w){this.id=d,this.scope=m,this.sourceCache=w,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(d){this.missingRequests.has(d.name)||this.pendingRequests.has(d.name)||this.pendingRequests.add(d.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const d=new Map;if(!this.sourceCache.loaded())return d;const m=this.sourceCache.getVisibleCoordinates();if(m.length===0)return d;const w=this.sourceCache.getSource();if(!(w instanceof sl))return d;const M=m.map(D=>this.sourceCache.getTile(D)),O=w.getImages(M,Array.from(this.pendingRequests));for(const[D,B]of O)d.set(a.I.from({name:D,iconsetId:this.id}),B),this.pendingRequests.delete(D);for(const D of this.pendingRequests)this.missingRequests.add(D);return this.pendingRequests.clear(),d}}const Dm=(_,d)=>Ke(_,d&&d.filter(m=>m.identifier!=="source.canvas")),QI=a.aH(dr,["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"]),JI=a.aH(dr,["setCenter","setZoom","setBearing","setPitch"]),kk=new Set(["background","sky","slot","custom"]),Rm={version:8,layers:[],sources:{}},Nv={duration:300,delay:0};class Qu extends a.E{constructor(d,m={}){super(),this.map=d,this.scope=m.scope||"",this.globalId=null,this.fragments=[],this.importDepth=m.importDepth||0,this.importsCache=m.importsCache||new Map,this.resolvedImports=m.resolvedImports||new Set,this.transition=Object.assign({},Nv),this._buildingIndex=new A3(this),this.crossTileSymbolIndex=new Sh,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=m.styleChanges||new Ae,this._hasDataDrivenEmissive=!1,this.dispatcher=m.dispatcher?m.dispatcher:new a.D(a.dh(),this),m.imageManager?this.imageManager=m.imageManager:(this.imageManager=new $e(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=m.glyphManager?m.glyphManager:new a.di(d._requestManager,m.localFontFamily?a.dj.all:m.localIdeographFontFamily?a.dj.ideographs:a.dj.none,m.localFontFamily||m.localIdeographFontFamily),m.modelManager?this.modelManager=m.modelManager:(this.modelManager=new Zie(d._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=m.configOptions?m.configOptions:new Map,this._configDependentLayers=m.configDependentLayers?m.configDependentLayers:new Set,this._indoorDependentLayers=m.indoorDependentLayers?m.indoorDependentLayers:new Set,this._config=m.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:m.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=m.initialConfig,this.dispatcher.broadcast("setReferrer",a.dk());const w=this;this._rtlTextPluginCallback=Qu.registerForPluginStateChange(M=>{w.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:M.pluginStatus,pluginURL:M.pluginURL},(O,D)=>{if(a.dl(O),D&&D.every(B=>B))for(const B in w._sourceCaches){const V=w._sourceCaches[B],Y=V.getSource().type;Y!=="vector"&&Y!=="geojson"||V.reload()}})}),this.on("data",M=>{if(M.dataType!=="source"||M.sourceDataType!=="metadata")return;const O=this.getOwnSource(M.sourceId);if(O&&O.vectorLayerIds)for(const D in this._layers){const B=this._layers[D];B.source===O.id&&this._validateLayer(B)}})}load(d){return d?(typeof d=="string"?this.loadURL(d):this.loadJSON(d),this):this}_getGlobalId(d){if(!d)return null;if(typeof d=="string"){if(a.h(d))return d;const m=a.dm(d);if(!m.startsWith("http"))try{return new URL(m,location.href).toString()}catch{return m}return m}return`json://${a.dn(JSON.stringify(d))}`}_diffStyle(d,m,w){this.globalId=this._getGlobalId(d);const M=(O,D)=>{try{D(null,this.setState(O,w))}catch(B){D(B,!1)}};if(typeof d=="string"){const O=this.map._requestManager.normalizeStyleURL(d),D=this.map._requestManager.transformRequest(O,a.R.Style);a.m(D,(B,V)=>{B?this.fire(new a.y(B)):V&&M(V,m)})}else typeof d=="object"&&M(d,m)}loadURL(d,m={}){this.fire(new a.z("dataloading",{dataType:"style"}));const w=typeof m.validate=="boolean"?m.validate:!a.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,m.accessToken),this.resolvedImports.add(d);const M=this.importsCache.get(d);if(M)return this._load(M,w);const O=this.map._requestManager.transformRequest(d,a.R.Style);this._request=a.m(O,(D,B)=>{if(this._request=null,D)this.fire(new a.y(D));else if(B)return this.importsCache.set(d,B),this._load(B,w)})}loadJSON(d,m={}){this.fire(new a.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=a.o.frame(()=>{this._request=null,this._load(d,m.validate!==!1)})}loadEmpty(){this.fire(new a.z("dataloading",{dataType:"style"})),this._load(Rm,!1)}_loadImports(d,m,w){if(this.importDepth>=4)return a.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const M=[];for(const O of d){const D=this._createFragmentStyle(O),B=new Promise(Q=>{D.once("style.import.load",Q),D.once("error",Q)}).then(()=>this.mergeAll());if(M.push(B),this.resolvedImports.has(O.url)){D.loadEmpty();continue}const V=O.data||this.importsCache.get(O.url);V?(D.loadJSON(V,{validate:m}),this._isInternalStyle(V)&&(D.globalId=null)):O.url?D.loadURL(O.url,{validate:m}):D.loadEmpty();const Y={style:D,id:O.id,config:O.config};if(w){const Q=this.fragments.findIndex(({id:ce})=>ce===w);this.fragments=this.fragments.slice(0,Q).concat(Y).concat(this.fragments.slice(Q))}else this.fragments.push(Y)}return Promise.allSettled(M)}getImportGlobalIds(d=this,m=new Set){for(const w of d.fragments)w.style.globalId&&m.add(w.style.globalId),this.getImportGlobalIds(w.style,m);return[...m.values()]}_createFragmentStyle(d){const m=this.scope?a.B(d.id,this.scope):d.id;let w;const M=this._initialConfig&&this._initialConfig[m];(d.config||M)&&(w=Object.assign({},d.config,M));const O=new Qu(this.map,{scope:m,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:w,configOptions:this.options,colorThemeOverride:d["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return O.setEventedParent(this.map,{style:O}),O}_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(d){return this.isRootStyle()&&(d.fragment||!!d.schema&&d.fragment!==!1)}_load(d,m){if(this._isInternalStyle(d)){const O=Object.assign({},Rm,{imports:[{id:"basemap",data:d,url:""}]},d.center?{center:d.center}:{},d.bearing?{bearing:d.bearing}:{},d.pitch?{pitch:d.pitch}:{},d.zoom?{zoom:d.zoom}:{},d.light?{light:d.light}:{});return this._importedAsBasemap=!0,void this._load(O,m)}if(this.updateConfig(this._config,d.schema),m&&Dm(this,Ii(d)))return;this._loaded=!0,this.stylesheet=a.dp(d);const w=()=>{for(const V in d.sources)this.addSource(V,d.sources[V],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const V in d.iconsets)this.addIconset(V,d.iconsets[V]);d.sprite?this._loadIconset(d.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&d.glyphs&&this.glyphManager.setURL(d.glyphs);const O=Cr(this.stylesheet.layers);if(this._order=O.map(V=>V.id),this.stylesheet.light&&a.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const V=this.stylesheet.lights[0];this.light=new At(V.properties,V.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new At(this.stylesheet.light)),this._layers={};for(const V of O){const Y=a.du(V,this.scope,this._styleColorTheme.lut,this.options);Y.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(Y.fqid),Y.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(Y.fqid),this._hasAppearances=this._hasAppearances||Y.getAppearances().length!==0,Y.setEventedParent(this,{layer:{id:Y.id}}),this._layers[Y.id]=Y;const Q=this.getOwnLayerSourceCache(Y),ce=!!this.directionalLight&&this.directionalLight.shadowsEnabled();Q&&Y.canCastShadows()&&ce&&(Q.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const D=this.stylesheet.terrain;D&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(D,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new a.z("data",{dataType:"style"}));const B=this.isRootStyle();d.imports?this._loadImports(d.imports,m).then(()=>{this._reloadImports(),this.fire(new a.z(B?"style.load":"style.import.load"))}).catch(V=>{this.fire(new a.y(new Error("Failed to load imports",V))),this.fire(new a.z(B?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new a.z(B?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const M=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(M){const O=this._evaluateColorThemeData(M);this._loadColorTheme(O).then(()=>{w()}).catch(D=>{a.w(`Couldn't load color theme from the stylesheet: ${D}`),w()})}else this._styleColorTheme.lut=null,w()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,m,w,M,O,D,B,V,Y,Q;const ce={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(oe=>{if(oe.stylesheet){if(oe.light!=null&&(d=oe.light),oe.stylesheet.lights)for(const ue of oe.stylesheet.lights)ue.type==="ambient"&&oe.ambientLight!=null&&(m=oe.ambientLight),ue.type==="directional"&&oe.directionalLight!=null&&(w=oe.directionalLight);M=this._prioritizeTerrain(M,oe.terrain,oe.stylesheet.terrain),oe.stylesheet.fog&&oe.fog!=null&&(O=oe.fog),oe.stylesheet.snow&&oe.snow!=null&&(D=oe.snow),oe.stylesheet.rain&&oe.rain!=null&&(B=oe.rain),oe.stylesheet.camera!=null&&(Q=oe.stylesheet.camera),oe.stylesheet.projection!=null&&(V=oe.stylesheet.projection),oe.stylesheet.transition!=null&&(Y=oe.stylesheet.transition),ce[oe.scope]=oe._styleColorTheme}}),this.light=d,this.ambientLight=m,this.directionalLight=w,this.fog=O,this.snow=D,this.rain=B,this._styleColorThemeForScope=ce,M===null?delete this.terrain:this.terrain=M,this.camera=Q||{"camera-projection":"perspective"},this.projection=V||{name:"mercator"},this.transition=Object.assign({},Nv,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const m=w=>{for(const M of w.fragments)m(M.style);d(w)};m(this)}_prioritizeTerrain(d,m,w){const M=d&&d.drapeRenderMode===0;return w===null?m&&m.drapeRenderMode===0?m:M?d:null:m!=null&&(!d||M||m&&m.drapeRenderMode===1)?m:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(m=>{d=this._prioritizeTerrain(d,m.terrain,m.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(m=>{m.stylesheet.projection!=null&&(d=m.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},m={},w={};this.forEachFragmentStyle(M=>{for(const O in M._sourceCaches){const D=a.B(O,M.scope);d[D]=M._sourceCaches[O]}for(const O in M._otherSourceCaches){const D=a.B(O,M.scope);m[D]=M._otherSourceCaches[O]}for(const O in M._symbolSourceCaches){const D=a.B(O,M.scope);w[D]=M._symbolSourceCaches[O]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=m,this._mergedSymbolSourceCaches=w}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const m of Object.values(d.stylesheet.indoor)){const w=m,M=a.B(w.sourceId,d.scope);this._mergedIndoor[M]=new Set(w.sourceLayers||[])}})}mergeLayers(){const d={},m=[],w={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(D=>{for(const B of D._order){const V=D._layers[B];if(V.type==="slot"){const Y=a.dq(B);if(d[Y])continue;d[Y]=[]}V.slot&&d[V.slot]?d[V.slot].push(V):m.push(V)}}),this._mergedOrder=[];let M=-1;const O=(D=[])=>{for(const B of D)if(B.type==="slot"){const V=a.dq(B.id);d[V]&&O(d[V]),this._mergedSlots.push(V)}else{const V=a.B(B.id,B.scope);this._mergedOrder.push(V),w[V]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,M=this._mergedOrder.length-1),B.type==="circle"&&(this._hasCircleLayers=!0),B.type==="symbol"&&(this._hasSymbolLayers=!0),B.type==="clip"&&(this._clipLayerPresent=!0)}};if(O(m),this._has3DLayers){const D={};for(let B=0;BD[B]-D[V])}this._mergedLayers=w,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(d){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,d),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(d){return d.data?function(m,w,M,O){const D=Object.assign({},w);for(const V of Object.keys(z3))D[V]===void 0&&(D[V]=z3[V].default);const B=new a.a8(Yie,m,new Map(M));return B.setTransitionOrValue(D,M),B.untransitioned().possiblyEvaluate(new a.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const m=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((w,M)=>{const O="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void w();let D=d;D.startsWith(O)||(D=O+D);const B=a.I.from("mapbox-reserved-lut"),V=new Image;V.src=D,V.onerror=()=>{this._styleColorTheme.lutLoading=!1,M(new Error("Failed to load image data"))},V.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==m)return void w();this._styleColorTheme.lutLoading=!1;const{width:Y,height:Q,data:ce}=a.o.getImageData(V);if(Q>32)return void M(new Error("The height of the image must be less than or equal to 32 pixels."));if(Y!==Q*Q)return void M(new Error("The width of the image must be equal to the height squared."));this.getImage(B)&&this.removeImage(B),this.addImage(B,{data:new a.q({width:Y,height:Q},ce),pixelRatio:1,sdf:!1,usvg:!1,version:0});const oe=this.imageManager.getImage(B,this.scope);oe?(this._styleColorTheme.lut={image:oe.data,data:d},w()):M(new Error("Missing LUT image."))}})}getLut(d){const m=this._styleColorThemeForScope[d];return m?m.lut:null}setProjection(d){d?this.stylesheet.projection=d: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(d){this._spriteRequest=function(m,w,M){let O,D,B;const V=a.o.devicePixelRatio>1?"@2x":"";let Y=a.m(w.transformRequest(w.normalizeSpriteURL(m,V,".json"),a.R.SpriteJSON),(oe,ue)=>{Y=null,B||(B=oe,O=ue,ce())}),Q=a.n(w.transformRequest(w.normalizeSpriteURL(m,V,".png"),a.R.SpriteImage),(oe,ue)=>{Q=null,B||(B=oe,D=ue,ce())});function ce(){if(B)M(B);else if(O&&D){const oe=a.o.getImageData(D),ue={};for(const ke in O){const{width:_e,height:Le,x:Pe,y:qe,sdf:Ze,pixelRatio:He,stretchX:xt,stretchY:ct,content:pt}=O[ke],lt=new a.q({width:_e,height:Le});a.q.copy(oe,lt,{x:Pe,y:qe},{x:0,y:0},{width:_e,height:Le},null),ue[ke]={data:lt,pixelRatio:He!==void 0?He:1,sdf:Ze!==void 0&&Ze,stretchX:xt,stretchY:ct,content:pt,usvg:!1,version:0}}M(null,ue)}}return{cancel(){Y&&(Y.cancel(),Y=null),Q&&(Q.cancel(),Q=null)}}}(d,this.map._requestManager,(m,w)=>{if(this._spriteRequest=null,m)this.fire(new a.y(m));else if(w){const M=new Map;for(const O in w)M.set(a.I.from(O),w[O]);this.addImages(M)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))})}addIconset(d,m){if(m.type==="sprite")return void this._loadSprite(m.url);const w=this.getOwnSourceCache(m.source);if(!w)return void this.fire(new a.y(new Error(`Source "${m.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const M=w.getSource();if(M.type!=="raster-array")return void this.fire(new a.y(new Error(`Source "${m.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));M.partial=!1;const O=new B3(d,this.scope,w);this.imageManager.addImageProvider(O,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!a.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const m=this.map._spriteFormat==="auto";var w,M;this._spriteRequest=(M=(O,D)=>{if(this._spriteRequest=null,O)m?this._loadSprite(d):this.fire(new a.y(O));else if(D){const B=new Map;for(const V in D)B.set(a.I.from(V),D[V]);this.addImages(B)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.z("data",{dataType:"style"}))},a.bu((w=this.map._requestManager).transformRequest(w.normalizeIconsetURL(d),a.R.Iconset),(O,D)=>{if(O)return void M(O);const B={},V=a.dg(new a.bt(D));for(const Y of V.icons){const Q={version:1,pixelRatio:a.o.devicePixelRatio,content:YI(Y),stretchX:Y.metadata?XI(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?XI(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};B[Y.name]=Q}M(null,B)}))}_validateLayer(d){const m=this.getOwnSource(d.source);if(!m)return;const w=d.sourceLayer;w&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(w)===-1)&&this.fire(new a.y(new Error(`Source layer "${w}" does not exist on source "${m.id}" as specified by style layer "${d.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const d in this._sourceCaches)if(!this._sourceCaches[d].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:d}of this.fragments)if(!d.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((d,m)=>{const w=this.fragments[m];return w&&w.style&&(d.data=w.style.serialize()),d})}_serializeSources(){const d={};for(const m in this._sourceCaches){const w=this._sourceCaches[m].getSource();d[w.id]||(d[w.id]=w.serialize())}return d}_serializeLayers(d){const m=[];for(const w of d){const M=this._layers[w];M&&M.type!=="custom"&&m.push(M.serialize())}return m}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 d in this._sourceCaches)if(this._sourceCaches[d].hasTransition())return!0;for(const d in this._layers)if(this._layers[d].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];if(m._transitionablePaint&&m._transitionablePaint._values){const w=m._transitionablePaint._values["line-emissive-strength"];if(w&&w.value&&w.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(d){return d?this.order:this._mergedOrder}isLayerDraped(d){return!!this.terrain&&d.isDraped(this.getLayerSourceCache(d))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(d){const m=this.getOwnLayer(d);if(m)return m;this.fire(new a.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const m=this.getOwnSource(d);if(m)return m;this.fire(new a.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,m){const w=this.map.painter;if(w)for(let M=d.minzoom||0;M<(d.maxzoom||25.5);M++){const O=d.getProgramIds();if(O)for(const D of O){const B=d.getDefaultProgramParams(D,m.zoom,this._styleColorTheme.lut);B&&(w.style=this,this.fog&&(w._fogVisible=!0,B.overrideFog=!0,w.getOrCreateProgram(D,B)),w._fogVisible=!1,B.overrideFog=!1,w.getOrCreateProgram(D,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,w.getOrCreateProgram(D,B)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const m=this.calculateLightsBrightness();d.brightness=m||0,m!==this._brightness&&(this._brightness=m,this.dispatcher.broadcast("setBrightness",m)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const w=this._changes.isDirty();let M=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const V in B){const{updatedIds:Y,removedIds:Q}=B[V];(Y||Q)&&(this._updateWorkerLayers(V,Y,Q),M=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(d),this.light&&this.light.updateTransitions(d),this.ambientLight&&this.ambientLight.updateTransitions(d),this.directionalLight&&this.directionalLight.updateTransitions(d),this.fog&&this.fog.updateTransitions(d),this.snow&&this.snow.updateTransitions(d),this.rain&&this.rain.updateTransitions(d),this._changes.reset()}const O={};for(const B in this._mergedSourceCaches){const V=this._mergedSourceCaches[B];O[B]=V.used,V.used=!1,V.tileCoverLift=0}for(const B of this._mergedOrder){const V=this._mergedLayers[B];if(V.visibility!=="none"&&V.recalculate(d,this._availableImages),!V.isHidden(d.zoom)){const Y=this.getLayerSourceCache(V);Y&&(Y.used=!0,Y.tileCoverLift=Math.max(Y.tileCoverLift,V.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(V,d)}):this.precompilePrograms(V,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&M&&this.mergeLayers();const D=this.imageManager.getPendingImageProviders();for(const B of D)B.sourceCache.used=!0;for(const B in O){const V=this._mergedSourceCaches[B];O[B]!==V.used&&V.getSource().fire(new a.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:V.getSource().id}))}this.light&&this.light.recalculate(d),this.terrain&&this.terrain.recalculate(d),this.fog&&this.fog.recalculate(d),this.snow&&this.snow.recalculate(d),this.rain&&this.rain.recalculate(d),this.z=d.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),w&&this.fire(new a.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const m of d){const w=m.resolvePendingRequests(),M=this.getFragmentStyle(m.scope);M&&M.addImages(w)}}_updateTilesForChangedImages(){const d={};for(const m in this._mergedSourceCaches){const w=this._mergedSourceCaches[m].getSource().scope;d[w]=d[w]||this._changes.getUpdatedImages(w),d[w].length!==0&&this._mergedSourceCaches[m].reloadTilesForDependencies(["icons","patterns"],d[w])}for(const m in d)this._changes.resetUpdatedImages(m)}_updateWorkerLayers(d,m,w){const M=this.getFragmentStyle(d);M&&this.dispatcher.broadcast("updateLayers",{layers:m?M._serializeLayers(m):[],scope:d,removedIds:w||[],options:M.options})}setState(d,m){if(this._checkLoaded(),Dm(this,Ii(d)))return!1;(d=a.dp(d)).layers=Cr(d.layers);const w=function(D,B){if(!D)return[{command:dr.setStyle,args:[B]}];let V=[];try{if(!a.by(D.version,B.version))return[{command:dr.setStyle,args:[B]}];if(a.by(D.center,B.center)||V.push({command:dr.setCenter,args:[B.center]}),a.by(D.zoom,B.zoom)||V.push({command:dr.setZoom,args:[B.zoom]}),a.by(D.bearing,B.bearing)||V.push({command:dr.setBearing,args:[B.bearing]}),a.by(D.pitch,B.pitch)||V.push({command:dr.setPitch,args:[B.pitch]}),a.by(D.sprite,B.sprite)||V.push({command:dr.setSprite,args:[B.sprite]}),a.by(D.glyphs,B.glyphs)||V.push({command:dr.setGlyphs,args:[B.glyphs]}),a.by(D.imports,B.imports)||function(ue=[],ke=[],_e){ke=ke||[];const Le=(ue=ue||[]).map(Wg),Pe=ke.map(Wg),qe=ue.reduce(mv,{}),Ze=ke.reduce(mv,{}),He=Le.slice();let xt,ct,pt,lt;for(xt=0,ct=0;xt{ue.source&&Y[ue.source]?V.push({command:dr.removeLayer,args:[ue.id]}):ce.push(ue)});let oe=D.terrain;oe&&Y[oe.source]&&(V.push({command:dr.setTerrain,args:[void 0]}),oe=void 0),V=V.concat(Q),a.by(oe,B.terrain)||V.push({command:dr.setTerrain,args:[B.terrain]}),function(ue,ke,_e){ke=ke||[];const Le=(ue=ue||[]).map(Wg),Pe=ke.map(Wg),qe=ue.reduce(mv,{}),Ze=ke.reduce(mv,{}),He=Le.slice(),xt=Object.create(null);let ct,pt,lt,st,wt,Ot,Pt;for(ct=0,pt=0;ct!(D.command in JI));if(w.length===0)return!1;const M=w.filter(D=>!(D.command in QI));if(M.length>0)throw new Error(`Unimplemented: ${M.map(D=>D.command).join(", ")}.`);const O=[];return w.forEach(D=>{O.push(this[D.command](...D.args))}),m&&Promise.all(O).then(m).catch(m),this.stylesheet=d,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(d){if(d.size===0)return this;for(const[m,w]of d.entries()){if(this.getImage(m))return this.fire(new a.y(new Error(`An image with the name "${m.name}" already exists.`)));this.imageManager.addImage(m,this.scope,w),this._changes.updateImage(m,this.scope)}return this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this}addImage(d,m){return this.getImage(d)?this.fire(new a.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,m),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this)}updateImage(d,m,w=!1){this.imageManager.updateImage(d,this.scope,m),w&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})))}getImage(d){return this.imageManager.getImage(d,this.scope)}removeImage(d){return this.getImage(d)?(this.imageManager.removeImage(d,this.scope),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(d){return this.modelManager.addModelURLs(d,this.getActualScope()),this._updateWorkerModels(),this.fire(new a.z("data",{dataType:"style"})),this}addModel(d,m,w={}){return this._checkLoaded(),this._validate(je,`models.${d}`,m,null,w)||(this.modelManager.addModel(d,m,this.getActualScope()),this.fire(new a.z("data",{dataType:"style"}))),this}hasModel(d){return this.modelManager.hasModel(d,this.getActualScope())}removeModel(d){return this.hasModel(d)?(this.modelManager.removeModel(d,this.getActualScope(),!1,!0),this.fire(new a.z("data",{dataType:"style"})),this):this.fire(new a.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,m,w={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!m.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(Oo,`sources.${d}`,m,null,w))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const M=Bo(d,m,this.dispatcher,this);M.scope=this.scope,M.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(M.id),source:M.serialize(),sourceId:M.id}));const O=D=>{const B=(D?"symbol:":"other:")+M.id,V=a.B(B,this.scope),Y=this._sourceCaches[B]=new Yc(V,M,D);(D?this._symbolSourceCaches:this._otherSourceCaches)[M.id]=Y,Y.onAdd(this.map)};O(!1),m.type!=="vector"&&m.type!=="geojson"||O(!0),M.onAdd&&M.onAdd(this.map),w.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const m=this.getOwnSource(d);if(!m)throw new Error("There is no source with this ID");for(const M in this._layers)if(this._layers[M].source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while layer "${M}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===d)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const M=Object.entries(this.stylesheet.iconsets).find(([O,D])=>D.type==="source"&&D.source===d);if(M)return this.fire(new a.y(new Error(`Source "${d}" cannot be removed while iconset "${M[0]}" is using it.`)))}const w=this.getOwnSourceCaches(d);for(const M of w){const O=a.dq(M.id);delete this._sourceCaches[O],this._changes.discardSourceCacheUpdate(M.id),M.fire(new a.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:M.getSource().id})),M.setEventedParent(null),M.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),m.setEventedParent(null),m.onRemove&&m.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,m){this._checkLoaded(),this.getOwnSource(d).setData(m),this._changes.setDirty()}getOwnSource(d){const m=this.getOwnSourceCache(d);return m&&m.getSource()}getOwnSources(){const d=[];for(const m in this._otherSourceCaches){const w=this.getOwnSourceCache(m);w&&d.push(w.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const m in d){const w=d[m]._tiles;for(const M in w){const O=w[M];if(O.state!=="loaded"&&O.state!=="errored")return!1}}return!0}setLights(d){if(this._checkLoaded(),!d)return delete this.ambientLight,void delete this.directionalLight;const m=this._getTransitionParameters();for(const O of d){if(this._validate(xo,"lights",O))return;switch(O.type){case"ambient":if(this.ambientLight){const D=this.ambientLight;D.set(O),D.updateTransitions(m)}else this.ambientLight=new Ks(O,Za||(Za=new a.a9({color:new a.aa(a.a6.properties_light_ambient.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const D=this.directionalLight;D.set(O),D.updateTransitions(m)}else this.directionalLight=new Ks(O,Oa||(Oa=new a.a9({direction:new a.ap(a.a6.properties_light_directional.direction),color:new a.aa(a.a6.properties_light_directional.color),"color-use-theme":new a.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.aa(a.a6.properties_light_directional.intensity),"cast-shadows":new a.aa(a.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new a.aa(a.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new a.aa(a.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const w=Object.assign(m,{worldview:this.map.getWorldview()}),M=new a.ac(this.z||0,w);this.ambientLight&&this.ambientLight.recalculate(M),this.directionalLight&&this.directionalLight.recalculate(M),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,m=this.ambientLight;if(!d||!m)return;const w=oe=>.2126*(oe[0]<=.03928?oe[0]/12.92:Math.pow((oe[0]+.055)/1.055,2.4))+.7152*(oe[1]<=.03928?oe[1]/12.92:Math.pow((oe[1]+.055)/1.055,2.4))+.0722*(oe[2]<=.03928?oe[2]/12.92:Math.pow((oe[2]+.055)/1.055,2.4)),M=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),O=d.properties.get("intensity"),D=d.properties.get("direction"),B=1-a.d4(D.x,D.y,D.z)[2]/90,V=w(M)*O*B,Y=m.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),Q=m.properties.get("intensity"),ce=w(Y)*Q;return Number(((V+ce)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const d=[];return this.directionalLight&&d.push(this.directionalLight.get()),this.ambientLight&&d.push(this.ambientLight.get()),d}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(d){if(d==null||d===""&&this.isRootStyle())return this;if(a.dr(d)){const m=a.ds(d),w=this.fragments.find(({id:O})=>O===m);if(!w)return;const M=a.dq(d);return w.style.getFragmentStyle(M)}{const m=this.fragments.find(({id:w})=>w===d);return m?m.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const m={},w=(M,O="")=>`${M}::${O}`;this._featuresetSelectors={};for(const M in d){const O=this._featuresetSelectors[M]=[];for(const D of d[M].selectors){if(D.featureNamespace){const V=this.getOwnLayer(D.layer);if(!V){a.w(`Layer is undefined for selector: ${D.layer}`);continue}const Y=w(V.source,V.sourceLayer);if(Y in m&&m[Y]!==D.featureNamespace){a.w(`"featureNamespace ${D.featureNamespace} of featureset ${M}'s selector is not associated to the same source, skip this selector`);continue}m[Y]=D.featureNamespace}let B;if(D.properties)for(const V in D.properties){const Y=a.U(D.properties[V]);Y.result==="success"&&(B=B||{},B[V]=Y.value)}O.push({layerId:D.layer,namespace:D.featureNamespace,properties:B,uniqueFeatureID:D._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const m=this.getFragmentStyle(d);if(!m||!m.stylesheet.featuresets)return[];const w=[];for(const M in m.stylesheet.featuresets)w.push({featuresetId:M,importId:m.scope?m.scope:void 0});return w}getFeaturesetLayers(d,m){const w=this.getFragmentStyle(m),M=w.stylesheet.featuresets;if(!M||!M[d])return this.fire(new a.y(new Error(`The featureset '${d}' does not exist in the map's style and cannot be queried.`))),[];const O=[];for(const D of M[d].selectors){const B=w.getOwnLayer(D.layer);B&&O.push(B)}return O}getConfigProperty(d,m){const w=this.getFragmentStyle(d);if(!w)return null;const M=a.B(m,w.scope),O=w.options.get(M),D=O?O.value||O.default:null;return D?D.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,m){const w=a.B(d,m);return this._mergedIndoor[w]}setIndoorData(d,m){this.map.indoor.setIndoorData(m)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,m,w){const M=this.getFragmentStyle(d);if(!M)return;const O=M.stylesheet.schema;if(!O||!O[m])return;const D=a.U(w);if(D.result!=="success")return void Dm(this,D.value);const B=D.value.expression,V=a.B(m,M.scope),Y=M.options.get(V);if(!Y)return;let Q;const{minValue:ce,maxValue:oe,stepValue:ue,type:ke,values:_e}=O[m],Le=a.U(O[m].default);Le.result==="success"&&(Q=Le.value.expression),Q?(this.options.set(V,Object.assign({},Y,{value:B,default:Q,minValue:ce,maxValue:oe,stepValue:ue,type:ke,values:_e})),this.updateConfigDependencies(m)):this.fire(new a.y(new Error(`No schema defined for the config option "${m}" in the "${d}" fragment.`)))}getConfig(d){const m=this.getFragmentStyle(d);if(!m)return null;const w=m.stylesheet.schema;if(!w)return null;const M={};for(const O in w){const D=a.B(O,m.scope),B=m.options.get(D),V=B?B.value||B.default:null;M[O]=V?V.serialize():null}return M}setConfig(d,m){const w=this.getFragmentStyle(d);w&&(w.updateConfig(m,w.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const m=this.getFragmentStyle(d);return m?m.stylesheet.schema:null}setSchema(d,m){const w=this.getFragmentStyle(d);w&&(w.stylesheet.schema=m,w.updateConfig(w._config,m),this.updateConfigDependencies())}updateConfig(d,m){if(this._config=d,d||m)if(m)for(const w in m){let M,O;const D=a.U(m[w].default);if(D.result==="success"&&(M=D.value.expression),d&&d[w]!==void 0){const oe=a.U(d[w]);oe.result==="success"&&(O=oe.value.expression)}const{minValue:B,maxValue:V,stepValue:Y,type:Q,values:ce}=m[w];if(M){const oe=a.B(w,this.scope);this.options.set(oe,{default:M,value:O,minValue:B,maxValue:V,stepValue:Y,type:Q,values:ce})}else this.fire(new a.y(new Error(`No schema defined for config option "${w}".`)))}else this.fire(new a.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,m=()=>!0){for(const w of d){const M=this.getLayer(w);M&&m(M)&&(M.possiblyEvaluateVisibility(),this._updateLayer(M),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,m=>!d||m.expressionDependencies.configDependencies.has(d)),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(m=>{const w=m._styleColorTheme.colorThemeOverride?m._styleColorTheme.colorThemeOverride:m._styleColorTheme.colorTheme;if(w){const M=m._evaluateColorThemeData(w);(!m._styleColorTheme.lut&&M!==""||m._styleColorTheme.lut&&M!==m._styleColorTheme.lut.data)&&m.setColorTheme(w)}}),this._changes.setDirty()}addLayer(d,m,w={}){this._checkLoaded();const M=d.id;if(this._layers[M])return void this.fire(new a.y(new Error(`Layer with id "${M}" already exists on this map`)));let O;if(d.type==="custom"){if(Dm(this,a.dt(d)))return;O=a.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(M,d.source),d=a.dp(d),d=Object.assign(d,{source:M})),this._validate(Bd,`layers.${M}`,d,{arrayIndex:-1},w))return;O=a.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(O),O.setEventedParent(this,{layer:{id:M}})}const D=a.B(O.source,O.scope);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(D),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(D);let B=this._order.length;if(m){const ce=this._order.indexOf(m);if(ce===-1)return void this.fire(new a.y(new Error(`Layer with id "${m}" does not exist on this map.`)));O.slot===this._layers[m].slot?B=ce:a.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,M),this._layerOrderChanged=!0,this._layers[M]=O;const V=this.getOwnLayerSourceCache(O),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();V&&O.canCastShadows()&&Y&&(V.castsShadows=!0);const Q=this._changes.getRemovedLayer(O);if(Q&&O.source&&V&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const ce=a.B(O.source,O.scope);Q.type!==O.type?this._changes.updateSourceCache(ce,"clear"):(this._changes.updateSourceCache(ce,"reload"),V.pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map),O.scope=this.scope,this.mergeLayers()}moveLayer(d,m){this._checkLoaded();const w=this._checkLayer(d);if(!w||d===m)return;const M=this._order.indexOf(d);this._order.splice(M,1);let O=this._order.length;if(m){const D=this._order.indexOf(m);if(D===-1)return void this.fire(new a.y(new Error(`Layer with id "${m}" does not exist on this map.`)));w.slot===this._layers[m].slot?O=D:a.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(O,0,d),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(d){this._checkLoaded();const m=this._checkLayer(d);if(!m)return;m.setEventedParent(null);const w=this._order.indexOf(d);this._order.splice(w,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(m.fqid),this._indoorDependentLayers.delete(m.fqid),this._changes.removeLayer(m);const M=this.getOwnLayerSourceCache(m);if(M&&M.castsShadows){let O=!1;for(const D in this._layers)if(this._layers[D].source===m.source&&this._layers[D].canCastShadows()){O=!0;break}M.castsShadows=O}m.onRemove&&m.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const m in this._layers)if(this._layers[m].type===d)return!0;return!1}setLayerZoomRange(d,m,w){this._checkLoaded();const M=this._checkLayer(d);M&&(M.minzoom===m&&M.maxzoom===w||(m!=null&&(M.minzoom=m),w!=null&&(M.maxzoom=w),this._updateLayer(M)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,m){this._checkLoaded();const w=this._checkLayer(d);w&&w.slot!==m&&(w.slot=m,this._updateLayer(w))}setFilter(d,m,w={}){this._checkLoaded();const M=this._checkLayer(d);if(M&&!a.by(M.filter,m))return m==null?(M.filter=void 0,void this._updateLayer(M)):void(this._validate(_r,`layers.${M.id}.filter`,m,{layerType:M.type},w)||(M.filter=a.dp(m),this._updateLayer(M)))}getFilter(d){const m=this._checkLayer(d);if(m)return a.dp(m.filter)}setLayoutProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);if(O&&!a.by(O.getLayoutProperty(m),w)){if(w!=null&&(!M||M.validate!==!1)&&Dm(O,kt.call(Ii,{key:`layers.${d}.layout.${m}`,layerType:O.type,objectKey:m,value:w,styleSpec:a.a6,style:{glyphs:!0,sprite:!0}})))return;O.setLayoutProperty(m,w),O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),this._updateLayer(O)}}setLayerProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);O&&(m==="appearances"?(O.setAppearances(w),this._changes.setDirty()):O.isPaintProperty(m)?this.setPaintProperty(d,m,w,M):this.setLayoutProperty(d,m,w,M))}getLayoutProperty(d,m){const w=this._checkLayer(d);if(w)return w.getLayoutProperty(m)}setPaintProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);if(!O||a.by(O.getPaintProperty(m),w)||w!=null&&(!M||M.validate!==!1)&&Dm(O,Hn.call(Ii,{key:`layers.${d}.paint.${m}`,layerType:O.type,objectKey:m,value:w,styleSpec:a.a6})))return;const D=O.setPaintProperty(m,w);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),D&&this._updateLayer(O),this._changes.updatePaintProperties(O)}getPaintProperty(d,m){const w=this._checkLayer(d);if(w)return w.getPaintProperty(m)}setFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:oe,sourceLayer:ue}of ce)Q.setFeatureState({id:d.id,source:oe,sourceLayer:ue},m)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.setFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const w=d.source,M=d.sourceLayer,O=this._checkSource(w);if(!O)return;const D=O.type;if(D==="geojson"&&M)return void this.fire(new a.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(D==="vector"&&!M)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided.")));const B=this.getOwnSourceCaches(w);for(const V of B)V.setFeatureState(M,d.id,m)}removeFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:oe,sourceLayer:ue}of ce)Q.removeFeatureState({id:d.id,source:oe,sourceLayer:ue},m)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.removeFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const w=d.source,M=this._checkSource(w);if(!M)return;const O=M.type,D=O==="vector"?d.sourceLayer:void 0;if(O==="vector"&&!D)return void this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(m&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new a.y(new Error("A feature id is required to remove its specific state property.")));const B=this.getOwnSourceCaches(w);for(const V of B)V.removeFeatureState(D,d.id,m)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let O;if("featuresetId"in d.target){const{featuresetId:D,importId:B}=d.target,V=this.getFragmentStyle(B),Y=V.getFeaturesetLayers(D);for(const{source:Q,sourceLayer:ce}of Y){const oe=V.getFeatureState({id:d.id,source:Q,sourceLayer:ce});if(oe&&!O)O=oe;else if(!a.by(O,oe))return void this.fire(new a.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in d.target){const{layerId:D}=d.target,B=this.getLayer(D);O=this.getFeatureState({id:d.id,source:B.source,sourceLayer:B.sourceLayer})}return O}const m=d.source,w=d.sourceLayer,M=this._checkSource(m);if(M){if(M.type!=="vector"||w)return d.id===void 0&&this.fire(new a.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(m)[0].getFeatureState(w,d.id);this.fire(new a.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(d){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,d),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const d=this.getTerrain(),m=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return a.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:m,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)},w=>w!==void 0)}_updateFilteredLayers(d){for(const m of Object.values(this._mergedLayers))d(m)&&this._updateLayer(m)}_updateLayer(d){this._changes.updateLayer(d);const m=this.getLayerSourceCache(d),w=a.B(d.source,d.scope),M=this._changes.getUpdatedSourceCaches();d.source&&!M[w]&&m&&m.getSource().type!=="raster"&&(this._changes.updateSourceCache(w,"reload"),m.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const m=B=>this._mergedLayers[B].is3D(!!this.terrain),w=this.order,M={},O=[];for(let B=w.length-1;B>=0;B--){const V=w[B];if(m(V)){M[V]=B;for(const Y of d){const Q=Y[V];if(Q)for(const ce of Q)O.push(ce)}}}O.sort((B,V)=>V.intersectionZ-B.intersectionZ);const D=[];for(let B=w.length-1;B>=0;B--){const V=w[B];if(m(V))for(let Y=O.length-1;Y>=0;Y--){const Q=O[Y].feature;if(Q.layer&&M[Q.layer.id]{if(kk.has(Q.type))return;const ce=this.getOwnLayerSourceCache(Q),oe=O[ce.id]=O[ce.id]||{sourceCache:ce,layers:{},has3DLayers:!1};Q.is3D(!!this.terrain)&&(oe.has3DLayers=!0),oe.layers[Q.fqid]=oe.layers[Q.fqid]||{styleLayer:Q,targets:[]},oe.layers[Q.fqid].targets.push({filter:M})};if(m&&m.layers){if(!Array.isArray(m.layers))return this.fire(new a.y(new Error("parameters.layers must be an Array."))),[];for(const Q of m.layers){const ce=this._layers[Q];if(!ce)return this.fire(new a.y(new Error(`The layer '${Q}' does not exist in the map's style and cannot be queried for features.`))),[];D(ce)}}else for(const Q in this._layers)D(this._layers[Q]);const B=this._queryRenderedFeatures(d,O,w),V=this._flattenAndSortRenderedFeatures(B),Y=[];for(const Q of V)a.dw(Q.layer.id)===this.scope&&Y.push(Q);return Y}queryRenderedFeatureset(d,m,w){let M;m&&!Array.isArray(m)&&m.filter&&(this._validate(_r,"queryRenderedFeatures.filter",m.filter,null,m),M=a.b6(m.filter));const O="mock",D=[];if(m&&m.target)D.push(Object.assign({},m,{targetId:O,filter:M}));else{const Q=this.getFeaturesetDescriptors();for(const ce of Q)D.push({targetId:O,filter:M,target:ce});for(const{style:ce}of this.fragments){const oe=ce.getFeaturesetDescriptors();for(const ue of oe)D.push({targetId:O,filter:M,target:ue})}}const B=this.queryRenderedTargets(d,D,w),V=[],Y=new Set;for(const Q of B)for(const ce of Q.variants[O])Vu(ce,Q,Y)||V.push(new a.dx(Q,ce));return V}queryRenderedTargets(d,m,w){const M={},O=(B,V,Y,Q)=>{const ce=M[V.id]=M[V.id]||{sourceCache:V,layers:{},has3DLayers:!1};if(ce.layers[B.fqid]=ce.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(ce.has3DLayers=!0),!Q)return Y.uniqueFeatureID=!1,void ce.layers[B.fqid].targets.push(Y);ce.layers[B.fqid].targets.push(Object.assign({},Y,{namespace:Q.namespace,properties:Q.properties,uniqueFeatureID:Q.uniqueFeatureID}))};for(const B of m)if("featuresetId"in B.target){const{featuresetId:V,importId:Y}=B.target,Q=this.getFragmentStyle(Y);if(!Q||!Q._featuresetSelectors)continue;const ce=Q._featuresetSelectors[V];if(!ce){this.fire(new a.y(new Error(`The featureset '${V}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const oe of ce){const ue=Q.getOwnLayer(oe.layerId);ue&&!kk.has(ue.type)&&O(ue,Q.getOwnLayerSourceCache(ue),B,oe)}}else if("layerId"in B.target){const{layerId:V}=B.target,Y=this.getLayer(V);if(!Y||kk.has(Y.type))continue;O(Y,this.getLayerSourceCache(Y),B)}const D=this._queryRenderedFeatures(d,M,w);return this._flattenAndSortRenderedFeatures(D)}_queryRenderedFeatures(d,m,w){const M=[],O=!!this.map._showQueryGeometry,D=ma.createFromScreenPoints(d,w);for(const B in m){const V=Jl(D,m[B],this._availableImages,w,O);Object.keys(V).length&&M.push(V)}if(this.placement)for(const B in m){if(!m[B].sourceCache._onlySymbols)continue;const V=up(D.screenGeometry,m[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(V).length&&M.push(V)}return M}querySourceFeatures(d,m){const w=m&&m.filter;w&&this._validate(_r,"querySourceFeatures.filter",w,null,m);let M=[];const O=this.getOwnSourceCaches(d);for(const D of O)M=M.concat(Em(D,m));return M}addSourceType(d,m,w){return Qu.getSourceType(d)?w(new Error(`A source type called "${d}" already exists.`)):(Qu.setSourceType(d,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:m.workerSourceURL},w):w(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,m,w={}){this._checkLoaded();const M=this.light.getLight();let O=!1;for(const B in d)if(!a.by(d[B],M[B])){O=!0;break}if(!O)return;const D=this._getTransitionParameters();this.light.setLight(d,m,w),this.light.updateTransitions(D)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=a.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&a.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,m=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),m===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let w=d;const M=!("source"in d)||d.source==null;if(m===1){if(this.disableElevatedTerrain)return;if("source"in w&&typeof w.source=="object"){const B="terrain-dem-src";this.addSource(B,w.source),w=a.dp(w),w=Object.assign(w,{source:B})}const O=Object.assign({},w),D={};if(this.terrain&&M){O.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(D.style=B.serialize())}if(this._validate(Tc,"terrain",O,D))return}if(!this.terrain||this.terrain.scope!==this.scope&&!M||this.terrain&&m!==this.terrain.drapeRenderMode){if(!w)return;this._createTerrain(w,m),this.fire(new a.z("data",{dataType:"style"}))}else{const O=this.terrain,D=O.get();for(const B of Object.keys(a.a6.terrain))!w.hasOwnProperty(B)&&a.a6.terrain[B].default&&(w[B]=a.a6.terrain[B].default);for(const B in d)if(!a.by(d[B],D[B])){O.set(d,this.options),this.stylesheet.terrain=d;const V=this._getTransitionParameters({duration:0});O.updateTransitions(V),this.fire(new a.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const m=this.fog=new Qn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_createSnow(d){const m=this.snow=new fo(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_createRain(d){const m=this.rain=new wa(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const d of this.map._markers)d._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(d){if(this._checkLoaded(),!d)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const m=this.fog;if(!a.by(m.get(),d)){m.set(d,this.options),this.stylesheet.fog=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}else this._createFog(d);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(d){if(this._checkLoaded(),!d)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const m=this.snow;if(!a.by(m.get(),d)){m.set(d,this.options),this.stylesheet.snow=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}else this._createSnow(d);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(d){if(this._checkLoaded(),!d)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const m=this.rain;if(!a.by(m.get(),d)){m.set(d,this.options),this.stylesheet.rain=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const M in this._layers)this._layers[M].lut=this._styleColorTheme.lut;for(const M in this._sourceCaches)this._sourceCaches[M].clearTiles()},m=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!m)return this._styleColorTheme.lut=null,void d();const w=this._evaluateColorThemeData(m);this._loadColorTheme(w).then(()=>{this.fire(new a.z("colorthemeset")),d()}).catch(M=>{a.w(`Couldn't set color theme: ${M}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&a.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=d,this._reloadColorTheme()}setImportColorTheme(d,m){const w=this.getFragmentStyle(d);w&&(w._styleColorTheme.colorThemeOverride=m,w._reloadColorTheme())}_getTransitionParameters(d){return{now:a.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],m=[];for(const w of this._mergedOrder)this.isLayerDraped(this._mergedLayers[w])?d.push(w):m.push(w);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...m)}_createTerrain(d,m){const w=this.terrain=new Lt(d,m,this.scope,this.options,this.map.getWorldview());m===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const M=this._getTransitionParameters({duration:0});w.updateTransitions(M)}_force3DLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="fill-extrusion"&&this._updateLayer(m)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="symbol"&&this._updateLayer(m)}}_validate(d,m,w,M,O={}){if(O&&O.validate===!1)return!1;const D=Object.assign({},this.serialize());return Dm(this,d.call(Ii,Object.assign({key:m,style:D,value:w,styleSpec:a.a6},M)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const d in this._mergedLayers)this._mergedLayers[d].setEventedParent(null);for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles(),this._mergedSourceCaches[d].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(d){const m=this.getSourceCaches(d);for(const w of m)w.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];m._clear&&m._clear()}}reloadSource(d){const m=this.getSourceCaches(d);for(const w of m)w.resume(),w.reload()}reloadSources(){for(const d of this.getSources())d.reload&&d.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(d=>{d.modelManager.reloadModels(d.scope)})}updateSources(d){let m;this.directionalLight&&(m=kv(this.directionalLight));const w=new Set,M=new Set;for(const O in this._mergedLayers){const D=this._mergedLayers[O];D.type==="building"&&w.add(D.source),D.hasElevation()&&!M.has(D.source)&&M.add(D.source)}for(const O in this._mergedSourceCaches){const D=this._mergedSourceCaches[O],B=M.has(D._source.id);w.has(D._source.id)&&(D._source.reparseOverscaled=!1),D.update(d,void 0,void 0,m,B)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const m=this._sourceCaches[d];m.resume(),m.reload()}}_updatePlacement(d,m,w,M,O,D,B=!1){let V=!1,Y=!1;const Q={},ce={};for(const _e of this._mergedOrder){const Le=this._mergedLayers[_e];if(Le.type!=="symbol")continue;const Pe=a.B(Le.source,Le.scope);let qe=Q[Pe];if(!qe){const He=this.getLayerSourceCache(Le);if(!He)continue;const xt=He.getRenderableIds(!0).map(ct=>He.getTileByID(ct));ce[Pe]=xt.slice(),qe=Q[Pe]=xt.sort((ct,pt)=>pt.tileID.overscaledZ-ct.tileID.overscaledZ||(ct.tileID.isLessThan(pt.tileID)?-1:1))}const Ze=this.crossTileSymbolIndex.addLayer(Le,qe,m.center.lng,m.projection);V=V||Ze}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new a.z("neworder"));const oe=!!(this.placement&&!m.equals(this.placement.transform)),ue=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!D||this.placement.lastReplacementSourceUpdateTime!==D.updateTime)),ke=(oe||ue||V||this.placement&&this.placement.isStale())&&M===0;if((B||!this.pauseablePlacement||ke||M!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.o.now(),m.zoom))&&(this.pauseablePlacement=new gl(m,this._mergedOrder,B||M===0,w,M,O,this.placement,this.fog&&m.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,Q,ce,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.o.now()),Y=!0),V&&this.pauseablePlacement.placement.setStale()),Y||V){this._buildingIndex.onNewFrame(m.zoom);for(let _e=0;_eO===d.id)!==-1)return void this.fire(new a.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!m)return w.push(d),this._loadImports([d],!0);const M=w.findIndex(({id:O})=>O===m);return M===-1&&this.fire(new a.y(new Error(`Import with id "${m}" does not exist on this map.`))),this.stylesheet.imports=w.slice(0,M).concat(d).concat(w.slice(M)),this._loadImports([d],!0,m)}updateImport(d,m){this._checkLoaded();const w=this.stylesheet.imports||[],M=this.getImportIndex(d);return M===-1?this:typeof m=="string"?(this.setImportUrl(d,m),this):(m.url&&m.url!==w[M].url&&this.setImportUrl(d,m.url),a.by(m.config,w[M].config)||this.setImportConfig(d,m.config,m.data.schema),a.by(m.data,w[M].data)||this.setImportData(d,m.data),this)}moveImport(d,m){this._checkLoaded();let w=this.stylesheet.imports||[];const M=this.getImportIndex(d);if(M===-1)return this;const O=this.getImportIndex(m);if(O===-1)return this;const D=w[M],B=this.fragments[M];return w=w.filter(({id:V})=>V!==d),this.fragments=this.fragments.filter(({id:V})=>V!==d),this.stylesheet.imports=w.slice(0,O).concat(D).concat(w.slice(O)),this.fragments=this.fragments.slice(0,O).concat(B).concat(this.fragments.slice(O)),this.mergeLayers(),this}setImportUrl(d,m){this._checkLoaded();const w=this.stylesheet.imports||[],M=this.getImportIndex(d);if(M===-1)return this;w[M].url=m;const O=this.fragments[M];return O.style=this._createFragmentStyle(w[M]),O.style.on("style.import.load",()=>this.mergeAll()),O.style.loadURL(m),this}setImportData(d,m){this._checkLoaded();const w=this.getImportIndex(d),M=this.stylesheet.imports||[];return w===-1?this:m?(this.fragments[w].style.setState(m),this._reloadImports(),this):(delete M[w].data,this.setImportUrl(d,M[w].url))}setImportConfig(d,m,w){this._checkLoaded();const M=this.getImportIndex(d),O=this.stylesheet.imports||[];if(M===-1)return this;m?O[M].config=m:delete O[M].config;const D=this.fragments[M];w&&D.style.stylesheet&&(D.style.stylesheet.schema=w);const B=D.style.stylesheet&&D.style.stylesheet.schema;return D.config=m,D.style.updateConfig(m,B),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const m=this.stylesheet.imports||[],w=this.getImportIndex(d);w!==-1&&(m.splice(w,1),this.fragments[w].style._remove(),this.fragments.splice(w,1),this._reloadImports())}getImportIndex(d){const m=(this.stylesheet.imports||[]).findIndex(w=>w.id===d);return m===-1&&this.fire(new a.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),m}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const m in this._mergedOtherSourceCaches){const w=this._mergedOtherSourceCaches[m];w&&d.push(w.getSource())}return d}getSource(d,m){const w=this.getSourceCache(d,m);return w&&w.getSource()}getLayerSource(d){const m=this.getLayerSourceCache(d);return m&&m.getSource()}getSourceCache(d,m){const w=a.B(d,m);return this._mergedOtherSourceCaches[w]}getLayerSourceCache(d){const m=a.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[m]:this._mergedOtherSourceCaches[m]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const m=[];return this._mergedOtherSourceCaches[d]&&m.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&m.push(this._mergedSymbolSourceCaches[d]),m}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const m in d){const w=d[m];w==="reload"?this.reloadSource(m):w==="clear"&&this.clearSource(m)}}updateLayers(d){const m=this._changes.getUpdatedPaintProperties();for(const w of m){const M=this.getLayer(w);M&&M.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,m,w){this.imageManager.getImages(m.images,m.scope,w),this._updateTilesForChangedImages();const M=D=>{if(D){const B=m.images.map(V=>a.I.toString(V));D.setDependencies(m.tileID.key,m.type,B)}},O=a.B(m.source,m.scope);M(this._mergedOtherSourceCaches[O]),M(this._mergedSymbolSourceCaches[O]),m.images.some(D=>D.iconsetId)&&this.fire(new a.z("data",{dataType:"style"}))}rasterizeImages(d,m,w){this.imageManager.rasterizeImages(m,w)}getGlyphs(d,m,w){this.glyphManager.getGlyphs(m.stacks,w)}getResource(d,m,w){return a.dz(m,w)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const m=[];return this._otherSourceCaches[d]&&m.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&m.push(this._symbolSourceCaches[d]),m}_isSourceCacheLoaded(d){const m=this.getOwnSourceCaches(d);return m.length===0?(this.fire(new a.y(new Error(`There is no source with ID '${d}'`))),!1):m.every(w=>w.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,m){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const w=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),M=d.type==="building";if(d.is3D(!!this.terrain)){if(w||M||m&&m.type==="batched-model"||d.type==="model")return!0}else if(d.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(d=>{d.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Qu.getSourceType=function(_){return au[_]},Qu.setSourceType=function(_,d){au[_]=d},Qu.registerForPluginStateChange=a.dA;class eP extends a.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},a.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(d){d===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=d,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(d){this._activeFloorsVisible=d,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(d){for(const[m,w]of Object.entries(d.buildings))if(this._buildings[m])for(const M of w.floorIds)this._buildings[m].floors[M]||(this._buildings[m].floors[M]=w.floors[M]);else this._buildings[m]=w;for(const m of d.activeFloors)this._activeFloors.add(m);this._updateIndoorSelector()}getIndoorTileOptions(d,m){const w=this._style.getIndoorSourceLayers(d,m);return w&&this._indoorState?{sourceLayers:w,indoorState:this._indoorState}:null}_updateUI(d,m,w){const M=function(O,D,B,V){let Y=null,Q=Number.MAX_SAFE_INTEGER;if(V<16)return null;for(const[ce,oe]of Object.entries(O)){const ue=oe.center;if(ue){const ke=D.distanceTo(a.aT.convert(ue));ke({id:D,name:w.floors[D].name,zIndex:w.floors[D].zIndex})).sort((D,B)=>B.zIndex-D.zIndex);this.fire(new a.z("selector-update",{selectedFloorId:M,activeFloorsVisible:this._activeFloorsVisible,floors:O}))}_updateActiveFloors(){const d=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:d,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var Cy=` #define EPSILON 0.0000001 #define PI 3.141592653589793 #ifdef RENDER_CUTOFF float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} #endif`,My=` #ifdef DUAL_SOURCE_BLENDING layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1; #else layout(location=0) out vec4 glFragColor; #endif #ifdef USE_MRT1 layout(location=1) out vec4 out_Target1; #endif highp float unpack_depth(highp vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} #ifdef INDICATOR_CUTOUT uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; #endif vec4 applyCutout(vec4 color,float height) { #ifdef INDICATOR_CUTOUT float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); #else return color; #endif } #ifdef DEBUG_WIREFRAME #define HANDLE_WIREFRAME_DEBUG \\ glFragColor=vec4(0.7,0.0,0.0,0.7); \\ gl_FragDepth=gl_FragCoord.z-0.0001; #else #define HANDLE_WIREFRAME_DEBUG #endif #ifdef RENDER_CUTOFF uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; #endif vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,$3=` #define EXTENT 8192.0 #define RAD_TO_DEG 180.0/PI #define DEG_TO_RAD PI/180.0 #define GLOBE_RADIUS EXTENT/PI/2.0 float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} #ifdef PROJECTION_GLOBE_VIEW vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { #ifndef PROJECTED_POS_ON_VIEWPORT float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; #else return vec3(0.0); #endif }vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} #endif vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4( unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} #ifdef RENDER_CUTOFF uniform vec4 u_cutoff_params;out float v_cutoff_opacity; #endif const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt) {float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} #ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib #define DECLARE_MATERIAL_TABLE_INFO #endif`,Nk="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",lu=` #define ELEVATION_SCALE 7.0 #define ELEVATION_OFFSET 450.0 #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} #else vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } #endif #ifdef TERRAIN uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif }float prevElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif } #ifdef TERRAIN_VERTEX_MORPHING float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} #else float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif return currentElevation(apos);} #endif vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} #else float elevation(vec2 pos) { return 0.0; } #endif #ifdef DEPTH_OCCLUSION uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; #ifdef DEPTH_D24 float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} #else highp float unpack_depth_rgba(vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif #ifdef DEPTH_D24 float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); #else float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); #endif return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; #ifdef DEPTH_D24 highp vec4 depth=vec4( texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r );depth=unpack_depth4(depth); #else highp vec4 depth=vec4( unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) ); #endif return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); #else highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); #endif res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} #else bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } #endif`,Sk=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} #endif`,Mr=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} #endif`,U3=`#ifdef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) );}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) );}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} #endif`,Ck=`#ifdef RASTER_ARRAY uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} #endif uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,Mk=`#ifdef RENDER_SHADOWS uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} #endif`,q3=`#ifdef RENDER_SHADOWS precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) { #ifdef CLIP_ZERO_TO_ONE highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); #else highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); #endif return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w; #ifdef SHADOWS_SINGLE_CASCADE vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias); #else light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); #endif }highp float calculate_shadow_bias(float NDotL) { #ifdef NORMAL_OFFSET return 0.5*u_shadow_bias.x; #else return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); #endif }float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) {highp vec2 biasUV=vec2( pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} #endif`;const Sv=/#include\s+"([^"]+)"/g,gf=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,V3=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Zg=new Set(["ifdef","ifndef","elif","if","defined"]),Yg=new Set;zm(Cy,Yg),zm($3,Yg),zm(My,Yg);const Fm={"_prelude_fog.vertex.glsl":Sk,"_prelude_terrain.vertex.glsl":lu,"_prelude_shadow.vertex.glsl":Mk,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer #define MATERIAL_TABLE_DEBUG 0 uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; #if MATERIAL_TABLE_DEBUG vec4 colorDebug; #endif };uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; }uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; #if MATERIAL_TABLE_DEBUG const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; #endif uint offset=0u; #if MATERIAL_TABLE_DEBUG bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} #endif offset++; #if MATERIAL_TABLE_DEBUG uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} #endif offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); #if MATERIAL_TABLE_DEBUG if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} #endif uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); #if MATERIAL_TABLE_DEBUG if(keepFinding) {uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} #endif offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; #if MATERIAL_TABLE_DEBUG if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} #endif info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) {uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) #define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); #define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; #endif`,"_prelude_fog.fragment.glsl":Mr,"_prelude_shadow.fragment.glsl":q3,"_prelude_lighting.glsl":` #ifdef LIGHTING_3D_MODE uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} #endif`,"_prelude_raster_array.glsl":U3,"_prelude_raster_particle.glsl":Ck},Tk={};Xs("",lu),Xs(Mr,Sk),Xs(q3,Mk),Xs(U3,""),Xs(Ck,"");const tP=Xs(My,$3),Ak=Cy,Xie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",Ak,tP.fragmentSource].join(` `),rP=["precision highp float;",Ak,tP.vertexSource].join(` `);var H3={background:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE in vec4 v_color; #endif void main() {vec4 out_color; #ifdef LIGHTING_3D_MODE out_color=v_color; #else out_color=u_color; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_lighting.glsl" in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE uniform mediump vec4 u_color;out vec4 v_color; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0,1); #ifdef LIGHTING_3D_MODE v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),backgroundPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),building:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity; #endif #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT in highp float v_flood_radius;in float v_has_flood_light; #endif uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} #ifdef BUILDING_FAUX_FACADE float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y; #if 0 if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0; #else if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; #endif return out_color;} #endif vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a; #ifdef BUILDING_FAUX_FACADE if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);} #endif vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; #ifdef RENDER_SHADOWS #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif #else shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir); #endif color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); #ifdef FLOOD_LIGHT float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance); #endif color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); #endif color*=u_opacity; #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_pos.z); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef DEBUG_SHOW_NORMALS color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT out highp float v_flood_radius;out float v_has_flood_light; #endif const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #ifdef BUILDING_FAUX_FACADE mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);} #endif #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive #ifdef FLOOD_LIGHT v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius); #endif vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0; #ifdef BUILDING_FAUX_FACADE v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;} #endif v_pos=a_pos_3f; #ifdef RENDER_CUTOFF vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; #endif #ifdef RENDER_SHADOWS vec3 shadow_pos=v_pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0); #endif #ifdef FOG v_fog_pos=fog_position(v_pos); #endif gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Xs(`in vec4 v_color_emissive; #pragma mapbox: define-attribute highp vec4 bloom_attenuation #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; #ifdef HAS_ATTRIBUTE_a_bloom_attenuation float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance); #endif #ifdef RENDER_CUTOFF opacity*=v_cutoff_opacity; #endif glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute highp vec4 bloom_attenuation out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation #ifdef HAS_ATTRIBUTE_a_part_color_emissive vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive); #else v_color_emissive=vec4(1.0); #endif gl_Position=u_matrix*vec4(a_pos_3f,1.0); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),buildingDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" in vec3 v_data;in float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity uniform float u_emissive_strength;void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) );vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_apply_premultiplied(out_color,v_fog_pos); #endif glFragColor=out_color*(v_visibility*opacity_t); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define NUM_VISIBILITY_RINGS 2 #define INV_SQRT2 0.70710678 #define ELEVATION_BIAS 0.0001 #define NUM_SAMPLES_PER_RING 16 uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif #ifdef ELEVATED_ROADS in float a_circle_z_offset; #endif out vec3 v_data;out float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { #if defined(TERRAIN) return elevation(pos)+ELEVATION_BIAS; #else return 0.0; #endif }vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); #ifdef PITCH_WITH_MAP #ifdef PROJECTION_GLOBE_VIEW return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); #else return u_matrix*( world_center+vec4(sample_offset,0,0) ); #endif #else return projected_center+vec4(sample_offset,0,0); #endif }float get_sample_step() { #ifdef PITCH_WITH_MAP return 2.0*PI/float(NUM_SAMPLES_PER_RING); #else return PI/float(NUM_SAMPLES_PER_RING); #endif }void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); #else surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); #endif #ifdef ELEVATED_ROADS world_center.z+=a_circle_z_offset+ELEVATION_BIAS; #endif vec4 projected_center=u_matrix*world_center;float view_scale=0.0; #ifdef PITCH_WITH_MAP #ifdef SCALE_WITH_MAP view_scale=1.0; #else view_scale=projected_center.w/u_camera_to_center_distance; #endif #else #ifdef SCALE_WITH_MAP view_scale=u_camera_to_center_distance; #else view_scale=projected_center.w; #endif #endif gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; #ifdef TERRAIN float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; #ifdef PITCH_WITH_MAP float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; #else occlusion_world_center=world_center;occlusion_projected_center=projected_center; #endif for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); #else visibility=1.0; #endif #ifdef PROJECTION_GLOBE_VIEW visibility=1.0; #endif v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); #ifdef FOG v_fog_pos=fog_position(world_center.xyz); #endif }`),clippingMask:Xs("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:Xs(`#include "_prelude_fog.fragment.glsl" uniform highp float u_intensity;in vec2 v_extrude; #pragma mapbox: define highp float weight #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); #ifdef FOG if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif out vec2 v_extrude; #pragma mapbox: define highp float weight #pragma mapbox: define mediump float radius const highp float ZERO=1.0/255.0/16.0; #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight #pragma mapbox: initialize mediump float radius vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #else pos=vec3(tilePos+extrude,elevation(tilePos)); #endif gl_Position=u_matrix*vec4(pos,1); #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),heatmapTexture:Xs(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(0.0); #endif HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Xs("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; #endif out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation); #ifdef PROJECTION_GLOBE_VIEW #ifndef PROJECTED_POS_ON_VIEWPORT vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition); #endif #endif vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Xs("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Xs("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3; #endif out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); #else gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); #endif }`),elevatedStructuresDepth:Xs(`void main() { #ifndef DEPTH_TEXTURE glFragColor=vec4(0.); #endif }`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Xs(`#ifdef DEPTH_RECONSTRUCTION in float v_height; #endif void main() { #ifdef DEPTH_RECONSTRUCTION if (v_height >=0.0) discard; #else #ifdef FEATURE_CUTOUT apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord); #endif #endif glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; #ifdef DEPTH_RECONSTRUCTION out float v_height; #endif void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); #ifdef DEPTH_RECONSTRUCTION if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; #endif gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in vec3 v_normal;in float v_height; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; #endif vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) {color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color vec3 color=structure_color.xyz; #ifdef LIGHTING_3D_MODE vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); #ifdef RENDER_SHADOWS float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor); #else color=apply_lighting(color,transformed_normal); #endif color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} #endif #ifdef FOG color=fog_apply(color,v_fog_pos); #endif vec4 out_color=vec4(color,1.0); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_height); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; #endif #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fill:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity vec4 out_color=color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=opacity; #ifdef INDICATOR_CUTOUT if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=z_offset; #endif }`),fillOutline:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef FLIP_Y v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillOutlinePattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif uniform float u_emissive_strength; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif in highp vec2 v_pos;in highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos;out highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef FLIP_Y v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillExtrusion:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" in vec4 v_color;in vec4 v_flat; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif uniform lowp float u_opacity; #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec2 v_ao; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) in vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) in highp vec3 v_normal; #endif uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) in float v_flood_radius;in float v_has_floodlight; #endif in float v_height; #pragma mapbox: define highp float emissive_strength void main() { #pragma mapbox: initialize highp float emissive_strength #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) vec3 normal=normalize(v_normal); #endif float z;vec4 color=v_color; #ifdef ZERO_ROOF_RADIUS z=float(normal.z > 0.00001); #ifdef LIGHTING_3D_MODE normal=mix(normal,vec3(0.0,0.0,1.0),z); #else color=mix(v_color,v_roof_color,z); #endif #endif float h=max(0.0,v_height);float ao_shade=1.0; #ifdef FAUX_AO float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; #ifdef ZERO_ROOF_RADIUS concave*=(1.0-z); #endif float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT color.rgb*=mix(ao_shade,1.0,v_has_floodlight); #else color.rgb*=ao_shade; #endif #else color.rgb*=ao_shade; #endif #endif #ifdef LIGHTING_3D_MODE float flood_radiance=0.0; #ifdef FLOOD_LIGHT flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; #endif #ifdef RENDER_SHADOWS #ifdef FLOOD_LIGHT float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); #else float shadowed_lighting_factor; #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); #endif #else color.rgb=apply_lighting(color.rgb,normal); #ifdef FLOOD_LIGHT color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); #endif #endif color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); #endif #ifdef INDICATOR_CUTOUT color=applyCutout(color,h); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) out vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) out highp vec3 v_normal; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec2 v_ao; #endif #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) out float v_flood_radius;out float v_has_floodlight; #endif out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define highp float flood_light_wall_radius #pragma mapbox: define highp float line_width #pragma mapbox: define highp float emissive_strength void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize highp float flood_light_wall_radius #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp float emissive_strength base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) v_normal=normal; #endif base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif float cutoff=1.0;vec3 scaled_pos=pos; #ifdef RENDER_CUTOFF vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0); #ifdef CLIP_ZERO_TO_ONE cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); #else cutoff=cutoff_opacity(u_cutoff_params,ground.z); #endif if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); #endif float NdotL=0.0;float colorvalue=0.0; #ifndef LIGHTING_3D_MODE colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #endif #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; #endif v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); #else v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),fillExtrusionDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp float line_width #pragma mapbox: define highp vec4 color out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp vec4 color base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else pos=vec3(pos_nx.xy,t > 0.0 ? height : base); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_EXTRUSION_PATTERN_TRANSITION uniform float u_pattern_transition; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE in vec3 v_normal; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio void main() { #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_EXTRUSION_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; #else out_color=out_color*v_lighting; #endif #ifdef FAUX_AO float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,height); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif out highp vec2 v_pos;out vec4 v_lighting; #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE out vec3 v_normal; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio #pragma mapbox: define highp float line_width void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio #pragma mapbox: initialize highp float line_width vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=z;vec3 p;float c_ele; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); #else p=vec3(pos_nx.xy,z); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 ? pos_nx.xy : vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; #ifdef LIGHTING_3D_MODE NdotL=calculate_NdotL(normal); #else NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); #endif if (normal.y !=0.0) {float r=0.84; #ifndef LIGHTING_3D_MODE r=mix(0.7,0.98,1.0-u_lightintensity); #endif NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE v_normal=normal; #else v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(p); #endif }`),groundShadow:Xs(`#include "_prelude_shadow.fragment.glsl" precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #ifdef FOG in float v_fog_opacity; #endif void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); #ifdef RENDER_CUTOFF shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); #endif #ifdef FOG shadow=mix(shadow,vec3(1.0),v_fog_opacity); #endif #ifdef INDICATOR_CUTOUT shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); #endif glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #ifdef FOG out float v_fog_opacity; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); #ifdef FOG v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); #endif }`),fillExtrusionGroundEffect:Xs(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; #ifdef SDF_SUBPASS in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} #ifdef FOG in highp float v_fog; #endif #endif void main() { #ifdef CLEAR_SUBPASS vec4 color=vec4(1.0); #ifdef CLEAR_FROM_TEXTURE color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); #endif glFragColor=color; #else #ifdef SDF_SUBPASS highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; #ifdef FOG fog=v_fog; #endif #ifdef RENDER_CUTOFF fog*=v_cutoff_opacity; #endif glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); #else #ifdef USE_MRT1 out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); #else vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); #ifdef OVERDRAW_INSPECTOR color=vec4(1.0); #endif glFragColor=color; #endif #endif HANDLE_WIREFRAME_DEBUG; #endif }`,`#include "_prelude_fog.vertex.glsl" in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; #ifdef SDF_SUBPASS out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; #ifdef FOG out highp float v_fog; #endif #endif uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao; #pragma mapbox: define highp float flood_light_ground_radius const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { #pragma mapbox: initialize highp float flood_light_ground_radius vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; #ifdef SDF_SUBPASS v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); #ifdef FOG v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); #endif #endif float hidden_by_landmark=0.0; #ifdef HAS_CENTROID hidden_by_landmark=a_hidden_by_landmark; #endif float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),hillshadePrepare:Xs(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( (c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) )/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; #ifdef LIGHTING_3D_MODE glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); #endif #ifdef FOG glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),line:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform sampler2D u_dash_image;in vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform sampler2D u_gradient_image; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha; #ifdef RENDER_LINE_DASH float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); #endif highp vec4 out_color; #ifdef RENDER_LINE_GRADIENT out_color=texture(u_gradient_image,v_uv.xy); #ifdef MULTIPLY_LINE_GRADIENT_COLOR out_color*=color; #endif #else out_color=color; #endif float trim_alpha=1.0; #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;} #endif if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} #ifdef RENDER_LINE_BORDER float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}} #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=(alpha*opacity); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define EXTRUDE_SCALE 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) in vec3 a_z_offset_width; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) in highp vec3 a_packed; #endif #ifdef RENDER_LINE_DASH in float a_linesofar; #endif uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform float u_image_height; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth; #ifdef VARIABLE_LINE_WIDTH bool left=normal.y==1.0;halfwidth=(u_width_scale*(left ? a_z_offset_width.y : a_z_offset_width.z))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal; #else halfwidth=(u_width_scale*width)/2.0; #endif offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; #ifdef RENDER_LINE_GRADIENT highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); #else v_uv=vec3(a_uv_x,0.0,line_progress); #endif #endif #ifdef RENDER_LINE_DASH float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y); #endif v_width2=vec2(outset,inset); #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),linePattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef LINE_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef LINE_JOIN_NONE in vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize lowp float emissive_strength vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif #ifdef LINE_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} #endif #ifdef LINE_JOIN_NONE highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} #endif #ifdef LIGHTING_3D_MODE color=apply_lighting_with_emission_ground(color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_z_offset); #endif glFragColor=color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) in vec3 a_z_offset_width; #endif #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 a_packed; #endif in highp float a_linesofar; #ifdef LINE_JOIN_NONE in highp vec3 a_pattern_data;out vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; #ifdef RENDER_LINE_TRIM_OFFSET out highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define mediump float offset #pragma mapbox: define mediump float gapwidth #pragma mapbox: define mediump float width #pragma mapbox: define mediump float floorwidth #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize mediump float offset #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float floorwidth #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); #endif v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); #ifdef LINE_JOIN_NONE v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),raster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_raster_array.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; #ifdef PROJECTION_GLOBE_VIEW in float v_split_fade; #endif uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; #ifndef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1; #endif #ifdef RASTER_COLOR uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; #endif void main() {vec4 color0,color1,color;vec2 value; #ifdef RASTER_COLOR #ifdef RASTER_ARRAY #ifdef RASTER_ARRAY_LINEAR value=mix( raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #else value=mix( raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #endif if (value.y > 0.0) value.x/=value.y; #else color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); #endif color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; #else color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); #endif color.a*=u_opacity; #ifdef GLOBE_POLES color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); #endif vec3 rgb=color.rgb;rgb=vec3( dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef PROJECTION_GLOBE_VIEW glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); #endif #ifdef RENDER_CUTOFF glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos;in vec2 a_texture_pos; #endif out vec2 v_pos0;out vec2 v_pos1;out float v_depth; #ifdef PROJECTION_GLOBE_VIEW out float v_split_fade; #endif void main() {vec2 uv; #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); #endif #else float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; #ifdef RENDER_CUTOFF v_depth=gl_Position.z; #endif }`),rasterParticle:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Xs("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Xs("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:Xs(`#include "_prelude_raster_particle.glsl" uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) );highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Xs(`#include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #define SDF_PX 8.0 #define SDF 1.0 #define ICON 0.0 uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; #ifdef ICON_TRANSITION uniform float u_icon_transition; #endif #ifdef COLOR_ADJUSTMENT uniform mat4 u_color_adj_mat; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #else #ifdef RENDER_SHADOWS in highp float v_z_offset; #endif #endif in vec2 v_tex_a; #ifdef ICON_TRANSITION in vec2 v_tex_b; #endif in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL in float is_sdf;in vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; #ifdef RENDER_TEXT_AND_SYMBOL if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif return;} #endif #ifdef RENDER_SDF float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; #else #ifdef ICON_TRANSITION vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); #else out_color=texture(u_texture,v_tex_a); #endif #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef COLOR_ADJUSTMENT out_color=u_color_adj_mat*out_color; #endif #endif out_color*=opacity*fade_opacity; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef TERRAIN out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #else out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #endif #endif #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #define APPEARANCE_ICON 1.0 in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; #ifdef Z_OFFSET in float a_auto_z_offset; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_globe_anchor;in vec3 a_globe_normal; #endif #ifdef ICON_TRANSITION in vec2 a_texb; #endif #ifdef OCCLUSION_QUERIES in float a_occlusion_query_opacity; #endif #ifdef ELEVATED_ROADS in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #else #ifdef RENDER_SHADOWS out highp float v_z_offset; #endif #endif uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; #endif out vec2 v_tex_a; #ifdef ICON_TRANSITION out vec2 v_tex_b; #endif out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL out float is_sdf;out vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength #pragma mapbox: define lowp float occlusion_opacity #pragma mapbox: define lowp float z_offset void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength #pragma mapbox: initialize lowp float occlusion_opacity #pragma mapbox: initialize lowp float z_offset vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance_icon=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance_icon==APPEARANCE_ICON) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); #ifdef Z_OFFSET e+=a_auto_z_offset; #endif vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; #ifdef PROJECTION_GLOBE_VIEW mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; #else world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; #endif vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; #ifdef PROJECTION_GLOBE_VIEW vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; #else offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; #endif vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; #ifdef PROJECTION_GLOBE_VIEW #ifdef PROJECTED_POS_ON_VIEWPORT projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); #else vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); #endif #else projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); #endif highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); #ifdef TERRAIN #ifdef PITCH_WITH_MAP_TERRAIN vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); #endif #endif #ifdef Z_OFFSET z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; #else z+=u_pitch_with_map ? z_offset : 0.0; #endif float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); #ifdef DEPTH_OCCLUSION float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; #endif #ifdef OCCLUSION_QUERIES float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; #endif #ifdef Z_TEST_OCCLUSION out_fade_opacity*=occlusion_opacity; #endif float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else #ifdef ELEVATED_ROADS vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else pos=vec3(projected_pos.xy/projected_pos.w+offset,z); #endif #endif gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; #ifdef RENDER_TEXT_AND_SYMBOL is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; #endif #ifdef ICON_TRANSITION v_tex_b=a_texb/u_texsize; #endif #ifdef RENDER_SHADOWS vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef INDICATOR_CUTOUT v_z_offset=e; #else #ifdef RENDER_SHADOWS v_z_offset=e; #endif #endif }`),terrainRaster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif in vec2 v_pos0; #ifdef FOG in float v_fog_opacity; #endif #ifdef RENDER_SHADOWS in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #endif uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; #ifdef LIGHTING_3D_MODE const vec3 normal=vec3(0.0,0.0,1.0); #ifdef RENDER_SHADOWS float cutoffOpacity=1.0; #ifdef RENDER_CUTOFF cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); #endif #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; #else float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); #endif #else float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0; #endif #endif #else color=image_color; #endif #ifdef FOG #ifdef ZERO_EXAGGERATION color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #else color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); #endif #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; #ifdef FOG out float v_fog_opacity; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #endif void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); #ifdef FOG #ifdef ZERO_EXAGGERATION v_fog_pos=fog_position(decodedPos); #else v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); #endif #endif #ifdef RENDER_SHADOWS vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); #endif }`),terrainDepth:Xs("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Xs(`#include "_prelude_fog.fragment.glsl" in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; #ifdef FOG sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); #endif sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,Nk),skyboxGradient:Xs(`#include "_prelude_fog.fragment.glsl" in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); #ifdef FOG color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; #endif color*=u_opacity;glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,Nk),skyboxCapture:Xs(` in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; #define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) #define BETA_M vec3(21e-6,21e-6,21e-6) #define MIE_G 0.76 #define DENSITY_HEIGHT_SCALE_R 8000.0 #define DENSITY_HEIGHT_SCALE_M 1200.0 #define PLANET_RADIUS 6360e3 #define ATMOSPHERE_RADIUS 6420e3 #define SAMPLE_STEPS 10 #define DENSITY_STEPS 4 float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif uniform float u_far_z_cutoff;in vec2 v_pos0; #ifndef FOG uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; #endif void main() {vec4 color; #ifdef CUSTOM_ANTIALIASING highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); #else raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0; #else color=apply_lighting_ground(color); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos; #endif out vec2 v_pos0;void main() { #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; #else float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); #endif v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; #ifdef GLOBE_POLES vec3 up_vector=globe_derived_up_vector; #else vec3 up_vector=elevationVector(tile_pos); #endif float height=elevation(tile_pos);globe_pos+=up_vector*height; #ifndef GLOBE_POLES globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; #endif #ifdef GLOBE_POLES vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); #else vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); #endif gl_Position=u_proj_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif }`),globeAtmosphere:Xs(`#include "_prelude_fog.fragment.glsl" uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; #ifdef PROJECTION_GLOBE_VIEW globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { #ifdef ALPHA_PASS glFragColor=vec4(0,0,0,0);return; #else #ifdef NATIVE glFragColor=vec4(1,1,1,1); #else glFragColor=vec4(0,0,0,1); #endif return; #endif } #endif highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; #ifdef PROJECTION_GLOBE_VIEW highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); #else horizon_angle=horizon_angle_mercator; #endif horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb; #ifdef ALPHA_PASS float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); #else vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); #endif }`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; #endif #ifdef OCCLUSION_TEXTURE_TRANSFORM uniform vec4 u_occlusionTextureTransform; #endif #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute highp vec2 uv_2f #ifdef HAS_ATTRIBUTE_a_pbr in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; #endif #ifdef HAS_TEXTURE_u_baseColorTexture uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; #endif #ifdef HAS_TEXTURE_u_metallicRoughnessTexture uniform sampler2D u_metallicRoughnessTexture; #endif #ifdef HAS_TEXTURE_u_occlusionTexture uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; #endif #ifdef HAS_TEXTURE_u_normalTexture uniform sampler2D u_normalTexture; #endif #ifdef HAS_TEXTURE_u_emissionTexture uniform sampler2D u_emissionTexture; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; #ifdef DEPTH_D24 highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} #else highp float unpack_depth_rgba(highp vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; #ifdef FLIP_Y coord.y=1.0-coord.y; #endif #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depthTexture,coord).r); #else highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); #endif return v_depth > depth+0.0005;} #endif #define saturate(_x) clamp(_x,0.,1.) vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) { #ifdef LIGHTING_3D_MODE vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); #endif return apply_lighting(albedo,transformed_normal,lighting_factor); #else vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3; #endif }vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; #ifdef HAS_ATTRIBUTE_a_color_3f albedo*=vec4(color_3f,1.0); #endif #ifdef HAS_ATTRIBUTE_a_pbr #else #ifdef HAS_ATTRIBUTE_a_color_4f albedo*=color_4f; #endif #endif #if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} #ifdef UNPREMULT_TEXTURE_IN_SHADER if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; #endif if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} #endif vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { #ifdef HAS_TEXTURE_u_normalTexture highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y; #ifdef FLIP_Y T=-T;B=-B; #endif highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; #else return mat3(1.0); #endif }highp vec3 getNormal(){highp vec3 n; #ifdef HAS_ATTRIBUTE_a_normal_3f n=normalize(normal_3f); #else highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z)); #ifdef FLIP_Y n=normalize(cross(fdx,fdy)); #else n=normalize(cross(fdx,fdy))*-1.0; #endif #endif #if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); #endif return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; #ifdef HAS_ATTRIBUTE_a_pbr mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; #endif #if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; #endif const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) {float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) {return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) {float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) {highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) {float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) { #ifdef LIGHTING_3D_MODE return mat.diffuseColor; #else return mat.diffuseColor/PI; #endif }vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) {vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) {vec3 env_light=vec3(0.65,0.65,0.65); #ifdef LIGHTING_3D_MODE float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; #endif vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) {highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=NdotL; #endif vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; #if !defined(LIGHTING_3D_MODE) const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); #endif color*=intensityFactor;return color;}void main() { #ifdef TERRAIN_FRAGMENT_OCCLUSION if (isOccluded()) {discard;} #endif vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; #ifdef LIGHTING_3D_MODE lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; #endif vec4 finalColor; #ifdef DIFFUSE_SHADED vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); #ifdef HAS_TEXTURE_u_occlusionTexture float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; #endif finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; #else Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; #if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) #ifdef OCCLUSION_TEXTURE_TRANSFORM vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; #else vec2 uv=uv_2f; #endif ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; #endif vec4 emissive=u_emissiveFactor; #if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); #endif #ifdef APPLY_LUT_ON_GPU float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; #endif color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; #ifdef HAS_ATTRIBUTE_a_pbr float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; #ifdef APPLY_LUT_ON_GPU color_mix=applyLUT(u_lutTexture,color_mix); #endif color=mix(color,color_mix,min(1.0,resEmission)); #ifdef HAS_ATTRIBUTE_a_color_4f float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); #endif #endif vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); #endif #ifdef FOG finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); #endif #ifdef RENDER_CUTOFF finalColor*=v_cutoff_opacity; #endif #ifdef INDICATOR_CUTOUT finalColor=applyCutout(finalColor,v_position_height.w); #endif #ifdef FEATURE_CUTOUT finalColor=apply_feature_cutout(finalColor,gl_FragCoord); #endif glFragColor=finalColor; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f; #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr #pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_normal_matrix; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; #endif out vec4 v_position_height;out lowp vec4 v_color_mix; #ifdef TERRAIN_FRAGMENT_OCCLUSION out highp float v_depth; #endif #ifdef HAS_ATTRIBUTE_a_pbr out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; #endif vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute-custom highp vec4 pbr #pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength highp mat4 normal_matrix; #ifdef INSTANCED_ARRAYS normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else normal_matrix=u_normal_matrix; #endif vec3 local_pos;mat3 rs; #ifdef MODEL_POSITION_ON_GPU vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; #else local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); #endif v_position_height.w=a_pos_3f.z; #ifdef HAS_ATTRIBUTE_a_pbr vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; #endif #ifdef FOG v_fog_pos=fog_position(local_pos); #endif #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION v_depth=gl_Position.z/gl_Position.w; #ifdef CLIP_ZERO_TO_ONE v_depth=-1.0+2.0*v_depth; #endif #endif #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); #else normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); #endif #endif #ifdef HAS_ATTRIBUTE_a_pbr #ifdef HAS_ATTRIBUTE_a_color_4f v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); #endif #endif #ifdef RENDER_SHADOWS vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); #ifdef NORMAL_OFFSET #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #else vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #endif #endif #endif v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; #endif }`),modelDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; #ifdef MODEL_POSITION_ON_GPU #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_instance; #endif uniform highp mat4 u_node_matrix; #endif void main() { #ifdef MODEL_POSITION_ON_GPU highp mat4 instance; #ifdef INSTANCED_ARRAYS instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else instance=u_instance; #endif vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); #else gl_Position=u_matrix*vec4(a_pos_3f,1); #endif v_depth=gl_Position.z/gl_Position.w;}`),stars:Xs(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) {float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Xs("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; uniform float u_horizontalOscillationRate; uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:Xs("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity; uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:Xs("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:Xs("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; #ifdef TERRAIN float e=elevation(world_pos.xy);world_pos.z+=e; #endif vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function zm(_,d){const m=_.split(` `);for(let w of m){if(w=w.trimStart(),w[0]!=="#"||!w.includes("if")||w.startsWith("#endif"))continue;const M=w.match(V3);if(M)for(const O of M)Zg.has(O)||d.add(O)}}function Xs(_,d){const m=new Set,w=[],M=[];_=_.replace(Sv,(D,B)=>(M.push(B),"")),d=d.replace(Sv,(D,B)=>(w.push(B),""));let O=new Set(Yg);zm(_,O),zm(d,O);for(const D of[...w,...M])Tk[D]||(Tk[D]=new Set,zm(Fm[D],Tk[D])),O=new Set([...O,...Tk[D]]);return{fragmentSource:_=_.replace(gf,(D,B,V,Y,Q)=>(m.add(Q),B==="define"?` #ifndef HAS_UNIFORM_u_${Q} in ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${Q} ${V} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} ${Q}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(gf,(D,B,V,Y,Q)=>{const ce=`MATERIAL_ATTRIBUTE_OFFSET_${Q}`,oe=Y==="float"?"vec2":Y,ue=`GET_ATTRIBUTE_${oe}(a_${Q}, materialInfo, ${ce})`,ke=Q.match(/color/)?"color":oe;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; #endif `:m.has(Q)?B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${oe} a_${Q}; #endif out ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize"?ke==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} ${Q} = a_${Q}; #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #if !defined(HAS_UNIFORM_u_${Q}) #ifdef ${ce} ${Q} = unpack_mix_${ke}(${ue}, u_${Q}_t); #else ${Q} = unpack_mix_${ke}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; out ${V} ${Y} ${Q}; #endif `:B==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${Q} = a_${Q}; #endif `:void 0:B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${oe} a_${Q}; #endif #else uniform ${V} ${Y} u_${Q}; #endif `:B==="define-instanced"?ke==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${Q}0; in vec4 a_${Q}1; in vec4 a_${Q}2; in vec4 a_${Q}3; #else uniform ${V} ${Y} u_${Q}; #endif `:` #ifdef INSTANCED_ARRAYS in ${V} ${oe} a_${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${V} ${Y} ${Q} = a_${Q}; #endif `:ke==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = ${ue}; #else ${V} ${Y} ${Q} = a_${Q}; #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = unpack_mix_${ke}(${ue}, u_${Q}_t); #else ${V} ${Y} ${Q} = unpack_mix_${ke}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `}),usedDefines:O,vertexIncludes:w,fragmentIncludes:M}}class Qie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,m,w,M,O,D,B,V){this.context=d;let Y=this.boundPaintVertexBuffers.length!==M.length;for(let ce=0;!Y&&ce{const xt=Ze.paint.get("hillshade-shadow-color"),ct=Ze.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",pt=Ze.paint.get("hillshade-highlight-color"),lt=Ze.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",st=Ze.paint.get("hillshade-accent-color"),wt=Ze.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Ot=Ze.paint.get("hillshade-emissive-strength");let Pt=a.an(Ze.paint.get("hillshade-illumination-direction"));if(Ze.paint.get("hillshade-illumination-anchor")==="viewport")Pt-=Pe.transform.angle;else if(Pe.style&&Pe.style.enable3dLights()&&Pe.style.directionalLight){const Wt=Pe.style.directionalLight.properties.get("direction"),sr=a.d4(Wt.x,Wt.y,Wt.z);Pt=a.an(sr[1])}const Vt=!Pe.options.moving;return{u_matrix:He||Pe.transform.calculateProjMatrix(qe.tileID.toUnwrapped(),Vt),u_image:0,u_latrange:Jie(0,qe.tileID),u_light:[Ze.paint.get("hillshade-exaggeration"),Pt],u_shadow:xt.toPremultipliedRenderColor(ct?null:Ze.lut),u_highlight:pt.toPremultipliedRenderColor(lt?null:Ze.lut),u_emissive_strength:Ot,u_accent:st.toPremultipliedRenderColor(wt?null:Ze.lut)}})(_,m,w,_.terrain?d.projMatrix:null);_.uploadCommonUniforms(B,oe,d.toUnwrapped());const{tileBoundsBuffer:ke,tileBoundsIndexBuffer:_e,tileBoundsSegments:Le}=_.getTileBoundsBuffers(m);oe.draw(_,V.TRIANGLES,M,O,D,Bn.disabled,ue,w.id,ke,_e,Le)}function W3(_,d,m){if(!d.needsDEMTextureUpload)return;const w=_.context,M=w.gl;w.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||_.getTileTexture(m.stride);const O=m.getPixels();d.demTexture?d.demTexture.update(O,{premultiply:!1}):d.demTexture=new a.T(w,O,M.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function tae(_,d,m){const w=_.context,M=w.gl;if(!d.dem)return;const O=d.dem;if(w.activeTexture.set(M.TEXTURE1),W3(_,d,O),!d.demTexture)return;d.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);const D=O.dim;w.activeTexture.set(M.TEXTURE0);let B=d.hillshadeFBO;if(!B){const oe=new a.T(w,{width:D,height:D,data:null},M.RGBA8);oe.bind(M.LINEAR,M.CLAMP_TO_EDGE),B=d.hillshadeFBO=w.createFramebuffer(D,D,1,"renderbuffer"),B.colorAttachment0.set(oe.texture)}w.bindFramebuffer.set(B.framebuffer),w.viewport.set([0,0,D,D]);const{tileBoundsBuffer:V,tileBoundsIndexBuffer:Y,tileBoundsSegments:Q}=_.getMercatorTileBoundsBuffers(),ce=[];_.linearFloatFilteringSupported()&&ce.push("TERRAIN_DEM_FLOAT_FORMAT"),_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ce.push("USE_MRT1"),_.getOrCreateProgram("hillshadePrepare",{defines:ce}).draw(_,M.TRIANGLES,un.disabled,$n.disabled,is.unblended,Bn.disabled,((oe,ue)=>{const ke=ue.stride,_e=a.bC();return a.ce(_e,0,a.al,-a.al,0,0,1),a.br(_e,_e,[0,-a.al,0]),{u_matrix:_e,u_image:1,u_dimension:[ke,ke],u_zoom:oe.overscaledZ}})(d.tileID,O),m.id,V,Y,Q),d.needsHillshadePrepare=!1}class ja{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class rae extends ja{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class nP extends ja{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class G3 extends ja{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class Ek extends ja{getDefault(){return[!0,!0,!0,!0]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class K3 extends ja{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class Xg extends ja{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Ty extends ja{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const m=this.current;(d.func!==m.func||d.ref!==m.ref||d.mask!==m.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class Cv extends ja{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class Ay extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.STENCIL_TEST):m.disable(m.STENCIL_TEST),this.current=d,this.dirty=!1}}class sP extends ja{getDefault(){return[0,1]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class Z3 extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),this.current=d,this.dirty=!1}}class iP extends ja{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Ey extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.BLEND):m.disable(m.BLEND),this.current=d,this.dirty=!1}}class Ik extends ja{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Pk extends ja{getDefault(){return a.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class Y3 extends ja{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(d,d),this.current=d,this.dirty=!1)}}class Lk extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.CULL_FACE):m.disable(m.CULL_FACE),this.current=d,this.dirty=!1}}class Mv extends ja{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class aP extends ja{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let oP=class extends ja{getDefault(){return null}set(_){(_!==this.current||this.dirty)&&(this.gl.useProgram(_),this.current=_,this.dirty=!1)}};class lP extends ja{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class Iy extends ja{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class cP extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class nae extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class sae extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindTexture(m.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class iae extends ja{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindBuffer(m.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class X3 extends ja{getDefault(){return null}set(d){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class Q3 extends ja{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class J3 extends ja{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class e5 extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class dP extends ja{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Ok extends ja{constructor(d,m){super(d),this.context=d,this.parent=m}getDefault(){return null}}class Dk extends Ok{constructor(d,m,w=0){super(d,m),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+w}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachmentPoint,m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class Py extends Ok{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferRenderbuffer(m.FRAMEBUFFER,this.attachment(),m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Tv extends Ok{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachment(),m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class uP extends Py{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const cu=(_,d,m,w)=>({u_matrix:_,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:m,u_emissive_texture_available:w}),Rk=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le)=>({u_proj_matrix:Float32Array.from(_),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(w),u_merc_matrix:m,u_zoom_transition:M,u_merc_center:O,u_image0:0,u_image1:1,u_frustum_tl:D,u_frustum_tr:B,u_frustum_br:V,u_frustum_bl:Y,u_globe_pos:Q,u_globe_radius:ce,u_viewport:oe,u_grid_matrix:Le?Float32Array.from(Le):new Float32Array(9),u_skirt_height:ue,u_far_z_cutoff:ke,u_emissive_texture_available:_e});function Av(_,d){return _!=null&&d!=null&&!(!_.hasData()||!d.hasData())&&_.demTexture!=null&&d.demTexture!=null&&_.tileID.key!==d.tileID.key}const vp=new class{constructor(){this.operations={}}newMorphing(_,d,m,w,M){if(_ in this.operations){const O=this.operations[_];O.to.tileID.key!==m.tileID.key&&(O.queued=m)}else this.operations[_]={startTime:w,phase:0,duration:M,from:d,to:m,queued:null}}getMorphValuesForProxy(_){if(!(_ in this.operations))return null;const d=this.operations[_];return{from:d.from,to:d.to,phase:d.phase}}update(_){for(const d in this.operations){const m=this.operations[d];for(m.phase=(_-m.startTime)/m.duration;m.phase>=1||!this._validOp(m);)if(!this._nextOp(m,_)){delete this.operations[d];break}}}_nextOp(_,d){return!!_.queued&&(_.from=_.to,_.to=_.queued,_.queued=null,_.phase=0,_.startTime=d,!0)}_validOp(_){return _.from.hasData()&&_.to.hasData()}},Fk={0:null,1:"TERRAIN_VERTEX_MORPHING"};function zk(_,d,m){if(d===0)return 0;const w=d<1&&m===514?.25/d:1;return 6*Math.pow(1.5,22-_)*Math.max(d,1)*w}function t5(_,d){const m=1<<_.z;return!d&&(_.x===0||_.x===m-1)||_.y===0||_.y===m-1}function Ly(_,d){if(!_.style||!_.style.enable3dLights())return;const m=_.context,w=m.gl;m.activeTexture.set(w.TEXTURE1),d?d.bind(w.LINEAR,w.CLAMP_TO_EDGE):_.emptyTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE)}const Ev=_=>({u_matrix:_});function Iv(_,d,m,w,M){if(M>0){const O=a.o.now(),D=(O-_.timeAdded)/M,B=d?(O-d.timeAdded)/M:-1,V=m.getSource(),Y=w.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Q=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(_.tileID.overscaledZ-Y),ce=Q&&_.refreshedUponExpiration?1:a.aA(Q?D:1-B,0,1);return d?{opacity:1,mix:1-ce,isFading:D<1}:{opacity:ce,mix:0,isFading:D<1}}return{opacity:1,mix:0,isFading:!1}}class Bk extends Yc{constructor(d){const m=Bo("mock-dem",{type:"raster-dem",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("mock-dem",m,!1),m.setEventedParent(this),this._sourceLoaded=!0}_loadTile(d,m){d.state="loaded",m(null)}}class r5 extends Yc{constructor(d){const m=Bo("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",m,!1),m.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,m,w){if(d.freezeTileCoverage)return;this.transform=d;const M=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((O,D)=>{if(O[D.key]="",!this._tiles[D.key]){const B=new fp(D,this._source.tileSize*D.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);B.state="loaded",this._tiles[D.key]=B}return O},{});for(const O in this._tiles)O in M||(this.freeFBO(O),this._tiles[O].unloadVectorData(),delete this._tiles[O])}freeFBO(d){const m=this.proxyCachedFBO[d];if(m!==void 0){const w=Object.values(m);this.renderCachePool.push(...w),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class n5 extends a.aQ{constructor(d,m,w){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=m,this.projMatrix=w}}class s5 extends a.bV{constructor(d,m){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[w,M,O]=function(V){const Y=new a.bd,Q=new a.b0,ce=131;Y.reserve(17161),Q.reserve(33800);const oe=a.al/128,ue=a.al+oe/2,ke=ue+oe;for(let Le=-oe;Leue||Le<0||Le>ue?24575:0,Ze=a.aA(Math.round(Pe),0,a.al),He=a.aA(Math.round(Le),0,a.al);Y.emplaceBack(Ze+qe,He)}const _e=(Le,Pe)=>{const qe=Pe*ce+Le;Q.emplaceBack(qe+1,qe,qe+ce),Q.emplaceBack(qe+ce,qe+ce+1,qe+1)};for(let Le=1;Le<129;Le++)for(let Pe=1;Pe<129;Pe++)_e(Pe,Le);return[0,129].forEach(Le=>{for(let Pe=0;Pe<130;Pe++)_e(Pe,Le),_e(Le,Pe)}),[Y,Q,32768]}(),D=d.context;this.gridBuffer=D.createVertexBuffer(w,a.bf.members),this.gridIndexBuffer=D.createIndexBuffer(M),this.gridSegments=a.bg.simpleSegment(0,0,w.length,M.length),this.gridNoSkirtSegments=a.bg.simpleSegment(0,0,w.length,O),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new r5(m.map),this.orthoMatrix=a.bC(),a.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,a.al,0,a.al,0,1);const B=D.gl;this._overlapStencilMode=new $n({func:B.GEQUAL,mask:255},0,255,B.KEEP,B.KEEP,B.REPLACE),this._previousZoom=d.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=m,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Bk(m.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(d){d.on("data",this._onStyleDataEvent.bind(this)),this._style=d,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(d,m,w){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const M=d.terrain.properties,O=d.terrain.drapeRenderMode===0,D=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=a.o.now();const B=d.terrain&&d.terrain.scope,V=M.get("source"),Y=O?this._mockSourceCache:d.getSourceCache(V,B);if(!Y)return void a.w(`Couldn't find terrain source "${V}".`);if(this.sourceCache=Y,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=D?this.calculateExaggeration(m):M.get("exaggeration"),!m.projection.requiresDraping&&D&&this._exaggeration===0)return void this._disable();this.enabled=!0;const Q=()=>{this.sourceCache.used&&a.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const ce=this.getScaledDemTileSize();this.sourceCache.update(m,ce,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,Q(),this._initializing=!0),Q(),m.updateElevation(!0,w),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(m),this._emptyDEMTextureDirty=!0,this._previousZoom=m.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const m=this._previousCameraAltitude,w=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=w;const M=m!=null?w-m:Number.MAX_VALUE;if(Math.abs(M)<2)return this._exaggeration;const O=d.zoom,D=this._style.terrain;if(!this._previousUpdateTimestamp)return D.getExaggeration(O);let B=O-this._previousZoom;const V=this._previousUpdateTimestamp;let Y=O;this._evaluationZoom!=null&&(Y=this._evaluationZoom,Math.abs(O-Y)>.5&&(B=.5*(O-Y+B)),B*M<0&&(Y+=B)),this._evaluationZoom=Y;const Q=D.getExaggeration(Y),ce=Q===D.getExaggeration(Math.max(0,Y-.1));if(ce&&Math.abs(Q-this._exaggeration)<.01)return Q;let oe=Math.min(.1,.00375*(this._updateTimestamp-V));return(ce||Q<.1||Math.abs(B)<1e-4)&&(oe=Math.min(.2,4*oe)),a.ak(this._exaggeration,Q,oe)}resetTileLookupCache(d){this._findCoveringTileCache[d]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(d){d.dataType==="source"&&d.coord?this._clearRenderCacheForTile(d.sourceCacheId,d.coord):d.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 d in this._style._mergedSourceCaches)this._style._mergedSourceCaches[d].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(d=>d.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 d=2*this.proxySourceCache.getSource().tileSize;return[d,d]}set useVertexMorphing(d){this._useVertexMorphing=d}updateTileBinding(d){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const m=this.proxySourceCache,w=this.painter.transform;this._initializing&&(this._initializing=w._centerAltitude===0&&this.getAtPointOrZero(a.ae.fromLngLat(w.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const M=this.proxyCoords=m.getIds().map(V=>{const Y=m.getTileByID(V).tileID;return Y.projMatrix=w.calculateProjMatrix(Y.toUnwrapped()),Y});(function(V,Y){const Q=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),ce=new a.P(Q.x,Q.y);V.sort((oe,ue)=>{if(ue.overscaledZ-oe.overscaledZ)return ue.overscaledZ-oe.overscaledZ;const ke=new a.P(oe.canonical.x+(1<{this.proxyToSource[V.key]={}}),this.terrainTileForTile={};const D=this._style._mergedSourceCaches;for(const V in D){const Y=D[V];if(!Y.used||(Y!==this.sourceCache&&this.resetTileLookupCache(Y.id),this._setupProxiedCoordsForOrtho(Y,d[V],O),Y.usedForTerrain))continue;const Q=d[V];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(Q)}this.proxiedCoords[m.id]=M.map(V=>new n5(V,V.key,this.orthoMatrix)),this._assignTerrainTiles(M),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(O),this.renderingToTexture=!1;const B={};this._visibleDemTiles=[];for(const V of this.proxyCoords){const Y=this.terrainTileForTile[V.key];if(!Y)continue;const Q=Y.tileID.key;Q in B||(this._visibleDemTiles.push(Y),B[Q]=Q)}}_assignTerrainTiles(d){this._initializing||d.forEach(m=>{if(this.terrainTileForTile[m.key])return;const w=this._findTileCoveringTileID(m,this.sourceCache);w&&(this.terrainTileForTile[m.key]=w)})}_prepareDEMTextures(){const d=this.painter.context,m=d.gl;for(const w in this.terrainTileForTile){const M=this.terrainTileForTile[w],O=M.dem;!O||M.demTexture&&!M.needsDEMTextureUpload||(d.activeTexture.set(m.TEXTURE1),W3(this.painter,M,O))}}_prepareDemTileUniforms(d,m,w,M){if(!m||m.demTexture==null)return!1;const O=d.tileID.canonical,D=Math.pow(2,m.tileID.canonical.z-O.z),B=M||"";return w[`u_dem_tl${B}`]=[O.x*D%1,O.y*D%1],w[`u_dem_scale${B}`]=D,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const m=this._visibleDemTiles.reduce((w,M)=>{if(!M.dem)return w;const O=M.dem.tree.minimums[0];return O>0&&d++,w+O},0);return d?m/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,m=d.gl;d.activeTexture.set(m.TEXTURE2);const w=this._getLoadedAreaMinimum(),M=new a.dL({width:1,height:1},new Float32Array([w]));this._emptyDEMTextureDirty=!1;let O=this._emptyDEMTexture;return O?O.update(M,{premultiply:!1}):O=this._emptyDEMTexture=new a.T(d,M,m.R32F,{premultiply:!1}),O}setupElevationDraw(d,m,w){const M=this.painter.context,O=M.gl,D={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};D.u_exaggeration=this.exaggeration();let B=null,V=null,Y=1;if(w&&w.morphing&&this._useVertexMorphing){const ue=w.morphing.srcDemTile,ke=w.morphing.dstDemTile;Y=w.morphing.phase,ue&&ke&&(this._prepareDemTileUniforms(d,ue,D,"_prev")&&(V=ue),this._prepareDemTileUniforms(d,ke,D)&&(B=ke))}const Q=ue=>ue&&ue.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let ce=null;var oe;if(this.enabled?V&&B?(ce=B.demTexture,M.activeTexture.set(O.TEXTURE4),V.demTexture.bind(Q(V),O.CLAMP_TO_EDGE),D.u_dem_lerp=Y):(B=this.terrainTileForTile[d.tileID.key],ce=this._prepareDemTileUniforms(d,B,D)?B.demTexture:this.emptyDEMTexture):ce=this.emptyDEMTexture,M.activeTexture.set(O.TEXTURE2),ce&&(D.u_dem_size=(oe=ce).size[0]===1?1:oe.size[0]-2,ce.bind(Q(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(w&&w.useDepthForOcclusion,m,D),w&&w.useMeterToDem&&B){const ue=(1<{if(Pe===Wt)return;const sr=[Fk[Wt],"PROJECTION_GLOBE_VIEW"];Ze&&sr.push("CUSTOM_ANTIALIASING");const br=Y.isTileAffectedByFog(Vt);Le=Y.getOrCreateProgram("globeRaster",{defines:sr,overrideFog:br}),Pe=Wt},xt=Y.colorModeForRenderPass(),ct=new un(_e.LEQUAL,un.ReadWrite,Y.depthRangeFor3D);vp.update(ue);const pt=a.dF(qe),lt=[a.aF(qe.center.lng),a.aJ(qe.center.lat)],st=Y.globeSharedBuffers,wt=[qe.width*a.o.devicePixelRatio,qe.height*a.o.devicePixelRatio],Ot=Float32Array.from(qe.globeMatrix),Pt={useDenormalizedUpVectorScale:!0};{const Vt=Y.transform,Wt=zk(Vt.zoom,Q.exaggeration(),Q.sourceCache._source.tileSize);Pe=-1;const sr=_e.TRIANGLES;for(const br of oe){const zt=ce.getTile(br),Mt=$n.disabled,Xt=Q.prevTerrainTileForTile[br.key],qt=Q.terrainTileForTile[br.key];Av(Xt,qt)&&vp.newMorphing(br.key,Xt,qt,ue,250),Ly(Y,zt.emissiveTexture),ke.activeTexture.set(_e.TEXTURE0),zt.texture&&zt.texture.bind(_e.LINEAR,_e.CLAMP_TO_EDGE);const ur=vp.getMorphValuesForProxy(br.key),Er=ur?1:0;ur&&Object.assign(Pt,{morphing:{srcDemTile:ur.from,dstDemTile:ur.to,phase:a.dD(ur.phase)}});const Gr=a.dG(br.canonical),Sr=a.dH(Gr.getCenter().lat),wr=a.dI(br.canonical,Gr,Sr,Vt.worldSize/Vt._pixelsPerMercatorPixel),on=a.bk(a.dJ(br.canonical)),en=Y.emissiveMode==="mrt-fallback"?1:0,$r=Rk(Vt.expandedFarZProjMatrix,Ot,pt,on,a.aj(Vt.zoom),lt,Vt.frustumCorners.TL,Vt.frustumCorners.TR,Vt.frustumCorners.BR,Vt.frustumCorners.BL,Vt.globeCenterInViewSpace,Vt.globeRadius,wt,Wt,Vt._farZ,en,wr);if(He(br,Er),Le&&(Q.setupElevationDraw(zt,Le,Pt),Y.uploadCommonUniforms(ke,Le,br.toUnwrapped()),st)){const[Kr,Nn,Yn]=st.getGridBuffers(Sr,Wt!==0);Le.draw(Y,sr,ct,Mt,xt,Bn.backCCW,$r,"globe_raster",Kr,Nn,Yn)}}}if(st&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const Vt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Ze&&Vt.push("CUSTOM_ANTIALIASING"),Le=Y.getOrCreateProgram("globeRaster",{defines:Vt});for(const Wt of oe){const{x:sr,y:br,z:zt}=Wt.canonical,Mt=br===0,Xt=br===(1<Kr.draw(Y,_e.TRIANGLES,ct,$n.disabled,xt,Bn.disabled,Rk(qe.expandedFarZProjMatrix,wr,wr,on,0,lt,qe.frustumCorners.TL,qe.frustumCorners.TR,qe.frustumCorners.BR,qe.frustumCorners.BL,qe.globeCenterInViewSpace,qe.globeRadius,wt,0,qe._farZ,en),"globe_pole_raster",Nn,Er,Gr);Q.setupElevationDraw(Sr,Le,Pt),Y.uploadCommonUniforms(ke,Le,Wt.toUnwrapped()),Mt&&Y.renderDefaultNorthPole&&$r(Le,qt),Xt&&Y.renderDefaultSouthPole&&(wr=a.cS(a.bC(),wr,[1,-1,1]),$r(Le,ur))}}}})(M,O,D,B,V);else{const Y=M.context,Q=Y.gl;let ce,oe;const ue=M.shadowRenderer,ke=Lm(M,M.longestCutoffRange),_e=xt=>{if(oe===xt)return;const ct=[];ct.push(Fk[xt]),ke.shouldRenderCutoff&&ct.push("RENDER_CUTOFF"),ue&&(ct.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ue.useNormalOffset&&ct.push("NORMAL_OFFSET")),ce=M.getOrCreateProgram("terrainRaster",{defines:ct}),oe=xt},Le=M.colorModeForRenderPass(),Pe=new un(Q.LEQUAL,un.ReadWrite,M.depthRangeFor3D);vp.update(V);const qe=M.transform,Ze=zk(qe.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let He=[0,0,0];if(ue){const xt=M.style.directionalLight,ct=M.style.ambientLight;xt&&ct&&(He=yp(M.style,xt,ct))}{oe=-1;const xt=Q.TRIANGLES,[ct,pt]=[O.gridIndexBuffer,O.gridSegments];for(const lt of B){const st=D.getTile(lt),wt=$n.disabled,Ot=O.prevTerrainTileForTile[lt.key],Pt=O.terrainTileForTile[lt.key];Av(Ot,Pt)&&vp.newMorphing(lt.key,Ot,Pt,V,250),Ly(M,st.emissiveTexture),Y.activeTexture.set(Q.TEXTURE0),st.texture&&st.texture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const Vt=vp.getMorphValuesForProxy(lt.key),Wt=Vt?1:0;let sr;Vt&&(sr={morphing:{srcDemTile:Vt.from,dstDemTile:Vt.to,phase:a.dD(Vt.phase)}});const br=M.emissiveMode==="mrt-fallback"?1:0,zt=cu(lt.projMatrix,t5(lt.canonical,qe.renderWorldCopies)?Ze/10:Ze,He,br);if(_e(Wt),!ce)continue;O.setupElevationDraw(st,ce,sr);const Mt=lt.toUnwrapped();ue&&ue.setupShadows(Mt,ce),M.uploadCommonUniforms(Y,ce,Mt,null,ke),ce.draw(M,xt,Pe,wt,Le,Bn.backCCW,zt,"terrain_raster",O.gridBuffer,ct,pt)}}}}(m,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,m.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const m=this.painter,w=this.painter.context,M=this.proxySourceCache,O=this.proxiedCoords[M.id],D=this._drapedRenderBatches.shift(),B=m.style.order,V=[];this._updateFBOs(m.emissiveMode==="mrt-fallback");let Y=0;for(const Q of O){const ce=M.getTileByID(Q.proxyTileKey),oe=M.proxyCachedFBO[Q.key]?M.proxyCachedFBO[Q.key][d]:void 0,ue=oe!==void 0?M.renderCache[oe]:this.pool[Y++],ke=oe!==void 0;if(ce.texture=ue.tex,ce.emissiveTexture=ue.emissiveTex,ke&&!ue.dirty){V.push(ce.tileID);continue}w.bindFramebuffer.set(ue.fb.framebuffer);const _e=w.gl;let Le;_e.drawBuffers(m.emissiveMode==="mrt-fallback"?[_e.COLOR_ATTACHMENT0,_e.COLOR_ATTACHMENT1]:[_e.COLOR_ATTACHMENT0]),this.renderedToTile=!1,ue.dirty&&(w.clear({color:a.ao.transparent,stencil:0}),ue.dirty=!1);for(let Pe=D.start;Pe<=D.end;++Pe){const qe=m.style._mergedLayers[B[Pe]];if(qe.isHidden(m.transform.zoom))continue;const Ze=m.style.getLayerSourceCache(qe),He=Ze?this.proxyToSource[Q.key][Ze.id]:[Q];if(!He)continue;const xt=He;w.viewport.set([0,0,ue.fb.width,ue.fb.height]),Le!==(Ze?Ze.id:null)&&(this._setupStencil(ue,He,qe,Ze),Le=Ze?Ze.id:null),m.renderLayer(m,Ze,qe,xt)}if(_e.drawBuffers([_e.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Pe of this._pendingGroundEffectLayers){const qe=m.style._mergedLayers[B[Pe]];if(qe.isHidden(m.transform.zoom))continue;const Ze=m.style.getLayerSourceCache(qe),He=Ze?this.proxyToSource[Q.key][Ze.id]:[Q];if(!He)continue;const xt=He;w.viewport.set([0,0,ue.fb.width,ue.fb.height]),Le!==(Ze?Ze.id:null)&&(this._setupStencil(ue,He,qe,Ze),Le=Ze?Ze.id:null),m.renderLayer(m,Ze,qe,xt)}this.renderedToTile?(ue.dirty=!0,V.push(ce.tileID)):ke||--Y,Y===5&&(Y=0,this.renderToBackBuffer(V))}return this.renderToBackBuffer(V),this.renderingToTexture=!1,w.bindFramebuffer.set(null),w.viewport.set([0,0,m.width,m.height]),D.end+1}postRender(){}isLayerOrderingCorrect(d){const m=d.order.length;let w=-1,M=m;for(let O=0;Ow}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(m=>m.dem).forEach(m=>{d=Math.min(d,m.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,m,w){if(!this._visibleDemTiles)return null;const M=this._visibleDemTiles.filter(O=>O.dem).map(O=>{const D=O.tileID,B=1<(O.t!==null?O.t:Number.MAX_VALUE)-(D.t!==null?D.t:Number.MAX_VALUE));for(const O of M){if(O.t==null)return null;const D=O.tile.dem.tree.raycast(O.minx,O.miny,O.maxx,O.maxy,d,m,w);if(D!=null)return D}return null}_createFBO(){const d=this.painter.context,m=d.gl,w=this.drapeBufferSize;d.activeTexture.set(m.TEXTURE0);const M=new a.T(d,{width:w[0],height:w[1],data:null},m.RGBA8);M.bind(m.LINEAR,m.CLAMP_TO_EDGE);const O=d.createFramebuffer(w[0],w[1],1,null);let D;return O.colorAttachment0.set(M.texture),this._emissiveTexture&&(D=new a.T(d,{width:w[0],height:w[1],data:null},m.R8),D.bind(m.LINEAR,m.CLAMP_TO_EDGE),O.createColorAttachment(d,1),O.colorAttachment1.set(D.texture)),O.depthAttachment=new uP(d,O.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,w[0],w[1]),this._stencilRef=0,O.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):O.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&m.texParameterf(m.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:O,tex:M,emissiveTex:D,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const m of this.pool)this._updateFBO(m,d);for(const m of this.proxySourceCache.renderCache)this._updateFBO(m,d);this._emissiveTexture=d}}_updateFBO(d,m){const w=d.fb,M=this.painter.context,O=M.gl,D=this.drapeBufferSize;if(m){const B=new a.T(M,{width:D[0],height:D[1],data:null},O.R8);B.bind(O.LINEAR,O.CLAMP_TO_EDGE),d.emissiveTex=B,w.createColorAttachment(M,1),w.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,w.removeColorAttachment(M,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const m=this._style._mergedLayers[d],w=m.isHidden(this.painter.transform.zoom);return m.type==="hillshade"||m.type==="custom"?!w&&m.shouldRedrape():!w&&m.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const w of this._style.getSources())if(w instanceof dp){d=!0;break}if(!d)return;const m={};for(let w=0;wV>B.end)||a.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=w}_setupRenderCache(d){const m=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,m.renderCache.length>m.renderCachePool.length){const D=Object.values(m.proxyCachedFBO);m.proxyCachedFBO={};for(let B=0;B=0;D--){const B=w[D];if(m.getTileByID(B.key),m.proxyCachedFBO[B.key]!==void 0){const V=d[B.key],Y=this.proxyToSource[B.key];let Q=0;for(const ce in Y){const oe=Y[ce],ue=V[ce];if(!ue||ue.length!==oe.length||oe.some((ke,_e)=>ke!==ue[_e]||M[ce]&&M[ce].hasOwnProperty(ke.key))){Q=-1;break}++Q}for(const ce in m.proxyCachedFBO[B.key])m.renderCache[m.proxyCachedFBO[B.key][ce]].dirty=Q<0||Q!==Object.values(V).length}}const O=[...this._drapedRenderBatches];O.sort((D,B)=>B.end-B.start-(D.end-D.start));for(const D of O)for(const B of w){if(m.proxyCachedFBO[B.key])continue;let V=m.renderCachePool.pop();V===void 0&&m.renderCache.length<50&&(V=m.renderCache.length,m.renderCache.push(this._createFBO())),V!==void 0&&(m.proxyCachedFBO[B.key]={},m.proxyCachedFBO[B.key][D.start]=V,m.renderCache[V].dirty=!0)}this._tilesDirty={}}_setupStencil(d,m,w,M){if(!M||!this._sourceTilesOverlap[M.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const O=this.painter.context,D=O.gl;if(m.length<=1)return void(this._overlapStencilType=!1);let B;if(w.isTileClipped())B=m.length,this._overlapStencilMode.test={func:D.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(m[0].overscaledZ>m[m.length-1].overscaledZ))return void(this._overlapStencilType=!1);B=1,this._overlapStencilMode.test={func:D.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+B>255&&(O.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=B,this._overlapStencilMode.ref=this._stencilRef,w.isTileClipped()&&this._renderTileClippingMasks(m,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(d){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[d.key]),this._overlapStencilMode):$n.disabled}_renderTileClippingMasks(d,m){const w=this.painter,M=this.painter.context,O=M.gl;w._tileClippingMaskIDs={},M.setColorMode(is.disabled),M.setDepthMode(un.disabled);const D=w.getOrCreateProgram("clippingMask");for(const B of d){const V=w._tileClippingMaskIDs[B.key]=--m;D.draw(w,O.TRIANGLES,un.disabled,new $n({func:O.ALWAYS,mask:0},V,255,O.KEEP,O.KEEP,O.REPLACE),is.disabled,Bn.disabled,Ev(B.projMatrix),"$clipping",w.tileExtentBuffer,w.quadTriangleIndexBuffer,w.tileExtentSegments)}}pointCoordinate(d){const m=this.painter.transform;if(d.x<0||d.x>m.width||d.y<0||d.y>m.height)return null;const w=[d.x,d.y,1,1];a.aC(w,w,m.pixelMatrixInverse),a.cK(w,w,1/w[3]),w[0]/=m.worldSize,w[1]/=m.worldSize;const M=m._camera.position,O=a.cf(1,m.center.lat),D=[M[0],M[1],M[2]/O,0],B=a.da([],w.slice(0,3),D);a.aw(B,B);const V=this.raycast(D,B,this._exaggeration);return V!==null&&V?(a.bH(D,D,B,V),D[3]=D[2],D[2]*=O,D):null}_setupProxiedCoordsForOrtho(d,m,w){if(d.getSource()instanceof a.aU)return this._setupProxiedCoordsForImageSource(d,m,w);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const M=this.proxiedCoords[d.id]=[],O=this.proxyCoords;for(let V=0;VQ.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,m,w){if(!d.getSource().loaded())return;const M=this.proxiedCoords[d.id]=[],O=this.proxyCoords,D=d.getSource(),B=D.tileID;if(!B)return;const V=new a.P(B.x,B.y)._div(1<(ce.min.x=Math.min(ce.min.x,oe.x-V.x),ce.min.y=Math.min(ce.min.y,oe.y-V.y),ce.max.x=Math.max(ce.max.x,oe.x-V.x),ce.max.y=Math.max(ce.max.y,oe.y-V.y),ce),{min:new a.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),Q=(ce,oe)=>{const ue=ce.wrap+ce.canonical.x/(1<Le+Y.max.x||ke+_ePe+Y.max.y};for(let ce=0;ceD.key===m.tileID.key);if(O)return O}if(m.tileID.key!==d.key){const O=d.canonical.z-m.tileID.canonical.z;let D,B,V;M=a.bC();const Y=m.tileID.wrap-d.wrap<0?(D=a.al>>O,B=D*((m.tileID.canonical.x<=ce){const oe=d.canonical.z-ce;m.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,m.transform.tileZoom),D=new a.aQ(B,d.wrap,ce,d.canonical.x>>oe,d.canonical.y>>oe)):oe!==0&&(B=ce,D=new a.aQ(B,d.wrap,ce,d.canonical.x>>oe,d.canonical.y>>oe))}D.key!==d.key&&(Y.push(D.key),w=m.getTile(D))}const Q=ce=>{Y.forEach(oe=>{M[oe]=ce}),Y.length=0};for(B-=1;B>=V&&(!w||!w.hasData());B--){w&&Q(w.tileID.key);const ce=D.calculateScaledKey(B);if(w=m.getTileByID(ce),w&&w.hasData())break;const oe=M[ce];if(oe===null)break;oe===void 0?Y.push(ce):w=m.getTileByID(oe)}return Q(w?w.tileID.key:null),w&&w.hasData()?w:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,m){let w=this._tilesDirty[d];w||(w=this._tilesDirty[d]={}),w[m.key]=!0}}function Oy(_,d,m){const w=function(B,V,Y){const Q=a.bJ(V,B),ce=a.bJ(Y,[.2126,.7152,.0722]),oe=(ke,_e,Le)=>(1-Le)*ke+Le*_e,ue=oe(1-.3*Math.min(ce,1),1,Math.min(Q+1,1));return oe(.92,1,Math.asin(a.aA(V[2],-1,1))/Math.PI+.5)*ue}(_,[0,0,1],d),M=[0,0,0];a.c5(M,m.slice(0,3),w);const O=[0,0,0];a.c5(O,d.slice(0,3),_[2]);const D=[0,0,0];return a.d8(D,M,O),a.db(D)}const aae=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],oae=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class hP{static cacheKey(d,m,w,M){const O=[m];M&&O.push(M.cacheKey);for(const D of w)d.usedDefines.has(D)&&O.push(D);return O.join("/")}constructor(d,m,w,M,O,D){const B=d.gl;this.program=B.createProgram(),this.configuration=M,this.name=m,this.fixedDefines=[...D];const V=`#version 300 es ${(M?M.defines():[]).concat(D.map(_e=>`#define ${_e}`)).join(` `)}`,Y=[V,Xie];for(const _e of w.fragmentIncludes)Y.push(Fm[_e]);Y.push(w.fragmentSource);const Q=Y.join(` `),ce=[V,rP];for(const _e of w.vertexIncludes)ce.push(Fm[_e]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&w.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&ce.push("uniform int u_instanceID;"),ce.push(w.vertexSource);let oe=ce.join(` `);this.forceManualRenderingForInstanceIDShaders&&(oe=oe.replaceAll("gl_InstanceID","u_instanceID"));const ue=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(ue,Q),B.compileShader(ue),B.attachShader(this.program,ue);const ke=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(ke,oe),B.compileShader(ke),B.attachShader(this.program,ke),this.attributes={},B.linkProgram(this.program),B.deleteShader(ke),B.deleteShader(ue),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=M?M.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(_e=>({u_instanceID:new a.ch(_e)}))(d)),(D.includes("TERRAIN")||m.includes("symbol")||m.includes("circle"))&&(this.terrainUniforms=(_e=>({u_dem:new a.ch(_e),u_dem_prev:new a.ch(_e),u_dem_tl:new a.ck(_e),u_dem_scale:new a.cj(_e),u_dem_tl_prev:new a.ck(_e),u_dem_scale_prev:new a.cj(_e),u_dem_size:new a.cj(_e),u_dem_lerp:new a.cj(_e),u_exaggeration:new a.cj(_e),u_depth:new a.ch(_e),u_depth_size_inv:new a.ck(_e),u_depth_range_unpack:new a.ck(_e),u_occluder_half_size:new a.cj(_e),u_occlusion_depth_offset:new a.cj(_e),u_meter_to_dem:new a.cj(_e),u_label_plane_matrix_inv:new a.cl(_e)}))(d)),D.includes("GLOBE")&&(this.globeUniforms=(_e=>({u_tile_tl_up:new a.ci(_e),u_tile_tr_up:new a.ci(_e),u_tile_br_up:new a.ci(_e),u_tile_bl_up:new a.ci(_e),u_tile_up_scale:new a.cj(_e)}))(d)),D.includes("FOG")&&(this.fogUniforms=(_e=>({u_fog_matrix:new a.cl(_e),u_fog_range:new a.ck(_e),u_fog_color:new a.d3(_e),u_fog_horizon_blend:new a.cj(_e),u_fog_vertical_limit:new a.ck(_e),u_fog_temporal_offset:new a.cj(_e),u_frustum_tl:new a.ci(_e),u_frustum_tr:new a.ci(_e),u_frustum_br:new a.ci(_e),u_frustum_bl:new a.ci(_e),u_globe_pos:new a.ci(_e),u_globe_radius:new a.cj(_e),u_globe_transition:new a.cj(_e),u_is_globe:new a.ch(_e),u_viewport:new a.ck(_e)}))(d)),D.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(_e=>({u_cutoff_params:new a.d3(_e)}))(d)),D.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(_e=>({u_lighting_ambient_color:new a.ci(_e),u_lighting_directional_dir:new a.ci(_e),u_lighting_directional_color:new a.ci(_e),u_ground_radiance:new a.ci(_e)}))(d)),D.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(_e=>({u_light_matrix_0:new a.cl(_e),u_light_matrix_1:new a.cl(_e),u_fade_range:new a.ck(_e),u_shadow_normal_offset:new a.ci(_e),u_shadow_intensity:new a.cj(_e),u_shadow_texel_size:new a.cj(_e),u_shadow_map_resolution:new a.cj(_e),u_shadow_direction:new a.ci(_e),u_shadow_bias:new a.ci(_e),u_shadowmap_0:new a.ch(_e),u_shadowmap_1:new a.ch(_e)}))(d)))}getAttributeLocation(d,m){let w=this.attributes[m];return w===void 0&&(w=this.attributes[m]=d.getAttribLocation(this.program,m)),w}setTerrainUniformValues(d,m){if(!this.terrainUniforms)return;const w=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M]&&w[M].set(this.program,M,m[M])}}setGlobeUniformValues(d,m){if(!this.globeUniforms)return;const w=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M]&&w[M].set(this.program,M,m[M])}}setFogUniformValues(d,m){if(!this.fogUniforms)return;const w=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setCutoffUniformValues(d,m){if(!this.cutoffUniforms)return;const w=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setLightsUniformValues(d,m){if(!this.lightsUniforms)return;const w=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setShadowUniformValues(d,m){if(this.failedToCreate||!this.shadowUniforms)return;const w=this.shadowUniforms;d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}_drawDebugWireframe(d,m,w,M,O,D,B,V,Y,Q){const ce=d.options.wireframe;if(ce.terrain===!1&&ce.layers2D===!1&&ce.layers3D===!1)return;const oe=d.context;if(!(!(!ce.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!ce.layers2D||d._terrain&&d._terrain.renderingToTexture||!aae.includes(this.name))||!(!ce.layers3D||!oae.includes(this.name))))return;const ue=oe.gl,ke=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,oe);if(!ke)return;const _e=[...this.fixedDefines,"DEBUG_WIREFRAME"],Le=d.getOrCreateProgram(this.name,{config:this.configuration,defines:_e});oe.program.set(Le.program);const Pe=(He,xt,ct)=>{if(xt[He]&&ct[He])for(const pt in xt[He])ct[He][pt]&&ct[He][pt].set(ct.program,pt,xt[He][pt].current)};Y&&Y.setUniforms(Le.program,oe,Le.binderUniforms,B,{zoom:V}),Pe("fixedUniforms",this,Le),Pe("terrainUniforms",this,Le),Pe("globeUniforms",this,Le),Pe("fogUniforms",this,Le),Pe("lightsUniforms",this,Le),Pe("shadowUniforms",this,Le),ke.bind(),oe.setColorMode(new is([ue.ONE,ue.ONE_MINUS_SRC_ALPHA,ue.ZERO,ue.ONE],a.ao.transparent,[!0,!0,!0,!1])),oe.setDepthMode(new un(m.func===ue.LESS?ue.LEQUAL:m.func,un.ReadOnly,m.range)),oe.setStencilMode($n.disabled);const qe=3*D.primitiveLength*2,Ze=3*D.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const He=Q||1;for(let xt=0;xt1?ue.drawElementsInstanced(ue.LINES,qe,ue.UNSIGNED_SHORT,Ze,Q):ue.drawElements(ue.LINES,qe,ue.UNSIGNED_SHORT,Ze);O.bind(),oe.program.set(this.program),oe.setDepthMode(m),oe.setStencilMode(w),oe.setColorMode(M)}checkUniforms(d,m,w){if(this.fixedDefines.includes(m)){for(const M of Object.keys(w))if(!w[M].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${M} not set but required by ${m} being defined`)}}draw(d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le){const Pe=d.context,qe=Pe.gl;if(this.failedToCreate)return;Pe.program.set(this.program),Pe.setDepthMode(w),Pe.setStencilMode(M),Pe.setColorMode(O),Pe.setCullFace(D);for(const[lt,st]of this.fixedUniformsEntries)st.set(this.program,lt,B[lt]);ke&&ke.setUniforms(this.program,Pe,this.binderUniforms,oe,{zoom:ue});const Ze={[qe.POINTS]:1,[qe.LINES]:2,[qe.TRIANGLES]:3,[qe.LINE_STRIP]:1}[m];this.checkUniforms(V,"RENDER_SHADOWS",this.shadowUniforms);const He=_e||[],xt=ke?ke.getPaintVertexBuffers():[],ct=m===qe.TRIANGLES&&Q,pt=Le&&Le>0?1:void 0;for(const lt of ce.get()){const st=lt.vaos||(lt.vaos={});if((st[V]||(st[V]=new Qie)).bind(Pe,this,Y,xt,Q,lt.vertexOffset,He,pt),this.forceManualRenderingForInstanceIDShaders){const wt=Le||1;for(let Ot=0;Ot1?qe.drawElementsInstanced(m,lt.primitiveLength*Ze,qe.UNSIGNED_SHORT,lt.primitiveOffset*Ze*2,Le):Q?qe.drawElements(m,lt.primitiveLength*Ze,qe.UNSIGNED_SHORT,lt.primitiveOffset*Ze*2):qe.drawArrays(m,lt.vertexOffset,lt.vertexLength);ct&&this._drawDebugWireframe(d,w,M,O,Q,lt,oe,ue,ke,Le)}}}function fP(_,d,m=0){const w=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,_.transform.tileZoom)/w,O=M*(d.tileID.canonical.x+d.tileID.wrap*w),D=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture?d.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/a.ay(d,1,_.transform.tileZoom),u_pixel_coord_upper:[O>>16,D>>16],u_pixel_coord_lower:[65535&O,65535&D],u_pattern_transition:m}}const $k={terrain:0,flat:1},lae=a.bC(),Uk=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le,Pe)=>{const qe=d.style.light,Ze=qe.properties.get("position"),He=[Ze.x,Ze.y,Ze.z],xt=a.dO();qe.properties.get("anchor")==="viewport"&&(a.dP(xt,-d.transform.angle),a.dQ(He,He,xt));const ct=qe.properties.get("color").toPremultipliedRenderColor(null),pt=d.transform,lt={u_matrix:_,u_lightpos:He,u_lightintensity:qe.properties.get("intensity"),u_lightcolor:[ct.r,ct.g,ct.b],u_vertical_gradient:+m,u_opacity:w,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:lae,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:$k[Y],u_base_type:$k[Q],u_ao:M,u_edge_radius:O,u_width_scale:D,u_flood_light_color:ke,u_vertical_scale:_e,u_flood_light_intensity:Le,u_ground_shadow_factor:Pe};return pt.projection.name==="globe"&&(lt.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:_,u_edge_radius:d,u_width_scale:m,u_vertical_scale:w,u_height_type:$k[M],u_base_type:$k[O]}),pP=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le,Pe)=>{const qe=Uk(_,d,m,w,M,O,D,B,Y,Q,ce,oe,ue,ke,_e,Le,1,[0,0,0]),Ze={u_height_factor:-Math.pow(2,B.overscaledZ)/V.tileSize/8};return Object.assign(qe,fP(d,V,Pe),Ze)},Dy=(_,d,m,w,M,O,D,B,V,Y,Q)=>({u_matrix:d,u_opacity:m,u_ao_pass:w?1:0,u_meter_to_tile:M,u_ao:O,u_flood_light_intensity:D,u_flood_light_color:B,u_attenuation:V,u_edge_radius:Y,u_fb:0,u_fb_size:Q,u_dynamic_offset:1}),a5=(_,d,m)=>({u_matrix:_,u_emissive_strength:d,u_ground_shadow_factor:m}),o5=(_,d,m,w,M,O=0)=>Object.assign(a5(_,d,M),fP(m,w,O)),mP=(_,d,m,w)=>({u_matrix:_,u_world:m,u_emissive_strength:d,u_ground_shadow_factor:w}),l5=(_,d,m,w,M,O,D=0)=>Object.assign(o5(_,d,m,w,O,D),{u_world:M}),Bm=(_,d)=>({u_matrix:_,u_ground_shadow_factor:d}),Qg=(_,d,m,w,M)=>({u_matrix:_,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:m,u_height_scale:w,u_reset_depth:M}),qk=(_,d,m,w,M,O,D,B,V)=>({u_matrix:_,u_normal_matrix:d,u_opacity:m,u_faux_facade_ao_intensity:w,u_camera_pos:M,u_tile_to_meter:O,u_facade_emissive_chance:D,u_flood_light_color:B,u_flood_light_intensity:V}),gP=_=>({u_matrix:_}),$m=_=>({u_matrix:_}),c5=(_,d,m,w,M,O,D,B)=>{const V=a.al/O.tileSize;return{u_matrix:_,u_inv_rot_matrix:d,u_camera_to_center_distance:m.getCameraToCenterDistance(B),u_extrude_scale:[m.pixelsToGLUnits[0]/V,m.pixelsToGLUnits[1]/V],u_zoom_transition:w,u_tile_id:D,u_merc_center:M}},Pv=(_,d,m=1)=>({u_matrix:_,u_color:d,u_overlay:0,u_overlay_scale:m}),xP=a.bC(),yP=(_,d,m,w,M,O,D)=>{const B=_.transform,V=B.projection.name==="globe",Y=V?a.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:a.ay(m,1,O),Q={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:D,u_inv_rot_matrix:xP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(V){Q.u_inv_rot_matrix=w,Q.u_merc_center=M,Q.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:w,u_grid_matrix:M,u_tl_parent:O,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity*ce.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:ce.paint.get("raster-brightness-min"),u_brightness_high:ce.paint.get("raster-brightness-max"),u_saturation_factor:a.dT(ce.paint.get("raster-saturation")),u_contrast_factor:a.dS(ce.paint.get("raster-contrast")),u_spin_weights:_P(ce.paint.get("raster-hue-rotate")),u_perspective_transform:oe,u_raster_elevation:ue,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:V,u_colorization_mix:Vk(a.dU,_e,Pe),u_colorization_offset:Hk(a.dU,Le,Pe),u_color_ramp:ke,u_texture_offset:[Ze/(qe+2*Ze),qe/(qe+2*Ze)],u_texture_res:[qe+2*Ze,qe+2*Ze],u_emissive_strength:He});function _P(_){_*=Math.PI/180;const d=Math.sin(_),m=Math.cos(_);return[(2*m+1)/3,(-Math.sqrt(3)*d-m+1)/3,(Math.sqrt(3)*d-m+1)/3]}const xf=.05,cae=(_,d,m,w,M,O,D,B,V,Y,Q,ce)=>({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:w,u_grid_matrix:M,u_tl_parent:O,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity,u_image0:0,u_image1:1,u_raster_elevation:ce,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:V}),dae=(_,d,m,w,M,O,D,B,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_tile_offset:m,u_velocity:w,u_color_ramp:O,u_velocity_res:M,u_max_speed:D,u_uv_offset:B,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[xf,xf]}),bP=(_,d,m,w,M,O,D,B,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_velocity:m,u_velocity_res:w,u_max_speed:M,u_speed_factor:O,u_reset_rate:D,u_rand_seed:Math.random(),u_uv_offset:B,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[xf,xf]}),wP=a.bC(),Wk=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le,Pe,qe,Ze,He,xt,ct,pt)=>{const lt=M.transform,st={u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:lt.getCameraToCenterDistance(qe),u_rotate_symbol:+m,u_aspect_ratio:lt.width/lt.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:D,u_coord_matrix:B,u_is_text:+Y,u_elevation_from_sea:V?1:0,u_pitch_with_map:+w,u_texsize:Q,u_texsize_icon:ce,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:wP,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:wP,u_up_vector:[0,-1,0],u_color_adj_mat:xt,u_icon_transition:ct||0,u_gamma_scale:w?M.transform.getCameraToCenterDistance(qe)*Math.cos(M.terrain?0:M.transform._pitch):1,u_device_pixel_ratio:a.o.devicePixelRatio,u_is_halo:1,u_scale_factor:pt||1,u_ground_shadow_factor:Ze,u_inv_matrix:a.bl(a.bC(),D),u_normal_scale:He,u_lutTexture:Sl.LUT};return qe.name==="globe"&&(st.u_tile_id=[ue.canonical.x,ue.canonical.y,1<({u_matrix:_,u_emissive_strength:d,u_opacity:m,u_color:w}),Um=(_,d,m,w,M,O,D,B,V)=>Object.assign(function(Y,Q,ce,oe,ue,ke){const{width:_e,height:Le}=oe.imageManager.getPixelSize(Q),Pe=Math.pow(2,ke.tileID.overscaledZ),qe=ke.tileSize*Math.pow(2,oe.transform.tileZoom)/Pe,Ze=qe*(ke.tileID.canonical.x+ke.tileID.wrap*Pe),He=qe*ke.tileID.canonical.y;return{u_image:0,u_pattern_tl:ce.tl,u_pattern_br:ce.br,u_texsize:[_e,Le],u_pattern_size:ce.displaySize,u_pattern_units_to_pixels:ue?[oe.transform.width,-1*oe.transform.height]:[1/a.ay(ke,1,oe.transform.tileZoom),1/a.ay(ke,1,oe.transform.tileZoom)],u_pixel_coord_upper:[Ze>>16,He>>16],u_pixel_coord_lower:[65535&Ze,65535&He]}}(0,O,D,w,B,V),{u_matrix:_,u_emissive_strength:d,u_opacity:m}),Ry=new Float32Array(a.bA([])),Jg=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue=[0,0,0],ke,_e,Le)=>{const Pe=M.style.light,qe=Pe.properties.get("position"),Ze=[-qe.x,-qe.y,qe.z],He=a.dO();Pe.properties.get("anchor")==="viewport"&&(a.dP(He,-M.transform.angle),a.dQ(Ze,Ze,He));const xt=Q.alphaMode==="MASK",ct=Pe.properties.get("color").toNonPremultipliedRenderColor(null),pt=oe.paint.get("model-ambient-occlusion-intensity"),lt=oe.paint.get("model-color").constantOr(a.ao.white).toNonPremultipliedRenderColor(null);return lt.a=oe.paint.get("model-color-mix-intensity").constantOr(0),Le&&(lt.r=Le[0],lt.g=Le[1],lt.b=Le[2],lt.a=Le[3]),_e&&(lt.r=_e.color.r,lt.g=_e.color.g,lt.b=_e.color.b,lt.a=_e.colorMix,ce=_e.emissionStrength,O*=_e.opacity),{u_matrix:_,u_lighting_matrix:d,u_normal_matrix:m,u_node_matrix:w||Ry,u_lightpos:Ze,u_lightintensity:Pe.properties.get("intensity"),u_lightcolor:[ct.r,ct.g,ct.b],u_camera_pos:ue,u_opacity:O,u_baseTextureIsAlpha:0,u_alphaMask:+xt,u_alphaCutoff:Q.alphaCutoff,u_baseColorFactor:D.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:V,u_roughnessFactor:Y,u_baseColorTexture:Sl.BaseColor,u_metallicRoughnessTexture:Sl.MetallicRoughness,u_normalTexture:Sl.Normal,u_occlusionTexture:Sl.Occlusion,u_emissionTexture:Sl.Emission,u_lutTexture:Sl.LUT,u_color_mix:lt.toArray01(),u_aoIntensity:pt,u_emissive_strength:ce,u_occlusionTextureTransform:ke||[0,0,0,0]}},d5=(_,d=Ry,m=Ry)=>({u_matrix:_,u_instance:d,u_node_matrix:m}),Gk={fillExtrusion:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_opacity:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_flood_light_color:new a.ci(_),u_vertical_scale:new a.cj(_),u_flood_light_intensity:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillExtrusionDepth:_=>({u_matrix:new a.cl(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_vertical_scale:new a.cj(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_)}),fillExtrusionPattern:_=>({u_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_vertical_gradient:new a.cj(_),u_height_factor:new a.cj(_),u_edge_radius:new a.cj(_),u_width_scale:new a.cj(_),u_ao:new a.ck(_),u_height_type:new a.ch(_),u_base_type:new a.ch(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_up_dir:new a.ci(_),u_height_lift:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_opacity:new a.cj(_),u_pattern_transition:new a.cj(_)}),fillExtrusionGroundEffect:_=>({u_matrix:new a.cl(_),u_opacity:new a.cj(_),u_ao_pass:new a.cj(_),u_meter_to_tile:new a.cj(_),u_ao:new a.ck(_),u_flood_light_intensity:new a.cj(_),u_flood_light_color:new a.ci(_),u_attenuation:new a.cj(_),u_edge_radius:new a.cj(_),u_fb:new a.ch(_),u_fb_size:new a.cj(_),u_dynamic_offset:new a.cj(_)}),fill:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_ground_shadow_factor:new a.ci(_)}),fillPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),fillOutline:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_ground_shadow_factor:new a.ci(_)}),fillOutlinePattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_world:new a.ck(_),u_image:new a.ch(_),u_texsize:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_tile_units_to_pixels:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_pattern_transition:new a.cj(_)}),building:_=>({u_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_opacity:new a.cj(_),u_faux_facade_ao_intensity:new a.cj(_),u_camera_pos:new a.ci(_),u_tile_to_meter:new a.cj(_),u_facade_emissive_chance:new a.cj(_),u_flood_light_color:new a.ci(_),u_flood_light_intensity:new a.cj(_)}),buildingBloom:_=>({u_matrix:new a.cl(_)}),buildingDepth:_=>({u_matrix:new a.cl(_)}),elevatedStructuresDepth:_=>({u_matrix:new a.cl(_),u_depth_bias:new a.cj(_)}),elevatedStructures:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),elevatedStructuresDepthReconstruct:_=>({u_matrix:new a.cl(_),u_camera_pos:new a.ci(_),u_depth_bias:new a.cj(_),u_height_scale:new a.cj(_),u_reset_depth:new a.cj(_)}),circle:a.dY,collisionBox:_=>({u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_extrude_scale:new a.ck(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_)}),collisionCircle:_=>({u_matrix:new a.cl(_),u_inv_matrix:new a.cl(_),u_camera_to_center_distance:new a.cj(_),u_viewport_size:new a.ck(_)}),debug:_=>({u_color:new a.dB(_),u_matrix:new a.cl(_),u_overlay:new a.ch(_),u_overlay_scale:new a.cj(_)}),clippingMask:_=>({u_matrix:new a.cl(_)}),heatmap:_=>({u_extrude_scale:new a.cj(_),u_intensity:new a.cj(_),u_matrix:new a.cl(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_up_dir:new a.ci(_)}),heatmapTexture:_=>({u_image:new a.ch(_),u_color_ramp:new a.ch(_),u_opacity:new a.cj(_)}),hillshade:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_latrange:new a.ck(_),u_light:new a.ck(_),u_shadow:new a.dB(_),u_highlight:new a.dB(_),u_emissive_strength:new a.cj(_),u_accent:new a.dB(_)}),hillshadePrepare:_=>({u_matrix:new a.cl(_),u_image:new a.ch(_),u_dimension:new a.ck(_),u_zoom:new a.cj(_)}),line:a.dX,linePattern:a.dW,raster:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_brightness_low:new a.cj(_),u_brightness_high:new a.cj(_),u_saturation_factor:new a.cj(_),u_contrast_factor:new a.cj(_),u_spin_weights:new a.ci(_),u_perspective_transform:new a.ck(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_),u_colorization_mix:new a.d3(_),u_colorization_offset:new a.cj(_),u_color_ramp:new a.ch(_),u_texture_offset:new a.ck(_),u_texture_res:new a.ck(_),u_emissive_strength:new a.cj(_)}),rasterParticle:_=>({u_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_grid_matrix:new a.dC(_),u_tl_parent:new a.ck(_),u_scale_parent:new a.cj(_),u_fade_t:new a.cj(_),u_opacity:new a.cj(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_raster_elevation:new a.cj(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_cutoff_params:new a.d3(_)}),rasterParticleTexture:_=>({u_texture:new a.ch(_),u_opacity:new a.cj(_)}),rasterParticleDraw:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_tile_offset:new a.ck(_),u_velocity:new a.ch(_),u_color_ramp:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),rasterParticleUpdate:_=>({u_particle_texture:new a.ch(_),u_particle_texture_side_len:new a.cj(_),u_velocity:new a.ch(_),u_velocity_res:new a.ck(_),u_max_speed:new a.cj(_),u_speed_factor:new a.cj(_),u_reset_rate:new a.cj(_),u_rand_seed:new a.cj(_),u_uv_offset:new a.ck(_),u_data_scale:new a.ck(_),u_data_offset:new a.cj(_),u_particle_pos_scale:new a.cj(_),u_particle_pos_offset:new a.ck(_)}),symbol:_=>({u_is_size_zoom_constant:new a.ch(_),u_is_size_feature_constant:new a.ch(_),u_size_t:new a.cj(_),u_size:new a.cj(_),u_camera_to_center_distance:new a.cj(_),u_rotate_symbol:new a.ch(_),u_aspect_ratio:new a.cj(_),u_fade_change:new a.cj(_),u_matrix:new a.cl(_),u_label_plane_matrix:new a.cl(_),u_coord_matrix:new a.cl(_),u_is_text:new a.ch(_),u_elevation_from_sea:new a.ch(_),u_pitch_with_map:new a.ch(_),u_texsize:new a.ck(_),u_texsize_icon:new a.ck(_),u_texture:new a.ch(_),u_texture_icon:new a.ch(_),u_gamma_scale:new a.cj(_),u_device_pixel_ratio:new a.cj(_),u_tile_id:new a.ci(_),u_zoom_transition:new a.cj(_),u_inv_rot_matrix:new a.cl(_),u_merc_center:new a.ck(_),u_camera_forward:new a.ci(_),u_tile_matrix:new a.cl(_),u_up_vector:new a.ci(_),u_ecef_origin:new a.ci(_),u_is_halo:new a.ch(_),u_icon_transition:new a.cj(_),u_color_adj_mat:new a.cl(_),u_scale_factor:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_inv_matrix:new a.cl(_),u_normal_scale:new a.cj(_),u_lutTexture:new a.ch(_)}),background:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_color:new a.dB(_)}),backgroundPattern:_=>({u_matrix:new a.cl(_),u_emissive_strength:new a.cj(_),u_opacity:new a.cj(_),u_image:new a.ch(_),u_pattern_tl:new a.ck(_),u_pattern_br:new a.ck(_),u_texsize:new a.ck(_),u_pattern_size:new a.ck(_),u_pixel_coord_upper:new a.ck(_),u_pixel_coord_lower:new a.ck(_),u_pattern_units_to_pixels:new a.ck(_)}),terrainRaster:_=>({u_matrix:new a.cl(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_skirt_height:new a.cj(_),u_ground_shadow_factor:new a.ci(_),u_emissive_texture_available:new a.cj(_)}),skybox:_=>({u_matrix:new a.cl(_),u_sun_direction:new a.ci(_),u_cubemap:new a.ch(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxGradient:_=>({u_matrix:new a.cl(_),u_color_ramp:new a.ch(_),u_center_direction:new a.ci(_),u_radius:new a.cj(_),u_opacity:new a.cj(_),u_temporal_offset:new a.cj(_)}),skyboxCapture:_=>({u_matrix_3f:new a.dC(_),u_sun_direction:new a.ci(_),u_sun_intensity:new a.cj(_),u_color_tint_r:new a.d3(_),u_color_tint_m:new a.d3(_),u_luminance:new a.cj(_)}),globeRaster:_=>({u_proj_matrix:new a.cl(_),u_globe_matrix:new a.cl(_),u_normalize_matrix:new a.cl(_),u_merc_matrix:new a.cl(_),u_zoom_transition:new a.cj(_),u_merc_center:new a.ck(_),u_image0:new a.ch(_),u_image1:new a.ch(_),u_grid_matrix:new a.dC(_),u_skirt_height:new a.cj(_),u_far_z_cutoff:new a.cj(_),u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_globe_pos:new a.ci(_),u_globe_radius:new a.cj(_),u_viewport:new a.ck(_),u_emissive_texture_available:new a.cj(_)}),globeAtmosphere:_=>({u_frustum_tl:new a.ci(_),u_frustum_tr:new a.ci(_),u_frustum_br:new a.ci(_),u_frustum_bl:new a.ci(_),u_horizon:new a.cj(_),u_transition:new a.cj(_),u_fadeout_range:new a.cj(_),u_atmosphere_fog_color:new a.d3(_),u_high_color:new a.d3(_),u_space_color:new a.d3(_),u_temporal_offset:new a.cj(_),u_horizon_angle:new a.cj(_)}),model:_=>({u_matrix:new a.cl(_),u_lighting_matrix:new a.cl(_),u_normal_matrix:new a.cl(_),u_node_matrix:new a.cl(_),u_lightpos:new a.ci(_),u_lightintensity:new a.cj(_),u_lightcolor:new a.ci(_),u_camera_pos:new a.ci(_),u_opacity:new a.cj(_),u_baseColorFactor:new a.d3(_),u_emissiveFactor:new a.d3(_),u_metallicFactor:new a.cj(_),u_roughnessFactor:new a.cj(_),u_baseTextureIsAlpha:new a.ch(_),u_alphaMask:new a.ch(_),u_alphaCutoff:new a.cj(_),u_baseColorTexture:new a.ch(_),u_metallicRoughnessTexture:new a.ch(_),u_normalTexture:new a.ch(_),u_occlusionTexture:new a.ch(_),u_emissionTexture:new a.ch(_),u_lutTexture:new a.ch(_),u_color_mix:new a.d3(_),u_aoIntensity:new a.cj(_),u_emissive_strength:new a.cj(_),u_occlusionTextureTransform:new a.d3(_)}),modelDepth:_=>({u_matrix:new a.cl(_),u_instance:new a.cl(_),u_node_matrix:new a.cl(_)}),groundShadow:_=>({u_matrix:new a.cl(_),u_ground_shadow_factor:new a.ci(_)}),stars:_=>({u_matrix:new a.cl(_),u_up:new a.ci(_),u_right:new a.ci(_),u_intensity_multiplier:new a.cj(_)}),snowParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_horizontalOscillationRadius:new a.cj(_),u_horizontalOscillationRate:new a.cj(_),u_boxSize:new a.cj(_),u_billboardSize:new a.cj(_),u_simpleShapeParameters:new a.ck(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_particleColor:new a.d3(_),u_direction:new a.ci(_)}),rainParticle:_=>({u_modelview:new a.cl(_),u_projection:new a.cl(_),u_time:new a.cj(_),u_cam_pos:new a.ci(_),u_texScreen:new a.ch(_),u_velocityConeAperture:new a.cj(_),u_velocity:new a.cj(_),u_boxSize:new a.cj(_),u_rainDropletSize:new a.ck(_),u_distortionStrength:new a.cj(_),u_rainDirection:new a.ci(_),u_color:new a.d3(_),u_screenSize:new a.ck(_),u_thinningCenterPos:new a.ck(_),u_thinningShape:new a.ci(_),u_thinningAffectedRatio:new a.cj(_),u_thinningParticleOffset:new a.cj(_),u_shapeDirectionalPower:new a.cj(_),u_shapeNormalPower:new a.cj(_),u_mode:new a.cj(_)}),vignette:_=>({u_vignetteShape:new a.ci(_),u_vignetteColor:new a.d3(_)}),occlusion:_=>({u_matrix:new a.cl(_),u_anchorPos:new a.ci(_),u_screenSizePx:new a.ck(_),u_occluderSizePx:new a.ck(_),u_color:new a.d3(_)})};class Mh{constructor(d,m,w,M){this.id=Mh.uniqueIdxCounter,Mh.uniqueIdxCounter++,this.context=d;const O=d.gl;this.buffer=O.createBuffer(),this.dynamicDraw=!!w,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),O.bufferData(O.ELEMENT_ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||M||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Mh.uniqueIdxCounter,Mh.uniqueIdxCounter++;const m=this.context.gl;this.context.unbindVAO(),this.bind(),m.bufferSubData(m.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Mh.uniqueIdxCounter=0;const u5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class jP{constructor(d,m,w,M,O,D){this.length=m.length,this.attributes=w,this.itemSize=m.bytesPerElement,this.dynamicDraw=M,this.instanceCount=D,this.context=d;const B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||O||m.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const m=this.context.gl;this.bind(),m.bufferSubData(m.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,m){for(let w=0;w0&&d.vertexAttribDivisor(O,w)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class kP{constructor(d,m,w,M,O){this.context=d,this.width=m,this.height=w;const D=this.framebuffer=d.gl.createFramebuffer();M>0&&(this.colorAttachment0=new Dk(d,D,0)),M>1&&(this.colorAttachment1=new Dk(d,D,1)),O&&(this.depthAttachmentType=O,this.depthAttachment=O==="renderbuffer"?new Py(d,D):new Tv(d,D))}createColorAttachment(d,m){m===0?this.colorAttachment0=new Dk(d,this.framebuffer,0):m===1&&(this.colorAttachment1=new Dk(d,this.framebuffer,1))}removeColorAttachment(d,m){const w=this.context.gl;let M;m===0?(M=this.colorAttachment0.get(),this.colorAttachment0=void 0):m===1&&(M=this.colorAttachment1.get(),this.colorAttachment1=void 0),M&&w.deleteTexture(M)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const m=this.colorAttachment0.get();m&&d.deleteTexture(m)}if(this.colorAttachment1){const m=this.colorAttachment1.get();m&&d.deleteTexture(m)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const m=this.depthAttachment.get();m&&d.deleteRenderbuffer(m)}else{const m=this.depthAttachment.get();m&&d.deleteTexture(m)}d.deleteFramebuffer(this.framebuffer)}}class Fy{constructor(d,m){this.gl=d,this.clearColor=new rae(this),this.clearDepth=new nP(this),this.clearStencil=new G3(this),this.colorMask=new Ek(this),this.depthMask=new K3(this),this.stencilMask=new Xg(this),this.stencilFunc=new Ty(this),this.stencilOp=new Cv(this),this.stencilTest=new Ay(this),this.depthRange=new sP(this),this.depthTest=new Z3(this),this.depthFunc=new iP(this),this.blend=new Ey(this),this.blendFunc=new Ik(this),this.blendColor=new Pk(this),this.blendEquation=new Y3(this),this.cullFace=new Lk(this),this.cullFaceSide=new Mv(this),this.frontFace=new aP(this),this.program=new oP(this),this.activeTexture=new lP(this),this.viewport=new Iy(this),this.bindFramebuffer=new cP(this),this.bindRenderbuffer=new nae(this),this.bindTexture=new sae(this),this.bindVertexBuffer=new iae(this),this.bindElementBuffer=new X3(this),this.bindVertexArrayOES=new Q3(this),this.pixelStoreUnpack=new J3(this),this.pixelStoreUnpackPremultiplyAlpha=new e5(this),this.pixelStoreUnpackFlipY=new dP(this),this.options=m?Object.assign({},m):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=d.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=d.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=d.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=m&&!!m.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=d.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=d.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=d.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=d.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(d,m,w){return new Mh(this,d,m,w)}createVertexBuffer(d,m,w,M,O){return new jP(this,d,m,w,M,O)}createRenderbuffer(d,m,w){const M=this.gl,O=M.createRenderbuffer();return this.bindRenderbuffer.set(O),M.renderbufferStorage(M.RENDERBUFFER,d,m,w),this.bindRenderbuffer.set(null),O}createFramebuffer(d,m,w,M){return new kP(this,d,m,w,M)}clear({color:d,depth:m,stencil:w,colorMask:M}){const O=this.gl;let D=0;d&&(D|=O.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(M||[!0,!0,!0,!0])),m!==void 0&&(D|=O.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(m),this.depthMask.set(!0)),w!==void 0&&(D|=O.STENCIL_BUFFER_BIT,this.clearStencil.set(w),this.stencilMask.set(255)),O.clear(D)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){a.by(d.blendFunction,is.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor),d.blendEquation?this.blendEquation.set(d.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(d.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let ex;function Qr(_,d,m,w,M,O,D){const B=_.context,V=B.gl,Y=_.transform,Q=[a.aF(Y.center.lng),a.aJ(Y.center.lat)],ce=m.layout.get("symbol-placement"),oe=m.layout.get("text-variable-anchor"),ue=m.layout.get("icon-rotation-alignment")==="map",ke=m.layout.get("text-rotation-alignment")==="map",_e=ce!=="point",Le=[];let Pe=0,qe=0;for(let st=0;st0){const $r=a.bC(),Kr=Sr;a.cP($r,Pt.placementInvProjMatrix,Y.glCoordMatrix),a.cP($r,$r,Pt.placementViewportMatrix),Le.push({circleArray:on,circleOffset:qe,transform:Kr,invTransform:$r,projection:Pt.getProjection()}),Pe+=on.length/4,qe=Pe}if(!wr)continue;_.terrain&&_.terrain.setupElevationDraw(Ot,Gr);const en=ur?[wt.canonical.x,wt.canonical.y,1<=0&&(ue[Ze.associatedIconIndex]={x:Pt,y:Vt,z:Wt,angle:Xt})}else Nh(ct,ce)}if(Y){oe.clear();const qe=_.icon.placedSymbolArray;for(let Ze=0;Ze{let Qs=[0,0,0];if(xi){const ls=_.style.directionalLight,sa=_.style.ambientLight;ls&&sa&&(Qs=yp(_.style,ls,sa))}return Qs},ii=xi=>{st.depthOcclusionForSymbolsAndCircles&&(m.hasOcclusionOpacityProperties||_.terrain)&&(xi.push("DEPTH_D24"),xi.push("DEPTH_OCCLUSION"))},Wn=xi=>{m.lut&&!ct&&(m.lut.texture||(m.lut.texture=new a.d$(_.context,m.lut.image,[m.lut.image.height,m.lut.image.height,m.lut.image.height],pt.gl.RGBA8)),pt.activeTexture.set(pt.gl.TEXTURE0+Sl.LUT),m.lut.texture&&m.lut.texture.bind(pt.gl.LINEAR,pt.gl.CLAMP_TO_EDGE),xi.push("APPLY_LUT_ON_GPU"))},gi=()=>{const xi=wt&&m.layout.get("symbol-placement")!=="point",Qs=[];ii(Qs),Wn(Qs);const ls=xi||Yn,sa=wr.elevationType==="road",eo=_.shadowRenderer,Ea=sa&&Pt&&!!eo&&eo.enabled,qi=dn(Ea),rd=sa&&Pt&&!_.terrain?zt:br,ec=m.paint.get("icon-image-cross-fade");_.terrainRenderModeElevated()&&Pt&&Qs.push("PITCH_WITH_MAP_TERRAIN"),on&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),ec>0&&wr.hasAnySecondaryIcon&&Qs.push("ICON_TRANSITION"),!wr.icon.zOffsetVertexBuffer||sa&&_.terrain||Qs.push("Z_OFFSET"),Pe===0&&qe===0&&Ze===0&&He===1||Qs.push("COLOR_ADJUSTMENT"),wr.sdfIcons&&Qs.push("RENDER_SDF"),Ea&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),sa&&Pt&&!_.terrain&&wr.icon.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS");const qo=wr.icon.programConfigurations.get(m.id),xc=_.getOrCreateProgram("symbol",{config:qo,defines:Qs}),yc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],zl=wr.iconSizeData,hu=a.bK(zl,st.zoom),rh=Pt||!st.isOrthographic,Nd=Ic($r,Sr.tileID.canonical,Pt,wt,st,wr.getProjection(),Kr),Ua=xv($r,Sr.tileID.canonical,Pt,wt,st,wr.getProjection(),Kr),oo=_.translatePosMatrix(Ua,Sr,B,Y,!0),Vi=_.translatePosMatrix($r,Sr,B,Y),_o=ls?Ov:Nd,Ra=wt&&!Pt&&!xi;let Ia=Er;!qt&&!st.mercatorFromTransition||wt||(Ia=_p(st));const nh=on?Ia:Er,Kv=m.getColorAdjustmentMatrix(Pe,qe,Ze,He),Eh=Wk(zl.kind,hu,Ra,Pt,_,Vi,_o,oo,xt,!1,yc,[0,0],0,Gr,en,Mt,Ls,nh,wr.getProjection(),qi,ui,Kv,ec,null),Zv=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,Gy=m.layout.get("icon-size").constantOr(0)!==1||wr.iconsNeedLinear,wf=wr.sdfIcons||_.options.rotating||_.options.zooming||Gy||rh?lt.LINEAR:lt.NEAREST,Tp=wr.sdfIcons&&m.paint.get("icon-halo-width").constantOr(1)!==0,Ky=_.terrain&&Pt&&xi?a.bl(a.bC(),Nd):Ov;if(xi&&wr.icon){const Km=a.bV.getAtTileOffsetFunc(Gr,st.center.lat,st.worldSize,wr.getProjection()),Ap=mk($r,Sr.tileID.canonical,Pt,wt,st,wr.getProjection(),Kr),Ih=m.layout.get("icon-size-scale-range"),Ep=a.aA(_.scaleFactor,Ih[0],Ih[1]);KI(wr,$r,_,!1,Ap,Ua,Pt,_e,Km,Gr,Ep)}return{program:xc,buffers:wr.icon,uniformValues:Eh,atlasTexture:Zv,atlasTextureIcon:null,atlasInterpolation:wf,atlasInterpolationIcon:null,isSDF:wr.sdfIcons,hasHalo:Tp,depthMode:rd,tile:Sr,renderWithShadows:Ea,labelPlaneMatrixInv:Ky}},Li=()=>{const xi=Ot&&m.layout.get("symbol-placement")!=="point",Qs=[],ls=xi||Xt||Yn,sa=wr.elevationType==="road",eo=_.shadowRenderer,Ea=sa&&Vt&&!!eo&&eo.enabled,qi=dn(Ea),rd=sa&&Vt&&!_.terrain?zt:br;_.terrainRenderModeElevated()&&Vt&&Qs.push("PITCH_WITH_MAP_TERRAIN"),on&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),!wr.text.zOffsetVertexBuffer||sa&&_.terrain||Qs.push("Z_OFFSET"),wr.iconsInText&&Qs.push("RENDER_TEXT_AND_SYMBOL"),Qs.push("RENDER_SDF"),Ea&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),sa&&Vt&&!_.terrain&&wr.text.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS"),ii(Qs);const ec=wr.text.programConfigurations.get(m.id),qo=_.getOrCreateProgram("symbol",{config:ec,defines:Qs});let xc,yc=[0,0],zl=null;const hu=wr.textSizeData;wr.iconsInText&&(yc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],zl=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,xc=Vt||!st.isOrthographic||_.options.rotating||_.options.zooming||hu.kind==="composite"||hu.kind==="camera"?lt.LINEAR:lt.NEAREST);const rh=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture.size:[0,0],Nd=m.layout.get("text-size-scale-range"),Ua=a.aA(_.scaleFactor,Nd[0],Nd[1]),oo=a.bK(hu,st.zoom,Ua),Vi=Ic($r,Sr.tileID.canonical,Vt,Ot,st,wr.getProjection(),Kr),_o=xv($r,Sr.tileID.canonical,Vt,Ot,st,wr.getProjection(),Kr),Ra=_.translatePosMatrix(_o,Sr,V,Q,!0),Ia=_.translatePosMatrix($r,Sr,V,Q),nh=ls?Ov:Vi,Kv=Ot&&!Vt&&!xi;let Eh=Er;!qt&&!st.mercatorFromTransition||Ot||(Eh=_p(st));const Zv=Wk(hu.kind,oo,Kv,Vt,_,Ia,nh,Ra,xt,!0,rh,yc,0,Gr,en,Mt,Ls,on?Eh:Er,wr.getProjection(),qi,ui,null,null,Ua),Gy=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture:null,wf=lt.LINEAR,Tp=m.paint.get("text-halo-width").constantOr(1)!==0,Ky=_.terrain&&Vt&&xi?a.bl(a.bC(),Vi):Ov;if(xi&&wr.text){const Km=a.bV.getAtTileOffsetFunc(Gr,st.center.lat,st.worldSize,wr.getProjection()),Ap=mk($r,Sr.tileID.canonical,Vt,Ot,st,wr.getProjection(),Kr);KI(wr,$r,_,!0,Ap,_o,Vt,Le,Km,Gr,Ua)}return{program:qo,buffers:wr.text,uniformValues:Zv,atlasTexture:Gy,atlasTextureIcon:zl,atlasInterpolation:wf,atlasInterpolationIcon:xc,isSDF:!0,hasHalo:Tp,depthMode:rd,tile:Sr,renderWithShadows:Ea,labelPlaneMatrixInv:Ky}},Ni=wr.icon.segments.get().length,ni=wr.text.segments.get().length,as=Ni&&!D.onlyText?gi():null,pi=ni&&!D.onlyIcons?Li():null,Da=m.paint.get("icon-opacity").constantOr(1),xa=m.paint.get("text-opacity").constantOr(1);if(Wt&&wr.canOverlap){sr=!0;const xi=Da&&!D.onlyText?wr.icon.segments.get():[],Qs=xa&&!D.onlyIcons?wr.text.segments.get():[];for(const ls of xi)ur.push({segments:new a.bg([ls]),sortKey:ls.sortKey,state:as});for(const ls of Qs)ur.push({segments:new a.bg([ls]),sortKey:ls.sortKey,state:pi})}else D.onlyText||ur.push({segments:Da?wr.icon.segments:new a.bg([]),sortKey:0,state:as}),D.onlyIcons||ur.push({segments:xa?wr.text.segments:new a.bg([]),sortKey:0,state:pi})}sr&&ur.sort((Gr,Sr)=>Gr.sortKey-Sr.sortKey);for(const Gr of ur){const Sr=Gr.state;if(Sr)if(_.terrain?_.terrain.setupElevationDraw(Sr.tile,Sr.program,{useDepthForOcclusion:st.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Sr.labelPlaneMatrixInv}):_.setupDepthForOcclusion(st.depthOcclusionForSymbolsAndCircles,Sr.program),pt.activeTexture.set(lt.TEXTURE0),Sr.atlasTexture&&Sr.atlasTexture.bind(Sr.atlasInterpolation,lt.CLAMP_TO_EDGE,!0),Sr.atlasTextureIcon&&(pt.activeTexture.set(lt.TEXTURE1),Sr.atlasTextureIcon&&Sr.atlasTextureIcon.bind(Sr.atlasInterpolationIcon,lt.CLAMP_TO_EDGE,!0)),Sr.renderWithShadows&&_.shadowRenderer.setupShadows(Sr.tile.tileID.toUnwrapped(),Sr.program,"vector-tile"),_.uploadCommonLightUniforms(_.context,Sr.program),Sr.hasHalo){const wr=Sr.uniformValues;wr.u_is_halo=1,h5(Sr.buffers,Gr.segments,m,_,Sr.program,Sr.depthMode,M,O,wr,2),wr.u_is_halo=0}else{if(Sr.isSDF){const wr=Sr.uniformValues;Sr.hasHalo&&(wr.u_is_halo=1,h5(Sr.buffers,Gr.segments,m,_,Sr.program,Sr.depthMode,M,O,wr,1)),wr.u_is_halo=0}h5(Sr.buffers,Gr.segments,m,_,Sr.program,Sr.depthMode,M,O,Sr.uniformValues,1)}}}function h5(_,d,m,w,M,O,D,B,V,Y){const Q=[_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer,_.iconTransitioningVertexBuffer,_.globeExtVertexBuffer,_.zOffsetVertexBuffer,_.orientationVertexBuffer];M.draw(w,w.context.gl.TRIANGLES,O,D,B,Bn.disabled,V,m.id,_.layoutVertexBuffer,_.indexBuffer,d,m.paint,w.transform.zoom,_.programConfigurations.get(m.id),Q,Y)}function NP(_,d){const m=1<<_.canonical.z,w=(d.x*m-_.canonical.x-_.wrap*m)*a.al,M=(d.y*m-_.canonical.y)*a.al,O=a.e8(d.z,d.y);return a.d5(w,M,O)}function Kk(_,d,m,w,M){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const O=_.context.gl,D=new un(_.context.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D),B=new un(_.context.gl.GREATER,un.ReadWrite,_.depthRangeFor3D),V=function(ue){let ke=.01;return ue.isOrthographic&&(ke=a.ak(1e-4,ke,a.d0(ue.pitch>=Ch?1:ue.pitch/Ch))),2*ke}(_.transform),Y=_.transform.getFreeCameraOptions().position,Q="elevatedStructuresDepthReconstruct",ce=_.getOrCreateProgram(Q,{defines:["DEPTH_RECONSTRUCTION"]}),oe=_.getOrCreateProgram(Q);for(const ue of w){const ke=d.getTile(ue),_e=ke.getBucket(m);if(!_e)continue;const Le=_e.elevatedStructures;if(!Le)continue;const Pe=_e.elevationBufferData.heightRange,qe=NP(ue.toUnwrapped(),Y),Ze=_.translatePosMatrix(ue.projMatrix,ke,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));let He,xt,ct,pt;if(M==="initialize"){if(!Pe||Pe.min>=1||Le.depthSegments.segments[0].primitiveLength===0)continue;He=Qg(Ze,qe,V,1,0),xt=D,ct=Le.depthSegments,pt=ce}else if(M==="reset"){if(!Pe||Pe.min>=0||Le.maskSegments.segments[0].primitiveLength===0)continue;He=Qg(Ze,qe,0,0,1),xt=B,ct=Le.maskSegments,pt=ce}else if(M==="geometry"){if(Le.depthSegments.segments[0].primitiveLength===0)continue;He=Qg(Ze,qe,V,1,0),xt=D,ct=Le.depthSegments,pt=oe}pt.draw(_,O.TRIANGLES,xt,$n.disabled,is.disabled,Bn.disabled,He,m.id,Le.vertexBuffer,Le.indexBuffer,ct,m.paint,_.transform.zoom)}}function Zk(_,d,m,w){const{painter:M,sourceCache:O,layer:D,coords:B,colorMode:V,elevationType:Y,terrainEnabled:Q,pass:ce}=_,oe=M.context.gl,ue=D.paint.get("fill-pattern"),ke=D.paint.get("fill-pattern-cross-fade"),_e=ue.constantOr(null);let Le=Y;Y!=="road"||d&&!Q||(Le="none");const Pe=Le==="road",qe=_.painter.shadowRenderer,Ze=Pe&&!!qe&&qe.enabled,He=new un(M.context.gl.LEQUAL,un.ReadOnly,M.depthRangeFor3D);let xt=[0,0,0];if(Ze){const st=M.style.directionalLight,wt=M.style.ambientLight;st&&wt&&(xt=yp(M.style,st,wt))}const ct=ue&&ue.constantOr(1),pt=M.terrain&&M.terrain.renderingToTexture,lt=(st,wt)=>{let Ot,Pt,Vt,Wt,sr;wt?(Ot=ct&&!D.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Vt=oe.LINES):(Ot=ct?"fillPattern":"fill",Vt=oe.TRIANGLES);for(const br of B){const zt=O.getTile(br);if(ct&&!zt.patternsLoaded())continue;const Mt=zt.getBucket(D);if(!Mt)continue;const Xt=d?Mt.elevationBufferData:Mt.bufferData;if(Xt.isEmpty())continue;M.prepareDrawTile();const qt=Xt.programConfigurations.get(D.id),ur=M.isTileAffectedByFog(br),Er=[],Gr=[];Pe&&(Er.push("ELEVATED_ROADS"),Gr.push(Xt.elevatedLayoutVertexBuffer)),Ze&&Er.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),pt&&m&&Er.push("USE_MRT1"),ct&&(M.context.activeTexture.set(oe.TEXTURE0),zt.imageAtlasTexture&&zt.imageAtlasTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),qt.updatePaintBuffers());let Sr=!1;if(_e&&zt.imageAtlas){const Kr=zt.imageAtlas,Nn=a.e3.from(_e),Yn=Nn.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Ls=Nn.getSecondary(),ui=Kr.patternPositions.get(Yn),dn=Ls?Kr.patternPositions.get(Ls.scaleSelf(a.o.devicePixelRatio).toString()):null;Sr=!!ui&&!!dn,ui&&qt.setConstantPatternPositions(ui,dn)}ke>0&&(Sr||qt.getPatternTransitionVertexBuffer("fill-pattern"))&&Er.push("FILL_PATTERN_TRANSITION");const wr=M.getOrCreateProgram(Ot,{config:qt,overrideFog:ur,defines:Er}),on=M.translatePosMatrix(br.projMatrix,zt,D.paint.get("fill-translate"),D.paint.get("fill-translate-anchor"));Ze&&qe.setupShadows(zt.tileID.toUnwrapped(),wr,"vector-tile");const en=D.paint.get("fill-emissive-strength");if(wt){Wt=Xt.lineIndexBuffer,sr=Xt.lineSegments;const Kr=M.terrain&&M.terrain.renderingToTexture?M.terrain.drapeBufferSize:[oe.drawingBufferWidth,oe.drawingBufferHeight];Pt=Ot==="fillOutlinePattern"&&ct?l5(on,en,M,zt,Kr,xt,ke):mP(on,en,Kr,xt)}else Wt=Xt.indexBuffer,sr=Xt.triangleSegments,Pt=ct?o5(on,en,M,zt,xt,ke):a5(on,en,xt);M.uploadCommonUniforms(M.context,wr,br.toUnwrapped());let $r=st;(Y==="road"&&!Q||Y==="offset")&&($r=He),wr.draw(M,Vt,$r,w||M.stencilModeForClipping(br),V,Bn.disabled,Pt,D.id,Xt.layoutVertexBuffer,Wt,sr,D.paint,M.transform.zoom,qt,Gr)}};M.renderPass===ce&<(M.depthModeForSublayer(1,M.renderPass==="opaque"?un.ReadWrite:un.ReadOnly),!1),Le==="none"&&M.renderPass==="translucent"&&D.paint.get("fill-antialias")&<(M.depthModeForSublayer(D.getPaintProperty("fill-outline-color")?2:0,un.ReadOnly),!0)}function Yk(_,d,m,w,M,O,D,B){m.resetLayerRenderingStats(_);const V=_.context,Y=V.gl,Q=_.transform,ce=m.paint.get("fill-extrusion-pattern"),oe=m.paint.get("fill-extrusion-pattern-cross-fade"),ue=ce.constantOr(null),ke=ce.constantOr(1),_e=m.paint.get("fill-extrusion-opacity"),Le=_.style.enable3dLights(),Pe=m.paint.get(Le&&!ke?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),qe=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Pe],Ze=m.layout.get("fill-extrusion-edge-radius"),He=Ze>0&&!m.paint.get("fill-extrusion-rounded-roof"),xt=He?0:Ze,ct=Q.projection.name==="globe"?a.eb():0,pt=Q.projection.name==="globe",lt=pt?a.aj(Q.zoom):0,st=[a.aF(Q.center.lng),a.aJ(Q.center.lat)],wt=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ot=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(wt?null:m.lut).toArray01().slice(0,3),Pt=m.paint.get("fill-extrusion-flood-light-intensity"),Vt=m.paint.get("fill-extrusion-vertical-scale"),Wt=m.paint.get("fill-extrusion-line-width").constantOr(1)!==0,sr=m.paint.get("fill-extrusion-height-alignment"),br=m.paint.get("fill-extrusion-base-alignment"),zt=Lm(_,m.paint.get("fill-extrusion-cutoff-fade-range")),Mt=[];let Xt;pt&&Mt.push("PROJECTION_GLOBE_VIEW"),qe[0]>0&&Mt.push("FAUX_AO"),He&&Mt.push("ZERO_ROOF_RADIUS"),B&&Mt.push("HAS_CENTROID"),Pt>0&&Mt.push("FLOOD_LIGHT"),zt.shouldRenderCutoff&&Mt.push("RENDER_CUTOFF"),Wt&&Mt.push("RENDER_WALL_MODE");const qt=_.renderPass==="shadow",ur=_.shadowRenderer,Er=qt&&!!ur,Gr=qt?Bn.disabled:Bn.backCCW;_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0);let Sr=[0,0,0];if(ur){const en=_.style.directionalLight,$r=_.style.ambientLight;en&&$r&&(Sr=yp(_.style,en,$r)),qt||(Mt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ur.useNormalOffset&&Mt.push("NORMAL_OFFSET")),Xt=Mt.concat(["SHADOWS_SINGLE_CASCADE"])}const wr=Er?"fillExtrusionDepth":ke?"fillExtrusionPattern":"fillExtrusion",on=m.getLayerRenderingStats();for(const en of w){const $r=d.getTile(en),Kr=$r.getBucket(m);if(!Kr||Kr.projection.name!==Q.projection.name)continue;let Nn=!1;ur&&(Nn=ur.getMaxCascadeForTile(en.toUnwrapped())===0);const Yn=_.isTileAffectedByFog(en),Ls=Kr.programConfigurations.get(m.id);let ui=!1;if(ue&&$r.imageAtlas){const ni=$r.imageAtlas,as=a.e3.from(ue),pi=as.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),Da=as.getSecondary(),xa=ni.patternPositions.get(pi),xi=Da?ni.patternPositions.get(Da.scaleSelf(a.o.devicePixelRatio).toString()):null;ui=!!xa&&!!xi,xa&&Ls.setConstantPatternPositions(xa,xi)}oe>0&&(ui||Ls.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Mt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const dn=_.getOrCreateProgram(wr,{config:Ls,defines:Nn?Xt:Mt,overrideFog:Yn});if(_.terrain&&_.terrain.setupElevationDraw($r,dn,{useMeterToDem:!0}),!Kr.centroidVertexBuffer){const ni=dn.getAttributeLocation(Y,"a_centroid_pos");ni!==-1&&Y.vertexAttrib2f(ni,0,0)}!qt&&ur&&ur.setupShadows($r.tileID.toUnwrapped(),dn,"vector-tile"),ke&&(_.context.activeTexture.set(Y.TEXTURE0),$r.imageAtlasTexture&&$r.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Ls.updatePaintBuffers());const ii=m.paint.get("fill-extrusion-vertical-gradient"),Wn=1/Kr.tileToMeter;let gi;if(qt&&ur){if(wp($r.tileID,Kr.maxHeight,_))continue;const ni=ur.calculateShadowPassMatrixFromTile($r.tileID.toUnwrapped());gi=i5(ni,xt,Wn,Vt,sr,br)}else{const ni=_.translatePosMatrix(en.expandedProjMatrix,$r,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),as=Q.projection.createInversionMatrix(Q,en.canonical);gi=ke?pP(ni,_,ii,_e,qe,xt,Wn,en,$r,ct,sr,br,lt,st,as,Ot,Vt,oe):Uk(ni,_,ii,_e,qe,xt,Wn,en,ct,sr,br,lt,st,as,Ot,Vt,Pt,Sr)}_.uploadCommonUniforms(V,dn,en.toUnwrapped(),null,zt);let Li=Kr.segments;if(Q.projection.name==="mercator"&&!qt&&(Li=Kr.getVisibleSegments($r.tileID,_.terrain,_.transform.getFrustum(0)),!Li.get().length))continue;if(on)if(qt)for(const ni of Li.get())on.numRenderedVerticesInShadowPass+=ni.primitiveLength;else for(const ni of Li.get())on.numRenderedVerticesInTransparentPass+=ni.primitiveLength;const Ni=[];(_.terrain||B)&&Ni.push(Kr.centroidVertexBuffer),pt&&Ni.push(Kr.layoutVertexExtBuffer),Wt&&Ni.push(Kr.wallVertexBuffer),dn.draw(_,V.gl.TRIANGLES,M,O,D,Gr,gi,m.id,Kr.layoutVertexBuffer,Kr.indexBuffer,Li,m.paint,_.transform.zoom,Ls,Ni)}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1)}class f5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function bp(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,ue,ke,_e,Le,Pe,qe,Ze){const He=d.context,xt=He.gl,ct=d.transform,pt=d.transform.zoom,lt=[],st=_.translate,wt=_.translateAnchor,Ot=_.edgeRadius,Pt=Lm(d,_.cutoffFadeRange);Q==="clear"?(lt.push("CLEAR_SUBPASS"),Ze&&(lt.push("CLEAR_FROM_TEXTURE"),He.activeTexture.set(xt.TEXTURE0),Ze.bind(xt.LINEAR,xt.CLAMP_TO_EDGE))):Q==="sdf"?lt.push("SDF_SUBPASS"):Q==="emissive"&&(lt.push("USE_MRT1"),He.activeTexture.set(xt.TEXTURE0),Ze.bind(xt.LINEAR,xt.CLAMP_TO_EDGE)),Pe&<.push("HAS_CENTROID"),Pt.shouldRenderCutoff&<.push("RENDER_CUTOFF");const Vt=(Wt,sr,br,zt,Mt)=>{let Xt=lt;sr.groundRadiusBuffer!=null&&(Xt=lt.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const qt=sr.programConfigurations.get(w.id),ur=d.isTileAffectedByFog(Wt),Er=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:qt,defines:Xt,overrideFog:ur}),Gr=Dy(d,zt,ce,Y,Mt,[oe,ue*Mt],ke,_e,Le,pt>=17?0:Ot*Mt,Ze?Ze.size[0]:0),Sr=[];Pe&&Sr.push(sr.hiddenByLandmarkVertexBuffer),sr.groundRadiusBuffer!=null&&Sr.push(sr.groundRadiusBuffer),d.uploadCommonUniforms(He,Er,Wt.toUnwrapped(),null,Pt),Er.draw(d,He.gl.TRIANGLES,O,D,B,V,Gr,w.id,sr.vertexBuffer,sr.indexBuffer,br,w.paint,pt,qt,Sr)};for(const Wt of M){const sr=m.getTile(Wt),br=sr.getBucket(w);if(!br||br.projection.name!==ct.projection.name||!br.groundEffect||br.groundEffect&&!br.groundEffect.hasData())continue;const zt=br.groundEffect,Mt=1/br.tileToMeter;{const Xt=d.translatePosMatrix(Wt.projMatrix,sr,st,wt),qt=zt.getDefaultSegment();Vt(Wt,zt,qt,Xt,Mt)}if(qe)for(let Xt=0;Xt<4;Xt++){const qt=a.e9[Xt](Wt),ur=m.getTile(qt);if(!ur)continue;const Er=ur.getBucket(w);if(!Er||Er.projection.name!==ct.projection.name||!Er.groundEffect||Er.groundEffect&&!Er.groundEffect.hasData())continue;const Gr=Er.groundEffect;let Sr,wr;Xt===0?(Sr=[-a.al,0,0],wr=1):Xt===1?(Sr=[a.al,0,0],wr=0):Xt===2?(Sr=[0,-a.al,0],wr=3):(Sr=[0,a.al,0],wr=2);const on=Gr.regionSegments[wr];if(!on)continue;const en=new Float32Array(16);a.br(en,Wt.projMatrix,Sr),Vt(Wt,Gr,on,d.translatePosMatrix(en,sr,st,wt),Mt)}}}function uae(_,d,m,w,M,O,D){w.centroidVertexArray.length===0&&w.createCentroidsBuffer();const B=O?O.findDEMTileFor(m):null;if(!(B&&B.dem||D))return;O&&B&&B.dem&&w.selfDEMTileTimestamp!==B.dem._timestamp&&(w.borderDoneWithNeighborZ=[-1,-1,-1,-1],w.selfDEMTileTimestamp=B.dem._timestamp);const V=Pe=>new a.P(Math.ceil((Pe+a.ed)*a.ee),0),Y=Pe=>{const qe=d.getSource().minzoom,Ze=xt=>{const ct=d.getTileByID(xt);if(ct&&ct.hasData())return ct.getBucket(M)},He=[0,-1,1];for(const xt of He){if(Pe.overscaledZ+xt(Q[0]=Math.min(Pe.min.y,qe.min.y),Q[1]=Math.max(Pe.max.y,qe.max.y),Q[2]=a.al-qe.min.x>Pe.max.x?qe.min.x-a.al:Pe.max.x,Q),oe=(Pe,qe)=>(Q[0]=Math.min(Pe.min.x,qe.min.x),Q[1]=Math.max(Pe.max.x,qe.max.x),Q[2]=a.al-qe.min.y>Pe.max.y?qe.min.y-a.al:Pe.max.y,Q),ue=[(Pe,qe)=>ce(Pe,qe),(Pe,qe)=>ce(qe,Pe),(Pe,qe)=>oe(Pe,qe),(Pe,qe)=>oe(qe,Pe)],ke=(Pe,qe,Ze,He,xt,ct,pt)=>{if(!O)return 0;const lt=[[ct?Ze:Pe,ct?Pe:Ze,0],[ct?Ze:qe,ct?qe:Ze,0]],st=pt<0?a.al+pt:pt,wt=[ct?st:(Pe+qe)/2,ct?(Pe+qe)/2:st,0];return Ze===0&&pt<0||Ze!==0&&pt>0?O.getForTilePoints(xt,[wt],!0,He):lt.push(wt),O.getForTilePoints(m,lt,!0,B),Math.max(lt[0][2],lt[1][2],wt[2])/O.exaggeration()};for(let Pe=0;Pe<4;Pe++){const qe=w.borderFeatureIndices[Pe];if(qe.length===0)continue;const Ze=a.e9[Pe](m),He=Y(Ze);if(!(He&&He instanceof a.ea))continue;const xt=O?O.findDEMTileFor(Ze):null;if(!(xt&&xt.dem||D)||(O&&xt&&xt.dem&&w.borderDEMTileTimestamp[Pe]!==xt.dem._timestamp&&(w.borderDoneWithNeighborZ[Pe]=-1,w.borderDEMTileTimestamp[Pe]=xt.dem._timestamp),w.borderDoneWithNeighborZ[Pe]===He.canonical.z))continue;He.centroidVertexArray.length===0&&He.createCentroidsBuffer();const ct=(Pe<2?1:5)-Pe,pt=He.borderDoneWithNeighborZ[ct]!==w.canonical.z,lt=He.borderFeatureIndices[ct];let st=0;if(w.canonical.z!==He.canonical.z){for(const wt of qe)w.showCentroid(w.featuresOnBorder[wt]);if(pt)for(const wt of lt)He.showCentroid(He.featuresOnBorder[wt]);w.borderDoneWithNeighborZ[Pe]=He.canonical.z,He.borderDoneWithNeighborZ[ct]=w.canonical.z}for(const wt of qe){const Ot=w.featuresOnBorder[wt],Pt=w.centroidData[Ot.centroidDataIndex],Vt=Ot.borders[Pe];let Wt;for(;stVt[0]+3||sr[0]>Vt[0]-3)break;He.showCentroid(Wt),st++}if(Wt&&stVt[1]-3)&&(br++,++st!==lt.length);)Wt=He.featuresOnBorder[lt[st]];Wt=He.featuresOnBorder[lt[sr]];let zt=!1;if(br>=1){const qt=Wt.borders[ct];Math.abs(Vt[0]-qt[0])<3&&Math.abs(Vt[1]-qt[1])<3&&(br=1,zt=!0,st=sr+1)}else if(br===0){w.showCentroid(Ot);continue}const Mt=He.centroidData[Wt.centroidDataIndex];D&&zt&&(((_e=Pt).flags|(Le=Mt).flags)&a.ec?(_e.flags|=a.ec,Le.flags|=a.ec):(_e.flags&=~a.ec,Le.flags&=~a.ec));const Xt=Ot.intersectsCount()>1||Wt.intersectsCount()>1;if(br>1)st=sr,Pt.centroidXY=Mt.centroidXY=new a.P(0,0);else if(xt&&xt.dem&&!Xt){const qt=ue[Pe](Pt,Mt),ur=Pe%2?a.al-1:0,Er=ke(qt[0],Math.min(a.al-1,qt[1]),ur,xt,Ze,Pe<2,qt[2]);Pt.centroidXY=Mt.centroidXY=V(Er)}else Xt?Pt.centroidXY=Mt.centroidXY=new a.P(0,0):(Pt.centroidXY=w.encodeBorderCentroid(Ot),Mt.centroidXY=He.encodeBorderCentroid(Wt));w.writeCentroidToBuffer(Pt),He.writeCentroidToBuffer(Mt)}else w.showCentroid(Ot)}w.borderDoneWithNeighborZ[Pe]=He.canonical.z,He.borderDoneWithNeighborZ[ct]=w.canonical.z}var _e,Le;(w.needsCentroidUpdate||!w.centroidVertexBuffer&&w.centroidVertexArray.length!==0)&&w.uploadCentroid(_)}const Ud=[1,0,0],p5=[0,1,0],ed=[0,0,1];function wp(_,d,m){const w=m.transform,M=m.shadowRenderer;if(!M)return!0;const O=_.toUnwrapped(),D=w.tileSize*M._cascades[m.currentShadowCascade].scale;let B=d;if(w.elevation){const _e=w.elevation.getMinMaxForTile(_);_e&&(B+=_e.max)}const V=[...M.shadowDirection];V[2]=-V[2];const Y=M.computeSimplifiedTileShadowVolume(O,B,D,V);if(!Y)return!1;const Q=[Ud,p5,ed,V,[V[0],0,V[2]],[0,V[1],V[2]]],ce=w.projection.name==="globe",oe=w.scaleZoom(D),ue=a.cB.fromInvProjectionMatrix(w.invProjMatrix,w.worldSize,oe,!ce),ke=M.getCurrentCascadeFrustum();return ue.intersectsPrecise(Y.vertices,Y.planes,Q)===0||ke.intersectsPrecise(Y.vertices,Y.planes,Q)===0}function Rv(_){const{painter:d,source:m,layer:w,coords:M}=_;let O=_.defines;const D=d.context,B=d.renderPass==="shadow",V=d.renderPass==="light-beam",Y=d.shadowRenderer,Q=a.ef(d.transform.center.lat,d.transform.zoom),ce=Lm(d,w.paint.get("building-cutoff-fade-range"));ce.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),_.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const oe of M){const ue=m.getTile(oe),ke=ue.getBucket(w);if(!ke)continue;Y&&Y.getMaxCascadeForTile(oe.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const _e=ke.programConfigurations.get(w.id);let Le,Pe,qe,Ze=d.translatePosMatrix(oe.expandedProjMatrix,ue,[0,0],"map");if(Ze=a.cS(a.bC(),Ze,[1,1,_.verticalScale]),B&&Y){if(wp(ue.tileID,ke.maxHeight*Q,d))continue;let xt=Y.calculateShadowPassMatrixFromTile(ue.tileID.toUnwrapped());xt=a.cS(a.bC(),xt,[1,1,_.verticalScale]),qe=$m(xt),Le=Pe=d.getOrCreateProgram("buildingDepth",{config:_e,defines:O,overrideFog:!1})}else if(V)Le=Pe=d.getOrCreateProgram("buildingBloom",{config:_e,defines:O,overrideFog:!1}),qe=gP(Ze);else{const xt=d.transform.calculatePosMatrix(oe.toUnwrapped(),d.transform.worldSize);a.cS(xt,xt,[1,1,_.verticalScale]);const ct=a.bC();a.cS(ct,xt,[1,-1,1/Q]),a.bl(ct,ct),a.eg(ct,ct);const pt=d.transform.getFreeCameraOptions().position,lt=1<{if(V){const pt=xt.entranceBloom;ct.draw(d,D.gl.TRIANGLES,_.depthMode,$n.disabled,_.blendMode,Bn.disabled,qe,w.id,pt.layoutVertexBuffer,pt.indexBuffer,pt.segmentsBucket,w.paint,d.transform.zoom,_e,[pt.layoutAttenuationBuffer,pt.layoutColorBuffer])}else{const pt=xt.segmentsBucket;let lt=[xt.layoutNormalBuffer,xt.layoutCentroidBuffer,xt.layoutColorBuffer,xt.layoutFloodLightDataBuffer];xt.layoutFacadePaintBuffer&&(lt=lt.concat([xt.layoutFacadeDataBuffer,xt.layoutFacadeVerticalRangeBuffer,xt.layoutFacadePaintBuffer])),ct.draw(d,D.gl.TRIANGLES,_.depthMode,$n.disabled,_.blendMode,B?Bn.disabled:Bn.backCW,qe,w.id,xt.layoutVertexBuffer,xt.indexBuffer,pt,w.paint,d.transform.zoom,_e,lt)}};d.uploadCommonUniforms(D,Pe,oe.toUnwrapped(),null,ce),ke.buildingWithoutFacade&&He(ke.buildingWithoutFacade,Pe),ke.buildingWithFacade&&(Le!==Pe&&d.uploadCommonUniforms(D,Le,oe.toUnwrapped(),null,ce),He(ke.buildingWithFacade,Le))}}function Xk(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe){const ue=_.context.gl,ke=_.depthModeForSublayer(1,un.ReadOnly,ue.LEQUAL,!0),_e=.1*(1-(Le=Q))+3*Le;var Le;const Pe=_._showOverdrawInspector,qe=ce,Ze=new f5;Pe||bp(Ze,_,d,m,w,ke,new $n({func:ue.ALWAYS,mask:255},255,255,ue.KEEP,ue.KEEP,ue.REPLACE),new is([ue.ONE,ue.ONE,ue.ONE,ue.ONE],a.ao.transparent,[!1,!1,!1,!0],ue.MIN),Bn.disabled,M,"sdf",O,D,B,V,Y,_e,qe,!1);{const He=Pe?$n.disabled:new $n({func:ue.EQUAL,mask:255},255,255,ue.KEEP,ue.DECR,ue.DECR),xt=Pe?_.colorModeForRenderPass():new is([ue.ONE_MINUS_DST_ALPHA,ue.DST_ALPHA,ue.ONE,ue.ONE],a.ao.transparent,[!0,!0,!0,!0]);bp(Ze,_,d,m,w,ke,He,xt,Bn.disabled,M,"color",O,D,B,V,Y,_e,qe,!1)}}function Qk(_){return[_[0]*a.eh,_[1]*a.eh,_[2]*a.eh,0]}function Fv(_,d,m,w,M,O,D,B,V){const Y=w.getSource(),Q=m.globeSharedBuffers;if(!Q)return;let ce,oe,ue;if(d&&(ce=w.getTile(d)),Y instanceof a.aU?(oe=Y.texture,ue=a.dK(0,0,m.transform)):ce&&d&&(oe=ce.texture,ue=a.dK(d.canonical.z,d.canonical.x,m.transform)),!oe||!ue)return;_||(ue=a.cS(a.bC(),ue,[1,-1,1]));const ke=m.context,_e=ke.gl,Le=M.paint.get("raster-resampling")==="nearest"?_e.NEAREST:_e.LINEAR,Pe=m.colorModeForDrapableLayerRenderPass(O),qe=D.defines;qe.push("GLOBE_POLES");const Ze=new un(_e.LEQUAL,un.ReadWrite,m.depthRangeFor3D),He=Float32Array.from(m.transform.expandedFarZProjMatrix),xt=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0))));m.terrain&&m.terrain.prepareDrawTile(),ke.activeTexture.set(_e.TEXTURE0),oe.bind(Le,_e.CLAMP_TO_EDGE),ke.activeTexture.set(_e.TEXTURE1),oe.bind(Le,_e.CLAMP_TO_EDGE),"useMipmap"in oe&&ke.extTextureFilterAnisotropic&&m.transform.pitch>20&&_e.texParameterf(_e.TEXTURE_2D,ke.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,ke.extTextureFilterAnisotropicMax);const[ct,pt,lt,st]=d?Q.getPoleBuffers(d.canonical.z,!1):Q.getPoleBuffers(0,!0),wt=M.paint.get("raster-elevation");let Ot;_?(Ot=ct,m.renderDefaultNorthPole=wt!==0):(Ot=pt,m.renderDefaultSouthPole=wt!==0);const Pt=Qk(D.mix),Vt=((sr,br,zt,Mt,Xt,qt,ur,Er,Gr,Sr,wr,on,en)=>vP(sr,br,zt,new Float32Array(16),new Float32Array(9),[0,0],Mt,[0,0],[0,0,0,0],1,{opacity:1,mix:0},qt,[0,0],Er,2,Sr,wr,on,1,0,en))(He,xt,ue,a.aj(m.transform.zoom),0,M,0,wt,0,Pt,D.offset,D.range,O),Wt=m.getOrCreateProgram("raster",{defines:qe});m.uploadCommonUniforms(ke,Wt,null),Wt.draw(m,_e.TRIANGLES,Ze,V,Pe,B,Vt,M.id,Ot,lt,st)}function SP(_){const d=_._nearZ,m=_.projection.farthestPixelDistance(_),w=m-d,M=.2*_.height,O=d+M;return[d,m,(O-M-d)/w,(O-d)/w]}function jp(_,d,m,w){if(_)return d instanceof sl&&_ instanceof pp?d.getTextureDescriptor(_,m,!0):{texture:_.texture,mix:Qk(w.mix),offset:w.offset,buffer:0,tileSize:1}}var Ji=a.ei([{name:"a_index",type:"Int16",components:1}]);class Jk{constructor(d,m,w,M){const O={width:w[0],height:w[1],data:null},D=d.gl;this.targetColorTexture=new a.T(d,O,D.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new a.T(d,O,D.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(m,M),this.lastInvalidatedAt=0}updateParticleTexture(d,m){if(this.particleTextureDimension===m.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const w=this.context.gl,M=m.width*m.height;this.particleTexture0=new a.T(this.context,m,w.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new a.T(this.context,m,w.RGBA8,{premultiply:!1,useMipmap:!1});const O=new a.ej;O.reserve(M);for(let D=0;D0){const Pt=a.bj(m.canonical,V),Vt=a.el(Pt);oe=a.aB(new Float32Array(16),V.globeMatrix,Vt),a.aB(oe,V.projMatrix,oe)}const ue=a.bC();ue[12]+=2*M/(a.o.devicePixelRatio*V.width),ue[13]+=2*O/(a.o.devicePixelRatio*V.height),a.aB(oe,ue,oe);const ke=_.getOrCreateProgram("debug",{defines:ce}),_e=d.getTileByID(m.key);_.terrain&&_.terrain.setupElevationDraw(_e,ke);const Le=un.disabled,Pe=$n.disabled,qe=_.colorModeForRenderPass(),Ze="$debug";B.activeTexture.set(Y.TEXTURE0),_.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Q?_e._makeGlobeTileDebugBuffers(_.context,V):_e._makeDebugTileBoundsBuffers(_.context,V.projection);const He=_e._tileDebugBuffer||_.debugBuffer,xt=_e._tileDebugIndexBuffer||_.debugIndexBuffer,ct=_e._tileDebugSegments||_.debugSegments;if(ke.draw(_,Y.LINE_STRIP,Le,Pe,qe,Bn.disabled,Pv(oe,w.toPremultipliedRenderColor(null)),Ze,He,xt,ct,null,null,null,[_e._globeTileDebugBorderBuffer]),D){const Pt=_e.latestRawTileData,Vt=Math.floor((Pt&&Pt.byteLength||0)/1024);let Wt=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(Wt+=` => ${m.overscaledZ}`),Wt+=` ${_e.state}`,Wt+=` ${Vt}kb`,function(sr,br){sr.initDebugOverlayCanvas();const zt=sr.debugOverlayCanvas,Mt=sr.context.gl,Xt=sr.debugOverlayCanvas.getContext("2d");Xt.clearRect(0,0,zt.width,zt.height),Xt.shadowColor="white",Xt.shadowBlur=2,Xt.lineWidth=1.5,Xt.strokeStyle="white",Xt.textBaseline="top",Xt.font="bold 36px Open Sans, sans-serif",Xt.fillText(br,5,5),Xt.strokeText(br,5,5),sr.debugOverlayTexture.update(zt),sr.debugOverlayTexture.bind(Mt.LINEAR,Mt.CLAMP_TO_EDGE)}(_,Wt)}const pt=d.getTile(m).tileSize,lt=512/Math.min(pt,512)*(m.overscaledZ/V.zoom)*.5,st=_e._tileDebugTextBuffer||_.debugBuffer,wt=_e._tileDebugTextIndexBuffer||_.quadTriangleIndexBuffer,Ot=_e._tileDebugTextSegments||_.debugSegments;ke.draw(_,Y.TRIANGLES,Le,Pe,is.alphaBlended,Bn.disabled,Pv(oe,a.ao.transparent.toPremultipliedRenderColor(null),lt),Ze,st,wt,Ot,null,null,null,[_e._globeTileDebugTextBuffer])}function nx(_,d,m,w){Ft(_,0,d+m/2,_.transform.width,m,w)}function $a(_,d,m,w){Ft(_,d-m/2,0,m,_.transform.height,w)}function Ft(_,d,m,w,M,O){const D=_.context,B=D.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*a.o.devicePixelRatio,m*a.o.devicePixelRatio,w*a.o.devicePixelRatio,M*a.o.devicePixelRatio),D.clear({color:O}),B.disable(B.SCISSOR_TEST)}const EP=a.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:eN}=EP;function yf(_,d,m,w){_.emplaceBack(d,m,w)}class tN{constructor(d){this.vertexArray=new a.em,this.indices=new a.b0,yf(this.vertexArray,-1,-1,1),yf(this.vertexArray,1,-1,1),yf(this.vertexArray,-1,1,1),yf(this.vertexArray,1,1,1),yf(this.vertexArray,-1,-1,-1),yf(this.vertexArray,1,-1,-1),yf(this.vertexArray,-1,1,-1),yf(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=d.createVertexBuffer(this.vertexArray,eN),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=a.bg.simpleSegment(0,0,36,12)}}function sx(_,d,m,w,M,O){const D=_.context.gl,B=d.paint.get("sky-atmosphere-color"),V=d.paint.get("sky-atmosphere-halo-color"),Y=d.paint.get("sky-atmosphere-sun-intensity"),Q=((ce,oe,ue,ke,_e)=>({u_matrix_3f:ce,u_sun_direction:oe,u_sun_intensity:ue,u_color_tint_r:[ke.r,ke.g,ke.b,ke.a],u_color_tint_m:[_e.r,_e.g,_e.b,_e.a],u_luminance:5e-5}))(a.eo(a.dO(),w),M,Y,B.toPremultipliedRenderColor(null),V.toPremultipliedRenderColor(null));D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+O,d.skyboxTexture,0),m.draw(_,D.TRIANGLES,un.disabled,$n.disabled,is.unblended,Bn.frontCW,Q,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const IP=a.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class zy{constructor(d){const m=new a.ep;m.emplaceBack(-1,1,1,0,0),m.emplaceBack(1,1,1,1,0),m.emplaceBack(1,-1,1,1,1),m.emplaceBack(-1,-1,1,0,1);const w=new a.b0;w.emplaceBack(0,1,2),w.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(m,IP.members),this.indexBuffer=d.createIndexBuffer(w),this.segments=a.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const hae=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class fae{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class PP{constructor(d){this.colorModeAlphaBlendedWriteRGB=new is([1,pf,1,pf],a.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new is([1,0,1,0],a.ao.transparent,[!1,!1,!1,!0]),this.params=new fae,this.updateNeeded=!0}update(d){const m=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new zy(m);const w=this.params.sizeRange,M=this.params.intensityRange,O=function(Q){const ce=a.eq(30),oe=[];for(let ue=0;ue{const lt=O.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];pt&<.push("ALPHA_PASS");const st=d.getOrCreateProgram("globeAtmosphere",{defines:lt}),wt=((Pt,Vt,Wt,sr,br,zt,Mt,Xt,qt,ur,Er,Gr)=>({u_frustum_tl:Pt,u_frustum_tr:Vt,u_frustum_br:Wt,u_frustum_bl:sr,u_horizon:br,u_transition:zt,u_fadeout_range:Mt,u_atmosphere_fog_color:Xt.toArray01(),u_high_color:qt.toArray01(),u_space_color:ur.toArray01(),u_temporal_offset:Er,u_horizon_angle:Gr}))(O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.frustumCorners.horizon,B,Le,Q,oe,ke,qe,xt);d.uploadCommonUniforms(w,st);const Ot=this.atmosphereBuffer;Ot&&st.draw(d,M.TRIANGLES,D,$n.disabled,pt?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Bn.backCW,wt,pt?"atmosphere_glow_alpha":"atmosphere_glow",Ot.vertexBuffer,Ot.indexBuffer,Ot.segments)};ct(!1),ct(!0)}drawStars(d,m){const w=a.aA(m.properties.get("star-intensity"),0,1);if(w===0)return;const M=d.context,O=M.gl,D=d.transform,B=d.getOrCreateProgram("stars"),V=a.c7([]);a.c9(V,V,-D._pitch),a.c8(V,V,-D.angle),a.c9(V,V,a.an(D._center.lat)),a.et(V,V,-a.an(D._center.lng));const Y=a.cc(new Float32Array(16),V),Q=a.aB([],D.starsProjMatrix,Y),ce=a.eo([],Y),oe=a.eu([],ce),ue=[0,1,0];a.dQ(ue,ue,oe),a.c5(ue,ue,this.params.sizeMultiplier);const ke=[1,0,0];a.dQ(ke,ke,oe),a.c5(ke,ke,this.params.sizeMultiplier);const _e=(Le=ue,Pe=ke,qe=w,{u_matrix:Float32Array.from(Q),u_up:Le,u_right:Pe,u_intensity_multiplier:qe});var Le,Pe,qe;d.uploadCommonUniforms(M,B),this.starsVx&&this.starsIdx&&B.draw(d,O.TRIANGLES,un.disabled,$n.disabled,this.colorModeAlphaBlendedWriteRGB,Bn.disabled,_e,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class rN{constructor(){this.visibleTiles=[]}updateBorders(d,m){const w=[],M=[],O=d._getRenderableCoordinates(!1,!0);for(const V of O){const Y=d.getTile(V);if(!Y.hasData())continue;const Q=Y.getBucket(m);Q&&(Q.isEmpty()||(w.push(V.key),M.push({bucket:Q,tileID:V.canonical})))}let D=w.length!==this.visibleTiles.length;if(!D){w.sort();for(let V=0;VV.tileID.z-Y.tileID.z||V.tileID.x-Y.tileID.x||V.tileID.y-Y.tileID.y);for(const V of M){const Y=new Array,Q=new Array,ce=V.bucket;for(const oe of ce.featuresOnBorder)B.has(oe.featureId)?Q.push(oe.footprintIndex):(B.add(oe.featureId),Y.push(oe.footprintIndex));ce.updateFootprintHiddenFlags(Y,a.ev,!1),ce.updateFootprintHiddenFlags(Q,a.ev,!0)}}}function nN(_,d){const m=[..._],w=d.cameraWorldSizeForFog/d.worldSize,M=a.bA([]);return a.cS(M,M,[w,w,1]),a.aB(m,M,m),a.aB(m,d.worldToFogMatrix,m),m}function sN(_,d,m,w,M){const O=m.material,D=w.context,{baseColorTexture:B,metallicRoughnessTexture:V}=O.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:Q,emissionTexture:ce}=O;function oe(ke,_e,Le){if(ke&&(_.push(_e),D.activeTexture.set(D.gl.TEXTURE0+Le),ke.gfxTexture)){const{minFilter:Pe,magFilter:qe,wrapS:Ze,wrapT:He}=ke.sampler;ke.gfxTexture.bindExtraParam(Pe,qe,Ze,He)}}oe(B,"HAS_TEXTURE_u_baseColorTexture",Sl.BaseColor),oe(V,"HAS_TEXTURE_u_metallicRoughnessTexture",Sl.MetallicRoughness),oe(Y,"HAS_TEXTURE_u_normalTexture",Sl.Normal),oe(Q,"HAS_TEXTURE_u_occlusionTexture",Sl.Occlusion),oe(ce,"HAS_TEXTURE_u_emissionTexture",Sl.Emission),M&&(M.texture||(M.texture=new a.d$(w.context,M.image,[M.image.height,M.image.height,M.image.height],D.gl.RGBA8)),D.activeTexture.set(D.gl.TEXTURE0+Sl.LUT),M.texture&&M.texture.bind(D.gl.LINEAR,D.gl.CLAMP_TO_EDGE),_.push("APPLY_LUT_ON_GPU")),m.texcoordBuffer&&(_.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(m.texcoordBuffer)),m.colorBuffer&&(_.push(m.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(m.colorBuffer)),m.normalBuffer&&(_.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(m.normalBuffer)),m.pbrBuffer&&(_.push("HAS_ATTRIBUTE_a_pbr"),_.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(m.pbrBuffer)),O.alphaMode!=="OPAQUE"&&O.alphaMode!=="MASK"||_.push("UNPREMULT_TEXTURE_IN_SHADER"),O.defined||_.push("DIFFUSE_SHADED");const ue=w.shadowRenderer;ue&&(_.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ue.useNormalOffset&&_.push("NORMAL_OFFSET"))}function iN(_,d,m,w,M,O){const D=_.modelOpacity,B=d.context,V=new un(d.context.gl.LEQUAL,_.isLightMesh?un.ReadOnly:un.ReadWrite,d.depthRangeFor3D),Y=d.transform,Q=_.mesh,ce=Q.material,oe=ce.pbrMetallicRoughness,ue=d.style.fog;let ke;ke=d.transform.projection.zAxisUnit==="pixels"?[..._.nodeModelMatrix]:a.aB([],w.zScaleMatrix,_.nodeModelMatrix),a.aB(ke,w.negCameraPosMatrix,ke);const _e=a.bl([],ke);a.eg(_e,_e);const Le=m.paint.get("model-color-use-theme").constantOr("default")==="none",Pe=m.paint.get("model-emissive-strength").constantOr(0),qe=Jg(new Float32Array(_.worldViewProjection),new Float32Array(ke),new Float32Array(_e),null,d,D,oe.baseColorFactor,ce.emissiveFactor,oe.metallicFactor,oe.roughnessFactor,ce,Pe,m,void 0,void 0,_.materialOverride,_.modelColor),Ze={defines:[]},He=[],xt=d.shadowRenderer;xt&&(xt.useNormalOffset=!1),sN(Ze.defines,He,Q,d,Le?null:m.lut);let ct=null;if(ue){const st=nN(_.nodeModelMatrix,d.transform);if(ct=new Float32Array(st),Y.projection.name!=="globe"){const wt=Q.aabb.min,Ot=Q.aabb.max,[Pt,Vt]=ue.getOpacityForBounds(st,wt[0],wt[1],Ot[0],Ot[1]);Ze.overrideFog=Pt>=ar||Vt>=ar}}const pt=Lm(d,m.paint.get("model-cutoff-fade-range"));pt.shouldRenderCutoff&&Ze.defines.push("RENDER_CUTOFF");const lt=d.getOrCreateProgram("model",Ze);d.uploadCommonUniforms(B,lt,null,ct,pt),d.renderPass!=="shadow"&&xt&&xt.setupShadowsFromMatrix(_.nodeModelMatrix,lt),lt.draw(d,B.gl.TRIANGLES,V,M,O,Q.material.doubleSided?Bn.disabled:Bn.backCCW,qe,m.id,Q.vertexBuffer,Q.indexBuffer,Q.segments,m.paint,d.transform.zoom,void 0,He)}function zv(_,d){return _.style._importedAsBasemap?"basemap":d.scope}function ix(_,d,m,w,M,O,D,B,V,Y){const Q=_.transform,ce=!!d.isGeometryBloom&&d.isGeometryBloom;if(ce&&_.renderPass==="shadow")return;const oe=Q.projection.name==="globe"?a.eD(m,Q):[...m];a.aB(oe,oe,d.globalMatrix);const ue=a.aB([],w,oe);if(d.meshes)for(const ke of d.meshes){const _e=B.get(ke.material.name);if(_e&&_e.opacity<=0)continue;if(ke.material.alphaMode!=="BLEND"){D.push({mesh:ke,depth:0,modelIndex:M,worldViewProjection:ue,nodeModelMatrix:oe,isLightMesh:ce,materialOverride:_e,modelOpacity:V,modelColor:Y});continue}const Le=a.af([],ke.centroid,ue);!Q.isOrthographic&&Le[2]<=0||O.push({mesh:ke,depth:Le[2],modelIndex:M,worldViewProjection:ue,nodeModelMatrix:oe,isLightMesh:ce,materialOverride:_e,modelOpacity:V,modelColor:Y})}if(d.children)for(const ke of d.children)ix(_,ke,m,w,M,O,D,B,V,Y)}function Th(_,d,m,w){const M=m.shadowRenderer;if(!M)return;const O=M.getShadowPassDepthMode(),D=M.getShadowPassColorMode(),B=M.calculateShadowPassMatrixFromMatrix(d),V=d5(B);m.getOrCreateProgram("modelDepth",{defines:m._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(m,m.context.gl.TRIANGLES,O,$n.disabled,D,Bn.disabled,V,w.id,_.vertexBuffer,_.indexBuffer,_.segments,w.paint,m.transform.zoom,void 0,void 0)}function LP(_,d,m,w,M,O){for(const D of M){const B=Object.assign({},w);B.part=D;const V={type:"Unknown",id:d,properties:B},Y={orientation:_.paint.get("model-rotation").evaluate(V,m)};O.set(D,Y)}}function OP(_,d,m,w,M,O){for(const D of M){const B=Object.assign({},w);B.part=D;const V={type:"Unknown",id:d,properties:B},Y={color:_.paint.get("model-color").evaluate(V,m),colorMix:_.paint.get("model-color-mix-intensity").evaluate(V,m),opacity:_.paint.get("model-opacity").evaluate(V,m),emissionStrength:_.paint.get("model-emissive-strength").evaluate(V,m)};O.set(D,Y)}}function DP(_,d,m,w,M){let O=!1;for(const B of w)B.modelOpacity!==1&&(iN(B,_,d,M[B.modelIndex],$n.disabled,is.disabled),O=!0);for(const B of w)iN(B,_,d,M[B.modelIndex],B.modelOpacity!==1?_.stencilModeFor3D():$n.disabled,_.colorModeForRenderPass());O&&_.resetStencilClippingMasks();const D=is.additive;for(const B of m)iN(B,_,d,M[B.modelIndex],$n.disabled,B.isLightMesh?D:_.colorModeForRenderPass())}function RP(_,d,m){const w=d.updateZoomBasedPaintProperties(),M=function(O,D,B){let V,Y,Q,ce=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&ce>0){const oe=O.terrain,ue=oe.findDEMTileFor(B);ue&&ue.dem?V=a.eF.create(oe,B,ue):ce=0}if(ce===0&&(D.terrainElevationMin=0,D.terrainElevationMax=0),ce===D.validForExaggeration&&(ce===0||V&&V._demTile&&V._demTile.tileID===D.validForDEMTile.id&&V._dem._timestamp===D.validForDEMTile.timestamp))return!1;for(const oe in D.instancesPerModel){const ue=D.instancesPerModel[oe];for(let ke=0;keY&&(Y=ue.max)}const Q=a.aA(w.x,O,D)-w.x,ce=a.aA(w.y,B,V)-w.y,oe=a.cf(Y,d.center.lat)-w.z;return d._zoomFromMercatorZ(Math.sqrt(Q*Q+ce*ce+oe*oe))}function FP(_,d,m,w,M,O,D){const B=_.context,V=_.renderPass==="shadow",Y=_.shadowRenderer,Q=V&&Y?Y.getShadowPassDepthMode():new un(B.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D),ce=_.isTileAffectedByFog(O),oe=_.transform.projection.name==="globe";if(m.meshes)for(const ue of m.meshes){const ke=oe?[]:["MODEL_POSITION_ON_GPU"],_e=[];let Le,Pe,qe;const Ze=!oe&&w.instancedDataArray.length>20;Ze&&ke.push("INSTANCED_ARRAYS");const He=Lm(_,d.paint.get("model-cutoff-fade-range"));if(He.shouldRenderCutoff&&ke.push("RENDER_CUTOFF"),V&&Y)Le=_.getOrCreateProgram("modelDepth",{defines:ke}),Pe=d5(D.shadowTileMatrix,D.shadowTileMatrix,Float32Array.from(m.globalMatrix)),qe=Y.getShadowPassColorMode();else{sN(ke,_e,ue,_,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Le=_.getOrCreateProgram("model",{defines:ke,overrideFog:ce});const ct=ue.material,pt=ct.pbrMetallicRoughness,lt=d.paint.get("model-opacity").constantOr(1),st=d.paint.get("model-emissive-strength").constantOr(0);Pe=Jg(O.expandedProjMatrix,Float32Array.from(m.globalMatrix),new Float32Array(16),null,_,lt,pt.baseColorFactor,ct.emissiveFactor,pt.metallicFactor,pt.roughnessFactor,ct,st,d,M),Y&&(D.shadowUniformsInitialized?Le.setShadowUniformValues(B,Y.getShadowUniformValues()):(Y.setupShadows(O.toUnwrapped(),Le,"model-tile"),D.shadowUniformsInitialized=!0)),qe=He.shouldRenderCutoff||lt<1||ct.alphaMode!=="OPAQUE"?is.alphaBlended:is.unblended}_.uploadCommonUniforms(B,Le,O.toUnwrapped(),null,He);const xt=ue.material.doubleSided?Bn.disabled:Bn.backCCW;if(Ze)_e.push(w.instancedDataBuffer),Le.draw(_,B.gl.TRIANGLES,Q,$n.disabled,qe,xt,Pe,d.id,ue.vertexBuffer,ue.indexBuffer,ue.segments,d.paint,_.transform.zoom,void 0,_e,w.instancedDataArray.length);else{const ct=V?"u_instance":"u_normal_matrix";for(let pt=0;ptV[1]?D:V,O[0]=m.max[0],D=a.aC(a.eG(),O,M),B=D[1]V[1]?D:V,O[1]=m.min[1],D=a.aC(a.eG(),O,M),B=D[1]V[1]?D:V;const Y=a.aA(w[0],0,1),Q=100*d.pixelsPerMeter*a.aA(w[1],0,1),ce=a.aA(w[2],0,1),oe=a.eH(a.eG(),B,V,Y),ue=Math.tan(.5*d.fovX),ke=-oe[2]*ue;if(Q===0)return oe[1]<-Math.abs(ke)?ce:1;const _e=(-Math.abs(ke)-oe[1])/Q,Le=(qe,Ze,He)=>(1-He)*qe+He*Ze,Pe=a.aA(Le(1,ce,_e),ce,1);return Le(1,Pe,a.aA((d.pitch-20)/20,0,1))}class zP{}class Vm{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,m,w){{const ce=this._storage.get(m.id);if(ce)return ce.lastUsedFrameIdx=d,ce.buf}const M=w.gl,O=M.getBufferParameter(M.ELEMENT_ARRAY_BUFFER,M.BUFFER_SIZE),D=new ArrayBuffer(O),B=new Int16Array(D);M.getBufferSubData(M.ELEMENT_ARRAY_BUFFER,0,new Int16Array(D));const V=new a.eJ;for(let ce=0;ce30&&(w.buf.destroy(),this._storage.delete(m))}destroy(){for(const[d,m]of this._storage)m.buf.destroy(),this._storage.delete(d)}}class By{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const $y=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class kp{constructor(d){this.revealStart=11,this.revealRange=2}}const g5=a.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class x5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,m){const w=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const D=new a.eK,B=new a.b0;D.emplaceBack(-1,-1),D.emplaceBack(1,-1),D.emplaceBack(1,1),D.emplaceBack(-1,1),B.emplaceBack(0,1,2),B.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(D,g5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const M=a.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,w);const D={u_vignetteShape:(O={vignetteShape:[m.start,m.range,Math.pow(10,m.fadePower)],vignetteColor:[m.color.r,m.color.g,m.color.b,m.color.a*m.strength]}).vignetteShape,u_vignetteColor:O.vignetteColor};w.draw(d,d.context.gl.TRIANGLES,un.disabled,$n.disabled,is.alphaBlended,Bn.disabled,D,"vignette",this.vignetteVx,this.vignetteIdx,M)}var O}}class y5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,m){const w=d.getFreeCameraOptions().position,M=w.toAltitude(),O=w.toLngLat(),D=a.an(O.lng),B=a.an(O.lat),V=d.pixelsPerMeter/m,Y=D*a.eM,Q=a.eM*Math.log(Math.tan(Math.PI/4+B/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const ce=-this._offsetYPrev+Q,oe=-this._elevationPrev+M;this._accumulatedOffsetX+=(-this._offsetXPrev+Y)*V,this._accumulatedOffsetY+=ce*V,this._accumulatedElevation+=oe*V,this._offsetXPrev=Y,this._offsetYPrev=Q,this._elevationPrev=M}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function aN(_,d){return[-(_[0]-Math.floor(_[0]/d)*d),-(_[1]-Math.floor(_[1]/d)*d),-(_[2]-Math.floor(_[2]/d)*d)]}function du(_){const d=a.eq(1323123451230),m=[];for(let w=0;w<_;++w){const M=2*d()-1,O=2*d()-1,D=2*d()-1;m.push(a.d5(M,O,D))}return m}function jd(_,d,m,w,M){const O=a.aA((M-m)/(w-m),0,1);return(1-O)*_+O*d}class ax{constructor(d){this._movement=new y5,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new x5,this._ppmScaleFactor=d}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(d,m){const w=d.transform;this._movement.update(w,this._ppmScaleFactor);const M=w.starsProjMatrix,O=a.c7([]);a.c9(O,O,a.an(90)-w._pitch),a.c8(O,O,-w.angle);const D=a.cc(new Float32Array(16),O),B=a.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),V=a.eg([],B),Y=a.aB([],V,D),Q=Date.now()/1e3;return this._accumulatedTimeFromStart+=(Q-this._prevTime)*m,this._prevTime=Q,{projectionMatrix:M,modelviewMatrix:Y}}}class oN extends ax{constructor(d){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 kp("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(d){const m=d.context;if(!this.particlesVx){const w=du(this.particlesCount),M=new a.eN,O=new a.b0;let D=0;const B=a.eq(1323123451230);for(let V=0;Vw)return;const M=jd(0,1,m.revealStart,m.revealStart+m.revealRange,w);if(!this.particlesVx||!this.particlesIdx)return;const O=structuredClone(this._params);let D=[-O.direction.x,O.direction.y,-100];a.aw(D,D);const B=structuredClone(this._vignetteParams);B.strength*=M,O.overrideStyleParameters||(O.intensity=d.style.rain.state.density,O.timeFactor=d.style.rain.state.intensity,O.color=structuredClone(d.style.rain.state.color),D=structuredClone(d.style.rain.state.direction),O.screenThinning.intensity=d.style.rain.state.centerThinning,O.dropletSizeX=d.style.rain.state.dropletSize[0],O.dropletSizeYScale=d.style.rain.state.dropletSize[1]/d.style.rain.state.dropletSize[0],O.distortionStrength=100*d.style.rain.state.distortionStrength,B.strength=1,B.color=structuredClone(d.style.rain.state.vignetteColor));const V=this.updateOnRender(d,O.timeFactor),Y=d.context,Q=Y.gl,ce=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new a.T(Y,{width:d.width,height:d.height,data:null},Q.RGBA8)),O.distortionStrength>0&&(Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE),Q.copyTexSubImage2D(Q.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const oe=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(Y,oe),Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const ue=[O.color.r,O.color.g,O.color.b,O.color.a],ke=(_e,Le)=>{const Pe=aN(this._movement.getPosition(),_e),qe=O.dropletSizeX,Ze=O.dropletSizeX*O.dropletSizeYScale,He=d.width/2,xt=d.height/2,ct=jd(0,O.screenThinning.start,0,1,O.screenThinning.intensity),pt=jd(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),lt=jd(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),st=(wt={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Pe,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,boxSize:_e,rainDropletSize:[qe,Ze],distortionStrength:O.distortionStrength,rainDirection:D,color:ue,screenSize:[ce.width,ce.height],thinningCenterPos:[He,xt],thinningShape:[ct,pt,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:lt,shapeDirectionalPower:O.shapeDirPower,shapeNormalPower:O.shapeNormalPower,mode:Le?0:1},{u_modelview:Float32Array.from(wt.modelview),u_projection:Float32Array.from(wt.projection),u_time:wt.time,u_cam_pos:wt.camPos,u_texScreen:0,u_velocityConeAperture:wt.velocityConeAperture,u_velocity:wt.velocity,u_boxSize:wt.boxSize,u_rainDropletSize:wt.rainDropletSize,u_distortionStrength:wt.distortionStrength,u_rainDirection:wt.rainDirection,u_color:wt.color,u_screenSize:wt.screenSize,u_thinningCenterPos:wt.thinningCenterPos,u_thinningShape:wt.thinningShape,u_thinningAffectedRatio:wt.thinningAffectedRatio,u_thinningParticleOffset:wt.thinningParticleOffset,u_shapeDirectionalPower:wt.shapeDirectionalPower,u_shapeNormalPower:wt.shapeNormalPower,u_mode:wt.mode});var wt;const Ot=Math.round(O.intensity*this.particlesCount),Pt=a.bg.simpleSegment(0,0,4*Ot,2*Ot);oe.draw(d,Q.TRIANGLES,un.disabled,$n.disabled,is.alphaBlended,Bn.disabled,st,"rain_particles",this.particlesVx,this.particlesIdx,Pt)};O.distortionStrength>0&&ke(O.boxSize,!0),ke(O.boxSize,!1),this._vignette.draw(d,B)}}const v5=a.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class _5 extends ax{constructor(d){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 kp("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(d){const m=d.context;if(!this.particlesVx){const w=du(this.particlesCount),M=new a.eO,O=new a.b0;let D=0;const B=a.eq(1323123451230);for(let V=0;VD)return;const B=jd(0,1,O.revealStart,O.revealStart+O.revealRange,D);M.strength*=B,m.overrideStyleParameters||(m.intensity=d.style.snow.state.density,m.timeFactor=d.style.snow.state.intensity,m.color=structuredClone(d.style.snow.state.color),w=structuredClone(d.style.snow.state.direction),m.screenThinning.intensity=d.style.snow.state.centerThinning,m.billboardSize=2.79*d.style.snow.state.flakeSize,M.strength=1,M.color=structuredClone(d.style.snow.state.vignetteColor));const V=this.updateOnRender(d,m.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const Y=d.context,Q=Y.gl,ce=d.transform,oe=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(Y,oe),((ue,ke,_e)=>{const Le=aN(this._movement.getPosition(),ue),Pe=ce.width/2,qe=ce.height/2,Ze=jd(0,_e.screenThinning.start,0,1,_e.screenThinning.intensity),He=jd(.001,_e.screenThinning.range,0,1,_e.screenThinning.intensity),xt=jd(0,_e.screenThinning.particleOffset,0,1,_e.screenThinning.intensity),ct=(pt={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Le,velocityConeAperture:_e.velocityConeAperture,velocity:_e.velocity,horizontalOscillationRadius:_e.horizontalOscillationRadius,horizontalOscillationRate:_e.horizontalOscillationRate,boxSize:ue,billboardSize:1*_e.billboardSize,simpleShapeParameters:[_e.shapeFadeStart,_e.shapeFadePower],screenSize:[ce.width,ce.height],thinningCenterPos:[Pe,qe],thinningShape:[Ze,He,Math.pow(10,_e.screenThinning.fadePower)],thinningAffectedRatio:_e.screenThinning.affectedRatio,thinningParticleOffset:xt,color:[_e.color.r,_e.color.g,_e.color.b,_e.color.a],direction:w},{u_modelview:Float32Array.from(pt.modelview),u_projection:Float32Array.from(pt.projection),u_time:pt.time,u_cam_pos:pt.camPos,u_velocityConeAperture:pt.velocityConeAperture,u_velocity:pt.velocity,u_horizontalOscillationRadius:pt.horizontalOscillationRadius,u_horizontalOscillationRate:pt.horizontalOscillationRate,u_boxSize:pt.boxSize,u_billboardSize:pt.billboardSize,u_simpleShapeParameters:pt.simpleShapeParameters,u_screenSize:pt.screenSize,u_thinningCenterPos:pt.thinningCenterPos,u_thinningShape:pt.thinningShape,u_thinningAffectedRatio:pt.thinningAffectedRatio,u_thinningParticleOffset:pt.thinningParticleOffset,u_particleColor:pt.color,u_direction:pt.direction});var pt;const lt=Math.round(_e.intensity*this.particlesCount),st=a.bg.simpleSegment(0,0,4*lt,2*lt);this.particlesVx&&this.particlesIdx&&oe.draw(d,Q.TRIANGLES,un.disabled,$n.disabled,is.alphaBlended,Bn.disabled,ct,"snow_particles",this.particlesVx,this.particlesIdx,st)})(m.boxSize,0,m),this._vignette.draw(d,M)}}const Hm={symbol:function(_,d,m,w,M){if(_.renderPass!=="translucent")return;const O=$n.disabled,D=_.colorModeForRenderPass(),B=m.layout.get("text-variable-anchor"),V=m.layout.get("text-size-scale-range"),Y=a.aA(_.scaleFactor,V[0],V[1]);B&&function(oe,ue,ke,_e,Le,Pe,qe,Ze){const He=ue.transform,xt=Le==="map",ct=Pe==="map";for(const pt of oe){const lt=_e.getTile(pt),st=lt.getBucket(ke);if(!st||!st.text||!st.text.segments.get().length)continue;const wt=a.bK(st.textSizeData,He.zoom,Ze),Ot=hf(pt,st.getProjection(),He),Pt=He.calculatePixelsToTileUnitsMatrix(lt),Vt=Ic(Ot,lt.tileID.canonical,ct,xt,He,st.getProjection(),Pt),Wt=st.hasIconTextFit()&&st.hasIconData();wt&&Tn(st,xt,ct,qe,He,Vt,pt,Math.pow(2,He.zoom-lt.tileID.overscaledZ),wt,Wt)}}(w,_,m,d,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),M,Y);const Q=m.paint.get("icon-opacity").constantOr(1)!==0,ce=m.paint.get("text-opacity").constantOr(1)!==0;m.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(Q||ce)?Dv(_,d,m,w,O,D):(Q&&Dv(_,d,m,w,O,D,{onlyIcons:!0}),ce&&Dv(_,d,m,w,O,D,{onlyText:!0})),d.map.showCollisionBoxes&&(Qr(_,d,m,w,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),Qr(_,d,m,w,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(_,d,m,w){if(_.renderPass!=="translucent")return;const M=m.paint.get("circle-opacity"),O=m.paint.get("circle-stroke-width"),D=m.paint.get("circle-stroke-opacity"),B=m.layout.get("circle-sort-key").constantOr(1)!==void 0,V=m.paint.get("circle-emissive-strength");if(M.constantOr(1)===0&&(O.constantOr(1)===0||D.constantOr(1)===0))return;const Y=_.context,Q=Y.gl,ce=_.transform,oe=!(!_.terrain||!_.terrain.enabled),ue=m.layout.get("circle-elevation-reference"),ke=_.depthModeForSublayer(0,un.ReadOnly),_e=new un(_.context.gl.LEQUAL,un.ReadOnly,_.depthRangeFor3D),Le=ue==="none"||oe?ke:_e,Pe=$n.disabled,qe=_.colorModeForDrapableLayerRenderPass(V),Ze=ce.projection.name==="globe",He=[a.aF(ce.center.lng),a.aJ(ce.center.lat)],xt=[];for(let pt=0;ptpt.sortKey-lt.sortKey);const ct={useDepthForOcclusion:ce.depthOcclusionForSymbolsAndCircles};for(const pt of xt){const{programConfiguration:lt,program:st,layoutVertexBuffer:wt,dynamicBuffers:Ot,indexBuffer:Pt,uniformValues:Vt,tile:Wt}=pt.state,sr=pt.segments;_.terrain&&_.terrain.setupElevationDraw(Wt,st,ct),_.uploadCommonUniforms(Y,st,Wt.tileID.toUnwrapped()),st.draw(_,Q.TRIANGLES,Le,Pe,qe,Bn.disabled,Vt,m.id,wt,Pt,sr,m.paint,ce.zoom,lt,Ot)}},heatmap:function(_,d,m,w){if(m.paint.get("heatmap-opacity")!==0)if(_.renderPass==="offscreen"){const M=_.context,O=M.gl,D=$n.disabled,B=new is([O.ONE,O.ONE,O.ONE,O.ONE],a.ao.transparent,[!0,!0,!0,!0]);(function(ue,ke,_e,Le){const Pe=ue.gl,qe=ke.width*Le,Ze=ke.height*Le;ue.activeTexture.set(Pe.TEXTURE1),ue.viewport.set([0,0,qe,Ze]);let He=_e.heatmapFbo;if(!He||He&&(He.width!==qe||He.height!==Ze)){He&&He.destroy();const xt=Pe.createTexture();Pe.bindTexture(Pe.TEXTURE_2D,xt),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_S,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_T,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MIN_FILTER,Pe.LINEAR),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MAG_FILTER,Pe.LINEAR),He=_e.heatmapFbo=ue.createFramebuffer(qe,Ze,1,null),function(ct,pt,lt,st,wt,Ot){const Pt=ct.gl;Pt.texImage2D(Pt.TEXTURE_2D,0,ct.extRenderToTextureHalfFloat?Pt.RGBA16F:Pt.RGBA,wt,Ot,0,Pt.RGBA,ct.extRenderToTextureHalfFloat?Pt.HALF_FLOAT:Pt.UNSIGNED_BYTE,null),st.colorAttachment0.set(lt)}(ue,0,xt,He,qe,Ze)}else Pe.bindTexture(Pe.TEXTURE_2D,He.colorAttachment0.get()),ue.bindFramebuffer.set(He.framebuffer)})(M,_,m,_.transform.projection.name==="globe"?.5:.25),M.clear({color:a.ao.transparent});const V=_.transform,Y=V.projection.name==="globe",Q=Y?["PROJECTION_GLOBE_VIEW"]:[],ce=Y?Bn.frontCCW:Bn.disabled,oe=[a.aF(V.center.lng),a.aJ(V.center.lat)];for(let ue=0;ue({u_image:0,u_color_ramp:1,u_opacity:ce.paint.get("heatmap-opacity")}))(0,O),O.id,M.viewportBuffer,M.quadTriangleIndexBuffer,M.viewportSegments,O.paint,M.transform.zoom)}(_,m))},line:function(_,d,m,w){if(_.renderPass!=="translucent")return;const M=m.paint.get("line-opacity"),O=m.paint.get("line-width");if(M.constantOr(1)===0||O.constantOr(1)===0)return;const D=m.paint.get("line-emissive-strength").isConstant(),B=m.paint.get("line-emissive-strength").constantOr(0),V=m.paint.get("line-occlusion-opacity"),Y=m.layout.get("line-elevation-reference"),Q=m.layout.get("line-width-unit")==="meters",ce=Y==="sea",oe=!(!_.terrain||!_.terrain.enabled),ue=_.context,ke=ue.gl;if(m.hasElevatedBuckets&&_.transform.projection.name==="globe")return;const _e=m.layout.get("line-cross-slope"),Le=_e!==void 0,Pe=_e<1,qe=_.colorModeForDrapableLayerRenderPass(D?B:null),Ze=_.terrain&&_.terrain.renderingToTexture,He=Ze?1:a.o.devicePixelRatio,xt=m.paint.get("line-dasharray"),ct=xt.constantOr(1),pt=m.layout.get("line-cap"),lt=xt.constantOr(null),st=pt.constantOr(null),wt=m.paint.get("line-pattern"),Ot=wt.constantOr(1),Pt=m.paint.get("line-pattern-cross-fade"),Vt=wt.constantOr(null),Wt=m.paint.get("line-opacity").constantOr(1);let sr=!Ot&&Wt!==1||_.depthOcclusion&&V>0&&V<1;const br=m.paint.get("line-gradient"),zt=Ot?"linePattern":"line",Mt=a.e2(m);let Xt;if(Ze&&_.terrain&&_.terrain.clipOrMaskOverlapStencilType()&&(sr=!1),V!==0&&_.depthOcclusion){const Gr=m.paint._values["line-opacity"];Gr&&Gr.value&&Gr.value.kind==="constant"?Xt=Gr.value:a.w(`Occlusion opacity for layer ${m.id} is supported only when line-opacity isn't data-driven.`)}O.value.kind!=="constant"&&O.value.isLineProgressConstant===!1&&Mt.push("VARIABLE_LINE_WIDTH"),Ze&&(_.emissiveMode!=="dual-source-blending"||D?_.emissiveMode==="mrt-fallback"&&Mt.push("USE_MRT1"):Mt.push("DUAL_SOURCE_BLENDING"));const qt=(Gr,Sr,wr,on,en,$r)=>{for(const Kr of Gr){const Nn=d.getTile(Kr);if(Ot&&!Nn.patternsLoaded())continue;const Yn=Nn.getBucket(m);if(!Yn||Yn.elevationType!=="none"&&!en||Yn.elevationType==="none"&&en)continue;_.prepareDrawTile();const Ls=[...Sr],ui=_.shadowRenderer,dn=Yn.elevationType==="road"&&!!ui&&ui.enabled;let ii=[0,0,0];if(dn){const ls=_.style.directionalLight,sa=_.style.ambientLight;ls&&sa&&(ii=yp(_.style,ls,sa)),Ls.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Wn=Yn.programConfigurations.get(m.id);let gi=!1;if(Vt&&Nn.imageAtlas){const ls=a.e3.from(Vt),sa=ls.getPrimary().scaleSelf(He).toString(),eo=Nn.imageAtlas.patternPositions.get(sa),Ea=ls.getSecondary(),qi=Ea?Nn.imageAtlas.patternPositions.get(Ea.scaleSelf(He).toString()):null;gi=!!eo&&!!qi,eo&&Wn.setConstantPatternPositions(eo,qi)}Pt>0&&(gi||Wn.getPatternTransitionVertexBuffer("line-pattern"))&&Ls.push("LINE_PATTERN_TRANSITION");const Li=_.isTileAffectedByFog(Kr),Ni=_.getOrCreateProgram(zt,{config:Wn,defines:Ls,overrideFog:Li});if(!Ot&<&&st&&Nn.lineAtlas){const ls=Nn.lineAtlas.getDash(lt,st);ls&&Wn.setConstantPatternPositions(ls)}dn&&ui.setupShadows(Nn.tileID.toUnwrapped(),Ni,"vector-tile");let[ni,as]=m.paint.get("line-trim-offset");(st==="round"||st==="square")&&ni!==as&&(ni===0&&(ni-=1),as===1&&(as+=1));const pi=Ze?Kr.projMatrix:null,Da=Q?1/Yn.tileToMeter/a.ay(Nn,1,_.transform.zoom):1,xa=Q?1/Yn.tileToMeter/a.ay(Nn,1,Math.floor(_.transform.zoom)):1,xi=Ot?a.e4(_,Nn,m,pi,He,Da,xa,[ni,as],ii,Pt):a.e5(_,Nn,m,pi,Yn.lineClipsArray.length,He,Da,xa,[ni,as],ii);if(br){const ls=Yn.gradients[m.id];let sa=ls.texture;if(m.gradientVersion!==ls.version){let eo=256;if(m.stepInterpolant){const Ea=d.getSource().maxzoom,qi=Kr.canonical.z===Ea?Math.ceil(1<<_.transform.maxZoom-Kr.canonical.z):1;eo=a.aA(a.e6(Yn.maxLineLength/a.al*1024*qi),256,ue.maxTextureSize)}ls.gradient=a.e7({expression:m.gradientExpression(),evaluationKey:"lineProgress",resolution:eo,image:ls.gradient||void 0,clips:Yn.lineClipsArray}),ls.texture?ls.texture.update(ls.gradient):ls.texture=new a.T(ue,ls.gradient,ke.RGBA8),ls.version=m.gradientVersion,sa=ls.texture}ue.activeTexture.set(ke.TEXTURE1),sa.bind(m.stepInterpolant?ke.NEAREST:ke.LINEAR,ke.CLAMP_TO_EDGE)}ct&&(ue.activeTexture.set(ke.TEXTURE0),Nn.lineAtlasTexture&&Nn.lineAtlasTexture.bind(ke.LINEAR,ke.REPEAT),Wn.updatePaintBuffers()),Ot&&(ue.activeTexture.set(ke.TEXTURE0),Nn.imageAtlasTexture&&Nn.imageAtlasTexture.bind(ke.LINEAR,ke.CLAMP_TO_EDGE),Wn.updatePaintBuffers()),en&&!ce&&_.terrain.setupElevationDraw(Nn,Ni),_.uploadCommonUniforms(ue,Ni,Kr.toUnwrapped());const Qs=ls=>{Xt!=null&&(Xt.value=Wt*V),Ni.draw(_,ke.TRIANGLES,wr,ls,qe,Bn.disabled,xi,m.id,Yn.layoutVertexBuffer,Yn.indexBuffer,Yn.segments,m.paint,_.transform.zoom,Wn,[Yn.layoutVertexBuffer2,Yn.patternVertexBuffer,Yn.zOffsetVertexBuffer]),Xt!=null&&(Xt.value=Wt)};if(sr&&!en){const ls=_.stencilModeForClipping(Kr).ref;ls===0&&Ze&&ue.clear({stencil:0});const sa={func:ke.EQUAL,mask:255};xi.u_alpha_discard_threshold=.8,Qs(new $n(sa,ls,255,ke.KEEP,ke.KEEP,ke.INVERT)),xi.u_alpha_discard_threshold=0,Qs(new $n(sa,ls,255,ke.KEEP,ke.KEEP,ke.KEEP))}else xi.u_alpha_discard_threshold=sr&&en&&$r?.8:0,Qs(en?on:_.stencilModeForClipping(Kr))}};let ur=_.depthModeForSublayer(0,un.ReadOnly);const Er=new un(_.depthOcclusion?ke.GREATER:ke.LEQUAL,un.ReadOnly,_.depthRangeFor3D);if(m.hasNonElevatedBuckets){const Gr=!Ze&&_.terrain;V!==0&&Gr?a.w(`Occlusion opacity for layer ${m.id} is supported on terrain only if the layer has line-z-offset enabled.`):Gr?a.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${m.id}.`):qt(w,Mt,ur,$n.disabled,!1,!0)}if(m.hasElevatedBuckets){Y==="hd-road-markup"?oe||(ur=Er,Mt.push("ELEVATED_ROADS")):(Mt.push("ELEVATED"),ur=Er,Le&&Mt.push(Pe?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),ce&&Mt.push("ELEVATION_REFERENCE_SEA"));const Gr=sr?_.stencilModeFor3D():$n.disabled;_.forceTerrainMode=!0,qt(w,Mt,ur,Gr,!0,!0),sr&&qt(w,Mt,ur,Gr,!0,!1),_.forceTerrainMode=!1}sr&&(_.resetStencilClippingMasks(),Ze&&ue.clear({stencil:0})),V===0||_.depthOcclusion||Ze||_.layersWithOcclusionOpacity.push(_.currentLayer)},fill:function(_,d,m,w){const M=m.paint.get("fill-color"),O=m.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const D=m.paint.get("fill-emissive-strength"),B=_.colorModeForDrapableLayerRenderPass(D),V=m.paint.get("fill-pattern"),Y=_.opaquePassEnabledForLayer()&&!V.constantOr(1)&&M.constantOr(a.ao.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";let Q="none";m.layout.get("fill-elevation-reference")!=="none"?Q="road":m.paint.get("fill-z-offset").constantOr(1)!==0&&(Q="offset");const ce=!(!_.terrain||!_.terrain.enabled),oe={painter:_,sourceCache:d,layer:m,coords:w,colorMode:B,elevationType:Q,terrainEnabled:ce,pass:Y};if(_.renderPass==="shadow")return void(_.shadowRenderer&&Q==="road"&&!ce&&function(ke){const{painter:_e,sourceCache:Le,layer:Pe,coords:qe}=ke,Ze=_e.context.gl,He=ke.painter.shadowRenderer;for(const xt of qe){const ct=Le.getTile(xt),pt=ct.getBucket(Pe);if(!pt)continue;const lt=pt.elevatedStructures;if(!lt||!lt.shadowCasterSegments||lt.shadowCasterSegments.segments[0].primitiveLength===0)continue;_e.prepareDrawTile();const st=pt.bufferData.programConfigurations.get(Pe.id),wt=_e.isTileAffectedByFog(xt),Ot=_e.getOrCreateProgram("elevatedStructuresDepth",{config:st,overrideFog:wt}),Pt=He.calculateShadowPassMatrixFromTile(ct.tileID.toUnwrapped());_e.uploadCommonUniforms(_e.context,Ot,xt.toUnwrapped());const Vt={u_matrix:Pt,u_depth_bias:0};Ot.draw(_e,Ze.TRIANGLES,He.getShadowPassDepthMode(),$n.disabled,He.getShadowPassColorMode(),Bn.disabled,Vt,Pe.id,lt.vertexBuffer,lt.indexBuffer,lt.shadowCasterSegments,Pe.paint,_e.transform.zoom,st)}}(oe));const ue=_.emissiveMode==="mrt-fallback";if(Q!=="offset"){if(Zk(oe,!1,ue),Q==="road"){const ke=!ce&&_.renderPass==="translucent";ke&&Kk(_,d,m,w,"geometry"),Zk(oe,!0,ue,$n.disabled),ke&&function(_e){const{painter:Le,sourceCache:Pe,layer:qe,coords:Ze,colorMode:He}=_e,xt=Le.context.gl,ct=_e.painter.shadowRenderer,pt=!!ct&&ct.enabled,lt=new un(Le.context.gl.LEQUAL,un.ReadOnly,Le.depthRangeFor3D);let st=[0,0,0];if(pt){const Ot=Le.style.directionalLight,Pt=Le.style.ambientLight;Ot&&Pt&&(st=yp(Le.style,Ot,Pt))}const wt=Ot=>{for(const Pt of Ze){const Vt=Pe.getTile(Pt),Wt=Vt.getBucket(qe);if(!Wt)continue;const sr=Wt.elevatedStructures;if(!sr)continue;let br,zt;if(Ot?(br=sr.renderableBridgeSegments,zt=sr.bridgeProgramConfigurations.get(qe.id)):(br=sr.renderableTunnelSegments,zt=sr.tunnelProgramConfigurations.get(qe.id)),!br||br.segments[0].primitiveLength===0)continue;zt.updatePaintBuffers(),Le.prepareDrawTile();const Mt=Le.isTileAffectedByFog(Pt),Xt=[];pt&&Xt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const qt=Le.getOrCreateProgram("elevatedStructures",{config:zt,overrideFog:Mt,defines:Xt}),ur=Le.translatePosMatrix(Pt.projMatrix,Vt,qe.paint.get("fill-translate"),qe.paint.get("fill-translate-anchor"));pt&&ct.setupShadows(Vt.tileID.toUnwrapped(),qt,"vector-tile");const Er=Bm(ur,st);Le.uploadCommonUniforms(Le.context,qt,Pt.toUnwrapped()),qt.draw(Le,xt.TRIANGLES,lt,$n.disabled,He,Bn.backCCW,Er,qe.id,sr.vertexBuffer,sr.indexBuffer,br,qe.paint,Le.transform.zoom,zt,[sr.vertexBufferNormal])}};wt(!0),wt(!1)}(oe)}}else Zk(oe,!1,ue,_.stencilModeFor3D())},"fill-extrusion":function(_,d,m,w){const M=m.paint.get("fill-extrusion-opacity"),O=_.context,D=O.gl,B=_.terrain,V=B&&B.renderingToTexture;if(M===0)return;const Y=_.emissiveMode==="mrt-fallback",Q=_.conflationActive&&_.style.isLayerClipped(m,d.getSource()),ce=_.style.order.indexOf(m.fqid);if(Q&&function(oe,ue,ke,_e,Le){for(const Pe of _e){const qe=ue.getTile(Pe).getBucket(ke);qe&&(qe.updateReplacement(Pe,oe.replacementSource,Le),qe.uploadCentroid(oe.context))}}(_,d,m,w,ce),B||Q)for(const oe of w){const ue=d.getTile(oe).getBucket(m);ue&&uae(_.context,d,oe,ue,m,B,Q)}if(_.renderPass==="shadow"&&_.shadowRenderer){const oe=_.shadowRenderer;if(B&&M<.65&&m._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof a.ad)return;const ue=oe.getShadowPassDepthMode(),ke=oe.getShadowPassColorMode();Yk(_,d,m,w,ue,$n.disabled,ke,Q)}else if(_.renderPass==="translucent"){const oe=!m.paint.get("fill-extrusion-pattern").constantOr(1),ue=m.paint.get("fill-extrusion-color").constantOr(a.ao.white);if(!V&&ue.a!==0){const ke=new un(_.context.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D);M===1&&oe?Yk(_,d,m,w,ke,$n.disabled,is.unblended,Q):(Yk(_,d,m,w,ke,$n.disabled,is.disabled,Q),Yk(_,d,m,w,ke,_.stencilModeFor3D(),_.colorModeForRenderPass(),Q),_.resetStencilClippingMasks())}if(_.style.enable3dLights()&&oe&&(!B&&_.transform.projection.name!=="globe"||V)){const ke=m.paint.get("fill-extrusion-opacity"),_e=m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Le=m.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Pe=m.paint.get("fill-extrusion-flood-light-intensity"),qe=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Ze=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(qe?null:m.lut).toArray01().slice(0,3),He=_e>0&&Le>0,xt=Pe>0,ct=(st,wt,Ot)=>(1-Ot)*st+Ot*wt,pt=new f5;pt.translate=m.paint.get("fill-extrusion-translate"),pt.translateAnchor=m.paint.get("fill-extrusion-translate-anchor"),pt.edgeRadius=m.layout.get("fill-extrusion-edge-radius"),pt.cutoffFadeRange=m.paint.get("fill-extrusion-cutoff-fade-range");const lt=st=>{const wt=_.depthModeForSublayer(1,un.ReadOnly,D.LEQUAL,!0),Ot=m.paint.get(st?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Pt=ct(.1,3,Ot),Vt=_._showOverdrawInspector;if(!Vt){const Wt=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),sr=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!1,!1,!1,!0],D.MIN);bp(pt,_,d,m,w,wt,Wt,sr,Bn.disabled,st,"sdf",ke,_e,Le,Pe,Ze,Pt,Q,!1)}{const Wt=Vt?$n.disabled:new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),sr=Vt?_.colorModeForRenderPass():new is([D.ONE_MINUS_DST_ALPHA,D.DST_ALPHA,D.ONE,D.ONE],a.ao.transparent,[!0,!0,!0,!0]);bp(pt,_,d,m,w,wt,Wt,sr,Bn.disabled,st,"color",ke,_e,Le,Pe,Ze,Pt,Q,!1)}};if(V){const st=()=>{const Ot=B.drapeBufferSize[0],Pt=B.drapeBufferSize[1];let Vt=B.framebufferCopyTexture;return Vt&&(!Vt||Vt.size[0]===Ot&&Vt.size[1]===Pt)||(Vt&&Vt.destroy(),Vt=B.framebufferCopyTexture=new a.T(O,new a.q({width:Ot,height:Pt}),D.RGBA8)),Vt.bind(D.LINEAR,D.CLAMP_TO_EDGE),D.copyTexSubImage2D(D.TEXTURE_2D,0,0,0,0,0,Ot,Pt),Vt},wt=(Ot,Pt,Vt)=>{const Wt=_.depthModeForSublayer(1,un.ReadOnly,D.LEQUAL,!1),sr=m.paint.get(Ot?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),br=ct(.1,3,sr);{const zt=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!1,!1,!1,!0]);bp(pt,_,d,m,w,Wt,$n.disabled,zt,Bn.disabled,Ot,"clear",ke,_e,Le,Pe,Ze,br,Q,Pt)}{const zt=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),Mt=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!1,!1,!1,!0],D.MIN);bp(pt,_,d,m,w,Wt,zt,Mt,Bn.disabled,Ot,"sdf",ke,_e,Le,Pe,Ze,br,Q,Pt)}Y&&!Ot&&(Vt=st());{const zt=Ot?D.ZERO:D.ONE_MINUS_DST_ALPHA,Mt=new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),Xt=new is([zt,D.DST_ALPHA,D.ONE_MINUS_DST_ALPHA,D.ZERO],a.ao.transparent,[!0,!0,!0,!0]);bp(pt,_,d,m,w,Wt,Mt,Xt,Bn.disabled,Ot,"color",ke,_e,Le,Pe,Ze,br,Q,Pt)}if(!Y||Ot){const zt=new is([D.ONE,D.ONE,D.ONE,Ot?D.ZERO:D.ONE],a.ao.transparent,[!1,!1,!1,!0],Ot?D.FUNC_ADD:D.MAX);bp(pt,_,d,m,w,Wt,$n.disabled,zt,Bn.disabled,Ot,"clear",ke,_e,Le,Pe,Ze,br,Q,Pt,Vt)}else{D.drawBuffers([D.NONE,D.COLOR_ATTACHMENT1]);const zt=new $n({func:D.EQUAL,mask:255},254,255,D.KEEP,D.DECR,D.DECR),Mt=new is([D.ONE,D.ONE,D.ONE,D.ONE],a.ao.transparent,[!0,!1,!1,!1],D.MAX);bp(pt,_,d,m,w,Wt,zt,Mt,Bn.disabled,Ot,"emissive",ke,_e,Le,Pe,Ze,br,Q,Pt,Vt),D.drawBuffers([D.COLOR_ATTACHMENT0])}};if(He||xt){let Ot;_.prepareDrawTile(),Y&&!He||(Ot=st()),He&&wt(!0,!1,Ot),xt&&wt(!1,!0,Ot)}}else He&<(!0),xt&<(!1),(He||xt)&&_.resetStencilClippingMasks()}}},building:function(_,d,m,w){_.currentLayer<_.firstLightBeamLayer&&(_.firstLightBeamLayer=_.currentLayer);const M=m.paint.get("building-ambient-occlusion-ground-intensity"),O=m.paint.get("building-ambient-occlusion-ground-radius"),D=m.paint.get("building-ambient-occlusion-ground-attenuation"),B=m.paint.get("building-opacity");if(B<=0)return;let V=M>0&&O>0,Y=!0;const Q=m.paint.get("building-vertical-scale");if(Q<=0)return;_.shadowRenderer||(Y=!1);const ce=_.conflationActive&&_.style.isLayerClipped(m,d.getSource()),oe=_.style.order.indexOf(m.fqid);if(function(ue,ke,_e,Le,Pe,qe){for(const Ze of qe){const He=ke.getTile(Ze).getBucket(_e);He&&(Pe&&He.updateReplacement(Ze,ue.replacementSource,Le),He.uploadUpdatedIndexBuffer(ue.context))}}(_,d,m,oe,ce,w),function(ue,ke,_e,Le){for(const Pe of Le){const qe=ke.getTile(Pe).getBucket(_e);qe&&qe.needsEvaluation()&&qe.uploadUpdatedColorBuffer(ue.context)}}(_,d,m,w),m.resetLayerRenderingStats(_),_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0),_.renderPass==="shadow"&&_.shadowRenderer){const ue=_.shadowRenderer,ke=[],_e=ue.getShadowPassDepthMode();Rv({painter:_,source:d,layer:m,coords:w,defines:ke,blendMode:ue.getShadowPassColorMode(),depthMode:_e,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(_.renderPass==="translucent"){let ue=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(ue=ue.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),_.shadowRenderer&&_.shadowRenderer.useNormalOffset&&(ue=ue.concat("NORMAL_OFFSET"));const ke=m.paint.get("building-facade-emissive-chance"),_e=m.paint.get("building-ambient-occlusion-intensity"),Le=m.paint.get("building-flood-light-intensity"),Pe=m.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",qe=m.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Pe?null:m.lut).toArray01().slice(0,3),Ze=m.paint.get("building-flood-light-ground-attenuation"),He=Le>0,xt=new un(_.context.gl.LEQUAL,un.ReadWrite,_.depthRangeFor3D);B<1&&Rv({painter:_,source:d,layer:m,coords:w,defines:ue,blendMode:is.disabled,depthMode:xt,opacity:B,verticalScale:Q,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Le,floodLightColor:qe,depthOnly:!0});const ct=_.colorModeForRenderPass();Rv({painter:_,source:d,layer:m,coords:w,defines:ue,blendMode:ct,depthMode:xt,opacity:B,verticalScale:Q,facadeEmissiveChance:ke,facadeAOIntensity:_e,floodLightIntensity:Le,floodLightColor:qe}),V&&Xk(_,d,m,w,!0,B,M,O,Le,qe,D,ce),He&&Xk(_,d,m,w,!1,B,M,O,Le,qe,Ze,ce)}else if(_.renderPass==="light-beam"){const ue=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],ke=new un(_.context.gl.LEQUAL,un.ReadOnly,_.depthRangeFor3D);Rv({painter:_,source:d,layer:m,coords:w,defines:ue,blendMode:is.alphaBlended,depthMode:ke,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1),_.resetStencilClippingMasks()},hillshade:function(_,d,m,w){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent"||_.style.disableElevatedTerrain)return;const M=_.context,O=_.terrain&&_.terrain.renderingToTexture,[D,B]=_.renderPass!=="translucent"||O?[{},w]:_.stencilConfigForOverlap(w);for(const V of B){const Y=d.getTile(V);if(Y.needsHillshadePrepare&&_.renderPass==="offscreen")tae(_,Y,m);else if(_.renderPass==="translucent"){const Q=_.depthModeForSublayer(0,un.ReadOnly),ce=m.paint.get("hillshade-emissive-strength"),oe=_.colorModeForDrapableLayerRenderPass(ce),ue=O&&_.terrain?_.terrain.stencilModeForRTTOverlap(V):D[V.overscaledZ];eae(_,V,Y,m,Q,ue,oe)}}M.viewport.set([0,0,_.width,_.height]),_.resetStencilClippingMasks()},raster:function(_,d,m,w,M,O){if(_.renderPass!=="translucent"||m.paint.get("raster-opacity")===0)return;const D=_.transform.projection.name==="globe",B=m.paint.get("raster-elevation")!==0,V=B&&D;if(_.renderElevatedRasterBackface&&!V)return;const Y=_.context,Q=Y.gl,ce=d.getSource(),oe=function(ct,pt,lt,st,wt){const Ot=pt.paint.get("raster-color"),Pt=ct.type==="raster-array",Vt=[],Wt=pt.paint.get("raster-resampling"),sr=pt.paint.get("raster-color-mix");let br=pt.paint.get("raster-color-range");const zt=[sr[0],sr[1],sr[2],0],Mt=sr[3];let Xt=Wt==="nearest"?st.NEAREST:st.LINEAR;if(Pt&&(Vt.push("RASTER_ARRAY"),Ot||Vt.push("RASTER_COLOR"),Wt==="linear"&&Vt.push("RASTER_ARRAY_LINEAR"),Xt=st.NEAREST,!br&&ct.rasterLayers)){const qt=ct.rasterLayers.find(({id:ur})=>ur===pt.sourceLayer);qt&&qt.fields&&qt.fields.range&&(br=qt.fields.range)}if(br=br||[0,1],Ot){Vt.push("RASTER_COLOR"),lt.activeTexture.set(st.TEXTURE2),pt.updateColorRamp(br);let qt=pt.colorRampTexture;qt||(qt=pt.colorRampTexture=new a.T(lt,pt.colorRamp,st.RGBA8)),qt.bind(st.LINEAR,st.CLAMP_TO_EDGE)}return wt&&Vt.push("USE_MRT1"),{mix:zt,range:br,offset:Mt,defines:Vt,resampling:Xt}}(ce,m,Y,Q,_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback");if(ce instanceof a.aU&&!w.length&&!D)return;const ue=m.paint.get("raster-emissive-strength"),ke=_.colorModeForDrapableLayerRenderPass(ue),_e=_.terrain&&_.terrain.renderingToTexture,Le=!_.options.moving,Pe=m.paint.get("raster-resampling")==="nearest"?Q.NEAREST:Q.LINEAR;if(ce instanceof a.aU&&!w.length&&(ce.onNorthPole||ce.onSouthPole)){const ct=B?_.stencilModeFor3D():$n.disabled;return void Fv(!!ce.onNorthPole,null,_,d,m,ue,oe,Bn.disabled,ct)}if(!w.length)return;const[qe,Ze]=ce instanceof a.aU||_e?[{},w]:_.stencilConfigForOverlap(w),He=Ze[Ze.length-1].overscaledZ;V&&oe.defines.push("PROJECTION_GLOBE_VIEW"),B&&oe.defines.push("RENDER_CUTOFF");const xt=(ct,pt,lt)=>{for(const st of ct){const wt=st.toUnwrapped(),Ot=d.getTile(st);if(_e&&(!Ot||!Ot.hasData()))continue;Y.activeTexture.set(Q.TEXTURE0);const Pt=jp(Ot,ce,m,oe);if(!Pt||!Pt.texture)continue;const{texture:Vt,mix:Wt,offset:sr,tileSize:br,buffer:zt}=Pt;let Mt,Xt;_e?(Mt=un.disabled,Xt=st.projMatrix):B?(Mt=new un(Q.LEQUAL,un.ReadWrite,_.depthRangeFor3D),Xt=D?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(wt,Le)):(Mt=_.depthModeForSublayer(st.overscaledZ-He,m.paint.get("raster-opacity")===1?un.ReadWrite:un.ReadOnly,Q.LESS),Xt=_.transform.calculateProjMatrix(wt,Le));const qt=_.terrain&&_e?_.terrain.stencilModeForRTTOverlap(st):qe[st.overscaledZ],ur=O?0:m.paint.get("raster-fade-duration");Ot.registerFadeDuration(ur);const Er=d.findLoadedParent(st,0),Gr=Iv(Ot,Er,d,_.transform,ur);let Sr,wr;!Gr.isFading&&Ot.refreshedUponExpiration&&(Ot.refreshedUponExpiration=!1),_.terrain&&_.terrain.prepareDrawTile(),Y.activeTexture.set(Q.TEXTURE0),Vt.bind(Pe,Q.CLAMP_TO_EDGE),Y.activeTexture.set(Q.TEXTURE1),Er?(Er.texture&&Er.texture.bind(Pe,Q.CLAMP_TO_EDGE),Sr=Math.pow(2,Er.tileID.overscaledZ-Ot.tileID.overscaledZ),wr=[Ot.tileID.canonical.x*Sr%1,Ot.tileID.canonical.y*Sr%1]):Vt.bind(Pe,Q.CLAMP_TO_EDGE),"useMipmap"in Vt&&Y.extTextureFilterAnisotropic&&_.transform.pitch>20&&Q.texParameterf(Q.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const on=_.transform;let en;const $r=B?SP(on):[0,0,0,0];let Kr,Nn,Yn,Ls,ui,dn=0;if(V&&ce instanceof a.aU&&ce.coordinates.length>3)Kr=Float32Array.from(a.bk(a.dJ(new a.cD(0,0,0)))),Nn=Float32Array.from(on.globeMatrix),Yn=Float32Array.from(a.dF(on)),Ls=[a.aF(on.center.lng),a.aJ(on.center.lat)],en=ce.elevatedGlobePerspectiveTransform,ui=ce.elevatedGlobeGridMatrix||new Float32Array(9);else if(V){const Li=a.dG(st.canonical);dn=a.dH(Li.getCenter().lat),Kr=Float32Array.from(a.bk(a.dJ(st.canonical))),Nn=Float32Array.from(on.globeMatrix),Yn=Float32Array.from(a.dF(on)),Ls=[a.aF(on.center.lng),a.aJ(on.center.lat)],en=[0,0],ui=Float32Array.from(a.dI(st.canonical,Li,dn,on.worldSize/on._pixelsPerMercatorPixel))}else en=ce instanceof a.aU?ce.perspectiveTransform:[0,0],Kr=new Float32Array(16),Nn=new Float32Array(9),Yn=new Float32Array(16),Ls=[0,0],ui=new Float32Array(9);const ii=vP(Xt,Kr,Nn,Yn,ui,wr||[0,0],a.aj(_.transform.zoom),Ls,$r,Sr||1,Gr,m,en,B?m.paint.get("raster-elevation"):0,2,Wt,sr,oe.range,br,zt,ue),Wn=_.isTileAffectedByFog(st),gi=_.getOrCreateProgram("raster",{defines:oe.defines,overrideFog:Wn});if(_.uploadCommonUniforms(Y,gi,wt),ce instanceof a.aU){const Li=ce.elevatedGlobeVertexBuffer,Ni=ce.elevatedGlobeIndexBuffer;if(_e||!D)ce.boundsBuffer&&ce.boundsSegments&&gi.draw(_,Q.TRIANGLES,Mt,$n.disabled,ke,Bn.disabled,ii,m.id,ce.boundsBuffer,_.quadTriangleIndexBuffer,ce.boundsSegments);else if(Li&&Ni){const ni=on.zoom<=a.c_?ce.elevatedGlobeSegments:ce.getSegmentsForLongitude(on.center.lng);ni&&gi.draw(_,Q.TRIANGLES,Mt,$n.disabled,ke,pt,ii,m.id,Li,Ni,ni)}}else if(V){Mt=new un(Q.LEQUAL,un.ReadOnly,_.depthRangeFor3D);const Li=_.globeSharedBuffers;if(Li){const[Ni,ni,as]=Li.getGridBuffers(dn,!1);gi.draw(_,Q.TRIANGLES,Mt,lt||qt,_.colorModeForRenderPass(),pt,ii,m.id,Ni,ni,as)}}else{const{tileBoundsBuffer:Li,tileBoundsIndexBuffer:Ni,tileBoundsSegments:ni}=_.getTileBoundsBuffers(Ot);gi.draw(_,Q.TRIANGLES,Mt,qt,ke,Bn.disabled,ii,m.id,Li,Ni,ni)}}if(!(ce instanceof a.aU)&&V)for(const st of ct){const wt=st.canonical.y===(1<>>16,2654435769),((st=Math.imul(st^st>>>16,2654435769))>>>0)/4294967296},lt=1/1.1;for(let st=0;sta.e9[qt](Vt));zt.push(Vt);const Mt=Vt.canonical.x,Xt=Vt.canonical.y;for(const qt of zt){const ur=He.getTile(wt?qt.wrapped():qt);if(!ur)continue;const Er=ur.rasterParticleState;if(!Er)continue;const Gr=qt.canonical.x+(1<pt.tileID)),ue&&(Y.activeTexture.set(Q.TEXTURE0),_.imageManager.bind(_.context,m.scope));const ct=[];if(_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ct.push("USE_MRT1"),V){const pt=_.getOrCreateProgram(Ze,{overrideFog:!1,overrideRtt:!0,defines:ct}),lt=new Float32Array(a.bA([])),st=new a.aQ(0,0,0,0,0),wt=ue?Um(lt,B,D,_,0,m.scope,ke,V,{tileID:st,tileSize:oe}):Lv(lt,B,D,M.toPremultipliedRenderColor(O?null:m.lut));pt.draw(_,Q.TRIANGLES,Pe,Le,qe,Bn.disabled,wt,m.id,_.viewportBuffer,_.quadTriangleIndexBuffer,_.viewportSegments)}else for(const pt of xt){const lt=_.isTileAffectedByFog(pt),st=_.getOrCreateProgram(Ze,{overrideFog:lt,defines:ct}),wt=pt.toUnwrapped(),Ot=w?pt.projMatrix:_.transform.calculateProjMatrix(wt);_.prepareDrawTile();const Pt=d?d.getTile(pt):He?He[pt.key]:new fp(pt,oe,ce.zoom,_),Vt=ue?Um(Ot,B,D,_,0,m.scope,ke,V,{tileID:pt,tileSize:oe}):Lv(Ot,B,D,M.toPremultipliedRenderColor(O?null:m.lut));_.uploadCommonUniforms(Y,st,wt);const{tileBoundsBuffer:Wt,tileBoundsIndexBuffer:sr,tileBoundsSegments:br}=_.getTileBoundsBuffers(Pt);st.draw(_,Q.TRIANGLES,Pe,Le,qe,Bn.disabled,Vt,m.id,Wt,sr,br)}},sky:function(_,d,m){const w=_._atmosphere?a.aj(_.transform.zoom):1,M=m.paint.get("sky-opacity")*w;if(M===0)return;const O=_.context,D=m.paint.get("sky-type"),B=new un(O.gl.LEQUAL,un.ReadOnly,[0,1]),V=_.frameCounter/1e3%1;D==="atmosphere"?_.renderPass==="offscreen"?m.needsSkyboxCapture(_)&&(function(Y,Q,ce,oe){const ue=Y.context,ke=ue.gl;let _e=Q.skyboxFbo;if(!_e){_e=Q.skyboxFbo=ue.createFramebuffer(32,32,1,null),Q.skyboxGeometry=new tN(ue),Q.skyboxTexture=ue.gl.createTexture(),ke.bindTexture(ke.TEXTURE_CUBE_MAP,Q.skyboxTexture),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_WRAP_S,ke.CLAMP_TO_EDGE),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_WRAP_T,ke.CLAMP_TO_EDGE),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_MIN_FILTER,ke.LINEAR),ke.texParameteri(ke.TEXTURE_CUBE_MAP,ke.TEXTURE_MAG_FILTER,ke.LINEAR);for(let Ze=0;Ze<6;++Ze)ke.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+Ze,0,ke.RGBA,32,32,0,ke.RGBA,ke.UNSIGNED_BYTE,null)}ue.bindFramebuffer.set(_e.framebuffer),ue.viewport.set([0,0,32,32]);const Le=Q.getCenter(Y,!0),Pe=Y.getOrCreateProgram("skyboxCapture"),qe=new Float64Array(16);a.bA(qe),a.en(qe,qe,.5*-Math.PI),sx(Y,Q,Pe,qe,Le,0),a.bA(qe),a.en(qe,qe,.5*Math.PI),sx(Y,Q,Pe,qe,Le,1),a.bA(qe),a.cU(qe,qe,.5*-Math.PI),sx(Y,Q,Pe,qe,Le,2),a.bA(qe),a.cU(qe,qe,.5*Math.PI),sx(Y,Q,Pe,qe,Le,3),a.bA(qe),sx(Y,Q,Pe,qe,Le,4),a.bA(qe),a.en(qe,qe,Math.PI),sx(Y,Q,Pe,qe,Le,5),ue.viewport.set([0,0,Y.width,Y.height])}(_,m),m.markSkyboxValid(_)):_.renderPass==="sky"&&function(Y,Q,ce,oe,ue){const ke=Y.context,_e=ke.gl,Le=Y.transform,Pe=Y.getOrCreateProgram("skybox");ke.activeTexture.set(_e.TEXTURE0),_e.bindTexture(_e.TEXTURE_CUBE_MAP,Q.skyboxTexture);const qe=((Ze,He,xt,ct,pt)=>({u_matrix:Ze,u_sun_direction:He,u_cubemap:0,u_opacity:ct,u_temporal_offset:pt}))(Le.skyboxMatrix,Q.getCenter(Y,!1),0,oe,ue);Y.uploadCommonUniforms(ke,Pe),Pe.draw(Y,_e.TRIANGLES,ce,$n.disabled,Y.colorModeForRenderPass(),Bn.backCW,qe,"skybox",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,m,B,M,V):D==="gradient"&&_.renderPass==="sky"&&function(Y,Q,ce,oe,ue){const ke=Y.context,_e=ke.gl,Le=Y.transform,Pe=Y.getOrCreateProgram("skyboxGradient");Q.skyboxGeometry||(Q.skyboxGeometry=new tN(ke)),ke.activeTexture.set(_e.TEXTURE0);let qe=Q.colorRampTexture;qe||(qe=Q.colorRampTexture=new a.T(ke,Q.colorRamp,_e.RGBA8)),qe.bind(_e.LINEAR,_e.CLAMP_TO_EDGE);const Ze=((He,xt,ct,pt,lt)=>({u_matrix:He,u_color_ramp:0,u_center_direction:xt,u_radius:a.an(ct),u_opacity:pt,u_temporal_offset:lt}))(Le.skyboxMatrix,Q.getCenter(Y,!1),Q.paint.get("sky-gradient-radius"),oe,ue);Y.uploadCommonUniforms(ke,Pe),Pe.draw(Y,_e.TRIANGLES,ce,$n.disabled,Y.colorModeForRenderPass(),Bn.backCW,Ze,"skyboxGradient",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,m,B,M,V)},custom:function(_,d,m,w){const M=_.context,O=m.implementation;if(!_.transform.projection.unsupportedLayers||!_.transform.projection.unsupportedLayers.includes("custom")||_.terrain&&(_.terrain.renderingToTexture||_.renderPass==="offscreen")&&m.isDraped(d)){if(_.renderPass==="offscreen"){const D=O.prerender;if(D){if(_.setCustomLayerDefaults(),M.setColorMode(_.colorModeForRenderPass()),_.transform.projection.name==="globe"){const B=_.transform.pointMerc;D.call(O,M.gl,_.transform.customLayerMatrix(),_.transform.getProjection(),_.transform.globeToMercatorMatrix(),a.aj(_.transform.zoom),[B.x,B.y],_.transform.pixelsPerMeterRatio)}else D.call(O,M.gl,_.transform.customLayerMatrix());M.setDirty(),_.setBaseState()}}else if(_.renderPass==="translucent"){if(_.terrain&&_.terrain.renderingToTexture){const B=O.renderToTile;if(B){const V=w[0].canonical,Y={x:V.x+w[0].wrap*(O.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,Q||(Y.enabled=!0))},oe=d.getSource();if(_.renderPass==="light-beam"&&oe.type!=="batched-model")return;if(oe.type==="vector"||oe.type==="geojson")return function(He,xt,ct,pt,lt){const st=He.transform,wt=st.projection.name==="globe",Ot=st.getFreeCameraOptions().position;if(!He.modelManager)return;const Pt=He.modelManager;ct.modelManager=Pt;const Vt=He.shadowRenderer;if(!ct._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Wt=ct._unevaluatedLayout._values["model-id"],sr=Object.assign({},ct.layout.get("model-id").parameters),br=He.style.order.indexOf(ct.fqid),zt=ct.paint.get("model-opacity").constantOr(1);for(const Mt of pt){const Xt=xt.getTile(Mt).getBucket(ct);if(!Xt||Xt.projection.name!==st.projection.name)continue;const qt=Xt.getModelUris();if(qt&&!Xt.modelsRequested&&(Pt.addModelsFromBucket(qt,lt),Xt.modelsRequested=!0),wt)sr.zoom=Mt.overscaledZ;else{const $r=td(Mt,st);sr.zoom=$r}const ur=Wt.possiblyEvaluate(sr);if(RP(He,Xt,Mt),vf.shadowUniformsInitialized=!1,vf.useSingleShadowCascade=!!Vt&&Vt.getMaxCascadeForTile(Mt.toUnwrapped())===0,He.renderPass==="shadow"&&Vt){if(He.currentShadowCascade===1&&Xt.isInsideFirstShadowMapFrustum)continue;const $r=st.calculatePosMatrix(Mt.toUnwrapped(),st.worldSize);if(vf.tileMatrix.set($r),vf.shadowTileMatrix=Float32Array.from(Vt.calculateShadowPassMatrixFromMatrix($r)),vf.aabb.min=[0,0,0],vf.aabb.max[0]=vf.aabb.max[1]=a.al,vf.aabb.max[2]=0,pae(Xt,vf,He,ct.scope))continue}const Er=1<0&&He.style.isLayerClipped(ct,xt.getSource())&&Xt.updateReplacement(Mt,He.replacementSource,br,ct.scope)&&(Xt.uploaded=!1,Xt.upload(He.context));let Sr=0;const wr=new Array,on=new Array,en=new Array;for(let $r in Xt.instancesPerModel){const Kr=Xt.instancesPerModel[$r];Kr.features.length>0&&!wt&&($r=ur.evaluate(Kr.features[0].feature,{}));const Nn=Pt.getModel($r,lt);if(Nn||Pt.hasURLBeenRequested($r)||Xt.modelUris.includes($r)||(Xt.modelUris.push($r),Xt.modelsRequested=!1),Nn&&Nn.uploaded)if(wt){const Yn=a.c5([],[Ot.x,Ot.y,Ot.z],He.transform.worldSize);a.ew(Yn,Yn);for(let Ls=0;Ls0&&ii.elevationUpdate($r.terrain,Ls,dn,Nn.source),ii.needsReEvaluation($r,ui,Nn)&&ii.evaluate(Nn))}})(He,xt,ct,pt),function(){let $r,Kr,Nn;wr?($r=pt.length-1,Kr=-1,Nn=-1):($r=0,Kr=pt.length,Nn=1);const Yn=new Float64Array(16),Ls=a.cA(),ui=new a.P(0,0);for(let dn=$r;dn!==Kr;dn+=Nn){const ii=pt[dn],Wn=xt.getTile(ii).getBucket(ct);if(!Wn||!Wn.uploaded)continue;let gi=!1;Ot&&(gi=Ot.getMaxCascadeForTile(ii.toUnwrapped())===0);const Li=st.calculatePosMatrix(ii.toUnwrapped(),st.worldSize),Ni=Wn.modelTraits;!Er&&wr&&(a.bl(Yn,Li),a.af(Ls,Vt,Yn),ui.x=Ls[0],ui.y=Ls[1]);const ni=[];Wn.setFilter(ct.filter);for(const as of Wn.getNodesInfo()){if(as.hiddenByReplacement||!as.node.meshes)continue;const pi=as.node;let Da=0;He.terrain&&pi.elevation&&(Da=pi.elevation*He.terrain.exaggeration());const xa=(()=>{const xc=as.aabb;return ur.min=[...xc.min],ur.max=[...xc.max],ur.min[2]+=Da,ur.max[2]+=Da,a.af(ur.min,ur.min,Li),a.af(ur.max,ur.max,Li),ur})(),xi=as.evaluatedScale;if(xi[0]<=1&&xi[1]<=1&&xi[2]<=1&&xa.intersects(Gr)===0)continue;if(!Er&&wr){const xc=.16666666666666666;as.cameraCollisionOpacity=Vt[0]>xa.min[0]&&Vt[0]xa.min[1]&&Vt[1]!wr||as.opacity===1&&pi.opacity===1?as.depthpi.depth?-1:1);for(const as of ni){const pi=as.nodeInfo,Da=pi.node;let xa=a.aB([],zt,as.tileModelMatrix);a.aB(xa,sr,xa);const xi=a.bl([],xa);a.eg(xi,xi),a.cS(xi,xi,Bv),xa=a.aB(xa,xa,Da.globalMatrix);const Qs=He.renderPass==="light-beam",ls=ct.paint.get("model-color-use-theme").constantOr("default")==="none",sa=Ni&a.eI.HasMapboxMeshFeatures,eo=sa?0:pi.evaluatedRMEA[0][2];for(let Ea=0;Ea=ar||Ia>=ar}}const zl=qi.material;let hu;zl.occlusionTexture&&zl.occlusionTexture.offsetScale&&(hu=zl.occlusionTexture.offsetScale,qo.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const rh=He.getOrCreateProgram("model",qo);!Er&&Ot&&Ot.setupShadowsFromMatrix(as.tileModelMatrix,rh,Ot.useNormalOffset),He.uploadCommonUniforms(lt,rh,null,yc);const Nd=zl.pbrMetallicRoughness;Nd.metallicFactor=.9,Nd.roughnessFactor=.5;const Ua=Jg(new Float32Array(ec),new Float32Array(xa),new Float32Array(xi),new Float32Array(Da.globalMatrix),He,as.opacity,Nd.baseColorFactor,zl.emissiveFactor,Nd.metallicFactor,Nd.roughnessFactor,zl,eo,ct,[0,0,0],hu);!rd&&(pi.hasTranslucentParts||as.opacity<1)&&rh.draw(He,lt.gl.TRIANGLES,Xt,$n.disabled,is.disabled,Bn.backCCW,Ua,ct.id,qi.vertexBuffer,qi.indexBuffer,qi.segments,ct.paint,He.transform.zoom,void 0,xc),rh.draw(He,lt.gl.TRIANGLES,rd?qt:Xt,$n.disabled,rd||as.opacity<1||pi.hasTranslucentParts?is.alphaBlended:is.unblended,Bn.backCCW,Ua,ct.id,qi.vertexBuffer,qi.indexBuffer,qi.segments,ct.paint,He.transform.zoom,void 0,xc)}}}}()}(_,d,m,w),void ce();if(oe.type!=="model")return;const ue=oe.getModels(),ke=[],_e=_.transform.getFreeCameraOptions().position,Le=a.c5([],[_e.x,_e.y,_e.z],_.transform.worldSize);a.ew(Le,Le);const Pe=[],qe=[];let Ze=0;for(const He of ue){const xt=d.getFeatureState("",He.id),ct={type:"Unknown",id:He.id,properties:He.featureProperties},pt=m.paint.get("model-rotation").evaluate(ct,xt),lt=m.paint.get("model-scale").evaluate(ct,xt),st=m.paint.get("model-translation").evaluate(ct,xt),wt=m.paint.get("model-opacity").evaluate(ct,xt);LP(m,He.id,xt,He.featureProperties,He.nodeOverrideNames,He.nodeOverrides),OP(m,He.id,xt,He.featureProperties,He.materialOverrideNames,He.materialOverrides),He.nodeOverrides.size>0&&He.computeBoundsAndApplyParent(),He.computeModelMatrix(_,pt,lt,st,B,D,!1);const Ot=a.bA([]),Pt=a.ef(He.position.lat,_.transform.zoom),Vt=a.bq([],[1,1,1/Pt]);a.br(Ot,Ot,Le),ke.push({zScaleMatrix:Vt,negCameraPosMatrix:Ot});for(const Wt of He.nodes)ix(_,Wt,He.matrix,_.transform.expandedFarZProjMatrix,Ze,Pe,qe,He.materialOverrides,wt);Ze++}if(Pe.sort((He,xt)=>xt.depth-He.depth),_.renderPass!=="shadow")DP(_,m,Pe,qe,ke),ce();else{for(const He of qe)Th(He.mesh,He.nodeModelMatrix,_,m);for(const He of Pe)Th(He.mesh,He.nodeModelMatrix,_,m);ce()}}},lN={line:function(_,d,m){if(_.hasElevatedBuckets=!1,_.hasNonElevatedBuckets=!1,_._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||_._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const w=d.getVisibleCoordinates();for(const M of w){const O=d.getTile(M).getBucket(_);if(O&&(O.elevationType!=="none"?_.hasElevatedBuckets=!0:_.hasNonElevatedBuckets=!0,_.hasElevatedBuckets&&_.hasNonElevatedBuckets))break}}}else _.hasNonElevatedBuckets=!0},model:function(_,d,m){const w=d.getSource();if(!w.loaded())return;if(w.type==="vector"||w.type==="geojson")return void(m.modelManager&&m.modelManager.upload(m,zv(m,_)));if(w.type==="batched-model"||w.type!=="model")return;const M=w.getModels();for(const O of M)O.upload(m.context)},raster:function(_,d,m){const w=d.getSource();if(!(w instanceof sl&&w.loaded()))return;const M=_.sourceLayer||w.rasterLayerIds&&w.rasterLayerIds[0];if(!M)return;const O=_.paint.get("raster-array-band")||w.getInitialBand(M);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(_.id,O)&&w.prepareTile(B,M,_.id,O)},"raster-particle":function(_,d,m){const w=d.getSource();if(!(w instanceof sl&&w.loaded()))return;const M=_.sourceLayer||w.rasterLayerIds&&w.rasterLayerIds[0];if(!M)return;const O=_.paint.get("raster-particle-array-band")||w.getInitialBand(M);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(_.id,O)&&w.prepareTile(B,M,_.id,O)}},uu={fill:Kk},cN={fill:function(_,d,m,w){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const M=_.context.gl,O=new un(M.LEQUAL,un.ReadOnly,_.depthRangeFor3D),D=new $n({func:M.ALWAYS,mask:255},255,255,M.KEEP,M.KEEP,M.REPLACE),B=_.transform.getFreeCameraOptions().position,V=_.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of w){const Q=d.getTile(Y),ce=Q.getBucket(m);if(!ce)continue;const oe=ce.elevatedStructures;if(!oe||oe.depthSegments.segments[0].primitiveLength===0)continue;const ue=NP(Y.toUnwrapped(),B),ke=_.translatePosMatrix(Y.projMatrix,Q,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor")),_e=Qg(ke,ue,0,1,0);V.draw(_,M.TRIANGLES,O,D,is.disabled,Bn.disabled,_e,m.id,oe.vertexBuffer,oe.indexBuffer,oe.depthSegments,m.paint,_.transform.zoom)}}};class dN{constructor(d,m,w,M,O){this.context=new Fy(d,m),this.transform=w,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=a.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const D=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const V of D)this._debugParams.enabledLayers[V]=!0;for(const V of D);this.occlusionParams=new By,this.setup(),this.numSublayers=Yc.maxUnderzooming+Yc.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new a.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Sy(this),this._wireframeDebugCache=new Vm,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const B=new a.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new a.T(this.context,B,d.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=M,this.worldview=O,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,m){const w=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(w||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new s5(this,d));const M=this._terrain;this.transform.elevation=w?M:null,M.update(d,this.transform,m),this.transform.elevation&&!M.enabled&&(this.transform.elevation=null)}_updateFog(d){const m=d.fog;if(!m||this.transform.projection.name==="globe"||m.getOpacity(this.transform.pitch)<1||m.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[w,M]=m.getFovAdjustedRange(this.transform._fov);if(w>M)return void(this.transform.fogCullDistSq=null);const O=w+.78*(M-w);this.transform.fogCullDistSq=O*O}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(d){d&&!this._terrain&&(this._terrain=new s5(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,m){if(this.width=d*a.o.devicePixelRatio,this.height=m*a.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const w of this.style.order)this.style._mergedLayers[w].resize()}setup(){const d=this.context,m=new a.bd;m.emplaceBack(0,0),m.emplaceBack(a.al,0),m.emplaceBack(0,a.al),m.emplaceBack(a.al,a.al),this.tileExtentBuffer=d.createVertexBuffer(m,a.bf.members),this.tileExtentSegments=a.bg.simpleSegment(0,0,4,2);const w=new a.bd;w.emplaceBack(0,0),w.emplaceBack(a.al,0),w.emplaceBack(0,a.al),w.emplaceBack(a.al,a.al),this.debugBuffer=d.createVertexBuffer(w,a.bf.members),this.debugSegments=a.bg.simpleSegment(0,0,4,5);const M=new a.bd;M.emplaceBack(-1,-1),M.emplaceBack(1,-1),M.emplaceBack(-1,1),M.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(M,a.bf.members),this.viewportSegments=a.bg.simpleSegment(0,0,4,2);const O=new a.b1;O.emplaceBack(0,0,0,0),O.emplaceBack(a.al,0,a.al,0),O.emplaceBack(0,a.al,0,a.al),O.emplaceBack(a.al,a.al,a.al,a.al),this.mercatorBoundsBuffer=d.createVertexBuffer(O,a.bi.members),this.mercatorBoundsSegments=a.bg.simpleSegment(0,0,4,2);const D=new a.b0;D.emplaceBack(0,1,2),D.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(D);const B=new a.be;for(const Y of[0,1,3,2,0])B.emplaceBack(Y);this.debugIndexBuffer=d.createIndexBuffer(B),this.emptyTexture=new a.T(d,new a.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=a.bC();const V=this.context.gl;this.stencilClearMode=new $n({func:V.ALWAYS,mask:0},0,255,V.ZERO,V.ZERO,V.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(d){return d._makeTileBoundsBuffers(this.context,this.transform.projection),d._tileBoundsBuffer?{tileBoundsBuffer:d._tileBoundsBuffer,tileBoundsIndexBuffer:d._tileBoundsIndexBuffer,tileBoundsSegments:d._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const d=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,d.TRIANGLES,un.disabled,this.stencilClearMode,is.disabled,Bn.disabled,Ev(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,m,w){if(!m||this.currentStencilSource===m.id||!d.isTileClipped()||!w||w.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const V of w)if(this._tileClippingMaskIDs[V.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=m.id;const M=this.context,O=M.gl;this.nextStencilID+w.length>256&&this.clearStencil(),M.setColorMode(is.disabled),M.setDepthMode(un.disabled);const D=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of w){const V=m.getTile(B),Y=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:Q,tileBoundsIndexBuffer:ce,tileBoundsSegments:oe}=this.getTileBoundsBuffers(V);D.draw(this,O.TRIANGLES,un.disabled,new $n({func:O.ALWAYS,mask:0},Y,255,O.KEEP,O.KEEP,O.REPLACE),is.disabled,Bn.disabled,Ev(B.projMatrix),"$clipping",Q,ce,oe)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,m=this.context.gl;return new $n({func:m.NOTEQUAL,mask:255},d,255,m.KEEP,m.KEEP,m.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const m=this.context.gl;return new $n({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(d){const m=this.context.gl,w=d.sort((D,B)=>B.overscaledZ-D.overscaledZ),M=w[w.length-1].overscaledZ,O=w[0].overscaledZ-M+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const D={};for(let B=0;Bthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((d,m)=>d+m/this._fpsHistory.length,0))}render(d,m){const w=a.o.now();this._dt=w-this._timeStamp,this._timeStamp=w,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=m;const M=this.style._mergedLayers,O=!(!this.terrain||!this.terrain.enabled),D=()=>this.style._getOrder(O).filter(zt=>{const Mt=M[zt];return!(Mt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Mt.type]});let B=D(),V=!1,Y=!1,Q=null,ce=0,oe=!1;for(const zt of B){const Mt=M[zt];Mt.visibility!=="none"&&(Mt.type==="circle"?V=!0:Mt.type==="building"?(Q=Mt,++ce):Mt.type==="symbol"&&(Mt.hasOcclusionOpacityProperties?Y=!0:V=!0))}this.updateEmissiveMode();let ue=B.map(zt=>M[zt]);const ke=this.style._mergedSourceCaches;this.imageManager=d.imageManager,this.modelManager=d.modelManager,this.symbolFadeChange=d.placement.symbolFadeChange(a.o.now()),this.imageManager.beginFrame();for(const zt in ke){const Mt=ke[zt];Mt.used&&(Mt.prepare(this.context),Mt.getSource().usedInConflation&&++ce)}let _e=!1;for(const zt of ue)zt.isHidden(this.transform.zoom)||(zt.type==="clip"&&(_e=!0),this.prepareLayer(zt));const Le={},Pe={},qe={},Ze={},He={};for(const zt in ke){const Mt=ke[zt];Le[zt]=Mt.getVisibleCoordinates(),Pe[zt]=Le[zt].slice().reverse(),qe[zt]=Mt.getVisibleCoordinates(!0).reverse(),Ze[zt]=Mt.getShadowCasterCoordinates(),He[zt]=Mt.sortCoordinatesByDistance(Le[zt])}const xt=zt=>{const Mt=this.style.getLayerSourceCache(zt);return Mt&&Mt.used?Mt.getSource():null};if(ce||_e||this._clippingActiveLastFrame){const zt=[],Mt=[];let Xt=0;for(const qt of ue)this.isSourceForClippingOrConflation(qt,xt(qt))&&(zt.push(qt),Mt.push(Xt)),Xt++;if(zt&&(_e||zt.length>1)||this._clippingActiveLastFrame){_e=!1;const qt=[];for(let ur=0;ur0){const qt=xt(Mt);qt&&(this.minCutoffZoom=Math.max(qt.minzoom,this.minCutoffZoom)),Mt.minzoom&&(this.minCutoffZoom=Math.max(Mt.minzoom,this.minCutoffZoom))}Mt.is3D(O)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=zt),this._lastOcclusionLayer=zt)}const ct=this.style&&this.style.fog;ct?(this._fogVisible=ct.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ct.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(qe),this.opaquePassCutoff=0,B=D(),ue=B.map(zt=>M[zt]));const pt=this._shadowRenderer;if(pt){pt.updateShadowParameters(this.transform,this.style.directionalLight);for(const zt in ke)for(const Mt of Le[zt]){let Xt={min:0,max:0};this.terrain&&(Xt=this.terrain.getMinMaxForTile(Mt)||Xt),pt.addShadowReceiver(Mt.toUnwrapped(),Xt.min,Xt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new PP(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const lt=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),st=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(lt&&!this._snow&&(this._snow=new _5(this)),!lt&&this._snow&&(this._snow.destroy(),delete this._snow),st&&!this._rain&&(this._rain=new oN(this)),!st&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),Q){this.buildingTileBorderManager||(this.buildingTileBorderManager=new rN);const zt=this.style.getLayerSourceCache(Q);this.buildingTileBorderManager.updateBorders(zt,Q)}if(!et.has(this.context.gl))return;this.renderPass="offscreen";for(const zt of ue){const Mt=d.getLayerSourceCache(zt);if(!zt.hasOffscreenPass()||zt.isHidden(this.transform.zoom))continue;const Xt=Mt?Pe[Mt.id]:void 0;(zt.type==="custom"||zt.type==="raster"||zt.type==="raster-particle"||zt.isSky()||Xt&&Xt.length)&&this.renderLayer(this,Mt,zt,Xt)}this.depthRangeFor3D=[0,1-(ue.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Ze)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const wt=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Ot=(()=>{if(m.showOverdrawInspector)return a.ao.black;const zt=this.style.fog;if(zt&&this.transform.projection.supportsFog){const Mt=this.style.getLut(zt.scope);if(!wt){const Xt=zt.properties.get("color-use-theme")==="none",qt=zt.properties.get("color").toNonPremultipliedRenderColor(Xt?null:Mt).toArray01();return new a.ao(...qt)}if(wt){const Xt=zt.properties.get("space-color-use-theme")==="none",qt=zt.properties.get("space-color").toNonPremultipliedRenderColor(Xt?null:Mt).toArray01();return new a.ao(...qt)}}return a.ao.transparent})();if(this.context.clear({color:Ot,depth:1}),this.clearStencil(),this._showOverdrawInspector=m.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&wt&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=B.length-1;this.currentLayer>=0;this.currentLayer--){const zt=ue[this.currentLayer],Mt=d.getLayerSourceCache(zt);if(zt.isSky())continue;const Xt=Mt?(zt.is3D(O)?He:Pe)[Mt.id]:void 0;this._renderTileClippingMasks(zt,Mt,Xt),this.renderLayer(this,Mt,zt,Xt)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&wt&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||a.aj(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer{for(this.currentLayer=0;this.currentLayer0&&zt.hasShadowPass()&&--Vt==0){{this.clearStencil(),this.resetStencilClippingMasks();const Xt=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Xt=this.currentLayer;this.depthOcclusion=!0;for(const qt of this.layersWithOcclusionOpacity){this.currentLayer=qt;const ur=ue[this.currentLayer],Er=d.getLayerSourceCache(ur),Gr=Er?Pe[Er.id]:void 0;this.terrain||this._renderTileClippingMasks(ur,Er,Er?Le[Er.id]:void 0),this.renderLayer(this,Er,ur,Gr)}this.depthOcclusion=!1,this.currentLayer=Xt,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 zt=null;ue.forEach(Mt=>{const Xt=d.getLayerSourceCache(Mt);Xt&&!Mt.isHidden(this.transform.zoom)&&Xt.getVisibleCoordinates().length&&(!zt||zt.getSource().maxzoom0?m.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,m,w){const M=w===void 0?this.terrain&&this.terrain.renderingToTexture:w,O=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(O.push("LIGHTING_3D_MODE"),O.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):M||O.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||O.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(O.push("TERRAIN"),this.linearFloatFilteringSupported()&&O.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&O.push("GLOBE"),!this._fogVisible||M||m!==void 0&&!m||O.push("FOG","FOG_DITHERING"),M&&O.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&O.push("OVERDRAW_INSPECTOR"),O}getOrCreateProgram(d,m){this.cache=this.cache||{};const w=m&&m.defines||[],M=m&&m.config,O=this.currentGlobalDefines(d,m&&m.overrideFog,m&&m.overrideRtt).concat(w),D=hP.cacheKey(H3[d],d,O,M);return this.cache[D]||(this.cache[D]=new hP(this.context,d,H3[d],M,Gk[d],O)),this.cache[D]}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 d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(d,m){if(this.style.enable3dLights()){const w=this.style.directionalLight,M=this.style.ambientLight;if(w&&M){const O=((D,B,V)=>{const Y=D.properties.get("direction"),Q=D.properties.get("color-use-theme")==="none",ce=D.properties.get("color").toNonPremultipliedRenderColor(Q?null:V.getLut(D.scope)).toArray01(),oe=D.properties.get("intensity"),ue=B.properties.get("color-use-theme")==="none",ke=B.properties.get("color").toNonPremultipliedRenderColor(ue?null:V.getLut(B.scope)).toArray01(),_e=B.properties.get("intensity"),Le=[Y.x,Y.y,Y.z],Pe=a.dN(ke,_e),qe=a.dN(ce,oe);return{u_lighting_ambient_color:Pe,u_lighting_directional_dir:Le,u_lighting_directional_color:qe,u_ground_radiance:Oy(Le,qe,Pe)}})(w,M,this.style);m.setLightsUniformValues(d,O)}}}uploadCommonUniforms(d,m,w,M,O){if(this.uploadCommonLightUniforms(d,m),this.terrain&&this.terrain.renderingToTexture)return;const D=this.style.fog;if(D){const B=D.getOpacity(this.transform.pitch),V=((Y,Q,ce,oe,ue,ke,_e,Le,Pe,qe,Ze,He)=>{const xt=Y.transform,ct=Q.properties.get("color-use-theme")==="none",pt=Q.properties.get("color").toNonPremultipliedRenderColor(ct?null:Y.style.getLut(Q.scope)).toArray01();pt[3]=oe;const lt=Y.frameCounter/1e3%1,[st,wt]=Q.properties.get("vertical-range");return{u_fog_matrix:ce?xt.calculateFogTileMatrix(ce):He||Y.identityMat,u_fog_range:Q.getFovAdjustedRange(xt._fov),u_fog_color:pt,u_fog_horizon_blend:Q.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(st,wt),wt],u_fog_temporal_offset:lt,u_frustum_tl:ue,u_frustum_tr:ke,u_frustum_br:_e,u_frustum_bl:Le,u_globe_pos:Pe,u_globe_radius:qe,u_viewport:Ze,u_globe_transition:a.aj(xt.zoom),u_is_globe:+(xt.projection.name==="globe")}})(this,D,w,B,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*a.o.devicePixelRatio,this.transform.height*a.o.devicePixelRatio],M);m.setFogUniformValues(d,V)}O&&m.setCutoffUniformValues(d,O.uniformValues)}setTileLoadedFlag(d){this.tileLoaded=d}saveCanvasCopy(){const d=this.canvasCopy();d&&(this.frameCopies.push(d),this.tileLoaded=!1)}canvasCopy(){const d=this.context.gl,m=d.createTexture();return d.bindTexture(d.TEXTURE_2D,m),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),m}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const d=this.style&&this.style.fog;return!!d&&d.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const d=this._backgroundTiles,m=this._backgroundTiles={},w=this.transform.coveringTiles({tileSize:512});for(const M of w)m[M.key]=d[M.key]||new fp(M,512,this.transform.tileZoom,this,void 0,this.worldview);return m}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,m){return!(!d.is3D(!(!this.terrain||!this.terrain.enabled))||d.type!=="clip"&&d.type!=="building"&&(d.minzoom&&d.minzoom>this.transform.zoom||(this.style._clipLayerPresent||d.sourceLayer!=="building"&&d.sourceLayer!=="procedural_buildings")&&(!m||m.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let m=this._cachedTileFogOpacities[d.key];return m||(this._cachedTileFogOpacities[d.key]=m=this.style.fog.getOpacityForTile(d)),m[0]>=ar||m[1]>=ar}setupDepthForOcclusion(d,m,w){const M=this.context,O=M.gl,D=!!w;var B;w||(w={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),M.activeTexture.set(O.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),w.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],w.u_depth_range_unpack=[2/((B=this.depthRangeFor3D)[1]-B[0]),-1-2*B[0]/(B[1]-B[0])],w.u_occluder_half_size=.5*this.occlusionParams.occluderSize,w.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),M.activeTexture.set(O.TEXTURE0),D||m.setTerrainUniformValues(M,w)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function uN(_,d){let m=!1,w=null;const M=()=>{w=null,m&&(_(),w=setTimeout(M,d),m=!1)};return()=>(m=!0,w||M(),w)}class b5{constructor(d){this._hashName=d&&encodeURIComponent(d),a.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=uN(this._updateHashUnthrottled.bind(this),300)}addTo(d){return this._map=d,window.addEventListener("hashchange",this._onHashChange,!1),d.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 d=this._map;if(!d)return"";const m=$o(d);if(this._hashName){const w=this._hashName;let M=!1;const O=location.hash.slice(1).split("&").map(D=>{const B=D.split("=")[0];return B===w?(M=!0,`${B}=${m}`):D}).filter(D=>D);return M||O.push(`${w}=${m}`),`#${O.join("&")}`}return`#${m}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(w=>w.split("=")).forEach(w=>{w[0]===this._hashName&&(m=w)}),(m&&m[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const m=this._getCurrentHash();if(m.length>=3&&!m.some(w=>isNaN(Number(w)))){const w=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(m[3]||0):d.getBearing();return d.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:w,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function $o(_,d){const m=_.getCenter(),w=Math.round(100*_.getZoom())/100,M=Math.ceil((w*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,M),D=Math.round(m.lng*O)/O,B=Math.round(m.lat*O)/O,V=_.getBearing(),Y=_.getPitch();let Q=d?`/${D}/${B}/${w}`:`${w}/${B}/${D}`;return(V||Y)&&(Q+="/"+Math.round(10*V)/10),Y&&(Q+=`/${Math.round(Y)}`),Q}const Uy={linearity:.3,easing:a.eT(0,0,.3,1)},w5=Object.assign({deceleration:2500,maxSpeed:1400},Uy),j5=Object.assign({deceleration:20,maxSpeed:1400},Uy),ox=Object.assign({deceleration:1e3,maxSpeed:360},Uy),k5=Object.assign({deceleration:1e3,maxSpeed:90},Uy);class N5{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,m=a.o.now();for(;d.length>0&&m-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const m={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:O}of this._inertiaBuffer)m.zoom+=O.zoomDelta||0,m.bearing+=O.bearingDelta||0,m.pitch+=O.pitchDelta||0,O.panDelta&&m.pan._add(O.panDelta),O.around&&(m.around=O.around),O.pinchAround&&(m.pinchAround=O.pinchAround);const w=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,M={};if(m.pan.mag()){const O=_f(m.pan.mag(),w,Object.assign({},w5,d||{}));M.offset=m.pan.mult(O.amount/m.pan.mag()),M.center=this._map.transform.center,qy(M,O)}if(m.zoom){const O=_f(m.zoom,w,j5);M.zoom=this._map.transform.zoom+O.amount,qy(M,O)}if(m.bearing){const O=_f(m.bearing,w,ox);M.bearing=this._map.transform.bearing+a.aA(O.amount,-179,179),qy(M,O)}if(m.pitch){const O=_f(m.pitch,w,k5);M.pitch=this._map.transform.pitch+O.amount,qy(M,O)}if(M.zoom||M.bearing){const O=m.pinchAround===void 0?m.around:m.pinchAround;M.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),M.noMoveStart=!0,M}}function qy(_,d){(!_.duration||_.durationm.unproject(V)),B=O.reduce((V,Y,Q,ce)=>V.add(Y.div(ce.length)),new a.P(0,0));super(d,{points:O,point:B,lngLats:D,lngLat:m.unproject(B),originalEvent:w}),this._defaultPrevented=!1}}class S5 extends a.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,m){super("wheel",{originalEvent:m}),this._defaultPrevented=!1}}class hN{constructor(d,m){this._map=d,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new S5(this._map,d))}mousedown(d,m){return this._mousedownPos=m,this._firePreventable(new kd(d.type,this._map,d))}mouseup(d){this._map.fire(new kd(d.type,this._map,d))}preclick(d){const m=new MouseEvent("preclick",d);this._map.fire(new kd(m.type,this._map,m))}click(d,m){this._mousedownPos&&this._mousedownPos.dist(m)>=this._clickTolerance||(this.preclick(d),this._map.fire(new kd(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new kd(d.type,this._map,d))}mouseover(d){this._map.fire(new kd(d.type,this._map,d))}mouseout(d){this._map.fire(new kd(d.type,this._map,d))}touchstart(d){return this._firePreventable(new Wm(d.type,this._map,d))}touchmove(d){this._map.fire(new Wm(d.type,this._map,d))}touchend(d){this._map.fire(new Wm(d.type,this._map,d))}touchcancel(d){this._map.fire(new Wm(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class C5{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new kd(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new kd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new kd(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=m.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,m){this.isEnabled()&&d.shiftKey&&d.button===0&&(z(),this._startPos=this._lastPos=m,this._active=!0)}mousemoveWindow(d,m){if(!this._active)return;const w=m,M=this._startPos,O=this._lastPos;if(!M||!O||O.equals(w)||!this._box&&w.dist(M){this._box&&(this._box.style.transform=`translate(${D}px,${V}px)`,this._box.style.width=B-D+"px",this._box.style.height=Y-V+"px")})}mouseupWindow(d,m){if(!this._active)return;const w=this._startPos,M=m;if(w&&d.button===0){if(this.reset(),H(),w.x!==M.x||w.y!==M.y)return this._map.fire(new a.z("boxzoomend",{originalEvent:d})),{cameraAnimation:O=>O.fitScreenCoordinates(w,M,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",d)}}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),F(),delete this._startPos,delete this._lastPos}_fireEvent(d,m){return this._map.fire(new a.z(d,{originalEvent:m}))}}function pN(_,d){const m={};for(let w=0;w<_.length;w++)m[_[w].identifier]=d[w];return m}class BP{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(d,m,w){(this.centroid||w.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),w.length===this.numTouches&&(this.centroid=function(M){const O=new a.P(0,0);for(const D of M)O._add(D);return O.div(M.length)}(m),this.touches=pN(w,m)))}touchmove(d,m,w){if(this.aborted||!this.centroid)return;const M=pN(w,m);for(const O in this.touches){const D=M[O];(!D||D.dist(this.touches[O])>30)&&(this.aborted=!0)}}touchend(d,m,w){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),w.length===0){const M=!this.aborted&&this.centroid;if(this.reset(),M)return M}}}class mN{constructor(d){this.singleTap=new BP(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,m,w){this.singleTap.touchstart(d,m,w)}touchmove(d,m,w){this.singleTap.touchmove(d,m,w)}touchend(d,m,w){const M=this.singleTap.touchend(d,m,w);if(M){const O=d.timeStamp-this.lastTime<500,D=!this.lastTap||this.lastTap.dist(M)<30;if(O&&D||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=M,this.count===this.numTaps)return this.reset(),M}}}class $P{constructor(){this._zoomIn=new mN({numTouches:1,numTaps:2}),this._zoomOut=new mN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,m,w){this._zoomIn.touchstart(d,m,w),this._zoomOut.touchstart(d,m,w)}touchmove(d,m,w){this._zoomIn.touchmove(d,m,w),this._zoomOut.touchmove(d,m,w)}touchend(d,m,w){const M=this._zoomIn.touchend(d,m,w),O=this._zoomOut.touchend(d,m,w);return M?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()+1,around:D.unproject(M)},{originalEvent:d})}):O?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()-1,around:D.unproject(O)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const UP={0:1,2:2},M5={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class gN{constructor(d){this.reset(),this._clickTolerance=d.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(d,m){return!1}_move(d,m){return{}}mousedown(d,m){if(this._lastPoint)return;const w=te(d);this._correctButton(d,w)&&(this._lastPoint=m,this._eventButton=w)}mousemoveWindow(d,m){const w=this._lastPoint;if(w){if(d.preventDefault(),this._eventButton!=null&&function(M,O){const D=UP[O];return M.buttons===void 0||(M.buttons&D)!==D}(d,this._eventButton))this.reset();else if(this._moved||!(m.dist(w)0&&(this._active=!0);const M=pN(w,m),O=new a.P(0,0),D=new a.P(0,0);let B=0;for(const Y in M){const Q=M[Y],ce=this._touches[Y];ce&&(O._add(Q),D._add(Q.sub(ce)),B++,M[Y]=Q)}if(this._touches=M,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class xN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,m,w){return{}}touchstart(d,m,w){this._firstTwoTouches||w.length<2||(this._firstTwoTouches=[w[0].identifier,w[1].identifier],this._start([m[0],m[1]]))}touchmove(d,m,w){const M=this._firstTwoTouches;if(!M)return;d.preventDefault();const[O,D]=M,B=$v(w,m,O),V=$v(w,m,D);if(!B||!V)return;const Y=this._aroundCenter?null:B.add(V).div(2);return this._move([B,V],Y,d)}touchend(d,m,w){if(!this._firstTwoTouches)return;const[M,O]=this._firstTwoTouches,D=$v(w,m,M),B=$v(w,m,O);D&&B||(this._active&&H(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function $v(_,d,m){for(let w=0;w<_.length;w++)if(_[w].identifier===m)return d[w]}function HP(_,d){return Math.log2(_/d)}class mae extends xN{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,m){const w=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(HP(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:HP(this._distance,w),pinchAround:m}}}function WP(_,d){return 180*_.angleWith(d)/Math.PI}class Aa extends xN{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,m){const w=this._vector;if(this._vector=d[0].sub(d[1]),w&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:WP(this._vector,w),pinchAround:m}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const m=25/(Math.PI*this._minDiameter)*360,w=this._startVector;if(!w)return!1;const M=WP(d,w);return Math.abs(M)Math.abs(_.x)}class gae extends xN{constructor(d){super(),this._map=d}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(d){this._lastPoints=d,yN(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,m,w){const M=this._lastPoints;if(!M)return;const O=d[0].sub(M[0]),D=d[1].sub(M[1]);return this._map._cooperativeGestures&&!a.eU()&&w.touches.length<3||(this._valid=this.gestureBeginsVertically(O,D,w.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(O.y+D.y)/2*-.5})}gestureBeginsVertically(d,m,w){if(this._valid!==void 0)return this._valid;const M=d.mag()>=2,O=m.mag()>=2;if(!M&&!O)return;if(!M||!O)return this._firstMove==null&&(this._firstMove=w),w-this._firstMove<100&&void 0;const D=d.y>0==m.y>0;return yN(d)&&yN(m)&&D}}const xae={panStep:100,bearingStep:15,pitchStep:10};class yae{constructor(){const d=xae;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let m=0,w=0,M=0,O=0,D=0;switch(d.keyCode){case 61:case 107:case 171:case 187:m=1;break;case 189:case 109:case 173:m=-1;break;case 37:d.shiftKey?w=-1:(d.preventDefault(),O=-1);break;case 39:d.shiftKey?w=1:(d.preventDefault(),O=1);break;case 38:d.shiftKey?M=1:(d.preventDefault(),D=-1);break;case 40:d.shiftKey?M=-1:(d.preventDefault(),D=1);break;default:return}return this._rotationDisabled&&(w=0,M=0),{cameraAnimation:B=>{const V=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:Uv,zoom:m?Math.round(V)+m*(d.shiftKey?2:1):V,bearing:B.getBearing()+w*this._bearingStep,pitch:B.getPitch()+M*this._pitchStep,offset:[-O*this._panStep,-D*this._panStep],center:B.getCenter()},{originalEvent:d})}}}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 Uv(_){return _*(2-_)}const E5=4.000244140625,I5=1/450;class vN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._handler=m,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=I5,a.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(d){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(d.ctrlKey||d.metaKey||this.isZooming()||a.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let m=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const w=a.o.now(),M=w-(this._lastWheelEventTime||0);this._lastWheelEventTime=w,m!==0&&m%E5==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":M>400?(this._type=null,this._lastValue=m,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(M*m)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,m+=this._lastValue)),d.shiftKey&&m&&(m/=4),this._type&&(this._lastWheelEvent=d,this._delta-=m,this._active||this._start(d)),d.preventDefault()}_onTimeout(d){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)}_start(d){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 m=K(this._el,d);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:m,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 d=this._map.transform;this._type==="wheel"&&d.projection.wrap&&(d._center.lng>=180||d._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const m=()=>d._terrainEnabled()&&this._aroundCoord?d.computeZoomRelativeTo(this._aroundCoord):d.zoom;if(this._delta!==0){const Y=this._type==="wheel"&&Math.abs(this._delta)>E5?this._wheelZoomRate:this._defaultZoomRate;let Q=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&Q!==0&&(Q=1/Q);const ce=m(),oe=Math.pow(2,ce),ue=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):oe;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(ue*Q))),this._type==="wheel"&&(this._startZoom=ce,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const w=typeof this._targetZoom=="number"?this._targetZoom:m(),M=this._startZoom,O=this._easing;let D,B=!1;if(this._type==="wheel"&&M&&O){const Y=Math.min((a.o.now()-this._lastWheelEventTime)/200,1),Q=O(Y);D=a.ak(M,w,Q),Y<1?this._frameId||(this._frameId=!0):B=!0}else D=w,B=!0;this._active=!0,B&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let V=D-m();return V*this._lastDelta<0&&(V=0),{noInertia:!0,needsRenderFrame:!B,zoomDelta:V,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let m=a.eV;if(this._prevEase){const w=this._prevEase,M=(a.o.now()-w.start)/w.duration,O=w.easing(M+.01)-w.easing(M),D=.27/Math.sqrt(O*O+1e-4)*.01,B=Math.sqrt(.0729-D*D);m=a.eT(D,B,.25,1)}return this._prevEase={start:a.o.now(),duration:d,easing:m},m}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=C("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 Np{constructor(d,m){this._clickZoom=d,this._tapZoom=m}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 _N{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,m){return d.preventDefault(),{cameraAnimation:w=>{w.easeTo({duration:300,zoom:w.getZoom()+(d.shiftKey?-1:1),around:w.unproject(m)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Uo{constructor(){this._tap=new mN({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(d,m,w){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?w.length>0&&(this._swipePoint=m[0],this._swipeTouch=w[0].identifier):this._tap.touchstart(d,m,w))}touchmove(d,m,w){if(this._tapTime){if(this._swipePoint){if(w[0].identifier!==this._swipeTouch)return;const M=m[0],O=M.y-this._swipePoint.y;return this._swipePoint=M,d.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(d,m,w)}touchend(d,m,w){this._tapTime?this._swipePoint&&w.length===0&&this.reset():this._tap.touchend(d,m,w)&&(this._tapTime=d.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bf{constructor(d,m,w){this._el=d,this._mousePan=m,this._touchPan=w}enable(d){this._inertiaOptions=d||{},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 qv{constructor(d,m,w){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=m,this._mousePitch=w}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class bN{constructor(d,m,w,M){this._el=d,this._touchZoom=m,this._touchRotate=w,this._tapDragZoom=M,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),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 Vv=_=>_.zoom||_.drag||_.pitch||_.rotate;class vae extends a.z{}class Hv{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,m){const w=a.av([],m,d);this.radius=a.ag(w[2]<0?a.eX([],w,this.constants):[w[0],w[1],0])}projectRay(d){a.eX(d,d,this.constants),a.aw(d,d),a.eY(d,d,this.constants);const m=a.c5([],d,this.radius);if(m[2]>0){const w=a.c5([],[0,0,1],a.bJ(m,[0,0,1])),M=a.c5([],a.aw([],[m[0],m[1],0]),this.radius),O=a.d8([],m,a.c5([],a.av([],a.d8([],M,w),m),2));m[0]=O[0],m[1]=O[1]}return m}}function wN(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class _ae{constructor(d,m){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new N5(d),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Hv,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),a.aY(["handleEvent","handleWindowEvent"],this);const w=this._el;this._listeners=[[w,"touchstart",{passive:!0}],[w,"touchmove",{passive:!1}],[w,"touchend",void 0],[w,"touchcancel",void 0],[w,"mousedown",void 0],[w,"mousemove",void 0],[w,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[w,"mouseover",void 0],[w,"mouseout",void 0],[w,"dblclick",void 0],[w,"click",void 0],[w,"keydown",{capture:!1}],[w,"keyup",void 0],[w,"wheel",{passive:!1}],[w,"contextmenu",void 0],[window,"blur",void 0]];for(const[M,O,D]of this._listeners){const B=M===document?this.handleWindowEvent:this.handleEvent;M.addEventListener(O,B,D)}}destroy(){for(const[d,m,w]of this._listeners){const M=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(m,M,w)}}_addDefaultHandlers(d){const m=this._map,w=m.getCanvasContainer();this._add("mapEvent",new hN(m,d));const M=m.boxZoom=new fN(m,d);this._add("boxZoom",M);const O=new $P,D=new _N;m.doubleClickZoom=new Np(D,O),this._add("tapZoom",O),this._add("clickZoom",D);const B=new Uo;this._add("tapDragZoom",B);const V=m.touchPitch=new gae(m);this._add("touchPitch",V);const Y=new T5(d),Q=new A5(d);m.dragRotate=new qv(d,Y,Q),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",Q,["mouseRotate"]);const ce=new qP(d),oe=new VP(m,d);m.dragPan=new bf(w,ce,oe),this._add("mousePan",ce),this._add("touchPan",oe,["touchZoom","touchRotate"]);const ue=new Aa,ke=new mae;m.touchZoomRotate=new bN(w,ke,ue,B),this._add("touchRotate",ue,["touchPan","touchZoom"]),this._add("touchZoom",ke,["touchPan","touchRotate"]),this._add("blockableMapEvent",new C5(m));const _e=m.scrollZoom=new vN(m,this);this._add("scrollZoom",_e,["mousePan"]);const Le=m.keyboard=new yae;this._add("keyboard",Le);for(const Pe of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Pe]&&m[Pe].enable(d[Pe])}_add(d,m,w){this._handlers.push({handlerName:d,handler:m,allowed:w}),this._handlersById[d]=m}stop(d){if(!this._updatingCamera){for(const{handler:m}of this._handlers)m.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Vv(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,m,w){for(const M in d)if(M!==w&&(!m||m.indexOf(M)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const m=[];for(const w of d)this._el.contains(w.target)&&m.push(w);return m}handleEvent(d,m){this._updatingCamera=!0;const w=d.type==="renderFrame",M=w?void 0:d,O={needsRenderFrame:!1},D={},B={},V=d.touches?this._getMapTouches(d.touches):void 0,Y=V?Z(this._el,V):w?void 0:K(this._el,d);for(const{handlerName:oe,handler:ue,allowed:ke}of this._handlers){if(!ue.isEnabled())continue;let _e;this._blockedByActive(B,ke,oe)?ue.reset():ue[m||d.type]&&(_e=ue[m||d.type](d,Y,V),this.mergeHandlerResult(O,D,_e,oe,M),_e&&_e.needsRenderFrame&&this._triggerRenderFrame()),(_e||ue.isActive())&&(B[oe]=ue)}const Q={};for(const oe in this._previousActiveHandlers)B[oe]||(Q[oe]=M);this._previousActiveHandlers=B,(Object.keys(Q).length||wN(O))&&(this._changes.push([O,D,Q]),this._triggerRenderFrame()),(Object.keys(B).length||wN(O))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=O;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))}mergeHandlerResult(d,m,w,M,O){if(!w)return;Object.assign(d,w);const D={handlerName:M,originalEvent:w.originalEvent||O};w.zoomDelta!==void 0&&(m.zoom=D),w.panDelta!==void 0&&(m.drag=D),w.pitchDelta!==void 0&&(m.pitch=D),w.bearingDelta!==void 0&&(m.rotate=D)}_applyChanges(){const d={},m={},w={};for(const[M,O,D]of this._changes)M.panDelta&&(d.panDelta=(d.panDelta||new a.P(0,0))._add(M.panDelta)),M.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+M.zoomDelta),M.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+M.bearingDelta),M.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+M.pitchDelta),M.around!==void 0&&(d.around=M.around),M.aroundCoord!==void 0&&(d.aroundCoord=M.aroundCoord),M.pinchAround!==void 0&&(d.pinchAround=M.pinchAround),M.noInertia&&(d.noInertia=M.noInertia),Object.assign(m,O),Object.assign(w,D);this._updateMapTransform(d,m,w),this._changes=[]}_updateMapTransform(d,m,w){const M=this._map,O=M.transform,D=qe=>[qe.x,qe.y,qe.z];if((qe=>{const Ze=this._eventsInProgress.drag;return Ze&&!this._handlersById[Ze.handlerName].isActive()})()&&!wN(d)){const qe=O.zoom;O.cameraElevationReference="sea",this._originalZoom!=null&&O._orthographicProjectionAtLowPitch&&O.projection.name!=="globe"&&O.pitch===0?(O.cameraElevationReference="ground",O.zoom=this._originalZoom):(O.recenterOnTerrain(),O.cameraElevationReference="ground"),qe!==O.zoom&&this._map._update(!0)}if(O._isCameraConstrained&&M._stop(!0),!wN(d))return void this._fireEvents(m,w,!0);let{panDelta:B,zoomDelta:V,bearingDelta:Y,pitchDelta:Q,around:ce,aroundCoord:oe,pinchAround:ue}=d;O._isCameraConstrained&&(V>0&&(V=0),O._isCameraConstrained=!1),ue!==void 0&&(ce=ue),(V||(qe=>m[qe]&&!this._eventsInProgress[qe])("drag"))&&ce&&(this._dragOrigin=D(O.pointCoordinate3D(ce)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",M._stop(!0),ce=ce||M.transform.centerPoint,Y&&(O.bearing+=Y),Q&&(O.pitch+=Q),O._updateCameraState();const ke=[0,0,0];if(B)if(O.projection.name==="mercator"){const qe=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(ce).dir),Ze=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(ce.sub(B)).dir);ke[0]=Ze[0]-qe[0],ke[1]=Ze[1]-qe[1]}else{const qe=O.pointCoordinate(ce);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const Ze=O._pixelsPerMercatorPixel/O.worldSize;ke[0]=-B.x*a.eW(a.a$(qe.y))*Ze,ke[1]=-B.y*a.eW(O.center.lat)*Ze}else{const Ze=O.pointCoordinate(ce.sub(B));qe&&Ze&&(ke[0]=Ze.x-qe.x,ke[1]=Ze.y-qe.y)}}const _e=O.zoom,Le=[0,0,0];if(V){const qe=D(oe||O.pointCoordinate3D(ce)),Ze={dir:a.aw([],a.av([],qe,O._camera.position))};if(Ze.dir[2]<0){const He=O.zoomDeltaToMovement(qe,V);a.c5(Le,Ze.dir,He)}}const Pe=a.d8(ke,ke,Le);O._translateCameraConstrained(Pe),V&&Math.abs(O.zoom-_e)>1e-4&&O.recenterOnTerrain(),O.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(m,w,!0)}_fireEvents(d,m,w){const M=Vv(this._eventsInProgress),O=Vv(d),D={};for(const Q in d){const{originalEvent:ce}=d[Q];this._eventsInProgress[Q]||(D[`${Q}start`]=ce),this._eventsInProgress[Q]=d[Q]}!M&&O&&this._fireEvent("movestart",O.originalEvent);for(const Q in D)this._fireEvent(Q,D[Q]);O&&this._fireEvent("move",O.originalEvent);for(const Q in d){const{originalEvent:ce}=d[Q];this._fireEvent(Q,ce)}const B={};let V;for(const Q in this._eventsInProgress){const{handlerName:ce,originalEvent:oe}=this._eventsInProgress[Q];this._handlersById[ce].isActive()||(delete this._eventsInProgress[Q],V=m[ce]||oe,B[`${Q}end`]=V)}for(const Q in B)this._fireEvent(Q,B[Q]);const Y=Vv(this._eventsInProgress);if(w&&(M||O)&&!Y){this._updatingCamera=!0;const Q=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ce=oe=>oe!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new vae("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const jN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class P5 extends a.E{constructor(d,m){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=m.bearingSnap,this._respectPrefersReducedMotion=m.respectPrefersReducedMotion!==!1,a.aY(["_renderFrameCallback"],this)}getCenter(){return new a.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,m){return this.jumpTo({center:d},m)}panBy(d,m,w){return d=a.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},m),w)}panTo(d,m,w){return this.easeTo(Object.assign({center:d},m),w)}getZoom(){return this.transform.zoom}setZoom(d,m){return this.jumpTo({zoom:d},m),this}zoomTo(d,m,w){return this.easeTo(Object.assign({zoom:d},m),w)}zoomIn(d,m){return this.zoomTo(this.getZoom()+1,d,m),this}zoomOut(d,m){return this.zoomTo(this.getZoom()-1,d,m),this}getBearing(){return this.transform.bearing}setBearing(d,m){return this.jumpTo({bearing:d},m),this}getPadding(){return this.transform.padding}setPadding(d,m){return this.jumpTo({padding:d},m),this}rotateTo(d,m,w){return this.easeTo(Object.assign({bearing:d},m),w)}resetNorth(d,m){return this.rotateTo(0,Object.assign({duration:1e3},d),m),this}resetNorthPitch(d,m){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),m),this}snapToNorth(d,m){return Math.abs(this.getBearing())d.aspect?w/(2*Math.tan(.5*d.fovX)*d.aspect):M/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,m,w,M,O,D){const B=d.clone(),V=this._extendCameraOptions(D);B.bearing=M,B.pitch=O;const Y=a.aT.convert(m),Q=a.aT.convert(w),ce=.5*(Y.lat+Q.lat),oe=.5*(Y.lng+Q.lng),ue=a.eZ(ce,oe),ke=a.aw([],ue),_e=a.aw([],a.bI([],ke,[0,1,0])),Le=a.bI([],_e,ke),Pe=[_e[0],_e[1],_e[2],0,Le[0],Le[1],Le[2],0,ke[0],ke[1],ke[2],0,0,0,0,1],qe=[ue,a.eZ(Y.lat,Y.lng),a.eZ(Q.lat,Y.lng),a.eZ(Q.lat,Q.lng),a.eZ(Y.lat,Q.lng),a.eZ(ce,Y.lng),a.eZ(ce,Q.lng),a.eZ(Y.lat,oe),a.eZ(Q.lat,oe)];let Ze=a.d9.fromPoints(qe.map(qt=>[a.bJ(_e,qt),a.bJ(Le,qt),a.bJ(ke,qt)]));const He=a.af([],Ze.center,Pe);a.e_(He)===0&&a.e$(He,0,0,1),a.aw(He,He),a.c5(He,He,a.aD),B.center=a.f0(He);const xt=B.getWorldToCameraMatrix(),ct=a.bl(new Float64Array(16),xt);Ze=a.d9.applyTransform(Ze,a.aB([],xt,Pe));const pt=this._extendAABB(Ze,B,V,M);if(!pt)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ze=pt,a.af(He,He,xt);const lt=.5*(Ze.max[2]-Ze.min[2]),st=this._minimumAABBFrustumDistance(B,Ze),wt=a.c5([],[0,0,1],lt),Ot=a.d8(wt,He,wt),Pt=st+(B.pitch===0?0:a.bG(He,Ot)),Vt=B.globeCenterInViewSpace,Wt=a.av([],He,[Vt[0],Vt[1],Vt[2]]);a.aw(Wt,Wt),a.c5(Wt,Wt,Pt);const sr=a.d8([],He,Wt);a.af(sr,sr,ct);const br=a.eM/a.aD,zt=a.ag(sr),Mt=a.cf(Math.max(zt*br-a.eM,Number.EPSILON),0),Xt=Math.min(B.zoomFromMercatorZAdjusted(Mt),V.maxZoom);return Xt>.5*(a.c_+a.cL)?(B.setProjection({name:"mercator"}),B.zoom=Xt,this._cameraForBounds(B,m,w,M,O,D)):{center:B.center,zoom:Xt,bearing:M,pitch:O}}_extendAABB(d,m,w,M){const O=.5*((w.padding.left||0)+(w.padding.right||0)),D=.5*((w.padding.top||0)+(w.padding.bottom||0)),B=D,V=O,Y=O,Q=D,ce=m.width-(V+Y),oe=m.height-(B+Q),ue=a.av([],d.max,d.min),ke=Math.min(ce/ue[0],oe/ue[1]),_e=Math.min(m.scaleZoom(m.scale*ke),w.maxZoom);if(isNaN(_e))return null;const Le=m.scale/m.zoomScale(_e),Pe=new a.d9([d.min[0]-V*Le,d.min[1]-Q*Le,d.min[2]],[d.max[0]+Y*Le,d.max[1]+B*Le,d.max[2]]),qe=(typeof w.offset.x=="number"&&typeof w.offset.y=="number"?new a.P(w.offset.x,w.offset.y):a.P.convert(w.offset)).rotate(-a.an(M));return Pe.center[0]-=qe.x*Le,Pe.center[1]+=qe.y*Le,Pe}queryTerrainElevation(d,m){const w=this.transform.elevation;return w?(m=Object.assign({},{exaggerated:!0},m),w.getAtPoint(a.ae.fromLngLat(d),null,m.exaggerated)):null}_cameraForBounds(d,m,w,M,O,D){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,m,w,M,O,D);const B=d.clone(),V=this._extendCameraOptions(D);B.bearing=M,B.pitch=O;const Y=a.aT.convert(m),Q=a.aT.convert(w),ce=new a.aT(Y.lng,Q.lat),oe=new a.aT(Q.lng,Y.lat),ue=B.project(Y),ke=B.project(Q),_e=this.queryTerrainElevation(Y),Le=this.queryTerrainElevation(Q),Pe=this.queryTerrainElevation(ce),qe=this.queryTerrainElevation(oe),Ze=[[ue.x,ue.y,Math.min(_e||0,Le||0,Pe||0,qe||0)],[ke.x,ke.y,Math.max(_e||0,Le||0,Pe||0,qe||0)]];let He=a.d9.fromPoints(Ze);const xt=B.getWorldToCameraMatrix(),ct=a.bl(new Float64Array(16),xt);He=a.d9.applyTransform(He,xt);const pt=this._extendAABB(He,B,V,M);if(!pt)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");He=pt;const lt=.5*a.av([],He.max,He.min)[2],st=this._minimumAABBFrustumDistance(B,He),wt=[0,0,1,0];a.aC(wt,wt,xt),a.f1(wt,wt);const Ot=a.c5([],wt,st+lt),Pt=a.d8([],He.center,Ot);a.af(He.center,He.center,ct),a.af(Pt,Pt,ct);const Vt=B.unproject(new a.P(He.center[0],He.center[1])),Wt=a.f2(B.projection,Vt),sr=Math.pow(2,Wt),br=Math.min(B._zoomFromMercatorZ(Pt[2]*B.pixelsPerMeter*sr/B.worldSize),V.maxZoom);return B.mercatorFromTransition&&br<.5*(a.c_+a.cL)?(B.setProjection({name:"globe"}),B.zoom=br,this._cameraForBounds(B,m,w,M,O,D)):{center:Vt,zoom:br,bearing:M,pitch:O}}fitBounds(d,m,w){const M=this.cameraForBounds(d,m);return this._fitInternal(M,m,w)}fitScreenCoordinates(d,m,w,M,O){const D=a.P.convert(d),B=a.P.convert(m),V=new a.P(Math.min(D.x,B.x),Math.min(D.y,B.y)),Y=new a.P(Math.max(D.x,B.x),Math.max(D.y,B.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(D,B))return this;const Q=this.transform.pointLocation3D(V),ce=this.transform.pointLocation3D(Y),oe=this.transform.pointLocation3D(new a.P(V.x,Y.y)),ue=this.transform.pointLocation3D(new a.P(Y.x,V.y)),ke=[Math.min(Q.lng,ce.lng,oe.lng,ue.lng),Math.min(Q.lat,ce.lat,oe.lat,ue.lat)],_e=[Math.max(Q.lng,ce.lng,oe.lng,ue.lng),Math.max(Q.lat,ce.lat,oe.lat,ue.lat)],Le=M&&M.pitch?M.pitch:this.getPitch(),Pe=this._cameraForBounds(this.transform,ke,_e,w,Le,M);return this._fitInternal(Pe,M,O)}_fitInternal(d,m,w){return d?(m=Object.assign(d,m)).linear?this.easeTo(m,w):this.flyTo(m,w):this}jumpTo(d,m){this.stop();const w=d.preloadOnly?this.transform.clone():this.transform;let M=!1,O=!1,D=!1;"zoom"in d&&w.zoom!==+d.zoom&&(M=!0,w.zoom=+d.zoom),d.center!==void 0&&(w.center=a.aT.convert(d.center)),"bearing"in d&&w.bearing!==+d.bearing&&(O=!0,w.bearing=+d.bearing),"pitch"in d&&w.pitch!==+d.pitch&&(D=!0,w.pitch=+d.pitch);const B=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!w.isPaddingEqual(B))if(d.retainPadding===!1){const V=w.clone();V.padding=B,w.setLocationAtPoint(w.center,V.centerPoint)}else w.padding=B;return d.preloadOnly?(this._preloadTiles(w),this):(this.fire(new a.z("movestart",m)).fire(new a.z("move",m)),M&&this.fire(new a.z("zoomstart",m)).fire(new a.z("zoom",m)).fire(new a.z("zoomend",m)),O&&this.fire(new a.z("rotatestart",m)).fire(new a.z("rotate",m)).fire(new a.z("rotateend",m)),D&&this.fire(new a.z("pitchstart",m)).fire(new a.z("pitch",m)).fire(new a.z("pitchend",m)),this.fire(new a.z("moveend",m)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.w(jN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,m){const w=this.transform;if(!w.projection.supportsFreeCamera)return a.w(jN),this;this.stop();const M=w.zoom,O=w.pitch,D=w.bearing;w.setFreeCameraOptions(d);const B=M!==w.zoom,V=O!==w.pitch,Y=D!==w.bearing;return this.fire(new a.z("movestart",m)).fire(new a.z("move",m)),B&&this.fire(new a.z("zoomstart",m)).fire(new a.z("zoom",m)).fire(new a.z("zoomend",m)),Y&&this.fire(new a.z("rotatestart",m)).fire(new a.z("rotate",m)).fire(new a.z("rotateend",m)),V&&this.fire(new a.z("pitchstart",m)).fire(new a.z("pitch",m)).fire(new a.z("pitchend",m)),this.fire(new a.z("moveend",m)),this}easeTo(d,m){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:a.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const w=this.transform,M=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),V="zoom"in d?+d.zoom:M,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,Q="pitch"in d?+d.pitch:D,ce=this._extendPadding(d.padding),oe=a.P.convert(d.offset);let ue,ke,_e;if(w.projection.name==="globe"){const wt=a.ae.fromLngLat(w.center),Ot=oe.rotate(-w.angle);wt.x+=Ot.x/w.worldSize,wt.y+=Ot.y/w.worldSize;const Pt=wt.toLngLat(),Vt=a.aT.convert(d.center||Pt);this._normalizeCenter(Vt),ue=w.centerPoint.add(Ot),ke=new a.P(wt.x,wt.y).mult(w.worldSize),_e=new a.P(a.aF(Vt.lng),a.aJ(Vt.lat)).mult(w.worldSize).sub(ke)}else{ue=w.centerPoint.add(oe);const wt=w.pointLocation(ue),Ot=a.aT.convert(d.center||wt);this._normalizeCenter(Ot),ke=w.project(wt),_e=w.project(Ot).sub(ke)}const Le=w.zoomScale(V-M);let Pe,qe;d.around&&(Pe=a.aT.convert(d.around),qe=w.locationPoint(Pe));const Ze=this._zooming||V!==M,He=this._rotating||O!==Y,xt=this._pitching||Q!==D,ct=!w.isPaddingEqual(ce),pt=d.retainPadding===!1?w.clone():w,lt=wt=>Ot=>{if(Ze&&(wt.zoom=a.ak(M,V,Ot)),He&&(wt.bearing=a.ak(O,Y,Ot)),xt&&(wt.pitch=a.ak(D,Q,Ot)),ct&&(pt.interpolatePadding(B,ce,Ot),ue=pt.centerPoint.add(oe)),Pe)wt.setLocationAtPoint(Pe,qe);else{const Pt=wt.zoomScale(wt.zoom-M),Vt=V>M?Math.min(2,Le):Math.max(.5,Le),Wt=Math.pow(Vt,1-Ot),sr=wt.unproject(ke.add(_e.mult(Ot*Wt)).mult(Pt));wt.setLocationAtPoint(wt.renderWorldCopies?sr.wrap():sr,ue)}return d.preloadOnly||this._fireMoveEvents(m),wt};if(d.preloadOnly){const wt=this._emulate(lt,d.duration,w);return this._preloadTiles(wt),this}const st={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Ze,this._rotating=He,this._pitching=xt,this._padding=ct,this._easeId=d.easeId,this._prepareEase(m,d.noMoveStart,st),this._ease(lt(w),wt=>{w.cameraElevationReference==="sea"&&w.recenterOnTerrain(),this._afterEase(m,wt)},d),this}_prepareEase(d,m,w={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),m||w.moving||this.fire(new a.z("movestart",d)),this._zooming&&!w.zooming&&this.fire(new a.z("zoomstart",d)),this._rotating&&!w.rotating&&this.fire(new a.z("rotatestart",d)),this._pitching&&!w.pitching&&this.fire(new a.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new a.z("move",d)),this._zooming&&this.fire(new a.z("zoom",d)),this._rotating&&this.fire(new a.z("rotate",d)),this._pitching&&this.fire(new a.z("pitch",d))}_afterEase(d,m){if(this._easeId&&m&&this._easeId===m)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const w=this._zooming,M=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,w&&this.fire(new a.z("zoomend",d)),M&&this.fire(new a.z("rotateend",d)),O&&this.fire(new a.z("pitchend",d)),this.fire(new a.z("moveend",d))}flyTo(d,m){if(this._prefersReducedMotion(d)){const qt=a.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(qt,m)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:a.eV},d);const w=this.transform,M=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),V="zoom"in d?a.aA(+d.zoom,w.minZoom,w.maxZoom):M,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,Q="pitch"in d?+d.pitch:D,ce=this._extendPadding(d.padding),oe=w.zoomScale(V-M),ue=a.P.convert(d.offset);let ke=w.centerPoint.add(ue);const _e=w.pointLocation(ke),Le=a.aT.convert(d.center||_e);this._normalizeCenter(Le);const Pe=w.project(_e),qe=w.project(Le).sub(Pe);let Ze=d.curve;const He=Math.max(w.width,w.height),xt=He/oe,ct=qe.mag();if("minZoom"in d){const qt=a.aA(Math.min(d.minZoom,M,V),w.minZoom,w.maxZoom),ur=He/w.zoomScale(qt-M);Ze=Math.sqrt(ur/ct*2)}const pt=Ze*Ze;function lt(qt){const ur=(xt*xt-He*He+(qt?-1:1)*pt*pt*ct*ct)/(2*(qt?xt:He)*pt*ct);return Math.log(Math.sqrt(ur*ur+1)-ur)}function st(qt){return(Math.exp(qt)-Math.exp(-qt))/2}function wt(qt){return(Math.exp(qt)+Math.exp(-qt))/2}const Ot=lt(0);let Pt=function(qt){return wt(Ot)/wt(Ot+Ze*qt)},Vt=function(qt){return He*((wt(Ot)*(st(ur=Ot+Ze*qt)/wt(ur))-st(Ot))/pt)/ct;var ur},Wt=(lt(1)-Ot)/Ze;if(Math.abs(ct)<1e-6||!isFinite(Wt)){if(Math.abs(He-xt)<1e-6)return this.easeTo(d,m);const qt=xtd.maxDuration&&(d.duration=0);const sr=O!==Y,br=Q!==D,zt=!w.isPaddingEqual(ce),Mt=d.retainPadding===!1?w.clone():w,Xt=qt=>ur=>{const Er=ur*Wt,Gr=1/Pt(Er);qt.zoom=ur===1?V:M+qt.scaleZoom(Gr),sr&&(qt.bearing=a.ak(O,Y,ur)),br&&(qt.pitch=a.ak(D,Q,ur)),zt&&(Mt.interpolatePadding(B,ce,ur),ke=Mt.centerPoint.add(ue));const Sr=ur===1?Le:qt.unproject(Pe.add(qe.mult(Vt(Er))).mult(Gr));return qt.setLocationAtPoint(qt.renderWorldCopies?Sr.wrap():Sr,ke),qt._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(m),qt};if(d.preloadOnly){const qt=this._emulate(Xt,d.duration,w);return this._preloadTiles(qt),this}return this._zooming=!0,this._rotating=sr,this._pitching=br,this._padding=zt,this._prepareEase(m,!1),this._ease(Xt(w),()=>this._afterEase(m),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const w=this._onEaseEnd;this._onEaseEnd=void 0,w.call(this,m)}if(!d){const w=this.handlers;w&&w.stop(!1)}return this}_ease(d,m,w){w.animate===!1||w.duration===0?(d(1),m()):(this._easeStart=a.o.now(),this._easeOptions=w,this._onEaseFrame=d,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((a.o.now()-this._easeStart)/this._easeOptions.duration,1),m=this._onEaseFrame;m&&m(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,m){d=a.bT(d,-180,180);const w=Math.abs(d-m);return Math.abs(d-360-m)180?-360:w<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&a.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,m,w){const M=Math.ceil(15*m/1e3),O=[],D=d(w.clone());for(let B=0;B<=M;B++){const V=D(B/M);O.push(V.clone())}return O}_preloadTiles(d,m){}}class Wv{constructor(d={}){this.options=d,a.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const m=this.options&&this.options.compact,w=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=C("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",w);const M=C("span","mapboxgl-ctrl-icon",this._compactButton);return M.setAttribute("aria-hidden","true"),M.setAttribute("title",w),this._innerContainer=C("div","mapboxgl-ctrl-attrib-inner",this._container),m&&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),m===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let d=this._editLink;d||(d=this._editLink=this._container.querySelector(".mapbox-improve-map"));const m=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.e.ACCESS_TOKEN}];if(d){const w=m.reduce((M,O,D)=>(O.value&&(M+=`${O.key}=${O.value}${DM.length-O.length),d=d.filter((M,O)=>{for(let D=O+1;D=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const w=d.map(M=>function(O){const D=new DOMParser().parseFromString(O,"text/html");return Array.from(D.body.querySelectorAll("*")).forEach(B=>{const V=B.textContent||"";if(B.tagName!=="A")return void B.replaceWith(D.createTextNode(V));const Y=B.getAttribute("href");if(!Y||!/^(https?:|mailto:)/i.test(Y))return void B.replaceWith(D.createTextNode(V));const Q=D.createElement("a");Q.href=Y,Q.textContent=V,Q.rel="noopener nofollow";const ce=B.getAttribute("class");ce&&(Q.className=ce),B.replaceWith(Q)}),D.body.innerHTML}(M)).join(" | ");w!==this._attribHTML&&(this._attribHTML=w,d.length?(this._innerContainer.innerHTML=w,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 Gv{constructor(){a.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=C("div","mapboxgl-ctrl");const m=C("a","mapboxgl-ctrl-logo");return m.target="_blank",m.rel="noopener nofollow",m.href="https://www.mapbox.com/",m.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),m.setAttribute("rel","noopener nofollow"),this._container.appendChild(m),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(d){d&&d.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const d=this._map.style._sourceCaches;if(Object.entries(d).length===0)return!0;for(const m in d){const w=d[m].getSource();if(w.hasOwnProperty("mapbox_logo")&&!w.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<250?m.classList.add("mapboxgl-compact"):m.classList.remove("mapboxgl-compact")}}}class Vy{constructor(){a.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",m=>this._onIndoorUpdate(m)),this._container}_createButton(d,m){const w=C("button",d,this._container);return w.type="button",w.addEventListener("click",m),w}_createSeparator(){return C("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,m){this._map&&(d.setAttribute("aria-label",m),d.textContent=m)}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(d){if(!d||!d.floors)return this._model=d,void(this._container.style.display="none");const m=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",m&&Array.from(this._container.children).forEach(w=>w.remove()),d.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(d.floors,d.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const d=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const m=this._map;this._model&&m&&m._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});C("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&d.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(d),this._createSeparator()}_updateBuildingsButtonState(){const d=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");d&&this._model&&(this._model.activeFloorsVisible?d.classList.remove("mapboxgl-ctrl-level-button-selected"):d.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(d,m){for(let w=0;w{this._map._selectIndoorFloor(M.id)});this._setButtonTitle(O,M.zIndex.toString()),this._model&&M.id===this._model.selectedFloorId&&m&&O.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(O),w=this._endTime)return this._end;const m=a.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-m)+this._end*m}isEasing(d){return d>=this._startTime&&d<=this._endTime}jumpTo(d){this._startTime=-1/0,this._endTime=-1/0,this._start=d,this._end=d}easeTo(d,m,w){this._start=this.getValue(m),this._end=d,this._startTime=m,this._endTime=m+w}}const Mp={"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 Gm extends a.z{constructor(d,m,w,M){const{point:O,lngLat:D,originalEvent:B,target:V}=d;super(d.type,{point:O,lngLat:D,originalEvent:B,target:V}),this.preventDefault=()=>{d.preventDefault()},this.id=m,this.interaction=w,this.feature=M}}class Ah{constructor(d){this.map=d,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(d,m){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const w=m.filter;let M=m.type;w&&this.filters.set(d,a.b6(w)),M==="mouseover"&&(M="mouseenter"),M==="mouseout"&&(M="mouseleave");const O=this.interactionsByType.get(M)||new Map;M==="mouseenter"||M==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(d,m)):O.size===0&&this.map.on(M,this.handleType),O.size===0&&this.interactionsByType.set(M,O),O.set(d,m),this.typeById.set(d,M)}get(d){const m=this.typeById.get(d);if(!m)return;const w=this.interactionsByType.get(m);return w?w.get(d):void 0}remove(d){const m=this.typeById.get(d);if(!m)return;this.typeById.delete(d),this.filters.delete(d);const w=this.interactionsByType.get(m);w&&(w.delete(d),m==="mouseenter"||m==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):w.size===0&&this.map.off(m,this.handleType))}queryTargets(d,m){const w=[];for(const[M,O]of m)O.target&&w.push({targetId:M,target:O.target,filter:this.filters.get(M)});return this.map.style.queryRenderedTargets(d,w,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const m=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());m.length&&(d.type="mouseenter",this.handleType(d,m));const w=new Map;for(const[M,{feature:O}]of this.prevHoveredFeatures)this.hoveredFeatures.has(M)||w.set(O.id,O);w.size&&(d.type="mouseleave",this.handleType(d,Array.from(w.values())))}handleOut(d){const m=Array.from(this.hoveredFeatures.values()).map(({feature:w})=>w);m.length&&(d.type="mouseleave",this.handleType(d,m)),this.hoveredFeatures.clear()}handleType(d,m){const w=d.type==="mouseenter";if(w&&!this.interactionsByType.has(d.type))return void a.w("mouseenter interaction required for mouseleave to work.");const M=Array.from(this.interactionsByType.get(d.type)).reverse(),O=!!m;m=m||this.queryTargets(d.point,M);let D=!1;const B=new Set;for(const V of m){for(const[Y,Q]of M){if(!Q.target)continue;const ce=V.variants?V.variants[Y]:null;if(ce){for(const oe of ce){if(Vu(oe,V,B,Y))continue;const ue=new a.dx(V,oe),ke=uf(oe,V,Y);O&&ue.id!==void 0&&(ue.state=this.map.getFeatureState(ue));const _e=w?this.prevHoveredFeatures.get(ke):null,Le=new Gm(d,Y,Q,ue),Pe=_e?_e.stop:Q.handler(Le);if(w&&this.hoveredFeatures.set(ke,{feature:V,stop:Pe}),Pe!==!1){D=!0;break}}if(D)break}}if(D)break}if(!D)for(const[V,Y]of M){const{handler:Q,target:ce}=Y;if(!ce&&Q(new Gm(d,V,Y,null))!==!1)break}}}function bae(_,d){if(Array.isArray(_)&&Array.isArray(d)){const m=new Set(_),w=new Set(d);return m.size===w.size&&_.every(M=>w.has(M))}return a.by(_,d)}const wae={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"},jae={showCompass:!0,showZoom:!0,visualizePitch:!1};class kae{constructor(d,m,w=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new T5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,w&&(this.mousePitch=new A5({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),a.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),m.addEventListener("mousedown",this.mousedown),m.addEventListener("touchstart",this.touchstart,{passive:!1}),m.addEventListener("touchmove",this.touchmove),m.addEventListener("touchend",this.touchend),m.addEventListener("touchcancel",this.reset)}down(d,m){this.mouseRotate.mousedown(d,m),this.mousePitch&&this.mousePitch.mousedown(d,m),z()}move(d,m){const w=this.map,M=this.mouseRotate.mousemoveWindow(d,m),O=M&&M.bearingDelta;if(O&&w.setBearing(w.getBearing()+O),this.mousePitch){const D=this.mousePitch.mousemoveWindow(d,m),B=D&&D.pitchDelta;B&&w.setPitch(w.getPitch()+B)}}off(){const d=this.element;d.removeEventListener("mousedown",this.mousedown),d.removeEventListener("touchstart",this.touchstart),d.removeEventListener("touchmove",this.touchmove),d.removeEventListener("touchend",this.touchend),d.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){F(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(d){this.down(Object.assign({},d,{ctrlKey:!0,preventDefault:()=>d.preventDefault()}),K(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,K(this.element,d))}mouseup(d){this.mouseRotate.mouseupWindow(d),this.mousePitch&&this.mousePitch.mouseupWindow(d),this.offTemp()}touchstart(d){d.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Z(this.element,d.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>d.preventDefault()},this._startPos))}touchmove(d){d.targetTouches.length!==1?this.reset():(this._lastPos=Z(this.element,d.targetTouches)[0],this.move({preventDefault:()=>d.preventDefault()},this._lastPos))}touchend(d){d.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)m.width||d.y>m.height;m.locationPoint3D(w).distSqr(d)180;){const w=m.locationPoint3D(_);if(w.x>=0&&w.y>=0&&w.x<=m.width&&w.y<=m.height)break;_.lng>m.center.lng?_.lng-=360:_.lng+=360}return _}const gc={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%)"},Ju={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class kN extends a.E{constructor(d,m){super(),(d instanceof HTMLElement||m)&&(d=Object.assign({element:d},m)),a.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:w="center",color:M="#3FB1CE",scale:O=1,draggable:D=!1,clickTolerance:B=0,rotation:V=Ju.rotation,rotationAlignment:Y=Ju.rotationAlignment,pitchAlignment:Q=Ju.pitchAlignment,occludedOpacity:ce=Ju.occludedOpacity,altitude:oe=Ju.altitude}=d||{};this._anchor=w,this._color=M,this._scale=O,this._draggable=D,this._clickTolerance=B,this._rotation=V,this._rotationAlignment=Y,this._pitchAlignment=Q,this._occludedOpacity=ce,this._altitude=oe,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),d&&d.element?(this._element=d.element,this._offset=a.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=a.P.convert(d&&d.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",_e=>{_e.preventDefault()}),this._element.addEventListener("mousedown",_e=>{_e.preventDefault()});const ue=this._element.classList;for(const _e in gc)ue.remove(`mapboxgl-marker-anchor-${_e}`);ue.add(`mapboxgl-marker-anchor-${this._anchor}`);const ke=d&&d.className?d.className.trim().split(/\s+/):[];ue.add(...ke),this._popup=null}_createDefaultMarker(){const d=C("div"),m=A("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const w=A("radialGradient",{id:"shadowGradient"},A("defs",{},m));A("stop",{offset:"10%","stop-opacity":.4},w),A("stop",{offset:"100%","stop-opacity":.05},w),A("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},m)}return A("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"},m),A("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"},m),A("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},m),d}addTo(d){return d===this._map||(this.remove(),this._map=d,d.getCanvasContainer().appendChild(this._element),d.on("move",this._updateMoving),d.on("moveend",this._update),d.on("remove",this._clearFadeTimer),d._addMarker(this),this.setDraggable(this._draggable),this._update(),d.on("click",this._onMapClick)),this}remove(){const d=this._map;return d&&(d.off("click",this._onMapClick),d.off("move",this._updateMoving),d.off("moveend",this._update),d.off("mousedown",this._addDragHandler),d.off("touchstart",this._addDragHandler),d.off("mouseup",this._onUp),d.off("touchend",this._onUp),d.off("mousemove",this._onMove),d.off("touchmove",this._onMove),d.off("remove",this._clearFadeTimer),d._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=a.aT.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(d){return d===this._altitude||(this._defaultMarker&&(this._altitude===0&&d!==0||this._altitude!==0&&d===0)&&(this._element=this._createDefaultMarker()),this._altitude=d||Ju.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(d){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")),d){if(!("offset"in d.options)){const M=Math.sqrt(Math.pow(13.5,2)/2);d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[M,-1*(38.1-13.5+M)],"bottom-right":[-M,-1*(38.1-13.5+M)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=d,d._marker=this,d._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(d){const m=d.code,w=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&w!==32&&w!==13||this.togglePopup()}_onMapClick(d){const m=d.originalEvent.target,w=this._element;this._popup&&(m===w||w.contains(m))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const d=this._popup;return d?(d.isOpen()?(d.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(d.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const d=this._map,m=this._pos;if(!d||!m)return!1;const w=d.unproject(m,this._altitude),M=d.getFreeCameraOptions();if(!M.position)return!1;const O=M.position.toLngLat();return O.distanceTo(w)<.9*O.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const m=this._pos;if(!m||m.x<0||m.x>d.transform.width||m.y<0||m.y>d.transform.height)return void this._clearFadeTimer();const w=d.unproject(m,this._altitude);let M;d._showingGlobe()&&a.f5(d.transform,this._lngLat)?M=0:(M=1-d._queryFogOpacity(w),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(M*=this._occludedOpacity)),this._element.style.opacity=`${M}`,this._element.style.pointerEvents=M>0?"auto":"none",this._popup&&this._popup._setOpacity(M),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const d=this._pos;if(!d||!this._map)return;const m=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${gc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${m.x}px,${m.y}px) `}_calculateXYTransform(){const d=this._pos,m=this._map,w=this.getPitchAlignment();if(!m||!d||w!=="map")return"";if(!m._showingGlobe()){const V=m.getPitch();return V?`rotateX(${V}deg)`:""}const M=a.cX(a.f6(m.transform,this._lngLat)),O=d.sub(a.f7(m.transform)),D=Math.abs(O.x)+Math.abs(O.y);if(D===0)return"";const B=M/D;return`rotateX(${-O.y*B}deg) rotateY(${O.x*B}deg)`}_calculateZTransform(){const d=this._pos,m=this._map;if(!m||!d)return"";let w=0;const M=this.getRotationAlignment();if(M==="map")if(m._showingGlobe()){const O=m.project(new a.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),D=m.project(new a.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(O);w=a.cX(Math.atan2(D.y,D.x))-90}else w=-m.getBearing();else if(M==="horizon"){const O=a.ah(4,6,m.getZoom()),D=a.f7(m.transform);D.y+=O*m.transform.height;const B=d.sub(D),V=a.cX(Math.atan2(B.y,B.x));w=(V>90?V-270:V+90)*(1-O)}return w+=this._rotation,w?`rotateZ(${w}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=L5(this._lngLat,this._pos,m.transform)),this._pos=m.project(this._lngLat,this._altitude),d===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),m._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(m._showingGlobe()||m.getTerrain()||m.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=a.P.convert(d),this._update(),this}addClassName(d){return this._element.classList.add(d),this}removeClassName(d){return this._element.classList.remove(d),this}toggleClassName(d){return this._element.classList.toggle(d)}_onMove(d){const m=this._map;if(!m)return;const w=this._pointerdownPos,M=this._positionDelta;if(w&&M){if(!this._isDragging){const O=this._clickTolerance||m._clickTolerance;if(d.point.dist(w)_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(_.antialias&&a.f3(window)&&(_.antialias=!1,a.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new F3(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies,null,null),_),this._repaint=!!_.repaint,this._interactive=_.interactive,this._minTileCacheSize=_.minTileCacheSize,this._maxTileCacheSize=_.maxTileCacheSize,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=_.crossSourceCollisions,this._collectResourceTiming=_.collectResourceTiming,this._language=this._parseLanguage(_.language),this._worldview=_.worldview,this._renderTaskQueue=new Sp,this._domRenderTaskQueue=new Sp,this._controls=[],this._markers=[],this._popups=[],this._mapId=a.b2(),this._locale=Object.assign({},Mp,_.locale),this._clickTolerance=_.clickTolerance,this._cooperativeGestures=_.cooperativeGestures,this._performanceMetricsCollection=_.performanceMetricsCollection,this._tessellationStep=_.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=_.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Cp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=_.scaleFactor,this._requestManager=new ne(_.transformRequest,_.accessToken,_.testMode),this._silenceAuthErrors=!!_.testMode,this._contextCreateOptions=_.contextCreateOptions?Object.assign({},_.contextCreateOptions):{},typeof _.container=="string"){const m=document.getElementById(_.container);if(!m)throw new Error(`Container '${_.container.toString()}' not found.`);this._container=m}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(this._container.childNodes.length>0&&a.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),_.maxBounds&&this.setMaxBounds(_.maxBounds),this._spriteFormat=_.spriteFormat,a.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new _ae(this,_),this._localFontFamily=_.localFontFamily,this._localIdeographFontFamily=_.localIdeographFontFamily,(_.style||!_.testMode)&&this.setStyle(_.style||a.e.DEFAULT_STYLE,{config:_.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),_.projection&&this.setProjection(_.projection),_.hash&&(this._hash=new b5(typeof _.hash=="string"&&_.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch});const m=_.bounds;m&&(this.resize(),this.fitBounds(m,Object.assign({},_.fitBoundsOptions,{duration:0})))}this.resize(),_.attributionControl&&this.addControl(new Wv({customAttribution:_.customAttribution})),this._logoControl=new Gv,this.addControl(this._logoControl,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",m=>{this._update(m.dataType==="style"),this.fire(new a.z(`${m.dataType}data`,m))}),this.on("dataloading",m=>{this.fire(new a.z(`${m.dataType}dataloading`,m))}),this._interactions=new Ah(this)}_getMapId(){return this._mapId}addControl(_,d){if(d===void 0&&(d=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.onAdd)return this.fire(new a.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const m=_.onAdd(this);this._controls.push(_);const w=this._controlPositions[d];return d.indexOf("bottom")!==-1?w.insertBefore(m,w.firstChild):w.appendChild(m),this}removeControl(_){if(!_||!_.onRemove)return this.fire(new a.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(_);return d>-1&&this._controls.splice(d,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(_){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 d=!this._moving;return d&&this.fire(new a.z("movestart",_)).fire(new a.z("move",_)),this.fire(new a.z("resize",_)),d&&this.fire(new a.z("moveend",_)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(_){return this.transform.setMaxBounds(a.aI.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_?this.setZoom(_):this.fire(new a.z("zoomstart")).fire(new a.z("zoom")).fire(new a.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_?this.setPitch(_):this.fire(new a.z("pitchstart")).fire(new a.z("pitch")).fire(new a.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(_){return this._scaleFactor=_,this.painter.scaleFactor=_,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(_){return _==="auto"?navigator.language:Array.isArray(_)?_.length===0?void 0:_.map(d=>d==="auto"?navigator.language:d):_}setLanguage(_){const d=this._parseLanguage(_);if(!this.style||d===this._language)return this;this._language=d,this.style.reloadSources();for(const m of this._controls)m._setLanguage&&m._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(_){return this.style&&_!==this._worldview?(this._worldview=_,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(_){return this._lazyInitEmptyStyle(),_?typeof _=="string"&&(_={name:_}):_=null,this._useExplicitProjection=!!_,this._prioritizeAndUpdateProjection(_,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const _=this.transform,d=_.projection.name;let m;d==="globe"&&_.zoom>=a.cL?(_.setMercatorFromTransition(),m=!0):d==="mercator"&&_.zoom=a.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(_),this.style.applyProjectionUpdate();const w=this.transform.getProjection().name==="mercator"&&m!==this.transform.mercatorFromTransition;return(d||w)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(_,d){return this.transform.locationPoint3D(a.aT.convert(_),d)}unproject(_,d){return this.transform.pointLocation3D(a.P.convert(_),d)}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(_,d,m){const w=M=>{let O=[];if(Array.isArray(d)){const D=d.filter(B=>this.getLayer(B));O=D.length?this.queryRenderedFeatures(M,{layers:D}):[]}else O=this.queryRenderedFeatures(M,{target:d});return O};if(_==="mouseenter"||_==="mouseover"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:D=>{const B=w(D.point);B.length?M||(M=!0,m.call(this,new kd(_,this,D.originalEvent,{features:B}))):M=!1},mouseout:()=>{M=!1}}}}if(_==="mouseleave"||_==="mouseout"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:B=>{w(B.point).length?M=!0:M&&(M=!1,m.call(this,new kd(_,this,B.originalEvent)))},mouseout:B=>{M&&(M=!1,m.call(this,new kd(_,this,B.originalEvent)))}}}}{const M=O=>{const D=w(O.point);D.length&&(O.features=D,m.call(this,O),delete O.features)};return{listener:m,targets:d,delegates:{[_]:M}}}}on(_,d,m){if(typeof d=="function"||m===void 0)return super.on(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._createDelegatedListener(_,d,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(w);for(const M in w.delegates)this.on(M,w.delegates[M]);return this}once(_,d,m){if(typeof d=="function"||m===void 0)return super.once(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._createDelegatedListener(_,d,m);for(const M in w.delegates)this.once(M,w.delegates[M]);return this}off(_,d,m){if(typeof d=="function"||m===void 0)return super.off(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._delegatedListeners?this._delegatedListeners[_]:void 0;return w&&(M=>{for(let O=0;O{if(m){const M=typeof m=="string"?m:m instanceof Error?m.message:m.error;a.w(`Unable to perform style diff: ${M}. Rebuilding the style from scratch.`),this._updateStyle(_,d)}else w&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(_,d))}_getUIString(_){const d=this._locale[_];if(d==null)throw new Error(`Missing UI string '${_}'`);return d}_updateStyle(_,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),_){const m=Object.assign({},d);d&&d.config&&(m.initialConfig=d.config,delete m.config),this.style=new Qu(this,m).load(_),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Qu(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(a.w("There is no style added to the map."),!1)}_isValidId(_){return _==null?(this.fire(new a.y(new Error("IDs can't be empty."))),!1):!a.dr(_)||(this.fire(new a.y(new Error(`IDs can't contain special symbols: "${_}".`))),!1)}_isTargetValid(_){return"featuresetId"in _?this._isValidId("importId"in _?_.importId:_.featuresetId):"layerId"in _&&this._isValidId(_.layerId)}_areTargetsValid(_){if(Array.isArray(_)){for(const d of _)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(_)}addSource(_,d){return this._isValidId(_)?(this._lazyInitEmptyStyle(),this.style.addSource(_,d),this._update(!0)):this}isSourceLoaded(_){return!!this._isValidId(_)&&!!this.style&&this.style._isSourceCacheLoaded(_)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(_,d,m){this._lazyInitEmptyStyle(),this.style.addSourceType(_,d,m)}removeSource(_){return this._isValidId(_)?(this.style.removeSource(_),this._updateTerrain(),this._update(!0)):this}getSource(_){return this._isValidId(_)?this.style.getOwnSource(_):null}addImage(_,d,{pixelRatio:m=1,sdf:w=!1,stretchX:M,stretchY:O,content:D}={}){this._lazyInitEmptyStyle();const B=a.I.from(_);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:V,height:Y,data:Q}=a.o.getImageData(d);this.style.addImage(B,{data:new a.q({width:V,height:Y},Q),pixelRatio:m,stretchX:M,stretchY:O,content:D,sdf:w,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new a.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:V,height:Y}=d,Q=d;this.style.addImage(B,{data:new a.q({width:V,height:Y},new Uint8Array(Q.data)),pixelRatio:m,stretchX:M,stretchY:O,content:D,sdf:w,usvg:!1,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,_)}}updateImage(_,d){this._lazyInitEmptyStyle();const m=a.I.from(_),w=this.style.getImage(m);if(!w)return void this.fire(new a.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const M=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?a.o.getImageData(d):d,{width:O,height:D,data:B}=M;if(O===void 0||D===void 0)return void this.fire(new a.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(O!==(w.usvg?w.icon.usvg_tree.width:w.data.width)||D!==(w.usvg?w.icon.usvg_tree.height:w.data.height))return void this.fire(new a.y(new Error(`The width and height of the updated image (${O}, ${D}) must be that same as the previous version of the image (${w.data.width}, ${w.data.height})`)));const V=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;w.usvg?(w.data=new a.q({width:O,height:D},new Uint8Array(B)),w.usvg=!1,w.icon=void 0,Y=!0):w.data.replace(B,V),this.style.updateImage(m,w,Y)}hasImage(_){return _?!!this.style&&!!this.style.getImage(a.I.from(_)):(this.fire(new a.y(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(a.I.from(_))}loadImage(_,d){a.n(this._requestManager.transformRequest(_,a.R.Image),(m,w)=>{d(m,w instanceof HTMLImageElement?a.o.getImageData(w):w)})}listImages(){return this.style.listImages().map(_=>_.name)}addModel(_,d){this._lazyInitEmptyStyle(),this.style.addModel(_,d)}hasModel(_){return _?this.style.hasModel(_):(this.fire(new a.y(new Error("Missing required model id"))),!1)}removeModel(_){this.style.removeModel(_)}listModels(){return this.style.listModels()}addLayer(_,d){return this._isValidId(_.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(_,d),this._update(!0)):this}getSlot(_){const d=this.getLayer(_);return d&&d.slot||null}setSlot(_,d){return this.style.setSlot(_,d),this.style.mergeLayers(),this._update(!0)}addImport(_,d){return this.style.addImport(_,d).catch(m=>this.fire(new a.y(new Error("Failed to add import",m)))),this}updateImport(_,d){return typeof d!="string"&&d.id!==_?(this.removeImport(_),this.addImport(d)):(this.style.updateImport(_,d),this._update(!0))}removeImport(_){return this.style.removeImport(_),this}moveImport(_,d){return this.style.moveImport(_,d),this._update(!0)}moveLayer(_,d){return this._isValidId(_)?(this.style.moveLayer(_,d),this._update(!0)):this}removeLayer(_){return this._isValidId(_)?(this.style.removeLayer(_),this._update(!0)):this}getLayer(_){if(!this._isValidId(_))return null;const d=this.style.getOwnLayer(_);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(_,d,m){return this._isValidId(_)?(this.style.setLayerZoomRange(_,d,m),this._update(!0)):this}setFilter(_,d,m={}){return this._isValidId(_)?(this.style.setFilter(_,d,m),this._update(!0)):this}getFilter(_){return this._isValidId(_)?this.style.getFilter(_):null}setPaintProperty(_,d,m,w={}){return this._isValidId(_)?(this.style.setPaintProperty(_,d,m,w),this._update(!0)):this}getPaintProperty(_,d){return this._isValidId(_)?this.style.getPaintProperty(_,d):null}setLayoutProperty(_,d,m,w={}){return this._isValidId(_)?(this.style.setLayoutProperty(_,d,m,w),this._update(!0)):this}getLayoutProperty(_,d){return this._isValidId(_)?this.style.getLayoutProperty(_,d):null}setLayerProperty(_,d,m,w={}){return this._isValidId(_)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(_,d,m,w),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(_){return this.style.setGlyphsUrl(_),this._update(!0)}getSchema(_){return this.style.getSchema(_)}setSchema(_,d){return this.style.setSchema(_,d),this._update(!0)}getConfig(_){return this.style.getConfig(_)}setConfig(_,d){return this.style.setConfig(_,d),this._update(!0)}getConfigProperty(_,d){return this.style.getConfigProperty(_,d)}setConfigProperty(_,d,m){return this.style.setConfigProperty(_,d,m),this._update(!0)}getFeaturesetDescriptors(_){return this.style.getFeaturesetDescriptors(_)}setLights(_){if(this._lazyInitEmptyStyle(),_&&_.length===1&&_[0].type==="flat"){const d=_[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(_),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const _=this.style.getLights()||[];return _.length===0&&_.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),_}setLight(_,d={}){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:_}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(_){return this._lazyInitEmptyStyle(),!_&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(_),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(_){return this._lazyInitEmptyStyle(),this.style.setFog(_),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(_){return this._lazyInitEmptyStyle(),this.style.setSnow(_),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(_){return this._lazyInitEmptyStyle(),this.style.setRain(_),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(_){return this._lazyInitEmptyStyle(),this.style.setColorTheme(_),this._update(!0)}setImportColorTheme(_,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(_,d),this._update(!0)}setCamera(_){return this.style.setCamera(_),this._triggerCameraUpdate(_)}_triggerCameraUpdate(_){return this._update(this.transform.setOrthographicProjectionAtLowPitch(_["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(_){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.aT.convert(_),this.transform):0}setFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.setFeatureState(_,d),this._update())}removeFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.removeFeatureState(_,d),this._update())}getFeatureState(_){return _.source&&!this._isValidId(_.source)?null:this.style.getFeatureState(_)}_selectIndoorFloor(_){this.indoor.selectFloor(_)}_setIndoorActiveFloorsVisibility(_){this.indoor.setActiveFloorsVisibility(_)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Vy),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const _=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let m,w,M,O=this._container;for(;O&&(!w||!M);){const D=window.getComputedStyle(O).transform;D&&D!=="none"&&(m=D.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(w=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(M=m[3])),O=O.parentElement}this._containerWidth=w?Math.abs(_/w):_,this._containerHeight=M?Math.abs(d/M):d}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupIndoor(){this.style.isIndoorEnabled()&&(this.indoor=new eP(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 _=this._container;_.classList.add("mapboxgl-map"),(this._missingCSSCanary=C("div","mapboxgl-canary",_)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=C("div","mapboxgl-canvas-container",_);this._canvas=C("canvas","mapboxgl-canvas",d),this._interactive&&(d.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 m=this._controlContainer=C("div","mapboxgl-control-container",_),w=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(M=>{w[M]=C("div",`mapboxgl-ctrl-${M}`,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,d){const m=a.o.devicePixelRatio||1;this._canvas.width=m*Math.ceil(_),this._canvas.height=m*Math.ceil(d),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${d}px`}_addMarker(_){this._markers.push(_)}_removeMarker(_){const d=this._markers.indexOf(_);d!==-1&&this._markers.splice(d,1)}_addPopup(_){this._popups.push(_)}_removePopup(_){const d=this._popups.indexOf(_);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const _=Object.assign({},N.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",_);d?(nt(d,!0),this.painter=new dN(d,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",m=>{m.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),a.k.testSupport(d)):this.fire(new a.y(new Error("Failed to initialize WebGL")))}_contextLost(_){_.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.z("webglcontextlost",{originalEvent:_}))}_contextRestored(_){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new a.z("webglcontextrestored",{originalEvent:_}))}_onMapScroll(_){if(_.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(_){return this.style?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_requestDomTask(_){!this.loaded()||this.loaded()&&!this.isMoving()?_():this._domRenderTaskQueue.add(_)}_render(_){let d;this.fire(new a.z("renderstart")),++this._frameId;const m=this.painter.context.extTimerQuery,w=a.o.now(),M=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=M.createQuery(),M.beginQuery(m.TIME_ELAPSED_EXT,d)),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(_),this._domRenderTaskQueue.run(_),this._removed)return;this._updateProjectionTransition();const O=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const Y=this.transform.zoom,Q=this.transform.pitch,ce=a.o.now(),oe=new a.ac(Y,{now:ce,fadeDuration:O,pitch:Q,transition:this.style.transition,worldview:this._worldview});this.style.update(oe)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let D=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),D=this._updateAverageElevation(w),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):D=this._updateAverageElevation(w);const B=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,O,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),B&&(this._placementDirty=B.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:O,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,x.mark(p.load),this.fire(new a.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),d){const Y=a.o.now()-w;M.endQuery(m.TIME_ELAPSED_EXT),setTimeout(()=>{const Q=M.getQueryParameter(d,M.QUERY_RESULT)/1e6;M.deleteQuery(d),this.fire(new a.z("gpu-timing-frame",{cpuTime:Y,gpuTime:Q}))},50)}if(this.listens("gpu-timing-layer")){const Y=this.painter.collectGpuTimers();setTimeout(()=>{const Q=this.painter.queryGpuTimers(Y);this.fire(new a.z("gpu-timing-layer",{layerTimes:Q}))},50)}if(this.listens("gpu-timing-deferred-render")){const Y=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const Q=this.painter.queryGpuTimeDeferredRender(Y);this.fire(new a.z("gpu-timing-deferred-render",{gpuTime:Q}))},50)}const V=this._sourcesDirty||this._styleDirty||this._placementDirty||D;if(V||this._repaint)this.triggerRepaint();else{const Y=this.idle();if(Y&&(D=this._updateAverageElevation(w,!0)),D)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new a.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const Q=this._calculateSpeedIndex();this.fire(new a.z("speedindexcompleted",{speedIndex:Q})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||V||(this._fullyLoaded=!0,x.mark(p.fullLoad),this._performanceMetricsCollection&&Ye(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(_){for(const d of this._markers)_&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!_||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(_,d=!1){const m=M=>(this.transform.averageElevation=M,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);const w=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(w||(d||_-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(_)){const M=this.transform.averageElevation;let O=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(O)?O=0:this._averageElevationLastSampledAt=_;const D=Math.abs(M-O);if(D>1){if(this._isInitialLoad||w)return this._averageElevation.jumpTo(O),m(O);this._averageElevation.easeTo(O,_,300)}else if(D>1e-4)return this._averageElevation.jumpTo(O),m(O)}return!!this._averageElevation.isEasing(_)&&m(this._averageElevation.getValue(_))}_authenticate(){mt(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,_=>{if(_&&(_.message===ve||_.status===401)){const d=this.painter.context.gl;nt(d,!1),this._logoControl instanceof Gv&&this._logoControl._updateLogo(),d&&d.clear(d.DEPTH_BUFFER_BIT|d.COLOR_BUFFER_BIT|d.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),be(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Te(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Fe(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Qe(this._requestManager._customAccessToken)}_updateTerrain(){const _=this._isDragging();this.painter.updateTerrain(this.style,_)}_calculateSpeedIndex(){const _=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const m=this.painter.context.gl,w=m.createFramebuffer();function M(O){m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,O,0);const D=new Uint8Array(m.drawingBufferWidth*m.drawingBufferHeight*4);return m.readPixels(0,0,m.drawingBufferWidth,m.drawingBufferHeight,m.RGBA,m.UNSIGNED_BYTE,D),D}return m.bindFramebuffer(m.FRAMEBUFFER,w),this._canvasPixelComparison(M(_),d.canvasCopies.map(M),d.timeStamps)}_canvasPixelComparison(_,d,m){let w=m[1]-m[0];const M=_.length/4;for(let O=0;O{const m=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,m&&this._render(d)}))}_preloadTiles(_){const d=this.style?this.style.getSourceCaches():[];return a.bw(d,(m,w)=>m._preloadTiles(_,w),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(_){this._trackResize&&this.resize({originalEvent:_})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(_){this._showParseStatus!==_&&(this._showParseStatus=_,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(_){this._showTerrainWireframe!==_&&(this._showTerrainWireframe=_,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(_){this._showLayers2DWireframe!==_&&(this._showLayers2DWireframe=_,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(_){this._showLayers3DWireframe!==_&&(this._showLayers3DWireframe=_,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(_){this._speedIndexTiming!==_&&(this._speedIndexTiming=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,this.style&&_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(_){this._showTileAABBs!==_&&(this._showTileAABBs=_,_&&this._update())}_setCacheLimits(_,d){a.f4(_,d)}get version(){return h}},NavigationControl:class{constructor(_={}){this.options=Object.assign({},jae,_),this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(a.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",d=>{this._map&&this._map.zoomIn({},{originalEvent:d})}),C("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",d=>{this._map&&this._map.zoomOut({},{originalEvent:d})}),C("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",d=>{const m=this._map;m&&(this.options.visualizePitch?m.resetNorthPitch({},{originalEvent:d}):m.resetNorth({},{originalEvent:d}))}),this._compassIcon=C("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const _=this._map;if(!_)return;const d=_.getZoom(),m=d===_.getMaxZoom(),w=d===_.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=w,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",w.toString())}_rotateCompassArrow(){const _=this._map;if(!_)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(_.transform.pitch*(Math.PI/180)),.5)}) rotateX(${_.transform.pitch}deg) rotateZ(${_.transform.angle*(180/Math.PI)}deg)`:`rotate(${_.transform.angle*(180/Math.PI)}deg)`;_._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),_.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&_.on("pitch",this._rotateCompassArrow),_.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new kae(_,this._compass,this.options.visualizePitch)),this._container}onRemove(){const _=this._map;_&&(this._container.remove(),this.options.showZoom&&_.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&_.off("pitch",this._rotateCompassArrow),_.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(_,d){const m=C("button",_,this._container);return m.type="button",m.addEventListener("click",d),m}_setButtonTitle(_,d){if(!this._map)return;const m=this._map._getUIString(`NavigationControl.${d}`);_.setAttribute("aria-label",m),_.firstElementChild&&_.firstElementChild.setAttribute("title",m)}},GeolocateControl:class extends a.E{constructor(_={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},Nae,_),a.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=uN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(_){return this._map=_,this._container=C("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(_){const d=(m=!!this.options.geolocation)=>{this._supportsGeolocation=m,_(m)};this._supportsGeolocation!==void 0?_(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(m=>d(m.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(_){const d=this._map.getMaxBounds(),m=_.coords;return!!d&&(m.longituded.getEast()||m.latituded.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(_){if(this._map){if(this._isOutOfMapMaxBounds(_))return this._setErrorState(),this.fire(new a.z("outofmaxbounds",_)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=_,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(_),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(_),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("geolocate",Object.assign({coords:_.coords,timestamp:_.timestamp},_.toJSON?{toJSON:_.toJSON.bind(_)}:{}))),this._finish()}}_updateCamera(_){const d=new a.aT(_.coords.longitude,_.coords.latitude),m=_.coords.accuracy,w=this._map.getBearing(),M=Object.assign({bearing:w},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(m),M,{geolocateSource:!0})}_updateMarker(_){if(_){const d=new a.aT(_.coords.longitude,_.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=_.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const _=this._map.transform,d=a.cf(1,_._center.lat)*_.worldSize,m=Math.ceil(2*this._accuracy*d);this._circleElement.style.width=`${m}px`,this._circleElement.style.height=`${m}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(_){if(this._map){if(this.options.trackUserLocation)if(_.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 d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(_.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.z("error",_)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(_){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=C("button","mapboxgl-ctrl-geolocate",this._container),C("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",_===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}else{const d=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=C("div","mapboxgl-user-location"),this._dotElement.appendChild(C("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(C("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new kN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=C("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new kN({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",d=>{d.geolocateSource||this._watchState!=="ACTIVE_LOCK"||d.originalEvent&&d.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.z("trackuserlocationend")))})}}_onDeviceOrientation(_){this._userLocationDotMarker&&(_.webkitCompassHeading?this._heading=_.webkitCompassHeading:_.absolute===!0&&(this._heading=-1*_.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let _;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(_={maximumAge:6e5,timeout:0},this._noTimeout=!0):(_=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,_),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 _=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(d=>{d==="granted"&&_()}).catch(console.error):_()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Wv,ScaleControl:class{constructor(_={}){this.options=Object.assign({},Hy,_),a.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const _=this.options.maxWidth||100,d=this._map,m=d._containerHeight/2,w=d._containerWidth/2-_/2,M=d.unproject([w,m]),O=d.unproject([w+_,m]),D=M.distanceTo(O);if(this.options.unit==="imperial"){const B=3.2808*D;B>5280?this._setScale(_,B/5280,"mile"):this._setScale(_,B,"foot")}else this.options.unit==="nautical"?this._setScale(_,D/1852,"nautical-mile"):D>=1e3?this._setScale(_,D/1e3,"kilometer"):this._setScale(_,D,"meter")}_setScale(_,d,m){this._map._requestDomTask(()=>{const w=function(O){const D=Math.pow(10,`${Math.floor(O)}`.length-1);let B=O/D;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(V){const Y=Math.pow(10,Math.ceil(-Math.log(V)/Math.LN10));return Math.round(V*Y)/Y}(B),D*B}(d),M=w/d;this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:m}).format(w):`${w} ${O5[m]}`,this._container.style.width=_*M+"px"})}onAdd(_){return this._map=_,this._language=_.getLanguage(),this._container=C("div","mapboxgl-ctrl mapboxgl-ctrl-scale",_.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(_){this._language=_,this._update()}setUnit(_){this.options.unit=_,this._update()}},FullscreenControl:class{constructor(_={}){this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container:a.w("Full screen control 'container' must be a DOM element.")),a.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(_){return this._map=_,this._container||(this._container=this._map.getContainer()),this._controlContainer=C("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const _=this._fullscreenButton=C("button","mapboxgl-ctrl-fullscreen",this._controlContainer);C("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",_)}_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:Vy,Popup:class extends a.E{constructor(_){super(),this.options=Object.assign(Object.create(eh),_),this._altitude=this.options.altitude,a.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(_&&_.className?_.className.trim().split(/\s+/):[])}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&_.on("preclick",this._onClose),this.options.closeOnMove&&_.on("move",this._onClose),_.on("remove",this.remove),this._update(),_._addPopup(this),this._focusFirstElement(),this._trackPointer?(_.on("mousemove",this._onMouseEvent),_.on("mouseup",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")):_.on("move",this._update),this.fire(new a.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const _=this._map;return _&&(_.off("move",this._update),_.off("move",this._onClose),_.off("preclick",this._onClose),_.off("click",this._onClose),_.off("remove",this.remove),_.off("mousemove",this._onMouseEvent),_.off("mouseup",this._onMouseEvent),_.off("drag",this._onMouseEvent),_._canvasContainer&&_._canvasContainer.classList.remove("mapboxgl-track-pointer"),_._removePopup(this),this._map=void 0),this.fire(new a.z("close")),this}getLngLat(){return this._lngLat}setLngLat(_){this._lngLat=a.aT.convert(_),this._pos=null,this._trackPointer=!1,this._update();const d=this._map;return d&&(d.on("move",this._update),d.off("mousemove",this._onMouseEvent),d._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(_){return this._altitude=_,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const _=this._map;return _&&(_.off("move",this._update),_.on("mousemove",this._onMouseEvent),_.on("drag",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const d=document.createDocumentFragment(),m=document.createElement("body");let w;for(m.innerHTML=_;w=m.firstChild,w;)d.appendChild(w);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=C("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(_),this.options.closeButton){const m=this._closeButton=C("button","mapboxgl-popup-close-button",d);m.type="button",m.setAttribute("aria-label","Close popup"),m.innerHTML='',m.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(_){return this._classList.add(_),this._updateClassList(),this}removeClassName(_){return this._classList.delete(_),this._updateClassList(),this}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){let d;return this._classList.delete(_)?d=!1:(this._classList.add(_),d=!0),this._updateClassList(),d}_onMouseEvent(_){this._update(_.point)}_getAnchor(_){if(this.options.anchor)return this.options.anchor;const d=this._map,m=this._container,w=this._pos;if(!d||!m||!w)return"bottom";const M=m.offsetWidth,O=m.offsetHeight,D=w.xd.transform.width-M/2;if(w.y+_d.transform.height-O){if(D)return"bottom-left";if(B)return"bottom-right"}return D?"left":B?"right":"bottom"}_updateClassList(){const _=this._container;if(!_)return;const d=[...this._classList];d.push("mapboxgl-popup"),this._anchor&&d.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&d.push("mapboxgl-popup-track-pointer"),_.className=d.join(" ")}_update(_){const d=this._map,m=this._content;if(!d||!this._lngLat&&!this._trackPointer||!m)return;let w=this._container;if(w||(w=this._container=C("div","mapboxgl-popup",d.getContainer()),this._tip=C("div","mapboxgl-popup-tip",w),w.appendChild(m)),this.options.maxWidth&&w.style.maxWidth!==this.options.maxWidth&&(w.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=L5(this._lngLat,this._pos,d.transform)),!this._trackPointer||_){const M=this._pos=this._trackPointer&&_ instanceof a.P?_:d.project(this._lngLat,this._altitude),O=lx(this.options.offset),D=this._anchor=this._getAnchor(O.y),B=lx(this.options.offset,D),V=M.add(B).round();d._requestDomTask(()=>{this._container&&D&&(this._container.style.transform=`${gc[D]} translate(${V.x}px,${V.y}px)`)})}if(!this._marker&&d._showingGlobe()){const M=a.f5(d.transform,this._lngLat)?0:1;this._setOpacity(M)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(th);_&&_.focus()}_onClose(){this.remove()}_setOpacity(_){this._container&&(this._container.style.opacity=`${_}`),this._content&&(this._content.style.pointerEvents=_?"auto":"none")}},Marker:kN,Style:Qu,LngLat:a.aT,LngLatBounds:a.aI,Point:a.P,MercatorCoordinate:a.ae,FreeCameraOptions:Jc,Evented:a.E,config:a.e,prewarm:a.f9,clearPrewarmedResources:a.f8,get accessToken(){return a.e.ACCESS_TOKEN},set accessToken(_){a.e.ACCESS_TOKEN=_},get baseApiUrl(){return a.e.API_URL},set baseApiUrl(_){a.e.API_URL=_},get workerCount(){return a.fi.workerCount},set workerCount(_){a.fi.workerCount=_},get maxParallelImageRequests(){return a.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(_){a.e.MAX_PARALLEL_IMAGE_REQUESTS=_},clearStorage(_){a.fh(_)},get workerUrl(){return a.fg.workerUrl},set workerUrl(_){a.fg.workerUrl=_},get workerClass(){return a.fg.workerClass},set workerClass(_){a.fg.workerClass=_},get workerParams(){return a.fg.workerParams},set workerParams(_){a.fg.workerParams=_},get dracoUrl(){return a.ff()},set dracoUrl(_){a.fe(_)},get meshoptUrl(){return a.fd()},set meshoptUrl(_){a.fc(_)},setNow:a.o.setNow,restoreNow:a.o.restoreNow}});var l=i;return l})})(zze);var xkt=zze.exports;const $L=za(xkt);function ykt(){const e=ns(),{isAdmin:t}=zr(),n=I.useRef(null),s=I.useRef(null),i=I.useRef([]),o=Lze(),{data:l}=Ize(),a=Dze(),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(!0),[N,C]=I.useState(null),[A,E]=I.useState(null),[T,L]=I.useState(!1),[z,F]=I.useState({popby_item_id:"",notes:""}),q=o.filter(te=>te.address||te.city&&te.state);I.useEffect(()=>{(async()=>{j(!0);try{const{data:ae}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ae!=null&&ae.value&&p(ae.value)}catch(ae){console.error("Error fetching mapbox token:",ae)}j(!1)})()},[]),I.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(te=>{C([te.coords.longitude,te.coords.latitude])},te=>{console.log("Could not get location:",te)})},[]),I.useEffect(()=>{if(!(!n.current||!h||s.current))return $L.accessToken=h,s.current=new $L.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:N?12:4,center:N||[-98.5795,39.8283]}),s.current.addControl(new $L.NavigationControl,"top-right"),()=>{var te;(te=s.current)==null||te.remove(),s.current=null}},[h,N]),I.useEffect(()=>{!s.current||!h||(i.current.forEach(te=>te.remove()),i.current=[],q.forEach(async te=>{var le;const ae=[te.address,te.city,te.state,te.zip].filter(Boolean).join(", ");if(ae)try{const ne=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ae)}.json?access_token=${h}`)).json();if(ne.features&&ne.features.length>0){const[ge,ie]=ne.features[0].center,fe=document.createElement("div");fe.className="cursor-pointer",fe.innerHTML=`
${te.first_name[0]}${((le=te.last_name)==null?void 0:le[0])||""}
${te.isDue?'
':""}
`;const de=new $L.Marker(fe).setLngLat([ge,ie]).addTo(s.current);fe.addEventListener("click",()=>{E(te)}),i.current.push(de)}}catch(ve){console.error("Geocoding error for",te.first_name,ve)}}))},[q,h]);const H=()=>{N&&s.current?s.current.flyTo({center:N,zoom:13}):$i({title:"Location not available",description:"Please enable location services",variant:"destructive"})},K=async()=>{A&&(await a.mutateAsync({contact_id:A.id,popby_item_id:z.popby_item_id||void 0,notes:z.notes||void 0,latitude:N==null?void 0:N[1],longitude:N==null?void 0:N[0]}),L(!1),E(null),F({popby_item_id:"",notes:""}))},Z=async()=>{if(x.trim())try{await J.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),p(x.trim()),$i({title:"Mapbox token saved!"})}catch{$i({title:"Error saving token",variant:"destructive"})}};return b?r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):h?r.jsx(Or,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(ee,{onClick:H,children:[r.jsx(OT,{className:"h-4 w-4 mr-2"}),"My Location"]})]}),r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-primary"}),r.jsx("span",{children:"Up to date"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-500"}),r.jsx("span",{children:"Due for popby"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg"}),q.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 rounded-lg",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"font-medium",children:"No contacts with addresses"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add addresses to your contacts to see them on the map."})]})})]}),A&&r.jsx(Ge,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold",children:[A.first_name," ",A.last_name]}),A.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[A.city,", ",A.state]})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>E(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[A.isDue?r.jsxs(Rt,{variant:"destructive",children:[A.daysOverdue,"+ days overdue"]}):r.jsx(Rt,{variant:"secondary",children:"Up to date"}),A.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",xn(new Date(A.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[A.phone&&r.jsx(ee,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${A.phone}`,children:[r.jsx(ca,{className:"h-4 w-4 mr-1"}),"Call"]})}),A.address&&r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const te=[A.address,A.city,A.state,A.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(te)}`,"_blank")},children:[r.jsx($T,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(ee,{size:"sm",className:"flex-1",onClick:()=>L(!0),children:[r.jsx(Ha,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Br,{open:T,onOpenChange:L,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Log Popby for ",A==null?void 0:A.first_name," ",A==null?void 0:A.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Popby Item (optional)"}),r.jsxs(vn,{value:z.popby_item_id,onValueChange:te=>F(ae=>({...ae,popby_item_id:te})),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select a popby item..."})}),r.jsx(gn,{children:l==null?void 0:l.map(te=>r.jsx(Ht,{value:te.id,children:te.name},te.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:z.notes,onChange:te=>F(ae=>({...ae,notes:te.target.value}))})]}),N&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(ml,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),r.jsxs(ee,{onClick:K,disabled:a.isPending,children:[r.jsx(qa,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):t?r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(ml,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Setup Map"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Mapbox public token to enable the map feature."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Mapbox Public Token"}),r.jsx(at,{placeholder:"pk.eyJ1I...",value:x,onChange:te=>y(te.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),r.jsx(ee,{onClick:Z,className:"w-full",children:"Save Token"}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Or,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(El,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Map Not Available"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The map feature has not been configured yet. Please contact your administrator."})]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const vkt=u3({property_address:nc().min(1,"Property address is required"),city:nc().optional(),state:nc().optional(),zip:nc().optional(),transaction_type:D6e(["buyer","seller"]),close_date:nc().min(1,"Close date is required"),sale_price:lA().min(0,"Sale price must be positive"),commission_amount:lA().optional(),lead_source_id:nc().optional(),client_type_id:nc().optional(),contact_id:nc().optional(),notes:nc().optional(),is_win:Uat()});function $ze({open:e,onOpenChange:t,transaction:n}){const[s,i]=I.useState(!1),[o,l]=I.useState(""),[a,h]=I.useState(!1),[p,x]=I.useState(""),y=Nse(),b=ypt(),{data:j}=kse(),{data:N}=Ug(),{data:C}=op(),A=wxe(),E=xpt(),{data:T}=Sse(),L=(T==null?void 0:T.show_commission)??!0,z=hse({resolver:fse(vkt),defaultValues:{property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1}});I.useEffect(()=>{n?z.reset({property_address:n.property_address,city:n.city||"",state:n.state||"",zip:n.zip||"",transaction_type:n.transaction_type,close_date:n.close_date,sale_price:Number(n.sale_price),commission_amount:n.commission_amount?Number(n.commission_amount):void 0,lead_source_id:n.lead_source_id||void 0,client_type_id:n.client_type_id||void 0,contact_id:n.contact_id||void 0,notes:n.notes||"",is_win:n.is_win}):z.reset({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1})},[n,z]);const F=async Z=>{const te={property_address:Z.property_address,transaction_type:Z.transaction_type,close_date:Z.close_date,sale_price:Z.sale_price,is_win:Z.is_win,commission_amount:Z.commission_amount||null,lead_source_id:Z.lead_source_id||null,client_type_id:Z.client_type_id||null,contact_id:Z.contact_id||null,city:Z.city||null,state:Z.state||null,zip:Z.zip||null,notes:Z.notes||null};n?await b.mutateAsync({id:n.id,...te}):await y.mutateAsync(te),t(!1)},q=async()=>{if(!o.trim())return;const[Z,...te]=o.trim().split(" "),ae=te.join(" ")||null,le=await A.mutateAsync({first_name:Z,last_name:ae,tagIds:[]});le&&(z.setValue("contact_id",le.id),l(""),h(!1),i(!1))},H=async()=>{if(!p.trim())return;const Z=await E.mutateAsync(p.trim());Z&&(z.setValue("lead_source_id",Z.id),x(""))},K=C==null?void 0:C.find(Z=>Z.id===z.watch("contact_id"));return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(Hr,{children:r.jsx(qr,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(Jo,{className:"max-h-[70vh] pr-4",children:r.jsx(pse,{...z,children:r.jsxs("form",{onSubmit:z.handleSubmit(F),className:"space-y-4",children:[r.jsx(Ml,{control:z.control,name:"property_address",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Property Address *"}),r.jsx(wl,{children:r.jsx(at,{placeholder:"123 Main St",...Z})}),r.jsx(wu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Ml,{control:z.control,name:"city",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"City"}),r.jsx(wl,{children:r.jsx(at,{placeholder:"City",...Z})})]})}),r.jsx(Ml,{control:z.control,name:"state",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"State"}),r.jsx(wl,{children:r.jsx(at,{placeholder:"TX",...Z})})]})}),r.jsx(Ml,{control:z.control,name:"zip",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Zip"}),r.jsx(wl,{children:r.jsx(at,{placeholder:"75001",...Z})})]})})]}),r.jsx(Ml,{control:z.control,name:"transaction_type",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Transaction Type *"}),r.jsxs(vn,{onValueChange:Z.onChange,value:Z.value,children:[r.jsx(wl,{children:r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select type"})})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"buyer",children:"Buyer"}),r.jsx(Ht,{value:"seller",children:"Seller"})]})]}),r.jsx(wu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Ml,{control:z.control,name:"close_date",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Close Date *"}),r.jsx(wl,{children:r.jsx(at,{type:"date",...Z})}),r.jsx(wu,{})]})}),r.jsx(Ml,{control:z.control,name:"sale_price",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Sale Price *"}),r.jsx(wl,{children:r.jsx(at,{type:"number",placeholder:"0",...Z,onChange:te=>Z.onChange(Number(te.target.value))})}),r.jsx(wu,{})]})})]}),L&&r.jsx(Ml,{control:z.control,name:"commission_amount",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Commission"}),r.jsx(wl,{children:r.jsx(at,{type:"number",placeholder:"0",...Z,value:Z.value??"",onChange:te=>Z.onChange(te.target.value?Number(te.target.value):void 0)})})]})}),r.jsx(Ml,{control:z.control,name:"lead_source_id",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Lead Source"}),r.jsxs(vn,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(wl,{children:r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select source"})})}),r.jsx(gn,{children:j==null?void 0:j.map(te=>r.jsx(Ht,{value:te.id,children:te.name},te.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{placeholder:"Add custom source...",value:p,onChange:Z=>x(Z.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:H,disabled:!p.trim(),children:r.jsx(jn,{className:"h-4 w-4"})})]}),r.jsx(Ml,{control:z.control,name:"client_type_id",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Client Type"}),r.jsxs(vn,{onValueChange:Z.onChange,value:Z.value||"",children:[r.jsx(wl,{children:r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select client type"})})}),r.jsx(gn,{children:N==null?void 0:N.map(te=>r.jsx(Ht,{value:te.id,children:te.name},te.id))})]})]})}),r.jsx(Ml,{control:z.control,name:"contact_id",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Client Contact"}),r.jsxs(Du,{open:s,onOpenChange:i,children:[r.jsx(Ru,{asChild:!0,children:r.jsx(wl,{children:r.jsxs(ee,{variant:"outline",role:"combobox",className:$t("w-full justify-between",!Z.value&&"text-muted-foreground"),children:[K?`${K.first_name} ${K.last_name||""}`.trim():"Select contact",r.jsx(o1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(nu,{className:"w-full p-0",align:"start",children:[r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search contacts..."}),r.jsxs(H1,{children:[r.jsx(W1,{children:r.jsxs("div",{className:"p-2 space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!a&&r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>h(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(G1,{children:C==null?void 0:C.map(te=>r.jsxs(K1,{value:`${te.first_name} ${te.last_name||""}`,onSelect:()=>{Z.onChange(te.id),i(!1)},children:[r.jsx(Ca,{className:$t("mr-2 h-4 w-4",te.id===Z.value?"opacity-100":"opacity-0")}),te.first_name," ",te.last_name||""]},te.id))})]})]}),a&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(at,{placeholder:"Enter contact name...",value:o,onChange:te=>l(te.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",onClick:q,disabled:!o.trim()||A.isPending,children:"Add Contact"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>{h(!1),l("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(Ml,{control:z.control,name:"notes",render:({field:Z})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Notes"}),r.jsx(wl,{children:r.jsx(ps,{placeholder:"Any notes about this transaction...",...Z})})]})}),r.jsx(Ml,{control:z.control,name:"is_win",render:({field:Z})=>r.jsxs(_l,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(bl,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(wl,{children:r.jsx(Rs,{checked:Z.value,onCheckedChange:Z.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:y.isPending||b.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function Uze({transactions:e,showCommission:t,isLoading:n}){const[s,i]=I.useState(null),[o,l]=I.useState(null),[a,h]=I.useState(""),[p,x]=I.useState("all"),[y,b]=I.useState("all"),[j,N]=I.useState("all"),[C,A]=I.useState(!1),E=vpt(),T=Nse(),{data:L}=kse(),{data:z}=Ug(),F=g3(),q=Z=>{const{id:te,created_at:ae,updated_at:le,lead_source:ve,client_type:ne,contact:ge,...ie}=Z;T.mutate(ie)},H=()=>{o&&(E.mutate(o),l(null))},K=e.filter(Z=>{var ge,ie,fe,de;const te=a===""||Z.property_address.toLowerCase().includes(a.toLowerCase())||((ie=(ge=Z.contact)==null?void 0:ge.first_name)==null?void 0:ie.toLowerCase().includes(a.toLowerCase()))||((de=(fe=Z.contact)==null?void 0:fe.last_name)==null?void 0:de.toLowerCase().includes(a.toLowerCase())),ae=p==="all"||Z.transaction_type===p,le=y==="all"||Z.lead_source_id===y,ve=j==="all"||Z.client_type_id===j,ne=!C||Z.is_win;return te&&ae&&le&&ve&&ne});return n?r.jsx(Ge,{children:r.jsx(Xe,{className:"p-6 space-y-4",children:[1,2,3].map(Z=>r.jsx(Pr,{className:"h-16 w-full"},Z))})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs(Qt,{children:["Transactions (",K.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search...",value:a,onChange:Z=>h(Z.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(vn,{value:p,onValueChange:x,children:[r.jsx(mn,{className:"w-[100px]",children:r.jsx(_n,{placeholder:"Type"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Types"}),r.jsx(Ht,{value:"buyer",children:"Buyer"}),r.jsx(Ht,{value:"seller",children:"Seller"})]})]}),r.jsxs(vn,{value:y,onValueChange:b,children:[r.jsx(mn,{className:"w-[130px]",children:r.jsx(_n,{placeholder:"Lead Source"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Sources"}),L==null?void 0:L.map(Z=>r.jsx(Ht,{value:Z.id,children:Z.name},Z.id))]})]}),r.jsxs(ee,{variant:C?"default":"outline",size:"sm",onClick:()=>A(!C),children:[r.jsx(Pl,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(Xe,{children:K.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):F?r.jsx("div",{className:"space-y-3",children:K.map(Z=>r.jsxs(Ge,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium truncate",children:Z.property_address}),Z.is_win&&r.jsx(Pl,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]}),r.jsx(Rt,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-3 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Close Date: "}),twe(Z.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),Ed(Z.sale_price)]}),t&&Z.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),Ed(Z.commission_amount)]}),Z.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),Z.lead_source.name]}),Z.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),Z.contact.first_name," ",Z.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>i(Z),children:r.jsx(rc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>q(Z),children:r.jsx(pl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>l(Z.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})]},Z.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Close Date"}),r.jsx(It,{children:"Sale Price"}),t&&r.jsx(It,{children:"Commission"}),r.jsx(It,{children:"Lead Source"}),r.jsx(It,{children:"Client"}),r.jsx(It,{className:"w-[50px]"})]})}),r.jsx(Ws,{children:K.map(Z=>{var te;return r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[Z.is_win&&r.jsx(Pl,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Z.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Z.city,Z.state?`, ${Z.state}`:""]})]})]})}),r.jsx(_t,{children:r.jsx(Rt,{variant:Z.transaction_type==="buyer"?"default":"secondary",children:Z.transaction_type})}),r.jsx(_t,{children:twe(Z.close_date)}),r.jsx(_t,{children:Ed(Z.sale_price)}),t&&r.jsx(_t,{children:Z.commission_amount?Ed(Z.commission_amount):"-"}),r.jsx(_t,{children:((te=Z.lead_source)==null?void 0:te.name)||"-"}),r.jsx(_t,{children:Z.contact?`${Z.contact.first_name} ${Z.contact.last_name||""}`.trim():"-"}),r.jsx(_t,{children:r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(Mx,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",children:[r.jsxs(mo,{onClick:()=>i(Z),children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(mo,{onClick:()=>q(Z),children:[r.jsx(pl,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(mo,{onClick:()=>l(Z.id),className:"text-destructive",children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},Z.id)})})]})})})]}),r.jsx($ze,{open:!!s,onOpenChange:Z=>!Z&&i(null),transaction:s||void 0}),r.jsx(fh,{open:!!o,onOpenChange:Z=>!Z&&l(null),children:r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Delete Transaction?"}),r.jsx(Cu,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:H,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function qze({goals:e,stats:t,year:n,showCommission:s}){const i=new Date().getMonth()+1,o=new Date().getFullYear()===n?i:12,l=12-o,a=(b,j)=>{if(!j||j===0)return null;const N=Math.min(b/j*100,100),C=Math.max(j-b,0),A=l>0?C/l:0,E=o/12*100,T=N>=E?"ahead":N>=E*.8?"on-track":"behind";return{percent:N,remaining:C,pace:A,status:T}},h=a(t.totalTransactions,e.transactions_goal),p=a(t.totalVolume,e.volume_goal),x=s?a(t.totalCommission,e.gci_goal):null,y=b=>{switch(b){case"ahead":return r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(Zf,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Rt,{variant:"secondary",children:[r.jsx(y1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Rt,{variant:"destructive",children:[r.jsx(w1,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!e.transactions_goal&&!e.volume_goal&&!e.gci_goal?null:r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kx,{className:"h-5 w-5 text-primary"}),r.jsxs(Qt,{children:[n," Goals Progress"]})]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.transactions_goal&&h&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Transactions"}),y(h.status)]}),r.jsx(Hc,{value:h.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[t.totalTransactions," of ",e.transactions_goal]}),r.jsxs("span",{children:[Math.round(h.percent),"%"]})]}),h.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(h.pace),"/month to hit goal"]})]}),e.volume_goal&&p&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Volume"}),y(p.status)]}),r.jsx(Hc,{value:p.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Ed(t.totalVolume,!0)," of ",Ed(e.volume_goal,!0)]}),r.jsxs("span",{children:[Math.round(p.percent),"%"]})]}),p.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Ed(p.pace,!0),"/month"]})]}),s&&e.gci_goal&&x&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"GCI"}),y(x.status)]}),r.jsx(Hc,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Ed(t.totalCommission,!0)," of ",Ed(e.gci_goal,!0)]}),r.jsxs("span",{children:[Math.round(x.percent),"%"]})]}),x.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Ed(x.pace,!0),"/month"]})]})]})})]})}var _kt=Array.isArray,kh=_kt,bkt=typeof Ix=="object"&&Ix&&Ix.Object===Object&&Ix,Vze=bkt,wkt=Vze,jkt=typeof self=="object"&&self&&self.Object===Object&&self,kkt=wkt||jkt||Function("return this")(),qg=kkt,Nkt=qg,Skt=Nkt.Symbol,zI=Skt,_4e=zI,Hze=Object.prototype,Ckt=Hze.hasOwnProperty,Mkt=Hze.toString,WM=_4e?_4e.toStringTag:void 0;function Tkt(e){var t=Ckt.call(e,WM),n=e[WM];try{e[WM]=void 0;var s=!0}catch{}var i=Mkt.call(e);return s&&(t?e[WM]=n:delete e[WM]),i}var Akt=Tkt,Ekt=Object.prototype,Ikt=Ekt.toString;function Pkt(e){return Ikt.call(e)}var Lkt=Pkt,b4e=zI,Okt=Akt,Dkt=Lkt,Rkt="[object Null]",Fkt="[object Undefined]",w4e=b4e?b4e.toStringTag:void 0;function zkt(e){return e==null?e===void 0?Fkt:Rkt:w4e&&w4e in Object(e)?Okt(e):Dkt(e)}var xy=zkt;function Bkt(e){return e!=null&&typeof e=="object"}var yy=Bkt,$kt=xy,Ukt=yy,qkt="[object Symbol]";function Vkt(e){return typeof e=="symbol"||Ukt(e)&&$kt(e)==qkt}var x3=Vkt,Hkt=kh,Wkt=x3,Gkt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Kkt=/^\w*$/;function Zkt(e,t){if(Hkt(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Wkt(e)?!0:Kkt.test(e)||!Gkt.test(e)||t!=null&&e in Object(t)}var Mye=Zkt;function Ykt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var uv=Ykt;const y3=za(uv);var Xkt=xy,Qkt=uv,Jkt="[object AsyncFunction]",eNt="[object Function]",tNt="[object GeneratorFunction]",rNt="[object Proxy]";function nNt(e){if(!Qkt(e))return!1;var t=Xkt(e);return t==eNt||t==tNt||t==Jkt||t==rNt}var Tye=nNt;const Ri=za(Tye);var sNt=qg,iNt=sNt["__core-js_shared__"],aNt=iNt,Bce=aNt,j4e=function(){var e=/[^.]+$/.exec(Bce&&Bce.keys&&Bce.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function oNt(e){return!!j4e&&j4e in e}var lNt=oNt,cNt=Function.prototype,dNt=cNt.toString;function uNt(e){if(e!=null){try{return dNt.call(e)}catch{}try{return e+""}catch{}}return""}var Wze=uNt,hNt=Tye,fNt=lNt,pNt=uv,mNt=Wze,gNt=/[\\^$.*+?()[\]{}|]/g,xNt=/^\[object .+?Constructor\]$/,yNt=Function.prototype,vNt=Object.prototype,_Nt=yNt.toString,bNt=vNt.hasOwnProperty,wNt=RegExp("^"+_Nt.call(bNt).replace(gNt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jNt(e){if(!pNt(e)||fNt(e))return!1;var t=hNt(e)?wNt:xNt;return t.test(mNt(e))}var kNt=jNt;function NNt(e,t){return e==null?void 0:e[t]}var SNt=NNt,CNt=kNt,MNt=SNt;function TNt(e,t){var n=MNt(e,t);return CNt(n)?n:void 0}var lk=TNt,ANt=lk,ENt=ANt(Object,"create"),Yse=ENt,k4e=Yse;function INt(){this.__data__=k4e?k4e(null):{},this.size=0}var PNt=INt;function LNt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ONt=LNt,DNt=Yse,RNt="__lodash_hash_undefined__",FNt=Object.prototype,zNt=FNt.hasOwnProperty;function BNt(e){var t=this.__data__;if(DNt){var n=t[e];return n===RNt?void 0:n}return zNt.call(t,e)?t[e]:void 0}var $Nt=BNt,UNt=Yse,qNt=Object.prototype,VNt=qNt.hasOwnProperty;function HNt(e){var t=this.__data__;return UNt?t[e]!==void 0:VNt.call(t,e)}var WNt=HNt,GNt=Yse,KNt="__lodash_hash_undefined__";function ZNt(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=GNt&&t===void 0?KNt:t,this}var YNt=ZNt,XNt=PNt,QNt=ONt,JNt=$Nt,e4t=WNt,t4t=YNt;function v3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var y4t=x4t,v4t=Xse;function _4t(e,t){var n=this.__data__,s=v4t(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}var b4t=_4t,w4t=s4t,j4t=h4t,k4t=m4t,N4t=y4t,S4t=b4t;function _3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},Gw=function(t){return Kj(t)&&t.indexOf("%")===t.length-1},Dn=function(t){return WSt(t)&&!BI(t)},YSt=function(t){return _a(t)},Uc=function(t){return Dn(t)||Kj(t)},XSt=0,$I=function(t){var n=++XSt;return"".concat(t||"").concat(n)},Au=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Dn(t)&&!Kj(t))return s;var o;if(Gw(t)){var l=t.indexOf("%");o=n*parseFloat(t.slice(0,l))/100}else o=+t;return BI(o)&&(o=s),i&&o>n&&(o=n),o},A0=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},QSt=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,s={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function iCt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var E4e={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Qx=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},I4e=null,Uce=null,zye=function e(t){if(t===I4e&&Array.isArray(Uce))return Uce;var n=[];return I.Children.forEach(t,function(s){_a(s)||($St.isFragment(s)?n=n.concat(e(s.props.children)):n.push(s))}),Uce=n,I4e=t,n};function Jf(e,t){var n=[],s=[];return Array.isArray(t)?s=t.map(function(i){return Qx(i)}):s=[Qx(t)],zye(e).forEach(function(i){var o=rf(i,"type.displayName")||rf(i,"type.name");s.indexOf(o)!==-1&&n.push(i)}),n}function Fh(e,t){var n=Jf(e,t);return n&&n[0]}var P4e=function(t){if(!t||!t.props)return!1;var n=t.props,s=n.width,i=n.height;return!(!Dn(s)||s<=0||!Dn(i)||i<=0)},aCt=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],oCt=function(t){return t&&t.type&&Kj(t.type)&&aCt.indexOf(t.type)>=0},lCt=function(t,n,s,i){var o,l=(o=$ce==null?void 0:$ce[i])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Ri(t)&&(i&&l.includes(n)||tCt.includes(n))||s&&Fye.includes(n)},Ai=function(t,n,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(I.isValidElement(t)&&(i=t.props),!y3(i))return null;var o={};return Object.keys(i).forEach(function(l){var a;lCt((a=i)===null||a===void 0?void 0:a[l],l,n,s)&&(o[l]=i[l])}),o},ffe=function e(t,n){if(t===n)return!0;var s=I.Children.count(t);if(s!==I.Children.count(n))return!1;if(s===0)return!0;if(s===1)return L4e(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function fCt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function mfe(e){var t=e.children,n=e.width,s=e.height,i=e.viewBox,o=e.className,l=e.style,a=e.title,h=e.desc,p=hCt(e,uCt),x=i||{width:n,height:s,x:0,y:0},y=ra("recharts-surface",o);return rt.createElement("svg",pfe({},Ai(p,!0,"svg"),{className:y,width:n,height:s,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),rt.createElement("title",null,a),rt.createElement("desc",null,h),t)}var pCt=["children","className"];function gfe(){return gfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function gCt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var ko=rt.forwardRef(function(e,t){var n=e.children,s=e.className,i=mCt(e,pCt),o=ra("recharts-layer",s);return rt.createElement("g",gfe({className:o},Ai(i,!0),{ref:t}),n)}),_m=function(t,n){for(var s=arguments.length,i=new Array(s>2?s-2:0),o=2;oi?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++s=s?e:vCt(e,t,n)}var bCt=_Ct,wCt="\\ud800-\\udfff",jCt="\\u0300-\\u036f",kCt="\\ufe20-\\ufe2f",NCt="\\u20d0-\\u20ff",SCt=jCt+kCt+NCt,CCt="\\ufe0e\\ufe0f",MCt="\\u200d",TCt=RegExp("["+MCt+wCt+SCt+CCt+"]");function ACt(e){return TCt.test(e)}var r7e=ACt;function ECt(e){return e.split("")}var ICt=ECt,n7e="\\ud800-\\udfff",PCt="\\u0300-\\u036f",LCt="\\ufe20-\\ufe2f",OCt="\\u20d0-\\u20ff",DCt=PCt+LCt+OCt,RCt="\\ufe0e\\ufe0f",FCt="["+n7e+"]",xfe="["+DCt+"]",yfe="\\ud83c[\\udffb-\\udfff]",zCt="(?:"+xfe+"|"+yfe+")",s7e="[^"+n7e+"]",i7e="(?:\\ud83c[\\udde6-\\uddff]){2}",a7e="[\\ud800-\\udbff][\\udc00-\\udfff]",BCt="\\u200d",o7e=zCt+"?",l7e="["+RCt+"]?",$Ct="(?:"+BCt+"(?:"+[s7e,i7e,a7e].join("|")+")"+l7e+o7e+")*",UCt=l7e+o7e+$Ct,qCt="(?:"+[s7e+xfe+"?",xfe,i7e,a7e,FCt].join("|")+")",VCt=RegExp(yfe+"(?="+yfe+")|"+qCt+UCt,"g");function HCt(e){return e.match(VCt)||[]}var WCt=HCt,GCt=ICt,KCt=r7e,ZCt=WCt;function YCt(e){return KCt(e)?ZCt(e):GCt(e)}var XCt=YCt,QCt=bCt,JCt=r7e,e3t=XCt,t3t=Yze;function r3t(e){return function(t){t=t3t(t);var n=JCt(t)?e3t(t):void 0,s=n?n[0]:t.charAt(0),i=n?QCt(n,1).join(""):t.slice(1);return s[e]()+i}}var n3t=r3t,s3t=n3t,i3t=s3t("toUpperCase"),a3t=i3t;const uie=za(a3t);function Ko(e){return function(){return e}}const c7e=Math.cos,fre=Math.sin,Am=Math.sqrt,pre=Math.PI,hie=2*pre,vfe=Math.PI,_fe=2*vfe,Tw=1e-6,o3t=_fe-Tw;function d7e(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return d7e;const n=10**t;return function(s){this._+=s[0];for(let i=1,o=s.length;iTw)if(!(Math.abs(y*h-p*x)>Tw)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let j=s-l,N=i-a,C=h*h+p*p,A=j*j+N*N,E=Math.sqrt(C),T=Math.sqrt(b),L=o*Math.tan((vfe-Math.acos((C+b-A)/(2*E*T)))/2),z=L/T,F=L/E;Math.abs(z-1)>Tw&&this._append`L${t+z*x},${n+z*y}`,this._append`A${o},${o},0,0,${+(y*j>x*N)},${this._x1=t+F*h},${this._y1=n+F*p}`}}arc(t,n,s,i,o,l){if(t=+t,n=+n,s=+s,l=!!l,s<0)throw new Error(`negative radius: ${s}`);let a=s*Math.cos(i),h=s*Math.sin(i),p=t+a,x=n+h,y=1^l,b=l?i-o:o-i;this._x1===null?this._append`M${p},${x}`:(Math.abs(this._x1-p)>Tw||Math.abs(this._y1-x)>Tw)&&this._append`L${p},${x}`,s&&(b<0&&(b=b%_fe+_fe),b>o3t?this._append`A${s},${s},0,1,${y},${t-a},${n-h}A${s},${s},0,1,${y},${this._x1=p},${this._y1=x}`:b>Tw&&this._append`A${s},${s},0,${+(b>=vfe)},${y},${this._x1=t+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(t,n,s,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${s=+s}v${+i}h${-s}Z`}toString(){return this._}}function Bye(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);t=s}return e},()=>new c3t(t)}function $ye(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function u7e(e){this._context=e}u7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function fie(e){return new u7e(e)}function h7e(e){return e[0]}function f7e(e){return e[1]}function p7e(e,t){var n=Ko(!0),s=null,i=fie,o=null,l=Bye(a);e=typeof e=="function"?e:e===void 0?h7e:Ko(e),t=typeof t=="function"?t:t===void 0?f7e:Ko(t);function a(h){var p,x=(h=$ye(h)).length,y,b=!1,j;for(s==null&&(o=i(j=l())),p=0;p<=x;++p)!(p=j;--N)a.point(L[N],z[N]);a.lineEnd(),a.areaEnd()}E&&(L[b]=+e(A,b,y),z[b]=+t(A,b,y),a.point(s?+s(A,b,y):L[b],n?+n(A,b,y):z[b]))}if(T)return a=null,T+""||null}function x(){return p7e().defined(i).curve(l).context(o)}return p.x=function(y){return arguments.length?(e=typeof y=="function"?y:Ko(+y),s=null,p):e},p.x0=function(y){return arguments.length?(e=typeof y=="function"?y:Ko(+y),p):e},p.x1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:Ko(+y),p):s},p.y=function(y){return arguments.length?(t=typeof y=="function"?y:Ko(+y),n=null,p):t},p.y0=function(y){return arguments.length?(t=typeof y=="function"?y:Ko(+y),p):t},p.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:Ko(+y),p):n},p.lineX0=p.lineY0=function(){return x().x(e).y(t)},p.lineY1=function(){return x().x(e).y(n)},p.lineX1=function(){return x().x(s).y(t)},p.defined=function(y){return arguments.length?(i=typeof y=="function"?y:Ko(!!y),p):i},p.curve=function(y){return arguments.length?(l=y,o!=null&&(a=l(o)),p):l},p.context=function(y){return arguments.length?(y==null?o=a=null:a=l(o=y),p):o},p}class m7e{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function d3t(e){return new m7e(e,!0)}function u3t(e){return new m7e(e,!1)}const Uye={draw(e,t){const n=Am(t/pre);e.moveTo(n,0),e.arc(0,0,n,0,hie)}},h3t={draw(e,t){const n=Am(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},g7e=Am(1/3),f3t=g7e*2,p3t={draw(e,t){const n=Am(t/f3t),s=n*g7e;e.moveTo(0,-n),e.lineTo(s,0),e.lineTo(0,n),e.lineTo(-s,0),e.closePath()}},m3t={draw(e,t){const n=Am(t),s=-n/2;e.rect(s,s,n,n)}},g3t=.8908130915292852,x7e=fre(pre/10)/fre(7*pre/10),x3t=fre(hie/10)*x7e,y3t=-c7e(hie/10)*x7e,v3t={draw(e,t){const n=Am(t*g3t),s=x3t*n,i=y3t*n;e.moveTo(0,-n),e.lineTo(s,i);for(let o=1;o<5;++o){const l=hie*o/5,a=c7e(l),h=fre(l);e.lineTo(h*n,-a*n),e.lineTo(a*s-h*i,h*s+a*i)}e.closePath()}},qce=Am(3),_3t={draw(e,t){const n=-Am(t/(qce*3));e.moveTo(0,n*2),e.lineTo(-qce*n,-n),e.lineTo(qce*n,-n),e.closePath()}},Sf=-.5,Cf=Am(3)/2,bfe=1/Am(12),b3t=(bfe/2+1)*3,w3t={draw(e,t){const n=Am(t/b3t),s=n/2,i=n*bfe,o=s,l=n*bfe+n,a=-o,h=l;e.moveTo(s,i),e.lineTo(o,l),e.lineTo(a,h),e.lineTo(Sf*s-Cf*i,Cf*s+Sf*i),e.lineTo(Sf*o-Cf*l,Cf*o+Sf*l),e.lineTo(Sf*a-Cf*h,Cf*a+Sf*h),e.lineTo(Sf*s+Cf*i,Sf*i-Cf*s),e.lineTo(Sf*o+Cf*l,Sf*l-Cf*o),e.lineTo(Sf*a+Cf*h,Sf*h-Cf*a),e.closePath()}};function j3t(e,t){let n=null,s=Bye(i);e=typeof e=="function"?e:Ko(e||Uye),t=typeof t=="function"?t:Ko(t===void 0?64:+t);function i(){let o;if(n||(n=o=s()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(e=typeof o=="function"?o:Ko(o),i):e},i.size=function(o){return arguments.length?(t=typeof o=="function"?o:Ko(+o),i):t},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function mre(){}function gre(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function y7e(e){this._context=e}y7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gre(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gre(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function k3t(e){return new y7e(e)}function v7e(e){this._context=e}v7e.prototype={areaStart:mre,areaEnd:mre,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:gre(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function N3t(e){return new v7e(e)}function _7e(e){this._context=e}_7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,s=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:gre(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function S3t(e){return new _7e(e)}function b7e(e){this._context=e}b7e.prototype={areaStart:mre,areaEnd:mre,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function C3t(e){return new b7e(e)}function D4e(e){return e<0?-1:1}function R4e(e,t,n){var s=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(s||i<0&&-0),l=(n-e._y1)/(i||s<0&&-0),a=(o*i+l*s)/(s+i);return(D4e(o)+D4e(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(a))||0}function F4e(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Vce(e,t,n){var s=e._x0,i=e._y0,o=e._x1,l=e._y1,a=(o-s)/3;e._context.bezierCurveTo(s+a,i+a*t,o-a,l-a*n,o,l)}function xre(e){this._context=e}xre.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Vce(this,this._t0,F4e(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Vce(this,F4e(this,n=R4e(this,e,t)),n);break;default:Vce(this,this._t0,n=R4e(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function w7e(e){this._context=new j7e(e)}(w7e.prototype=Object.create(xre.prototype)).point=function(e,t){xre.prototype.point.call(this,t,e)};function j7e(e){this._context=e}j7e.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,s,i,o){this._context.bezierCurveTo(t,e,s,n,o,i)}};function M3t(e){return new xre(e)}function T3t(e){return new w7e(e)}function k7e(e){this._context=e}k7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var s=z4e(e),i=z4e(t),o=0,l=1;l=0;--t)i[t]=(l[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function E3t(e){return new pie(e,.5)}function I3t(e){return new pie(e,0)}function P3t(e){return new pie(e,1)}function jC(e,t){if((l=e.length)>1)for(var n=1,s,i,o=e[t[0]],l,a=o.length;n=0;)n[t]=t;return n}function L3t(e,t){return e[t]}function O3t(e){const t=[];return t.key=e,t}function D3t(){var e=Ko([]),t=wfe,n=jC,s=L3t;function i(o){var l=Array.from(e.apply(this,arguments),O3t),a,h=l.length,p=-1,x;for(const y of o)for(a=0,++p;a0){for(var n,s,i=0,o=e[0].length,l;i0){for(var n=0,s=e[t[0]],i,o=s.length;n0)||!((o=(i=e[t[0]]).length)>0))){for(var n=0,s=1,i,o,l;s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function H3t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var N7e={symbolCircle:Uye,symbolCross:h3t,symbolDiamond:p3t,symbolSquare:m3t,symbolStar:v3t,symbolTriangle:_3t,symbolWye:w3t},W3t=Math.PI/180,G3t=function(t){var n="symbol".concat(uie(t));return N7e[n]||Uye},K3t=function(t,n,s){if(n==="area")return t;switch(s){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*W3t;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Z3t=function(t,n){N7e["symbol".concat(uie(t))]=n},qye=function(t){var n=t.type,s=n===void 0?"circle":n,i=t.size,o=i===void 0?64:i,l=t.sizeType,a=l===void 0?"area":l,h=V3t(t,B3t),p=$4e($4e({},h),{},{type:s,size:o,sizeType:a}),x=function(){var A=G3t(s),E=j3t().type(A).size(K3t(o,a,s));return E()},y=p.className,b=p.cx,j=p.cy,N=Ai(p,!0);return b===+b&&j===+j&&o===+o?rt.createElement("path",jfe({},N,{className:ra("recharts-symbols",y),transform:"translate(".concat(b,", ").concat(j,")"),d:x()})):null};qye.registerSymbol=Z3t;function kC(e){"@babel/helpers - typeof";return kC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kC(e)}function kfe(){return kfe=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var T=j.inactive?p:j.color;return rt.createElement("li",kfe({className:A,style:y,key:"legend-item-".concat(N)},Zj(s.props,j,N)),rt.createElement(mfe,{width:l,height:l,viewBox:x,style:b},s.renderIcon(j)),rt.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},C?C(E,j,N):E))})}},{key:"render",value:function(){var s=this.props,i=s.payload,o=s.layout,l=s.align;if(!i||!i.length)return null;var a={padding:0,margin:0,textAlign:o==="horizontal"?l:"left"};return rt.createElement("ul",{className:"recharts-default-legend",style:a},this.renderItems())}}])}(I.PureComponent);bE(Vye,"displayName","Legend");bE(Vye,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var i5t=Qse;function a5t(){this.__data__=new i5t,this.size=0}var o5t=a5t;function l5t(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var c5t=l5t;function d5t(e){return this.__data__.get(e)}var u5t=d5t;function h5t(e){return this.__data__.has(e)}var f5t=h5t,p5t=Qse,m5t=Eye,g5t=Iye,x5t=200;function y5t(e,t){var n=this.__data__;if(n instanceof p5t){var s=n.__data__;if(!m5t||s.lengtha))return!1;var p=o.get(e),x=o.get(t);if(p&&x)return p==t&&x==e;var y=-1,b=!0,j=n&B5t?new D5t:void 0;for(o.set(e,t),o.set(t,e);++y-1&&e%1==0&&e-1&&e%1==0&&e<=VMt}var Kye=HMt,WMt=xy,GMt=Kye,KMt=yy,ZMt="[object Arguments]",YMt="[object Array]",XMt="[object Boolean]",QMt="[object Date]",JMt="[object Error]",eTt="[object Function]",tTt="[object Map]",rTt="[object Number]",nTt="[object Object]",sTt="[object RegExp]",iTt="[object Set]",aTt="[object String]",oTt="[object WeakMap]",lTt="[object ArrayBuffer]",cTt="[object DataView]",dTt="[object Float32Array]",uTt="[object Float64Array]",hTt="[object Int8Array]",fTt="[object Int16Array]",pTt="[object Int32Array]",mTt="[object Uint8Array]",gTt="[object Uint8ClampedArray]",xTt="[object Uint16Array]",yTt="[object Uint32Array]",dl={};dl[dTt]=dl[uTt]=dl[hTt]=dl[fTt]=dl[pTt]=dl[mTt]=dl[gTt]=dl[xTt]=dl[yTt]=!0;dl[ZMt]=dl[YMt]=dl[lTt]=dl[XMt]=dl[cTt]=dl[QMt]=dl[JMt]=dl[eTt]=dl[tTt]=dl[rTt]=dl[nTt]=dl[sTt]=dl[iTt]=dl[aTt]=dl[oTt]=!1;function vTt(e){return KMt(e)&&GMt(e.length)&&!!dl[WMt(e)]}var _Tt=vTt;function bTt(e){return function(t){return e(t)}}var D7e=bTt,bre={exports:{}};bre.exports;(function(e,t){var n=Vze,s=t&&!t.nodeType&&t,i=s&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===s,l=o&&n.process,a=function(){try{var h=i&&i.require&&i.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}}();e.exports=a})(bre,bre.exports);var wTt=bre.exports,jTt=_Tt,kTt=D7e,K4e=wTt,Z4e=K4e&&K4e.isTypedArray,NTt=Z4e?kTt(Z4e):jTt,R7e=NTt,STt=TMt,CTt=Wye,MTt=kh,TTt=O7e,ATt=Gye,ETt=R7e,ITt=Object.prototype,PTt=ITt.hasOwnProperty;function LTt(e,t){var n=MTt(e),s=!n&&CTt(e),i=!n&&!s&&TTt(e),o=!n&&!s&&!i&&ETt(e),l=n||s||i||o,a=l?STt(e.length,String):[],h=a.length;for(var p in e)(t||PTt.call(e,p))&&!(l&&(p=="length"||i&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||ATt(p,h)))&&a.push(p);return a}var OTt=LTt,DTt=Object.prototype;function RTt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||DTt;return e===n}var FTt=RTt;function zTt(e,t){return function(n){return e(t(n))}}var F7e=zTt,BTt=F7e,$Tt=BTt(Object.keys,Object),UTt=$Tt,qTt=FTt,VTt=UTt,HTt=Object.prototype,WTt=HTt.hasOwnProperty;function GTt(e){if(!qTt(e))return VTt(e);var t=[];for(var n in Object(e))WTt.call(e,n)&&n!="constructor"&&t.push(n);return t}var KTt=GTt,ZTt=Tye,YTt=Kye;function XTt(e){return e!=null&&YTt(e.length)&&!ZTt(e)}var UI=XTt,QTt=OTt,JTt=KTt,eAt=UI;function tAt(e){return eAt(e)?QTt(e):JTt(e)}var mie=tAt,rAt=xMt,nAt=CMt,sAt=mie;function iAt(e){return rAt(e,sAt,nAt)}var aAt=iAt,Y4e=aAt,oAt=1,lAt=Object.prototype,cAt=lAt.hasOwnProperty;function dAt(e,t,n,s,i,o){var l=n&oAt,a=Y4e(e),h=a.length,p=Y4e(t),x=p.length;if(h!=x&&!l)return!1;for(var y=h;y--;){var b=a[y];if(!(l?b in t:cAt.call(t,b)))return!1}var j=o.get(e),N=o.get(t);if(j&&N)return j==t&&N==e;var C=!0;o.set(e,t),o.set(t,e);for(var A=l;++y-1}var lIt=oIt;function cIt(e,t,n){for(var s=-1,i=e==null?0:e.length;++s=kIt){var p=t?null:wIt(e);if(p)return jIt(p);l=!1,i=bIt,h=new yIt}else h=t?[]:a;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function BIt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function $It(e){return e.value}function UIt(e,t){if(rt.isValidElement(e))return rt.cloneElement(e,t);if(typeof e=="function")return rt.createElement(e,t);t.ref;var n=zIt(t,EIt);return rt.createElement(Vye,n)}var hSe=1,LS=function(e){function t(){var n;IIt(this,t);for(var s=arguments.length,i=new Array(s),o=0;ohSe||Math.abs(i.height-this.lastBoundingBox.height)>hSe)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,s&&s(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,s&&s(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?vx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var i=this.props,o=i.layout,l=i.align,a=i.verticalAlign,h=i.margin,p=i.chartWidth,x=i.chartHeight,y,b;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(l==="center"&&o==="vertical"){var j=this.getBBoxSnapshot();y={left:((p||0)-j.width)/2}}else y=l==="right"?{right:h&&h.right||0}:{left:h&&h.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(a==="middle"){var N=this.getBBoxSnapshot();b={top:((x||0)-N.height)/2}}else b=a==="bottom"?{bottom:h&&h.bottom||0}:{top:h&&h.top||0};return vx(vx({},y),b)}},{key:"render",value:function(){var s=this,i=this.props,o=i.content,l=i.width,a=i.height,h=i.wrapperStyle,p=i.payloadUniqBy,x=i.payload,y=vx(vx({position:"absolute",width:l||"auto",height:a||"auto"},this.getDefaultPosition(h)),h);return rt.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(j){s.wrapperNode=j}},UIt(o,vx(vx({},this.props),{},{payload:H7e(x,p,$It)})))}}],[{key:"getWithHeight",value:function(s,i){var o=vx(vx({},this.defaultProps),s.props),l=o.layout;return l==="vertical"&&Dn(s.props.height)?{height:s.props.height}:l==="horizontal"?{width:s.props.width||i}:null}}])}(I.PureComponent);gie(LS,"displayName","Legend");gie(LS,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var fSe=zI,qIt=Wye,VIt=kh,pSe=fSe?fSe.isConcatSpreadable:void 0;function HIt(e){return VIt(e)||qIt(e)||!!(pSe&&e&&e[pSe])}var WIt=HIt,GIt=P7e,KIt=WIt;function K7e(e,t,n,s,i){var o=-1,l=e.length;for(n||(n=KIt),i||(i=[]);++o0&&n(a)?t>1?K7e(a,t-1,n,s,i):GIt(i,a):s||(i[i.length]=a)}return i}var Z7e=K7e;function ZIt(e){return function(t,n,s){for(var i=-1,o=Object(t),l=s(t),a=l.length;a--;){var h=l[e?a:++i];if(n(o[h],h,o)===!1)break}return t}}var YIt=ZIt,XIt=YIt,QIt=XIt(),JIt=QIt,ePt=JIt,tPt=mie;function rPt(e,t){return e&&ePt(e,t,tPt)}var Y7e=rPt,nPt=UI;function sPt(e,t){return function(n,s){if(n==null)return n;if(!nPt(n))return e(n,s);for(var i=n.length,o=t?i:-1,l=Object(n);(t?o--:++ot||o&&l&&h&&!a&&!p||s&&l&&h||!n&&h||!i)return 1;if(!s&&!o&&!p&&e=a)return h;var p=n[s];return h*(p=="desc"?-1:1)}}return e.index-t.index}var yPt=xPt,Kce=Lye,vPt=Oye,_Pt=Vg,bPt=X7e,wPt=fPt,jPt=D7e,kPt=yPt,NPt=k3,SPt=kh;function CPt(e,t,n){t.length?t=Kce(t,function(o){return SPt(o)?function(l){return vPt(l,o.length===1?o[0]:o)}:o}):t=[NPt];var s=-1;t=Kce(t,jPt(_Pt));var i=bPt(e,function(o,l,a){var h=Kce(t,function(p){return p(o)});return{criteria:h,index:++s,value:o}});return wPt(i,function(o,l){return kPt(o,l,n)})}var MPt=CPt;function TPt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var APt=TPt,EPt=APt,gSe=Math.max;function IPt(e,t,n){return t=gSe(t===void 0?e.length-1:t,0),function(){for(var s=arguments,i=-1,o=gSe(s.length-t,0),l=Array(o);++i0){if(++t>=UPt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var WPt=HPt,GPt=$Pt,KPt=WPt,ZPt=KPt(GPt),YPt=ZPt,XPt=k3,QPt=PPt,JPt=YPt;function e6t(e,t){return JPt(QPt(e,t,XPt),e+"")}var t6t=e6t,r6t=Aye,n6t=UI,s6t=Gye,i6t=uv;function a6t(e,t,n){if(!i6t(n))return!1;var s=typeof t;return(s=="number"?n6t(n)&&s6t(t,n.length):s=="string"&&t in n)?r6t(n[t],e):!1}var xie=a6t,o6t=Z7e,l6t=MPt,c6t=t6t,ySe=xie,d6t=c6t(function(e,t){if(e==null)return[];var n=t.length;return n>1&&ySe(e,t[0],t[1])?t=[]:n>2&&ySe(t[0],t[1],t[2])&&(t=[t[0]]),l6t(e,o6t(t,1),[])}),u6t=d6t;const Xye=za(u6t);function wE(e){"@babel/helpers - typeof";return wE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wE(e)}function Ife(){return Ife=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=t.x),"".concat(GM,"-left"),Dn(n)&&t&&Dn(t.x)&&n=t.y),"".concat(GM,"-top"),Dn(s)&&t&&Dn(t.y)&&sC?Math.max(x,h[s]):Math.max(y,h[s])}function S6t(e){var t=e.translateX,n=e.translateY,s=e.useTranslate3d;return{transform:s?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function C6t(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.offsetTopLeft,i=e.position,o=e.reverseDirection,l=e.tooltipBox,a=e.useTranslate3d,h=e.viewBox,p,x,y;return l.height>0&&l.width>0&&n?(x=bSe({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:l.width,viewBox:h,viewBoxDimension:h.width}),y=bSe({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:s,position:i,reverseDirection:o,tooltipDimension:l.height,viewBox:h,viewBoxDimension:h.height}),p=S6t({translateX:x,translateY:y,useTranslate3d:a})):p=k6t,{cssProperties:p,cssClasses:N6t({translateX:x,translateY:y,coordinate:n})}}function SC(e){"@babel/helpers - typeof";return SC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},SC(e)}function wSe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function jSe(e){for(var t=1;tkSe||Math.abs(s.height-this.state.lastBoundingBox.height)>kSe)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,i=this.props,o=i.active,l=i.allowEscapeViewBox,a=i.animationDuration,h=i.animationEasing,p=i.children,x=i.coordinate,y=i.hasPayload,b=i.isAnimationActive,j=i.offset,N=i.position,C=i.reverseDirection,A=i.useTranslate3d,E=i.viewBox,T=i.wrapperStyle,L=C6t({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:j,position:N,reverseDirection:C,tooltipBox:this.state.lastBoundingBox,useTranslate3d:A,viewBox:E}),z=L.cssClasses,F=L.cssProperties,q=jSe(jSe({transition:b&&o?"transform ".concat(a,"ms ").concat(h):void 0},F),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},T);return rt.createElement("div",{tabIndex:-1,className:z,style:q,ref:function(K){s.wrapperNode=K}},p)}}])}(I.PureComponent),R6t=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},N3={isSsr:R6t()};function CC(e){"@babel/helpers - typeof";return CC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},CC(e)}function NSe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function SSe(e){for(var t=1;t0;return rt.createElement(D6t,{allowEscapeViewBox:l,animationDuration:a,animationEasing:h,isAnimationActive:b,active:o,coordinate:x,hasPayload:q,offset:j,position:A,reverseDirection:E,useTranslate3d:T,viewBox:L,wrapperStyle:z},G6t(p,SSe(SSe({},this.props),{},{payload:F})))}}])}(I.PureComponent);Qye(Qp,"displayName","Tooltip");Qye(Qp,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!N3.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var K6t=qg,Z6t=function(){return K6t.Date.now()},Y6t=Z6t,X6t=/\s/;function Q6t(e){for(var t=e.length;t--&&X6t.test(e.charAt(t)););return t}var J6t=Q6t,eLt=J6t,tLt=/^\s+/;function rLt(e){return e&&e.slice(0,eLt(e)+1).replace(tLt,"")}var nLt=rLt,sLt=nLt,CSe=uv,iLt=x3,MSe=NaN,aLt=/^[-+]0x[0-9a-f]+$/i,oLt=/^0b[01]+$/i,lLt=/^0o[0-7]+$/i,cLt=parseInt;function dLt(e){if(typeof e=="number")return e;if(iLt(e))return MSe;if(CSe(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=CSe(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=sLt(e);var n=oLt.test(e);return n||lLt.test(e)?cLt(e.slice(2),n?2:8):aLt.test(e)?MSe:+e}var n9e=dLt,uLt=uv,Yce=Y6t,TSe=n9e,hLt="Expected a function",fLt=Math.max,pLt=Math.min;function mLt(e,t,n){var s,i,o,l,a,h,p=0,x=!1,y=!1,b=!0;if(typeof e!="function")throw new TypeError(hLt);t=TSe(t)||0,uLt(n)&&(x=!!n.leading,y="maxWait"in n,o=y?fLt(TSe(n.maxWait)||0,t):o,b="trailing"in n?!!n.trailing:b);function j(q){var H=s,K=i;return s=i=void 0,p=q,l=e.apply(K,H),l}function N(q){return p=q,a=setTimeout(E,t),x?j(q):l}function C(q){var H=q-h,K=q-p,Z=t-H;return y?pLt(Z,o-K):Z}function A(q){var H=q-h,K=q-p;return h===void 0||H>=t||H<0||y&&K>=o}function E(){var q=Yce();if(A(q))return T(q);a=setTimeout(E,C(q))}function T(q){return a=void 0,b&&s?j(q):(s=i=void 0,l)}function L(){a!==void 0&&clearTimeout(a),p=0,s=h=i=a=void 0}function z(){return a===void 0?l:T(Yce())}function F(){var q=Yce(),H=A(q);if(s=arguments,i=this,h=q,H){if(a===void 0)return N(h);if(y)return clearTimeout(a),a=setTimeout(E,t),j(h)}return a===void 0&&(a=setTimeout(E,t)),l}return F.cancel=L,F.flush=z,F}var gLt=mLt,xLt=gLt,yLt=uv,vLt="Expected a function";function _Lt(e,t,n){var s=!0,i=!0;if(typeof e!="function")throw new TypeError(vLt);return yLt(n)&&(s="leading"in n?!!n.leading:s,i="trailing"in n?!!n.trailing:i),xLt(e,t,{leading:s,maxWait:t,trailing:i})}var bLt=_Lt;const s9e=za(bLt);function kE(e){"@babel/helpers - typeof";return kE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kE(e)}function ASe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function HL(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&(ve=s9e(ve,C,{trailing:!0,leading:!1}));var ne=new ResizeObserver(ve),ge=F.current.getBoundingClientRect(),ie=ge.width,fe=ge.height;return ae(ie,fe),ne.observe(F.current),function(){ne.disconnect()}},[ae,C]);var le=I.useMemo(function(){var ve=Z.containerWidth,ne=Z.containerHeight;if(ve<0||ne<0)return null;_m(Gw(l)||Gw(h),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,h),_m(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ge=Gw(l)?ve:l,ie=Gw(h)?ne:h;n&&n>0&&(ge?ie=ge/n:ie&&(ge=ie*n),b&&ie>b&&(ie=b)),_m(ge>0||ie>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,ge,ie,l,h,x,y,n);var fe=!Array.isArray(j)&&Qx(j.type).endsWith("Chart");return rt.Children.map(j,function(de){return rt.isValidElement(de)?I.cloneElement(de,HL({width:ge,height:ie},fe?{style:HL({height:"100%",width:"100%",maxHeight:ie,maxWidth:ge},de.props.style)}:{})):de})},[n,j,h,b,y,x,Z,l]);return rt.createElement("div",{id:A?"".concat(A):void 0,className:ra("recharts-responsive-container",E),style:HL(HL({},z),{},{width:l,height:h,minWidth:x,minHeight:y,maxHeight:b}),ref:F},le)}),yie=function(t){return null};yie.displayName="Cell";function NE(e){"@babel/helpers - typeof";return NE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},NE(e)}function ISe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Rfe(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||N3.isSsr)return{width:0,height:0};var s=OLt(n),i=JSON.stringify({text:t,copyStyle:s});if(u4.widthCache[i])return u4.widthCache[i];try{var o=document.getElementById(PSe);o||(o=document.createElement("span"),o.setAttribute("id",PSe),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Rfe(Rfe({},LLt),s);Object.assign(o.style,l),o.textContent="".concat(t);var a=o.getBoundingClientRect(),h={width:a.width,height:a.height};return u4.widthCache[i]=h,++u4.cacheCount>PLt&&(u4.cacheCount=0,u4.widthCache={}),h}catch{return{width:0,height:0}}},DLt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function SE(e){"@babel/helpers - typeof";return SE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},SE(e)}function Nre(e,t){return BLt(e)||zLt(e,t)||FLt(e,t)||RLt()}function RLt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FLt(e,t){if(e){if(typeof e=="string")return LSe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return LSe(e,t)}}function LSe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function e8t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function BSe(e,t){return s8t(e)||n8t(e,t)||r8t(e,t)||t8t()}function t8t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r8t(e,t){if(e){if(typeof e=="string")return $Se(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $Se(e,t)}}function $Se(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return ge.reduce(function(ie,fe){var de=fe.word,ye=fe.width,Ie=ie[ie.length-1];if(Ie&&(i==null||o||Ie.width+ye+sfe.width?ie:fe})};if(!x)return j;for(var C="…",A=function(ge){var ie=y.slice(0,ge),fe=l9e({breakAll:p,style:h,children:ie+C}).wordsWithComputedWidth,de=b(fe),ye=de.length>l||N(de).width>Number(i);return[ye,de]},E=0,T=y.length-1,L=0,z;E<=T&&L<=y.length-1;){var F=Math.floor((E+T)/2),q=F-1,H=A(q),K=BSe(H,2),Z=K[0],te=K[1],ae=A(F),le=BSe(ae,1),ve=le[0];if(!Z&&!ve&&(E=F+1),Z&&ve&&(T=F-1),!Z&&ve){z=te;break}L++}return z||j},USe=function(t){var n=_a(t)?[]:t.toString().split(o9e);return[{words:n}]},a8t=function(t){var n=t.width,s=t.scaleToFit,i=t.children,o=t.style,l=t.breakAll,a=t.maxLines;if((n||s)&&!N3.isSsr){var h,p,x=l9e({breakAll:l,children:i,style:o});if(x){var y=x.wordsWithComputedWidth,b=x.spaceWidth;h=y,p=b}else return USe(i);return i8t({breakAll:l,children:i,maxLines:a,style:o},h,p,n,s)}return USe(i)},qSe="#808080",Yj=function(t){var n=t.x,s=n===void 0?0:n,i=t.y,o=i===void 0?0:i,l=t.lineHeight,a=l===void 0?"1em":l,h=t.capHeight,p=h===void 0?"0.71em":h,x=t.scaleToFit,y=x===void 0?!1:x,b=t.textAnchor,j=b===void 0?"start":b,N=t.verticalAnchor,C=N===void 0?"end":N,A=t.fill,E=A===void 0?qSe:A,T=zSe(t,QLt),L=I.useMemo(function(){return a8t({breakAll:T.breakAll,children:T.children,maxLines:T.maxLines,scaleToFit:y,style:T.style,width:T.width})},[T.breakAll,T.children,T.maxLines,y,T.style,T.width]),z=T.dx,F=T.dy,q=T.angle,H=T.className,K=T.breakAll,Z=zSe(T,JLt);if(!Uc(s)||!Uc(o))return null;var te=s+(Dn(z)?z:0),ae=o+(Dn(F)?F:0),le;switch(C){case"start":le=Xce("calc(".concat(p,")"));break;case"middle":le=Xce("calc(".concat((L.length-1)/2," * -").concat(a," + (").concat(p," / 2))"));break;default:le=Xce("calc(".concat(L.length-1," * -").concat(a,")"));break}var ve=[];if(y){var ne=L[0].width,ge=T.width;ve.push("scale(".concat((Dn(ge)?ge/ne:1)/ne,")"))}return q&&ve.push("rotate(".concat(q,", ").concat(te,", ").concat(ae,")")),ve.length&&(Z.transform=ve.join(" ")),rt.createElement("text",Ffe({},Ai(Z,!0),{x:te,y:ae,className:ra("recharts-text",H),textAnchor:j,fill:E.includes("url")?qSe:E}),L.map(function(ie,fe){var de=ie.words.join(K?"":" ");return rt.createElement("tspan",{x:te,dy:fe===0?le:a,key:"".concat(de,"-").concat(fe)},de)}))};function E1(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function o8t(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Jye(e){let t,n,s;e.length!==2?(t=E1,n=(a,h)=>E1(e(a),h),s=(a,h)=>e(a)-h):(t=e===E1||e===o8t?e:l8t,n=e,s=e);function i(a,h,p=0,x=a.length){if(p>>1;n(a[y],h)<0?p=y+1:x=y}while(p>>1;n(a[y],h)<=0?p=y+1:x=y}while(pp&&s(a[y-1],h)>-s(a[y],h)?y-1:y}return{left:i,center:l,right:o}}function l8t(){return 0}function c9e(e){return e===null?NaN:+e}function*c8t(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const d8t=Jye(E1),qI=d8t.right;Jye(c9e).center;class VSe extends Map{constructor(t,n=f8t){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[s,i]of t)this.set(s,i)}get(t){return super.get(HSe(this,t))}has(t){return super.has(HSe(this,t))}set(t,n){return super.set(u8t(this,t),n)}delete(t){return super.delete(h8t(this,t))}}function HSe({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function u8t({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function h8t({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function f8t(e){return e!==null&&typeof e=="object"?e.valueOf():e}function p8t(e=E1){if(e===E1)return d9e;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const s=e(t,n);return s||s===0?s:(e(n,n)===0)-(e(t,t)===0)}}function d9e(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const m8t=Math.sqrt(50),g8t=Math.sqrt(10),x8t=Math.sqrt(2);function Sre(e,t,n){const s=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(s)),o=s/Math.pow(10,i),l=o>=m8t?10:o>=g8t?5:o>=x8t?2:1;let a,h,p;return i<0?(p=Math.pow(10,-i)/l,a=Math.round(e*p),h=Math.round(t*p),a/pt&&--h,p=-p):(p=Math.pow(10,i)*l,a=Math.round(e/p),h=Math.round(t/p),a*pt&&--h),h0))return[];if(e===t)return[e];const s=t=i))return[];const a=o-i+1,h=new Array(a);if(s)if(l<0)for(let p=0;p=s)&&(n=s);return n}function GSe(e,t){let n;for(const s of e)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function u9e(e,t,n=0,s=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),s=Math.floor(Math.min(e.length-1,s)),!(n<=t&&t<=s))return e;for(i=i===void 0?d9e:p8t(i);s>n;){if(s-n>600){const h=s-n+1,p=t-n+1,x=Math.log(h),y=.5*Math.exp(2*x/3),b=.5*Math.sqrt(x*y*(h-y)/h)*(p-h/2<0?-1:1),j=Math.max(n,Math.floor(t-p*y/h+b)),N=Math.min(s,Math.floor(t+(h-p)*y/h+b));u9e(e,t,j,N,i)}const o=e[t];let l=n,a=s;for(KM(e,n,t),i(e[s],o)>0&&KM(e,n,s);l0;)--a}i(e[n],o)===0?KM(e,n,a):(++a,KM(e,a,s)),a<=t&&(n=a+1),t<=a&&(s=a-1)}return e}function KM(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function y8t(e,t,n){if(e=Float64Array.from(c8t(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return GSe(e);if(t>=1)return WSe(e);var s,i=(s-1)*t,o=Math.floor(i),l=WSe(u9e(e,o).subarray(0,o+1)),a=GSe(e.subarray(o+1));return l+(a-l)*(i-o)}}function v8t(e,t,n=c9e){if(!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return+n(e[0],0,e);if(t>=1)return+n(e[s-1],s-1,e);var s,i=(s-1)*t,o=Math.floor(i),l=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return l+(a-l)*(i-o)}}function _8t(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var s=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?GL(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?GL(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=w8t.exec(e))?new ph(t[1],t[2],t[3],1):(t=j8t.exec(e))?new ph(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=k8t.exec(e))?GL(t[1],t[2],t[3],t[4]):(t=N8t.exec(e))?GL(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=S8t.exec(e))?eCe(t[1],t[2]/100,t[3]/100,1):(t=C8t.exec(e))?eCe(t[1],t[2]/100,t[3]/100,t[4]):KSe.hasOwnProperty(e)?XSe(KSe[e]):e==="transparent"?new ph(NaN,NaN,NaN,0):null}function XSe(e){return new ph(e>>16&255,e>>8&255,e&255,1)}function GL(e,t,n,s){return s<=0&&(e=t=n=NaN),new ph(e,t,n,s)}function A8t(e){return e instanceof VI||(e=AE(e)),e?(e=e.rgb(),new ph(e.r,e.g,e.b,e.opacity)):new ph}function qfe(e,t,n,s){return arguments.length===1?A8t(e):new ph(e,t,n,s??1)}function ph(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}t0e(ph,qfe,f9e(VI,{brighter(e){return e=e==null?Cre:Math.pow(Cre,e),new ph(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ME:Math.pow(ME,e),new ph(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ph(Mj(this.r),Mj(this.g),Mj(this.b),Mre(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:QSe,formatHex:QSe,formatHex8:E8t,formatRgb:JSe,toString:JSe}));function QSe(){return`#${Kw(this.r)}${Kw(this.g)}${Kw(this.b)}`}function E8t(){return`#${Kw(this.r)}${Kw(this.g)}${Kw(this.b)}${Kw((isNaN(this.opacity)?1:this.opacity)*255)}`}function JSe(){const e=Mre(this.opacity);return`${e===1?"rgb(":"rgba("}${Mj(this.r)}, ${Mj(this.g)}, ${Mj(this.b)}${e===1?")":`, ${e})`}`}function Mre(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Mj(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Kw(e){return e=Mj(e),(e<16?"0":"")+e.toString(16)}function eCe(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sm(e,t,n,s)}function p9e(e){if(e instanceof sm)return new sm(e.h,e.s,e.l,e.opacity);if(e instanceof VI||(e=AE(e)),!e)return new sm;if(e instanceof sm)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),o=Math.max(t,n,s),l=NaN,a=o-i,h=(o+i)/2;return a?(t===o?l=(n-s)/a+(n0&&h<1?0:l,new sm(l,a,h,e.opacity)}function I8t(e,t,n,s){return arguments.length===1?p9e(e):new sm(e,t,n,s??1)}function sm(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}t0e(sm,I8t,f9e(VI,{brighter(e){return e=e==null?Cre:Math.pow(Cre,e),new sm(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ME:Math.pow(ME,e),new sm(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new ph(Qce(e>=240?e-240:e+120,i,s),Qce(e,i,s),Qce(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new sm(tCe(this.h),KL(this.s),KL(this.l),Mre(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Mre(this.opacity);return`${e===1?"hsl(":"hsla("}${tCe(this.h)}, ${KL(this.s)*100}%, ${KL(this.l)*100}%${e===1?")":`, ${e})`}`}}));function tCe(e){return e=(e||0)%360,e<0?e+360:e}function KL(e){return Math.max(0,Math.min(1,e||0))}function Qce(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const r0e=e=>()=>e;function P8t(e,t){return function(n){return e+n*t}}function L8t(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function O8t(e){return(e=+e)==1?m9e:function(t,n){return n-t?L8t(t,n,e):r0e(isNaN(t)?n:t)}}function m9e(e,t){var n=t-e;return n?P8t(e,n):r0e(isNaN(e)?t:e)}const rCe=function e(t){var n=O8t(t);function s(i,o){var l=n((i=qfe(i)).r,(o=qfe(o)).r),a=n(i.g,o.g),h=n(i.b,o.b),p=m9e(i.opacity,o.opacity);return function(x){return i.r=l(x),i.g=a(x),i.b=h(x),i.opacity=p(x),i+""}}return s.gamma=e,s}(1);function D8t(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),a[l]?a[l]+=o:a[++l]=o),(s=s[0])===(i=i[0])?a[l]?a[l]+=i:a[++l]=i:(a[++l]=null,h.push({i:l,x:Tre(s,i)})),n=Jce.lastIndex;return nt&&(n=e,e=t,t=n),function(s){return Math.max(e,Math.min(t,s))}}function G8t(e,t,n){var s=e[0],i=e[1],o=t[0],l=t[1];return i2?K8t:G8t,h=p=null,y}function y(b){return b==null||isNaN(b=+b)?o:(h||(h=a(e.map(s),t,n)))(s(l(b)))}return y.invert=function(b){return l(i((p||(p=a(t,e.map(s),Tre)))(b)))},y.domain=function(b){return arguments.length?(e=Array.from(b,Are),x()):e.slice()},y.range=function(b){return arguments.length?(t=Array.from(b),x()):t.slice()},y.rangeRound=function(b){return t=Array.from(b),n=n0e,x()},y.clamp=function(b){return arguments.length?(l=b?!0:Eu,x()):l!==Eu},y.interpolate=function(b){return arguments.length?(n=b,x()):n},y.unknown=function(b){return arguments.length?(o=b,y):o},function(b,j){return s=b,i=j,x()}}function s0e(){return vie()(Eu,Eu)}function Z8t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Ere(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,s=e.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+e.slice(n+1)]}function MC(e){return e=Ere(Math.abs(e)),e?e[1]:NaN}function Y8t(e,t){return function(n,s){for(var i=n.length,o=[],l=0,a=e[0],h=0;i>0&&a>0&&(h+a+1>s&&(a=Math.max(1,s-h)),o.push(n.substring(i-=a,i+a)),!((h+=a+1)>s));)a=e[l=(l+1)%e.length];return o.reverse().join(t)}}function X8t(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Q8t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function EE(e){if(!(t=Q8t.exec(e)))throw new Error("invalid format: "+e);var t;return new i0e({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}EE.prototype=i0e.prototype;function i0e(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}i0e.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function J8t(e){e:for(var t=e.length,n=1,s=-1,i;n0&&(s=0);break}return s>0?e.slice(0,s)+e.slice(i+1):e}var g9e;function eOt(e,t){var n=Ere(e,t);if(!n)return e+"";var s=n[0],i=n[1],o=i-(g9e=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,l=s.length;return o===l?s:o>l?s+new Array(o-l+1).join("0"):o>0?s.slice(0,o)+"."+s.slice(o):"0."+new Array(1-o).join("0")+Ere(e,Math.max(0,t+o-1))[0]}function sCe(e,t){var n=Ere(e,t);if(!n)return e+"";var s=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+s:s.length>i+1?s.slice(0,i+1)+"."+s.slice(i+1):s+new Array(i-s.length+2).join("0")}const iCe={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Z8t,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>sCe(e*100,t),r:sCe,s:eOt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function aCe(e){return e}var oCe=Array.prototype.map,lCe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tOt(e){var t=e.grouping===void 0||e.thousands===void 0?aCe:Y8t(oCe.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",s=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?aCe:X8t(oCe.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",h=e.nan===void 0?"NaN":e.nan+"";function p(y){y=EE(y);var b=y.fill,j=y.align,N=y.sign,C=y.symbol,A=y.zero,E=y.width,T=y.comma,L=y.precision,z=y.trim,F=y.type;F==="n"?(T=!0,F="g"):iCe[F]||(L===void 0&&(L=12),z=!0,F="g"),(A||b==="0"&&j==="=")&&(A=!0,b="0",j="=");var q=C==="$"?n:C==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",H=C==="$"?s:/[%p]/.test(F)?l:"",K=iCe[F],Z=/[defgprs%]/.test(F);L=L===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,L)):Math.max(0,Math.min(20,L));function te(ae){var le=q,ve=H,ne,ge,ie;if(F==="c")ve=K(ae)+ve,ae="";else{ae=+ae;var fe=ae<0||1/ae<0;if(ae=isNaN(ae)?h:K(Math.abs(ae),L),z&&(ae=J8t(ae)),fe&&+ae==0&&N!=="+"&&(fe=!1),le=(fe?N==="("?N:a:N==="-"||N==="("?"":N)+le,ve=(F==="s"?lCe[8+g9e/3]:"")+ve+(fe&&N==="("?")":""),Z){for(ne=-1,ge=ae.length;++neie||ie>57){ve=(ie===46?i+ae.slice(ne+1):ae.slice(ne))+ve,ae=ae.slice(0,ne);break}}}T&&!A&&(ae=t(ae,1/0));var de=le.length+ae.length+ve.length,ye=de>1)+le+ae+ve+ye.slice(de);break;default:ae=ye+le+ae+ve;break}return o(ae)}return te.toString=function(){return y+""},te}function x(y,b){var j=p((y=EE(y),y.type="f",y)),N=Math.max(-8,Math.min(8,Math.floor(MC(b)/3)))*3,C=Math.pow(10,-N),A=lCe[8+N/3];return function(E){return j(C*E)+A}}return{format:p,formatPrefix:x}}var ZL,a0e,x9e;rOt({thousands:",",grouping:[3],currency:["$",""]});function rOt(e){return ZL=tOt(e),a0e=ZL.format,x9e=ZL.formatPrefix,ZL}function nOt(e){return Math.max(0,-MC(Math.abs(e)))}function sOt(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(MC(t)/3)))*3-MC(Math.abs(e)))}function iOt(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,MC(t)-MC(e))+1}function y9e(e,t,n,s){var i=$fe(e,t,n),o;switch(s=EE(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(o=sOt(i,l))&&(s.precision=o),x9e(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=iOt(i,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=nOt(i))&&(s.precision=o-(s.type==="%")*2);break}}return a0e(s)}function hv(e){var t=e.domain;return e.ticks=function(n){var s=t();return zfe(s[0],s[s.length-1],n??10)},e.tickFormat=function(n,s){var i=t();return y9e(i[0],i[i.length-1],n??10,s)},e.nice=function(n){n==null&&(n=10);var s=t(),i=0,o=s.length-1,l=s[i],a=s[o],h,p,x=10;for(a0;){if(p=Bfe(l,a,n),p===h)return s[i]=l,s[o]=a,t(s);if(p>0)l=Math.floor(l/p)*p,a=Math.ceil(a/p)*p;else if(p<0)l=Math.ceil(l*p)/p,a=Math.floor(a*p)/p;else break;h=p}return e},e}function Ire(){var e=s0e();return e.copy=function(){return HI(e,Ire())},cp.apply(e,arguments),hv(e)}function v9e(e){var t;function n(s){return s==null||isNaN(s=+s)?t:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(e=Array.from(s,Are),n):e.slice()},n.unknown=function(s){return arguments.length?(t=s,n):t},n.copy=function(){return v9e(e).unknown(t)},e=arguments.length?Array.from(e,Are):[0,1],hv(n)}function _9e(e,t){e=e.slice();var n=0,s=e.length-1,i=e[n],o=e[s],l;return oMath.pow(e,t)}function dOt(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function uCe(e){return(t,n)=>-e(-t,n)}function o0e(e){const t=e(cCe,dCe),n=t.domain;let s=10,i,o;function l(){return i=dOt(s),o=cOt(s),n()[0]<0?(i=uCe(i),o=uCe(o),e(aOt,oOt)):e(cCe,dCe),t}return t.base=function(a){return arguments.length?(s=+a,l()):s},t.domain=function(a){return arguments.length?(n(a),l()):n()},t.ticks=a=>{const h=n();let p=h[0],x=h[h.length-1];const y=x0){for(;b<=j;++b)for(N=1;Nx)break;E.push(C)}}else for(;b<=j;++b)for(N=s-1;N>=1;--N)if(C=b>0?N/o(-b):N*o(b),!(Cx)break;E.push(C)}E.length*2{if(a==null&&(a=10),h==null&&(h=s===10?"s":","),typeof h!="function"&&(!(s%1)&&(h=EE(h)).precision==null&&(h.trim=!0),h=a0e(h)),a===1/0)return h;const p=Math.max(1,s*a/t.ticks().length);return x=>{let y=x/o(Math.round(i(x)));return y*sn(_9e(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function b9e(){const e=o0e(vie()).domain([1,10]);return e.copy=()=>HI(e,b9e()).base(e.base()),cp.apply(e,arguments),e}function hCe(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function fCe(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function l0e(e){var t=1,n=e(hCe(t),fCe(t));return n.constant=function(s){return arguments.length?e(hCe(t=+s),fCe(t)):t},hv(n)}function w9e(){var e=l0e(vie());return e.copy=function(){return HI(e,w9e()).constant(e.constant())},cp.apply(e,arguments)}function pCe(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function uOt(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function hOt(e){return e<0?-e*e:e*e}function c0e(e){var t=e(Eu,Eu),n=1;function s(){return n===1?e(Eu,Eu):n===.5?e(uOt,hOt):e(pCe(n),pCe(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,s()):n},hv(t)}function d0e(){var e=c0e(vie());return e.copy=function(){return HI(e,d0e()).exponent(e.exponent())},cp.apply(e,arguments),e}function fOt(){return d0e.apply(null,arguments).exponent(.5)}function mCe(e){return Math.sign(e)*e*e}function pOt(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function j9e(){var e=s0e(),t=[0,1],n=!1,s;function i(o){var l=pOt(e(o));return isNaN(l)?s:n?Math.round(l):l}return i.invert=function(o){return e.invert(mCe(o))},i.domain=function(o){return arguments.length?(e.domain(o),i):e.domain()},i.range=function(o){return arguments.length?(e.range((t=Array.from(o,Are)).map(mCe)),i):t.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(e.clamp(o),i):e.clamp()},i.unknown=function(o){return arguments.length?(s=o,i):s},i.copy=function(){return j9e(e.domain(),t).round(n).clamp(e.clamp()).unknown(s)},cp.apply(i,arguments),hv(i)}function k9e(){var e=[],t=[],n=[],s;function i(){var l=0,a=Math.max(1,t.length);for(n=new Array(a-1);++l0?n[a-1]:e[0],a=n?[s[n-1],t]:[s[p-1],s[p]]},l.unknown=function(h){return arguments.length&&(o=h),l},l.thresholds=function(){return s.slice()},l.copy=function(){return N9e().domain([e,t]).range(i).unknown(o)},cp.apply(hv(l),arguments)}function S9e(){var e=[.5],t=[0,1],n,s=1;function i(o){return o!=null&&o<=o?t[qI(e,o,0,s)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),s=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),s=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var l=t.indexOf(o);return[e[l-1],e[l]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return S9e().domain(e).range(t).unknown(n)},cp.apply(i,arguments)}const ede=new Date,tde=new Date;function Gc(e,t,n,s){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const l=i(o),a=i.ceil(o);return o-l(t(o=new Date(+o),l==null?1:Math.floor(l)),o),i.range=(o,l,a)=>{const h=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o0))return h;let p;do h.push(p=new Date(+o)),t(o,a),e(o);while(pGc(l=>{if(l>=l)for(;e(l),!o(l);)l.setTime(l-1)},(l,a)=>{if(l>=l)if(a<0)for(;++a<=0;)for(;t(l,-1),!o(l););else for(;--a>=0;)for(;t(l,1),!o(l););}),n&&(i.count=(o,l)=>(ede.setTime(+o),tde.setTime(+l),e(ede),e(tde),Math.floor(n(ede,tde))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(s?l=>s(l)%o===0:l=>i.count(0,l)%o===0):i)),i}const Pre=Gc(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Pre.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Gc(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Pre);Pre.range;const Rx=1e3,Uf=Rx*60,Fx=Uf*60,cy=Fx*24,u0e=cy*7,gCe=cy*30,rde=cy*365,Zw=Gc(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Rx)},(e,t)=>(t-e)/Rx,e=>e.getUTCSeconds());Zw.range;const h0e=Gc(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Rx)},(e,t)=>{e.setTime(+e+t*Uf)},(e,t)=>(t-e)/Uf,e=>e.getMinutes());h0e.range;const f0e=Gc(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Uf)},(e,t)=>(t-e)/Uf,e=>e.getUTCMinutes());f0e.range;const p0e=Gc(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Rx-e.getMinutes()*Uf)},(e,t)=>{e.setTime(+e+t*Fx)},(e,t)=>(t-e)/Fx,e=>e.getHours());p0e.range;const m0e=Gc(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Fx)},(e,t)=>(t-e)/Fx,e=>e.getUTCHours());m0e.range;const WI=Gc(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Uf)/cy,e=>e.getDate()-1);WI.range;const _ie=Gc(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/cy,e=>e.getUTCDate()-1);_ie.range;const C9e=Gc(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/cy,e=>Math.floor(e/cy));C9e.range;function ck(e){return Gc(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Uf)/u0e)}const bie=ck(0),Lre=ck(1),mOt=ck(2),gOt=ck(3),TC=ck(4),xOt=ck(5),yOt=ck(6);bie.range;Lre.range;mOt.range;gOt.range;TC.range;xOt.range;yOt.range;function dk(e){return Gc(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/u0e)}const wie=dk(0),Ore=dk(1),vOt=dk(2),_Ot=dk(3),AC=dk(4),bOt=dk(5),wOt=dk(6);wie.range;Ore.range;vOt.range;_Ot.range;AC.range;bOt.range;wOt.range;const g0e=Gc(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());g0e.range;const x0e=Gc(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());x0e.range;const dy=Gc(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());dy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gc(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});dy.range;const uy=Gc(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());uy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gc(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});uy.range;function M9e(e,t,n,s,i,o){const l=[[Zw,1,Rx],[Zw,5,5*Rx],[Zw,15,15*Rx],[Zw,30,30*Rx],[o,1,Uf],[o,5,5*Uf],[o,15,15*Uf],[o,30,30*Uf],[i,1,Fx],[i,3,3*Fx],[i,6,6*Fx],[i,12,12*Fx],[s,1,cy],[s,2,2*cy],[n,1,u0e],[t,1,gCe],[t,3,3*gCe],[e,1,rde]];function a(p,x,y){const b=xA).right(l,b);if(j===l.length)return e.every($fe(p/rde,x/rde,y));if(j===0)return Pre.every(Math.max($fe(p,x,y),1));const[N,C]=l[b/l[j-1][2]53)return null;"w"in Ee||(Ee.w=1),"Z"in Ee?(me=sde(ZM(Ee.y,0,1)),mt=me.getUTCDay(),me=mt>4||mt===0?Ore.ceil(me):Ore(me),me=_ie.offset(me,(Ee.V-1)*7),Ee.y=me.getUTCFullYear(),Ee.m=me.getUTCMonth(),Ee.d=me.getUTCDate()+(Ee.w+6)%7):(me=nde(ZM(Ee.y,0,1)),mt=me.getDay(),me=mt>4||mt===0?Lre.ceil(me):Lre(me),me=WI.offset(me,(Ee.V-1)*7),Ee.y=me.getFullYear(),Ee.m=me.getMonth(),Ee.d=me.getDate()+(Ee.w+6)%7)}else("W"in Ee||"U"in Ee)&&("w"in Ee||(Ee.w="u"in Ee?Ee.u%7:"W"in Ee?1:0),mt="Z"in Ee?sde(ZM(Ee.y,0,1)).getUTCDay():nde(ZM(Ee.y,0,1)).getDay(),Ee.m=0,Ee.d="W"in Ee?(Ee.w+6)%7+Ee.W*7-(mt+5)%7:Ee.w+Ee.U*7-(mt+6)%7);return"Z"in Ee?(Ee.H+=Ee.Z/100|0,Ee.M+=Ee.Z%100,sde(Ee)):nde(Ee)}}function K(Fe,Me,Qe,Ee){for(var Ye=0,me=Me.length,mt=Qe.length,et,nt;Ye=mt)return-1;if(et=Me.charCodeAt(Ye++),et===37){if(et=Me.charAt(Ye++),nt=F[et in xCe?Me.charAt(Ye++):et],!nt||(Ee=nt(Fe,Qe,Ee))<0)return-1}else if(et!=Qe.charCodeAt(Ee++))return-1}return Ee}function Z(Fe,Me,Qe){var Ee=p.exec(Me.slice(Qe));return Ee?(Fe.p=x.get(Ee[0].toLowerCase()),Qe+Ee[0].length):-1}function te(Fe,Me,Qe){var Ee=j.exec(Me.slice(Qe));return Ee?(Fe.w=N.get(Ee[0].toLowerCase()),Qe+Ee[0].length):-1}function ae(Fe,Me,Qe){var Ee=y.exec(Me.slice(Qe));return Ee?(Fe.w=b.get(Ee[0].toLowerCase()),Qe+Ee[0].length):-1}function le(Fe,Me,Qe){var Ee=E.exec(Me.slice(Qe));return Ee?(Fe.m=T.get(Ee[0].toLowerCase()),Qe+Ee[0].length):-1}function ve(Fe,Me,Qe){var Ee=C.exec(Me.slice(Qe));return Ee?(Fe.m=A.get(Ee[0].toLowerCase()),Qe+Ee[0].length):-1}function ne(Fe,Me,Qe){return K(Fe,t,Me,Qe)}function ge(Fe,Me,Qe){return K(Fe,n,Me,Qe)}function ie(Fe,Me,Qe){return K(Fe,s,Me,Qe)}function fe(Fe){return l[Fe.getDay()]}function de(Fe){return o[Fe.getDay()]}function ye(Fe){return h[Fe.getMonth()]}function Ie(Fe){return a[Fe.getMonth()]}function Ne(Fe){return i[+(Fe.getHours()>=12)]}function we(Fe){return 1+~~(Fe.getMonth()/3)}function he(Fe){return l[Fe.getUTCDay()]}function xe(Fe){return o[Fe.getUTCDay()]}function be(Fe){return h[Fe.getUTCMonth()]}function Oe(Fe){return a[Fe.getUTCMonth()]}function Te(Fe){return i[+(Fe.getUTCHours()>=12)]}function Ve(Fe){return 1+~~(Fe.getUTCMonth()/3)}return{format:function(Fe){var Me=q(Fe+="",L);return Me.toString=function(){return Fe},Me},parse:function(Fe){var Me=H(Fe+="",!1);return Me.toString=function(){return Fe},Me},utcFormat:function(Fe){var Me=q(Fe+="",z);return Me.toString=function(){return Fe},Me},utcParse:function(Fe){var Me=H(Fe+="",!0);return Me.toString=function(){return Fe},Me}}}var xCe={"-":"",_:" ",0:"0"},vd=/^\s*\d+/,MOt=/^%/,TOt=/[\\^$*+?|[\]().{}]/g;function so(e,t,n){var s=e<0?"-":"",i=(s?-e:e)+"",o=i.length;return s+(o[t.toLowerCase(),n]))}function EOt(e,t,n){var s=vd.exec(t.slice(n,n+1));return s?(e.w=+s[0],n+s[0].length):-1}function IOt(e,t,n){var s=vd.exec(t.slice(n,n+1));return s?(e.u=+s[0],n+s[0].length):-1}function POt(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.U=+s[0],n+s[0].length):-1}function LOt(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.V=+s[0],n+s[0].length):-1}function OOt(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.W=+s[0],n+s[0].length):-1}function yCe(e,t,n){var s=vd.exec(t.slice(n,n+4));return s?(e.y=+s[0],n+s[0].length):-1}function vCe(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function DOt(e,t,n){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return s?(e.Z=s[1]?0:-(s[2]+(s[3]||"00")),n+s[0].length):-1}function ROt(e,t,n){var s=vd.exec(t.slice(n,n+1));return s?(e.q=s[0]*3-3,n+s[0].length):-1}function FOt(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.m=s[0]-1,n+s[0].length):-1}function _Ce(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.d=+s[0],n+s[0].length):-1}function zOt(e,t,n){var s=vd.exec(t.slice(n,n+3));return s?(e.m=0,e.d=+s[0],n+s[0].length):-1}function bCe(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.H=+s[0],n+s[0].length):-1}function BOt(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.M=+s[0],n+s[0].length):-1}function $Ot(e,t,n){var s=vd.exec(t.slice(n,n+2));return s?(e.S=+s[0],n+s[0].length):-1}function UOt(e,t,n){var s=vd.exec(t.slice(n,n+3));return s?(e.L=+s[0],n+s[0].length):-1}function qOt(e,t,n){var s=vd.exec(t.slice(n,n+6));return s?(e.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function VOt(e,t,n){var s=MOt.exec(t.slice(n,n+1));return s?n+s[0].length:-1}function HOt(e,t,n){var s=vd.exec(t.slice(n));return s?(e.Q=+s[0],n+s[0].length):-1}function WOt(e,t,n){var s=vd.exec(t.slice(n));return s?(e.s=+s[0],n+s[0].length):-1}function wCe(e,t){return so(e.getDate(),t,2)}function GOt(e,t){return so(e.getHours(),t,2)}function KOt(e,t){return so(e.getHours()%12||12,t,2)}function ZOt(e,t){return so(1+WI.count(dy(e),e),t,3)}function T9e(e,t){return so(e.getMilliseconds(),t,3)}function YOt(e,t){return T9e(e,t)+"000"}function XOt(e,t){return so(e.getMonth()+1,t,2)}function QOt(e,t){return so(e.getMinutes(),t,2)}function JOt(e,t){return so(e.getSeconds(),t,2)}function eDt(e){var t=e.getDay();return t===0?7:t}function tDt(e,t){return so(bie.count(dy(e)-1,e),t,2)}function A9e(e){var t=e.getDay();return t>=4||t===0?TC(e):TC.ceil(e)}function rDt(e,t){return e=A9e(e),so(TC.count(dy(e),e)+(dy(e).getDay()===4),t,2)}function nDt(e){return e.getDay()}function sDt(e,t){return so(Lre.count(dy(e)-1,e),t,2)}function iDt(e,t){return so(e.getFullYear()%100,t,2)}function aDt(e,t){return e=A9e(e),so(e.getFullYear()%100,t,2)}function oDt(e,t){return so(e.getFullYear()%1e4,t,4)}function lDt(e,t){var n=e.getDay();return e=n>=4||n===0?TC(e):TC.ceil(e),so(e.getFullYear()%1e4,t,4)}function cDt(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+so(t/60|0,"0",2)+so(t%60,"0",2)}function jCe(e,t){return so(e.getUTCDate(),t,2)}function dDt(e,t){return so(e.getUTCHours(),t,2)}function uDt(e,t){return so(e.getUTCHours()%12||12,t,2)}function hDt(e,t){return so(1+_ie.count(uy(e),e),t,3)}function E9e(e,t){return so(e.getUTCMilliseconds(),t,3)}function fDt(e,t){return E9e(e,t)+"000"}function pDt(e,t){return so(e.getUTCMonth()+1,t,2)}function mDt(e,t){return so(e.getUTCMinutes(),t,2)}function gDt(e,t){return so(e.getUTCSeconds(),t,2)}function xDt(e){var t=e.getUTCDay();return t===0?7:t}function yDt(e,t){return so(wie.count(uy(e)-1,e),t,2)}function I9e(e){var t=e.getUTCDay();return t>=4||t===0?AC(e):AC.ceil(e)}function vDt(e,t){return e=I9e(e),so(AC.count(uy(e),e)+(uy(e).getUTCDay()===4),t,2)}function _Dt(e){return e.getUTCDay()}function bDt(e,t){return so(Ore.count(uy(e)-1,e),t,2)}function wDt(e,t){return so(e.getUTCFullYear()%100,t,2)}function jDt(e,t){return e=I9e(e),so(e.getUTCFullYear()%100,t,2)}function kDt(e,t){return so(e.getUTCFullYear()%1e4,t,4)}function NDt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?AC(e):AC.ceil(e),so(e.getUTCFullYear()%1e4,t,4)}function SDt(){return"+0000"}function kCe(){return"%"}function NCe(e){return+e}function SCe(e){return Math.floor(+e/1e3)}var h4,P9e,L9e;CDt({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function CDt(e){return h4=COt(e),P9e=h4.format,h4.parse,L9e=h4.utcFormat,h4.utcParse,h4}function MDt(e){return new Date(e)}function TDt(e){return e instanceof Date?+e:+new Date(+e)}function y0e(e,t,n,s,i,o,l,a,h,p){var x=s0e(),y=x.invert,b=x.domain,j=p(".%L"),N=p(":%S"),C=p("%I:%M"),A=p("%I %p"),E=p("%a %d"),T=p("%b %d"),L=p("%B"),z=p("%Y");function F(q){return(h(q)t(i/(e.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(i,o)=>y8t(e,o/s))},n.copy=function(){return F9e(t).domain(e)},vy.apply(n,arguments)}function kie(){var e=0,t=.5,n=1,s=1,i,o,l,a,h,p=Eu,x,y=!1,b;function j(C){return isNaN(C=+C)?b:(C=.5+((C=+x(C))-o)*(s*Ct}var U9e=DDt,RDt=Nie,FDt=U9e,zDt=k3;function BDt(e){return e&&e.length?RDt(e,zDt,FDt):void 0}var $Dt=BDt;const Sie=za($Dt);function UDt(e,t){return ee.e^o.s<0?1:-1;for(s=o.d.length,i=e.d.length,t=0,n=se.d[t]^o.s<0?1:-1;return s===i?0:s>i^o.s<0?1:-1};_s.decimalPlaces=_s.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*hl;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};_s.dividedBy=_s.div=function(e){return Jx(this,new this.constructor(e))};_s.dividedToIntegerBy=_s.idiv=function(e){var t=this,n=t.constructor;return Fo(Jx(t,new n(e),0,1),n.precision)};_s.equals=_s.eq=function(e){return!this.cmp(e)};_s.exponent=function(){return Mc(this)};_s.greaterThan=_s.gt=function(e){return this.cmp(e)>0};_s.greaterThanOrEqualTo=_s.gte=function(e){return this.cmp(e)>=0};_s.isInteger=_s.isint=function(){return this.e>this.d.length-2};_s.isNegative=_s.isneg=function(){return this.s<0};_s.isPositive=_s.ispos=function(){return this.s>0};_s.isZero=function(){return this.s===0};_s.lessThan=_s.lt=function(e){return this.cmp(e)<0};_s.lessThanOrEqualTo=_s.lte=function(e){return this.cmp(e)<1};_s.logarithm=_s.log=function(e){var t,n=this,s=n.constructor,i=s.precision,o=i+5;if(e===void 0)e=new s(10);else if(e=new s(e),e.s<1||e.eq(Hh))throw Error(rp+"NaN");if(n.s<1)throw Error(rp+(n.s?"NaN":"-Infinity"));return n.eq(Hh)?new s(0):(kl=!1,t=Jx(IE(n,o),IE(e,o),o),kl=!0,Fo(t,i))};_s.minus=_s.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?G9e(t,e):H9e(t,(e.s=-e.s,e))};_s.modulo=_s.mod=function(e){var t,n=this,s=n.constructor,i=s.precision;if(e=new s(e),!e.s)throw Error(rp+"NaN");return n.s?(kl=!1,t=Jx(n,e,0,1).times(e),kl=!0,n.minus(t)):Fo(new s(n),i)};_s.naturalExponential=_s.exp=function(){return W9e(this)};_s.naturalLogarithm=_s.ln=function(){return IE(this)};_s.negated=_s.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};_s.plus=_s.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?H9e(t,e):G9e(t,(e.s=-e.s,e))};_s.precision=_s.sd=function(e){var t,n,s,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Tj+e);if(t=Mc(i)+1,s=i.d.length-1,n=s*hl+1,s=i.d[s],s){for(;s%10==0;s/=10)n--;for(s=i.d[0];s>=10;s/=10)n++}return e&&t>n?t:n};_s.squareRoot=_s.sqrt=function(){var e,t,n,s,i,o,l,a=this,h=a.constructor;if(a.s<1){if(!a.s)return new h(0);throw Error(rp+"NaN")}for(e=Mc(a),kl=!1,i=Math.sqrt(+a),i==0||i==1/0?(t=mg(a.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=M3((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),s=new h(t)):s=new h(i.toString()),n=h.precision,i=l=n+3;;)if(o=s,s=o.plus(Jx(a,o,l+2)).times(.5),mg(o.d).slice(0,l)===(t=mg(s.d)).slice(0,l)){if(t=t.slice(l-3,l+1),i==l&&t=="4999"){if(Fo(o,n+1,0),o.times(o).eq(a)){s=o;break}}else if(t!="9999")break;l+=4}return kl=!0,Fo(s,n)};_s.times=_s.mul=function(e){var t,n,s,i,o,l,a,h,p,x=this,y=x.constructor,b=x.d,j=(e=new y(e)).d;if(!x.s||!e.s)return new y(0);for(e.s*=x.s,n=x.e+e.e,h=b.length,p=j.length,h=0;){for(t=0,i=h+s;i>s;)a=o[i]+j[s]*b[i-s-1]+t,o[i--]=a%id|0,t=a/id|0;o[i]=(o[i]+t)%id|0}for(;!o[--l];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,kl?Fo(e,y.precision):e};_s.toDecimalPlaces=_s.todp=function(e,t){var n=this,s=n.constructor;return n=new s(n),e===void 0?n:(Rg(e,0,C3),t===void 0?t=s.rounding:Rg(t,0,8),Fo(n,e+Mc(n)+1,t))};_s.toExponential=function(e,t){var n,s=this,i=s.constructor;return e===void 0?n=Xj(s,!0):(Rg(e,0,C3),t===void 0?t=i.rounding:Rg(t,0,8),s=Fo(new i(s),e+1,t),n=Xj(s,!0,e+1)),n};_s.toFixed=function(e,t){var n,s,i=this,o=i.constructor;return e===void 0?Xj(i):(Rg(e,0,C3),t===void 0?t=o.rounding:Rg(t,0,8),s=Fo(new o(i),e+Mc(i)+1,t),n=Xj(s.abs(),!1,e+Mc(s)+1),i.isneg()&&!i.isZero()?"-"+n:n)};_s.toInteger=_s.toint=function(){var e=this,t=e.constructor;return Fo(new t(e),Mc(e)+1,t.rounding)};_s.toNumber=function(){return+this};_s.toPower=_s.pow=function(e){var t,n,s,i,o,l,a=this,h=a.constructor,p=12,x=+(e=new h(e));if(!e.s)return new h(Hh);if(a=new h(a),!a.s){if(e.s<1)throw Error(rp+"Infinity");return a}if(a.eq(Hh))return a;if(s=h.precision,e.eq(Hh))return Fo(a,s);if(t=e.e,n=e.d.length-1,l=t>=n,o=a.s,l){if((n=x<0?-x:x)<=V9e){for(i=new h(Hh),t=Math.ceil(s/hl+4),kl=!1;n%2&&(i=i.times(a),TCe(i.d,t)),n=M3(n/2),n!==0;)a=a.times(a),TCe(a.d,t);return kl=!0,e.s<0?new h(Hh).div(i):Fo(i,s)}}else if(o<0)throw Error(rp+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,a.s=1,kl=!1,i=e.times(IE(a,s+p)),kl=!0,i=W9e(i),i.s=o,i};_s.toPrecision=function(e,t){var n,s,i=this,o=i.constructor;return e===void 0?(n=Mc(i),s=Xj(i,n<=o.toExpNeg||n>=o.toExpPos)):(Rg(e,1,C3),t===void 0?t=o.rounding:Rg(t,0,8),i=Fo(new o(i),e,t),n=Mc(i),s=Xj(i,e<=n||n<=o.toExpNeg,e)),s};_s.toSignificantDigits=_s.tosd=function(e,t){var n=this,s=n.constructor;return e===void 0?(e=s.precision,t=s.rounding):(Rg(e,1,C3),t===void 0?t=s.rounding:Rg(t,0,8)),Fo(new s(n),e,t)};_s.toString=_s.valueOf=_s.val=_s.toJSON=_s[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Mc(e),n=e.constructor;return Xj(e,t<=n.toExpNeg||t>=n.toExpPos)};function H9e(e,t){var n,s,i,o,l,a,h,p,x=e.constructor,y=x.precision;if(!e.s||!t.s)return t.s||(t=new x(e)),kl?Fo(t,y):t;if(h=e.d,p=t.d,l=e.e,i=t.e,h=h.slice(),o=l-i,o){for(o<0?(s=h,o=-o,a=p.length):(s=p,i=l,a=h.length),l=Math.ceil(y/hl),a=l>a?l+1:a+1,o>a&&(o=a,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(a=h.length,o=p.length,a-o<0&&(o=a,s=p,p=h,h=s),n=0;o;)n=(h[--o]=h[o]+p[o]+n)/id|0,h[o]%=id;for(n&&(h.unshift(n),++i),a=h.length;h[--a]==0;)h.pop();return t.d=h,t.e=i,kl?Fo(t,y):t}function Rg(e,t,n){if(e!==~~e||en)throw Error(Tj+e)}function mg(e){var t,n,s,i=e.length-1,o="",l=e[0];if(i>0){for(o+=l,t=1;tl?1:-1;else for(a=h=0;ai[a]?1:-1;break}return h}function n(s,i,o){for(var l=0;o--;)s[o]-=l,l=s[o]1;)s.shift()}return function(s,i,o,l){var a,h,p,x,y,b,j,N,C,A,E,T,L,z,F,q,H,K,Z=s.constructor,te=s.s==i.s?1:-1,ae=s.d,le=i.d;if(!s.s)return new Z(s);if(!i.s)throw Error(rp+"Division by zero");for(h=s.e-i.e,H=le.length,F=ae.length,j=new Z(te),N=j.d=[],p=0;le[p]==(ae[p]||0);)++p;if(le[p]>(ae[p]||0)&&--h,o==null?T=o=Z.precision:l?T=o+(Mc(s)-Mc(i))+1:T=o,T<0)return new Z(0);if(T=T/hl+2|0,p=0,H==1)for(x=0,le=le[0],T++;(p1&&(le=e(le,x),ae=e(ae,x),H=le.length,F=ae.length),z=H,C=ae.slice(0,H),A=C.length;A=id/2&&++q;do x=0,a=t(le,C,H,A),a<0?(E=C[0],H!=A&&(E=E*id+(C[1]||0)),x=E/q|0,x>1?(x>=id&&(x=id-1),y=e(le,x),b=y.length,A=C.length,a=t(y,C,b,A),a==1&&(x--,n(y,H16)throw Error(b0e+Mc(e));if(!e.s)return new x(Hh);for(kl=!1,a=y,l=new x(.03125);e.abs().gte(.1);)e=e.times(l),p+=5;for(s=Math.log(Ew(2,p))/Math.LN10*2+5|0,a+=s,n=i=o=new x(Hh),x.precision=a;;){if(i=Fo(i.times(e),a),n=n.times(++h),l=o.plus(Jx(i,n,a)),mg(l.d).slice(0,a)===mg(o.d).slice(0,a)){for(;p--;)o=Fo(o.times(o),a);return x.precision=y,t==null?(kl=!0,Fo(o,y)):o}o=l}}function Mc(e){for(var t=e.e*hl,n=e.d[0];n>=10;n/=10)t++;return t}function ide(e,t,n){if(t>e.LN10.sd())throw kl=!0,n&&(e.precision=n),Error(rp+"LN10 precision limit exceeded");return Fo(new e(e.LN10),t)}function k0(e){for(var t="";e--;)t+="0";return t}function IE(e,t){var n,s,i,o,l,a,h,p,x,y=1,b=10,j=e,N=j.d,C=j.constructor,A=C.precision;if(j.s<1)throw Error(rp+(j.s?"NaN":"-Infinity"));if(j.eq(Hh))return new C(0);if(t==null?(kl=!1,p=A):p=t,j.eq(10))return t==null&&(kl=!0),ide(C,p);if(p+=b,C.precision=p,n=mg(N),s=n.charAt(0),o=Mc(j),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)j=j.times(e),n=mg(j.d),s=n.charAt(0),y++;o=Mc(j),s>1?(j=new C("0."+n),o++):j=new C(s+"."+n.slice(1))}else return h=ide(C,p+2,A).times(o+""),j=IE(new C(s+"."+n.slice(1)),p-b).plus(h),C.precision=A,t==null?(kl=!0,Fo(j,A)):j;for(a=l=j=Jx(j.minus(Hh),j.plus(Hh),p),x=Fo(j.times(j),p),i=3;;){if(l=Fo(l.times(x),p),h=a.plus(Jx(l,new C(i),p)),mg(h.d).slice(0,p)===mg(a.d).slice(0,p))return a=a.times(2),o!==0&&(a=a.plus(ide(C,p+2,A).times(o+""))),a=Jx(a,new C(y),p),C.precision=A,t==null?(kl=!0,Fo(a,A)):a;a=h,i+=2}}function MCe(e,t){var n,s,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(n<0&&(n=s),n+=+t.slice(s+1),t=t.substring(0,s)):n<0&&(n=t.length),s=0;t.charCodeAt(s)===48;)++s;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(s,i),t){if(i-=s,n=n-s-1,e.e=M3(n/hl),e.d=[],s=(n+1)%hl,n<0&&(s+=hl),sDre||e.e<-Dre))throw Error(b0e+n)}else e.s=0,e.e=0,e.d=[0];return e}function Fo(e,t,n){var s,i,o,l,a,h,p,x,y=e.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(s=t-l,s<0)s+=hl,i=t,p=y[x=0];else{if(x=Math.ceil((s+1)/hl),o=y.length,x>=o)return e;for(p=o=y[x],l=1;o>=10;o/=10)l++;s%=hl,i=s-hl+l}if(n!==void 0&&(o=Ew(10,l-i-1),a=p/o%10|0,h=t<0||y[x+1]!==void 0||p%o,h=n<4?(a||h)&&(n==0||n==(e.s<0?3:2)):a>5||a==5&&(n==4||h||n==6&&(s>0?i>0?p/Ew(10,l-i):0:y[x-1])%10&1||n==(e.s<0?8:7))),t<1||!y[0])return h?(o=Mc(e),y.length=1,t=t-o-1,y[0]=Ew(10,(hl-t%hl)%hl),e.e=M3(-t/hl)||0):(y.length=1,y[0]=e.e=e.s=0),e;if(s==0?(y.length=x,o=1,x--):(y.length=x+1,o=Ew(10,hl-s),y[x]=i>0?(p/Ew(10,l-i)%Ew(10,i)|0)*o:0),h)for(;;)if(x==0){(y[0]+=o)==id&&(y[0]=1,++e.e);break}else{if(y[x]+=o,y[x]!=id)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(kl&&(e.e>Dre||e.e<-Dre))throw Error(b0e+Mc(e));return e}function G9e(e,t){var n,s,i,o,l,a,h,p,x,y,b=e.constructor,j=b.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new b(e),kl?Fo(t,j):t;if(h=e.d,y=t.d,s=t.e,p=e.e,h=h.slice(),l=p-s,l){for(x=l<0,x?(n=h,l=-l,a=y.length):(n=y,s=p,a=h.length),i=Math.max(Math.ceil(j/hl),a)+2,l>i&&(l=i,n.length=1),n.reverse(),i=l;i--;)n.push(0);n.reverse()}else{for(i=h.length,a=y.length,x=i0;--i)h[a++]=0;for(i=y.length;i>l;){if(h[--i]0?o=o.charAt(0)+"."+o.slice(1)+k0(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+k0(-i-1)+o,n&&(s=n-l)>0&&(o+=k0(s))):i>=l?(o+=k0(i+1-l),n&&(s=n-i-1)>0&&(o=o+"."+k0(s))):((s=i+1)0&&(i+1===l&&(o+="."),o+=k0(s))),e.s<0?"-"+o:o}function TCe(e,t){if(e.length>t)return e.length=t,!0}function K9e(e){var t,n,s;function i(o){var l=this;if(!(l instanceof i))return new i(o);if(l.constructor=i,o instanceof i){l.s=o.s,l.e=o.e,l.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Tj+o);if(o>0)l.s=1;else if(o<0)o=-o,l.s=-1;else{l.s=0,l.e=0,l.d=[0];return}if(o===~~o&&o<1e7){l.e=0,l.d=[o];return}return MCe(l,o.toString())}else if(typeof o!="string")throw Error(Tj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,cRt.test(o))MCe(l,o);else throw Error(Tj+o)}if(i.prototype=_s,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=K9e,i.config=i.set=dRt,e===void 0&&(e={}),e)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&s<=i[t+2])this[n]=s;else throw Error(Tj+n+": "+s);if((s=e[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(Tj+n+": "+s);return this}var w0e=K9e(lRt);Hh=new w0e(1);const Io=w0e;function uRt(e){return mRt(e)||pRt(e)||fRt(e)||hRt()}function hRt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fRt(e,t){if(e){if(typeof e=="string")return Wfe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wfe(e,t)}}function pRt(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function mRt(e){if(Array.isArray(e))return Wfe(e)}function Wfe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=t?n.apply(void 0,i):e(t-l,ACe(function(){for(var a=arguments.length,h=new Array(a),p=0;pe.length)&&(t=e.length);for(var n=0,s=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,i=!1,o=void 0;try{for(var l=e[Symbol.iterator](),a;!(s=(a=l.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(h){i=!0,o=h}finally{try{!s&&l.return!=null&&l.return()}finally{if(i)throw o}}return n}}function ARt(e){if(Array.isArray(e))return e}function J9e(e){var t=PE(e,2),n=t[0],s=t[1],i=n,o=s;return n>s&&(i=s,o=n),[i,o]}function eBe(e,t,n){if(e.lte(0))return new Io(0);var s=Aie.getDigitCount(e.toNumber()),i=new Io(10).pow(s),o=e.div(i),l=s!==1?.05:.1,a=new Io(Math.ceil(o.div(l).toNumber())).add(n).mul(l),h=a.mul(i);return t?h:new Io(Math.ceil(h))}function ERt(e,t,n){var s=1,i=new Io(e);if(!i.isint()&&n){var o=Math.abs(e);o<1?(s=new Io(10).pow(Aie.getDigitCount(e)-1),i=new Io(Math.floor(i.div(s).toNumber())).mul(s)):o>1&&(i=new Io(Math.floor(e)))}else e===0?i=new Io(Math.floor((t-1)/2)):n||(i=new Io(Math.floor(e)));var l=Math.floor((t-1)/2),a=vRt(yRt(function(h){return i.add(new Io(h-l).mul(s)).toNumber()}),Gfe);return a(0,t)}function tBe(e,t,n,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Io(0),tickMin:new Io(0),tickMax:new Io(0)};var o=eBe(new Io(t).sub(e).div(n-1),s,i),l;e<=0&&t>=0?l=new Io(0):(l=new Io(e).add(t).div(2),l=l.sub(new Io(l).mod(o)));var a=Math.ceil(l.sub(e).div(o).toNumber()),h=Math.ceil(new Io(t).sub(l).div(o).toNumber()),p=a+h+1;return p>n?tBe(e,t,n,s,i+1):(p0?h+(n-p):h,a=t>0?a:a+(n-p)),{step:o,tickMin:l.sub(new Io(a).mul(o)),tickMax:l.add(new Io(h).mul(o))})}function IRt(e){var t=PE(e,2),n=t[0],s=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Math.max(i,2),a=J9e([n,s]),h=PE(a,2),p=h[0],x=h[1];if(p===-1/0||x===1/0){var y=x===1/0?[p].concat(Zfe(Gfe(0,i-1).map(function(){return 1/0}))):[].concat(Zfe(Gfe(0,i-1).map(function(){return-1/0})),[x]);return n>s?Kfe(y):y}if(p===x)return ERt(p,i,o);var b=tBe(p,x,l,o),j=b.step,N=b.tickMin,C=b.tickMax,A=Aie.rangeStep(N,C.add(new Io(.1).mul(j)),j);return n>s?Kfe(A):A}function PRt(e,t){var n=PE(e,2),s=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=J9e([s,i]),a=PE(l,2),h=a[0],p=a[1];if(h===-1/0||p===1/0)return[s,i];if(h===p)return[h];var x=Math.max(t,2),y=eBe(new Io(p).sub(h).div(x-1),o,0),b=[].concat(Zfe(Aie.rangeStep(new Io(h),new Io(p).sub(new Io(.99).mul(y)),y)),[p]);return s>i?Kfe(b):b}var LRt=X9e(IRt),ORt=X9e(PRt),DRt="Invariant failed";function Qj(e,t){throw new Error(DRt)}var RRt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function EC(e){"@babel/helpers - typeof";return EC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},EC(e)}function Rre(){return Rre=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function VRt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function HRt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function WRt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=-1,a=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(a<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var h=o.range,p=0;p0?i[p-1].coordinate:i[a-1].coordinate,y=i[p].coordinate,b=p>=a-1?i[0].coordinate:i[p+1].coordinate,j=void 0;if(Tu(y-x)!==Tu(b-y)){var N=[];if(Tu(b-y)===Tu(h[1]-h[0])){j=b;var C=y+h[1]-h[0];N[0]=Math.min(C,(C+x)/2),N[1]=Math.max(C,(C+x)/2)}else{j=x;var A=b+h[1]-h[0];N[0]=Math.min(y,(A+y)/2),N[1]=Math.max(y,(A+y)/2)}var E=[Math.min(y,(j+y)/2),Math.max(y,(j+y)/2)];if(t>E[0]&&t<=E[1]||t>=N[0]&&t<=N[1]){l=i[p].index;break}}else{var T=Math.min(x,b),L=Math.max(x,b);if(t>(T+y)/2&&t<=(L+y)/2){l=i[p].index;break}}}else for(var z=0;z0&&z(s[z].coordinate+s[z-1].coordinate)/2&&t<=(s[z].coordinate+s[z+1].coordinate)/2||z===a-1&&t>(s[z].coordinate+s[z-1].coordinate)/2){l=s[z].index;break}return l},j0e=function(t){var n,s=t,i=s.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Wl(Wl({},t.type.defaultProps),t.props):t.props,l=o.stroke,a=o.fill,h;switch(i){case"Line":h=l;break;case"Area":case"Radar":h=l&&l!=="none"?l:a;break;default:h=a;break}return h},cFt=function(t){var n=t.barSize,s=t.totalSize,i=t.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var l={},a=Object.keys(o),h=0,p=a.length;h=0});if(E&&E.length){var T=E[0].type.defaultProps,L=T!==void 0?Wl(Wl({},T),E[0].props):E[0].props,z=L.barSize,F=L[A];l[F]||(l[F]=[]);var q=_a(z)?n:z;l[F].push({item:E[0],stackList:E.slice(1),barSize:_a(q)?void 0:Au(q,s,0)})}}return l},dFt=function(t){var n=t.barGap,s=t.barCategoryGap,i=t.bandSize,o=t.sizeList,l=o===void 0?[]:o,a=t.maxBarSize,h=l.length;if(h<1)return null;var p=Au(n,i,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var b=!1,j=i/h,N=l.reduce(function(z,F){return z+F.barSize||0},0);N+=(h-1)*p,N>=i&&(N-=(h-1)*p,p=0),N>=i&&j>0&&(b=!0,j*=.9,N=h*j);var C=(i-N)/2>>0,A={offset:C-p,size:0};x=l.reduce(function(z,F){var q={item:F.item,position:{offset:A.offset+A.size+p,size:b?j:F.barSize}},H=[].concat(PCe(z),[q]);return A=H[H.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){H.push({item:K,position:A})}),H},y)}else{var E=Au(s,i,0,!0);i-2*E-(h-1)*p<=0&&(p=0);var T=(i-2*E-(h-1)*p)/h;T>1&&(T>>=0);var L=a===+a?Math.min(T,a):T;x=l.reduce(function(z,F,q){var H=[].concat(PCe(z),[{item:F.item,position:{offset:E+(T+p)*q+(T-L)/2,size:L}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(K){H.push({item:K,position:H[H.length-1].position})}),H},y)}return x},uFt=function(t,n,s,i){var o=s.children,l=s.width,a=s.margin,h=l-(a.left||0)-(a.right||0),p=iBe({children:o,legendWidth:h});if(p){var x=i||{},y=x.width,b=x.height,j=p.align,N=p.verticalAlign,C=p.layout;if((C==="vertical"||C==="horizontal"&&N==="middle")&&j!=="center"&&Dn(t[j]))return Wl(Wl({},t),{},DS({},j,t[j]+(y||0)));if((C==="horizontal"||C==="vertical"&&j==="center")&&N!=="middle"&&Dn(t[N]))return Wl(Wl({},t),{},DS({},N,t[N]+(b||0)))}return t},hFt=function(t,n,s){return _a(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},aBe=function(t,n,s,i,o){var l=n.props.children,a=Jf(l,Eie).filter(function(p){return hFt(i,o,p.props.direction)});if(a&&a.length){var h=a.map(function(p){return p.props.dataKey});return t.reduce(function(p,x){var y=Xd(x,s);if(_a(y))return p;var b=Array.isArray(y)?[Cie(y),Sie(y)]:[y,y],j=h.reduce(function(N,C){var A=Xd(x,C,0),E=b[0]-Math.abs(Array.isArray(A)?A[0]:A),T=b[1]+Math.abs(Array.isArray(A)?A[1]:A);return[Math.min(E,N[0]),Math.max(T,N[1])]},[1/0,-1/0]);return[Math.min(j[0],p[0]),Math.max(j[1],p[1])]},[1/0,-1/0])}return null},fFt=function(t,n,s,i,o){var l=n.map(function(a){return aBe(t,a,s,o,i)}).filter(function(a){return!_a(a)});return l&&l.length?l.reduce(function(a,h){return[Math.min(a[0],h[0]),Math.max(a[1],h[1])]},[1/0,-1/0]):null},oBe=function(t,n,s,i,o){var l=n.map(function(h){var p=h.props.dataKey;return s==="number"&&p&&aBe(t,h,p,i)||kA(t,p,s,o)});if(s==="number")return l.reduce(function(h,p){return[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);var a={};return l.reduce(function(h,p){for(var x=0,y=p.length;x=2?Tu(a[0]-a[1])*2*p:p,n&&(t.ticks||t.niceTicks)){var x=(t.ticks||t.niceTicks).map(function(y){var b=o?o.indexOf(y):y;return{coordinate:i(b)+p,value:y,offset:p}});return x.filter(function(y){return!BI(y.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(y,b){return{coordinate:i(y)+p,value:y,index:b,offset:p}}):i.ticks&&!s?i.ticks(t.tickCount).map(function(y){return{coordinate:i(y)+p,value:y,offset:p}}):i.domain().map(function(y,b){return{coordinate:i(y)+p,value:o?o[y]:y,index:b,offset:p}})},ade=new WeakMap,YL=function(t,n){if(typeof n!="function")return t;ade.has(t)||ade.set(t,new WeakMap);var s=ade.get(t);if(s.has(n))return s.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,i),i},dBe=function(t,n,s){var i=t.scale,o=t.type,l=t.layout,a=t.axisType;if(i==="auto")return l==="radial"&&a==="radiusAxis"?{scale:CE(),realScaleType:"band"}:l==="radial"&&a==="angleAxis"?{scale:Ire(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:jA(),realScaleType:"point"}:o==="category"?{scale:CE(),realScaleType:"band"}:{scale:Ire(),realScaleType:"linear"};if(Kj(i)){var h="scale".concat(uie(i));return{scale:(CCe[h]||jA)(),realScaleType:CCe[h]?h:"point"}}return Ri(i)?{scale:i}:{scale:jA(),realScaleType:"point"}},OCe=1e-4,uBe=function(t){var n=t.domain();if(!(!n||n.length<=2)){var s=n.length,i=t.range(),o=Math.min(i[0],i[1])-OCe,l=Math.max(i[0],i[1])+OCe,a=t(n[0]),h=t(n[s-1]);(al||hl)&&t.domain([n[0],n[s-1]])}},pFt=function(t,n){if(!t)return null;for(var s=0,i=t.length;si)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(t[a][s][0]=o,t[a][s][1]=o+h,o=t[a][s][1]):(t[a][s][0]=l,t[a][s][1]=l+h,l=t[a][s][1])}},xFt=function(t){var n=t.length;if(!(n<=0))for(var s=0,i=t[0].length;s=0?(t[l][s][0]=o,t[l][s][1]=o+a,o=t[l][s][1]):(t[l][s][0]=0,t[l][s][1]=0)}},yFt={sign:gFt,expand:R3t,none:jC,silhouette:F3t,wiggle:z3t,positive:xFt},vFt=function(t,n,s){var i=n.map(function(a){return a.props.dataKey}),o=yFt[s],l=D3t().keys(i).value(function(a,h){return+Xd(a,h,0)}).order(wfe).offset(o);return l(t)},_Ft=function(t,n,s,i,o,l){if(!t)return null;var a=l?n.reverse():n,h={},p=a.reduce(function(y,b){var j,N=(j=b.type)!==null&&j!==void 0&&j.defaultProps?Wl(Wl({},b.type.defaultProps),b.props):b.props,C=N.stackId,A=N.hide;if(A)return y;var E=N[s],T=y[E]||{hasStack:!1,stackGroups:{}};if(Uc(C)){var L=T.stackGroups[C]||{numericAxisId:s,cateAxisId:i,items:[]};L.items.push(b),T.hasStack=!0,T.stackGroups[C]=L}else T.stackGroups[$I("_stackId_")]={numericAxisId:s,cateAxisId:i,items:[b]};return Wl(Wl({},y),{},DS({},E,T))},h),x={};return Object.keys(p).reduce(function(y,b){var j=p[b];if(j.hasStack){var N={};j.stackGroups=Object.keys(j.stackGroups).reduce(function(C,A){var E=j.stackGroups[A];return Wl(Wl({},C),{},DS({},A,{numericAxisId:s,cateAxisId:i,items:E.items,stackedData:vFt(t,E.items,o)}))},N)}return Wl(Wl({},y),{},DS({},b,j))},x)},hBe=function(t,n){var s=n.realScaleType,i=n.type,o=n.tickCount,l=n.originalDomain,a=n.allowDecimals,h=s||n.scale;if(h!=="auto"&&h!=="linear")return null;if(o&&i==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var p=t.domain();if(!p.length)return null;var x=LRt(p,o,a);return t.domain([Cie(x),Sie(x)]),{niceTicks:x}}if(o&&i==="number"){var y=t.domain(),b=ORt(y,o,a);return{niceTicks:b}}return null},DCe=function(t){var n=t.axis,s=t.ticks,i=t.offset,o=t.bandSize,l=t.entry,a=t.index;if(n.type==="category")return s[a]?s[a].coordinate+i:null;var h=Xd(l,n.dataKey,n.domain[a]);return _a(h)?null:n.scale(h)-o/2+i},bFt=function(t){var n=t.numericAxis,s=n.scale.domain();if(n.type==="number"){var i=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return i<=0&&o>=0?0:o<0?o:i}return s[0]},wFt=function(t,n){var s,i=(s=t.type)!==null&&s!==void 0&&s.defaultProps?Wl(Wl({},t.type.defaultProps),t.props):t.props,o=i.stackId;if(Uc(o)){var l=n[o];if(l){var a=l.items.indexOf(t);return a>=0?l.stackedData[a]:null}}return null},jFt=function(t){return t.reduce(function(n,s){return[Cie(s.concat([n[0]]).filter(Dn)),Sie(s.concat([n[1]]).filter(Dn))]},[1/0,-1/0])},fBe=function(t,n,s){return Object.keys(t).reduce(function(i,o){var l=t[o],a=l.stackedData,h=a.reduce(function(p,x){var y=jFt(x.slice(n,s+1));return[Math.min(p[0],y[0]),Math.max(p[1],y[1])]},[1/0,-1/0]);return[Math.min(h[0],i[0]),Math.max(h[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},RCe=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,FCe=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Jfe=function(t,n,s){if(Ri(t))return t(n,s);if(!Array.isArray(t))return n;var i=[];if(Dn(t[0]))i[0]=s?t[0]:Math.min(t[0],n[0]);else if(RCe.test(t[0])){var o=+RCe.exec(t[0])[1];i[0]=n[0]-o}else Ri(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(Dn(t[1]))i[1]=s?t[1]:Math.max(t[1],n[1]);else if(FCe.test(t[1])){var l=+FCe.exec(t[1])[1];i[1]=n[1]+l}else Ri(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},zre=function(t,n,s){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!s||i>0)return i}if(t&&n&&n.length>=2){for(var o=Xye(n,function(y){return y.coordinate}),l=1/0,a=1,h=o.length;ae.length)&&(t=e.length);for(var n=0,s=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(s.left||0)-(s.right||0)),Math.abs(n-(s.top||0)-(s.bottom||0)))/2},IFt=function(t,n,s,i,o){var l=t.width,a=t.height,h=t.startAngle,p=t.endAngle,x=Au(t.cx,l,l/2),y=Au(t.cy,a,a/2),b=gBe(l,a,s),j=Au(t.innerRadius,b,0),N=Au(t.outerRadius,b,b*.8),C=Object.keys(n);return C.reduce(function(A,E){var T=n[E],L=T.domain,z=T.reversed,F;if(_a(T.range))i==="angleAxis"?F=[h,p]:i==="radiusAxis"&&(F=[j,N]),z&&(F=[F[1],F[0]]);else{F=T.range;var q=F,H=SFt(q,2);h=H[0],p=H[1]}var K=dBe(T,o),Z=K.realScaleType,te=K.scale;te.domain(L).range(F),uBe(te);var ae=hBe(te,Nx(Nx({},T),{},{realScaleType:Z})),le=Nx(Nx(Nx({},T),ae),{},{range:F,radius:N,realScaleType:Z,scale:te,cx:x,cy:y,innerRadius:j,outerRadius:N,startAngle:h,endAngle:p});return Nx(Nx({},A),{},mBe({},E,le))},{})},PFt=function(t,n){var s=t.x,i=t.y,o=n.x,l=n.y;return Math.sqrt(Math.pow(s-o,2)+Math.pow(i-l,2))},LFt=function(t,n){var s=t.x,i=t.y,o=n.cx,l=n.cy,a=PFt({x:s,y:i},{x:o,y:l});if(a<=0)return{radius:a};var h=(s-o)/a,p=Math.acos(h);return i>l&&(p=2*Math.PI-p),{radius:a,angle:EFt(p),angleInRadian:p}},OFt=function(t){var n=t.startAngle,s=t.endAngle,i=Math.floor(n/360),o=Math.floor(s/360),l=Math.min(i,o);return{startAngle:n-l*360,endAngle:s-l*360}},DFt=function(t,n){var s=n.startAngle,i=n.endAngle,o=Math.floor(s/360),l=Math.floor(i/360),a=Math.min(o,l);return t+a*360},UCe=function(t,n){var s=t.x,i=t.y,o=LFt({x:s,y:i},n),l=o.radius,a=o.angle,h=n.innerRadius,p=n.outerRadius;if(lp)return!1;if(l===0)return!0;var x=OFt(n),y=x.startAngle,b=x.endAngle,j=a,N;if(y<=b){for(;j>b;)j-=360;for(;j=y&&j<=b}else{for(;j>y;)j-=360;for(;j=b&&j<=y}return N?Nx(Nx({},n),{},{radius:l,angle:DFt(j,n)}):null},xBe=function(t){return!I.isValidElement(t)&&!Ri(t)&&typeof t!="boolean"?t.className:""};function RE(e){"@babel/helpers - typeof";return RE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},RE(e)}var RFt=["offset"];function FFt(e){return UFt(e)||$Ft(e)||BFt(e)||zFt()}function zFt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BFt(e,t){if(e){if(typeof e=="string")return epe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return epe(e,t)}}function $Ft(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function UFt(e){if(Array.isArray(e))return epe(e)}function epe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function VFt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function qCe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Lc(e){for(var t=1;t=0?1:-1,L,z;i==="insideStart"?(L=j+T*l,z=C):i==="insideEnd"?(L=N-T*l,z=!C):i==="end"&&(L=N+T*l,z=C),z=E<=0?z:!z;var F=Xo(p,x,A,L),q=Xo(p,x,A,L+(z?1:-1)*359),H="M".concat(F.x,",").concat(F.y,` A`).concat(A,",").concat(A,",0,1,").concat(z?0:1,`, `).concat(q.x,",").concat(q.y),K=_a(t.id)?$I("recharts-radial-line-"):t.id;return rt.createElement("text",FE({},s,{dominantBaseline:"central",className:ra("recharts-radial-bar-label",a)}),rt.createElement("defs",null,rt.createElement("path",{id:K,d:H})),rt.createElement("textPath",{xlinkHref:"#".concat(K)},n))},XFt=function(t){var n=t.viewBox,s=t.offset,i=t.position,o=n,l=o.cx,a=o.cy,h=o.innerRadius,p=o.outerRadius,x=o.startAngle,y=o.endAngle,b=(x+y)/2;if(i==="outside"){var j=Xo(l,a,p+s,b),N=j.x,C=j.y;return{x:N,y:C,textAnchor:N>=l?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:l,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:l,y:a,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:l,y:a,textAnchor:"middle",verticalAnchor:"end"};var A=(h+p)/2,E=Xo(l,a,A,b),T=E.x,L=E.y;return{x:T,y:L,textAnchor:"middle",verticalAnchor:"middle"}},QFt=function(t){var n=t.viewBox,s=t.parentViewBox,i=t.offset,o=t.position,l=n,a=l.x,h=l.y,p=l.width,x=l.height,y=x>=0?1:-1,b=y*i,j=y>0?"end":"start",N=y>0?"start":"end",C=p>=0?1:-1,A=C*i,E=C>0?"end":"start",T=C>0?"start":"end";if(o==="top"){var L={x:a+p/2,y:h-y*i,textAnchor:"middle",verticalAnchor:j};return Lc(Lc({},L),s?{height:Math.max(h-s.y,0),width:p}:{})}if(o==="bottom"){var z={x:a+p/2,y:h+x+b,textAnchor:"middle",verticalAnchor:N};return Lc(Lc({},z),s?{height:Math.max(s.y+s.height-(h+x),0),width:p}:{})}if(o==="left"){var F={x:a-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"};return Lc(Lc({},F),s?{width:Math.max(F.x-s.x,0),height:x}:{})}if(o==="right"){var q={x:a+p+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"};return Lc(Lc({},q),s?{width:Math.max(s.x+s.width-q.x,0),height:x}:{})}var H=s?{width:p,height:x}:{};return o==="insideLeft"?Lc({x:a+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"},H):o==="insideRight"?Lc({x:a+p-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"},H):o==="insideTop"?Lc({x:a+p/2,y:h+b,textAnchor:"middle",verticalAnchor:N},H):o==="insideBottom"?Lc({x:a+p/2,y:h+x-b,textAnchor:"middle",verticalAnchor:j},H):o==="insideTopLeft"?Lc({x:a+A,y:h+b,textAnchor:T,verticalAnchor:N},H):o==="insideTopRight"?Lc({x:a+p-A,y:h+b,textAnchor:E,verticalAnchor:N},H):o==="insideBottomLeft"?Lc({x:a+A,y:h+x-b,textAnchor:T,verticalAnchor:j},H):o==="insideBottomRight"?Lc({x:a+p-A,y:h+x-b,textAnchor:E,verticalAnchor:j},H):y3(o)&&(Dn(o.x)||Gw(o.x))&&(Dn(o.y)||Gw(o.y))?Lc({x:a+Au(o.x,p),y:h+Au(o.y,x),textAnchor:"end",verticalAnchor:"end"},H):Lc({x:a+p/2,y:h+x/2,textAnchor:"middle",verticalAnchor:"middle"},H)},JFt=function(t){return"cx"in t&&Dn(t.cx)};function ld(e){var t=e.offset,n=t===void 0?5:t,s=qFt(e,RFt),i=Lc({offset:n},s),o=i.viewBox,l=i.position,a=i.value,h=i.children,p=i.content,x=i.className,y=x===void 0?"":x,b=i.textBreakAll;if(!o||_a(a)&&_a(h)&&!I.isValidElement(p)&&!Ri(p))return null;if(I.isValidElement(p))return I.cloneElement(p,i);var j;if(Ri(p)){if(j=I.createElement(p,i),I.isValidElement(j))return j}else j=KFt(i);var N=JFt(o),C=Ai(i,!0);if(N&&(l==="insideStart"||l==="insideEnd"||l==="end"))return YFt(i,j,C);var A=N?XFt(i):QFt(i);return rt.createElement(Yj,FE({className:ra("recharts-label",y)},C,A,{breakAll:b}),j)}ld.displayName="Label";var yBe=function(t){var n=t.cx,s=t.cy,i=t.angle,o=t.startAngle,l=t.endAngle,a=t.r,h=t.radius,p=t.innerRadius,x=t.outerRadius,y=t.x,b=t.y,j=t.top,N=t.left,C=t.width,A=t.height,E=t.clockWise,T=t.labelViewBox;if(T)return T;if(Dn(C)&&Dn(A)){if(Dn(y)&&Dn(b))return{x:y,y:b,width:C,height:A};if(Dn(j)&&Dn(N))return{x:j,y:N,width:C,height:A}}return Dn(y)&&Dn(b)?{x:y,y:b,width:0,height:0}:Dn(n)&&Dn(s)?{cx:n,cy:s,startAngle:o||i||0,endAngle:l||i||0,innerRadius:p||0,outerRadius:x||h||a||0,clockWise:E}:t.viewBox?t.viewBox:{}},ezt=function(t,n){return t?t===!0?rt.createElement(ld,{key:"label-implicit",viewBox:n}):Uc(t)?rt.createElement(ld,{key:"label-implicit",viewBox:n,value:t}):I.isValidElement(t)?t.type===ld?I.cloneElement(t,{key:"label-implicit",viewBox:n}):rt.createElement(ld,{key:"label-implicit",content:t,viewBox:n}):Ri(t)?rt.createElement(ld,{key:"label-implicit",content:t,viewBox:n}):y3(t)?rt.createElement(ld,FE({viewBox:n},t,{key:"label-implicit"})):null:null},tzt=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&s&&!t.label)return null;var i=t.children,o=yBe(t),l=Jf(i,ld).map(function(h,p){return I.cloneElement(h,{viewBox:n||o,key:"label-".concat(p)})});if(!s)return l;var a=ezt(t.label,n||o);return[a].concat(FFt(l))};ld.parseViewBox=yBe;ld.renderCallByParent=tzt;function rzt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var nzt=rzt;const szt=za(nzt);function zE(e){"@babel/helpers - typeof";return zE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zE(e)}var izt=["valueAccessor"],azt=["data","dataKey","clockWise","id","textBreakAll"];function ozt(e){return uzt(e)||dzt(e)||czt(e)||lzt()}function lzt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function czt(e,t){if(e){if(typeof e=="string")return tpe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tpe(e,t)}}function dzt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function uzt(e){if(Array.isArray(e))return tpe(e)}function tpe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function mzt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var gzt=function(t){return Array.isArray(t.value)?szt(t.value):t.value};function I1(e){var t=e.valueAccessor,n=t===void 0?gzt:t,s=WCe(e,izt),i=s.data,o=s.dataKey,l=s.clockWise,a=s.id,h=s.textBreakAll,p=WCe(s,azt);return!i||!i.length?null:rt.createElement(ko,{className:"recharts-label-list"},i.map(function(x,y){var b=_a(o)?n(x,y):Xd(x&&x.payload,o),j=_a(a)?{}:{id:"".concat(a,"-").concat(y)};return rt.createElement(ld,$re({},Ai(x,!0),p,j,{parentViewBox:x.parentViewBox,value:b,textBreakAll:h,viewBox:ld.parseViewBox(_a(l)?x:HCe(HCe({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}I1.displayName="LabelList";function xzt(e,t){return e?e===!0?rt.createElement(I1,{key:"labelList-implicit",data:t}):rt.isValidElement(e)||Ri(e)?rt.createElement(I1,{key:"labelList-implicit",data:t,content:e}):y3(e)?rt.createElement(I1,$re({data:t},e,{key:"labelList-implicit"})):null:null}function yzt(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var s=e.children,i=Jf(s,I1).map(function(l,a){return I.cloneElement(l,{data:t,key:"labelList-".concat(a)})});if(!n)return i;var o=xzt(e.label,t);return[o].concat(ozt(i))}I1.renderCallByParent=yzt;function BE(e){"@babel/helpers - typeof";return BE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},BE(e)}function rpe(){return rpe=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(l>p),`, `).concat(y.x,",").concat(y.y,` `);if(i>0){var j=Xo(n,s,i,l),N=Xo(n,s,i,p);b+="L ".concat(N.x,",").concat(N.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(h)>180),",").concat(+(l<=p),`, `).concat(j.x,",").concat(j.y," Z")}else b+="L ".concat(n,",").concat(s," Z");return b},jzt=function(t){var n=t.cx,s=t.cy,i=t.innerRadius,o=t.outerRadius,l=t.cornerRadius,a=t.forceCornerRadius,h=t.cornerIsExternal,p=t.startAngle,x=t.endAngle,y=Tu(x-p),b=XL({cx:n,cy:s,radius:o,angle:p,sign:y,cornerRadius:l,cornerIsExternal:h}),j=b.circleTangency,N=b.lineTangency,C=b.theta,A=XL({cx:n,cy:s,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:h}),E=A.circleTangency,T=A.lineTangency,L=A.theta,z=h?Math.abs(p-x):Math.abs(p-x)-C-L;if(z<0)return a?"M ".concat(N.x,",").concat(N.y,` a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0 a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0 `):vBe({cx:n,cy:s,innerRadius:i,outerRadius:o,startAngle:p,endAngle:x});var F="M ".concat(N.x,",").concat(N.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(j.x,",").concat(j.y,` A`).concat(o,",").concat(o,",0,").concat(+(z>180),",").concat(+(y<0),",").concat(E.x,",").concat(E.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(T.x,",").concat(T.y,` `);if(i>0){var q=XL({cx:n,cy:s,radius:i,angle:p,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),H=q.circleTangency,K=q.lineTangency,Z=q.theta,te=XL({cx:n,cy:s,radius:i,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),ae=te.circleTangency,le=te.lineTangency,ve=te.theta,ne=h?Math.abs(p-x):Math.abs(p-x)-Z-ve;if(ne<0&&l===0)return"".concat(F,"L").concat(n,",").concat(s,"Z");F+="L".concat(le.x,",").concat(le.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ae.x,",").concat(ae.y,` A`).concat(i,",").concat(i,",0,").concat(+(ne>180),",").concat(+(y>0),",").concat(H.x,",").concat(H.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(K.x,",").concat(K.y,"Z")}else F+="L".concat(n,",").concat(s,"Z");return F},kzt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},_Be=function(t){var n=KCe(KCe({},kzt),t),s=n.cx,i=n.cy,o=n.innerRadius,l=n.outerRadius,a=n.cornerRadius,h=n.forceCornerRadius,p=n.cornerIsExternal,x=n.startAngle,y=n.endAngle,b=n.className;if(l0&&Math.abs(x-y)<360?A=jzt({cx:s,cy:i,innerRadius:o,outerRadius:l,cornerRadius:Math.min(C,N/2),forceCornerRadius:h,cornerIsExternal:p,startAngle:x,endAngle:y}):A=vBe({cx:s,cy:i,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),rt.createElement("path",rpe({},Ai(n,!0),{className:j,d:A,role:"img"}))};function $E(e){"@babel/helpers - typeof";return $E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$E(e)}function npe(){return npe=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[s],t[s],s,s,e,t,n))return!1;return!0}function qzt(e,t){return uk(e.getTime(),t.getTime())}function Vzt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Hzt(e,t){return e===t}function r3e(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var i=new Array(s),o=e.entries(),l,a,h=0;(l=o.next())&&!l.done;){for(var p=t.entries(),x=!1,y=0;(a=p.next())&&!a.done;){if(i[y]){y++;continue}var b=l.value,j=a.value;if(n.equals(b[0],j[0],h,y,e,t,n)&&n.equals(b[1],j[1],b[0],j[0],e,t,n)){x=i[y]=!0;break}y++}if(!x)return!1;h++}return!0}var Wzt=uk;function Gzt(e,t,n){var s=t3e(e),i=s.length;if(t3e(t).length!==i)return!1;for(;i-- >0;)if(!kBe(e,t,n,s[i]))return!1;return!0}function eT(e,t,n){var s=JCe(e),i=s.length;if(JCe(t).length!==i)return!1;for(var o,l,a;i-- >0;)if(o=s[i],!kBe(e,t,n,o)||(l=e3e(e,o),a=e3e(t,o),(l||a)&&(!l||!a||l.configurable!==a.configurable||l.enumerable!==a.enumerable||l.writable!==a.writable)))return!1;return!0}function Kzt(e,t){return uk(e.valueOf(),t.valueOf())}function Zzt(e,t){return e.source===t.source&&e.flags===t.flags}function n3e(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var i=new Array(s),o=e.values(),l,a;(l=o.next())&&!l.done;){for(var h=t.values(),p=!1,x=0;(a=h.next())&&!a.done;){if(!i[x]&&n.equals(l.value,a.value,l.value,a.value,e,t,n)){p=i[x]=!0;break}x++}if(!p)return!1}return!0}function Yzt(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Xzt(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function kBe(e,t,n,s){return(s===$zt||s===Bzt||s===zzt)&&(e.$$typeof||t.$$typeof)?!0:Fzt(t,s)&&n.equals(e[s],t[s],s,s,e,t,n)}var Qzt="[object Arguments]",Jzt="[object Boolean]",e7t="[object Date]",t7t="[object Error]",r7t="[object Map]",n7t="[object Number]",s7t="[object Object]",i7t="[object RegExp]",a7t="[object Set]",o7t="[object String]",l7t="[object URL]",c7t=Array.isArray,s3e=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,i3e=Object.assign,d7t=Object.prototype.toString.call.bind(Object.prototype.toString);function u7t(e){var t=e.areArraysEqual,n=e.areDatesEqual,s=e.areErrorsEqual,i=e.areFunctionsEqual,o=e.areMapsEqual,l=e.areNumbersEqual,a=e.areObjectsEqual,h=e.arePrimitiveWrappersEqual,p=e.areRegExpsEqual,x=e.areSetsEqual,y=e.areTypedArraysEqual,b=e.areUrlsEqual;return function(N,C,A){if(N===C)return!0;if(N==null||C==null)return!1;var E=typeof N;if(E!==typeof C)return!1;if(E!=="object")return E==="number"?l(N,C,A):E==="function"?i(N,C,A):!1;var T=N.constructor;if(T!==C.constructor)return!1;if(T===Object)return a(N,C,A);if(c7t(N))return t(N,C,A);if(s3e!=null&&s3e(N))return y(N,C,A);if(T===Date)return n(N,C,A);if(T===RegExp)return p(N,C,A);if(T===Map)return o(N,C,A);if(T===Set)return x(N,C,A);var L=d7t(N);return L===e7t?n(N,C,A):L===i7t?p(N,C,A):L===r7t?o(N,C,A):L===a7t?x(N,C,A):L===s7t?typeof N.then!="function"&&typeof C.then!="function"&&a(N,C,A):L===l7t?b(N,C,A):L===t7t?s(N,C,A):L===Qzt?a(N,C,A):L===Jzt||L===n7t||L===o7t?h(N,C,A):!1}}function h7t(e){var t=e.circular,n=e.createCustomConfig,s=e.strict,i={areArraysEqual:s?eT:Uzt,areDatesEqual:qzt,areErrorsEqual:Vzt,areFunctionsEqual:Hzt,areMapsEqual:s?QCe(r3e,eT):r3e,areNumbersEqual:Wzt,areObjectsEqual:s?eT:Gzt,arePrimitiveWrappersEqual:Kzt,areRegExpsEqual:Zzt,areSetsEqual:s?QCe(n3e,eT):n3e,areTypedArraysEqual:s?eT:Yzt,areUrlsEqual:Xzt};if(n&&(i=i3e({},i,n(i))),t){var o=JL(i.areArraysEqual),l=JL(i.areMapsEqual),a=JL(i.areObjectsEqual),h=JL(i.areSetsEqual);i=i3e({},i,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:a,areSetsEqual:h})}return i}function f7t(e){return function(t,n,s,i,o,l,a){return e(t,n,a)}}function p7t(e){var t=e.circular,n=e.comparator,s=e.createState,i=e.equals,o=e.strict;if(s)return function(h,p){var x=s(),y=x.cache,b=y===void 0?t?new WeakMap:void 0:y,j=x.meta;return n(h,p,{cache:b,equals:i,meta:j,strict:o})};if(t)return function(h,p){return n(h,p,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var l={cache:void 0,equals:i,meta:void 0,strict:o};return function(h,p){return n(h,p,l)}}var m7t=pv();pv({strict:!0});pv({circular:!0});pv({circular:!0,strict:!0});pv({createInternalComparator:function(){return uk}});pv({strict:!0,createInternalComparator:function(){return uk}});pv({circular:!0,createInternalComparator:function(){return uk}});pv({circular:!0,createInternalComparator:function(){return uk},strict:!0});function pv(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,s=e.createInternalComparator,i=e.createState,o=e.strict,l=o===void 0?!1:o,a=h7t(e),h=u7t(a),p=s?s(h):f7t(h);return p7t({circular:n,comparator:h,createState:i,equals:p,strict:l})}function g7t(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function a3e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function i(o){n<0&&(n=o),o-n>t?(e(o),n=-1):g7t(i)};requestAnimationFrame(s)}function ipe(e){"@babel/helpers - typeof";return ipe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ipe(e)}function x7t(e){return b7t(e)||_7t(e)||v7t(e)||y7t()}function y7t(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v7t(e,t){if(e){if(typeof e=="string")return o3e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o3e(e,t)}}function o3e(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n1?1:E<0?0:E},C=function(E){for(var T=E>1?1:E,L=T,z=0;z<8;++z){var F=y(L)-T,q=j(L);if(Math.abs(F-T)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,s=n===void 0?100:n,i=t.damping,o=i===void 0?8:i,l=t.dt,a=l===void 0?17:l,h=function(x,y,b){var j=-(x-y)*s,N=b*o,C=b+(j-N)*a/1e3,A=b*a/1e3+x;return Math.abs(A-y)e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Q7t(e,t){if(e==null)return{};var n={},s=Object.keys(e),i,o;for(o=0;o=0)&&(n[i]=e[i]);return n}function ode(e){return r9t(e)||t9t(e)||e9t(e)||J7t()}function J7t(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e9t(e,t){if(e){if(typeof e=="string")return dpe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dpe(e,t)}}function t9t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function r9t(e){if(Array.isArray(e))return dpe(e)}function dpe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Vre(e){return Vre=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Vre(e)}var hy=function(e){o9t(n,e);var t=l9t(n);function n(s,i){var o;n9t(this,n),o=t.call(this,s,i);var l=o.props,a=l.isActive,h=l.attributeName,p=l.from,x=l.to,y=l.steps,b=l.children,j=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(fpe(o)),o.changeStyle=o.changeStyle.bind(fpe(o)),!a||j<=0)return o.state={style:{}},typeof b=="function"&&(o.state={style:x}),hpe(o);if(y&&y.length)o.state={style:y[0].style};else if(p){if(typeof b=="function")return o.state={style:p},hpe(o);o.state={style:h?xT({},h,p):p}}else o.state={style:{}};return o}return i9t(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,l=i.canBegin;this.mounted=!0,!(!o||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,l=o.isActive,a=o.canBegin,h=o.attributeName,p=o.shouldReAnimate,x=o.to,y=o.from,b=this.state.style;if(a){if(!l){var j={style:h?xT({},h,x):x};this.state&&b&&(h&&b[h]!==x||!h&&b!==x)&&this.setState(j);return}if(!(m7t(i.to,x)&&i.canBegin&&i.isActive)){var N=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var C=N||p?y:i.to;if(this.state&&b){var A={style:h?xT({},h,C):C};(h&&b[h]!==C||!h&&b!==C)&&this.setState(A)}this.runAnimation($p($p({},this.props),{},{from:C,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,l=i.from,a=i.to,h=i.duration,p=i.easing,x=i.begin,y=i.onAnimationEnd,b=i.onAnimationStart,j=Z7t(l,a,F7t(p),h,this.changeStyle),N=function(){o.stopJSAnimation=j()};this.manager.start([b,x,N,h,y])}},{key:"runStepAnimation",value:function(i){var o=this,l=i.steps,a=i.begin,h=i.onAnimationStart,p=l[0],x=p.style,y=p.duration,b=y===void 0?0:y,j=function(C,A,E){if(E===0)return C;var T=A.duration,L=A.easing,z=L===void 0?"ease":L,F=A.style,q=A.properties,H=A.onAnimationEnd,K=E>0?l[E-1]:A,Z=q||Object.keys(F);if(typeof z=="function"||z==="spring")return[].concat(ode(C),[o.runJSAnimation.bind(o,{from:K.style,to:F,duration:T,easing:z}),T]);var te=d3e(Z,T,z),ae=$p($p($p({},K.style),F),{},{transition:te});return[].concat(ode(C),[ae,T,H]).filter(S7t)};return this.manager.start([h].concat(ode(l.reduce(j,[x,Math.max(b,a)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=w7t());var o=i.begin,l=i.duration,a=i.attributeName,h=i.to,p=i.easing,x=i.onAnimationStart,y=i.onAnimationEnd,b=i.steps,j=i.children,N=this.manager;if(this.unSubscribe=N.subscribe(this.handleStyleChange),typeof p=="function"||typeof j=="function"||p==="spring"){this.runJSAnimation(i);return}if(b.length>1){this.runStepAnimation(i);return}var C=a?xT({},a,h):h,A=d3e(Object.keys(C),l,p);N.start([x,o,$p($p({},C),{},{transition:A}),l,y])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var l=i.duration;i.attributeName,i.easing;var a=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var h=X7t(i,Y7t),p=I.Children.count(o),x=this.state.style;if(typeof o=="function")return o(x);if(!a||p===0||l<=0)return o;var y=function(j){var N=j.props,C=N.style,A=C===void 0?{}:C,E=N.className,T=I.cloneElement(j,$p($p({},h),{},{style:$p($p({},A),x),className:E}));return T};return p===1?y(I.Children.only(o)):rt.createElement("div",null,I.Children.map(o,function(b){return y(b)}))}}]),n}(I.PureComponent);hy.displayName="Animate";hy.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};hy.propTypes={from:po.oneOfType([po.object,po.string]),to:po.oneOfType([po.object,po.string]),attributeName:po.string,duration:po.number,begin:po.number,easing:po.oneOfType([po.string,po.func]),steps:po.arrayOf(po.shape({duration:po.number.isRequired,style:po.object.isRequired,easing:po.oneOfType([po.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),po.func]),properties:po.arrayOf("string"),onAnimationEnd:po.func})),children:po.oneOfType([po.node,po.func]),isActive:po.bool,canBegin:po.bool,onAnimationEnd:po.func,shouldReAnimate:po.bool,onAnimationStart:po.func,onAnimationReStart:po.func};function VE(e){"@babel/helpers - typeof";return VE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},VE(e)}function Hre(){return Hre=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0?1:-1,h=s>=0?1:-1,p=i>=0&&s>=0||i<0&&s<0?1:0,x;if(l>0&&o instanceof Array){for(var y=[0,0,0,0],b=0,j=4;bl?l:o[b];x="M".concat(t,",").concat(n+a*y[0]),y[0]>0&&(x+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(p,",").concat(t+h*y[0],",").concat(n)),x+="L ".concat(t+s-h*y[1],",").concat(n),y[1]>0&&(x+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(p,`, `).concat(t+s,",").concat(n+a*y[1])),x+="L ".concat(t+s,",").concat(n+i-a*y[2]),y[2]>0&&(x+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(p,`, `).concat(t+s-h*y[2],",").concat(n+i)),x+="L ".concat(t+h*y[3],",").concat(n+i),y[3]>0&&(x+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(p,`, `).concat(t,",").concat(n+i-a*y[3])),x+="Z"}else if(l>0&&o===+o&&o>0){var N=Math.min(l,o);x="M ".concat(t,",").concat(n+a*N,` A `).concat(N,",").concat(N,",0,0,").concat(p,",").concat(t+h*N,",").concat(n,` L `).concat(t+s-h*N,",").concat(n,` A `).concat(N,",").concat(N,",0,0,").concat(p,",").concat(t+s,",").concat(n+a*N,` L `).concat(t+s,",").concat(n+i-a*N,` A `).concat(N,",").concat(N,",0,0,").concat(p,",").concat(t+s-h*N,",").concat(n+i,` L `).concat(t+h*N,",").concat(n+i,` A `).concat(N,",").concat(N,",0,0,").concat(p,",").concat(t,",").concat(n+i-a*N," Z")}else x="M ".concat(t,",").concat(n," h ").concat(s," v ").concat(i," h ").concat(-s," Z");return x},y9t=function(t,n){if(!t||!n)return!1;var s=t.x,i=t.y,o=n.x,l=n.y,a=n.width,h=n.height;if(Math.abs(a)>0&&Math.abs(h)>0){var p=Math.min(o,o+a),x=Math.max(o,o+a),y=Math.min(l,l+h),b=Math.max(l,l+h);return s>=p&&s<=x&&i>=y&&i<=b}return!1},v9t={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},k0e=function(t){var n=y3e(y3e({},v9t),t),s=I.useRef(),i=I.useState(-1),o=d9t(i,2),l=o[0],a=o[1];I.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var z=s.current.getTotalLength();z&&a(z)}catch{}},[]);var h=n.x,p=n.y,x=n.width,y=n.height,b=n.radius,j=n.className,N=n.animationEasing,C=n.animationDuration,A=n.animationBegin,E=n.isAnimationActive,T=n.isUpdateAnimationActive;if(h!==+h||p!==+p||x!==+x||y!==+y||x===0||y===0)return null;var L=ra("recharts-rectangle",j);return T?rt.createElement(hy,{canBegin:l>0,from:{width:x,height:y,x:h,y:p},to:{width:x,height:y,x:h,y:p},duration:C,animationEasing:N,isActive:T},function(z){var F=z.width,q=z.height,H=z.x,K=z.y;return rt.createElement(hy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:C,isActive:E,easing:N},rt.createElement("path",Hre({},Ai(n,!0),{className:L,d:v3e(H,K,F,q,b),ref:s})))}):rt.createElement("path",Hre({},Ai(n,!0),{className:L,d:v3e(h,p,x,y,b)}))},_9t=["points","className","baseLinePoints","connectNulls"];function z4(){return z4=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function w9t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function _3e(e){return S9t(e)||N9t(e)||k9t(e)||j9t()}function j9t(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function k9t(e,t){if(e){if(typeof e=="string")return ppe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ppe(e,t)}}function N9t(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function S9t(e){if(Array.isArray(e))return ppe(e)}function ppe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(s){b3e(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),b3e(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},SA=function(t,n){var s=C9t(t);n&&(s=[s.reduce(function(o,l){return[].concat(_3e(o),_3e(l))},[])]);var i=s.map(function(o){return o.reduce(function(l,a,h){return"".concat(l).concat(h===0?"M":"L").concat(a.x,",").concat(a.y)},"")}).join("");return s.length===1?"".concat(i,"Z"):i},M9t=function(t,n,s){var i=SA(t,s);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(SA(n.reverse(),s).slice(1))},T9t=function(t){var n=t.points,s=t.className,i=t.baseLinePoints,o=t.connectNulls,l=b9t(t,_9t);if(!n||!n.length)return null;var a=ra("recharts-polygon",s);if(i&&i.length){var h=l.stroke&&l.stroke!=="none",p=M9t(n,i,o);return rt.createElement("g",{className:a},rt.createElement("path",z4({},Ai(l,!0),{fill:p.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:p})),h?rt.createElement("path",z4({},Ai(l,!0),{fill:"none",d:SA(n,o)})):null,h?rt.createElement("path",z4({},Ai(l,!0),{fill:"none",d:SA(i,o)})):null)}var x=SA(n,o);return rt.createElement("path",z4({},Ai(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:a,d:x}))};function mpe(){return mpe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function D9t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var R9t=function(t,n,s,i,o,l){return"M".concat(t,",").concat(o,"v").concat(i,"M").concat(l,",").concat(n,"h").concat(s)},F9t=function(t){var n=t.x,s=n===void 0?0:n,i=t.y,o=i===void 0?0:i,l=t.top,a=l===void 0?0:l,h=t.left,p=h===void 0?0:h,x=t.width,y=x===void 0?0:x,b=t.height,j=b===void 0?0:b,N=t.className,C=O9t(t,A9t),A=E9t({x:s,y:o,top:a,left:p,width:y,height:j},C);return!Dn(s)||!Dn(o)||!Dn(y)||!Dn(j)||!Dn(a)||!Dn(p)?null:rt.createElement("path",gpe({},Ai(A,!0),{className:ra("recharts-cross",N),d:R9t(s,o,y,j,a,p)}))},z9t=Nie,B9t=U9e,$9t=Vg;function U9t(e,t){return e&&e.length?z9t(e,$9t(t),B9t):void 0}var q9t=U9t;const V9t=za(q9t);var H9t=Nie,W9t=Vg,G9t=q9e;function K9t(e,t){return e&&e.length?H9t(e,W9t(t),G9t):void 0}var Z9t=K9t;const Y9t=za(Z9t);var X9t=["cx","cy","angle","ticks","axisLine"],Q9t=["ticks","tick","angle","tickFormatter","stroke"];function PC(e){"@babel/helpers - typeof";return PC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},PC(e)}function CA(){return CA=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function J9t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function eBt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N3e(e,t){for(var n=0;nM3e?l=i==="outer"?"start":"end":o<-M3e?l=i==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var s=this.props,i=s.cx,o=s.cy,l=s.radius,a=s.axisLine,h=s.axisLineType,p=u_(u_({},Ai(this.props,!1)),{},{fill:"none"},Ai(a,!1));if(h==="circle")return rt.createElement(N0e,Dw({className:"recharts-polar-angle-axis-line"},p,{cx:i,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(b){return Xo(i,o,l,b.coordinate)});return rt.createElement(T9t,Dw({className:"recharts-polar-angle-axis-line"},p,{points:y}))}},{key:"renderTicks",value:function(){var s=this,i=this.props,o=i.ticks,l=i.tick,a=i.tickLine,h=i.tickFormatter,p=i.stroke,x=Ai(this.props,!1),y=Ai(l,!1),b=u_(u_({},x),{},{fill:"none"},Ai(a,!1)),j=o.map(function(N,C){var A=s.getTickLineCoord(N),E=s.getTickTextAnchor(N),T=u_(u_(u_({textAnchor:E},x),{},{stroke:"none",fill:p},y),{},{index:C,payload:N,x:A.x2,y:A.y2});return rt.createElement(ko,Dw({className:ra("recharts-polar-angle-axis-tick",xBe(l)),key:"tick-".concat(N.coordinate)},Zj(s.props,N,C)),a&&rt.createElement("line",Dw({className:"recharts-polar-angle-axis-tick-line"},b,A)),l&&t.renderTickItem(l,T,h?h(N.value,C):N.value))});return rt.createElement(ko,{className:"recharts-polar-angle-axis-ticks"},j)}},{key:"render",value:function(){var s=this.props,i=s.ticks,o=s.radius,l=s.axisLine;return o<=0||!i||!i.length?null:rt.createElement(ko,{className:ra("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,i,o){var l;return rt.isValidElement(s)?l=rt.cloneElement(s,i):Ri(s)?l=s(i):l=rt.createElement(Yj,Dw({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(I.PureComponent);Lie(Oie,"displayName","PolarAngleAxis");Lie(Oie,"axisType","angleAxis");Lie(Oie,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var mBt=F7e,gBt=mBt(Object.getPrototypeOf,Object),xBt=gBt,yBt=xy,vBt=xBt,_Bt=yy,bBt="[object Object]",wBt=Function.prototype,jBt=Object.prototype,OBe=wBt.toString,kBt=jBt.hasOwnProperty,NBt=OBe.call(Object);function SBt(e){if(!_Bt(e)||yBt(e)!=bBt)return!1;var t=vBt(e);if(t===null)return!0;var n=kBt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&OBe.call(n)==NBt}var CBt=SBt;const MBt=za(CBt);var TBt=xy,ABt=yy,EBt="[object Boolean]";function IBt(e){return e===!0||e===!1||ABt(e)&&TBt(e)==EBt}var PBt=IBt;const LBt=za(PBt);function WE(e){"@babel/helpers - typeof";return WE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},WE(e)}function Kre(){return Kre=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:b,x:h,y:p},to:{upperWidth:x,lowerWidth:y,height:b,x:h,y:p},duration:C,animationEasing:N,isActive:E},function(L){var z=L.upperWidth,F=L.lowerWidth,q=L.height,H=L.x,K=L.y;return rt.createElement(hy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:C,easing:N},rt.createElement("path",Kre({},Ai(n,!0),{className:T,d:I3e(H,K,z,F,q),ref:s})))}):rt.createElement("g",null,rt.createElement("path",Kre({},Ai(n,!0),{className:T,d:I3e(h,p,x,y,b)})))},HBt=["option","shapeType","propTransformer","activeClassName","isActive"];function GE(e){"@babel/helpers - typeof";return GE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},GE(e)}function WBt(e,t){if(e==null)return{};var n=GBt(e,t),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function GBt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function P3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Zre(e){for(var t=1;t0?rf(L,"paddingAngle",0):0;if(F){var H=j0(F.endAngle-F.startAngle,L.endAngle-L.startAngle),K=Go(Go({},L),{},{startAngle:T+q,endAngle:T+H(C)+q});A.push(K),T=K.endAngle}else{var Z=L.endAngle,te=L.startAngle,ae=j0(0,Z-te),le=ae(C),ve=Go(Go({},L),{},{startAngle:T+q,endAngle:T+le+q});A.push(ve),T=ve.endAngle}}),rt.createElement(ko,null,s.renderSectorsStatically(A))})}},{key:"attachKeyboardHandlers",value:function(s){var i=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var l=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[l].focus(),i.setState({sectorToFocus:l});break}case"ArrowRight":{var a=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[a].focus(),i.setState({sectorToFocus:a});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,i=s.sectors,o=s.isAnimationActive,l=this.state.prevSectors;return o&&i&&i.length&&(!l||!Mie(l,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,i=this.props,o=i.hide,l=i.sectors,a=i.className,h=i.label,p=i.cx,x=i.cy,y=i.innerRadius,b=i.outerRadius,j=i.isAnimationActive,N=this.state.isAnimationFinished;if(o||!l||!l.length||!Dn(p)||!Dn(x)||!Dn(y)||!Dn(b))return null;var C=ra("recharts-pie",a);return rt.createElement(ko,{tabIndex:this.props.rootTabIndex,className:C,ref:function(E){s.pieRef=E}},this.renderSectors(),h&&this.renderLabels(l),ld.renderCallByParent(this.props,null,!1),(!j||N)&&I1.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,i){return i.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==i.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:s.sectors!==i.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,i){return s>i?"start":s=360?T:T-1)*h,z=A-T*j-L,F=i.reduce(function(K,Z){var te=Xd(Z,E,0);return K+(Dn(te)?te:0)},0),q;if(F>0){var H;q=i.map(function(K,Z){var te=Xd(K,E,0),ae=Xd(K,x,Z),le=(Dn(te)?te:0)/F,ve;Z?ve=H.endAngle+Tu(C)*h*(te!==0?1:0):ve=l;var ne=ve+Tu(C)*((te!==0?j:0)+le*z),ge=(ve+ne)/2,ie=(N.innerRadius+N.outerRadius)/2,fe=[{name:ae,value:te,payload:K,dataKey:E,type:b}],de=Xo(N.cx,N.cy,ie,ge);return H=Go(Go(Go({percent:le,cornerRadius:o,name:ae,tooltipPayload:fe,midAngle:ge,middleRadius:ie,tooltipPosition:de},K),N),{},{value:Xd(K,E),startAngle:ve,endAngle:ne,payload:K,paddingAngle:Tu(C)*h}),H})}return Go(Go({},N),{},{sectors:q,data:i})});var p$t=Math.ceil,m$t=Math.max;function g$t(e,t,n,s){for(var i=-1,o=m$t(p$t((t-e)/(n||1)),0),l=Array(o);o--;)l[s?o:++i]=e,e+=n;return l}var x$t=g$t,y$t=n9e,R3e=1/0,v$t=17976931348623157e292;function _$t(e){if(!e)return e===0?e:0;if(e=y$t(e),e===R3e||e===-R3e){var t=e<0?-1:1;return t*v$t}return e===e?e:0}var zBe=_$t,b$t=x$t,w$t=xie,lde=zBe;function j$t(e){return function(t,n,s){return s&&typeof s!="number"&&w$t(t,n,s)&&(n=s=void 0),t=lde(t),n===void 0?(n=t,t=0):n=lde(n),s=s===void 0?t0&&s.handleDrag(i.changedTouches[0])}),Oh(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=s.props,o=i.endIndex,l=i.onDragEnd,a=i.startIndex;l==null||l({endIndex:o,startIndex:a})}),s.detachDragEndListener()}),Oh(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Oh(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Oh(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Oh(s,"handleSlideDragStart",function(i){var o=U3e(i)?i.changedTouches[0]:i;s.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),s.attachDragEndListener()}),s.travellerDragStartHandlers={startX:s.handleTravellerDragStart.bind(s,"startX"),endX:s.handleTravellerDragStart.bind(s,"endX")},s.state={},s}return R$t(t,e),P$t(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var i=s.startX,o=s.endX,l=this.state.scaleValues,a=this.props,h=a.gap,p=a.data,x=p.length-1,y=Math.min(i,o),b=Math.max(i,o),j=t.getIndexInRange(l,y),N=t.getIndexInRange(l,b);return{startIndex:j-j%h,endIndex:N===x?x:N-N%h}}},{key:"getTextOfTick",value:function(s){var i=this.props,o=i.data,l=i.tickFormatter,a=i.dataKey,h=Xd(o[s],a,s);return Ri(l)?l(h,s):h}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var i=this.state,o=i.slideMoveStartX,l=i.startX,a=i.endX,h=this.props,p=h.x,x=h.width,y=h.travellerWidth,b=h.startIndex,j=h.endIndex,N=h.onChange,C=s.pageX-o;C>0?C=Math.min(C,p+x-y-a,p+x-y-l):C<0&&(C=Math.max(C,p-l,p-a));var A=this.getIndex({startX:l+C,endX:a+C});(A.startIndex!==b||A.endIndex!==j)&&N&&N(A),this.setState({startX:l+C,endX:a+C,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,i){var o=U3e(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var i=this.state,o=i.brushMoveStartX,l=i.movingTravellerId,a=i.endX,h=i.startX,p=this.state[l],x=this.props,y=x.x,b=x.width,j=x.travellerWidth,N=x.onChange,C=x.gap,A=x.data,E={startX:this.state.startX,endX:this.state.endX},T=s.pageX-o;T>0?T=Math.min(T,y+b-j-p):T<0&&(T=Math.max(T,y-p)),E[l]=p+T;var L=this.getIndex(E),z=L.startIndex,F=L.endIndex,q=function(){var K=A.length-1;return l==="startX"&&(a>h?z%C===0:F%C===0)||ah?F%C===0:z%C===0)||a>h&&F===K};this.setState(Oh(Oh({},l,p+T),"brushMoveStartX",s.pageX),function(){N&&q()&&N(L)})}},{key:"handleTravellerMoveKeyboard",value:function(s,i){var o=this,l=this.state,a=l.scaleValues,h=l.startX,p=l.endX,x=this.state[i],y=a.indexOf(x);if(y!==-1){var b=y+s;if(!(b===-1||b>=a.length)){var j=a[b];i==="startX"&&j>=p||i==="endX"&&j<=h||this.setState(Oh({},i,j),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,i=s.x,o=s.y,l=s.width,a=s.height,h=s.fill,p=s.stroke;return rt.createElement("rect",{stroke:p,fill:h,x:i,y:o,width:l,height:a})}},{key:"renderPanorama",value:function(){var s=this.props,i=s.x,o=s.y,l=s.width,a=s.height,h=s.data,p=s.children,x=s.padding,y=I.Children.only(p);return y?rt.cloneElement(y,{x:i,y:o,width:l,height:a,margin:x,compact:!0,data:h}):null}},{key:"renderTravellerLayer",value:function(s,i){var o,l,a=this,h=this.props,p=h.y,x=h.travellerWidth,y=h.height,b=h.traveller,j=h.ariaLabel,N=h.data,C=h.startIndex,A=h.endIndex,E=Math.max(s,this.props.x),T=cde(cde({},Ai(this.props,!1)),{},{x:E,y:p,width:x,height:y}),L=j||"Min value: ".concat((o=N[C])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=N[A])===null||l===void 0?void 0:l.name);return rt.createElement(ko,{tabIndex:0,role:"slider","aria-label":L,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(F){["ArrowLeft","ArrowRight"].includes(F.key)&&(F.preventDefault(),F.stopPropagation(),a.handleTravellerMoveKeyboard(F.key==="ArrowRight"?1:-1,i))},onFocus:function(){a.setState({isTravellerFocused:!0})},onBlur:function(){a.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(b,T))}},{key:"renderSlide",value:function(s,i){var o=this.props,l=o.y,a=o.height,h=o.stroke,p=o.travellerWidth,x=Math.min(s,i)+p,y=Math.max(Math.abs(i-s)-p,0);return rt.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:h,fillOpacity:.2,x,y:l,width:y,height:a})}},{key:"renderText",value:function(){var s=this.props,i=s.startIndex,o=s.endIndex,l=s.y,a=s.height,h=s.travellerWidth,p=s.stroke,x=this.state,y=x.startX,b=x.endX,j=5,N={pointerEvents:"none",fill:p};return rt.createElement(ko,{className:"recharts-brush-texts"},rt.createElement(Yj,Qre({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,b)-j,y:l+a/2},N),this.getTextOfTick(i)),rt.createElement(Yj,Qre({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,b)+h+j,y:l+a/2},N),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,i=s.data,o=s.className,l=s.children,a=s.x,h=s.y,p=s.width,x=s.height,y=s.alwaysShowText,b=this.state,j=b.startX,N=b.endX,C=b.isTextActive,A=b.isSlideMoving,E=b.isTravellerMoving,T=b.isTravellerFocused;if(!i||!i.length||!Dn(a)||!Dn(h)||!Dn(p)||!Dn(x)||p<=0||x<=0)return null;var L=ra("recharts-brush",o),z=rt.Children.count(l)===1,F=E$t("userSelect","none");return rt.createElement(ko,{className:L,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),z&&this.renderPanorama(),this.renderSlide(j,N),this.renderTravellerLayer(j,"startX"),this.renderTravellerLayer(N,"endX"),(C||A||E||T||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var i=s.x,o=s.y,l=s.width,a=s.height,h=s.stroke,p=Math.floor(o+a/2)-1;return rt.createElement(rt.Fragment,null,rt.createElement("rect",{x:i,y:o,width:l,height:a,fill:h,stroke:"none"}),rt.createElement("line",{x1:i+1,y1:p,x2:i+l-1,y2:p,fill:"none",stroke:"#fff"}),rt.createElement("line",{x1:i+1,y1:p+2,x2:i+l-1,y2:p+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,i){var o;return rt.isValidElement(s)?o=rt.cloneElement(s,i):Ri(s)?o=s(i):o=t.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(s,i){var o=s.data,l=s.width,a=s.x,h=s.travellerWidth,p=s.updateId,x=s.startIndex,y=s.endIndex;if(o!==i.prevData||p!==i.prevUpdateId)return cde({prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:a,prevWidth:l},o&&o.length?z$t({data:o,width:l,x:a,travellerWidth:h,startIndex:x,endIndex:y}):{scale:null,scaleValues:null});if(i.scale&&(l!==i.prevWidth||a!==i.prevX||h!==i.prevTravellerWidth)){i.scale.range([a,a+l-h]);var b=i.scale.domain().map(function(j){return i.scale(j)});return{prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:a,prevWidth:l,startX:i.scale(s.startIndex),endX:i.scale(s.endIndex),scaleValues:b}}return null}},{key:"getIndexInRange",value:function(s,i){for(var o=s.length,l=0,a=o-1;a-l>1;){var h=Math.floor((l+a)/2);s[h]>i?a=h:l=h}return i>=s[a]?a:l}}])}(I.PureComponent);Oh(RC,"displayName","Brush");Oh(RC,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var B$t=Yye;function $$t(e,t){var n;return B$t(e,function(s,i,o){return n=t(s,i,o),!n}),!!n}var U$t=$$t,q$t=A7e,V$t=Vg,H$t=U$t,W$t=kh,G$t=xie;function K$t(e,t,n){var s=W$t(e)?q$t:H$t;return n&&G$t(e,t,n)&&(t=void 0),s(e,V$t(t))}var Z$t=K$t;const Y$t=za(Z$t);var Eg=function(t,n){var s=t.alwaysShow,i=t.ifOverflow;return s&&(i="extendDomain"),i===n},q3e=Q7e;function X$t(e,t,n){t=="__proto__"&&q3e?q3e(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Q$t=X$t,J$t=Q$t,eUt=Y7e,tUt=Vg;function rUt(e,t){var n={};return t=tUt(t),eUt(e,function(s,i,o){J$t(n,i,t(s,i,o))}),n}var nUt=rUt;const sUt=za(nUt);function iUt(e,t){for(var n=-1,s=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function wUt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function jUt(e,t){var n=e.x,s=e.y,i=bUt(e,xUt),o="".concat(n),l=parseInt(o,10),a="".concat(s),h=parseInt(a,10),p="".concat(t.height||i.height),x=parseInt(p,10),y="".concat(t.width||i.width),b=parseInt(y,10);return tT(tT(tT(tT(tT({},t),i),l?{x:l}:{}),h?{y:h}:{}),{},{height:x,width:b,name:t.name,radius:t.radius})}function H3e(e){return rt.createElement(DBe,bpe({shapeType:"rectangle",propTransformer:jUt,activeClassName:"recharts-active-bar"},e))}var kUt=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,i){if(typeof t=="number")return t;var o=Dn(s)||YSt(s);return o?t(s,i):(o||Qj(),n)}},NUt=["value","background"],VBe;function FC(e){"@babel/helpers - typeof";return FC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},FC(e)}function SUt(e,t){if(e==null)return{};var n=CUt(e,t),s,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function CUt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function ene(){return ene=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(ge)0&&Math.abs(ne)0&&(ve=Math.min((xe||0)-(ne[be-1]||0),ve))}),Number.isFinite(ve)){var ge=ve/le,ie=C.layout==="vertical"?s.height:s.width;if(C.padding==="gap"&&(H=ge*ie/2),C.padding==="no-gap"){var fe=Au(t.barCategoryGap,ge*ie),de=ge*ie/2;H=de-fe-(de-fe)/ie*fe}}}i==="xAxis"?K=[s.left+(L.left||0)+(H||0),s.left+s.width-(L.right||0)-(H||0)]:i==="yAxis"?K=h==="horizontal"?[s.top+s.height-(L.bottom||0),s.top+(L.top||0)]:[s.top+(L.top||0)+(H||0),s.top+s.height-(L.bottom||0)-(H||0)]:K=C.range,F&&(K=[K[1],K[0]]);var ye=dBe(C,o,b),Ie=ye.scale,Ne=ye.realScaleType;Ie.domain(E).range(K),uBe(Ie);var we=hBe(Ie,Jp(Jp({},C),{},{realScaleType:Ne}));i==="xAxis"?(ae=A==="top"&&!z||A==="bottom"&&z,Z=s.left,te=y[q]-ae*C.height):i==="yAxis"&&(ae=A==="left"&&!z||A==="right"&&z,Z=y[q]-ae*C.width,te=s.top);var he=Jp(Jp(Jp({},C),we),{},{realScaleType:Ne,x:Z,y:te,scale:Ie,width:i==="xAxis"?s.width:C.width,height:i==="yAxis"?s.height:C.height});return he.bandSize=zre(he,we),!C.hide&&i==="xAxis"?y[q]+=(ae?-1:1)*he.height:C.hide||(y[q]+=(ae?-1:1)*he.width),Jp(Jp({},j),{},Fie({},N,he))},{})},KBe=function(t,n){var s=t.x,i=t.y,o=n.x,l=n.y;return{x:Math.min(s,o),y:Math.min(i,l),width:Math.abs(o-s),height:Math.abs(l-i)}},zUt=function(t){var n=t.x1,s=t.y1,i=t.x2,o=t.y2;return KBe({x:n,y:s},{x:i,y:o})},ZBe=function(){function e(t){OUt(this,e),this.scale=t}return DUt(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=s.bandAware,o=s.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var a=this.bandwidth?this.bandwidth():0;return this.scale(n)+a}default:return this.scale(n)}if(i){var h=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+h}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),i=s[0],o=s[s.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new e(n)}}])}();Fie(ZBe,"EPS",1e-4);var S0e=function(t){var n=Object.keys(t).reduce(function(s,i){return Jp(Jp({},s),{},Fie({},i,ZBe.create(t[i])))},{});return Jp(Jp({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,a=o.position;return sUt(i,function(h,p){return n[p].apply(h,{bandAware:l,position:a})})},isInRange:function(i){return qBe(i,function(o,l){return n[l].isInRange(o)})}})};function BUt(e){return(e%180+180)%180}var $Ut=function(t){var n=t.width,s=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=BUt(i),l=o*Math.PI/180,a=Math.atan(s/n),h=l>a&&l-1?i[o?t[l]:l]:void 0}}var WUt=HUt,GUt=zBe;function KUt(e){var t=GUt(e),n=t%1;return t===t?n?t-n:t:0}var ZUt=KUt,YUt=V7e,XUt=Vg,QUt=ZUt,JUt=Math.max;function eqt(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var i=n==null?0:QUt(n);return i<0&&(i=JUt(s+i,0)),YUt(e,XUt(t),i)}var tqt=eqt,rqt=WUt,nqt=tqt,sqt=rqt(nqt),iqt=sqt;const aqt=za(iqt);var oqt=rSt(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),C0e=I.createContext(void 0),M0e=I.createContext(void 0),YBe=I.createContext(void 0),XBe=I.createContext({}),QBe=I.createContext(void 0),JBe=I.createContext(0),e$e=I.createContext(0),Y3e=function(t){var n=t.state,s=n.xAxisMap,i=n.yAxisMap,o=n.offset,l=t.clipPathId,a=t.children,h=t.width,p=t.height,x=oqt(o);return rt.createElement(C0e.Provider,{value:s},rt.createElement(M0e.Provider,{value:i},rt.createElement(XBe.Provider,{value:o},rt.createElement(YBe.Provider,{value:x},rt.createElement(QBe.Provider,{value:l},rt.createElement(JBe.Provider,{value:p},rt.createElement(e$e.Provider,{value:h},a)))))))},lqt=function(){return I.useContext(QBe)},t$e=function(t){var n=I.useContext(C0e);n==null&&Qj();var s=n[t];return s==null&&Qj(),s},cqt=function(){var t=I.useContext(C0e);return A0(t)},dqt=function(){var t=I.useContext(M0e),n=aqt(t,function(s){return qBe(s.domain,Number.isFinite)});return n||A0(t)},r$e=function(t){var n=I.useContext(M0e);n==null&&Qj();var s=n[t];return s==null&&Qj(),s},uqt=function(){var t=I.useContext(YBe);return t},hqt=function(){return I.useContext(XBe)},T0e=function(){return I.useContext(e$e)},A0e=function(){return I.useContext(JBe)};function zC(e){"@babel/helpers - typeof";return zC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zC(e)}function fqt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pqt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);ne*i)return!1;var o=n();return e*(t-e*o/2-s)>=0&&e*(t+e*o/2-i)<=0}function Zqt(e,t){return c$e(e,t+1)}function Yqt(e,t,n,s,i){for(var o=(s||[]).slice(),l=t.start,a=t.end,h=0,p=1,x=l,y=function(){var N=s==null?void 0:s[h];if(N===void 0)return{v:c$e(s,p)};var C=h,A,E=function(){return A===void 0&&(A=n(N,C)),A},T=N.coordinate,L=h===0||ine(e,T,E,x,a);L||(h=0,x=l,p+=1),L&&(x=T+e*(E()/2+i),h+=p)},b;p<=o.length;)if(b=y(),b)return b.v;return[]}function QE(e){"@babel/helpers - typeof";return QE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},QE(e)}function s5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Kd(e){for(var t=1;t0?j.coordinate-A*e:j.coordinate})}else o[b]=j=Kd(Kd({},j),{},{tickCoord:j.coordinate});var E=ine(e,j.tickCoord,C,a,h);E&&(h=j.tickCoord-e*(C()/2+i),o[b]=Kd(Kd({},j),{},{isShow:!0}))},x=l-1;x>=0;x--)p(x);return o}function tVt(e,t,n,s,i,o){var l=(s||[]).slice(),a=l.length,h=t.start,p=t.end;if(o){var x=s[a-1],y=n(x,a-1),b=e*(x.coordinate+e*y/2-p);l[a-1]=x=Kd(Kd({},x),{},{tickCoord:b>0?x.coordinate-b*e:x.coordinate});var j=ine(e,x.tickCoord,function(){return y},h,p);j&&(p=x.tickCoord-e*(y/2+i),l[a-1]=Kd(Kd({},x),{},{isShow:!0}))}for(var N=o?a-1:a,C=function(T){var L=l[T],z,F=function(){return z===void 0&&(z=n(L,T)),z};if(T===0){var q=e*(L.coordinate-e*F()/2-h);l[T]=L=Kd(Kd({},L),{},{tickCoord:q<0?L.coordinate-q*e:L.coordinate})}else l[T]=L=Kd(Kd({},L),{},{tickCoord:L.coordinate});var H=ine(e,L.tickCoord,F,h,p);H&&(h=L.tickCoord+e*(F()/2+i),l[T]=Kd(Kd({},L),{},{isShow:!0}))},A=0;A=2?Tu(i[1].coordinate-i[0].coordinate):1,E=Kqt(o,A,j);return h==="equidistantPreserveStart"?Yqt(A,E,C,i,l):(h==="preserveStart"||h==="preserveStartEnd"?b=tVt(A,E,C,i,l,h==="preserveStartEnd"):b=eVt(A,E,C,i,l),b.filter(function(T){return T.isShow}))}var rVt=["viewBox"],nVt=["viewBox"],sVt=["ticks"];function UC(e){"@babel/helpers - typeof";return UC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},UC(e)}function $4(){return $4=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function iVt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function aVt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a5e(e,t){for(var n=0;n0?h(this.props):h(j)),l<=0||a<=0||!N||!N.length?null:rt.createElement(ko,{className:ra("recharts-cartesian-axis",p),ref:function(A){s.layerReference=A}},o&&this.renderAxisLine(),this.renderTicks(N,this.state.fontSize,this.state.letterSpacing),ld.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,i,o){var l,a=ra(i.className,"recharts-cartesian-axis-tick-value");return rt.isValidElement(s)?l=rt.cloneElement(s,Pc(Pc({},i),{},{className:a})):Ri(s)?l=s(Pc(Pc({},i),{},{className:a})):l=rt.createElement(Yj,$4({},i,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(I.Component);L0e(T3,"displayName","CartesianAxis");L0e(T3,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var fVt=["x1","y1","x2","y2","key"],pVt=["offset"];function Jj(e){"@babel/helpers - typeof";return Jj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jj(e)}function o5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,s)}return n}function Yd(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function yVt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var vVt=function(t){var n=t.fill;if(!n||n==="none")return null;var s=t.fillOpacity,i=t.x,o=t.y,l=t.width,a=t.height,h=t.ry;return rt.createElement("rect",{x:i,y:o,ry:h,width:l,height:a,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function h$e(e,t){var n;if(rt.isValidElement(e))n=rt.cloneElement(e,t);else if(Ri(e))n=e(t);else{var s=t.x1,i=t.y1,o=t.x2,l=t.y2,a=t.key,h=l5e(t,fVt),p=Ai(h,!1);p.offset;var x=l5e(p,pVt);n=rt.createElement("line",Yw({},x,{x1:s,y1:i,x2:o,y2:l,fill:"none",key:a}))}return n}function _Vt(e){var t=e.x,n=e.width,s=e.horizontal,i=s===void 0?!0:s,o=e.horizontalPoints;if(!i||!o||!o.length)return null;var l=o.map(function(a,h){var p=Yd(Yd({},e),{},{x1:t,y1:a,x2:t+n,y2:a,key:"line-".concat(h),index:h});return h$e(i,p)});return rt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function bVt(e){var t=e.y,n=e.height,s=e.vertical,i=s===void 0?!0:s,o=e.verticalPoints;if(!i||!o||!o.length)return null;var l=o.map(function(a,h){var p=Yd(Yd({},e),{},{x1:a,y1:t,x2:a,y2:t+n,key:"line-".concat(h),index:h});return h$e(i,p)});return rt.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function wVt(e){var t=e.horizontalFill,n=e.fillOpacity,s=e.x,i=e.y,o=e.width,l=e.height,a=e.horizontalPoints,h=e.horizontal,p=h===void 0?!0:h;if(!p||!t||!t.length)return null;var x=a.map(function(b){return Math.round(b+i-i)}).sort(function(b,j){return b-j});i!==x[0]&&x.unshift(0);var y=x.map(function(b,j){var N=!x[j+1],C=N?i+l-b:x[j+1]-b;if(C<=0)return null;var A=j%t.length;return rt.createElement("rect",{key:"react-".concat(j),y:b,x:s,height:C,width:o,stroke:"none",fill:t[A],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return rt.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function jVt(e){var t=e.vertical,n=t===void 0?!0:t,s=e.verticalFill,i=e.fillOpacity,o=e.x,l=e.y,a=e.width,h=e.height,p=e.verticalPoints;if(!n||!s||!s.length)return null;var x=p.map(function(b){return Math.round(b+o-o)}).sort(function(b,j){return b-j});o!==x[0]&&x.unshift(0);var y=x.map(function(b,j){var N=!x[j+1],C=N?o+a-b:x[j+1]-b;if(C<=0)return null;var A=j%s.length;return rt.createElement("rect",{key:"react-".concat(j),x:b,y:l,width:C,height:h,stroke:"none",fill:s[A],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return rt.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var kVt=function(t,n){var s=t.xAxis,i=t.width,o=t.height,l=t.offset;return cBe(P0e(Yd(Yd(Yd({},T3.defaultProps),s),{},{ticks:zx(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),l.left,l.left+l.width,n)},NVt=function(t,n){var s=t.yAxis,i=t.width,o=t.height,l=t.offset;return cBe(P0e(Yd(Yd(Yd({},T3.defaultProps),s),{},{ticks:zx(s,!0),viewBox:{x:0,y:0,width:i,height:o}})),l.top,l.top+l.height,n)},f4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function f$e(e){var t,n,s,i,o,l,a=T0e(),h=A0e(),p=hqt(),x=Yd(Yd({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:f4.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:f4.fill,horizontal:(s=e.horizontal)!==null&&s!==void 0?s:f4.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:f4.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:f4.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:f4.verticalFill,x:Dn(e.x)?e.x:p.left,y:Dn(e.y)?e.y:p.top,width:Dn(e.width)?e.width:p.width,height:Dn(e.height)?e.height:p.height}),y=x.x,b=x.y,j=x.width,N=x.height,C=x.syncWithTicks,A=x.horizontalValues,E=x.verticalValues,T=cqt(),L=dqt();if(!Dn(j)||j<=0||!Dn(N)||N<=0||!Dn(y)||y!==+y||!Dn(b)||b!==+b)return null;var z=x.verticalCoordinatesGenerator||kVt,F=x.horizontalCoordinatesGenerator||NVt,q=x.horizontalPoints,H=x.verticalPoints;if((!q||!q.length)&&Ri(F)){var K=A&&A.length,Z=F({yAxis:L?Yd(Yd({},L),{},{ticks:K?A:L.ticks}):void 0,width:a,height:h,offset:p},K?!0:C);_m(Array.isArray(Z),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Jj(Z),"]")),Array.isArray(Z)&&(q=Z)}if((!H||!H.length)&&Ri(z)){var te=E&&E.length,ae=z({xAxis:T?Yd(Yd({},T),{},{ticks:te?E:T.ticks}):void 0,width:a,height:h,offset:p},te?!0:C);_m(Array.isArray(ae),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Jj(ae),"]")),Array.isArray(ae)&&(H=ae)}return rt.createElement("g",{className:"recharts-cartesian-grid"},rt.createElement(vVt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),rt.createElement(_Vt,Yw({},x,{offset:p,horizontalPoints:q,xAxis:T,yAxis:L})),rt.createElement(bVt,Yw({},x,{offset:p,verticalPoints:H,xAxis:T,yAxis:L})),rt.createElement(wVt,Yw({},x,{horizontalPoints:q})),rt.createElement(jVt,Yw({},x,{verticalPoints:H})))}f$e.displayName="CartesianGrid";function qC(e){"@babel/helpers - typeof";return qC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qC(e)}function SVt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function CVt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function fHt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function pHt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mHt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n0?l:t&&t.length&&Dn(i)&&Dn(o)?t.slice(i,o+1):[]};function C$e(e){return e==="number"?[0,"auto"]:void 0}var Fpe=function(t,n,s,i){var o=t.graphicalItems,l=t.tooltipAxis,a=Hie(n,t);return s<0||!o||!o.length||s>=a.length?null:o.reduce(function(h,p){var x,y=(x=p.props.data)!==null&&x!==void 0?x:n;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=s&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var b;if(l.dataKey&&!l.allowDuplicatedCategory){var j=y===void 0?a:y;b=ufe(j,l.dataKey,i)}else b=y&&y[s]||a[s];return b?[].concat(WC(h),[pBe(p,b)]):h},[])},p5e=function(t,n,s,i){var o=i||{x:t.chartX,y:t.chartY},l=CHt(o,s),a=t.orderedTooltipTicks,h=t.tooltipAxis,p=t.tooltipTicks,x=lFt(l,a,p,h);if(x>=0&&p){var y=p[x]&&p[x].value,b=Fpe(t,n,x,y),j=MHt(s,a,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:b,activeCoordinate:j}}return null},THt=function(t,n){var s=n.axes,i=n.graphicalItems,o=n.axisType,l=n.axisIdKey,a=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,y=t.children,b=t.stackOffset,j=lBe(x,o);return s.reduce(function(N,C){var A,E=C.type.defaultProps!==void 0?Yr(Yr({},C.type.defaultProps),C.props):C.props,T=E.type,L=E.dataKey,z=E.allowDataOverflow,F=E.allowDuplicatedCategory,q=E.scale,H=E.ticks,K=E.includeHidden,Z=E[l];if(N[Z])return N;var te=Hie(t.data,{graphicalItems:i.filter(function(we){var he,xe=l in we.props?we.props[l]:(he=we.type.defaultProps)===null||he===void 0?void 0:he[l];return xe===Z}),dataStartIndex:h,dataEndIndex:p}),ae=te.length,le,ve,ne;tHt(E.domain,z,T)&&(le=Jfe(E.domain,null,z),j&&(T==="number"||q!=="auto")&&(ne=kA(te,L,"category")));var ge=C$e(T);if(!le||le.length===0){var ie,fe=(ie=E.domain)!==null&&ie!==void 0?ie:ge;if(L){if(le=kA(te,L,T),T==="category"&&j){var de=QSt(le);F&&de?(ve=le,le=Xre(0,ae)):F||(le=zCe(fe,le,C).reduce(function(we,he){return we.indexOf(he)>=0?we:[].concat(WC(we),[he])},[]))}else if(T==="category")F?le=le.filter(function(we){return we!==""&&!_a(we)}):le=zCe(fe,le,C).reduce(function(we,he){return we.indexOf(he)>=0||he===""||_a(he)?we:[].concat(WC(we),[he])},[]);else if(T==="number"){var ye=fFt(te,i.filter(function(we){var he,xe,be=l in we.props?we.props[l]:(he=we.type.defaultProps)===null||he===void 0?void 0:he[l],Oe="hide"in we.props?we.props.hide:(xe=we.type.defaultProps)===null||xe===void 0?void 0:xe.hide;return be===Z&&(K||!Oe)}),L,o,x);ye&&(le=ye)}j&&(T==="number"||q!=="auto")&&(ne=kA(te,L,"category"))}else j?le=Xre(0,ae):a&&a[Z]&&a[Z].hasStack&&T==="number"?le=b==="expand"?[0,1]:fBe(a[Z].stackGroups,h,p):le=oBe(te,i.filter(function(we){var he=l in we.props?we.props[l]:we.type.defaultProps[l],xe="hide"in we.props?we.props.hide:we.type.defaultProps.hide;return he===Z&&(K||!xe)}),T,x,!0);if(T==="number")le=Ope(y,le,Z,o,H),fe&&(le=Jfe(fe,le,z));else if(T==="category"&&fe){var Ie=fe,Ne=le.every(function(we){return Ie.indexOf(we)>=0});Ne&&(le=Ie)}}return Yr(Yr({},N),{},vi({},Z,Yr(Yr({},E),{},{axisType:o,domain:le,categoricalDomain:ne,duplicateDomain:ve,originalDomain:(A=E.domain)!==null&&A!==void 0?A:ge,isCategorical:j,layout:x})))},{})},AHt=function(t,n){var s=n.graphicalItems,i=n.Axis,o=n.axisType,l=n.axisIdKey,a=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,y=t.children,b=Hie(t.data,{graphicalItems:s,dataStartIndex:h,dataEndIndex:p}),j=b.length,N=lBe(x,o),C=-1;return s.reduce(function(A,E){var T=E.type.defaultProps!==void 0?Yr(Yr({},E.type.defaultProps),E.props):E.props,L=T[l],z=C$e("number");if(!A[L]){C++;var F;return N?F=Xre(0,j):a&&a[L]&&a[L].hasStack?(F=fBe(a[L].stackGroups,h,p),F=Ope(y,F,L,o)):(F=Jfe(z,oBe(b,s.filter(function(q){var H,K,Z=l in q.props?q.props[l]:(H=q.type.defaultProps)===null||H===void 0?void 0:H[l],te="hide"in q.props?q.props.hide:(K=q.type.defaultProps)===null||K===void 0?void 0:K.hide;return Z===L&&!te}),"number",x),i.defaultProps.allowDataOverflow),F=Ope(y,F,L,o)),Yr(Yr({},A),{},vi({},L,Yr(Yr({axisType:o},i.defaultProps),{},{hide:!0,orientation:rf(NHt,"".concat(o,".").concat(C%2),null),domain:F,originalDomain:z,isCategorical:N,layout:x})))}return A},{})},EHt=function(t,n){var s=n.axisType,i=s===void 0?"xAxis":s,o=n.AxisComp,l=n.graphicalItems,a=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.children,y="".concat(i,"Id"),b=Jf(x,o),j={};return b&&b.length?j=THt(t,{axes:b,graphicalItems:l,axisType:i,axisIdKey:y,stackGroups:a,dataStartIndex:h,dataEndIndex:p}):l&&l.length&&(j=AHt(t,{Axis:o,graphicalItems:l,axisType:i,axisIdKey:y,stackGroups:a,dataStartIndex:h,dataEndIndex:p})),j},IHt=function(t){var n=A0(t),s=zx(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:Xye(s,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:zre(n,s)}},m5e=function(t){var n=t.children,s=t.defaultShowTooltip,i=Fh(n,RC),o=0,l=0;return t.data&&t.data.length!==0&&(l=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(l=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:l,activeTooltipIndex:-1,isTooltipActive:!!s}},PHt=function(t){return!t||!t.length?!1:t.some(function(n){var s=Qx(n&&n.type);return s&&s.indexOf("Bar")>=0})},g5e=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},LHt=function(t,n){var s=t.props,i=t.graphicalItems,o=t.xAxisMap,l=o===void 0?{}:o,a=t.yAxisMap,h=a===void 0?{}:a,p=s.width,x=s.height,y=s.children,b=s.margin||{},j=Fh(y,RC),N=Fh(y,LS),C=Object.keys(h).reduce(function(F,q){var H=h[q],K=H.orientation;return!H.mirror&&!H.hide?Yr(Yr({},F),{},vi({},K,F[K]+H.width)):F},{left:b.left||0,right:b.right||0}),A=Object.keys(l).reduce(function(F,q){var H=l[q],K=H.orientation;return!H.mirror&&!H.hide?Yr(Yr({},F),{},vi({},K,rf(F,"".concat(K))+H.height)):F},{top:b.top||0,bottom:b.bottom||0}),E=Yr(Yr({},A),C),T=E.bottom;j&&(E.bottom+=j.props.height||RC.defaultProps.height),N&&n&&(E=uFt(E,i,s,n));var L=p-E.left-E.right,z=x-E.top-E.bottom;return Yr(Yr({brushBottom:T},E),{},{width:Math.max(L,0),height:Math.max(z,0)})},OHt=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},M$e=function(t){var n=t.chartName,s=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,l=t.validateTooltipEventTypes,a=l===void 0?["axis"]:l,h=t.axisComponents,p=t.legendContent,x=t.formatAxisMap,y=t.defaultProps,b=function(E,T){var L=T.graphicalItems,z=T.stackGroups,F=T.offset,q=T.updateId,H=T.dataStartIndex,K=T.dataEndIndex,Z=E.barSize,te=E.layout,ae=E.barGap,le=E.barCategoryGap,ve=E.maxBarSize,ne=g5e(te),ge=ne.numericAxisName,ie=ne.cateAxisName,fe=PHt(L),de=[];return L.forEach(function(ye,Ie){var Ne=Hie(E.data,{graphicalItems:[ye],dataStartIndex:H,dataEndIndex:K}),we=ye.type.defaultProps!==void 0?Yr(Yr({},ye.type.defaultProps),ye.props):ye.props,he=we.dataKey,xe=we.maxBarSize,be=we["".concat(ge,"Id")],Oe=we["".concat(ie,"Id")],Te={},Ve=h.reduce(function(Je,tt){var ft=T["".concat(tt.axisType,"Map")],jt=we["".concat(tt.axisType,"Id")];ft&&ft[jt]||tt.axisType==="zAxis"||Qj();var Nt=ft[jt];return Yr(Yr({},Je),{},vi(vi({},tt.axisType,Nt),"".concat(tt.axisType,"Ticks"),zx(Nt)))},Te),Fe=Ve[ie],Me=Ve["".concat(ie,"Ticks")],Qe=z&&z[be]&&z[be].hasStack&&wFt(ye,z[be].stackGroups),Ee=Qx(ye.type).indexOf("Bar")>=0,Ye=zre(Fe,Me),me=[],mt=fe&&cFt({barSize:Z,stackGroups:z,totalSize:OHt(Ve,ie)});if(Ee){var et,nt,Ae=_a(xe)?ve:xe,ht=(et=(nt=zre(Fe,Me,!0))!==null&&nt!==void 0?nt:Ae)!==null&&et!==void 0?et:0;me=dFt({barGap:ae,barCategoryGap:le,bandSize:ht!==Ye?ht:Ye,sizeList:mt[Oe],maxBarSize:Ae}),ht!==Ye&&(me=me.map(function(Je){return Yr(Yr({},Je),{},{position:Yr(Yr({},Je.position),{},{offset:Je.position.offset-ht/2})})}))}var $e=ye&&ye.type&&ye.type.getComposedData;$e&&de.push({props:Yr(Yr({},$e(Yr(Yr({},Ve),{},{displayedData:Ne,props:E,dataKey:he,item:ye,bandSize:Ye,barPosition:me,offset:F,stackedData:Qe,layout:te,dataStartIndex:H,dataEndIndex:K}))),{},vi(vi(vi({key:ye.key||"item-".concat(Ie)},ge,Ve[ge]),ie,Ve[ie]),"animationId",q)),childIndex:dCt(ye,E.children),item:ye})}),de},j=function(E,T){var L=E.props,z=E.dataStartIndex,F=E.dataEndIndex,q=E.updateId;if(!P4e({props:L}))return null;var H=L.children,K=L.layout,Z=L.stackOffset,te=L.data,ae=L.reverseStackOrder,le=g5e(K),ve=le.numericAxisName,ne=le.cateAxisName,ge=Jf(H,s),ie=_Ft(te,ge,"".concat(ve,"Id"),"".concat(ne,"Id"),Z,ae),fe=h.reduce(function(we,he){var xe="".concat(he.axisType,"Map");return Yr(Yr({},we),{},vi({},xe,EHt(L,Yr(Yr({},he),{},{graphicalItems:ge,stackGroups:he.axisType===ve&&ie,dataStartIndex:z,dataEndIndex:F}))))},{}),de=LHt(Yr(Yr({},fe),{},{props:L,graphicalItems:ge}),T==null?void 0:T.legendBBox);Object.keys(fe).forEach(function(we){fe[we]=x(L,fe[we],de,we.replace("Map",""),n)});var ye=fe["".concat(ne,"Map")],Ie=IHt(ye),Ne=b(L,Yr(Yr({},fe),{},{dataStartIndex:z,dataEndIndex:F,updateId:q,graphicalItems:ge,stackGroups:ie,offset:de}));return Yr(Yr({formattedGraphicalItems:Ne,graphicalItems:ge,offset:de,stackGroups:ie},Ie),fe)},N=function(A){function E(T){var L,z,F;return pHt(this,E),F=xHt(this,E,[T]),vi(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),vi(F,"accessibilityManager",new eHt),vi(F,"handleLegendBBoxUpdate",function(q){if(q){var H=F.state,K=H.dataStartIndex,Z=H.dataEndIndex,te=H.updateId;F.setState(Yr({legendBBox:q},j({props:F.props,dataStartIndex:K,dataEndIndex:Z,updateId:te},Yr(Yr({},F.state),{},{legendBBox:q}))))}}),vi(F,"handleReceiveSyncEvent",function(q,H,K){if(F.props.syncId===q){if(K===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(H)}}),vi(F,"handleBrushChange",function(q){var H=q.startIndex,K=q.endIndex;if(H!==F.state.dataStartIndex||K!==F.state.dataEndIndex){var Z=F.state.updateId;F.setState(function(){return Yr({dataStartIndex:H,dataEndIndex:K},j({props:F.props,dataStartIndex:H,dataEndIndex:K,updateId:Z},F.state))}),F.triggerSyncEvent({dataStartIndex:H,dataEndIndex:K})}}),vi(F,"handleMouseEnter",function(q){var H=F.getMouseInfo(q);if(H){var K=Yr(Yr({},H),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseEnter;Ri(Z)&&Z(K,q)}}),vi(F,"triggeredAfterMouseMove",function(q){var H=F.getMouseInfo(q),K=H?Yr(Yr({},H),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onMouseMove;Ri(Z)&&Z(K,q)}),vi(F,"handleItemMouseEnter",function(q){F.setState(function(){return{isTooltipActive:!0,activeItem:q,activePayload:q.tooltipPayload,activeCoordinate:q.tooltipPosition||{x:q.cx,y:q.cy}}})}),vi(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),vi(F,"handleMouseMove",function(q){q.persist(),F.throttleTriggeredAfterMouseMove(q)}),vi(F,"handleMouseLeave",function(q){F.throttleTriggeredAfterMouseMove.cancel();var H={isTooltipActive:!1};F.setState(H),F.triggerSyncEvent(H);var K=F.props.onMouseLeave;Ri(K)&&K(H,q)}),vi(F,"handleOuterEvent",function(q){var H=cCt(q),K=rf(F.props,"".concat(H));if(H&&Ri(K)){var Z,te;/.*touch.*/i.test(H)?te=F.getMouseInfo(q.changedTouches[0]):te=F.getMouseInfo(q),K((Z=te)!==null&&Z!==void 0?Z:{},q)}}),vi(F,"handleClick",function(q){var H=F.getMouseInfo(q);if(H){var K=Yr(Yr({},H),{},{isTooltipActive:!0});F.setState(K),F.triggerSyncEvent(K);var Z=F.props.onClick;Ri(Z)&&Z(K,q)}}),vi(F,"handleMouseDown",function(q){var H=F.props.onMouseDown;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"handleMouseUp",function(q){var H=F.props.onMouseUp;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"handleTouchMove",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(q.changedTouches[0])}),vi(F,"handleTouchStart",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseDown(q.changedTouches[0])}),vi(F,"handleTouchEnd",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseUp(q.changedTouches[0])}),vi(F,"handleDoubleClick",function(q){var H=F.props.onDoubleClick;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"handleContextMenu",function(q){var H=F.props.onContextMenu;if(Ri(H)){var K=F.getMouseInfo(q);H(K,q)}}),vi(F,"triggerSyncEvent",function(q){F.props.syncId!==void 0&&ude.emit(hde,F.props.syncId,q,F.eventEmitterSymbol)}),vi(F,"applySyncEvent",function(q){var H=F.props,K=H.layout,Z=H.syncMethod,te=F.state.updateId,ae=q.dataStartIndex,le=q.dataEndIndex;if(q.dataStartIndex!==void 0||q.dataEndIndex!==void 0)F.setState(Yr({dataStartIndex:ae,dataEndIndex:le},j({props:F.props,dataStartIndex:ae,dataEndIndex:le,updateId:te},F.state)));else if(q.activeTooltipIndex!==void 0){var ve=q.chartX,ne=q.chartY,ge=q.activeTooltipIndex,ie=F.state,fe=ie.offset,de=ie.tooltipTicks;if(!fe)return;if(typeof Z=="function")ge=Z(de,q);else if(Z==="value"){ge=-1;for(var ye=0;ye=0){var Qe,Ee;if(ve.dataKey&&!ve.allowDuplicatedCategory){var Ye=typeof ve.dataKey=="function"?Me:"payload.".concat(ve.dataKey.toString());Qe=ufe(ye,Ye,ge),Ee=Ie&&Ne&&ufe(Ne,Ye,ge)}else Qe=ye==null?void 0:ye[ne],Ee=Ie&&Ne&&Ne[ne];if(Oe||be){var me=q.props.activeIndex!==void 0?q.props.activeIndex:ne;return[I.cloneElement(q,Yr(Yr(Yr({},Z.props),Ve),{},{activeIndex:me})),null,null]}if(!_a(Qe))return[Fe].concat(WC(F.renderActivePoints({item:Z,activePoint:Qe,basePoint:Ee,childIndex:ne,isRange:Ie})))}else{var mt,et=(mt=F.getItemByXY(F.state.activeCoordinate))!==null&&mt!==void 0?mt:{graphicalItem:Fe},nt=et.graphicalItem,Ae=nt.item,ht=Ae===void 0?q:Ae,$e=nt.childIndex,Je=Yr(Yr(Yr({},Z.props),Ve),{},{activeIndex:$e});return[I.cloneElement(ht,Je),null,null]}return Ie?[Fe,null,null]:[Fe,null]}),vi(F,"renderCustomized",function(q,H,K){return I.cloneElement(q,Yr(Yr({key:"recharts-customized-".concat(K)},F.props),F.state))}),vi(F,"renderMap",{CartesianGrid:{handler:t8,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:t8},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:t8},YAxis:{handler:t8},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((L=T.id)!==null&&L!==void 0?L:$I("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=s9e(F.triggeredAfterMouseMove,(z=T.throttleDelay)!==null&&z!==void 0?z:1e3/60),F.state={},F}return _Ht(E,A),gHt(E,[{key:"componentDidMount",value:function(){var L,z;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(L=this.props.margin.left)!==null&&L!==void 0?L:0,top:(z=this.props.margin.top)!==null&&z!==void 0?z:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var L=this.props,z=L.children,F=L.data,q=L.height,H=L.layout,K=Fh(z,Qp);if(K){var Z=K.props.defaultIndex;if(!(typeof Z!="number"||Z<0||Z>this.state.tooltipTicks.length-1)){var te=this.state.tooltipTicks[Z]&&this.state.tooltipTicks[Z].value,ae=Fpe(this.state,F,Z,te),le=this.state.tooltipTicks[Z].coordinate,ve=(this.state.offset.top+q)/2,ne=H==="horizontal",ge=ne?{x:le,y:ve}:{y:le,x:ve},ie=this.state.formattedGraphicalItems.find(function(de){var ye=de.item;return ye.type.name==="Scatter"});ie&&(ge=Yr(Yr({},ge),ie.props.points[Z].tooltipPosition),ae=ie.props.points[Z].tooltipPayload);var fe={activeTooltipIndex:Z,isTooltipActive:!0,activeLabel:te,activePayload:ae,activeCoordinate:ge};this.setState(fe),this.renderCursor(K),this.accessibilityManager.setIndex(Z)}}}},{key:"getSnapshotBeforeUpdate",value:function(L,z){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==z.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==L.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==L.margin){var F,q;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:(q=this.props.margin.top)!==null&&q!==void 0?q:0}})}return null}},{key:"componentDidUpdate",value:function(L){ffe([Fh(L.children,Qp)],[Fh(this.props.children,Qp)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var L=Fh(this.props.children,Qp);if(L&&typeof L.props.shared=="boolean"){var z=L.props.shared?"axis":"item";return a.indexOf(z)>=0?z:o}return o}},{key:"getMouseInfo",value:function(L){if(!this.container)return null;var z=this.container,F=z.getBoundingClientRect(),q=DLt(F),H={chartX:Math.round(L.pageX-q.left),chartY:Math.round(L.pageY-q.top)},K=F.width/z.offsetWidth||1,Z=this.inRange(H.chartX,H.chartY,K);if(!Z)return null;var te=this.state,ae=te.xAxisMap,le=te.yAxisMap,ve=this.getTooltipEventType(),ne=p5e(this.state,this.props.data,this.props.layout,Z);if(ve!=="axis"&&ae&&le){var ge=A0(ae).scale,ie=A0(le).scale,fe=ge&&ge.invert?ge.invert(H.chartX):null,de=ie&&ie.invert?ie.invert(H.chartY):null;return Yr(Yr({},H),{},{xValue:fe,yValue:de},ne)}return ne?Yr(Yr({},H),ne):null}},{key:"inRange",value:function(L,z){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,q=this.props.layout,H=L/F,K=z/F;if(q==="horizontal"||q==="vertical"){var Z=this.state.offset,te=H>=Z.left&&H<=Z.left+Z.width&&K>=Z.top&&K<=Z.top+Z.height;return te?{x:H,y:K}:null}var ae=this.state,le=ae.angleAxisMap,ve=ae.radiusAxisMap;if(le&&ve){var ne=A0(le);return UCe({x:H,y:K},ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var L=this.props.children,z=this.getTooltipEventType(),F=Fh(L,Qp),q={};F&&z==="axis"&&(F.props.trigger==="click"?q={onClick:this.handleClick}:q={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var H=hre(this.props,this.handleOuterEvent);return Yr(Yr({},H),q)}},{key:"addListener",value:function(){ude.on(hde,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){ude.removeListener(hde,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(L,z,F){for(var q=this.state.formattedGraphicalItems,H=0,K=q.length;H");return e}const E$e=I.forwardRef(({id:e,className:t,children:n,config:s,...i},o)=>{const l=I.useId(),a=`chart-${e||l.replace(/:/g,"")}`;return r.jsx(T$e.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":a,ref:o,className:$t("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",t),...i,children:[r.jsx(zHt,{id:a,config:s}),r.jsx(Dfe,{children:n})]})})});E$e.displayName="Chart";const zHt=({id:e,config:t})=>{const n=Object.entries(t).filter(([s,i])=>i.theme||i.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(FHt).map(([s,i])=>` ${i} [data-chart=${e}] { ${n.map(([o,l])=>{var h;const a=((h=l.theme)==null?void 0:h[s])||l.color;return a?` --color-${o}: ${a};`:null}).join(` `)} } `).join(` `)}}):null},I$e=I.forwardRef(({active:e,payload:t,className:n,indicator:s="dot",hideLabel:i=!1,hideIndicator:o=!1,label:l,labelFormatter:a,labelClassName:h,formatter:p,color:x,nameKey:y,labelKey:b},j)=>{const{config:N}=A$e(),C=I.useMemo(()=>{var F;if(i||!(t!=null&&t.length))return null;const[E]=t,T=`${b||E.dataKey||E.name||"value"}`,L=zpe(N,E,T),z=!b&&typeof l=="string"?((F=N[l])==null?void 0:F.label)||l:L==null?void 0:L.label;return a?r.jsx("div",{className:$t("font-medium",h),children:a(z,t)}):z?r.jsx("div",{className:$t("font-medium",h),children:z}):null},[l,a,t,i,h,N,b]);if(!e||!(t!=null&&t.length))return null;const A=t.length===1&&s!=="dot";return r.jsxs("div",{ref:j,className:$t("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[A?null:C,r.jsx("div",{className:"grid gap-1.5",children:t.map((E,T)=>{const L=`${y||E.name||E.dataKey||"value"}`,z=zpe(N,E,L),F=x||E.payload.fill||E.color;return r.jsx("div",{className:$t("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",s==="dot"&&"items-center"),children:p&&(E==null?void 0:E.value)!==void 0&&E.name?p(E.value,E.name,E,T,E.payload):r.jsxs(r.Fragment,{children:[z!=null&&z.icon?r.jsx(z.icon,{}):!o&&r.jsx("div",{className:$t("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":s==="dot","w-1":s==="line","w-0 border-[1.5px] border-dashed bg-transparent":s==="dashed","my-0.5":A&&s==="dashed"}),style:{"--color-bg":F,"--color-border":F}}),r.jsxs("div",{className:$t("flex flex-1 justify-between leading-none",A?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[A?C:null,r.jsx("span",{className:"text-muted-foreground",children:(z==null?void 0:z.label)||E.name})]}),E.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:E.value.toLocaleString()})]})]})},E.dataKey)})})]})});I$e.displayName="ChartTooltip";const BHt=I.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:s="bottom",nameKey:i},o)=>{const{config:l}=A$e();return n!=null&&n.length?r.jsx("div",{ref:o,className:$t("flex items-center justify-center gap-4",s==="top"?"pb-3":"pt-3",e),children:n.map(a=>{const h=`${i||a.dataKey||"value"}`,p=zpe(l,a,h);return r.jsxs("div",{className:$t("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[p!=null&&p.icon&&!t?r.jsx(p.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:a.color}}),p==null?void 0:p.label]},a.value)})}):null});BHt.displayName="ChartLegend";function zpe(e,t,n){if(typeof t!="object"||t===null)return;const s="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let i=n;return n in t&&typeof t[n]=="string"?i=t[n]:s&&n in s&&typeof s[n]=="string"&&(i=s[n]),i in e?e[i]:e[n]}const r8=["hsl(var(--primary))","hsl(var(--secondary))","hsl(210, 70%, 50%)","hsl(170, 60%, 45%)","hsl(280, 60%, 55%)","hsl(30, 70%, 50%)","hsl(340, 65%, 55%)","hsl(200, 65%, 50%)"];function P$e({stats:e,year:t}){const n=e.transactionsByMonth.some(i=>i.count>0),s=e.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):r.jsxs("div",{className:"grid gap-6",children:[n&&r.jsxs(Ge,{className:"overflow-hidden",children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(Xe,{className:"overflow-hidden",children:r.jsx(E$e,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Dfe,{width:"100%",height:"100%",children:r.jsxs(DHt,{data:e.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(f$e,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(qie,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(Vie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(Qp,{content:r.jsx(I$e,{})}),r.jsx(hk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(Xe,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Dfe,{width:"100%",height:"100%",children:r.jsxs(RHt,{children:[r.jsx(_y,{data:e.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:i,percent:o})=>o>.05?`${i} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:e.leadSourceBreakdown.map((i,o)=>r.jsx(yie,{fill:r8[o%r8.length]},`cell-${o}`))}),r.jsx(Qp,{formatter:(i,o)=>[`${i} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:e.leadSourceBreakdown.slice(0,6).map((i,o)=>r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:r8[o%r8.length]}}),r.jsx("span",{className:"text-muted-foreground",children:i.name})]},i.name))})]})]})]})}function $Ht(e){if(!e||!e.trim())return null;const t=e.trim(),n=["yyyy-MM-dd","M/d/yyyy","MM/dd/yyyy","M-d-yyyy","MM-dd-yyyy","MM/dd/yy","M/d/yy"];for(const s of n)try{const i=fxe(t,s,new Date);if(whe(i))return xn(i,"yyyy-MM-dd")}catch{}try{const s=new Date(t);if(whe(s))return xn(s,"yyyy-MM-dd")}catch{}return null}const UHt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function qHt({open:e,onOpenChange:t}){const[n,s]=I.useState([]),[i,o]=I.useState(!1),[l,a]=I.useState(0),{data:h}=kse(),{data:p}=Ug(),x=Nse(),y=()=>{const E=UHt.join(","),T=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),L=`${E} ${T}`,z=new Blob([L],{type:"text/csv"}),F=URL.createObjectURL(z),q=document.createElement("a");q.href=F,q.download="transaction-import-template.csv",q.click(),URL.revokeObjectURL(F)},b=E=>{const T=E.split(` `).filter(z=>z.trim());if(T.length<2)return[];const L=T[0].split(",").map(z=>z.trim().toLowerCase().replace(/['"]/g,""));return T.slice(1).map((z,F)=>{var fe,de,ye,Ie;const q=[];let H="",K=!1;for(const Ne of z)Ne==='"'?K=!K:Ne===","&&!K?(q.push(H.trim()),H=""):H+=Ne;q.push(H.trim());const Z=Ne=>{var he;const we=L.indexOf(Ne);return we>=0?(he=q[we])==null?void 0:he.replace(/^["']|["']$/g,"").trim():""},te=(fe=Z("transaction_type"))==null?void 0:fe.toLowerCase(),ae=(de=Z("sale_price"))==null?void 0:de.replace(/[$,]/g,""),le=(ye=Z("commission_amount"))==null?void 0:ye.replace(/[$,]/g,""),ve=(Ie=Z("is_win"))==null?void 0:Ie.toLowerCase(),ne=Z("close_date"),ge=$Ht(ne);let ie;return Z("property_address")?["buyer","seller"].includes(te)?ge?(!ae||isNaN(Number(ae)))&&(ie="Invalid sale price"):ie=`Invalid date format: "${ne}" - use MM/DD/YYYY or YYYY-MM-DD`:ie='Transaction type must be "buyer" or "seller"':ie="Missing property address",{property_address:Z("property_address"),city:Z("city"),state:Z("state"),zip:Z("zip"),transaction_type:te==="seller"?"seller":"buyer",close_date:ge||"",sale_price:Number(ae)||0,commission_amount:le?Number(le):null,lead_source_name:Z("lead_source"),client_type_name:Z("client_type"),is_win:["yes","true","1"].includes(ve),notes:Z("notes"),error:ie}})},j=E=>{var z;const T=(z=E.target.files)==null?void 0:z[0];if(!T)return;const L=new FileReader;L.onload=F=>{var K;const q=(K=F.target)==null?void 0:K.result,H=b(q);s(H)},L.readAsText(T)},N=async()=>{const E=n.filter(z=>!z.error);if(E.length===0){ze.error("No valid transactions to import");return}o(!0),a(0);let T=0,L=0;for(let z=0;zK.name.toLowerCase()===F.lead_source_name.toLowerCase()),H=p==null?void 0:p.find(K=>K.name.toLowerCase()===F.client_type_name.toLowerCase());await x.mutateAsync({property_address:F.property_address,city:F.city||null,state:F.state||null,zip:F.zip||null,transaction_type:F.transaction_type,close_date:F.close_date,sale_price:F.sale_price,commission_amount:F.commission_amount,lead_source_id:(q==null?void 0:q.id)||null,client_type_id:(H==null?void 0:H.id)||null,contact_id:null,notes:F.notes||null,is_win:F.is_win}),T++}catch(q){L++,console.error("Failed to import transaction:",q)}a(Math.round((z+1)/E.length*100))}o(!1),T>0&&ze.success(`Imported ${T} transaction${T>1?"s":""}`),L>0&&ze.error(`Failed to import ${L} transaction${L>1?"s":""}`),s([]),t(!1)},C=n.filter(E=>!E.error).length,A=n.filter(E=>E.error).length;return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Import Transactions"}),r.jsx(es,{children:"Upload a CSV file with your past transactions"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Download Template"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Get a CSV template with the correct format"})]}),r.jsxs(ee,{variant:"outline",onClick:y,children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(at,{id:"csv-file",type:"file",accept:".csv",onChange:j})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Rt,{variant:"outline",children:[n.length," rows found"]}),C>0&&r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(Ca,{className:"h-3 w-3 mr-1"}),C," valid"]}),A>0&&r.jsxs(Rt,{variant:"destructive",children:[r.jsx(El,{className:"h-3 w-3 mr-1"}),A," errors"]})]}),r.jsx(Jo,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((E,T)=>r.jsxs("div",{className:`p-2 rounded text-sm ${E.error?"bg-destructive/10":"bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:E.property_address||"(no address)"}),r.jsx(Rt,{variant:E.transaction_type==="buyer"?"default":"secondary",children:E.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[E.close_date," • $",E.sale_price.toLocaleString()]}),E.error&&r.jsx(Fxe,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(zxe,{className:"text-xs",children:E.error})})]},T)),n.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",n.length-10," more"]})]})}),i&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${l}%`}})}),r.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Importing... ",l,"%"]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{onClick:N,disabled:C===0||i,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Import ",C," Transaction",C!==1?"s":""]})]})]})]})})}const VHt=u3({transactions_goal:lA().min(0).optional(),volume_goal:lA().min(0).optional(),gci_goal:lA().min(0).optional()});function HHt({open:e,onOpenChange:t,year:n,existingGoals:s}){const i=_pt(),{data:o}=Sse(),l=(o==null?void 0:o.show_commission)??!0,a=hse({resolver:fse(VHt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});I.useEffect(()=>{s?a.reset({transactions_goal:s.transactions_goal??void 0,volume_goal:s.volume_goal?Number(s.volume_goal):void 0,gci_goal:s.gci_goal?Number(s.gci_goal):void 0}):a.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[s,a,e]);const h=async p=>{await i.mutateAsync({year:n,transactions_goal:p.transactions_goal??null,volume_goal:p.volume_goal??null,gci_goal:l?p.gci_goal??null:null}),t(!1)};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:[n," Goals"]}),r.jsx(es,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(pse,{...a,children:r.jsxs("form",{onSubmit:a.handleSubmit(h),className:"space-y-4",children:[r.jsx(Ml,{control:a.control,name:"transactions_goal",render:({field:p})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Transactions Goal"}),r.jsx(wl,{children:r.jsx(at,{type:"number",placeholder:"e.g., 24",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(cee,{children:"Total number of deals you want to close"}),r.jsx(wu,{})]})}),r.jsx(Ml,{control:a.control,name:"volume_goal",render:({field:p})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"Volume Goal ($)"}),r.jsx(wl,{children:r.jsx(at,{type:"number",placeholder:"e.g., 5000000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(cee,{children:"Total sales volume you want to achieve"}),r.jsx(wu,{})]})}),l&&r.jsx(Ml,{control:a.control,name:"gci_goal",render:({field:p})=>r.jsxs(_l,{children:[r.jsx(bl,{children:"GCI Goal ($)"}),r.jsx(wl,{children:r.jsx(at,{type:"number",placeholder:"e.g., 150000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(cee,{children:"Gross commission income target"}),r.jsx(wu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:i.isPending,children:"Save Goals"})]})]})})]})})}const L$e=new Date().getFullYear(),WHt=Array.from({length:10},(e,t)=>L$e-t);function GHt(){var F;const[e,t]=I.useState(L$e),[n,s]=I.useState(!1),[i,o]=I.useState(!1),[l,a]=I.useState(!1),[h,p]=I.useState(!1),{data:x,isLoading:y}=Nxe(e),{yearStats:b,lifetimeStats:j,showCommission:N}=FOe(e),{data:C,isLoading:A}=ROe(e),{data:E}=Sse(),T=bpt(),L=()=>{if(!x||x.length===0)return;const q=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...N?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],H=x.map(le=>{var ve,ne;return[le.property_address,le.city||"",le.state||"",le.zip||"",le.transaction_type,le.close_date,le.sale_price,...N?[le.commission_amount||""]:[],((ve=le.lead_source)==null?void 0:ve.name)||"",((ne=le.client_type)==null?void 0:ne.name)||"",le.contact?`${le.contact.first_name} ${le.contact.last_name||""}`.trim():"",le.is_win?"Yes":"No",le.notes||""]}),K=[q,...H].map(le=>le.map(ve=>`"${String(ve).replace(/"/g,'""')}"`).join(",")).join(` `),Z=new Blob([K],{type:"text/csv"}),te=URL.createObjectURL(Z),ae=document.createElement("a");ae.href=te,ae.download=`transactions-${e}.csv`,ae.click(),URL.revokeObjectURL(te)},z=!x||x.length===0;return r.jsxs(Or,{title:"Scorecard",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Scorecard"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Business Scorecard"}),r.jsx("p",{className:"text-muted-foreground",children:"Track your transactions, goals, and performance"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(vn,{value:String(e),onValueChange:q=>t(Number(q)),children:[r.jsx(mn,{className:"w-[120px]",children:r.jsx(_n,{})}),r.jsx(gn,{children:WHt.map(q=>r.jsx(Ht,{value:String(q),children:q},q))})]}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(!h),children:r.jsx(fd,{className:"h-4 w-4"})})]})]}),h&&r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsx(Qt,{className:"text-lg",children:"Settings"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Ue,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(Rs,{checked:(E==null?void 0:E.show_commission)??!0,onCheckedChange:q=>T.mutate({show_commission:q})})]})})]}),z&&!y?r.jsx(Ge,{className:"py-12",children:r.jsxs(Xe,{className:"text-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(ac,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Start Tracking Your Success"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mt-1",children:"Add your past transactions to see your performance metrics, track your goals, and celebrate your wins."})]}),r.jsxs("div",{className:"flex flex-wrap justify-center gap-2 pt-2",children:[r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(ee,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Import CSV"]})]}),r.jsxs("div",{className:"pt-4 border-t mt-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Need help formatting your data?"}),r.jsx(ee,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download CSV Template"]})})]})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(ee,{variant:"outline",onClick:()=>a(!0),children:[r.jsx(Kx,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(ee,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(ee,{variant:"outline",onClick:L,disabled:z,children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"CSV Template"]})})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:b.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.totalTransactions," lifetime"]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Vn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[b.buyerCount,"/",b.sellerCount]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ud,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(b.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ed(j.totalVolume,!0)," lifetime"]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Zf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(b.averagePrice,!0)})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Pl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((F=b.topLeadSource)==null?void 0:F.name)||"-"}),b.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.topLeadSource.count," deals"]})]})}),N&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ud,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(b.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ed(j.totalCommission,!0)," lifetime"]})]})})]}),C&&r.jsx(qze,{goals:C,stats:b,year:e,showCommission:N}),r.jsxs(ba,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"transactions",children:"Transactions"}),r.jsx(ln,{value:"charts",children:"Charts"})]}),r.jsx(An,{value:"transactions",children:r.jsx(Uze,{transactions:x||[],showCommission:N,isLoading:y})}),r.jsx(An,{value:"charts",children:r.jsx(P$e,{stats:b,year:e})})]})]})]}),r.jsx($ze,{open:n,onOpenChange:s}),r.jsx(qHt,{open:i,onOpenChange:o}),r.jsx(HHt,{open:l,onOpenChange:a,year:e,existingGoals:C})]})}function O$e({open:e,onOpenChange:t,listingId:n,listingSlug:s,listingTitle:i}){const{user:o}=zr(),[l,a]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(!1);I.useEffect(()=>{(async()=>{if(!(!e||!o)){p(!0);try{const{data:A,error:E}=await J.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",n).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(E)throw E;if(A&&A.share_token)a(A);else if(A&&!A.share_token){const{data:T,error:L}=await J.from("listing_shares").update({share_type:"referral_link"}).eq("id",A.id).select("id, share_token, click_count, lead_count").single();if(L)throw L;a(T)}else{const{data:T,error:L}=await J.from("listing_shares").insert({listing_id:n,sharing_agent_id:o.id,share_type:"referral_link"}).select("id, share_token, click_count, lead_count").single();if(L)throw L;a(T)}}catch(A){console.error("Error creating share link:",A),ze.error("Failed to generate share link")}finally{p(!1)}}})()},[e,o,n]);const b=l!=null&&l.share_token?`https://listings.relevelup.com/${s||n}?ref=${l.share_token}`:"",j=async()=>{try{await navigator.clipboard.writeText(b),y(!0),ze.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{ze.error("Failed to copy link")}},N=C=>{const A=encodeURIComponent(b),E=encodeURIComponent(`Check out this listing: ${i}`);switch(C){case"email":window.open(`mailto:?subject=${E}&body=${A}`);break;case"text":window.open(`sms:?body=${E}%20${A}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${A}`,"_blank");break}};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Cs,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(es,{children:"Share this listing with your network. When someone submits a lead through your link, they'll become your contact!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:r.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[r.jsx("strong",{children:"How it works:"})," The listing still shows the original agent's info, but any leads from your unique link go directly to you!"]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:h?"Generating...":b,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:j,disabled:h||!b,variant:x?"default":"outline",children:x?r.jsx(Ca,{className:"h-4 w-4"}):r.jsx(pl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>N("email"),disabled:h,children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>N("text"),disabled:h,children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>N("facebook"),disabled:h,children:[r.jsx(Od,{className:"h-4 w-4 mr-2"}),"Facebook"]})]})]}),l&&(l.click_count>0||l.lead_count>0)&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx(Ue,{className:"mb-2 block",children:"Your Share Performance"}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground mb-1",children:[r.jsx(Qo,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Clicks"})]}),r.jsx("p",{className:"text-2xl font-bold",children:l.click_count})]}),r.jsxs("div",{className:"bg-primary/10 rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-primary mb-1",children:[r.jsx(Vn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs",children:"Leads"})]}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:l.lead_count})]})]})]})]})]})})}const KHt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},ZHt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},YHt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function n8({listing:e,onClick:t,onEdit:n,onDelete:s,showActions:i}){var C,A;const{user:o}=zr(),{data:l}=EOe(e.id),a=AOe(),[h,p]=I.useState(!1),x=E=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(E),y=((C=e.photos)==null?void 0:C.find(E=>E.is_primary))||((A=e.photos)==null?void 0:A[0]),b=(o==null?void 0:o.id)===e.agent_id,j=async E=>{E.stopPropagation();try{const T=await a.mutateAsync(e.id);ze.success(T.saved?"Listing saved!":"Listing removed from saved")}catch{ze.error("Failed to save listing")}},N=E=>{if(E.stopPropagation(),o)p(!0);else{const T=`https://listings.relevelup.com/${e.slug||e.id}`;navigator.clipboard.writeText(T),ze.success("Link copied to clipboard!")}};return r.jsxs(Ge,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:t,children:[r.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[y?r.jsx("img",{src:y.photo_url,alt:e.property_address||e.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(ym,{className:"h-12 w-12"})}),r.jsx(Rt,{className:`absolute top-2 left-2 ${KHt[e.status]} text-white border-0`,children:ZHt[e.status]}),e.is_featured&&r.jsx("div",{className:"absolute top-2 right-2 p-1.5 bg-amber-500 rounded-full",children:r.jsx(vs,{className:"h-4 w-4 text-white fill-white"})}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[r.jsx(ee,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:j,children:r.jsx(oa,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),r.jsx(ee,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:N,title:b?"Copy link":"Share & earn leads",children:b?r.jsx(uc,{className:"h-4 w-4"}):r.jsx(Cs,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(O$e,{open:h,onOpenChange:p,listingId:e.id,listingSlug:e.slug||null,listingTitle:e.property_address||`${e.city}, ${e.state}`}),r.jsxs(Xe,{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xl font-bold text-primary",children:x(e.price)}),e.open_to_referrals&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:[r.jsx(Vn,{className:"h-3 w-3 mr-1"}),"Referrals"]})]}),r.jsxs("div",{children:[e.property_address&&r.jsx("p",{className:"font-medium truncate",children:e.property_address}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(ml,{className:"h-3 w-3"}),e.city,", ",e.state,e.neighborhood&&` • ${e.neighborhood}`]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.bedrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Hf,{className:"h-4 w-4"}),e.bedrooms," bd"]}),e.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Vf,{className:"h-4 w-4"}),e.bathrooms," ba"]}),e.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ym,{className:"h-4 w-4"}),e.square_footage.toLocaleString()," sqft"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsx(Rt,{variant:"secondary",className:"text-xs",children:YHt[e.property_type]}),e.agent&&r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:e.agent.name})]}),r.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Qo,{className:"h-3 w-3"}),e.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(uc,{className:"h-3 w-3"}),e.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-3 w-3"}),e.save_count]})]}),i&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(ee,{variant:"outline",size:"sm",className:"flex-1",onClick:E=>{E.stopPropagation(),n()},children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(ee,{variant:"destructive",size:"sm",onClick:E=>{E.stopPropagation(),s()},children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})]})}const XHt=[{value:"active",label:"Active"},{value:"coming_soon",label:"Coming Soon"},{value:"price_improvement",label:"Price Improvement"},{value:"under_contract",label:"Under Contract"},{value:"sold",label:"Sold"}],QHt=[{value:"single_family",label:"Single Family"},{value:"condo",label:"Condo"},{value:"townhouse",label:"Townhouse"},{value:"land",label:"Land"},{value:"multi_family",label:"Multi-Family"},{value:"luxury",label:"Luxury"},{value:"commercial",label:"Commercial"},{value:"other",label:"Other"}];function JHt({filters:e,onFiltersChange:t,onClose:n}){const s=()=>{t({sortBy:"newest"})};return r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Qt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(bs,{className:"h-4 w-4"})})]})]}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Status"}),r.jsxs(vn,{value:e.status||"all",onValueChange:i=>t({...e,status:i==="all"?void 0:i}),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"All statuses"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Statuses"}),XHt.map(i=>r.jsx(Ht,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Property Type"}),r.jsxs(vn,{value:e.propertyType||"all",onValueChange:i=>t({...e,propertyType:i==="all"?void 0:i}),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"All types"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Types"}),QHt.map(i=>r.jsx(Ht,{value:i.value,children:i.label},i.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Min Price"}),r.jsx(at,{type:"number",placeholder:"No minimum",value:e.minPrice||"",onChange:i=>t({...e,minPrice:i.target.value?Number(i.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Max Price"}),r.jsx(at,{type:"number",placeholder:"No maximum",value:e.maxPrice||"",onChange:i=>t({...e,maxPrice:i.target.value?Number(i.target.value):void 0})})]})]}),r.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(Rs,{checked:e.openToReferrals||!1,onCheckedChange:i=>t({...e,openToReferrals:i||void 0})})]})]})]})}function eWt({leaderboard:e}){const t=s=>{switch(s){case 0:return r.jsx(Wa,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(Hx,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Pl,{className:"h-5 w-5 text-amber-700"});default:return r.jsx("span",{className:"text-sm font-medium text-muted-foreground w-5 text-center",children:s+1})}},n=(s,i)=>!s||s.length===0?r.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"No data yet. Start sharing to climb the leaderboard!"}):r.jsx("div",{className:"space-y-2",children:s.map((o,l)=>r.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${l===0?"bg-gradient-to-r from-amber-500/10 to-amber-500/5 border border-amber-500/20":"bg-muted/50"}`,children:[r.jsx("div",{className:"flex items-center justify-center w-8",children:t(l)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"font-medium truncate",children:o.name})}),r.jsxs(Rt,{variant:l===0?"default":"secondary",children:[o.count," ",i]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Wa,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-emerald-500/10 to-emerald-500/5 border border-emerald-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-emerald-500/20 flex items-center justify-center",children:r.jsx(uc,{className:"h-6 w-6 text-emerald-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Listing Amplifier"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Share 10+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-sky-500/10 to-sky-500/5 border border-sky-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-sky-500/20 flex items-center justify-center",children:r.jsx(fi,{className:"h-6 w-6 text-sky-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Top Contributor"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add 5+ listings"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-purple-500/10 to-purple-500/5 border border-purple-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-purple-500/20 flex items-center justify-center",children:r.jsx(Hx,{className:"h-6 w-6 text-purple-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Referral Connector"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Send 3+ referrals"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-amber-500/10 to-amber-500/5 border border-amber-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-amber-500/20 flex items-center justify-center",children:r.jsx(Wa,{className:"h-6 w-6 text-amber-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Community MVP"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Top performer"})]})]})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Community Leaderboard"})}),r.jsx(Xe,{children:r.jsxs(ba,{defaultValue:"sharers",children:[r.jsxs(fa,{className:"w-full",children:[r.jsxs(ln,{value:"sharers",className:"flex-1",children:[r.jsx(uc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(ln,{value:"listers",className:"flex-1",children:[r.jsx(fi,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(An,{value:"sharers",className:"mt-4",children:n(e==null?void 0:e.topSharers,"shares")}),r.jsx(An,{value:"listers",className:"mt-4",children:n(e==null?void 0:e.topListers,"listings")})]})})]})]})}function tWt(){var Z,te,ae,le,ve,ne,ge,ie;const e=ns(),{brokerageId:t}=zr(),{data:n,isLoading:s}=SOe(),[i,o]=I.useState("feed"),[l,a]=I.useState(!1),[h,p]=I.useState(""),[x,y]=I.useState({sortBy:"newest"}),{data:b,isLoading:j}=COe({...x,city:h||x.city}),{data:N,isLoading:C}=npt(),{data:A,isLoading:E}=kxe(),{data:T,isLoading:L}=opt(),{data:z,isLoading:F}=dpt(),{data:q}=cpt(),H=TOe(),K=async fe=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await H.mutateAsync(fe),ze.success("Listing deleted successfully")}catch{ze.error("Failed to delete listing")}};return s?r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):n?r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs(ee,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(fi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(b==null?void 0:b.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(oa,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(N==null?void 0:N.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(dj,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(A==null?void 0:A.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(Vn,{className:"h-5 w-5 text-sky-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(((Z=T==null?void 0:T.sent)==null?void 0:Z.length)||0)+(((te=T==null?void 0:T.received)==null?void 0:te.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(ba,{value:i,onValueChange:o,children:[r.jsxs(fa,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(ln,{value:"feed",children:"Community Feed"}),t&&r.jsx(ln,{value:"brokerage",children:"Brokerage"}),r.jsx(ln,{value:"my-listings",children:"My Listings"}),r.jsx(ln,{value:"saved",children:"Saved"}),r.jsx(ln,{value:"referrals",children:"Referrals"}),r.jsx(ln,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(An,{value:"feed",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by city or neighborhood...",value:h,onChange:fe=>p(fe.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:x.sortBy,onValueChange:fe=>y({...x,sortBy:fe}),children:[r.jsx(mn,{className:"w-[180px]",children:r.jsx(_n,{placeholder:"Sort by"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"newest",children:"Newest First"}),r.jsx(Ht,{value:"updated",children:"Recently Updated"}),r.jsx(Ht,{value:"price_asc",children:"Price: Low to High"}),r.jsx(Ht,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(ee,{variant:"outline",onClick:()=>a(!l),children:[r.jsx(pj,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(JHt,{filters:x,onFiltersChange:y,onClose:()=>a(!1)}),j?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((fe,de)=>r.jsxs(Ge,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"}),r.jsx(Pr,{className:"h-4 w-1/4"})]})]},de))}):(b==null?void 0:b.length)===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to share a listing with the community!"}),r.jsxs(ee,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:b==null?void 0:b.map(fe=>r.jsx(n8,{listing:fe,onClick:()=>e(`/mission-control/listings/${fe.id}`)},fe.id))})]}),r.jsx(An,{value:"my-listings",className:"space-y-4",children:E?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,de)=>r.jsxs(Ge,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"})]})]},de))}):(A==null?void 0:A.length)===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(dj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Share your listings with the LevelUp community!"}),r.jsxs(ee,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Your First Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:A==null?void 0:A.map(fe=>r.jsx(n8,{listing:fe,showActions:!0,onClick:()=>e(`/mission-control/listings/${fe.id}`),onEdit:()=>e(`/mission-control/listings/${fe.id}/edit`),onDelete:()=>K(fe.id)},fe.id))})}),r.jsx(An,{value:"saved",className:"space-y-4",children:C?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,de)=>r.jsxs(Ge,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"})]})]},de))}):(N==null?void 0:N.length)===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(oa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No saved listings"}),r.jsx("p",{className:"text-muted-foreground",children:"Save listings to quickly access them later"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:N==null?void 0:N.map(fe=>r.jsx(n8,{listing:fe.listing,onClick:()=>e(`/mission-control/listings/${fe.listing.id}`)},fe.id))})}),r.jsx(An,{value:"referrals",className:"space-y-6",children:r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(uc,{className:"h-4 w-4"}),"Referrals Sent (",((ae=T==null?void 0:T.sent)==null?void 0:ae.length)||0,")"]}),((le=T==null?void 0:T.sent)==null?void 0:le.length)===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(ve=T==null?void 0:T.sent)==null?void 0:ve.map(fe=>{var de,ye;return r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fe.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((de=fe.listing)==null?void 0:de.property_address)||((ye=fe.listing)==null?void 0:ye.city)})]}),r.jsx(Rt,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]})})},fe.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(Vn,{className:"h-4 w-4"}),"Referrals Received (",((ne=T==null?void 0:T.received)==null?void 0:ne.length)||0,")"]}),((ge=T==null?void 0:T.received)==null?void 0:ge.length)===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(ie=T==null?void 0:T.received)==null?void 0:ie.map(fe=>{var de;return r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fe.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(de=fe.sender)==null?void 0:de.name]})]}),r.jsx(Rt,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]}),r.jsx(ee,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>e(`/mission-control/listings/${fe.listing_id}`),children:"View Listing"})]})},fe.id)})})]})]})}),t&&r.jsx(An,{value:"brokerage",className:"space-y-4",children:F?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,de)=>r.jsxs(Ge,{children:[r.jsx(Pr,{className:"h-48 w-full"}),r.jsxs(Xe,{className:"p-4 space-y-2",children:[r.jsx(Pr,{className:"h-5 w-3/4"}),r.jsx(Pr,{className:"h-4 w-1/2"})]})]},de))}):(z==null?void 0:z.length)===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(dj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No brokerage listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No agents in your brokerage have added listings yet."}),r.jsxs(ee,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add a Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:z==null?void 0:z.map(fe=>r.jsx(n8,{listing:fe,onClick:()=>e(`/mission-control/listings/${fe.id}`)},fe.id))})}),r.jsx(An,{value:"leaderboard",children:r.jsx(eWt,{leaderboard:q})})]})]})}):r.jsx(Or,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Coming Soon"}),r.jsx("p",{className:"text-muted-foreground",children:"Listing Exchange is currently in development. Check back soon!"})]})})})}function O0e(){const{user:e}=zr();return Zt({queryKey:["deal-pipeline-stages",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await J.from("deal_pipeline_stages").select("*").eq("owner_user_id",e.id).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function D$e(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async()=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{error:n}=await J.rpc("initialize_deal_pipeline_stages",{p_user_id:e.id});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function R$e(){const{user:e}=zr();return Zt({queryKey:["deal-pipeline-deals",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await J.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status) `).eq("owner_user_id",e.id).order("updated_at",{ascending:!1});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function F$e(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:i}=await J.from("deal_pipeline").insert({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||null,contact_id:n.contact_id||null,listing_id:n.listing_id||null,property_address:n.property_address||null,city:n.city||null,state:n.state||null,zip_code:n.zip_code||null,expected_price:n.expected_price||null,expected_commission:n.expected_commission||null,commission_percentage:n.commission_percentage||3,target_close_date:n.target_close_date||null,contract_date:n.contract_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:e.id}).select().single();if(i)throw i;return await J.from("deal_activities").insert([{deal_id:s.id,activity_type:"system",title:"Deal created",description:`Deal "${n.deal_name}" was created`}]),s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function z$e(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("deal_pipeline").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function rWt(){const e=Wr();return cr({mutationFn:async({dealId:t,stageId:n,stageName:s})=>{const{data:i,error:o}=await J.from("deal_pipeline").update({stage_id:n}).eq("id",t).select().single();if(o)throw o;return await J.from("deal_activities").insert({deal_id:t,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),i},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-activities"]})}})}function nWt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("deal_pipeline").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function sWt(e){return Zt({queryKey:["deal-activities",e],queryFn:async()=>{const{data:t,error:n}=await J.from("deal_activities").select("*").eq("deal_id",e).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function iWt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("deal_activities").insert([{deal_id:t.deal_id,activity_type:t.activity_type,title:t.title,description:t.description||null}]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-activities",n.deal_id]})}})}function aWt(e){return Zt({queryKey:["deal-checklist",e],queryFn:async()=>{const{data:t,error:n}=await J.from("deal_checklist_items").select("*").eq("deal_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function oWt(){const e=Wr();return cr({mutationFn:async({id:t,is_completed:n,deal_id:s})=>{const{data:i,error:o}=await J.from("deal_checklist_items").update({is_completed:n,completed_at:n?new Date().toISOString():null}).eq("id",t).select().single();if(o)throw o;return i},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function lWt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("deal_checklist_items").insert([{deal_id:t.deal_id,title:t.title,description:t.description||null,due_date:t.due_date||null,sort_order:t.sort_order||0}]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function cWt(){const{user:e}=zr();return Zt({queryKey:["deal-pipeline-stats",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return null;const{data:t,error:n}=await J.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",e.id);if(n)throw n;const s=(t==null?void 0:t.filter(o=>{var l,a;return!((l=o.deal_pipeline_stages)!=null&&l.is_won_stage)&&!((a=o.deal_pipeline_stages)!=null&&a.is_lost_stage)}))||[],i=(t==null?void 0:t.filter(o=>{var l;return(l=o.deal_pipeline_stages)==null?void 0:l.is_won_stage}))||[];return{totalDeals:(t==null?void 0:t.length)||0,activeDeals:s.length,wonDeals:i.length,pipelineValue:s.reduce((o,l)=>o+(l.expected_price||0),0),expectedCommission:s.reduce((o,l)=>o+(l.expected_commission||0),0),wonValue:i.reduce((o,l)=>o+(l.expected_price||0),0)}},enabled:!!(e!=null&&e.id)})}function dWt(e){const{user:t}=zr();return Zt({queryKey:["deal-by-listing",e,t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id)||!e)return null;const{data:n,error:s}=await J.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",t.id).eq("listing_id",e).maybeSingle();if(s)throw s;return n},enabled:!!(t!=null&&t.id)&&!!e})}function uWt(){const e=Wr();return cr({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:i}=await J.from("deal_pipeline").update({listing_id:n}).eq("id",t).select().single();if(i)throw i;return await J.from("deal_activities").insert({deal_id:t,activity_type:"system",title:"Linked to Listing Exchange",description:"This deal is now synced with Listing Exchange",metadata:{listing_id:n}}),s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",n.listingId]})}})}function hWt(){const e=Wr();return cr({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:i}=await J.from("deal_pipeline").update({listing_id:null}).eq("id",t).select().single();if(i)throw i;return{data:s,listingId:n}},onSuccess:t=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",t.listingId]})}})}function fWt({listing:e}){const t=ns(),[n,s]=I.useState(""),[i,o]=I.useState(!1),{data:l,isLoading:a}=dWt(e.id),{data:h,isLoading:p}=O0e(),{data:x,isLoading:y}=R$e(),b=D$e(),j=uWt(),N=hWt(),C=F$e(),A=(x==null?void 0:x.filter(F=>!F.listing_id))||[],E=F=>{if(!(h!=null&&h.length))return null;switch(F){case"coming_soon":case"active":case"price_improvement":return h.find(q=>q.name==="Active");case"under_contract":return h.find(q=>q.name==="Under Contract");case"sold":return h.find(q=>q.is_won_stage);default:return h.find(q=>q.name==="Active")}},T=async()=>{o(!0);try{h!=null&&h.length||await b.mutateAsync();const F=E(e.status);await C.mutateAsync({deal_name:e.property_address?`${e.property_address}, ${e.city}`:`${e.city}, ${e.state}`,deal_type:"seller",stage_id:(F==null?void 0:F.id)||null,listing_id:e.id,property_address:e.property_address,city:e.city,state:e.state,expected_price:e.price,expected_commission:e.price*.03,commission_percentage:3,priority:"medium",probability:50}),ze.success("Deal created and linked to listing!")}catch(F){console.error("Failed to create deal:",F),ze.error("Failed to create deal")}finally{o(!1)}},L=async()=>{if(!n){ze.error("Please select a deal");return}try{await j.mutateAsync({dealId:n,listingId:e.id}),ze.success("Listing linked to deal!"),s("")}catch{ze.error("Failed to link listing")}},z=async()=>{if(l)try{await N.mutateAsync({dealId:l.id,listingId:e.id}),ze.success("Listing unlinked from deal")}catch{ze.error("Failed to unlink listing")}};return a||p?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2 text-base",children:[r.jsx(m1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(nn,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(Ge,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Qt,{className:"flex items-center gap-2 text-base",children:[r.jsx(Xh,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(Xe,{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:l.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:l.deal_pipeline_stages&&r.jsx(Rt,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${l.deal_pipeline_stages.color}20`,color:l.deal_pipeline_stages.color},children:l.deal_pipeline_stages.name})})]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes sync automatically between the listing and pipeline."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>t("/mission-control/pipeline"),children:["View Pipeline",r.jsx(Zo,{className:"h-3 w-3 ml-1"})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:z,disabled:N.isPending,children:N.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(tA,{className:"h-4 w-4"})})]})]})]}):r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Qt,{className:"flex items-center gap-2 text-base",children:[r.jsx(m1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(ee,{onClick:T,disabled:i||C.isPending,className:"w-full",size:"sm",children:[i||C.isPending?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),A.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(vn,{value:n,onValueChange:s,children:[r.jsx(mn,{className:"flex-1 text-sm",children:r.jsx(_n,{placeholder:"Link to existing deal..."})}),r.jsx(gn,{children:A.map(F=>r.jsx(Ht,{value:F.id,children:F.deal_name},F.id))})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:L,disabled:!n||j.isPending,children:j.isPending?r.jsx(nn,{className:"h-4 w-4 animate-spin"}):r.jsx(Xh,{className:"h-4 w-4"})})]})]})]})]})}const pWt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},mWt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},x5e={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function gWt(){var ve,ne,ge,ie,fe,de,ye,Ie,Ne;const{listingId:e}=Wc(),t=ns(),{user:n}=zr(),{data:s,isLoading:i}=MOe(e||""),{data:o}=EOe(e||""),{data:l}=ipt(e||""),a=AOe(),h=spt(),p=apt(),x=TOe(),y=lpt(),[b,j]=I.useState(!1),[N,C]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState({buyerName:"",buyerType:"",notes:""}),q=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),H=we=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(we),K=async we=>{const he=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,xe=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;p.mutate({listingId:s.id,shareType:we});try{switch(we){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(he)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(he),ze.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${xe} ${he}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(xe)}&body=${encodeURIComponent(`Check out this listing: ${he}`)}`);break}}catch(be){console.error("Share error:",be),ze.error("Failed to share")}},Z=async()=>{try{await x.mutateAsync(s.id),ze.success("Listing deleted"),t("/mission-control/listings")}catch{ze.error("Failed to delete listing")}},te=async()=>{if(!z.buyerName.trim()){ze.error("Please enter buyer name");return}try{await y.mutateAsync({listingId:s.id,listingAgentId:s.agent_id,buyerName:z.buyerName,buyerType:z.buyerType||void 0,notes:z.notes||void 0}),ze.success("Referral sent successfully!"),C(!1),F({buyerName:"",buyerType:"",notes:""})}catch{ze.error("Failed to send referral")}},ae=we=>{var Fe,Me;const he=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,xe=H((s==null?void 0:s.price)||0),be=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Oe=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Te=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Ve=[be,Oe,Te].filter(Boolean).join(" | ");switch(we){case"just_listed":return`🏡 JUST LISTED! ${he} ${xe} ${Ve} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Fe=s==null?void 0:s.city)==null?void 0:Fe.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${he} Now ${xe}! ${Ve} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${x5e[(s==null?void 0:s.property_type)||"single_family"].toLowerCase()} in ${s==null?void 0:s.city}? 👀 I've got just the one for you! ${Ve} DM me for details! 📩 #ComingSoon #RealEstate #${(Me=s==null?void 0:s.city)==null?void 0:Me.replace(/\s/g,"")}`;default:return""}};if(i)return r.jsx(Or,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-10 w-32"}),r.jsx(Pr,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Pr,{className:"h-48"}),r.jsx(Pr,{className:"h-48"}),r.jsx(Pr,{className:"h-48"})]})]})});if(!s)return r.jsx(Or,{title:"Listing Not Found",description:"",children:r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(ee,{onClick:()=>t("/mission-control/listings"),children:"Back to Listings"})]})})});const le=((ve=s.photos)==null?void 0:ve.find(we=>we.is_primary))||((ne=s.photos)==null?void 0:ne[0]);return r.jsxs(Or,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/mission-control/listings"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>le&&L(le.photo_url),children:le?r.jsx("img",{src:le.photo_url,alt:"Primary",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No photos"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:(ge=s.photos)==null?void 0:ge.slice(1,5).map((we,he)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>L(we.photo_url),children:r.jsx("img",{src:we.photo_url,alt:`Photo ${he+2}`,className:"w-full h-full object-cover"})},we.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Rt,{className:`${pWt[s.status]} text-white border-0`,children:mWt[s.status]}),s.is_featured&&r.jsxs(Rt,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(vs,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Rt,{variant:"outline",children:[r.jsx(Vn,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:H(s.price)}),s.property_address&&r.jsx("p",{className:"text-xl font-medium",children:s.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(ml,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>a.mutate(s.id),children:r.jsx(oa,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>h.mutate(s.id),children:l?r.jsx(cj,{className:"h-4 w-4"}):r.jsx(_g,{className:"h-4 w-4"})}),!q&&r.jsxs(ee,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>E(!0),children:[r.jsx(Cs,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(uc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(ap,{children:[r.jsxs(mo,{onClick:()=>K("copy"),children:[r.jsx(pl,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(mo,{onClick:()=>K("facebook"),children:[r.jsx(Od,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(mo,{onClick:()=>K("text"),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(mo,{onClick:()=>K("email"),children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),q&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",onClick:()=>t(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(rc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:()=>j(!0),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[s.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Hf,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bedrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Beds"})]}),s.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(Vf,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.bathrooms}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Baths"})]}),s.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(ym,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.square_footage.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Sq Ft"})]}),s.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(zs,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.year_built}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"pt-4 space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Rt,{variant:"secondary",children:[r.jsx(na,{className:"h-3 w-3 mr-1"}),x5e[s.property_type]]}),s.lot_size&&r.jsxs(Rt,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Rt,{variant:"secondary",children:"HOA"})]}),s.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Description"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})]}),s.agent_notes&&s.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.agent_notes})]}),s.mls_link&&r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]}),r.jsxs("div",{className:"flex items-center gap-4 pt-4 mt-4 border-t text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Qo,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(uc,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(oa,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Share Content"})}),r.jsx(Xe,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(we=>r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("p",{className:"font-medium text-sm capitalize",children:[we.replace("_"," ")," Caption"]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ae(we)),ze.success("Caption copied!")},children:r.jsx(pl,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ae(we)})]},we))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx("span",{className:"text-lg font-semibold text-primary",children:((fe=(ie=s.agent)==null?void 0:ie.name)==null?void 0:fe.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((de=s.agent)==null?void 0:de.name)||"Unknown"}),((Ie=(ye=s.agent)==null?void 0:ye.brokerage)==null?void 0:Ie.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!q&&r.jsx("div",{className:"space-y-2",children:((Ne=s.agent)==null?void 0:Ne.email)&&r.jsx(ee,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),q&&r.jsx(fWt,{listing:s}),!q&&s.open_to_referrals&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(ee,{className:"w-full",onClick:()=>C(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Br,{open:!!T,onOpenChange:()=>L(null),children:r.jsx(Fr,{className:"max-w-4xl",children:r.jsx("img",{src:T||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Br,{open:b,onOpenChange:j,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Delete Listing"}),r.jsx(es,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Z,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Br,{open:N,onOpenChange:C,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Send Buyer Referral"}),r.jsx(es,{children:"Submit buyer information to the listing agent"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Buyer Name *"}),r.jsx(at,{value:z.buyerName,onChange:we=>F({...z,buyerName:we.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Buyer Type"}),r.jsxs(vn,{value:z.buyerType,onValueChange:we=>F({...z,buyerType:we}),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select type"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"first_time",children:"First-Time Buyer"}),r.jsx(Ht,{value:"investor",children:"Investor"}),r.jsx(Ht,{value:"relocating",children:"Relocating"}),r.jsx(Ht,{value:"upgrade",children:"Upgrading"}),r.jsx(Ht,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Notes"}),r.jsx(ps,{value:z.notes,onChange:we=>F({...z,notes:we.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(ee,{onClick:te,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(O$e,{open:A,onOpenChange:E,listingId:(s==null?void 0:s.id)||"",listingSlug:(s==null?void 0:s.slug)||null,listingTitle:(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`})]})}function xWt({selectedVideoId:e,onVideoSelect:t,listingId:n}){const s=ns(),{user:i}=zr(),[o,l]=I.useState(!1),[a,h]=I.useState([]),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,N]=I.useState({});I.useEffect(()=>{e&&i?C():b(null)},[e,i]);const C=async()=>{if(!e)return;const{data:Z,error:te}=await J.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("id",e).eq("is_deleted",!1).single();!te&&Z&&(b(Z),A(Z))},A=async Z=>{try{const{data:te,error:ae}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Z.bunny_video_id,isAgentVideo:!0}});!ae&&(te!=null&&te.thumbnailUrl)&&N(le=>({...le,[Z.id]:{thumbnailUrl:te.thumbnailUrl}}))}catch(te){console.warn("Failed to get signed URL",te)}},E=async()=>{if(i){x(!0);try{const{data:Z,error:te}=await J.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",i.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(te)throw te;h(Z||[]),Z!=null&&Z.length&&T(Z)}catch(Z){console.error("Error fetching videos:",Z),ze.error("Failed to load videos")}finally{x(!1)}}},T=async Z=>{const te=await Promise.allSettled(Z.map(async le=>{const{data:ve,error:ne}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:le.bunny_video_id,isAgentVideo:!0}});if(ne)throw ne;return{id:le.id,thumbnailUrl:ve==null?void 0:ve.thumbnailUrl}})),ae={};for(const le of te)le.status==="fulfilled"&&le.value.thumbnailUrl&&(ae[le.value.id]={thumbnailUrl:le.value.thumbnailUrl});N(le=>({...le,...ae}))},L=()=>{l(!0),E()},z=Z=>{t(Z.id),b(Z),l(!1),ze.success("Video selected")},F=()=>{t(null),b(null)},q=()=>{const Z=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(Z)}`)},H=Z=>{if(!Z)return"0:00";const te=Math.floor(Z/60),ae=Z%60;return`${te}:${ae.toString().padStart(2,"0")}`},K=Z=>{var te;return((te=j[Z.id])==null?void 0:te.thumbnailUrl)||Z.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?r.jsx(Ge,{className:"overflow-hidden",children:r.jsx(Xe,{className:"p-0",children:r.jsxs("div",{className:"flex items-start gap-4 p-4",children:[r.jsxs("div",{className:"relative w-32 h-20 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[K(y)?r.jsx("img",{src:K(y),alt:y.title||"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 flex items-center justify-center",children:r.jsx(dc,{className:"h-6 w-6 text-white fill-white"})}),y.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:H(y.duration_seconds)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:y.title||"Untitled Video"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Property Video Tour"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:L,children:"Change"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:F,className:"text-destructive hover:text-destructive",children:r.jsx(bs,{className:"h-4 w-4"})})]})]})})}):r.jsx(Ge,{className:"border-dashed",children:r.jsx(Xe,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Fi,{className:"h-10 w-10 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add a video walkthrough to showcase this property"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-center",children:[r.jsxs(ee,{type:"button",variant:"outline",onClick:L,className:"gap-2",children:[r.jsx(oS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(ee,{type:"button",variant:"outline",onClick:q,className:"gap-2",children:[r.jsx(bg,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Br,{open:o,onOpenChange:l,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(Hr,{children:r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(oS,{className:"h-5 w-5"}),"Select a Video"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:p?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(nn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):a.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No videos in your library yet"}),r.jsxs(ee,{onClick:q,className:"gap-2",children:[r.jsx(bg,{className:"h-4 w-4"}),"Record Your First Video"]})]}):r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 p-1",children:a.map(Z=>r.jsxs("button",{type:"button",onClick:()=>z(Z),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${e===Z.id?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[K(Z)?r.jsx("img",{src:K(Z),alt:Z.title||"Video",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fi,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:r.jsx(dc,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),Z.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:H(Z.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:Z.title||"Untitled Video"})})]},Z.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:q,className:"gap-2",children:[r.jsx(bg,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(ee,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const yWt=[{value:"active",label:"Active"},{value:"coming_soon",label:"Coming Soon"},{value:"price_improvement",label:"Price Improvement"},{value:"under_contract",label:"Under Contract"},{value:"sold",label:"Sold"}],vWt=[{value:"single_family",label:"Single Family"},{value:"condo",label:"Condo"},{value:"townhouse",label:"Townhouse"},{value:"land",label:"Land"},{value:"multi_family",label:"Multi-Family"},{value:"luxury",label:"Luxury"},{value:"commercial",label:"Commercial"},{value:"other",label:"Other"}];function y5e(){var ge;const{listingId:e}=Wc(),[t]=Fd(),n=t.get("brokerage"),s=ns(),{user:i}=zr(),o=!!e&&e!=="new",l=!!n&&!o,{data:a,isLoading:h}=MOe(o?e:""),p=Qft(),x=Jft(),y=ept(),b=tpt(),j=rpt(),{data:N=[]}=Zt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:ie,error:fe}=await J.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(fe)throw fe;return ie||[]},enabled:l}),[C,A]=I.useState(""),[E,T]=I.useState(!1),[L,z]=I.useState([]),[F,q]=I.useState([]),[H,K]=I.useState({property_address:"",city:"",state:"",neighborhood:"",price:"",property_type:"single_family",status:"active",bedrooms:"",bathrooms:"",square_footage:"",lot_size:"",year_built:"",has_hoa:!1,description:"",agent_notes:"",agent_notes_public:!1,mls_link:"",video_link:"",video_id:null,allow_sharing:!0,open_to_referrals:!0,open_to_social_promotion:!0,share_with_brokerage:!1,is_public:!0});I.useEffect(()=>{var ie,fe,de,ye,Ie;a&&o&&K({property_address:a.property_address||"",city:a.city||"",state:a.state||"",neighborhood:a.neighborhood||"",price:((ie=a.price)==null?void 0:ie.toString())||"",property_type:a.property_type,status:a.status,bedrooms:((fe=a.bedrooms)==null?void 0:fe.toString())||"",bathrooms:((de=a.bathrooms)==null?void 0:de.toString())||"",square_footage:((ye=a.square_footage)==null?void 0:ye.toString())||"",lot_size:a.lot_size||"",year_built:((Ie=a.year_built)==null?void 0:Ie.toString())||"",has_hoa:a.has_hoa,description:a.description||"",agent_notes:a.agent_notes||"",agent_notes_public:a.agent_notes_public,mls_link:a.mls_link||"",video_link:a.video_link||"",video_id:a.video_id||null,allow_sharing:a.allow_sharing,open_to_referrals:a.open_to_referrals,open_to_social_promotion:a.open_to_social_promotion,share_with_brokerage:a.share_with_brokerage??!1,is_public:a.is_public})},[a,o]);const Z=ie=>{if(!ie)return;const fe=Array.from(ie);z(ye=>[...ye,...fe]);const de=fe.map(ye=>URL.createObjectURL(ye));q(ye=>[...ye,...de])},te=ie=>{URL.revokeObjectURL(F[ie]),z(fe=>fe.filter((de,ye)=>ye!==ie)),q(fe=>fe.filter((de,ye)=>ye!==ie))},ae=async ie=>{var fe;if(!(!ie||!a)){T(!0);try{for(const de of Array.from(ie)){const ye=de.name.split(".").pop(),Ie=`${i==null?void 0:i.id}/${a.id}/${Date.now()}.${ye}`,{error:Ne}=await J.storage.from("listing-photos").upload(Ie,de);if(Ne)throw Ne;const{data:{publicUrl:we}}=J.storage.from("listing-photos").getPublicUrl(Ie);await b.mutateAsync({listingId:a.id,photoUrl:we,isPrimary:!((fe=a.photos)!=null&&fe.length)})}ze.success("Photos uploaded!")}catch(de){console.error("Upload error:",de),ze.error("Failed to upload photos")}finally{T(!1)}}},le=async ie=>{for(let fe=0;fe{if(a)try{await j.mutateAsync({photoId:ie,listingId:a.id}),ze.success("Photo removed")}catch{ze.error("Failed to remove photo")}},ne=async ie=>{if(ie.preventDefault(),!H.city.trim()||!H.state.trim()||!H.price){ze.error("Please fill in required fields (City, State, Price)");return}if(l&&!C){ze.error("Please select an agent to assign this listing to");return}try{const fe={property_address:H.property_address||null,city:H.city,state:H.state,neighborhood:H.neighborhood||null,price:Number(H.price),property_type:H.property_type,status:H.status,bedrooms:H.bedrooms?Number(H.bedrooms):null,bathrooms:H.bathrooms?Number(H.bathrooms):null,square_footage:H.square_footage?Number(H.square_footage):null,lot_size:H.lot_size||null,year_built:H.year_built?Number(H.year_built):null,has_hoa:H.has_hoa,description:H.description||null,agent_notes:H.agent_notes||null,agent_notes_public:H.agent_notes_public,mls_link:H.mls_link||null,video_link:H.video_link||null,video_id:H.video_id||null,allow_sharing:H.allow_sharing,open_to_referrals:H.open_to_referrals,open_to_social_promotion:H.open_to_social_promotion,share_with_brokerage:H.share_with_brokerage,is_public:H.is_public};if(o)await y.mutateAsync({id:e,...fe}),ze.success("Listing updated!"),s(`/mission-control/listings/${e}`);else{T(!0);let de;if(l&&C?de=await x.mutateAsync({agentId:C,...fe}):de=await p.mutateAsync(fe),L.length>0)try{await le(de.id),F.forEach(ye=>URL.revokeObjectURL(ye)),z([]),q([])}catch(ye){console.error("Photo upload error:",ye),ze.error("Listing created but some photos failed to upload")}T(!1),ze.success("Listing created!"),s(l?"/my-brokerage":`/mission-control/listings/${de.id}`)}}catch(fe){console.error("Save error:",fe),ze.error("Failed to save listing"),T(!1)}};return o&&h?r.jsx(Or,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-10 w-32"}),r.jsx(Pr,{className:"h-[600px] w-full"})]})}):r.jsx(Or,{title:o?"Edit Listing":l?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:ne,className:"space-y-6",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:()=>s(l?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),l?"Back to Brokerage":"Back to Listings"]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[l&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Assign to Agent *"})}),r.jsxs(Xe,{children:[r.jsxs(vn,{value:C,onValueChange:A,children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select an agent..."})}),r.jsx(gn,{children:N.map(ie=>r.jsx(Ht,{value:ie.id,children:ie.name||ie.email},ie.id))})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This listing will appear on the selected agent's Listing Exchange."})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Property Details"})}),r.jsx(Xe,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx(Ue,{children:"Property Address"}),r.jsx(at,{value:H.property_address,onChange:ie=>K({...H,property_address:ie.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"City *"}),r.jsx(at,{value:H.city,onChange:ie=>K({...H,city:ie.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"State *"}),r.jsx(at,{value:H.state,onChange:ie=>K({...H,state:ie.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Neighborhood"}),r.jsx(at,{value:H.neighborhood,onChange:ie=>K({...H,neighborhood:ie.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Price *"}),r.jsx(at,{type:"number",value:H.price,onChange:ie=>K({...H,price:ie.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Property Type"}),r.jsxs(vn,{value:H.property_type,onValueChange:ie=>K({...H,property_type:ie}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:vWt.map(ie=>r.jsx(Ht,{value:ie.value,children:ie.label},ie.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Status"}),r.jsxs(vn,{value:H.status,onValueChange:ie=>K({...H,status:ie}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:yWt.map(ie=>r.jsx(Ht,{value:ie.value,children:ie.label},ie.value))})]})]})]})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Property Specs (Optional)"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Bedrooms"}),r.jsx(at,{type:"number",value:H.bedrooms,onChange:ie=>K({...H,bedrooms:ie.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Bathrooms"}),r.jsx(at,{type:"number",step:"0.5",value:H.bathrooms,onChange:ie=>K({...H,bathrooms:ie.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Sq Ft"}),r.jsx(at,{type:"number",value:H.square_footage,onChange:ie=>K({...H,square_footage:ie.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Lot Size"}),r.jsx(at,{value:H.lot_size,onChange:ie=>K({...H,lot_size:ie.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Year Built"}),r.jsx(at,{type:"number",value:H.year_built,onChange:ie=>K({...H,year_built:ie.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(Rs,{checked:H.has_hoa,onCheckedChange:ie=>K({...H,has_hoa:ie})}),r.jsx(Ue,{children:"Has HOA"})]})]})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Description & Links"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Description"}),r.jsx(ps,{value:H.description,onChange:ie=>K({...H,description:ie.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Agent Notes"}),r.jsx(ps,{value:H.agent_notes,onChange:ie=>K({...H,agent_notes:ie.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{checked:H.agent_notes_public,onCheckedChange:ie=>K({...H,agent_notes_public:ie})}),r.jsx(Ue,{className:"text-sm text-muted-foreground",children:"Make notes visible to other agents"})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"MLS Link"}),r.jsx(at,{value:H.mls_link,onChange:ie=>K({...H,mls_link:ie.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Video Link"}),r.jsx(at,{value:H.video_link,onChange:ie=>K({...H,video_link:ie.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Fi,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(Xe,{children:r.jsx(xWt,{selectedVideoId:H.video_id,onVideoSelect:ie=>K({...H,video_id:ie}),listingId:o?e:void 0})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Photos"})}),r.jsxs(Xe,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((ge=a==null?void 0:a.photos)==null?void 0:ge.map(ie=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>ve(ie.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(bs,{className:"h-3 w-3"})}),ie.is_primary&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},ie.id))),!o&&F.map((ie,fe)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ie,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>te(fe),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(bs,{className:"h-3 w-3"})}),fe===0&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},fe)),r.jsxs("label",{className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 cursor-pointer flex flex-col items-center justify-center gap-2 text-muted-foreground",children:[E?r.jsx(nn,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-8 w-8"}),r.jsx("span",{className:"text-xs",children:"Upload"})]}),r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ie=>o?ae(ie.target.files):Z(ie.target.files),disabled:E})]})]}),!o&&L.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[L.length," photo",L.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Sharing & Collaboration"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(Rs,{checked:H.allow_sharing,onCheckedChange:ie=>K({...H,allow_sharing:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(Rs,{checked:H.open_to_referrals,onCheckedChange:ie=>K({...H,open_to_referrals:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(Rs,{checked:H.open_to_social_promotion,onCheckedChange:ie=>K({...H,open_to_social_promotion:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(Rs,{checked:H.share_with_brokerage,onCheckedChange:ie=>K({...H,share_with_brokerage:ie})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(Rs,{checked:H.is_public,onCheckedChange:ie=>K({...H,is_public:ie})})]})]})]}),r.jsx(ee,{type:"submit",className:"w-full",size:"lg",disabled:p.isPending||y.isPending,children:p.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function _Wt({maxDurationSeconds:e=30,onRecordingComplete:t,onError:n,onRecordingStateChange:s,className:i,teleprompterContent:o}){const l=I.useRef(null),a=I.useRef(null),h=I.useRef(null),p=I.useRef([]),x=I.useRef(null),y=I.useRef(null),b=I.useRef(null),j=I.useRef(null),N=g3(),[C,A]=I.useState(!0),[E,T]=I.useState(!0),[L,z]=I.useState(null),[F,q]=I.useState(!1),[H,K]=I.useState(!1),[Z,te]=I.useState(null),[ae,le]=I.useState(null),[ve,ne]=I.useState(0),[ge,ie]=I.useState("user"),[fe,de]=I.useState(0),[ye,Ie]=I.useState(!1),[Ne,we]=I.useState(!0),[he,xe]=I.useState(null),[be,Oe]=I.useState(!1),Te=I.useCallback(Je=>{A(Je)},[]),Ve=I.useRef(C),Fe=I.useCallback(async()=>{var tt;T(!0),xe(null);const Je=N&&C;console.log("[VideoRecorder] initCamera start",{isMobile:N,usePortraitMode:C,shouldBePortrait:Je,facingMode:ge});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");h.current&&(console.log("[VideoRecorder] stopping existing stream"),h.current.getTracks().forEach(vt=>vt.stop()));const ft=N&&Je?{facingMode:{ideal:ge},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:ge},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",ft);const jt=await navigator.mediaDevices.getUserMedia({video:ft,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),jt.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");h.current=jt,z(!0);const Et=jt.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",Et.width,"x",Et.height),l.current){const vt=l.current;vt.srcObject=jt,vt.muted=!0,vt.playsInline=!0,vt.autoplay=!0,vt.setAttribute("muted",""),vt.setAttribute("playsinline",""),vt.setAttribute("autoplay","");try{(tt=vt.load)==null||tt.call(vt)}catch(Ar){console.warn("[VideoRecorder] videoEl.load failed",Ar)}const rr=async()=>{try{return await vt.play(),console.log("[VideoRecorder] preview play ok"),Oe(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:vt.readyState,videoWidth:vt.videoWidth,videoHeight:vt.videoHeight})},300),!0}catch(Ar){return console.warn("[VideoRecorder] preview play blocked",Ar),Oe(!0),!1}};await new Promise(Ar=>{let yn=!1;const kn=()=>{yn||(yn=!0,Ar())},Jr=()=>{rr().finally(kn)};vt.onloadedmetadata=Jr,vt.onloadeddata=Jr,setTimeout(kn,1500)})}try{y.current=new AudioContext;const vt=y.current.createMediaStreamSource(jt);b.current=y.current.createAnalyser(),b.current.fftSize=256,vt.connect(b.current);const rr=()=>{if(b.current){const Ar=new Uint8Array(b.current.frequencyBinCount);b.current.getByteFrequencyData(Ar);const yn=Ar.reduce((kn,Jr)=>kn+Jr)/Ar.length;de(Math.min(100,yn/128*100))}j.current=requestAnimationFrame(rr)};rr()}catch(vt){console.warn("Audio context not available:",vt)}}catch(ft){console.error("Camera initialization error:",ft),z(!1);let jt="Failed to access camera or microphone.";ft.name==="NotAllowedError"?jt="Camera permission denied. Please allow camera access in your browser settings.":ft.name==="NotFoundError"?jt="No camera found. Please connect a camera and try again.":ft.name==="NotReadableError"?jt="Camera is in use by another application. Please close other apps using the camera.":ft.message&&(jt=ft.message),xe(jt),n==null||n(jt)}finally{T(!1)}},[ge,n,N,C]);I.useEffect(()=>{Ve.current!==C&&L&&!F&&!ae&&(Ve.current=C,Fe())},[C,L,F,ae,Fe]),I.useEffect(()=>(Fe(),()=>{h.current&&h.current.getTracks().forEach(Je=>Je.stop()),x.current&&clearInterval(x.current),j.current&&cancelAnimationFrame(j.current),y.current&&y.current.close(),ae&&URL.revokeObjectURL(ae)}),[Fe,ae]),I.useEffect(()=>{if(E||L!==!0||ae)return;const Je=h.current,tt=l.current;!Je||!tt||(tt.srcObject!==Je&&(tt.srcObject=Je,tt.muted=!0,tt.playsInline=!0,tt.autoplay=!0,tt.setAttribute("muted",""),tt.setAttribute("playsinline",""),tt.setAttribute("autoplay","")),tt.play().then(()=>Oe(!1)).catch(ft=>{Oe(!0),console.warn("Live preview play blocked on mount:",ft)}))},[L,E,ae]),I.useEffect(()=>{s==null||s(F)},[F,s]);const Me=I.useCallback(async()=>{if(ae)return;const Je=l.current;if(Je)try{await Je.play(),Oe(!1)}catch(tt){Oe(!0),console.warn("Live preview still blocked (needs user gesture):",tt)}},[ae]),Qe=I.useCallback(()=>{a.current&&a.current.state!=="inactive"&&a.current.stop(),x.current&&(clearInterval(x.current),x.current=null),q(!1),K(!1)},[]),Ee=I.useCallback(()=>{if(!h.current)return;Me(),p.current=[],ne(0);const tt=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(jt=>MediaRecorder.isTypeSupported(jt)),ft=new MediaRecorder(h.current,tt?{mimeType:tt,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});ft.ondataavailable=jt=>{jt.data.size>0&&p.current.push(jt.data)},ft.onstop=()=>{var vt;const jt=ft.mimeType||tt||((vt=p.current[0])==null?void 0:vt.type)||"video/webm",Nt=new Blob(p.current,{type:jt});te(Nt);const Et=URL.createObjectURL(Nt);le(Et)},a.current=ft,ft.start(100),q(!0),x.current=setInterval(()=>{ne(jt=>jt>=e-1?(Qe(),e):jt+1)},1e3)},[Me,e,Qe]),Ye=I.useCallback(()=>{a.current&&a.current.state==="recording"&&(a.current.pause(),K(!0),x.current&&clearInterval(x.current))},[]),me=I.useCallback(()=>{a.current&&a.current.state==="paused"&&(a.current.resume(),K(!1),x.current=setInterval(()=>{ne(Je=>Je>=e-1?(Qe(),e):Je+1)},1e3))},[e,Qe]),mt=I.useCallback(()=>{ae&&URL.revokeObjectURL(ae),te(null),le(null),ne(0),Ie(!1),we(!0),l.current&&h.current&&(l.current.srcObject=h.current,l.current.muted=!0,Me())},[Me,ae]),et=I.useCallback(()=>{ie(Je=>Je==="user"?"environment":"user")},[]),nt=I.useCallback(()=>{Z&&t(Z,ve)},[Z,ve,t]),Ae=I.useCallback(()=>{l.current&&ae&&(ye?l.current.pause():(we(!1),l.current.muted=!1,l.current.play()),Ie(!ye))},[ae,ye]);I.useEffect(()=>{if(!ae)return;const Je=l.current;if(!Je)return;we(!1),Je.pause(),Je.removeAttribute("src"),Je.srcObject=null,Je.load(),Je.src=ae,Je.currentTime=0,Je.playsInline=!0,Je.muted=!1,Je.onended=()=>Ie(!1);const tt=()=>{const ft=Je.error,jt=ft?`Recorded video failed to play (code ${ft.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",ft),n==null||n(jt)};return Je.addEventListener("error",tt),Je.load(),()=>{Je.removeEventListener("error",tt)}},[n,ae]);const ht=Je=>{const tt=Math.floor(Je/60),ft=Je%60;return`${tt}:${ft.toString().padStart(2,"0")}`},$e=N&&C?"aspect-[9/16]":"aspect-video";return E?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",$e,i),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(nn,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):L===!1?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",$e,i),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(El,{className:"h-12 w-12 mx-auto mb-4 text-destructive"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Camera Access Required"}),r.jsx("p",{className:"text-gray-400 mb-4 text-sm",children:he||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{onClick:()=>Fe(),variant:"secondary",className:"w-full",children:[r.jsx(Vl,{className:"h-4 w-4 mr-2"}),"Try Again"]}),r.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"💡 Tip: If you're viewing this in an embedded preview, try opening the app in a new browser tab for full camera access."})]})]})}):r.jsxs("div",{className:$t("flex flex-col gap-2",i),children:[N&&!F&&!ae&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(yj,{className:$t("h-4 w-4",C?"text-muted-foreground":"text-primary")}),r.jsx(Ue,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(Rs,{id:"orientation-toggle",checked:C,onCheckedChange:Te}),r.jsx(Ue,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(xm,{className:$t("h-4 w-4",C?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:$t("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{Me()},children:[r.jsx("video",{ref:l,src:ae??void 0,className:$t("w-full bg-black",C&&!ae?"object-contain":"object-cover",$e,ge==="user"&&!ae&&"scale-x-[-1]"),playsInline:!0,controls:!!ae,muted:ae?Ne:!0,autoPlay:!ae},ae??"live"),!ae&&be&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(ee,{type:"button",variant:"secondary",onClick:()=>void Me(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!ae&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),F&&r.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx("div",{className:$t("w-3 h-3 rounded-full",H?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[ht(ve)," / ",ht(e)]})]}),F&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Hc,{value:ve/e*100,className:"h-1 rounded-none"})}),!ae&&r.jsxs("div",{className:"absolute bottom-20 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx(BT,{className:"h-4 w-4 text-white"}),r.jsx("div",{className:"w-20 h-2 bg-white/20 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-green-500 transition-all duration-75",style:{width:`${fe}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:ae?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:mt,children:[r.jsx(Vl,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(ee,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Ae,children:ye?r.jsx(Qh,{className:"h-5 w-5"}):r.jsx(dc,{className:"h-5 w-5"})}),r.jsxs(ee,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:nt,children:[r.jsx(Ca,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:et,disabled:F,children:r.jsx(mS,{className:"h-5 w-5"})}),F?r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:H?me:Ye,children:H?r.jsx(dc,{className:"h-5 w-5"}):r.jsx(Qh,{className:"h-5 w-5"})}),r.jsx(ee,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Qe,children:r.jsx(ym,{className:"h-6 w-6 fill-current"})})]}):r.jsx(ee,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Ee,children:r.jsx(Fi,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}function bWt({text:e,isVisible:t,onToggleVisibility:n,isRecording:s=!1,className:i}){const o=I.useRef(null),l=I.useRef(null),a=I.useRef(0),h=I.useRef(0),[p,x]=I.useState(!1),[y,b]=I.useState(30),[j,N]=I.useState(24),[C,A]=I.useState(1.6),[E,T]=I.useState(.85),[L,z]=I.useState("top"),[F,q]=I.useState(!1),H=I.useCallback(ae=>{if(!o.current)return;a.current===0&&(a.current=ae);const le=ae-a.current;a.current=ae,h.current+=y*le/1e3;const ve=Math.floor(h.current);ve>0&&(o.current.scrollTop+=ve,h.current-=ve);const{scrollTop:ne,scrollHeight:ge,clientHeight:ie}=o.current;if(ne+ie>=ge){x(!1);return}l.current=requestAnimationFrame(H)},[y]);I.useEffect(()=>(p?(a.current=0,h.current=0,l.current=requestAnimationFrame(H)):l.current&&cancelAnimationFrame(l.current),()=>{l.current&&cancelAnimationFrame(l.current)}),[p,H]),I.useEffect(()=>{s&&t?(o.current&&(o.current.scrollTop=0),setTimeout(()=>{x(!0)},100)):s||x(!1)},[s,t]);const K=I.useCallback(()=>{o.current&&(o.current.scrollTop=0),x(!1)},[]),Z=I.useCallback(()=>{x(ae=>!ae)},[]);if(!t)return r.jsx("div",{className:$t("absolute top-4 right-4 pointer-events-auto z-10",i),children:r.jsxs(ee,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const te={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return r.jsxs("div",{className:$t("absolute inset-0 pointer-events-none",i),children:[r.jsx("div",{className:$t("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",te[L]),style:{opacity:E},children:r.jsxs("div",{ref:o,className:$t("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",F&&"scale-x-[-1]"),style:{maskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)",WebkitMaskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)"},children:[r.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${j}px`,lineHeight:C,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:e}),r.jsx("div",{className:"h-32"})]})}),r.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsx(ee,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(fd,{className:"h-4 w-4"})})}),r.jsx(nu,{className:"w-72",side:"left",align:"start",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium",children:"Teleprompter Settings"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-xs",children:"Scroll Speed"}),r.jsx(lm,{value:[y],onValueChange:([ae])=>b(ae),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-xs",children:"Font Size"}),r.jsx(lm,{value:[j],onValueChange:([ae])=>N(ae),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-xs",children:"Line Spacing"}),r.jsx(lm,{value:[C*10],onValueChange:([ae])=>A(ae/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-xs",children:"Opacity"}),r.jsx(lm,{value:[E*100],onValueChange:([ae])=>T(ae/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:L==="top"?"default":"outline",size:"sm",onClick:()=>z("top"),children:r.jsx(a1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:L==="center"?"default":"outline",size:"sm",onClick:()=>z("center"),children:r.jsx(y1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:L==="bottom"?"default":"outline",size:"sm",onClick:()=>z("bottom"),children:r.jsx(Pu,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-xs",children:"Mirror Mode"}),r.jsx(Rs,{checked:F,onCheckedChange:q})]})]})})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:Z,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:p?r.jsx(Qh,{className:"h-4 w-4"}):r.jsx(dc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:K,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(mS,{className:"h-4 w-4"})}),r.jsxs(ee,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(d1,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function wWt({onSelectScript:e,onCreateNew:t,selectedScriptId:n,className:s}){const{toast:i}=pa(),[o,l]=I.useState(""),[a,h]=I.useState(null),[p,x]=I.useState("levelup"),{data:y,isLoading:b}=Qjt(),{data:j,isLoading:N}=Jjt(),{data:C,isLoading:A}=ekt(),E=tkt(),T=I.useMemo(()=>j?j.filter(H=>{const K=!o||H.title.toLowerCase().includes(o.toLowerCase())||H.script_text.toLowerCase().includes(o.toLowerCase())||H.tags.some(te=>te.toLowerCase().includes(o.toLowerCase())),Z=!a||H.category_id===a;return K&&Z}):[],[j,o,a]),L=I.useMemo(()=>C?C.filter(H=>!o||H.title.toLowerCase().includes(o.toLowerCase())||H.script_text.toLowerCase().includes(o.toLowerCase())):[],[C,o]),z=H=>{e({title:H.title,text:H.script_text})},F=async H=>{try{await E.mutateAsync(H),i({title:"Script saved to My Scripts"})}catch{i({title:"Failed to save script",variant:"destructive"})}},q=b||N||A;return r.jsxs("div",{className:$t("flex flex-col h-full",s),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search scripts...",value:o,onChange:H=>l(H.target.value),className:"pl-9"})]})}),r.jsxs(ba,{value:p,onValueChange:H=>x(H),className:"flex-1 flex flex-col",children:[r.jsxs(fa,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(ln,{value:"levelup",children:[r.jsx(wi,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(ln,{value:"my-scripts",children:[r.jsx(um,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(An,{value:"levelup",className:"flex-1 flex flex-col mt-0 p-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[r.jsx(Rt,{variant:a?"outline":"default",className:"cursor-pointer",onClick:()=>h(null),children:"All"}),y==null?void 0:y.map(H=>r.jsx(Rt,{variant:a===H.id?"default":"outline",className:"cursor-pointer",onClick:()=>h(H.id),children:H.name},H.id))]}),r.jsx(Jo,{className:"flex-1 max-h-[50vh]",children:q?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(wi,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No scripts found"})]}):r.jsx("div",{className:"space-y-2",children:T.map(H=>r.jsxs(Ge,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===H.id&&"ring-2 ring-primary"),onClick:()=>z(H),children:[r.jsx(Gt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Qt,{className:"text-sm font-medium truncate",children:H.title}),H.category&&r.jsx(Rt,{variant:"secondary",className:"mt-1 text-xs",children:H.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:K=>{K.stopPropagation(),F(H)},children:r.jsx(um,{className:"h-4 w-4"})}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(Xe,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:H.script_text})})]},H.id))})})]}),r.jsxs(An,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[t&&r.jsxs(ee,{variant:"outline",className:"mb-4",onClick:t,children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Jo,{className:"flex-1 max-h-[50vh]",children:A?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(nn,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):L.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(um,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No saved scripts"}),r.jsx("p",{className:"text-sm mt-1",children:"Save LevelUp scripts or create your own"})]}):r.jsx("div",{className:"space-y-2",children:L.map(H=>r.jsxs(Ge,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===H.id&&"ring-2 ring-primary"),onClick:()=>z(H),children:[r.jsx(Gt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Qt,{className:"text-sm font-medium truncate",children:H.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:H.is_custom?r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Rt,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Ka,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(Xe,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:H.script_text})})]},H.id))})})]})]})]})}function jWt({selectedTemplate:e,onSelect:t,contactName:n,saving:s=!1}){const[i,o]=I.useState(()=>{const a=MS(e);return new Set([a.category])}),l=a=>{o(h=>{const p=new Set(h);return p.has(a)?p.delete(a):p.add(a),p})};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(nn,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:gft.map(a=>{const h=xft(a.id),p=i.has(a.id),x=h.some(y=>y.id===e);return r.jsxs(NS,{open:p,onOpenChange:()=>l(a.id),children:[r.jsxs(SS,{className:"flex items-center justify-between w-full p-2.5 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:a.name}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.length,")"]}),x&&!p&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),r.jsx(Pu,{className:$t("h-4 w-4 text-muted-foreground transition-transform",p&&"rotate-180")})]}),r.jsx(CS,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:h.map(y=>{const b=e===y.id;return r.jsxs("button",{type:"button",onClick:()=>t(y.id),disabled:s,className:$t("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",b?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[b&&r.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:r.jsx(Ca,{className:"h-2.5 w-2.5 text-primary-foreground"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"opacity-70 shrink-0",children:y.icon}),r.jsx("span",{className:"text-sm font-medium truncate",children:y.name})]})]},y.id)})})})]},a.id)})}),n&&e!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',MS(e).headerText(n),'"']})]})}function B$e({open:e,onOpenChange:t,video:n,contactName:s,onTemplateUpdated:i}){const[o,l]=I.useState(n.page_template||"default"),[a,h]=I.useState(!1),[p,x]=I.useState(!1),[y,b]=I.useState(n.page_template||"default"),[j,N]=I.useState([]),[C,A]=I.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[E,T]=I.useState(!1),[L,z]=I.useState(!1),F=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";I.useEffect(()=>{e&&j.length===0&&q()},[e]);const q=async()=>{z(!0);try{const{data:ge,error:ie}=await J.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(ie)throw ie;const fe=(ge||[]).map(de=>({id:de.id,name:[de.first_name,de.last_name].filter(Boolean).join(" ")||"Unnamed",email:de.email||null}));N(fe)}catch(ge){console.error("Failed to fetch contacts:",ge)}finally{z(!1)}},H=async ge=>{A(ge),T(!1),h(!0);try{const{error:ie}=await J.from("agent_videos").update({contact_id:(ge==null?void 0:ge.id)||null,recipient_name:(ge==null?void 0:ge.name)||null}).eq("id",n.id);if(ie)throw ie;ze.success(ge?`Assigned to ${ge.name}`:"Contact removed"),i==null||i()}catch(ie){console.error("Failed to update contact:",ie),ze.error("Failed to update contact")}finally{h(!1)}},K=async ge=>{l(ge),h(!0);try{const{error:ie}=await J.from("agent_videos").update({page_template:ge}).eq("id",n.id);if(ie)throw ie;b(ge),ze.success("Template saved!"),i==null||i()}catch(ie){console.error("Failed to save template:",ie),ze.error("Failed to save template"),l(y)}finally{h(!1)}},Z=(C==null?void 0:C.name)||null,te=()=>{const ge=n.title||"Video Message",ie=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},ae=async()=>{if(!n.thumbnail_url){ze.error("Video thumbnail not available yet");return}const ge=te(),ie=`Watch: ${n.title||"Video Message"} ${F}`;try{const fe=new Blob([ge],{type:"text/html"}),de=new Blob([ie],{type:"text/plain"}),ye=new ClipboardItem({"text/html":fe,"text/plain":de});await navigator.clipboard.write([ye]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ie+` `+ge),ze.success("Copied! Paste into your email.")}},le=async()=>{await navigator.clipboard.writeText(F),x(!0),ze.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},ve=()=>{const ie=MS(o).headerText(Z),fe=o==="default"?`Check out this video: ${F}`:`${ie} Check out this special video: ${F}`;window.open(`sms:?body=${encodeURIComponent(fe)}`,"_self")},ne=()=>{const ge=MS(o),ie=ge.headerText(Z),fe=o==="default"?n.title||"Video Message":ie,de=`${ge.subText} Watch the video: ${F}`,ye=C!=null&&C.email?encodeURIComponent(C.email):"";window.open(`mailto:${ye}?subject=${encodeURIComponent(fe)}&body=${encodeURIComponent(de)}`,"_self")};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(So,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(es,{children:"Choose a themed page template and share your video"})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Du,{open:E,onOpenChange:T,children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":E,className:"flex-1 justify-between",disabled:a,children:[C?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),C.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(o1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(nu,{className:"w-[300px] p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search contacts..."}),r.jsxs(H1,{children:[r.jsx(W1,{children:L?"Loading...":"No contacts found."}),r.jsx(G1,{children:j.map(ge=>r.jsxs(K1,{value:ge.name,onSelect:()=>H(ge),children:[r.jsx(Ca,{className:$t("mr-2 h-4 w-4",(C==null?void 0:C.id)===ge.id?"opacity-100":"opacity-0")}),ge.name]},ge.id))})]})]})})]}),C&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>H(null),disabled:a,className:"shrink-0",children:r.jsx(bs,{className:"h-4 w-4"})})]}),C&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',MS(o).headerText(C.name),'"']})]}),r.jsx(jWt,{selectedTemplate:o,onSelect:K,contactName:Z,saving:a}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:F,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:le,variant:p?"default":"outline",className:"shrink-0 gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Ca,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(pl,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Share for Email"}),r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:ae,children:[r.jsx(Do,{className:"h-4 w-4"}),"Copy with Thumbnail (for Gmail)"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste into Gmail to embed a clickable video thumbnail"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ve,children:[r.jsx(Po,{className:"h-4 w-4"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ne,children:[r.jsx(Ys,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(ri,{children:r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Done"})})]})})}function kWt(){var nt;const e=ns(),[t]=Fd(),{toast:n}=pa(),s=t.get("contact_id"),i=t.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:a,isNearLimit:h}=ikt(),{data:p}=op(),x=Fze(),y=ckt(),[b,j]=I.useState("record"),[N,C]=I.useState(""),[A,E]=I.useState(!1),[T,L]=I.useState(!1),[z,F]=I.useState(!1),[q,H]=I.useState(null),[K,Z]=I.useState(0),[te,ae]=I.useState(0),[le,ve]=I.useState(null),[ne,ge]=I.useState(null),[ie,fe]=I.useState(s||""),[de,ye]=I.useState(""),[Ie,Ne]=I.useState(""),[we,he]=I.useState(null),[xe,be]=I.useState(null),[Oe,Te]=I.useState(null),[Ve,Fe]=I.useState(!1),Me=I.useCallback(async(Ae,ht)=>{H(Ae),j("uploading");try{const{videoId:$e,uploadUrl:Je}=await akt(de||"Quick Video Touch");ve($e);const{apiKey:tt}=await okt($e),ft=new XMLHttpRequest;ft.upload.onprogress=Nt=>{Nt.lengthComputable&&Z(Nt.loaded/Nt.total*100)},await new Promise((Nt,Et)=>{ft.onload=()=>{ft.status>=200&&ft.status<300?Nt():Et(new Error(`Upload failed: ${ft.status}`))},ft.onerror=()=>Et(new Error("Upload failed")),ft.open("PUT",Je),ft.setRequestHeader("AccessKey",tt),ft.send(Ae)}),j("processing");let jt=0;for(;jt<4;){await new Promise(Et=>setTimeout(Et,2e3));const Nt=await lkt($e);if(jt=Nt.status,ae(Nt.encodeProgress||0),jt===4)ge({playbackUrl:Nt.directPlayUrl,thumbnailUrl:Nt.thumbnailUrl,previewUrl:Nt.previewUrl||null,duration:Nt.length||ht,fileSizeMb:(Nt.storageSize||Ae.size)/(1024*1024)});else if(jt===5||jt===6)throw new Error("Video processing failed")}j("details")}catch($e){console.error("Upload error:",$e),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),j("record")}},[de,n]),Qe=async()=>{if(!(!le||!ne))try{const Ae=ie&&ie!=="none"?ie:null,ht=await x.mutateAsync({bunny_video_id:le,contact_id:Ae,playback_url:ne.playbackUrl,thumbnail_url:ne.thumbnailUrl,preview_url:ne.previewUrl,duration_seconds:ne.duration,file_size_mb:ne.fileSizeMb,title:de||"Quick Video Touch",notes:Ie,task_id:i||null,status:"ready"});he(ht.id),be(ht.share_token||null),Ae&&await y.mutateAsync({contactId:Ae,videoId:ht.id,notes:Ie}),n({title:"Video saved successfully!"}),j("share")}catch(Ae){console.error("Save video error:",Ae),n({title:"Failed to save video",description:(Ae==null?void 0:Ae.message)||"Please try again.",variant:"destructive"})}},Ee=(Ae,ht)=>{navigator.clipboard.writeText(ht),Te(Ae),setTimeout(()=>Te(null),2e3),n({title:"Copied to clipboard!"})},Ye=()=>xe?`https://video.relevelup.com/${xe}`:(ne==null?void 0:ne.playbackUrl)||"",me=()=>{const Ae=p==null?void 0:p.find(ft=>ft.id===ie),ht=Ae?`${Ae.first_name}`:"",$e=(Ae==null?void 0:Ae.phone)||"",Je=(Ae==null?void 0:Ae.email)||"",tt=Ye();return{text:`Hey${ht?` ${ht}`:""}! I recorded a quick video for you: ${tt}`,link:tt,contactPhone:$e,contactEmail:Je}},mt=()=>{const{text:Ae,contactPhone:ht}=me(),$e=ht?`sms:${ht}?body=${encodeURIComponent(Ae)}`:`sms:?body=${encodeURIComponent(Ae)}`;window.open($e,"_self")},et=()=>{const{link:Ae,contactEmail:ht}=me(),$e="Check out this video",Je=`I recorded a quick video for you: ${Ae}`,tt=ht?`mailto:${ht}?subject=${encodeURIComponent($e)}&body=${encodeURIComponent(Je)}`:`mailto:?subject=${encodeURIComponent($e)}&body=${encodeURIComponent(Je)}`;window.open(tt,"_self")};return o?r.jsx(Or,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>e(-1),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Quick Video Touch"}),r.jsx("p",{className:"text-muted-foreground",children:"Record a personal video message"})]})]}),h&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",a.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(0)," MB remaining"]})]})]}),b==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(_Wt,{maxDurationSeconds:30,onRecordingComplete:Me,onRecordingStateChange:F,className:"w-full",teleprompterContent:A&&N&&r.jsx(bWt,{text:N,isVisible:A,onToggleVisibility:()=>E(!1),isRecording:z})}),!A&&N&&r.jsxs(ee,{variant:"outline",className:"mt-4",onClick:()=>E(!0),children:[r.jsx(wi,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(Ge,{className:"lg:col-span-1",children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Qt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx(ps,{placeholder:"Type or paste your script here...",value:N,onChange:Ae=>C(Ae.target.value),rows:6}),r.jsxs(tse,{open:T,onOpenChange:L,children:[r.jsx(Lge,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"w-full",children:[r.jsx(wi,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(kI,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(rse,{className:"p-4 border-b",children:r.jsx(nse,{children:"Select a Script"})}),r.jsx(wWt,{onSelectScript:Ae=>{C(Ae.text),L(!1),E(!0)},className:"h-[calc(100vh-80px)]"})]})]}),N&&r.jsx(ee,{className:"w-full",onClick:()=>E(!0),children:"Use Script"})]})]})]}),b==="uploading"&&r.jsx(Ge,{className:"max-w-md mx-auto",children:r.jsxs(Xe,{className:"pt-6 text-center",children:[r.jsx(no,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-pulse"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Uploading Video..."}),r.jsx(Hc,{value:K,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[K.toFixed(0),"%"]})]})}),b==="processing"&&r.jsx(Ge,{className:"max-w-md mx-auto",children:r.jsxs(Xe,{className:"pt-6 text-center",children:[r.jsx(nn,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-spin"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Processing Video..."}),r.jsx(Hc,{value:te,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[te.toFixed(0),"%"]})]})}),b==="details"&&r.jsxs(Ge,{className:"max-w-lg mx-auto",children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Video Details"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Title"}),r.jsx(at,{value:de,onChange:Ae=>ye(Ae.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Attach to Contact (Optional)"}),r.jsxs(vn,{value:ie,onValueChange:fe,children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"No contact - use anywhere"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(So,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),p==null?void 0:p.map(Ae=>r.jsx(Ht,{value:Ae.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cc,{className:"h-4 w-4"}),Ae.first_name," ",Ae.last_name]})},Ae.id))]})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Notes"}),r.jsx(ps,{value:Ie,onChange:Ae=>Ne(Ae.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(ee,{className:"w-full",onClick:Qe,disabled:x.isPending,children:[x.isPending&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),b==="share"&&r.jsxs(Ge,{className:"max-w-lg mx-auto",children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Ca,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:mt,children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:et,children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>Ee("link",me().link),children:[r.jsx(So,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Oe==="link"&&r.jsx(Ca,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>Fe(!0),children:[r.jsx(hd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>e("/mission-control/video-library"),children:"View Library"}),r.jsx(ee,{onClick:()=>{j("record"),H(null),ve(null),ge(null)},children:"Record Another"})]})]})]}),we&&xe&&r.jsx(B$e,{open:Ve,onOpenChange:Fe,video:{id:we,share_token:xe,title:de||null,contact_id:ie||null,thumbnail_url:(ne==null?void 0:ne.thumbnailUrl)||null},contactName:((nt=p==null?void 0:p.find(Ae=>Ae.id===ie))==null?void 0:nt.first_name)||null})]})}):r.jsx(Or,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(Bh,{className:"h-16 w-16 text-destructive mx-auto mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Storage Limit Reached"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"You've reached your video storage limit. Delete videos from your library to record more."}),r.jsx(ee,{onClick:()=>e("/mission-control/video-library"),children:"Open Video Library"})]})})}function NWt({open:e,onOpenChange:t}){const{data:n}=op(),{data:s}=Cye(),i=Fze(),o=I.useRef(null),[l,a]=I.useState(null),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(""),[N,C]=I.useState(!1),[A,E]=I.useState(0),[T,L]=I.useState("idle"),z=(s==null?void 0:s.total_storage_mb)||0,q=((s==null?void 0:s.max_storage_mb)||1024)-z,H=ae=>{var ne;const le=(ne=ae.target.files)==null?void 0:ne[0];if(!le)return;if(!le.type.startsWith("video/")){ze.error("Please select a video file");return}const ve=le.size/(1024*1024);if(ve>500){ze.error("Video file must be less than 500MB");return}if(ve>q){ze.error(`Not enough storage. You have ${q.toFixed(1)} MB remaining.`);return}a(le),h||p(le.name.replace(/\.[^/.]+$/,""))},K=async()=>{if(!l){ze.error("Please select a video file");return}C(!0),E(0),L("creating");try{const{data:ae,error:le}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:h||l.name,isAgentVideo:!0}});if(le)throw new Error(le.message);const{videoId:ve,libraryId:ne}=ae;L("uploading");const{data:ge,error:ie}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ve,isAgentVideo:!0}});if(ie)throw new Error(ie.message);await new Promise((ye,Ie)=>{const Ne=new XMLHttpRequest;Ne.upload.addEventListener("progress",we=>{if(we.lengthComputable){const he=Math.round(we.loaded/we.total*100);E(he)}}),Ne.addEventListener("load",()=>{Ne.status>=200&&Ne.status<300?ye():Ie(new Error(`Upload failed with status ${Ne.status}`))}),Ne.addEventListener("error",()=>Ie(new Error("Upload failed"))),Ne.open("PUT",ge.uploadUrl),Ne.setRequestHeader("AccessKey",ge.apiKey),Ne.send(l)}),L("processing");const fe=l.size/(1024*1024),de=`https://iframe.mediadelivery.net/embed/${ne}/${ve}`;await i.mutateAsync({bunny_video_id:ve,playback_url:de,file_size_mb:fe,title:h||l.name,notes:x||void 0,contact_id:b||void 0,status:"processing",touch_type:"video_upload"}),ze.success("Video uploaded successfully! Processing may take a few minutes."),Z()}catch(ae){console.error("Upload error:",ae),ze.error(ae instanceof Error?ae.message:"Failed to upload video")}finally{C(!1),L("idle")}},Z=()=>{N||(a(null),p(""),y(""),j(""),E(0),L("idle"),t(!1))},te=()=>{switch(T){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${A}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Br,{open:e,onOpenChange:Z,children:r.jsxs(Fr,{className:"sm:max-w-md",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Upload Video"}),r.jsx(es,{children:"Upload a video file from your device to your video library."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Video File"}),l?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Fi,{className:"h-8 w-8 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:l.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(l.size/(1024*1024)).toFixed(1)," MB"]})]}),!N&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ae=>{ae.stopPropagation(),a(null)},children:r.jsx(bs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>{var ae;return(ae=o.current)==null?void 0:ae.click()},children:[r.jsx(no,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),r.jsx("input",{ref:o,type:"file",accept:"video/*",className:"hidden",onChange:H,disabled:N})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"title",children:"Title"}),r.jsx(at,{id:"title",value:h,onChange:ae=>p(ae.target.value),placeholder:"Enter video title",disabled:N})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Associate with Contact (optional)"}),r.jsxs(vn,{value:b||"__none__",onValueChange:ae=>j(ae==="__none__"?"":ae),disabled:N,children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select a contact"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(ae=>r.jsxs(Ht,{value:ae.id,children:[ae.first_name," ",ae.last_name||""]},ae.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(ps,{id:"notes",value:x,onChange:ae=>y(ae.target.value),placeholder:"Add any notes about this video",rows:2,disabled:N})]}),N&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(nn,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:te()})]}),r.jsx(Hc,{value:T==="uploading"?A:T==="processing"?100:10})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:Z,disabled:N,children:"Cancel"}),r.jsx(ee,{onClick:K,disabled:!l||N,children:N?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function SWt({previewSrc:e,thumbnailSrc:t,alt:n,isHovered:s}){const[i,o]=I.useState(!1),[l,a]=I.useState(!1),h=s&&e&&!i,p=t&&!l;return!p&&!h?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[p&&r.jsx("img",{src:t,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${h?"opacity-0":"opacity-100"}`,onError:()=>a(!0)}),h&&r.jsx("img",{src:e,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function CWt({video:e,previewSrc:t,thumbnailSrc:n,onOpen:s,onDelete:i,onNavigateToContact:o,onGetEmbedCode:l,onCopyEmailHtml:a,onShareWithTemplate:h,getContactName:p,getShareUrl:x,copyToClipboard:y,formatDuration:b}){const[j,N]=I.useState(!1);return r.jsxs(Ge,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(SWt,{previewSrc:t,thumbnailSrc:n,alt:e.title||"Video preview",isHovered:j}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center",children:r.jsx(dc,{className:"h-6 w-6 text-primary ml-1"})})}),r.jsx("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:b(e.duration_seconds)}),e.status!=="ready"&&r.jsx(Rt,{variant:e.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:e.status})]}),r.jsx(Xe,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"font-medium truncate",children:e.title||"Untitled Video"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[r.jsx(Cc,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:p(e.contact_id)})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-0.5",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ki,{className:"h-3 w-3"}),r.jsx("span",{children:xn(new Date(e.created_at),"MMM d, yyyy")})]}),(e.view_count??0)>0&&r.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[r.jsx(Qo,{className:"h-3 w-3"}),r.jsxs("span",{children:[e.view_count," ",e.view_count===1?"view":"views"]})]})]})]}),r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:C=>C.stopPropagation(),children:r.jsx(Mx,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",className:"bg-popover",children:[r.jsxs(mo,{onClick:C=>{C.stopPropagation(),s()},children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(pC,{}),r.jsxs(mo,{onClick:C=>{C.stopPropagation(),h()},children:[r.jsx(hd,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(mo,{onClick:C=>{C.stopPropagation(),y(x(e),"Share link")},children:[r.jsx(So,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(mo,{onClick:C=>{C.stopPropagation(),l()},children:[r.jsx(hj,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(mo,{onClick:C=>{C.stopPropagation(),a()},children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsx(pC,{}),e.contact_id&&r.jsxs(mo,{onClick:C=>{C.stopPropagation(),o()},children:[r.jsx(Cc,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(mo,{onClick:C=>{C.stopPropagation(),i()},className:"text-destructive",children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function MWt(){const e=ns(),{data:t,isLoading:n}=rkt(),{data:s}=Cye(),{data:i}=op(),o=skt(),[l,a]=I.useState(""),[h,p]=I.useState(null),[x,y]=I.useState(!1),[b,j]=I.useState(!1),[N,C]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(!1),[z,F]=I.useState({}),q=he=>{if(!he)return"Unassigned";const xe=i==null?void 0:i.find(be=>be.id===he);return xe?`${xe.first_name} ${xe.last_name||""}`.trim():"Unknown"},H=he=>{if(!he)return"0:00";const xe=Math.floor(he/60),be=he%60;return`${xe}:${be.toString().padStart(2,"0")}`},K=t==null?void 0:t.filter(he=>{if(!l)return!0;const xe=q(he.contact_id).toLowerCase(),be=(he.title||"").toLowerCase(),Oe=(he.notes||"").toLowerCase();return xe.includes(l.toLowerCase())||be.includes(l.toLowerCase())||Oe.includes(l.toLowerCase())});I.useEffect(()=>{(async()=>{if(!(t!=null&&t.length))return;const xe=t.filter(Oe=>(Oe==null?void 0:Oe.bunny_video_id)&&!z[Oe.id]);if(!xe.length)return;const be=await Promise.allSettled(xe.map(async Oe=>{const{data:Te,error:Ve}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Oe.bunny_video_id,isAgentVideo:!0}});if(Ve)throw Ve;return{id:Oe.id,previewUrl:Te==null?void 0:Te.previewUrl,thumbnailUrl:Te==null?void 0:Te.thumbnailUrl}}));F(Oe=>{const Te={...Oe};for(const Ve of be)Ve.status==="fulfilled"&&(Te[Ve.value.id]={previewUrl:Ve.value.previewUrl,thumbnailUrl:Ve.value.thumbnailUrl});return Te})})().catch(xe=>console.warn("Failed to load signed Bunny asset URLs",xe))},[t,z]);const Z=(s==null?void 0:s.total_storage_mb)||0,te=(s==null?void 0:s.max_storage_mb)||1024,ae=Z/te*100,le=ae>=80,ve=ae>=100,ne=async(he,xe)=>{await navigator.clipboard.writeText(he),ze.success(`${xe} copied to clipboard`)},ge=he=>he.share_token?`https://video.relevelup.com/${he.share_token}`:he.playback_url||"",ie=he=>{const xe=ge(he),be=i==null?void 0:i.find(Qe=>Qe.id===he.contact_id),Oe=q(he.contact_id),Te=Oe!=="Unassigned"?Oe.split(" ")[0]:"",Ve=(be==null?void 0:be.phone)||"",Fe=`Hey${Te?` ${Te}`:""}! I recorded a quick video message for you. Check it out: ${xe}`,Me=Ve?`sms:${Ve}?body=${encodeURIComponent(Fe)}`:`sms:?body=${encodeURIComponent(Fe)}`;window.open(Me,"_self")},fe=he=>{const xe=i==null?void 0:i.find(Me=>Me.id===he.contact_id),be=(xe==null?void 0:xe.email)||"",Oe=ge(he),Te="Check out this video",Ve=`I recorded a quick video for you: ${Oe}`,Fe=be?`mailto:${be}?subject=${encodeURIComponent(Te)}&body=${encodeURIComponent(Ve)}`:`mailto:?subject=${encodeURIComponent(Te)}&body=${encodeURIComponent(Ve)}`;window.open(Fe,"_self")},de=he=>{var Te;const xe=ge(he),be=he.title||"Video Message",Oe=he.share_token?`https://video.relevelup.com/thumb/${he.share_token}`:((Te=z[he.id])==null?void 0:Te.thumbnailUrl)||he.thumbnail_url||"";return``},ye=async he=>{if(!he.thumbnail_url&&!he.share_token){ze.error("Video thumbnail not available yet");return}const xe=de(he),be=ge(he),Oe=`Watch: ${he.title||"Video Message"} ${be}`;try{const Te=new Blob([xe],{type:"text/html"}),Ve=new Blob([Oe],{type:"text/plain"}),Fe=new ClipboardItem({"text/html":Te,"text/plain":Ve});await navigator.clipboard.write([Fe]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(Oe+` `+xe),ze.success("Copied! Paste into your email.")}},Ie=async he=>{try{ze.loading("Preparing download...",{id:"download"});const{data:xe,error:be}=await J.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:he.bunny_video_id,isAgentVideo:!0}});if(be||!(xe!=null&&xe.downloadUrl))throw new Error((be==null?void 0:be.message)||"Failed to get download URL");const Te=`${((he.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,Ve=await fetch(xe.downloadUrl);if(!Ve.ok)throw new Error("Failed to fetch video file");const Fe=await Ve.blob(),Me=URL.createObjectURL(Fe),Qe=document.createElement("a");Qe.href=Me,Qe.download=Te,Qe.rel="noreferrer",document.body.appendChild(Qe),Qe.click(),Qe.remove(),URL.revokeObjectURL(Me),ze.success("Download started",{id:"download"})}catch(xe){console.error("Download error:",xe),ze.error("Could not force download (your browser may block it).",{id:"download"})}},Ne=he=>{p(he),y(!0)},we=async()=>{if(h)try{await o.mutateAsync({id:h.id,bunnyVideoId:h.bunny_video_id,hardDelete:!0}),j(!1),p(null),ze.success("Video deleted successfully")}catch{ze.error("Failed to delete video")}};return r.jsx(Or,{title:"Video Library",description:"Manage your video touches",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Video Library"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage and share your video touches"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>C(!0),children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(ee,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(Ge,{className:le?"border-amber-500":ve?"border-destructive":"",children:r.jsxs(Xe,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(IT,{className:`h-5 w-5 ${ve?"text-destructive":le?"text-amber-500":"text-muted-foreground"}`}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-sm font-medium",children:"Storage Used"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[Z.toFixed(1)," MB / ",te>=1024?`${(te/1024).toFixed(0)} GB`:`${te} MB`]})]}),r.jsx(Hc,{value:Math.min(ae,100),className:`h-2 ${ve?"[&>div]:bg-destructive":le?"[&>div]:bg-amber-500":""}`})]}),le&&!ve&&r.jsxs(Rt,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(El,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),ve&&r.jsxs(Rt,{variant:"destructive",children:[r.jsx(El,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),ve&&r.jsx("p",{className:"text-sm text-destructive mt-2",children:"You've reached your storage limit. Delete videos to record more."})]})}),r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search videos by contact, title, or notes...",value:l,onChange:he=>a(he.target.value),className:"pl-10"})]}),n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})}):(K==null?void 0:K.length)===0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"py-12 text-center",children:[r.jsx(Fi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No videos yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Record your first video touch to get started"}),r.jsxs(ee,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Record Video"]})]})}):r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:K==null?void 0:K.map(he=>{var xe,be;return r.jsx(CWt,{video:he,previewSrc:(xe=z[he.id])==null?void 0:xe.previewUrl,thumbnailSrc:(be=z[he.id])==null?void 0:be.thumbnailUrl,onOpen:()=>Ne(he),onDelete:()=>{p(he),j(!0)},onNavigateToContact:()=>e(`/mission-control/contacts/${he.contact_id}`),onGetEmbedCode:()=>{p(he),E(!0)},onCopyEmailHtml:()=>ye(he),onShareWithTemplate:()=>{p(he),L(!0)},getContactName:q,getShareUrl:ge,copyToClipboard:ne,formatDuration:H},he.id)})}),r.jsx(Br,{open:x,onOpenChange:y,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:(h==null?void 0:h.title)||"Video Preview"}),r.jsx(es,{children:(h==null?void 0:h.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Cc,{className:"h-3 w-3"}),q(h.contact_id)]})})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:h.playback_url?(()=>{let he=h.playback_url;return he.includes("iframe.mediadelivery.net/play/")&&(he=he.replace("/play/","/embed/"),he+=(he.includes("?")?"&":"?")+"autoplay=false&responsive=true"),he.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:he,title:h.title||"Video preview",className:"absolute top-0 left-0 w-full h-full rounded-lg",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:h.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:h.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>ze.error("Video preview failed to load")},h.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Fi,{className:"h-12 w-12 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground ml-2",children:"Video not available"})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>ie(h),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>fe(h),children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ne(ge(h),"Share link"),children:[r.jsx(pl,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ye(h),children:[r.jsx(Ys,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(ee,{variant:"outline",onClick:()=>Ie(h),children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>{y(!1),L(!0)},children:[r.jsx(hd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(ee,{variant:"destructive",onClick:()=>{y(!1),j(!0)},children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Br,{open:b,onOpenChange:j,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Delete Video"}),r.jsx(es,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:we,disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(NWt,{open:N,onOpenChange:C}),r.jsx(Br,{open:A,onOpenChange:E,children:r.jsxs(Fr,{className:"sm:max-w-lg",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Embed Video"}),r.jsx(es,{children:"Copy this code to embed the video on your website."})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Embed Code"}),r.jsx(ps,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(ee,{className:"flex-1",onClick:()=>{const he=``;ne(he,"Embed code")},children:[r.jsx(pl,{className:"h-4 w-4 mr-2"}),"Copy Embed Code"]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this code into your website's HTML where you want the video to appear. The video will automatically resize to fit its container."})]})]})}),h&&r.jsx(B$e,{open:T,onOpenChange:L,video:h,contactName:q(h.contact_id)})]})})}function $$e({stages:e,currentStageId:t,onStageSelect:n,disabled:s}){const[i,o]=I.useState(!1),l=e.find(h=>h.id===t),a=h=>{h.id!==t&&n(h.id,h.name),o(!1)};return r.jsxs(Cm,{open:i,onOpenChange:o,children:[r.jsx(Mm,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:h=>h.stopPropagation(),children:[l&&r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:l.color}}),r.jsx("span",{className:"max-w-[80px] truncate",children:(l==null?void 0:l.name)||"Move"}),r.jsx(Ka,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(ap,{align:"end",className:"w-48 z-50 bg-popover",onClick:h=>h.stopPropagation(),children:e.map(h=>{const p=h.icon&&IAe[h.icon]||Lu,x=h.id===t;return r.jsxs(mo,{onClick:()=>a(h),className:$t("flex items-center gap-2 cursor-pointer",x&&"bg-accent"),children:[r.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${h.color}20`},children:r.jsx(p,{className:"h-3 w-3",style:{color:h.color}})}),r.jsx("span",{className:"flex-1",children:h.name}),x&&r.jsx(Ca,{className:"h-4 w-4 text-primary"})]},h.id)})})]})}const TWt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},AWt={low:{color:"bg-slate-100 text-slate-600",dot:"bg-slate-400"},medium:{color:"bg-amber-100 text-amber-700",dot:"bg-amber-500"},high:{color:"bg-orange-100 text-orange-700",dot:"bg-orange-500"},urgent:{color:"bg-red-100 text-red-700",dot:"bg-red-500"}};function U$e({deal:e,onClick:t,isDragging:n,stages:s,onStageChange:i,showStagePicker:o=!1,isWonStage:l=!1}){var A,E;const a=g3(),h=TWt[e.deal_type],p=AWt[e.priority],x=I.useMemo(()=>e.target_close_date?gC(new Date(e.target_close_date),new Date):null,[e.target_close_date]),y=x!==null&&x<0,b=x!==null&&x<=7&&x>=0,j=l&&!e.scorecard_transaction_id,N=!!e.scorecard_transaction_id,C=T=>T?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T):null;return r.jsx(Ge,{className:$t("cursor-pointer transition-all duration-200 hover:shadow-md hover:border-primary/30 group",n&&"opacity-50 rotate-2 shadow-xl",y&&"border-red-200 bg-red-50/30",j&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:t,children:r.jsxs(Xe,{className:"p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:e.deal_name})}),r.jsx(Rt,{variant:"outline",className:$t("text-[10px] px-1.5 py-0 shrink-0",h.color),children:h.label})]}),e.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ci,{className:"h-5 w-5",children:r.jsxs(di,{className:"text-[10px] bg-primary/10 text-primary",children:[(A=e.contact.first_name)==null?void 0:A[0],(E=e.contact.last_name)==null?void 0:E[0]]})}),r.jsxs("span",{className:"truncate",children:[e.contact.first_name," ",e.contact.last_name]})]}),e.listing&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(Xh,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),j&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[r.jsx(Wa,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),N&&l&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[r.jsx(Ya,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:"Synced to Scorecard"})]}),!e.listing&&(e.property_address||e.city)&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(fi,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:e.property_address||`${e.city}, ${e.state}`})]}),e.expected_price&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(ud,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:C(e.expected_price)}),e.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",C(e.expected_commission)," GCI"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-1 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:$t("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",p.color),children:[r.jsx("div",{className:$t("w-1.5 h-1.5 rounded-full",p.dot)}),r.jsx("span",{className:"capitalize",children:e.priority})]}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.probability,"%"]})]}),o&&a&&s&&i?r.jsx($$e,{stages:s,currentStageId:e.stage_id||"",onStageSelect:(T,L)=>i(e.id,T,L)}):e.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-[10px]",y&&"text-red-600",b&&!y&&"text-amber-600",!y&&!b&&"text-muted-foreground"),children:[y?r.jsx(El,{className:"h-3 w-3"}):r.jsx(zs,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:b?`${x}d left`:xn(new Date(e.target_close_date),"MMM d")})]}):null]})]})})}function EWt({stage:e,deals:t,onDealClick:n,onAddDeal:s,onDragStart:i,onDragOver:o,onDrop:l,isDragOver:a,isWonStage:h=!1}){const p=I.useRef(null),x=t.reduce((N,C)=>N+(C.expected_price||0),0),y=t.reduce((N,C)=>N+(C.expected_commission||0),0),b=N=>N>=1e6?`$${(N/1e6).toFixed(1)}M`:N>=1e3?`$${(N/1e3).toFixed(0)}K`:`$${N.toFixed(0)}`,j=e.icon&&IAe[e.icon]||Lu;return r.jsxs("div",{ref:p,className:$t("flex flex-col h-full min-w-[280px] max-w-[320px] bg-muted/30 rounded-xl border border-border/50 transition-all duration-200",a&&"border-primary/50 bg-primary/5 ring-2 ring-primary/20"),onDragOver:N=>o(N,e.id),onDrop:N=>l(N,e.id),children:[r.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:e.color,borderTopWidth:3},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{backgroundColor:`${e.color}20`},children:r.jsx(j,{className:"h-4 w-4",style:{color:e.color}})}),r.jsx("div",{children:r.jsx("h3",{className:"font-semibold text-sm",children:e.name})})]}),r.jsx(Rt,{variant:"secondary",className:"text-xs font-medium px-2",children:t.length})]}),x>0&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:b(x)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[b(y)," GCI"]})]})]}),r.jsx(Jo,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[t.map(N=>r.jsx("div",{draggable:!0,onDragStart:C=>{C.dataTransfer.effectAllowed="move",i(N.id,e.id)},children:r.jsx(U$e,{deal:N,onClick:()=>n(N),isWonStage:h})},N.id)),t.length===0&&r.jsxs("div",{className:"py-8 px-4 text-center text-muted-foreground text-sm",children:[r.jsx("p",{className:"mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-xs",children:"Drag deals here or add new"})]})]})}),r.jsx("div",{className:"p-2 border-t border-border/50 shrink-0",children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(e.id),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function IWt({stats:e,isLoading:t}){const n=i=>i>=1e6?`$${(i/1e6).toFixed(1)}M`:i>=1e3?`$${(i/1e3).toFixed(0)}K`:`$${i.toLocaleString()}`,s=[{label:"Active Deals",value:(e==null?void 0:e.activeDeals)||0,icon:Kx,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((e==null?void 0:e.pipelineValue)||0),icon:ac,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((e==null?void 0:e.expectedCommission)||0),icon:ud,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(e==null?void 0:e.wonDeals)||0,icon:Wa,color:"text-amber-500",bgColor:"bg-amber-500/10"}];return t?r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(i=>r.jsx(Ge,{className:"animate-pulse",children:r.jsx(Xe,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},i))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(i=>r.jsx(Ge,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:$t("p-2 rounded-lg",i.bgColor),children:r.jsx(i.icon,{className:$t("h-5 w-5",i.color)})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:i.label}),r.jsx("p",{className:"text-xl font-bold",children:i.value})]})]})})},i.label))})}const PWt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],LWt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function OWt({open:e,onOpenChange:t,deal:n,defaultStageId:s}){const{data:i}=O0e(),{data:o}=op(),{data:l}=kxe(),a=F$e(),h=z$e(),[p,x]=I.useState(""),[y,b]=I.useState(!1),j=(l==null?void 0:l.filter(z=>((n==null?void 0:n.listing_id)===z.id,!0)))||[],[N,C]=I.useState({deal_name:"",deal_type:"buyer",stage_id:"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""});I.useEffect(()=>{var z,F,q;e&&(n?(C({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||"",contact_id:n.contact_id||"",listing_id:n.listing_id||"",property_address:n.property_address||"",city:n.city||"",state:n.state||"",zip_code:n.zip_code||"",expected_price:((z=n.expected_price)==null?void 0:z.toString())||"",commission_percentage:((F=n.commission_percentage)==null?void 0:F.toString())||"3",target_close_date:n.target_close_date?new Date(n.target_close_date):void 0,contract_date:n.contract_date?new Date(n.contract_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&x(`${n.contact.first_name} ${n.contact.last_name}`)):(C({deal_name:"",deal_type:"buyer",stage_id:s||((q=i==null?void 0:i[0])==null?void 0:q.id)||"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""}),x("")))},[e,n,s,i]);const A=o==null?void 0:o.filter(z=>{var q,H,K;const F=p.toLowerCase();return((q=z.first_name)==null?void 0:q.toLowerCase().includes(F))||((H=z.last_name)==null?void 0:H.toLowerCase().includes(F))||((K=z.email)==null?void 0:K.toLowerCase().includes(F))}).slice(0,5),E=()=>{const z=parseFloat(N.expected_price)||0,F=parseFloat(N.commission_percentage)||0;return z*(F/100)},T=async z=>{var F,q;if(z.preventDefault(),!N.deal_name.trim()){ze.error("Please enter a deal name");return}try{const H={deal_name:N.deal_name,deal_type:N.deal_type,stage_id:N.stage_id||null,contact_id:N.contact_id||null,listing_id:N.listing_id||null,property_address:N.property_address||null,city:N.city||null,state:N.state||null,zip_code:N.zip_code||null,expected_price:N.expected_price?parseFloat(N.expected_price):null,expected_commission:E()||null,commission_percentage:N.commission_percentage?parseFloat(N.commission_percentage):3,target_close_date:((F=N.target_close_date)==null?void 0:F.toISOString().split("T")[0])||null,contract_date:((q=N.contract_date)==null?void 0:q.toISOString().split("T")[0])||null,priority:N.priority,probability:parseInt(N.probability)||50,notes:N.notes||null};n?(await h.mutateAsync({id:n.id,...H}),ze.success("Deal updated successfully")):(await a.mutateAsync(H),ze.success("Deal created successfully")),t(!1)}catch{ze.error("Failed to save deal")}},L=a.isPending||h.isPending;return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(es,{children:n?"Update the deal details below.":"Enter the details for your new deal."})]}),r.jsxs("form",{onSubmit:T,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Ue,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(at,{id:"deal_name",value:N.deal_name,onChange:z=>C(F=>({...F,deal_name:z.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Deal Type"}),r.jsxs(vn,{value:N.deal_type,onValueChange:z=>C(F=>({...F,deal_type:z})),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:PWt.map(z=>r.jsx(Ht,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Stage"}),r.jsxs(vn,{value:N.stage_id,onValueChange:z=>C(F=>({...F,stage_id:z})),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select stage"})}),r.jsx(gn,{children:i==null?void 0:i.map(z=>r.jsx(Ht,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:z.color}}),z.name]})},z.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{value:p,onChange:z=>{x(z.target.value),b(!0),z.target.value||C(F=>({...F,contact_id:""}))},onFocus:()=>b(!0),placeholder:"Search contacts...",className:"pl-9"}),y&&p&&A&&A.length>0&&r.jsx("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:A.map(z=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{C(F=>({...F,contact_id:z.id})),x(`${z.first_name} ${z.last_name}`),b(!1)},children:[r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[z.first_name," ",z.last_name]}),z.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:z.email})]},z.id))})]})]}),j.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{className:"flex items-center gap-2",children:[r.jsx(Xh,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(vn,{value:N.listing_id,onValueChange:z=>{const F=j.find(q=>q.id===z);C(F?q=>{var H;return{...q,listing_id:z,deal_type:"seller",property_address:F.property_address||q.property_address,city:F.city||q.city,state:F.state||q.state,expected_price:((H=F.price)==null?void 0:H.toString())||q.expected_price}}:q=>({...q,listing_id:z}))},children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select a listing to sync status..."})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"",children:"None"}),j.map(z=>r.jsx(Ht,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:z.property_address||`${z.city}, ${z.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",(z.price/1e3).toFixed(0),"K"]})]})},z.id))]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes will sync automatically between the deal and listing."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Property Details"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(Ue,{htmlFor:"property_address",children:"Address"}),r.jsx(at,{id:"property_address",value:N.property_address,onChange:z=>C(F=>({...F,property_address:z.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"city",children:"City"}),r.jsx(at,{id:"city",value:N.city,onChange:z=>C(F=>({...F,city:z.target.value}))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"state",children:"State"}),r.jsx(at,{id:"state",value:N.state,onChange:z=>C(F=>({...F,state:z.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(at,{id:"zip_code",value:N.zip_code,onChange:z=>C(F=>({...F,zip_code:z.target.value}))})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Financial Details"}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"expected_price",children:"Expected Price"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(at,{id:"expected_price",type:"number",value:N.expected_price,onChange:z=>C(F=>({...F,expected_price:z.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(at,{id:"commission_percentage",type:"number",step:"0.1",value:N.commission_percentage,onChange:z=>C(F=>({...F,commission_percentage:z.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Expected GCI"}),r.jsx(at,{value:E()?`$${E().toLocaleString()}`:"-",disabled:!0,className:"bg-muted"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Dates & Status"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Target Close Date"}),r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!N.target_close_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),N.target_close_date?xn(N.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(nu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:N.target_close_date,onSelect:z=>C(F=>({...F,target_close_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Contract Date"}),r.jsxs(Du,{children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!N.contract_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),N.contract_date?xn(N.contract_date,"PPP"):"Pick a date"]})}),r.jsx(nu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:N.contract_date,onSelect:z=>C(F=>({...F,contract_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Priority"}),r.jsxs(vn,{value:N.priority,onValueChange:z=>C(F=>({...F,priority:z})),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:LWt.map(z=>r.jsx(Ht,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(at,{type:"number",min:"0",max:"100",value:N.probability,onChange:z=>C(F=>({...F,probability:z.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:N.notes,onChange:z=>C(F=>({...F,notes:z.target.value})),placeholder:"Add any additional notes about this deal...",rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:L,children:[L&&r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const DWt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},RWt={note:Po,call:ca,email:Ys,meeting:zs,stage_change:Fs,task_completed:Ya,document:fi,system:Ki};function FWt({deal:e,open:t,onOpenChange:n,onEdit:s,onAddToScorecard:i,isWonStage:o}){var le,ve;const{data:l,isLoading:a}=sWt((e==null?void 0:e.id)||""),{data:h,isLoading:p}=aWt((e==null?void 0:e.id)||""),x=iWt(),y=lWt(),b=oWt(),j=nWt(),[N,C]=I.useState(""),[A,E]=I.useState(""),[T,L]=I.useState(!1);if(!e)return null;const z=DWt[e.deal_type],F=ne=>ne?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ne):"-",q=async()=>{if(N.trim())try{await x.mutateAsync({deal_id:e.id,activity_type:"note",title:"Note added",description:N}),C(""),ze.success("Note added")}catch{ze.error("Failed to add note")}},H=async()=>{if(A.trim())try{await y.mutateAsync({deal_id:e.id,title:A,sort_order:((h==null?void 0:h.length)||0)+1}),E(""),ze.success("Task added")}catch{ze.error("Failed to add task")}},K=async(ne,ge)=>{try{await b.mutateAsync({id:ne,is_completed:ge,deal_id:e.id})}catch{ze.error("Failed to update task")}},Z=async()=>{try{await j.mutateAsync(e.id),ze.success("Deal deleted"),n(!1)}catch{ze.error("Failed to delete deal")}},te=(h==null?void 0:h.filter(ne=>ne.is_completed).length)||0,ae=(h==null?void 0:h.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(tse,{open:t,onOpenChange:n,children:r.jsxs(kI,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(rse,{className:"p-6 pb-4 border-b shrink-0",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Rt,{variant:"outline",className:$t("text-xs",z.color),children:z.label}),r.jsxs(Rt,{variant:"secondary",className:"text-xs capitalize",children:[e.priority," priority"]})]}),r.jsx(nse,{className:"text-xl",children:e.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>s(e),children:r.jsx(rc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>L(!0),children:r.jsx(Zn,{className:"h-4 w-4"})})]})]})}),r.jsx(Jo,{className:"flex-1",children:r.jsxs("div",{className:"p-6 space-y-6",children:[e.contact&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(ci,{className:"h-10 w-10",children:r.jsxs(di,{className:"bg-primary/10 text-primary",children:[(le=e.contact.first_name)==null?void 0:le[0],(ve=e.contact.last_name)==null?void 0:ve[0]]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"font-medium",children:[e.contact.first_name," ",e.contact.last_name]}),e.contact.email&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.contact.email})]}),r.jsxs("div",{className:"flex gap-2",children:[e.contact.phone&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${e.contact.phone}`,children:r.jsx(ca,{className:"h-4 w-4"})})}),e.contact.email&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${e.contact.email}`,children:r.jsx(Ys,{className:"h-4 w-4"})})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(e.property_address||e.city)&&r.jsxs("div",{className:"col-span-2 flex items-start gap-2 text-sm",children:[r.jsx(fi,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:e.property_address||"Address TBD"}),r.jsx("p",{className:"text-muted-foreground",children:[e.city,e.state,e.zip_code].filter(Boolean).join(", ")})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected Price"}),r.jsx("p",{className:"text-lg font-bold",children:F(e.expected_price)})]}),r.jsxs("div",{className:"bg-emerald-500/10 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected GCI"}),r.jsx("p",{className:"text-lg font-bold text-emerald-600",children:F(e.expected_commission)})]}),o&&!e.scorecard_transaction_id&&i&&r.jsxs(ee,{onClick:()=>i(e),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(Wa,{className:"h-4 w-4 mr-2"}),"Add to Scorecard"]}),e.scorecard_transaction_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-lg p-3",children:[r.jsx(Ya,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),e.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",xn(new Date(e.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(ud,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[e.probability,"% probability"]})]})]}),e.notes&&r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium mb-1",children:"Notes"}),r.jsx("p",{className:"text-muted-foreground",children:e.notes})]}),r.jsxs(ba,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(fa,{className:"w-full grid grid-cols-2",children:[r.jsxs(ln,{value:"tasks",className:"gap-1",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Tasks ",ae>0&&`(${te}/${ae})`]}),r.jsxs(ln,{value:"activity",className:"gap-1",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(An,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{placeholder:"Add a new task...",value:A,onChange:ne=>E(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&H()}),r.jsx(ee,{onClick:H,disabled:!A.trim(),children:r.jsx(jn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[h==null?void 0:h.map(ne=>r.jsxs("div",{className:$t("flex items-center gap-3 p-3 rounded-lg border transition-colors",ne.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(cc,{checked:ne.is_completed,onCheckedChange:ge=>K(ne.id,!!ge)}),r.jsx("span",{className:$t("flex-1 text-sm",ne.is_completed&&"line-through text-muted-foreground"),children:ne.title}),ne.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:xn(new Date(ne.due_date),"MMM d")})]},ne.id)),(h==null?void 0:h.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs(An,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ps,{placeholder:"Add a note...",value:N,onChange:ne=>C(ne.target.value),rows:2}),r.jsxs(ee,{onClick:q,disabled:!N.trim(),size:"sm",className:"w-full",children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[l==null?void 0:l.map(ne=>{const ge=RWt[ne.activity_type]||Ki;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:r.jsx(ge,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:ne.title}),ne.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:ne.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:tu(new Date(ne.created_at),{addSuffix:!0})})]})]},ne.id)}),(l==null?void 0:l.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No activity yet"})]})]})]})]})})]})}),r.jsx(fh,{open:T,onOpenChange:L,children:r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Delete Deal?"}),r.jsxs(Cu,{children:['This will permanently delete "',e.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:Z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function zWt({open:e,onOpenChange:t,deal:n,onComplete:s}){const i=Nse(),o=z$e(),{data:l}=kse(),{data:a}=Ug(),[h,p]=I.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:xn(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});I.useEffect(()=>{if(n&&e){const b=n.deal_type==="seller"?"seller":"buyer",j=n.expected_price||0,N=n.commission_percentage||3,C=n.expected_commission||j*N/100;p({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:b,close_date:n.actual_close_date||n.target_close_date||xn(new Date,"yyyy-MM-dd"),sale_price:j,commission_amount:C,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,e]);const x=async b=>{if(b.preventDefault(),!!n)try{const j=await i.mutateAsync({property_address:h.property_address,city:h.city||null,state:h.state||null,zip:h.zip||null,transaction_type:h.transaction_type,close_date:h.close_date,sale_price:h.sale_price,commission_amount:h.commission_amount||null,lead_source_id:h.lead_source_id||null,client_type_id:h.client_type_id||null,contact_id:n.contact_id||null,notes:h.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:j.id,actual_close_date:h.close_date}),ze.success("Deal added to Scorecard! 🎉"),t(!1),s==null||s()}catch(j){console.error("Error syncing to scorecard:",j),ze.error("Failed to add to scorecard")}},y=b=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(b);return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{className:"space-y-3",children:[r.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20",children:r.jsx(Wa,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(qr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(es,{className:"text-center",children:"Review and confirm the details before adding this deal to your Scorecard."})]}),r.jsxs("form",{onSubmit:x,className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(fi,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(at,{id:"property_address",value:h.property_address,onChange:b=>p(j=>({...j,property_address:b.target.value})),placeholder:"123 Main St",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"city",children:"City"}),r.jsx(at,{id:"city",value:h.city,onChange:b=>p(j=>({...j,city:b.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"state",children:"State"}),r.jsx(at,{id:"state",value:h.state,onChange:b=>p(j=>({...j,state:b.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"zip",children:"Zip"}),r.jsx(at,{id:"zip",value:h.zip,onChange:b=>p(j=>({...j,zip:b.target.value})),placeholder:"75001"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Transaction Type *"}),r.jsxs(vn,{value:h.transaction_type,onValueChange:b=>p(j=>({...j,transaction_type:b})),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"buyer",children:"Buyer"}),r.jsx(Ht,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(at,{id:"close_date",type:"date",value:h.close_date,onChange:b=>p(j=>({...j,close_date:b.target.value})),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(ud,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(at,{id:"sale_price",type:"number",value:h.sale_price||"",onChange:b=>p(j=>({...j,sale_price:Number(b.target.value)})),placeholder:"450000",required:!0,min:0}),h.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Ue,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(fS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(at,{id:"commission_amount",type:"number",value:h.commission_amount||"",onChange:b=>p(j=>({...j,commission_amount:Number(b.target.value)})),placeholder:"13500",min:0}),h.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Lead Source"}),r.jsxs(vn,{value:h.lead_source_id,onValueChange:b=>p(j=>({...j,lead_source_id:b})),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select source"})}),r.jsx(gn,{children:l==null?void 0:l.map(b=>r.jsx(Ht,{value:b.id,children:b.name},b.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Client Type"}),r.jsxs(vn,{value:h.client_type_id,onValueChange:b=>p(j=>({...j,client_type_id:b})),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select type"})}),r.jsx(gn,{children:a==null?void 0:a.map(b=>r.jsx(Ht,{value:b.id,children:b.name},b.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:h.notes,onChange:b=>p(j=>({...j,notes:b.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(ri,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Skip for now"}),r.jsx(ee,{type:"submit",disabled:i.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:i.isPending?"Adding...":r.jsxs(r.Fragment,{children:["Add to Scorecard",r.jsx(Zo,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const BWt={buyer:{label:"Buyer",color:"bg-blue-500/10 text-blue-600 border-blue-200"},seller:{label:"Seller",color:"bg-emerald-500/10 text-emerald-600 border-emerald-200"},dual:{label:"Dual",color:"bg-purple-500/10 text-purple-600 border-purple-200"},referral:{label:"Referral",color:"bg-orange-500/10 text-orange-600 border-orange-200"},lease:{label:"Lease",color:"bg-cyan-500/10 text-cyan-600 border-cyan-200"}},v5e={urgent:0,high:1,medium:2,low:3};function $Wt({deals:e,stages:t,onDealClick:n,onStageChange:s}){const[i,o]=I.useState("target_close_date"),[l,a]=I.useState("asc"),h=j=>{i===j?a(N=>N==="asc"?"desc":"asc"):(o(j),a("asc"))},p=I.useMemo(()=>[...e].sort((j,N)=>{var A,E;let C=0;switch(i){case"deal_name":C=j.deal_name.localeCompare(N.deal_name);break;case"stage":{const T=((A=t.find(z=>z.id===j.stage_id))==null?void 0:A.sort_order)||0,L=((E=t.find(z=>z.id===N.stage_id))==null?void 0:E.sort_order)||0;C=T-L;break}case"expected_price":C=(j.expected_price||0)-(N.expected_price||0);break;case"expected_commission":C=(j.expected_commission||0)-(N.expected_commission||0);break;case"target_close_date":{const T=j.target_close_date?new Date(j.target_close_date).getTime():1/0,L=N.target_close_date?new Date(N.target_close_date).getTime():1/0;C=T-L;break}case"priority":C=v5e[j.priority]-v5e[N.priority];break}return l==="asc"?C:-C}),[e,t,i,l]),x=j=>j?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(j):"—",y=j=>j?t.find(N=>N.id===j):null,b=({field:j,children:N})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>h(j),children:[N,i===j?l==="asc"?r.jsx(vg,{className:"ml-2 h-4 w-4"}):r.jsx(i1,{className:"ml-2 h-4 w-4"}):r.jsx($x,{className:"ml-2 h-4 w-4 opacity-50"})]});return e.length===0?r.jsx("div",{className:"text-center py-16",children:r.jsx("p",{className:"text-muted-foreground",children:"No deals to display"})}):r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[250px]",children:r.jsx(b,{field:"deal_name",children:"Deal Name"})}),r.jsx(It,{className:"w-[150px]",children:r.jsx(b,{field:"stage",children:"Stage"})}),r.jsx(It,{className:"w-[100px]",children:"Type"}),r.jsx(It,{className:"w-[120px]",children:r.jsx(b,{field:"expected_price",children:"Price"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(b,{field:"expected_commission",children:"GCI"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(b,{field:"target_close_date",children:"Close Date"})}),r.jsx(It,{className:"w-[100px]",children:r.jsx(b,{field:"priority",children:"Priority"})})]})}),r.jsx(Ws,{children:p.map(j=>{y(j.stage_id);const N=BWt[j.deal_type],C=j.target_close_date?gC(new Date(j.target_close_date),new Date):null,A=C!==null&&C<0,E=C!==null&&C<=7&&C>=0;return r.jsxs(Ir,{className:$t("cursor-pointer hover:bg-muted/50 transition-colors",A&&"bg-red-50/50"),onClick:()=>n(j),children:[r.jsx(_t,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:j.deal_name}),j.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[j.contact.first_name," ",j.contact.last_name]})]})}),r.jsx(_t,{onClick:T=>T.stopPropagation(),children:r.jsx($$e,{stages:t,currentStageId:j.stage_id||"",onStageSelect:(T,L)=>s(j.id,T,L)})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",className:$t("text-xs",N.color),children:N.label})}),r.jsx(_t,{children:r.jsx("span",{className:"font-medium",children:x(j.expected_price)})}),r.jsx(_t,{children:r.jsx("span",{className:"text-emerald-600",children:x(j.expected_commission)})}),r.jsx(_t,{children:j.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-sm",A&&"text-red-600",E&&!A&&"text-amber-600"),children:[A&&r.jsx(El,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:xn(new Date(j.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",className:$t("text-xs capitalize",j.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",j.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",j.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",j.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:j.priority})})]},j.id)})})]})})}function UWt(){var we;const e=g3(),{data:t,isLoading:n}=O0e(),{data:s,isLoading:i,refetch:o}=R$e(),{data:l,isLoading:a}=cWt(),h=D$e(),p=rWt(),[x,y]=I.useState("board"),[b,j]=I.useState(!1),[N,C]=I.useState(!1),[A,E]=I.useState(null),[T,L]=I.useState(null),[z,F]=I.useState(null),[q,H]=I.useState(null),[K,Z]=I.useState(!1),[te,ae]=I.useState(null);I.useEffect(()=>{!n&&t&&t.length===0&&h.mutate()},[n,t]);const le=he=>{E(he),C(!0)},ve=he=>{L(he||null),E(null),j(!0)},ne=he=>{E(he),C(!1),j(!0)},ge=(he,xe)=>{F(he)},ie=(he,xe)=>{he.preventDefault(),he.dataTransfer.dropEffect="move",H(xe)},fe=async(he,xe)=>{if(he.preventDefault(),H(null),!z)return;const be=s==null?void 0:s.find(Te=>Te.id===z),Oe=t==null?void 0:t.find(Te=>Te.id===xe);if(!be||!Oe||be.stage_id===xe){F(null);return}try{if(await p.mutateAsync({dealId:z,stageId:xe,stageName:Oe.name}),ze.success(`Moved to ${Oe.name}`),Oe.is_won_stage&&!be.scorecard_transaction_id){const Te={...be,stage_id:xe};ae(Te),Z(!0)}}catch{ze.error("Failed to move deal")}F(null)},de=I.useCallback(async(he,xe,be)=>{const Oe=s==null?void 0:s.find(Ve=>Ve.id===he),Te=t==null?void 0:t.find(Ve=>Ve.id===xe);if(!(!Oe||!Te||Oe.stage_id===xe))try{if(await p.mutateAsync({dealId:he,stageId:xe,stageName:be}),ze.success(`Moved to ${be}`),Te.is_won_stage&&!Oe.scorecard_transaction_id){const Ve={...Oe,stage_id:xe};ae(Ve),Z(!0)}}catch{ze.error("Failed to move deal")}},[s,t,p]),ye=he=>(s==null?void 0:s.filter(xe=>xe.stage_id===he))||[],Ie=n||i,Ne=e?"list":x;return r.jsxs(Or,{children:[r.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)]",children:[r.jsxs("div",{className:"shrink-0 p-4 md:p-6 pb-0 space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Deal Pipeline"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Track and manage your active deals"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Vl,{className:"h-4 w-4"})}),!e&&r.jsx(xI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Cg,{children:[r.jsx(Mg,{asChild:!0,children:r.jsxs(ee,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),className:"px-3 gap-1.5",children:[r.jsx(pm,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(vm,{children:"Kanban board view"})]}),r.jsxs(Cg,{children:[r.jsx(Mg,{asChild:!0,children:r.jsxs(ee,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[r.jsx(Wf,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(vm,{children:"Grouped list view"})]}),r.jsxs(Cg,{children:[r.jsx(Mg,{asChild:!0,children:r.jsxs(ee,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[r.jsx(XT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(vm,{children:"Sortable table view"})]})]})}),r.jsxs(ee,{onClick:()=>ve(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(IWt,{stats:l||null,isLoading:a})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Ie?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(he=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Pr,{className:"h-full rounded-xl"})},he))}):Ne==="board"?r.jsxs(Jo,{className:"h-full -mx-4 md:-mx-6 px-4 md:px-6",children:[r.jsx("div",{className:"flex gap-4 h-full pb-4",children:t==null?void 0:t.map(he=>r.jsx(EWt,{stage:he,deals:ye(he.id),onDealClick:le,onAddDeal:ve,onDragStart:ge,onDragOver:ie,onDrop:fe,isDragOver:q===he.id,isWonStage:he.is_won_stage},he.id))}),r.jsx(zge,{orientation:"horizontal"})]}):Ne==="table"?r.jsx(Jo,{className:"h-full",children:r.jsx($Wt,{deals:s||[],stages:t||[],onDealClick:le,onStageChange:de})}):r.jsx(Jo,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[t==null?void 0:t.map(he=>{const xe=ye(he.id);return xe.length===0?null:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:he.color}}),r.jsx("h3",{className:"font-semibold",children:he.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",xe.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:xe.map(be=>r.jsx(U$e,{deal:be,onClick:()=>le(be),stages:t,onStageChange:de,showStagePicker:!0,isWonStage:he.is_won_stage},be.id))})]},he.id)}),(s==null?void 0:s.length)===0&&r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-muted rounded-full flex items-center justify-center",children:r.jsx(pm,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Start tracking your opportunities by adding your first deal"}),r.jsxs(ee,{onClick:()=>ve(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(OWt,{open:b,onOpenChange:j,deal:A,defaultStageId:T}),r.jsx(FWt,{deal:A,open:N,onOpenChange:C,onEdit:ne,isWonStage:A?(we=t==null?void 0:t.find(he=>he.id===A.stage_id))==null?void 0:we.is_won_stage:!1,onAddToScorecard:he=>{ae(he),Z(!0),C(!1)}}),r.jsx(zWt,{open:K,onOpenChange:Z,deal:te,onComplete:()=>{o(),ae(null)}})]})}const Bpe=[{value:"video_intro",label:"Video Intro",icon:Fi,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:zT,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:Gx,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:Xh,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:uc,description:"Links to your social profiles"}],qWt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],VWt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function q$e({cardId:e}){const{data:t,isLoading:n}=Iit(e),s=Pit(),i=Lit(),o=Oit(),[l,a]=I.useState(!1),[h,p]=I.useState(""),[x,y]=I.useState(null);if(n)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Pr,{className:"h-16 w-full"}),r.jsx(Pr,{className:"h-16 w-full"})]});const b=()=>{h&&s.mutate({card_id:e,block_type:h,sort_order:(t==null?void 0:t.length)||0,config:VWt[h]||{}},{onSuccess:()=>{a(!1),p("")}})},j=T=>{i.mutate({id:T.id,is_visible:!T.is_visible})},N=(T,L)=>{if(!t)return;const z=t.findIndex(H=>H.id===T.id),F=L==="up"?z-1:z+1;if(F<0||F>=t.length)return;const q=t[F];i.mutate({id:T.id,sort_order:q.sort_order}),i.mutate({id:q.id,sort_order:T.sort_order})},C=T=>{confirm("Remove this block from this card?")&&o.mutate(T.id)},A=(T,L)=>{i.mutate({id:T.id,config:L},{onSuccess:()=>y(null)})},E=T=>Bpe.find(L=>L.value===T);return r.jsxs("div",{className:"space-y-3",children:[!t||t.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-muted-foreground mb-4 text-sm",children:"No blocks yet. Add a block to customize this card."}),r.jsxs(ee,{size:"sm",onClick:()=>a(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):r.jsxs(r.Fragment,{children:[t.map((T,L)=>{const z=E(T.block_type),F=(z==null?void 0:z.icon)||Gx;return r.jsx(Ge,{className:T.is_visible?"":"opacity-50",children:r.jsx(Xe,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(p1,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx(F,{className:"h-4 w-4 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-xs",children:(z==null?void 0:z.label)||T.block_type}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:HWt(T)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(T,"up"),disabled:L===0,children:r.jsx(vg,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(T,"down"),disabled:L===t.length-1,children:r.jsx(i1,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(T),children:T.is_visible?r.jsx(Qo,{className:"h-3 w-3"}):r.jsx(d1,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(T),children:"Edit"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>C(T),children:r.jsx(Zn,{className:"h-3 w-3"})})]})]})})},T.id)}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>a(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:Bpe.map(T=>{const L=T.icon;return r.jsxs("button",{onClick:()=>p(T.value),className:`flex items-center gap-3 p-3 rounded-lg border text-left transition-colors ${h===T.value?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[r.jsx(L,{className:"h-5 w-5 text-primary flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:T.description})]})]},T.value)})}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{onClick:b,disabled:!h||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(WWt,{block:x,onSave:T=>A(x,T),onClose:()=>y(null)})]})}function HWt(e){var n;const t=e.config;switch(e.block_type){case"video_intro":return t.video_url?"Video configured":"No video set";case"testimonials":{const s=((n=t.testimonials)==null?void 0:n.length)||0;return`${s} testimonial${s!==1?"s":""}`}case"specialties":{const s=t.tags||[];return s.length?s.slice(0,3).join(", ")+(s.length>3?"...":""):"No tags"}case"custom_links":{const s=t.links||[];return`${s.length} link${s.length!==1?"s":""}`}case"social_media":{const s=t.platforms||[];return s.length?s.map(i=>i.platform).join(", "):"No platforms"}default:return""}}function WWt({block:e,onSave:t,onClose:n}){const[s,i]=I.useState(e.config),o=Bpe.find(l=>l.value===e.block_type);return r.jsx(Br,{open:!0,onOpenChange:n,children:r.jsxs(Fr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Edit ",o==null?void 0:o.label]})}),e.block_type==="video_intro"&&r.jsx(GWt,{config:s,onChange:i,cardId:e.card_id}),e.block_type==="testimonials"&&r.jsx(KWt,{config:s,onChange:i}),e.block_type==="specialties"&&r.jsx(ZWt,{config:s,onChange:i}),e.block_type==="custom_links"&&r.jsx(YWt,{config:s,onChange:i}),e.block_type==="social_media"&&r.jsx(XWt,{config:s,onChange:i}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(ee,{onClick:()=>t(s),children:"Save"})]})]})})}function GWt({config:e,onChange:t,cardId:n}){var j,N;const[s,i]=I.useState(""),[o,l]=I.useState((j=e.video_url)!=null&&j.includes("youtube")||(N=e.video_url)!=null&&N.includes("youtu.be")?"youtube":"library"),{data:a}=Zt({queryKey:["card-owner",n],queryFn:async()=>{const{data:C}=await J.from("agent_cards").select("user_id").eq("id",n).single();return C==null?void 0:C.user_id},enabled:!!n}),{data:h,isLoading:p}=Zt({queryKey:["agent-videos-library",a],queryFn:async()=>{const{data:C,error:A}=await J.from("agent_videos").select("id, title, bunny_video_id, thumbnail_url, playback_url, created_at").eq("owner_user_id",a).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(A)throw A;return C||[]},enabled:!!a}),x=(h==null?void 0:h.filter(C=>!s||(C.title||"").toLowerCase().includes(s.toLowerCase())))||[],y=e.bunny_video_id,b=C=>{var L;const A=(L=C.playback_url)==null?void 0:L.match(/\/(?:play|embed)\/(\d+)\//),T=`https://iframe.mediadelivery.net/embed/${A?A[1]:"570924"}/${C.bunny_video_id}?autoplay=false&responsive=true`;t({...e,video_url:T,bunny_video_id:C.bunny_video_id,video_source:"library"})};return r.jsx("div",{className:"space-y-4",children:r.jsxs(ba,{value:o,onValueChange:l,children:[r.jsxs(fa,{className:"w-full",children:[r.jsx(ln,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(ln,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(An,{value:"library",className:"space-y-3 mt-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search videos...",value:s,onChange:C=>i(C.target.value),className:"pl-9"})]}),r.jsx(Jo,{className:"h-[240px]",children:p?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Pr,{className:"h-14 w-full"}),r.jsx(Pr,{className:"h-14 w-full"})]}):x.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:(h==null?void 0:h.length)===0?"No videos in library yet":"No matching videos"}):r.jsx("div",{className:"space-y-1.5 pr-3",children:x.map(C=>r.jsxs("button",{onClick:()=>b(C),className:`w-full flex items-center gap-3 p-2 rounded-lg border text-left transition-colors ${y===C.bunny_video_id?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[C.thumbnail_url?r.jsx("img",{src:C.thumbnail_url,alt:"",className:"h-10 w-16 rounded object-cover flex-shrink-0 bg-muted",onError:A=>{var E;A.currentTarget.style.display="none",(E=A.currentTarget.nextElementSibling)==null||E.classList.remove("hidden")}}):null,r.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${C.thumbnail_url?"hidden":""}`,children:r.jsx(Fi,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate flex-1",children:C.title||"Untitled Video"}),y===C.bunny_video_id&&r.jsx(Ca,{className:"h-4 w-4 text-primary flex-shrink-0"})]},C.id))})})]}),r.jsx(An,{value:"youtube",className:"space-y-3 mt-3",children:r.jsxs("div",{children:[r.jsx(Ue,{children:"YouTube URL"}),r.jsx(at,{placeholder:"https://www.youtube.com/watch?v=...",value:e.video_source==="youtube"&&e.video_url||"",onChange:C=>t({...e,video_url:C.target.value,bunny_video_id:null,video_source:"youtube"})}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Paste a YouTube video link"})]})})]})})}function KWt({config:e,onChange:t}){const n=e.testimonials||[],s=(l,a,h)=>{const p=[...n];p[l]={...p[l],[a]:h},t({...e,testimonials:p})},i=()=>t({...e,testimonials:[...n,{name:"",quote:"",role:""}]}),o=l=>t({...e,testimonials:n.filter((a,h)=>h!==l)});return r.jsxs("div",{className:"space-y-4",children:[n.map((l,a)=>r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Ue,{className:"text-xs font-medium",children:["Testimonial ",a+1]}),n.length>1&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(a),children:r.jsx(Zn,{className:"h-3 w-3"})})]}),r.jsx(at,{placeholder:"Client name",value:l.name,onChange:h=>s(a,"name",h.target.value)}),r.jsx(at,{placeholder:"Role/title (optional)",value:l.role||"",onChange:h=>s(a,"role",h.target.value)}),r.jsx("textarea",{className:"w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Their testimonial quote...",value:l.quote,onChange:h=>s(a,"quote",h.target.value)})]})},a)),r.jsxs(ee,{variant:"outline",size:"sm",onClick:i,className:"w-full",children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function ZWt({config:e,onChange:t}){const n=e.tags||[],[s,i]=I.useState(""),o=a=>{t({...e,tags:n.includes(a)?n.filter(h=>h!==a):[...n,a]})},l=()=>{s.trim()&&!n.includes(s.trim())&&(t({...e,tags:[...n,s.trim()]}),i(""))};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{className:"text-sm mb-2 block",children:"Preset Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:qWt.map(a=>r.jsx("button",{onClick:()=>o(a),className:`px-3 py-1.5 text-xs rounded-full border transition-colors ${n.includes(a)?"bg-primary text-primary-foreground border-primary":"bg-muted border-border hover:bg-muted/80"}`,children:a},a))})]}),r.jsxs("div",{children:[r.jsx(Ue,{className:"text-sm mb-2 block",children:"Custom Tag"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{placeholder:"Add your own...",value:s,onChange:a=>i(a.target.value),onKeyDown:a=>a.key==="Enter"&&(a.preventDefault(),l())}),r.jsx(ee,{variant:"outline",size:"sm",onClick:l,children:"Add"})]})]}),n.length>0&&r.jsxs("div",{children:[r.jsxs(Ue,{className:"text-xs text-muted-foreground mb-1 block",children:["Selected (",n.length,")"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(a=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-primary/10 text-primary rounded-full",children:[a,r.jsx("button",{onClick:()=>o(a),className:"hover:text-destructive",children:"×"})]},a))})]})]})}function YWt({config:e,onChange:t}){const n=e.links||[],s=(l,a,h)=>{const p=[...n];p[l]={...p[l],[a]:h},t({...e,links:p})},i=()=>t({...e,links:[...n,{label:"",url:""}]}),o=l=>t({...e,links:n.filter((a,h)=>h!==l)});return r.jsxs("div",{className:"space-y-3",children:[n.map((l,a)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(at,{placeholder:"Button label",value:l.label,onChange:h=>s(a,"label",h.target.value)}),r.jsx(at,{placeholder:"https://...",value:l.url,onChange:h=>s(a,"url",h.target.value)})]}),n.length>1&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(a),children:r.jsx(Zn,{className:"h-3 w-3"})})]},a)),r.jsxs(ee,{variant:"outline",size:"sm",onClick:i,className:"w-full",children:[r.jsx(jn,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const _5e=[{value:"instagram",label:"Instagram"},{value:"facebook",label:"Facebook"},{value:"linkedin",label:"LinkedIn"},{value:"twitter",label:"X (Twitter)"},{value:"youtube",label:"YouTube"},{value:"tiktok",label:"TikTok"},{value:"zillow",label:"Zillow"},{value:"realtor",label:"Realtor.com"}];function XWt({config:e,onChange:t}){const n=e.platforms||[],s=h=>{n.find(p=>p.platform===h)||t({...e,platforms:[...n,{platform:h,url:""}]})},i=(h,p)=>{const x=[...n];x[h]={...x[h],url:p},t({...e,platforms:x})},o=h=>{t({...e,platforms:n.filter((p,x)=>x!==h)})},l=_5e.filter(h=>!n.find(p=>p.platform===h.value)),a=h=>{const p=lhe[h],x=_5e.find(y=>y.value===h);return{label:(x==null?void 0:x.label)||h,color:(p==null?void 0:p.color)||"#666",iconPath:p==null?void 0:p.icon}};return r.jsxs("div",{className:"space-y-4",children:[n.length>0&&r.jsx("div",{className:"space-y-3",children:n.map((h,p)=>{const x=a(h.platform);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-9 w-9 rounded-lg flex items-center justify-center flex-shrink-0 border",style:{borderColor:x.color+"30",backgroundColor:x.color+"10"},children:x.iconPath&&r.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:x.color,children:r.jsx("path",{d:x.iconPath})})}),r.jsx("div",{className:"flex-1",children:r.jsx(at,{placeholder:`Your ${x.label} profile URL`,value:h.url,onChange:y=>i(p,y.target.value)})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(p),children:r.jsx(Zn,{className:"h-3.5 w-3.5"})})]},p)})}),l.length>0&&r.jsxs("div",{children:[r.jsx(Ue,{className:"text-xs text-muted-foreground mb-2 block",children:"Add a platform"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(h=>{const p=lhe[h.value];return r.jsxs("button",{onClick:()=>s(h.value),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-full border border-border bg-muted hover:bg-muted/80 transition-colors",children:[(p==null?void 0:p.icon)&&r.jsx("svg",{viewBox:"0 0 24 24",width:12,height:12,fill:p.color,children:r.jsx("path",{d:p.icon})}),h.label]},h.value)})})]}),n.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Tap a platform above to add your social media profile."})]})}var QWt=Object.defineProperty,dne=Object.getOwnPropertySymbols,V$e=Object.prototype.hasOwnProperty,H$e=Object.prototype.propertyIsEnumerable,b5e=(e,t,n)=>t in e?QWt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$pe=(e,t)=>{for(var n in t||(t={}))V$e.call(t,n)&&b5e(e,n,t[n]);if(dne)for(var n of dne(t))H$e.call(t,n)&&b5e(e,n,t[n]);return e},Upe=(e,t)=>{var n={};for(var s in e)V$e.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&dne)for(var s of dne(e))t.indexOf(s)<0&&H$e.call(e,s)&&(n[s]=e[s]);return n};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var ek;(e=>{const t=class Na{constructor(h,p,x,y){if(this.version=h,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],hNa.MAX_VERSION)throw new RangeError("Version value out of range");if(y<-1||y>7)throw new RangeError("Mask value out of range");this.size=h*4+17;let b=[];for(let N=0;N7)throw new RangeError("Invalid value");let N,C;for(N=x;;N++){const L=Na.getNumDataCodewords(N,p)*8,z=l.getTotalBits(h,N);if(z<=L){C=z;break}if(N>=y)throw new RangeError("Data too long")}for(const L of[Na.Ecc.MEDIUM,Na.Ecc.QUARTILE,Na.Ecc.HIGH])j&&C<=Na.getNumDataCodewords(N,L)*8&&(p=L);let A=[];for(const L of h){n(L.mode.modeBits,4,A),n(L.numChars,L.mode.numCharCountBits(N),A);for(const z of L.getData())A.push(z)}i(A.length==C);const E=Na.getNumDataCodewords(N,p)*8;i(A.length<=E),n(0,Math.min(4,E-A.length),A),n(0,(8-A.length%8)%8,A),i(A.length%8==0);for(let L=236;A.lengthT[z>>>3]|=L<<7-(z&7)),new Na(N,p,T,b)}getModule(h,p){return 0<=h&&h>>9)*1335;const y=(p<<10|x)^21522;i(y>>>15==0);for(let b=0;b<=5;b++)this.setFunctionModule(8,b,s(y,b));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(let b=9;b<15;b++)this.setFunctionModule(14-b,8,s(y,b));for(let b=0;b<8;b++)this.setFunctionModule(this.size-1-b,8,s(y,b));for(let b=8;b<15;b++)this.setFunctionModule(8,this.size-15+b,s(y,b));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let h=this.version;for(let x=0;x<12;x++)h=h<<1^(h>>>11)*7973;const p=this.version<<12|h;i(p>>>18==0);for(let x=0;x<18;x++){const y=s(p,x),b=this.size-11+x%3,j=Math.floor(x/3);this.setFunctionModule(b,j,y),this.setFunctionModule(j,b,y)}}drawFinderPattern(h,p){for(let x=-4;x<=4;x++)for(let y=-4;y<=4;y++){const b=Math.max(Math.abs(y),Math.abs(x)),j=h+y,N=p+x;0<=j&&j{(L!=C-b||F>=N)&&T.push(z[L])});return i(T.length==j),T}drawCodewords(h){if(h.length!=Math.floor(Na.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(let y=0;y>>3],7-(p&7)),p++)}}i(p==h.length*8)}applyMask(h){if(h<0||h>7)throw new RangeError("Mask value out of range");for(let p=0;p5&&h++):(this.finderPenaltyAddHistory(N,C),j||(h+=this.finderPenaltyCountPatterns(C)*Na.PENALTY_N3),j=this.modules[b][A],N=1);h+=this.finderPenaltyTerminateAndCount(j,N,C)*Na.PENALTY_N3}for(let b=0;b5&&h++):(this.finderPenaltyAddHistory(N,C),j||(h+=this.finderPenaltyCountPatterns(C)*Na.PENALTY_N3),j=this.modules[A][b],N=1);h+=this.finderPenaltyTerminateAndCount(j,N,C)*Na.PENALTY_N3}for(let b=0;bj+(N?1:0),p);const x=this.size*this.size,y=Math.ceil(Math.abs(p*20-x*10)/x)-1;return i(0<=y&&y<=9),h+=y*Na.PENALTY_N4,i(0<=h&&h<=2568888),h}getAlignmentPatternPositions(){if(this.version==1)return[];{const h=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(h*2-2))*2;let x=[6];for(let y=this.size-7;x.lengthNa.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*h+128)*h+64;if(h>=2){const x=Math.floor(h/7)+2;p-=(25*x-10)*x-55,h>=7&&(p-=36)}return i(208<=p&&p<=29648),p}static getNumDataCodewords(h,p){return Math.floor(Na.getNumRawDataModules(h)/8)-Na.ECC_CODEWORDS_PER_BLOCK[p.ordinal][h]*Na.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][h]}static reedSolomonComputeDivisor(h){if(h<1||h>255)throw new RangeError("Degree out of range");let p=[];for(let y=0;y0);for(const y of h){const b=y^x.shift();x.push(0),p.forEach((j,N)=>x[N]^=Na.reedSolomonMultiply(j,b))}return x}static reedSolomonMultiply(h,p){if(h>>>8||p>>>8)throw new RangeError("Byte out of range");let x=0;for(let y=7;y>=0;y--)x=x<<1^(x>>>7)*285,x^=(p>>>y&1)*h;return i(x>>>8==0),x}finderPenaltyCountPatterns(h){const p=h[1];i(p<=this.size*3);const x=p>0&&h[2]==p&&h[3]==p*3&&h[4]==p&&h[5]==p;return(x&&h[0]>=p*4&&h[6]>=p?1:0)+(x&&h[6]>=p*4&&h[0]>=p?1:0)}finderPenaltyTerminateAndCount(h,p,x){return h&&(this.finderPenaltyAddHistory(p,x),p=0),p+=this.size,this.finderPenaltyAddHistory(p,x),this.finderPenaltyCountPatterns(x)}finderPenaltyAddHistory(h,p){p[0]==0&&(h+=this.size),p.pop(),p.unshift(h)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(a,h,p){if(h<0||h>31||a>>>h)throw new RangeError("Value out of range");for(let x=h-1;x>=0;x--)p.push(a>>>x&1)}function s(a,h){return(a>>>h&1)!=0}function i(a){if(!a)throw new Error("Assertion error")}const o=class $l{constructor(h,p,x){if(this.mode=h,this.numChars=p,this.bitData=x,p<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}static makeBytes(h){let p=[];for(const x of h)n(x,8,p);return new $l($l.Mode.BYTE,h.length,p)}static makeNumeric(h){if(!$l.isNumeric(h))throw new RangeError("String contains non-numeric characters");let p=[];for(let x=0;x=1<{(t=>{const n=class{constructor(i,o){this.ordinal=i,this.formatBits=o}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(ek||(ek={}));(e=>{(t=>{const n=class{constructor(i,o){this.modeBits=i,this.numBitsCharCount=o}numCharCountBits(i){return this.numBitsCharCount[Math.floor((i+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(ek||(ek={}));var q4=ek;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var JWt={L:q4.QrCode.Ecc.LOW,M:q4.QrCode.Ecc.MEDIUM,Q:q4.QrCode.Ecc.QUARTILE,H:q4.QrCode.Ecc.HIGH},W$e=128,G$e="L",K$e="#FFFFFF",Z$e="#000000",Y$e=!1,X$e=1,eGt=4,tGt=0,rGt=.1;function Q$e(e,t=0){const n=[];return e.forEach(function(s,i){let o=null;s.forEach(function(l,a){if(!l&&o!==null){n.push(`M${o+t} ${i+t}h${a-o}v1H${o+t}z`),o=null;return}if(a===s.length-1){if(!l)return;o===null?n.push(`M${a+t},${i+t} h1v1H${a+t}z`):n.push(`M${o+t},${i+t} h${a+1-o}v1H${o+t}z`);return}l&&o===null&&(o=a)})}),n.join("")}function J$e(e,t){return e.slice().map((n,s)=>s=t.y+t.h?n:n.map((i,o)=>o=t.x+t.w?i:!1))}function nGt(e,t,n,s){if(s==null)return null;const i=e.length+n*2,o=Math.floor(t*rGt),l=i/t,a=(s.width||o)*l,h=(s.height||o)*l,p=s.x==null?e.length/2-a/2:s.x*l,x=s.y==null?e.length/2-h/2:s.y*l,y=s.opacity==null?1:s.opacity;let b=null;if(s.excavate){let N=Math.floor(p),C=Math.floor(x),A=Math.ceil(a+p-N),E=Math.ceil(h+x-C);b={x:N,y:C,w:A,h:E}}const j=s.crossOrigin;return{x:p,y:x,h,w:a,excavation:b,opacity:y,crossOrigin:j}}function sGt(e,t){return t!=null?Math.max(Math.floor(t),0):e?eGt:tGt}function eUe({value:e,level:t,minVersion:n,includeMargin:s,marginSize:i,imageSettings:o,size:l,boostLevel:a}){let h=rt.useMemo(()=>{const N=(Array.isArray(e)?e:[e]).reduce((C,A)=>(C.push(...q4.QrSegment.makeSegments(A)),C),[]);return q4.QrCode.encodeSegments(N,JWt[t],n,void 0,void 0,a)},[e,t,n,a]);const{cells:p,margin:x,numCells:y,calculatedImageSettings:b}=rt.useMemo(()=>{let j=h.getModules();const N=sGt(s,i),C=j.length+N*2,A=nGt(j,l,N,o);return{cells:j,margin:N,numCells:C,calculatedImageSettings:A}},[h,l,o,s,i]);return{qrcode:h,margin:x,cells:p,numCells:y,calculatedImageSettings:b}}var iGt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),aGt=rt.forwardRef(function(t,n){const s=t,{value:i,size:o=W$e,level:l=G$e,bgColor:a=K$e,fgColor:h=Z$e,includeMargin:p=Y$e,minVersion:x=X$e,boostLevel:y,marginSize:b,imageSettings:j}=s,C=Upe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:A}=C,E=Upe(C,["style"]),T=j==null?void 0:j.src,L=rt.useRef(null),z=rt.useRef(null),F=rt.useCallback(ne=>{L.current=ne,typeof n=="function"?n(ne):n&&(n.current=ne)},[n]),[q,H]=rt.useState(!1),{margin:K,cells:Z,numCells:te,calculatedImageSettings:ae}=eUe({value:i,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:b,imageSettings:j,size:o});rt.useEffect(()=>{if(L.current!=null){const ne=L.current,ge=ne.getContext("2d");if(!ge)return;let ie=Z;const fe=z.current,de=ae!=null&&fe!==null&&fe.complete&&fe.naturalHeight!==0&&fe.naturalWidth!==0;de&&ae.excavation!=null&&(ie=J$e(Z,ae.excavation));const ye=window.devicePixelRatio||1;ne.height=ne.width=o*ye;const Ie=o/te*ye;ge.scale(Ie,Ie),ge.fillStyle=a,ge.fillRect(0,0,te,te),ge.fillStyle=h,iGt?ge.fill(new Path2D(Q$e(ie,K))):Z.forEach(function(Ne,we){Ne.forEach(function(he,xe){he&&ge.fillRect(xe+K,we+K,1,1)})}),ae&&(ge.globalAlpha=ae.opacity),de&&ge.drawImage(fe,ae.x+K,ae.y+K,ae.w,ae.h)}}),rt.useEffect(()=>{H(!1)},[T]);const le=$pe({height:o,width:o},A);let ve=null;return T!=null&&(ve=rt.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{H(!0)},ref:z,crossOrigin:ae==null?void 0:ae.crossOrigin})),rt.createElement(rt.Fragment,null,rt.createElement("canvas",$pe({style:le,height:o,width:o,ref:F,role:"img"},E)),ve)});aGt.displayName="QRCodeCanvas";var tUe=rt.forwardRef(function(t,n){const s=t,{value:i,size:o=W$e,level:l=G$e,bgColor:a=K$e,fgColor:h=Z$e,includeMargin:p=Y$e,minVersion:x=X$e,boostLevel:y,title:b,marginSize:j,imageSettings:N}=s,C=Upe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:A,cells:E,numCells:T,calculatedImageSettings:L}=eUe({value:i,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:j,imageSettings:N,size:o});let z=E,F=null;N!=null&&L!=null&&(L.excavation!=null&&(z=J$e(E,L.excavation)),F=rt.createElement("image",{href:N.src,height:L.h,width:L.w,x:L.x+A,y:L.y+A,preserveAspectRatio:"none",opacity:L.opacity,crossOrigin:L.crossOrigin}));const q=Q$e(z,A);return rt.createElement("svg",$pe({height:o,width:o,viewBox:`0 0 ${T} ${T}`,ref:n,role:"img"},C),!!b&&rt.createElement("title",null,b),rt.createElement("path",{fill:a,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),rt.createElement("path",{fill:h,d:q,shapeRendering:"crispEdges"}),F)});tUe.displayName="QRCodeSVG";function oGt({slug:e,agentName:t}){const n=I.useRef(null),s=`https://cards.relevelup.com/${e}`,i=I.useCallback(()=>{var y;const o=(y=n.current)==null?void 0:y.querySelector("svg");if(!o)return;const l=document.createElement("canvas"),a=1024;l.width=a,l.height=a;const h=l.getContext("2d");if(!h)return;const p=new XMLSerializer().serializeToString(o),x=new Image;x.onload=()=>{h.fillStyle="#ffffff",h.fillRect(0,0,a,a),h.drawImage(x,0,0,a,a);const b=document.createElement("a");b.download=`${e}-qr-code.png`,b.href=l.toDataURL("image/png"),b.click(),ze.success("QR code downloaded!")},x.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(p)))},[e]);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"QR Code"}),r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{ref:n,className:"bg-white p-3 rounded-lg border shadow-sm shrink-0",children:r.jsx(tUe,{value:s,size:120,level:"H",bgColor:"#ffffff",fgColor:"#000000"})}),r.jsxs("div",{className:"space-y-2 min-w-0",children:[r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Download this QR code to use on business cards, flyers, signs, or any print materials. Scanning it opens your digital card instantly."}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:i,className:"gap-1.5",children:[r.jsx(Va,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function pde(e){return{is_published:e.is_published,theme:e.theme,title:e.title||"",positioning_statement:e.positioning_statement||"",bio:e.bio||"",review_snippet:e.review_snippet||"",review_source_url:e.review_source_url||"",booking_url:e.booking_url||"",custom_cta_label:e.custom_cta_label||"",show_photo:e.show_photo,show_bio:e.show_bio,show_credentials:e.show_credentials,show_social_links:e.show_social_links,show_save_contact:e.show_save_contact,show_leave_review:e.show_leave_review,show_refer_friend:e.show_refer_friend,brokerage_display_name:e.brokerage_display_name||"",brokerage_logo_url:e.brokerage_logo_url||"",brokerage_logo_size:e.brokerage_logo_size||56,team_name:e.team_name||"",team_logo_url:e.team_logo_url||"",team_logo_size:e.team_logo_size||56}}function lGt(){const{user:e}=zr(),{data:t,isLoading:n}=pit(e==null?void 0:e.id),s=g3(),[i,o]=I.useState(null),l=I.useMemo(()=>i||(t?pde(t):null),[i,t]);if(n)return r.jsx(Or,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Pr,{className:"h-8 w-48"}),r.jsx(Pr,{className:"h-32 w-full"}),r.jsx(Pr,{className:"h-32 w-full"})]})});if(!t)return r.jsx(Or,{children:r.jsx(dGt,{userId:e==null?void 0:e.id})});const a=l||pde(t),h=p=>{o(x=>{const y=x||pde(t);return typeof p=="function"?p(y):p})};return r.jsx(Or,{children:r.jsxs("div",{className:"flex gap-6",children:[r.jsxs("div",{className:`${s?"w-full":"flex-1 min-w-0"} max-w-2xl mx-auto p-4 space-y-6 animate-fade-in`,children:[r.jsx(uGt,{card:t}),r.jsx(pGt,{card:t,form:a,setForm:h})]}),!s&&r.jsx("div",{className:"w-[400px] shrink-0 sticky top-4 self-start",children:r.jsxs("div",{className:"rounded-xl border bg-muted/30 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b bg-card",children:[r.jsx(yj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-medium",children:"Live Preview"})]}),r.jsx("div",{className:"h-[calc(100vh-140px)] overflow-y-auto",children:r.jsx(cGt,{card:t,form:a})})]})})]})})}function cGt({card:e,form:t}){const{data:n}=Zt({queryKey:["card-preview-profile",e.user_id],queryFn:async()=>{const{data:i}=await J.from("profiles").select("name, email, phone, avatar_url, brokerage_id").eq("id",e.user_id).single();let o=(i==null?void 0:i.avatar_url)||null;if(!o){const{data:l}=await J.storage.from("avatars").list(`${e.user_id}`);if(l&&l.length>0){const{data:a}=J.storage.from("avatars").getPublicUrl(`${e.user_id}/${l[0].name}`);o=`${a.publicUrl}?t=${Date.now()}`}}return{...i,avatar_url:o}}}),s=I.useMemo(()=>({...e,is_published:t.is_published,theme:t.theme,title:t.title||null,positioning_statement:t.positioning_statement||null,bio:t.bio||null,review_snippet:t.review_snippet||null,review_source_url:t.review_source_url||null,booking_url:t.booking_url||null,custom_cta_label:t.custom_cta_label||null,custom_cta_url:e.custom_cta_url,show_photo:t.show_photo,show_bio:t.show_bio,show_video:e.show_video,show_credentials:t.show_credentials,show_social_links:t.show_social_links,show_save_contact:t.show_save_contact,show_leave_review:t.show_leave_review,show_refer_friend:t.show_refer_friend,brokerage_display_name:t.brokerage_display_name||null,brokerage_logo_url:t.brokerage_logo_url||null,brokerage_logo_size:t.brokerage_logo_size,team_name:t.team_name||null,team_logo_url:t.team_logo_url||null,team_logo_size:t.team_logo_size,social_links:e.social_links||[],profile:{name:(n==null?void 0:n.name)||null,email:(n==null?void 0:n.email)||null,phone:(n==null?void 0:n.phone)||null,brokerage_id:(n==null?void 0:n.brokerage_id)||null},brokerage_name:t.brokerage_display_name||null,avatar_url:(n==null?void 0:n.avatar_url)||null}),[e,t,n]);return r.jsx("div",{className:"transform scale-[0.85] origin-top",children:r.jsx(Ege,{card:s})})}function dGt({userId:e}){var h;const[t,n]=I.useState(""),s=v6e(),{data:i}=Zt({queryKey:["my-profile-for-card",e],queryFn:async()=>{if(!e)return null;const{data:p}=await J.from("profiles").select("name").eq("id",e).single();return p},enabled:!!e}),o=((h=i==null?void 0:i.name)==null?void 0:h.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||"",l=()=>{if(!e)return;const p=(t.trim()||o).toLowerCase().replace(/[^a-z0-9-]/g,"-");if(!p){ze.error("Please enter a URL slug for your card");return}s.mutate({user_id:e,slug:p,is_published:!0},{onSuccess:()=>ze.success("Your digital card has been created!")})},a=[{icon:Vx,title:"Shareable Link",desc:"One link that works everywhere"},{icon:Ng,title:"Lead Capture",desc:"Collect leads automatically"},{icon:Kf,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:hd,title:"Fully Customizable",desc:"Themes, colors, and content blocks"}];return r.jsxs("div",{className:"max-w-2xl mx-auto p-4 animate-fade-in",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary/90 via-primary to-primary/80 p-8 md:p-12 mb-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_30%_20%,rgba(255,255,255,0.15),transparent_50%)]"}),r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_80%_80%,rgba(0,0,0,0.1),transparent_50%)]"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm text-sm font-medium mb-4",children:[r.jsx(Cs,{className:"h-3.5 w-3.5"}),"New Feature"]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3 tracking-tight",children:"Your Digital Business Card"}),r.jsx("p",{className:"text-primary-foreground/80 text-lg max-w-md leading-relaxed",children:"Ditch the paper. Share a beautiful, interactive card that captures leads and makes a lasting impression."})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:a.map(p=>r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border bg-card hover:shadow-md transition-shadow",children:[r.jsx("div",{className:"mt-0.5 p-2 rounded-lg bg-primary/10 shrink-0",children:r.jsx(p.icon,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:p.title}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p.desc})]})]},p.title))}),r.jsxs(Ge,{className:"shadow-lg border-2",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx(Qt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(En,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(Xe,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Your Card URL"}),r.jsxs("div",{className:"flex items-center gap-0 mt-1.5",children:[r.jsx("span",{className:"inline-flex items-center px-3 h-10 rounded-l-md border border-r-0 bg-muted text-sm text-muted-foreground whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(at,{value:t||o,onChange:p=>n(p.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),r.jsxs(ee,{onClick:l,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(Cs,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function uGt({card:e}){const n=`https://cards.relevelup.com/${e.slug}`,s=()=>{navigator.clipboard.writeText(n),ze.success("Card link copied!")};return r.jsx("div",{className:"rounded-xl border bg-card p-5",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:"My Digital Card"}),r.jsx(Rt,{variant:e.is_published?"default":"secondary",className:"text-[10px] uppercase tracking-wider",children:e.is_published?"Live":"Draft"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Vx,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",e.slug]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[r.jsx(pl,{className:"h-3.5 w-3.5"})," Copy Link"]}),r.jsx(ee,{size:"sm",asChild:!0,className:"gap-1.5",children:r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function hGt({userId:e}){const t=Wr(),n=I.useRef(null),[s,i]=I.useState(!1),[o,l]=I.useState(""),{data:a,isLoading:h}=Zt({queryKey:["card-editor-profile",e],queryFn:async()=>{const{data:ae}=await J.from("profiles").select("name, email, phone, avatar_url").eq("id",e).single();let le=(ae==null?void 0:ae.avatar_url)||null;if(!le){const{data:ve}=await J.storage.from("avatars").list(`${e}`);if(ve&&ve.length>0){const{data:ne}=J.storage.from("avatars").getPublicUrl(`${e}/${ve[0].name}`);le=`${ne.publicUrl}?t=${Date.now()}`,await J.from("profiles").update({avatar_url:le}).eq("id",e)}}return{...ae,avatar_url:le}}}),[p,x]=I.useState(null),[y,b]=I.useState(null),[j,N]=I.useState(null),[C,A]=I.useState(!1),E=p??(a==null?void 0:a.name)??"",T=y??(a==null?void 0:a.phone)??"",L=j??(a==null?void 0:a.email)??"",z=a==null?void 0:a.avatar_url,F=((a==null?void 0:a.name)||"A").split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),q=!(a!=null&&a.avatar_url)||!(a!=null&&a.phone),H=cr({mutationFn:async ae=>{const{error:le}=await J.from("profiles").update(ae).eq("id",e);if(le)throw le},onSuccess:()=>{t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Profile updated!")},onError:()=>ze.error("Failed to update profile")}),K=()=>{const ae={};if(p!==null&&p!==(a==null?void 0:a.name)&&(ae.name=p),y!==null&&y!==(a==null?void 0:a.phone)&&(ae.phone=y||null),j!==null&&j!==(a==null?void 0:a.email)&&(ae.email=j),Object.keys(ae).length===0){ze.info("No changes to save");return}H.mutate(ae)},Z=ae=>{var ne;const le=(ne=ae.target.files)==null?void 0:ne[0];if(!le)return;if(!le.type.startsWith("image/")){ze.error("Please select an image file");return}const ve=new FileReader;ve.onloadend=()=>{l(ve.result),i(!0)},ve.readAsDataURL(le),ae.target.value=""},te=async ae=>{A(!0);try{const{data:le}=await J.storage.from("avatars").list(`${e}`);le&&le.length>0&&await J.storage.from("avatars").remove(le.map(fe=>`${e}/${fe.name}`));const ve=`${e}/avatar.jpg`,{error:ne}=await J.storage.from("avatars").upload(ve,ae,{upsert:!0,contentType:"image/jpeg"});if(ne)throw ne;const{data:ge}=J.storage.from("avatars").getPublicUrl(ve),ie=ge.publicUrl+"?t="+Date.now();await J.from("profiles").update({avatar_url:ie}).eq("id",e),t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Photo updated!")}catch{ze.error("Failed to upload photo")}finally{A(!1)}};return h?r.jsx(Pr,{className:"h-32 w-full rounded-xl"}):r.jsxs(r.Fragment,{children:[r.jsx(Ge,{className:q?"border-amber-300 dark:border-amber-700":"",children:r.jsxs(Xe,{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Ue,{className:"text-sm font-semibold",children:"Profile Info"}),q&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[r.jsx(El,{className:"h-3 w-3"}),"Missing info — complete below so your card looks great"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-3",children:"This info shows on your digital card and updates your profile everywhere."}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"relative group cursor-pointer",onClick:()=>{var ae;return(ae=n.current)==null?void 0:ae.click()},children:[r.jsxs(ci,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(Ga,{src:z||void 0,alt:E}),r.jsx(di,{className:"text-lg font-semibold bg-primary/10 text-primary",children:F})]}),r.jsx("div",{className:"absolute inset-0 bg-black/40 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(bg,{className:"h-5 w-5 text-white"})}),r.jsx("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:Z})]}),r.jsxs("div",{className:"flex-1 space-y-0.5",children:[r.jsx("p",{className:"text-sm font-medium",children:C?"Uploading...":z?"Tap to change photo":"Add a profile photo"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This photo appears on your card, profile, and community posts"})]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),r.jsx(at,{value:E,onChange:ae=>x(ae.target.value),placeholder:"Your full name",className:"h-10"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),r.jsx(at,{value:T,onChange:ae=>b(ae.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),r.jsx(at,{value:L,onChange:ae=>N(ae.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:K,disabled:H.isPending,className:"w-full",children:H.isPending?"Saving...":"Update Profile Info"})]})}),r.jsx(Mxe,{open:s,onClose:()=>i(!1),imageSrc:o,onCropComplete:te,aspectRatio:1})]})}function fGt({form:e,setForm:t,userId:n}){const[s,i]=I.useState(null),[o,l]=I.useState(e.brokerage_logo_url?"logo":"name"),[a,h]=I.useState(e.team_logo_url?"logo":"name"),p=j=>{l(j),t(j==="name"?N=>({...N,brokerage_logo_url:""}):N=>({...N,brokerage_display_name:""}))},x=j=>{h(j),t(j==="name"?N=>({...N,team_logo_url:""}):N=>({...N,team_name:""}))},y=async(j,N)=>{var A;const C=(A=j.target.files)==null?void 0:A[0];if(C){if(!C.type.startsWith("image/")){ze.error("Please select an image file");return}i(N);try{const E=C.name.split(".").pop()||"png",L=`${n}/${N==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${E}`,{error:z}=await J.storage.from("card-logos").upload(L,C,{upsert:!0});if(z)throw z;const{data:F}=J.storage.from("card-logos").getPublicUrl(L),q=F.publicUrl+"?t="+Date.now();t(N==="brokerage_logo_url"?H=>({...H,[N]:q,brokerage_display_name:""}):H=>({...H,[N]:q,team_name:""})),ze.success("Logo uploaded!")}catch{ze.error("Failed to upload logo")}finally{i(null),j.target.value=""}}},b=j=>{t(N=>({...N,[j]:""}))};return r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-5 space-y-5",children:[r.jsxs("div",{children:[r.jsx(Ue,{className:"text-sm font-semibold",children:"Brokerage & Team Branding"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Choose either a name or a logo for each — not both."})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(Ue,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:o==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>p("name"),children:"Use Name"}),r.jsx(ee,{type:"button",variant:o==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>p("logo"),children:"Use Logo"})]}),o==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Name"}),r.jsx(at,{value:e.brokerage_display_name,onChange:j=>t(N=>({...N,brokerage_display_name:j.target.value})),placeholder:"e.g. Keller Williams Realty",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[e.brokerage_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:e.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${e.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>b("brokerage_logo_url"),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}):null,r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(bg,{className:"h-3.5 w-3.5"}),s==="brokerage_logo_url"?"Uploading...":e.brokerage_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:j=>y(j,"brokerage_logo_url"),disabled:s!==null})]})]}),e.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.brokerage_logo_size||56,"px"]})]}),r.jsx(lm,{value:[e.brokerage_logo_size||56],onValueChange:([j])=>t(N=>({...N,brokerage_logo_size:j})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(Ue,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:a==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("name"),children:"Use Name"}),r.jsx(ee,{type:"button",variant:a==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("logo"),children:"Use Logo"})]}),a==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Team Name"}),r.jsx(at,{value:e.team_name,onChange:j=>t(N=>({...N,team_name:j.target.value})),placeholder:"e.g. The Smith Group",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Team Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[e.team_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:e.team_logo_url,alt:"Team logo",style:{height:`${e.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>b("team_logo_url"),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}):null,r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(bg,{className:"h-3.5 w-3.5"}),s==="team_logo_url"?"Uploading...":e.team_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:j=>y(j,"team_logo_url"),disabled:s!==null})]})]}),e.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.team_logo_size||56,"px"]})]}),r.jsx(lm,{value:[e.team_logo_size||56],onValueChange:([j])=>t(N=>({...N,team_logo_size:j})),min:24,max:120,step:4})]})]})]})]})})}function pGt({card:e,form:t,setForm:n}){var b;const s=_6e(),i=Wr(),{data:o}=b6e(e.id),[l,a]=I.useState(e.slug),[h,p]=I.useState(!1),x=async()=>{const j=l.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!j){ze.error("Please enter a valid URL");return}if(j===e.slug){ze.info("No changes to save");return}p(!0);try{const{data:N}=await J.from("agent_cards").select("id").eq("slug",j).neq("id",e.id).maybeSingle();if(N){ze.error("This URL is already taken. Try another one.");return}const{error:C}=await J.from("agent_cards").update({slug:j}).eq("id",e.id);if(C)throw C;a(j),i.invalidateQueries({queryKey:["agent-card"]}),ze.success("Card address updated!")}catch{ze.error("Failed to update card address")}finally{p(!1)}},y=()=>{s.mutate({id:e.id,...t,is_published:!0,title:t.title||null,positioning_statement:t.positioning_statement||null,bio:t.bio||null,review_snippet:t.review_snippet||null,review_source_url:t.review_source_url||null,booking_url:t.booking_url||null,custom_cta_label:t.custom_cta_label||null,brokerage_display_name:t.brokerage_display_name||null,brokerage_logo_url:t.brokerage_logo_url||null,brokerage_logo_size:t.brokerage_logo_size,team_name:t.team_name||null,team_logo_url:t.team_logo_url||null,team_logo_size:t.team_logo_size},{onSuccess:()=>ze.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ba,{defaultValue:"content",children:[r.jsxs(fa,{className:"w-full h-11 p-1",children:[r.jsxs(ln,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(fm,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(ln,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Qo,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(ln,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Ng,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(ln,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(qT,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(ln,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(vj,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),r.jsxs(An,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(hGt,{userId:e.user_id}),r.jsx(fGt,{form:t,setForm:n,userId:e.user_id}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx(Ue,{className:"text-sm font-semibold",children:"Card Status"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Toggle your card on or off"})]}),r.jsx(Rs,{checked:t.is_published,onCheckedChange:j=>n(N=>({...N,is_published:j}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Card Address"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex flex-1",children:[r.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 bg-muted text-muted-foreground text-xs whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(at,{value:l,onChange:j=>a(j.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"your-name",className:"rounded-l-none h-10"})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:x,disabled:h||l===e.slug,className:"shrink-0",children:h?"Saving...":"Update"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is your unique card URL. Only letters, numbers, and dashes allowed."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Theme"}),r.jsxs(vn,{value:t.theme,onValueChange:j=>n(N=>({...N,theme:j})),children:[r.jsx(mn,{className:"h-11",children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"standard",children:"✨ Standard — Modern & Clean"}),r.jsx(Ht,{value:"luxury",children:"🌙 Luxury — Dark & Gold"}),r.jsx(Ht,{value:"bold",children:"🔥 Bold — Vibrant & Punchy"}),r.jsx(Ht,{value:"classic",children:"📋 Classic — Professional"})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(at,{value:t.title,onChange:j=>n(N=>({...N,title:j.target.value})),placeholder:"e.g. Luxury Real Estate Specialist",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown below your name on the card"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Positioning Statement"}),r.jsx(at,{value:t.positioning_statement,onChange:j=>n(N=>({...N,positioning_statement:j.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Bio"}),r.jsx(ps,{value:t.bio,onChange:j=>n(N=>({...N,bio:j.target.value})),placeholder:"A short intro about you and what makes you different...",rows:3})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Review Snippet"}),r.jsx(at,{value:t.review_snippet,onChange:j=>n(N=>({...N,review_snippet:j.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Review Source URL"}),r.jsx(at,{value:t.review_source_url,onChange:j=>n(N=>({...N,review_source_url:j.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Booking URL"}),r.jsx(at,{value:t.booking_url,onChange:j=>n(N=>({...N,booking_url:j.target.value})),placeholder:"https://calendly.com/your-link",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to show a built-in lead form instead"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Custom CTA Label"}),r.jsx(at,{value:t.custom_cta_label,onChange:j=>n(N=>({...N,custom_cta_label:j.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(An,{value:"sections",className:"mt-4",children:r.jsx(Ge,{children:r.jsx(Xe,{className:"p-5 divide-y",children:[{key:"show_photo",label:"Photo",desc:"Uses the photo from your Profile Info above"},{key:"show_bio",label:"Bio Section",desc:"Display your bio on the card"},{key:"show_credentials",label:"Credentials",desc:"Show star rating and reviews"},{key:"show_social_links",label:"Social Links",desc:"Display your social media links"},{key:"show_save_contact",label:"Save Contact",desc:"Let visitors save you as a contact"},{key:"show_leave_review",label:"Leave Review",desc:"Link to your review page"},{key:"show_refer_friend",label:"Refer a Friend",desc:"Enable referral submissions"}].map(({key:j,label:N,desc:C})=>r.jsxs("div",{className:"flex items-center justify-between py-4 first:pt-0 last:pb-0",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Ue,{className:"text-sm font-medium",children:N}),r.jsx("p",{className:"text-xs text-muted-foreground",children:C})]}),r.jsx(Rs,{checked:t[j],onCheckedChange:A=>n(E=>({...E,[j]:A}))})]},j))})})}),r.jsx(An,{value:"blocks",className:"mt-4",children:r.jsx(q$e,{cardId:e.id})}),r.jsx(An,{value:"analytics",className:"mt-4",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{label:"Views",value:(o==null?void 0:o.views)??0,icon:Qo,color:"text-blue-600 bg-blue-100 dark:text-blue-400 dark:bg-blue-900/30"},{label:"Clicks",value:(o==null?void 0:o.clicks)??0,icon:vj,color:"text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900/30"},{label:"Leads",value:((b=o==null?void 0:o.leads)==null?void 0:b.length)??0,icon:Jh,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(j=>r.jsx(Ge,{className:"overflow-hidden",children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:`p-1.5 rounded-md ${j.color}`,children:r.jsx(j.icon,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:j.label})]}),r.jsx("div",{className:"text-2xl font-bold",children:j.value})]})},j.label))}),o&&o.leads.length>0&&r.jsxs(Ge,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsx(Qt,{className:"text-base",children:"Recent Leads"})}),r.jsx(Xe,{className:"pt-0 space-y-2",children:o.leads.slice(0,5).map(j=>r.jsxs("div",{className:"flex items-center justify-between text-sm p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:j.name}),j.phone&&r.jsx("span",{className:"text-muted-foreground ml-2",children:j.phone})]}),j.intent&&r.jsx(Rt,{variant:"secondary",className:"text-xs",children:j.intent})]},j.id))})]}),(!o||o.leads.length===0)&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-8 text-center",children:[r.jsx(vj,{className:"h-10 w-10 text-muted-foreground/40 mx-auto mb-3"}),r.jsx("p",{className:"font-medium text-muted-foreground",children:"No analytics data yet"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Share your card link to start tracking"})]})})]})}),r.jsx(An,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(Ge,{children:r.jsx(Xe,{className:"p-6",children:r.jsx(oGt,{slug:e.slug})})})})]}),r.jsx(ee,{onClick:y,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:s.isPending?"Saving...":"Save Changes"})]})}const rUe=new Date().getFullYear(),mGt=Array.from({length:5},(e,t)=>rUe-t);function gGt(){const[e,t]=I.useState(rUe),n=ns(),{data:s,isLoading:i}=wpt();return i?r.jsx(Or,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Pr,{className:"h-24"},o))}),r.jsx(Pr,{className:"h-96"})]})}):r.jsx(Or,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Scorecard Admin"}),r.jsx("p",{className:"text-muted-foreground",children:"View agent performance and scorecards"})]}),r.jsxs(vn,{value:String(e),onValueChange:o=>t(Number(o)),children:[r.jsx(mn,{className:"w-[120px]",children:r.jsx(_n,{})}),r.jsx(gn,{children:mGt.map(o=>r.jsx(Ht,{value:String(o),children:o},o))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Vn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Agents Tracking"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ac,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with transactions"})]})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Agents with Scorecards"}),r.jsx(En,{children:"Click to view individual agent scorecards"})]}),r.jsx(Xe,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ac,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Email"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:s.map(o=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:o.name}),r.jsx(_t,{className:"text-muted-foreground",children:o.email}),r.jsx(_t,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const nUe=new Date().getFullYear(),xGt=Array.from({length:10},(e,t)=>nUe-t);function yGt(){var b;const{userId:e}=Wc(),t=ns(),[n,s]=I.useState(nUe),{data:i,isLoading:o}=Zt({queryKey:["agent-profile",e],queryFn:async()=>{const{data:j,error:N}=await J.from("profiles").select("id, name, email").eq("id",e).single();if(N)throw N;return j},enabled:!!e}),{data:l,isLoading:a}=Nxe(n,e),{yearStats:h,lifetimeStats:p,showCommission:x}=FOe(n,e),{data:y}=ROe(n,e);return o?r.jsx(Or,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(j=>r.jsx(Pr,{className:"h-24"},j))})]})}):r.jsx(Or,{title:`${i==null?void 0:i.name}'s Scorecard`,children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>t("/admin/scorecard"),children:r.jsx(Qa,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:i==null?void 0:i.name}),r.jsx("p",{className:"text-muted-foreground",children:i==null?void 0:i.email})]})]}),r.jsxs(vn,{value:String(n),onValueChange:j=>s(Number(j)),children:[r.jsx(mn,{className:"w-[120px]",children:r.jsx(_n,{})}),r.jsx(gn,{children:xGt.map(j=>r.jsx(Ht,{value:String(j),children:j},j))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:h.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.totalTransactions," lifetime"]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Vn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[h.buyerCount,"/",h.sellerCount]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ud,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(h.totalVolume,!0)})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Zf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg Price"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(h.averagePrice,!0)})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Pl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((b=h.topLeadSource)==null?void 0:b.name)||"-"})]})})]}),y&&r.jsx(qze,{goals:y,stats:h,year:n,showCommission:x}),r.jsxs(ba,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"transactions",children:"Transactions"}),r.jsx(ln,{value:"charts",children:"Charts"})]}),r.jsx(An,{value:"transactions",children:r.jsx(Uze,{transactions:l||[],showCommission:x,isLoading:a})}),r.jsx(An,{value:"charts",children:r.jsx(P$e,{stats:h,year:n})})]})]})})}function vGt(){const e=Wr(),[t,n]=I.useState(""),[s,i]=I.useState("all");F6e();const{data:o,refetch:l}=Zt({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:T}=await J.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(T==null?void 0:T.enabled)??!1}}),{data:a,isLoading:h}=Zt({queryKey:["admin-listings"],queryFn:async()=>{const{data:T,error:L}=await J.from("listings").select(` *, agent:profiles!listings_agent_id_fkey(id, name, email), photos:listing_photos(id, photo_url, is_primary) `).order("created_at",{ascending:!1});if(L)throw L;return T}}),{data:p}=Zt({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:T}=await J.from("listings").select("id, is_approved, status"),{data:L}=await J.from("listing_shares").select("id"),{data:z}=await J.from("listing_views").select("id");return{total:(T==null?void 0:T.length)||0,pending:(T==null?void 0:T.filter(F=>!F.is_approved).length)||0,active:(T==null?void 0:T.filter(F=>F.status==="active").length)||0,totalShares:(L==null?void 0:L.length)||0,totalViews:(z==null?void 0:z.length)||0}}}),x=cr({mutationFn:async({id:T,approved:L})=>{const{error:z}=await J.from("listings").update({is_approved:L}).eq("id",T);if(z)throw z},onSuccess:(T,{approved:L})=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success(L?"Listing approved":"Listing unapproved")}}),y=cr({mutationFn:async({id:T,featured:L})=>{const{error:z}=await J.from("listings").update({is_featured:L}).eq("id",T);if(z)throw z},onSuccess:(T,{featured:L})=>{e.invalidateQueries({queryKey:["admin-listings"]}),ze.success(L?"Listing featured":"Listing unfeatured")}}),b=cr({mutationFn:async T=>{const{error:L}=await J.from("listings").delete().eq("id",T);if(L)throw L},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success("Listing deleted")}}),j=cr({mutationFn:async T=>{const{error:L}=await J.from("feature_flags").update({enabled:T}).eq("key","listing_exchange_enabled");if(L)throw L},onSuccess:()=>{l(),ze.success("Feature flag updated")}}),N=o??!1,C=a==null?void 0:a.filter(T=>{var F,q,H,K;const L=((F=T.city)==null?void 0:F.toLowerCase().includes(t.toLowerCase()))||((H=(q=T.agent)==null?void 0:q.name)==null?void 0:H.toLowerCase().includes(t.toLowerCase()))||((K=T.property_address)==null?void 0:K.toLowerCase().includes(t.toLowerCase())),z=s==="all"||s==="pending"&&!T.is_approved||s==="approved"&&T.is_approved;return L&&z}),A=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T),E=T=>{const L={active:"bg-green-500/10 text-green-600 border-green-200",coming_soon:"bg-blue-500/10 text-blue-600 border-blue-200",price_improvement:"bg-amber-500/10 text-amber-600 border-amber-200",under_contract:"bg-purple-500/10 text-purple-600 border-purple-200",sold:"bg-gray-500/10 text-gray-600 border-gray-200"};return L[T]||L.active};return r.jsx(Or,{title:"Listing Exchange Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage community listings"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Feature visible to agents"}),r.jsx(Rs,{checked:N,onCheckedChange:T=>j.mutate(T)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(na,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Listings"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.total)||0})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zf,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.active)||0})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-4 w-4 text-amber-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Pending Review"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.pending)||0})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qo,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Views"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.totalViews)||0})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(uc,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Shares"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.totalShares)||0})]})})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by city, address, or agent...",value:t,onChange:T=>n(T.target.value),className:"pl-9"})]}),r.jsx(ba,{value:s,onValueChange:T=>i(T),children:r.jsxs(fa,{children:[r.jsx(ln,{value:"all",children:"All"}),r.jsx(ln,{value:"pending",children:"Pending"}),r.jsx(ln,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{children:["Listings (",(C==null?void 0:C.length)||0,")"]})}),r.jsx(Xe,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Price"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-center",children:"Approved"}),r.jsx(It,{className:"text-center",children:"Featured"}),r.jsx(It,{children:"Views"}),r.jsx(It,{children:"Shares"}),r.jsx(It,{children:"Date"}),r.jsx(It,{})]})}),r.jsx(Ws,{children:h?r.jsx(Ir,{children:r.jsx(_t,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(C==null?void 0:C.length)===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):C==null?void 0:C.map(T=>{var L,z,F,q,H;return r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(z=(L=T.photos)==null?void 0:L[0])!=null&&z.photo_url?r.jsx("img",{src:T.photos[0].photo_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(na,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.property_address||`${T.city}, ${T.state}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(F=T.property_type)==null?void 0:F.replace("_"," ")})]})]})}),r.jsx(_t,{children:r.jsx("p",{className:"text-sm",children:((q=T.agent)==null?void 0:q.name)||"Unknown"})}),r.jsx(_t,{className:"font-medium",children:A(T.price)}),r.jsx(_t,{children:r.jsx(Rt,{variant:"outline",className:E(T.status),children:(H=T.status)==null?void 0:H.replace("_"," ")})}),r.jsx(_t,{className:"text-center",children:r.jsx(Rs,{checked:T.is_approved??!1,onCheckedChange:K=>x.mutate({id:T.id,approved:K})})}),r.jsx(_t,{className:"text-center",children:r.jsx(Rs,{checked:T.is_featured??!1,onCheckedChange:K=>y.mutate({id:T.id,featured:K})})}),r.jsx(_t,{children:T.view_count||0}),r.jsx(_t,{children:T.share_count||0}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:xn(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(_t,{children:r.jsxs(Cm,{children:[r.jsx(Mm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(lg,{className:"h-4 w-4"})})}),r.jsxs(ap,{align:"end",children:[r.jsxs(mo,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(mo,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(mo,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&b.mutate(T.id)},children:[r.jsx(bs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const _Gt=()=>{var y,b;const[e,t]=I.useState(""),[n,s]=I.useState(null),{data:i,isLoading:o}=Zt({queryKey:["membership-reviews"],queryFn:async()=>{const{data:j,error:N}=await J.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(N)throw N;const C=(j==null?void 0:j.map(T=>T.user_id))||[],{data:A}=await J.from("profiles").select("id, name, email").in("id",C);return j==null?void 0:j.map(T=>({...T,profiles:(A==null?void 0:A.find(L=>L.id===T.user_id))||null}))}}),l=i==null?void 0:i.filter(j=>{var C,A,E,T,L;const N=e.toLowerCase();return((A=(C=j.profiles)==null?void 0:C.name)==null?void 0:A.toLowerCase().includes(N))||((T=(E=j.profiles)==null?void 0:E.email)==null?void 0:T.toLowerCase().includes(N))||((L=j.review_text)==null?void 0:L.toLowerCase().includes(N))}),a=i!=null&&i.length?(i.reduce((j,N)=>j+N.rating,0)/i.length).toFixed(1):"0.0",h=i==null?void 0:i.reduce((j,N)=>(j[N.rating]=(j[N.rating]||0)+1,j),{}),p=(i==null?void 0:i.filter(j=>j.posted_to_google).length)||0,x=j=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(N=>r.jsx(vs,{className:$t("h-4 w-4",j>=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},N))});return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Membership Reviews",description:"View and manage feedback from LevelUp members"}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsx(Ge,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(En,{children:"Total Reviews"}),r.jsx(Qt,{className:"text-3xl",children:(i==null?void 0:i.length)||0})]})}),r.jsx(Ge,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(En,{children:"Average Rating"}),r.jsxs(Qt,{className:"flex items-center gap-2 text-3xl",children:[a,r.jsx(vs,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(Ge,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(En,{children:"5-Star Reviews"}),r.jsx(Qt,{className:"text-3xl",children:(h==null?void 0:h[5])||0})]})}),r.jsx(Ge,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(En,{children:"Posted to Google"}),r.jsxs(Qt,{className:"flex items-center gap-2 text-3xl",children:[p,r.jsx(Fs,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name, email, or review...",value:e,onChange:j=>t(j.target.value),className:"pl-9"})]}),r.jsx(Ge,{children:r.jsx(Xe,{className:"p-0",children:r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Member"}),r.jsx(It,{children:"Rating"}),r.jsx(It,{className:"hidden md:table-cell",children:"Review"}),r.jsx(It,{children:"Google"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Ws,{children:o?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Ir,{children:r.jsx(_t,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(j=>{var N,C;return r.jsxs(Ir,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(j),children:[r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((N=j.profiles)==null?void 0:N.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(C=j.profiles)==null?void 0:C.email})]})}),r.jsx(_t,{children:x(j.rating)}),r.jsx(_t,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:j.review_text||"-"})}),r.jsx(_t,{children:j.posted_to_google?r.jsx(Rt,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Rt,{variant:"outline",children:"No"})}),r.jsx(_t,{className:"text-sm text-muted-foreground",children:xn(new Date(j.created_at),"MMM d, yyyy")})]},j.id)})})]})})}),r.jsx(Br,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsx(Hr,{children:r.jsx(qr,{children:"Review Details"})}),n&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:((y=n.profiles)==null?void 0:y.name)||"Unknown Member"}),((b=n.profiles)==null?void 0:b.email)&&r.jsxs("a",{href:`mailto:${n.profiles.email}`,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-primary",children:[r.jsx(Ys,{className:"h-3 w-3"}),n.profiles.email]})]}),r.jsxs("div",{className:"text-right",children:[x(n.rating),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[n.rating," out of 5 stars"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Review"}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:n.review_text||"No written review provided."})]}),r.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(zs,{className:"h-4 w-4"}),xn(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Rt,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Fs,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Rt,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},bGt=[{value:"0",label:"Sunday"},{value:"1",label:"Monday"},{value:"2",label:"Tuesday"},{value:"3",label:"Wednesday"},{value:"4",label:"Thursday"},{value:"5",label:"Friday"},{value:"6",label:"Saturday"}],wGt=Array.from({length:24},(e,t)=>({value:String(t),label:t===0?"12:00 AM":t<12?`${t}:00 AM`:t===12?"12:00 PM":`${t-12}:00 PM`}));function jGt(){const e=Wr(),{user:t}=zr(),[n,s]=I.useState(!1),[i,o]=I.useState(!1),[l,a]=I.useState(!1),{data:h,isLoading:p}=Zt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:K,error:Z}=await J.from("weekly_digest_settings").select("*").single();if(Z)throw Z;return K}}),{data:x,isLoading:y}=Zt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:K,error:Z}=await J.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(Z)throw Z;return K}}),{data:b}=Zt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:K,error:Z}=await J.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(Z)throw Z;return K||0}}),{data:j,refetch:N}=Zt({queryKey:["digest-queue-status"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const[Z,te,ae,le]=await Promise.all([J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",K.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",K.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",K.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",K.toISOString())]);return{pending:Z.count||0,processing:te.count||0,sent:ae.count||0,failed:le.count||0,total:(Z.count||0)+(te.count||0)+(ae.count||0)+(le.count||0)}},refetchInterval:5e3});I.useEffect(()=>{if(j&&(j.pending>0||j.processing>0)){const K=setInterval(()=>{N(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(K)}},[j,N,e]);const{data:C=0}=Zt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const K=new Date;K.setUTCHours(0,0,0,0);const{count:Z,error:te}=await J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString());if(te)throw te;return Z||0}}),A=cr({mutationFn:async K=>{const{error:Z}=await J.from("weekly_digest_settings").update(K).eq("id",h==null?void 0:h.id);if(Z)throw Z},onSuccess:()=>{e.invalidateQueries({queryKey:["weekly-digest-settings"]}),ze.success("Settings updated")},onError:K=>{ze.error("Failed to update settings: "+K.message)}}),E=async()=>{s(!0);try{const{data:K,error:Z}=await J.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(Z)throw Z;K.queued?ze.success(`${K.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):K.sent!==void 0&&ze.success(`Digest sent! ${K.sent} emails delivered, ${K.failed} failed`),N(),e.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(K){ze.error("Failed to send digest: "+K.message)}finally{s(!1)}},T=async()=>{var K,Z,te,ae,le,ve;if(!(t!=null&&t.email)){ze.error("No email found for your account");return}o(!0);try{const{data:ne,error:ge}=await J.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:t.email}});if(ge)throw ge;const ie=ne==null?void 0:ne.resendId,fe=ne==null?void 0:ne.resendDetails,de=fe==null?void 0:fe.status,ye=((K=fe==null?void 0:fe.body)==null?void 0:K.status)||((te=(Z=fe==null?void 0:fe.body)==null?void 0:Z.data)==null?void 0:te.status),Ie=((le=(ae=fe==null?void 0:fe.body)==null?void 0:ae.error)==null?void 0:le.message)||((ve=fe==null?void 0:fe.body)==null?void 0:ve.message);ze.success(ie?`Preview accepted by email provider (id: ${ie})${de?`, status check: ${de}`:""}${ye?`, provider: ${ye}`:""}${Ie?` (${Ie})`:""}. Check spam/promotions—delivery can take a few minutes.`:"Preview accepted by email provider. Check spam/promotions—delivery can take a few minutes.")}catch(ne){ze.error("Failed to send preview: "+ne.message)}finally{o(!1)}},L=async()=>{a(!0);try{const{data:K,error:Z}=await J.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(Z)throw Z;K.queued===0||K.sent===0&&K.failed===0&&!K.queued?ze.info("No failed emails to retry"):K.queued?ze.success(`${K.queued} emails queued for retry!`):ze.success(`Retry complete! ${K.sent} emails delivered, ${K.failed} failed`),N(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(K){ze.error("Failed to retry: "+K.message)}finally{a(!1)}},z=j!=null&&j.total?Math.round((j.sent+j.failed)/j.total*100):0,F=((j==null?void 0:j.pending)||0)>0||((j==null?void 0:j.processing)||0)>0,{data:q}=Zt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var ve,ne;const K=new Date;K.setUTCHours(0,0,0,0);const[Z,te,ae,le]=await Promise.all([J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",K.toISOString()),J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",K.toISOString()),J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",K.toISOString()),J.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:Z.count||0,totalFailed:te.count||0,agentOsEngaged:ae.count||0,lastSent:((ne=(ve=le.data)==null?void 0:ve[0])==null?void 0:ne.sent_at)||null}},refetchInterval:F?5e3:!1}),H={totalSent:(q==null?void 0:q.totalSent)||0,totalFailed:(q==null?void 0:q.totalFailed)||0,lastSent:q==null?void 0:q.lastSent,agentOsEngaged:(q==null?void 0:q.agentOsEngaged)||0};return p?r.jsx(Or,{title:"Weekly Digest",description:"Manage automated weekly email digests",children:r.jsxs("div",{className:"animate-pulse space-y-4",children:[r.jsx("div",{className:"h-32 bg-muted rounded-lg"}),r.jsx("div",{className:"h-64 bg-muted rounded-lg"})]})}):r.jsx(Or,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(ba,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(fa,{children:[r.jsxs(ln,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(ln,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(ac,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(An,{value:"settings",className:"space-y-6",children:[F&&j&&r.jsx(Ge,{className:"border-primary/50 bg-primary/5",children:r.jsxs(Xe,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(nn,{className:"h-5 w-5 animate-spin text-primary"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:"Sending emails..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[j.sent.toLocaleString()," sent, ",j.pending.toLocaleString()," pending",j.failed>0&&`, ${j.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[z,"%"]})]}),r.jsx(Hc,{value:z,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Processing ~80 emails per minute. Estimated time remaining: ~",Math.ceil(j.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Vn,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:b}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10",children:r.jsx(Ya,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:r.jsx(zc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(Ge,{children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Ki,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.lastSent?xn(new Date(H.lastSent),"MMM d"):"Never"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last Sent"})]})]})})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Ki,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(En,{children:"Configure when the digest is sent"})]}),r.jsxs(Xe,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(Rs,{checked:h==null?void 0:h.is_enabled,onCheckedChange:K=>A.mutate({is_enabled:K})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Cron Frequency"}),r.jsxs(vn,{value:(h==null?void 0:h.cron_frequency)||"daily",onValueChange:K=>A.mutate({cron_frequency:K}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx(Ht,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(h==null?void 0:h.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Day of Week"}),r.jsxs(vn,{value:String(h==null?void 0:h.send_day),onValueChange:K=>A.mutate({send_day:parseInt(K)}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:bGt.map(K=>r.jsx(Ht,{value:K.value,children:K.label},K.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Time (UTC)"}),r.jsxs(vn,{value:String(h==null?void 0:h.send_hour),onValueChange:K=>A.mutate({send_hour:parseInt(K)}),disabled:(h==null?void 0:h.cron_frequency)==="daily",children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:wGt.map(K=>r.jsx(Ht,{value:K.value,children:K.label},K.value))})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{onClick:T,disabled:i,variant:"outline",className:"flex-1",children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Preview to Me"]}),r.jsxs(ee,{onClick:E,disabled:n,className:"flex-1",children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),C>0&&r.jsxs(ee,{onClick:L,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(Vl,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${C} Failed`]})]})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(wi,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(En,{children:"Choose what to include in the digest"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ue,{children:"New Resources"})]}),r.jsx(Rs,{checked:h==null?void 0:h.include_new_resources,onCheckedChange:K=>A.mutate({include_new_resources:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ue,{children:"Community Highlights"})]}),r.jsx(Rs,{checked:h==null?void 0:h.include_community_posts,onCheckedChange:K=>A.mutate({include_community_posts:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ac,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ue,{children:"Agent OS Stats"})]}),r.jsx(Rs,{checked:h==null?void 0:h.include_agent_os_stats,onCheckedChange:K=>A.mutate({include_agent_os_stats:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ue,{children:"Upcoming Events"})]}),r.jsx(Rs,{checked:h==null?void 0:h.include_upcoming_events,onCheckedChange:K=>A.mutate({include_upcoming_events:K})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ue,{children:"Goals Progress"})]}),r.jsx(Rs,{checked:h==null?void 0:h.include_goals_progress,onCheckedChange:K=>A.mutate({include_goals_progress:K})})]})]})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Custom Introduction"}),r.jsx(En,{children:"Personalize the intro message (optional)"})]}),r.jsx(Xe,{children:r.jsx(ps,{placeholder:"Here's what's new this week to help you grow your business...",value:(h==null?void 0:h.custom_intro_text)||"",onChange:K=>A.mutate({custom_intro_text:K.target.value||null}),rows:3})})]})]}),r.jsx(An,{value:"stats",children:r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Ys,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(En,{children:"Recent digest emails sent to members"})]}),r.jsx(Xe,{children:y?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(K=>r.jsx("div",{className:"h-12 bg-muted rounded"},K))}):x&&x.length>0?r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Sent At"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Agent OS"})]})}),r.jsx(Ws,{children:x.map(K=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:K.email_sent_to}),r.jsx(_t,{children:xn(new Date(K.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(_t,{children:r.jsx(Rt,{variant:K.delivery_status==="sent"?"default":"destructive",children:K.delivery_status})}),r.jsx(_t,{children:K.resources_count}),r.jsx(_t,{children:K.has_agent_os_activity?r.jsx(Rt,{variant:"secondary",children:"Active"}):r.jsx(Rt,{variant:"outline",children:"Not Started"})})]},K.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ys,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No digests sent yet"}),r.jsx("p",{className:"text-sm",children:"Send your first digest to see delivery stats"})]})})]})})]})})}const kGt={first_event:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-200",streak_3:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",streak_5:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",events_5:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",events_10:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",events_25:"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200"};function NGt(){var we,he,xe;const e=Wr(),[t,n]=I.useState(""),[s,i]=I.useState(null),[o,l]=I.useState(!1),[a,h]=I.useState(!1),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,N]=I.useState(!0),[C,A]=I.useState(!1),[E,T]=I.useState(""),[L,z]=I.useState(null),{data:F,isLoading:q}=Zt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:be,error:Oe}=await J.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Oe)throw Oe;const Te=(be==null?void 0:be.map(Me=>Me.user_id))||[],{data:Ve}=await J.from("profiles").select("id, name, email").in("id",Te),Fe=new Map((Ve==null?void 0:Ve.map(Me=>[Me.id,{name:Me.name,email:Me.email}]))||[]);return be==null?void 0:be.map(Me=>({...Me,profile:Fe.get(Me.user_id)||null}))}}),{data:H}=Zt({queryKey:["all-profiles-for-points",F],queryFn:async()=>{const{data:be,error:Oe}=await J.from("profiles").select("id, name, email").order("name");if(Oe)throw Oe;return be}}),Z=((H==null?void 0:H.filter(be=>!(F!=null&&F.some(Oe=>Oe.user_id===be.id))))||[]).filter(be=>{var Te,Ve;if(!E)return!0;const Oe=E.toLowerCase();return((Te=be.name)==null?void 0:Te.toLowerCase().includes(Oe))||((Ve=be.email)==null?void 0:Ve.toLowerCase().includes(Oe))}),{data:te,isLoading:ae}=Zt({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:be,error:Oe}=await J.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Oe)throw Oe;return be},enabled:!!(s!=null&&s.user_id)&&a}),{data:le}=Zt({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:be,error:Oe}=await J.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Oe)throw Oe;return be},enabled:!!(s!=null&&s.user_id)}),ve=cr({mutationFn:async({userId:be,points:Oe,reason:Te})=>{const{error:Ve}=await J.from("agent_points").insert({user_id:be,points:Oe,reason:Te});if(Ve)throw Ve;const{data:Fe}=await J.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",be).maybeSingle(),Me=((Fe==null?void 0:Fe.total_points)||0)+Oe,Qe=((Fe==null?void 0:Fe.spendable_points)||0)+Oe,{error:Ee}=await J.from("agent_attendance_stats").upsert({user_id:be,total_points:Math.max(0,Me),spendable_points:Math.max(0,Qe),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Ee)throw Ee},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-agent-points"]}),e.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),x(""),b(""),ze.success(j?"Points awarded successfully!":"Points deducted successfully!")},onError:be=>{console.error("Error modifying points:",be),ze.error("Failed to modify points")}}),ne=()=>{if(!s||!p||!y){ze.error("Please fill in all fields");return}const be=parseInt(p);if(isNaN(be)||be<=0){ze.error("Please enter a valid positive number");return}ve.mutate({userId:s.user_id,points:j?be:-be,reason:y})},ge=()=>{if(!L||!p||!y){ze.error("Please fill in all fields");return}const be=parseInt(p);if(isNaN(be)||be<=0){ze.error("Please enter a valid positive number");return}ve.mutate({userId:L.id,points:be,reason:y},{onSuccess:()=>{A(!1),z(null),T("")}})},ie=(be,Oe)=>{i(be),N(Oe),l(!0)},fe=be=>{i(be),h(!0)},de=F==null?void 0:F.filter(be=>{var Fe,Me,Qe,Ee;const Oe=((Me=(Fe=be.profile)==null?void 0:Fe.name)==null?void 0:Me.toLowerCase())||"",Te=((Ee=(Qe=be.profile)==null?void 0:Qe.email)==null?void 0:Ee.toLowerCase())||"",Ve=t.toLowerCase();return Oe.includes(Ve)||Te.includes(Ve)}),ye=(F==null?void 0:F.reduce((be,Oe)=>be+Oe.total_points,0))||0,Ie=(F==null?void 0:F.length)||0,Ne=Ie>0?Math.round(ye/Ie):0;return q?r.jsx(Or,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(be=>r.jsx(Pr,{className:"h-24"},be))}),r.jsx(Pr,{className:"h-96"})]})}):r.jsx(Or,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Agent Points Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Track, view, and manage agent gamification points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Vn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ie}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Wa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:ye.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Zf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Average Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ne}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"per agent"})]})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search agents...",value:t,onChange:be=>n(be.target.value),className:"pl-10"})]}),r.jsxs(ee,{onClick:()=>A(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{children:"Agent Leaderboard"}),r.jsx(En,{children:"All agents with their points, events, and streaks"})]}),r.jsx(Xe,{children:!de||de.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Wa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"Total Points"}),r.jsx(It,{className:"text-center",children:"Spendable"}),r.jsx(It,{className:"text-center",children:"Events"}),r.jsx(It,{className:"text-center",children:"Streak"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:de.map((be,Oe)=>{var Te,Ve,Fe,Me;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:Oe<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Oe===0?"bg-yellow-100 text-yellow-700":Oe===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Oe+1}):r.jsx("span",{className:"text-muted-foreground",children:Oe+1})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{children:((Ve=(Te=be.profile)==null?void 0:Te.name)==null?void 0:Ve.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Fe=be.profile)==null?void 0:Fe.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(Me=be.profile)==null?void 0:Me.email})]})]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),be.total_points]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(Ha,{className:"h-3 w-3 mr-1"}),be.spendable_points||0]})}),r.jsx(_t,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(zs,{className:"h-3 w-3 text-muted-foreground"}),be.total_events_attended]})}),r.jsx(_t,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Zh,{className:"h-3 w-3 text-orange-500"}),be.current_streak]})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>ie(be,!0),title:"Award points",children:r.jsx(jn,{className:"h-4 w-4 text-green-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>ie(be,!1),title:"Deduct points",children:r.jsx(y1,{className:"h-4 w-4 text-red-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>fe(be),title:"View history",children:r.jsx(nS,{className:"h-4 w-4"})})]})})]},be.user_id)})})]})})]}),r.jsx(Br,{open:o,onOpenChange:l,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:j?"Award Points":"Deduct Points"}),r.jsxs(es,{children:[j?"Award":"Deduct"," points ",j?"to":"from"," ",((we=s==null?void 0:s.profile)==null?void 0:we.name)||"this agent"]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"points",children:"Points Amount"}),r.jsx(at,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:be=>x(be.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"reason",children:"Reason"}),r.jsx(ps,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:be=>b(be.target.value)})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:ne,disabled:ve.isPending,className:j?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:ve.isPending?"Saving...":j?"Award Points":"Deduct Points"})]})]})}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{children:["Point History: ",(he=s==null?void 0:s.profile)==null?void 0:he.name]}),r.jsx(es,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(ba,{defaultValue:"history",className:"w-full",children:[r.jsxs(fa,{className:"grid w-full grid-cols-2",children:[r.jsx(ln,{value:"history",children:"Point History"}),r.jsx(ln,{value:"badges",children:"Badges"})]}),r.jsx(An,{value:"history",className:"mt-4",children:ae?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(be=>r.jsx(Pr,{className:"h-12"},be))}):!te||te.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(nS,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No point history yet"})]}):r.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:te.map(be=>r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:be.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:xn(new Date(be.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Rt,{variant:be.points>=0?"default":"destructive",className:be.points>=0?"bg-green-100 text-green-800":"",children:[be.points>=0?"+":"",be.points]})]},be.id))})}),r.jsx(An,{value:"badges",className:"mt-4",children:!le||le.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Pl,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No badges earned yet"})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:le.map(be=>r.jsxs("div",{className:`p-3 rounded-lg ${kGt[be.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Pl,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:be.badge_name})]}),be.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:be.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",xn(new Date(be.earned_at),"MMM d, yyyy")]})]},be.id))})})]})]})}),r.jsx(Br,{open:C,onOpenChange:be=>{A(be),be||(z(null),T(""),x(""),b(""))},children:r.jsxs(Fr,{className:"max-w-md",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Award Points to New Agent"}),r.jsx(es,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:L?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(ci,{className:"h-10 w-10",children:r.jsx(di,{children:((xe=L.name)==null?void 0:xe.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:L.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:L.email})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>z(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(at,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:be=>x(be.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"new-reason",children:"Reason"}),r.jsx(ps,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:be=>b(be.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name or email...",value:E,onChange:be=>T(be.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:Z.length===0?r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx(Vn,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:E?"No matching agents found":"All agents already have points"})]}):Z.slice(0,20).map(be=>{var Oe;return r.jsxs("button",{onClick:()=>z(be),className:"w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors border-b last:border-b-0 text-left",children:[r.jsx(ci,{className:"h-8 w-8",children:r.jsx(di,{children:((Oe=be.name)==null?void 0:Oe.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:be.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:be.email})]})]},be.id)})})]})}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),L&&r.jsxs(ee,{onClick:ge,disabled:ve.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function SGt(){const{data:e,isLoading:t}=fit(),[n,s]=I.useState(null),[i,o]=I.useState(!1),[l,a]=I.useState(""),[h,p]=I.useState("all"),[x,y]=I.useState("newest"),b=I.useMemo(()=>(e==null?void 0:e.map(E=>E.user_id))||[],[e]),j=I.useMemo(()=>(e==null?void 0:e.map(E=>E.id))||[],[e]),{data:N}=Zt({queryKey:["card-profiles-lookup",b],queryFn:async()=>{if(b.length===0)return{};const{data:E}=await J.from("profiles").select("id, name, email").in("id",b),T={};return E==null||E.forEach(L=>{T[L.id]={name:L.name||"",email:L.email||""}}),T},enabled:b.length>0}),{data:C}=Zt({queryKey:["card-stats-all",j],queryFn:async()=>{if(j.length===0)return{};const E={};j.forEach(z=>{E[z]={views:0,leads:0}});const{data:T}=await J.from("agent_card_interactions").select("card_id").in("card_id",j).eq("interaction_type","card_view");T==null||T.forEach(z=>{E[z.card_id]&&E[z.card_id].views++});const{data:L}=await J.from("agent_card_leads").select("card_id").in("card_id",j);return L==null||L.forEach(z=>{E[z.card_id]&&E[z.card_id].leads++}),E},enabled:j.length>0}),A=I.useMemo(()=>{if(!e)return[];let E=[...e];if(h==="live"?E=E.filter(T=>T.is_published):h==="draft"&&(E=E.filter(T=>!T.is_published)),l.trim()){const T=l.toLowerCase();E=E.filter(L=>{var F,q;const z=N==null?void 0:N[L.user_id];return L.slug.toLowerCase().includes(T)||((F=z==null?void 0:z.name)==null?void 0:F.toLowerCase().includes(T))||((q=z==null?void 0:z.email)==null?void 0:q.toLowerCase().includes(T))})}return x==="newest"?E.sort((T,L)=>new Date(L.created_at).getTime()-new Date(T.created_at).getTime()):x==="oldest"?E.sort((T,L)=>new Date(T.created_at).getTime()-new Date(L.created_at).getTime()):x==="name"?E.sort((T,L)=>{var z,F;return(((z=N==null?void 0:N[T.user_id])==null?void 0:z.name)||"").localeCompare(((F=N==null?void 0:N[L.user_id])==null?void 0:F.name)||"")}):x==="slug"&&E.sort((T,L)=>T.slug.localeCompare(L.slug)),E},[e,h,l,x,N]);return r.jsxs(Or,{title:"Digital Agent Cards",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Digital Agent Cards"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage agent digital business cards"})]}),r.jsxs(ee,{onClick:()=>o(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(_i,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(at,{placeholder:"Search by name, email, or slug...",value:l,onChange:E=>a(E.target.value),className:"pl-9"})]}),r.jsxs(vn,{value:h,onValueChange:p,children:[r.jsx(mn,{className:"w-full sm:w-36",children:r.jsx(_n,{placeholder:"Status"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"all",children:"All Status"}),r.jsx(Ht,{value:"live",children:"Live"}),r.jsx(Ht,{value:"draft",children:"Draft"})]})]}),r.jsxs(vn,{value:x,onValueChange:y,children:[r.jsx(mn,{className:"w-full sm:w-40",children:r.jsx(_n,{placeholder:"Sort by"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"newest",children:"Newest First"}),r.jsx(Ht,{value:"oldest",children:"Oldest First"}),r.jsx(Ht,{value:"name",children:"Name A–Z"}),r.jsx(Ht,{value:"slug",children:"Slug A–Z"})]})]})]}),!t&&e&&e.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",A.length," of ",e.length," cards"]}),t?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(E=>r.jsx(Pr,{className:"h-48"},E))}):A.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:A.map(E=>r.jsx(CGt,{card:E,onEdit:()=>s(E),stats:C==null?void 0:C[E.id]},E.id))}):e&&e.length>0?r.jsx(Ge,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(_i,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No matching cards"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Try adjusting your search or filters"})]})}):r.jsx(Ge,{children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(Vn,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No cards yet"}),r.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Create your first digital agent card"}),r.jsxs(ee,{onClick:()=>o(!0),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(MGt,{open:i,onOpenChange:o}),n&&r.jsx(TGt,{card:n,open:!!n,onOpenChange:E=>!E&&s(null)})]})}function CGt({card:e,onEdit:t,stats:n}){const[s,i]=I.useState(null);I.useEffect(()=>{(async()=>{const{data:h}=await J.from("profiles").select("name").eq("id",e.user_id).single();let p=null;try{const{data:x}=await J.storage.from("avatars").list(`${e.user_id}`);if(x&&x.length>0){const{data:y}=J.storage.from("avatars").getPublicUrl(`${e.user_id}/${x[0].name}`);p=y.publicUrl}}catch{}i({name:(h==null?void 0:h.name)||"Unknown",avatar_url:p})})()},[e.user_id]);const o=`https://cards.relevelup.com/${e.slug}`,l=()=>{navigator.clipboard.writeText(o),ze.success("Link copied!")};return r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:(s==null?void 0:s.avatar_url)||void 0}),r.jsx(di,{children:((s==null?void 0:s.name)||"U")[0]})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold truncate",children:(s==null?void 0:s.name)||"Loading..."}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["/card/",e.slug]})]}),r.jsx(Rt,{variant:e.is_published?"default":"secondary",children:e.is_published?"Live":"Draft"})]}),r.jsxs("div",{className:"flex items-center gap-3 mb-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Qo,{className:"h-3.5 w-3.5"}),(n==null?void 0:n.views)??0," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Vn,{className:"h-3.5 w-3.5"}),(n==null?void 0:n.leads)??0," leads"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:t,className:"flex-1",children:[r.jsx(ha,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:l,children:r.jsx(pl,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Fs,{className:"h-3 w-3"})})})]})]})})}function MGt({open:e,onOpenChange:t}){const[n,s]=I.useState(""),[i,o]=I.useState(""),[l,a]=I.useState(""),[h,p]=I.useState(!1),x=v6e(),y=l.trim(),{data:b}=Zt({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let T=J.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(T=T.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:L}=await T;return L||[]},enabled:e}),[j,N]=I.useState(null),C=(b==null?void 0:b.find(T=>T.id===n))||j,A=()=>{if(!n||!i.trim()){ze.error("Select an agent and enter a slug");return}x.mutate({user_id:n,slug:i.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-"),is_published:!0},{onSuccess:()=>{t(!1),s(""),o(""),a("")}})},E=T=>{var z;s(T),p(!1);const L=b==null?void 0:b.find(F=>F.id===T);L&&(N(L),o(((z=L.name)==null?void 0:z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Br,{open:e,onOpenChange:t,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Create Agent Card"}),r.jsx(es,{children:"Select an agent and set their card URL slug."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Agent"}),r.jsxs(Du,{open:h,onOpenChange:p,children:[r.jsx(Ru,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":h,className:"w-full justify-between font-normal",children:[C?`${C.name} (${C.email})`:"Search for an agent...",r.jsx(o1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(nu,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:r.jsxs(q1,{shouldFilter:!1,children:[r.jsx(V1,{placeholder:"Search by name or email...",value:l,onValueChange:a}),r.jsxs(H1,{children:[r.jsx(W1,{children:"No agents found."}),r.jsx(G1,{children:(b||[]).map(T=>r.jsxs(K1,{value:T.id,onSelect:E,children:[r.jsx(Ca,{className:$t("mr-2 h-4 w-4",n===T.id?"opacity-100":"opacity-0")}),T.name," (",T.email,")"]},T.id))})]})]})})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"URL Slug"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"/card/"}),r.jsx(at,{value:i,onChange:T=>o(T.target.value),placeholder:"john-doe"})]})]}),r.jsx(ee,{onClick:A,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function TGt({card:e,open:t,onOpenChange:n}){const s=_6e(),{data:i}=b6e(e.id),o=Wr(),[l,a]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(!1),[b,j]=I.useState(""),[N,C]=I.useState(e.slug),[A,E]=I.useState(!1),[T,L]=I.useState({is_published:e.is_published,theme:e.theme,title:e.title||"",positioning_statement:e.positioning_statement||"",bio:e.bio||"",review_snippet:e.review_snippet||"",review_source_url:e.review_source_url||"",booking_url:e.booking_url||"",custom_cta_label:e.custom_cta_label||"",custom_cta_url:e.custom_cta_url||"",show_photo:e.show_photo,show_bio:e.show_bio,show_credentials:e.show_credentials,show_social_links:e.show_social_links,show_save_contact:e.show_save_contact,show_leave_review:e.show_leave_review,show_refer_friend:e.show_refer_friend,brokerage_display_name:e.brokerage_display_name||"",brokerage_logo_url:e.brokerage_logo_url||"",brokerage_logo_size:e.brokerage_logo_size||56,team_name:e.team_name||"",team_logo_url:e.team_logo_url||"",team_logo_size:e.team_logo_size||56});I.useEffect(()=>{t&&(async()=>{try{const{data:te}=await J.storage.from("avatars").list(`${e.user_id}`);if(te&&te.length>0){const{data:ae}=J.storage.from("avatars").getPublicUrl(`${e.user_id}/${te[0].name}`);a(`${ae.publicUrl}?t=${Date.now()}`)}}catch{}})()},[e.user_id,t]);const z=Z=>{var le;const te=(le=Z.target.files)==null?void 0:le[0];if(!te)return;if(!te.type.startsWith("image/")){ze.error("Please select an image file");return}if(te.size>5*1024*1024){ze.error("Image must be under 5MB");return}const ae=new FileReader;ae.onloadend=()=>{j(ae.result),y(!0)},ae.readAsDataURL(te),Z.target.value=""},F=async Z=>{p(!0);try{const{data:te}=await J.storage.from("avatars").list(`${e.user_id}`);te&&te.length>0&&await J.storage.from("avatars").remove(te.map(ge=>`${e.user_id}/${ge.name}`));const ae=`${e.user_id}/avatar.jpg`,{error:le}=await J.storage.from("avatars").upload(ae,Z,{upsert:!0,contentType:"image/jpeg"});if(le)throw le;const{data:ve}=J.storage.from("avatars").getPublicUrl(ae),ne=`${ve.publicUrl}?t=${Date.now()}`;a(ne),await J.from("profiles").update({avatar_url:ne}).eq("id",e.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),ze.success("Photo updated!")}catch(te){ze.error(te.message||"Upload failed")}finally{p(!1)}},q=async()=>{const Z=N.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!Z){ze.error("Please enter a valid URL");return}if(Z===e.slug){ze.info("No changes to save");return}E(!0);try{const{data:te}=await J.from("agent_cards").select("id").eq("slug",Z).neq("id",e.id).maybeSingle();if(te){ze.error("This URL is already taken. Try another one.");return}const{error:ae}=await J.from("agent_cards").update({slug:Z}).eq("id",e.id);if(ae)throw ae;C(Z),o.invalidateQueries({queryKey:["agent-cards-admin"]}),ze.success("Card address updated!")}catch{ze.error("Failed to update card address")}finally{E(!1)}},H=async(Z,te)=>{var le;const ae=(le=Z.target.files)==null?void 0:le[0];if(ae){if(!ae.type.startsWith("image/")){ze.error("Please select an image file");return}try{const ve=ae.name.split(".").pop()||"png",ne=te==="brokerage_logo_url"?"brokerage-logo":"team-logo",ge=`${e.user_id}/${ne}.${ve}`,{error:ie}=await J.storage.from("card-logos").upload(ge,ae,{upsert:!0});if(ie)throw ie;const{data:fe}=J.storage.from("card-logos").getPublicUrl(ge),de=fe.publicUrl+"?t="+Date.now();L(te==="brokerage_logo_url"?ye=>({...ye,[te]:de,brokerage_display_name:""}):ye=>({...ye,[te]:de,team_name:""})),ze.success("Logo uploaded!")}catch{ze.error("Failed to upload logo")}finally{Z.target.value=""}}},K=()=>{s.mutate({id:e.id,...T,title:T.title||null,positioning_statement:T.positioning_statement||null,bio:T.bio||null,review_snippet:T.review_snippet||null,review_source_url:T.review_source_url||null,booking_url:T.booking_url||null,custom_cta_label:T.custom_cta_label||null,custom_cta_url:T.custom_cta_url||null,brokerage_display_name:T.brokerage_display_name||null,brokerage_logo_url:T.brokerage_logo_url||null,brokerage_logo_size:T.brokerage_logo_size,team_name:T.team_name||null,team_logo_url:T.team_logo_url||null,team_logo_size:T.team_logo_size},{onSuccess:()=>n(!1)})};return r.jsxs(r.Fragment,{children:[r.jsx(Br,{open:t,onOpenChange:n,children:r.jsxs(Fr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Edit Agent Card"}),r.jsxs(es,{children:["/card/",e.slug]})]}),r.jsxs(ba,{defaultValue:"content",children:[r.jsxs(fa,{className:"w-full",children:[r.jsx(ln,{value:"content",className:"flex-1",children:"Content"}),r.jsx(ln,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(ln,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(ln,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(An,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{children:"Published"}),r.jsx(Rs,{checked:T.is_published,onCheckedChange:Z=>L(te=>({...te,is_published:Z}))})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Agent Photo"}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs(ci,{className:"h-16 w-16",children:[r.jsx(Ga,{src:l||void 0}),r.jsx(di,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:z,disabled:h}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,disabled:h,children:r.jsx("span",{children:h?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Card Address"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsxs("div",{className:"flex flex-1",children:[r.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 bg-muted text-muted-foreground text-xs whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(at,{value:N,onChange:Z=>C(Z.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"agent-name",className:"rounded-l-none"})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:q,disabled:A||N===e.slug,className:"shrink-0",children:A?"Saving...":"Update"})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Theme"}),r.jsxs(vn,{value:T.theme,onValueChange:Z=>L(te=>({...te,theme:Z})),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"standard",children:"✨ Standard (Modern Clean)"}),r.jsx(Ht,{value:"luxury",children:"🌙 Luxury (Dark & Gold)"}),r.jsx(Ht,{value:"bold",children:"🔥 Bold (Vibrant & Punchy)"}),r.jsx(Ht,{value:"classic",children:"📋 Classic (Professional)"})]})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Title / Tagline"}),r.jsx(at,{value:T.title,onChange:Z=>L(te=>({...te,title:Z.target.value})),placeholder:"e.g. Luxury Real Estate Specialist"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shown below the agent's name on the card"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Positioning Statement"}),r.jsx(at,{value:T.positioning_statement,onChange:Z=>L(te=>({...te,positioning_statement:Z.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Bio"}),r.jsx(ps,{value:T.bio,onChange:Z=>L(te=>({...te,bio:Z.target.value})),placeholder:"Short about me...",rows:3})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Review Snippet"}),r.jsx(at,{value:T.review_snippet,onChange:Z=>L(te=>({...te,review_snippet:Z.target.value})),placeholder:"Best agent we've ever worked with..."})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Review Source URL"}),r.jsx(at,{value:T.review_source_url,onChange:Z=>L(te=>({...te,review_source_url:Z.target.value})),placeholder:"https://g.page/your-business/review"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Booking URL (optional — if empty, shows lead form)"}),r.jsx(at,{value:T.booking_url,onChange:Z=>L(te=>({...te,booking_url:Z.target.value})),placeholder:"https://calendly.com/your-link"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Custom CTA Label (optional)"}),r.jsx(at,{value:T.custom_cta_label,onChange:Z=>L(te=>({...te,custom_cta_label:Z.target.value})),placeholder:"Book a Call"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Custom CTA URL (optional)"}),r.jsx(at,{value:T.custom_cta_url,onChange:Z=>L(te=>({...te,custom_cta_url:Z.target.value})),placeholder:"https://example.com/landing"})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(Ue,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(at,{value:T.brokerage_display_name,onChange:Z=>L(te=>({...te,brokerage_display_name:Z.target.value,brokerage_logo_url:""})),placeholder:"Brokerage name (or upload logo below)",disabled:!!T.brokerage_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[T.brokerage_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:T.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${T.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>L(Z=>({...Z,brokerage_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(no,{className:"h-3.5 w-3.5"}),T.brokerage_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Z=>H(Z,"brokerage_logo_url")})]})]}),T.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[T.brokerage_logo_size||56,"px"]})]}),r.jsx(lm,{value:[T.brokerage_logo_size||56],onValueChange:([Z])=>L(te=>({...te,brokerage_logo_size:Z})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(Ue,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(at,{value:T.team_name,onChange:Z=>L(te=>({...te,team_name:Z.target.value,team_logo_url:""})),placeholder:"Team name (or upload logo below)",disabled:!!T.team_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[T.team_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:T.team_logo_url,alt:"Team logo",style:{height:`${T.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>L(Z=>({...Z,team_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(no,{className:"h-3.5 w-3.5"}),T.team_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Z=>H(Z,"team_logo_url")})]})]}),T.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Ue,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[T.team_logo_size||56,"px"]})]}),r.jsx(lm,{value:[T.team_logo_size||56],onValueChange:([Z])=>L(te=>({...te,team_logo_size:Z})),min:24,max:120,step:4})]})]})]})]}),r.jsx(An,{value:"sections",className:"space-y-4 mt-4",children:[{key:"show_photo",label:"Show Photo",hint:"Photo is pulled from the agent's profile."},{key:"show_bio",label:"Show Bio"},{key:"show_credentials",label:"Show Credentials"},{key:"show_social_links",label:"Show Social Links"},{key:"show_save_contact",label:"Save Contact Button"},{key:"show_leave_review",label:"Leave Review Button"},{key:"show_refer_friend",label:"Refer a Friend Button"}].map(({key:Z,label:te,hint:ae})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:te}),ae&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[ae," ",Z==="show_photo"&&r.jsx("a",{href:"/profile",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:"Update Profile"})]})]}),r.jsx(Rs,{checked:T[Z],onCheckedChange:le=>L(ve=>({...ve,[Z]:le}))})]},Z))}),r.jsx(An,{value:"blocks",className:"mt-4",children:r.jsx(q$e,{cardId:e.id})}),r.jsx(An,{value:"analytics",className:"mt-4",children:i?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:i.views}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Views"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:i.clicks}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:i.leads.length}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Leads"})]})})]}),i.leads.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Recent Leads"}),r.jsx("div",{className:"space-y-2",children:i.leads.slice(0,5).map(Z=>r.jsxs("div",{className:"text-sm p-2 bg-muted/50 rounded-lg",children:[r.jsx("span",{className:"font-medium",children:Z.name}),Z.phone&&r.jsxs("span",{className:"text-muted-foreground",children:[" · ",Z.phone]}),Z.intent&&r.jsx(Rt,{variant:"secondary",className:"ml-2 text-xs",children:Z.intent})]},Z.id))})]})]}):r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No analytics data yet"})})]}),r.jsx(ee,{onClick:K,disabled:s.isPending,className:"w-full mt-4",children:s.isPending?"Saving...":"Save Changes"})]})}),r.jsx(Mxe,{open:x,onClose:()=>y(!1),imageSrc:b,onCropComplete:F,aspectRatio:1})]})}const RS={pending_payment:"Pending Payment",order_submitted:"Order Submitted",awaiting_proof_approval:"Awaiting Proof Approval",proof_approved:"Proof Approved",processing:"Processing",in_production:"In Production",shipped:"Shipped",completed:"Completed",cancelled:"Cancelled",refunded:"Refunded"},D0e={pending_payment:"bg-yellow-100 text-yellow-800",order_submitted:"bg-blue-100 text-blue-800",awaiting_proof_approval:"bg-orange-100 text-orange-800",proof_approved:"bg-green-100 text-green-800",processing:"bg-purple-100 text-purple-800",in_production:"bg-indigo-100 text-indigo-800",shipped:"bg-cyan-100 text-cyan-800",completed:"bg-green-200 text-green-900",cancelled:"bg-red-100 text-red-800",refunded:"bg-gray-100 text-gray-800"};function R0e(e=!0){return Zt({queryKey:["marketplace-categories",e],queryFn:async()=>{let t=J.from("marketplace_categories").select("*").order("sort_order",{ascending:!0});e&&(t=t.eq("is_active",!0));const{data:n,error:s}=await t;if(s)throw s;return n}})}function AGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("marketplace_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category created successfully")},onError:t=>{ze.error("Failed to create category: "+t.message)}})}function EGt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("marketplace_categories").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category updated successfully")},onError:t=>{ze.error("Failed to update category: "+t.message)}})}function IGt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("marketplace_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category deleted successfully")},onError:t=>{ze.error("Failed to delete category: "+t.message)}})}function sUe(e,t=!0){return Zt({queryKey:["marketplace-products",e,t],queryFn:async()=>{let n=J.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).order("sort_order",{ascending:!0});e&&(n=n.eq("category_id",e)),t&&(n=n.eq("is_active",!0));const{data:s,error:i}=await n;if(i)throw i;return s}})}function PGt(e){return Zt({queryKey:["marketplace-product",e],queryFn:async()=>{const{data:t,error:n}=await J.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function LGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("marketplace_products").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product created successfully")},onError:t=>{ze.error("Failed to create product: "+t.message)}})}function OGt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("marketplace_products").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.id]}),ze.success("Product updated successfully")},onError:t=>{ze.error("Failed to update product: "+t.message)}})}function DGt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("marketplace_products").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product deleted successfully")},onError:t=>{ze.error("Failed to delete product: "+t.message)}})}function RGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("marketplace_product_images").insert([t]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.product_id]})}})}function FGt(){const e=Wr();return cr({mutationFn:async({id:t,productId:n})=>{const{error:s}=await J.from("marketplace_product_images").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),ze.success("Image deleted successfully")},onError:t=>{ze.error("Failed to delete image: "+t.message)}})}function zGt(){const e=Wr();return cr({mutationFn:async({imageId:t,productId:n})=>{const{error:s}=await J.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:i}=await J.from("marketplace_product_images").update({is_primary:!0}).eq("id",t);if(i)throw i;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),ze.success("Primary image updated")},onError:t=>{ze.error("Failed to set primary image: "+t.message)}})}function BGt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("marketplace_product_variants").insert([t]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.product_id]}),ze.success("Variant added successfully")}})}function $Gt(){const e=Wr();return cr({mutationFn:async({id:t,productId:n})=>{const{error:s}=await J.from("marketplace_product_variants").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),ze.success("Variant deleted successfully")}})}function UGt(){const e=Wr();return cr({mutationFn:async({productId:t,videoUrl:n})=>{await J.from("marketplace_product_videos").delete().eq("product_id",t);const{data:s,error:i}=await J.from("marketplace_product_videos").insert({product_id:t,video_url:n}).select().single();if(i)throw i;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.productId]}),ze.success("Video updated successfully")}})}function qGt(e){const{isAdmin:t}=zr();return Zt({queryKey:["marketplace-orders",e,t],queryFn:async()=>{let n=J.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:i}=await n;if(i)throw i;if(t&&s){const o=[...new Set(s.map(h=>h.user_id))],{data:l}=await J.from("profiles").select("id, name, email").in("id",o),a=new Map((l==null?void 0:l.map(h=>[h.id,h]))||[]);return s.map(h=>({...h,user:a.get(h.user_id)}))}return s}})}function VGt(){const{user:e}=zr();return Zt({queryKey:["my-marketplace-orders",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await J.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("user_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function HGt(e){return Zt({queryKey:["marketplace-order",e],queryFn:async()=>{const{data:t,error:n}=await J.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function WGt(){const e=Wr(),{user:t}=zr();return cr({mutationFn:async({orderId:n,status:s,notes:i,trackingNumber:o,trackingUrl:l,previousStatus:a})=>{const h={status:s};o!==void 0&&(h.tracking_number=o),l!==void 0&&(h.tracking_url=l);const{error:p}=await J.from("marketplace_orders").update(h).eq("id",n);if(p)throw p;const{error:x}=await J.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:i,created_by:t==null?void 0:t.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(s)&&s!==a)try{await J.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:l}})}catch(b){console.error("Failed to send notification email:",b)}},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Order status updated")},onError:n=>{ze.error("Failed to update order: "+n.message)}})}function GGt(){const e=Wr();return cr({mutationFn:async({itemId:t,proofUrl:n,proofNotes:s,orderId:i})=>{const{error:o}=await J.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",t);if(o)throw o;await J.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",i);try{await J.functions.invoke("marketplace-order-notify",{body:{orderId:i,notificationType:"proof_ready"}})}catch(l){console.error("Failed to send proof notification:",l)}return i},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof uploaded & customer notified")}})}function KGt(){const e=Wr();return cr({mutationFn:async({itemId:t,orderId:n})=>{const{error:s}=await J.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof approved")}})}function ZGt(){const e=Wr();return cr({mutationFn:async({itemId:t,orderId:n,reason:s})=>{const{error:i}=await J.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",t);if(i)throw i;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof rejected - please upload a new proof")}})}function YGt(){const{data:e,isLoading:t}=R0e(!1),n=AGt(),s=EGt(),i=IGt(),[o,l]=I.useState(!1),[a,h]=I.useState(null),[p,x]=I.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),y=()=>{x({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),h(null)},b=C=>{h(C),x({name:C.name,description:C.description||"",image_url:C.image_url||"",sort_order:C.sort_order,is_active:C.is_active}),l(!0)},j=async C=>{C.preventDefault(),a?await s.mutateAsync({id:a.id,...p}):await n.mutateAsync(p),l(!1),y()},N=async C=>{confirm("Are you sure you want to delete this category?")&&await i.mutateAsync(C)};return t?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Pr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(C=>r.jsx(Pr,{className:"h-12 w-full"},C))})})]}):r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Qt,{children:"Categories"}),r.jsxs(Br,{open:o,onOpenChange:C=>{l(C),C||y()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsx(qr,{children:a?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Name"}),r.jsx(at,{id:"name",value:p.name,onChange:C=>x({...p,name:C.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:p.description,onChange:C=>x({...p,description:C.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"image_url",children:"Image URL"}),r.jsx(at,{id:"image_url",value:p.image_url,onChange:C=>x({...p,image_url:C.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(at,{id:"sort_order",type:"number",value:p.sort_order,onChange:C=>x({...p,sort_order:parseInt(C.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"is_active",checked:p.is_active,onCheckedChange:C=>x({...p,is_active:C})}),r.jsx(Ue,{htmlFor:"is_active",children:"Active"})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:a?"Update Category":"Create Category"})]})]})]})]}),r.jsx(Xe,{children:e&&e.length>0?r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Sort Order"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:e.map(C=>r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-medium",children:C.name}),r.jsx(_t,{className:"max-w-xs truncate",children:C.description}),r.jsx(_t,{children:C.sort_order}),r.jsx(_t,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${C.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:C.is_active?"Active":"Inactive"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(C),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>N(C.id),disabled:i.isPending,children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},C.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function XGt(){var Ne,we;const{data:e,isLoading:t}=sUe(void 0,!1),{data:n}=R0e(!1),s=LGt(),i=OGt(),o=DGt(),l=RGt(),a=FGt(),h=zGt(),p=BGt(),x=$Gt(),y=UGt(),[b,j]=I.useState(!1),[N,C]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState(null),[q,H]=I.useState(!1),[K,Z]=I.useState({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),[te,ae]=I.useState({name:"",price_adjustment:0}),[le,ve]=I.useState(""),ne=()=>{Z({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),L(null)},ge=he=>{L(he),Z({name:he.name,description:he.description||"",base_price:Number(he.base_price),shipping_fee:Number(he.shipping_fee),category_id:he.category_id||"",allow_artwork_upload:he.allow_artwork_upload,requires_proof_approval:he.requires_proof_approval,is_active:he.is_active,sort_order:he.sort_order}),j(!0)},ie=async he=>{he.preventDefault();const xe={...K,category_id:K.category_id||null};T?await i.mutateAsync({id:T.id,...xe}):await s.mutateAsync(xe),j(!1),ne()},fe=async he=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(he)},de=async he=>{if(!z||!he.target.files||he.target.files.length===0)return;H(!0);const xe=he.target.files[0],be=xe.name.split(".").pop(),Oe=`products/${z.id}/${Date.now()}.${be}`;try{const{error:Te}=await J.storage.from("marketplace").upload(Oe,xe);if(Te)throw Te;const{data:{publicUrl:Ve}}=J.storage.from("marketplace").getPublicUrl(Oe);await l.mutateAsync({product_id:z.id,image_url:Ve,is_primary:!z.images||z.images.length===0}),ze.success("Image uploaded successfully")}catch(Te){ze.error("Failed to upload image: "+Te.message)}finally{H(!1)}},ye=async he=>{he.preventDefault(),z&&(await p.mutateAsync({product_id:z.id,name:te.name,price_adjustment:te.price_adjustment}),ae({name:"",price_adjustment:0}))},Ie=async()=>{!z||!le||(await y.mutateAsync({productId:z.id,videoUrl:le}),ve(""))};return t?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Pr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(he=>r.jsx(Pr,{className:"h-64 w-full"},he))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Qt,{children:"Products"}),r.jsxs(Br,{open:b,onOpenChange:he=>{j(he),he||ne()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Fr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsx(qr,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"name",children:"Product Name"}),r.jsx(at,{id:"name",value:K.name,onChange:he=>Z({...K,name:he.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"category",children:"Category"}),r.jsxs(vn,{value:K.category_id,onValueChange:he=>Z({...K,category_id:he}),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select category"})}),r.jsx(gn,{children:n==null?void 0:n.map(he=>r.jsx(Ht,{value:he.id,children:he.name},he.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:K.description,onChange:he=>Z({...K,description:he.target.value}),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(at,{id:"base_price",type:"number",step:"0.01",min:"0",value:K.base_price,onChange:he=>Z({...K,base_price:parseFloat(he.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(at,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:K.shipping_fee,onChange:he=>Z({...K,shipping_fee:parseFloat(he.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(at,{id:"sort_order",type:"number",value:K.sort_order,onChange:he=>Z({...K,sort_order:parseInt(he.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"allow_artwork_upload",checked:K.allow_artwork_upload,onCheckedChange:he=>Z({...K,allow_artwork_upload:he})}),r.jsx(Ue,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"requires_proof_approval",checked:K.requires_proof_approval,onCheckedChange:he=>Z({...K,requires_proof_approval:he})}),r.jsx(Ue,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"is_active",checked:K.is_active,onCheckedChange:he=>Z({...K,is_active:he})}),r.jsx(Ue,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:s.isPending||i.isPending,children:T?"Update Product":"Create Product"})]})]})]})]}),r.jsx(Xe,{children:e&&e.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(he=>{var xe,be;return r.jsxs(Ge,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[he.images&&he.images.length>0?r.jsx("img",{src:((xe=he.images.find(Oe=>Oe.is_primary))==null?void 0:xe.image_url)||he.images[0].image_url,alt:he.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"No image"}),!he.is_active&&r.jsx(Rt,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:he.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((be=he.category)==null?void 0:be.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(he.base_price).toFixed(2)]}),Number(he.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(he.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[he.allow_artwork_upload&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),he.requires_proof_approval&&r.jsx(Rt,{variant:"outline",className:"text-xs",children:"Proof Required"}),he.variants&&he.variants.length>0&&r.jsxs(Rt,{variant:"outline",className:"text-xs",children:[he.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>ge(he),children:[r.jsx(ha,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{F(he),C(!0)},children:[r.jsx(sS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{F(he),E(!0)},children:[r.jsx(Gx,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>fe(he.id),children:r.jsx(Zn,{className:"h-3 w-3 text-destructive"})})]})]})]},he.id)})}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No products yet. Create your first product to get started."})})]}),r.jsx(Br,{open:N,onOpenChange:C,children:r.jsxs(Fr,{className:"max-w-2xl",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Manage Images - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(Ne=z==null?void 0:z.images)==null?void 0:Ne.map(he=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:he.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),he.is_primary&&r.jsx(Rt,{className:"absolute top-2 left-2",variant:"default",children:"Primary"}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!he.is_primary&&r.jsx(ee,{variant:"secondary",size:"icon",onClick:async()=>{var xe;await h.mutateAsync({imageId:he.id,productId:z.id}),F({...z,images:(xe=z.images)==null?void 0:xe.map(be=>({...be,is_primary:be.id===he.id}))})},disabled:h.isPending,title:"Set as primary",children:r.jsx(vs,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:async()=>{var be;await a.mutateAsync({id:he.id,productId:z.id});const xe=e==null?void 0:e.find(Oe=>Oe.id===z.id);xe&&F({...xe,images:(be=xe.images)==null?void 0:be.filter(Oe=>Oe.id!==he.id)})},disabled:a.isPending,children:r.jsx(Zn,{className:"h-4 w-4"})})]})]},he.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:de,className:"hidden",id:"image-upload",disabled:q}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(sS,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:q?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx(Ue,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(at,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:le,onChange:he=>ve(he.target.value)}),r.jsxs(ee,{onClick:Ie,disabled:!le,children:[r.jsx(Fi,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),(z==null?void 0:z.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",z.video.video_url]})]})]})]})}),r.jsx(Br,{open:A,onOpenChange:E,children:r.jsxs(Fr,{children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Manage Variants - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:ye,className:"flex gap-2",children:[r.jsx(at,{placeholder:"Variant name (e.g., 500 count)",value:te.name,onChange:he=>ae({...te,name:he.target.value}),required:!0}),r.jsx(at,{type:"number",step:"0.01",placeholder:"Price adj.",value:te.price_adjustment,onChange:he=>ae({...te,price_adjustment:parseFloat(he.target.value)||0}),className:"w-32"}),r.jsx(ee,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(we=z==null?void 0:z.variants)==null?void 0:we.map(he=>r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted rounded-lg",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:he.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(he.price_adjustment)>=0?"+":"","$",Number(he.price_adjustment).toFixed(2)]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:he.id,productId:z.id}),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]},he.id)),(!(z!=null&&z.variants)||z.variants.length===0)&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:'No variants yet. Add variants like "250 count", "500 count", etc.'})]})]})]})})]})}const QGt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function JGt(){var C,A,E;const{data:e,isLoading:t}=qGt(),n=WGt(),s=GGt(),[i,o]=I.useState(null),[l,a]=I.useState(!1),[h,p]=I.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,y]=I.useState(!1),b=T=>{o(T),p({status:T.status,notes:"",trackingNumber:T.tracking_number||"",trackingUrl:T.tracking_url||""}),a(!0)},j=async()=>{i&&(await n.mutateAsync({orderId:i.id,status:h.status,notes:h.notes,trackingNumber:h.trackingNumber,trackingUrl:h.trackingUrl,previousStatus:i.status}),a(!1))},N=async(T,L)=>{if(!i||!T.target.files||T.target.files.length===0)return;y(!0);const z=T.target.files[0],F=z.name.split(".").pop(),q=`proofs/${i.id}/${L}/${Date.now()}.${F}`;try{const{error:H}=await J.storage.from("marketplace").upload(q,z);if(H)throw H;const{data:{publicUrl:K}}=J.storage.from("marketplace").getPublicUrl(q);await s.mutateAsync({itemId:L,proofUrl:K,orderId:i.id}),ze.success("Proof uploaded successfully")}catch(H){ze.error("Failed to upload proof: "+H.message)}finally{y(!1)}};return t?r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Pr,{className:"h-8 w-48"})}),r.jsx(Xe,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Pr,{className:"h-16 w-full"},T))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Orders"})}),r.jsx(Xe,{children:e&&e.length>0?r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Order #"}),r.jsx(It,{children:"Customer"}),r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Total"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:e.map(T=>{var L,z;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"font-mono",children:T.order_number}),r.jsx(_t,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((L=T.user)==null?void 0:L.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(z=T.user)==null?void 0:z.email})]})}),r.jsx(_t,{children:xn(new Date(T.created_at),"MMM d, yyyy")}),r.jsxs(_t,{className:"font-bold",children:["$",Number(T.total).toFixed(2)]}),r.jsx(_t,{children:r.jsx(Rt,{className:D0e[T.status],children:RS[T.status]})}),r.jsx(_t,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>b(T),children:[r.jsx(Qo,{className:"h-4 w-4 mr-1"}),"View"]})})]},T.id)})})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),r.jsx(Br,{open:l,onOpenChange:a,children:r.jsxs(Fr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(Hr,{children:r.jsxs(qr,{children:["Order ",i==null?void 0:i.order_number]})}),i&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Customer"}),r.jsx("p",{children:(C=i.user)==null?void 0:C.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(A=i.user)==null?void 0:A.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:i.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.shipping_address,r.jsx("br",{}),i.shipping_city,", ",i.shipping_state," ",i.shipping_zip]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Order Items"}),r.jsx("div",{className:"space-y-3",children:(E=i.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(T.unit_price).toFixed(2)," x ",T.quantity]})]}),T.artwork_url&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),r.jsx("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),r.jsx("div",{className:"mt-3 pt-3 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),r.jsx(Rt,{variant:T.proof_status==="approved"?"default":"secondary",children:T.proof_status||"No proof yet"})]}),T.proof_url?r.jsx("a",{href:T.proof_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Proof"}):r.jsxs("div",{children:[r.jsx("input",{type:"file",accept:"image/*,.pdf",onChange:L=>N(L,T.id),className:"hidden",id:`proof-${T.id}`,disabled:x}),r.jsx("label",{htmlFor:`proof-${T.id}`,children:r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(no,{className:"h-4 w-4 mr-1"}),x?"Uploading...":"Upload Proof"]})})})]})]})})]},T.id))})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(i.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(i.shipping_total).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between font-bold text-lg mt-2",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(i.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Update Order Status"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Status"}),r.jsxs(vn,{value:h.status,onValueChange:T=>p({...h,status:T}),children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsx(gn,{children:QGt.map(T=>r.jsx(Ht,{value:T,children:RS[T]},T))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Tracking Number"}),r.jsx(at,{value:h.trackingNumber,onChange:T=>p({...h,trackingNumber:T.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Tracking URL"}),r.jsx(at,{value:h.trackingUrl,onChange:T=>p({...h,trackingUrl:T.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Notes (optional)"}),r.jsx(ps,{value:h.notes,onChange:T=>p({...h,notes:T.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(ee,{onClick:j,disabled:n.isPending,className:"w-full",children:[r.jsx(Dl,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),i.status_history&&i.status_history.length>0&&r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Status History"}),r.jsx("div",{className:"space-y-2",children:i.status_history.map(T=>r.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[r.jsxs("div",{children:[r.jsx(Rt,{variant:"outline",children:RS[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:xn(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function eKt(){const[e,t]=I.useState("products"),n=ns();return r.jsx(Or,{title:"Marketplace Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Marketplace Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage products, categories, and orders"})]}),r.jsxs(ee,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(ba,{value:e,onValueChange:t,children:[r.jsxs(fa,{className:"grid w-full grid-cols-3",children:[r.jsxs(ln,{value:"products",className:"flex items-center gap-2",children:[r.jsx(Dl,{className:"h-4 w-4"}),"Products"]}),r.jsxs(ln,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(qx,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(ln,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(hh,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(An,{value:"products",children:r.jsx(XGt,{})}),r.jsx(An,{value:"categories",children:r.jsx(YGt,{})}),r.jsx(An,{value:"orders",children:r.jsx(JGt,{})})]})]})})}function iUe(){return Zt({queryKey:["reward-categories"],queryFn:async()=>{const{data:e,error:t}=await J.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(t)throw t;return e}})}function tKt(e){return Zt({queryKey:["reward-items",e],queryFn:async()=>{let t=J.from("reward_store_items").select(` *, category:reward_store_categories(*) `).order("created_at",{ascending:!1});const{data:n,error:s}=await t;if(s)throw s;return n}})}function rKt(e){return Zt({queryKey:["active-reward-items",e],queryFn:async()=>{let t=J.from("reward_store_items").select(` *, category:reward_store_categories(*) `).eq("is_active",!0).order("created_at",{ascending:!1});e&&(t=t.eq("category_id",e));const{data:n,error:s}=await t;if(s)throw s;return n}})}function nKt(e){return Zt({queryKey:["user-purchases",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await J.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",e).order("purchased_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function sKt(){return Zt({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:e,error:t}=await J.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).order("purchased_at",{ascending:!1});if(t)throw t;if(!e||e.length===0)return[];const n=[...new Set(e.map(l=>l.user_id))],{data:s,error:i}=await J.from("profiles").select("id, name, email").in("id",n);if(i)throw i;const o=new Map((s==null?void 0:s.map(l=>[l.id,l]))||[]);return e.map(l=>({...l,user:o.get(l.user_id)||null}))}})}function iKt(e){return Zt({queryKey:["spendable-points",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:n}=await J.from("agent_attendance_stats").select("spendable_points").eq("user_id",e).single();if(n&&n.code!=="PGRST116")throw n;return(t==null?void 0:t.spendable_points)||0},enabled:!!e})}function aKt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.rpc("purchase_reward_item",{p_item_id:t});if(s)throw s;const i=n;if(!i.success)throw new Error(i.error||"Purchase failed");return i},onSuccess:()=>{e.invalidateQueries({queryKey:["user-purchases"]}),e.invalidateQueries({queryKey:["spendable-points"]}),e.invalidateQueries({queryKey:["active-reward-items"]}),e.invalidateQueries({queryKey:["reward-items"]})}})}function oKt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("reward_store_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function lKt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("reward_store_categories").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function cKt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("reward_store_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function dKt(){const e=Wr();return cr({mutationFn:async t=>{const{data:n,error:s}=await J.from("reward_store_items").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function uKt(){const e=Wr();return cr({mutationFn:async({id:t,...n})=>{const{data:s,error:i}=await J.from("reward_store_items").update(n).eq("id",t).select().single();if(i)throw i;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function hKt(){const e=Wr();return cr({mutationFn:async t=>{const{error:n}=await J.from("reward_store_items").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function fKt(e){const t=e.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return t?{bucket:t[1],path:t[2]}:null}async function mde(e,t){const n=fKt(e);if(n)try{const{data:s,error:i}=await J.storage.from(n.bucket).download(n.path);if(i){console.error("Error downloading file:",i),ze.error("Failed to download file");return}const o=URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=t||n.path.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("Download error:",s),ze.error("Failed to download file")}else try{const i=await(await fetch(e)).blob(),o=URL.createObjectURL(i),l=document.createElement("a");l.href=o,l.download=t||e.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("External download error:",s),ze.error("Failed to download file")}}function aUe(){return Zt({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:e,error:t}=await J.from("point_reward_settings").select("*").order("action_name");if(t)throw t;return e}})}function pKt(){const e=Wr();return cr({mutationFn:async({id:t,points:n,is_active:s})=>{const i={points:n};s!==void 0&&(i.is_active=s);const{data:o,error:l}=await J.from("point_reward_settings").update(i).eq("id",t).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["point-reward-settings"]})}})}function mKt(){const{user:e}=zr(),[t,n]=I.useState("items"),[s,i]=I.useState(!1),[o,l]=I.useState(null),[a,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,N]=I.useState(null),[C,A]=I.useState(!1),[E,T]=I.useState(null),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,K]=I.useState(null),[Z,te]=I.useState(""),[ae,le]=I.useState("file"),[ve,ne]=I.useState(""),[ge,ie]=I.useState(""),[fe,de]=I.useState(""),[ye,Ie]=I.useState(!0),[Ne,we]=I.useState(null),[he,xe]=I.useState(!1),[be,Oe]=I.useState(!1),Te=I.useRef(null),Ve=I.useRef(null),{data:Fe,isLoading:Me}=iUe(),{data:Qe,isLoading:Ee}=tKt(),{data:Ye,isLoading:me}=sKt(),{data:mt,isLoading:et}=aUe(),nt=oKt(),Ae=lKt(),ht=cKt(),$e=dKt(),Je=uKt(),tt=hKt(),ft=pKt(),[jt,Nt]=I.useState({}),Et=fr=>{fr?(l(fr),h(fr.name),x(fr.description||""),b(fr.icon||"")):(l(null),h(""),x(""),b("")),i(!0)},vt=async()=>{if(!a.trim()){ze.error("Please enter a category name");return}try{o?(await Ae.mutateAsync({id:o.id,name:a,description:p||null,icon:y||null}),ze.success("Category updated successfully")):(await nt.mutateAsync({name:a,description:p||null,icon:y||null,sort_order:((Fe==null?void 0:Fe.length)||0)+1}),ze.success("Category created successfully")),i(!1)}catch(fr){console.error("Error saving category:",fr),ze.error("Failed to save category")}},rr=async()=>{if(j)try{await ht.mutateAsync(j),ze.success("Category deleted successfully"),N(null)}catch(fr){console.error("Error deleting category:",fr),ze.error("Failed to delete category")}},Ar=fr=>{var xs;fr?(T(fr),z(fr.name),q(fr.description||""),K(fr.category_id),te(fr.points_cost.toString()),le(fr.item_type),ne(fr.file_url||""),ie(fr.preview_image_url||""),de(((xs=fr.max_quantity)==null?void 0:xs.toString())||""),Ie(fr.is_active)):(T(null),z(""),q(""),K(null),te(""),le("file"),ne(""),ie(""),de(""),Ie(!0)),A(!0)},yn=async(fr,xs)=>{xs==="file"?xe(!0):Oe(!0);try{const ji=fr.name.split(".").pop(),mi=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ji}`,La=`${xs==="file"?"items":"previews"}/${mi}`,{error:da}=await J.storage.from("reward-store").upload(La,fr);if(da)throw da;const{data:{publicUrl:tl}}=J.storage.from("reward-store").getPublicUrl(La);xs==="file"?ne(tl):ie(tl),ze.success("File uploaded successfully")}catch(ji){console.error("Error uploading file:",ji),ze.error("Failed to upload file")}finally{xs==="file"?xe(!1):Oe(!1)}},kn=async()=>{if(!L.trim()){ze.error("Please enter an item name");return}if(!Z||parseInt(Z)<0){ze.error("Please enter a valid points cost");return}try{const fr={name:L,description:F||null,category_id:H,points_cost:parseInt(Z),item_type:ae,file_url:ve||null,preview_image_url:ge||null,max_quantity:fe?parseInt(fe):null,current_quantity:fe?parseInt(fe):null,is_active:ye,created_by:e==null?void 0:e.id};E?(await Je.mutateAsync({id:E.id,...fr,current_quantity:E.max_quantity!==(fe?parseInt(fe):null)?fe?parseInt(fe):null:E.current_quantity}),ze.success("Item updated successfully")):(await $e.mutateAsync(fr),ze.success("Item created successfully")),A(!1)}catch(fr){console.error("Error saving item:",fr),ze.error("Failed to save item")}},Jr=async()=>{if(Ne)try{await tt.mutateAsync(Ne),ze.success("Item deleted successfully"),we(null)}catch(fr){console.error("Error deleting item:",fr),ze.error("Failed to delete item")}},zn=async(fr,xs)=>{const ji=jt[fr];if(ji===void 0||ji===xs.toString())return;const mi=parseInt(ji);if(isNaN(mi)||mi<0){ze.error("Please enter a valid positive number");return}try{await ft.mutateAsync({id:fr,points:mi}),ze.success("Points updated successfully"),Nt(La=>{const da={...La};return delete da[fr],da})}catch(La){console.error("Error updating points:",La),ze.error("Failed to update points")}};return Me||Ee||me||et?r.jsx(Or,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64"}),r.jsx(Pr,{className:"h-96"})]})}):r.jsxs(Or,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Reward Store Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage store items that agents can purchase with their points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Dl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Items"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Qe==null?void 0:Qe.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(Qe==null?void 0:Qe.filter(fr=>fr.is_active).length)||0," active"]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(qx,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Fe==null?void 0:Fe.length)||0})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(vs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg. Cost"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[Qe&&Qe.length>0?Math.round(Qe.reduce((fr,xs)=>fr+xs.points_cost,0)/Qe.length):0," pts"]})]})})]}),r.jsxs(ba,{value:t,onValueChange:n,children:[r.jsxs(fa,{children:[r.jsx(ln,{value:"items",children:"Items"}),r.jsx(ln,{value:"categories",children:"Categories"}),r.jsx(ln,{value:"purchases",children:"Purchases"}),r.jsx(ln,{value:"point-settings",children:"Point Settings"})]}),r.jsx(An,{value:"items",className:"mt-4",children:r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Store Items"}),r.jsx(En,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(ee,{onClick:()=>Ar(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(Xe,{children:!Qe||Qe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ha,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No items yet. Add your first reward item!"})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Item"}),r.jsx(It,{children:"Category"}),r.jsx(It,{className:"text-center",children:"Cost"}),r.jsx(It,{className:"text-center",children:"Type"}),r.jsx(It,{className:"text-center",children:"Quantity"}),r.jsx(It,{className:"text-center",children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:Qe.map(fr=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[fr.preview_image_url?r.jsx("img",{src:fr.preview_image_url,alt:fr.name,className:"h-10 w-10 rounded object-cover"}):r.jsx("div",{className:"h-10 w-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Ha,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fr.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:fr.description||"No description"})]})]})}),r.jsx(_t,{children:fr.category?r.jsx(Rt,{variant:"outline",children:fr.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),fr.points_cost]})}),r.jsx(_t,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[fr.item_type==="file"?r.jsx(wi,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(So,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:fr.item_type})]})}),r.jsx(_t,{className:"text-center",children:fr.max_quantity!==null?r.jsxs("span",{className:fr.current_quantity===0?"text-red-500":"",children:[fr.current_quantity,"/",fr.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(_t,{className:"text-center",children:r.jsx(Rt,{variant:fr.is_active?"default":"secondary",children:fr.is_active?"Active":"Inactive"})}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Ar(fr),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>we(fr.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},fr.id))})]})})]})}),r.jsx(An,{value:"categories",className:"mt-4",children:r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Qt,{children:"Categories"}),r.jsx(En,{children:"Organize your store items into categories"})]}),r.jsxs(ee,{onClick:()=>Et(),children:[r.jsx(jn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Xe,{children:!Fe||Fe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(qx,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center",children:"Items"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ws,{children:Fe.map(fr=>r.jsxs(Ir,{children:[r.jsxs(_t,{className:"font-medium",children:[fr.icon&&r.jsx("span",{className:"mr-2",children:fr.icon}),fr.name]}),r.jsx(_t,{className:"text-muted-foreground",children:fr.description||"—"}),r.jsx(_t,{className:"text-center",children:(Qe==null?void 0:Qe.filter(xs=>xs.category_id===fr.id).length)||0}),r.jsx(_t,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Et(fr),children:r.jsx(ha,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(fr.id),children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})})]})})]},fr.id))})]})})]})}),r.jsx(An,{value:"purchases",className:"mt-4",children:r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(hh,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(En,{children:"View all reward redemptions by agents"})]}),r.jsx(Xe,{children:!Ye||Ye.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(hh,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Item"}),r.jsx(It,{className:"text-center",children:"Points Spent"})]})}),r.jsx(Ws,{children:Ye.map(fr=>{var xs,ji,mi,La;return r.jsxs(Ir,{children:[r.jsx(_t,{className:"text-muted-foreground",children:xn(new Date(fr.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center",children:r.jsx(Cc,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((xs=fr.user)==null?void 0:xs.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((ji=fr.user)==null?void 0:ji.email)||"—"})]})]})}),r.jsx(_t,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(mi=fr.item)!=null&&mi.preview_image_url?r.jsx("img",{src:fr.item.preview_image_url,alt:fr.item.name,className:"h-8 w-8 rounded object-cover"}):r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center",children:r.jsx(Ha,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((La=fr.item)==null?void 0:La.name)||"Deleted item"})]})}),r.jsx(_t,{className:"text-center",children:r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),fr.points_spent]})})]},fr.id)})})]})})]})})]})]}),r.jsx(Br,{open:s,onOpenChange:i,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:o?"Edit Category":"Add Category"}),r.jsx(es,{children:o?"Update the category details":"Create a new category for your store items"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"categoryName",children:"Name"}),r.jsx(at,{id:"categoryName",value:a,onChange:fr=>h(fr.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(ps,{id:"categoryDescription",value:p,onChange:fr=>x(fr.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(at,{id:"categoryIcon",value:y,onChange:fr=>b(fr.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{onClick:vt,disabled:nt.isPending||Ae.isPending,children:nt.isPending||Ae.isPending?"Saving...":"Save"})]})]})}),r.jsx(Br,{open:C,onOpenChange:A,children:r.jsxs(Fr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:E?"Edit Item":"Add Item"}),r.jsx(es,{children:E?"Update the item details":"Create a new reward item for agents to purchase"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"itemName",children:"Name *"}),r.jsx(at,{id:"itemName",value:L,onChange:fr=>z(fr.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"itemDescription",children:"Description"}),r.jsx(ps,{id:"itemDescription",value:F,onChange:fr=>q(fr.target.value),placeholder:"Describe the item..."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(vn,{value:H||"none",onValueChange:fr=>K(fr==="none"?null:fr),children:[r.jsx(mn,{children:r.jsx(_n,{placeholder:"Select category"})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"none",children:"No category"}),Fe==null?void 0:Fe.map(fr=>r.jsxs(Ht,{value:fr.id,children:[fr.icon&&`${fr.icon} `,fr.name]},fr.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(at,{id:"itemPointsCost",type:"number",min:"0",value:Z,onChange:fr=>te(fr.target.value),placeholder:"e.g., 100"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"itemType",children:"Type"}),r.jsxs(vn,{value:ae,onValueChange:le,children:[r.jsx(mn,{children:r.jsx(_n,{})}),r.jsxs(gn,{children:[r.jsx(Ht,{value:"file",children:"File Download"}),r.jsx(Ht,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(at,{id:"itemMaxQuantity",type:"number",min:"1",value:fe,onChange:fr=>de(fr.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:ve,onChange:fr=>ne(fr.target.value),placeholder:ae==="file"?"Upload a file or paste URL":"Paste external link"}),ae==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var fr;return(fr=Te.current)==null?void 0:fr.click()},disabled:he,children:r.jsx(no,{className:"h-4 w-4"})}),r.jsx("input",{ref:Te,type:"file",className:"hidden",onChange:fr=>{var ji;const xs=(ji=fr.target.files)==null?void 0:ji[0];xs&&yn(xs,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(at,{value:ge,onChange:fr=>ie(fr.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var fr;return(fr=Ve.current)==null?void 0:fr.click()},disabled:be,children:r.jsx(Do,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ve,type:"file",accept:"image/*",className:"hidden",onChange:fr=>{var ji;const xs=(ji=fr.target.files)==null?void 0:ji[0];xs&&yn(xs,"preview")}})]}),ge&&r.jsx("img",{src:ge,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rs,{id:"itemIsActive",checked:ye,onCheckedChange:Ie}),r.jsx(Ue,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),r.jsx(ee,{onClick:kn,disabled:$e.isPending||Je.isPending,children:$e.isPending||Je.isPending?"Saving...":"Save"})]})]})}),r.jsx(fh,{open:!!j,onOpenChange:()=>N(null),children:r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Delete Category"}),r.jsx(Cu,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:rr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(fh,{open:!!Ne,onOpenChange:()=>we(null),children:r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Delete Item"}),r.jsx(Cu,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:Jr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t==="point-settings"&&r.jsxs(Ge,{className:"mt-4",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Qt,{children:"Point Reward Settings"}),r.jsx(En,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(Xe,{children:!mt||mt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(fd,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(Vs,{children:[r.jsx(Hs,{children:r.jsxs(Ir,{children:[r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center w-32",children:"Points"}),r.jsx(It,{className:"text-right w-24",children:"Save"})]})}),r.jsx(Ws,{children:mt.map(fr=>r.jsxs(Ir,{children:[r.jsx(_t,{children:r.jsx("p",{className:"font-medium",children:fr.action_name})}),r.jsx(_t,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:fr.description})}),r.jsx(_t,{className:"text-center",children:r.jsx(at,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:jt[fr.id]??fr.points.toString(),onChange:xs=>Nt(ji=>({...ji,[fr.id]:xs.target.value}))})}),r.jsx(_t,{className:"text-right",children:r.jsx(ee,{size:"sm",variant:"outline",disabled:jt[fr.id]===void 0||jt[fr.id]===fr.points.toString()||ft.isPending,onClick:()=>zn(fr.id,fr.points),children:r.jsx(jg,{className:"h-4 w-4"})})})]},fr.id))})]})})]})]})}function gKt(){const e=Wr(),[t,n]=I.useState(!1),{data:s,isLoading:i}=Zt({queryKey:["social-accounts"],queryFn:async()=>{const{data:p,error:x}=await J.from("social_accounts").select("*").order("created_at",{ascending:!1});if(x)throw x;return p}}),o=cr({mutationFn:async p=>{const{error:x}=await J.from("social_accounts").delete().eq("id",p);if(x)throw x},onSuccess:()=>{e.invalidateQueries({queryKey:["social-accounts"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),l=async()=>{n(!0);try{const{data:p,error:x}=await J.functions.invoke("meta-oauth",{body:{action:"get_auth_url"}});if(x)throw x;if(p!=null&&p.authUrl)window.location.href=p.authUrl;else throw new Error("Failed to get authorization URL")}catch(p){console.error("Meta OAuth error:",p),ze.error("Failed to start connection. Make sure Meta App credentials are configured."),n(!1)}},a=(s==null?void 0:s.filter(p=>p.platform==="facebook"))||[],h=(s==null?void 0:s.filter(p=>p.platform==="instagram"))||[];return r.jsx(Or,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(qu,{title:"Integrations",description:"Connect your social media accounts to post directly from the dashboard"}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-2",children:r.jsx(Od,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"Facebook"}),r.jsx(En,{children:"Connect Facebook Pages to post content"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[a.length>0?r.jsx("div",{className:"space-y-3",children:a.map(p=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:p.profile_picture_url||""}),r.jsx(di,{children:r.jsx(Od,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:p.page_name||p.platform_username||"Facebook Page"}),r.jsx(Rt,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Disconnect Facebook?"}),r.jsx(Cu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Facebook accounts connected"}),r.jsxs(ee,{onClick:l,disabled:t,className:"w-full gap-2",variant:"outline",children:[t?r.jsx(Vl,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-2",children:r.jsx(eu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"Instagram"}),r.jsx(En,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[h.length>0?r.jsx("div",{className:"space-y-3",children:h.map(p=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:p.profile_picture_url||""}),r.jsx(di,{children:r.jsx(eu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",p.platform_username||"Instagram Account"]}),r.jsx(Rt,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Disconnect Instagram?"}),r.jsx(Cu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Instagram accounts connected"}),r.jsxs(ee,{onClick:l,disabled:t,className:"w-full gap-2",variant:"outline",children:[t?r.jsx(Vl,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),"Connect Instagram Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Instagram Business accounts must be connected to a Facebook Page"})]})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsx(Qt,{className:"text-lg",children:"Setup Instructions"}),r.jsx(En,{children:"Follow these steps to set up Meta integration"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Create a Meta App"}),r.jsx("p",{className:"text-muted-foreground",children:"Go to developers.facebook.com and create a new app"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Add Facebook Login Product"}),r.jsx("p",{className:"text-muted-foreground",children:"Enable Facebook Login and configure OAuth redirect URLs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Configure API Keys"}),r.jsx("p",{className:"text-muted-foreground",children:"Add META_APP_ID and META_APP_SECRET to your environment"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"4"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Request Permissions"}),r.jsx("p",{className:"text-muted-foreground",children:"Request pages_manage_posts, pages_read_engagement, instagram_basic, and instagram_content_publish"})]})]})]}),r.jsx(ee,{variant:"outline",className:"gap-2",asChild:!0,children:r.jsxs("a",{href:"https://developers.facebook.com/apps",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open Meta Developer Console"]})})]})]})]})})}const xKt={new_events:{label:"New Events",icon:"📅"},new_templates:{label:"New Templates",icon:"📄"},new_toolbox:{label:"New Toolbox Resources",icon:"🧰"},new_social_swag:{label:"New Social Swag",icon:"🎨"},new_newsletters:{label:"New Newsletters",icon:"📰"},new_community_posts:{label:"New Community Posts",icon:"💬"}};function rT(e,t=18,n=10){return e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`}function yKt(){var ae,le,ve,ne,ge;const e=Wr(),[t,n]=I.useState("Test Push"),[s,i]=I.useState("Testing web push notification"),[o,l]=I.useState("/community"),[a,h]=I.useState(!1),[p,x]=I.useState(!1),[y,b]=I.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[j,N]=I.useState(null),[C,A]=I.useState(null),{data:E,isLoading:T}=Zt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:ie,error:fe}=await J.from("push_notification_settings").select("*").order("setting_key");if(fe)throw fe;return ie}}),{data:L,isLoading:z}=Zt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:ie,error:fe}=await J.from("push_subscriptions").select("*",{count:"exact",head:!0});if(fe)throw fe;return{totalSubscriptions:ie||0}}}),F=cr({mutationFn:async({settingKey:ie,isEnabled:fe})=>{const{error:de}=await J.from("push_notification_settings").update({is_enabled:fe}).eq("setting_key",ie);if(de)throw de},onSuccess:()=>{e.invalidateQueries({queryKey:["push-notification-settings"]}),ze.success("Notification setting updated")},onError:ie=>{ze.error("Failed to update setting: "+ie.message)}}),q=I.useMemo(()=>{var ie,fe;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((ie=y.serviceWorker)==null?void 0:ie.activeState)??"unknown"} · sub=${(fe=y.subscription)!=null&&fe.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);I.useEffect(()=>{let ie=!0;const fe=async()=>{var Ne,we,he,xe,be,Oe,Te;const ye="serviceWorker"in navigator&&"PushManager"in window,Ie={isSupported:ye,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((Ne=navigator.serviceWorker)!=null&&Ne.controller)};if(!ye){ie&&b(Ie);return}try{const{data:Ve,error:Fe}=await J.functions.invoke("get-vapid-public-key",{body:{}});if(Fe)throw Fe;Ie.vapidPublicKey=Ve==null?void 0:Ve.vapidPublicKey;const Qe=(await navigator.serviceWorker.getRegistrations()).find(Ee=>{var me,mt,et;return(((me=Ee.active)==null?void 0:me.scriptURL)||((mt=Ee.waiting)==null?void 0:mt.scriptURL)||((et=Ee.installing)==null?void 0:et.scriptURL)||"").includes("/sw.js")});if(Qe){Ie.pushWorkerScriptUrl=((we=Qe.active)==null?void 0:we.scriptURL)||((he=Qe.waiting)==null?void 0:he.scriptURL)||((xe=Qe.installing)==null?void 0:xe.scriptURL),Ie.serviceWorker={scope:Qe.scope,activeState:(be=Qe.active)==null?void 0:be.state};const Ee=await Qe.pushManager.getSubscription();if(Ee){const Ye=Ee.toJSON();Ie.subscription={endpoint:Ye.endpoint,p256dh:(Oe=Ye.keys)==null?void 0:Oe.p256dh,auth:(Te=Ye.keys)==null?void 0:Te.auth}}}}catch(Ve){Ie.error=(Ve==null?void 0:Ve.message)||String(Ve)}ie&&b(Ie)};fe();const de=window.setInterval(fe,4e3);return()=>{ie=!1,window.clearInterval(de)}},[]);const H=async()=>{if(typeof Notification>"u"){ze.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){ze.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),ze.success("Triggered a local notification (not push).")}catch(ie){ze.error(`Local notification failed: ${(ie==null?void 0:ie.message)||String(ie)}`)}},K=async()=>{h(!0),N(null);try{const{data:ie,error:fe}=await J.functions.invoke("send-push-notification",{body:{title:t,body:s,url:o}});if(fe)throw fe;N({sent:ie==null?void 0:ie.sent,failed:ie==null?void 0:ie.failed,expiredCleaned:ie==null?void 0:ie.expiredCleaned,vapidPublicKey:ie==null?void 0:ie.vapidPublicKey}),(ie==null?void 0:ie.sent)>0?ze.success(`Test notification sent to ${ie.sent} subscriber(s)`):(ie==null?void 0:ie.failed)>0?ze.warning(`Notification failed for ${ie.failed} subscriber(s). ${ie.expired||0} expired subscriptions cleaned up.`):ze.info("No active subscriptions to send to")}catch(ie){console.error("Error sending test notification:",ie),N({error:(ie==null?void 0:ie.message)||String(ie)}),ze.error("Failed to send test notification: "+(ie.message||"Unknown error"))}finally{h(!1)}},Z=async()=>{x(!0),A(null);try{const{data:ie,error:fe}=await J.functions.invoke("generate-vapid-keys",{body:{}});if(fe)throw fe;const de=ie==null?void 0:ie.publicKey,ye=ie==null?void 0:ie.privateKey;if(!de||!ye)throw new Error("generate-vapid-keys did not return keys");A({publicKey:de,privateKey:ye}),ze.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(ie){console.error("Error generating VAPID keys:",ie),ze.error("Failed to generate VAPID keys: "+((ie==null?void 0:ie.message)||"Unknown error"))}finally{x(!1)}},te=cr({mutationFn:async()=>{const{error:ie}=await J.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(ie)throw ie},onSuccess:()=>{ze.success("All subscriptions cleared. Users will need to re-enable notifications."),e.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:ie=>{ze.error("Failed to clear subscriptions: "+ie.message)}});return r.jsx(Or,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(qu,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(Vn,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(En,{children:"Current active push notification subscriptions"})]}),r.jsx(Xe,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:z?"...":(L==null?void 0:L.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(En,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(Xe,{children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:E==null?void 0:E.map(ie=>{const fe=xKt[ie.setting_key]||{label:ie.setting_key,icon:"🔔"};return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-2xl",children:fe.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:fe.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:ie.description})]})]}),r.jsx(Rs,{checked:ie.is_enabled,onCheckedChange:de=>F.mutate({settingKey:ie.setting_key,isEnabled:de}),disabled:F.isPending})]},ie.id)})})})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(_g,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(En,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Client push debug"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:q}),y.error&&r.jsx("div",{className:"mt-2 text-destructive",children:y.error}),r.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Backend VAPID public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:y.vapidPublicKey?rT(y.vapidPublicKey):"(not loaded)"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Service worker"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["scope: ",(ae=y.serviceWorker)!=null&&ae.scope?rT(y.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((le=y.serviceWorker)==null?void 0:le.activeState)??"none"]})]})]}),r.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Current browser subscription"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["endpoint: ",(ve=y.subscription)!=null&&ve.endpoint?rT(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ne=y.subscription)!=null&&ne.p256dh?rT(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(ge=y.subscription)!=null&&ge.auth?rT(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(ee,{variant:"outline",onClick:H,children:"Local notification test"}),r.jsx(ee,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(at,{id:"test-title",value:t,onChange:ie=>n(ie.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(ps,{id:"test-body",value:s,onChange:ie=>i(ie.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(at,{id:"test-url",value:o,onChange:ie=>l(ie.target.value),placeholder:"/community or full URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Where users will be taken when they click the notification"})]}),r.jsxs(ee,{onClick:K,disabled:a||!t||!s,className:"w-full sm:w-auto",children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Test Notification"]}),j&&r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Last send debug"}),j.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",j.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",j.sent??0," sent, ",j.failed??0," failed, ",j.expiredCleaned??0," expired cleaned"]}),j.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:j.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(Ge,{children:[r.jsxs(Gt,{children:[r.jsxs(Qt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Zn,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(En,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(ee,{variant:"destructive",onClick:()=>te.mutate(),disabled:te.isPending,children:[r.jsx(Zn,{className:"h-4 w-4 mr-2"}),te.isPending?"Clearing...":"Clear All Subscriptions"]}),r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:"If you suspect the backend public/private keys don’t match, generate a fresh pair, update backend secrets, then clear subscriptions and have users re-enable push."}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.jsx(ee,{variant:"outline",onClick:Z,disabled:p,children:p?"Generating…":"Generate VAPID keys"})}),C&&r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"text-muted-foreground",children:["Copy these into backend secrets ",r.jsx("span",{className:"font-mono",children:"VAPID_PUBLIC_KEY"})," and ",r.jsx("span",{className:"font-mono",children:"VAPID_PRIVATE_KEY"}),"."]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:C.publicKey})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Private key (keep secret)"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:C.privateKey})]})]})]})]})]})]})})}function vKt(){const[e]=Fd(),t=ns(),[n,s]=I.useState("loading"),[i,o]=I.useState("Processing connection...");return I.useEffect(()=>{(async()=>{const a=e.get("code"),h=e.get("error"),p=e.get("error_description"),x=e.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Failed to connect: "+(p||h));return}if(!a){s("error"),o("No authorization code received"),ze.error("Failed to connect: No authorization code");return}try{const{data:y,error:b}=await J.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:x}});if(b)throw b;if(y!=null&&y.success)s("success"),o(y.message||"Accounts connected successfully!"),ze.success(y.message||"Social accounts connected!");else throw new Error((y==null?void 0:y.error)||"Failed to connect accounts")}catch(y){console.error("Callback error:",y),s("error"),o(y.message||"Failed to complete connection"),ze.error(y.message||"Failed to connect accounts")}})()},[e]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ge,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(nn,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(qa,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(zc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Qt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>t("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function _Kt(){const e=ns(),t=Wr(),{isAdmin:n}=zr(),[s,i]=I.useState(!1),[o,l]=I.useState(null),[a,h]=I.useState(null),{data:p,isLoading:x}=Zt({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:F},error:q}=await J.auth.getUser();if(q)throw q;if(!F)return[];const{data:H,error:K}=await J.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(K)throw K;return H}}),y=cr({mutationFn:async F=>{const{data:{user:q},error:H}=await J.auth.getUser();if(H)throw H;if(!q)throw new Error("Not authenticated");const{error:K}=await J.from("social_accounts").delete().eq("id",F).eq("user_id",q.id);if(K)throw K},onSuccess:()=>{t.invalidateQueries({queryKey:["my-social-accounts"]}),t.invalidateQueries({queryKey:["social-accounts-for-post"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),b=async()=>{i(!0);try{const{data:F,error:q}=await J.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Meta OAuth error:",F),ze.error("Failed to start connection. Please try again."),i(!1)}},j=async()=>{i(!0);try{const{data:F,error:q}=await J.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(F){console.error("LinkedIn OAuth error:",F),ze.error("Failed to start LinkedIn connection. Please try again."),i(!1)}},N=async()=>{i(!0);try{const{data:F,error:q}=await J.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(F){console.error("Google OAuth error:",F),ze.error("Failed to start Google connection. Please try again."),i(!1)}},C=(p==null?void 0:p.filter(F=>F.platform==="facebook"))||[],A=(p==null?void 0:p.filter(F=>F.platform==="instagram"))||[],E=(p==null?void 0:p.filter(F=>F.platform==="linkedin"))||[],T=(p==null?void 0:p.filter(F=>F.platform==="google_business"))||[],L=((p==null?void 0:p.length)||0)>0,z=async(F,q)=>{l(F),h(null);try{const{data:H,error:K}=await J.functions.invoke("meta-api-test",{body:{testType:"all",accountId:F}});if(K)throw K;h(H.results||[]),ze.success(H.summary||"API tests completed")}catch(H){console.error("Meta API test error:",H),ze.error("Failed to run API tests")}finally{l(null)}};return r.jsx(Or,{title:"Social Connections",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-pink-500 via-purple-500 to-blue-500 p-6 md:p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs(Rt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Cs,{className:"h-3 w-3 mr-1"}),"Post directly from Social Swag"]})}),r.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-2",children:"Connect Your Social Accounts"}),r.jsx("p",{className:"text-white/90 max-w-xl",children:"Link your Facebook Pages and Instagram Business accounts to post content directly from Social Swag with one click."})]})]}),r.jsxs(ee,{variant:"ghost",onClick:()=>e("/social-swag-2"),className:"gap-2",children:[r.jsx(Qa,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(Ge,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(Xe,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:r.jsx(Ki,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Rt,{variant:"secondary",className:"mb-3 bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Social Connections Coming Soon!"}),r.jsx("p",{className:"text-muted-foreground max-w-md",children:"We're putting the finishing touches on this feature. Soon you'll be able to connect your social accounts and post directly from Social Swag with one click."})]})}),n&&r.jsxs(r.Fragment,{children:[L&&r.jsx(Ge,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(Xe,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(qa,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-200",children:"You're all set!"}),r.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"You can now post directly to your connected accounts from Social Swag."})]})]})}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-3",children:r.jsx(Od,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"Facebook"}),r.jsx(En,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):C.length>0?r.jsx("div",{className:"space-y-3",children:C.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(Od,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Facebook Page"}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Disconnect Facebook?"}),r.jsx(Cu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(ee,{onClick:b,disabled:s,className:"w-full gap-2",variant:C.length>0?"outline":"default",children:[s?r.jsx(Vl,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),C.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-3",children:r.jsx(eu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"Instagram"}),r.jsx(En,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length>0?r.jsx("div",{className:"space-y-3",children:A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(eu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",F.platform_username||"Instagram Account"]}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Disconnect Instagram?"}),r.jsx(Cu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(ee,{onClick:b,disabled:s,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[s?r.jsx(Vl,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),A.length>0?"Connect Another Account":"Connect Instagram"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Instagram Business accounts must be connected to a Facebook Page"})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-600/10 p-3",children:r.jsx(mm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"LinkedIn"}),r.jsx(En,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):E.length>0?r.jsx("div",{className:"space-y-3",children:E.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(mm,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.platform_username||"LinkedIn Account"}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Disconnect LinkedIn?"}),r.jsx(Cu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(ee,{onClick:j,disabled:s,className:"w-full gap-2",variant:E.length>0?"outline":"default",children:[s?r.jsx(Vl,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),E.length>0?"Reconnect LinkedIn":"Connect LinkedIn"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Share content directly to your LinkedIn profile"})]})]}),r.jsxs(Ge,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Rt,{variant:"secondary",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"})}),n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Rt,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-red-500/10 p-3",children:r.jsx(ml,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"Google Business"}),r.jsx(En,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ci,{className:"h-10 w-10",children:[r.jsx(Ga,{src:F.profile_picture_url||""}),r.jsx(di,{children:r.jsx(ml,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Google Business"}),r.jsx(Rt,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(fh,{children:[r.jsx(W0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Zn,{className:"h-4 w-4"})})}),r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Disconnect Google Business?"}),r.jsx(Cu,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:n?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),r.jsxs(ee,{onClick:n?N:void 0,disabled:!n||s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(Vl,{className:"h-4 w-4 animate-spin"}):r.jsx(jn,{className:"h-4 w-4"}),T.length>0?"Reconnect Google Business":"Connect Google Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Post updates directly to your Google Business Profile"})]})]})]}),n&&(C.length>0||A.length>0)&&r.jsxs(Ge,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-amber-500/10 p-3",children:r.jsx(mj,{className:"h-6 w-6 text-amber-600"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),r.jsx(En,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',r.jsx("strong",{children:"public_profile"}),", ",r.jsx("strong",{children:"pages_show_list"}),", ",r.jsx("strong",{children:"pages_read_engagement"}),", ",r.jsx("strong",{children:"instagram_basic"}),", ",r.jsx("strong",{children:"pages_manage_posts"}),", and ",r.jsx("strong",{children:"instagram_content_publish"}),"."]}),r.jsxs("div",{className:"space-y-3",children:[C.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Od,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:F.page_name||"Facebook Page"})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(mj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${F.id}`)),A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(eu,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",F.platform_username||"Instagram"]})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(mj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${F.id}`))]}),a&&a.length>0&&r.jsxs("div",{className:"mt-4 rounded-lg border bg-background p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Test Results"}),r.jsx("div",{className:"space-y-2",children:a.map((F,q)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[F.status==="success"?r.jsx(Ya,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):F.status==="pending"?r.jsx(nn,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(zc,{className:"h-4 w-4 text-red-600 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-mono text-xs bg-muted px-1 rounded",children:F.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:F.details})]})]},q))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Facebook posts are auto-deleted. Instagram posts will remain and should be manually deleted. Allow up to 24 hours for Meta to register the API calls."})]})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{className:"text-lg",children:"How it works"})}),r.jsx(Xe,{children:r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Connect your accounts"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link your Facebook, Instagram, or LinkedIn account"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Browse Social Swag"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Find the perfect image and caption for your post"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Post with one click"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:'Click "Create Post" to share directly to your accounts'})]})]})]})})]})]})]})})}function bKt(){const[e]=Fd(),t=ns(),[n,s]=I.useState("loading"),[i,o]=I.useState("Processing your connection...");return I.useEffect(()=>{(async()=>{var y;const a=e.get("code"),h=e.get("error"),p=e.get("error_description"),x=e.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!a){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:b,error:j}=await J.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:a,state:x,callbackPath:"/social-connections/callback"}});if(j)throw j;if(b!=null&&b.success)s("success"),o(`Successfully connected ${((y=b.accounts)==null?void 0:y.length)||0} account(s)!`),ze.success("Social accounts connected successfully!");else throw new Error((b==null?void 0:b.error)||"Unknown error")}catch(b){console.error("OAuth callback error:",b),s("error"),o(b instanceof Error?b.message:"Failed to connect accounts"),ze.error("Failed to connect: "+(b instanceof Error?b.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ge,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[n==="loading"&&r.jsx(nn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(qa,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(zc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Qt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>t("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function wKt(){const[e]=Fd(),t=ns(),[n,s]=I.useState("loading"),[i,o]=I.useState("Connecting your Google Business Profile...");return I.useEffect(()=>{(async()=>{const a=e.get("code"),h=e.get("error"),p=e.get("error_description"),x=e.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!a){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:y,error:b}=await J.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:a,state:x}});if(b)throw b;if(y!=null&&y.success)s("success"),o(y.message||"Successfully connected Google Business Profile!"),ze.success("Google Business Profile connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Google OAuth callback error:",y),s("error"),o(y instanceof Error?y.message:"Failed to connect Google Business Profile"),ze.error("Failed to connect: "+(y instanceof Error?y.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ge,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[n==="loading"&&r.jsx(nn,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(qa,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(zc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Qt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>t("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function jKt(){const[e]=Fd(),t=ns(),[n,s]=I.useState("loading"),[i,o]=I.useState("Connecting your LinkedIn account...");return I.useEffect(()=>{(async()=>{var y;const a=e.get("code"),h=e.get("state"),p=e.get("error"),x=e.get("error_description");if(p){console.error("LinkedIn OAuth error:",p,x),s("error"),o(x||"Failed to connect LinkedIn account"),ze.error(x||"Failed to connect LinkedIn");return}if(!a){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:b,error:j}=await J.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:a,state:h,callbackPath:"/social-connections/linkedin-callback"}});if(j)throw j;if(b!=null&&b.success)s("success"),o(`Successfully connected ${((y=b.accounts)==null?void 0:y.length)||1} LinkedIn account`),ze.success("LinkedIn connected successfully!");else throw new Error((b==null?void 0:b.error)||"Failed to connect LinkedIn account")}catch(b){console.error("LinkedIn callback error:",b),s("error"),o(b instanceof Error?b.message:"Failed to connect LinkedIn account"),ze.error("Failed to connect LinkedIn")}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:r.jsxs(Ge,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[n==="loading"&&r.jsx(nn,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(qa,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(zc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Qt,{className:"flex items-center justify-center gap-2",children:[r.jsx(mm,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(En,{children:i})]}),r.jsx(Xe,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>t("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function kKt(){const e=ns(),[t,n]=I.useState(null),{data:s,isLoading:i}=sUe(t||void 0,!0),{data:o,isLoading:l}=R0e(!0),{cartItems:a}=wse(),h=a.reduce((x,y)=>x+y.quantity,0),p=x=>{e(`/marketplace/${x.id}`)};return i||l?r.jsx(Or,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[1,2,3].map(x=>r.jsx(Pr,{className:"h-10 w-24 flex-shrink-0"},x))}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[1,2,3,4].map(x=>r.jsx(Pr,{className:"h-72 w-full"},x))})]})}):r.jsx(Or,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Marketplace"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Shop exclusive products for LevelUp members"})]}),r.jsxs(ee,{variant:"outline",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(hh,{className:"h-4 w-4 mr-2"}),"Cart",h>0&&r.jsx(Rt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:h})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(ee,{variant:t===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(ee,{variant:t===x.id?"default":"outline",size:"sm",onClick:()=>n(x.id),children:x.name},x.id))]}),s&&s.length>0?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(x=>{var y;return r.jsxs(Ge,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>p(x),children:[r.jsxs("div",{className:"aspect-square bg-muted relative",children:[x.images&&x.images.length>0?r.jsx("img",{src:((y=x.images.find(b=>b.is_primary))==null?void 0:y.image_url)||x.images[0].image_url,alt:x.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Dl,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(Rt,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:x.name}),x.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:x.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(x.base_price).toFixed(2)]}),x.variants&&x.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.variants.length," options"]})]})]})]},x.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Dl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No products available yet."})]})]})})}const oUe=I.forwardRef(({...e},t)=>r.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));oUe.displayName="Breadcrumb";const lUe=I.forwardRef(({className:e,...t},n)=>r.jsx("ol",{ref:n,className:$t("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));lUe.displayName="BreadcrumbList";const yee=I.forwardRef(({className:e,...t},n)=>r.jsx("li",{ref:n,className:$t("inline-flex items-center gap-1.5",e),...t}));yee.displayName="BreadcrumbItem";const qpe=I.forwardRef(({asChild:e,className:t,...n},s)=>{const i=e?Ume:"a";return r.jsx(i,{ref:s,className:$t("transition-colors hover:text-foreground",t),...n})});qpe.displayName="BreadcrumbLink";const cUe=I.forwardRef(({className:e,...t},n)=>r.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:$t("font-normal text-foreground",e),...t}));cUe.displayName="BreadcrumbPage";const Vpe=({children:e,className:t,...n})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:$t("[&>svg]:size-3.5",t),...n,children:e??r.jsx(Ka,{})});Vpe.displayName="BreadcrumbSeparator";function NKt(){var ve,ne;const{productId:e}=Wc(),t=ns(),{data:n,isLoading:s}=PGt(e||""),{addToCart:i,cartItems:o}=wse(),[l,a]=I.useState(null),[h,p]=I.useState(1),[x,y]=I.useState(0),[b,j]=I.useState(null),[N,C]=I.useState(!1),[A,E]=I.useState(!1),T=(ve=n==null?void 0:n.variants)==null?void 0:ve.find(ge=>ge.id===l),L=((ne=n==null?void 0:n.variants)==null?void 0:ne.filter(ge=>ge.is_active))||[],z=Number((n==null?void 0:n.base_price)||0),F=T?Number(T.price_adjustment):0,q=z+F,H=Number((n==null?void 0:n.shipping_fee)||0),K=o.reduce((ge,ie)=>ge+ie.quantity,0),Z=async ge=>{if(!ge.target.files||ge.target.files.length===0)return;C(!0);const ie=ge.target.files[0],fe=ie.name.split(".").pop(),de=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${fe}`;try{const{error:ye}=await J.storage.from("marketplace").upload(de,ie);if(ye)throw ye;const{data:{publicUrl:Ie}}=J.storage.from("marketplace").getPublicUrl(de);j(Ie),ze.success("Artwork uploaded successfully")}catch(ye){ze.error("Failed to upload artwork: "+ye.message)}finally{C(!1)}},te=()=>{if(n){if(L.length>0&&!l){ze.error("Please select an option");return}i(n,T||void 0,h,b||void 0),E(!0),ze.success("Added to cart!"),setTimeout(()=>E(!1),2e3)}},ae=()=>{n!=null&&n.images&&y(ge=>(ge+1)%n.images.length)},le=()=>{n!=null&&n.images&&y(ge=>(ge-1+n.images.length)%n.images.length)};return s?r.jsx(Or,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Pr,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Pr,{className:"h-8 w-3/4"}),r.jsx(Pr,{className:"h-6 w-1/4"}),r.jsx(Pr,{className:"h-24 w-full"}),r.jsx(Pr,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Or,{title:n.name,children:[r.jsx(oUe,{className:"mb-6",children:r.jsxs(lUe,{children:[r.jsx(yee,{children:r.jsx(qpe,{asChild:!0,children:r.jsx(uo,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(Vpe,{}),r.jsx(yee,{children:r.jsx(qpe,{asChild:!0,children:r.jsx(uo,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(Vpe,{}),r.jsx(yee,{children:r.jsx(cUe,{children:n.name})})]})}),r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative aspect-square bg-muted rounded-lg overflow-hidden flex items-center justify-center",children:n.images&&n.images.length>0?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:n.images[x].image_url,alt:n.name,className:"max-w-full max-h-full object-contain"}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:le,children:r.jsx(qc,{className:"h-6 w-6"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ae,children:r.jsx(Ka,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Dl,{className:"h-24 w-24 text-muted-foreground"})})}),n.images&&n.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:n.images.map((ge,ie)=>r.jsx("button",{onClick:()=>y(ie),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${ie===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:ge.image_url,alt:"",className:"w-full h-full object-cover"})},ge.id))}),n.video&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),r.jsx("div",{className:"aspect-video",children:r.jsx("iframe",{src:n.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[n.category&&r.jsx(Rt,{variant:"secondary",className:"mb-2",children:n.category.name}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:n.name}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-3xl font-bold",children:["$",q.toFixed(2)]}),H>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",H.toFixed(2)," shipping"]})]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})}),L.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:L.map(ge=>r.jsxs(ee,{variant:l===ge.id?"default":"outline",onClick:()=>a(ge.id),children:[ge.name,Number(ge.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(ge.price_adjustment)>0?"+":"","$",Number(ge.price_adjustment).toFixed(2),")"]})]},ge.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{children:"Upload Your Artwork (Optional)"}),b?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:b,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(ee,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>j(null),children:"×"})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6",children:[r.jsx("input",{type:"file",accept:"image/*,.pdf,.ai,.eps",onChange:Z,className:"hidden",id:"artwork-upload",disabled:N}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(no,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:N?"Uploading...":"Click to upload artwork"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ue,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(ge=>Math.max(1,ge-1)),children:"-"}),r.jsx(at,{type:"number",value:h,onChange:ge=>p(Math.max(1,parseInt(ge.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(ge=>ge+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(ee,{size:"lg",className:"flex-1",onClick:te,disabled:A,children:A?r.jsxs(r.Fragment,{children:[r.jsx(Ca,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(hh,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(ee,{variant:"outline",size:"lg",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(hh,{className:"h-5 w-5"}),K>0&&r.jsx(Rt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:K})]})]}),n.requires_proof_approval&&r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-3 rounded-lg",children:"📋 This product requires proof approval before production. You'll receive a proof to review after your order is placed."})]})]})]}):r.jsx(Or,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Dl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Product not found"}),r.jsx(ee,{onClick:()=>t("/marketplace"),children:"Back to Marketplace"})]})})}function SKt(){const e=ns(),{cartItems:t,removeFromCart:n,updateQuantity:s,getItemPrice:i,getSubtotal:o,getShippingTotal:l,getTotal:a,clearCart:h}=wse(),[p,x]=I.useState(!1),[y,b]=I.useState(""),j=async()=>{if(t.length===0){ze.error("Your cart is empty");return}x(!0);try{const{data:N,error:C}=await J.functions.invoke("marketplace-checkout",{body:{items:t.map(A=>{var E;return{product_id:A.product.id,variant_id:((E=A.variant)==null?void 0:E.id)||null,quantity:A.quantity,artwork_url:A.artworkUrl||null}}),notes:y.trim()||null}});if(C)throw C;if(N!=null&&N.url)h(),window.open(N.url,"_blank");else throw new Error("No checkout URL received")}catch(N){ze.error("Checkout failed: "+N.message)}finally{x(!1)}};return t.length===0?r.jsx(Or,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(kg,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your cart is empty"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Add some products to get started!"}),r.jsx(ee,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Or,{title:"Shopping Cart",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[t.map(N=>{var C,A;return r.jsx(Ge,{children:r.jsx(Xe,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:N.product.images&&N.product.images.length>0?r.jsx("img",{src:((C=N.product.images.find(E=>E.is_primary))==null?void 0:C.image_url)||N.product.images[0].image_url,alt:N.product.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(kg,{className:"h-8 w-8 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold line-clamp-1",children:N.product.name}),N.variant&&r.jsx("p",{className:"text-sm text-muted-foreground",children:N.variant.name}),r.jsxs("p",{className:"font-medium mt-1",children:["$",i(N).toFixed(2),Number(N.product.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(N.product.shipping_fee).toFixed(2)," shipping"]})]}),N.artworkUrl&&r.jsx("div",{className:"mt-2",children:r.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return n(N.product.id,(E=N.variant)==null?void 0:E.id)},children:r.jsx(Zn,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(N.product.id,(E=N.variant)==null?void 0:E.id,N.quantity-1)},disabled:N.quantity<=1,children:r.jsx(y1,{className:"h-3 w-3"})}),r.jsx(at,{type:"number",value:N.quantity,onChange:E=>{var T;return s(N.product.id,(T=N.variant)==null?void 0:T.id,parseInt(E.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(N.product.id,(E=N.variant)==null?void 0:E.id,N.quantity+1)},children:r.jsx(jn,{className:"h-3 w-3"})})]})]})]})})},`${N.product.id}-${((A=N.variant)==null?void 0:A.id)||"base"}`)}),r.jsx(ee,{variant:"ghost",className:"text-destructive",onClick:h,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(Ge,{className:"sticky top-4",children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Order Summary"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",t.reduce((N,C)=>N+C.quantity,0)," items)"]}),r.jsxs("span",{children:["$",o().toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",l().toFixed(2)]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",a().toFixed(2)]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(ps,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:N=>b(N.target.value),rows:3,className:"resize-none"})]}),r.jsx(ee,{className:"w-full",size:"lg",onClick:j,disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(nn,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(Zo,{className:"h-5 w-5 ml-2"})]})}),r.jsx("p",{className:"text-xs text-center text-muted-foreground",children:"Secure checkout powered by Stripe"})]})]})})]})})}function CKt(){const e=ns(),{data:t,isLoading:n}=VGt();return n?r.jsx(Or,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Pr,{className:"h-32 w-full"},s))})}):!t||t.length===0?r.jsx(Or,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Dl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No orders yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Start shopping to see your orders here!"}),r.jsx(ee,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Or,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:t.map(s=>{var i,o,l;return r.jsx(Ge,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>e(`/marketplace/orders/${s.id}`),children:r.jsxs(Xe,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:s.order_number}),r.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:xn(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Rt,{className:D0e[s.status],children:RS[s.status]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex -space-x-2",children:[(i=s.items)==null?void 0:i.slice(0,3).map((a,h)=>r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",style:{zIndex:3-h},children:[a.quantity,"×"]},a.id)),s.items&&s.items.length>3&&r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",children:["+",s.items.length-3]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:((o=s.items)==null?void 0:o.length)===1?s.items[0].product_name:`${(l=s.items)==null?void 0:l.length} items`}),r.jsxs("p",{className:"font-semibold",children:["$",Number(s.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.tracking_url&&r.jsxs(ee,{variant:"outline",size:"sm",onClick:a=>{a.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Fs,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Ka,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const w5e=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function MKt({currentStatus:e,statusHistory:t}){const n=w5e.indexOf(e);return r.jsx("div",{className:"space-y-3",children:w5e.map((s,i)=>{const o=t==null?void 0:t.find(p=>p.status===s),l=in;return r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`mt-0.5 flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center ${l?"bg-green-500 text-white":a?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:l?r.jsx(Ya,{className:"h-4 w-4"}):a?r.jsx(Ki,{className:"h-4 w-4"}):r.jsx("span",{className:"text-xs",children:i+1})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`font-medium ${h?"text-muted-foreground":""}`,children:RS[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[xn(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function TKt(){var E;const{orderId:e}=Wc(),t=ns(),{data:n,isLoading:s,refetch:i}=HGt(e||""),o=KGt(),l=ZGt(),[a,h]=I.useState(!1),[p,x]=I.useState(null),[y,b]=I.useState(""),[j,N]=I.useState(null),C=async T=>{N(T);try{await o.mutateAsync({orderId:e,itemId:T}),ze.success("Proof approved!"),i()}catch{ze.error("Failed to approve proof")}finally{N(null)}},A=async()=>{if(p){N(p);try{await l.mutateAsync({orderId:e,itemId:p,reason:y}),ze.success("Revision requested"),h(!1),b(""),x(null),i()}catch{ze.error("Failed to request revision")}finally{N(null)}}};return s?r.jsx(Or,{title:"Order Details",children:r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsx(Pr,{className:"h-64 w-full"}),r.jsx(Pr,{className:"h-48 w-full"})]}),r.jsx(Pr,{className:"h-96 w-full"})]})}):n?r.jsxs(Or,{title:`Order ${n.order_number}`,children:[r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs(Ge,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Qt,{children:"Order Status"}),r.jsx(Rt,{className:D0e[n.status],children:RS[n.status]})]}),r.jsx(Xe,{children:r.jsx(MKt,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Items"})}),r.jsx(Xe,{className:"space-y-4",children:(E=n.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",T.quantity," × $",Number(T.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(T.unit_price)*T.quantity).toFixed(2)]})]}),T.artwork_url&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),r.jsxs("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(u1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Fs,{className:"h-3 w-3"})]})]}),T.proof_url&&r.jsxs("div",{className:"bg-muted rounded-lg p-3",children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"Proof Ready for Review"}),r.jsxs("a",{href:T.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[r.jsx(u1,{className:"h-4 w-4"}),"View Proof",r.jsx(Fs,{className:"h-3 w-3"})]}),T.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(ee,{size:"sm",onClick:()=>C(T.id),disabled:j===T.id,children:[j===T.id?r.jsx(nn,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(pd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>{x(T.id),h(!0)},disabled:j===T.id,children:[r.jsx(QT,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),T.proof_status==="approved"&&r.jsxs(Rt,{className:"bg-green-100 text-green-800",children:[r.jsx(Ya,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),T.proof_status==="rejected"&&T.proof_notes&&r.jsxs("div",{className:"mt-2",children:[r.jsx(Rt,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.proof_notes})]})]})]},T.id))})]}),n.shipping_name&&r.jsxs(Ge,{children:[r.jsx(Gt,{children:r.jsxs(Qt,{className:"flex items-center gap-2",children:[r.jsx(eA,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(Xe,{children:[r.jsx("p",{className:"font-medium",children:n.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[n.shipping_address,r.jsx("br",{}),n.shipping_city,", ",n.shipping_state," ",n.shipping_zip]}),n.tracking_number&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),r.jsx("p",{className:"font-mono font-medium",children:n.tracking_number}),n.tracking_url&&r.jsxs(ee,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Fs,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(Ge,{className:"sticky top-4",children:[r.jsx(Gt,{children:r.jsx(Qt,{children:"Order Summary"})}),r.jsxs(Xe,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",xn(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(Qd,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(n.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(n.shipping_total).toFixed(2)]})]})]}),r.jsx(Qd,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(n.total).toFixed(2)]})]}),n.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Qd,{}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-1",children:"Order Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.notes})]})]})]})]})})]}),r.jsx(Br,{open:a,onOpenChange:h,children:r.jsxs(Fr,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Request Changes"}),r.jsx(es,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(ps,{placeholder:"Describe the changes needed...",value:y,onChange:T=>b(T.target.value),rows:4}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(ee,{onClick:A,disabled:!y.trim()||j!==null,children:[j?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Or,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Dl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Order not found"}),r.jsx(ee,{onClick:()=>t("/marketplace/orders"),children:"View All Orders"})]})})}function AKt(){const e=ns(),[t]=Fd();return t.get("session_id"),I.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Or,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(Ge,{children:r.jsxs(Xe,{className:"pt-8 pb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(Ya,{className:"h-8 w-8 text-green-600"})}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thank You for Your Order!"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Your order has been confirmed and is being processed. You'll receive an email confirmation shortly."}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 mb-6 text-left",children:[r.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Dl,{className:"h-4 w-4"}),"What happens next?"]}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("li",{children:"• We'll review your order and prepare it for production"}),r.jsx("li",{children:"• If your order requires a proof, you'll receive it for approval"}),r.jsx("li",{children:"• Once approved, we'll begin production and ship when ready"}),r.jsx("li",{children:"• You'll receive tracking info when your order ships"})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(ee,{className:"flex-1",onClick:()=>e("/marketplace/orders"),children:["View My Orders",r.jsx(Zo,{className:"h-4 w-4 ml-2"})]}),r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>e("/marketplace"),children:"Continue Shopping"})]})]})})})})}function EKt(){const{user:e}=zr(),[t,n]=I.useState("store"),[s,i]=I.useState(null),[o,l]=I.useState(null),[a,h]=I.useState(!1),[p,x]=I.useState(5),[y,b]=I.useState(""),[j,N]=I.useState(!1),[C,A]=I.useState(!1),[E,T]=I.useState(""),[L,z]=I.useState(null),[F,q]=I.useState(!1),{hasSubmittedReview:H,submitReview:K,markPostedToGoogle:Z}=lOe(),{data:te}=aUe(),{data:ae,isLoading:le}=iUe(),{data:ve,isLoading:ne}=rKt(s),{data:ge,isLoading:ie}=nKt(e==null?void 0:e.id),{data:fe=0}=iKt(e==null?void 0:e.id),de=aKt(),ye=new Set((ge==null?void 0:ge.map(Oe=>Oe.item_id))||[]),Ie=async()=>{if(o)try{await de.mutateAsync(o.id),ze.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Oe){ze.error(Oe.message||"Failed to purchase item")}},Ne=async()=>{if(!y.trim()){ze.error("Please write a review");return}N(!0);const Oe=await K(p,y);N(!1),Oe.success?(ze.success("Thank you for your review! You earned 25 points!"),T(y),A(!0),b(""),x(5)):ze.error(Oe.error||"Failed to submit review")},we=()=>{navigator.clipboard.writeText(E),ze.success("Review copied to clipboard!")},he=()=>{Z(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},xe=()=>{A(!1),h(!1),T("")};return le||ne||ie?r.jsx(Or,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-24 w-full"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(Oe=>r.jsx(Pr,{className:"h-64"},Oe))})]})}):r.jsxs(Or,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Reward Store"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Redeem your points for exclusive rewards"})]}),r.jsx(Ge,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:r.jsx(vs,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your Spendable Points"}),r.jsx("p",{className:"text-3xl font-bold text-primary",children:fe.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Wa,{className:"h-4 w-4"}),r.jsx("span",{children:"Earn points by attending events"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Zh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(NS,{open:F,onOpenChange:q,children:r.jsxs(Ge,{className:"border-primary/20",children:[r.jsx(SS,{asChild:!0,children:r.jsx(Gt,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Wa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Qt,{className:"text-base",children:"How to Earn Points"}),r.jsx(En,{children:"See all the ways you can earn spendable points"})]})]}),F?r.jsx(a1,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Pu,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(CS,{children:r.jsx(Xe,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[te==null?void 0:te.filter(Oe=>Oe.is_active).map(Oe=>{const Te=Ve=>{switch(Ve){case"event_attendance":return r.jsx(zs,{className:"h-5 w-5"});case"leave_review":return r.jsx(vs,{className:"h-5 w-5"});case"add_listing":return r.jsx(fi,{className:"h-5 w-5"});case"first_contact":return r.jsx(Vn,{className:"h-5 w-5"});case"first_video":return r.jsx(Fi,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Po,{className:"h-5 w-5"});default:return r.jsx(Ha,{className:"h-5 w-5"})}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0",children:Te(Oe.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Oe.action_name}),Oe.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Oe.description})]}),r.jsxs(Rt,{variant:"secondary",className:"font-bold shrink-0",children:["+",Oe.points]})]},Oe.id)}),r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/20 flex items-center justify-center text-orange-500 shrink-0",children:r.jsx(Zh,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Streak Bonuses"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Attend consecutive weeks for bonus points!"})]}),r.jsx(Rt,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!H&&r.jsx(Ge,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(Xe,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/20 flex items-center justify-center",children:r.jsx(Po,{className:"h-6 w-6 text-yellow-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Earn 25 Free Points!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave a quick review and earn 25 spendable points"})]})]}),r.jsxs(ee,{onClick:()=>h(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(ba,{value:t,onValueChange:n,children:[r.jsxs(fa,{children:[r.jsxs(ln,{value:"store",className:"flex items-center gap-2",children:[r.jsx(kg,{className:"h-4 w-4"}),"Store"]}),r.jsxs(ln,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(Dl,{className:"h-4 w-4"}),"My Rewards",ge&&ge.length>0&&r.jsx(Rt,{variant:"secondary",className:"ml-1",children:ge.length})]})]}),r.jsxs(An,{value:"store",className:"mt-6",children:[ae&&ae.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(ee,{variant:s===null?"default":"outline",size:"sm",onClick:()=>i(null),children:"All"}),ae.map(Oe=>r.jsxs(ee,{variant:s===Oe.id?"default":"outline",size:"sm",onClick:()=>i(Oe.id),children:[Oe.icon&&`${Oe.icon} `,Oe.name]},Oe.id))]}),!ve||ve.length===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Ha,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No items available"}),r.jsx("p",{className:"text-sm",children:"Check back later for new rewards!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ve.map(Oe=>{const Te=ye.has(Oe.id),Ve=Oe.max_quantity!==null&&Oe.current_quantity===0,Fe=fe>=Oe.points_cost;return r.jsxs(Ge,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Te?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>z(Oe),children:[Oe.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Oe.preview_image_url,alt:Oe.name,className:"w-full h-full object-cover"}),Te&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(Ya,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Ve&&!Te&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Rt,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(Ha,{className:"h-12 w-12 text-muted-foreground/50"}),Te&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Rt,{className:"bg-green-500 text-white",children:[r.jsx(Ya,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Qt,{className:"text-lg",children:Oe.name}),r.jsxs(Rt,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),Oe.points_cost]})]}),Oe.category&&r.jsxs(Rt,{variant:"outline",className:"w-fit",children:[Oe.category.icon&&`${Oe.category.icon} `,Oe.category.name]})]}),r.jsxs(Xe,{children:[r.jsx(En,{className:"mb-4 line-clamp-2",children:Oe.description||"No description available"}),Oe.max_quantity!==null&&!Te&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Oe.current_quantity," of ",Oe.max_quantity," remaining"]}),Te?r.jsx(ee,{className:"w-full",onClick:Me=>{Me.stopPropagation(),Oe.file_url&&mde(Oe.file_url,Oe.name)},disabled:!Oe.file_url,children:Oe.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(ee,{className:"w-full",onClick:Me=>{Me.stopPropagation(),l(Oe)},disabled:Ve||!Fe,children:Ve?"Sold Out":Fe?r.jsxs(r.Fragment,{children:[r.jsx(kg,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Oe.points_cost-fe} more pts`})]})]},Oe.id)})})]}),r.jsx(An,{value:"my-rewards",className:"mt-6",children:!ge||ge.length===0?r.jsx(Ge,{children:r.jsx(Xe,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Dl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No rewards yet"}),r.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ge.map(Oe=>{var Te,Ve,Fe,Me,Qe;return r.jsxs(Ge,{className:"overflow-hidden",children:[(Te=Oe.item)!=null&&Te.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Oe.item.preview_image_url,alt:((Ve=Oe.item)==null?void 0:Ve.name)||"Reward",className:"w-full h-full object-cover"})}):r.jsx("div",{className:"aspect-video bg-muted flex items-center justify-center",children:r.jsx(Ha,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Qt,{className:"text-lg",children:((Fe=Oe.item)==null?void 0:Fe.name)||"Unknown Item"}),r.jsxs(En,{className:"text-xs",children:["Purchased for ",Oe.points_spent," points • ",new Date(Oe.purchased_at).toLocaleDateString()]})]}),r.jsx(Xe,{children:r.jsx(ee,{className:"w-full",onClick:()=>{var Ee,Ye;(Ee=Oe.item)!=null&&Ee.file_url&&mde(Oe.item.file_url,(Ye=Oe.item)==null?void 0:Ye.name)},disabled:!((Me=Oe.item)!=null&&Me.file_url),children:((Qe=Oe.item)==null?void 0:Qe.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Oe.id)})})})]})]}),r.jsx(fh,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(ju,{children:[r.jsxs(ku,{children:[r.jsx(Su,{children:"Confirm Purchase"}),r.jsxs(Cu,{children:['Are you sure you want to purchase "',o==null?void 0:o.name,'" for ',o==null?void 0:o.points_cost," points?",r.jsx("br",{}),r.jsx("br",{}),"You currently have ",r.jsxs("strong",{children:[fe," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[fe-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(Nu,{children:[r.jsx(Mu,{children:"Cancel"}),r.jsx(Jd,{onClick:Ie,disabled:de.isPending,children:de.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Br,{open:a,onOpenChange:Oe=>{!Oe&&C?xe():h(Oe)},children:r.jsx(Fr,{children:C?r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(es,{children:"Would you also share your review on Google? It helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your review:"}),r.jsxs("p",{className:"text-sm italic",children:['"',E,'"']})]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:we,children:[r.jsx(pl,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(ri,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(ee,{variant:"outline",onClick:xe,children:"Maybe Later"}),r.jsxs(ee,{onClick:he,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Hr,{children:[r.jsx(qr,{children:"Leave a Review"}),r.jsx(es,{children:"Share your experience with LevelUp and earn 25 spendable points!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Rating"}),r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(Oe=>r.jsx("button",{type:"button",onClick:()=>x(Oe),className:"focus:outline-none",children:r.jsx(vs,{className:`h-8 w-8 transition-colors ${p>=Oe?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Oe))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(ps,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:Oe=>b(Oe.target.value),rows:4})]})]}),r.jsxs(ri,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ne,disabled:j,className:"bg-yellow-600 hover:bg-yellow-700",children:j?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Br,{open:!!L,onOpenChange:()=>z(null),children:r.jsxs(Fr,{className:"max-w-lg",children:[r.jsxs(Hr,{children:[r.jsxs(qr,{className:"flex items-center gap-2",children:[L==null?void 0:L.name,r.jsxs(Rt,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),L==null?void 0:L.points_cost]})]}),(L==null?void 0:L.category)&&r.jsxs(Rt,{variant:"outline",className:"w-fit",children:[L.category.icon&&`${L.category.icon} `,L.category.name]})]}),(L==null?void 0:L.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:L.preview_image_url,alt:L.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(L==null?void 0:L.description)||"No description available"}),(L==null?void 0:L.max_quantity)!==null&&!ye.has((L==null?void 0:L.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[L==null?void 0:L.current_quantity," of ",L==null?void 0:L.max_quantity," remaining"]})]}),r.jsx(ri,{children:L&&ye.has(L.id)?r.jsx(ee,{className:"w-full",onClick:()=>{L.file_url&&mde(L.file_url,L.name)},disabled:!L.file_url,children:L.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})}):L&&r.jsx(ee,{className:"w-full",onClick:()=>{z(null),l(L)},disabled:L.max_quantity!==null&&L.current_quantity===0||fe{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function P1(e){const t=[];for(let n=0,s=e.length;nLh||e.height>Lh)&&(e.width>Lh&&e.height>Lh?e.width>e.height?(e.height*=Lh/e.width,e.width=Lh):(e.width*=Lh/e.height,e.height=Lh):e.width>Lh?(e.height*=Lh/e.width,e.width=Lh):(e.width*=Lh/e.height,e.height=Lh))}function hne(e){return new Promise((t,n)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=n,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function FKt(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function zKt(e,t,n){const s="http://www.w3.org/2000/svg",i=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${t} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),i.appendChild(o),o.appendChild(e),FKt(i)}const bh=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||bh(n,t)};function BKt(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function $Kt(e,t){return dUe(t).map(n=>{const s=e.getPropertyValue(n),i=e.getPropertyPriority(n);return`${n}: ${s}${i?" !important":""};`}).join(" ")}function UKt(e,t,n,s){const i=`.${e}:${t}`,o=n.cssText?BKt(n):$Kt(n,s);return document.createTextNode(`${i}{${o}}`)}function j5e(e,t,n,s){const i=window.getComputedStyle(e,n),o=i.getPropertyValue("content");if(o===""||o==="none")return;const l=PKt();try{t.className=`${t.className} ${l}`}catch{return}const a=document.createElement("style");a.appendChild(UKt(l,n,i,s)),t.appendChild(a)}function qKt(e,t,n){j5e(e,t,":before",n),j5e(e,t,":after",n)}const k5e="application/font-woff",N5e="image/jpeg",VKt={woff:k5e,woff2:k5e,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:N5e,jpeg:N5e,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function HKt(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function F0e(e){const t=HKt(e).toLowerCase();return VKt[t]||""}function WKt(e){return e.split(/,/)[1]}function Hpe(e){return e.search(/^(data:)/)!==-1}function GKt(e,t){return`data:${t};base64,${e}`}async function hUe(e,t,n){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const i=await s.blob();return new Promise((o,l)=>{const a=new FileReader;a.onerror=l,a.onloadend=()=>{try{o(n({res:s,result:a.result}))}catch(h){l(h)}},a.readAsDataURL(i)})}const gde={};function KKt(e,t,n){let s=e.replace(/\?.*/,"");return n&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function z0e(e,t,n){const s=KKt(e,t,n.includeQueryParams);if(gde[s]!=null)return gde[s];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const o=await hUe(e,n.fetchRequestInit,({res:l,result:a})=>(t||(t=l.headers.get("Content-Type")||""),WKt(a)));i=GKt(o,t)}catch(o){i=n.imagePlaceholder||"";let l=`Failed to fetch resource: ${e}`;o&&(l=typeof o=="string"?o:o.message),l&&console.warn(l)}return gde[s]=i,i}async function ZKt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):hne(t)}async function YKt(e,t){if(e.currentSrc){const o=document.createElement("canvas"),l=o.getContext("2d");o.width=e.clientWidth,o.height=e.clientHeight,l==null||l.drawImage(e,0,0,o.width,o.height);const a=o.toDataURL();return hne(a)}const n=e.poster,s=F0e(n),i=await z0e(n,s,t);return hne(i)}async function XKt(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await Wie(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function QKt(e,t){return bh(e,HTMLCanvasElement)?ZKt(e):bh(e,HTMLVideoElement)?YKt(e,t):bh(e,HTMLIFrameElement)?XKt(e,t):e.cloneNode(fUe(e))}const JKt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",fUe=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function eZt(e,t,n){var s,i;if(fUe(t))return t;let o=[];return JKt(e)&&e.assignedNodes?o=P1(e.assignedNodes()):bh(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?o=P1(e.contentDocument.body.childNodes):o=P1(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),o.length===0||bh(e,HTMLVideoElement)||await o.reduce((l,a)=>l.then(()=>Wie(a,n)).then(h=>{h&&t.appendChild(h)}),Promise.resolve()),t}function tZt(e,t,n){const s=t.style;if(!s)return;const i=window.getComputedStyle(e);i.cssText?(s.cssText=i.cssText,s.transformOrigin=i.transformOrigin):dUe(n).forEach(o=>{let l=i.getPropertyValue(o);o==="font-size"&&l.endsWith("px")&&(l=`${Math.floor(parseFloat(l.substring(0,l.length-2)))-.1}px`),bh(e,HTMLIFrameElement)&&o==="display"&&l==="inline"&&(l="block"),o==="d"&&t.getAttribute("d")&&(l=`path(${t.getAttribute("d")})`),s.setProperty(o,l,i.getPropertyPriority(o))})}function rZt(e,t){bh(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),bh(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function nZt(e,t){if(bh(e,HTMLSelectElement)){const n=t,s=Array.from(n.children).find(i=>e.value===i.getAttribute("value"));s&&s.setAttribute("selected","")}}function sZt(e,t,n){return bh(t,Element)&&(tZt(e,t,n),qKt(e,t,n),rZt(e,t),nZt(e,t)),t}async function iZt(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const s={};for(let o=0;oQKt(s,t)).then(s=>eZt(e,s,t)).then(s=>sZt(e,s,t)).then(s=>iZt(s,t))}const pUe=/url\((['"]?)([^'"]+?)\1\)/g,aZt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,oZt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function lZt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function cZt(e){const t=[];return e.replace(pUe,(n,s,i)=>(t.push(i),n)),t.filter(n=>!Hpe(n))}async function dZt(e,t,n,s,i){try{const o=n?IKt(t,n):t,l=F0e(t);let a;return i||(a=await z0e(o,l,s)),e.replace(lZt(t),`$1${a}$3`)}catch{}return e}function uZt(e,{preferredFontFormat:t}){return t?e.replace(oZt,n=>{for(;;){const[s,,i]=aZt.exec(n)||[];if(!i)return"";if(i===t)return`src: ${s};`}}):e}function mUe(e){return e.search(pUe)!==-1}async function gUe(e,t,n){if(!mUe(e))return e;const s=uZt(e,n);return cZt(s).reduce((o,l)=>o.then(a=>dZt(a,l,t,n)),Promise.resolve(s))}async function m4(e,t,n){var s;const i=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(i){const o=await gUe(i,null,n);return t.style.setProperty(e,o,t.style.getPropertyPriority(e)),!0}return!1}async function hZt(e,t){await m4("background",e,t)||await m4("background-image",e,t),await m4("mask",e,t)||await m4("-webkit-mask",e,t)||await m4("mask-image",e,t)||await m4("-webkit-mask-image",e,t)}async function fZt(e,t){const n=bh(e,HTMLImageElement);if(!(n&&!Hpe(e.src))&&!(bh(e,SVGImageElement)&&!Hpe(e.href.baseVal)))return;const s=n?e.src:e.href.baseVal,i=await z0e(s,F0e(s),t);await new Promise((o,l)=>{e.onload=o,e.onerror=t.onImageErrorHandler?(...h)=>{try{o(t.onImageErrorHandler(...h))}catch(p){l(p)}}:l;const a=e;a.decode&&(a.decode=o),a.loading==="lazy"&&(a.loading="eager"),n?(e.srcset="",e.src=i):e.href.baseVal=i})}async function pZt(e,t){const s=P1(e.childNodes).map(i=>xUe(i,t));await Promise.all(s).then(()=>e)}async function xUe(e,t){bh(e,Element)&&(await hZt(e,t),await fZt(e,t),await pZt(e,t))}function mZt(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(i=>{n[i]=s[i]}),e}const S5e={};async function C5e(e){let t=S5e[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},S5e[e]=t,t}async function M5e(e,t){let n=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async l=>{let a=l.replace(s,"$1");return a.startsWith("https://")||(a=new URL(a,e.url).href),hUe(a,t.fetchRequestInit,({result:h})=>(n=n.replace(l,`url(${h})`),[l,h]))});return Promise.all(o).then(()=>n)}function T5e(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const h=i.exec(s);if(h===null)break;t.push(h[0])}s=s.replace(i,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,l="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(l,"gi");for(;;){let h=o.exec(s);if(h===null){if(h=a.exec(s),h===null)break;o.lastIndex=a.lastIndex}else a.lastIndex=o.lastIndex;t.push(h[0])}return t}async function gZt(e,t){const n=[],s=[];return e.forEach(i=>{if("cssRules"in i)try{P1(i.cssRules||[]).forEach((o,l)=>{if(o.type===CSSRule.IMPORT_RULE){let a=l+1;const h=o.href,p=C5e(h).then(x=>M5e(x,t)).then(x=>T5e(x).forEach(y=>{try{i.insertRule(y,y.startsWith("@import")?a+=1:i.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:y,error:b})}})).catch(x=>{console.error("Error loading remote css",x.toString())});s.push(p)}})}catch(o){const l=e.find(a=>a.href==null)||document.styleSheets[0];i.href!=null&&s.push(C5e(i.href).then(a=>M5e(a,t)).then(a=>T5e(a).forEach(h=>{l.insertRule(h,l.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",o)}}),Promise.all(s).then(()=>(e.forEach(i=>{if("cssRules"in i)try{P1(i.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${i.href}`,o)}}),n))}function xZt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>mUe(t.style.getPropertyValue("src")))}async function yZt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=P1(e.ownerDocument.styleSheets),s=await gZt(n,t);return xZt(s)}function yUe(e){return e.trim().replace(/["']/g,"")}function vZt(e){const t=new Set;function n(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(o=>{t.add(yUe(o))}),Array.from(s.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(e),t}async function _Zt(e,t){const n=await yZt(e,t),s=vZt(e);return(await Promise.all(n.filter(o=>s.has(yUe(o.style.fontFamily))).map(o=>{const l=o.parentStyleSheet?o.parentStyleSheet.href:null;return gUe(o.cssText,l,t)}))).join(` `)}async function bZt(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await _Zt(e,t);if(n){const s=document.createElement("style"),i=document.createTextNode(n);s.appendChild(i),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function wZt(e,t={}){const{width:n,height:s}=uUe(e,t),i=await Wie(e,t,!0);return await bZt(i,t),await xUe(i,t),mZt(i,t),await zKt(i,n,s)}async function jZt(e,t={}){const{width:n,height:s}=uUe(e,t),i=await wZt(e,t),o=await hne(i),l=document.createElement("canvas"),a=l.getContext("2d"),h=t.pixelRatio||DKt(),p=t.canvasWidth||n,x=t.canvasHeight||s;return l.width=p*h,l.height=x*h,t.skipAutoScale||RKt(l),l.style.width=`${p}`,l.style.height=`${x}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,l.width,l.height)),a.drawImage(o,0,0,l.width,l.height),l}async function kZt(e,t={}){return(await jZt(e,t)).toDataURL()}function NZt(){return Zt({queryKey:["listing-swag-categories"],queryFn:async()=>{const{data:e,error:t}=await J.from("listing_swag_categories").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}})}function SZt(){return Zt({queryKey:["listing-swag-styles"],queryFn:async()=>{const{data:e,error:t}=await J.from("listing_swag_styles").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}})}function CZt(){const{user:e}=zr(),t=Wr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{error:s}=await J.from("listing_swag_generations").insert({user_id:e.id,category_id:n.categoryId,style_id:n.styleId,listing_id:n.listingId||null,property_address:n.propertyAddress,property_city:n.propertyCity,property_state:n.propertyState,property_price:n.propertyPrice,bedrooms:n.bedrooms,bathrooms:n.bathrooms,square_feet:n.squareFeet,photo_url:n.photoUrl,formats_downloaded:n.formatsDownloaded});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-swag-generations"]})}})}const MZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function A5e(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function E5e({data:e,format:t}){var b,j;const n=MZt[t],s=.4,i=e.primaryColor||"#1e3a5f",o=e.secondaryColor||"#ffffff",l=A5e(i)?"#0f172a":"#ffffff",a=A5e(o)?"#0f172a":"#ffffff",h=i+"33",p=N=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(N),x=t==="story",y=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"relative",style:{height:x?"38%":y?"35%":"36%"},children:[e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e5e7eb"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:28*s},children:"Add Property Photo"})}),r.jsx("div",{className:"absolute",style:{top:20*s,left:20*s,backgroundColor:i,padding:`${18*s}px ${36*s}px`,borderRadius:6*s},children:r.jsx("span",{style:{color:l,fontSize:28*s,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.1em"},children:e.categoryName})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:o,padding:`${20*s}px ${32*s}px`,borderRadius:6*s,boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,marginBottom:4*s},children:"Listed at"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:i},children:p(e.propertyPrice)})]})]}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:i,padding:`${28*s}px ${36*s}px`,gap:16*s},children:[r.jsx(ml,{style:{width:36*s,height:36*s,color:l,opacity:.8,flexShrink:0}}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:800,color:l,marginBottom:4*s},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:l,opacity:.8,fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{backgroundColor:o},children:[{icon:Hf,value:e.bedrooms,label:"Bedrooms"},{icon:Vf,value:e.bathrooms,label:"Bathrooms"},{icon:x1,value:((b=e.squareFeet)==null?void 0:b.toLocaleString())||"—",label:"Sq Ft"}].map((N,C)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,borderRight:C<2?`2px solid ${h}`:"none",backgroundColor:C===1?h:o},children:[r.jsx(N.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:i},children:N.value}),r.jsx("div",{style:{fontSize:18*s,color:"#64748b",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:N.label})]},C))}),r.jsxs("div",{className:"flex items-center",style:{padding:`${48*s}px`,backgroundColor:o,gap:36*s,flex:1},children:[e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"object-cover",style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:220*s,height:220*s,borderRadius:"50%",backgroundColor:i,color:l,fontSize:88*s,fontWeight:700,flexShrink:0},children:((j=e.agentName)==null?void 0:j.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:i,marginBottom:8*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:28*s,color:"#64748b",marginBottom:24*s,fontWeight:600},children:"Real Estate Professional"}),r.jsxs("div",{className:"flex flex-col",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:28*s,height:28*s,color:l}})}),r.jsx("span",{style:{fontSize:36*s,color:a,fontWeight:800},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:52*s,height:52*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ys,{style:{width:28*s,height:28*s,color:l}})}),r.jsx("span",{style:{fontSize:30*s,color:"#475569",fontWeight:600},children:e.agentEmail})]})]})]})]})]})}const TZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function I5e(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function AZt({data:e,format:t}){var b,j;const n=TZt[t],s=.4,i=e.primaryColor||"#0f766e",o=e.secondaryColor||"#ffffff",l=I5e(i)?"#0f172a":"#ffffff",a=I5e(o)?"#0f172a":"#ffffff",h=i+"22",p=N=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(N),x=t==="story",y=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:i},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:o,padding:`${28*s}px ${36*s}px`},children:[r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:18*s,color:i,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.1em",marginBottom:4*s},children:"Just"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i,textTransform:"uppercase"},children:e.categoryName})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:"#64748b",marginBottom:4*s},children:"Price"}),r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:i},children:p(e.propertyPrice)})]})]}),r.jsx("div",{className:"relative",style:{height:x?"32%":"28%",margin:`0 ${24*s}px`,borderRadius:16*s,overflow:"hidden",border:`6px solid ${o}`},children:e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:h},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})})}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,padding:`${24*s}px ${32*s}px`,borderRadius:16*s,gap:18*s},children:[r.jsx("div",{className:"flex items-center justify-center",style:{width:64*s,height:64*s,backgroundColor:i,borderRadius:"50%",flexShrink:0},children:r.jsx(ml,{style:{width:32*s,height:32*s,color:l}})}),r.jsxs("div",{children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:a},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:"#64748b",fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:20*s,padding:`0 ${24*s}px`},children:[{icon:Hf,value:e.bedrooms,label:"Beds"},{icon:Vf,value:e.bathrooms,label:"Baths"},{icon:x1,value:((b=e.squareFeet)==null?void 0:b.toLocaleString())||"—",label:"Sq Ft"}].map((N,C)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center",style:{backgroundColor:o,padding:`${24*s}px`,borderRadius:16*s},children:[r.jsx(N.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:900,color:a},children:N.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:N.label})]},C))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:o,margin:`${20*s}px ${24*s}px`,marginBottom:24*s,padding:`${40*s}px`,borderRadius:20*s,gap:36*s,flex:1},children:[e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`8px solid ${i}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:i,color:l,fontSize:80*s,fontWeight:700,flexShrink:0},children:((j=e.agentName)==null?void 0:j.charAt(0))||"A"}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:900,color:a,marginBottom:8*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:24*s,color:i,fontWeight:700,marginBottom:20*s},children:"Licensed Real Estate Agent"}),r.jsxs("div",{className:"flex flex-col",style:{gap:14*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:26*s,height:26*s,color:l}})}),r.jsx("span",{style:{fontSize:34*s,color:a,fontWeight:800},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ys,{style:{width:26*s,height:26*s,color:l}})}),r.jsx("span",{style:{fontSize:28*s,color:"#475569",fontWeight:600},children:e.agentEmail})]})]})]})]})]})}const EZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function P5e(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function IZt({data:e,format:t}){var y,b;const n=EZt[t],s=.4,i=e.primaryColor||"#2c3e50",o=e.secondaryColor||"#c9a962",l=P5e(i)?"#0f172a":"#ffffff",a=P5e(o)?"#0f172a":"#ffffff",h=j=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(j),p=t==="story",x=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Georgia', serif",backgroundColor:i},children:[r.jsxs("div",{className:"text-center",style:{backgroundColor:i,padding:`${32*s}px`,borderBottom:`6px solid ${o}`},children:[r.jsx("div",{style:{fontSize:20*s,color:o,textTransform:"uppercase",letterSpacing:"0.3em",marginBottom:8*s},children:"Just"}),r.jsx("div",{style:{fontSize:56*s,fontWeight:400,color:l,textTransform:"uppercase",letterSpacing:"0.15em"},children:e.categoryName})]}),r.jsxs("div",{className:"relative",style:{height:p?"30%":"26%",margin:`${24*s}px`,border:`4px solid ${o}`,borderRadius:6*s,overflow:"hidden"},children:[e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:"#e8e4de"},children:r.jsx("span",{style:{color:"#9ca3af",fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:20*s,right:20*s,backgroundColor:i,padding:`${18*s}px ${32*s}px`,borderRadius:6*s,border:`3px solid ${o}`},children:[r.jsx("div",{style:{fontSize:14*s,color:o,textTransform:"uppercase",letterSpacing:"0.1em"},children:"Offered at"}),r.jsx("div",{style:{fontSize:42*s,fontWeight:400,color:l},children:h(e.propertyPrice)})]})]}),r.jsxs("div",{className:"text-center",style:{padding:`${20*s}px ${36*s}px`,backgroundColor:"#faf8f5"},children:[r.jsx("div",{style:{fontSize:36*s,fontWeight:400,color:i,marginBottom:8*s},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:24*s,color:o,letterSpacing:"0.1em",fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]}),r.jsx("div",{className:"flex justify-center",style:{gap:48*s,padding:`${28*s}px`,backgroundColor:"#faf8f5",borderTop:"2px solid #e8e4de",borderBottom:"2px solid #e8e4de"},children:[{icon:Hf,value:e.bedrooms,label:"Bedrooms"},{icon:Vf,value:e.bathrooms,label:"Bathrooms"},{icon:x1,value:((y=e.squareFeet)==null?void 0:y.toLocaleString())||"—",label:"Sq Ft"}].map((j,N)=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(j.icon,{style:{width:32*s,height:32*s,color:o,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:40*s,fontWeight:400,color:i},children:j.value}),r.jsx("div",{style:{fontSize:16*s,color:"#7c8798",textTransform:"uppercase",letterSpacing:"0.08em"},children:j.label})]},N))}),r.jsxs("div",{className:"flex items-center justify-center",style:{backgroundColor:i,padding:`${48*s}px`,gap:40*s,borderTop:`6px solid ${o}`,flex:1},children:[e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"object-cover",style:{width:200*s,height:200*s,borderRadius:"50%",border:`6px solid ${o}`,flexShrink:0},crossOrigin:"anonymous"}):r.jsx("div",{className:"flex items-center justify-center",style:{width:200*s,height:200*s,borderRadius:"50%",backgroundColor:o,color:a,fontSize:80*s,fontWeight:400,fontStyle:"italic",flexShrink:0},children:((b=e.agentName)==null?void 0:b.charAt(0))||"A"}),r.jsxs("div",{className:"text-center flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:52*s,fontWeight:400,color:l,fontStyle:"italic",marginBottom:10*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:22*s,color:o,textTransform:"uppercase",letterSpacing:"0.2em",marginBottom:24*s},children:"Real Estate Advisor"}),r.jsxs("div",{className:"flex flex-col items-center",style:{gap:16*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:32*s,color:l,fontWeight:600},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:14*s},children:[r.jsx("div",{style:{width:48*s,height:48*s,borderRadius:"50%",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ys,{style:{width:26*s,height:26*s,color:a}})}),r.jsx("span",{style:{fontSize:26*s,color:"#94a3b8"},children:e.agentEmail})]})]})]})]})]})}const PZt={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}};function LZt(e){const t=e.substring(1),n=parseInt(t,16),s=n>>16&255,i=n>>8&255,o=n>>0&255;return .299*s+.587*i+.114*o>150}function OZt({data:e,format:t}){var y,b;const n=PZt[t],s=.4,i=e.primaryColor||"#dc2626",o=e.secondaryColor||"#ffffff",l=LZt(i)?"#0f172a":"#ffffff",a=i+"22",h=j=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(j),p=t==="story",x=t==="square";return r.jsxs("div",{"data-template":!0,className:"relative overflow-hidden flex flex-col",style:{width:n.width*s,height:n.height*s,fontFamily:"'Inter', sans-serif",backgroundColor:"#0f172a"},children:[r.jsxs("div",{className:"flex items-center justify-between",style:{backgroundColor:i,padding:`${32*s}px ${40*s}px`},children:[r.jsx("div",{style:{fontSize:48*s,fontWeight:900,color:l,textTransform:"uppercase",letterSpacing:"0.05em"},children:e.categoryName}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{style:{fontSize:16*s,color:l,opacity:.8,marginBottom:4*s},children:"Asking"}),r.jsx("div",{style:{fontSize:44*s,fontWeight:900,color:l},children:h(e.propertyPrice)})]})]}),r.jsxs("div",{className:"relative",style:{height:p?"30%":x?"28%":"26%"},children:[e.photoUrl?r.jsx("img",{src:e.photoUrl,alt:"Property",className:"w-full h-full object-cover",crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:a},children:r.jsx("span",{style:{color:i,fontSize:24*s},children:"Add Property Photo"})}),r.jsxs("div",{className:"absolute",style:{bottom:0,left:0,right:0,backgroundColor:"rgba(0,0,0,0.9)",padding:`${24*s}px ${32*s}px`},children:[r.jsx("div",{style:{fontSize:32*s,fontWeight:800,color:"#ffffff"},children:e.propertyAddress}),r.jsxs("div",{style:{fontSize:22*s,color:i,fontWeight:600},children:[e.propertyCity,", ",e.propertyState]})]})]}),r.jsx("div",{className:"flex",style:{borderBottom:`6px solid ${i}`},children:[{icon:Hf,value:e.bedrooms,label:"Beds"},{icon:Vf,value:e.bathrooms,label:"Baths"},{icon:x1,value:((y=e.squareFeet)==null?void 0:y.toLocaleString())||"—",label:"Sq Ft"}].map((j,N)=>r.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:`${28*s}px`,backgroundColor:N===1?a:o,borderRight:N<2?`2px solid ${a}`:"none"},children:[r.jsx(j.icon,{style:{width:36*s,height:36*s,color:i,marginBottom:10*s}}),r.jsx("div",{style:{fontSize:42*s,fontWeight:900,color:"#0f172a"},children:j.value}),r.jsx("div",{style:{fontSize:16*s,color:"#64748b",fontWeight:600,textTransform:"uppercase"},children:j.label})]},N))}),r.jsxs("div",{className:"flex items-center",style:{backgroundColor:"#0f172a",padding:`${48*s}px`,gap:40*s,flex:1},children:[r.jsx("div",{style:{width:220*s,height:220*s,borderRadius:"50%",border:`8px solid ${i}`,padding:6*s,backgroundColor:"#1e293b",flexShrink:0},children:e.agentPhoto?r.jsx("img",{src:e.agentPhoto,alt:e.agentName,className:"w-full h-full object-cover",style:{borderRadius:"50%"},crossOrigin:"anonymous"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",style:{borderRadius:"50%",backgroundColor:i,color:l,fontSize:88*s,fontWeight:700},children:((b=e.agentName)==null?void 0:b.charAt(0))||"A"})}),r.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[r.jsx("div",{style:{fontSize:56*s,fontWeight:900,color:"#ffffff",marginBottom:10*s,lineHeight:1.1},children:e.agentName}),r.jsx("div",{style:{fontSize:28*s,color:i,fontWeight:700,marginBottom:24*s},children:"Your Real Estate Expert"}),r.jsxs("div",{className:"flex flex-col",style:{gap:18*s},children:[r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(ca,{style:{width:30*s,height:30*s,color:l}})}),r.jsx("span",{style:{fontSize:38*s,color:"#ffffff",fontWeight:800},children:e.agentPhone})]}),r.jsxs("div",{className:"flex items-center",style:{gap:16*s},children:[r.jsx("div",{style:{width:56*s,height:56*s,borderRadius:"50%",backgroundColor:i,display:"flex",alignItems:"center",justifyContent:"center"},children:r.jsx(Ys,{style:{width:30*s,height:30*s,color:l}})}),r.jsx("span",{style:{fontSize:30*s,color:"#94a3b8",fontWeight:600},children:e.agentEmail})]})]})]})]})]})}function DZt({templateKey:e,data:t,format:n}){switch(e){case"modern-minimal":return r.jsx(E5e,{data:t,format:n});case"bold-impact":return r.jsx(AZt,{data:t,format:n});case"classic-elegant":return r.jsx(IZt,{data:t,format:n});case"vibrant-energy":return r.jsx(OZt,{data:t,format:n});default:return r.jsx(E5e,{data:t,format:n})}}const RZt={Home:r.jsx(fi,{className:"h-6 w-6"}),DoorOpen:r.jsx(c1,{className:"h-6 w-6"}),TrendingDown:r.jsx(w1,{className:"h-6 w-6"}),CheckCircle:r.jsx(qa,{className:"h-6 w-6"}),FileText:r.jsx(wi,{className:"h-6 w-6"})},nT={portrait:{label:"Portrait",icon:r.jsx(Do,{className:"h-5 w-5"}),dimensions:"1080×1350",ratio:"4:5"},square:{label:"Square",icon:r.jsx(ym,{className:"h-5 w-5"}),dimensions:"1080×1080",ratio:"1:1"},story:{label:"Story",icon:r.jsx(xm,{className:"h-5 w-5"}),dimensions:"1080×1920",ratio:"9:16"}};function FZt(){const{user:e}=zr(),{data:t,isLoading:n}=NZt(),{data:s,isLoading:i}=SZt(),{data:o}=kxe(),{avatarUrl:l}=Pge(e==null?void 0:e.id),a=CZt(),[h,p]=I.useState(null);I.useEffect(()=>{(async()=>{if(!e)return;const{data:xe}=await J.from("profiles").select("name, phone").eq("id",e.id).single();xe&&p(xe)})()},[e]);const[x,y]=I.useState("category"),[b,j]=I.useState(null),[N,C]=I.useState(null),[A,E]=I.useState("portrait"),[T,L]=I.useState(!1),[z,F]=I.useState(""),[q,H]=I.useState("#1e3a5f"),[K,Z]=I.useState("#ffffff"),[te,ae]=I.useState({propertyAddress:"",propertyCity:"",propertyState:"",propertyPrice:"",bedrooms:"",bathrooms:"",squareFeet:"",openHouseDate:"",openHouseTime:"",originalPrice:""}),le=I.useRef(null),ve=he=>{var be;const xe=(be=he.target.files)==null?void 0:be[0];if(xe){const Oe=new FileReader;Oe.onloadend=()=>{F(Oe.result)},Oe.readAsDataURL(xe)}},ne=he=>{var be,Oe,Te,Ve,Fe,Me;const xe=o==null?void 0:o.find(Qe=>Qe.id===he);xe&&(ae({propertyAddress:xe.property_address||"",propertyCity:xe.city||"",propertyState:xe.state||"",propertyPrice:((be=xe.price)==null?void 0:be.toString())||"",bedrooms:((Oe=xe.bedrooms)==null?void 0:Oe.toString())||"",bathrooms:((Te=xe.bathrooms)==null?void 0:Te.toString())||"",squareFeet:((Ve=xe.square_footage)==null?void 0:Ve.toString())||"",openHouseDate:"",openHouseTime:"",originalPrice:""}),(Me=(Fe=xe.photos)==null?void 0:Fe[0])!=null&&Me.photo_url&&F(xe.photos[0].photo_url))},ge=()=>({categoryId:(b==null?void 0:b.id)||"",categoryName:(b==null?void 0:b.name)||"",styleId:(N==null?void 0:N.id)||"",templateKey:(N==null?void 0:N.template_key)||"modern-minimal",primaryColor:q,secondaryColor:K,accentColor:q,fontFamily:(N==null?void 0:N.font_family)||"Inter",propertyAddress:te.propertyAddress,propertyCity:te.propertyCity,propertyState:te.propertyState,propertyPrice:parseFloat(te.propertyPrice)||0,bedrooms:parseInt(te.bedrooms)||0,bathrooms:parseFloat(te.bathrooms)||0,squareFeet:parseInt(te.squareFeet)||0,photoUrl:z,agentName:(h==null?void 0:h.name)||"Agent Name",agentPhone:(h==null?void 0:h.phone)||"",agentEmail:(e==null?void 0:e.email)||"",agentPhoto:l||"",brokerageName:"",openHouseDate:te.openHouseDate,openHouseTime:te.openHouseTime,originalPrice:te.originalPrice?parseFloat(te.originalPrice):void 0}),ie=async he=>{if(le.current){L(!0);try{const xe=le.current.querySelector("[data-template]");if(!xe)throw new Error("Template not found");const be={portrait:{width:1080,height:1350},square:{width:1080,height:1080},story:{width:1080,height:1920}},Oe=.3,Te=be[he],Ve=await kZt(xe,{width:Te.width*Oe,height:Te.height*Oe,pixelRatio:1/Oe,cacheBust:!0}),Fe=document.createElement("a");Fe.download=`listing-${b==null?void 0:b.slug}-${he}-${Date.now()}.png`,Fe.href=Ve,Fe.click(),b&&N&&a.mutate({categoryId:b.id,styleId:N.id,propertyAddress:te.propertyAddress,propertyCity:te.propertyCity,propertyState:te.propertyState,propertyPrice:parseFloat(te.propertyPrice)||void 0,bedrooms:parseInt(te.bedrooms)||void 0,bathrooms:parseFloat(te.bathrooms)||void 0,squareFeet:parseInt(te.squareFeet)||void 0,photoUrl:z,formatsDownloaded:[he]}),ze.success(`Downloaded ${nT[he].label} format!`)}catch(xe){console.error("Download error:",xe),ze.error("Failed to download image")}finally{L(!1)}}},fe=async()=>{const he=["portrait","square","story"];for(const xe of he)E(xe),await new Promise(be=>setTimeout(be,500)),await ie(xe)},de=()=>{switch(x){case"category":return!!b;case"style":return!!N;case"details":return te.propertyAddress&&te.propertyPrice&&z;default:return!0}},ye=()=>{const he=["category","style","details","preview"],xe=he.indexOf(x);xe{const he=["category","style","details","preview"],xe=he.indexOf(x);xe>0&&y(he[xe-1])},Ne=()=>r.jsx("div",{className:"flex items-center justify-center gap-2 mb-8",children:["category","style","details","preview"].map((he,xe)=>r.jsxs(rt.Fragment,{children:[r.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ${x===he?"bg-primary text-primary-foreground":we.indexOf(x)>xe?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"}`,children:xe+1}),xe<3&&r.jsx("div",{className:`w-12 h-0.5 ${we.indexOf(x)>xe?"bg-primary":"bg-muted"}`})]},he))}),we=["category","style","details","preview"];return n||i?r.jsxs("div",{className:"space-y-6",children:[r.jsx(Pr,{className:"h-8 w-64 mx-auto"}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[1,2,3,4,5].map(he=>r.jsx(Pr,{className:"h-32"},he))})]}):r.jsxs("div",{className:"max-w-4xl mx-auto",children:[Ne(),x==="category"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"What type of announcement?"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose the category that matches your listing status"})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:t==null?void 0:t.map(he=>r.jsx(Ge,{className:`cursor-pointer transition-all hover:shadow-md ${(b==null?void 0:b.id)===he.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>j(he),children:r.jsxs(Xe,{className:"p-6 text-center",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center text-primary",children:RZt[he.icon||"Home"]}),r.jsx("h3",{className:"font-semibold",children:he.name})]})},he.id))})]}),x==="style"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Choose your layout & colors"}),r.jsx("p",{className:"text-muted-foreground",children:"Select a layout style and customize your brand colors"})]}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-6",children:[r.jsx("h3",{className:"font-semibold mb-4",children:"Your Brand Colors"}),r.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx(Ue,{className:"mb-2 block",children:"Primary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:q,onChange:he=>H(he.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(at,{value:q,onChange:he=>H(he.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for headers, badges, and accents"})]}),r.jsxs("div",{children:[r.jsx(Ue,{className:"mb-2 block",children:"Secondary Color"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"color",value:K,onChange:he=>Z(he.target.value),className:"w-12 h-12 rounded-lg border-2 border-border cursor-pointer",style:{padding:0}}),r.jsx(at,{value:K,onChange:he=>Z(he.target.value),className:"flex-1 font-mono uppercase",maxLength:7})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Used for backgrounds and contrast"})]})]}),r.jsxs("div",{className:"mt-4 p-4 rounded-lg border flex items-center gap-4",children:[r.jsx("div",{className:"w-16 h-16 rounded-lg flex items-center justify-center text-sm font-bold",style:{backgroundColor:q,color:K},children:"Preview"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This is how your primary and secondary colors will look together"})]})]})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-4 text-center",children:"Choose Layout Style"}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:s==null?void 0:s.map(he=>r.jsxs(Ge,{className:`cursor-pointer transition-all hover:shadow-md overflow-hidden ${(N==null?void 0:N.id)===he.id?"ring-2 ring-primary border-primary":""}`,onClick:()=>C(he),children:[r.jsx("div",{className:"h-32 flex items-center justify-center text-white font-bold",style:{background:`linear-gradient(135deg, ${q} 0%, ${q}cc 100%)`},children:r.jsx("span",{className:"text-lg",children:he.name})}),r.jsxs(Xe,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:he.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:he.description})]})]},he.id))})]})]}),x==="details"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Add listing details"}),r.jsx("p",{className:"text-muted-foreground",children:"Enter the property information and upload a photo"})]}),o&&o.length>0&&r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Ue,{className:"mb-2 block",children:"Quick fill from your listings"}),r.jsxs("select",{className:"w-full p-2 border rounded-md",onChange:he=>ne(he.target.value),defaultValue:"",children:[r.jsx("option",{value:"",children:"Select a listing..."}),o.map(he=>r.jsxs("option",{value:he.id,children:[he.property_address,", ",he.city]},he.id))]})]})}),r.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4",children:[r.jsx(Ue,{className:"mb-2 block",children:"Property Photo *"}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center cursor-pointer hover:border-primary transition-colors",onClick:()=>{var he;return(he=document.getElementById("photo-upload"))==null?void 0:he.click()},children:[z?r.jsx("img",{src:z,alt:"Preview",className:"w-full h-48 object-cover rounded"}):r.jsxs("div",{className:"py-8",children:[r.jsx(no,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to upload photo"})]}),r.jsx("input",{id:"photo-upload",type:"file",accept:"image/*",className:"hidden",onChange:ve})]})]})}),r.jsx(Ge,{children:r.jsxs(Xe,{className:"p-4 space-y-4",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Street Address *"}),r.jsx(at,{value:te.propertyAddress,onChange:he=>ae({...te,propertyAddress:he.target.value}),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"City"}),r.jsx(at,{value:te.propertyCity,onChange:he=>ae({...te,propertyCity:he.target.value}),placeholder:"Austin"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"State"}),r.jsx(at,{value:te.propertyState,onChange:he=>ae({...te,propertyState:he.target.value}),placeholder:"TX"})]})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Price *"}),r.jsx(at,{type:"number",value:te.propertyPrice,onChange:he=>ae({...te,propertyPrice:he.target.value}),placeholder:"450000"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Beds"}),r.jsx(at,{type:"number",value:te.bedrooms,onChange:he=>ae({...te,bedrooms:he.target.value}),placeholder:"3"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Baths"}),r.jsx(at,{type:"number",step:"0.5",value:te.bathrooms,onChange:he=>ae({...te,bathrooms:he.target.value}),placeholder:"2"})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Sq Ft"}),r.jsx(at,{type:"number",value:te.squareFeet,onChange:he=>ae({...te,squareFeet:he.target.value}),placeholder:"2000"})]})]}),(b==null?void 0:b.slug)==="open-house"&&r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx(Ue,{children:"Open House Date"}),r.jsx(at,{type:"date",value:te.openHouseDate,onChange:he=>ae({...te,openHouseDate:he.target.value})})]}),r.jsxs("div",{children:[r.jsx(Ue,{children:"Time"}),r.jsx(at,{value:te.openHouseTime,onChange:he=>ae({...te,openHouseTime:he.target.value}),placeholder:"2-4 PM"})]})]}),(b==null?void 0:b.slug)==="price-drop"&&r.jsxs("div",{children:[r.jsx(Ue,{children:"Original Price"}),r.jsx(at,{type:"number",value:te.originalPrice,onChange:he=>ae({...te,originalPrice:he.target.value}),placeholder:"500000"})]})]})})]})]}),x==="preview"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("h2",{className:"text-2xl font-bold mb-2",children:"Preview & Download"}),r.jsx("p",{className:"text-muted-foreground",children:"Choose your format and download your listing graphic"})]}),r.jsx(ba,{value:A,onValueChange:he=>E(he),className:"w-full",children:r.jsx(fa,{className:"grid w-full grid-cols-4",children:Object.entries(nT).map(([he,xe])=>r.jsxs(ln,{value:he,className:"gap-2",children:[xe.icon,r.jsx("span",{className:"hidden sm:inline",children:xe.label})]},he))})}),r.jsxs("div",{className:"flex justify-center gap-2 mb-4",children:[r.jsx(Rt,{variant:"secondary",children:nT[A].dimensions}),r.jsx(Rt,{variant:"outline",children:nT[A].ratio})]}),r.jsx("div",{className:"flex justify-center",ref:le,children:r.jsx("div",{"data-template":!0,className:"shadow-2xl rounded-lg overflow-hidden",children:r.jsx(DZt,{templateKey:(N==null?void 0:N.template_key)||"modern-minimal",data:ge(),format:A})})}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(ee,{size:"lg",onClick:()=>ie(A),disabled:T,children:[T?r.jsx(nn,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download ",nT[A].label]}),r.jsxs(ee,{size:"lg",variant:"outline",onClick:fe,disabled:T,children:[r.jsx(Va,{className:"h-4 w-4 mr-2"}),"Download All Formats"]})]})]}),r.jsxs("div",{className:"flex justify-between mt-8 pt-6 border-t",children:[r.jsxs(ee,{variant:"outline",onClick:Ie,disabled:x==="category",children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Back"]}),x!=="preview"&&r.jsxs(ee,{onClick:ye,disabled:!de(),children:["Continue",r.jsx(Zo,{className:"h-4 w-4 ml-2"})]})]})]})}function zZt(){const{isAdmin:e}=zr();return e?r.jsxs(Or,{children:[r.jsxs(np,{children:[r.jsx("title",{children:"Listing Swag | LevelUp"}),r.jsx("meta",{name:"description",content:"Create stunning listing graphics for your properties"})]}),r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/90 to-primary/80 p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('/placeholder.svg')] opacity-5"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Cs,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm font-medium uppercase tracking-wider opacity-90",children:"Marketing Tools"})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Listing Swag"}),r.jsx("p",{className:"text-lg opacity-90 max-w-2xl mb-6",children:"Create beautiful, professional listing graphics in seconds. Choose from stunning templates and download in multiple formats."}),r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(hd,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Unique Styles"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Do,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"4 Export Formats"})]}),r.jsxs("div",{className:"flex items-center gap-2 bg-white/10 rounded-lg px-4 py-2",children:[r.jsx(Va,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:"Instant Download"})]})]})]})]}),r.jsx(FZt,{})]})]}):r.jsx(nee,{to:"/dashboard",replace:!0})}const BZt=()=>{const e=Nm();return I.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gray-100",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),r.jsx("p",{className:"mb-4 text-xl text-gray-600",children:"Oops! Page not found"}),r.jsx("a",{href:"/",className:"text-blue-500 underline hover:text-blue-700",children:"Return to Home"})]})})},$Zt=new UQe,UZt=()=>{const e=window.location.hostname;return e==="listings.relevelup.com"||e.startsWith("listings.")},qZt=()=>{const e=window.location.hostname;return e==="cards.relevelup.com"||e.startsWith("cards.")},VZt=()=>r.jsx(GQe,{client:$Zt,children:r.jsx(YEe,{children:r.jsxs(xI,{children:[r.jsx(lYe,{}),r.jsx(BYe,{}),r.jsx(aet,{children:r.jsx(fnt,{children:r.jsxs(pnt,{children:[r.jsx(mnt,{}),r.jsx(wst,{}),qZt()?r.jsx(tat,{}):UZt()?r.jsx(lit,{}):r.jsxs(QJe,{children:[r.jsx(an,{path:"/",element:r.jsx(hat,{})}),r.jsx(an,{path:"/privacy-policy",element:r.jsx(fat,{})}),r.jsx(an,{path:"/terms-of-service",element:r.jsx(pat,{})}),r.jsx(an,{path:"/data-deletion",element:r.jsx(mat,{})}),r.jsx(an,{path:"/public/listings",element:r.jsx(m6e,{})}),r.jsx(an,{path:"/public/listing/:slugOrId",element:r.jsx(jft,{})}),r.jsx(an,{path:"/card/:slug",element:r.jsx(kft,{})}),r.jsx(an,{path:"/auth",element:r.jsx(Hat,{})}),r.jsx(an,{path:"/subscription-success",element:r.jsx(Wat,{})}),r.jsx(an,{path:"/subscription",element:r.jsx(Sn,{children:r.jsx(Eht,{})})}),r.jsx(an,{path:"/share/video",element:r.jsx(vft,{}),children:r.jsx(an,{path:":shareToken",element:r.jsx(yft,{})})}),r.jsx(an,{path:"/og/video/:token",element:r.jsx(_ft,{})}),r.jsx(an,{path:"/setup-brokerage",element:r.jsx(Sn,{children:r.jsx(Iht,{})})}),r.jsx(an,{path:"/claim-account",element:r.jsx(vke,{})}),r.jsx(an,{path:"/claim",element:r.jsx(vke,{})}),r.jsx(an,{path:"/join",element:r.jsx(Pht,{})}),r.jsx(an,{path:"/trial",element:r.jsx(Vht,{})}),r.jsx(an,{path:"/trial/success",element:r.jsx(Hht,{})}),r.jsx(an,{path:"/dashboard",element:r.jsx(Sn,{children:r.jsx(Mpt,{})})}),r.jsx(an,{path:"/profile",element:r.jsx(Sn,{children:r.jsx(lmt,{})})}),r.jsx(an,{path:"/apps",element:r.jsx(Sn,{children:r.jsx(bmt,{})})}),r.jsx(an,{path:"/admin",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(vyt,{})})}),r.jsx(an,{path:"/admin/apps",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(wyt,{})})}),r.jsx(an,{path:"/admin/members",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Nyt,{})})}),r.jsx(an,{path:"/admin/invite-codes",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Syt,{})})}),r.jsx(an,{path:"/admin/events",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(_wt,{})})}),r.jsx(an,{path:"/events",element:r.jsx(Sn,{children:r.jsx(ymt,{})})}),r.jsx(an,{path:"/events/:eventId",element:r.jsx(Sn,{children:r.jsx(_mt,{})})}),r.jsx(an,{path:"/templates",element:r.jsx(Sn,{children:r.jsx(wmt,{})})}),r.jsx(an,{path:"/templates/:templateId",element:r.jsx(Sn,{children:r.jsx(Smt,{})})}),r.jsx(an,{path:"/admin/templates",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(bwt,{})})}),r.jsx(an,{path:"/academy",element:r.jsx(Sn,{children:r.jsx(Cmt,{})})}),r.jsx(an,{path:"/academy/:videoId",element:r.jsx(Sn,{children:r.jsx(Tmt,{})})}),r.jsx(an,{path:"/admin/academy",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(jwt,{})})}),r.jsx(an,{path:"/toolbox",element:r.jsx(Sn,{children:r.jsx(Amt,{})})}),r.jsx(an,{path:"/toolbox/:kitId",element:r.jsx(Sn,{children:r.jsx(Emt,{})})}),r.jsx(an,{path:"/admin/toolbox",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(kwt,{})})}),r.jsx(an,{path:"/social-swag",element:r.jsx(Sn,{children:r.jsx(Imt,{})})}),r.jsx(an,{path:"/social-swag-2",element:r.jsx(Sn,{children:r.jsx(qxt,{})})}),r.jsx(an,{path:"/social-swag/:swagId",element:r.jsx(Sn,{children:r.jsx(Vxt,{})})}),r.jsx(an,{path:"/social-connections",element:r.jsx(Sn,{children:r.jsx(_Kt,{})})}),r.jsx(an,{path:"/social-connections/callback",element:r.jsx(Sn,{children:r.jsx(bKt,{})})}),r.jsx(an,{path:"/social-connections/linkedin-callback",element:r.jsx(Sn,{children:r.jsx(jKt,{})})}),r.jsx(an,{path:"/social-connections/google-callback",element:r.jsx(Sn,{children:r.jsx(wKt,{})})}),r.jsx(an,{path:"/admin/social-swag",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Nwt,{})})}),r.jsx(an,{path:"/admin/social-swag-2",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Swt,{})})}),r.jsx(an,{path:"/community",element:r.jsx(Sn,{children:r.jsx(cyt,{})})}),r.jsx(an,{path:"/support",element:r.jsx(Sn,{children:r.jsx(dyt,{})})}),r.jsx(an,{path:"/admin/community",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Cwt,{})})}),r.jsx(an,{path:"/admin/support-tickets",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Owt,{})})}),r.jsx(an,{path:"/admin/email-templates",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Fwt,{})})}),r.jsx(an,{path:"/admin/analytics",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Iwt,{})})}),r.jsx(an,{path:"/admin/brokerage-resources",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Pwt,{})})}),r.jsx(an,{path:"/admin/dashboard-management",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(Lwt,{})})}),r.jsx(an,{path:"/brokerage/dashboard",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(Zwt,{})})}),r.jsx(an,{path:"/my-brokerage",element:r.jsx(Sn,{children:r.jsx(tjt,{})})}),r.jsx(an,{path:"/brokerage-resources",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(gyt,{})})}),r.jsx(an,{path:"/brokerage-resources/:resourceId",element:r.jsx(Sn,{requireBrokerageManager:!0,children:r.jsx(xyt,{})})}),r.jsx(an,{path:"/newsletters",element:r.jsx(Sn,{children:r.jsx(rjt,{})})}),r.jsx(an,{path:"/newsletters/:id",element:r.jsx(Sn,{children:r.jsx(sjt,{})})}),r.jsx(an,{path:"/wishlist",element:r.jsx(Sn,{children:r.jsx(ojt,{})})}),r.jsx(an,{path:"/wishlist/:itemId",element:r.jsx(Sn,{children:r.jsx(ljt,{})})}),r.jsx(an,{path:"/admin/wishlist",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(cjt,{})})}),r.jsx(an,{path:"/admin/levelup-brief",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(djt,{})})}),r.jsx(an,{path:"/admin/newsletters",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ajt,{})})}),r.jsx(an,{path:"/admin/additional-services",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(ujt,{})})}),r.jsx(an,{path:"/admin/discounts",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(hjt,{})})}),r.jsx(an,{path:"/admin/subscriptions",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(fjt,{})})}),r.jsx(an,{path:"/admin/referrals",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(pjt,{})})}),r.jsx(an,{path:"/admin/onboarding-checklist",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(gjt,{})})}),r.jsx(an,{path:"/admin/marketplace",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(eKt,{})})}),r.jsx(an,{path:"/admin/agent-points",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(NGt,{})})}),r.jsx(an,{path:"/admin/reward-store",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(mKt,{})})}),r.jsx(an,{path:"/admin/integrations",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(gKt,{})})}),r.jsx(an,{path:"/admin/integrations/callback",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(vKt,{})})}),r.jsx(an,{path:"/reward-store",element:r.jsx(Sn,{children:r.jsx(EKt,{})})}),r.jsx(an,{path:"/additional-services",element:r.jsx(Sn,{children:r.jsx(Cjt,{})})}),r.jsx(an,{path:"/additional-services/:serviceId",element:r.jsx(Sn,{children:r.jsx(Mjt,{})})}),r.jsx(an,{path:"/ai-toolkit",element:r.jsx(Sn,{children:r.jsx(Tjt,{})})}),r.jsx(an,{path:"/listing-swag",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(zZt,{})})}),r.jsx(an,{path:"/mission-control",element:r.jsx(Sn,{children:r.jsx(Fjt,{})})}),r.jsx(an,{path:"/mission-control/contacts",element:r.jsx(Sn,{children:r.jsx(Xjt,{})})}),r.jsx(an,{path:"/mission-control/contacts/:contactId",element:r.jsx(Sn,{children:r.jsx(hkt,{})})}),r.jsx(an,{path:"/mission-control/plans",element:r.jsx(Sn,{children:r.jsx(fkt,{})})}),r.jsx(an,{path:"/mission-control/popbys",element:r.jsx(Sn,{children:r.jsx(gkt,{})})}),r.jsx(an,{path:"/mission-control/popbys/map",element:r.jsx(Sn,{children:r.jsx(ykt,{})})}),r.jsx(an,{path:"/admin/notification-settings",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(yKt,{})})}),r.jsx(an,{path:"/admin/agent-os",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(yjt,{})})}),r.jsx(an,{path:"/mission-control/listings",element:r.jsx(Sn,{children:r.jsx(tWt,{})})}),r.jsx(an,{path:"/mission-control/listings/new",element:r.jsx(Sn,{children:r.jsx(y5e,{})})}),r.jsx(an,{path:"/mission-control/listings/:listingId",element:r.jsx(Sn,{children:r.jsx(gWt,{})})}),r.jsx(an,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Sn,{children:r.jsx(y5e,{})})}),r.jsx(an,{path:"/admin/listing-exchange",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(vGt,{})})}),r.jsx(an,{path:"/mission-control/pipeline",element:r.jsx(Sn,{children:r.jsx(UWt,{})})}),r.jsx(an,{path:"/mission-control/my-card",element:r.jsx(Sn,{children:r.jsx(lGt,{})})}),r.jsx(an,{path:"/mission-control/scorecard",element:r.jsx(Sn,{children:r.jsx(GHt,{})})}),r.jsx(an,{path:"/admin/scorecard",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(gGt,{})})}),r.jsx(an,{path:"/admin/scorecard/:userId",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(yGt,{})})}),r.jsx(an,{path:"/admin/membership-reviews",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(_Gt,{})})}),r.jsx(an,{path:"/admin/weekly-digest",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(jGt,{})})}),r.jsx(an,{path:"/mission-control/video/record",element:r.jsx(Sn,{children:r.jsx(kWt,{})})}),r.jsx(an,{path:"/mission-control/video-library",element:r.jsx(Sn,{children:r.jsx(MWt,{})})}),r.jsx(an,{path:"/marketplace",element:r.jsx(Sn,{children:r.jsx(kKt,{})})}),r.jsx(an,{path:"/marketplace/:productId",element:r.jsx(Sn,{children:r.jsx(NKt,{})})}),r.jsx(an,{path:"/marketplace/cart",element:r.jsx(Sn,{children:r.jsx(SKt,{})})}),r.jsx(an,{path:"/marketplace/orders",element:r.jsx(Sn,{children:r.jsx(CKt,{})})}),r.jsx(an,{path:"/marketplace/orders/:orderId",element:r.jsx(Sn,{children:r.jsx(TKt,{})})}),r.jsx(an,{path:"/marketplace/success",element:r.jsx(Sn,{children:r.jsx(AKt,{})})}),r.jsx(an,{path:"/admin/agent-cards",element:r.jsx(Sn,{requireAdmin:!0,children:r.jsx(SGt,{})})}),r.jsx(an,{path:"*",element:r.jsx(BZt,{})})]}),")"]})})})]})})});nAe(document.getElementById("root")).render(r.jsx(VZt,{}));