var zKe=Object.defineProperty;var iwe=e=>{throw TypeError(e)};var BKe=(e,t,n)=>t in e?zKe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Jn=(e,t,n)=>BKe(e,typeof t!="symbol"?t+"":t,n),Rle=(e,t,n)=>t.has(e)||iwe("Cannot "+n);var tr=(e,t,n)=>(Rle(e,t,"read from private field"),n?n.call(e):t.get(e)),xa=(e,t,n)=>t.has(e)?iwe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ys=(e,t,n,s)=>(Rle(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),gi=(e,t,n)=>(Rle(e,t,"access private method"),n);var jL=(e,t,n,s)=>({set _(a){ys(e,t,a,n)},get _(){return tr(e,t,s)}});function $Ke(e,t){for(var n=0;ns[a]})}}}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 a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const o of a)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(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var Qx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function VTe(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 a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}),n}var HTe={exports:{}},Jne={},WTe={exports:{}},Bi={};/** * @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 BI=Symbol.for("react.element"),UKe=Symbol.for("react.portal"),qKe=Symbol.for("react.fragment"),VKe=Symbol.for("react.strict_mode"),HKe=Symbol.for("react.profiler"),WKe=Symbol.for("react.provider"),GKe=Symbol.for("react.context"),KKe=Symbol.for("react.forward_ref"),ZKe=Symbol.for("react.suspense"),YKe=Symbol.for("react.memo"),XKe=Symbol.for("react.lazy"),owe=Symbol.iterator;function QKe(e){return e===null||typeof e!="object"?null:(e=owe&&e[owe]||e["@@iterator"],typeof e=="function"?e:null)}var GTe={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},KTe=Object.assign,ZTe={};function m3(e,t,n){this.props=e,this.context=t,this.refs=ZTe,this.updater=n||GTe}m3.prototype.isReactComponent={};m3.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")};m3.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function YTe(){}YTe.prototype=m3.prototype;function rge(e,t,n){this.props=e,this.context=t,this.refs=ZTe,this.updater=n||GTe}var nge=rge.prototype=new YTe;nge.constructor=rge;KTe(nge,m3.prototype);nge.isPureReactComponent=!0;var lwe=Array.isArray,XTe=Object.prototype.hasOwnProperty,sge={current:null},QTe={key:!0,ref:!0,__self:!0,__source:!0};function JTe(e,t,n){var s,a={},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)XTe.call(t,s)&&!QTe.hasOwnProperty(s)&&(a[s]=t[s]);var i=arguments.length-2;if(i===1)a.children=n;else if(1>>1,we=ue[_e];if(0>>1;_ea(Me,Te))Iea($e,Me)?(ue[_e]=$e,ue[Ie]=Te,_e=Ie):(ue[_e]=Me,ue[Xe]=Te,_e=Xe);else if(Iea($e,Te))ue[_e]=$e,ue[Ie]=Te,_e=Ie;else break e}}return xe}function a(ue,xe){var Te=ue.sortIndex-xe.sortIndex;return Te!==0?Te:ue.id-xe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,i=l.now();e.unstable_now=function(){return l.now()-i}}var u=[],m=[],x=1,y=null,v=3,b=!1,N=!1,k=!1,M=typeof setTimeout=="function"?setTimeout:null,I=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 P(ue){for(var xe=n(m);xe!==null;){if(xe.callback===null)s(m);else if(xe.startTime<=ue)s(m),xe.sortIndex=xe.expirationTime,t(u,xe);else break;xe=n(m)}}function F(ue){if(k=!1,P(ue),!N)if(n(u)!==null)N=!0,se(D);else{var xe=n(m);xe!==null&&me(F,xe.startTime-ue)}}function D(ue,xe){N=!1,k&&(k=!1,I(W),W=-1),b=!0;var Te=v;try{for(P(xe),y=n(u);y!==null&&(!(y.expirationTime>xe)||ue&&!ae());){var _e=y.callback;if(typeof _e=="function"){y.callback=null,v=y.priorityLevel;var we=_e(y.expirationTime<=xe);xe=e.unstable_now(),typeof we=="function"?y.callback=we:y===n(u)&&s(u),P(xe)}else s(u);y=n(u)}if(y!==null)var ve=!0;else{var Xe=n(m);Xe!==null&&me(F,Xe.startTime-xe),ve=!1}return ve}finally{y=null,v=Te,b=!1}}var U=!1,V=null,W=-1,G=5,ee=-1;function ae(){return!(e.unstable_now()-eeue||125_e?(ue.sortIndex=Te,t(m,ue),n(u)===null&&ue===n(m)&&(k?(I(W),W=-1):k=!0,me(F,Te-_e))):(ue.sortIndex=we,t(u,ue),N||b||(N=!0,se(D))),ue},e.unstable_shouldYield=ae,e.unstable_wrapCallback=function(ue){var xe=v;return function(){var Te=v;v=xe;try{return ue.apply(this,arguments)}finally{v=Te}}}})(sAe);nAe.exports=sAe;var cZe=nAe.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 dZe=A,jm=cZe;function An(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"),yue=Object.prototype.hasOwnProperty,uZe=/^[: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]*$/,dwe={},uwe={};function hZe(e){return yue.call(uwe,e)?!0:yue.call(dwe,e)?!1:uZe.test(e)?uwe[e]=!0:(dwe[e]=!0,!1)}function mZe(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 fZe(e,t,n,s){if(t===null||typeof t>"u"||mZe(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 ih(e,t,n,s,a,o,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=l}var iu={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){iu[e]=new ih(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];iu[t]=new ih(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){iu[e]=new ih(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){iu[e]=new ih(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){iu[e]=new ih(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){iu[e]=new ih(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){iu[e]=new ih(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){iu[e]=new ih(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){iu[e]=new ih(e,5,!1,e.toLowerCase(),null,!1,!1)});var oge=/[\-:]([a-z])/g;function lge(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(oge,lge);iu[t]=new ih(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(oge,lge);iu[t]=new ih(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(oge,lge);iu[t]=new ih(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){iu[e]=new ih(e,1,!1,e.toLowerCase(),null,!1,!1)});iu.xlinkHref=new ih("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){iu[e]=new ih(e,1,!1,e.toLowerCase(),null,!0,!0)});function cge(e,t,n,s){var a=iu.hasOwnProperty(t)?iu[t]:null;(a!==null?a.type!==0:s||!(2i||a[l]!==o[i]){var u=` `+a[l].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=l&&0<=i);break}}}finally{Ble=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?CT(e):""}function pZe(e){switch(e.tag){case 5:return CT(e.type);case 16:return CT("Lazy");case 13:return CT("Suspense");case 19:return CT("SuspenseList");case 0:case 2:case 15:return e=$le(e.type,!1),e;case 11:return e=$le(e.type.render,!1),e;case 1:return e=$le(e.type,!0),e;default:return""}}function wue(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 GS:return"Fragment";case WS:return"Portal";case vue:return"Profiler";case dge:return"StrictMode";case _ue:return"Suspense";case bue:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case oAe:return(e.displayName||"Context")+".Consumer";case iAe:return(e._context.displayName||"Context")+".Provider";case uge:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hge:return t=e.displayName||null,t!==null?t:wue(e.type)||"Memo";case H0:t=e._payload,e=e._init;try{return wue(e(t))}catch{}}return null}function gZe(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 wue(t);case 8:return t===dge?"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 cv(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function cAe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xZe(e){var t=cAe(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 a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.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 SL(e){e._valueTracker||(e._valueTracker=xZe(e))}function dAe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=cAe(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function rte(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 jue(e,t){var n=t.checked;return Hl({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function mwe(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=cv(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 uAe(e,t){t=t.checked,t!=null&&cge(e,"checked",t,!1)}function kue(e,t){uAe(e,t);var n=cv(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")?Nue(e,t.type,n):t.hasOwnProperty("defaultValue")&&Nue(e,t.type,cv(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fwe(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 Nue(e,t,n){(t!=="number"||rte(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var MT=Array.isArray;function h4(e,t,n,s){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=CL.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function iE(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var UT={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},yZe=["Webkit","ms","Moz","O"];Object.keys(UT).forEach(function(e){yZe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),UT[t]=UT[e]})});function pAe(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||UT.hasOwnProperty(e)&&UT[e]?(""+t).trim():t+"px"}function gAe(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,a=pAe(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,a):e[n]=a}}var vZe=Hl({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 Mue(e,t){if(t){if(vZe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(An(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(An(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(An(61))}if(t.style!=null&&typeof t.style!="object")throw Error(An(62))}}function Tue(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 Aue=null;function mge(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Eue=null,m4=null,f4=null;function xwe(e){if(e=qI(e)){if(typeof Eue!="function")throw Error(An(280));var t=e.stateNode;t&&(t=sse(t),Eue(e.stateNode,e.type,t))}}function xAe(e){m4?f4?f4.push(e):f4=[e]:m4=e}function yAe(){if(m4){var e=m4,t=f4;if(f4=m4=null,xwe(e),t)for(e=0;e>>=0,e===0?32:31-(AZe(e)/EZe|0)|0}var ML=64,TL=4194304;function TT(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 ite(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,a=e.suspendedLanes,o=e.pingedLanes,l=n&268435455;if(l!==0){var i=l&~a;i!==0?s=TT(i):(o&=l,o!==0&&(s=TT(o)))}else l=n&~a,l!==0?s=TT(l):o!==0&&(s=TT(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&a)&&(a=s&-s,o=t&-t,a>=o||a===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 $I(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Sp(t),e[t]=n}function OZe(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=VT),Swe=" ",Cwe=!1;function FAe(e,t){switch(e){case"keyup":return cYe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zAe(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var KS=!1;function uYe(e,t){switch(e){case"compositionend":return zAe(t);case"keypress":return t.which!==32?null:(Cwe=!0,Swe);case"textInput":return e=t.data,e===Swe&&Cwe?null:e;default:return null}}function hYe(e,t){if(KS)return e==="compositionend"||!bge&&FAe(e,t)?(e=DAe(),KO=yge=j1=null,KS=!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=Ewe(n)}}function qAe(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?qAe(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function VAe(){for(var e=window,t=rte();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=rte(e.document)}return t}function wge(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 bYe(e){var t=VAe(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&qAe(n.ownerDocument.documentElement,n)){if(s!==null&&wge(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 a=n.textContent.length,o=Math.min(s.start,a);s=s.end===void 0?o:Math.min(s.end,a),!e.extend&&o>s&&(a=s,s=o,o=a),a=Iwe(n,o);var l=Iwe(n,s);a&&l&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(a.node,a.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,ZS=null,Rue=null,WT=null,Fue=!1;function Pwe(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fue||ZS==null||ZS!==rte(s)||(s=ZS,"selectionStart"in s&&wge(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&&hE(WT,s)||(WT=s,s=cte(Rue,"onSelect"),0QS||(e.current=Vue[QS],Vue[QS]=null,QS--)}function il(e,t){QS++,Vue[QS]=e.current,e.current=t}var dv={},wu=_v(dv),Ih=_v(!1),Qj=dv;function vC(e,t){var n=e.type.contextTypes;if(!n)return dv;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in n)a[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Ph(e){return e=e.childContextTypes,e!=null}function ute(){vl(Ih),vl(wu)}function Bwe(e,t,n){if(wu.current!==dv)throw Error(An(168));il(wu,t),il(Ih,n)}function JAe(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var a in s)if(!(a in t))throw Error(An(108,gZe(e)||"Unknown",a));return Hl({},n,s)}function hte(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||dv,Qj=wu.current,il(wu,e),il(Ih,Ih.current),!0}function $we(e,t,n){var s=e.stateNode;if(!s)throw Error(An(169));n?(e=JAe(e,t,Qj),s.__reactInternalMemoizedMergedChildContext=e,vl(Ih),vl(wu),il(wu,e)):vl(Ih),il(Ih,n)}var Gx=null,ase=!1,tce=!1;function eEe(e){Gx===null?Gx=[e]:Gx.push(e)}function PYe(e){ase=!0,eEe(e)}function bv(){if(!tce&&Gx!==null){tce=!0;var e=0,t=Lo;try{var n=Gx;for(Lo=1;e>=l,a-=l,Jx=1<<32-Sp(t)+a|n<W?(G=V,V=null):G=V.sibling;var ee=v(I,V,P[W],F);if(ee===null){V===null&&(V=G);break}e&&V&&ee.alternate===null&&t(I,V),T=o(ee,T,W),U===null?D=ee:U.sibling=ee,U=ee,V=G}if(W===P.length)return n(I,V),Tl&&I_(I,W),D;if(V===null){for(;WW?(G=V,V=null):G=V.sibling;var ae=v(I,V,ee.value,F);if(ae===null){V===null&&(V=G);break}e&&V&&ae.alternate===null&&t(I,V),T=o(ae,T,W),U===null?D=ae:U.sibling=ae,U=ae,V=G}if(ee.done)return n(I,V),Tl&&I_(I,W),D;if(V===null){for(;!ee.done;W++,ee=P.next())ee=y(I,ee.value,F),ee!==null&&(T=o(ee,T,W),U===null?D=ee:U.sibling=ee,U=ee);return Tl&&I_(I,W),D}for(V=s(I,V);!ee.done;W++,ee=P.next())ee=b(V,I,W,ee.value,F),ee!==null&&(e&&ee.alternate!==null&&V.delete(ee.key===null?W:ee.key),T=o(ee,T,W),U===null?D=ee:U.sibling=ee,U=ee);return e&&V.forEach(function(oe){return t(I,oe)}),Tl&&I_(I,W),D}function M(I,T,P,F){if(typeof P=="object"&&P!==null&&P.type===GS&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case NL:e:{for(var D=P.key,U=T;U!==null;){if(U.key===D){if(D=P.type,D===GS){if(U.tag===7){n(I,U.sibling),T=a(U,P.props.children),T.return=I,I=T;break e}}else if(U.elementType===D||typeof D=="object"&&D!==null&&D.$$typeof===H0&&Vwe(D)===U.type){n(I,U.sibling),T=a(U,P.props),T.ref=XM(I,U,P),T.return=I,I=T;break e}n(I,U);break}else t(I,U);U=U.sibling}P.type===GS?(T=Cj(P.props.children,I.mode,F,P.key),T.return=I,I=T):(F=r8(P.type,P.key,P.props,null,I.mode,F),F.ref=XM(I,T,P),F.return=I,I=F)}return l(I);case WS:e:{for(U=P.key;T!==null;){if(T.key===U)if(T.tag===4&&T.stateNode.containerInfo===P.containerInfo&&T.stateNode.implementation===P.implementation){n(I,T.sibling),T=a(T,P.children||[]),T.return=I,I=T;break e}else{n(I,T);break}else t(I,T);T=T.sibling}T=cce(P,I.mode,F),T.return=I,I=T}return l(I);case H0:return U=P._init,M(I,T,U(P._payload),F)}if(MT(P))return N(I,T,P,F);if(WM(P))return k(I,T,P,F);DL(I,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,T!==null&&T.tag===6?(n(I,T.sibling),T=a(T,P),T.return=I,I=T):(n(I,T),T=lce(P,I.mode,F),T.return=I,I=T),l(I)):n(I,T)}return M}var bC=sEe(!0),aEe=sEe(!1),pte=_v(null),gte=null,t4=null,Sge=null;function Cge(){Sge=t4=gte=null}function Mge(e){var t=pte.current;vl(pte),e._currentValue=t}function Gue(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 g4(e,t){gte=e,Sge=t4=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Mh=!0),e.firstContext=null)}function vf(e){var t=e._currentValue;if(Sge!==e)if(e={context:e,memoizedValue:t,next:null},t4===null){if(gte===null)throw Error(An(308));t4=e,gte.dependencies={lanes:0,firstContext:e}}else t4=t4.next=e;return t}var nj=null;function Tge(e){nj===null?nj=[e]:nj.push(e)}function iEe(e,t,n,s){var a=t.interleaved;return a===null?(n.next=n,Tge(t)):(n.next=a.next,a.next=n),t.interleaved=n,Sy(e,s)}function Sy(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 W0=!1;function Age(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oEe(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 iy(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function D1(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,lo&2){var a=s.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t,Sy(e,n)}return a=s.interleaved,a===null?(t.next=t,Tge(s)):(t.next=a.next,a.next=t),s.interleaved=t,Sy(e,n)}function YO(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,pge(e,n)}}function Hwe(e,t){var n=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var a=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?a=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?a=o=t:o=o.next=t}else a=o=t;n={baseState:s.baseState,firstBaseUpdate:a,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 xte(e,t,n,s){var a=e.updateQueue;W0=!1;var o=a.firstBaseUpdate,l=a.lastBaseUpdate,i=a.shared.pending;if(i!==null){a.shared.pending=null;var u=i,m=u.next;u.next=null,l===null?o=m:l.next=m,l=u;var x=e.alternate;x!==null&&(x=x.updateQueue,i=x.lastBaseUpdate,i!==l&&(i===null?x.firstBaseUpdate=m:i.next=m,x.lastBaseUpdate=u))}if(o!==null){var y=a.baseState;l=0,x=m=u=null,i=o;do{var v=i.lane,b=i.eventTime;if((s&v)===v){x!==null&&(x=x.next={eventTime:b,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var N=e,k=i;switch(v=t,b=n,k.tag){case 1:if(N=k.payload,typeof N=="function"){y=N.call(b,y,v);break e}y=N;break e;case 3:N.flags=N.flags&-65537|128;case 0:if(N=k.payload,v=typeof N=="function"?N.call(b,y,v):N,v==null)break e;y=Hl({},y,v);break e;case 2:W0=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,v=a.effects,v===null?a.effects=[i]:v.push(i))}else b={eventTime:b,lane:v,tag:i.tag,payload:i.payload,callback:i.callback,next:null},x===null?(m=x=b,u=y):x=x.next=b,l|=v;if(i=i.next,i===null){if(i=a.shared.pending,i===null)break;v=i,i=v.next,v.next=null,a.lastBaseUpdate=v,a.shared.pending=null}}while(!0);if(x===null&&(u=y),a.baseState=u,a.firstBaseUpdate=m,a.lastBaseUpdate=x,t=a.shared.interleaved,t!==null){a=t;do l|=a.lane,a=a.next;while(a!==t)}else o===null&&(a.shared.lanes=0);tk|=l,e.lanes=l,e.memoizedState=y}}function Wwe(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var s=nce.transition;nce.transition={};try{e(!1),t()}finally{Lo=n,nce.transition=s}}function kEe(){return _f().memoizedState}function RYe(e,t,n){var s=F1(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},NEe(e))SEe(t,n);else if(n=iEe(e,t,n,s),n!==null){var a=Qu();Cp(n,e,s,a),CEe(n,t,s)}}function FYe(e,t,n){var s=F1(e),a={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(NEe(e))SEe(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,i=o(l,n);if(a.hasEagerState=!0,a.eagerState=i,Dp(i,l)){var u=t.interleaved;u===null?(a.next=a,Tge(t)):(a.next=u.next,u.next=a),t.interleaved=a;return}}catch{}finally{}n=iEe(e,t,a,s),n!==null&&(a=Qu(),Cp(n,e,s,a),CEe(n,t,s))}}function NEe(e){var t=e.alternate;return e===$l||t!==null&&t===$l}function SEe(e,t){GT=vte=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function CEe(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,pge(e,n)}}var _te={readContext:vf,useCallback:hu,useContext:hu,useEffect:hu,useImperativeHandle:hu,useInsertionEffect:hu,useLayoutEffect:hu,useMemo:hu,useReducer:hu,useRef:hu,useState:hu,useDebugValue:hu,useDeferredValue:hu,useTransition:hu,useMutableSource:hu,useSyncExternalStore:hu,useId:hu,unstable_isNewReconciler:!1},zYe={readContext:vf,useCallback:function(e,t){return gg().memoizedState=[e,t===void 0?null:t],e},useContext:vf,useEffect:Kwe,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,QO(4194308,4,vEe.bind(null,t,e),n)},useLayoutEffect:function(e,t){return QO(4194308,4,e,t)},useInsertionEffect:function(e,t){return QO(4,2,e,t)},useMemo:function(e,t){var n=gg();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=gg();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=RYe.bind(null,$l,e),[s.memoizedState,e]},useRef:function(e){var t=gg();return e={current:e},t.memoizedState=e},useState:Gwe,useDebugValue:Fge,useDeferredValue:function(e){return gg().memoizedState=e},useTransition:function(){var e=Gwe(!1),t=e[0];return e=DYe.bind(null,e[1]),gg().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=$l,a=gg();if(Tl){if(n===void 0)throw Error(An(407));n=n()}else{if(n=t(),Dd===null)throw Error(An(349));ek&30||uEe(s,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Kwe(mEe.bind(null,s,o,e),[e]),s.flags|=2048,_E(9,hEe.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=gg(),t=Dd.identifierPrefix;if(Tl){var n=ey,s=Jx;n=(s&~(1<<32-Sp(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=yE++,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[Ng]=t,e[pE]=s,REe(e,t,!1,!1),t.stateNode=e;e:{switch(l=Tue(n,s),n){case"dialog":fl("cancel",e),fl("close",e),a=s;break;case"iframe":case"object":case"embed":fl("load",e),a=s;break;case"video":case"audio":for(a=0;akC&&(t.flags|=128,s=!0,QM(o,!1),t.lanes=4194304)}else{if(!s)if(e=yte(l),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),QM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Tl)return mu(t),null}else 2*vc()-o.renderingStartTime>kC&&n!==1073741824&&(t.flags|=128,s=!0,QM(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=vc(),t.sibling=null,n=Rl.current,il(Rl,s?n&1|2:n&1),t):(mu(t),null);case 22:case 23:return Vge(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?rm&1073741824&&(mu(t),t.subtreeFlags&6&&(t.flags|=8192)):mu(t),null;case 24:return null;case 25:return null}throw Error(An(156,t.tag))}function GYe(e,t){switch(kge(t),t.tag){case 1:return Ph(t.type)&&ute(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wC(),vl(Ih),vl(wu),Pge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ige(t),null;case 13:if(vl(Rl),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(An(340));_C()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vl(Rl),null;case 4:return wC(),null;case 10:return Mge(t.type._context),null;case 22:case 23:return Vge(),null;case 24:return null;default:return null}}var FL=!1,xu=!1,KYe=typeof WeakSet=="function"?WeakSet:Set,js=null;function r4(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Xl(e,t,s)}else n.current=null}function rhe(e,t,n){try{n()}catch(s){Xl(e,t,s)}}var aje=!1;function ZYe(e,t){if(zue=ote,e=VAe(),wge(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 a=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,i=-1,u=-1,m=0,x=0,y=e,v=null;t:for(;;){for(var b;y!==n||a!==0&&y.nodeType!==3||(i=l+a),y!==o||s!==0&&y.nodeType!==3||(u=l+s),y.nodeType===3&&(l+=y.nodeValue.length),(b=y.firstChild)!==null;)v=y,y=b;for(;;){if(y===e)break t;if(v===n&&++m===a&&(i=l),v===o&&++x===s&&(u=l),(b=y.nextSibling)!==null)break;y=v,v=y.parentNode}y=b}n=i===-1||u===-1?null:{start:i,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bue={focusedElem:e,selectionRange:n},ote=!1,js=t;js!==null;)if(t=js,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,js=e;else for(;js!==null;){t=js;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 k=N.memoizedProps,M=N.memoizedState,I=t.stateNode,T=I.getSnapshotBeforeUpdate(t.elementType===t.type?k:op(t.type,k),M);I.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var P=t.stateNode.containerInfo;P.nodeType===1?P.textContent="":P.nodeType===9&&P.documentElement&&P.removeChild(P.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(An(163))}}catch(F){Xl(t,t.return,F)}if(e=t.sibling,e!==null){e.return=t.return,js=e;break}js=t.return}return N=aje,aje=!1,N}function KT(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,o!==void 0&&rhe(t,n,o)}a=a.next}while(a!==s)}}function lse(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 nhe(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 BEe(e){var t=e.alternate;t!==null&&(e.alternate=null,BEe(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ng],delete t[pE],delete t[que],delete t[EYe],delete t[IYe])),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 $Ee(e){return e.tag===5||e.tag===3||e.tag===4}function ije(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$Ee(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 she(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=dte));else if(s!==4&&(e=e.child,e!==null))for(she(e,t,n),e=e.sibling;e!==null;)she(e,t,n),e=e.sibling}function ahe(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(ahe(e,t,n),e=e.sibling;e!==null;)ahe(e,t,n),e=e.sibling}var Jd=null,up=!1;function L0(e,t,n){for(n=n.child;n!==null;)UEe(e,t,n),n=n.sibling}function UEe(e,t,n){if(Ig&&typeof Ig.onCommitFiberUnmount=="function")try{Ig.onCommitFiberUnmount(ese,n)}catch{}switch(n.tag){case 5:xu||r4(n,t);case 6:var s=Jd,a=up;Jd=null,L0(e,t,n),Jd=s,up=a,Jd!==null&&(up?(e=Jd,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Jd.removeChild(n.stateNode));break;case 18:Jd!==null&&(up?(e=Jd,n=n.stateNode,e.nodeType===8?ece(e.parentNode,n):e.nodeType===1&&ece(e,n),dE(e)):ece(Jd,n.stateNode));break;case 4:s=Jd,a=up,Jd=n.stateNode.containerInfo,up=!0,L0(e,t,n),Jd=s,up=a;break;case 0:case 11:case 14:case 15:if(!xu&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){a=s=s.next;do{var o=a,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&rhe(n,t,l),a=a.next}while(a!==s)}L0(e,t,n);break;case 1:if(!xu&&(r4(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){Xl(n,t,i)}L0(e,t,n);break;case 21:L0(e,t,n);break;case 22:n.mode&1?(xu=(s=xu)||n.memoizedState!==null,L0(e,t,n),xu=s):L0(e,t,n);break;default:L0(e,t,n)}}function oje(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new KYe),t.forEach(function(s){var a=sXe.bind(null,e,s);n.has(s)||(n.add(s),s.then(a,a))})}}function ep(e,t){var n=t.deletions;if(n!==null)for(var s=0;sa&&(a=l),s&=~o}if(s=a,s=vc()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*XYe(s/1960))-s,10e?16:e,k1===null)var s=!1;else{if(e=k1,k1=null,jte=0,lo&6)throw Error(An(331));var a=lo;for(lo|=4,js=e.current;js!==null;){var o=js,l=o.child;if(js.flags&16){var i=o.deletions;if(i!==null){for(var u=0;uvc()-Uge?Sj(e,0):$ge|=n),Lh(e,t)}function YEe(e,t){t===0&&(e.mode&1?(t=TL,TL<<=1,!(TL&130023424)&&(TL=4194304)):t=1);var n=Qu();e=Sy(e,t),e!==null&&($I(e,t,n),Lh(e,n))}function nXe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),YEe(e,n)}function sXe(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(An(314))}s!==null&&s.delete(t),YEe(e,n)}var XEe;XEe=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ih.current)Mh=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Mh=!1,HYe(e,t,n);Mh=!!(e.flags&131072)}else Mh=!1,Tl&&t.flags&1048576&&tEe(t,fte,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;JO(e,t),e=t.pendingProps;var a=vC(t,wu.current);g4(t,n),a=Oge(null,t,s,e,a,n);var o=Dge();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ph(s)?(o=!0,hte(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Age(t),a.updater=ose,t.stateNode=a,a._reactInternals=t,Zue(t,s,e,n),t=Que(null,t,s,!0,o,n)):(t.tag=0,Tl&&o&&jge(t),Vu(null,t,a,n),t=t.child),t;case 16:s=t.elementType;e:{switch(JO(e,t),e=t.pendingProps,a=s._init,s=a(s._payload),t.type=s,a=t.tag=iXe(s),e=op(s,e),a){case 0:t=Xue(null,t,s,e,n);break e;case 1:t=rje(null,t,s,e,n);break e;case 11:t=eje(null,t,s,e,n);break e;case 14:t=tje(null,t,s,op(s.type,e),n);break e}throw Error(An(306,s,""))}return t;case 0:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:op(s,a),Xue(e,t,s,a,n);case 1:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:op(s,a),rje(e,t,s,a,n);case 3:e:{if(LEe(t),e===null)throw Error(An(387));s=t.pendingProps,o=t.memoizedState,a=o.element,oEe(e,t),xte(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){a=jC(Error(An(423)),t),t=nje(e,t,s,n,a);break e}else if(s!==a){a=jC(Error(An(424)),t),t=nje(e,t,s,n,a);break e}else for(um=O1(t.stateNode.containerInfo.firstChild),hm=t,Tl=!0,pp=null,n=aEe(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_C(),s===a){t=Cy(e,t,n);break e}Vu(e,t,s,n)}t=t.child}return t;case 5:return lEe(t),e===null&&Wue(t),s=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,l=a.children,$ue(s,a)?l=null:o!==null&&$ue(s,o)&&(t.flags|=32),PEe(e,t),Vu(e,t,l,n),t.child;case 6:return e===null&&Wue(t),null;case 13:return OEe(e,t,n);case 4:return Ege(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=bC(t,null,s,n):Vu(e,t,s,n),t.child;case 11:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:op(s,a),eje(e,t,s,a,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,a=t.pendingProps,o=t.memoizedProps,l=a.value,il(pte,s._currentValue),s._currentValue=l,o!==null)if(Dp(o.value,l)){if(o.children===a.children&&!Ih.current){t=Cy(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var i=o.dependencies;if(i!==null){l=o.child;for(var u=i.firstContext;u!==null;){if(u.context===s){if(o.tag===1){u=iy(-1,n&-n),u.tag=2;var m=o.updateQueue;if(m!==null){m=m.shared;var x=m.pending;x===null?u.next=u:(u.next=x.next,x.next=u),m.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Gue(o.return,n,t),i.lanes|=n;break}u=u.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(An(341));l.lanes|=n,i=l.alternate,i!==null&&(i.lanes|=n),Gue(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,a.children,n),t=t.child}return t;case 9:return a=t.type,s=t.pendingProps.children,g4(t,n),a=vf(a),s=s(a),t.flags|=1,Vu(e,t,s,n),t.child;case 14:return s=t.type,a=op(s,t.pendingProps),a=op(s.type,a),tje(e,t,s,a,n);case 15:return EEe(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:op(s,a),JO(e,t),t.tag=1,Ph(s)?(e=!0,hte(t)):e=!1,g4(t,n),MEe(t,s,a),Zue(t,s,a,n),Que(null,t,s,!0,e,n);case 19:return DEe(e,t,n);case 22:return IEe(e,t,n)}throw Error(An(156,t.tag))};function QEe(e,t){return NAe(e,t)}function aXe(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 of(e,t,n,s){return new aXe(e,t,n,s)}function Wge(e){return e=e.prototype,!(!e||!e.isReactComponent)}function iXe(e){if(typeof e=="function")return Wge(e)?1:0;if(e!=null){if(e=e.$$typeof,e===uge)return 11;if(e===hge)return 14}return 2}function z1(e,t){var n=e.alternate;return n===null?(n=of(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 r8(e,t,n,s,a,o){var l=2;if(s=e,typeof e=="function")Wge(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case GS:return Cj(n.children,a,o,t);case dge:l=8,a|=8;break;case vue:return e=of(12,n,t,a|2),e.elementType=vue,e.lanes=o,e;case _ue:return e=of(13,n,t,a),e.elementType=_ue,e.lanes=o,e;case bue:return e=of(19,n,t,a),e.elementType=bue,e.lanes=o,e;case lAe:return dse(n,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case iAe:l=10;break e;case oAe:l=9;break e;case uge:l=11;break e;case hge:l=14;break e;case H0:l=16,s=null;break e}throw Error(An(130,e==null?e:typeof e,""))}return t=of(l,n,t,a),t.elementType=e,t.type=s,t.lanes=o,t}function Cj(e,t,n,s){return e=of(7,e,s,t),e.lanes=n,e}function dse(e,t,n,s){return e=of(22,e,s,t),e.elementType=lAe,e.lanes=n,e.stateNode={isHidden:!1},e}function lce(e,t,n){return e=of(6,e,null,t),e.lanes=n,e}function cce(e,t,n){return t=of(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function oXe(e,t,n,s,a){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=qle(0),this.expirationTimes=qle(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qle(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Gge(e,t,n,s,a,o,l,i,u){return e=new oXe(e,t,n,i,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=of(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Age(o),e}function lXe(e,t,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rIe)}catch(e){console.error(e)}}rIe(),rAe.exports=Cm;var Th=rAe.exports;const Xge=eo(Th);var nIe,pje=Th;nIe=pje.createRoot,pje.hydrateRoot;const mXe=1,fXe=1e6;let dce=0;function pXe(){return dce=(dce+1)%Number.MAX_SAFE_INTEGER,dce.toString()}const uce=new Map,gje=e=>{if(uce.has(e))return;const t=setTimeout(()=>{uce.delete(e),XT({type:"REMOVE_TOAST",toastId:e})},fXe);uce.set(e,t)},gXe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,mXe)};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?gje(n):e.toasts.forEach(s=>{gje(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)}}},n8=[];let s8={toasts:[]};function XT(e){s8=gXe(s8,e),n8.forEach(t=>{t(s8)})}function Sa({...e}){const t=pXe(),n=a=>XT({type:"UPDATE_TOAST",toast:{...a,id:t}}),s=()=>XT({type:"DISMISS_TOAST",toastId:t});return XT({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||s()}}}),{id:t,dismiss:s,update:n}}function fi(){const[e,t]=A.useState(s8);return A.useEffect(()=>(n8.push(t),()=>{const n=n8.indexOf(t);n>-1&&n8.splice(n,1)}),[e]),{...e,toast:Sa,dismiss:n=>XT({type:"DISMISS_TOAST",toastId:n})}}function gn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function xje(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function My(...e){return t=>{let n=!1;const s=e.map(a=>{const o=xje(a,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a{const{children:l,...i}=o,u=A.useMemo(()=>i,Object.values(i));return r.jsx(n.Provider,{value:u,children:l})};s.displayName=e+"Provider";function a(o){const l=A.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[s,a]}function cc(e,t=[]){let n=[];function s(o,l){const i=A.createContext(l),u=n.length;n=[...n,l];const m=y=>{var I;const{scope:v,children:b,...N}=y,k=((I=v==null?void 0:v[e])==null?void 0:I[u])||i,M=A.useMemo(()=>N,Object.values(N));return r.jsx(k.Provider,{value:M,children:b})};m.displayName=o+"Provider";function x(y,v){var k;const b=((k=v==null?void 0:v[e])==null?void 0:k[u])||i,N=A.useContext(b);if(N)return N;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${o}\``)}return[m,x]}const a=()=>{const o=n.map(l=>A.createContext(l));return function(i){const u=(i==null?void 0:i[e])||o;return A.useMemo(()=>({[`__scope${e}`]:{...i,[e]:u}}),[i,u])}};return a.scopeName=e,[s,yXe(a,...t)]}function yXe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=s.reduce((i,{useScope:u,scopeName:m})=>{const y=u(o)[`__scope${m}`];return{...i,...y}},{});return A.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function uv(e){const t=vXe(e),n=A.forwardRef((s,a)=>{const{children:o,...l}=s,i=A.Children.toArray(o),u=i.find(_Xe);if(u){const m=u.props.children,x=i.map(y=>y===u?A.Children.count(m)>1?A.Children.only(null):A.isValidElement(m)?m.props.children:null:y);return r.jsx(t,{...l,ref:a,children:A.isValidElement(m)?A.cloneElement(m,void 0,x):null})}return r.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}var Qge=uv("Slot");function vXe(e){const t=A.forwardRef((n,s)=>{const{children:a,...o}=n;if(A.isValidElement(a)){const l=wXe(a),i=bXe(o,a.props);return a.type!==A.Fragment&&(i.ref=s?My(s,l):l),A.cloneElement(a,i)}return A.Children.count(a)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sIe=Symbol("radix.slottable");function aIe(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=sIe,t}function _Xe(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sIe}function bXe(e,t){const n={...t};for(const s in t){const a=e[s],o=t[s];/^on[A-Z]/.test(s)?a&&o?n[s]=(...i)=>{const u=o(...i);return a(...i),u}:a&&(n[s]=a):s==="style"?n[s]={...a,...o}:s==="className"&&(n[s]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function wXe(e){var s,a;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=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function HI(e){const t=e+"CollectionProvider",[n,s]=cc(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=k=>{const{scope:M,children:I}=k,T=dt.useRef(null),P=dt.useRef(new Map).current;return r.jsx(a,{scope:M,itemMap:P,collectionRef:T,children:I})};l.displayName=t;const i=e+"CollectionSlot",u=uv(i),m=dt.forwardRef((k,M)=>{const{scope:I,children:T}=k,P=o(i,I),F=ca(M,P.collectionRef);return r.jsx(u,{ref:F,children:T})});m.displayName=i;const x=e+"CollectionItemSlot",y="data-radix-collection-item",v=uv(x),b=dt.forwardRef((k,M)=>{const{scope:I,children:T,...P}=k,F=dt.useRef(null),D=ca(M,F),U=o(x,I);return dt.useEffect(()=>(U.itemMap.set(F,{ref:F,...P}),()=>void U.itemMap.delete(F))),r.jsx(v,{[y]:"",ref:D,children:T})});b.displayName=x;function N(k){const M=o(e+"CollectionConsumer",k);return dt.useCallback(()=>{const T=M.collectionRef.current;if(!T)return[];const P=Array.from(T.querySelectorAll(`[${y}]`));return Array.from(M.itemMap.values()).sort((U,V)=>P.indexOf(U.ref.current)-P.indexOf(V.ref.current))},[M.collectionRef,M.itemMap])}return[{Provider:l,Slot:m,ItemSlot:b},N,s]}var jXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fn=jXe.reduce((e,t)=>{const n=uv(`Primitive.${t}`),s=A.forwardRef((a,o)=>{const{asChild:l,...i}=a,u=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...i,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Jge(e,t){e&&Th.flushSync(()=>e.dispatchEvent(t))}function sc(e){const t=A.useRef(e);return A.useEffect(()=>{t.current=e}),A.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function kXe(e,t=globalThis==null?void 0:globalThis.document){const n=sc(e);A.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var NXe="DismissableLayer",dhe="dismissableLayer.update",SXe="dismissableLayer.pointerDownOutside",CXe="dismissableLayer.focusOutside",yje,iIe=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),wv=A.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:i,...u}=e,m=A.useContext(iIe),[x,y]=A.useState(null),v=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=A.useState({}),N=ca(t,V=>y(V)),k=Array.from(m.layers),[M]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),I=k.indexOf(M),T=x?k.indexOf(x):-1,P=m.layersWithOutsidePointerEventsDisabled.size>0,F=T>=I,D=TXe(V=>{const W=V.target,G=[...m.branches].some(ee=>ee.contains(W));!F||G||(a==null||a(V),l==null||l(V),V.defaultPrevented||i==null||i())},v),U=AXe(V=>{const W=V.target;[...m.branches].some(ee=>ee.contains(W))||(o==null||o(V),l==null||l(V),V.defaultPrevented||i==null||i())},v);return kXe(V=>{T===m.layers.size-1&&(s==null||s(V),!V.defaultPrevented&&i&&(V.preventDefault(),i()))},v),A.useEffect(()=>{if(x)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(yje=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(x)),m.layers.add(x),vje(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=yje)}},[x,v,n,m]),A.useEffect(()=>()=>{x&&(m.layers.delete(x),m.layersWithOutsidePointerEventsDisabled.delete(x),vje())},[x,m]),A.useEffect(()=>{const V=()=>b({});return document.addEventListener(dhe,V),()=>document.removeEventListener(dhe,V)},[]),r.jsx(Fn.div,{...u,ref:N,style:{pointerEvents:P?F?"auto":"none":void 0,...e.style},onFocusCapture:gn(e.onFocusCapture,U.onFocusCapture),onBlurCapture:gn(e.onBlurCapture,U.onBlurCapture),onPointerDownCapture:gn(e.onPointerDownCapture,D.onPointerDownCapture)})});wv.displayName=NXe;var MXe="DismissableLayerBranch",oIe=A.forwardRef((e,t)=>{const n=A.useContext(iIe),s=A.useRef(null),a=ca(t,s);return A.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Fn.div,{...e,ref:a})});oIe.displayName=MXe;function TXe(e,t=globalThis==null?void 0:globalThis.document){const n=sc(e),s=A.useRef(!1),a=A.useRef(()=>{});return A.useEffect(()=>{const o=i=>{if(i.target&&!s.current){let u=function(){lIe(SXe,n,m,{discrete:!0})};const m={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=u,t.addEventListener("click",a.current,{once:!0})):u()}else t.removeEventListener("click",a.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function AXe(e,t=globalThis==null?void 0:globalThis.document){const n=sc(e),s=A.useRef(!1);return A.useEffect(()=>{const a=o=>{o.target&&!s.current&&lIe(CXe,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function vje(){const e=new CustomEvent(dhe);document.dispatchEvent(e)}function lIe(e,t,n,{discrete:s}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?Jge(a,o):a.dispatchEvent(o)}var EXe=wv,IXe=oIe,oc=globalThis!=null&&globalThis.document?A.useLayoutEffect:()=>{},PXe="Portal",g3=A.forwardRef((e,t)=>{var i;const{container:n,...s}=e,[a,o]=A.useState(!1);oc(()=>o(!0),[]);const l=n||a&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?Xge.createPortal(r.jsx(Fn.div,{...s,ref:t}),l):null});g3.displayName=PXe;function LXe(e,t){return A.useReducer((n,s)=>t[n][s]??n,e)}var Ac=e=>{const{present:t,children:n}=e,s=OXe(t),a=typeof n=="function"?n({present:s.isPresent}):A.Children.only(n),o=ca(s.ref,DXe(a));return typeof n=="function"||s.isPresent?A.cloneElement(a,{ref:o}):null};Ac.displayName="Presence";function OXe(e){const[t,n]=A.useState(),s=A.useRef(null),a=A.useRef(e),o=A.useRef("none"),l=e?"mounted":"unmounted",[i,u]=LXe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const m=$L(s.current);o.current=i==="mounted"?m:"none"},[i]),oc(()=>{const m=s.current,x=a.current;if(x!==e){const v=o.current,b=$L(m);e?u("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?u("UNMOUNT"):u(x&&v!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,u]),oc(()=>{if(t){let m;const x=t.ownerDocument.defaultView??window,y=b=>{const k=$L(s.current).includes(b.animationName);if(b.target===t&&k&&(u("ANIMATION_END"),!a.current)){const M=t.style.animationFillMode;t.style.animationFillMode="forwards",m=x.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=M)})}},v=b=>{b.target===t&&(o.current=$L(s.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{x.clearTimeout(m),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:A.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function $L(e){return(e==null?void 0:e.animationName)||"none"}function DXe(e){var s,a;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=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var RXe=ige[" useInsertionEffect ".trim().toString()]||oc;function rh({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,o,l]=FXe({defaultProp:t,onChange:n}),i=e!==void 0,u=i?e:a;{const x=A.useRef(e!==void 0);A.useEffect(()=>{const y=x.current;y!==i&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${i?"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=i},[i,s])}const m=A.useCallback(x=>{var y;if(i){const v=zXe(x)?x(e):x;v!==e&&((y=l.current)==null||y.call(l,v))}else o(x)},[i,e,o,l]);return[u,m]}function FXe({defaultProp:e,onChange:t}){const[n,s]=A.useState(e),a=A.useRef(n),o=A.useRef(t);return RXe(()=>{o.current=t},[t]),A.useEffect(()=>{var l;a.current!==n&&((l=o.current)==null||l.call(o,n),a.current=n)},[n,a]),[n,s,o]}function zXe(e){return typeof e=="function"}var cIe=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"}),BXe="VisuallyHidden",pse=A.forwardRef((e,t)=>r.jsx(Fn.span,{...e,ref:t,style:{...cIe,...e.style}}));pse.displayName=BXe;var $Xe=pse,exe="ToastProvider",[txe,UXe,qXe]=HI("Toast"),[dIe]=cc("Toast",[qXe]),[VXe,gse]=dIe(exe),uIe=e=>{const{__scopeToast:t,label:n="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:o=50,children:l}=e,[i,u]=A.useState(null),[m,x]=A.useState(0),y=A.useRef(!1),v=A.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${exe}\`. Expected non-empty \`string\`.`),r.jsx(txe.Provider,{scope:t,children:r.jsx(VXe,{scope:t,label:n,duration:s,swipeDirection:a,swipeThreshold:o,toastCount:m,viewport:i,onViewportChange:u,onToastAdd:A.useCallback(()=>x(b=>b+1),[]),onToastRemove:A.useCallback(()=>x(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:v,children:l})})};uIe.displayName=exe;var hIe="ToastViewport",HXe=["F8"],uhe="toast.viewportPause",hhe="toast.viewportResume",mIe=A.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:s=HXe,label:a="Notifications ({hotkey})",...o}=e,l=gse(hIe,n),i=UXe(n),u=A.useRef(null),m=A.useRef(null),x=A.useRef(null),y=A.useRef(null),v=ca(t,y,l.onViewportChange),b=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=l.toastCount>0;A.useEffect(()=>{const M=I=>{var P;s.length!==0&&s.every(F=>I[F]||I.code===F)&&((P=y.current)==null||P.focus())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[s]),A.useEffect(()=>{const M=u.current,I=y.current;if(N&&M&&I){const T=()=>{if(!l.isClosePausedRef.current){const U=new CustomEvent(uhe);I.dispatchEvent(U),l.isClosePausedRef.current=!0}},P=()=>{if(l.isClosePausedRef.current){const U=new CustomEvent(hhe);I.dispatchEvent(U),l.isClosePausedRef.current=!1}},F=U=>{!M.contains(U.relatedTarget)&&P()},D=()=>{M.contains(document.activeElement)||P()};return M.addEventListener("focusin",T),M.addEventListener("focusout",F),M.addEventListener("pointermove",T),M.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",P),()=>{M.removeEventListener("focusin",T),M.removeEventListener("focusout",F),M.removeEventListener("pointermove",T),M.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",P)}}},[N,l.isClosePausedRef]);const k=A.useCallback(({tabbingDirection:M})=>{const T=i().map(P=>{const F=P.ref.current,D=[F,...sQe(F)];return M==="forwards"?D:D.reverse()});return(M==="forwards"?T.reverse():T).flat()},[i]);return A.useEffect(()=>{const M=y.current;if(M){const I=T=>{var D,U,V;const P=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!P){const W=document.activeElement,G=T.shiftKey;if(T.target===M&&G){(D=m.current)==null||D.focus();return}const oe=k({tabbingDirection:G?"backwards":"forwards"}),pe=oe.findIndex(ne=>ne===W);hce(oe.slice(pe+1))?T.preventDefault():G?(U=m.current)==null||U.focus():(V=x.current)==null||V.focus()}};return M.addEventListener("keydown",I),()=>M.removeEventListener("keydown",I)}},[i,k]),r.jsxs(IXe,{ref:u,role:"region","aria-label":a.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&r.jsx(mhe,{ref:m,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"forwards"});hce(M)}}),r.jsx(txe.Slot,{scope:n,children:r.jsx(Fn.ol,{tabIndex:-1,...o,ref:v})}),N&&r.jsx(mhe,{ref:x,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"backwards"});hce(M)}})]})});mIe.displayName=hIe;var fIe="ToastFocusProxy",mhe=A.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=e,o=gse(fIe,n);return r.jsx(pse,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:l=>{var m;const i=l.relatedTarget;!((m=o.viewport)!=null&&m.contains(i))&&s()}})});mhe.displayName=fIe;var WI="Toast",WXe="toast.swipeStart",GXe="toast.swipeMove",KXe="toast.swipeCancel",ZXe="toast.swipeEnd",pIe=A.forwardRef((e,t)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:o,...l}=e,[i,u]=rh({prop:s,defaultProp:a??!0,onChange:o,caller:WI});return r.jsx(Ac,{present:n||i,children:r.jsx(QXe,{open:i,...l,ref:t,onClose:()=>u(!1),onPause:sc(e.onPause),onResume:sc(e.onResume),onSwipeStart:gn(e.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:gn(e.onSwipeMove,m=>{const{x,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${y}px`)}),onSwipeCancel:gn(e.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:gn(e.onSwipeEnd,m=>{const{x,y}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),u(!1)})})})});pIe.displayName=WI;var[YXe,XXe]=dIe(WI,{onClose(){}}),QXe=A.forwardRef((e,t)=>{const{__scopeToast:n,type:s="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:i,onPause:u,onResume:m,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:v,onSwipeEnd:b,...N}=e,k=gse(WI,n),[M,I]=A.useState(null),T=ca(t,ne=>I(ne)),P=A.useRef(null),F=A.useRef(null),D=a||k.duration,U=A.useRef(0),V=A.useRef(D),W=A.useRef(0),{onToastAdd:G,onToastRemove:ee}=k,ae=sc(()=>{var fe;(M==null?void 0:M.contains(document.activeElement))&&((fe=k.viewport)==null||fe.focus()),l()}),oe=A.useCallback(ne=>{!ne||ne===1/0||(window.clearTimeout(W.current),U.current=new Date().getTime(),W.current=window.setTimeout(ae,ne))},[ae]);A.useEffect(()=>{const ne=k.viewport;if(ne){const fe=()=>{oe(V.current),m==null||m()},se=()=>{const me=new Date().getTime()-U.current;V.current=V.current-me,window.clearTimeout(W.current),u==null||u()};return ne.addEventListener(uhe,se),ne.addEventListener(hhe,fe),()=>{ne.removeEventListener(uhe,se),ne.removeEventListener(hhe,fe)}}},[k.viewport,D,u,m,oe]),A.useEffect(()=>{o&&!k.isClosePausedRef.current&&oe(D)},[o,D,k.isClosePausedRef,oe]),A.useEffect(()=>(G(),()=>ee()),[G,ee]);const pe=A.useMemo(()=>M?wIe(M):null,[M]);return k.viewport?r.jsxs(r.Fragment,{children:[pe&&r.jsx(JXe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:pe}),r.jsx(YXe,{scope:n,onClose:ae,children:Th.createPortal(r.jsx(txe.ItemSlot,{scope:n,children:r.jsx(EXe,{asChild:!0,onEscapeKeyDown:gn(i,()=>{k.isFocusedToastEscapeKeyDownRef.current||ae(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Fn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":k.swipeDirection,...N,ref:T,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:gn(e.onKeyDown,ne=>{ne.key==="Escape"&&(i==null||i(ne.nativeEvent),ne.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,ae()))}),onPointerDown:gn(e.onPointerDown,ne=>{ne.button===0&&(P.current={x:ne.clientX,y:ne.clientY})}),onPointerMove:gn(e.onPointerMove,ne=>{if(!P.current)return;const fe=ne.clientX-P.current.x,se=ne.clientY-P.current.y,me=!!F.current,ue=["left","right"].includes(k.swipeDirection),xe=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,Te=ue?xe(0,fe):0,_e=ue?0:xe(0,se),we=ne.pointerType==="touch"?10:2,ve={x:Te,y:_e},Xe={originalEvent:ne,delta:ve};me?(F.current=ve,UL(GXe,y,Xe,{discrete:!1})):_je(ve,k.swipeDirection,we)?(F.current=ve,UL(WXe,x,Xe,{discrete:!1}),ne.target.setPointerCapture(ne.pointerId)):(Math.abs(fe)>we||Math.abs(se)>we)&&(P.current=null)}),onPointerUp:gn(e.onPointerUp,ne=>{const fe=F.current,se=ne.target;if(se.hasPointerCapture(ne.pointerId)&&se.releasePointerCapture(ne.pointerId),F.current=null,P.current=null,fe){const me=ne.currentTarget,ue={originalEvent:ne,delta:fe};_je(fe,k.swipeDirection,k.swipeThreshold)?UL(ZXe,b,ue,{discrete:!0}):UL(KXe,v,ue,{discrete:!0}),me.addEventListener("click",xe=>xe.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),JXe=e=>{const{__scopeToast:t,children:n,...s}=e,a=gse(WI,t),[o,l]=A.useState(!1),[i,u]=A.useState(!1);return rQe(()=>l(!0)),A.useEffect(()=>{const m=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(m)},[]),i?null:r.jsx(g3,{asChild:!0,children:r.jsx(pse,{...s,children:o&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},eQe="ToastTitle",gIe=A.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Fn.div,{...s,ref:t})});gIe.displayName=eQe;var tQe="ToastDescription",xIe=A.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Fn.div,{...s,ref:t})});xIe.displayName=tQe;var yIe="ToastAction",vIe=A.forwardRef((e,t)=>{const{altText:n,...s}=e;return n.trim()?r.jsx(bIe,{altText:n,asChild:!0,children:r.jsx(rxe,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${yIe}\`. Expected non-empty \`string\`.`),null)});vIe.displayName=yIe;var _Ie="ToastClose",rxe=A.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e,a=XXe(_Ie,n);return r.jsx(bIe,{asChild:!0,children:r.jsx(Fn.button,{type:"button",...s,ref:t,onClick:gn(e.onClick,a.onClose)})})});rxe.displayName=_Ie;var bIe=A.forwardRef((e,t)=>{const{__scopeToast:n,altText:s,...a}=e;return r.jsx(Fn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...a,ref:t})});function wIe(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),nQe(s)){const a=s.ariaHidden||s.hidden||s.style.display==="none",o=s.dataset.radixToastAnnounceExclude==="";if(!a)if(o){const l=s.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...wIe(s))}}),t}function UL(e,t,n,{discrete:s}){const a=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?Jge(a,o):a.dispatchEvent(o)}var _je=(e,t,n=0)=>{const s=Math.abs(e.x),a=Math.abs(e.y),o=s>a;return t==="left"||t==="right"?o&&s>n:!o&&a>n};function rQe(e=()=>{}){const t=sc(e);oc(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[t])}function nQe(e){return e.nodeType===e.ELEMENT_NODE}function sQe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hce(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var aQe=uIe,jIe=mIe,kIe=pIe,NIe=gIe,SIe=xIe,CIe=vIe,MIe=rxe;function TIe(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,wje=ui,x3=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return wje(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:o}=t,l=Object.keys(a).map(m=>{const x=n==null?void 0:n[m],y=o==null?void 0:o[m];if(x===null)return null;const v=bje(x)||bje(y);return a[m][v]}),i=n&&Object.entries(n).reduce((m,x)=>{let[y,v]=x;return v===void 0||(m[y]=v),m},{}),u=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((m,x)=>{let{class:y,className:v,...b}=x;return Object.entries(b).every(N=>{let[k,M]=N;return Array.isArray(M)?M.includes({...o,...i}[k]):{...o,...i}[k]===M})?[...m,y,v]:m},[]);return wje(e,l,u,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 iQe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),AIe=(...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 oQe={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 EIe=A.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:l,...i},u)=>A.createElement("svg",{ref:u,...oQe,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:AIe("lucide",a),...i},[...l.map(([m,x])=>A.createElement(m,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 q=(e,t)=>{const n=A.forwardRef(({className:s,...a},o)=>A.createElement(EIe,{ref:o,iconNode:t,className:AIe(`lucide-${iQe(e)}`,s),...a}));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 a8=q("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 i8=q("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 o8=q("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 l8=q("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 Lg=q("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 c8=q("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 d8=q("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 L_=q("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 O_=q("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 u8=q("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 D_=q("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 h8=q("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 m8=q("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 f8=q("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 p8=q("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 g8=q("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=q("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 x8=q("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 y8=q("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 v8=q("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 _8=q("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 b8=q("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 w8=q("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 j8=q("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 k8=q("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 N8=q("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 S8=q("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 C8=q("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 v4=q("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 _4=q("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 M8=q("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 T8=q("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 A8=q("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 E8=q("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 I8=q("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 P8=q("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 L8=q("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 O8=q("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 D8=q("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 R8=q("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 F8=q("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 z8=q("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 B8=q("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 $8=q("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 U8=q("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 q8=q("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 V8=q("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 H8=q("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 W8=q("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 G8=q("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 K8=q("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 QT=q("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 Z8=q("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 Y8=q("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 X8=q("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 JT=q("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 Q8=q("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 J8=q("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 eD=q("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 tD=q("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 rD=q("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 nD=q("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 sD=q("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 aD=q("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 iD=q("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 oD=q("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 lD=q("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 R_=q("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 cD=q("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 dD=q("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 uD=q("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 hD=q("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 mD=q("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 fD=q("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 pD=q("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 F_=q("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 z_=q("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 oy=q("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 gD=q("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 xD=q("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 yD=q("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 Wi=q("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 vD=q("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 _D=q("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 bD=q("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 No=q("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 wD=q("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 jD=q("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 B_=q("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 Og=q("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 kD=q("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 ND=q("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 SD=q("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 $_=q("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 CD=q("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 MD=q("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 TD=q("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 U_=q("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 df=q("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 AD=q("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 ED=q("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 ID=q("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 PD=q("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 LD=q("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 OD=q("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 Bl=q("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 DD=q("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 q_=q("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 RD=q("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 FD=q("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 zD=q("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 BD=q("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 V_=q("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 $D=q("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 UD=q("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 qD=q("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 VD=q("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 HD=q("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 WD=q("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 GD=q("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 KD=q("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 ZD=q("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 YD=q("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 XD=q("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 QD=q("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 JD=q("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 eR=q("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 tR=q("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 rR=q("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 nR=q("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 sR=q("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 aR=q("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 iR=q("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 oR=q("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 B1=q("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 lR=q("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 cR=q("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 dR=q("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 uR=q("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 hR=q("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 mR=q("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 fR=q("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 pR=q("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 gR=q("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 xR=q("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 yR=q("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 $1=q("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 vR=q("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 _R=q("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 bR=q("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 wR=q("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 jR=q("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 kR=q("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 Mj=q("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 NR=q("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 SR=q("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 Dg=q("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 H_=q("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 W_=q("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 CR=q("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 MR=q("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 TR=q("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 AR=q("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 ER=q("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 IR=q("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 PR=q("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 LR=q("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 OR=q("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 DR=q("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 RR=q("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 FR=q("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 zR=q("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 BR=q("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 $R=q("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 UR=q("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 b4=q("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 qR=q("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 VR=q("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 HR=q("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 WR=q("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 GR=q("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 KR=q("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 ZR=q("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 G_=q("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 YR=q("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 XR=q("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 QR=q("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 JR=q("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 eF=q("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 tF=q("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 rF=q("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 nF=q("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 sF=q("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 aF=q("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 eA=q("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 iF=q("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 oF=q("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 lF=q("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 cF=q("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 dF=q("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 uF=q("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 hF=q("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 mF=q("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 fF=q("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 pF=q("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 tA=q("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 gF=q("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 Mp=q("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 xF=q("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 yF=q("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 vF=q("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 w4=q("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 _F=q("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 bF=q("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 K_=q("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 wF=q("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 jF=q("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 kF=q("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 rA=q("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 NF=q("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 SF=q("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 CF=q("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 MF=q("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 Oh=q("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 TF=q("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 AF=q("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 EF=q("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 IF=q("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 PF=q("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 hi=q("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 Tj=q("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 LF=q("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 OF=q("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 DF=q("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 RF=q("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 FF=q("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 mm=q("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 zF=q("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 BF=q("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 $F=q("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 UF=q("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 qF=q("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 VF=q("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 nA=q("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 HF=q("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 Tp=q("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 WF=q("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 GF=q("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 KF=q("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 ZF=q("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 YF=q("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 XF=q("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 Aj=q("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 QF=q("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 JF=q("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 ez=q("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 tz=q("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 rz=q("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 Cs=q("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 nz=q("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 Rg=q("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 sz=q("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 az=q("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 iz=q("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 oz=q("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 lz=q("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 Z_=q("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 cz=q("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 dz=q("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 uz=q("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 hz=q("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 mz=q("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 fz=q("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 pz=q("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 gz=q("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 xz=q("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 yz=q("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 vz=q("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 _z=q("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 bz=q("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 Y_=q("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 X_=q("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 wz=q("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 jz=q("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 kz=q("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 Q_=q("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 J_=q("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 eb=q("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 Nz=q("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 tb=q("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 Sz=q("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 _c=q("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 Cz=q("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 rb=q("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 Mz=q("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 Tz=q("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 nb=q("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 sb=q("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 Az=q("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 ab=q("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 ib=q("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 ob=q("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 Ez=q("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 Iz=q("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 mi=q("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 Pz=q("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 Lz=q("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 Rd=q("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 Oz=q("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 Dz=q("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 kc=q("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 Gi=q("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 ly=q("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 Rz=q("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 Fz=q("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 zz=q("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 Bz=q("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 $z=q("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 Uz=q("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 qz=q("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 cy=q("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 Vz=q("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 Hz=q("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 Wz=q("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 Gz=q("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 Kz=q("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 yl=q("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 lb=q("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 cb=q("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 db=q("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 ub=q("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 hb=q("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 mb=q("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 fb=q("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 pb=q("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 oi=q("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 no=q("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 gb=q("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 xb=q("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 yb=q("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 vb=q("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 Zz=q("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 _b=q("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 Yz=q("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 Xz=q("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 Qz=q("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 Jz=q("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 e7=q("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 t7=q("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 r7=q("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 bb=q("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 Kx=q("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 wb=q("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 n7=q("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 jb=q("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 kb=q("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 Nb=q("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 Sb=q("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 rf=q("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 Cb=q("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 Mb=q("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 Tb=q("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 s7=q("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 Ab=q("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 Eb=q("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 Ib=q("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 bc=q("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 Ju=q("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 a7=q("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 i7=q("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 o7=q("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 sA=q("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 l7=q("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 aA=q("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 c7=q("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 d7=q("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 Pb=q("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 Lb=q("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 u7=q("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 h7=q("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 m7=q("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 f7=q("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 p7=q("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 g7=q("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 x7=q("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 y7=q("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 v7=q("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 _7=q("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 b7=q("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 w7=q("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 j7=q("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 k7=q("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 N7=q("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 S7=q("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 C7=q("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 M7=q("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 T7=q("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 Xa=q("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 A7=q("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 E7=q("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 Ob=q("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 I7=q("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 P7=q("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 L7=q("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 O7=q("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 D7=q("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 R7=q("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 F7=q("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 z7=q("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 B7=q("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 $7=q("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 U7=q("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 q7=q("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 Db=q("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 V7=q("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 H7=q("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 ty=q("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 W7=q("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 Rb=q("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 Ej=q("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 G7=q("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 K7=q("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 Ij=q("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 Z7=q("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 Y7=q("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 Fb=q("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 zb=q("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 X7=q("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 Q7=q("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 J7=q("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 e9=q("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 t9=q("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 r9=q("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 n9=q("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 s9=q("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 a9=q("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 Bb=q("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 i9=q("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 o9=q("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 l9=q("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 c9=q("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 d9=q("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 u9=q("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 h9=q("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 m9=q("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 f9=q("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 p9=q("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 Po=q("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 g9=q("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 x9=q("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 y9=q("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 v9=q("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 _9=q("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 b9=q("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 w9=q("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 j9=q("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 k9=q("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 N9=q("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 S9=q("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 C9=q("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 uf=q("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 M9=q("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 T9=q("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 A9=q("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 E9=q("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 U1=q("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 I9=q("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 P9=q("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 L9=q("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 O9=q("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 D9=q("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 R9=q("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 F9=q("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 z9=q("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 B9=q("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 $9=q("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 U9=q("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 q9=q("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 $b=q("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 V9=q("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 H9=q("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 W9=q("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 G9=q("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 K9=q("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 Z9=q("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 Y9=q("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 X9=q("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 Q9=q("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 J9=q("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 eB=q("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 tB=q("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 rB=q("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 nB=q("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 sB=q("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 aB=q("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 iB=q("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 oB=q("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 lB=q("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 Fd=q("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 cB=q("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 dB=q("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 Pj=q("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 uB=q("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 so=q("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 hB=q("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 mB=q("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 fB=q("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 pB=q("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 gB=q("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 xB=q("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 yB=q("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 vB=q("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 _B=q("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 bB=q("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 wB=q("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 jB=q("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 Ub=q("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 kB=q("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 NB=q("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 SB=q("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 j4=q("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 kg=q("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 gp=q("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 CB=q("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 MB=q("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 TB=q("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 AB=q("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 EB=q("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 IB=q("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 PB=q("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 Ss=q("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 LB=q("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 Fg=q("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 _o=q("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 au=q("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 OB=q("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 DB=q("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 RB=q("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 FB=q("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 zB=q("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 BB=q("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 $B=q("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 UB=q("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 qB=q("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 VB=q("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 qb=q("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 HB=q("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 WB=q("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 GB=q("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 Vb=q("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 Hb=q("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 Wb=q("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 Gb=q("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 KB=q("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 ZB=q("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 YB=q("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 XB=q("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 QB=q("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 Kb=q("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 JB=q("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 e$=q("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 t$=q("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 r$=q("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 q1=q("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 n$=q("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 s$=q("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 a$=q("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 i$=q("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 o$=q("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 l$=q("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 c$=q("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 d$=q("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 u$=q("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 h$=q("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 m$=q("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 Zb=q("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 Yb=q("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 f$=q("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 p$=q("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 g$=q("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 x$=q("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 y$=q("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 v$=q("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 _$=q("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 V1=q("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 b$=q("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 w$=q("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 j$=q("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 _a=q("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 k$=q("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 N$=q("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 S$=q("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 C$=q("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 M$=q("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 T$=q("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 A$=q("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 E$=q("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 I$=q("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 P$=q("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 L$=q("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 O$=q("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 D$=q("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 Td=q("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 R$=q("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 H1=q("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 F$=q("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 z$=q("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 B$=q("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 $$=q("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 U$=q("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 q$=q("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 V$=q("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 H$=q("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 dy=q("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 W$=q("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 fm=q("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 G$=q("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 K$=q("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 Z$=q("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 Lj=q("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 Y$=q("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 X$=q("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 Q$=q("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 J$=q("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 eU=q("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 bp=q("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 tU=q("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 rU=q("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 nU=q("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 sU=q("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 aU=q("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 iU=q("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 oU=q("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 lU=q("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 cU=q("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 Xb=q("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 dU=q("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 uU=q("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 hU=q("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 mU=q("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 fU=q("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 pU=q("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 gU=q("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 xU=q("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 yU=q("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 vU=q("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 _U=q("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 Ap=q("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 bU=q("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 Qb=q("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 wU=q("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 jU=q("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 kU=q("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 NU=q("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 SU=q("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 CU=q("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 MU=q("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 TU=q("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 AU=q("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 EU=q("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 IU=q("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 PU=q("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 LU=q("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 OU=q("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 DU=q("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 RU=q("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 FU=q("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 zU=q("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 BU=q("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 $U=q("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 UU=q("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 qU=q("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 VU=q("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 HU=q("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 WU=q("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 GU=q("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 KU=q("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 ZU=q("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 YU=q("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 Oj=q("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 ao=q("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 XU=q("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 QU=q("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 Jb=q("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 JU=q("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 eq=q("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 tq=q("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 rq=q("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 nq=q("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 sq=q("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 aq=q("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 iq=q("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 oq=q("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 lq=q("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 cq=q("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 dq=q("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 uq=q("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 hq=q("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 mq=q("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 fq=q("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 pq=q("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 uy=q("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 gq=q("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 xq=q("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 W1=q("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 yq=q("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 vq=q("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 e2=q("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 _q=q("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 t2=q("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 tm=q("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 bq=q("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 zg=q("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 wq=q("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 jq=q("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 kq=q("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 Nq=q("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 Sq=q("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 Cq=q("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 Mq=q("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 r2=q("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 Tq=q("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 Aq=q("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 Eq=q("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 Iq=q("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 Pq=q("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 Lq=q("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 iA=q("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 Oq=q("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 k4=q("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 Dq=q("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 Rq=q("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 oA=q("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 lA=q("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 Fq=q("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 zq=q("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 Bq=q("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 $q=q("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 Uq=q("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 qq=q("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 Vq=q("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 Hq=q("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 Wq=q("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 Gq=q("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 Kq=q("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 Zq=q("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 vi=q("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 Yq=q("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 Xq=q("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 Qq=q("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 N4=q("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 Jq=q("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 eV=q("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 tV=q("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 rV=q("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 nV=q("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 sV=q("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 aV=q("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 ya=q("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 n2=q("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 s2=q("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 iV=q("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 oV=q("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 lV=q("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 cV=q("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 dV=q("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 Dj=q("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 uV=q("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 hV=q("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 Fl=q("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 mV=q("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 fV=q("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 pV=q("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 a2=q("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 i2=q("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 gV=q("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 xV=q("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 yV=q("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 vV=q("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 _u=q("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 S4=q("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 _V=q("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 bV=q("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 wV=q("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 jV=q("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 hy=q("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 Rj=q("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 kV=q("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 pm=q("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 NV=q("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 SV=q("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 CV=q("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 MV=q("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 TV=q("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 AV=q("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 EV=q("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 IV=q("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 PV=q("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 LV=q("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 OV=q("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 DV=q("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 RV=q("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 o2=q("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 FV=q("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 zV=q("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 BV=q("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 $V=q("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 UV=q("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 qV=q("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 VV=q("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 Fj=q("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 hf=q("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 HV=q("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 WV=q("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 GV=q("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 zj=q("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 KV=q("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 ZV=q("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 YV=q("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 XV=q("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 QV=q("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 C4=q("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 M4=q("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 JV=q("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 eH=q("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=q("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 tH=q("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 gm=q("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 Oo=q("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 xm=q("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 rH=q("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 nH=q("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 sH=q("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 aH=q("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 iH=q("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 oH=q("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 lH=q("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 T4=q("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 cH=q("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 dH=q("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 uH=q("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 hH=q("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 mH=q("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 fH=q("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 pH=q("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 mf=q("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 Gr=q("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 gH=q("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 xH=q("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 yH=q("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 vH=q("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 cA=q("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 l2=q("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 _H=q("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 c2=q("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 ff=q("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 A4=q("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 E4=q("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 bH=q("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 wH=q("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 jH=q("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 kH=q("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 NH=q("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 SH=q("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 CH=q("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 MH=q("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 TH=q("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 AH=q("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 EH=q("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 dA=q("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 ws=q("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 IH=q("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 PH=q("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 LH=q("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 OH=q("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 DH=q("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 RH=q("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 FH=q("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 zH=q("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 BH=q("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 $H=q("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 UH=q("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 qH=q("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 Do=q("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 VH=q("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 HH=q("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 WH=q("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 GH=q("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 KH=q("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 my=q("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 ZH=q("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 Ep=q("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 YH=q("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 XH=q("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 uA=q("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 QH=q("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 JH=q("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 eW=q("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 I4=q("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 tW=q("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 rW=q("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 nW=q("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 hA=q("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 sW=q("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 aW=q("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 iW=q("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 Ul=q("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 oW=q("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 lW=q("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 cW=q("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 dW=q("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 uW=q("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 hW=q("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 mW=q("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 fW=q("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 pW=q("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 mA=q("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 gW=q("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 xW=q("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 yW=q("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 vW=q("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 _W=q("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 Ro=q("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 bW=q("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 wW=q("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 d2=q("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 fA=q("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 jW=q("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 kW=q("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 NW=q("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 SW=q("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 CW=q("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 MW=q("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 TW=q("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 AW=q("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 K1=q("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 EW=q("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 IW=q("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 PW=q("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 LW=q("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 OW=q("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 DW=q("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 RW=q("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 FW=q("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 zW=q("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 BW=q("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 $W=q("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 UW=q("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 Bj=q("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 qW=q("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 VW=q("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 HW=q("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 WW=q("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 GW=q("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 KW=q("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 ZW=q("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 Z1=q("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 YW=q("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 XW=q("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 u2=q("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 QW=q("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 JW=q("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 eG=q("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 tG=q("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 rG=q("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 nG=q("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 sG=q("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 aG=q("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 iG=q("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 oG=q("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 lG=q("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 cG=q("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 dG=q("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 uG=q("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 hG=q("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 mG=q("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 fG=q("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 pG=q("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 gG=q("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 xG=q("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 pA=q("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 yG=q("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 fy=q("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 vG=q("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 _G=q("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 bG=q("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 wG=q("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 jG=q("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 kG=q("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 NG=q("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 SG=q("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 CG=q("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 h2=q("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 MG=q("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 m2=q("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 f2=q("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 TG=q("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 AG=q("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 EG=q("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 IG=q("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 PG=q("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 LG=q("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 OG=q("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 DG=q("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 RG=q("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 FG=q("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 zG=q("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 BG=q("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 ql=q("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 $G=q("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 UG=q("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 p2=q("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 qG=q("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 Vc=q("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 VG=q("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 g2=q("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 HG=q("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 WG=q("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=q("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 y2=q("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 v2=q("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 _2=q("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 GG=q("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 b2=q("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 KG=q("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 ZG=q("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 YG=q("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 w2=q("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 XG=q("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 QG=q("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 JG=q("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 eK=q("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 G0=q("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 tK=q("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 rK=q("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 nK=q("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 Hc=q("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 ym=q("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 sK=q("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 aK=q("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 K0=q("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 iK=q("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=q("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 Z0=q("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 oK=q("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 lK=q("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 cK=q("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 Qa=q("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 dK=q("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 P4=q("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 uK=q("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 hK=q("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 mK=q("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 fK=q("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 pK=q("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 gK=q("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 xK=q("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 yK=q("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 Ai=q("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 vK=q("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 _K=q("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 bK=q("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 wK=q("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 jK=q("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 kK=q("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 NK=q("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 SK=q("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 CK=q("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 MK=q("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 TK=q("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 gA=q("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 Y1=q("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 AK=q("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 EK=q("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 IK=q("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 PK=q("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 LK=q("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 Vl=q("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 OK=q("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 j2=q("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 xA=q("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 _n=q("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 DK=q("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 RK=q("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 FK=q("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 zK=q("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 BK=q("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 $K=q("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 UK=q("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 qK=q("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 VK=q("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 HK=q("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 py=q("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 WK=q("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 GK=q("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 KK=q("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 ZK=q("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 YK=q("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 XK=q("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 yA=q("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 vA=q("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 QK=q("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 JK=q("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 eZ=q("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 tZ=q("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 rZ=q("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 nZ=q("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 Uj=q("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 sZ=q("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 aZ=q("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 iZ=q("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 oZ=q("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 lZ=q("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 cZ=q("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 dZ=q("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 uZ=q("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 hZ=q("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 mZ=q("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 fZ=q("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 pZ=q("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 gZ=q("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 xZ=q("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 k2=q("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 yZ=q("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 vZ=q("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 _Z=q("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 bZ=q("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 wZ=q("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 L4=q("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 jZ=q("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 kZ=q("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 NZ=q("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 Go=q("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 SZ=q("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 CZ=q("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 MZ=q("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 TZ=q("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 AZ=q("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 _A=q("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 EZ=q("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 IZ=q("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 PZ=q("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 bA=q("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 LZ=q("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 OZ=q("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 Bg=q("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 DZ=q("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=q("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 N2=q("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 FZ=q("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 O4=q("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 zZ=q("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 wA=q("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 BZ=q("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 $Z=q("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 UZ=q("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 S2=q("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 C2=q("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 qZ=q("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 VZ=q("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 HZ=q("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 WZ=q("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 GZ=q("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 KZ=q("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 ZZ=q("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 YZ=q("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 XZ=q("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 QZ=q("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 JZ=q("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 Ip=q("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 M2=q("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 eY=q("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 tY=q("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 rY=q("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 nY=q("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 sY=q("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 aY=q("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 iY=q("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 oY=q("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 lY=q("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 cY=q("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 dY=q("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 uY=q("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 hY=q("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 mY=q("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 fY=q("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 pY=q("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 gY=q("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 xY=q("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 yY=q("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 vY=q("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 _Y=q("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 ma=q("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 bY=q("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 T2=q("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 wY=q("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 Ji=q("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 jY=q("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 kY=q("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 NY=q("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 SY=q("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 CY=q("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 MY=q("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 TY=q("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 zd=q("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 AY=q("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 Nc=q("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 jA=q("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 EY=q("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 IY=q("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 PY=q("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 LY=q("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 kA=q("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 OY=q("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 DY=q("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=q("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 FY=q("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 zY=q("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 BY=q("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 A2=q("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 vm=q("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 $Y=q("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 UY=q("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 qY=q("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 $g=q("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 VY=q("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 Ah=q("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 HY=q("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 WY=q("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 GY=q("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 KY=q("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 ZY=q("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 YY=q("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 XY=q("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 QY=q("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 JY=q("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 eX=q("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 tX=q("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 rX=q("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 nX=q("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 sX=q("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 aX=q("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 iX=q("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 oX=q("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 lX=q("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 cX=q("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 dX=q("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 uX=q("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 NA=q("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 E2=q("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 hX=q("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 mX=q("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 gy=q("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 fX=q("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 pX=q("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 gX=q("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 N1=q("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 xX=q("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 yX=q("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 vX=q("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 _X=q("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 bX=q("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 Os=q("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 wX=q("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 jX=q("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 kX=q("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 NX=q("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 SX=q("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 CX=q("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 MX=q("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 TX=q("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 I2=q("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 P2=q("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 L2=q("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 O2=q("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 D2=q("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 R2=q("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 F2=q("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 z2=q("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 B2=q("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 $2=q("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 U2=q("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 q2=q("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 V2=q("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 H2=q("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 W2=q("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 pg=q("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 Y0=q("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 G2=q("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 K2=q("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 Z2=q("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 Y2=q("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 X2=q("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 Q2=q("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 AX=q("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 EX=q("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 J2=q("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 ew=q("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 tw=q("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 rw=q("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 nw=q("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 sw=q("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 aw=q("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 iw=q("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 ow=q("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 lw=q("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 cw=q("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 dw=q("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 uw=q("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 hw=q("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 mw=q("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 gc=q("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 fw=q("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 pw=q("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 gw=q("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 xw=q("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 yw=q("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 vw=q("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 IX=q("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 _w=q("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 bw=q("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 ww=q("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 jw=q("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 kw=q("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 PX=q("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 LX=q("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 Nw=q("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 Sw=q("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 Cw=q("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 Mw=q("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 Ug=q("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 OX=q("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 DX=q("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=q("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 FX=q("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 zX=q("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 ks=q("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 BX=q("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 $X=q("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 UX=q("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 qX=q("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 VX=q("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 HX=q("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 WX=q("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 GX=q("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 KX=q("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 ZX=q("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 YX=q("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 XX=q("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 QX=q("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 JX=q("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 X1=q("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 eQ=q("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 tQ=q("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 rQ=q("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 nQ=q("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 sQ=q("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 aQ=q("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 iQ=q("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 oQ=q("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 lQ=q("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 D4=q("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 cQ=q("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 dQ=q("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 uQ=q("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 hQ=q("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 mQ=q("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 fQ=q("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 pQ=q("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 gQ=q("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 xQ=q("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 yQ=q("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 qg=q("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 vQ=q("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 _Q=q("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 bQ=q("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 wQ=q("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 jQ=q("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 kQ=q("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 NQ=q("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 xy=q("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 SQ=q("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 CQ=q("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 MQ=q("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 TQ=q("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 Tw=q("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 AQ=q("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 EQ=q("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 IQ=q("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 PQ=q("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 LQ=q("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 OQ=q("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 Aw=q("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 DQ=q("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=q("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 FQ=q("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 zQ=q("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 BQ=q("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 SA=q("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 Bd=q("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 $Q=q("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 UQ=q("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 qQ=q("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 VQ=q("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 HQ=q("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 WQ=q("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 CA=q("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 GQ=q("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 KQ=q("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 ZQ=q("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 YQ=q("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 XQ=q("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 QQ=q("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 JQ=q("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 eJ=q("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 tJ=q("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 rJ=q("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 nJ=q("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 sJ=q("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 aJ=q("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 iJ=q("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 oJ=q("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 lJ=q("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 cJ=q("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 dJ=q("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 uJ=q("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 Ew=q("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 Bn=q("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 hJ=q("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 mJ=q("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 Iw=q("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 Q1=q("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 fJ=q("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 pJ=q("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 qj=q("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 gJ=q("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 eh=q("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 Nh=q("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 xJ=q("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 yJ=q("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 io=q("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 MA=q("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 vJ=q("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 _J=q("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=q("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 bJ=q("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 wJ=q("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 jJ=q("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 kJ=q("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 NJ=q("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 SJ=q("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 CJ=q("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 MJ=q("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 TJ=q("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 AJ=q("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 R4=q("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 EJ=q("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 IJ=q("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 PJ=q("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 Lw=q("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 LJ=q("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=q("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 OJ=q("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 bo=q("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 DJ=q("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 Vj=q("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 AA=q("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=q("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 FJ=q("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 th=q("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 Ow=q("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 Dw=q("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 Rw=q("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 zJ=q("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 Fw=q("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 BJ=q("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 zw=q("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=q("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 $J=q("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 UJ=q("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 ic=q("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 $w=q("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 $n=q("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 Uw=q("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 qw=q("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 qJ=q("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 EA=q("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 VJ=q("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 HJ=q("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 WJ=q("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 GJ=q("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 KJ=q("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 ZJ=q("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 Ia=q("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 YJ=q("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 XJ=q("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 QJ=q("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 JJ=q("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 eee=q("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 tee=q("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 ree=q("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 nee=q("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 see=q("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 aee=q("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 iee=q("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 Vw=q("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 oee=q("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 lee=q("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 Hw=q("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 cee=q("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 dee=q("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 uee=q("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 hee=q("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 mee=q("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 fee=q("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 pee=q("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 gee=q("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 xee=q("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 yee=q("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 vee=q("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 _ee=q("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 bee=q("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 wee=q("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 jee=q("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 kee=q("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 Nee=q("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 See=q("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 Cee=q("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 Mee=q("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 Tee=q("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 Aee=q("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 Eee=q("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 Iee=q("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 Pee=q("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 yy=q("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 ds=q("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 Lee=q("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 Oee=q("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 Vg=q("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 F4=q("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 z4=q("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 lQe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:a8,AArrowUp:i8,ALargeSmall:o8,Accessibility:l8,Activity:Lg,AirVent:c8,Airplay:d8,AlarmClock:h8,AlarmClockCheck:L_,AlarmClockMinus:O_,AlarmClockOff:u8,AlarmClockPlus:D_,AlarmSmoke:m8,Album:f8,AlignCenter:y4,AlignCenterHorizontal:p8,AlignCenterVertical:g8,AlignEndHorizontal:x8,AlignEndVertical:y8,AlignHorizontalDistributeCenter:v8,AlignHorizontalDistributeEnd:_8,AlignHorizontalDistributeStart:b8,AlignHorizontalJustifyCenter:w8,AlignHorizontalJustifyEnd:j8,AlignHorizontalJustifyStart:k8,AlignHorizontalSpaceAround:N8,AlignHorizontalSpaceBetween:S8,AlignJustify:C8,AlignLeft:v4,AlignRight:_4,AlignStartHorizontal:M8,AlignStartVertical:T8,AlignVerticalDistributeCenter:A8,AlignVerticalDistributeEnd:E8,AlignVerticalDistributeStart:I8,AlignVerticalJustifyCenter:P8,AlignVerticalJustifyEnd:L8,AlignVerticalJustifyStart:O8,AlignVerticalSpaceAround:D8,AlignVerticalSpaceBetween:R8,Ambulance:F8,Ampersand:z8,Ampersands:B8,Amphora:$8,Anchor:U8,Angry:q8,Annoyed:V8,Antenna:H8,Anvil:W8,Aperture:G8,AppWindow:QT,AppWindowMac:K8,Apple:Z8,Archive:JT,ArchiveRestore:Y8,ArchiveX:X8,Armchair:Q8,ArrowBigDown:eD,ArrowBigDownDash:J8,ArrowBigLeft:rD,ArrowBigLeftDash:tD,ArrowBigRight:sD,ArrowBigRightDash:nD,ArrowBigUp:iD,ArrowBigUpDash:aD,ArrowDown:oy,ArrowDown01:oD,ArrowDown10:lD,ArrowDownAZ:R_,ArrowDownFromLine:cD,ArrowDownLeft:dD,ArrowDownNarrowWide:uD,ArrowDownRight:hD,ArrowDownToDot:mD,ArrowDownToLine:fD,ArrowDownUp:pD,ArrowDownWideNarrow:F_,ArrowDownZA:z_,ArrowLeft:Wi,ArrowLeftFromLine:gD,ArrowLeftRight:xD,ArrowLeftToLine:yD,ArrowRight:No,ArrowRightFromLine:vD,ArrowRightLeft:_D,ArrowRightToLine:bD,ArrowUp:df,ArrowUp01:wD,ArrowUp10:jD,ArrowUpAZ:B_,ArrowUpDown:Og,ArrowUpFromDot:kD,ArrowUpFromLine:ND,ArrowUpLeft:SD,ArrowUpNarrowWide:$_,ArrowUpRight:CD,ArrowUpToLine:MD,ArrowUpWideNarrow:TD,ArrowUpZA:U_,ArrowsUpFromLine:AD,Asterisk:ED,AtSign:ID,Atom:PD,AudioLines:LD,AudioWaveform:OD,Award:Bl,Axe:DD,Axis3d:q_,Baby:RD,Backpack:FD,Badge:eR,BadgeAlert:zD,BadgeCent:BD,BadgeCheck:V_,BadgeDollarSign:$D,BadgeEuro:UD,BadgeHelp:qD,BadgeIndianRupee:VD,BadgeInfo:HD,BadgeJapaneseYen:WD,BadgeMinus:GD,BadgePercent:KD,BadgePlus:ZD,BadgePoundSterling:YD,BadgeRussianRuble:XD,BadgeSwissFranc:QD,BadgeX:JD,BaggageClaim:tR,Ban:rR,Banana:nR,Bandage:sR,Banknote:aR,Barcode:iR,Baseline:oR,Bath:B1,Battery:mR,BatteryCharging:lR,BatteryFull:cR,BatteryLow:dR,BatteryMedium:uR,BatteryWarning:hR,Beaker:fR,Bean:gR,BeanOff:pR,Bed:$1,BedDouble:xR,BedSingle:yR,Beef:vR,Beer:bR,BeerOff:_R,Bell:Dg,BellDot:wR,BellElectric:jR,BellMinus:kR,BellOff:Mj,BellPlus:NR,BellRing:SR,BetweenHorizontalEnd:H_,BetweenHorizontalStart:W_,BetweenVerticalEnd:CR,BetweenVerticalStart:MR,BicepsFlexed:TR,Bike:AR,Binary:ER,Binoculars:IR,Biohazard:PR,Bird:LR,Bitcoin:OR,Blend:DR,Blinds:RR,Blocks:FR,Bluetooth:UR,BluetoothConnected:zR,BluetoothOff:BR,BluetoothSearching:$R,Bold:b4,Bolt:qR,Bomb:VR,Bone:HR,Book:mF,BookA:WR,BookAudio:GR,BookCheck:KR,BookCopy:ZR,BookDashed:G_,BookDown:YR,BookHeadphones:XR,BookHeart:QR,BookImage:JR,BookKey:eF,BookLock:tF,BookMarked:rF,BookMinus:nF,BookOpen:eA,BookOpenCheck:sF,BookOpenText:aF,BookPlus:iF,BookText:oF,BookType:lF,BookUp:dF,BookUp2:cF,BookUser:uF,BookX:hF,Bookmark:Mp,BookmarkCheck:fF,BookmarkMinus:pF,BookmarkPlus:tA,BookmarkX:gF,BoomBox:xF,Bot:w4,BotMessageSquare:yF,BotOff:vF,Box:_F,Boxes:bF,Braces:K_,Brackets:wF,Brain:rA,BrainCircuit:jF,BrainCog:kF,BrickWall:NF,Briefcase:Oh,BriefcaseBusiness:SF,BriefcaseConveyorBelt:CF,BriefcaseMedical:MF,BringToFront:TF,Brush:AF,Bug:PF,BugOff:EF,BugPlay:IF,Building:Tj,Building2:hi,Bus:OF,BusFront:LF,Cable:RF,CableCar:DF,Cake:mm,CakeSlice:FF,Calculator:zF,Calendar:Cs,Calendar1:BF,CalendarArrowDown:$F,CalendarArrowUp:UF,CalendarCheck:VF,CalendarCheck2:qF,CalendarClock:nA,CalendarCog:HF,CalendarDays:Tp,CalendarFold:WF,CalendarHeart:GF,CalendarMinus:ZF,CalendarMinus2:KF,CalendarOff:YF,CalendarPlus:Aj,CalendarPlus2:XF,CalendarRange:QF,CalendarSearch:JF,CalendarSync:ez,CalendarX:rz,CalendarX2:tz,Camera:Rg,CameraOff:nz,Candy:iz,CandyCane:sz,CandyOff:az,Cannabis:oz,Captions:Z_,CaptionsOff:lz,Car:uz,CarFront:cz,CarTaxiFront:dz,Caravan:hz,Carrot:mz,CaseLower:fz,CaseSensitive:pz,CaseUpper:gz,CassetteTape:xz,Cast:yz,Castle:vz,Cat:_z,Cctv:bz,ChartArea:Y_,ChartBar:Q_,ChartBarBig:X_,ChartBarDecreasing:wz,ChartBarIncreasing:jz,ChartBarStacked:kz,ChartCandlestick:J_,ChartColumn:_c,ChartColumnBig:eb,ChartColumnDecreasing:Nz,ChartColumnIncreasing:tb,ChartColumnStacked:Sz,ChartGantt:Cz,ChartLine:rb,ChartNetwork:Mz,ChartNoAxesColumn:sb,ChartNoAxesColumnDecreasing:Tz,ChartNoAxesColumnIncreasing:nb,ChartNoAxesCombined:Az,ChartNoAxesGantt:ab,ChartPie:ib,ChartScatter:ob,ChartSpline:Ez,Check:mi,CheckCheck:Iz,ChefHat:Pz,Cherry:Lz,ChevronDown:Rd,ChevronFirst:Oz,ChevronLast:Dz,ChevronLeft:kc,ChevronRight:Gi,ChevronUp:ly,ChevronsDown:Fz,ChevronsDownUp:Rz,ChevronsLeft:$z,ChevronsLeftRight:Bz,ChevronsLeftRightEllipsis:zz,ChevronsRight:qz,ChevronsRightLeft:Uz,ChevronsUp:Vz,ChevronsUpDown:cy,Chrome:Hz,Church:Wz,Cigarette:Kz,CigaretteOff:Gz,Circle:Ju,CircleAlert:yl,CircleArrowDown:lb,CircleArrowLeft:cb,CircleArrowOutDownLeft:db,CircleArrowOutDownRight:ub,CircleArrowOutUpLeft:hb,CircleArrowOutUpRight:mb,CircleArrowRight:fb,CircleArrowUp:pb,CircleCheck:no,CircleCheckBig:oi,CircleChevronDown:gb,CircleChevronLeft:xb,CircleChevronRight:yb,CircleChevronUp:vb,CircleDashed:Zz,CircleDivide:_b,CircleDollarSign:Yz,CircleDot:Qz,CircleDotDashed:Xz,CircleEllipsis:Jz,CircleEqual:e7,CircleFadingArrowUp:t7,CircleFadingPlus:r7,CircleGauge:bb,CircleHelp:Kx,CircleMinus:wb,CircleOff:n7,CircleParking:kb,CircleParkingOff:jb,CirclePause:Nb,CirclePercent:Sb,CirclePlay:rf,CirclePlus:Cb,CirclePower:Mb,CircleSlash:s7,CircleSlash2:Tb,CircleStop:Ab,CircleUser:Ib,CircleUserRound:Eb,CircleX:bc,CircuitBoard:a7,Citrus:i7,Clapperboard:o7,Clipboard:f7,ClipboardCheck:sA,ClipboardCopy:l7,ClipboardList:aA,ClipboardMinus:c7,ClipboardPaste:d7,ClipboardPen:Lb,ClipboardPenLine:Pb,ClipboardPlus:u7,ClipboardType:h7,ClipboardX:m7,Clock:Xa,Clock1:p7,Clock10:g7,Clock11:x7,Clock12:y7,Clock2:v7,Clock3:_7,Clock4:b7,Clock5:w7,Clock6:j7,Clock7:k7,Clock8:N7,Clock9:S7,ClockAlert:C7,ClockArrowDown:M7,ClockArrowUp:T7,Cloud:V7,CloudAlert:A7,CloudCog:E7,CloudDownload:Ob,CloudDrizzle:I7,CloudFog:P7,CloudHail:L7,CloudLightning:O7,CloudMoon:R7,CloudMoonRain:D7,CloudOff:F7,CloudRain:B7,CloudRainWind:z7,CloudSnow:$7,CloudSun:q7,CloudSunRain:U7,CloudUpload:Db,Cloudy:H7,Clover:ty,Club:W7,Code:Ej,CodeXml:Rb,Codepen:G7,Codesandbox:K7,Coffee:Ij,Cog:Z7,Coins:Y7,Columns2:Fb,Columns3:zb,Columns4:X7,Combine:Q7,Command:J7,Compass:e9,Component:t9,Computer:r9,ConciergeBell:n9,Cone:s9,Construction:a9,Contact:i9,ContactRound:Bb,Container:o9,Contrast:l9,Cookie:c9,CookingPot:d9,Copy:Po,CopyCheck:u9,CopyMinus:h9,CopyPlus:m9,CopySlash:f9,CopyX:p9,Copyleft:g9,Copyright:x9,CornerDownLeft:y9,CornerDownRight:v9,CornerLeftDown:_9,CornerLeftUp:b9,CornerRightDown:w9,CornerRightUp:j9,CornerUpLeft:k9,CornerUpRight:N9,Cpu:S9,CreativeCommons:C9,CreditCard:uf,Croissant:M9,Crop:T9,Cross:A9,Crosshair:E9,Crown:U1,Cuboid:I9,CupSoda:P9,Currency:L9,Cylinder:O9,Dam:D9,Database:z9,DatabaseBackup:R9,DatabaseZap:F9,Delete:B9,Dessert:$9,Diameter:U9,Diamond:H9,DiamondMinus:q9,DiamondPercent:$b,DiamondPlus:V9,Dice1:W9,Dice2:G9,Dice3:K9,Dice4:Z9,Dice5:Y9,Dice6:X9,Dices:Q9,Diff:J9,Disc:nB,Disc2:eB,Disc3:tB,DiscAlbum:rB,Divide:sB,Dna:iB,DnaOff:aB,Dock:oB,Dog:lB,DollarSign:Fd,Donut:cB,DoorClosed:dB,DoorOpen:Pj,Dot:uB,Download:so,DraftingCompass:hB,Drama:mB,Dribbble:fB,Drill:pB,Droplet:gB,Droplets:xB,Drum:yB,Drumstick:vB,Dumbbell:_B,Ear:wB,EarOff:bB,Earth:Ub,EarthLock:jB,Eclipse:kB,Egg:j4,EggFried:NB,EggOff:SB,Ellipsis:gp,EllipsisVertical:kg,Equal:TB,EqualApproximately:CB,EqualNot:MB,Eraser:AB,EthernetPort:EB,Euro:IB,Expand:PB,ExternalLink:Ss,Eye:_o,EyeClosed:LB,EyeOff:Fg,Facebook:au,Factory:OB,Fan:DB,FastForward:RB,Feather:FB,Fence:zB,FerrisWheel:BB,Figma:$B,File:O$,FileArchive:UB,FileAudio:VB,FileAudio2:qB,FileAxis3d:qb,FileBadge:WB,FileBadge2:HB,FileBox:GB,FileChartColumn:Hb,FileChartColumnIncreasing:Vb,FileChartLine:Wb,FileChartPie:Gb,FileCheck:ZB,FileCheck2:KB,FileClock:YB,FileCode:QB,FileCode2:XB,FileCog:Kb,FileDiff:JB,FileDigit:e$,FileDown:t$,FileHeart:r$,FileImage:q1,FileInput:n$,FileJson:a$,FileJson2:s$,FileKey:o$,FileKey2:i$,FileLock:c$,FileLock2:l$,FileMinus:u$,FileMinus2:d$,FileMusic:h$,FileOutput:m$,FilePen:Yb,FilePenLine:Zb,FilePlus:p$,FilePlus2:f$,FileQuestion:g$,FileScan:x$,FileSearch:v$,FileSearch2:y$,FileSliders:_$,FileSpreadsheet:V1,FileStack:b$,FileSymlink:w$,FileTerminal:j$,FileText:_a,FileType:N$,FileType2:k$,FileUp:S$,FileUser:C$,FileVideo:T$,FileVideo2:M$,FileVolume:E$,FileVolume2:A$,FileWarning:I$,FileX:L$,FileX2:P$,Files:D$,Film:Td,Filter:H1,FilterX:R$,Fingerprint:F$,FireExtinguisher:z$,Fish:U$,FishOff:B$,FishSymbol:$$,Flag:dy,FlagOff:q$,FlagTriangleLeft:V$,FlagTriangleRight:H$,Flame:fm,FlameKindling:W$,Flashlight:K$,FlashlightOff:G$,FlaskConical:Lj,FlaskConicalOff:Z$,FlaskRound:Y$,FlipHorizontal:Q$,FlipHorizontal2:X$,FlipVertical:eU,FlipVertical2:J$,Flower:tU,Flower2:bp,Focus:rU,FoldHorizontal:nU,FoldVertical:sU,Folder:EU,FolderArchive:aU,FolderCheck:iU,FolderClock:oU,FolderClosed:lU,FolderCode:cU,FolderCog:Xb,FolderDot:dU,FolderDown:uU,FolderGit:mU,FolderGit2:hU,FolderHeart:fU,FolderInput:pU,FolderKanban:gU,FolderKey:xU,FolderLock:yU,FolderMinus:vU,FolderOpen:Ap,FolderOpenDot:_U,FolderOutput:bU,FolderPen:Qb,FolderPlus:wU,FolderRoot:jU,FolderSearch:NU,FolderSearch2:kU,FolderSymlink:SU,FolderSync:CU,FolderTree:MU,FolderUp:TU,FolderX:AU,Folders:IU,Footprints:PU,Forklift:LU,Forward:OU,Frame:DU,Framer:RU,Frown:FU,Fuel:zU,Fullscreen:BU,GalleryHorizontal:UU,GalleryHorizontalEnd:$U,GalleryThumbnails:qU,GalleryVertical:HU,GalleryVerticalEnd:VU,Gamepad:GU,Gamepad2:WU,Gauge:KU,Gavel:ZU,Gem:YU,Ghost:Oj,Gift:ao,GitBranch:QU,GitBranchPlus:XU,GitCommitHorizontal:Jb,GitCommitVertical:JU,GitCompare:tq,GitCompareArrows:eq,GitFork:rq,GitGraph:nq,GitMerge:sq,GitPullRequest:dq,GitPullRequestArrow:aq,GitPullRequestClosed:iq,GitPullRequestCreate:lq,GitPullRequestCreateArrow:oq,GitPullRequestDraft:cq,Github:uq,Gitlab:hq,GlassWater:mq,Glasses:fq,Globe:uy,GlobeLock:pq,Goal:gq,Grab:xq,GraduationCap:W1,Grape:yq,Grid2x2:t2,Grid2x2Check:vq,Grid2x2Plus:e2,Grid2x2X:_q,Grid3x3:tm,Grip:wq,GripHorizontal:bq,GripVertical:zg,Group:jq,Guitar:kq,Ham:Nq,Hammer:Sq,Hand:Eq,HandCoins:Cq,HandHeart:Mq,HandHelping:r2,HandMetal:Tq,HandPlatter:Aq,Handshake:Iq,HardDrive:iA,HardDriveDownload:Pq,HardDriveUpload:Lq,HardHat:Oq,Hash:k4,Haze:Dq,HdmiPort:Rq,Heading:Uq,Heading1:oA,Heading2:lA,Heading3:Fq,Heading4:zq,Heading5:Bq,Heading6:$q,HeadphoneOff:qq,Headphones:Vq,Headset:Hq,Heart:vi,HeartCrack:Wq,HeartHandshake:Gq,HeartOff:Kq,HeartPulse:Zq,Heater:Yq,Hexagon:Xq,Highlighter:Qq,History:N4,Hop:eV,HopOff:Jq,Hospital:tV,Hotel:rV,Hourglass:nV,House:ya,HousePlug:sV,HousePlus:aV,IceCreamBowl:n2,IceCreamCone:s2,IdCard:iV,Image:Fl,ImageDown:oV,ImageMinus:lV,ImageOff:cV,ImagePlay:dV,ImagePlus:Dj,ImageUp:uV,ImageUpscale:hV,Images:mV,Import:fV,Inbox:pV,IndentDecrease:a2,IndentIncrease:i2,IndianRupee:gV,Infinity:xV,Info:yV,InspectionPanel:vV,Instagram:_u,Italic:S4,IterationCcw:_V,IterationCw:bV,JapaneseYen:wV,Joystick:jV,Kanban:hy,Key:pm,KeyRound:Rj,KeySquare:kV,Keyboard:CV,KeyboardMusic:NV,KeyboardOff:SV,Lamp:PV,LampCeiling:MV,LampDesk:TV,LampFloor:AV,LampWallDown:EV,LampWallUp:IV,LandPlot:LV,Landmark:OV,Languages:DV,Laptop:FV,LaptopMinimal:o2,LaptopMinimalCheck:RV,Lasso:BV,LassoSelect:zV,Laugh:$V,Layers:VV,Layers2:UV,Layers3:qV,LayoutDashboard:Fj,LayoutGrid:hf,LayoutList:HV,LayoutPanelLeft:WV,LayoutPanelTop:GV,LayoutTemplate:zj,Leaf:KV,LeafyGreen:ZV,Lectern:YV,LetterText:XV,Library:C4,LibraryBig:QV,LifeBuoy:M4,Ligature:JV,Lightbulb:G1,LightbulbOff:eH,Link:Oo,Link2:gm,Link2Off:tH,Linkedin:xm,List:mf,ListCheck:rH,ListChecks:nH,ListCollapse:sH,ListEnd:aH,ListFilter:iH,ListMinus:oH,ListMusic:lH,ListOrdered:T4,ListPlus:cH,ListRestart:dH,ListStart:uH,ListTodo:hH,ListTree:mH,ListVideo:fH,ListX:pH,Loader:xH,LoaderCircle:Gr,LoaderPinwheel:gH,Locate:cA,LocateFixed:yH,LocateOff:vH,Lock:ff,LockKeyhole:_H,LockKeyholeOpen:l2,LockOpen:c2,LogIn:A4,LogOut:E4,Logs:bH,Lollipop:wH,Luggage:jH,Magnet:kH,Mail:ws,MailCheck:NH,MailMinus:SH,MailOpen:CH,MailPlus:MH,MailQuestion:TH,MailSearch:AH,MailWarning:EH,MailX:dA,Mailbox:IH,Mails:PH,Map:HH,MapPin:Do,MapPinCheck:OH,MapPinCheckInside:LH,MapPinHouse:DH,MapPinMinus:FH,MapPinMinusInside:RH,MapPinOff:zH,MapPinPlus:$H,MapPinPlusInside:BH,MapPinX:qH,MapPinXInside:UH,MapPinned:VH,Martini:WH,Maximize:KH,Maximize2:GH,Medal:my,Megaphone:Ep,MegaphoneOff:ZH,Meh:YH,MemoryStick:XH,Menu:uA,Merge:QH,MessageCircle:Ul,MessageCircleCode:JH,MessageCircleDashed:eW,MessageCircleHeart:I4,MessageCircleMore:tW,MessageCircleOff:rW,MessageCirclePlus:nW,MessageCircleQuestion:hA,MessageCircleReply:sW,MessageCircleWarning:aW,MessageCircleX:iW,MessageSquare:Ro,MessageSquareCode:oW,MessageSquareDashed:lW,MessageSquareDiff:cW,MessageSquareDot:dW,MessageSquareHeart:uW,MessageSquareLock:hW,MessageSquareMore:mW,MessageSquareOff:fW,MessageSquarePlus:pW,MessageSquareQuote:mA,MessageSquareReply:gW,MessageSquareShare:xW,MessageSquareText:yW,MessageSquareWarning:vW,MessageSquareX:_W,MessagesSquare:bW,Mic:fA,MicOff:wW,MicVocal:d2,Microchip:jW,Microscope:kW,Microwave:NW,Milestone:SW,Milk:MW,MilkOff:CW,Minimize:AW,Minimize2:TW,Minus:K1,Monitor:Bj,MonitorCheck:EW,MonitorCog:IW,MonitorDot:PW,MonitorDown:LW,MonitorOff:OW,MonitorPause:DW,MonitorPlay:RW,MonitorSmartphone:FW,MonitorSpeaker:zW,MonitorStop:BW,MonitorUp:$W,MonitorX:UW,Moon:VW,MoonStar:qW,Mountain:WW,MountainSnow:HW,Mouse:XW,MouseOff:GW,MousePointer:YW,MousePointer2:KW,MousePointerBan:ZW,MousePointerClick:Z1,Move:dG,Move3d:u2,MoveDiagonal:JW,MoveDiagonal2:QW,MoveDown:rG,MoveDownLeft:eG,MoveDownRight:tG,MoveHorizontal:nG,MoveLeft:sG,MoveRight:aG,MoveUp:lG,MoveUpLeft:iG,MoveUpRight:oG,MoveVertical:cG,Music:fG,Music2:uG,Music3:hG,Music4:mG,Navigation:pA,Navigation2:gG,Navigation2Off:pG,NavigationOff:xG,Network:yG,Newspaper:fy,Nfc:vG,Notebook:jG,NotebookPen:_G,NotebookTabs:bG,NotebookText:wG,NotepadText:NG,NotepadTextDashed:kG,Nut:CG,NutOff:SG,Octagon:TG,OctagonAlert:h2,OctagonMinus:MG,OctagonPause:m2,OctagonX:f2,Omega:AG,Option:EG,Orbit:IG,Origami:PG,Package:ql,Package2:LG,PackageCheck:OG,PackageMinus:DG,PackageOpen:RG,PackagePlus:FG,PackageSearch:zG,PackageX:BG,PaintBucket:$G,PaintRoller:UG,Paintbrush:qG,PaintbrushVertical:p2,Palette:Vc,PanelBottom:WG,PanelBottomClose:VG,PanelBottomDashed:g2,PanelBottomOpen:HG,PanelLeft:_2,PanelLeftClose:x2,PanelLeftDashed:y2,PanelLeftOpen:v2,PanelRight:ZG,PanelRightClose:GG,PanelRightDashed:b2,PanelRightOpen:KG,PanelTop:QG,PanelTopClose:YG,PanelTopDashed:w2,PanelTopOpen:XG,PanelsLeftBottom:JG,PanelsRightBottom:eK,PanelsTopLeft:G0,Paperclip:tK,Parentheses:rK,ParkingMeter:nK,PartyPopper:Hc,Pause:ym,PawPrint:sK,PcCase:aK,Pen:Z0,PenLine:K0,PenOff:iK,PenTool:$j,Pencil:Qa,PencilLine:oK,PencilOff:lK,PencilRuler:cK,Pentagon:dK,Percent:P4,PersonStanding:uK,PhilippinePeso:hK,Phone:Ai,PhoneCall:mK,PhoneForwarded:fK,PhoneIncoming:pK,PhoneMissed:gK,PhoneOff:xK,PhoneOutgoing:yK,Pi:vK,Piano:_K,Pickaxe:bK,PictureInPicture:jK,PictureInPicture2:wK,PiggyBank:kK,Pilcrow:CK,PilcrowLeft:NK,PilcrowRight:SK,Pill:TK,PillBottle:MK,Pin:Y1,PinOff:gA,Pipette:AK,Pizza:EK,Plane:LK,PlaneLanding:IK,PlaneTakeoff:PK,Play:Vl,Plug:xA,Plug2:OK,PlugZap:j2,Plus:_n,Pocket:RK,PocketKnife:DK,Podcast:FK,Pointer:BK,PointerOff:zK,Popcorn:$K,Popsicle:UK,PoundSterling:qK,Power:HK,PowerOff:VK,Presentation:py,Printer:GK,PrinterCheck:WK,Projector:KK,Proportions:ZK,Puzzle:YK,Pyramid:XK,QrCode:yA,Quote:vA,Rabbit:QK,Radar:JK,Radiation:eZ,Radical:tZ,Radio:Uj,RadioReceiver:rZ,RadioTower:nZ,Radius:sZ,RailSymbol:aZ,Rainbow:iZ,Rat:oZ,Ratio:lZ,Receipt:xZ,ReceiptCent:cZ,ReceiptEuro:dZ,ReceiptIndianRupee:uZ,ReceiptJapaneseYen:hZ,ReceiptPoundSterling:mZ,ReceiptRussianRuble:fZ,ReceiptSwissFranc:pZ,ReceiptText:gZ,RectangleEllipsis:k2,RectangleHorizontal:yZ,RectangleVertical:vZ,Recycle:_Z,Redo:L4,Redo2:bZ,RedoDot:wZ,RefreshCcw:kZ,RefreshCcwDot:jZ,RefreshCw:Go,RefreshCwOff:NZ,Refrigerator:SZ,Regex:CZ,RemoveFormatting:MZ,Repeat:_A,Repeat1:TZ,Repeat2:AZ,Replace:IZ,ReplaceAll:EZ,Reply:bA,ReplyAll:PZ,Rewind:LZ,Ribbon:OZ,Rocket:Bg,RockingChair:DZ,RollerCoaster:RZ,Rotate3d:N2,RotateCcw:O4,RotateCcwSquare:FZ,RotateCw:wA,RotateCwSquare:zZ,Route:$Z,RouteOff:BZ,Router:UZ,Rows2:S2,Rows3:C2,Rows4:qZ,Rss:VZ,Ruler:HZ,RussianRuble:WZ,Sailboat:GZ,Salad:KZ,Sandwich:ZZ,Satellite:XZ,SatelliteDish:YZ,Save:Ip,SaveAll:QZ,SaveOff:JZ,Scale:eY,Scale3d:M2,Scaling:tY,Scan:cY,ScanBarcode:rY,ScanEye:nY,ScanFace:sY,ScanLine:aY,ScanQrCode:iY,ScanSearch:oY,ScanText:lY,School:dY,Scissors:hY,ScissorsLineDashed:uY,ScreenShare:fY,ScreenShareOff:mY,Scroll:gY,ScrollText:pY,Search:ma,SearchCheck:xY,SearchCode:yY,SearchSlash:vY,SearchX:_Y,Section:bY,Send:Ji,SendHorizontal:T2,SendToBack:wY,SeparatorHorizontal:jY,SeparatorVertical:kY,Server:MY,ServerCog:NY,ServerCrash:SY,ServerOff:CY,Settings:zd,Settings2:TY,Shapes:AY,Share:jA,Share2:Nc,Sheet:EY,Shell:IY,Shield:vm,ShieldAlert:PY,ShieldBan:LY,ShieldCheck:kA,ShieldEllipsis:OY,ShieldHalf:DY,ShieldMinus:RY,ShieldOff:FY,ShieldPlus:zY,ShieldQuestion:BY,ShieldX:A2,Ship:UY,ShipWheel:$Y,Shirt:qY,ShoppingBag:$g,ShoppingBasket:VY,ShoppingCart:Ah,Shovel:HY,ShowerHead:WY,Shrink:GY,Shrub:KY,Shuffle:ZY,Sigma:YY,Signal:tX,SignalHigh:XY,SignalLow:QY,SignalMedium:JY,SignalZero:eX,Signature:rX,Signpost:sX,SignpostBig:nX,Siren:aX,SkipBack:iX,SkipForward:oX,Skull:lX,Slack:cX,Slash:dX,Slice:uX,SlidersHorizontal:NA,SlidersVertical:E2,Smartphone:gy,SmartphoneCharging:hX,SmartphoneNfc:mX,Smile:pX,SmilePlus:fX,Snail:gX,Snowflake:N1,Sofa:xX,Soup:yX,Space:vX,Spade:_X,Sparkle:bX,Sparkles:Os,Speaker:wX,Speech:jX,SpellCheck:NX,SpellCheck2:kX,Spline:SX,Split:CX,SprayCan:MX,Sprout:TX,Square:Ug,SquareActivity:I2,SquareArrowDown:O2,SquareArrowDownLeft:P2,SquareArrowDownRight:L2,SquareArrowLeft:D2,SquareArrowOutDownLeft:R2,SquareArrowOutDownRight:F2,SquareArrowOutUpLeft:z2,SquareArrowOutUpRight:B2,SquareArrowRight:$2,SquareArrowUp:V2,SquareArrowUpLeft:U2,SquareArrowUpRight:q2,SquareAsterisk:H2,SquareBottomDashedScissors:W2,SquareChartGantt:pg,SquareCheck:G2,SquareCheckBig:Y0,SquareChevronDown:K2,SquareChevronLeft:Z2,SquareChevronRight:Y2,SquareChevronUp:X2,SquareCode:Q2,SquareDashed:tw,SquareDashedBottom:EX,SquareDashedBottomCode:AX,SquareDashedKanban:J2,SquareDashedMousePointer:ew,SquareDivide:rw,SquareDot:nw,SquareEqual:sw,SquareFunction:aw,SquareKanban:iw,SquareLibrary:ow,SquareM:lw,SquareMenu:cw,SquareMinus:dw,SquareMousePointer:uw,SquareParking:mw,SquareParkingOff:hw,SquarePen:gc,SquarePercent:fw,SquarePi:pw,SquarePilcrow:gw,SquarePlay:xw,SquarePlus:yw,SquarePower:vw,SquareRadical:IX,SquareScissors:_w,SquareSigma:bw,SquareSlash:ww,SquareSplitHorizontal:jw,SquareSplitVertical:kw,SquareSquare:PX,SquareStack:LX,SquareTerminal:Nw,SquareUser:Cw,SquareUserRound:Sw,SquareX:Mw,Squircle:OX,Squirrel:DX,Stamp:RX,Star:ks,StarHalf:FX,StarOff:zX,StepBack:BX,StepForward:$X,Stethoscope:UX,Sticker:qX,StickyNote:VX,Store:HX,StretchHorizontal:WX,StretchVertical:GX,Strikethrough:KX,Subscript:ZX,Sun:X1,SunDim:YX,SunMedium:XX,SunMoon:QX,SunSnow:JX,Sunrise:eQ,Sunset:tQ,Superscript:rQ,SwatchBook:nQ,SwissFranc:sQ,SwitchCamera:aQ,Sword:iQ,Swords:oQ,Syringe:lQ,Table:pQ,Table2:D4,TableCellsMerge:cQ,TableCellsSplit:dQ,TableColumnsSplit:uQ,TableOfContents:hQ,TableProperties:mQ,TableRowsSplit:fQ,Tablet:xQ,TabletSmartphone:gQ,Tablets:yQ,Tag:qg,Tags:vQ,Tally1:_Q,Tally2:bQ,Tally3:wQ,Tally4:jQ,Tally5:kQ,Tangent:NQ,Target:xy,Telescope:SQ,Tent:MQ,TentTree:CQ,Terminal:TQ,TestTube:AQ,TestTubeDiagonal:Tw,TestTubes:EQ,Text:DQ,TextCursor:PQ,TextCursorInput:IQ,TextQuote:LQ,TextSearch:OQ,TextSelect:Aw,Theater:RQ,Thermometer:BQ,ThermometerSnowflake:FQ,ThermometerSun:zQ,ThumbsDown:SA,ThumbsUp:Bd,Ticket:CA,TicketCheck:$Q,TicketMinus:UQ,TicketPercent:qQ,TicketPlus:VQ,TicketSlash:HQ,TicketX:WQ,Tickets:KQ,TicketsPlane:GQ,Timer:XQ,TimerOff:ZQ,TimerReset:YQ,ToggleLeft:QQ,ToggleRight:JQ,Toilet:eJ,Tornado:tJ,Torus:rJ,Touchpad:sJ,TouchpadOff:nJ,TowerControl:aJ,ToyBrick:iJ,Tractor:oJ,TrafficCone:lJ,TrainFront:dJ,TrainFrontTunnel:cJ,TrainTrack:uJ,TramFront:Ew,Trash:hJ,Trash2:Bn,TreeDeciduous:mJ,TreePalm:Iw,TreePine:Q1,Trees:fJ,Trello:pJ,TrendingDown:qj,TrendingUp:eh,TrendingUpDown:gJ,Triangle:yJ,TriangleAlert:Nh,TriangleRight:xJ,Trophy:io,Truck:MA,Turtle:vJ,Tv:bJ,TvMinimal:Pw,TvMinimalPlay:_J,Twitch:wJ,Twitter:jJ,Type:NJ,TypeOutline:kJ,Umbrella:CJ,UmbrellaOff:SJ,Underline:MJ,Undo:R4,Undo2:TJ,UndoDot:AJ,UnfoldHorizontal:EJ,UnfoldVertical:IJ,Ungroup:PJ,University:Lw,Unlink:TA,Unlink2:LJ,Unplug:OJ,Upload:bo,Usb:DJ,User:ic,UserCheck:Vj,UserCog:AA,UserMinus:RJ,UserPen:FJ,UserPlus:th,UserRound:Bw,UserRoundCheck:Ow,UserRoundCog:Dw,UserRoundMinus:Rw,UserRoundPen:zJ,UserRoundPlus:Fw,UserRoundSearch:BJ,UserRoundX:zw,UserSearch:$J,UserX:UJ,Users:$n,UsersRound:$w,Utensils:qw,UtensilsCrossed:Uw,UtilityPole:qJ,Variable:EA,Vault:VJ,Vegan:HJ,VenetianMask:WJ,Vibrate:KJ,VibrateOff:GJ,Video:Ia,VideoOff:ZJ,Videotape:YJ,View:XJ,Voicemail:QJ,Volleyball:JJ,Volume:see,Volume1:eee,Volume2:tee,VolumeOff:ree,VolumeX:nee,Vote:aee,Wallet:oee,WalletCards:iee,WalletMinimal:Vw,Wallpaper:lee,Wand:cee,WandSparkles:Hw,Warehouse:dee,WashingMachine:uee,Watch:hee,Waves:mee,Waypoints:fee,Webcam:pee,Webhook:xee,WebhookOff:gee,Weight:yee,Wheat:_ee,WheatOff:vee,WholeWord:bee,Wifi:See,WifiHigh:wee,WifiLow:jee,WifiOff:kee,WifiZero:Nee,Wind:Mee,WindArrowDown:Cee,Wine:Aee,WineOff:Tee,Workflow:Eee,Worm:Iee,WrapText:Pee,Wrench:yy,X:ds,Youtube:Lee,Zap:Vg,ZapOff:Oee,ZoomIn:F4,ZoomOut:z4},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 IIe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:a8,AArrowDownIcon:a8,AArrowUp:i8,AArrowUpIcon:i8,ALargeSmall:o8,ALargeSmallIcon:o8,Accessibility:l8,AccessibilityIcon:l8,Activity:Lg,ActivityIcon:Lg,ActivitySquare:I2,ActivitySquareIcon:I2,AirVent:c8,AirVentIcon:c8,Airplay:d8,AirplayIcon:d8,AlarmCheck:L_,AlarmCheckIcon:L_,AlarmClock:h8,AlarmClockCheck:L_,AlarmClockCheckIcon:L_,AlarmClockIcon:h8,AlarmClockMinus:O_,AlarmClockMinusIcon:O_,AlarmClockOff:u8,AlarmClockOffIcon:u8,AlarmClockPlus:D_,AlarmClockPlusIcon:D_,AlarmMinus:O_,AlarmMinusIcon:O_,AlarmPlus:D_,AlarmPlusIcon:D_,AlarmSmoke:m8,AlarmSmokeIcon:m8,Album:f8,AlbumIcon:f8,AlertCircle:yl,AlertCircleIcon:yl,AlertOctagon:h2,AlertOctagonIcon:h2,AlertTriangle:Nh,AlertTriangleIcon:Nh,AlignCenter:y4,AlignCenterHorizontal:p8,AlignCenterHorizontalIcon:p8,AlignCenterIcon:y4,AlignCenterVertical:g8,AlignCenterVerticalIcon:g8,AlignEndHorizontal:x8,AlignEndHorizontalIcon:x8,AlignEndVertical:y8,AlignEndVerticalIcon:y8,AlignHorizontalDistributeCenter:v8,AlignHorizontalDistributeCenterIcon:v8,AlignHorizontalDistributeEnd:_8,AlignHorizontalDistributeEndIcon:_8,AlignHorizontalDistributeStart:b8,AlignHorizontalDistributeStartIcon:b8,AlignHorizontalJustifyCenter:w8,AlignHorizontalJustifyCenterIcon:w8,AlignHorizontalJustifyEnd:j8,AlignHorizontalJustifyEndIcon:j8,AlignHorizontalJustifyStart:k8,AlignHorizontalJustifyStartIcon:k8,AlignHorizontalSpaceAround:N8,AlignHorizontalSpaceAroundIcon:N8,AlignHorizontalSpaceBetween:S8,AlignHorizontalSpaceBetweenIcon:S8,AlignJustify:C8,AlignJustifyIcon:C8,AlignLeft:v4,AlignLeftIcon:v4,AlignRight:_4,AlignRightIcon:_4,AlignStartHorizontal:M8,AlignStartHorizontalIcon:M8,AlignStartVertical:T8,AlignStartVerticalIcon:T8,AlignVerticalDistributeCenter:A8,AlignVerticalDistributeCenterIcon:A8,AlignVerticalDistributeEnd:E8,AlignVerticalDistributeEndIcon:E8,AlignVerticalDistributeStart:I8,AlignVerticalDistributeStartIcon:I8,AlignVerticalJustifyCenter:P8,AlignVerticalJustifyCenterIcon:P8,AlignVerticalJustifyEnd:L8,AlignVerticalJustifyEndIcon:L8,AlignVerticalJustifyStart:O8,AlignVerticalJustifyStartIcon:O8,AlignVerticalSpaceAround:D8,AlignVerticalSpaceAroundIcon:D8,AlignVerticalSpaceBetween:R8,AlignVerticalSpaceBetweenIcon:R8,Ambulance:F8,AmbulanceIcon:F8,Ampersand:z8,AmpersandIcon:z8,Ampersands:B8,AmpersandsIcon:B8,Amphora:$8,AmphoraIcon:$8,Anchor:U8,AnchorIcon:U8,Angry:q8,AngryIcon:q8,Annoyed:V8,AnnoyedIcon:V8,Antenna:H8,AntennaIcon:H8,Anvil:W8,AnvilIcon:W8,Aperture:G8,ApertureIcon:G8,AppWindow:QT,AppWindowIcon:QT,AppWindowMac:K8,AppWindowMacIcon:K8,Apple:Z8,AppleIcon:Z8,Archive:JT,ArchiveIcon:JT,ArchiveRestore:Y8,ArchiveRestoreIcon:Y8,ArchiveX:X8,ArchiveXIcon:X8,AreaChart:Y_,AreaChartIcon:Y_,Armchair:Q8,ArmchairIcon:Q8,ArrowBigDown:eD,ArrowBigDownDash:J8,ArrowBigDownDashIcon:J8,ArrowBigDownIcon:eD,ArrowBigLeft:rD,ArrowBigLeftDash:tD,ArrowBigLeftDashIcon:tD,ArrowBigLeftIcon:rD,ArrowBigRight:sD,ArrowBigRightDash:nD,ArrowBigRightDashIcon:nD,ArrowBigRightIcon:sD,ArrowBigUp:iD,ArrowBigUpDash:aD,ArrowBigUpDashIcon:aD,ArrowBigUpIcon:iD,ArrowDown:oy,ArrowDown01:oD,ArrowDown01Icon:oD,ArrowDown10:lD,ArrowDown10Icon:lD,ArrowDownAZ:R_,ArrowDownAZIcon:R_,ArrowDownAz:R_,ArrowDownAzIcon:R_,ArrowDownCircle:lb,ArrowDownCircleIcon:lb,ArrowDownFromLine:cD,ArrowDownFromLineIcon:cD,ArrowDownIcon:oy,ArrowDownLeft:dD,ArrowDownLeftFromCircle:db,ArrowDownLeftFromCircleIcon:db,ArrowDownLeftFromSquare:R2,ArrowDownLeftFromSquareIcon:R2,ArrowDownLeftIcon:dD,ArrowDownLeftSquare:P2,ArrowDownLeftSquareIcon:P2,ArrowDownNarrowWide:uD,ArrowDownNarrowWideIcon:uD,ArrowDownRight:hD,ArrowDownRightFromCircle:ub,ArrowDownRightFromCircleIcon:ub,ArrowDownRightFromSquare:F2,ArrowDownRightFromSquareIcon:F2,ArrowDownRightIcon:hD,ArrowDownRightSquare:L2,ArrowDownRightSquareIcon:L2,ArrowDownSquare:O2,ArrowDownSquareIcon:O2,ArrowDownToDot:mD,ArrowDownToDotIcon:mD,ArrowDownToLine:fD,ArrowDownToLineIcon:fD,ArrowDownUp:pD,ArrowDownUpIcon:pD,ArrowDownWideNarrow:F_,ArrowDownWideNarrowIcon:F_,ArrowDownZA:z_,ArrowDownZAIcon:z_,ArrowDownZa:z_,ArrowDownZaIcon:z_,ArrowLeft:Wi,ArrowLeftCircle:cb,ArrowLeftCircleIcon:cb,ArrowLeftFromLine:gD,ArrowLeftFromLineIcon:gD,ArrowLeftIcon:Wi,ArrowLeftRight:xD,ArrowLeftRightIcon:xD,ArrowLeftSquare:D2,ArrowLeftSquareIcon:D2,ArrowLeftToLine:yD,ArrowLeftToLineIcon:yD,ArrowRight:No,ArrowRightCircle:fb,ArrowRightCircleIcon:fb,ArrowRightFromLine:vD,ArrowRightFromLineIcon:vD,ArrowRightIcon:No,ArrowRightLeft:_D,ArrowRightLeftIcon:_D,ArrowRightSquare:$2,ArrowRightSquareIcon:$2,ArrowRightToLine:bD,ArrowRightToLineIcon:bD,ArrowUp:df,ArrowUp01:wD,ArrowUp01Icon:wD,ArrowUp10:jD,ArrowUp10Icon:jD,ArrowUpAZ:B_,ArrowUpAZIcon:B_,ArrowUpAz:B_,ArrowUpAzIcon:B_,ArrowUpCircle:pb,ArrowUpCircleIcon:pb,ArrowUpDown:Og,ArrowUpDownIcon:Og,ArrowUpFromDot:kD,ArrowUpFromDotIcon:kD,ArrowUpFromLine:ND,ArrowUpFromLineIcon:ND,ArrowUpIcon:df,ArrowUpLeft:SD,ArrowUpLeftFromCircle:hb,ArrowUpLeftFromCircleIcon:hb,ArrowUpLeftFromSquare:z2,ArrowUpLeftFromSquareIcon:z2,ArrowUpLeftIcon:SD,ArrowUpLeftSquare:U2,ArrowUpLeftSquareIcon:U2,ArrowUpNarrowWide:$_,ArrowUpNarrowWideIcon:$_,ArrowUpRight:CD,ArrowUpRightFromCircle:mb,ArrowUpRightFromCircleIcon:mb,ArrowUpRightFromSquare:B2,ArrowUpRightFromSquareIcon:B2,ArrowUpRightIcon:CD,ArrowUpRightSquare:q2,ArrowUpRightSquareIcon:q2,ArrowUpSquare:V2,ArrowUpSquareIcon:V2,ArrowUpToLine:MD,ArrowUpToLineIcon:MD,ArrowUpWideNarrow:TD,ArrowUpWideNarrowIcon:TD,ArrowUpZA:U_,ArrowUpZAIcon:U_,ArrowUpZa:U_,ArrowUpZaIcon:U_,ArrowsUpFromLine:AD,ArrowsUpFromLineIcon:AD,Asterisk:ED,AsteriskIcon:ED,AsteriskSquare:H2,AsteriskSquareIcon:H2,AtSign:ID,AtSignIcon:ID,Atom:PD,AtomIcon:PD,AudioLines:LD,AudioLinesIcon:LD,AudioWaveform:OD,AudioWaveformIcon:OD,Award:Bl,AwardIcon:Bl,Axe:DD,AxeIcon:DD,Axis3D:q_,Axis3DIcon:q_,Axis3d:q_,Axis3dIcon:q_,Baby:RD,BabyIcon:RD,Backpack:FD,BackpackIcon:FD,Badge:eR,BadgeAlert:zD,BadgeAlertIcon:zD,BadgeCent:BD,BadgeCentIcon:BD,BadgeCheck:V_,BadgeCheckIcon:V_,BadgeDollarSign:$D,BadgeDollarSignIcon:$D,BadgeEuro:UD,BadgeEuroIcon:UD,BadgeHelp:qD,BadgeHelpIcon:qD,BadgeIcon:eR,BadgeIndianRupee:VD,BadgeIndianRupeeIcon:VD,BadgeInfo:HD,BadgeInfoIcon:HD,BadgeJapaneseYen:WD,BadgeJapaneseYenIcon:WD,BadgeMinus:GD,BadgeMinusIcon:GD,BadgePercent:KD,BadgePercentIcon:KD,BadgePlus:ZD,BadgePlusIcon:ZD,BadgePoundSterling:YD,BadgePoundSterlingIcon:YD,BadgeRussianRuble:XD,BadgeRussianRubleIcon:XD,BadgeSwissFranc:QD,BadgeSwissFrancIcon:QD,BadgeX:JD,BadgeXIcon:JD,BaggageClaim:tR,BaggageClaimIcon:tR,Ban:rR,BanIcon:rR,Banana:nR,BananaIcon:nR,Bandage:sR,BandageIcon:sR,Banknote:aR,BanknoteIcon:aR,BarChart:nb,BarChart2:sb,BarChart2Icon:sb,BarChart3:_c,BarChart3Icon:_c,BarChart4:tb,BarChart4Icon:tb,BarChartBig:eb,BarChartBigIcon:eb,BarChartHorizontal:Q_,BarChartHorizontalBig:X_,BarChartHorizontalBigIcon:X_,BarChartHorizontalIcon:Q_,BarChartIcon:nb,Barcode:iR,BarcodeIcon:iR,Baseline:oR,BaselineIcon:oR,Bath:B1,BathIcon:B1,Battery:mR,BatteryCharging:lR,BatteryChargingIcon:lR,BatteryFull:cR,BatteryFullIcon:cR,BatteryIcon:mR,BatteryLow:dR,BatteryLowIcon:dR,BatteryMedium:uR,BatteryMediumIcon:uR,BatteryWarning:hR,BatteryWarningIcon:hR,Beaker:fR,BeakerIcon:fR,Bean:gR,BeanIcon:gR,BeanOff:pR,BeanOffIcon:pR,Bed:$1,BedDouble:xR,BedDoubleIcon:xR,BedIcon:$1,BedSingle:yR,BedSingleIcon:yR,Beef:vR,BeefIcon:vR,Beer:bR,BeerIcon:bR,BeerOff:_R,BeerOffIcon:_R,Bell:Dg,BellDot:wR,BellDotIcon:wR,BellElectric:jR,BellElectricIcon:jR,BellIcon:Dg,BellMinus:kR,BellMinusIcon:kR,BellOff:Mj,BellOffIcon:Mj,BellPlus:NR,BellPlusIcon:NR,BellRing:SR,BellRingIcon:SR,BetweenHorizonalEnd:H_,BetweenHorizonalEndIcon:H_,BetweenHorizonalStart:W_,BetweenHorizonalStartIcon:W_,BetweenHorizontalEnd:H_,BetweenHorizontalEndIcon:H_,BetweenHorizontalStart:W_,BetweenHorizontalStartIcon:W_,BetweenVerticalEnd:CR,BetweenVerticalEndIcon:CR,BetweenVerticalStart:MR,BetweenVerticalStartIcon:MR,BicepsFlexed:TR,BicepsFlexedIcon:TR,Bike:AR,BikeIcon:AR,Binary:ER,BinaryIcon:ER,Binoculars:IR,BinocularsIcon:IR,Biohazard:PR,BiohazardIcon:PR,Bird:LR,BirdIcon:LR,Bitcoin:OR,BitcoinIcon:OR,Blend:DR,BlendIcon:DR,Blinds:RR,BlindsIcon:RR,Blocks:FR,BlocksIcon:FR,Bluetooth:UR,BluetoothConnected:zR,BluetoothConnectedIcon:zR,BluetoothIcon:UR,BluetoothOff:BR,BluetoothOffIcon:BR,BluetoothSearching:$R,BluetoothSearchingIcon:$R,Bold:b4,BoldIcon:b4,Bolt:qR,BoltIcon:qR,Bomb:VR,BombIcon:VR,Bone:HR,BoneIcon:HR,Book:mF,BookA:WR,BookAIcon:WR,BookAudio:GR,BookAudioIcon:GR,BookCheck:KR,BookCheckIcon:KR,BookCopy:ZR,BookCopyIcon:ZR,BookDashed:G_,BookDashedIcon:G_,BookDown:YR,BookDownIcon:YR,BookHeadphones:XR,BookHeadphonesIcon:XR,BookHeart:QR,BookHeartIcon:QR,BookIcon:mF,BookImage:JR,BookImageIcon:JR,BookKey:eF,BookKeyIcon:eF,BookLock:tF,BookLockIcon:tF,BookMarked:rF,BookMarkedIcon:rF,BookMinus:nF,BookMinusIcon:nF,BookOpen:eA,BookOpenCheck:sF,BookOpenCheckIcon:sF,BookOpenIcon:eA,BookOpenText:aF,BookOpenTextIcon:aF,BookPlus:iF,BookPlusIcon:iF,BookTemplate:G_,BookTemplateIcon:G_,BookText:oF,BookTextIcon:oF,BookType:lF,BookTypeIcon:lF,BookUp:dF,BookUp2:cF,BookUp2Icon:cF,BookUpIcon:dF,BookUser:uF,BookUserIcon:uF,BookX:hF,BookXIcon:hF,Bookmark:Mp,BookmarkCheck:fF,BookmarkCheckIcon:fF,BookmarkIcon:Mp,BookmarkMinus:pF,BookmarkMinusIcon:pF,BookmarkPlus:tA,BookmarkPlusIcon:tA,BookmarkX:gF,BookmarkXIcon:gF,BoomBox:xF,BoomBoxIcon:xF,Bot:w4,BotIcon:w4,BotMessageSquare:yF,BotMessageSquareIcon:yF,BotOff:vF,BotOffIcon:vF,Box:_F,BoxIcon:_F,BoxSelect:tw,BoxSelectIcon:tw,Boxes:bF,BoxesIcon:bF,Braces:K_,BracesIcon:K_,Brackets:wF,BracketsIcon:wF,Brain:rA,BrainCircuit:jF,BrainCircuitIcon:jF,BrainCog:kF,BrainCogIcon:kF,BrainIcon:rA,BrickWall:NF,BrickWallIcon:NF,Briefcase:Oh,BriefcaseBusiness:SF,BriefcaseBusinessIcon:SF,BriefcaseConveyorBelt:CF,BriefcaseConveyorBeltIcon:CF,BriefcaseIcon:Oh,BriefcaseMedical:MF,BriefcaseMedicalIcon:MF,BringToFront:TF,BringToFrontIcon:TF,Brush:AF,BrushIcon:AF,Bug:PF,BugIcon:PF,BugOff:EF,BugOffIcon:EF,BugPlay:IF,BugPlayIcon:IF,Building:Tj,Building2:hi,Building2Icon:hi,BuildingIcon:Tj,Bus:OF,BusFront:LF,BusFrontIcon:LF,BusIcon:OF,Cable:RF,CableCar:DF,CableCarIcon:DF,CableIcon:RF,Cake:mm,CakeIcon:mm,CakeSlice:FF,CakeSliceIcon:FF,Calculator:zF,CalculatorIcon:zF,Calendar:Cs,Calendar1:BF,Calendar1Icon:BF,CalendarArrowDown:$F,CalendarArrowDownIcon:$F,CalendarArrowUp:UF,CalendarArrowUpIcon:UF,CalendarCheck:VF,CalendarCheck2:qF,CalendarCheck2Icon:qF,CalendarCheckIcon:VF,CalendarClock:nA,CalendarClockIcon:nA,CalendarCog:HF,CalendarCogIcon:HF,CalendarDays:Tp,CalendarDaysIcon:Tp,CalendarFold:WF,CalendarFoldIcon:WF,CalendarHeart:GF,CalendarHeartIcon:GF,CalendarIcon:Cs,CalendarMinus:ZF,CalendarMinus2:KF,CalendarMinus2Icon:KF,CalendarMinusIcon:ZF,CalendarOff:YF,CalendarOffIcon:YF,CalendarPlus:Aj,CalendarPlus2:XF,CalendarPlus2Icon:XF,CalendarPlusIcon:Aj,CalendarRange:QF,CalendarRangeIcon:QF,CalendarSearch:JF,CalendarSearchIcon:JF,CalendarSync:ez,CalendarSyncIcon:ez,CalendarX:rz,CalendarX2:tz,CalendarX2Icon:tz,CalendarXIcon:rz,Camera:Rg,CameraIcon:Rg,CameraOff:nz,CameraOffIcon:nz,CandlestickChart:J_,CandlestickChartIcon:J_,Candy:iz,CandyCane:sz,CandyCaneIcon:sz,CandyIcon:iz,CandyOff:az,CandyOffIcon:az,Cannabis:oz,CannabisIcon:oz,Captions:Z_,CaptionsIcon:Z_,CaptionsOff:lz,CaptionsOffIcon:lz,Car:uz,CarFront:cz,CarFrontIcon:cz,CarIcon:uz,CarTaxiFront:dz,CarTaxiFrontIcon:dz,Caravan:hz,CaravanIcon:hz,Carrot:mz,CarrotIcon:mz,CaseLower:fz,CaseLowerIcon:fz,CaseSensitive:pz,CaseSensitiveIcon:pz,CaseUpper:gz,CaseUpperIcon:gz,CassetteTape:xz,CassetteTapeIcon:xz,Cast:yz,CastIcon:yz,Castle:vz,CastleIcon:vz,Cat:_z,CatIcon:_z,Cctv:bz,CctvIcon:bz,ChartArea:Y_,ChartAreaIcon:Y_,ChartBar:Q_,ChartBarBig:X_,ChartBarBigIcon:X_,ChartBarDecreasing:wz,ChartBarDecreasingIcon:wz,ChartBarIcon:Q_,ChartBarIncreasing:jz,ChartBarIncreasingIcon:jz,ChartBarStacked:kz,ChartBarStackedIcon:kz,ChartCandlestick:J_,ChartCandlestickIcon:J_,ChartColumn:_c,ChartColumnBig:eb,ChartColumnBigIcon:eb,ChartColumnDecreasing:Nz,ChartColumnDecreasingIcon:Nz,ChartColumnIcon:_c,ChartColumnIncreasing:tb,ChartColumnIncreasingIcon:tb,ChartColumnStacked:Sz,ChartColumnStackedIcon:Sz,ChartGantt:Cz,ChartGanttIcon:Cz,ChartLine:rb,ChartLineIcon:rb,ChartNetwork:Mz,ChartNetworkIcon:Mz,ChartNoAxesColumn:sb,ChartNoAxesColumnDecreasing:Tz,ChartNoAxesColumnDecreasingIcon:Tz,ChartNoAxesColumnIcon:sb,ChartNoAxesColumnIncreasing:nb,ChartNoAxesColumnIncreasingIcon:nb,ChartNoAxesCombined:Az,ChartNoAxesCombinedIcon:Az,ChartNoAxesGantt:ab,ChartNoAxesGanttIcon:ab,ChartPie:ib,ChartPieIcon:ib,ChartScatter:ob,ChartScatterIcon:ob,ChartSpline:Ez,ChartSplineIcon:Ez,Check:mi,CheckCheck:Iz,CheckCheckIcon:Iz,CheckCircle:oi,CheckCircle2:no,CheckCircle2Icon:no,CheckCircleIcon:oi,CheckIcon:mi,CheckSquare:Y0,CheckSquare2:G2,CheckSquare2Icon:G2,CheckSquareIcon:Y0,ChefHat:Pz,ChefHatIcon:Pz,Cherry:Lz,CherryIcon:Lz,ChevronDown:Rd,ChevronDownCircle:gb,ChevronDownCircleIcon:gb,ChevronDownIcon:Rd,ChevronDownSquare:K2,ChevronDownSquareIcon:K2,ChevronFirst:Oz,ChevronFirstIcon:Oz,ChevronLast:Dz,ChevronLastIcon:Dz,ChevronLeft:kc,ChevronLeftCircle:xb,ChevronLeftCircleIcon:xb,ChevronLeftIcon:kc,ChevronLeftSquare:Z2,ChevronLeftSquareIcon:Z2,ChevronRight:Gi,ChevronRightCircle:yb,ChevronRightCircleIcon:yb,ChevronRightIcon:Gi,ChevronRightSquare:Y2,ChevronRightSquareIcon:Y2,ChevronUp:ly,ChevronUpCircle:vb,ChevronUpCircleIcon:vb,ChevronUpIcon:ly,ChevronUpSquare:X2,ChevronUpSquareIcon:X2,ChevronsDown:Fz,ChevronsDownIcon:Fz,ChevronsDownUp:Rz,ChevronsDownUpIcon:Rz,ChevronsLeft:$z,ChevronsLeftIcon:$z,ChevronsLeftRight:Bz,ChevronsLeftRightEllipsis:zz,ChevronsLeftRightEllipsisIcon:zz,ChevronsLeftRightIcon:Bz,ChevronsRight:qz,ChevronsRightIcon:qz,ChevronsRightLeft:Uz,ChevronsRightLeftIcon:Uz,ChevronsUp:Vz,ChevronsUpDown:cy,ChevronsUpDownIcon:cy,ChevronsUpIcon:Vz,Chrome:Hz,ChromeIcon:Hz,Church:Wz,ChurchIcon:Wz,Cigarette:Kz,CigaretteIcon:Kz,CigaretteOff:Gz,CigaretteOffIcon:Gz,Circle:Ju,CircleAlert:yl,CircleAlertIcon:yl,CircleArrowDown:lb,CircleArrowDownIcon:lb,CircleArrowLeft:cb,CircleArrowLeftIcon:cb,CircleArrowOutDownLeft:db,CircleArrowOutDownLeftIcon:db,CircleArrowOutDownRight:ub,CircleArrowOutDownRightIcon:ub,CircleArrowOutUpLeft:hb,CircleArrowOutUpLeftIcon:hb,CircleArrowOutUpRight:mb,CircleArrowOutUpRightIcon:mb,CircleArrowRight:fb,CircleArrowRightIcon:fb,CircleArrowUp:pb,CircleArrowUpIcon:pb,CircleCheck:no,CircleCheckBig:oi,CircleCheckBigIcon:oi,CircleCheckIcon:no,CircleChevronDown:gb,CircleChevronDownIcon:gb,CircleChevronLeft:xb,CircleChevronLeftIcon:xb,CircleChevronRight:yb,CircleChevronRightIcon:yb,CircleChevronUp:vb,CircleChevronUpIcon:vb,CircleDashed:Zz,CircleDashedIcon:Zz,CircleDivide:_b,CircleDivideIcon:_b,CircleDollarSign:Yz,CircleDollarSignIcon:Yz,CircleDot:Qz,CircleDotDashed:Xz,CircleDotDashedIcon:Xz,CircleDotIcon:Qz,CircleEllipsis:Jz,CircleEllipsisIcon:Jz,CircleEqual:e7,CircleEqualIcon:e7,CircleFadingArrowUp:t7,CircleFadingArrowUpIcon:t7,CircleFadingPlus:r7,CircleFadingPlusIcon:r7,CircleGauge:bb,CircleGaugeIcon:bb,CircleHelp:Kx,CircleHelpIcon:Kx,CircleIcon:Ju,CircleMinus:wb,CircleMinusIcon:wb,CircleOff:n7,CircleOffIcon:n7,CircleParking:kb,CircleParkingIcon:kb,CircleParkingOff:jb,CircleParkingOffIcon:jb,CirclePause:Nb,CirclePauseIcon:Nb,CirclePercent:Sb,CirclePercentIcon:Sb,CirclePlay:rf,CirclePlayIcon:rf,CirclePlus:Cb,CirclePlusIcon:Cb,CirclePower:Mb,CirclePowerIcon:Mb,CircleSlash:s7,CircleSlash2:Tb,CircleSlash2Icon:Tb,CircleSlashIcon:s7,CircleSlashed:Tb,CircleSlashedIcon:Tb,CircleStop:Ab,CircleStopIcon:Ab,CircleUser:Ib,CircleUserIcon:Ib,CircleUserRound:Eb,CircleUserRoundIcon:Eb,CircleX:bc,CircleXIcon:bc,CircuitBoard:a7,CircuitBoardIcon:a7,Citrus:i7,CitrusIcon:i7,Clapperboard:o7,ClapperboardIcon:o7,Clipboard:f7,ClipboardCheck:sA,ClipboardCheckIcon:sA,ClipboardCopy:l7,ClipboardCopyIcon:l7,ClipboardEdit:Lb,ClipboardEditIcon:Lb,ClipboardIcon:f7,ClipboardList:aA,ClipboardListIcon:aA,ClipboardMinus:c7,ClipboardMinusIcon:c7,ClipboardPaste:d7,ClipboardPasteIcon:d7,ClipboardPen:Lb,ClipboardPenIcon:Lb,ClipboardPenLine:Pb,ClipboardPenLineIcon:Pb,ClipboardPlus:u7,ClipboardPlusIcon:u7,ClipboardSignature:Pb,ClipboardSignatureIcon:Pb,ClipboardType:h7,ClipboardTypeIcon:h7,ClipboardX:m7,ClipboardXIcon:m7,Clock:Xa,Clock1:p7,Clock10:g7,Clock10Icon:g7,Clock11:x7,Clock11Icon:x7,Clock12:y7,Clock12Icon:y7,Clock1Icon:p7,Clock2:v7,Clock2Icon:v7,Clock3:_7,Clock3Icon:_7,Clock4:b7,Clock4Icon:b7,Clock5:w7,Clock5Icon:w7,Clock6:j7,Clock6Icon:j7,Clock7:k7,Clock7Icon:k7,Clock8:N7,Clock8Icon:N7,Clock9:S7,Clock9Icon:S7,ClockAlert:C7,ClockAlertIcon:C7,ClockArrowDown:M7,ClockArrowDownIcon:M7,ClockArrowUp:T7,ClockArrowUpIcon:T7,ClockIcon:Xa,Cloud:V7,CloudAlert:A7,CloudAlertIcon:A7,CloudCog:E7,CloudCogIcon:E7,CloudDownload:Ob,CloudDownloadIcon:Ob,CloudDrizzle:I7,CloudDrizzleIcon:I7,CloudFog:P7,CloudFogIcon:P7,CloudHail:L7,CloudHailIcon:L7,CloudIcon:V7,CloudLightning:O7,CloudLightningIcon:O7,CloudMoon:R7,CloudMoonIcon:R7,CloudMoonRain:D7,CloudMoonRainIcon:D7,CloudOff:F7,CloudOffIcon:F7,CloudRain:B7,CloudRainIcon:B7,CloudRainWind:z7,CloudRainWindIcon:z7,CloudSnow:$7,CloudSnowIcon:$7,CloudSun:q7,CloudSunIcon:q7,CloudSunRain:U7,CloudSunRainIcon:U7,CloudUpload:Db,CloudUploadIcon:Db,Cloudy:H7,CloudyIcon:H7,Clover:ty,CloverIcon:ty,Club:W7,ClubIcon:W7,Code:Ej,Code2:Rb,Code2Icon:Rb,CodeIcon:Ej,CodeSquare:Q2,CodeSquareIcon:Q2,CodeXml:Rb,CodeXmlIcon:Rb,Codepen:G7,CodepenIcon:G7,Codesandbox:K7,CodesandboxIcon:K7,Coffee:Ij,CoffeeIcon:Ij,Cog:Z7,CogIcon:Z7,Coins:Y7,CoinsIcon:Y7,Columns:Fb,Columns2:Fb,Columns2Icon:Fb,Columns3:zb,Columns3Icon:zb,Columns4:X7,Columns4Icon:X7,ColumnsIcon:Fb,Combine:Q7,CombineIcon:Q7,Command:J7,CommandIcon:J7,Compass:e9,CompassIcon:e9,Component:t9,ComponentIcon:t9,Computer:r9,ComputerIcon:r9,ConciergeBell:n9,ConciergeBellIcon:n9,Cone:s9,ConeIcon:s9,Construction:a9,ConstructionIcon:a9,Contact:i9,Contact2:Bb,Contact2Icon:Bb,ContactIcon:i9,ContactRound:Bb,ContactRoundIcon:Bb,Container:o9,ContainerIcon:o9,Contrast:l9,ContrastIcon:l9,Cookie:c9,CookieIcon:c9,CookingPot:d9,CookingPotIcon:d9,Copy:Po,CopyCheck:u9,CopyCheckIcon:u9,CopyIcon:Po,CopyMinus:h9,CopyMinusIcon:h9,CopyPlus:m9,CopyPlusIcon:m9,CopySlash:f9,CopySlashIcon:f9,CopyX:p9,CopyXIcon:p9,Copyleft:g9,CopyleftIcon:g9,Copyright:x9,CopyrightIcon:x9,CornerDownLeft:y9,CornerDownLeftIcon:y9,CornerDownRight:v9,CornerDownRightIcon:v9,CornerLeftDown:_9,CornerLeftDownIcon:_9,CornerLeftUp:b9,CornerLeftUpIcon:b9,CornerRightDown:w9,CornerRightDownIcon:w9,CornerRightUp:j9,CornerRightUpIcon:j9,CornerUpLeft:k9,CornerUpLeftIcon:k9,CornerUpRight:N9,CornerUpRightIcon:N9,Cpu:S9,CpuIcon:S9,CreativeCommons:C9,CreativeCommonsIcon:C9,CreditCard:uf,CreditCardIcon:uf,Croissant:M9,CroissantIcon:M9,Crop:T9,CropIcon:T9,Cross:A9,CrossIcon:A9,Crosshair:E9,CrosshairIcon:E9,Crown:U1,CrownIcon:U1,Cuboid:I9,CuboidIcon:I9,CupSoda:P9,CupSodaIcon:P9,CurlyBraces:K_,CurlyBracesIcon:K_,Currency:L9,CurrencyIcon:L9,Cylinder:O9,CylinderIcon:O9,Dam:D9,DamIcon:D9,Database:z9,DatabaseBackup:R9,DatabaseBackupIcon:R9,DatabaseIcon:z9,DatabaseZap:F9,DatabaseZapIcon:F9,Delete:B9,DeleteIcon:B9,Dessert:$9,DessertIcon:$9,Diameter:U9,DiameterIcon:U9,Diamond:H9,DiamondIcon:H9,DiamondMinus:q9,DiamondMinusIcon:q9,DiamondPercent:$b,DiamondPercentIcon:$b,DiamondPlus:V9,DiamondPlusIcon:V9,Dice1:W9,Dice1Icon:W9,Dice2:G9,Dice2Icon:G9,Dice3:K9,Dice3Icon:K9,Dice4:Z9,Dice4Icon:Z9,Dice5:Y9,Dice5Icon:Y9,Dice6:X9,Dice6Icon:X9,Dices:Q9,DicesIcon:Q9,Diff:J9,DiffIcon:J9,Disc:nB,Disc2:eB,Disc2Icon:eB,Disc3:tB,Disc3Icon:tB,DiscAlbum:rB,DiscAlbumIcon:rB,DiscIcon:nB,Divide:sB,DivideCircle:_b,DivideCircleIcon:_b,DivideIcon:sB,DivideSquare:rw,DivideSquareIcon:rw,Dna:iB,DnaIcon:iB,DnaOff:aB,DnaOffIcon:aB,Dock:oB,DockIcon:oB,Dog:lB,DogIcon:lB,DollarSign:Fd,DollarSignIcon:Fd,Donut:cB,DonutIcon:cB,DoorClosed:dB,DoorClosedIcon:dB,DoorOpen:Pj,DoorOpenIcon:Pj,Dot:uB,DotIcon:uB,DotSquare:nw,DotSquareIcon:nw,Download:so,DownloadCloud:Ob,DownloadCloudIcon:Ob,DownloadIcon:so,DraftingCompass:hB,DraftingCompassIcon:hB,Drama:mB,DramaIcon:mB,Dribbble:fB,DribbbleIcon:fB,Drill:pB,DrillIcon:pB,Droplet:gB,DropletIcon:gB,Droplets:xB,DropletsIcon:xB,Drum:yB,DrumIcon:yB,Drumstick:vB,DrumstickIcon:vB,Dumbbell:_B,DumbbellIcon:_B,Ear:wB,EarIcon:wB,EarOff:bB,EarOffIcon:bB,Earth:Ub,EarthIcon:Ub,EarthLock:jB,EarthLockIcon:jB,Eclipse:kB,EclipseIcon:kB,Edit:gc,Edit2:Z0,Edit2Icon:Z0,Edit3:K0,Edit3Icon:K0,EditIcon:gc,Egg:j4,EggFried:NB,EggFriedIcon:NB,EggIcon:j4,EggOff:SB,EggOffIcon:SB,Ellipsis:gp,EllipsisIcon:gp,EllipsisVertical:kg,EllipsisVerticalIcon:kg,Equal:TB,EqualApproximately:CB,EqualApproximatelyIcon:CB,EqualIcon:TB,EqualNot:MB,EqualNotIcon:MB,EqualSquare:sw,EqualSquareIcon:sw,Eraser:AB,EraserIcon:AB,EthernetPort:EB,EthernetPortIcon:EB,Euro:IB,EuroIcon:IB,Expand:PB,ExpandIcon:PB,ExternalLink:Ss,ExternalLinkIcon:Ss,Eye:_o,EyeClosed:LB,EyeClosedIcon:LB,EyeIcon:_o,EyeOff:Fg,EyeOffIcon:Fg,Facebook:au,FacebookIcon:au,Factory:OB,FactoryIcon:OB,Fan:DB,FanIcon:DB,FastForward:RB,FastForwardIcon:RB,Feather:FB,FeatherIcon:FB,Fence:zB,FenceIcon:zB,FerrisWheel:BB,FerrisWheelIcon:BB,Figma:$B,FigmaIcon:$B,File:O$,FileArchive:UB,FileArchiveIcon:UB,FileAudio:VB,FileAudio2:qB,FileAudio2Icon:qB,FileAudioIcon:VB,FileAxis3D:qb,FileAxis3DIcon:qb,FileAxis3d:qb,FileAxis3dIcon:qb,FileBadge:WB,FileBadge2:HB,FileBadge2Icon:HB,FileBadgeIcon:WB,FileBarChart:Vb,FileBarChart2:Hb,FileBarChart2Icon:Hb,FileBarChartIcon:Vb,FileBox:GB,FileBoxIcon:GB,FileChartColumn:Hb,FileChartColumnIcon:Hb,FileChartColumnIncreasing:Vb,FileChartColumnIncreasingIcon:Vb,FileChartLine:Wb,FileChartLineIcon:Wb,FileChartPie:Gb,FileChartPieIcon:Gb,FileCheck:ZB,FileCheck2:KB,FileCheck2Icon:KB,FileCheckIcon:ZB,FileClock:YB,FileClockIcon:YB,FileCode:QB,FileCode2:XB,FileCode2Icon:XB,FileCodeIcon:QB,FileCog:Kb,FileCog2:Kb,FileCog2Icon:Kb,FileCogIcon:Kb,FileDiff:JB,FileDiffIcon:JB,FileDigit:e$,FileDigitIcon:e$,FileDown:t$,FileDownIcon:t$,FileEdit:Yb,FileEditIcon:Yb,FileHeart:r$,FileHeartIcon:r$,FileIcon:O$,FileImage:q1,FileImageIcon:q1,FileInput:n$,FileInputIcon:n$,FileJson:a$,FileJson2:s$,FileJson2Icon:s$,FileJsonIcon:a$,FileKey:o$,FileKey2:i$,FileKey2Icon:i$,FileKeyIcon:o$,FileLineChart:Wb,FileLineChartIcon:Wb,FileLock:c$,FileLock2:l$,FileLock2Icon:l$,FileLockIcon:c$,FileMinus:u$,FileMinus2:d$,FileMinus2Icon:d$,FileMinusIcon:u$,FileMusic:h$,FileMusicIcon:h$,FileOutput:m$,FileOutputIcon:m$,FilePen:Yb,FilePenIcon:Yb,FilePenLine:Zb,FilePenLineIcon:Zb,FilePieChart:Gb,FilePieChartIcon:Gb,FilePlus:p$,FilePlus2:f$,FilePlus2Icon:f$,FilePlusIcon:p$,FileQuestion:g$,FileQuestionIcon:g$,FileScan:x$,FileScanIcon:x$,FileSearch:v$,FileSearch2:y$,FileSearch2Icon:y$,FileSearchIcon:v$,FileSignature:Zb,FileSignatureIcon:Zb,FileSliders:_$,FileSlidersIcon:_$,FileSpreadsheet:V1,FileSpreadsheetIcon:V1,FileStack:b$,FileStackIcon:b$,FileSymlink:w$,FileSymlinkIcon:w$,FileTerminal:j$,FileTerminalIcon:j$,FileText:_a,FileTextIcon:_a,FileType:N$,FileType2:k$,FileType2Icon:k$,FileTypeIcon:N$,FileUp:S$,FileUpIcon:S$,FileUser:C$,FileUserIcon:C$,FileVideo:T$,FileVideo2:M$,FileVideo2Icon:M$,FileVideoIcon:T$,FileVolume:E$,FileVolume2:A$,FileVolume2Icon:A$,FileVolumeIcon:E$,FileWarning:I$,FileWarningIcon:I$,FileX:L$,FileX2:P$,FileX2Icon:P$,FileXIcon:L$,Files:D$,FilesIcon:D$,Film:Td,FilmIcon:Td,Filter:H1,FilterIcon:H1,FilterX:R$,FilterXIcon:R$,Fingerprint:F$,FingerprintIcon:F$,FireExtinguisher:z$,FireExtinguisherIcon:z$,Fish:U$,FishIcon:U$,FishOff:B$,FishOffIcon:B$,FishSymbol:$$,FishSymbolIcon:$$,Flag:dy,FlagIcon:dy,FlagOff:q$,FlagOffIcon:q$,FlagTriangleLeft:V$,FlagTriangleLeftIcon:V$,FlagTriangleRight:H$,FlagTriangleRightIcon:H$,Flame:fm,FlameIcon:fm,FlameKindling:W$,FlameKindlingIcon:W$,Flashlight:K$,FlashlightIcon:K$,FlashlightOff:G$,FlashlightOffIcon:G$,FlaskConical:Lj,FlaskConicalIcon:Lj,FlaskConicalOff:Z$,FlaskConicalOffIcon:Z$,FlaskRound:Y$,FlaskRoundIcon:Y$,FlipHorizontal:Q$,FlipHorizontal2:X$,FlipHorizontal2Icon:X$,FlipHorizontalIcon:Q$,FlipVertical:eU,FlipVertical2:J$,FlipVertical2Icon:J$,FlipVerticalIcon:eU,Flower:tU,Flower2:bp,Flower2Icon:bp,FlowerIcon:tU,Focus:rU,FocusIcon:rU,FoldHorizontal:nU,FoldHorizontalIcon:nU,FoldVertical:sU,FoldVerticalIcon:sU,Folder:EU,FolderArchive:aU,FolderArchiveIcon:aU,FolderCheck:iU,FolderCheckIcon:iU,FolderClock:oU,FolderClockIcon:oU,FolderClosed:lU,FolderClosedIcon:lU,FolderCode:cU,FolderCodeIcon:cU,FolderCog:Xb,FolderCog2:Xb,FolderCog2Icon:Xb,FolderCogIcon:Xb,FolderDot:dU,FolderDotIcon:dU,FolderDown:uU,FolderDownIcon:uU,FolderEdit:Qb,FolderEditIcon:Qb,FolderGit:mU,FolderGit2:hU,FolderGit2Icon:hU,FolderGitIcon:mU,FolderHeart:fU,FolderHeartIcon:fU,FolderIcon:EU,FolderInput:pU,FolderInputIcon:pU,FolderKanban:gU,FolderKanbanIcon:gU,FolderKey:xU,FolderKeyIcon:xU,FolderLock:yU,FolderLockIcon:yU,FolderMinus:vU,FolderMinusIcon:vU,FolderOpen:Ap,FolderOpenDot:_U,FolderOpenDotIcon:_U,FolderOpenIcon:Ap,FolderOutput:bU,FolderOutputIcon:bU,FolderPen:Qb,FolderPenIcon:Qb,FolderPlus:wU,FolderPlusIcon:wU,FolderRoot:jU,FolderRootIcon:jU,FolderSearch:NU,FolderSearch2:kU,FolderSearch2Icon:kU,FolderSearchIcon:NU,FolderSymlink:SU,FolderSymlinkIcon:SU,FolderSync:CU,FolderSyncIcon:CU,FolderTree:MU,FolderTreeIcon:MU,FolderUp:TU,FolderUpIcon:TU,FolderX:AU,FolderXIcon:AU,Folders:IU,FoldersIcon:IU,Footprints:PU,FootprintsIcon:PU,ForkKnife:qw,ForkKnifeCrossed:Uw,ForkKnifeCrossedIcon:Uw,ForkKnifeIcon:qw,Forklift:LU,ForkliftIcon:LU,FormInput:k2,FormInputIcon:k2,Forward:OU,ForwardIcon:OU,Frame:DU,FrameIcon:DU,Framer:RU,FramerIcon:RU,Frown:FU,FrownIcon:FU,Fuel:zU,FuelIcon:zU,Fullscreen:BU,FullscreenIcon:BU,FunctionSquare:aw,FunctionSquareIcon:aw,GalleryHorizontal:UU,GalleryHorizontalEnd:$U,GalleryHorizontalEndIcon:$U,GalleryHorizontalIcon:UU,GalleryThumbnails:qU,GalleryThumbnailsIcon:qU,GalleryVertical:HU,GalleryVerticalEnd:VU,GalleryVerticalEndIcon:VU,GalleryVerticalIcon:HU,Gamepad:GU,Gamepad2:WU,Gamepad2Icon:WU,GamepadIcon:GU,GanttChart:ab,GanttChartIcon:ab,GanttChartSquare:pg,GanttChartSquareIcon:pg,Gauge:KU,GaugeCircle:bb,GaugeCircleIcon:bb,GaugeIcon:KU,Gavel:ZU,GavelIcon:ZU,Gem:YU,GemIcon:YU,Ghost:Oj,GhostIcon:Oj,Gift:ao,GiftIcon:ao,GitBranch:QU,GitBranchIcon:QU,GitBranchPlus:XU,GitBranchPlusIcon:XU,GitCommit:Jb,GitCommitHorizontal:Jb,GitCommitHorizontalIcon:Jb,GitCommitIcon:Jb,GitCommitVertical:JU,GitCommitVerticalIcon:JU,GitCompare:tq,GitCompareArrows:eq,GitCompareArrowsIcon:eq,GitCompareIcon:tq,GitFork:rq,GitForkIcon:rq,GitGraph:nq,GitGraphIcon:nq,GitMerge:sq,GitMergeIcon:sq,GitPullRequest:dq,GitPullRequestArrow:aq,GitPullRequestArrowIcon:aq,GitPullRequestClosed:iq,GitPullRequestClosedIcon:iq,GitPullRequestCreate:lq,GitPullRequestCreateArrow:oq,GitPullRequestCreateArrowIcon:oq,GitPullRequestCreateIcon:lq,GitPullRequestDraft:cq,GitPullRequestDraftIcon:cq,GitPullRequestIcon:dq,Github:uq,GithubIcon:uq,Gitlab:hq,GitlabIcon:hq,GlassWater:mq,GlassWaterIcon:mq,Glasses:fq,GlassesIcon:fq,Globe:uy,Globe2:Ub,Globe2Icon:Ub,GlobeIcon:uy,GlobeLock:pq,GlobeLockIcon:pq,Goal:gq,GoalIcon:gq,Grab:xq,GrabIcon:xq,GraduationCap:W1,GraduationCapIcon:W1,Grape:yq,GrapeIcon:yq,Grid:tm,Grid2X2:t2,Grid2X2Icon:t2,Grid2X2Plus:e2,Grid2X2PlusIcon:e2,Grid2x2:t2,Grid2x2Check:vq,Grid2x2CheckIcon:vq,Grid2x2Icon:t2,Grid2x2Plus:e2,Grid2x2PlusIcon:e2,Grid2x2X:_q,Grid2x2XIcon:_q,Grid3X3:tm,Grid3X3Icon:tm,Grid3x3:tm,Grid3x3Icon:tm,GridIcon:tm,Grip:wq,GripHorizontal:bq,GripHorizontalIcon:bq,GripIcon:wq,GripVertical:zg,GripVerticalIcon:zg,Group:jq,GroupIcon:jq,Guitar:kq,GuitarIcon:kq,Ham:Nq,HamIcon:Nq,Hammer:Sq,HammerIcon:Sq,Hand:Eq,HandCoins:Cq,HandCoinsIcon:Cq,HandHeart:Mq,HandHeartIcon:Mq,HandHelping:r2,HandHelpingIcon:r2,HandIcon:Eq,HandMetal:Tq,HandMetalIcon:Tq,HandPlatter:Aq,HandPlatterIcon:Aq,Handshake:Iq,HandshakeIcon:Iq,HardDrive:iA,HardDriveDownload:Pq,HardDriveDownloadIcon:Pq,HardDriveIcon:iA,HardDriveUpload:Lq,HardDriveUploadIcon:Lq,HardHat:Oq,HardHatIcon:Oq,Hash:k4,HashIcon:k4,Haze:Dq,HazeIcon:Dq,HdmiPort:Rq,HdmiPortIcon:Rq,Heading:Uq,Heading1:oA,Heading1Icon:oA,Heading2:lA,Heading2Icon:lA,Heading3:Fq,Heading3Icon:Fq,Heading4:zq,Heading4Icon:zq,Heading5:Bq,Heading5Icon:Bq,Heading6:$q,Heading6Icon:$q,HeadingIcon:Uq,HeadphoneOff:qq,HeadphoneOffIcon:qq,Headphones:Vq,HeadphonesIcon:Vq,Headset:Hq,HeadsetIcon:Hq,Heart:vi,HeartCrack:Wq,HeartCrackIcon:Wq,HeartHandshake:Gq,HeartHandshakeIcon:Gq,HeartIcon:vi,HeartOff:Kq,HeartOffIcon:Kq,HeartPulse:Zq,HeartPulseIcon:Zq,Heater:Yq,HeaterIcon:Yq,HelpCircle:Kx,HelpCircleIcon:Kx,HelpingHand:r2,HelpingHandIcon:r2,Hexagon:Xq,HexagonIcon:Xq,Highlighter:Qq,HighlighterIcon:Qq,History:N4,HistoryIcon:N4,Home:ya,HomeIcon:ya,Hop:eV,HopIcon:eV,HopOff:Jq,HopOffIcon:Jq,Hospital:tV,HospitalIcon:tV,Hotel:rV,HotelIcon:rV,Hourglass:nV,HourglassIcon:nV,House:ya,HouseIcon:ya,HousePlug:sV,HousePlugIcon:sV,HousePlus:aV,HousePlusIcon:aV,IceCream:s2,IceCream2:n2,IceCream2Icon:n2,IceCreamBowl:n2,IceCreamBowlIcon:n2,IceCreamCone:s2,IceCreamConeIcon:s2,IceCreamIcon:s2,Icon:EIe,IdCard:iV,IdCardIcon:iV,Image:Fl,ImageDown:oV,ImageDownIcon:oV,ImageIcon:Fl,ImageMinus:lV,ImageMinusIcon:lV,ImageOff:cV,ImageOffIcon:cV,ImagePlay:dV,ImagePlayIcon:dV,ImagePlus:Dj,ImagePlusIcon:Dj,ImageUp:uV,ImageUpIcon:uV,ImageUpscale:hV,ImageUpscaleIcon:hV,Images:mV,ImagesIcon:mV,Import:fV,ImportIcon:fV,Inbox:pV,InboxIcon:pV,Indent:i2,IndentDecrease:a2,IndentDecreaseIcon:a2,IndentIcon:i2,IndentIncrease:i2,IndentIncreaseIcon:i2,IndianRupee:gV,IndianRupeeIcon:gV,Infinity:xV,InfinityIcon:xV,Info:yV,InfoIcon:yV,Inspect:uw,InspectIcon:uw,InspectionPanel:vV,InspectionPanelIcon:vV,Instagram:_u,InstagramIcon:_u,Italic:S4,ItalicIcon:S4,IterationCcw:_V,IterationCcwIcon:_V,IterationCw:bV,IterationCwIcon:bV,JapaneseYen:wV,JapaneseYenIcon:wV,Joystick:jV,JoystickIcon:jV,Kanban:hy,KanbanIcon:hy,KanbanSquare:iw,KanbanSquareDashed:J2,KanbanSquareDashedIcon:J2,KanbanSquareIcon:iw,Key:pm,KeyIcon:pm,KeyRound:Rj,KeyRoundIcon:Rj,KeySquare:kV,KeySquareIcon:kV,Keyboard:CV,KeyboardIcon:CV,KeyboardMusic:NV,KeyboardMusicIcon:NV,KeyboardOff:SV,KeyboardOffIcon:SV,Lamp:PV,LampCeiling:MV,LampCeilingIcon:MV,LampDesk:TV,LampDeskIcon:TV,LampFloor:AV,LampFloorIcon:AV,LampIcon:PV,LampWallDown:EV,LampWallDownIcon:EV,LampWallUp:IV,LampWallUpIcon:IV,LandPlot:LV,LandPlotIcon:LV,Landmark:OV,LandmarkIcon:OV,Languages:DV,LanguagesIcon:DV,Laptop:FV,Laptop2:o2,Laptop2Icon:o2,LaptopIcon:FV,LaptopMinimal:o2,LaptopMinimalCheck:RV,LaptopMinimalCheckIcon:RV,LaptopMinimalIcon:o2,Lasso:BV,LassoIcon:BV,LassoSelect:zV,LassoSelectIcon:zV,Laugh:$V,LaughIcon:$V,Layers:VV,Layers2:UV,Layers2Icon:UV,Layers3:qV,Layers3Icon:qV,LayersIcon:VV,Layout:G0,LayoutDashboard:Fj,LayoutDashboardIcon:Fj,LayoutGrid:hf,LayoutGridIcon:hf,LayoutIcon:G0,LayoutList:HV,LayoutListIcon:HV,LayoutPanelLeft:WV,LayoutPanelLeftIcon:WV,LayoutPanelTop:GV,LayoutPanelTopIcon:GV,LayoutTemplate:zj,LayoutTemplateIcon:zj,Leaf:KV,LeafIcon:KV,LeafyGreen:ZV,LeafyGreenIcon:ZV,Lectern:YV,LecternIcon:YV,LetterText:XV,LetterTextIcon:XV,Library:C4,LibraryBig:QV,LibraryBigIcon:QV,LibraryIcon:C4,LibrarySquare:ow,LibrarySquareIcon:ow,LifeBuoy:M4,LifeBuoyIcon:M4,Ligature:JV,LigatureIcon:JV,Lightbulb:G1,LightbulbIcon:G1,LightbulbOff:eH,LightbulbOffIcon:eH,LineChart:rb,LineChartIcon:rb,Link:Oo,Link2:gm,Link2Icon:gm,Link2Off:tH,Link2OffIcon:tH,LinkIcon:Oo,Linkedin:xm,LinkedinIcon:xm,List:mf,ListCheck:rH,ListCheckIcon:rH,ListChecks:nH,ListChecksIcon:nH,ListCollapse:sH,ListCollapseIcon:sH,ListEnd:aH,ListEndIcon:aH,ListFilter:iH,ListFilterIcon:iH,ListIcon:mf,ListMinus:oH,ListMinusIcon:oH,ListMusic:lH,ListMusicIcon:lH,ListOrdered:T4,ListOrderedIcon:T4,ListPlus:cH,ListPlusIcon:cH,ListRestart:dH,ListRestartIcon:dH,ListStart:uH,ListStartIcon:uH,ListTodo:hH,ListTodoIcon:hH,ListTree:mH,ListTreeIcon:mH,ListVideo:fH,ListVideoIcon:fH,ListX:pH,ListXIcon:pH,Loader:xH,Loader2:Gr,Loader2Icon:Gr,LoaderCircle:Gr,LoaderCircleIcon:Gr,LoaderIcon:xH,LoaderPinwheel:gH,LoaderPinwheelIcon:gH,Locate:cA,LocateFixed:yH,LocateFixedIcon:yH,LocateIcon:cA,LocateOff:vH,LocateOffIcon:vH,Lock:ff,LockIcon:ff,LockKeyhole:_H,LockKeyholeIcon:_H,LockKeyholeOpen:l2,LockKeyholeOpenIcon:l2,LockOpen:c2,LockOpenIcon:c2,LogIn:A4,LogInIcon:A4,LogOut:E4,LogOutIcon:E4,Logs:bH,LogsIcon:bH,Lollipop:wH,LollipopIcon:wH,LucideAArrowDown:a8,LucideAArrowUp:i8,LucideALargeSmall:o8,LucideAccessibility:l8,LucideActivity:Lg,LucideActivitySquare:I2,LucideAirVent:c8,LucideAirplay:d8,LucideAlarmCheck:L_,LucideAlarmClock:h8,LucideAlarmClockCheck:L_,LucideAlarmClockMinus:O_,LucideAlarmClockOff:u8,LucideAlarmClockPlus:D_,LucideAlarmMinus:O_,LucideAlarmPlus:D_,LucideAlarmSmoke:m8,LucideAlbum:f8,LucideAlertCircle:yl,LucideAlertOctagon:h2,LucideAlertTriangle:Nh,LucideAlignCenter:y4,LucideAlignCenterHorizontal:p8,LucideAlignCenterVertical:g8,LucideAlignEndHorizontal:x8,LucideAlignEndVertical:y8,LucideAlignHorizontalDistributeCenter:v8,LucideAlignHorizontalDistributeEnd:_8,LucideAlignHorizontalDistributeStart:b8,LucideAlignHorizontalJustifyCenter:w8,LucideAlignHorizontalJustifyEnd:j8,LucideAlignHorizontalJustifyStart:k8,LucideAlignHorizontalSpaceAround:N8,LucideAlignHorizontalSpaceBetween:S8,LucideAlignJustify:C8,LucideAlignLeft:v4,LucideAlignRight:_4,LucideAlignStartHorizontal:M8,LucideAlignStartVertical:T8,LucideAlignVerticalDistributeCenter:A8,LucideAlignVerticalDistributeEnd:E8,LucideAlignVerticalDistributeStart:I8,LucideAlignVerticalJustifyCenter:P8,LucideAlignVerticalJustifyEnd:L8,LucideAlignVerticalJustifyStart:O8,LucideAlignVerticalSpaceAround:D8,LucideAlignVerticalSpaceBetween:R8,LucideAmbulance:F8,LucideAmpersand:z8,LucideAmpersands:B8,LucideAmphora:$8,LucideAnchor:U8,LucideAngry:q8,LucideAnnoyed:V8,LucideAntenna:H8,LucideAnvil:W8,LucideAperture:G8,LucideAppWindow:QT,LucideAppWindowMac:K8,LucideApple:Z8,LucideArchive:JT,LucideArchiveRestore:Y8,LucideArchiveX:X8,LucideAreaChart:Y_,LucideArmchair:Q8,LucideArrowBigDown:eD,LucideArrowBigDownDash:J8,LucideArrowBigLeft:rD,LucideArrowBigLeftDash:tD,LucideArrowBigRight:sD,LucideArrowBigRightDash:nD,LucideArrowBigUp:iD,LucideArrowBigUpDash:aD,LucideArrowDown:oy,LucideArrowDown01:oD,LucideArrowDown10:lD,LucideArrowDownAZ:R_,LucideArrowDownAz:R_,LucideArrowDownCircle:lb,LucideArrowDownFromLine:cD,LucideArrowDownLeft:dD,LucideArrowDownLeftFromCircle:db,LucideArrowDownLeftFromSquare:R2,LucideArrowDownLeftSquare:P2,LucideArrowDownNarrowWide:uD,LucideArrowDownRight:hD,LucideArrowDownRightFromCircle:ub,LucideArrowDownRightFromSquare:F2,LucideArrowDownRightSquare:L2,LucideArrowDownSquare:O2,LucideArrowDownToDot:mD,LucideArrowDownToLine:fD,LucideArrowDownUp:pD,LucideArrowDownWideNarrow:F_,LucideArrowDownZA:z_,LucideArrowDownZa:z_,LucideArrowLeft:Wi,LucideArrowLeftCircle:cb,LucideArrowLeftFromLine:gD,LucideArrowLeftRight:xD,LucideArrowLeftSquare:D2,LucideArrowLeftToLine:yD,LucideArrowRight:No,LucideArrowRightCircle:fb,LucideArrowRightFromLine:vD,LucideArrowRightLeft:_D,LucideArrowRightSquare:$2,LucideArrowRightToLine:bD,LucideArrowUp:df,LucideArrowUp01:wD,LucideArrowUp10:jD,LucideArrowUpAZ:B_,LucideArrowUpAz:B_,LucideArrowUpCircle:pb,LucideArrowUpDown:Og,LucideArrowUpFromDot:kD,LucideArrowUpFromLine:ND,LucideArrowUpLeft:SD,LucideArrowUpLeftFromCircle:hb,LucideArrowUpLeftFromSquare:z2,LucideArrowUpLeftSquare:U2,LucideArrowUpNarrowWide:$_,LucideArrowUpRight:CD,LucideArrowUpRightFromCircle:mb,LucideArrowUpRightFromSquare:B2,LucideArrowUpRightSquare:q2,LucideArrowUpSquare:V2,LucideArrowUpToLine:MD,LucideArrowUpWideNarrow:TD,LucideArrowUpZA:U_,LucideArrowUpZa:U_,LucideArrowsUpFromLine:AD,LucideAsterisk:ED,LucideAsteriskSquare:H2,LucideAtSign:ID,LucideAtom:PD,LucideAudioLines:LD,LucideAudioWaveform:OD,LucideAward:Bl,LucideAxe:DD,LucideAxis3D:q_,LucideAxis3d:q_,LucideBaby:RD,LucideBackpack:FD,LucideBadge:eR,LucideBadgeAlert:zD,LucideBadgeCent:BD,LucideBadgeCheck:V_,LucideBadgeDollarSign:$D,LucideBadgeEuro:UD,LucideBadgeHelp:qD,LucideBadgeIndianRupee:VD,LucideBadgeInfo:HD,LucideBadgeJapaneseYen:WD,LucideBadgeMinus:GD,LucideBadgePercent:KD,LucideBadgePlus:ZD,LucideBadgePoundSterling:YD,LucideBadgeRussianRuble:XD,LucideBadgeSwissFranc:QD,LucideBadgeX:JD,LucideBaggageClaim:tR,LucideBan:rR,LucideBanana:nR,LucideBandage:sR,LucideBanknote:aR,LucideBarChart:nb,LucideBarChart2:sb,LucideBarChart3:_c,LucideBarChart4:tb,LucideBarChartBig:eb,LucideBarChartHorizontal:Q_,LucideBarChartHorizontalBig:X_,LucideBarcode:iR,LucideBaseline:oR,LucideBath:B1,LucideBattery:mR,LucideBatteryCharging:lR,LucideBatteryFull:cR,LucideBatteryLow:dR,LucideBatteryMedium:uR,LucideBatteryWarning:hR,LucideBeaker:fR,LucideBean:gR,LucideBeanOff:pR,LucideBed:$1,LucideBedDouble:xR,LucideBedSingle:yR,LucideBeef:vR,LucideBeer:bR,LucideBeerOff:_R,LucideBell:Dg,LucideBellDot:wR,LucideBellElectric:jR,LucideBellMinus:kR,LucideBellOff:Mj,LucideBellPlus:NR,LucideBellRing:SR,LucideBetweenHorizonalEnd:H_,LucideBetweenHorizonalStart:W_,LucideBetweenHorizontalEnd:H_,LucideBetweenHorizontalStart:W_,LucideBetweenVerticalEnd:CR,LucideBetweenVerticalStart:MR,LucideBicepsFlexed:TR,LucideBike:AR,LucideBinary:ER,LucideBinoculars:IR,LucideBiohazard:PR,LucideBird:LR,LucideBitcoin:OR,LucideBlend:DR,LucideBlinds:RR,LucideBlocks:FR,LucideBluetooth:UR,LucideBluetoothConnected:zR,LucideBluetoothOff:BR,LucideBluetoothSearching:$R,LucideBold:b4,LucideBolt:qR,LucideBomb:VR,LucideBone:HR,LucideBook:mF,LucideBookA:WR,LucideBookAudio:GR,LucideBookCheck:KR,LucideBookCopy:ZR,LucideBookDashed:G_,LucideBookDown:YR,LucideBookHeadphones:XR,LucideBookHeart:QR,LucideBookImage:JR,LucideBookKey:eF,LucideBookLock:tF,LucideBookMarked:rF,LucideBookMinus:nF,LucideBookOpen:eA,LucideBookOpenCheck:sF,LucideBookOpenText:aF,LucideBookPlus:iF,LucideBookTemplate:G_,LucideBookText:oF,LucideBookType:lF,LucideBookUp:dF,LucideBookUp2:cF,LucideBookUser:uF,LucideBookX:hF,LucideBookmark:Mp,LucideBookmarkCheck:fF,LucideBookmarkMinus:pF,LucideBookmarkPlus:tA,LucideBookmarkX:gF,LucideBoomBox:xF,LucideBot:w4,LucideBotMessageSquare:yF,LucideBotOff:vF,LucideBox:_F,LucideBoxSelect:tw,LucideBoxes:bF,LucideBraces:K_,LucideBrackets:wF,LucideBrain:rA,LucideBrainCircuit:jF,LucideBrainCog:kF,LucideBrickWall:NF,LucideBriefcase:Oh,LucideBriefcaseBusiness:SF,LucideBriefcaseConveyorBelt:CF,LucideBriefcaseMedical:MF,LucideBringToFront:TF,LucideBrush:AF,LucideBug:PF,LucideBugOff:EF,LucideBugPlay:IF,LucideBuilding:Tj,LucideBuilding2:hi,LucideBus:OF,LucideBusFront:LF,LucideCable:RF,LucideCableCar:DF,LucideCake:mm,LucideCakeSlice:FF,LucideCalculator:zF,LucideCalendar:Cs,LucideCalendar1:BF,LucideCalendarArrowDown:$F,LucideCalendarArrowUp:UF,LucideCalendarCheck:VF,LucideCalendarCheck2:qF,LucideCalendarClock:nA,LucideCalendarCog:HF,LucideCalendarDays:Tp,LucideCalendarFold:WF,LucideCalendarHeart:GF,LucideCalendarMinus:ZF,LucideCalendarMinus2:KF,LucideCalendarOff:YF,LucideCalendarPlus:Aj,LucideCalendarPlus2:XF,LucideCalendarRange:QF,LucideCalendarSearch:JF,LucideCalendarSync:ez,LucideCalendarX:rz,LucideCalendarX2:tz,LucideCamera:Rg,LucideCameraOff:nz,LucideCandlestickChart:J_,LucideCandy:iz,LucideCandyCane:sz,LucideCandyOff:az,LucideCannabis:oz,LucideCaptions:Z_,LucideCaptionsOff:lz,LucideCar:uz,LucideCarFront:cz,LucideCarTaxiFront:dz,LucideCaravan:hz,LucideCarrot:mz,LucideCaseLower:fz,LucideCaseSensitive:pz,LucideCaseUpper:gz,LucideCassetteTape:xz,LucideCast:yz,LucideCastle:vz,LucideCat:_z,LucideCctv:bz,LucideChartArea:Y_,LucideChartBar:Q_,LucideChartBarBig:X_,LucideChartBarDecreasing:wz,LucideChartBarIncreasing:jz,LucideChartBarStacked:kz,LucideChartCandlestick:J_,LucideChartColumn:_c,LucideChartColumnBig:eb,LucideChartColumnDecreasing:Nz,LucideChartColumnIncreasing:tb,LucideChartColumnStacked:Sz,LucideChartGantt:Cz,LucideChartLine:rb,LucideChartNetwork:Mz,LucideChartNoAxesColumn:sb,LucideChartNoAxesColumnDecreasing:Tz,LucideChartNoAxesColumnIncreasing:nb,LucideChartNoAxesCombined:Az,LucideChartNoAxesGantt:ab,LucideChartPie:ib,LucideChartScatter:ob,LucideChartSpline:Ez,LucideCheck:mi,LucideCheckCheck:Iz,LucideCheckCircle:oi,LucideCheckCircle2:no,LucideCheckSquare:Y0,LucideCheckSquare2:G2,LucideChefHat:Pz,LucideCherry:Lz,LucideChevronDown:Rd,LucideChevronDownCircle:gb,LucideChevronDownSquare:K2,LucideChevronFirst:Oz,LucideChevronLast:Dz,LucideChevronLeft:kc,LucideChevronLeftCircle:xb,LucideChevronLeftSquare:Z2,LucideChevronRight:Gi,LucideChevronRightCircle:yb,LucideChevronRightSquare:Y2,LucideChevronUp:ly,LucideChevronUpCircle:vb,LucideChevronUpSquare:X2,LucideChevronsDown:Fz,LucideChevronsDownUp:Rz,LucideChevronsLeft:$z,LucideChevronsLeftRight:Bz,LucideChevronsLeftRightEllipsis:zz,LucideChevronsRight:qz,LucideChevronsRightLeft:Uz,LucideChevronsUp:Vz,LucideChevronsUpDown:cy,LucideChrome:Hz,LucideChurch:Wz,LucideCigarette:Kz,LucideCigaretteOff:Gz,LucideCircle:Ju,LucideCircleAlert:yl,LucideCircleArrowDown:lb,LucideCircleArrowLeft:cb,LucideCircleArrowOutDownLeft:db,LucideCircleArrowOutDownRight:ub,LucideCircleArrowOutUpLeft:hb,LucideCircleArrowOutUpRight:mb,LucideCircleArrowRight:fb,LucideCircleArrowUp:pb,LucideCircleCheck:no,LucideCircleCheckBig:oi,LucideCircleChevronDown:gb,LucideCircleChevronLeft:xb,LucideCircleChevronRight:yb,LucideCircleChevronUp:vb,LucideCircleDashed:Zz,LucideCircleDivide:_b,LucideCircleDollarSign:Yz,LucideCircleDot:Qz,LucideCircleDotDashed:Xz,LucideCircleEllipsis:Jz,LucideCircleEqual:e7,LucideCircleFadingArrowUp:t7,LucideCircleFadingPlus:r7,LucideCircleGauge:bb,LucideCircleHelp:Kx,LucideCircleMinus:wb,LucideCircleOff:n7,LucideCircleParking:kb,LucideCircleParkingOff:jb,LucideCirclePause:Nb,LucideCirclePercent:Sb,LucideCirclePlay:rf,LucideCirclePlus:Cb,LucideCirclePower:Mb,LucideCircleSlash:s7,LucideCircleSlash2:Tb,LucideCircleSlashed:Tb,LucideCircleStop:Ab,LucideCircleUser:Ib,LucideCircleUserRound:Eb,LucideCircleX:bc,LucideCircuitBoard:a7,LucideCitrus:i7,LucideClapperboard:o7,LucideClipboard:f7,LucideClipboardCheck:sA,LucideClipboardCopy:l7,LucideClipboardEdit:Lb,LucideClipboardList:aA,LucideClipboardMinus:c7,LucideClipboardPaste:d7,LucideClipboardPen:Lb,LucideClipboardPenLine:Pb,LucideClipboardPlus:u7,LucideClipboardSignature:Pb,LucideClipboardType:h7,LucideClipboardX:m7,LucideClock:Xa,LucideClock1:p7,LucideClock10:g7,LucideClock11:x7,LucideClock12:y7,LucideClock2:v7,LucideClock3:_7,LucideClock4:b7,LucideClock5:w7,LucideClock6:j7,LucideClock7:k7,LucideClock8:N7,LucideClock9:S7,LucideClockAlert:C7,LucideClockArrowDown:M7,LucideClockArrowUp:T7,LucideCloud:V7,LucideCloudAlert:A7,LucideCloudCog:E7,LucideCloudDownload:Ob,LucideCloudDrizzle:I7,LucideCloudFog:P7,LucideCloudHail:L7,LucideCloudLightning:O7,LucideCloudMoon:R7,LucideCloudMoonRain:D7,LucideCloudOff:F7,LucideCloudRain:B7,LucideCloudRainWind:z7,LucideCloudSnow:$7,LucideCloudSun:q7,LucideCloudSunRain:U7,LucideCloudUpload:Db,LucideCloudy:H7,LucideClover:ty,LucideClub:W7,LucideCode:Ej,LucideCode2:Rb,LucideCodeSquare:Q2,LucideCodeXml:Rb,LucideCodepen:G7,LucideCodesandbox:K7,LucideCoffee:Ij,LucideCog:Z7,LucideCoins:Y7,LucideColumns:Fb,LucideColumns2:Fb,LucideColumns3:zb,LucideColumns4:X7,LucideCombine:Q7,LucideCommand:J7,LucideCompass:e9,LucideComponent:t9,LucideComputer:r9,LucideConciergeBell:n9,LucideCone:s9,LucideConstruction:a9,LucideContact:i9,LucideContact2:Bb,LucideContactRound:Bb,LucideContainer:o9,LucideContrast:l9,LucideCookie:c9,LucideCookingPot:d9,LucideCopy:Po,LucideCopyCheck:u9,LucideCopyMinus:h9,LucideCopyPlus:m9,LucideCopySlash:f9,LucideCopyX:p9,LucideCopyleft:g9,LucideCopyright:x9,LucideCornerDownLeft:y9,LucideCornerDownRight:v9,LucideCornerLeftDown:_9,LucideCornerLeftUp:b9,LucideCornerRightDown:w9,LucideCornerRightUp:j9,LucideCornerUpLeft:k9,LucideCornerUpRight:N9,LucideCpu:S9,LucideCreativeCommons:C9,LucideCreditCard:uf,LucideCroissant:M9,LucideCrop:T9,LucideCross:A9,LucideCrosshair:E9,LucideCrown:U1,LucideCuboid:I9,LucideCupSoda:P9,LucideCurlyBraces:K_,LucideCurrency:L9,LucideCylinder:O9,LucideDam:D9,LucideDatabase:z9,LucideDatabaseBackup:R9,LucideDatabaseZap:F9,LucideDelete:B9,LucideDessert:$9,LucideDiameter:U9,LucideDiamond:H9,LucideDiamondMinus:q9,LucideDiamondPercent:$b,LucideDiamondPlus:V9,LucideDice1:W9,LucideDice2:G9,LucideDice3:K9,LucideDice4:Z9,LucideDice5:Y9,LucideDice6:X9,LucideDices:Q9,LucideDiff:J9,LucideDisc:nB,LucideDisc2:eB,LucideDisc3:tB,LucideDiscAlbum:rB,LucideDivide:sB,LucideDivideCircle:_b,LucideDivideSquare:rw,LucideDna:iB,LucideDnaOff:aB,LucideDock:oB,LucideDog:lB,LucideDollarSign:Fd,LucideDonut:cB,LucideDoorClosed:dB,LucideDoorOpen:Pj,LucideDot:uB,LucideDotSquare:nw,LucideDownload:so,LucideDownloadCloud:Ob,LucideDraftingCompass:hB,LucideDrama:mB,LucideDribbble:fB,LucideDrill:pB,LucideDroplet:gB,LucideDroplets:xB,LucideDrum:yB,LucideDrumstick:vB,LucideDumbbell:_B,LucideEar:wB,LucideEarOff:bB,LucideEarth:Ub,LucideEarthLock:jB,LucideEclipse:kB,LucideEdit:gc,LucideEdit2:Z0,LucideEdit3:K0,LucideEgg:j4,LucideEggFried:NB,LucideEggOff:SB,LucideEllipsis:gp,LucideEllipsisVertical:kg,LucideEqual:TB,LucideEqualApproximately:CB,LucideEqualNot:MB,LucideEqualSquare:sw,LucideEraser:AB,LucideEthernetPort:EB,LucideEuro:IB,LucideExpand:PB,LucideExternalLink:Ss,LucideEye:_o,LucideEyeClosed:LB,LucideEyeOff:Fg,LucideFacebook:au,LucideFactory:OB,LucideFan:DB,LucideFastForward:RB,LucideFeather:FB,LucideFence:zB,LucideFerrisWheel:BB,LucideFigma:$B,LucideFile:O$,LucideFileArchive:UB,LucideFileAudio:VB,LucideFileAudio2:qB,LucideFileAxis3D:qb,LucideFileAxis3d:qb,LucideFileBadge:WB,LucideFileBadge2:HB,LucideFileBarChart:Vb,LucideFileBarChart2:Hb,LucideFileBox:GB,LucideFileChartColumn:Hb,LucideFileChartColumnIncreasing:Vb,LucideFileChartLine:Wb,LucideFileChartPie:Gb,LucideFileCheck:ZB,LucideFileCheck2:KB,LucideFileClock:YB,LucideFileCode:QB,LucideFileCode2:XB,LucideFileCog:Kb,LucideFileCog2:Kb,LucideFileDiff:JB,LucideFileDigit:e$,LucideFileDown:t$,LucideFileEdit:Yb,LucideFileHeart:r$,LucideFileImage:q1,LucideFileInput:n$,LucideFileJson:a$,LucideFileJson2:s$,LucideFileKey:o$,LucideFileKey2:i$,LucideFileLineChart:Wb,LucideFileLock:c$,LucideFileLock2:l$,LucideFileMinus:u$,LucideFileMinus2:d$,LucideFileMusic:h$,LucideFileOutput:m$,LucideFilePen:Yb,LucideFilePenLine:Zb,LucideFilePieChart:Gb,LucideFilePlus:p$,LucideFilePlus2:f$,LucideFileQuestion:g$,LucideFileScan:x$,LucideFileSearch:v$,LucideFileSearch2:y$,LucideFileSignature:Zb,LucideFileSliders:_$,LucideFileSpreadsheet:V1,LucideFileStack:b$,LucideFileSymlink:w$,LucideFileTerminal:j$,LucideFileText:_a,LucideFileType:N$,LucideFileType2:k$,LucideFileUp:S$,LucideFileUser:C$,LucideFileVideo:T$,LucideFileVideo2:M$,LucideFileVolume:E$,LucideFileVolume2:A$,LucideFileWarning:I$,LucideFileX:L$,LucideFileX2:P$,LucideFiles:D$,LucideFilm:Td,LucideFilter:H1,LucideFilterX:R$,LucideFingerprint:F$,LucideFireExtinguisher:z$,LucideFish:U$,LucideFishOff:B$,LucideFishSymbol:$$,LucideFlag:dy,LucideFlagOff:q$,LucideFlagTriangleLeft:V$,LucideFlagTriangleRight:H$,LucideFlame:fm,LucideFlameKindling:W$,LucideFlashlight:K$,LucideFlashlightOff:G$,LucideFlaskConical:Lj,LucideFlaskConicalOff:Z$,LucideFlaskRound:Y$,LucideFlipHorizontal:Q$,LucideFlipHorizontal2:X$,LucideFlipVertical:eU,LucideFlipVertical2:J$,LucideFlower:tU,LucideFlower2:bp,LucideFocus:rU,LucideFoldHorizontal:nU,LucideFoldVertical:sU,LucideFolder:EU,LucideFolderArchive:aU,LucideFolderCheck:iU,LucideFolderClock:oU,LucideFolderClosed:lU,LucideFolderCode:cU,LucideFolderCog:Xb,LucideFolderCog2:Xb,LucideFolderDot:dU,LucideFolderDown:uU,LucideFolderEdit:Qb,LucideFolderGit:mU,LucideFolderGit2:hU,LucideFolderHeart:fU,LucideFolderInput:pU,LucideFolderKanban:gU,LucideFolderKey:xU,LucideFolderLock:yU,LucideFolderMinus:vU,LucideFolderOpen:Ap,LucideFolderOpenDot:_U,LucideFolderOutput:bU,LucideFolderPen:Qb,LucideFolderPlus:wU,LucideFolderRoot:jU,LucideFolderSearch:NU,LucideFolderSearch2:kU,LucideFolderSymlink:SU,LucideFolderSync:CU,LucideFolderTree:MU,LucideFolderUp:TU,LucideFolderX:AU,LucideFolders:IU,LucideFootprints:PU,LucideForkKnife:qw,LucideForkKnifeCrossed:Uw,LucideForklift:LU,LucideFormInput:k2,LucideForward:OU,LucideFrame:DU,LucideFramer:RU,LucideFrown:FU,LucideFuel:zU,LucideFullscreen:BU,LucideFunctionSquare:aw,LucideGalleryHorizontal:UU,LucideGalleryHorizontalEnd:$U,LucideGalleryThumbnails:qU,LucideGalleryVertical:HU,LucideGalleryVerticalEnd:VU,LucideGamepad:GU,LucideGamepad2:WU,LucideGanttChart:ab,LucideGanttChartSquare:pg,LucideGauge:KU,LucideGaugeCircle:bb,LucideGavel:ZU,LucideGem:YU,LucideGhost:Oj,LucideGift:ao,LucideGitBranch:QU,LucideGitBranchPlus:XU,LucideGitCommit:Jb,LucideGitCommitHorizontal:Jb,LucideGitCommitVertical:JU,LucideGitCompare:tq,LucideGitCompareArrows:eq,LucideGitFork:rq,LucideGitGraph:nq,LucideGitMerge:sq,LucideGitPullRequest:dq,LucideGitPullRequestArrow:aq,LucideGitPullRequestClosed:iq,LucideGitPullRequestCreate:lq,LucideGitPullRequestCreateArrow:oq,LucideGitPullRequestDraft:cq,LucideGithub:uq,LucideGitlab:hq,LucideGlassWater:mq,LucideGlasses:fq,LucideGlobe:uy,LucideGlobe2:Ub,LucideGlobeLock:pq,LucideGoal:gq,LucideGrab:xq,LucideGraduationCap:W1,LucideGrape:yq,LucideGrid:tm,LucideGrid2X2:t2,LucideGrid2X2Plus:e2,LucideGrid2x2:t2,LucideGrid2x2Check:vq,LucideGrid2x2Plus:e2,LucideGrid2x2X:_q,LucideGrid3X3:tm,LucideGrid3x3:tm,LucideGrip:wq,LucideGripHorizontal:bq,LucideGripVertical:zg,LucideGroup:jq,LucideGuitar:kq,LucideHam:Nq,LucideHammer:Sq,LucideHand:Eq,LucideHandCoins:Cq,LucideHandHeart:Mq,LucideHandHelping:r2,LucideHandMetal:Tq,LucideHandPlatter:Aq,LucideHandshake:Iq,LucideHardDrive:iA,LucideHardDriveDownload:Pq,LucideHardDriveUpload:Lq,LucideHardHat:Oq,LucideHash:k4,LucideHaze:Dq,LucideHdmiPort:Rq,LucideHeading:Uq,LucideHeading1:oA,LucideHeading2:lA,LucideHeading3:Fq,LucideHeading4:zq,LucideHeading5:Bq,LucideHeading6:$q,LucideHeadphoneOff:qq,LucideHeadphones:Vq,LucideHeadset:Hq,LucideHeart:vi,LucideHeartCrack:Wq,LucideHeartHandshake:Gq,LucideHeartOff:Kq,LucideHeartPulse:Zq,LucideHeater:Yq,LucideHelpCircle:Kx,LucideHelpingHand:r2,LucideHexagon:Xq,LucideHighlighter:Qq,LucideHistory:N4,LucideHome:ya,LucideHop:eV,LucideHopOff:Jq,LucideHospital:tV,LucideHotel:rV,LucideHourglass:nV,LucideHouse:ya,LucideHousePlug:sV,LucideHousePlus:aV,LucideIceCream:s2,LucideIceCream2:n2,LucideIceCreamBowl:n2,LucideIceCreamCone:s2,LucideIdCard:iV,LucideImage:Fl,LucideImageDown:oV,LucideImageMinus:lV,LucideImageOff:cV,LucideImagePlay:dV,LucideImagePlus:Dj,LucideImageUp:uV,LucideImageUpscale:hV,LucideImages:mV,LucideImport:fV,LucideInbox:pV,LucideIndent:i2,LucideIndentDecrease:a2,LucideIndentIncrease:i2,LucideIndianRupee:gV,LucideInfinity:xV,LucideInfo:yV,LucideInspect:uw,LucideInspectionPanel:vV,LucideInstagram:_u,LucideItalic:S4,LucideIterationCcw:_V,LucideIterationCw:bV,LucideJapaneseYen:wV,LucideJoystick:jV,LucideKanban:hy,LucideKanbanSquare:iw,LucideKanbanSquareDashed:J2,LucideKey:pm,LucideKeyRound:Rj,LucideKeySquare:kV,LucideKeyboard:CV,LucideKeyboardMusic:NV,LucideKeyboardOff:SV,LucideLamp:PV,LucideLampCeiling:MV,LucideLampDesk:TV,LucideLampFloor:AV,LucideLampWallDown:EV,LucideLampWallUp:IV,LucideLandPlot:LV,LucideLandmark:OV,LucideLanguages:DV,LucideLaptop:FV,LucideLaptop2:o2,LucideLaptopMinimal:o2,LucideLaptopMinimalCheck:RV,LucideLasso:BV,LucideLassoSelect:zV,LucideLaugh:$V,LucideLayers:VV,LucideLayers2:UV,LucideLayers3:qV,LucideLayout:G0,LucideLayoutDashboard:Fj,LucideLayoutGrid:hf,LucideLayoutList:HV,LucideLayoutPanelLeft:WV,LucideLayoutPanelTop:GV,LucideLayoutTemplate:zj,LucideLeaf:KV,LucideLeafyGreen:ZV,LucideLectern:YV,LucideLetterText:XV,LucideLibrary:C4,LucideLibraryBig:QV,LucideLibrarySquare:ow,LucideLifeBuoy:M4,LucideLigature:JV,LucideLightbulb:G1,LucideLightbulbOff:eH,LucideLineChart:rb,LucideLink:Oo,LucideLink2:gm,LucideLink2Off:tH,LucideLinkedin:xm,LucideList:mf,LucideListCheck:rH,LucideListChecks:nH,LucideListCollapse:sH,LucideListEnd:aH,LucideListFilter:iH,LucideListMinus:oH,LucideListMusic:lH,LucideListOrdered:T4,LucideListPlus:cH,LucideListRestart:dH,LucideListStart:uH,LucideListTodo:hH,LucideListTree:mH,LucideListVideo:fH,LucideListX:pH,LucideLoader:xH,LucideLoader2:Gr,LucideLoaderCircle:Gr,LucideLoaderPinwheel:gH,LucideLocate:cA,LucideLocateFixed:yH,LucideLocateOff:vH,LucideLock:ff,LucideLockKeyhole:_H,LucideLockKeyholeOpen:l2,LucideLockOpen:c2,LucideLogIn:A4,LucideLogOut:E4,LucideLogs:bH,LucideLollipop:wH,LucideLuggage:jH,LucideMSquare:lw,LucideMagnet:kH,LucideMail:ws,LucideMailCheck:NH,LucideMailMinus:SH,LucideMailOpen:CH,LucideMailPlus:MH,LucideMailQuestion:TH,LucideMailSearch:AH,LucideMailWarning:EH,LucideMailX:dA,LucideMailbox:IH,LucideMails:PH,LucideMap:HH,LucideMapPin:Do,LucideMapPinCheck:OH,LucideMapPinCheckInside:LH,LucideMapPinHouse:DH,LucideMapPinMinus:FH,LucideMapPinMinusInside:RH,LucideMapPinOff:zH,LucideMapPinPlus:$H,LucideMapPinPlusInside:BH,LucideMapPinX:qH,LucideMapPinXInside:UH,LucideMapPinned:VH,LucideMartini:WH,LucideMaximize:KH,LucideMaximize2:GH,LucideMedal:my,LucideMegaphone:Ep,LucideMegaphoneOff:ZH,LucideMeh:YH,LucideMemoryStick:XH,LucideMenu:uA,LucideMenuSquare:cw,LucideMerge:QH,LucideMessageCircle:Ul,LucideMessageCircleCode:JH,LucideMessageCircleDashed:eW,LucideMessageCircleHeart:I4,LucideMessageCircleMore:tW,LucideMessageCircleOff:rW,LucideMessageCirclePlus:nW,LucideMessageCircleQuestion:hA,LucideMessageCircleReply:sW,LucideMessageCircleWarning:aW,LucideMessageCircleX:iW,LucideMessageSquare:Ro,LucideMessageSquareCode:oW,LucideMessageSquareDashed:lW,LucideMessageSquareDiff:cW,LucideMessageSquareDot:dW,LucideMessageSquareHeart:uW,LucideMessageSquareLock:hW,LucideMessageSquareMore:mW,LucideMessageSquareOff:fW,LucideMessageSquarePlus:pW,LucideMessageSquareQuote:mA,LucideMessageSquareReply:gW,LucideMessageSquareShare:xW,LucideMessageSquareText:yW,LucideMessageSquareWarning:vW,LucideMessageSquareX:_W,LucideMessagesSquare:bW,LucideMic:fA,LucideMic2:d2,LucideMicOff:wW,LucideMicVocal:d2,LucideMicrochip:jW,LucideMicroscope:kW,LucideMicrowave:NW,LucideMilestone:SW,LucideMilk:MW,LucideMilkOff:CW,LucideMinimize:AW,LucideMinimize2:TW,LucideMinus:K1,LucideMinusCircle:wb,LucideMinusSquare:dw,LucideMonitor:Bj,LucideMonitorCheck:EW,LucideMonitorCog:IW,LucideMonitorDot:PW,LucideMonitorDown:LW,LucideMonitorOff:OW,LucideMonitorPause:DW,LucideMonitorPlay:RW,LucideMonitorSmartphone:FW,LucideMonitorSpeaker:zW,LucideMonitorStop:BW,LucideMonitorUp:$W,LucideMonitorX:UW,LucideMoon:VW,LucideMoonStar:qW,LucideMoreHorizontal:gp,LucideMoreVertical:kg,LucideMountain:WW,LucideMountainSnow:HW,LucideMouse:XW,LucideMouseOff:GW,LucideMousePointer:YW,LucideMousePointer2:KW,LucideMousePointerBan:ZW,LucideMousePointerClick:Z1,LucideMousePointerSquareDashed:ew,LucideMove:dG,LucideMove3D:u2,LucideMove3d:u2,LucideMoveDiagonal:JW,LucideMoveDiagonal2:QW,LucideMoveDown:rG,LucideMoveDownLeft:eG,LucideMoveDownRight:tG,LucideMoveHorizontal:nG,LucideMoveLeft:sG,LucideMoveRight:aG,LucideMoveUp:lG,LucideMoveUpLeft:iG,LucideMoveUpRight:oG,LucideMoveVertical:cG,LucideMusic:fG,LucideMusic2:uG,LucideMusic3:hG,LucideMusic4:mG,LucideNavigation:pA,LucideNavigation2:gG,LucideNavigation2Off:pG,LucideNavigationOff:xG,LucideNetwork:yG,LucideNewspaper:fy,LucideNfc:vG,LucideNotebook:jG,LucideNotebookPen:_G,LucideNotebookTabs:bG,LucideNotebookText:wG,LucideNotepadText:NG,LucideNotepadTextDashed:kG,LucideNut:CG,LucideNutOff:SG,LucideOctagon:TG,LucideOctagonAlert:h2,LucideOctagonMinus:MG,LucideOctagonPause:m2,LucideOctagonX:f2,LucideOmega:AG,LucideOption:EG,LucideOrbit:IG,LucideOrigami:PG,LucideOutdent:a2,LucidePackage:ql,LucidePackage2:LG,LucidePackageCheck:OG,LucidePackageMinus:DG,LucidePackageOpen:RG,LucidePackagePlus:FG,LucidePackageSearch:zG,LucidePackageX:BG,LucidePaintBucket:$G,LucidePaintRoller:UG,LucidePaintbrush:qG,LucidePaintbrush2:p2,LucidePaintbrushVertical:p2,LucidePalette:Vc,LucidePalmtree:Iw,LucidePanelBottom:WG,LucidePanelBottomClose:VG,LucidePanelBottomDashed:g2,LucidePanelBottomInactive:g2,LucidePanelBottomOpen:HG,LucidePanelLeft:_2,LucidePanelLeftClose:x2,LucidePanelLeftDashed:y2,LucidePanelLeftInactive:y2,LucidePanelLeftOpen:v2,LucidePanelRight:ZG,LucidePanelRightClose:GG,LucidePanelRightDashed:b2,LucidePanelRightInactive:b2,LucidePanelRightOpen:KG,LucidePanelTop:QG,LucidePanelTopClose:YG,LucidePanelTopDashed:w2,LucidePanelTopInactive:w2,LucidePanelTopOpen:XG,LucidePanelsLeftBottom:JG,LucidePanelsLeftRight:zb,LucidePanelsRightBottom:eK,LucidePanelsTopBottom:C2,LucidePanelsTopLeft:G0,LucidePaperclip:tK,LucideParentheses:rK,LucideParkingCircle:kb,LucideParkingCircleOff:jb,LucideParkingMeter:nK,LucideParkingSquare:mw,LucideParkingSquareOff:hw,LucidePartyPopper:Hc,LucidePause:ym,LucidePauseCircle:Nb,LucidePauseOctagon:m2,LucidePawPrint:sK,LucidePcCase:aK,LucidePen:Z0,LucidePenBox:gc,LucidePenLine:K0,LucidePenOff:iK,LucidePenSquare:gc,LucidePenTool:$j,LucidePencil:Qa,LucidePencilLine:oK,LucidePencilOff:lK,LucidePencilRuler:cK,LucidePentagon:dK,LucidePercent:P4,LucidePercentCircle:Sb,LucidePercentDiamond:$b,LucidePercentSquare:fw,LucidePersonStanding:uK,LucidePhilippinePeso:hK,LucidePhone:Ai,LucidePhoneCall:mK,LucidePhoneForwarded:fK,LucidePhoneIncoming:pK,LucidePhoneMissed:gK,LucidePhoneOff:xK,LucidePhoneOutgoing:yK,LucidePi:vK,LucidePiSquare:pw,LucidePiano:_K,LucidePickaxe:bK,LucidePictureInPicture:jK,LucidePictureInPicture2:wK,LucidePieChart:ib,LucidePiggyBank:kK,LucidePilcrow:CK,LucidePilcrowLeft:NK,LucidePilcrowRight:SK,LucidePilcrowSquare:gw,LucidePill:TK,LucidePillBottle:MK,LucidePin:Y1,LucidePinOff:gA,LucidePipette:AK,LucidePizza:EK,LucidePlane:LK,LucidePlaneLanding:IK,LucidePlaneTakeoff:PK,LucidePlay:Vl,LucidePlayCircle:rf,LucidePlaySquare:xw,LucidePlug:xA,LucidePlug2:OK,LucidePlugZap:j2,LucidePlugZap2:j2,LucidePlus:_n,LucidePlusCircle:Cb,LucidePlusSquare:yw,LucidePocket:RK,LucidePocketKnife:DK,LucidePodcast:FK,LucidePointer:BK,LucidePointerOff:zK,LucidePopcorn:$K,LucidePopsicle:UK,LucidePoundSterling:qK,LucidePower:HK,LucidePowerCircle:Mb,LucidePowerOff:VK,LucidePowerSquare:vw,LucidePresentation:py,LucidePrinter:GK,LucidePrinterCheck:WK,LucideProjector:KK,LucideProportions:ZK,LucidePuzzle:YK,LucidePyramid:XK,LucideQrCode:yA,LucideQuote:vA,LucideRabbit:QK,LucideRadar:JK,LucideRadiation:eZ,LucideRadical:tZ,LucideRadio:Uj,LucideRadioReceiver:rZ,LucideRadioTower:nZ,LucideRadius:sZ,LucideRailSymbol:aZ,LucideRainbow:iZ,LucideRat:oZ,LucideRatio:lZ,LucideReceipt:xZ,LucideReceiptCent:cZ,LucideReceiptEuro:dZ,LucideReceiptIndianRupee:uZ,LucideReceiptJapaneseYen:hZ,LucideReceiptPoundSterling:mZ,LucideReceiptRussianRuble:fZ,LucideReceiptSwissFranc:pZ,LucideReceiptText:gZ,LucideRectangleEllipsis:k2,LucideRectangleHorizontal:yZ,LucideRectangleVertical:vZ,LucideRecycle:_Z,LucideRedo:L4,LucideRedo2:bZ,LucideRedoDot:wZ,LucideRefreshCcw:kZ,LucideRefreshCcwDot:jZ,LucideRefreshCw:Go,LucideRefreshCwOff:NZ,LucideRefrigerator:SZ,LucideRegex:CZ,LucideRemoveFormatting:MZ,LucideRepeat:_A,LucideRepeat1:TZ,LucideRepeat2:AZ,LucideReplace:IZ,LucideReplaceAll:EZ,LucideReply:bA,LucideReplyAll:PZ,LucideRewind:LZ,LucideRibbon:OZ,LucideRocket:Bg,LucideRockingChair:DZ,LucideRollerCoaster:RZ,LucideRotate3D:N2,LucideRotate3d:N2,LucideRotateCcw:O4,LucideRotateCcwSquare:FZ,LucideRotateCw:wA,LucideRotateCwSquare:zZ,LucideRoute:$Z,LucideRouteOff:BZ,LucideRouter:UZ,LucideRows:S2,LucideRows2:S2,LucideRows3:C2,LucideRows4:qZ,LucideRss:VZ,LucideRuler:HZ,LucideRussianRuble:WZ,LucideSailboat:GZ,LucideSalad:KZ,LucideSandwich:ZZ,LucideSatellite:XZ,LucideSatelliteDish:YZ,LucideSave:Ip,LucideSaveAll:QZ,LucideSaveOff:JZ,LucideScale:eY,LucideScale3D:M2,LucideScale3d:M2,LucideScaling:tY,LucideScan:cY,LucideScanBarcode:rY,LucideScanEye:nY,LucideScanFace:sY,LucideScanLine:aY,LucideScanQrCode:iY,LucideScanSearch:oY,LucideScanText:lY,LucideScatterChart:ob,LucideSchool:dY,LucideSchool2:Lw,LucideScissors:hY,LucideScissorsLineDashed:uY,LucideScissorsSquare:_w,LucideScissorsSquareDashedBottom:W2,LucideScreenShare:fY,LucideScreenShareOff:mY,LucideScroll:gY,LucideScrollText:pY,LucideSearch:ma,LucideSearchCheck:xY,LucideSearchCode:yY,LucideSearchSlash:vY,LucideSearchX:_Y,LucideSection:bY,LucideSend:Ji,LucideSendHorizonal:T2,LucideSendHorizontal:T2,LucideSendToBack:wY,LucideSeparatorHorizontal:jY,LucideSeparatorVertical:kY,LucideServer:MY,LucideServerCog:NY,LucideServerCrash:SY,LucideServerOff:CY,LucideSettings:zd,LucideSettings2:TY,LucideShapes:AY,LucideShare:jA,LucideShare2:Nc,LucideSheet:EY,LucideShell:IY,LucideShield:vm,LucideShieldAlert:PY,LucideShieldBan:LY,LucideShieldCheck:kA,LucideShieldClose:A2,LucideShieldEllipsis:OY,LucideShieldHalf:DY,LucideShieldMinus:RY,LucideShieldOff:FY,LucideShieldPlus:zY,LucideShieldQuestion:BY,LucideShieldX:A2,LucideShip:UY,LucideShipWheel:$Y,LucideShirt:qY,LucideShoppingBag:$g,LucideShoppingBasket:VY,LucideShoppingCart:Ah,LucideShovel:HY,LucideShowerHead:WY,LucideShrink:GY,LucideShrub:KY,LucideShuffle:ZY,LucideSidebar:_2,LucideSidebarClose:x2,LucideSidebarOpen:v2,LucideSigma:YY,LucideSigmaSquare:bw,LucideSignal:tX,LucideSignalHigh:XY,LucideSignalLow:QY,LucideSignalMedium:JY,LucideSignalZero:eX,LucideSignature:rX,LucideSignpost:sX,LucideSignpostBig:nX,LucideSiren:aX,LucideSkipBack:iX,LucideSkipForward:oX,LucideSkull:lX,LucideSlack:cX,LucideSlash:dX,LucideSlashSquare:ww,LucideSlice:uX,LucideSliders:E2,LucideSlidersHorizontal:NA,LucideSlidersVertical:E2,LucideSmartphone:gy,LucideSmartphoneCharging:hX,LucideSmartphoneNfc:mX,LucideSmile:pX,LucideSmilePlus:fX,LucideSnail:gX,LucideSnowflake:N1,LucideSofa:xX,LucideSortAsc:$_,LucideSortDesc:F_,LucideSoup:yX,LucideSpace:vX,LucideSpade:_X,LucideSparkle:bX,LucideSparkles:Os,LucideSpeaker:wX,LucideSpeech:jX,LucideSpellCheck:NX,LucideSpellCheck2:kX,LucideSpline:SX,LucideSplit:CX,LucideSplitSquareHorizontal:jw,LucideSplitSquareVertical:kw,LucideSprayCan:MX,LucideSprout:TX,LucideSquare:Ug,LucideSquareActivity:I2,LucideSquareArrowDown:O2,LucideSquareArrowDownLeft:P2,LucideSquareArrowDownRight:L2,LucideSquareArrowLeft:D2,LucideSquareArrowOutDownLeft:R2,LucideSquareArrowOutDownRight:F2,LucideSquareArrowOutUpLeft:z2,LucideSquareArrowOutUpRight:B2,LucideSquareArrowRight:$2,LucideSquareArrowUp:V2,LucideSquareArrowUpLeft:U2,LucideSquareArrowUpRight:q2,LucideSquareAsterisk:H2,LucideSquareBottomDashedScissors:W2,LucideSquareChartGantt:pg,LucideSquareCheck:G2,LucideSquareCheckBig:Y0,LucideSquareChevronDown:K2,LucideSquareChevronLeft:Z2,LucideSquareChevronRight:Y2,LucideSquareChevronUp:X2,LucideSquareCode:Q2,LucideSquareDashed:tw,LucideSquareDashedBottom:EX,LucideSquareDashedBottomCode:AX,LucideSquareDashedKanban:J2,LucideSquareDashedMousePointer:ew,LucideSquareDivide:rw,LucideSquareDot:nw,LucideSquareEqual:sw,LucideSquareFunction:aw,LucideSquareGanttChart:pg,LucideSquareKanban:iw,LucideSquareLibrary:ow,LucideSquareM:lw,LucideSquareMenu:cw,LucideSquareMinus:dw,LucideSquareMousePointer:uw,LucideSquareParking:mw,LucideSquareParkingOff:hw,LucideSquarePen:gc,LucideSquarePercent:fw,LucideSquarePi:pw,LucideSquarePilcrow:gw,LucideSquarePlay:xw,LucideSquarePlus:yw,LucideSquarePower:vw,LucideSquareRadical:IX,LucideSquareScissors:_w,LucideSquareSigma:bw,LucideSquareSlash:ww,LucideSquareSplitHorizontal:jw,LucideSquareSplitVertical:kw,LucideSquareSquare:PX,LucideSquareStack:LX,LucideSquareTerminal:Nw,LucideSquareUser:Cw,LucideSquareUserRound:Sw,LucideSquareX:Mw,LucideSquircle:OX,LucideSquirrel:DX,LucideStamp:RX,LucideStar:ks,LucideStarHalf:FX,LucideStarOff:zX,LucideStars:Os,LucideStepBack:BX,LucideStepForward:$X,LucideStethoscope:UX,LucideSticker:qX,LucideStickyNote:VX,LucideStopCircle:Ab,LucideStore:HX,LucideStretchHorizontal:WX,LucideStretchVertical:GX,LucideStrikethrough:KX,LucideSubscript:ZX,LucideSubtitles:Z_,LucideSun:X1,LucideSunDim:YX,LucideSunMedium:XX,LucideSunMoon:QX,LucideSunSnow:JX,LucideSunrise:eQ,LucideSunset:tQ,LucideSuperscript:rQ,LucideSwatchBook:nQ,LucideSwissFranc:sQ,LucideSwitchCamera:aQ,LucideSword:iQ,LucideSwords:oQ,LucideSyringe:lQ,LucideTable:pQ,LucideTable2:D4,LucideTableCellsMerge:cQ,LucideTableCellsSplit:dQ,LucideTableColumnsSplit:uQ,LucideTableOfContents:hQ,LucideTableProperties:mQ,LucideTableRowsSplit:fQ,LucideTablet:xQ,LucideTabletSmartphone:gQ,LucideTablets:yQ,LucideTag:qg,LucideTags:vQ,LucideTally1:_Q,LucideTally2:bQ,LucideTally3:wQ,LucideTally4:jQ,LucideTally5:kQ,LucideTangent:NQ,LucideTarget:xy,LucideTelescope:SQ,LucideTent:MQ,LucideTentTree:CQ,LucideTerminal:TQ,LucideTerminalSquare:Nw,LucideTestTube:AQ,LucideTestTube2:Tw,LucideTestTubeDiagonal:Tw,LucideTestTubes:EQ,LucideText:DQ,LucideTextCursor:PQ,LucideTextCursorInput:IQ,LucideTextQuote:LQ,LucideTextSearch:OQ,LucideTextSelect:Aw,LucideTextSelection:Aw,LucideTheater:RQ,LucideThermometer:BQ,LucideThermometerSnowflake:FQ,LucideThermometerSun:zQ,LucideThumbsDown:SA,LucideThumbsUp:Bd,LucideTicket:CA,LucideTicketCheck:$Q,LucideTicketMinus:UQ,LucideTicketPercent:qQ,LucideTicketPlus:VQ,LucideTicketSlash:HQ,LucideTicketX:WQ,LucideTickets:KQ,LucideTicketsPlane:GQ,LucideTimer:XQ,LucideTimerOff:ZQ,LucideTimerReset:YQ,LucideToggleLeft:QQ,LucideToggleRight:JQ,LucideToilet:eJ,LucideTornado:tJ,LucideTorus:rJ,LucideTouchpad:sJ,LucideTouchpadOff:nJ,LucideTowerControl:aJ,LucideToyBrick:iJ,LucideTractor:oJ,LucideTrafficCone:lJ,LucideTrain:Ew,LucideTrainFront:dJ,LucideTrainFrontTunnel:cJ,LucideTrainTrack:uJ,LucideTramFront:Ew,LucideTrash:hJ,LucideTrash2:Bn,LucideTreeDeciduous:mJ,LucideTreePalm:Iw,LucideTreePine:Q1,LucideTrees:fJ,LucideTrello:pJ,LucideTrendingDown:qj,LucideTrendingUp:eh,LucideTrendingUpDown:gJ,LucideTriangle:yJ,LucideTriangleAlert:Nh,LucideTriangleRight:xJ,LucideTrophy:io,LucideTruck:MA,LucideTurtle:vJ,LucideTv:bJ,LucideTv2:Pw,LucideTvMinimal:Pw,LucideTvMinimalPlay:_J,LucideTwitch:wJ,LucideTwitter:jJ,LucideType:NJ,LucideTypeOutline:kJ,LucideUmbrella:CJ,LucideUmbrellaOff:SJ,LucideUnderline:MJ,LucideUndo:R4,LucideUndo2:TJ,LucideUndoDot:AJ,LucideUnfoldHorizontal:EJ,LucideUnfoldVertical:IJ,LucideUngroup:PJ,LucideUniversity:Lw,LucideUnlink:TA,LucideUnlink2:LJ,LucideUnlock:c2,LucideUnlockKeyhole:l2,LucideUnplug:OJ,LucideUpload:bo,LucideUploadCloud:Db,LucideUsb:DJ,LucideUser:ic,LucideUser2:Bw,LucideUserCheck:Vj,LucideUserCheck2:Ow,LucideUserCircle:Ib,LucideUserCircle2:Eb,LucideUserCog:AA,LucideUserCog2:Dw,LucideUserMinus:RJ,LucideUserMinus2:Rw,LucideUserPen:FJ,LucideUserPlus:th,LucideUserPlus2:Fw,LucideUserRound:Bw,LucideUserRoundCheck:Ow,LucideUserRoundCog:Dw,LucideUserRoundMinus:Rw,LucideUserRoundPen:zJ,LucideUserRoundPlus:Fw,LucideUserRoundSearch:BJ,LucideUserRoundX:zw,LucideUserSearch:$J,LucideUserSquare:Cw,LucideUserSquare2:Sw,LucideUserX:UJ,LucideUserX2:zw,LucideUsers:$n,LucideUsers2:$w,LucideUsersRound:$w,LucideUtensils:qw,LucideUtensilsCrossed:Uw,LucideUtilityPole:qJ,LucideVariable:EA,LucideVault:VJ,LucideVegan:HJ,LucideVenetianMask:WJ,LucideVerified:V_,LucideVibrate:KJ,LucideVibrateOff:GJ,LucideVideo:Ia,LucideVideoOff:ZJ,LucideVideotape:YJ,LucideView:XJ,LucideVoicemail:QJ,LucideVolleyball:JJ,LucideVolume:see,LucideVolume1:eee,LucideVolume2:tee,LucideVolumeOff:ree,LucideVolumeX:nee,LucideVote:aee,LucideWallet:oee,LucideWallet2:Vw,LucideWalletCards:iee,LucideWalletMinimal:Vw,LucideWallpaper:lee,LucideWand:cee,LucideWand2:Hw,LucideWandSparkles:Hw,LucideWarehouse:dee,LucideWashingMachine:uee,LucideWatch:hee,LucideWaves:mee,LucideWaypoints:fee,LucideWebcam:pee,LucideWebhook:xee,LucideWebhookOff:gee,LucideWeight:yee,LucideWheat:_ee,LucideWheatOff:vee,LucideWholeWord:bee,LucideWifi:See,LucideWifiHigh:wee,LucideWifiLow:jee,LucideWifiOff:kee,LucideWifiZero:Nee,LucideWind:Mee,LucideWindArrowDown:Cee,LucideWine:Aee,LucideWineOff:Tee,LucideWorkflow:Eee,LucideWorm:Iee,LucideWrapText:Pee,LucideWrench:yy,LucideX:ds,LucideXCircle:bc,LucideXOctagon:f2,LucideXSquare:Mw,LucideYoutube:Lee,LucideZap:Vg,LucideZapOff:Oee,LucideZoomIn:F4,LucideZoomOut:z4,Luggage:jH,LuggageIcon:jH,MSquare:lw,MSquareIcon:lw,Magnet:kH,MagnetIcon:kH,Mail:ws,MailCheck:NH,MailCheckIcon:NH,MailIcon:ws,MailMinus:SH,MailMinusIcon:SH,MailOpen:CH,MailOpenIcon:CH,MailPlus:MH,MailPlusIcon:MH,MailQuestion:TH,MailQuestionIcon:TH,MailSearch:AH,MailSearchIcon:AH,MailWarning:EH,MailWarningIcon:EH,MailX:dA,MailXIcon:dA,Mailbox:IH,MailboxIcon:IH,Mails:PH,MailsIcon:PH,Map:HH,MapIcon:HH,MapPin:Do,MapPinCheck:OH,MapPinCheckIcon:OH,MapPinCheckInside:LH,MapPinCheckInsideIcon:LH,MapPinHouse:DH,MapPinHouseIcon:DH,MapPinIcon:Do,MapPinMinus:FH,MapPinMinusIcon:FH,MapPinMinusInside:RH,MapPinMinusInsideIcon:RH,MapPinOff:zH,MapPinOffIcon:zH,MapPinPlus:$H,MapPinPlusIcon:$H,MapPinPlusInside:BH,MapPinPlusInsideIcon:BH,MapPinX:qH,MapPinXIcon:qH,MapPinXInside:UH,MapPinXInsideIcon:UH,MapPinned:VH,MapPinnedIcon:VH,Martini:WH,MartiniIcon:WH,Maximize:KH,Maximize2:GH,Maximize2Icon:GH,MaximizeIcon:KH,Medal:my,MedalIcon:my,Megaphone:Ep,MegaphoneIcon:Ep,MegaphoneOff:ZH,MegaphoneOffIcon:ZH,Meh:YH,MehIcon:YH,MemoryStick:XH,MemoryStickIcon:XH,Menu:uA,MenuIcon:uA,MenuSquare:cw,MenuSquareIcon:cw,Merge:QH,MergeIcon:QH,MessageCircle:Ul,MessageCircleCode:JH,MessageCircleCodeIcon:JH,MessageCircleDashed:eW,MessageCircleDashedIcon:eW,MessageCircleHeart:I4,MessageCircleHeartIcon:I4,MessageCircleIcon:Ul,MessageCircleMore:tW,MessageCircleMoreIcon:tW,MessageCircleOff:rW,MessageCircleOffIcon:rW,MessageCirclePlus:nW,MessageCirclePlusIcon:nW,MessageCircleQuestion:hA,MessageCircleQuestionIcon:hA,MessageCircleReply:sW,MessageCircleReplyIcon:sW,MessageCircleWarning:aW,MessageCircleWarningIcon:aW,MessageCircleX:iW,MessageCircleXIcon:iW,MessageSquare:Ro,MessageSquareCode:oW,MessageSquareCodeIcon:oW,MessageSquareDashed:lW,MessageSquareDashedIcon:lW,MessageSquareDiff:cW,MessageSquareDiffIcon:cW,MessageSquareDot:dW,MessageSquareDotIcon:dW,MessageSquareHeart:uW,MessageSquareHeartIcon:uW,MessageSquareIcon:Ro,MessageSquareLock:hW,MessageSquareLockIcon:hW,MessageSquareMore:mW,MessageSquareMoreIcon:mW,MessageSquareOff:fW,MessageSquareOffIcon:fW,MessageSquarePlus:pW,MessageSquarePlusIcon:pW,MessageSquareQuote:mA,MessageSquareQuoteIcon:mA,MessageSquareReply:gW,MessageSquareReplyIcon:gW,MessageSquareShare:xW,MessageSquareShareIcon:xW,MessageSquareText:yW,MessageSquareTextIcon:yW,MessageSquareWarning:vW,MessageSquareWarningIcon:vW,MessageSquareX:_W,MessageSquareXIcon:_W,MessagesSquare:bW,MessagesSquareIcon:bW,Mic:fA,Mic2:d2,Mic2Icon:d2,MicIcon:fA,MicOff:wW,MicOffIcon:wW,MicVocal:d2,MicVocalIcon:d2,Microchip:jW,MicrochipIcon:jW,Microscope:kW,MicroscopeIcon:kW,Microwave:NW,MicrowaveIcon:NW,Milestone:SW,MilestoneIcon:SW,Milk:MW,MilkIcon:MW,MilkOff:CW,MilkOffIcon:CW,Minimize:AW,Minimize2:TW,Minimize2Icon:TW,MinimizeIcon:AW,Minus:K1,MinusCircle:wb,MinusCircleIcon:wb,MinusIcon:K1,MinusSquare:dw,MinusSquareIcon:dw,Monitor:Bj,MonitorCheck:EW,MonitorCheckIcon:EW,MonitorCog:IW,MonitorCogIcon:IW,MonitorDot:PW,MonitorDotIcon:PW,MonitorDown:LW,MonitorDownIcon:LW,MonitorIcon:Bj,MonitorOff:OW,MonitorOffIcon:OW,MonitorPause:DW,MonitorPauseIcon:DW,MonitorPlay:RW,MonitorPlayIcon:RW,MonitorSmartphone:FW,MonitorSmartphoneIcon:FW,MonitorSpeaker:zW,MonitorSpeakerIcon:zW,MonitorStop:BW,MonitorStopIcon:BW,MonitorUp:$W,MonitorUpIcon:$W,MonitorX:UW,MonitorXIcon:UW,Moon:VW,MoonIcon:VW,MoonStar:qW,MoonStarIcon:qW,MoreHorizontal:gp,MoreHorizontalIcon:gp,MoreVertical:kg,MoreVerticalIcon:kg,Mountain:WW,MountainIcon:WW,MountainSnow:HW,MountainSnowIcon:HW,Mouse:XW,MouseIcon:XW,MouseOff:GW,MouseOffIcon:GW,MousePointer:YW,MousePointer2:KW,MousePointer2Icon:KW,MousePointerBan:ZW,MousePointerBanIcon:ZW,MousePointerClick:Z1,MousePointerClickIcon:Z1,MousePointerIcon:YW,MousePointerSquareDashed:ew,MousePointerSquareDashedIcon:ew,Move:dG,Move3D:u2,Move3DIcon:u2,Move3d:u2,Move3dIcon:u2,MoveDiagonal:JW,MoveDiagonal2:QW,MoveDiagonal2Icon:QW,MoveDiagonalIcon:JW,MoveDown:rG,MoveDownIcon:rG,MoveDownLeft:eG,MoveDownLeftIcon:eG,MoveDownRight:tG,MoveDownRightIcon:tG,MoveHorizontal:nG,MoveHorizontalIcon:nG,MoveIcon:dG,MoveLeft:sG,MoveLeftIcon:sG,MoveRight:aG,MoveRightIcon:aG,MoveUp:lG,MoveUpIcon:lG,MoveUpLeft:iG,MoveUpLeftIcon:iG,MoveUpRight:oG,MoveUpRightIcon:oG,MoveVertical:cG,MoveVerticalIcon:cG,Music:fG,Music2:uG,Music2Icon:uG,Music3:hG,Music3Icon:hG,Music4:mG,Music4Icon:mG,MusicIcon:fG,Navigation:pA,Navigation2:gG,Navigation2Icon:gG,Navigation2Off:pG,Navigation2OffIcon:pG,NavigationIcon:pA,NavigationOff:xG,NavigationOffIcon:xG,Network:yG,NetworkIcon:yG,Newspaper:fy,NewspaperIcon:fy,Nfc:vG,NfcIcon:vG,Notebook:jG,NotebookIcon:jG,NotebookPen:_G,NotebookPenIcon:_G,NotebookTabs:bG,NotebookTabsIcon:bG,NotebookText:wG,NotebookTextIcon:wG,NotepadText:NG,NotepadTextDashed:kG,NotepadTextDashedIcon:kG,NotepadTextIcon:NG,Nut:CG,NutIcon:CG,NutOff:SG,NutOffIcon:SG,Octagon:TG,OctagonAlert:h2,OctagonAlertIcon:h2,OctagonIcon:TG,OctagonMinus:MG,OctagonMinusIcon:MG,OctagonPause:m2,OctagonPauseIcon:m2,OctagonX:f2,OctagonXIcon:f2,Omega:AG,OmegaIcon:AG,Option:EG,OptionIcon:EG,Orbit:IG,OrbitIcon:IG,Origami:PG,OrigamiIcon:PG,Outdent:a2,OutdentIcon:a2,Package:ql,Package2:LG,Package2Icon:LG,PackageCheck:OG,PackageCheckIcon:OG,PackageIcon:ql,PackageMinus:DG,PackageMinusIcon:DG,PackageOpen:RG,PackageOpenIcon:RG,PackagePlus:FG,PackagePlusIcon:FG,PackageSearch:zG,PackageSearchIcon:zG,PackageX:BG,PackageXIcon:BG,PaintBucket:$G,PaintBucketIcon:$G,PaintRoller:UG,PaintRollerIcon:UG,Paintbrush:qG,Paintbrush2:p2,Paintbrush2Icon:p2,PaintbrushIcon:qG,PaintbrushVertical:p2,PaintbrushVerticalIcon:p2,Palette:Vc,PaletteIcon:Vc,Palmtree:Iw,PalmtreeIcon:Iw,PanelBottom:WG,PanelBottomClose:VG,PanelBottomCloseIcon:VG,PanelBottomDashed:g2,PanelBottomDashedIcon:g2,PanelBottomIcon:WG,PanelBottomInactive:g2,PanelBottomInactiveIcon:g2,PanelBottomOpen:HG,PanelBottomOpenIcon:HG,PanelLeft:_2,PanelLeftClose:x2,PanelLeftCloseIcon:x2,PanelLeftDashed:y2,PanelLeftDashedIcon:y2,PanelLeftIcon:_2,PanelLeftInactive:y2,PanelLeftInactiveIcon:y2,PanelLeftOpen:v2,PanelLeftOpenIcon:v2,PanelRight:ZG,PanelRightClose:GG,PanelRightCloseIcon:GG,PanelRightDashed:b2,PanelRightDashedIcon:b2,PanelRightIcon:ZG,PanelRightInactive:b2,PanelRightInactiveIcon:b2,PanelRightOpen:KG,PanelRightOpenIcon:KG,PanelTop:QG,PanelTopClose:YG,PanelTopCloseIcon:YG,PanelTopDashed:w2,PanelTopDashedIcon:w2,PanelTopIcon:QG,PanelTopInactive:w2,PanelTopInactiveIcon:w2,PanelTopOpen:XG,PanelTopOpenIcon:XG,PanelsLeftBottom:JG,PanelsLeftBottomIcon:JG,PanelsLeftRight:zb,PanelsLeftRightIcon:zb,PanelsRightBottom:eK,PanelsRightBottomIcon:eK,PanelsTopBottom:C2,PanelsTopBottomIcon:C2,PanelsTopLeft:G0,PanelsTopLeftIcon:G0,Paperclip:tK,PaperclipIcon:tK,Parentheses:rK,ParenthesesIcon:rK,ParkingCircle:kb,ParkingCircleIcon:kb,ParkingCircleOff:jb,ParkingCircleOffIcon:jb,ParkingMeter:nK,ParkingMeterIcon:nK,ParkingSquare:mw,ParkingSquareIcon:mw,ParkingSquareOff:hw,ParkingSquareOffIcon:hw,PartyPopper:Hc,PartyPopperIcon:Hc,Pause:ym,PauseCircle:Nb,PauseCircleIcon:Nb,PauseIcon:ym,PauseOctagon:m2,PauseOctagonIcon:m2,PawPrint:sK,PawPrintIcon:sK,PcCase:aK,PcCaseIcon:aK,Pen:Z0,PenBox:gc,PenBoxIcon:gc,PenIcon:Z0,PenLine:K0,PenLineIcon:K0,PenOff:iK,PenOffIcon:iK,PenSquare:gc,PenSquareIcon:gc,PenTool:$j,PenToolIcon:$j,Pencil:Qa,PencilIcon:Qa,PencilLine:oK,PencilLineIcon:oK,PencilOff:lK,PencilOffIcon:lK,PencilRuler:cK,PencilRulerIcon:cK,Pentagon:dK,PentagonIcon:dK,Percent:P4,PercentCircle:Sb,PercentCircleIcon:Sb,PercentDiamond:$b,PercentDiamondIcon:$b,PercentIcon:P4,PercentSquare:fw,PercentSquareIcon:fw,PersonStanding:uK,PersonStandingIcon:uK,PhilippinePeso:hK,PhilippinePesoIcon:hK,Phone:Ai,PhoneCall:mK,PhoneCallIcon:mK,PhoneForwarded:fK,PhoneForwardedIcon:fK,PhoneIcon:Ai,PhoneIncoming:pK,PhoneIncomingIcon:pK,PhoneMissed:gK,PhoneMissedIcon:gK,PhoneOff:xK,PhoneOffIcon:xK,PhoneOutgoing:yK,PhoneOutgoingIcon:yK,Pi:vK,PiIcon:vK,PiSquare:pw,PiSquareIcon:pw,Piano:_K,PianoIcon:_K,Pickaxe:bK,PickaxeIcon:bK,PictureInPicture:jK,PictureInPicture2:wK,PictureInPicture2Icon:wK,PictureInPictureIcon:jK,PieChart:ib,PieChartIcon:ib,PiggyBank:kK,PiggyBankIcon:kK,Pilcrow:CK,PilcrowIcon:CK,PilcrowLeft:NK,PilcrowLeftIcon:NK,PilcrowRight:SK,PilcrowRightIcon:SK,PilcrowSquare:gw,PilcrowSquareIcon:gw,Pill:TK,PillBottle:MK,PillBottleIcon:MK,PillIcon:TK,Pin:Y1,PinIcon:Y1,PinOff:gA,PinOffIcon:gA,Pipette:AK,PipetteIcon:AK,Pizza:EK,PizzaIcon:EK,Plane:LK,PlaneIcon:LK,PlaneLanding:IK,PlaneLandingIcon:IK,PlaneTakeoff:PK,PlaneTakeoffIcon:PK,Play:Vl,PlayCircle:rf,PlayCircleIcon:rf,PlayIcon:Vl,PlaySquare:xw,PlaySquareIcon:xw,Plug:xA,Plug2:OK,Plug2Icon:OK,PlugIcon:xA,PlugZap:j2,PlugZap2:j2,PlugZap2Icon:j2,PlugZapIcon:j2,Plus:_n,PlusCircle:Cb,PlusCircleIcon:Cb,PlusIcon:_n,PlusSquare:yw,PlusSquareIcon:yw,Pocket:RK,PocketIcon:RK,PocketKnife:DK,PocketKnifeIcon:DK,Podcast:FK,PodcastIcon:FK,Pointer:BK,PointerIcon:BK,PointerOff:zK,PointerOffIcon:zK,Popcorn:$K,PopcornIcon:$K,Popsicle:UK,PopsicleIcon:UK,PoundSterling:qK,PoundSterlingIcon:qK,Power:HK,PowerCircle:Mb,PowerCircleIcon:Mb,PowerIcon:HK,PowerOff:VK,PowerOffIcon:VK,PowerSquare:vw,PowerSquareIcon:vw,Presentation:py,PresentationIcon:py,Printer:GK,PrinterCheck:WK,PrinterCheckIcon:WK,PrinterIcon:GK,Projector:KK,ProjectorIcon:KK,Proportions:ZK,ProportionsIcon:ZK,Puzzle:YK,PuzzleIcon:YK,Pyramid:XK,PyramidIcon:XK,QrCode:yA,QrCodeIcon:yA,Quote:vA,QuoteIcon:vA,Rabbit:QK,RabbitIcon:QK,Radar:JK,RadarIcon:JK,Radiation:eZ,RadiationIcon:eZ,Radical:tZ,RadicalIcon:tZ,Radio:Uj,RadioIcon:Uj,RadioReceiver:rZ,RadioReceiverIcon:rZ,RadioTower:nZ,RadioTowerIcon:nZ,Radius:sZ,RadiusIcon:sZ,RailSymbol:aZ,RailSymbolIcon:aZ,Rainbow:iZ,RainbowIcon:iZ,Rat:oZ,RatIcon:oZ,Ratio:lZ,RatioIcon:lZ,Receipt:xZ,ReceiptCent:cZ,ReceiptCentIcon:cZ,ReceiptEuro:dZ,ReceiptEuroIcon:dZ,ReceiptIcon:xZ,ReceiptIndianRupee:uZ,ReceiptIndianRupeeIcon:uZ,ReceiptJapaneseYen:hZ,ReceiptJapaneseYenIcon:hZ,ReceiptPoundSterling:mZ,ReceiptPoundSterlingIcon:mZ,ReceiptRussianRuble:fZ,ReceiptRussianRubleIcon:fZ,ReceiptSwissFranc:pZ,ReceiptSwissFrancIcon:pZ,ReceiptText:gZ,ReceiptTextIcon:gZ,RectangleEllipsis:k2,RectangleEllipsisIcon:k2,RectangleHorizontal:yZ,RectangleHorizontalIcon:yZ,RectangleVertical:vZ,RectangleVerticalIcon:vZ,Recycle:_Z,RecycleIcon:_Z,Redo:L4,Redo2:bZ,Redo2Icon:bZ,RedoDot:wZ,RedoDotIcon:wZ,RedoIcon:L4,RefreshCcw:kZ,RefreshCcwDot:jZ,RefreshCcwDotIcon:jZ,RefreshCcwIcon:kZ,RefreshCw:Go,RefreshCwIcon:Go,RefreshCwOff:NZ,RefreshCwOffIcon:NZ,Refrigerator:SZ,RefrigeratorIcon:SZ,Regex:CZ,RegexIcon:CZ,RemoveFormatting:MZ,RemoveFormattingIcon:MZ,Repeat:_A,Repeat1:TZ,Repeat1Icon:TZ,Repeat2:AZ,Repeat2Icon:AZ,RepeatIcon:_A,Replace:IZ,ReplaceAll:EZ,ReplaceAllIcon:EZ,ReplaceIcon:IZ,Reply:bA,ReplyAll:PZ,ReplyAllIcon:PZ,ReplyIcon:bA,Rewind:LZ,RewindIcon:LZ,Ribbon:OZ,RibbonIcon:OZ,Rocket:Bg,RocketIcon:Bg,RockingChair:DZ,RockingChairIcon:DZ,RollerCoaster:RZ,RollerCoasterIcon:RZ,Rotate3D:N2,Rotate3DIcon:N2,Rotate3d:N2,Rotate3dIcon:N2,RotateCcw:O4,RotateCcwIcon:O4,RotateCcwSquare:FZ,RotateCcwSquareIcon:FZ,RotateCw:wA,RotateCwIcon:wA,RotateCwSquare:zZ,RotateCwSquareIcon:zZ,Route:$Z,RouteIcon:$Z,RouteOff:BZ,RouteOffIcon:BZ,Router:UZ,RouterIcon:UZ,Rows:S2,Rows2:S2,Rows2Icon:S2,Rows3:C2,Rows3Icon:C2,Rows4:qZ,Rows4Icon:qZ,RowsIcon:S2,Rss:VZ,RssIcon:VZ,Ruler:HZ,RulerIcon:HZ,RussianRuble:WZ,RussianRubleIcon:WZ,Sailboat:GZ,SailboatIcon:GZ,Salad:KZ,SaladIcon:KZ,Sandwich:ZZ,SandwichIcon:ZZ,Satellite:XZ,SatelliteDish:YZ,SatelliteDishIcon:YZ,SatelliteIcon:XZ,Save:Ip,SaveAll:QZ,SaveAllIcon:QZ,SaveIcon:Ip,SaveOff:JZ,SaveOffIcon:JZ,Scale:eY,Scale3D:M2,Scale3DIcon:M2,Scale3d:M2,Scale3dIcon:M2,ScaleIcon:eY,Scaling:tY,ScalingIcon:tY,Scan:cY,ScanBarcode:rY,ScanBarcodeIcon:rY,ScanEye:nY,ScanEyeIcon:nY,ScanFace:sY,ScanFaceIcon:sY,ScanIcon:cY,ScanLine:aY,ScanLineIcon:aY,ScanQrCode:iY,ScanQrCodeIcon:iY,ScanSearch:oY,ScanSearchIcon:oY,ScanText:lY,ScanTextIcon:lY,ScatterChart:ob,ScatterChartIcon:ob,School:dY,School2:Lw,School2Icon:Lw,SchoolIcon:dY,Scissors:hY,ScissorsIcon:hY,ScissorsLineDashed:uY,ScissorsLineDashedIcon:uY,ScissorsSquare:_w,ScissorsSquareDashedBottom:W2,ScissorsSquareDashedBottomIcon:W2,ScissorsSquareIcon:_w,ScreenShare:fY,ScreenShareIcon:fY,ScreenShareOff:mY,ScreenShareOffIcon:mY,Scroll:gY,ScrollIcon:gY,ScrollText:pY,ScrollTextIcon:pY,Search:ma,SearchCheck:xY,SearchCheckIcon:xY,SearchCode:yY,SearchCodeIcon:yY,SearchIcon:ma,SearchSlash:vY,SearchSlashIcon:vY,SearchX:_Y,SearchXIcon:_Y,Section:bY,SectionIcon:bY,Send:Ji,SendHorizonal:T2,SendHorizonalIcon:T2,SendHorizontal:T2,SendHorizontalIcon:T2,SendIcon:Ji,SendToBack:wY,SendToBackIcon:wY,SeparatorHorizontal:jY,SeparatorHorizontalIcon:jY,SeparatorVertical:kY,SeparatorVerticalIcon:kY,Server:MY,ServerCog:NY,ServerCogIcon:NY,ServerCrash:SY,ServerCrashIcon:SY,ServerIcon:MY,ServerOff:CY,ServerOffIcon:CY,Settings:zd,Settings2:TY,Settings2Icon:TY,SettingsIcon:zd,Shapes:AY,ShapesIcon:AY,Share:jA,Share2:Nc,Share2Icon:Nc,ShareIcon:jA,Sheet:EY,SheetIcon:EY,Shell:IY,ShellIcon:IY,Shield:vm,ShieldAlert:PY,ShieldAlertIcon:PY,ShieldBan:LY,ShieldBanIcon:LY,ShieldCheck:kA,ShieldCheckIcon:kA,ShieldClose:A2,ShieldCloseIcon:A2,ShieldEllipsis:OY,ShieldEllipsisIcon:OY,ShieldHalf:DY,ShieldHalfIcon:DY,ShieldIcon:vm,ShieldMinus:RY,ShieldMinusIcon:RY,ShieldOff:FY,ShieldOffIcon:FY,ShieldPlus:zY,ShieldPlusIcon:zY,ShieldQuestion:BY,ShieldQuestionIcon:BY,ShieldX:A2,ShieldXIcon:A2,Ship:UY,ShipIcon:UY,ShipWheel:$Y,ShipWheelIcon:$Y,Shirt:qY,ShirtIcon:qY,ShoppingBag:$g,ShoppingBagIcon:$g,ShoppingBasket:VY,ShoppingBasketIcon:VY,ShoppingCart:Ah,ShoppingCartIcon:Ah,Shovel:HY,ShovelIcon:HY,ShowerHead:WY,ShowerHeadIcon:WY,Shrink:GY,ShrinkIcon:GY,Shrub:KY,ShrubIcon:KY,Shuffle:ZY,ShuffleIcon:ZY,Sidebar:_2,SidebarClose:x2,SidebarCloseIcon:x2,SidebarIcon:_2,SidebarOpen:v2,SidebarOpenIcon:v2,Sigma:YY,SigmaIcon:YY,SigmaSquare:bw,SigmaSquareIcon:bw,Signal:tX,SignalHigh:XY,SignalHighIcon:XY,SignalIcon:tX,SignalLow:QY,SignalLowIcon:QY,SignalMedium:JY,SignalMediumIcon:JY,SignalZero:eX,SignalZeroIcon:eX,Signature:rX,SignatureIcon:rX,Signpost:sX,SignpostBig:nX,SignpostBigIcon:nX,SignpostIcon:sX,Siren:aX,SirenIcon:aX,SkipBack:iX,SkipBackIcon:iX,SkipForward:oX,SkipForwardIcon:oX,Skull:lX,SkullIcon:lX,Slack:cX,SlackIcon:cX,Slash:dX,SlashIcon:dX,SlashSquare:ww,SlashSquareIcon:ww,Slice:uX,SliceIcon:uX,Sliders:E2,SlidersHorizontal:NA,SlidersHorizontalIcon:NA,SlidersIcon:E2,SlidersVertical:E2,SlidersVerticalIcon:E2,Smartphone:gy,SmartphoneCharging:hX,SmartphoneChargingIcon:hX,SmartphoneIcon:gy,SmartphoneNfc:mX,SmartphoneNfcIcon:mX,Smile:pX,SmileIcon:pX,SmilePlus:fX,SmilePlusIcon:fX,Snail:gX,SnailIcon:gX,Snowflake:N1,SnowflakeIcon:N1,Sofa:xX,SofaIcon:xX,SortAsc:$_,SortAscIcon:$_,SortDesc:F_,SortDescIcon:F_,Soup:yX,SoupIcon:yX,Space:vX,SpaceIcon:vX,Spade:_X,SpadeIcon:_X,Sparkle:bX,SparkleIcon:bX,Sparkles:Os,SparklesIcon:Os,Speaker:wX,SpeakerIcon:wX,Speech:jX,SpeechIcon:jX,SpellCheck:NX,SpellCheck2:kX,SpellCheck2Icon:kX,SpellCheckIcon:NX,Spline:SX,SplineIcon:SX,Split:CX,SplitIcon:CX,SplitSquareHorizontal:jw,SplitSquareHorizontalIcon:jw,SplitSquareVertical:kw,SplitSquareVerticalIcon:kw,SprayCan:MX,SprayCanIcon:MX,Sprout:TX,SproutIcon:TX,Square:Ug,SquareActivity:I2,SquareActivityIcon:I2,SquareArrowDown:O2,SquareArrowDownIcon:O2,SquareArrowDownLeft:P2,SquareArrowDownLeftIcon:P2,SquareArrowDownRight:L2,SquareArrowDownRightIcon:L2,SquareArrowLeft:D2,SquareArrowLeftIcon:D2,SquareArrowOutDownLeft:R2,SquareArrowOutDownLeftIcon:R2,SquareArrowOutDownRight:F2,SquareArrowOutDownRightIcon:F2,SquareArrowOutUpLeft:z2,SquareArrowOutUpLeftIcon:z2,SquareArrowOutUpRight:B2,SquareArrowOutUpRightIcon:B2,SquareArrowRight:$2,SquareArrowRightIcon:$2,SquareArrowUp:V2,SquareArrowUpIcon:V2,SquareArrowUpLeft:U2,SquareArrowUpLeftIcon:U2,SquareArrowUpRight:q2,SquareArrowUpRightIcon:q2,SquareAsterisk:H2,SquareAsteriskIcon:H2,SquareBottomDashedScissors:W2,SquareBottomDashedScissorsIcon:W2,SquareChartGantt:pg,SquareChartGanttIcon:pg,SquareCheck:G2,SquareCheckBig:Y0,SquareCheckBigIcon:Y0,SquareCheckIcon:G2,SquareChevronDown:K2,SquareChevronDownIcon:K2,SquareChevronLeft:Z2,SquareChevronLeftIcon:Z2,SquareChevronRight:Y2,SquareChevronRightIcon:Y2,SquareChevronUp:X2,SquareChevronUpIcon:X2,SquareCode:Q2,SquareCodeIcon:Q2,SquareDashed:tw,SquareDashedBottom:EX,SquareDashedBottomCode:AX,SquareDashedBottomCodeIcon:AX,SquareDashedBottomIcon:EX,SquareDashedIcon:tw,SquareDashedKanban:J2,SquareDashedKanbanIcon:J2,SquareDashedMousePointer:ew,SquareDashedMousePointerIcon:ew,SquareDivide:rw,SquareDivideIcon:rw,SquareDot:nw,SquareDotIcon:nw,SquareEqual:sw,SquareEqualIcon:sw,SquareFunction:aw,SquareFunctionIcon:aw,SquareGanttChart:pg,SquareGanttChartIcon:pg,SquareIcon:Ug,SquareKanban:iw,SquareKanbanIcon:iw,SquareLibrary:ow,SquareLibraryIcon:ow,SquareM:lw,SquareMIcon:lw,SquareMenu:cw,SquareMenuIcon:cw,SquareMinus:dw,SquareMinusIcon:dw,SquareMousePointer:uw,SquareMousePointerIcon:uw,SquareParking:mw,SquareParkingIcon:mw,SquareParkingOff:hw,SquareParkingOffIcon:hw,SquarePen:gc,SquarePenIcon:gc,SquarePercent:fw,SquarePercentIcon:fw,SquarePi:pw,SquarePiIcon:pw,SquarePilcrow:gw,SquarePilcrowIcon:gw,SquarePlay:xw,SquarePlayIcon:xw,SquarePlus:yw,SquarePlusIcon:yw,SquarePower:vw,SquarePowerIcon:vw,SquareRadical:IX,SquareRadicalIcon:IX,SquareScissors:_w,SquareScissorsIcon:_w,SquareSigma:bw,SquareSigmaIcon:bw,SquareSlash:ww,SquareSlashIcon:ww,SquareSplitHorizontal:jw,SquareSplitHorizontalIcon:jw,SquareSplitVertical:kw,SquareSplitVerticalIcon:kw,SquareSquare:PX,SquareSquareIcon:PX,SquareStack:LX,SquareStackIcon:LX,SquareTerminal:Nw,SquareTerminalIcon:Nw,SquareUser:Cw,SquareUserIcon:Cw,SquareUserRound:Sw,SquareUserRoundIcon:Sw,SquareX:Mw,SquareXIcon:Mw,Squircle:OX,SquircleIcon:OX,Squirrel:DX,SquirrelIcon:DX,Stamp:RX,StampIcon:RX,Star:ks,StarHalf:FX,StarHalfIcon:FX,StarIcon:ks,StarOff:zX,StarOffIcon:zX,Stars:Os,StarsIcon:Os,StepBack:BX,StepBackIcon:BX,StepForward:$X,StepForwardIcon:$X,Stethoscope:UX,StethoscopeIcon:UX,Sticker:qX,StickerIcon:qX,StickyNote:VX,StickyNoteIcon:VX,StopCircle:Ab,StopCircleIcon:Ab,Store:HX,StoreIcon:HX,StretchHorizontal:WX,StretchHorizontalIcon:WX,StretchVertical:GX,StretchVerticalIcon:GX,Strikethrough:KX,StrikethroughIcon:KX,Subscript:ZX,SubscriptIcon:ZX,Subtitles:Z_,SubtitlesIcon:Z_,Sun:X1,SunDim:YX,SunDimIcon:YX,SunIcon:X1,SunMedium:XX,SunMediumIcon:XX,SunMoon:QX,SunMoonIcon:QX,SunSnow:JX,SunSnowIcon:JX,Sunrise:eQ,SunriseIcon:eQ,Sunset:tQ,SunsetIcon:tQ,Superscript:rQ,SuperscriptIcon:rQ,SwatchBook:nQ,SwatchBookIcon:nQ,SwissFranc:sQ,SwissFrancIcon:sQ,SwitchCamera:aQ,SwitchCameraIcon:aQ,Sword:iQ,SwordIcon:iQ,Swords:oQ,SwordsIcon:oQ,Syringe:lQ,SyringeIcon:lQ,Table:pQ,Table2:D4,Table2Icon:D4,TableCellsMerge:cQ,TableCellsMergeIcon:cQ,TableCellsSplit:dQ,TableCellsSplitIcon:dQ,TableColumnsSplit:uQ,TableColumnsSplitIcon:uQ,TableIcon:pQ,TableOfContents:hQ,TableOfContentsIcon:hQ,TableProperties:mQ,TablePropertiesIcon:mQ,TableRowsSplit:fQ,TableRowsSplitIcon:fQ,Tablet:xQ,TabletIcon:xQ,TabletSmartphone:gQ,TabletSmartphoneIcon:gQ,Tablets:yQ,TabletsIcon:yQ,Tag:qg,TagIcon:qg,Tags:vQ,TagsIcon:vQ,Tally1:_Q,Tally1Icon:_Q,Tally2:bQ,Tally2Icon:bQ,Tally3:wQ,Tally3Icon:wQ,Tally4:jQ,Tally4Icon:jQ,Tally5:kQ,Tally5Icon:kQ,Tangent:NQ,TangentIcon:NQ,Target:xy,TargetIcon:xy,Telescope:SQ,TelescopeIcon:SQ,Tent:MQ,TentIcon:MQ,TentTree:CQ,TentTreeIcon:CQ,Terminal:TQ,TerminalIcon:TQ,TerminalSquare:Nw,TerminalSquareIcon:Nw,TestTube:AQ,TestTube2:Tw,TestTube2Icon:Tw,TestTubeDiagonal:Tw,TestTubeDiagonalIcon:Tw,TestTubeIcon:AQ,TestTubes:EQ,TestTubesIcon:EQ,Text:DQ,TextCursor:PQ,TextCursorIcon:PQ,TextCursorInput:IQ,TextCursorInputIcon:IQ,TextIcon:DQ,TextQuote:LQ,TextQuoteIcon:LQ,TextSearch:OQ,TextSearchIcon:OQ,TextSelect:Aw,TextSelectIcon:Aw,TextSelection:Aw,TextSelectionIcon:Aw,Theater:RQ,TheaterIcon:RQ,Thermometer:BQ,ThermometerIcon:BQ,ThermometerSnowflake:FQ,ThermometerSnowflakeIcon:FQ,ThermometerSun:zQ,ThermometerSunIcon:zQ,ThumbsDown:SA,ThumbsDownIcon:SA,ThumbsUp:Bd,ThumbsUpIcon:Bd,Ticket:CA,TicketCheck:$Q,TicketCheckIcon:$Q,TicketIcon:CA,TicketMinus:UQ,TicketMinusIcon:UQ,TicketPercent:qQ,TicketPercentIcon:qQ,TicketPlus:VQ,TicketPlusIcon:VQ,TicketSlash:HQ,TicketSlashIcon:HQ,TicketX:WQ,TicketXIcon:WQ,Tickets:KQ,TicketsIcon:KQ,TicketsPlane:GQ,TicketsPlaneIcon:GQ,Timer:XQ,TimerIcon:XQ,TimerOff:ZQ,TimerOffIcon:ZQ,TimerReset:YQ,TimerResetIcon:YQ,ToggleLeft:QQ,ToggleLeftIcon:QQ,ToggleRight:JQ,ToggleRightIcon:JQ,Toilet:eJ,ToiletIcon:eJ,Tornado:tJ,TornadoIcon:tJ,Torus:rJ,TorusIcon:rJ,Touchpad:sJ,TouchpadIcon:sJ,TouchpadOff:nJ,TouchpadOffIcon:nJ,TowerControl:aJ,TowerControlIcon:aJ,ToyBrick:iJ,ToyBrickIcon:iJ,Tractor:oJ,TractorIcon:oJ,TrafficCone:lJ,TrafficConeIcon:lJ,Train:Ew,TrainFront:dJ,TrainFrontIcon:dJ,TrainFrontTunnel:cJ,TrainFrontTunnelIcon:cJ,TrainIcon:Ew,TrainTrack:uJ,TrainTrackIcon:uJ,TramFront:Ew,TramFrontIcon:Ew,Trash:hJ,Trash2:Bn,Trash2Icon:Bn,TrashIcon:hJ,TreeDeciduous:mJ,TreeDeciduousIcon:mJ,TreePalm:Iw,TreePalmIcon:Iw,TreePine:Q1,TreePineIcon:Q1,Trees:fJ,TreesIcon:fJ,Trello:pJ,TrelloIcon:pJ,TrendingDown:qj,TrendingDownIcon:qj,TrendingUp:eh,TrendingUpDown:gJ,TrendingUpDownIcon:gJ,TrendingUpIcon:eh,Triangle:yJ,TriangleAlert:Nh,TriangleAlertIcon:Nh,TriangleIcon:yJ,TriangleRight:xJ,TriangleRightIcon:xJ,Trophy:io,TrophyIcon:io,Truck:MA,TruckIcon:MA,Turtle:vJ,TurtleIcon:vJ,Tv:bJ,Tv2:Pw,Tv2Icon:Pw,TvIcon:bJ,TvMinimal:Pw,TvMinimalIcon:Pw,TvMinimalPlay:_J,TvMinimalPlayIcon:_J,Twitch:wJ,TwitchIcon:wJ,Twitter:jJ,TwitterIcon:jJ,Type:NJ,TypeIcon:NJ,TypeOutline:kJ,TypeOutlineIcon:kJ,Umbrella:CJ,UmbrellaIcon:CJ,UmbrellaOff:SJ,UmbrellaOffIcon:SJ,Underline:MJ,UnderlineIcon:MJ,Undo:R4,Undo2:TJ,Undo2Icon:TJ,UndoDot:AJ,UndoDotIcon:AJ,UndoIcon:R4,UnfoldHorizontal:EJ,UnfoldHorizontalIcon:EJ,UnfoldVertical:IJ,UnfoldVerticalIcon:IJ,Ungroup:PJ,UngroupIcon:PJ,University:Lw,UniversityIcon:Lw,Unlink:TA,Unlink2:LJ,Unlink2Icon:LJ,UnlinkIcon:TA,Unlock:c2,UnlockIcon:c2,UnlockKeyhole:l2,UnlockKeyholeIcon:l2,Unplug:OJ,UnplugIcon:OJ,Upload:bo,UploadCloud:Db,UploadCloudIcon:Db,UploadIcon:bo,Usb:DJ,UsbIcon:DJ,User:ic,User2:Bw,User2Icon:Bw,UserCheck:Vj,UserCheck2:Ow,UserCheck2Icon:Ow,UserCheckIcon:Vj,UserCircle:Ib,UserCircle2:Eb,UserCircle2Icon:Eb,UserCircleIcon:Ib,UserCog:AA,UserCog2:Dw,UserCog2Icon:Dw,UserCogIcon:AA,UserIcon:ic,UserMinus:RJ,UserMinus2:Rw,UserMinus2Icon:Rw,UserMinusIcon:RJ,UserPen:FJ,UserPenIcon:FJ,UserPlus:th,UserPlus2:Fw,UserPlus2Icon:Fw,UserPlusIcon:th,UserRound:Bw,UserRoundCheck:Ow,UserRoundCheckIcon:Ow,UserRoundCog:Dw,UserRoundCogIcon:Dw,UserRoundIcon:Bw,UserRoundMinus:Rw,UserRoundMinusIcon:Rw,UserRoundPen:zJ,UserRoundPenIcon:zJ,UserRoundPlus:Fw,UserRoundPlusIcon:Fw,UserRoundSearch:BJ,UserRoundSearchIcon:BJ,UserRoundX:zw,UserRoundXIcon:zw,UserSearch:$J,UserSearchIcon:$J,UserSquare:Cw,UserSquare2:Sw,UserSquare2Icon:Sw,UserSquareIcon:Cw,UserX:UJ,UserX2:zw,UserX2Icon:zw,UserXIcon:UJ,Users:$n,Users2:$w,Users2Icon:$w,UsersIcon:$n,UsersRound:$w,UsersRoundIcon:$w,Utensils:qw,UtensilsCrossed:Uw,UtensilsCrossedIcon:Uw,UtensilsIcon:qw,UtilityPole:qJ,UtilityPoleIcon:qJ,Variable:EA,VariableIcon:EA,Vault:VJ,VaultIcon:VJ,Vegan:HJ,VeganIcon:HJ,VenetianMask:WJ,VenetianMaskIcon:WJ,Verified:V_,VerifiedIcon:V_,Vibrate:KJ,VibrateIcon:KJ,VibrateOff:GJ,VibrateOffIcon:GJ,Video:Ia,VideoIcon:Ia,VideoOff:ZJ,VideoOffIcon:ZJ,Videotape:YJ,VideotapeIcon:YJ,View:XJ,ViewIcon:XJ,Voicemail:QJ,VoicemailIcon:QJ,Volleyball:JJ,VolleyballIcon:JJ,Volume:see,Volume1:eee,Volume1Icon:eee,Volume2:tee,Volume2Icon:tee,VolumeIcon:see,VolumeOff:ree,VolumeOffIcon:ree,VolumeX:nee,VolumeXIcon:nee,Vote:aee,VoteIcon:aee,Wallet:oee,Wallet2:Vw,Wallet2Icon:Vw,WalletCards:iee,WalletCardsIcon:iee,WalletIcon:oee,WalletMinimal:Vw,WalletMinimalIcon:Vw,Wallpaper:lee,WallpaperIcon:lee,Wand:cee,Wand2:Hw,Wand2Icon:Hw,WandIcon:cee,WandSparkles:Hw,WandSparklesIcon:Hw,Warehouse:dee,WarehouseIcon:dee,WashingMachine:uee,WashingMachineIcon:uee,Watch:hee,WatchIcon:hee,Waves:mee,WavesIcon:mee,Waypoints:fee,WaypointsIcon:fee,Webcam:pee,WebcamIcon:pee,Webhook:xee,WebhookIcon:xee,WebhookOff:gee,WebhookOffIcon:gee,Weight:yee,WeightIcon:yee,Wheat:_ee,WheatIcon:_ee,WheatOff:vee,WheatOffIcon:vee,WholeWord:bee,WholeWordIcon:bee,Wifi:See,WifiHigh:wee,WifiHighIcon:wee,WifiIcon:See,WifiLow:jee,WifiLowIcon:jee,WifiOff:kee,WifiOffIcon:kee,WifiZero:Nee,WifiZeroIcon:Nee,Wind:Mee,WindArrowDown:Cee,WindArrowDownIcon:Cee,WindIcon:Mee,Wine:Aee,WineIcon:Aee,WineOff:Tee,WineOffIcon:Tee,Workflow:Eee,WorkflowIcon:Eee,Worm:Iee,WormIcon:Iee,WrapText:Pee,WrapTextIcon:Pee,Wrench:yy,WrenchIcon:yy,X:ds,XCircle:bc,XCircleIcon:bc,XIcon:ds,XOctagon:f2,XOctagonIcon:f2,XSquare:Mw,XSquareIcon:Mw,Youtube:Lee,YoutubeIcon:Lee,Zap:Vg,ZapIcon:Vg,ZapOff:Oee,ZapOffIcon:Oee,ZoomIn:F4,ZoomInIcon:F4,ZoomOut:z4,ZoomOutIcon:z4,createLucideIcon:q,icons:lQe},Symbol.toStringTag,{value:"Module"})),nxe="-",cQe=e=>{const t=uQe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const i=l.split(nxe);return i[0]===""&&i.length!==1&&i.shift(),PIe(i,t)||dQe(l)},getConflictingClassGroupIds:(l,i)=>{const u=n[l]||[];return i&&s[l]?[...u,...s[l]]:u}}},PIe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?PIe(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(nxe);return(l=t.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},jje=/^\[(.+)\]$/,dQe=e=>{if(jje.test(e)){const t=jje.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},uQe=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return mQe(Object.entries(e.classGroups),n).forEach(([o,l])=>{fhe(l,s,o,t)}),s},fhe=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:kje(t,a);o.classGroupId=n;return}if(typeof a=="function"){if(hQe(a)){fhe(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,l])=>{fhe(l,kje(t,o),n,s)})})},kje=(e,t)=>{let n=e;return t.split(nxe).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},hQe=e=>e.isThemeGetter,mQe=(e,t)=>t?e.map(([n,s])=>{const a=s.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,i])=>[t+l,i])):o);return[n,a]}):e,fQe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const a=(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 a(o,l),l},set(o,l){n.has(o)?n.set(o,l):a(o,l)}}},LIe="!",pQe=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,a=t[0],o=t.length,l=i=>{const u=[];let m=0,x=0,y;for(let M=0;Mx?y-x:void 0;return{modifiers:u,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:k}};return n?i=>n({className:i,parseClassName:l}):l},gQe=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},xQe=e=>({cache:fQe(e.cacheSize),parseClassName:pQe(e),...cQe(e)}),yQe=/\s+/,vQe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,o=[],l=e.trim().split(yQe);let i="";for(let u=l.length-1;u>=0;u-=1){const m=l[u],{modifiers:x,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:b}=n(m);let N=!!b,k=s(N?v.substring(0,b):v);if(!k){if(!N){i=m+(i.length>0?" "+i:i);continue}if(k=s(v),!k){i=m+(i.length>0?" "+i:i);continue}N=!1}const M=gQe(x).join(":"),I=y?M+LIe:M,T=I+k;if(o.includes(T))continue;o.push(T);const P=a(k,N);for(let F=0;F0?" "+i:i)}return i};function _Qe(){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=xQe(m),s=n.cache.get,a=n.cache.set,o=i,i(u)}function i(u){const m=s(u);if(m)return m;const x=vQe(u,n);return a(u,x),x}return function(){return o(_Qe.apply(null,arguments))}}const ml=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},DIe=/^\[(?:([a-z-]+):)?(.+)\]$/i,wQe=/^\d+\/\d+$/,jQe=new Set(["px","full","screen"]),kQe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NQe=/\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$/,SQe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,CQe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MQe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Px=e=>B4(e)||jQe.has(e)||wQe.test(e),O0=e=>y3(e,"length",DQe),B4=e=>!!e&&!Number.isNaN(Number(e)),mce=e=>y3(e,"number",B4),eT=e=>!!e&&Number.isInteger(Number(e)),TQe=e=>e.endsWith("%")&&B4(e.slice(0,-1)),di=e=>DIe.test(e),D0=e=>kQe.test(e),AQe=new Set(["length","size","percentage"]),EQe=e=>y3(e,AQe,RIe),IQe=e=>y3(e,"position",RIe),PQe=new Set(["image","url"]),LQe=e=>y3(e,PQe,FQe),OQe=e=>y3(e,"",RQe),tT=()=>!0,y3=(e,t,n)=>{const s=DIe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},DQe=e=>NQe.test(e)&&!SQe.test(e),RIe=()=>!1,RQe=e=>CQe.test(e),FQe=e=>MQe.test(e),zQe=()=>{const e=ml("colors"),t=ml("spacing"),n=ml("blur"),s=ml("brightness"),a=ml("borderColor"),o=ml("borderRadius"),l=ml("borderSpacing"),i=ml("borderWidth"),u=ml("contrast"),m=ml("grayscale"),x=ml("hueRotate"),y=ml("invert"),v=ml("gap"),b=ml("gradientColorStops"),N=ml("gradientColorStopPositions"),k=ml("inset"),M=ml("margin"),I=ml("opacity"),T=ml("padding"),P=ml("saturate"),F=ml("scale"),D=ml("sepia"),U=ml("skew"),V=ml("space"),W=ml("translate"),G=()=>["auto","contain","none"],ee=()=>["auto","hidden","clip","visible","scroll"],ae=()=>["auto",di,t],oe=()=>[di,t],pe=()=>["",Px,O0],ne=()=>["auto",B4,di],fe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>["start","end","center","between","around","evenly","stretch"],xe=()=>["","0",di],Te=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_e=()=>[B4,di];return{cacheSize:500,separator:":",theme:{colors:[tT],spacing:[Px,O0],blur:["none","",D0,di],brightness:_e(),borderColor:[e],borderRadius:["none","","full",D0,di],borderSpacing:oe(),borderWidth:pe(),contrast:_e(),grayscale:xe(),hueRotate:_e(),invert:xe(),gap:oe(),gradientColorStops:[e],gradientColorStopPositions:[TQe,O0],inset:ae(),margin:ae(),opacity:_e(),padding:oe(),saturate:_e(),scale:_e(),sepia:xe(),skew:_e(),space:oe(),translate:oe()},classGroups:{aspect:[{aspect:["auto","square","video",di]}],container:["container"],columns:[{columns:[D0]}],"break-after":[{"break-after":Te()}],"break-before":[{"break-before":Te()}],"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:[...fe(),di]}],overflow:[{overflow:ee()}],"overflow-x":[{"overflow-x":ee()}],"overflow-y":[{"overflow-y":ee()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",eT,di]}],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",di]}],grow:[{grow:xe()}],shrink:[{shrink:xe()}],order:[{order:["first","last","none",eT,di]}],"grid-cols":[{"grid-cols":[tT]}],"col-start-end":[{col:["auto",{span:["full",eT,di]},di]}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":[tT]}],"row-start-end":[{row:["auto",{span:[eT,di]},di]}],"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",di]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",di]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...ue()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ue(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ue(),"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:[M]}],mx:[{mx:[M]}],my:[{my:[M]}],ms:[{ms:[M]}],me:[{me:[M]}],mt:[{mt:[M]}],mr:[{mr:[M]}],mb:[{mb:[M]}],ml:[{ml:[M]}],"space-x":[{"space-x":[V]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[V]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",di,t]}],"min-w":[{"min-w":[di,t,"min","max","fit"]}],"max-w":[{"max-w":[di,t,"none","full","min","max","fit","prose",{screen:[D0]},D0]}],h:[{h:[di,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[di,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[di,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[di,t,"auto","min","max","fit"]}],"font-size":[{text:["base",D0,O0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",mce]}],"font-family":[{font:[tT]}],"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",di]}],"line-clamp":[{"line-clamp":["none",B4,mce]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Px,di]}],"list-image":[{"list-image":["none",di]}],"list-style-type":[{list:["none","disc","decimal",di]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[I]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[I]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Px,O0]}],"underline-offset":[{"underline-offset":["auto",Px,di]}],"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:oe()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",di]}],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",di]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[I]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...fe(),IQe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",EQe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},LQe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],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:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[I]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[I]}],"divide-style":[{divide:se()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[Px,di]}],"outline-w":[{outline:[Px,O0]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[Px,O0]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",D0,OQe]}],"shadow-color":[{shadow:[tT]}],opacity:[{opacity:[I]}],"mix-blend":[{"mix-blend":[...me(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":me()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",D0,di]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[y]}],saturate:[{saturate:[P]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[I]}],"backdrop-saturate":[{"backdrop-saturate":[P]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"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",di]}],duration:[{duration:_e()}],ease:[{ease:["linear","in","out","in-out",di]}],delay:[{delay:_e()}],animate:[{animate:["none","spin","ping","pulse","bounce",di]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[F]}],"scale-x":[{"scale-x":[F]}],"scale-y":[{"scale-y":[F]}],rotate:[{rotate:[eT,di]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",di]}],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",di]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":oe()}],"scroll-mx":[{"scroll-mx":oe()}],"scroll-my":[{"scroll-my":oe()}],"scroll-ms":[{"scroll-ms":oe()}],"scroll-me":[{"scroll-me":oe()}],"scroll-mt":[{"scroll-mt":oe()}],"scroll-mr":[{"scroll-mr":oe()}],"scroll-mb":[{"scroll-mb":oe()}],"scroll-ml":[{"scroll-ml":oe()}],"scroll-p":[{"scroll-p":oe()}],"scroll-px":[{"scroll-px":oe()}],"scroll-py":[{"scroll-py":oe()}],"scroll-ps":[{"scroll-ps":oe()}],"scroll-pe":[{"scroll-pe":oe()}],"scroll-pt":[{"scroll-pt":oe()}],"scroll-pr":[{"scroll-pr":oe()}],"scroll-pb":[{"scroll-pb":oe()}],"scroll-pl":[{"scroll-pl":oe()}],"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",di]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Px,O0,mce]}],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"]}}},BQe=bQe(zQe);function Ut(...e){return BQe(ui(e))}function tu(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 Nje(e){const t=new Date(e);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}function xse(e){return e?e.replace(/<[^>]*>/g,""):""}const $Qe=aQe,FIe=A.forwardRef(({className:e,...t},n)=>r.jsx(jIe,{ref:n,className:Ut("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}));FIe.displayName=jIe.displayName;const UQe=x3("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"}}),zIe=A.forwardRef(({className:e,variant:t,...n},s)=>r.jsx(kIe,{ref:s,className:Ut(UQe({variant:t}),e),...n}));zIe.displayName=kIe.displayName;const qQe=A.forwardRef(({className:e,...t},n)=>r.jsx(CIe,{ref:n,className:Ut("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}));qQe.displayName=CIe.displayName;const BIe=A.forwardRef(({className:e,...t},n)=>r.jsx(MIe,{ref:n,className:Ut("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(ds,{className:"h-4 w-4"})}));BIe.displayName=MIe.displayName;const $Ie=A.forwardRef(({className:e,...t},n)=>r.jsx(NIe,{ref:n,className:Ut("text-sm font-semibold",e),...t}));$Ie.displayName=NIe.displayName;const UIe=A.forwardRef(({className:e,...t},n)=>r.jsx(SIe,{ref:n,className:Ut("text-sm opacity-90",e),...t}));UIe.displayName=SIe.displayName;function VQe(){const{toasts:e}=fi();return r.jsxs($Qe,{children:[e.map(function({id:t,title:n,description:s,action:a,...o}){return r.jsxs(zIe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx($Ie,{children:n}),s&&r.jsx(UIe,{children:s})]}),a,r.jsx(BIe,{})]},t)}),r.jsx(FIe,{})]})}var Sje=["light","dark"],HQe="(prefers-color-scheme: dark)",WQe=A.createContext(void 0),GQe={setTheme:e=>{},themes:[]},KQe=()=>{var e;return(e=A.useContext(WQe))!=null?e:GQe};A.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:s,enableColorScheme:a,defaultTheme:o,value:l,attrs:i,nonce:u})=>{let m=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(N=>`'${N}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,y=a?Sje.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",v=(N,k=!1,M=!0)=>{let I=l?l[N]:N,T=k?N+"|| ''":`'${I}'`,P="";return a&&M&&!k&&Sje.includes(N)&&(P+=`d.style.colorScheme = '${N}';`),n==="class"?k||I?P+=`c.add(${T})`:P+="null":I&&(P+=`d[s](n,${T})`),P},b=e?`!function(){${x}${v(e)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${m})){var t='${HQe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${v("dark")}}else{${v("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${v(l?"x[e]":"e",!0)}}${m?"":"else{"+v(o,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${t}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${v(l?"x[e]":"e",!0)}}else{${v(o,!1,!1)};}${y}}catch(t){}}();`;return A.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:b}})});var ZQe=e=>{switch(e){case"success":return QQe;case"info":return eJe;case"warning":return JQe;case"error":return tJe;default:return null}},YQe=Array(12).fill(0),XQe=({visible:e,className:t})=>dt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},dt.createElement("div",{className:"sonner-spinner"},YQe.map((n,s)=>dt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),QQe=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dt.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"})),JQe=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},dt.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"})),eJe=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dt.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"})),tJe=dt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},dt.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"})),rJe=dt.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"},dt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),dt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),nJe=()=>{let[e,t]=dt.useState(document.hidden);return dt.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},phe=1,sJe=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,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:phe++,o=this.toasts.find(i=>i.id===a),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(i=>i.id===a?(this.publish({...i,...e,id:a,title:n}),{...i,...e,id:a,dismissible:l,title:n}):i):this.addToast({title:n,...s,dismissible:l,id:a}),a},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(),a=n!==void 0,o,l=s.then(async u=>{if(o=["resolve",u],dt.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(iJe(u)&&!u.ok){a=!1;let m=typeof t.error=="function"?await t.error(`HTTP error! status: ${u.status}`):t.error,x=typeof t.description=="function"?await t.description(`HTTP error! status: ${u.status}`):t.description;this.create({id:n,type:"error",message:m,description:x})}else if(t.success!==void 0){a=!1;let m=typeof t.success=="function"?await t.success(u):t.success,x=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"success",message:m,description:x})}}).catch(async u=>{if(o=["reject",u],t.error!==void 0){a=!1;let m=typeof t.error=="function"?await t.error(u):t.error,x=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"error",message:m,description:x})}}).finally(()=>{var u;a&&(this.dismiss(n),n=void 0),(u=t.finally)==null||u.call(t)}),i=()=>new Promise((u,m)=>l.then(()=>o[0]==="reject"?m(o[1]):u(o[1])).catch(m));return typeof n!="string"&&typeof n!="number"?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||phe++;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}},jh=new sJe,aJe=(e,t)=>{let n=(t==null?void 0:t.id)||phe++;return jh.addToast({title:e,...t,id:n}),n},iJe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",oJe=aJe,lJe=()=>jh.toasts,cJe=()=>jh.getActiveToasts(),Ae=Object.assign(oJe,{success:jh.success,info:jh.info,warning:jh.warning,error:jh.error,custom:jh.custom,message:jh.message,promise:jh.promise,dismiss:jh.dismiss,loading:jh.loading},{getHistory:lJe,getToasts:cJe});function dJe(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))}dJe(`: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 qL(e){return e.label!==void 0}var uJe=3,hJe="32px",mJe="16px",Cje=4e3,fJe=356,pJe=14,gJe=20,xJe=200;function tp(...e){return e.filter(Boolean).join(" ")}function yJe(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var vJe=e=>{var t,n,s,a,o,l,i,u,m,x,y;let{invert:v,toast:b,unstyled:N,interacting:k,setHeights:M,visibleToasts:I,heights:T,index:P,toasts:F,expanded:D,removeToast:U,defaultRichColors:V,closeButton:W,style:G,cancelButtonStyle:ee,actionButtonStyle:ae,className:oe="",descriptionClassName:pe="",duration:ne,position:fe,gap:se,loadingIcon:me,expandByDefault:ue,classNames:xe,icons:Te,closeButtonAriaLabel:_e="Close toast",pauseWhenPageIsHidden:we}=e,[ve,Xe]=dt.useState(null),[Me,Ie]=dt.useState(null),[$e,Be]=dt.useState(!1),[Ve,ot]=dt.useState(!1),[Tt,Oe]=dt.useState(!1),[at,le]=dt.useState(!1),[qe,Je]=dt.useState(!1),[st,je]=dt.useState(0),[ut,Ce]=dt.useState(0),Ee=dt.useRef(b.duration||ne||Cje),Ze=dt.useRef(null),Le=dt.useRef(null),Ke=P===0,tt=P+1<=I,ct=b.type,it=b.dismissible!==!1,zt=b.className||"",Lt=b.descriptionClassName||"",lr=dt.useMemo(()=>T.findIndex(hs=>hs.toastId===b.id)||0,[T,b.id]),Ar=dt.useMemo(()=>{var hs;return(hs=b.closeButton)!=null?hs:W},[b.closeButton,W]),Mr=dt.useMemo(()=>b.duration||ne||Cje,[b.duration,ne]),Zr=dt.useRef(0),Xn=dt.useRef(0),dr=dt.useRef(0),En=dt.useRef(null),[Es,Hs]=fe.split("-"),Ei=dt.useMemo(()=>T.reduce((hs,Ys,zs)=>zs>=lr?hs:hs+Ys.height,0),[T,lr]),Ii=nJe(),Ho=b.invert||v,Ha=ct==="loading";Xn.current=dt.useMemo(()=>lr*se+Ei,[lr,Ei]),dt.useEffect(()=>{Ee.current=Mr},[Mr]),dt.useEffect(()=>{Be(!0)},[]),dt.useEffect(()=>{let hs=Le.current;if(hs){let Ys=hs.getBoundingClientRect().height;return Ce(Ys),M(zs=>[{toastId:b.id,height:Ys,position:b.position},...zs]),()=>M(zs=>zs.filter(ji=>ji.toastId!==b.id))}},[M,b.id]),dt.useLayoutEffect(()=>{if(!$e)return;let hs=Le.current,Ys=hs.style.height;hs.style.height="auto";let zs=hs.getBoundingClientRect().height;hs.style.height=Ys,Ce(zs),M(ji=>ji.find(ir=>ir.toastId===b.id)?ji.map(ir=>ir.toastId===b.id?{...ir,height:zs}:ir):[{toastId:b.id,height:zs,position:b.position},...ji])},[$e,b.title,b.description,M,b.id]);let us=dt.useCallback(()=>{ot(!0),je(Xn.current),M(hs=>hs.filter(Ys=>Ys.toastId!==b.id)),setTimeout(()=>{U(b)},xJe)},[b,U,M,Xn]);dt.useEffect(()=>{if(b.promise&&ct==="loading"||b.duration===1/0||b.type==="loading")return;let hs;return D||k||we&&Ii?(()=>{if(dr.current{var Ys;(Ys=b.onAutoClose)==null||Ys.call(b,b),us()},Ee.current)),()=>clearTimeout(hs)},[D,k,b,ct,we,Ii,us]),dt.useEffect(()=>{b.delete&&us()},[us,b.delete]);function ra(){var hs,Ys,zs;return Te!=null&&Te.loading?dt.createElement("div",{className:tp(xe==null?void 0:xe.loader,(hs=b==null?void 0:b.classNames)==null?void 0:hs.loader,"sonner-loader"),"data-visible":ct==="loading"},Te.loading):me?dt.createElement("div",{className:tp(xe==null?void 0:xe.loader,(Ys=b==null?void 0:b.classNames)==null?void 0:Ys.loader,"sonner-loader"),"data-visible":ct==="loading"},me):dt.createElement(XQe,{className:tp(xe==null?void 0:xe.loader,(zs=b==null?void 0:b.classNames)==null?void 0:zs.loader),visible:ct==="loading"})}return dt.createElement("li",{tabIndex:0,ref:Le,className:tp(oe,zt,xe==null?void 0:xe.toast,(t=b==null?void 0:b.classNames)==null?void 0:t.toast,xe==null?void 0:xe.default,xe==null?void 0:xe[ct],(n=b==null?void 0:b.classNames)==null?void 0:n[ct]),"data-sonner-toast":"","data-rich-colors":(s=b.richColors)!=null?s:V,"data-styled":!(b.jsx||b.unstyled||N),"data-mounted":$e,"data-promise":!!b.promise,"data-swiped":qe,"data-removed":Ve,"data-visible":tt,"data-y-position":Es,"data-x-position":Hs,"data-index":P,"data-front":Ke,"data-swiping":Tt,"data-dismissible":it,"data-type":ct,"data-invert":Ho,"data-swipe-out":at,"data-swipe-direction":Me,"data-expanded":!!(D||ue&&$e),style:{"--index":P,"--toasts-before":P,"--z-index":F.length-P,"--offset":`${Ve?st:Xn.current}px`,"--initial-height":ue?"auto":`${ut}px`,...G,...b.style},onDragEnd:()=>{Oe(!1),Xe(null),En.current=null},onPointerDown:hs=>{Ha||!it||(Ze.current=new Date,je(Xn.current),hs.target.setPointerCapture(hs.pointerId),hs.target.tagName!=="BUTTON"&&(Oe(!0),En.current={x:hs.clientX,y:hs.clientY}))},onPointerUp:()=>{var hs,Ys,zs,ji;if(at||!it)return;En.current=null;let ir=Number(((hs=Le.current)==null?void 0:hs.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Pa=Number(((Ys=Le.current)==null?void 0:Ys.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),oo=new Date().getTime()-((zs=Ze.current)==null?void 0:zs.getTime()),bi=ve==="x"?ir:Pa,qn=Math.abs(bi)/oo;if(Math.abs(bi)>=gJe||qn>.11){je(Xn.current),(ji=b.onDismiss)==null||ji.call(b,b),Ie(ve==="x"?ir>0?"right":"left":Pa>0?"down":"up"),us(),le(!0),Je(!1);return}Oe(!1),Xe(null)},onPointerMove:hs=>{var Ys,zs,ji,ir;if(!En.current||!it||((Ys=window.getSelection())==null?void 0:Ys.toString().length)>0)return;let Pa=hs.clientY-En.current.y,oo=hs.clientX-En.current.x,bi=(zs=e.swipeDirections)!=null?zs:yJe(fe);!ve&&(Math.abs(oo)>1||Math.abs(Pa)>1)&&Xe(Math.abs(oo)>Math.abs(Pa)?"x":"y");let qn={x:0,y:0};ve==="y"?(bi.includes("top")||bi.includes("bottom"))&&(bi.includes("top")&&Pa<0||bi.includes("bottom")&&Pa>0)&&(qn.y=Pa):ve==="x"&&(bi.includes("left")||bi.includes("right"))&&(bi.includes("left")&&oo<0||bi.includes("right")&&oo>0)&&(qn.x=oo),(Math.abs(qn.x)>0||Math.abs(qn.y)>0)&&Je(!0),(ji=Le.current)==null||ji.style.setProperty("--swipe-amount-x",`${qn.x}px`),(ir=Le.current)==null||ir.style.setProperty("--swipe-amount-y",`${qn.y}px`)}},Ar&&!b.jsx?dt.createElement("button",{"aria-label":_e,"data-disabled":Ha,"data-close-button":!0,onClick:Ha||!it?()=>{}:()=>{var hs;us(),(hs=b.onDismiss)==null||hs.call(b,b)},className:tp(xe==null?void 0:xe.closeButton,(a=b==null?void 0:b.classNames)==null?void 0:a.closeButton)},(o=Te==null?void 0:Te.close)!=null?o:rJe):null,b.jsx||A.isValidElement(b.title)?b.jsx?b.jsx:typeof b.title=="function"?b.title():b.title:dt.createElement(dt.Fragment,null,ct||b.icon||b.promise?dt.createElement("div",{"data-icon":"",className:tp(xe==null?void 0:xe.icon,(l=b==null?void 0:b.classNames)==null?void 0:l.icon)},b.promise||b.type==="loading"&&!b.icon?b.icon||ra():null,b.type!=="loading"?b.icon||(Te==null?void 0:Te[ct])||ZQe(ct):null):null,dt.createElement("div",{"data-content":"",className:tp(xe==null?void 0:xe.content,(i=b==null?void 0:b.classNames)==null?void 0:i.content)},dt.createElement("div",{"data-title":"",className:tp(xe==null?void 0:xe.title,(u=b==null?void 0:b.classNames)==null?void 0:u.title)},typeof b.title=="function"?b.title():b.title),b.description?dt.createElement("div",{"data-description":"",className:tp(pe,Lt,xe==null?void 0:xe.description,(m=b==null?void 0:b.classNames)==null?void 0:m.description)},typeof b.description=="function"?b.description():b.description):null),A.isValidElement(b.cancel)?b.cancel:b.cancel&&qL(b.cancel)?dt.createElement("button",{"data-button":!0,"data-cancel":!0,style:b.cancelButtonStyle||ee,onClick:hs=>{var Ys,zs;qL(b.cancel)&&it&&((zs=(Ys=b.cancel).onClick)==null||zs.call(Ys,hs),us())},className:tp(xe==null?void 0:xe.cancelButton,(x=b==null?void 0:b.classNames)==null?void 0:x.cancelButton)},b.cancel.label):null,A.isValidElement(b.action)?b.action:b.action&&qL(b.action)?dt.createElement("button",{"data-button":!0,"data-action":!0,style:b.actionButtonStyle||ae,onClick:hs=>{var Ys,zs;qL(b.action)&&((zs=(Ys=b.action).onClick)==null||zs.call(Ys,hs),!hs.defaultPrevented&&us())},className:tp(xe==null?void 0:xe.actionButton,(y=b==null?void 0:b.classNames)==null?void 0:y.actionButton)},b.action.label):null))};function Mje(){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 _Je(e,t){let n={};return[e,t].forEach((s,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?mJe:hJe;function u(m){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof m=="number"?`${m}px`:m})}typeof s=="number"||typeof s=="string"?u(s):typeof s=="object"?["top","right","bottom","left"].forEach(m=>{s[m]===void 0?n[`${l}-${m}`]=i:n[`${l}-${m}`]=typeof s[m]=="number"?`${s[m]}px`:s[m]}):u(i)}),n}var bJe=A.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:u,mobileOffset:m,theme:x="light",richColors:y,duration:v,style:b,visibleToasts:N=uJe,toastOptions:k,dir:M=Mje(),gap:I=pJe,loadingIcon:T,icons:P,containerAriaLabel:F="Notifications",pauseWhenPageIsHidden:D}=e,[U,V]=dt.useState([]),W=dt.useMemo(()=>Array.from(new Set([s].concat(U.filter(we=>we.position).map(we=>we.position)))),[U,s]),[G,ee]=dt.useState([]),[ae,oe]=dt.useState(!1),[pe,ne]=dt.useState(!1),[fe,se]=dt.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),me=dt.useRef(null),ue=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),xe=dt.useRef(null),Te=dt.useRef(!1),_e=dt.useCallback(we=>{V(ve=>{var Xe;return(Xe=ve.find(Me=>Me.id===we.id))!=null&&Xe.delete||jh.dismiss(we.id),ve.filter(({id:Me})=>Me!==we.id)})},[]);return dt.useEffect(()=>jh.subscribe(we=>{if(we.dismiss){V(ve=>ve.map(Xe=>Xe.id===we.id?{...Xe,delete:!0}:Xe));return}setTimeout(()=>{Xge.flushSync(()=>{V(ve=>{let Xe=ve.findIndex(Me=>Me.id===we.id);return Xe!==-1?[...ve.slice(0,Xe),{...ve[Xe],...we},...ve.slice(Xe+1)]:[we,...ve]})})})}),[]),dt.useEffect(()=>{if(x!=="system"){se(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?se("dark"):se("light")),typeof window>"u")return;let we=window.matchMedia("(prefers-color-scheme: dark)");try{we.addEventListener("change",({matches:ve})=>{se(ve?"dark":"light")})}catch{we.addListener(({matches:Xe})=>{try{se(Xe?"dark":"light")}catch(Me){console.error(Me)}})}},[x]),dt.useEffect(()=>{U.length<=1&&oe(!1)},[U]),dt.useEffect(()=>{let we=ve=>{var Xe,Me;a.every(Ie=>ve[Ie]||ve.code===Ie)&&(oe(!0),(Xe=me.current)==null||Xe.focus()),ve.code==="Escape"&&(document.activeElement===me.current||(Me=me.current)!=null&&Me.contains(document.activeElement))&&oe(!1)};return document.addEventListener("keydown",we),()=>document.removeEventListener("keydown",we)},[a]),dt.useEffect(()=>{if(me.current)return()=>{xe.current&&(xe.current.focus({preventScroll:!0}),xe.current=null,Te.current=!1)}},[me.current]),dt.createElement("section",{ref:t,"aria-label":`${F} ${ue}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((we,ve)=>{var Xe;let[Me,Ie]=we.split("-");return U.length?dt.createElement("ol",{key:we,dir:M==="auto"?Mje():M,tabIndex:-1,ref:me,className:i,"data-sonner-toaster":!0,"data-theme":fe,"data-y-position":Me,"data-lifted":ae&&U.length>1&&!o,"data-x-position":Ie,style:{"--front-toast-height":`${((Xe=G[0])==null?void 0:Xe.height)||0}px`,"--width":`${fJe}px`,"--gap":`${I}px`,...b,..._Je(u,m)},onBlur:$e=>{Te.current&&!$e.currentTarget.contains($e.relatedTarget)&&(Te.current=!1,xe.current&&(xe.current.focus({preventScroll:!0}),xe.current=null))},onFocus:$e=>{$e.target instanceof HTMLElement&&$e.target.dataset.dismissible==="false"||Te.current||(Te.current=!0,xe.current=$e.relatedTarget)},onMouseEnter:()=>oe(!0),onMouseMove:()=>oe(!0),onMouseLeave:()=>{pe||oe(!1)},onDragEnd:()=>oe(!1),onPointerDown:$e=>{$e.target instanceof HTMLElement&&$e.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},U.filter($e=>!$e.position&&ve===0||$e.position===we).map(($e,Be)=>{var Ve,ot;return dt.createElement(vJe,{key:$e.id,icons:P,index:Be,toast:$e,defaultRichColors:y,duration:(Ve=k==null?void 0:k.duration)!=null?Ve:v,className:k==null?void 0:k.className,descriptionClassName:k==null?void 0:k.descriptionClassName,invert:n,visibleToasts:N,closeButton:(ot=k==null?void 0:k.closeButton)!=null?ot:l,interacting:pe,position:we,style:k==null?void 0:k.style,unstyled:k==null?void 0:k.unstyled,classNames:k==null?void 0:k.classNames,cancelButtonStyle:k==null?void 0:k.cancelButtonStyle,actionButtonStyle:k==null?void 0:k.actionButtonStyle,removeToast:_e,toasts:U.filter(Tt=>Tt.position==$e.position),heights:G.filter(Tt=>Tt.position==$e.position),setHeights:ee,expandByDefault:o,gap:I,loadingIcon:T,expanded:ae,pauseWhenPageIsHidden:D,swipeDirections:e.swipeDirections})})):null}))});const wJe=({...e})=>{const{theme:t="system"}=KQe();return r.jsx(bJe,{theme:t,position:"top-center",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 jJe=ige[" useId ".trim().toString()]||(()=>{}),kJe=0;function pd(e){const[t,n]=A.useState(jJe());return oc(()=>{n(s=>s??String(kJe++))},[e]),t?`radix-${t}`:""}const NJe=["top","right","bottom","left"],hv=Math.min,am=Math.max,Ste=Math.round,VL=Math.floor,Hg=e=>({x:e,y:e}),SJe={left:"right",right:"left",bottom:"top",top:"bottom"},CJe={start:"end",end:"start"};function ghe(e,t,n){return am(e,hv(t,n))}function Ty(e,t){return typeof e=="function"?e(t):e}function Ay(e){return e.split("-")[0]}function v3(e){return e.split("-")[1]}function sxe(e){return e==="x"?"y":"x"}function axe(e){return e==="y"?"height":"width"}const MJe=new Set(["top","bottom"]);function Mg(e){return MJe.has(Ay(e))?"y":"x"}function ixe(e){return sxe(Mg(e))}function TJe(e,t,n){n===void 0&&(n=!1);const s=v3(e),a=ixe(e),o=axe(a);let l=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Cte(l)),[l,Cte(l)]}function AJe(e){const t=Cte(e);return[xhe(e),t,xhe(t)]}function xhe(e){return e.replace(/start|end/g,t=>CJe[t])}const Tje=["left","right"],Aje=["right","left"],EJe=["top","bottom"],IJe=["bottom","top"];function PJe(e,t,n){switch(e){case"top":case"bottom":return n?t?Aje:Tje:t?Tje:Aje;case"left":case"right":return t?EJe:IJe;default:return[]}}function LJe(e,t,n,s){const a=v3(e);let o=PJe(Ay(e),n==="start",s);return a&&(o=o.map(l=>l+"-"+a),t&&(o=o.concat(o.map(xhe)))),o}function Cte(e){return e.replace(/left|right|bottom|top/g,t=>SJe[t])}function OJe(e){return{top:0,right:0,bottom:0,left:0,...e}}function qIe(e){return typeof e!="number"?OJe(e):{top:e,right:e,bottom:e,left:e}}function Mte(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function Eje(e,t,n){let{reference:s,floating:a}=e;const o=Mg(t),l=ixe(t),i=axe(l),u=Ay(t),m=o==="y",x=s.x+s.width/2-a.width/2,y=s.y+s.height/2-a.height/2,v=s[i]/2-a[i]/2;let b;switch(u){case"top":b={x,y:s.y-a.height};break;case"bottom":b={x,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y};break;case"left":b={x:s.x-a.width,y};break;default:b={x:s.x,y:s.y}}switch(v3(t)){case"start":b[l]-=v*(n&&m?-1:1);break;case"end":b[l]+=v*(n&&m?-1:1);break}return b}const DJe=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:o=[],platform:l}=n,i=o.filter(Boolean),u=await(l.isRTL==null?void 0:l.isRTL(t));let m=await l.getElementRects({reference:e,floating:t,strategy:a}),{x,y}=Eje(m,s,u),v=s,b={},N=0;for(let k=0;k({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:o,platform:l,elements:i,middlewareData:u}=t,{element:m,padding:x=0}=Ty(e,t)||{};if(m==null)return{};const y=qIe(x),v={x:n,y:s},b=ixe(a),N=axe(b),k=await l.getDimensions(m),M=b==="y",I=M?"top":"left",T=M?"bottom":"right",P=M?"clientHeight":"clientWidth",F=o.reference[N]+o.reference[b]-v[b]-o.floating[N],D=v[b]-o.reference[b],U=await(l.getOffsetParent==null?void 0:l.getOffsetParent(m));let V=U?U[P]:0;(!V||!await(l.isElement==null?void 0:l.isElement(U)))&&(V=i.floating[P]||o.floating[N]);const W=F/2-D/2,G=V/2-k[N]/2-1,ee=hv(y[I],G),ae=hv(y[T],G),oe=ee,pe=V-k[N]-ae,ne=V/2-k[N]/2+W,fe=ghe(oe,ne,pe),se=!u.arrow&&v3(a)!=null&&ne!==fe&&o.reference[N]/2-(nene<=0)){var ae,oe;const ne=(((ae=o.flip)==null?void 0:ae.index)||0)+1,fe=V[ne];if(fe&&(!(y==="alignment"?T!==Mg(fe):!1)||ee.every(ue=>ue.overflows[0]>0&&Mg(ue.placement)===T)))return{data:{index:ne,overflows:ee},reset:{placement:fe}};let se=(oe=ee.filter(me=>me.overflows[0]<=0).sort((me,ue)=>me.overflows[1]-ue.overflows[1])[0])==null?void 0:oe.placement;if(!se)switch(b){case"bestFit":{var pe;const me=(pe=ee.filter(ue=>{if(U){const xe=Mg(ue.placement);return xe===T||xe==="y"}return!0}).map(ue=>[ue.placement,ue.overflows.filter(xe=>xe>0).reduce((xe,Te)=>xe+Te,0)]).sort((ue,xe)=>ue[1]-xe[1])[0])==null?void 0:pe[0];me&&(se=me);break}case"initialPlacement":se=i;break}if(a!==se)return{reset:{placement:se}}}return{}}}};function Ije(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pje(e){return NJe.some(t=>e[t]>=0)}const zJe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...a}=Ty(e,t);switch(s){case"referenceHidden":{const o=await wE(t,{...a,elementContext:"reference"}),l=Ije(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Pje(l)}}}case"escaped":{const o=await wE(t,{...a,altBoundary:!0}),l=Ije(o,n.floating);return{data:{escapedOffsets:l,escaped:Pje(l)}}}default:return{}}}}},VIe=new Set(["left","top"]);async function BJe(e,t){const{placement:n,platform:s,elements:a}=e,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),l=Ay(n),i=v3(n),u=Mg(n)==="y",m=VIe.has(l)?-1:1,x=o&&u?-1:1,y=Ty(t,e);let{mainAxis:v,crossAxis:b,alignmentAxis:N}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return i&&typeof N=="number"&&(b=i==="end"?N*-1:N),u?{x:b*x,y:v*m}:{x:v*m,y:b*x}}const $Je=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:o,placement:l,middlewareData:i}=t,u=await BJe(t,e);return l===((n=i.offset)==null?void 0:n.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:a+u.x,y:o+u.y,data:{...u,placement:l}}}}},UJe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:i={fn:M=>{let{x:I,y:T}=M;return{x:I,y:T}}},...u}=Ty(e,t),m={x:n,y:s},x=await wE(t,u),y=Mg(Ay(a)),v=sxe(y);let b=m[v],N=m[y];if(o){const M=v==="y"?"top":"left",I=v==="y"?"bottom":"right",T=b+x[M],P=b-x[I];b=ghe(T,b,P)}if(l){const M=y==="y"?"top":"left",I=y==="y"?"bottom":"right",T=N+x[M],P=N-x[I];N=ghe(T,N,P)}const k=i.fn({...t,[v]:b,[y]:N});return{...k,data:{x:k.x-n,y:k.y-s,enabled:{[v]:o,[y]:l}}}}}},qJe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:o,middlewareData:l}=t,{offset:i=0,mainAxis:u=!0,crossAxis:m=!0}=Ty(e,t),x={x:n,y:s},y=Mg(a),v=sxe(y);let b=x[v],N=x[y];const k=Ty(i,t),M=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:0,crossAxis:0,...k};if(u){const P=v==="y"?"height":"width",F=o.reference[v]-o.floating[P]+M.mainAxis,D=o.reference[v]+o.reference[P]-M.mainAxis;bD&&(b=D)}if(m){var I,T;const P=v==="y"?"width":"height",F=VIe.has(Ay(a)),D=o.reference[y]-o.floating[P]+(F&&((I=l.offset)==null?void 0:I[y])||0)+(F?0:M.crossAxis),U=o.reference[y]+o.reference[P]+(F?0:((T=l.offset)==null?void 0:T[y])||0)-(F?M.crossAxis:0);NU&&(N=U)}return{[v]:b,[y]:N}}}},VJe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:o,platform:l,elements:i}=t,{apply:u=()=>{},...m}=Ty(e,t),x=await wE(t,m),y=Ay(a),v=v3(a),b=Mg(a)==="y",{width:N,height:k}=o.floating;let M,I;y==="top"||y==="bottom"?(M=y,I=v===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(I=y,M=v==="end"?"top":"bottom");const T=k-x.top-x.bottom,P=N-x.left-x.right,F=hv(k-x[M],T),D=hv(N-x[I],P),U=!t.middlewareData.shift;let V=F,W=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(W=P),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(V=T),U&&!v){const ee=am(x.left,0),ae=am(x.right,0),oe=am(x.top,0),pe=am(x.bottom,0);b?W=N-2*(ee!==0||ae!==0?ee+ae:am(x.left,x.right)):V=k-2*(oe!==0||pe!==0?oe+pe:am(x.top,x.bottom))}await u({...t,availableWidth:W,availableHeight:V});const G=await l.getDimensions(i.floating);return N!==G.width||k!==G.height?{reset:{rects:!0}}:{}}}};function yse(){return typeof window<"u"}function _3(e){return HIe(e)?(e.nodeName||"").toLowerCase():"#document"}function _m(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sx(e){var t;return(t=(HIe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HIe(e){return yse()?e instanceof Node||e instanceof _m(e).Node:!1}function Rp(e){return yse()?e instanceof Element||e instanceof _m(e).Element:!1}function Xg(e){return yse()?e instanceof HTMLElement||e instanceof _m(e).HTMLElement:!1}function Lje(e){return!yse()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _m(e).ShadowRoot}const HJe=new Set(["inline","contents"]);function GI(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=Fp(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!HJe.has(a)}const WJe=new Set(["table","td","th"]);function GJe(e){return WJe.has(_3(e))}const KJe=[":popover-open",":modal"];function vse(e){return KJe.some(t=>{try{return e.matches(t)}catch{return!1}})}const ZJe=["transform","translate","scale","rotate","perspective"],YJe=["transform","translate","scale","rotate","perspective","filter"],XJe=["paint","layout","strict","content"];function oxe(e){const t=lxe(),n=Rp(e)?Fp(e):e;return ZJe.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)||YJe.some(s=>(n.willChange||"").includes(s))||XJe.some(s=>(n.contain||"").includes(s))}function QJe(e){let t=mv(e);for(;Xg(t)&&!NC(t);){if(oxe(t))return t;if(vse(t))return null;t=mv(t)}return null}function lxe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const JJe=new Set(["html","body","#document"]);function NC(e){return JJe.has(_3(e))}function Fp(e){return _m(e).getComputedStyle(e)}function _se(e){return Rp(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mv(e){if(_3(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Lje(e)&&e.host||sx(e);return Lje(t)?t.host:t}function WIe(e){const t=mv(e);return NC(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xg(t)&&GI(t)?t:WIe(t)}function jE(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=WIe(e),o=a===((s=e.ownerDocument)==null?void 0:s.body),l=_m(a);if(o){const i=yhe(l);return t.concat(l,l.visualViewport||[],GI(a)?a:[],i&&n?jE(i):[])}return t.concat(a,jE(a,[],n))}function yhe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function GIe(e){const t=Fp(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Xg(e),o=a?e.offsetWidth:n,l=a?e.offsetHeight:s,i=Ste(n)!==o||Ste(s)!==l;return i&&(n=o,s=l),{width:n,height:s,$:i}}function cxe(e){return Rp(e)?e:e.contextElement}function $4(e){const t=cxe(e);if(!Xg(t))return Hg(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:o}=GIe(t);let l=(o?Ste(n.width):n.width)/s,i=(o?Ste(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const eet=Hg(0);function KIe(e){const t=_m(e);return!lxe()||!t.visualViewport?eet:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tet(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_m(e)?!1:t}function nk(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=cxe(e);let l=Hg(1);t&&(s?Rp(s)&&(l=$4(s)):l=$4(e));const i=tet(o,n,s)?KIe(o):Hg(0);let u=(a.left+i.x)/l.x,m=(a.top+i.y)/l.y,x=a.width/l.x,y=a.height/l.y;if(o){const v=_m(o),b=s&&Rp(s)?_m(s):s;let N=v,k=yhe(N);for(;k&&s&&b!==N;){const M=$4(k),I=k.getBoundingClientRect(),T=Fp(k),P=I.left+(k.clientLeft+parseFloat(T.paddingLeft))*M.x,F=I.top+(k.clientTop+parseFloat(T.paddingTop))*M.y;u*=M.x,m*=M.y,x*=M.x,y*=M.y,u+=P,m+=F,N=_m(k),k=yhe(N)}}return Mte({width:x,height:y,x:u,y:m})}function dxe(e,t){const n=_se(e).scrollLeft;return t?t.left+n:nk(sx(e)).left+n}function ZIe(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=s.left+t.scrollLeft-(n?0:dxe(e,s)),o=s.top+t.scrollTop;return{x:a,y:o}}function ret(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const o=a==="fixed",l=sx(s),i=t?vse(t.floating):!1;if(s===l||i&&o)return n;let u={scrollLeft:0,scrollTop:0},m=Hg(1);const x=Hg(0),y=Xg(s);if((y||!y&&!o)&&((_3(s)!=="body"||GI(l))&&(u=_se(s)),Xg(s))){const b=nk(s);m=$4(s),x.x=b.x+s.clientLeft,x.y=b.y+s.clientTop}const v=l&&!y&&!o?ZIe(l,u,!0):Hg(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-u.scrollLeft*m.x+x.x+v.x,y:n.y*m.y-u.scrollTop*m.y+x.y+v.y}}function net(e){return Array.from(e.getClientRects())}function set(e){const t=sx(e),n=_se(e),s=e.ownerDocument.body,a=am(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=am(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+dxe(e);const i=-n.scrollTop;return Fp(s).direction==="rtl"&&(l+=am(t.clientWidth,s.clientWidth)-a),{width:a,height:o,x:l,y:i}}function aet(e,t){const n=_m(e),s=sx(e),a=n.visualViewport;let o=s.clientWidth,l=s.clientHeight,i=0,u=0;if(a){o=a.width,l=a.height;const m=lxe();(!m||m&&t==="fixed")&&(i=a.offsetLeft,u=a.offsetTop)}return{width:o,height:l,x:i,y:u}}const iet=new Set(["absolute","fixed"]);function oet(e,t){const n=nk(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,o=Xg(e)?$4(e):Hg(1),l=e.clientWidth*o.x,i=e.clientHeight*o.y,u=a*o.x,m=s*o.y;return{width:l,height:i,x:u,y:m}}function Oje(e,t,n){let s;if(t==="viewport")s=aet(e,n);else if(t==="document")s=set(sx(e));else if(Rp(t))s=oet(t,n);else{const a=KIe(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Mte(s)}function YIe(e,t){const n=mv(e);return n===t||!Rp(n)||NC(n)?!1:Fp(n).position==="fixed"||YIe(n,t)}function cet(e,t){const n=t.get(e);if(n)return n;let s=jE(e,[],!1).filter(i=>Rp(i)&&_3(i)!=="body"),a=null;const o=Fp(e).position==="fixed";let l=o?mv(e):e;for(;Rp(l)&&!NC(l);){const i=Fp(l),u=oxe(l);!u&&i.position==="fixed"&&(a=null),(o?!u&&!a:!u&&i.position==="static"&&!!a&&iet.has(a.position)||GI(l)&&!u&&YIe(e,l))?s=s.filter(x=>x!==l):a=i,l=mv(l)}return t.set(e,s),s}function det(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const l=[...n==="clippingAncestors"?vse(t)?[]:cet(t,this._c):[].concat(n),s],i=l[0],u=l.reduce((m,x)=>{const y=Oje(t,x,a);return m.top=am(y.top,m.top),m.right=hv(y.right,m.right),m.bottom=hv(y.bottom,m.bottom),m.left=am(y.left,m.left),m},Oje(t,i,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function uet(e){const{width:t,height:n}=GIe(e);return{width:t,height:n}}function het(e,t,n){const s=Xg(t),a=sx(t),o=n==="fixed",l=nk(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const u=Hg(0);function m(){u.x=dxe(a)}if(s||!s&&!o)if((_3(t)!=="body"||GI(a))&&(i=_se(t)),s){const b=nk(t,!0,o,t);u.x=b.x+t.clientLeft,u.y=b.y+t.clientTop}else a&&m();o&&!s&&a&&m();const x=a&&!s&&!o?ZIe(a,i):Hg(0),y=l.left+i.scrollLeft-u.x-x.x,v=l.top+i.scrollTop-u.y-x.y;return{x:y,y:v,width:l.width,height:l.height}}function fce(e){return Fp(e).position==="static"}function Dje(e,t){if(!Xg(e)||Fp(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return sx(e)===n&&(n=n.ownerDocument.body),n}function XIe(e,t){const n=_m(e);if(vse(e))return n;if(!Xg(e)){let a=mv(e);for(;a&&!NC(a);){if(Rp(a)&&!fce(a))return a;a=mv(a)}return n}let s=Dje(e,t);for(;s&&GJe(s)&&fce(s);)s=Dje(s,t);return s&&NC(s)&&fce(s)&&!oxe(s)?n:s||QJe(e)||n}const met=async function(e){const t=this.getOffsetParent||XIe,n=this.getDimensions,s=await n(e.floating);return{reference:het(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function fet(e){return Fp(e).direction==="rtl"}const pet={convertOffsetParentRelativeRectToViewportRelativeRect:ret,getDocumentElement:sx,getClippingRect:det,getOffsetParent:XIe,getElementRects:met,getClientRects:net,getDimensions:uet,getScale:$4,isElement:Rp,isRTL:fet};function QIe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function get(e,t){let n=null,s;const a=sx(e);function o(){var i;clearTimeout(s),(i=n)==null||i.disconnect(),n=null}function l(i,u){i===void 0&&(i=!1),u===void 0&&(u=1),o();const m=e.getBoundingClientRect(),{left:x,top:y,width:v,height:b}=m;if(i||t(),!v||!b)return;const N=VL(y),k=VL(a.clientWidth-(x+v)),M=VL(a.clientHeight-(y+b)),I=VL(x),P={rootMargin:-N+"px "+-k+"px "+-M+"px "+-I+"px",threshold:am(0,hv(1,u))||1};let F=!0;function D(U){const V=U[0].intersectionRatio;if(V!==u){if(!F)return l();V?l(!1,V):s=setTimeout(()=>{l(!1,1e-7)},1e3)}V===1&&!QIe(m,e.getBoundingClientRect())&&l(),F=!1}try{n=new IntersectionObserver(D,{...P,root:a.ownerDocument})}catch{n=new IntersectionObserver(D,P)}n.observe(e)}return l(!0),o}function xet(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:u=!1}=s,m=cxe(e),x=a||o?[...m?jE(m):[],...jE(t)]:[];x.forEach(I=>{a&&I.addEventListener("scroll",n,{passive:!0}),o&&I.addEventListener("resize",n)});const y=m&&i?get(m,n):null;let v=-1,b=null;l&&(b=new ResizeObserver(I=>{let[T]=I;T&&T.target===m&&b&&(b.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var P;(P=b)==null||P.observe(t)})),n()}),m&&!u&&b.observe(m),b.observe(t));let N,k=u?nk(e):null;u&&M();function M(){const I=nk(e);k&&!QIe(k,I)&&n(),k=I,N=requestAnimationFrame(M)}return n(),()=>{var I;x.forEach(T=>{a&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),y==null||y(),(I=b)==null||I.disconnect(),b=null,u&&cancelAnimationFrame(N)}}const yet=$Je,vet=UJe,_et=FJe,bet=VJe,wet=zJe,Rje=RJe,jet=qJe,ket=(e,t,n)=>{const s=new Map,a={platform:pet,...n},o={...a.platform,_c:s};return DJe(e,t,{...a,platform:o})};var Net=typeof document<"u",Cet=function(){},Dee=Net?A.useLayoutEffect:Cet;function Tte(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,a;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(!Tte(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const o=a[s];if(!(o==="_owner"&&e.$$typeof)&&!Tte(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function JIe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fje(e,t){const n=JIe(e);return Math.round(t*n)/n}function pce(e){const t=A.useRef(e);return Dee(()=>{t.current=e}),t}function Met(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:o,floating:l}={},transform:i=!0,whileElementsMounted:u,open:m}=e,[x,y]=A.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,b]=A.useState(s);Tte(v,s)||b(s);const[N,k]=A.useState(null),[M,I]=A.useState(null),T=A.useCallback(ue=>{ue!==U.current&&(U.current=ue,k(ue))},[]),P=A.useCallback(ue=>{ue!==V.current&&(V.current=ue,I(ue))},[]),F=o||N,D=l||M,U=A.useRef(null),V=A.useRef(null),W=A.useRef(x),G=u!=null,ee=pce(u),ae=pce(a),oe=pce(m),pe=A.useCallback(()=>{if(!U.current||!V.current)return;const ue={placement:t,strategy:n,middleware:v};ae.current&&(ue.platform=ae.current),ket(U.current,V.current,ue).then(xe=>{const Te={...xe,isPositioned:oe.current!==!1};ne.current&&!Tte(W.current,Te)&&(W.current=Te,Th.flushSync(()=>{y(Te)}))})},[v,t,n,ae,oe]);Dee(()=>{m===!1&&W.current.isPositioned&&(W.current.isPositioned=!1,y(ue=>({...ue,isPositioned:!1})))},[m]);const ne=A.useRef(!1);Dee(()=>(ne.current=!0,()=>{ne.current=!1}),[]),Dee(()=>{if(F&&(U.current=F),D&&(V.current=D),F&&D){if(ee.current)return ee.current(F,D,pe);pe()}},[F,D,pe,ee,G]);const fe=A.useMemo(()=>({reference:U,floating:V,setReference:T,setFloating:P}),[T,P]),se=A.useMemo(()=>({reference:F,floating:D}),[F,D]),me=A.useMemo(()=>{const ue={position:n,left:0,top:0};if(!se.floating)return ue;const xe=Fje(se.floating,x.x),Te=Fje(se.floating,x.y);return i?{...ue,transform:"translate("+xe+"px, "+Te+"px)",...JIe(se.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:xe,top:Te}},[n,i,se.floating,x.x,x.y]);return A.useMemo(()=>({...x,update:pe,refs:fe,elements:se,floatingStyles:me}),[x,pe,fe,se,me])}const Tet=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Rje({element:s.current,padding:a}).fn(n):{}:s?Rje({element:s,padding:a}).fn(n):{}}}},Aet=(e,t)=>({...yet(e),options:[e,t]}),Eet=(e,t)=>({...vet(e),options:[e,t]}),Iet=(e,t)=>({...jet(e),options:[e,t]}),Pet=(e,t)=>({..._et(e),options:[e,t]}),Let=(e,t)=>({...bet(e),options:[e,t]}),Oet=(e,t)=>({...wet(e),options:[e,t]}),Det=(e,t)=>({...Tet(e),options:[e,t]});var Ret="Arrow",ePe=A.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...o}=e;return r.jsx(Fn.svg,{...o,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});ePe.displayName=Ret;var Fet=ePe;function KI(e){const[t,n]=A.useState(void 0);return oc(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let l,i;if("borderBoxSize"in o){const u=o.borderBoxSize,m=Array.isArray(u)?u[0]:u;l=m.inlineSize,i=m.blockSize}else l=e.offsetWidth,i=e.offsetHeight;n({width:l,height:i})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var uxe="Popper",[tPe,ax]=cc(uxe),[zet,rPe]=tPe(uxe),nPe=e=>{const{__scopePopper:t,children:n}=e,[s,a]=A.useState(null);return r.jsx(zet,{scope:t,anchor:s,onAnchorChange:a,children:n})};nPe.displayName=uxe;var sPe="PopperAnchor",aPe=A.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,o=rPe(sPe,n),l=A.useRef(null),i=ca(t,l);return A.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||l.current)}),s?null:r.jsx(Fn.div,{...a,ref:i})});aPe.displayName=sPe;var hxe="PopperContent",[Bet,$et]=tPe(hxe),iPe=A.forwardRef((e,t)=>{var $e,Be,Ve,ot,Tt,Oe;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:u=!0,collisionBoundary:m=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:N,...k}=e,M=rPe(hxe,n),[I,T]=A.useState(null),P=ca(t,at=>T(at)),[F,D]=A.useState(null),U=KI(F),V=(U==null?void 0:U.width)??0,W=(U==null?void 0:U.height)??0,G=s+(o!=="center"?"-"+o:""),ee=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ae=Array.isArray(m)?m:[m],oe=ae.length>0,pe={padding:ee,boundary:ae.filter(qet),altBoundary:oe},{refs:ne,floatingStyles:fe,placement:se,isPositioned:me,middlewareData:ue}=Met({strategy:"fixed",placement:G,whileElementsMounted:(...at)=>xet(...at,{animationFrame:b==="always"}),elements:{reference:M.anchor},middleware:[Aet({mainAxis:a+W,alignmentAxis:l}),u&&Eet({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?Iet():void 0,...pe}),u&&Pet({...pe}),Let({...pe,apply:({elements:at,rects:le,availableWidth:qe,availableHeight:Je})=>{const{width:st,height:je}=le.reference,ut=at.floating.style;ut.setProperty("--radix-popper-available-width",`${qe}px`),ut.setProperty("--radix-popper-available-height",`${Je}px`),ut.setProperty("--radix-popper-anchor-width",`${st}px`),ut.setProperty("--radix-popper-anchor-height",`${je}px`)}}),F&&Det({element:F,padding:i}),Vet({arrowWidth:V,arrowHeight:W}),v&&Oet({strategy:"referenceHidden",...pe})]}),[xe,Te]=cPe(se),_e=sc(N);oc(()=>{me&&(_e==null||_e())},[me,_e]);const we=($e=ue.arrow)==null?void 0:$e.x,ve=(Be=ue.arrow)==null?void 0:Be.y,Xe=((Ve=ue.arrow)==null?void 0:Ve.centerOffset)!==0,[Me,Ie]=A.useState();return oc(()=>{I&&Ie(window.getComputedStyle(I).zIndex)},[I]),r.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...fe,transform:me?fe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[(ot=ue.transformOrigin)==null?void 0:ot.x,(Tt=ue.transformOrigin)==null?void 0:Tt.y].join(" "),...((Oe=ue.hide)==null?void 0:Oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Bet,{scope:n,placedSide:xe,onArrowChange:D,arrowX:we,arrowY:ve,shouldHideArrow:Xe,children:r.jsx(Fn.div,{"data-side":xe,"data-align":Te,...k,ref:P,style:{...k.style,animation:me?void 0:"none"}})})})});iPe.displayName=hxe;var oPe="PopperArrow",Uet={top:"bottom",right:"left",bottom:"top",left:"right"},lPe=A.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,o=$et(oPe,s),l=Uet[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(Fet,{...a,ref:n,style:{...a.style,display:"block"}})})});lPe.displayName=oPe;function qet(e){return e!==null}var Vet=e=>({name:"transformOrigin",options:e,fn(t){var M,I,T;const{placement:n,rects:s,middlewareData:a}=t,l=((M=a.arrow)==null?void 0:M.centerOffset)!==0,i=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[m,x]=cPe(n),y={start:"0%",center:"50%",end:"100%"}[x],v=(((I=a.arrow)==null?void 0:I.x)??0)+i/2,b=(((T=a.arrow)==null?void 0:T.y)??0)+u/2;let N="",k="";return m==="bottom"?(N=l?y:`${v}px`,k=`${-u}px`):m==="top"?(N=l?y:`${v}px`,k=`${s.floating.height+u}px`):m==="right"?(N=`${-u}px`,k=l?y:`${b}px`):m==="left"&&(N=`${s.floating.width+u}px`,k=l?y:`${b}px`),{data:{x:N,y:k}}}});function cPe(e){const[t,n="center"]=e.split("-");return[t,n]}var ZI=nPe,b3=aPe,YI=iPe,XI=lPe,[bse]=cc("Tooltip",[ax]),wse=ax(),dPe="TooltipProvider",Het=700,vhe="tooltip.open",[Wet,mxe]=bse(dPe),uPe=e=>{const{__scopeTooltip:t,delayDuration:n=Het,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:o}=e,l=A.useRef(!0),i=A.useRef(!1),u=A.useRef(0);return A.useEffect(()=>{const m=u.current;return()=>window.clearTimeout(m)},[]),r.jsx(Wet,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:A.useCallback(()=>{window.clearTimeout(u.current),l.current=!1},[]),onClose:A.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:A.useCallback(m=>{i.current=m},[]),disableHoverableContent:a,children:o})};uPe.displayName=dPe;var kE="Tooltip",[Get,jse]=bse(kE),hPe=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=e,u=mxe(kE,e.__scopeTooltip),m=wse(t),[x,y]=A.useState(null),v=pd(),b=A.useRef(0),N=l??u.disableHoverableContent,k=i??u.delayDuration,M=A.useRef(!1),[I,T]=rh({prop:s,defaultProp:a??!1,onChange:V=>{V?(u.onOpen(),document.dispatchEvent(new CustomEvent(vhe))):u.onClose(),o==null||o(V)},caller:kE}),P=A.useMemo(()=>I?M.current?"delayed-open":"instant-open":"closed",[I]),F=A.useCallback(()=>{window.clearTimeout(b.current),b.current=0,M.current=!1,T(!0)},[T]),D=A.useCallback(()=>{window.clearTimeout(b.current),b.current=0,T(!1)},[T]),U=A.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{M.current=!0,T(!0),b.current=0},k)},[k,T]);return A.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(ZI,{...m,children:r.jsx(Get,{scope:t,contentId:v,open:I,stateAttribute:P,trigger:x,onTriggerChange:y,onTriggerEnter:A.useCallback(()=>{u.isOpenDelayedRef.current?U():F()},[u.isOpenDelayedRef,U,F]),onTriggerLeave:A.useCallback(()=>{N?D():(window.clearTimeout(b.current),b.current=0)},[D,N]),onOpen:F,onClose:D,disableHoverableContent:N,children:n})})};hPe.displayName=kE;var _he="TooltipTrigger",mPe=A.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=jse(_he,n),o=mxe(_he,n),l=wse(n),i=A.useRef(null),u=ca(t,i,a.onTriggerChange),m=A.useRef(!1),x=A.useRef(!1),y=A.useCallback(()=>m.current=!1,[]);return A.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),r.jsx(b3,{asChild:!0,...l,children:r.jsx(Fn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:u,onPointerMove:gn(e.onPointerMove,v=>{v.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),x.current=!0)}),onPointerLeave:gn(e.onPointerLeave,()=>{a.onTriggerLeave(),x.current=!1}),onPointerDown:gn(e.onPointerDown,()=>{a.open&&a.onClose(),m.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:gn(e.onFocus,()=>{m.current||a.onOpen()}),onBlur:gn(e.onBlur,a.onClose),onClick:gn(e.onClick,a.onClose)})})});mPe.displayName=_he;var Ket="TooltipPortal",[Her,Zet]=bse(Ket,{forceMount:void 0}),SC="TooltipContent",fPe=A.forwardRef((e,t)=>{const n=Zet(SC,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...o}=e,l=jse(SC,e.__scopeTooltip);return r.jsx(Ac,{present:s||l.open,children:l.disableHoverableContent?r.jsx(pPe,{side:a,...o,ref:t}):r.jsx(Yet,{side:a,...o,ref:t})})}),Yet=A.forwardRef((e,t)=>{const n=jse(SC,e.__scopeTooltip),s=mxe(SC,e.__scopeTooltip),a=A.useRef(null),o=ca(t,a),[l,i]=A.useState(null),{trigger:u,onClose:m}=n,x=a.current,{onPointerInTransitChange:y}=s,v=A.useCallback(()=>{i(null),y(!1)},[y]),b=A.useCallback((N,k)=>{const M=N.currentTarget,I={x:N.clientX,y:N.clientY},T=ttt(I,M.getBoundingClientRect()),P=rtt(I,T),F=ntt(k.getBoundingClientRect()),D=att([...P,...F]);i(D),y(!0)},[y]);return A.useEffect(()=>()=>v(),[v]),A.useEffect(()=>{if(u&&x){const N=M=>b(M,x),k=M=>b(M,u);return u.addEventListener("pointerleave",N),x.addEventListener("pointerleave",k),()=>{u.removeEventListener("pointerleave",N),x.removeEventListener("pointerleave",k)}}},[u,x,b,v]),A.useEffect(()=>{if(l){const N=k=>{const M=k.target,I={x:k.clientX,y:k.clientY},T=(u==null?void 0:u.contains(M))||(x==null?void 0:x.contains(M)),P=!stt(I,l);T?v():P&&(v(),m())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[u,x,l,m,v]),r.jsx(pPe,{...e,ref:o})}),[Xet,Qet]=bse(kE,{isInside:!1}),Jet=aIe("TooltipContent"),pPe=A.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=e,u=jse(SC,n),m=wse(n),{onClose:x}=u;return A.useEffect(()=>(document.addEventListener(vhe,x),()=>document.removeEventListener(vhe,x)),[x]),A.useEffect(()=>{if(u.trigger){const y=v=>{const b=v.target;b!=null&&b.contains(u.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[u.trigger,x]),r.jsx(wv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(YI,{"data-state":u.stateAttribute,...m,...i,ref:t,style:{...i.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(Jet,{children:s}),r.jsx(Xet,{scope:n,isInside:!0,children:r.jsx($Xe,{id:u.contentId,role:"tooltip",children:a||s})})]})})});fPe.displayName=SC;var gPe="TooltipArrow",ett=A.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=wse(n);return Qet(gPe,n).isInside?null:r.jsx(XI,{...a,...s,ref:t})});ett.displayName=gPe;function ttt(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,s,a,o)){case o:return"left";case a:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function rtt(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 ntt(e){const{top:t,right:n,bottom:s,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:s},{x:a,y:s}]}function stt(e,t){const{x:n,y:s}=e;let a=!1;for(let o=0,l=t.length-1;os!=v>s&&n<(y-m)*(s-x)/(v-x)+m&&(a=!a)}return a}function att(e){const t=e.slice();return t.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),itt(t)}function itt(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)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const a=e[s];for(;n.length>=2;){const o=n[n.length-1],l=n[n.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))n.pop();else break}n.push(a)}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 ott=uPe,ltt=hPe,ctt=mPe,xPe=fPe;const QI=ott,Wg=ltt,Gg=ctt,Pp=A.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(xPe,{ref:s,sideOffset:t,className:Ut("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}));Pp.displayName=xPe.displayName;var w3=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(){}},sk=typeof window>"u"||"Deno"in globalThis;function Hu(){}function dtt(e,t){return typeof e=="function"?e(t):e}function bhe(e){return typeof e=="number"&&e>=0&&e!==1/0}function yPe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function J1(e,t){return typeof e=="function"?e(t):e}function Xm(e,t){return typeof e=="function"?e(t):e}function zje(e,t){const{type:n="all",exact:s,fetchStatus:a,predicate:o,queryKey:l,stale:i}=e;if(l){if(s){if(t.queryHash!==fxe(l,t.options))return!1}else if(!NE(t.queryKey,l))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||a&&a!==t.state.fetchStatus||o&&!o(t))}function Bje(e,t){const{exact:n,status:s,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(ak(t.options.mutationKey)!==ak(o))return!1}else if(!NE(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||a&&!a(t))}function fxe(e,t){return((t==null?void 0:t.queryKeyHashFn)||ak)(e)}function ak(e){return JSON.stringify(e,(t,n)=>whe(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function NE(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>NE(e[n],t[n])):!1}function vPe(e,t){if(e===t)return e;const n=$je(e)&&$je(t);if(n||whe(e)&&whe(t)){const s=n?e:Object.keys(e),a=s.length,o=n?t:Object.keys(t),l=o.length,i=n?[]:{},u=new Set(s);let m=0;for(let x=0;x{setTimeout(t,e)})}function jhe(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?vPe(e,t):t}function htt(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function mtt(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var pxe=Symbol();function _Pe(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===pxe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function bPe(e,t){return typeof e=="function"?e(...t):!!e}var gj,m1,iC,LTe,ftt=(LTe=class extends w3{constructor(){super();xa(this,gj);xa(this,m1);xa(this,iC);ys(this,iC,t=>{if(!sk&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){tr(this,m1)||this.setEventListener(tr(this,iC))}onUnsubscribe(){var t;this.hasListeners()||((t=tr(this,m1))==null||t.call(this),ys(this,m1,void 0))}setEventListener(t){var n;ys(this,iC,t),(n=tr(this,m1))==null||n.call(this),ys(this,m1,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){tr(this,gj)!==t&&(ys(this,gj,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof tr(this,gj)=="boolean"?tr(this,gj):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},gj=new WeakMap,m1=new WeakMap,iC=new WeakMap,LTe),gxe=new ftt,oC,f1,lC,OTe,ptt=(OTe=class extends w3{constructor(){super();xa(this,oC,!0);xa(this,f1);xa(this,lC);ys(this,lC,t=>{if(!sk&&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(){tr(this,f1)||this.setEventListener(tr(this,lC))}onUnsubscribe(){var t;this.hasListeners()||((t=tr(this,f1))==null||t.call(this),ys(this,f1,void 0))}setEventListener(t){var n;ys(this,lC,t),(n=tr(this,f1))==null||n.call(this),ys(this,f1,t(this.setOnline.bind(this)))}setOnline(t){tr(this,oC)!==t&&(ys(this,oC,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return tr(this,oC)}},oC=new WeakMap,f1=new WeakMap,lC=new WeakMap,OTe),Ete=new ptt;function khe(){let e,t;const n=new Promise((a,o)=>{e=a,t=o});n.status="pending",n.catch(()=>{});function s(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{s({status:"fulfilled",value:a}),e(a)},n.reject=a=>{s({status:"rejected",reason:a}),t(a)},n}function gtt(e){return Math.min(1e3*2**e,3e4)}function wPe(e){return(e??"online")==="online"?Ete.isOnline():!0}var jPe=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function gce(e){return e instanceof jPe}function kPe(e){let t=!1,n=0,s=!1,a;const o=khe(),l=k=>{var M;s||(v(new jPe(k)),(M=e.abort)==null||M.call(e))},i=()=>{t=!0},u=()=>{t=!1},m=()=>gxe.isFocused()&&(e.networkMode==="always"||Ete.isOnline())&&e.canRun(),x=()=>wPe(e.networkMode)&&e.canRun(),y=k=>{var M;s||(s=!0,(M=e.onSuccess)==null||M.call(e,k),a==null||a(),o.resolve(k))},v=k=>{var M;s||(s=!0,(M=e.onError)==null||M.call(e,k),a==null||a(),o.reject(k))},b=()=>new Promise(k=>{var M;a=I=>{(s||m())&&k(I)},(M=e.onPause)==null||M.call(e)}).then(()=>{var k;a=void 0,s||(k=e.onContinue)==null||k.call(e)}),N=()=>{if(s)return;let k;const M=n===0?e.initialPromise:void 0;try{k=M??e.fn()}catch(I){k=Promise.reject(I)}Promise.resolve(k).then(y).catch(I=>{var U;if(s)return;const T=e.retry??(sk?0:3),P=e.retryDelay??gtt,F=typeof P=="function"?P(n,I):P,D=T===!0||typeof T=="number"&&nm()?void 0:b()).then(()=>{t?v(I):N()})})};return{promise:o,cancel:l,continue:()=>(a==null||a(),o),cancelRetry:i,continueRetry:u,canStart:x,start:()=>(x()?N():b().then(N),o)}}var xtt=e=>setTimeout(e,0);function ytt(){let e=[],t=0,n=i=>{i()},s=i=>{i()},a=xtt;const o=i=>{t?e.push(i):a(()=>{n(i)})},l=()=>{const i=e;e=[],i.length&&a(()=>{s(()=>{i.forEach(u=>{n(u)})})})};return{batch:i=>{let u;t++;try{u=i()}finally{t--,t||l()}return u},batchCalls:i=>(...u)=>{o(()=>{i(...u)})},schedule:o,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{a=i}}}var id=ytt(),xj,DTe,NPe=(DTe=class{constructor(){xa(this,xj)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bhe(this.gcTime)&&ys(this,xj,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sk?1/0:5*60*1e3))}clearGcTimeout(){tr(this,xj)&&(clearTimeout(tr(this,xj)),ys(this,xj,void 0))}},xj=new WeakMap,DTe),cC,yj,Ym,vj,fu,DI,_j,cp,Bx,RTe,vtt=(RTe=class extends NPe{constructor(t){super();xa(this,cp);xa(this,cC);xa(this,yj);xa(this,Ym);xa(this,vj);xa(this,fu);xa(this,DI);xa(this,_j);ys(this,_j,!1),ys(this,DI,t.defaultOptions),this.setOptions(t.options),this.observers=[],ys(this,vj,t.client),ys(this,Ym,tr(this,vj).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ys(this,cC,_tt(this.options)),this.state=t.state??tr(this,cC),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=tr(this,fu))==null?void 0:t.promise}setOptions(t){this.options={...tr(this,DI),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&tr(this,Ym).remove(this)}setData(t,n){const s=jhe(this.state.data,t,this.options);return gi(this,cp,Bx).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){gi(this,cp,Bx).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,a;const n=(s=tr(this,fu))==null?void 0:s.promise;return(a=tr(this,fu))==null||a.cancel(t),n?n.then(Hu).catch(Hu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(tr(this,cC))}isActive(){return this.observers.some(t=>Xm(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pxe||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:!yPe(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=tr(this,fu))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=tr(this,fu))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),tr(this,Ym).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(tr(this,fu)&&(tr(this,_j)?tr(this,fu).cancel({revert:!0}):tr(this,fu).cancelRetry()),this.scheduleGc()),tr(this,Ym).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gi(this,cp,Bx).call(this,{type:"invalidate"})}fetch(t,n){var m,x,y;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(tr(this,fu))return tr(this,fu).continueRetry(),tr(this,fu).promise}if(t&&this.setOptions(t),!this.options.queryFn){const v=this.observers.find(b=>b.options.queryFn);v&&this.setOptions(v.options)}const s=new AbortController,a=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(ys(this,_j,!0),s.signal)})},o=()=>{const v=_Pe(this.options,n),N=(()=>{const k={client:tr(this,vj),queryKey:this.queryKey,meta:this.meta};return a(k),k})();return ys(this,_j,!1),this.options.persister?this.options.persister(v,N,this):v(N)},i=(()=>{const v={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:tr(this,vj),state:this.state,fetchFn:o};return a(v),v})();(m=this.options.behavior)==null||m.onFetch(i,this),ys(this,yj,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=i.fetchOptions)==null?void 0:x.meta))&&gi(this,cp,Bx).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const u=v=>{var b,N,k,M;gce(v)&&v.silent||gi(this,cp,Bx).call(this,{type:"error",error:v}),gce(v)||((N=(b=tr(this,Ym).config).onError)==null||N.call(b,v,this),(M=(k=tr(this,Ym).config).onSettled)==null||M.call(k,this.state.data,v,this)),this.scheduleGc()};return ys(this,fu,kPe({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onSuccess:v=>{var b,N,k,M;if(v===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(v)}catch(I){u(I);return}(N=(b=tr(this,Ym).config).onSuccess)==null||N.call(b,v,this),(M=(k=tr(this,Ym).config).onSettled)==null||M.call(k,v,this.state.error,this),this.scheduleGc()},onError:u,onFail:(v,b)=>{gi(this,cp,Bx).call(this,{type:"failed",failureCount:v,error:b})},onPause:()=>{gi(this,cp,Bx).call(this,{type:"pause"})},onContinue:()=>{gi(this,cp,Bx).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),tr(this,fu).start()}},cC=new WeakMap,yj=new WeakMap,Ym=new WeakMap,vj=new WeakMap,fu=new WeakMap,DI=new WeakMap,_j=new WeakMap,cp=new WeakSet,Bx=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,...SPe(s.data,this.options),fetchMeta:t.meta??null};case"success":return ys(this,yj,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 a=t.error;return gce(a)&&a.revert&&tr(this,yj)?{...tr(this,yj),fetchStatus:"idle"}:{...s,error:a,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...t.state}}};this.state=n(this.state),id.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),tr(this,Ym).notify({query:this,type:"updated",action:t})})},RTe);function SPe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:wPe(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function _tt(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 bg,FTe,btt=(FTe=class extends w3{constructor(t={}){super();xa(this,bg);this.config=t,ys(this,bg,new Map)}build(t,n,s){const a=n.queryKey,o=n.queryHash??fxe(a,n);let l=this.get(o);return l||(l=new vtt({client:t,queryKey:a,queryHash:o,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){tr(this,bg).has(t.queryHash)||(tr(this,bg).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=tr(this,bg).get(t.queryHash);n&&(t.destroy(),n===t&&tr(this,bg).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){id.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return tr(this,bg).get(t)}getAll(){return[...tr(this,bg).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>zje(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>zje(t,s)):n}notify(t){id.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){id.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){id.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},bg=new WeakMap,FTe),wg,Uu,bj,jg,$0,zTe,wtt=(zTe=class extends NPe{constructor(t){super();xa(this,jg);xa(this,wg);xa(this,Uu);xa(this,bj);this.mutationId=t.mutationId,ys(this,Uu,t.mutationCache),ys(this,wg,[]),this.state=t.state||CPe(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){tr(this,wg).includes(t)||(tr(this,wg).push(t),this.clearGcTimeout(),tr(this,Uu).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ys(this,wg,tr(this,wg).filter(n=>n!==t)),this.scheduleGc(),tr(this,Uu).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){tr(this,wg).length||(this.state.status==="pending"?this.scheduleGc():tr(this,Uu).remove(this))}continue(){var t;return((t=tr(this,bj))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,i,u,m,x,y,v,b,N,k,M,I,T,P,F,D,U,V,W;const n=()=>{gi(this,jg,$0).call(this,{type:"continue"})};ys(this,bj,kPe({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(G,ee)=>{gi(this,jg,$0).call(this,{type:"failed",failureCount:G,error:ee})},onPause:()=>{gi(this,jg,$0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>tr(this,Uu).canRun(this)}));const s=this.state.status==="pending",a=!tr(this,bj).canStart();try{if(s)n();else{gi(this,jg,$0).call(this,{type:"pending",variables:t,isPaused:a}),await((l=(o=tr(this,Uu).config).onMutate)==null?void 0:l.call(o,t,this));const ee=await((u=(i=this.options).onMutate)==null?void 0:u.call(i,t));ee!==this.state.context&&gi(this,jg,$0).call(this,{type:"pending",context:ee,variables:t,isPaused:a})}const G=await tr(this,bj).start();return await((x=(m=tr(this,Uu).config).onSuccess)==null?void 0:x.call(m,G,t,this.state.context,this)),await((v=(y=this.options).onSuccess)==null?void 0:v.call(y,G,t,this.state.context)),await((N=(b=tr(this,Uu).config).onSettled)==null?void 0:N.call(b,G,null,this.state.variables,this.state.context,this)),await((M=(k=this.options).onSettled)==null?void 0:M.call(k,G,null,t,this.state.context)),gi(this,jg,$0).call(this,{type:"success",data:G}),G}catch(G){try{throw await((T=(I=tr(this,Uu).config).onError)==null?void 0:T.call(I,G,t,this.state.context,this)),await((F=(P=this.options).onError)==null?void 0:F.call(P,G,t,this.state.context)),await((U=(D=tr(this,Uu).config).onSettled)==null?void 0:U.call(D,void 0,G,this.state.variables,this.state.context,this)),await((W=(V=this.options).onSettled)==null?void 0:W.call(V,void 0,G,t,this.state.context)),G}finally{gi(this,jg,$0).call(this,{type:"error",error:G})}}finally{tr(this,Uu).runNext(this)}}},wg=new WeakMap,Uu=new WeakMap,bj=new WeakMap,jg=new WeakSet,$0=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),id.batch(()=>{tr(this,wg).forEach(s=>{s.onMutationUpdate(t)}),tr(this,Uu).notify({mutation:this,type:"updated",action:t})})},zTe);function CPe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Zx,dp,RI,BTe,jtt=(BTe=class extends w3{constructor(t={}){super();xa(this,Zx);xa(this,dp);xa(this,RI);this.config=t,ys(this,Zx,new Set),ys(this,dp,new Map),ys(this,RI,0)}build(t,n,s){const a=new wtt({mutationCache:this,mutationId:++jL(this,RI)._,options:t.defaultMutationOptions(n),state:s});return this.add(a),a}add(t){tr(this,Zx).add(t);const n=HL(t);if(typeof n=="string"){const s=tr(this,dp).get(n);s?s.push(t):tr(this,dp).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(tr(this,Zx).delete(t)){const n=HL(t);if(typeof n=="string"){const s=tr(this,dp).get(n);if(s)if(s.length>1){const a=s.indexOf(t);a!==-1&&s.splice(a,1)}else s[0]===t&&tr(this,dp).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=HL(t);if(typeof n=="string"){const s=tr(this,dp).get(n),a=s==null?void 0:s.find(o=>o.state.status==="pending");return!a||a===t}else return!0}runNext(t){var s;const n=HL(t);if(typeof n=="string"){const a=(s=tr(this,dp).get(n))==null?void 0:s.find(o=>o!==t&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){id.batch(()=>{tr(this,Zx).forEach(t=>{this.notify({type:"removed",mutation:t})}),tr(this,Zx).clear(),tr(this,dp).clear()})}getAll(){return Array.from(tr(this,Zx))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Bje(n,s))}findAll(t={}){return this.getAll().filter(n=>Bje(t,n))}notify(t){id.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return id.batch(()=>Promise.all(t.map(n=>n.continue().catch(Hu))))}},Zx=new WeakMap,dp=new WeakMap,RI=new WeakMap,BTe);function HL(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Ite(e){return{onFetch:(t,n)=>{var x,y,v,b,N;const s=t.options,a=(v=(y=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:v.direction,o=((b=t.state.data)==null?void 0:b.pages)||[],l=((N=t.state.data)==null?void 0:N.pageParams)||[];let i={pages:[],pageParams:[]},u=0;const m=async()=>{let k=!1;const M=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(t.signal.aborted?k=!0:t.signal.addEventListener("abort",()=>{k=!0}),t.signal)})},I=_Pe(t.options,t.fetchOptions),T=async(P,F,D)=>{if(k)return Promise.reject();if(F==null&&P.pages.length)return Promise.resolve(P);const V=(()=>{const ae={client:t.client,queryKey:t.queryKey,pageParam:F,direction:D?"backward":"forward",meta:t.options.meta};return M(ae),ae})(),W=await I(V),{maxPages:G}=t.options,ee=D?mtt:htt;return{pages:ee(P.pages,W,G),pageParams:ee(P.pageParams,F,G)}};if(a&&o.length){const P=a==="backward",F=P?MPe:Nhe,D={pages:o,pageParams:l},U=F(s,D);i=await T(D,U,P)}else{const P=e??o.length;do{const F=u===0?l[0]??s.initialPageParam:Nhe(s,i);if(u>0&&F==null)break;i=await T(i,F),u++}while(u{var k,M;return(M=(k=t.options).persister)==null?void 0:M.call(k,m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=m}}}function Nhe(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 MPe(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 ktt(e,t){return t?Nhe(e,t)!=null:!1}function Ntt(e,t){return!t||!e.getPreviousPageParam?!1:MPe(e,t)!=null}var Yl,p1,g1,dC,uC,x1,hC,mC,$Te,Stt=($Te=class{constructor(e={}){xa(this,Yl);xa(this,p1);xa(this,g1);xa(this,dC);xa(this,uC);xa(this,x1);xa(this,hC);xa(this,mC);ys(this,Yl,e.queryCache||new btt),ys(this,p1,e.mutationCache||new jtt),ys(this,g1,e.defaultOptions||{}),ys(this,dC,new Map),ys(this,uC,new Map),ys(this,x1,0)}mount(){jL(this,x1)._++,tr(this,x1)===1&&(ys(this,hC,gxe.subscribe(async e=>{e&&(await this.resumePausedMutations(),tr(this,Yl).onFocus())})),ys(this,mC,Ete.subscribe(async e=>{e&&(await this.resumePausedMutations(),tr(this,Yl).onOnline())})))}unmount(){var e,t;jL(this,x1)._--,tr(this,x1)===0&&((e=tr(this,hC))==null||e.call(this),ys(this,hC,void 0),(t=tr(this,mC))==null||t.call(this),ys(this,mC,void 0))}isFetching(e){return tr(this,Yl).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return tr(this,p1).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=tr(this,Yl).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=tr(this,Yl).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 tr(this,Yl).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),a=tr(this,Yl).get(s.queryHash),o=a==null?void 0:a.state.data,l=dtt(t,o);if(l!==void 0)return tr(this,Yl).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return id.batch(()=>tr(this,Yl).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=tr(this,Yl).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=tr(this,Yl);id.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=tr(this,Yl);return id.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=id.batch(()=>tr(this,Yl).findAll(e).map(a=>a.cancel(n)));return Promise.all(s).then(Hu).catch(Hu)}invalidateQueries(e,t={}){return id.batch(()=>(tr(this,Yl).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=id.batch(()=>tr(this,Yl).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,n);return n.throwOnError||(o=o.catch(Hu)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(Hu)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=tr(this,Yl).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(Hu).catch(Hu)}fetchInfiniteQuery(e){return e.behavior=Ite(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Hu).catch(Hu)}ensureInfiniteQueryData(e){return e.behavior=Ite(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ete.isOnline()?tr(this,p1).resumePausedMutations():Promise.resolve()}getQueryCache(){return tr(this,Yl)}getMutationCache(){return tr(this,p1)}getDefaultOptions(){return tr(this,g1)}setDefaultOptions(e){ys(this,g1,e)}setQueryDefaults(e,t){tr(this,dC).set(ak(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...tr(this,dC).values()],n={};return t.forEach(s=>{NE(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){tr(this,uC).set(ak(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...tr(this,uC).values()],n={};return t.forEach(s=>{NE(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...tr(this,g1).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fxe(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===pxe&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...tr(this,g1).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){tr(this,Yl).clear(),tr(this,p1).clear()}},Yl=new WeakMap,p1=new WeakMap,g1=new WeakMap,dC=new WeakMap,uC=new WeakMap,x1=new WeakMap,hC=new WeakMap,mC=new WeakMap,$Te),_h,Xi,FI,qu,wj,fC,y1,v1,zI,pC,gC,jj,kj,_1,xC,So,ET,She,Che,Mhe,The,Ahe,Ehe,Ihe,APe,UTe,TPe=(UTe=class extends w3{constructor(t,n){super();xa(this,So);xa(this,_h);xa(this,Xi);xa(this,FI);xa(this,qu);xa(this,wj);xa(this,fC);xa(this,y1);xa(this,v1);xa(this,zI);xa(this,pC);xa(this,gC);xa(this,jj);xa(this,kj);xa(this,_1);xa(this,xC,new Set);this.options=n,ys(this,_h,t),ys(this,v1,null),ys(this,y1,khe()),this.options.experimental_prefetchInRender||tr(this,y1).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&&(tr(this,Xi).addObserver(this),qje(tr(this,Xi),this.options)?gi(this,So,ET).call(this):this.updateResult(),gi(this,So,The).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Phe(tr(this,Xi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Phe(tr(this,Xi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gi(this,So,Ahe).call(this),gi(this,So,Ehe).call(this),tr(this,Xi).removeObserver(this)}setOptions(t){const n=this.options,s=tr(this,Xi);if(this.options=tr(this,_h).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xm(this.options.enabled,tr(this,Xi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gi(this,So,Ihe).call(this),tr(this,Xi).setOptions(this.options),n._defaulted&&!Ate(this.options,n)&&tr(this,_h).getQueryCache().notify({type:"observerOptionsUpdated",query:tr(this,Xi),observer:this});const a=this.hasListeners();a&&Vje(tr(this,Xi),s,this.options,n)&&gi(this,So,ET).call(this),this.updateResult(),a&&(tr(this,Xi)!==s||Xm(this.options.enabled,tr(this,Xi))!==Xm(n.enabled,tr(this,Xi))||J1(this.options.staleTime,tr(this,Xi))!==J1(n.staleTime,tr(this,Xi)))&&gi(this,So,She).call(this);const o=gi(this,So,Che).call(this);a&&(tr(this,Xi)!==s||Xm(this.options.enabled,tr(this,Xi))!==Xm(n.enabled,tr(this,Xi))||o!==tr(this,_1))&&gi(this,So,Mhe).call(this,o)}getOptimisticResult(t){const n=tr(this,_h).getQueryCache().build(tr(this,_h),t),s=this.createResult(n,t);return Mtt(this,s)&&(ys(this,qu,s),ys(this,fC,this.options),ys(this,wj,tr(this,Xi).state)),s}getCurrentResult(){return tr(this,qu)}trackResult(t,n){return new Proxy(t,{get:(s,a)=>(this.trackProp(a),n==null||n(a),Reflect.get(s,a))})}trackProp(t){tr(this,xC).add(t)}getCurrentQuery(){return tr(this,Xi)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=tr(this,_h).defaultQueryOptions(t),s=tr(this,_h).getQueryCache().build(tr(this,_h),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return gi(this,So,ET).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),tr(this,qu)))}createResult(t,n){var G;const s=tr(this,Xi),a=this.options,o=tr(this,qu),l=tr(this,wj),i=tr(this,fC),m=t!==s?t.state:tr(this,FI),{state:x}=t;let y={...x},v=!1,b;if(n._optimisticResults){const ee=this.hasListeners(),ae=!ee&&qje(t,n),oe=ee&&Vje(t,s,n,a);(ae||oe)&&(y={...y,...SPe(x.data,t.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:N,errorUpdatedAt:k,status:M}=y;b=y.data;let I=!1;if(n.placeholderData!==void 0&&b===void 0&&M==="pending"){let ee;o!=null&&o.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(ee=o.data,I=!0):ee=typeof n.placeholderData=="function"?n.placeholderData((G=tr(this,gC))==null?void 0:G.state.data,tr(this,gC)):n.placeholderData,ee!==void 0&&(M="success",b=jhe(o==null?void 0:o.data,ee,n),v=!0)}if(n.select&&b!==void 0&&!I)if(o&&b===(l==null?void 0:l.data)&&n.select===tr(this,zI))b=tr(this,pC);else try{ys(this,zI,n.select),b=n.select(b),b=jhe(o==null?void 0:o.data,b,n),ys(this,pC,b),ys(this,v1,null)}catch(ee){ys(this,v1,ee)}tr(this,v1)&&(N=tr(this,v1),b=tr(this,pC),k=Date.now(),M="error");const T=y.fetchStatus==="fetching",P=M==="pending",F=M==="error",D=P&&T,U=b!==void 0,W={status:M,fetchStatus:y.fetchStatus,isPending:P,isSuccess:M==="success",isError:F,isInitialLoading:D,isLoading:D,data:b,dataUpdatedAt:y.dataUpdatedAt,error:N,errorUpdatedAt:k,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>m.dataUpdateCount||y.errorUpdateCount>m.errorUpdateCount,isFetching:T,isRefetching:T&&!P,isLoadingError:F&&!U,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:F&&U,isStale:xxe(t,n),refetch:this.refetch,promise:tr(this,y1),isEnabled:Xm(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const ee=pe=>{W.status==="error"?pe.reject(W.error):W.data!==void 0&&pe.resolve(W.data)},ae=()=>{const pe=ys(this,y1,W.promise=khe());ee(pe)},oe=tr(this,y1);switch(oe.status){case"pending":t.queryHash===s.queryHash&&ee(oe);break;case"fulfilled":(W.status==="error"||W.data!==oe.value)&&ae();break;case"rejected":(W.status!=="error"||W.error!==oe.reason)&&ae();break}}return W}updateResult(){const t=tr(this,qu),n=this.createResult(tr(this,Xi),this.options);if(ys(this,wj,tr(this,Xi).state),ys(this,fC,this.options),tr(this,wj).data!==void 0&&ys(this,gC,tr(this,Xi)),Ate(n,t))return;ys(this,qu,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!tr(this,xC).size)return!0;const l=new Set(o??tr(this,xC));return this.options.throwOnError&&l.add("error"),Object.keys(tr(this,qu)).some(i=>{const u=i;return tr(this,qu)[u]!==t[u]&&l.has(u)})};gi(this,So,APe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&gi(this,So,The).call(this)}},_h=new WeakMap,Xi=new WeakMap,FI=new WeakMap,qu=new WeakMap,wj=new WeakMap,fC=new WeakMap,y1=new WeakMap,v1=new WeakMap,zI=new WeakMap,pC=new WeakMap,gC=new WeakMap,jj=new WeakMap,kj=new WeakMap,_1=new WeakMap,xC=new WeakMap,So=new WeakSet,ET=function(t){gi(this,So,Ihe).call(this);let n=tr(this,Xi).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Hu)),n},She=function(){gi(this,So,Ahe).call(this);const t=J1(this.options.staleTime,tr(this,Xi));if(sk||tr(this,qu).isStale||!bhe(t))return;const s=yPe(tr(this,qu).dataUpdatedAt,t)+1;ys(this,jj,setTimeout(()=>{tr(this,qu).isStale||this.updateResult()},s))},Che=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(tr(this,Xi)):this.options.refetchInterval)??!1},Mhe=function(t){gi(this,So,Ehe).call(this),ys(this,_1,t),!(sk||Xm(this.options.enabled,tr(this,Xi))===!1||!bhe(tr(this,_1))||tr(this,_1)===0)&&ys(this,kj,setInterval(()=>{(this.options.refetchIntervalInBackground||gxe.isFocused())&&gi(this,So,ET).call(this)},tr(this,_1)))},The=function(){gi(this,So,She).call(this),gi(this,So,Mhe).call(this,gi(this,So,Che).call(this))},Ahe=function(){tr(this,jj)&&(clearTimeout(tr(this,jj)),ys(this,jj,void 0))},Ehe=function(){tr(this,kj)&&(clearInterval(tr(this,kj)),ys(this,kj,void 0))},Ihe=function(){const t=tr(this,_h).getQueryCache().build(tr(this,_h),this.options);if(t===tr(this,Xi))return;const n=tr(this,Xi);ys(this,Xi,t),ys(this,FI,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},APe=function(t){id.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(tr(this,qu))}),tr(this,_h).getQueryCache().notify({query:tr(this,Xi),type:"observerResultsUpdated"})})},UTe);function Ctt(e,t){return Xm(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function qje(e,t){return Ctt(e,t)||e.state.data!==void 0&&Phe(e,t,t.refetchOnMount)}function Phe(e,t,n){if(Xm(t.enabled,e)!==!1&&J1(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&xxe(e,t)}return!1}function Vje(e,t,n,s){return(e!==t||Xm(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&xxe(e,n)}function xxe(e,t){return Xm(t.enabled,e)!==!1&&e.isStaleByTime(J1(t.staleTime,e))}function Mtt(e,t){return!Ate(e.getCurrentResult(),t)}var Ttt=class extends TPe{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:Ite()})}getOptimisticResult(e){return e.behavior=Ite(),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,k;const{state:n}=e,s=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=s,u=(k=(N=n.fetchMeta)==null?void 0:N.fetchMore)==null?void 0:k.direction,m=l&&u==="forward",x=a&&u==="forward",y=l&&u==="backward",v=a&&u==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:ktt(t,n.data),hasPreviousPage:Ntt(t,n.data),isFetchNextPageError:m,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:v,isRefetchError:i&&!m&&!y,isRefetching:o&&!x&&!v}}},b1,w1,bh,Yx,jy,Ree,Lhe,qTe,Att=(qTe=class extends w3{constructor(n,s){super();xa(this,jy);xa(this,b1);xa(this,w1);xa(this,bh);xa(this,Yx);ys(this,b1,n),this.setOptions(s),this.bindMethods(),gi(this,jy,Ree).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var a;const s=this.options;this.options=tr(this,b1).defaultMutationOptions(n),Ate(this.options,s)||tr(this,b1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:tr(this,bh),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&ak(s.mutationKey)!==ak(this.options.mutationKey)?this.reset():((a=tr(this,bh))==null?void 0:a.state.status)==="pending"&&tr(this,bh).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=tr(this,bh))==null||n.removeObserver(this)}onMutationUpdate(n){gi(this,jy,Ree).call(this),gi(this,jy,Lhe).call(this,n)}getCurrentResult(){return tr(this,w1)}reset(){var n;(n=tr(this,bh))==null||n.removeObserver(this),ys(this,bh,void 0),gi(this,jy,Ree).call(this),gi(this,jy,Lhe).call(this)}mutate(n,s){var a;return ys(this,Yx,s),(a=tr(this,bh))==null||a.removeObserver(this),ys(this,bh,tr(this,b1).getMutationCache().build(tr(this,b1),this.options)),tr(this,bh).addObserver(this),tr(this,bh).execute(n)}},b1=new WeakMap,w1=new WeakMap,bh=new WeakMap,Yx=new WeakMap,jy=new WeakSet,Ree=function(){var s;const n=((s=tr(this,bh))==null?void 0:s.state)??CPe();ys(this,w1,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Lhe=function(n){id.batch(()=>{var s,a,o,l,i,u,m,x;if(tr(this,Yx)&&this.hasListeners()){const y=tr(this,w1).variables,v=tr(this,w1).context;(n==null?void 0:n.type)==="success"?((a=(s=tr(this,Yx)).onSuccess)==null||a.call(s,n.data,y,v),(l=(o=tr(this,Yx)).onSettled)==null||l.call(o,n.data,null,y,v)):(n==null?void 0:n.type)==="error"&&((u=(i=tr(this,Yx)).onError)==null||u.call(i,n.error,y,v),(x=(m=tr(this,Yx)).onSettled)==null||x.call(m,void 0,n.error,y,v))}this.listeners.forEach(y=>{y(tr(this,w1))})})},qTe),EPe=A.createContext(void 0),Vr=e=>{const t=A.useContext(EPe);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ett=({client:e,children:t})=>(A.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(EPe.Provider,{value:e,children:t})),IPe=A.createContext(!1),Itt=()=>A.useContext(IPe);IPe.Provider;function Ptt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ltt=A.createContext(Ptt()),Ott=()=>A.useContext(Ltt),Dtt=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Rtt=e=>{A.useEffect(()=>{e.clearReset()},[e])},Ftt=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(a&&e.data===void 0||bPe(n,[e.error,s])),ztt=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))}},Btt=(e,t)=>e.isLoading&&e.isFetching&&!t,$tt=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Hje=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function PPe(e,t,n){var y,v,b,N,k;const s=Itt(),a=Ott(),o=Vr(),l=o.defaultQueryOptions(e);(v=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||v.call(y,l),l._optimisticResults=s?"isRestoring":"optimistic",ztt(l),Dtt(l,a),Rtt(a);const i=!o.getQueryCache().get(l.queryHash),[u]=A.useState(()=>new t(o,l)),m=u.getOptimisticResult(l),x=!s&&e.subscribed!==!1;if(A.useSyncExternalStore(A.useCallback(M=>{const I=x?u.subscribe(id.batchCalls(M)):Hu;return u.updateResult(),I},[u,x]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),A.useEffect(()=>{u.setOptions(l)},[l,u]),$tt(l,m))throw Hje(l,u,a);if(Ftt({result:m,errorResetBoundary:a,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw m.error;if((N=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||N.call(b,l,m),l.experimental_prefetchInRender&&!sk&&Btt(m,s)){const M=i?Hje(l,u,a):(k=o.getQueryCache().get(l.queryHash))==null?void 0:k.promise;M==null||M.catch(Hu).finally(()=>{u.updateResult()})}return l.notifyOnChangeProps?m:u.trackResult(m)}function Zt(e,t){return PPe(e,TPe)}function ar(e,t){const n=Vr(),[s]=A.useState(()=>new Att(n,e));A.useEffect(()=>{s.setOptions(e)},[s,e]);const a=A.useSyncExternalStore(A.useCallback(l=>s.subscribe(id.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=A.useCallback((l,i)=>{s.mutate(l,i).catch(Hu)},[s]);if(a.error&&bPe(s.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function Utt(e,t){return PPe(e,Ttt)}/** * @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 SE(){return SE=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function LPe(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Vtt(){return Math.random().toString(36).substr(2,8)}function Gje(e,t){return{usr:e.state,key:e.key,idx:t}}function Ohe(e,t,n,s){return n===void 0&&(n=null),SE({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?j3(t):t,{state:n,key:t&&t.key||s||Vtt()})}function Pte(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 j3(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 Htt(e,t,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:o=!1}=s,l=a.history,i=S1.Pop,u=null,m=x();m==null&&(m=0,l.replaceState(SE({},l.state,{idx:m}),""));function x(){return(l.state||{idx:null}).idx}function y(){i=S1.Pop;let M=x(),I=M==null?null:M-m;m=M,u&&u({action:i,location:k.location,delta:I})}function v(M,I){i=S1.Push;let T=Ohe(k.location,M,I);m=x()+1;let P=Gje(T,m),F=k.createHref(T);try{l.pushState(P,"",F)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;a.location.assign(F)}o&&u&&u({action:i,location:k.location,delta:1})}function b(M,I){i=S1.Replace;let T=Ohe(k.location,M,I);m=x();let P=Gje(T,m),F=k.createHref(T);l.replaceState(P,"",F),o&&u&&u({action:i,location:k.location,delta:0})}function N(M){let I=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof M=="string"?M:Pte(M);return T=T.replace(/ $/,"%20"),Sc(I,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,I)}let k={get action(){return i},get location(){return e(a,l)},listen(M){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Wje,y),u=M,()=>{a.removeEventListener(Wje,y),u=null}},createHref(M){return t(a,M)},createURL:N,encodeLocation(M){let I=N(M);return{pathname:I.pathname,search:I.search,hash:I.hash}},push:v,replace:b,go(M){return l.go(M)}};return k}var Kje;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Kje||(Kje={}));function Wtt(e,t,n){return n===void 0&&(n="/"),Gtt(e,t,n)}function Gtt(e,t,n,s){let a=typeof t=="string"?j3(t):t,o=yxe(a.pathname||"/",n);if(o==null)return null;let l=OPe(e);Ktt(l);let i=null;for(let u=0;i==null&&u{let u={relativePath:i===void 0?o.path||"":i,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};u.relativePath.startsWith("/")&&(Sc(u.relativePath.startsWith(s),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(s.length));let m=ev([s,u.relativePath]),x=n.concat(u);o.children&&o.children.length>0&&(Sc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),OPe(o.children,t,x,m)),!(o.path==null&&!o.index)&&t.push({path:m,score:trt(m,o.index),routesMeta:x})};return e.forEach((o,l)=>{var i;if(o.path===""||!((i=o.path)!=null&&i.includes("?")))a(o,l);else for(let u of DPe(o.path))a(o,l,u)}),t}function DPe(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return a?[o,""]:[o];let l=DPe(s.join("/")),i=[];return i.push(...l.map(u=>u===""?o:[o,u].join("/"))),a&&i.push(...l),i.map(u=>e.startsWith("/")&&u===""?"/":u)}function Ktt(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:rrt(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const Ztt=/^:[\w-]+$/,Ytt=3,Xtt=2,Qtt=1,Jtt=10,ert=-2,Zje=e=>e==="*";function trt(e,t){let n=e.split("/"),s=n.length;return n.some(Zje)&&(s+=ert),t&&(s+=Xtt),n.filter(a=>!Zje(a)).reduce((a,o)=>a+(Ztt.test(o)?Ytt:o===""?Qtt:Jtt),s)}function rrt(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function nrt(e,t,n){let{routesMeta:s}=e,a={},o="/",l=[];for(let i=0;i{let{paramName:v,isOptional:b}=x;if(v==="*"){let k=i[y]||"";l=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const N=i[y];return b&&!N?m[v]=void 0:m[v]=(N||"").replace(/%2F/g,"/"),m},{}),pathname:o,pathnameBase:l,pattern:e}}function art(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),LPe(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=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,i,u)=>(s.push({paramName:i,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function irt(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return LPe(!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 yxe(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 ort(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?j3(e):e;return{pathname:n?n.startsWith("/")?n:lrt(n,t):t,search:urt(s),hash:hrt(a)}}function lrt(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function xce(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 crt(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function vxe(e,t){let n=crt(e);return t?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function _xe(e,t,n,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=j3(e):(a=SE({},e),Sc(!a.pathname||!a.pathname.includes("?"),xce("?","pathname","search",a)),Sc(!a.pathname||!a.pathname.includes("#"),xce("#","pathname","hash",a)),Sc(!a.search||!a.search.includes("#"),xce("#","search","hash",a)));let o=e===""||a.pathname==="",l=o?"/":a.pathname,i;if(l==null)i=n;else{let y=t.length-1;if(!s&&l.startsWith("..")){let v=l.split("/");for(;v[0]==="..";)v.shift(),y-=1;a.pathname=v.join("/")}i=y>=0?t[y]:"/"}let u=ort(a,i),m=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(m||x)&&(u.pathname+="/"),u}const ev=e=>e.join("/").replace(/\/\/+/g,"/"),drt=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),urt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,hrt=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function mrt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const RPe=["post","put","patch","delete"];new Set(RPe);const frt=["get",...RPe];new Set(frt);/** * 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 CE(){return CE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{i.current=!0}),A.useCallback(function(m,x){if(x===void 0&&(x={}),!i.current)return;if(typeof m=="number"){s.go(m);return}let y=_xe(m,JSON.parse(l),o,x.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:ev([t,y.pathname])),(x.replace?s.replace:s.push)(y,x.state,x)},[t,s,l,o,e])}const yrt=A.createContext(null);function vrt(e){let t=A.useContext(ix).outlet;return t&&A.createElement(yrt.Provider,{value:e},t)}function Ec(){let{matches:e}=A.useContext(ix),t=e[e.length-1];return t?t.params:{}}function BPe(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=A.useContext(jv),{matches:a}=A.useContext(ix),{pathname:o}=wf(),l=JSON.stringify(vxe(a,s.v7_relativeSplatPath));return A.useMemo(()=>_xe(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function _rt(e,t){return brt(e,t)}function brt(e,t,n,s){k3()||Sc(!1);let{navigator:a}=A.useContext(jv),{matches:o}=A.useContext(ix),l=o[o.length-1],i=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let m=wf(),x;if(t){var y;let M=typeof t=="string"?j3(t):t;u==="/"||(y=M.pathname)!=null&&y.startsWith(u)||Sc(!1),x=M}else x=m;let v=x.pathname||"/",b=v;if(u!=="/"){let M=u.replace(/^\//,"").split("/");b="/"+v.replace(/^\//,"").split("/").slice(M.length).join("/")}let N=Wtt(e,{pathname:b}),k=Srt(N&&N.map(M=>Object.assign({},M,{params:Object.assign({},i,M.params),pathname:ev([u,a.encodeLocation?a.encodeLocation(M.pathname).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?u:ev([u,a.encodeLocation?a.encodeLocation(M.pathnameBase).pathname:M.pathnameBase])})),o,n,s);return t&&k?A.createElement(kse.Provider,{value:{location:CE({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:S1.Pop}},k):k}function wrt(){let e=Art(),t=mrt(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return A.createElement(A.Fragment,null,A.createElement("h2",null,"Unexpected Application Error!"),A.createElement("h3",{style:{fontStyle:"italic"}},t),n?A.createElement("pre",{style:a},n):null,null)}const jrt=A.createElement(wrt,null);class krt extends A.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?A.createElement(ix.Provider,{value:this.props.routeContext},A.createElement(FPe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Nrt(e){let{routeContext:t,match:n,children:s}=e,a=A.useContext(bxe);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),A.createElement(ix.Provider,{value:t},s)}function Srt(e,t,n,s){var a;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,i=(a=n)==null?void 0:a.errors;if(i!=null){let x=l.findIndex(y=>y.route.id&&(i==null?void 0:i[y.route.id])!==void 0);x>=0||Sc(!1),l=l.slice(0,Math.min(l.length,x+1))}let u=!1,m=-1;if(n&&s&&s.v7_partialHydration)for(let x=0;x=0?l=l.slice(0,m+1):l=[l[0]];break}}}return l.reduceRight((x,y,v)=>{let b,N=!1,k=null,M=null;n&&(b=i&&y.route.id?i[y.route.id]:void 0,k=y.route.errorElement||jrt,u&&(m<0&&v===0?(Irt("route-fallback"),N=!0,M=null):m===v&&(N=!0,M=y.route.hydrateFallbackElement||null)));let I=t.concat(l.slice(0,v+1)),T=()=>{let P;return b?P=k:N?P=M:y.route.Component?P=A.createElement(y.route.Component,null):y.route.element?P=y.route.element:P=x,A.createElement(Nrt,{match:y,routeContext:{outlet:x,matches:I,isDataRoute:n!=null},children:P})};return n&&(y.route.ErrorBoundary||y.route.errorElement||v===0)?A.createElement(krt,{location:n.location,revalidation:n.revalidation,component:k,error:b,children:T(),routeContext:{outlet:null,matches:I,isDataRoute:!0}}):T()},null)}var $Pe=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}($Pe||{}),UPe=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}(UPe||{});function Crt(e){let t=A.useContext(bxe);return t||Sc(!1),t}function Mrt(e){let t=A.useContext(prt);return t||Sc(!1),t}function Trt(e){let t=A.useContext(ix);return t||Sc(!1),t}function qPe(e){let t=Trt(),n=t.matches[t.matches.length-1];return n.route.id||Sc(!1),n.route.id}function Art(){var e;let t=A.useContext(FPe),n=Mrt(),s=qPe();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function Ert(){let{router:e}=Crt($Pe.UseNavigateStable),t=qPe(UPe.UseNavigateStable),n=A.useRef(!1);return zPe(()=>{n.current=!0}),A.useCallback(function(a,o){o===void 0&&(o={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,CE({fromRouteId:t},o)))},[e,t])}const Yje={};function Irt(e,t,n){Yje[e]||(Yje[e]=!0)}function Prt(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function yce(e){let{to:t,replace:n,state:s,relative:a}=e;k3()||Sc(!1);let{future:o,static:l}=A.useContext(jv),{matches:i}=A.useContext(ix),{pathname:u}=wf(),m=Vn(),x=_xe(t,vxe(i,o.v7_relativeSplatPath),u,a==="path"),y=JSON.stringify(x);return A.useEffect(()=>m(JSON.parse(y),{replace:n,state:s,relative:a}),[m,y,a,n,s]),null}function Lrt(e){return vrt(e.context)}function rn(e){Sc(!1)}function Ort(e){let{basename:t="/",children:n=null,location:s,navigationType:a=S1.Pop,navigator:o,static:l=!1,future:i}=e;k3()&&Sc(!1);let u=t.replace(/^\/*/,"/"),m=A.useMemo(()=>({basename:u,navigator:o,static:l,future:CE({v7_relativeSplatPath:!1},i)}),[u,i,o,l]);typeof s=="string"&&(s=j3(s));let{pathname:x="/",search:y="",hash:v="",state:b=null,key:N="default"}=s,k=A.useMemo(()=>{let M=yxe(x,u);return M==null?null:{location:{pathname:M,search:y,hash:v,state:b,key:N},navigationType:a}},[u,x,y,v,b,N,a]);return k==null?null:A.createElement(jv.Provider,{value:m},A.createElement(kse.Provider,{children:n,value:k}))}function Drt(e){let{children:t,location:n}=e;return _rt(Dhe(t),n)}new Promise(()=>{});function Dhe(e,t){t===void 0&&(t=[]);let n=[];return A.Children.forEach(e,(s,a)=>{if(!A.isValidElement(s))return;let o=[...t,a];if(s.type===A.Fragment){n.push.apply(n,Dhe(s.props.children,o));return}s.type!==rn&&Sc(!1),!s.props.index||!s.props.children||Sc(!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=Dhe(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 Rhe(){return Rhe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[a]=e[a]);return n}function Frt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zrt(e,t){return e.button===0&&(!t||t==="_self")&&!Frt(e)}function Fhe(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(a=>[n,a]):[[n,s]])},[]))}function Brt(e,t){let n=Fhe(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(o=>{n.append(a,o)})}),n}const $rt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Urt="6";try{window.__reactRouterVersion=Urt}catch{}const qrt="startTransition",Xje=ige[qrt];function Vrt(e){let{basename:t,children:n,future:s,window:a}=e,o=A.useRef();o.current==null&&(o.current=qtt({window:a,v5Compat:!0}));let l=o.current,[i,u]=A.useState({action:l.action,location:l.location}),{v7_startTransition:m}=s||{},x=A.useCallback(y=>{m&&Xje?Xje(()=>u(y)):u(y)},[u,m]);return A.useLayoutEffect(()=>l.listen(x),[l,x]),A.useEffect(()=>Prt(s),[s]),A.createElement(Ort,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:l,future:s})}const Hrt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Wrt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,co=A.forwardRef(function(t,n){let{onClick:s,relative:a,reloadDocument:o,replace:l,state:i,target:u,to:m,preventScrollReset:x,viewTransition:y}=t,v=Rrt(t,$rt),{basename:b}=A.useContext(jv),N,k=!1;if(typeof m=="string"&&Wrt.test(m)&&(N=m,Hrt))try{let P=new URL(window.location.href),F=m.startsWith("//")?new URL(P.protocol+m):new URL(m),D=yxe(F.pathname,b);F.origin===P.origin&&D!=null?m=D+F.search+F.hash:k=!0}catch{}let M=grt(m,{relative:a}),I=Grt(m,{replace:l,state:i,target:u,preventScrollReset:x,relative:a,viewTransition:y});function T(P){s&&s(P),P.defaultPrevented||I(P)}return A.createElement("a",Rhe({},v,{href:N||M,onClick:k||o?s:T,ref:n,target:u}))});var Qje;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Qje||(Qje={}));var Jje;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Jje||(Jje={}));function Grt(e,t){let{target:n,replace:s,state:a,preventScrollReset:o,relative:l,viewTransition:i}=t===void 0?{}:t,u=Vn(),m=wf(),x=BPe(e,{relative:l});return A.useCallback(y=>{if(zrt(y,n)){y.preventDefault();let v=s!==void 0?s:Pte(m)===Pte(x);u(e,{replace:v,state:a,preventScrollReset:o,relative:l,viewTransition:i})}},[m,u,x,s,a,n,e,o,l,i])}function Zc(e){let t=A.useRef(Fhe(e)),n=A.useRef(!1),s=wf(),a=A.useMemo(()=>Brt(s.search,n.current?null:t.current),[s.search]),o=Vn(),l=A.useCallback((i,u)=>{const m=Fhe(typeof i=="function"?i(a):i);n.current=!0,o("?"+m,u)},[o,a]);return[a,l]}var Krt=typeof Element<"u",Zrt=typeof Map=="function",Yrt=typeof Set=="function",Xrt=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Fee(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,a;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!Fee(e[s],t[s]))return!1;return!0}var o;if(Zrt&&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(!Fee(s.value[1],t.get(s.value[0])))return!1;return!0}if(Yrt&&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(Xrt&&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(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[s]))return!1;if(Krt&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((a[s]==="_owner"||a[s]==="__v"||a[s]==="__o")&&e.$$typeof)&&!Fee(e[a[s]],t[a[s]]))return!1;return!0}return e!==e&&t!==t}var Qrt=function(t,n){try{return Fee(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 Jrt=eo(Qrt);var ent=function(e,t,n,s,a,o,l,i){if(!e){var u;if(t===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var m=[n,s,a,o,l,i],x=0;u=new Error(t.replace(/%s/g,function(){return m[x++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}},tnt=ent;const eke=eo(tnt);var rnt=function(t,n,s,a){var o=s?s.call(a,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),i=Object.keys(n);if(l.length!==i.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(n),m=0;m(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))(VPe||{}),vce={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"]}},tke=Object.values(VPe),wxe={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},snt=Object.entries(wxe).reduce((e,[t,n])=>(e[n]=t,e),{}),wp="data-rh",U4={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},q4=(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},ant=e=>{let t=q4(e,"title");const n=q4(e,U4.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,()=>t);const s=q4(e,U4.DEFAULT_TITLE);return t||s||void 0},int=e=>q4(e,U4.ON_CHANGE_CLIENT_STATE)||(()=>{}),_ce=(e,t)=>t.filter(n=>typeof n[e]<"u").map(n=>n[e]).reduce((n,s)=>({...n,...s}),{}),ont=(e,t)=>t.filter(n=>typeof n.base<"u").map(n=>n.base).reverse().reduce((n,s)=>{if(!n.length){const a=Object.keys(s);for(let o=0;oconsole&&typeof console.warn=="function"&&console.warn(e),rT=(e,t,n)=>{const s={};return n.filter(a=>Array.isArray(a[e])?!0:(typeof a[e]<"u"&&lnt(`Helmet: ${e} should be of type "Array". Instead found type "${typeof a[e]}"`),!1)).map(a=>a[e]).reverse().reduce((a,o)=>{const l={};o.filter(u=>{let m;const x=Object.keys(u);for(let v=0;va.push(u));const i=Object.keys(l);for(let u=0;u{if(Array.isArray(e)&&e.length){for(let n=0;n({baseTag:ont(["href"],e),bodyAttributes:_ce("bodyAttributes",e),defer:q4(e,U4.DEFER),encode:q4(e,U4.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:_ce("htmlAttributes",e),linkTags:rT("link",["rel","href"],e),metaTags:rT("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:rT("noscript",["innerHTML"],e),onChangeClientState:int(e),scriptTags:rT("script",["src","innerHTML"],e),styleTags:rT("style",["cssText"],e),title:ant(e),titleAttributes:_ce("titleAttributes",e),prioritizeSeoTags:cnt(e,U4.PRIORITIZE_SEO_TAGS)}),HPe=e=>Array.isArray(e)?e.join(""):e,unt=(e,t)=>{const n=Object.keys(e);for(let s=0;sArray.isArray(e)?e.reduce((n,s)=>(unt(s,t)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:e,priority:[]},rke=(e,t)=>({...e,[t]:void 0}),hnt=["noscript","script","style"],zhe=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),WPe=e=>Object.keys(e).reduce((t,n)=>{const s=typeof e[n]<"u"?`${n}="${e[n]}"`:`${n}`;return t?`${t} ${s}`:s},""),mnt=(e,t,n,s)=>{const a=WPe(n),o=HPe(t);return a?`<${e} ${wp}="true" ${a}>${zhe(o,s)}`:`<${e} ${wp}="true">${zhe(o,s)}`},fnt=(e,t,n=!0)=>t.reduce((s,a)=>{const o=a,l=Object.keys(o).filter(m=>!(m==="innerHTML"||m==="cssText")).reduce((m,x)=>{const y=typeof o[x]>"u"?x:`${x}="${zhe(o[x],n)}"`;return m?`${m} ${y}`:y},""),i=o.innerHTML||o.cssText||"",u=hnt.indexOf(e)===-1;return`${s}<${e} ${wp}="true" ${l}${u?"/>":`>${i}`}`},""),GPe=(e,t={})=>Object.keys(e).reduce((n,s)=>{const a=wxe[s];return n[a||s]=e[s],n},t),pnt=(e,t,n)=>{const s={key:t,[wp]:!0},a=GPe(n,s);return[dt.createElement("title",a,t)]},zee=(e,t)=>t.map((n,s)=>{const a={key:s,[wp]:!0};return Object.keys(n).forEach(o=>{const i=wxe[o]||o;if(i==="innerHTML"||i==="cssText"){const u=n.innerHTML||n.cssText;a.dangerouslySetInnerHTML={__html:u}}else a[i]=n[o]}),dt.createElement(e,a)}),Zm=(e,t,n=!0)=>{switch(e){case"title":return{toComponent:()=>pnt(e,t.title,t.titleAttributes),toString:()=>mnt(e,t.title,t.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>GPe(t),toString:()=>WPe(t)};default:return{toComponent:()=>zee(e,t),toString:()=>fnt(e,t,n)}}},gnt=({metaTags:e,linkTags:t,scriptTags:n,encode:s})=>{const a=bce(e,vce.meta),o=bce(t,vce.link),l=bce(n,vce.script);return{priorityMethods:{toComponent:()=>[...zee("meta",a.priority),...zee("link",o.priority),...zee("script",l.priority)],toString:()=>`${Zm("meta",a.priority,s)} ${Zm("link",o.priority,s)} ${Zm("script",l.priority,s)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},xnt=e=>{const{baseTag:t,bodyAttributes:n,encode:s=!0,htmlAttributes:a,noscriptTags:o,styleTags:l,title:i="",titleAttributes:u,prioritizeSeoTags:m}=e;let{linkTags:x,metaTags:y,scriptTags:v}=e,b={toComponent:()=>{},toString:()=>""};return m&&({priorityMethods:b,linkTags:x,metaTags:y,scriptTags:v}=gnt(e)),{priority:b,base:Zm("base",t,s),bodyAttributes:Zm("bodyAttributes",n,s),htmlAttributes:Zm("htmlAttributes",a,s),link:Zm("link",x,s),meta:Zm("meta",y,s),noscript:Zm("noscript",o,s),script:Zm("script",v,s),style:Zm("style",l,s),title:Zm("title",{title:i,titleAttributes:u},s)}},Bhe=xnt,WL=[],KPe=!!(typeof window<"u"&&window.document&&window.document.createElement),$he=class{constructor(e,t){Jn(this,"instances",[]);Jn(this,"canUseDOM",KPe);Jn(this,"context");Jn(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?WL:this.instances,add:e=>{(this.canUseDOM?WL:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?WL:this.instances).indexOf(e);(this.canUseDOM?WL:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=Bhe({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ynt={},ZPe=dt.createContext(ynt),Nj,YPe=(Nj=class extends A.Component{constructor(n){super(n);Jn(this,"helmetData");this.helmetData=new $he(this.props.context||{},Nj.canUseDOM)}render(){return dt.createElement(ZPe.Provider,{value:this.helmetData.value},this.props.children)}},Jn(Nj,"canUseDOM",KPe),Nj),yS=(e,t)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${e}[${wp}]`),a=[].slice.call(s),o=[];let l;return t&&t.length&&t.forEach(i=>{const u=document.createElement(e);for(const m in i)if(Object.prototype.hasOwnProperty.call(i,m))if(m==="innerHTML")u.innerHTML=i.innerHTML;else if(m==="cssText")u.styleSheet?u.styleSheet.cssText=i.cssText:u.appendChild(document.createTextNode(i.cssText));else{const x=m,y=typeof i[x]>"u"?"":i[x];u.setAttribute(m,y)}u.setAttribute(wp,"true"),a.some((m,x)=>(l=x,u.isEqualNode(m)))?a.splice(l,1):o.push(u)}),a.forEach(i=>{var u;return(u=i.parentNode)==null?void 0:u.removeChild(i)}),o.forEach(i=>n.appendChild(i)),{oldTags:a,newTags:o}},Uhe=(e,t)=>{const n=document.getElementsByTagName(e)[0];if(!n)return;const s=n.getAttribute(wp),a=s?s.split(","):[],o=[...a],l=Object.keys(t);for(const i of l){const u=t[i]||"";n.getAttribute(i)!==u&&n.setAttribute(i,u),a.indexOf(i)===-1&&a.push(i);const m=o.indexOf(i);m!==-1&&o.splice(m,1)}for(let i=o.length-1;i>=0;i-=1)n.removeAttribute(o[i]);a.length===o.length?n.removeAttribute(wp):n.getAttribute(wp)!==l.join(",")&&n.setAttribute(wp,l.join(","))},vnt=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=HPe(e)),Uhe("title",t)},nke=(e,t)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:a,linkTags:o,metaTags:l,noscriptTags:i,onChangeClientState:u,scriptTags:m,styleTags:x,title:y,titleAttributes:v}=e;Uhe("body",s),Uhe("html",a),vnt(y,v);const b={baseTag:yS("base",n),linkTags:yS("link",o),metaTags:yS("meta",l),noscriptTags:yS("noscript",i),scriptTags:yS("script",m),styleTags:yS("style",x)},N={},k={};Object.keys(b).forEach(M=>{const{newTags:I,oldTags:T}=b[M];I.length&&(N[M]=I),T.length&&(k[M]=b[M].oldTags)}),t&&t(),u(e,N,k)},nT=null,_nt=e=>{nT&&cancelAnimationFrame(nT),e.defer?nT=requestAnimationFrame(()=>{nke(e,()=>{nT=null})}):(nke(e),nT=null)},bnt=_nt,ske=class extends A.Component{constructor(){super(...arguments);Jn(this,"rendered",!1)}shouldComponentUpdate(t){return!nnt(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 a=dnt(t.get().map(o=>{const l={...o.props};return delete l.context,l}));YPe.canUseDOM?bnt(a):Bhe&&(s=Bhe(a)),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}},xue,$p=(xue=class extends A.Component{shouldComponentUpdate(e){return!Jrt(rke(this.props,"helmetData"),rke(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 eke(tke.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 ${tke.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),eke(!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 dt.Children.forEach(e,s=>{if(!s||!s.props)return;const{children:a,...o}=s.props,l=Object.keys(o).reduce((u,m)=>(u[snt[m]||m]=o[m],u),{});let{type:i}=s;switch(typeof i=="symbol"?i=i.toString():this.warnOnInvalidChildren(s,a),i){case"Symbol(react.fragment)":t=this.mapChildrenToProps(a,t);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,l,a);break;default:t=this.mapObjectTypeChildren(s,t,l,a);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 $he)){const a=s;s=new $he(a.context,!0),delete n.helmetData}return s?dt.createElement(ske,{...n,context:s.value}):dt.createElement(ZPe.Consumer,null,a=>dt.createElement(ske,{...n,context:a}))}},Jn(xue,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),xue),qhe=function(e,t){return qhe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},qhe(e,t)};function XPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");qhe(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var nf=function(){return nf=Object.assign||function(t){for(var n,s=1,a=arguments.length;s=0;i--)(l=e[i])&&(o=(a<3?l(o):a>3?l(t,n,o):l(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}function JPe(e,t){return function(n,s){t(n,s,e)}}function e6e(e,t,n,s,a,o){function l(I){if(I!==void 0&&typeof I!="function")throw new TypeError("Function expected");return I}for(var i=s.kind,u=i==="getter"?"get":i==="setter"?"set":"value",m=!t&&e?s.static?e:e.prototype:null,x=t||(m?Object.getOwnPropertyDescriptor(m,s.name):{}),y,v=!1,b=n.length-1;b>=0;b--){var N={};for(var k in s)N[k]=k==="access"?{}:s[k];for(var k in s.access)N.access[k]=s.access[k];N.addInitializer=function(I){if(v)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(I||null))};var M=(0,n[b])(i==="accessor"?{get:x.get,set:x.set}:x[u],N);if(i==="accessor"){if(M===void 0)continue;if(M===null||typeof M!="object")throw new TypeError("Object expected");(y=l(M.get))&&(x.get=y),(y=l(M.set))&&(x.set=y),(y=l(M.init))&&a.unshift(y)}else(y=l(M))&&(i==="field"?a.unshift(y):x[u]=y)}m&&Object.defineProperty(m,s.name,x),v=!0}function t6e(e,t,n){for(var s=arguments.length>2,a=0;a0&&o[o.length-1])&&(m[0]===6||m[0]===2)){n=0;continue}if(m[0]===3&&(!o||m[1]>o[0]&&m[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 jxe(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var s=n.call(e),a,o=[],l;try{for(;(t===void 0||t-- >0)&&!(a=s.next()).done;)o.push(a.value)}catch(i){l={error:i}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(l)throw l.error}}return o}function o6e(){for(var e=[],t=0;t1||u(b,k)})},N&&(a[b]=N(a[b])))}function u(b,N){try{m(s[b](N))}catch(k){v(o[0][3],k)}}function m(b){b.value instanceof CC?Promise.resolve(b.value.v).then(x,y):v(o[0][2],b)}function x(b){u("next",b)}function y(b){u("throw",b)}function v(b,N){b(N),o.shift(),o.length&&u(o[0][0],o[0][1])}}function d6e(e){var t,n;return t={},s("next"),s("throw",function(a){throw a}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(a,o){t[a]=e[a]?function(l){return(n=!n)?{value:CC(e[a](l)),done:!1}:o?o(l):l}:o}}function u6e(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 Lte=="function"?Lte(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(i,u){l=e[o](l),a(i,u,l.done,l.value)})}}function a(o,l,i,u){Promise.resolve(u).then(function(m){o({value:m,done:i})},l)}}function h6e(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var wnt=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},Vhe=function(e){return Vhe=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},Vhe(e)};function m6e(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=Vhe(e),s=0;s0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),i=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(n.map(u=>{if(u=Cnt(u),u in ake)return;ake[u]=!0;const m=u.endsWith(".css"),x=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${x}`))return;const y=document.createElement("link");if(y.rel=m?"stylesheet":Snt,m||(y.as="script"),y.crossOrigin="",y.href=u,i&&y.setAttribute("nonce",i),document.head.appendChild(y),m)return new Promise((v,b)=>{y.addEventListener("load",v),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(l){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l}return a.then(l=>{for(const i of l||[])i.status==="rejected"&&o(i.reason);return t().catch(o)})},Mnt=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>N3(async()=>{const{default:s}=await Promise.resolve().then(()=>Ck);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)};class Nxe extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}}class ike extends Nxe{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class oke extends Nxe{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class lke extends Nxe{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Hhe;(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"})(Hhe||(Hhe={}));class Tnt{constructor(t,{headers:n={},customFetch:s,region:a=Hhe.Any}={}){this.url=t,this.headers=n,this.region=a,this.fetch=Mnt(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return qs(this,arguments,void 0,function*(n,s={}){var a;try{const{headers:o,method:l,body:i,signal:u}=s;let m={},{region:x}=s;x||(x=this.region);const y=new URL(`${this.url}/${n}`);x&&x!=="any"&&(m["x-region"]=x,y.searchParams.set("forceFunctionRegion",x));let v;i&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&i instanceof Blob||i instanceof ArrayBuffer?(m["Content-Type"]="application/octet-stream",v=i):typeof i=="string"?(m["Content-Type"]="text/plain",v=i):typeof FormData<"u"&&i instanceof FormData?v=i:(m["Content-Type"]="application/json",v=JSON.stringify(i)):v=i;const b=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},m),this.headers),o),body:v,signal:u}).catch(I=>{throw I.name==="AbortError"?I:new ike(I)}),N=b.headers.get("x-relay-error");if(N&&N==="true")throw new oke(b);if(!b.ok)throw new lke(b);let k=((a=b.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),M;return k==="application/json"?M=yield b.json():k==="application/octet-stream"||k==="application/pdf"?M=yield b.blob():k==="text/event-stream"?M=b:k==="multipart/form-data"?M=yield b.formData():M=yield b.text(),{data:M,error:null,response:b}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new ike(o)}:{data:null,error:o,response:o instanceof lke||o instanceof oke?o.context:void 0}}})}}var Sh={};const S3=VTe(Nnt);var GL={},KL={},ZL={},YL={},XL={},Ant=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")},MC=Ant();const Ent=MC.fetch,b6e=MC.fetch.bind(MC),w6e=MC.Headers,Int=MC.Request,Pnt=MC.Response,Ck=Object.freeze(Object.defineProperty({__proto__:null,Headers:w6e,Request:Int,Response:Pnt,default:b6e,fetch:Ent},Symbol.toStringTag,{value:"Module"})),Lnt=VTe(Ck);var QL={},cke;function j6e(){if(cke)return QL;cke=1,Object.defineProperty(QL,"__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 QL.default=e,QL}var dke;function k6e(){if(dke)return XL;dke=1,Object.defineProperty(XL,"__esModule",{value:!0});const e=S3,t=e.__importDefault(Lnt),n=e.__importDefault(j6e());class s{constructor(o){var l,i;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=(i=o.isMaybeSingle)!==null&&i!==void 0?i:!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 i=this.fetch;let u=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async m=>{var x,y,v,b;let N=null,k=null,M=null,I=m.status,T=m.statusText;if(m.ok){if(this.method!=="HEAD"){const U=await m.text();U===""||(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"))?k=U:k=JSON.parse(U))}const F=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),D=(v=m.headers.get("content-range"))===null||v===void 0?void 0:v.split("/");F&&D&&D.length>1&&(M=parseInt(D[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(k)&&(k.length>1?(N={code:"PGRST116",details:`Results contain ${k.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},k=null,M=null,I=406,T="Not Acceptable"):k.length===1?k=k[0]:k=null)}else{const F=await m.text();try{N=JSON.parse(F),Array.isArray(N)&&m.status===404&&(k=[],N=null,I=200,T="OK")}catch{m.status===404&&F===""?(I=204,T="No Content"):N={message:F}}if(N&&this.isMaybeSingle&&(!((b=N==null?void 0:N.details)===null||b===void 0)&&b.includes("0 rows"))&&(N=null,I=200,T="OK"),N&&this.shouldThrowOnError)throw new n.default(N)}return{error:N,data:k,count:M,status:I,statusText:T}});return this.shouldThrowOnError||(u=u.catch(m=>{var x,y,v;return{error:{message:`${(x=m==null?void 0:m.name)!==null&&x!==void 0?x:"FetchError"}: ${m==null?void 0:m.message}`,details:`${(y=m==null?void 0:m.stack)!==null&&y!==void 0?y:""}`,hint:"",code:`${(v=m==null?void 0:m.code)!==null&&v!==void 0?v:""}`},data:null,count:null,status:0,statusText:""}})),u.then(o,l)}returns(){return this}overrideTypes(){return this}}return XL.default=s,XL}var uke;function N6e(){if(uke)return YL;uke=1,Object.defineProperty(YL,"__esModule",{value:!0});const t=S3.__importDefault(k6e());class n extends t.default{select(a){let o=!1;const l=(a??"*").split("").map(i=>/\s/.test(i)&&!o?"":(i==='"'&&(o=!o),i)).join("");return this.url.searchParams.set("select",l),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:o=!0,nullsFirst:l,foreignTable:i,referencedTable:u=i}={}){const m=u?`${u}.order`:"order",x=this.url.searchParams.get(m);return this.url.searchParams.set(m,`${x?`${x},`:""}${a}.${o?"asc":"desc"}${l===void 0?"":l?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:o,referencedTable:l=o}={}){const i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(i,`${a}`),this}range(a,o,{foreignTable:l,referencedTable:i=l}={}){const u=typeof i>"u"?"offset":`${i}.offset`,m=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(u,`${a}`),this.url.searchParams.set(m,`${o-a+1}`),this}abortSignal(a){return this.signal=a,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:a=!1,verbose:o=!1,settings:l=!1,buffers:i=!1,wal:u=!1,format:m="text"}={}){var x;const y=[a?"analyze":null,o?"verbose":null,l?"settings":null,i?"buffers":null,u?"wal":null].filter(Boolean).join("|"),v=(x=this.headers.get("Accept"))!==null&&x!==void 0?x:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${m}; for="${v}"; options=${y};`),m==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}}return YL.default=n,YL}var hke;function Sxe(){if(hke)return ZL;hke=1,Object.defineProperty(ZL,"__esModule",{value:!0});const t=S3.__importDefault(N6e()),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 i=Array.from(new Set(l)).map(u=>typeof u=="string"&&n.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(o,`in.(${i})`),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:i,type:u}={}){let m="";u==="plain"?m="pl":u==="phrase"?m="ph":u==="websearch"&&(m="w");const x=i===void 0?"":`(${i})`;return this.url.searchParams.append(o,`${m}fts${x}.${l}`),this}match(o){return Object.entries(o).forEach(([l,i])=>{this.url.searchParams.append(l,`eq.${i}`)}),this}not(o,l,i){return this.url.searchParams.append(o,`not.${l}.${i}`),this}or(o,{foreignTable:l,referencedTable:i=l}={}){const u=i?`${i}.or`:"or";return this.url.searchParams.append(u,`(${o})`),this}filter(o,l,i){return this.url.searchParams.append(o,`${l}.${i}`),this}}return ZL.default=s,ZL}var mke;function S6e(){if(mke)return KL;mke=1,Object.defineProperty(KL,"__esModule",{value:!0});const t=S3.__importDefault(Sxe());class n{constructor(a,{headers:o={},schema:l,fetch:i}){this.url=a,this.headers=new Headers(o),this.schema=l,this.fetch=i}select(a,o){const{head:l=!1,count:i}=o??{},u=l?"HEAD":"GET";let m=!1;const x=(a??"*").split("").map(y=>/\s/.test(y)&&!m?"":(y==='"'&&(m=!m),y)).join("");return this.url.searchParams.set("select",x),i&&this.headers.append("Prefer",`count=${i}`),new t.default({method:u,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:o,defaultToNull:l=!0}={}){var i;const u="POST";if(o&&this.headers.append("Prefer",`count=${o}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const m=a.reduce((x,y)=>x.concat(Object.keys(y)),[]);if(m.length>0){const x=[...new Set(m)].map(y=>`"${y}"`);this.url.searchParams.set("columns",x.join(","))}}return new t.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(a,{onConflict:o,ignoreDuplicates:l=!1,count:i,defaultToNull:u=!0}={}){var m;const x="POST";if(this.headers.append("Prefer",`resolution=${l?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),i&&this.headers.append("Prefer",`count=${i}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const y=a.reduce((v,b)=>v.concat(Object.keys(b)),[]);if(y.length>0){const v=[...new Set(y)].map(b=>`"${b}"`);this.url.searchParams.set("columns",v.join(","))}}return new t.default({method:x,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(m=this.fetch)!==null&&m!==void 0?m:fetch})}update(a,{count:o}={}){var l;const i="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new t.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}delete({count:a}={}){var o;const l="DELETE";return a&&this.headers.append("Prefer",`count=${a}`),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 KL.default=n,KL}var fke;function Ont(){if(fke)return GL;fke=1,Object.defineProperty(GL,"__esModule",{value:!0});const e=S3,t=e.__importDefault(S6e()),n=e.__importDefault(Sxe());class s{constructor(o,{headers:l={},schema:i,fetch:u}={}){this.url=o,this.headers=new Headers(l),this.schemaName=i,this.fetch=u}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:i=!1,get:u=!1,count:m}={}){var x;let y;const v=new URL(`${this.url}/rpc/${o}`);let b;i||u?(y=i?"HEAD":"GET",Object.entries(l).filter(([k,M])=>M!==void 0).map(([k,M])=>[k,Array.isArray(M)?`{${M.join(",")}}`:`${M}`]).forEach(([k,M])=>{v.searchParams.append(k,M)})):(y="POST",b=l);const N=new Headers(this.headers);return m&&N.set("Prefer",`count=${m}`),new n.default({method:y,url:v,headers:N,schema:this.schemaName,body:b,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return GL.default=s,GL}Object.defineProperty(Sh,"__esModule",{value:!0});var C6e=Sh.PostgrestError=R6e=Sh.PostgrestBuilder=O6e=Sh.PostgrestTransformBuilder=P6e=Sh.PostgrestFilterBuilder=E6e=Sh.PostgrestQueryBuilder=T6e=Sh.PostgrestClient=void 0;const C3=S3,M6e=C3.__importDefault(Ont());var T6e=Sh.PostgrestClient=M6e.default;const A6e=C3.__importDefault(S6e());var E6e=Sh.PostgrestQueryBuilder=A6e.default;const I6e=C3.__importDefault(Sxe());var P6e=Sh.PostgrestFilterBuilder=I6e.default;const L6e=C3.__importDefault(N6e());var O6e=Sh.PostgrestTransformBuilder=L6e.default;const D6e=C3.__importDefault(k6e());var R6e=Sh.PostgrestBuilder=D6e.default;const F6e=C3.__importDefault(j6e());C6e=Sh.PostgrestError=F6e.default;var z6e=Sh.default={PostgrestClient:M6e.default,PostgrestQueryBuilder:A6e.default,PostgrestFilterBuilder:I6e.default,PostgrestTransformBuilder:L6e.default,PostgrestBuilder:D6e.default,PostgrestError:F6e.default};const Dnt=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return R6e},get PostgrestClient(){return T6e},get PostgrestError(){return C6e},get PostgrestFilterBuilder(){return P6e},get PostgrestQueryBuilder(){return E6e},get PostgrestTransformBuilder(){return O6e},default:z6e},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:Rnt,PostgrestQueryBuilder:Ger,PostgrestFilterBuilder:Ker,PostgrestTransformBuilder:Zer,PostgrestBuilder:Yer,PostgrestError:Xer}=z6e||Dnt;class Fnt{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,a=parseInt(s.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} 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 znt="2.78.0",Bnt=`realtime-js/${znt}`,$nt="1.0.0",Whe=1e4,Unt=1e3,qnt=100;var IA;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(IA||(IA={}));var rd;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(rd||(rd={}));var hp;(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"})(hp||(hp={}));var Ghe;(function(e){e.websocket="websocket"})(Ghe||(Ghe={}));var Xw;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Xw||(Xw={}));class Vnt{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 a=n.getUint8(1),o=n.getUint8(2);let l=this.HEADER_LENGTH+2;const i=s.decode(t.slice(l,l+a));l=l+a;const u=s.decode(t.slice(l,l+o));l=l+o;const m=JSON.parse(s.decode(t.slice(l,t.byteLength)));return{ref:null,topic:i,event:u,payload:m}}}class B6e{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 nl;(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"})(nl||(nl={}));const pke=(e,t,n={})=>{var s;const a=(s=n.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((o,l)=>(o[l]=Hnt(l,e,t,a),o),{}):{}},Hnt=(e,t,n,s)=>{const a=t.find(i=>i.name===e),o=a==null?void 0:a.type,l=n[e];return o&&!s.includes(o)?$6e(o,l):Khe(l)},$6e=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Znt(t,n)}switch(e){case nl.bool:return Wnt(t);case nl.float4:case nl.float8:case nl.int2:case nl.int4:case nl.int8:case nl.numeric:case nl.oid:return Gnt(t);case nl.json:case nl.jsonb:return Knt(t);case nl.timestamp:return Ynt(t);case nl.abstime:case nl.date:case nl.daterange:case nl.int4range:case nl.int8range:case nl.money:case nl.reltime:case nl.text:case nl.time:case nl.timestamptz:case nl.timetz:case nl.tsrange:case nl.tstzrange:return Khe(t);default:return Khe(t)}},Khe=e=>e,Wnt=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Gnt=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Knt=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},Znt=(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(i=>$6e(t,i))}return e},Ynt=e=>typeof e=="string"?e.replace(" ","T"):e,U6e=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 wce{constructor(t,n,s={},a=Whe){this.channel=t,this.event=n,this.payload=s,this.timeout=a,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 gke;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(gke||(gke={}));class PA{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,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.joinRef=this.channel._joinRef(),this.state=PA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(u=>{this.state=PA.syncDiff(this.state,u,o,l)}),this.pendingDiffs=[],i()}),this.channel._on(s.diff,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=PA.syncDiff(this.state,a,o,l),i())}),this.onJoin((a,o,l)=>{this.channel._trigger("presence",{event:"join",key:a,currentPresences:o,newPresences:l})}),this.onLeave((a,o,l)=>{this.channel._trigger("presence",{event:"leave",key:a,currentPresences:o,leftPresences:l})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(t,n,s,a){const o=this.cloneDeep(t),l=this.transformState(n),i={},u={};return this.map(o,(m,x)=>{l[m]||(u[m]=x)}),this.map(l,(m,x)=>{const y=o[m];if(y){const v=x.map(M=>M.presence_ref),b=y.map(M=>M.presence_ref),N=x.filter(M=>b.indexOf(M.presence_ref)<0),k=y.filter(M=>v.indexOf(M.presence_ref)<0);N.length>0&&(i[m]=N),k.length>0&&(u[m]=k)}else i[m]=x}),this.syncDiff(o,{joins:i,leaves:u},s,a)}static syncDiff(t,n,s,a){const{joins:o,leaves:l}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),a||(a=()=>{}),this.map(o,(i,u)=>{var m;const x=(m=t[i])!==null&&m!==void 0?m:[];if(t[i]=this.cloneDeep(u),x.length>0){const y=t[i].map(b=>b.presence_ref),v=x.filter(b=>y.indexOf(b.presence_ref)<0);t[i].unshift(...v)}s(i,x,u)}),this.map(l,(i,u)=>{let m=t[i];if(!m)return;const x=u.map(y=>y.presence_ref);m=m.filter(y=>x.indexOf(y.presence_ref)<0),t[i]=m,a(i,m,u),m.length===0&&delete t[i]}),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 a=t[s];return"metas"in a?n[s]=a.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[s]=a,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 xke;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(xke||(xke={}));var LA;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(LA||(LA={}));var Vx;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Vx||(Vx={}));class Cxe{constructor(t,n={config:{}},s){var a,o;if(this.topic=t,this.params=n,this.socket=s,this.bindings={},this.state=rd.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 wce(this,hp.join,this.params,this.timeout),this.rejoinTimer=new B6e(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=rd.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=rd.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=rd.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=rd.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=rd.errored,this.rejoinTimer.scheduleTimeout())}),this._on(hp.reply,{},(l,i)=>{this._trigger(this._replyEventName(i),l)}),this.presence=new PA(this),this.broadcastEndpointURL=U6e(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((o=(a=this.params.config)===null||a===void 0?void 0:a.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,a,o;if(this.socket.isConnected()||this.socket.connect(),this.state==rd.closed){const{config:{broadcast:l,presence:i,private:u}}=this.params,m=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(b=>b.filter))!==null&&a!==void 0?a:[],x=!!this.bindings[LA.PRESENCE]&&this.bindings[LA.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,y={},v={broadcast:l,presence:Object.assign(Object.assign({},i),{enabled:x}),postgres_changes:m,private:u};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(b=>t==null?void 0:t(Vx.CHANNEL_ERROR,b)),this._onClose(()=>t==null?void 0:t(Vx.CLOSED)),this.updateJoinPayload(Object.assign({config:v},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:b})=>{var N;if(this.socket.setAuth(),b===void 0){t==null||t(Vx.SUBSCRIBED);return}else{const k=this.bindings.postgres_changes,M=(N=k==null?void 0:k.length)!==null&&N!==void 0?N:0,I=[];for(let T=0;T{this.state=rd.errored,t==null||t(Vx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(b).join(", ")||"error")))}).receive("timeout",()=>{t==null||t(Vx.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===rd.joined&&t===LA.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 a;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}]})},i=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(a=s.timeout)!==null&&a!==void 0?a:this.timeout);if(i.status===202)return{success:!0};let u=i.statusText;try{const m=await i.json();u=m.error||m.message||u}catch{}return Promise.reject(new Error(u))}async send(t,n={}){var s,a;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,u={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 m=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((a=m.body)===null||a===void 0?void 0:a.cancel()),m.ok?"ok":"error"}catch(m){return m.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var l,i,u;const m=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((u=(i=(l=this.params)===null||l===void 0?void 0:l.config)===null||i===void 0?void 0:i.broadcast)===null||u===void 0)&&u.ack)&&o("ok"),m.receive("ok",()=>o("ok")),m.receive("error",()=>o("error")),m.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=rd.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(hp.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>{s=new wce(this,hp.leave,{},t),s.receive("ok",()=>{n(),a("ok")}).receive("timeout",()=>{n(),a("timed out")}).receive("error",()=>{a("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=rd.closed,this.bindings={}}async _fetchWithTimeout(t,n,s){const a=new AbortController,o=setTimeout(()=>a.abort(),s),l=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:a.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 a=new wce(this,t,n,s);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>qnt){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 a,o;const l=t.toLocaleLowerCase(),{close:i,error:u,leave:m,join:x}=hp;if(s&&[i,u,m,x].indexOf(l)>=0&&s!==this._joinRef())return;let v=this._onMessage(l,n,s);if(n&&!v)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(l)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(b=>{var N,k,M;return((N=b.filter)===null||N===void 0?void 0:N.event)==="*"||((M=(k=b.filter)===null||k===void 0?void 0:k.event)===null||M===void 0?void 0:M.toLocaleLowerCase())===l}).map(b=>b.callback(v,s)):(o=this.bindings[l])===null||o===void 0||o.filter(b=>{var N,k,M,I,T,P;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in b){const F=b.id,D=(N=b.filter)===null||N===void 0?void 0:N.event;return F&&((k=n.ids)===null||k===void 0?void 0:k.includes(F))&&(D==="*"||(D==null?void 0:D.toLocaleLowerCase())===((M=n.data)===null||M===void 0?void 0:M.type.toLocaleLowerCase()))}else{const F=(T=(I=b==null?void 0:b.filter)===null||I===void 0?void 0:I.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return F==="*"||F===((P=n==null?void 0:n.event)===null||P===void 0?void 0:P.toLocaleLowerCase())}else return b.type.toLocaleLowerCase()===l}).map(b=>{if(typeof v=="object"&&"ids"in v){const N=v.data,{schema:k,table:M,commit_timestamp:I,type:T,errors:P}=N;v=Object.assign(Object.assign({},{schema:k,table:M,commit_timestamp:I,eventType:T,new:{},old:{},errors:P}),this._getPayloadRecords(N))}b.callback(v,s)})}_isClosed(){return this.state===rd.closed}_isJoined(){return this.state===rd.joined}_isJoining(){return this.state===rd.joining}_isLeaving(){return this.state===rd.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,s){const a=t.toLocaleLowerCase(),o={type:a,filter:n,callback:s};return this.bindings[a]?this.bindings[a].push(o):this.bindings[a]=[o],this}_off(t,n){const s=t.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(a=>{var o;return!(((o=a.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===s&&Cxe.isEqual(a.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(hp.close,{},t)}_onError(t){this._on(hp.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=rd.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=pke(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=pke(t.columns,t.old_record)),n}}const jce=()=>{},JL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Xnt=[1e3,2e3,5e3,1e4],Qnt=1e4,Jnt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class est{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=Whe,this.transport=null,this.heartbeatIntervalMs=JL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=jce,this.ref=0,this.reconnectTimer=null,this.logger=jce,this.conn=null,this.sendBuffer=[],this.serializer=new Vnt,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=a=>{let o;return a?o=a:typeof fetch>"u"?o=(...l)=>N3(async()=>{const{default:i}=await Promise.resolve().then(()=>Ck);return{default:i}},void 0).then(({default:i})=>i(...l)).catch(i=>{throw new Error(`Failed to load @supabase/node-fetch: ${i.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}/${Ghe.websocket}`,this.httpEndpoint=U6e(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=Fnt.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:$nt}))}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 IA.connecting:return Xw.Connecting;case IA.open:return Xw.Open;case IA.closing:return Xw.Closing;default:return Xw.Closed}}isConnected(){return this.connectionState()===Xw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const s=`realtime:${t}`,a=this.getChannels().find(o=>o.topic===s);if(a)return a;{const o=new Cxe(`realtime:${t}`,n,this);return this.channels.push(o),o}}push(t){const{topic:n,event:s,payload:a,ref:o}=t,l=()=>{this.encode(t,i=>{var u;(u=this.conn)===null||u===void 0||u.send(i)})};this.log("push",`${n} ${s} (${o})`,a),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(Unt,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},JL.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(m){this.log("error","error in heartbeat callback",m)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:a,payload:o,ref:l}=n,i=l?`(${l})`:"",u=o.status||"";this.log("receive",`${u} ${s} ${a} ${i}`.trim(),o),this.channels.filter(m=>m._isMember(s)).forEach(m=>m._trigger(a,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(hp.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const s=t.match(/\?/)?"&":"?",a=new URLSearchParams(n);return`${t}${s}${a}`}_workerObjectUrl(t){let n;if(t)n=t;else{const s=new Blob([Jnt],{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 a={access_token:n,version:Bnt};n&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push(hp.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(a){this.log("error",`error in ${t} callback`,a)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new B6e(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},JL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,s,a,o,l,i,u,m,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:Whe,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:JL.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=(i=t==null?void 0:t.heartbeatCallback)!==null&&i!==void 0?i:jce,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=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:y=>Xnt[y-1]||Qnt,this.encode=(m=t==null?void 0:t.encode)!==null&&m!==void 0?m:(y,v)=>v(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 Mxe extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Dl(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class tst extends Mxe{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 Zhe extends Mxe{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}const Txe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>N3(async()=>{const{default:s}=await Promise.resolve().then(()=>Ck);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},rst=()=>qs(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield N3(()=>Promise.resolve().then(()=>Ck),void 0)).Response:Response}),Yhe=e=>{if(Array.isArray(e))return e.map(n=>Yhe(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,s])=>{const a=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[a]=Yhe(s)}),t},nst=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)},kce=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)},sst=(e,t,n)=>qs(void 0,void 0,void 0,function*(){const s=yield rst();e instanceof s&&!(n!=null&&n.noResolveJson)?e.json().then(a=>{const o=e.status||500,l=(a==null?void 0:a.statusCode)||o+"";t(new tst(kce(a),o,l))}).catch(a=>{t(new Zhe(kce(a),a))}):t(new Zhe(kce(e),e))}),ast=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!s?a:(nst(s)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(s)):a.body=s,t!=null&&t.duplex&&(a.duplex=t.duplex),Object.assign(Object.assign({},a),n))};function JI(e,t,n,s,a,o){return qs(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(n,ast(t,s,a,o)).then(u=>{if(!u.ok)throw u;return s!=null&&s.noResolveJson?u:u.json()}).then(u=>l(u)).catch(u=>sst(u,i,s))})})}function ME(e,t,n,s){return qs(this,void 0,void 0,function*(){return JI(e,"GET",t,n,s)})}function lp(e,t,n,s,a){return qs(this,void 0,void 0,function*(){return JI(e,"POST",t,s,a,n)})}function Xhe(e,t,n,s,a){return qs(this,void 0,void 0,function*(){return JI(e,"PUT",t,s,a,n)})}function ist(e,t,n,s){return qs(this,void 0,void 0,function*(){return JI(e,"HEAD",t,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function Axe(e,t,n,s,a){return qs(this,void 0,void 0,function*(){return JI(e,"DELETE",t,s,a,n)})}class ost{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n}then(t,n){return this.execute().then(t,n)}execute(){return qs(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Dl(t))return{data:null,error:t};throw t}})}}var q6e;class lst{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n,this[q6e]="BlobDownloadBuilder",this.promise=null}asStream(){return new ost(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 qs(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Dl(t))return{data:null,error:t};throw t}})}}q6e=Symbol.toStringTag;const cst={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},yke={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class dst{constructor(t,n={},s,a){this.shouldThrowOnError=!1,this.url=t,this.headers=n,this.bucketId=s,this.fetch=Txe(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,n,s,a){return qs(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},yke),a);let i=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(l.upsert)});const u=l.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u))):(o=s,i["cache-control"]=`max-age=${l.cacheControl}`,i["content-type"]=l.contentType,u&&(i["x-metadata"]=this.toBase64(this.encodeMetadata(u)))),a!=null&&a.headers&&(i=Object.assign(Object.assign({},i),a.headers));const m=this._removeEmptyFolders(n),x=this._getFinalPath(m),y=yield(t=="PUT"?Xhe:lp)(this.fetch,`${this.url}/object/${x}`,o,Object.assign({headers:i},l!=null&&l.duplex?{duplex:l.duplex}:{}));return{data:{path:m,id:y.Id,fullPath:y.Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if(Dl(o))return{data:null,error:o};throw o}})}upload(t,n,s){return qs(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,s)})}uploadToSignedUrl(t,n,s,a){return qs(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(t),l=this._getFinalPath(o),i=new URL(this.url+`/object/upload/sign/${l}`);i.searchParams.set("token",n);try{let u;const m=Object.assign({upsert:yke.upsert},a),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(m.upsert)});typeof Blob<"u"&&s instanceof Blob?(u=new FormData,u.append("cacheControl",m.cacheControl),u.append("",s)):typeof FormData<"u"&&s instanceof FormData?(u=s,u.append("cacheControl",m.cacheControl)):(u=s,x["cache-control"]=`max-age=${m.cacheControl}`,x["content-type"]=m.contentType);const y=yield Xhe(this.fetch,i.toString(),u,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if(Dl(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(t,n){return qs(this,void 0,void 0,function*(){try{let s=this._getFinalPath(t);const a=Object.assign({},this.headers);n!=null&&n.upsert&&(a["x-upsert"]="true");const o=yield lp(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:a}),l=new URL(this.url+o.url),i=l.searchParams.get("token");if(!i)throw new Mxe("No token returned by API");return{data:{signedUrl:l.toString(),path:t,token:i},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Dl(s))return{data:null,error:s};throw s}})}update(t,n,s){return qs(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,s)})}move(t,n,s){return qs(this,void 0,void 0,function*(){try{return{data:yield lp(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(a){if(this.shouldThrowOnError)throw a;if(Dl(a))return{data:null,error:a};throw a}})}copy(t,n,s){return qs(this,void 0,void 0,function*(){try{return{data:{path:(yield lp(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(a){if(this.shouldThrowOnError)throw a;if(Dl(a))return{data:null,error:a};throw a}})}createSignedUrl(t,n,s){return qs(this,void 0,void 0,function*(){try{let a=this._getFinalPath(t),o=yield lp(this.fetch,`${this.url}/object/sign/${a}`,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(a){if(this.shouldThrowOnError)throw a;if(Dl(a))return{data:null,error:a};throw a}})}createSignedUrls(t,n,s){return qs(this,void 0,void 0,function*(){try{const a=yield lp(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:a.map(l=>Object.assign(Object.assign({},l),{signedUrl:l.signedURL?encodeURI(`${this.url}${l.signedURL}${o}`):null})),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Dl(a))return{data:null,error:a};throw a}})}download(t,n){const a=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),l=o?`?${o}`:"",i=this._getFinalPath(t),u=()=>ME(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new lst(u,this.shouldThrowOnError)}info(t){return qs(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{const s=yield ME(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Yhe(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Dl(s))return{data:null,error:s};throw s}})}exists(t){return qs(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{return yield ist(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Dl(s)&&s instanceof Zhe){const a=s.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:s}}throw s}})}getPublicUrl(t,n){const s=this._getFinalPath(t),a=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&a.push(o);const i=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",u=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});u!==""&&a.push(u);let m=a.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}${m}`)}}}remove(t){return qs(this,void 0,void 0,function*(){try{return{data:yield Axe(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(n))return{data:null,error:n};throw n}})}list(t,n,s){return qs(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},cst),n),{prefix:t||""});return{data:yield lp(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},s),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Dl(a))return{data:null,error:a};throw a}})}listV2(t,n){return qs(this,void 0,void 0,function*(){try{const s=Object.assign({},t);return{data:yield lp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Dl(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 V6e="2.78.0",H6e={"X-Client-Info":`storage-js/${V6e}`};class ust{constructor(t,n={},s,a){this.shouldThrowOnError=!1;const o=new URL(t);a!=null&&a.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({},H6e),n),this.fetch=Txe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return qs(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(t);return{data:yield ME(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(n))return{data:null,error:n};throw n}})}getBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:yield ME(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(n))return{data:null,error:n};throw n}})}createBucket(t){return qs(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield lp(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(a){if(this.shouldThrowOnError)throw a;if(Dl(a))return{data:null,error:a};throw a}})}updateBucket(t,n){return qs(this,void 0,void 0,function*(){try{return{data:yield Xhe(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(Dl(s))return{data:null,error:s};throw s}})}emptyBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:yield lp(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(n))return{data:null,error:n};throw n}})}deleteBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:yield Axe(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(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 hst{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},H6e),n),this.fetch=Txe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:yield lp(this.fetch,`${this.url}/bucket`,{name:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(n))return{data:null,error:n};throw n}})}listBuckets(t){return qs(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(),a=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield ME(this.fetch,a,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(n))return{data:null,error:n};throw n}})}deleteBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:yield Axe(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Dl(n))return{data:null,error:n};throw n}})}}const Exe={"X-Client-Info":`storage-js/${V6e}`,"Content-Type":"application/json"};class W6e extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function im(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class Nce extends W6e{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 mst extends W6e{constructor(t,n){super(t),this.name="StorageVectorsUnknownError",this.originalError=n}}var vke;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(vke||(vke={}));const Ixe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>N3(async()=>{const{default:s}=await Promise.resolve().then(()=>Ck);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},fst=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)},_ke=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),pst=(e,t,n)=>qs(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 a=e.status||500,o=e;if(typeof o.json=="function")o.json().then(l=>{const i=(l==null?void 0:l.statusCode)||(l==null?void 0:l.code)||a+"";t(new Nce(_ke(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Nce(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Nce(i,a,l))}}else t(new mst(_ke(e),e))}),gst=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return s?(fst(s)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(s)):a.body=s,Object.assign(Object.assign({},a),n)):a};function xst(e,t,n,s,a,o){return qs(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(n,gst(t,s,a,o)).then(u=>{if(!u.ok)throw u;if(s!=null&&s.noResolveJson)return u;const m=u.headers.get("content-type");return!m||!m.includes("application/json")?{}:u.json()}).then(u=>l(u)).catch(u=>pst(u,i,s))})})}function om(e,t,n,s,a){return qs(this,void 0,void 0,function*(){return xst(e,"POST",t,s,a,n)})}class yst{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Exe),n),this.fetch=Ixe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return qs(this,void 0,void 0,function*(){try{return{data:(yield om(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}getIndex(t,n){return qs(this,void 0,void 0,function*(){try{return{data:yield om(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(im(s))return{data:null,error:s};throw s}})}listIndexes(t){return qs(this,void 0,void 0,function*(){try{return{data:yield om(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}deleteIndex(t,n){return qs(this,void 0,void 0,function*(){try{return{data:(yield om(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(im(s))return{data:null,error:s};throw s}})}}class vst{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Exe),n),this.fetch=Ixe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return qs(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 om(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}getVectors(t){return qs(this,void 0,void 0,function*(){try{return{data:yield om(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}listVectors(t){return qs(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 om(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}queryVectors(t){return qs(this,void 0,void 0,function*(){try{return{data:yield om(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}deleteVectors(t){return qs(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 om(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}}class _st{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Exe),n),this.fetch=Ixe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:(yield om(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}getBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:yield om(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}listBuckets(){return qs(this,arguments,void 0,function*(t={}){try{return{data:yield om(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}deleteBucket(t){return qs(this,void 0,void 0,function*(){try{return{data:(yield om(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(im(n))return{data:null,error:n};throw n}})}}class bst extends _st{constructor(t,n={}){super(t,n.headers||{},n.fetch)}from(t){return new wst(this.url,this.headers,t,this.fetch)}}class wst extends yst{constructor(t,n,s,a){super(t,n,a),this.vectorBucketName=s}createIndex(t){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return qs(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 qs(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 qs(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 qs(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new jst(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class jst extends vst{constructor(t,n,s,a,o){super(t,n,o),this.vectorBucketName=s,this.indexName=a}putVectors(t){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return qs(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 qs(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 qs(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 qs(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 qs(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class kst extends ust{constructor(t,n={},s,a){super(t,n,s,a)}from(t){return new dst(this.url,this.headers,t,this.fetch)}get vectors(){return new bst(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new hst(this.url+"/iceberg",this.headers,this.fetch)}}const Nst="2.78.0";let IT="";typeof Deno<"u"?IT="deno":typeof document<"u"?IT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?IT="react-native":IT="node";const Sst={"X-Client-Info":`supabase-js-${IT}/${Nst}`},Cst={headers:Sst},Mst={schema:"public"},Tst={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Ast={},Est=e=>{let t;return e?t=e:typeof fetch>"u"?t=b6e:t=fetch,(...n)=>t(...n)},Ist=()=>typeof Headers>"u"?w6e:Headers,Pst=(e,t,n)=>{const s=Est(n),a=Ist();return async(o,l)=>{var i;const u=(i=await t())!==null&&i!==void 0?i:e;let m=new a(l==null?void 0:l.headers);return m.has("apikey")||m.set("apikey",e),m.has("Authorization")||m.set("Authorization",`Bearer ${u}`),s(o,Object.assign(Object.assign({},l),{headers:m}))}};function Lst(e){return e.endsWith("/")?e:e+"/"}function Ost(e,t){var n,s;const{db:a,auth:o,realtime:l,global:i}=e,{db:u,auth:m,realtime:x,global:y}=t,v={db:Object.assign(Object.assign({},u),a),auth:Object.assign(Object.assign({},m),o),realtime:Object.assign(Object.assign({},x),l),storage:{},global:Object.assign(Object.assign(Object.assign({},y),i),{headers:Object.assign(Object.assign({},(n=y==null?void 0:y.headers)!==null&&n!==void 0?n:{}),(s=i==null?void 0:i.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return e.accessToken?v.accessToken=e.accessToken:delete v.accessToken,v}function Dst(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(Lst(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const G6e="2.78.0",FS=30*1e3,Qhe=3,Sce=Qhe*FS,Rst="http://localhost:9999",Fst="supabase.auth.token",zst={"X-Client-Info":`gotrue-js/${G6e}`},Jhe="X-Supabase-Api-Version",K6e={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Bst=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,$st=10*60*1e3;class TE extends Error{constructor(t,n,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function la(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Ust extends TE{constructor(t,n,s){super(t,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function qst(e){return la(e)&&e.name==="AuthApiError"}class Qw extends TE{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class Nv extends TE{constructor(t,n,s,a){super(t,s,a),this.name=n,this.status=s}}class np extends Nv{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Vst(e){return la(e)&&e.name==="AuthSessionMissingError"}class vS extends Nv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class eO extends Nv{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class tO 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 Hst(e){return la(e)&&e.name==="AuthImplicitGrantRedirectError"}class bke 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 eme extends Nv{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Cce(e){return la(e)&&e.name==="AuthRetryableFetchError"}class wke extends Nv{constructor(t,n,s){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class tme extends Nv{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ote="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),jke=` \r=`.split(""),Wst=(()=>{const e=new Array(128);for(let t=0;t=6;){const s=t.queue>>t.queuedBits-6&63;n(Ote[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(Ote[s]),t.queuedBits-=6}}function Z6e(e,t,n){const s=Wst[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 Nke(e){const t=[],n=l=>{t.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{Zst(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 Kst(e,t){for(let n=0;n55295&&s<=56319){const a=(s-55296)*1024&65535;s=(e.charCodeAt(n+1)-56320&65535|a)+65536,n+=1}Gst(s,t)}}function Zst(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 V4(e){const t=[],n={queue:0,queuedBits:0},s=a=>{t.push(a)};for(let a=0;at.push(n)),new Uint8Array(t)}function aj(e){const t=[],n={queue:0,queuedBits:0},s=a=>{t.push(a)};return e.forEach(a=>kke(a,n,s)),kke(null,n,s),t.join("")}function Xst(e){return Math.round(Date.now()/1e3)+e}function Qst(){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 $u=()=>typeof window<"u"&&typeof document<"u",N_={tested:!1,writable:!1},Y6e=()=>{if(!$u())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(N_.tested)return N_.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),N_.tested=!0,N_.writable=!0}catch{N_.tested=!0,N_.writable=!1}return N_.writable};function Jst(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((a,o)=>{t[o]=a})}catch{}return n.searchParams.forEach((s,a)=>{t[a]=s}),t}const X6e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>N3(async()=>{const{default:s}=await Promise.resolve().then(()=>Ck);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},eat=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",zS=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},S_=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},R0=async(e,t)=>{await e.removeItem(t)};class Sse{constructor(){this.promise=new Sse.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Sse.promiseConstructor=Promise;function Mce(e){const t=e.split(".");if(t.length!==3)throw new tme("Invalid JWT structure");for(let s=0;s{setTimeout(()=>t(null),e)})}function rat(e,t){return new Promise((s,a)=>{(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)){a(l);return}}})()})}function nat(e){return("0"+e.toString(16)).substr(-2)}function sat(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",s=n.length;let a="";for(let o=0;o<56;o++)a+=n.charAt(Math.floor(Math.random()*s));return a}return crypto.getRandomValues(t),Array.from(t,nat).join("")}async function aat(e){const n=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",n),a=new Uint8Array(s);return Array.from(a).map(o=>String.fromCharCode(o)).join("")}async function iat(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 aat(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function _S(e,t,n=!1){const s=sat();let a=s;n&&(a+="/PASSWORD_RECOVERY"),await zS(e,`${t}-code-verifier`,a);const o=await iat(s);return[o,s===o?"plain":"s256"]}const oat=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function lat(e){const t=e.headers.get(Jhe);if(!t||!t.match(oat))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function cat(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 dat(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 uat=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function bS(e){if(!uat.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Tce(){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 hat(e,t){return new Proxy(e,{get:(n,s,a)=>{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,a)}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,a)}})}function Ske(e){return JSON.parse(JSON.stringify(e))}const Ww=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),mat=[502,503,504];async function Cke(e){var t;if(!eat(e))throw new eme(Ww(e),0);if(mat.includes(e.status))throw new eme(Ww(e),e.status);let n;try{n=await e.json()}catch(o){throw new Qw(Ww(o),o)}let s;const a=lat(e);if(a&&a.getTime()>=K6e["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 wke(Ww(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new np}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 wke(Ww(n),e.status,n.weak_password.reasons);throw new Ust(Ww(n),e.status||500,s)}const fat=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),n))};async function za(e,t,n,s){var a;const o=Object.assign({},s==null?void 0:s.headers);o[Jhe]||(o[Jhe]=K6e["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const l=(a=s==null?void 0:s.query)!==null&&a!==void 0?a:{};s!=null&&s.redirectTo&&(l.redirect_to=s.redirectTo);const i=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",u=await pat(e,t,n+i,{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(u):{data:Object.assign({},u),error:null}}async function pat(e,t,n,s,a,o){const l=fat(t,s,a,o);let i;try{i=await e(n,Object.assign({},l))}catch(u){throw console.error(u),new eme(Ww(u),0)}if(i.ok||await Cke(i),s!=null&&s.noResolveJson)return i;try{return await i.json()}catch(u){await Cke(u)}}function sp(e){var t;let n=null;yat(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Xst(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:s},error:null}}function Mke(e){const t=sp(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 l1(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function gat(e){return{data:e,error:null}}function xat(e){const{action_link:t,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o}=e,l=kv(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),i={action_link:t,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o},u=Object.assign({},l);return{data:{properties:i,user:u},error:null}}function Tke(e){return e}function yat(e){return e.access_token&&e.refresh_token&&e.expires_in}const Ace=["global","local","others"];class vat{constructor({url:t="",headers:n={},fetch:s}){this.url=t,this.headers=n,this.fetch=X6e(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=Ace[0]){if(Ace.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ace.join(", ")}`);try{return await za(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(la(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,n={}){try{return await za(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:l1})}catch(s){if(la(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:n}=t,s=kv(t,["options"]),a=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(a.new_email=s==null?void 0:s.newEmail,delete a.newEmail),await za(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:xat,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(la(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await za(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:l1})}catch(n){if(la(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,s,a,o,l,i,u;try{const m={nextPage:null,lastPage:0,total:0},x=await za(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=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Tke});if(x.error)throw x.error;const y=await x.json(),v=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,b=(u=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&u!==void 0?u:[];return b.length>0&&(b.forEach(N=>{const k=parseInt(N.split(";")[0].split("=")[1].substring(0,1)),M=JSON.parse(N.split(";")[1].split("=")[1]);m[`${M}Page`]=k}),m.total=parseInt(v)),{data:Object.assign(Object.assign({},y),m),error:null}}catch(m){if(la(m))return{data:{users:[]},error:m};throw m}}async getUserById(t){bS(t);try{return await za(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:l1})}catch(n){if(la(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){bS(t);try{return await za(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:l1})}catch(s){if(la(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,n=!1){bS(t);try{return await za(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:l1})}catch(s){if(la(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){bS(t.userId);try{const{data:n,error:s}=await za(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:n,error:s}}catch(n){if(la(n))return{data:null,error:n};throw n}}async _deleteFactor(t){bS(t.userId),bS(t.id);try{return{data:await za(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(la(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,s,a,o,l,i,u;try{const m={nextPage:null,lastPage:0,total:0},x=await za(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=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Tke});if(x.error)throw x.error;const y=await x.json(),v=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,b=(u=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&u!==void 0?u:[];return b.length>0&&(b.forEach(N=>{const k=parseInt(N.split(";")[0].split("=")[1].substring(0,1)),M=JSON.parse(N.split(";")[1].split("=")[1]);m[`${M}Page`]=k}),m.total=parseInt(v)),{data:Object.assign(Object.assign({},y),m),error:null}}catch(m){if(la(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(t){try{return await za(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(la(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await za(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(la(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await za(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(la(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{return await za(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(la(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await za(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(la(n))return{data:null,error:n};throw n}}}function Ake(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const wS={debug:!!(globalThis&&Y6e()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Q6e extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class _at extends Q6e{}async function bat(e,t,n){wS.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;return t>0&&setTimeout(()=>{s.abort(),wS.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 a=>{if(a){wS.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await n()}finally{wS.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw wS.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new _at(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(wS.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 wat(){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 J6e(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function jat(e){return parseInt(e,16)}function kat(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function Nat(e){var t;const{chainId:n,domain:s,expirationTime:a,issuedAt:o=new Date,nonce:l,notBefore:i,requestId:u,resources:m,scheme:x,uri:y,version:v}=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(v!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${v}`);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 b=J6e(e.address),N=x?`${x}://${s}`:s,k=e.statement?`${e.statement} `:"",M=`${N} wants you to sign in with your Ethereum account: ${b} ${k}`;let I=`URI: ${y} Version: ${v} Chain ID: ${n}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(a&&(I+=` Expiration Time: ${a.toISOString()}`),i&&(I+=` Not Before: ${i.toISOString()}`),u&&(I+=` Request ID: ${u}`),m){let T=` Resources:`;for(const P of m){if(!P||typeof P!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${P}`);T+=` - ${P}`}I+=T}return`${M} ${I}`}class zc extends Error{constructor({message:t,code:n,cause:s,name:a}){var o;super(t,{cause:s}),this.__isWebAuthnError=!0,this.name=(o=a??(s instanceof Error?s.name:void 0))!==null&&o!==void 0?o:"Unknown Error",this.code=n}}class Dte extends zc{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function Sat({error:e,options:t}){var n,s,a;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 zc({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 zc({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 zc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((a=o.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new zc({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 zc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new zc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(i=>i.type==="public-key").length===0?new zc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new zc({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(eLe(l)){if(o.rp.id!==l)return new zc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new zc({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 zc({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 zc({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 zc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function Cat({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 zc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new zc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(eLe(s)){if(n.rpId!==s)return new zc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new zc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new zc({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 zc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class Mat{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 Tat=new Mat;function Aat(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,a=kv(e,["challenge","user","excludeCredentials"]),o=V4(t).buffer,l=Object.assign(Object.assign({},n),{id:V4(n.id).buffer}),i=Object.assign(Object.assign({},a),{challenge:o,user:l});if(s&&s.length>0){i.excludeCredentials=new Array(s.length);for(let u=0;u0){o.allowCredentials=new Array(n.length);for(let l=0;la!==null&&typeof a=="object"&&!Array.isArray(a),n=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),s={};for(const a of e)if(a)for(const o in a){const l=a[o];if(l!==void 0)if(Array.isArray(l))s[o]=l;else if(n(l))s[o]=l;else if(t(l)){const i=s[o];t(i)?s[o]=Rte(i,l):s[o]=Rte(l)}else s[o]=l}return s}function Fat(e,t){return Rte(Dat,e,t||{})}function zat(e,t){return Rte(Rat,e,t||{})}class Bat{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:a},o){try{const{data:l,error:i}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:i};const u=a??Tat.createNewAbortSignal();if(l.webauthn.type==="create"){const{user:m}=l.webauthn.credential_options.publicKey;m.name||(m.name=`${m.id}:${s}`),m.displayName||(m.displayName=m.name)}switch(l.webauthn.type){case"create":{const m=Fat(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Lat({publicKey:m,signal:u});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 m=zat(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Oat(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:m,signal:u}));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 la(l)?{data:null,error:l}:{data:null,error:new Qw("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:a}},o){if(!n)return{data:null,error:new TE("rpId is required for WebAuthn authentication")};try{if(!Eke())return{data:null,error:new Qw("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:s},signal:a},{request:o});if(!l)return{data:null,error:i};const{webauthn:u}=l;return this._verify({factorId:t,challengeId:l.challengeId,webauthn:{type:u.type,rpId:n,rpOrigins:s,credential_response:u.credential_response}})}catch(l){return la(l)?{data:null,error:l}:{data:null,error:new Qw("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:a},o){if(!n)return{data:null,error:new TE("rpId is required for WebAuthn registration")};try{if(!Eke())return{data:null,error:new Qw("Browser does not support WebAuthn",null)};const{data:l,error:i}=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(v=>v.factor_type==="webauthn"&&v.friendly_name===t&&v.status!=="unverified")}).then(x=>x?this.client.mfa.unenroll({factorId:x==null?void 0:x.id}):void 0),{data:null,error:i};const{data:u,error:m}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:a},{create:o});return u?this._verify({factorId:l.id,challengeId:u.challengeId,webauthn:{rpId:n,rpOrigins:s,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:m}}catch(l){return la(l)?{data:null,error:l}:{data:null,error:new Qw("Unexpected error in register",l)}}}}wat();const $at={url:Rst,storageKey:Fst,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:zst,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Ike(e,t,n){return await n()}const jS={};class AE{get jwks(){var t,n;return(n=(t=jS[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){jS[this.storageKey]=Object.assign(Object.assign({},jS[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=jS[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){jS[this.storageKey]=Object.assign(Object.assign({},jS[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=AE.nextInstanceID,AE.nextInstanceID+=1,this.instanceID>0&&$u()&&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 a=Object.assign(Object.assign({},$at),t);if(this.logDebugMessages=!!a.debug,typeof a.debug=="function"&&(this.logger=a.debug),this.persistSession=a.persistSession,this.storageKey=a.storageKey,this.autoRefreshToken=a.autoRefreshToken,this.admin=new vat({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=X6e(a.fetch),this.lock=a.lock||Ike,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:$u()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=bat:this.lock=Ike,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 Bat(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:Y6e()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Ake(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Ake(this.memoryStorage)),$u()&&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} (${G6e}) ${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=Jst(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),$u()&&this.detectSessionInUrl&&s!=="none"){const{data:a,error:o}=await this._getSessionFromURL(n,s);if(o){if(this._debug("#_initialize()","error detecting session from URL",o),Hst(o)){const u=(t=o.details)===null||t===void 0?void 0:t.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:l,redirectType:i}=a;return this._debug("#_initialize()","detected session in URL",l,"redirect type",i),await this._saveSession(l),setTimeout(async()=>{i==="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 la(n)?{error:n}:{error:new Qw("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,s,a;try{const o=await za(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:(a=t==null?void 0:t.options)===null||a===void 0?void 0:a.captchaToken}},xform:sp}),{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const u=l.session,m=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:m,session:u},error:null}}catch(o){if(la(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(t){var n,s,a;try{let o;if("email"in t){const{email:x,password:y,options:v}=t;let b=null,N=null;this.flowType==="pkce"&&([b,N]=await _S(this.storage,this.storageKey)),o=await za(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:v==null?void 0:v.emailRedirectTo,body:{email:x,password:y,data:(n=v==null?void 0:v.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:v==null?void 0:v.captchaToken},code_challenge:b,code_challenge_method:N},xform:sp})}else if("phone"in t){const{phone:x,password:y,options:v}=t;o=await za(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:y,data:(s=v==null?void 0:v.data)!==null&&s!==void 0?s:{},channel:(a=v==null?void 0:v.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:v==null?void 0:v.captchaToken}},xform:sp})}else throw new eO("You must provide either an email or phone number and a password");const{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const u=l.session,m=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:m,session:u},error:null}}catch(o){if(la(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:i}=t;n=await za(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:l,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Mke})}else if("phone"in t){const{phone:o,password:l,options:i}=t;n=await za(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:l,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Mke})}else throw new eO("You must provide either an email or phone number and a password");const{data:s,error:a}=n;return a?{data:{user:null,session:null},error:a}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new vS}:(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:a})}catch(n){if(la(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,s,a,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:(a=t.options)===null||a===void 0?void 0:a.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,a,o,l,i,u,m,x,y,v;let b,N;if("message"in t)b=t.message,N=t.signature;else{const{chain:k,wallet:M,statement:I,options:T}=t;let P;if($u())if(typeof M=="object")P=M;else{const G=window;if("ethereum"in G&&typeof G.ethereum=="object"&&"request"in G.ethereum&&typeof G.ethereum.request=="function")P=G.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 M!="object"||!(T!=null&&T.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=M}const F=new URL((n=T==null?void 0:T.url)!==null&&n!==void 0?n:window.location.href),D=await P.request({method:"eth_requestAccounts"}).then(G=>G).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const U=J6e(D[0]);let V=(s=T==null?void 0:T.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!V){const G=await P.request({method:"eth_chainId"});V=jat(G)}const W={domain:F.host,address:U,statement:I,uri:F.href,version:"1",chainId:V,nonce:(a=T==null?void 0:T.signInWithEthereum)===null||a===void 0?void 0:a.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:(i=T==null?void 0:T.signInWithEthereum)===null||i===void 0?void 0:i.expirationTime,notBefore:(u=T==null?void 0:T.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(m=T==null?void 0:T.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(x=T==null?void 0:T.signInWithEthereum)===null||x===void 0?void 0:x.resources};b=Nat(W),N=await P.request({method:"personal_sign",params:[kat(b),U]})}try{const{data:k,error:M}=await za(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:b,signature:N},!((y=t.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(v=t.options)===null||v===void 0?void 0:v.captchaToken}}:null),xform:sp});if(M)throw M;return!k||!k.session||!k.user?{data:{user:null,session:null},error:new vS}:(k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),{data:Object.assign({},k),error:M})}catch(k){if(la(k))return{data:{user:null,session:null},error:k};throw k}}async signInWithSolana(t){var n,s,a,o,l,i,u,m,x,y,v,b;let N,k;if("message"in t)N=t.message,k=t.signature;else{const{chain:M,wallet:I,statement:T,options:P}=t;let F;if($u())if(typeof I=="object")F=I;else{const U=window;if("solana"in U&&typeof U.solana=="object"&&("signIn"in U.solana&&typeof U.solana.signIn=="function"||"signMessage"in U.solana&&typeof U.solana.signMessage=="function"))F=U.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 I!="object"||!(P!=null&&P.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");F=I}const D=new URL((n=P==null?void 0:P.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in F&&F.signIn){const U=await F.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},P==null?void 0:P.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),T?{statement:T}:null));let V;if(Array.isArray(U)&&U[0]&&typeof U[0]=="object")V=U[0];else if(U&&typeof U=="object"&&"signedMessage"in U&&"signature"in U)V=U;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in V&&"signature"in V&&(typeof V.signedMessage=="string"||V.signedMessage instanceof Uint8Array)&&V.signature instanceof Uint8Array)N=typeof V.signedMessage=="string"?V.signedMessage:new TextDecoder().decode(V.signedMessage),k=V.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in F)||typeof F.signMessage!="function"||!("publicKey"in F)||typeof F!="object"||!F.publicKey||!("toBase58"in F.publicKey)||typeof F.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");N=[`${D.host} wants you to sign in with your Solana account:`,F.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(a=(s=P==null?void 0:P.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((o=P==null?void 0:P.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${P.signInWithSolana.notBefore}`]:[],...!((l=P==null?void 0:P.signInWithSolana)===null||l===void 0)&&l.expirationTime?[`Expiration Time: ${P.signInWithSolana.expirationTime}`]:[],...!((i=P==null?void 0:P.signInWithSolana)===null||i===void 0)&&i.chainId?[`Chain ID: ${P.signInWithSolana.chainId}`]:[],...!((u=P==null?void 0:P.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${P.signInWithSolana.nonce}`]:[],...!((m=P==null?void 0:P.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${P.signInWithSolana.requestId}`]:[],...!((y=(x=P==null?void 0:P.signInWithSolana)===null||x===void 0?void 0:x.resources)===null||y===void 0)&&y.length?["Resources",...P.signInWithSolana.resources.map(V=>`- ${V}`)]:[]].join(` `);const U=await F.signMessage(new TextEncoder().encode(N),"utf8");if(!U||!(U instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");k=U}}try{const{data:M,error:I}=await za(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:N,signature:aj(k)},!((v=t.options)===null||v===void 0)&&v.captchaToken?{gotrue_meta_security:{captcha_token:(b=t.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:sp});if(I)throw I;return!M||!M.session||!M.user?{data:{user:null,session:null},error:new vS}:(M.session&&(await this._saveSession(M.session),await this._notifyAllSubscribers("SIGNED_IN",M.session)),{data:Object.assign({},M),error:I})}catch(M){if(la(M))return{data:{user:null,session:null},error:M};throw M}}async _exchangeCodeForSession(t){const n=await S_(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(n??"").split("/");try{const{data:o,error:l}=await za(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:sp});if(await R0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new vS}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:a??null}),error:l})}catch(o){if(la(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(t){try{const{options:n,provider:s,token:a,access_token:o,nonce:l}=t,i=await za(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:a,access_token:o,nonce:l,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:sp}),{data:u,error:m}=i;return m?{data:{user:null,session:null},error:m}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new vS}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:m})}catch(n){if(la(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,s,a,o,l;try{if("email"in t){const{email:i,options:u}=t;let m=null,x=null;this.flowType==="pkce"&&([m,x]=await _S(this.storage,this.storageKey));const{error:y}=await za(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:(n=u==null?void 0:u.data)!==null&&n!==void 0?n:{},create_user:(s=u==null?void 0:u.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:m,code_challenge_method:x},redirectTo:u==null?void 0:u.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in t){const{phone:i,options:u}=t,{data:m,error:x}=await za(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:i,data:(a=u==null?void 0:u.data)!==null&&a!==void 0?a:{},create_user:(o=u==null?void 0:u.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(l=u==null?void 0:u.channel)!==null&&l!==void 0?l:"sms"}});return{data:{user:null,session:null,messageId:m==null?void 0:m.message_id},error:x}}throw new eO("You must provide either an email or phone number.")}catch(i){if(la(i))return{data:{user:null,session:null},error:i};throw i}}async verifyOtp(t){var n,s;try{let a,o;"options"in t&&(a=(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:i}=await za(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:sp});if(i)throw i;if(!l)throw new Error("An error occurred on token verification.");const u=l.session,m=l.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:m,session:u},error:null}}catch(a){if(la(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(t){var n,s,a;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await _S(this.storage,this.storageKey)),await za(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}),!((a=t==null?void 0:t.options)===null||a===void 0)&&a.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:gat})}catch(o){if(la(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 np;const{error:a}=await za(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:a}})}catch(t){if(la(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:a,options:o}=t,{error:l}=await za(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:a,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:a,options:o}=t,{data:l,error:i}=await za(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:a,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:i}}throw new eO("You must provide either an email or phone number and a type")}catch(n){if(la(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(),a=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}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 a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.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 S_(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 za(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:l1}):await this._useSession(async n=>{var s,a,o;const{data:l,error:i}=n;if(i)throw i;return!(!((s=l.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new np}:await za(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(a=l.session)===null||a===void 0?void 0:a.access_token)!==null&&o!==void 0?o:void 0,xform:l1})})}catch(n){if(la(n))return Vst(n)&&(await this._removeSession(),await R0(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:a,error:o}=s;if(o)throw o;if(!a.session)throw new np;const l=a.session;let i=null,u=null;this.flowType==="pkce"&&t.email!=null&&([i,u]=await _S(this.storage,this.storageKey));const{data:m,error:x}=await za(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:i,code_challenge_method:u}),jwt:l.access_token,xform:l1});if(x)throw x;return l.user=m.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),{data:{user:l.user},error:null}})}catch(s){if(la(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 np;const n=Date.now()/1e3;let s=n,a=!0,o=null;const{payload:l}=Mce(t.access_token);if(l.exp&&(s=l.exp,a=s<=n),a){const{data:i,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!i)return{data:{user:null,session:null},error:null};o=i}else{const{data:i,error:u}=await this._getUser(t.access_token);if(u)throw u;o={access_token:t.access_token,refresh_token:t.refresh_token,user:i.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(la(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:i}=n;if(i)throw i;t=(s=l.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new np;const{data:a,error:o}=await this._callRefreshToken(t.refresh_token);return o?{data:{user:null,session:null},error:o}:a?{data:{user:a.user,session:a},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(la(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t,n){try{if(!$u())throw new tO("No browser detected.");if(t.error||t.error_description||t.error_code)throw new tO(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 bke("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new tO("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 bke("No code detected.");const{data:T,error:P}=await this._exchangeCodeForSession(t.code);if(P)throw P;const F=new URL(window.location.href);return F.searchParams.delete("code"),window.history.replaceState(window.history.state,"",F.toString()),{data:{session:T.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:o,refresh_token:l,expires_in:i,expires_at:u,token_type:m}=t;if(!o||!i||!l||!m)throw new tO("No session defined in URL");const x=Math.round(Date.now()/1e3),y=parseInt(i);let v=x+y;u&&(v=parseInt(u));const b=v-x;b*1e3<=FS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${y}s`);const N=v-y;x-N>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",N,v,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,v,x);const{data:k,error:M}=await this._getUser(o);if(M)throw M;const I={provider_token:s,provider_refresh_token:a,access_token:o,expires_in:y,expires_at:v,refresh_token:l,token_type:m,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:I,redirectType:t.type},error:null}}catch(s){if(la(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 S_(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:a,error:o}=n;if(o)return{error:o};const l=(s=a.session)===null||s===void 0?void 0:s.access_token;if(l){const{error:i}=await this.admin.signOut(l,t);if(i&&!(qst(i)&&(i.status===404||i.status===401||i.status===403)))return{error:i}}return t!=="others"&&(await this._removeSession(),await R0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(t){const n=Qst(),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,a;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((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let s=null,a=null;this.flowType==="pkce"&&([s,a]=await _S(this.storage,this.storageKey,!0));try{return await za(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:a,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(la(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(la(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:a}=await this._useSession(async o=>{var l,i,u,m,x;const{data:y,error:v}=o;if(v)throw v;const b=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(l=t.options)===null||l===void 0?void 0:l.redirectTo,scopes:(i=t.options)===null||i===void 0?void 0:i.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await za(this.fetch,"GET",b,{headers:this.headers,jwt:(x=(m=y.session)===null||m===void 0?void 0:m.access_token)!==null&&x!==void 0?x:void 0})});if(a)throw a;return $u()&&!(!((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(la(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:a,data:{session:o}}=n;if(a)throw a;const{options:l,provider:i,token:u,access_token:m,nonce:x}=t,y=await za(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:i,id_token:u,access_token:m,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:sp}),{data:v,error:b}=y;return b?{data:{user:null,session:null},error:b}:!v||!v.session||!v.user?{data:{user:null,session:null},error:new vS}:(v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("USER_UPDATED",v.session)),{data:v,error:b})}catch(a){if(la(a))return{data:{user:null,session:null},error:a};throw a}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var s,a;const{data:o,error:l}=n;if(l)throw l;return await za(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(a=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0})})}catch(n){if(la(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 rat(async a=>(a>0&&await tat(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await za(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:sp})),(a,o)=>{const l=200*Math.pow(2,a);return o&&Cce(o)&&Date.now()+l-s{try{await i.callback(t,n)}catch(u){o.push(u)}});if(await Promise.all(l),o.length>0){for(let i=0;ithis._autoRefreshTokenTick(),FS);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 a=Math.floor((s.expires_at*1e3-t)/FS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${FS}ms, refresh threshold is ${Qhe} ticks`),a<=Qhe&&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 Q6e)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!$u()||!(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 a=[`provider=${encodeURIComponent(n)}`];if(s!=null&&s.redirectTo&&a.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&a.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[o,l]=await _S(this.storage,this.storageKey),i=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(l)}`});a.push(i.toString())}if(s!=null&&s.queryParams){const o=new URLSearchParams(s.queryParams);a.push(o.toString())}return s!=null&&s.skipBrowserRedirect&&a.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var s;const{data:a,error:o}=n;return o?{data:null,error:o}:await za(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(la(n))return{data:null,error:n};throw n}}async _enroll(t){try{return await this._useSession(async n=>{var s,a;const{data:o,error:l}=n;if(l)return{data:null,error:l};const i=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:u,error:m}=await za(this.fetch,"POST",`${this.url}/factors`,{body:i,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return m?{data:null,error:m}:(t.factorType==="totp"&&u.type==="totp"&&(!((a=u==null?void 0:u.totp)===null||a===void 0)&&a.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),{data:u,error:null})})}catch(n){if(la(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:a,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"?Iat(t.webauthn.credential_response):Pat(t.webauthn.credential_response)})}:{code:t.code}),{data:i,error:u}=await za(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return u?{data:null,error:u}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+i.expires_in},i)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",i),{data:i,error:u})})}catch(n){if(la(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:a,error:o}=n;if(o)return{data:null,error:o};const l=await za(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:i}=l;if(i.type!=="webauthn")return{data:i,error:null};switch(i.webauthn.type){case"create":return{data:Object.assign(Object.assign({},i),{webauthn:Object.assign(Object.assign({},i.webauthn),{credential_options:Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:Aat(i.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},i),{webauthn:Object.assign(Object.assign({},i.webauthn),{credential_options:Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:Eat(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(la(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 a={all:[],phone:[],totp:[],webauthn:[]};for(const o of(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])a.all.push(o),o.status==="verified"&&a[o.factor_type].push(o);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(){var t,n;const{data:{session:s},error:a}=await this.getSession();if(a)return{data:null,error:a};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Mce(s.access_token);let l=null;o.aal&&(l=o.aal);let i=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&&(i="aal2");const m=o.amr||[];return{data:{currentLevel:l,nextLevel:i,currentAuthenticationMethods:m},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:s},error:a}=n;return a?{data:null,error:a}:s?await za(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 np}})}catch(n){if(la(n))return{data:null,error:n};throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:a},error:o}=s;if(o)return{data:null,error:o};if(!a)return{data:null,error:new np};const l=await za(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&$u()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(la(s))return{data:null,error:s};throw s}}async _denyAuthorization(t,n){try{return await this._useSession(async s=>{const{data:{session:a},error:o}=s;if(o)return{data:null,error:o};if(!a)return{data:null,error:new np};const l=await za(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&$u()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(la(s))return{data:null,error:s};throw s}}async fetchJwk(t,n={keys:[]}){let s=n.keys.find(i=>i.kid===t);if(s)return s;const a=Date.now();if(s=this.jwks.keys.find(i=>i.kid===t),s&&this.jwks_cached_at+$st>a)return s;const{data:o,error:l}=await za(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=a,s=o.keys.find(i=>i.kid===t),!s)?null:s}async getClaims(t,n={}){try{let s=t;if(!s){const{data:b,error:N}=await this.getSession();if(N||!b.session)return{data:null,error:N};s=b.session.access_token}const{header:a,payload:o,signature:l,raw:{header:i,payload:u}}=Mce(s);n!=null&&n.allowExpired||cat(o.exp);const m=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!m){const{error:b}=await this.getUser(s);if(b)throw b;return{data:{claims:o,header:a,signature:l},error:null}}const x=dat(a.alg),y=await crypto.subtle.importKey("jwk",m,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,Yst(`${i}.${u}`)))throw new tme("Invalid JWT signature");return{data:{claims:o,header:a,signature:l},error:null}}catch(s){if(la(s))return{data:null,error:s};throw s}}}AE.nextInstanceID=0;const Uat=AE;class qat extends Uat{constructor(t){super(t)}}class Vat{constructor(t,n,s){var a,o,l;this.supabaseUrl=t,this.supabaseKey=n;const i=Dst(t);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const u=`sb-${i.hostname.split(".")[0]}-auth-token`,m={db:Mst,realtime:Ast,auth:Object.assign(Object.assign({},Tst),{storageKey:u}),global:Cst},x=Ost(s??{},m);this.storageKey=(a=x.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(o=x.global.headers)!==null&&o!==void 0?o:{},x.accessToken?(this.accessToken=x.accessToken,this.auth=new Proxy({},{get:(y,v)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(v)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((l=x.auth)!==null&&l!==void 0?l:{},this.headers,x.global.fetch),this.fetch=Pst(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 Rnt(new URL("rest/v1",i).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new kst(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new Tnt(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:a,userStorage:o,storageKey:l,flowType:i,lock:u,debug:m},x,y){const v={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new qat({url:this.authUrl.href,headers:Object.assign(Object.assign({},v),x),storageKey:l,autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:a,userStorage:o,flowType:i,lock:u,debug:m,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(b=>b.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new est(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 Hat=(e,t,n)=>new Vat(e,t,n);function Wat(){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}Wat()&&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 Gat="https://relzejiswnotikjgvjhz.supabase.co",Kat="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",Y=Hat(Gat,Kat,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),tLe=A.createContext(void 0),Zat=({children:e})=>{const[t,n]=A.useState(null),[s,a]=A.useState(null),[o,l]=A.useState(!0),[i,u]=A.useState(!1),[m,x]=A.useState(!1),[y,v]=A.useState(null),[b,N]=A.useState([]),[k,M]=A.useState(null),I=Vn(),T=async U=>{try{console.log("Checking roles via RPC for user:",U);const[{data:V,error:W},{data:G,error:ee}]=await Promise.all([Y.rpc("has_role",{_user_id:U,_role:"admin"}),Y.rpc("has_role",{_user_id:U,_role:"brokerage_manager"})]);if(W||ee)console.error("Role RPC errors:",{isAdminError:W,isBrokerError:ee}),u(!1),x(!1);else{const pe=!!V,ne=!!G;console.log("RPC roles result:",{adminValue:pe,brokerValue:ne}),u(pe),x(ne)}const{data:ae,error:oe}=await Y.from("profiles").select("brokerage_id").eq("id",U).single();if(v(!oe&&ae?ae.brokerage_id:null),G){console.log("Fetching managed brokerages for user:",U);const{data:pe,error:ne}=await Y.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",U);if(console.log("Managed brokerage assignments result:",{assignments:pe,assignmentsError:ne}),ne||!pe){console.error("Error fetching managed brokerage assignments:",ne),N([]);return}const fe=Array.from(new Set(pe.map(xe=>xe.brokerage_id).filter(Boolean)));if(fe.length===0){N([]);return}const{data:se,error:me}=await Y.from("brokerages").select("id, name").in("id",fe);if(console.log("Managed brokerages details result:",{brokeragesData:se,brokeragesError:me}),me||!se){console.error("Error fetching managed brokerages details:",me),N([]);return}const ue=se.map(xe=>({id:xe.id,name:xe.name})).sort((xe,Te)=>fe.indexOf(xe.id)-fe.indexOf(Te.id));console.log("Parsed managed brokerages:",ue),N(ue),ue.length>0&&!k&&M(ue[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),N([])}catch(V){console.error("Unexpected error in checkRoles:",V),u(!1),x(!1),v(null),N([])}};A.useEffect(()=>{const{data:{subscription:U}}=Y.auth.onAuthStateChange((V,W)=>{console.log("Auth event:",V),a(W),n((W==null?void 0:W.user)??null),V==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{I("/profile?reset=true")},100)),W!=null&&W.user?setTimeout(()=>{T(W.user.id)},0):(u(!1),x(!1),v(null),N([]),M(null))});return Y.auth.getSession().then(({data:{session:V}})=>{a(V),n((V==null?void 0:V.user)??null),V!=null&&V.user?T(V.user.id).finally(()=>{l(!1)}):l(!1)}),()=>U.unsubscribe()},[]);const P=async(U,V)=>{const{error:W}=await Y.auth.signInWithPassword({email:U,password:V});if(W)throw Ae.error(W.message),W;Ae.success("Welcome back!"),I("/dashboard")},F=async(U,V,W)=>{const G=`${window.location.origin}/dashboard`,{error:ee}=await Y.auth.signUp({email:U,password:V,options:{emailRedirectTo:G,data:{name:W}}});if(ee)throw Ae.error(ee.message),ee;Ae.success("Account created! Welcome to LevelUp."),I("/dashboard")},D=async()=>{try{const{data:{session:U}}=await Y.auth.getSession();if(U){const{error:V}=await Y.auth.signOut();V?V.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",V.message):(console.error("Sign out error:",V),Ae.error(V.message)):Ae.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),a(null),u(!1),x(!1),v(null),N([]),M(null),I("/auth")}catch(U){console.error("Unexpected sign out error:",U),I("/auth")}};return r.jsx(tLe.Provider,{value:{user:t,session:s,loading:o,signIn:P,signUp:F,signOut:D,isAdmin:i,isBrokerageManager:m,brokerageId:y,managedBrokerages:b,selectedBrokerageId:k,setSelectedBrokerageId:M},children:e})},tn=()=>{const e=A.useContext(tLe);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},rLe=A.createContext(void 0),C_="levelup_admin_session",F0="levelup_impersonation",Yat=({children:e})=>{const[t,n]=A.useState(!1),[s,a]=A.useState(null),[o,l]=A.useState(!1);A.useEffect(()=>{const m=sessionStorage.getItem(F0);if(m)try{const x=JSON.parse(m);n(!0),a(x)}catch{sessionStorage.removeItem(F0)}},[]);const i=async m=>{l(!0);try{const{data:{session:x}}=await Y.auth.getSession();if(!x)return Ae.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(C_,JSON.stringify(y));const v=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:m})}),b=await v.json();if(!v.ok)throw new Error(b.error||"Failed to impersonate user");const N={id:b.targetUser.id,name:b.targetUser.name,email:b.targetUser.email};if(sessionStorage.setItem(F0,JSON.stringify(N)),b.method==="session"){const{error:k}=await Y.auth.setSession({access_token:b.access_token,refresh_token:b.refresh_token});if(k)throw console.error("Set session error:",k),sessionStorage.removeItem(C_),sessionStorage.removeItem(F0),new Error("Failed to establish impersonation session")}else{const k=b.type||"recovery",{error:M}=await Y.auth.verifyOtp({token_hash:b.token_hash,type:k});if(M)throw console.error("Verify OTP error:",M),sessionStorage.removeItem(C_),sessionStorage.removeItem(F0),new Error("Failed to establish impersonation session")}return n(!0),a(N),Ae.success(`Now viewing as ${N.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),Ae.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(C_),sessionStorage.removeItem(F0),!1}finally{l(!1)}},u=async()=>{l(!0);try{const m=sessionStorage.getItem(C_);if(!m){await Y.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(m);await Y.auth.signOut();const{error:y}=await Y.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(C_),sessionStorage.removeItem(F0),y){console.error("Failed to restore admin session:",y),Ae.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),a(null),Ae.success("Returned to admin account"),window.location.href="/admin/members"}catch(m){console.error("Stop impersonation error:",m),Ae.error("Failed to restore admin session"),sessionStorage.removeItem(C_),sessionStorage.removeItem(F0),window.location.href="/auth"}finally{l(!1)}};return r.jsx(rLe.Provider,{value:{isImpersonating:t,impersonatedUser:s,startImpersonation:i,stopImpersonation:u,isLoading:o},children:e})},Pxe=()=>{const e=A.useContext(rLe);if(e===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return e},EE=x3("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"}}),Q=A.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...a},o)=>{const l=s?Qge:"button";return r.jsx(l,{className:Ut(EE({variant:t,size:n,className:e})),ref:o,...a})});Q.displayName="Button";const Xat=()=>{const{isImpersonating:e,impersonatedUser:t,stopImpersonation:n,isLoading:s}=Pxe();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(Nh,{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(Q,{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(Gr,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(ds,{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"})]})})]})})},nLe=A.createContext(void 0),sT="levelup_acting_as",Qat=({children:e})=>{const{user:t}=tn(),[n,s]=A.useState(!1),[a,o]=A.useState([]),[l,i]=A.useState(null),[u,m]=A.useState({}),[x,y]=A.useState(!0);A.useEffect(()=>{if(!(t!=null&&t.id)){s(!1),o([]),i(null),m({}),y(!1);return}(async()=>{y(!0);try{const{data:M}=await Y.rpc("has_role",{_user_id:t.id,_role:"assistant"});if(!M){s(!1),o([]),i(null),m({}),y(!1);return}s(!0);const{data:I,error:T}=await Y.from("agent_assistant_assignments").select("agent_id, permissions").eq("assistant_id",t.id);if(T||!I||I.length===0){o([]),y(!1);return}const P=I.map(V=>V.agent_id),{data:F}=await Y.from("profiles").select("id, name, email, avatar_url").in("id",P),D=(F||[]).map(V=>({id:V.id,name:V.name||V.email||"Unknown",email:V.email||"",avatar_url:V.avatar_url}));o(D);const U=sessionStorage.getItem(sT);if(U){const V=D.find(W=>W.id===U);if(V){i(V);const W=I.find(G=>G.agent_id===U);m((W==null?void 0:W.permissions)||{})}else if(D.length>0){i(D[0]);const W=I.find(G=>G.agent_id===D[0].id);m((W==null?void 0:W.permissions)||{}),sessionStorage.setItem(sT,D[0].id)}}else if(D.length>0){i(D[0]);const V=I.find(W=>W.agent_id===D[0].id);m((V==null?void 0:V.permissions)||{}),sessionStorage.setItem(sT,D[0].id)}}catch(M){console.error("Error loading assistant data:",M)}finally{y(!1)}})()},[t==null?void 0:t.id]);const v=k=>{i(k),k?(sessionStorage.setItem(sT,k.id),Y.from("agent_assistant_assignments").select("permissions").eq("assistant_id",(t==null?void 0:t.id)||"").eq("agent_id",k.id).single().then(({data:M})=>{m((M==null?void 0:M.permissions)||{})})):(sessionStorage.removeItem(sT),m({}))},b=k=>n?u[k]===!0:!0,N=n&&l?l.id:(t==null?void 0:t.id)||null;return r.jsx(nLe.Provider,{value:{isAssistant:n,assignedAgents:a,actingAsAgent:l,setActingAsAgent:v,effectiveUserId:N,permissions:u,hasPermission:b,isLoading:x},children:e})},Lxe=()=>{const e=A.useContext(nLe);if(e===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return e},Yc=()=>{const{effectiveUserId:e}=Lxe();return e};var sLe={exports:{}},aLe={};/** * @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 TC=A;function Jat(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var eit=typeof Object.is=="function"?Object.is:Jat,tit=TC.useState,rit=TC.useEffect,nit=TC.useLayoutEffect,sit=TC.useDebugValue;function ait(e,t){var n=t(),s=tit({inst:{value:n,getSnapshot:t}}),a=s[0].inst,o=s[1];return nit(function(){a.value=n,a.getSnapshot=t,Ece(a)&&o({inst:a})},[e,n,t]),rit(function(){return Ece(a)&&o({inst:a}),e(function(){Ece(a)&&o({inst:a})})},[e]),sit(n),n}function Ece(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!eit(e,n)}catch{return!0}}function iit(e,t){return t()}var oit=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?iit:ait;aLe.useSyncExternalStore=TC.useSyncExternalStore!==void 0?TC.useSyncExternalStore:oit;sLe.exports=aLe;var lit=sLe.exports;function cit(){return lit.useSyncExternalStore(dit,()=>!0,()=>!1)}function dit(){return()=>{}}var Oxe="Avatar",[uit]=cc(Oxe),[hit,iLe]=uit(Oxe),oLe=A.forwardRef((e,t)=>{const{__scopeAvatar:n,...s}=e,[a,o]=A.useState("idle");return r.jsx(hit,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:r.jsx(Fn.span,{...s,ref:t})})});oLe.displayName=Oxe;var lLe="AvatarImage",cLe=A.forwardRef((e,t)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:a=()=>{},...o}=e,l=iLe(lLe,n),i=mit(s,o),u=sc(m=>{a(m),l.onImageLoadingStatusChange(m)});return oc(()=>{i!=="idle"&&u(i)},[i,u]),i==="loaded"?r.jsx(Fn.img,{...o,ref:t,src:s}):null});cLe.displayName=lLe;var dLe="AvatarFallback",uLe=A.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:s,...a}=e,o=iLe(dLe,n),[l,i]=A.useState(s===void 0);return A.useEffect(()=>{if(s!==void 0){const u=window.setTimeout(()=>i(!0),s);return()=>window.clearTimeout(u)}},[s]),l&&o.imageLoadingStatus!=="loaded"?r.jsx(Fn.span,{...a,ref:t}):null});uLe.displayName=dLe;function Pke(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function mit(e,{referrerPolicy:t,crossOrigin:n}){const s=cit(),a=A.useRef(null),o=s?(a.current||(a.current=new window.Image),a.current):null,[l,i]=A.useState(()=>Pke(o,e));return oc(()=>{i(Pke(o,e))},[o,e]),oc(()=>{const u=y=>()=>{i(y)};if(!o)return;const m=u("loaded"),x=u("error");return o.addEventListener("load",m),o.addEventListener("error",x),t&&(o.referrerPolicy=t),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",m),o.removeEventListener("error",x)}},[o,n,t]),l}var hLe=oLe,mLe=cLe,fLe=uLe;const ea=A.forwardRef(({className:e,...t},n)=>r.jsx(hLe,{ref:n,className:Ut("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ea.displayName=hLe.displayName;const Ci=A.forwardRef(({className:e,...t},n)=>r.jsx(mLe,{ref:n,className:Ut("aspect-square h-full w-full",e),...t}));Ci.displayName=mLe.displayName;const ta=A.forwardRef(({className:e,...t},n)=>r.jsx(fLe,{ref:n,className:Ut("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ta.displayName=fLe.displayName;const fit=x3("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 At({className:e,variant:t,...n}){return r.jsx("div",{className:Ut(fit({variant:t}),e),...n})}var pit=A.createContext(void 0);function Mk(e){const t=A.useContext(pit);return e||t||"ltr"}var Ice=0;function Cse(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Lke()),document.body.insertAdjacentElement("beforeend",e[1]??Lke()),Ice++,()=>{Ice===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ice--}},[])}function Lke(){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 Pce="focusScope.autoFocusOnMount",Lce="focusScope.autoFocusOnUnmount",Oke={bubbles:!1,cancelable:!0},git="FocusScope",eP=A.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[i,u]=A.useState(null),m=sc(a),x=sc(o),y=A.useRef(null),v=ca(t,k=>u(k)),b=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(s){let k=function(P){if(b.paused||!i)return;const F=P.target;i.contains(F)?y.current=F:U0(y.current,{select:!0})},M=function(P){if(b.paused||!i)return;const F=P.relatedTarget;F!==null&&(i.contains(F)||U0(y.current,{select:!0}))},I=function(P){if(document.activeElement===document.body)for(const D of P)D.removedNodes.length>0&&U0(i)};document.addEventListener("focusin",k),document.addEventListener("focusout",M);const T=new MutationObserver(I);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",M),T.disconnect()}}},[s,i,b.paused]),A.useEffect(()=>{if(i){Rke.add(b);const k=document.activeElement;if(!i.contains(k)){const I=new CustomEvent(Pce,Oke);i.addEventListener(Pce,m),i.dispatchEvent(I),I.defaultPrevented||(xit(wit(pLe(i)),{select:!0}),document.activeElement===k&&U0(i))}return()=>{i.removeEventListener(Pce,m),setTimeout(()=>{const I=new CustomEvent(Lce,Oke);i.addEventListener(Lce,x),i.dispatchEvent(I),I.defaultPrevented||U0(k??document.body,{select:!0}),i.removeEventListener(Lce,x),Rke.remove(b)},0)}}},[i,m,x,b]);const N=A.useCallback(k=>{if(!n&&!s||b.paused)return;const M=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,I=document.activeElement;if(M&&I){const T=k.currentTarget,[P,F]=yit(T);P&&F?!k.shiftKey&&I===F?(k.preventDefault(),n&&U0(P,{select:!0})):k.shiftKey&&I===P&&(k.preventDefault(),n&&U0(F,{select:!0})):I===T&&k.preventDefault()}},[n,s,b.paused]);return r.jsx(Fn.div,{tabIndex:-1,...l,ref:v,onKeyDown:N})});eP.displayName=git;function xit(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(U0(s,{select:t}),document.activeElement!==n)return}function yit(e){const t=pLe(e),n=Dke(t,e),s=Dke(t.reverse(),e);return[n,s]}function pLe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dke(e,t){for(const n of e)if(!vit(n,{upTo:t}))return n}function vit(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 _it(e){return e instanceof HTMLInputElement&&"select"in e}function U0(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_it(e)&&t&&e.select()}}var Rke=bit();function bit(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Fke(e,t),e.unshift(t)},remove(t){var n;e=Fke(e,t),(n=e[0])==null||n.resume()}}}function Fke(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function wit(e){return e.filter(t=>t.tagName!=="A")}var Oce="rovingFocusGroup.onEntryFocus",jit={bubbles:!1,cancelable:!0},tP="RovingFocusGroup",[rme,gLe,kit]=HI(tP),[Nit,M3]=cc(tP,[kit]),[Sit,Cit]=Nit(tP),xLe=A.forwardRef((e,t)=>r.jsx(rme.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(rme.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Mit,{...e,ref:t})})}));xLe.displayName=tP;var Mit=A.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:u,onEntryFocus:m,preventScrollOnEntryFocus:x=!1,...y}=e,v=A.useRef(null),b=ca(t,v),N=Mk(o),[k,M]=rh({prop:l,defaultProp:i??null,onChange:u,caller:tP}),[I,T]=A.useState(!1),P=sc(m),F=gLe(n),D=A.useRef(!1),[U,V]=A.useState(0);return A.useEffect(()=>{const W=v.current;if(W)return W.addEventListener(Oce,P),()=>W.removeEventListener(Oce,P)},[P]),r.jsx(Sit,{scope:n,orientation:s,dir:N,loop:a,currentTabStopId:k,onItemFocus:A.useCallback(W=>M(W),[M]),onItemShiftTab:A.useCallback(()=>T(!0),[]),onFocusableItemAdd:A.useCallback(()=>V(W=>W+1),[]),onFocusableItemRemove:A.useCallback(()=>V(W=>W-1),[]),children:r.jsx(Fn.div,{tabIndex:I||U===0?-1:0,"data-orientation":s,...y,ref:b,style:{outline:"none",...e.style},onMouseDown:gn(e.onMouseDown,()=>{D.current=!0}),onFocus:gn(e.onFocus,W=>{const G=!D.current;if(W.target===W.currentTarget&&G&&!I){const ee=new CustomEvent(Oce,jit);if(W.currentTarget.dispatchEvent(ee),!ee.defaultPrevented){const ae=F().filter(se=>se.focusable),oe=ae.find(se=>se.active),pe=ae.find(se=>se.id===k),fe=[oe,pe,...ae].filter(Boolean).map(se=>se.ref.current);_Le(fe,x)}}D.current=!1}),onBlur:gn(e.onBlur,()=>T(!1))})})}),yLe="RovingFocusGroupItem",vLe=A.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:o,children:l,...i}=e,u=pd(),m=o||u,x=Cit(yLe,n),y=x.currentTabStopId===m,v=gLe(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:k}=x;return A.useEffect(()=>{if(s)return b(),()=>N()},[s,b,N]),r.jsx(rme.ItemSlot,{scope:n,id:m,focusable:s,active:a,children:r.jsx(Fn.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...i,ref:t,onMouseDown:gn(e.onMouseDown,M=>{s?x.onItemFocus(m):M.preventDefault()}),onFocus:gn(e.onFocus,()=>x.onItemFocus(m)),onKeyDown:gn(e.onKeyDown,M=>{if(M.key==="Tab"&&M.shiftKey){x.onItemShiftTab();return}if(M.target!==M.currentTarget)return;const I=Eit(M,x.orientation,x.dir);if(I!==void 0){if(M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;M.preventDefault();let P=v().filter(F=>F.focusable).map(F=>F.ref.current);if(I==="last")P.reverse();else if(I==="prev"||I==="next"){I==="prev"&&P.reverse();const F=P.indexOf(M.currentTarget);P=x.loop?Iit(P,F+1):P.slice(F+1)}setTimeout(()=>_Le(P))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:k!=null}):l})})});vLe.displayName=yLe;var Tit={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ait(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Eit(e,t,n){const s=Ait(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Tit[s]}function _Le(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function Iit(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Dxe=xLe,Rxe=vLe,Pit=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},kS=new WeakMap,rO=new WeakMap,nO={},Dce=0,bLe=function(e){return e&&(e.host||bLe(e.parentNode))},Lit=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=bLe(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})},Oit=function(e,t,n,s){var a=Lit(t,Array.isArray(e)?e:[e]);nO[n]||(nO[n]=new WeakMap);var o=nO[n],l=[],i=new Set,u=new Set(a),m=function(y){!y||i.has(y)||(i.add(y),m(y.parentNode))};a.forEach(m);var x=function(y){!y||u.has(y)||Array.prototype.forEach.call(y.children,function(v){if(i.has(v))x(v);else try{var b=v.getAttribute(s),N=b!==null&&b!=="false",k=(kS.get(v)||0)+1,M=(o.get(v)||0)+1;kS.set(v,k),o.set(v,M),l.push(v),k===1&&N&&rO.set(v,!0),M===1&&v.setAttribute(n,"true"),N||v.setAttribute(s,"true")}catch(I){console.error("aria-hidden: cannot operate on ",v,I)}})};return x(t),i.clear(),Dce++,function(){l.forEach(function(y){var v=kS.get(y)-1,b=o.get(y)-1;kS.set(y,v),o.set(y,b),v||(rO.has(y)||y.removeAttribute(s),rO.delete(y)),b||y.removeAttribute(n)}),Dce--,Dce||(kS=new WeakMap,kS=new WeakMap,rO=new WeakMap,nO={})}},Mse=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=Pit(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),Oit(s,a,n,"aria-hidden")):function(){return null}},Bee="right-scroll-bar-position",$ee="width-before-scroll-bar",Dit="with-scroll-bars-hidden",Rit="--removed-body-scroll-bar-size";function Rce(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Fit(e,t){var n=A.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var a=n.value;a!==s&&(n.value=s,n.callback(s,a))}}}})[0];return n.callback=t,n.facade}var zit=typeof window<"u"?A.useLayoutEffect:A.useEffect,zke=new WeakMap;function Bit(e,t){var n=Fit(null,function(s){return e.forEach(function(a){return Rce(a,s)})});return zit(function(){var s=zke.get(n);if(s){var a=new Set(s),o=new Set(e),l=n.current;a.forEach(function(i){o.has(i)||Rce(i,null)}),o.forEach(function(i){a.has(i)||Rce(i,l)})}zke.set(n,e)},[e]),n}function $it(e){return e}function Uit(e,t){t===void 0&&(t=$it);var n=[],s=!1,a={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(i){return i!==l})}},assignSyncMedium:function(o){for(s=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(i){return o(i)},filter:function(){return n}}},assignMedium:function(o){s=!0;var l=[];if(n.length){var i=n;n=[],i.forEach(o),l=n}var u=function(){var x=l;l=[],x.forEach(o)},m=function(){return Promise.resolve().then(u)};m(),n={push:function(x){l.push(x),m()},filter:function(x){return l=l.filter(x),n}}}};return a}function qit(e){e===void 0&&(e={});var t=Uit(null);return t.options=nf({async:!0,ssr:!1},e),t}var wLe=function(e){var t=e.sideCar,n=kv(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 A.createElement(s,nf({},n))};wLe.isSideCarExport=!0;function Vit(e,t){return e.useMedium(t),wLe}var jLe=qit(),Fce=function(){},Tse=A.forwardRef(function(e,t){var n=A.useRef(null),s=A.useState({onScrollCapture:Fce,onWheelCapture:Fce,onTouchMoveCapture:Fce}),a=s[0],o=s[1],l=e.forwardProps,i=e.children,u=e.className,m=e.removeScrollBar,x=e.enabled,y=e.shards,v=e.sideCar,b=e.noRelative,N=e.noIsolation,k=e.inert,M=e.allowPinchZoom,I=e.as,T=I===void 0?"div":I,P=e.gapMode,F=kv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=v,U=Bit([n,t]),V=nf(nf({},F),a);return A.createElement(A.Fragment,null,x&&A.createElement(D,{sideCar:jLe,removeScrollBar:m,shards:y,noRelative:b,noIsolation:N,inert:k,setCallbacks:o,allowPinchZoom:!!M,lockRef:n,gapMode:P}),l?A.cloneElement(A.Children.only(i),nf(nf({},V),{ref:U})):A.createElement(T,nf({},V,{className:u,ref:U}),i))});Tse.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Tse.classNames={fullWidth:$ee,zeroRight:Bee};var Hit=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Wit(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Hit();return t&&e.setAttribute("nonce",t),e}function Git(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Kit(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Zit=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Wit())&&(Git(t,n),Kit(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Yit=function(){var e=Zit();return function(t,n){A.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},kLe=function(){var e=Yit(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},Xit={left:0,top:0,right:0,gap:0},zce=function(e){return parseInt(e||"",10)||0},Qit=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[zce(n),zce(s),zce(a)]},Jit=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Xit;var t=Qit(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])}},eot=kLe(),H4="data-scroll-locked",tot=function(e,t,n,s){var a=e.left,o=e.top,l=e.right,i=e.gap;return n===void 0&&(n="margin"),` .`.concat(Dit,` { overflow: hidden `).concat(s,`; padding-right: `).concat(i,"px ").concat(s,`; } body[`).concat(H4,`] { overflow: hidden `).concat(s,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&` padding-left: `.concat(a,`px; padding-top: `).concat(o,`px; padding-right: `).concat(l,`px; margin-left:0; margin-top:0; margin-right: `).concat(i,"px ").concat(s,`; `),n==="padding"&&"padding-right: ".concat(i,"px ").concat(s,";")].filter(Boolean).join(""),` } .`).concat(Bee,` { right: `).concat(i,"px ").concat(s,`; } .`).concat($ee,` { margin-right: `).concat(i,"px ").concat(s,`; } .`).concat(Bee," .").concat(Bee,` { right: 0 `).concat(s,`; } .`).concat($ee," .").concat($ee,` { margin-right: 0 `).concat(s,`; } body[`).concat(H4,`] { `).concat(Rit,": ").concat(i,`px; } `)},Bke=function(){var e=parseInt(document.body.getAttribute(H4)||"0",10);return isFinite(e)?e:0},rot=function(){A.useEffect(function(){return document.body.setAttribute(H4,(Bke()+1).toString()),function(){var e=Bke()-1;e<=0?document.body.removeAttribute(H4):document.body.setAttribute(H4,e.toString())}},[])},not=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;rot();var o=A.useMemo(function(){return Jit(a)},[a]);return A.createElement(eot,{styles:tot(o,!t,a,n?"":"!important")})},nme=!1;if(typeof window<"u")try{var sO=Object.defineProperty({},"passive",{get:function(){return nme=!0,!0}});window.addEventListener("test",sO,sO),window.removeEventListener("test",sO,sO)}catch{nme=!1}var NS=nme?{passive:!1}:!1,sot=function(e){return e.tagName==="TEXTAREA"},NLe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!sot(e)&&n[t]==="visible")},aot=function(e){return NLe(e,"overflowY")},iot=function(e){return NLe(e,"overflowX")},$ke=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=SLe(e,s);if(a){var o=CLe(e,s),l=o[1],i=o[2];if(l>i)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},oot=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},lot=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},SLe=function(e,t){return e==="v"?aot(t):iot(t)},CLe=function(e,t){return e==="v"?oot(t):lot(t)},cot=function(e,t){return e==="h"&&t==="rtl"?-1:1},dot=function(e,t,n,s,a){var o=cot(e,window.getComputedStyle(t).direction),l=o*s,i=n.target,u=t.contains(i),m=!1,x=l>0,y=0,v=0;do{if(!i)break;var b=CLe(e,i),N=b[0],k=b[1],M=b[2],I=k-M-o*N;(N||I)&&SLe(e,i)&&(y+=I,v+=N);var T=i.parentNode;i=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&i!==document.body||u&&(t.contains(i)||t===i));return(x&&Math.abs(y)<1||!x&&Math.abs(v)<1)&&(m=!0),m},aO=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Uke=function(e){return[e.deltaX,e.deltaY]},qke=function(e){return e&&"current"in e?e.current:e},uot=function(e,t){return e[0]===t[0]&&e[1]===t[1]},hot=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},mot=0,SS=[];function fot(e){var t=A.useRef([]),n=A.useRef([0,0]),s=A.useRef(),a=A.useState(mot++)[0],o=A.useState(kLe)[0],l=A.useRef(e);A.useEffect(function(){l.current=e},[e]),A.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var k=kxe([e.lockRef.current],(e.shards||[]).map(qke),!0).filter(Boolean);return k.forEach(function(M){return M.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),k.forEach(function(M){return M.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var i=A.useCallback(function(k,M){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!l.current.allowPinchZoom;var I=aO(k),T=n.current,P="deltaX"in k?k.deltaX:T[0]-I[0],F="deltaY"in k?k.deltaY:T[1]-I[1],D,U=k.target,V=Math.abs(P)>Math.abs(F)?"h":"v";if("touches"in k&&V==="h"&&U.type==="range")return!1;var W=$ke(V,U);if(!W)return!0;if(W?D=V:(D=V==="v"?"h":"v",W=$ke(V,U)),!W)return!1;if(!s.current&&"changedTouches"in k&&(P||F)&&(s.current=D),!D)return!0;var G=s.current||D;return dot(G,M,k,G==="h"?P:F)},[]),u=A.useCallback(function(k){var M=k;if(!(!SS.length||SS[SS.length-1]!==o)){var I="deltaY"in M?Uke(M):aO(M),T=t.current.filter(function(D){return D.name===M.type&&(D.target===M.target||M.target===D.shadowParent)&&uot(D.delta,I)})[0];if(T&&T.should){M.cancelable&&M.preventDefault();return}if(!T){var P=(l.current.shards||[]).map(qke).filter(Boolean).filter(function(D){return D.contains(M.target)}),F=P.length>0?i(M,P[0]):!l.current.noIsolation;F&&M.cancelable&&M.preventDefault()}}},[]),m=A.useCallback(function(k,M,I,T){var P={name:k,delta:M,target:I,should:T,shadowParent:pot(I)};t.current.push(P),setTimeout(function(){t.current=t.current.filter(function(F){return F!==P})},1)},[]),x=A.useCallback(function(k){n.current=aO(k),s.current=void 0},[]),y=A.useCallback(function(k){m(k.type,Uke(k),k.target,i(k,e.lockRef.current))},[]),v=A.useCallback(function(k){m(k.type,aO(k),k.target,i(k,e.lockRef.current))},[]);A.useEffect(function(){return SS.push(o),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:v}),document.addEventListener("wheel",u,NS),document.addEventListener("touchmove",u,NS),document.addEventListener("touchstart",x,NS),function(){SS=SS.filter(function(k){return k!==o}),document.removeEventListener("wheel",u,NS),document.removeEventListener("touchmove",u,NS),document.removeEventListener("touchstart",x,NS)}},[]);var b=e.removeScrollBar,N=e.inert;return A.createElement(A.Fragment,null,N?A.createElement(o,{styles:hot(a)}):null,b?A.createElement(not,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function pot(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const got=Vit(jLe,fot);var rP=A.forwardRef(function(e,t){return A.createElement(Tse,nf({},e,{ref:t,sideCar:got}))});rP.classNames=Tse.classNames;var sme=["Enter"," "],xot=["ArrowDown","PageUp","Home"],MLe=["ArrowUp","PageDown","End"],yot=[...xot,...MLe],vot={ltr:[...sme,"ArrowRight"],rtl:[...sme,"ArrowLeft"]},_ot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nP="Menu",[IE,bot,wot]=HI(nP),[Tk,TLe]=cc(nP,[wot,ax,M3]),Ase=ax(),ALe=M3(),[jot,Ak]=Tk(nP),[kot,sP]=Tk(nP),ELe=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:a,onOpenChange:o,modal:l=!0}=e,i=Ase(t),[u,m]=A.useState(null),x=A.useRef(!1),y=sc(o),v=Mk(a);return A.useEffect(()=>{const b=()=>{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",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",N,{capture:!0}),document.removeEventListener("pointermove",N,{capture:!0})}},[]),r.jsx(ZI,{...i,children:r.jsx(jot,{scope:t,open:n,onOpenChange:y,content:u,onContentChange:m,children:r.jsx(kot,{scope:t,onClose:A.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:v,modal:l,children:s})})})};ELe.displayName=nP;var Not="MenuAnchor",Fxe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Ase(n);return r.jsx(b3,{...a,...s,ref:t})});Fxe.displayName=Not;var zxe="MenuPortal",[Sot,ILe]=Tk(zxe,{forceMount:void 0}),PLe=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:a}=e,o=Ak(zxe,t);return r.jsx(Sot,{scope:t,forceMount:n,children:r.jsx(Ac,{present:n||o.open,children:r.jsx(g3,{asChild:!0,container:a,children:s})})})};PLe.displayName=zxe;var pf="MenuContent",[Cot,Bxe]=Tk(pf),LLe=A.forwardRef((e,t)=>{const n=ILe(pf,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,o=Ak(pf,e.__scopeMenu),l=sP(pf,e.__scopeMenu);return r.jsx(IE.Provider,{scope:e.__scopeMenu,children:r.jsx(Ac,{present:s||o.open,children:r.jsx(IE.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(Mot,{...a,ref:t}):r.jsx(Tot,{...a,ref:t})})})})}),Mot=A.forwardRef((e,t)=>{const n=Ak(pf,e.__scopeMenu),s=A.useRef(null),a=ca(t,s);return A.useEffect(()=>{const o=s.current;if(o)return Mse(o)},[]),r.jsx($xe,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:gn(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tot=A.forwardRef((e,t)=>{const n=Ak(pf,e.__scopeMenu);return r.jsx($xe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Aot=uv("MenuContent.ScrollLock"),$xe=A.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:u,onEscapeKeyDown:m,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:v,onDismiss:b,disableOutsideScroll:N,...k}=e,M=Ak(pf,n),I=sP(pf,n),T=Ase(n),P=ALe(n),F=bot(n),[D,U]=A.useState(null),V=A.useRef(null),W=ca(t,V,M.onContentChange),G=A.useRef(0),ee=A.useRef(""),ae=A.useRef(0),oe=A.useRef(null),pe=A.useRef("right"),ne=A.useRef(0),fe=N?rP:A.Fragment,se=N?{as:Aot,allowPinchZoom:!0}:void 0,me=xe=>{var $e,Be;const Te=ee.current+xe,_e=F().filter(Ve=>!Ve.disabled),we=document.activeElement,ve=($e=_e.find(Ve=>Ve.ref.current===we))==null?void 0:$e.textValue,Xe=_e.map(Ve=>Ve.textValue),Me=Uot(Xe,Te,ve),Ie=(Be=_e.find(Ve=>Ve.textValue===Me))==null?void 0:Be.ref.current;(function Ve(ot){ee.current=ot,window.clearTimeout(G.current),ot!==""&&(G.current=window.setTimeout(()=>Ve(""),1e3))})(Te),Ie&&setTimeout(()=>Ie.focus())};A.useEffect(()=>()=>window.clearTimeout(G.current),[]),Cse();const ue=A.useCallback(xe=>{var _e,we;return pe.current===((_e=oe.current)==null?void 0:_e.side)&&Vot(xe,(we=oe.current)==null?void 0:we.area)},[]);return r.jsx(Cot,{scope:n,searchRef:ee,onItemEnter:A.useCallback(xe=>{ue(xe)&&xe.preventDefault()},[ue]),onItemLeave:A.useCallback(xe=>{var Te;ue(xe)||((Te=V.current)==null||Te.focus(),U(null))},[ue]),onTriggerLeave:A.useCallback(xe=>{ue(xe)&&xe.preventDefault()},[ue]),pointerGraceTimerRef:ae,onPointerGraceIntentChange:A.useCallback(xe=>{oe.current=xe},[]),children:r.jsx(fe,{...se,children:r.jsx(eP,{asChild:!0,trapped:a,onMountAutoFocus:gn(o,xe=>{var Te;xe.preventDefault(),(Te=V.current)==null||Te.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(wv,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:m,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:v,onDismiss:b,children:r.jsx(Dxe,{asChild:!0,...P,dir:I.dir,orientation:"vertical",loop:s,currentTabStopId:D,onCurrentTabStopIdChange:U,onEntryFocus:gn(u,xe=>{I.isUsingKeyboardRef.current||xe.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(YI,{role:"menu","aria-orientation":"vertical","data-state":YLe(M.open),"data-radix-menu-content":"",dir:I.dir,...T,...k,ref:W,style:{outline:"none",...k.style},onKeyDown:gn(k.onKeyDown,xe=>{const _e=xe.target.closest("[data-radix-menu-content]")===xe.currentTarget,we=xe.ctrlKey||xe.altKey||xe.metaKey,ve=xe.key.length===1;_e&&(xe.key==="Tab"&&xe.preventDefault(),!we&&ve&&me(xe.key));const Xe=V.current;if(xe.target!==Xe||!yot.includes(xe.key))return;xe.preventDefault();const Ie=F().filter($e=>!$e.disabled).map($e=>$e.ref.current);MLe.includes(xe.key)&&Ie.reverse(),Bot(Ie)}),onBlur:gn(e.onBlur,xe=>{xe.currentTarget.contains(xe.target)||(window.clearTimeout(G.current),ee.current="")}),onPointerMove:gn(e.onPointerMove,PE(xe=>{const Te=xe.target,_e=ne.current!==xe.clientX;if(xe.currentTarget.contains(Te)&&_e){const we=xe.clientX>ne.current?"right":"left";pe.current=we,ne.current=xe.clientX}}))})})})})})})});LLe.displayName=pf;var Eot="MenuGroup",Uxe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Fn.div,{role:"group",...s,ref:t})});Uxe.displayName=Eot;var Iot="MenuLabel",OLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Fn.div,{...s,ref:t})});OLe.displayName=Iot;var Fte="MenuItem",Vke="menu.itemSelect",Ese=A.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...a}=e,o=A.useRef(null),l=sP(Fte,e.__scopeMenu),i=Bxe(Fte,e.__scopeMenu),u=ca(t,o),m=A.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const v=new CustomEvent(Vke,{bubbles:!0,cancelable:!0});y.addEventListener(Vke,b=>s==null?void 0:s(b),{once:!0}),Jge(y,v),v.defaultPrevented?m.current=!1:l.onClose()}};return r.jsx(DLe,{...a,ref:u,disabled:n,onClick:gn(e.onClick,x),onPointerDown:y=>{var v;(v=e.onPointerDown)==null||v.call(e,y),m.current=!0},onPointerUp:gn(e.onPointerUp,y=>{var v;m.current||(v=y.currentTarget)==null||v.click()}),onKeyDown:gn(e.onKeyDown,y=>{const v=i.searchRef.current!=="";n||v&&y.key===" "||sme.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});Ese.displayName=Fte;var DLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...o}=e,l=Bxe(Fte,n),i=ALe(n),u=A.useRef(null),m=ca(t,u),[x,y]=A.useState(!1),[v,b]=A.useState("");return A.useEffect(()=>{const N=u.current;N&&b((N.textContent??"").trim())},[o.children]),r.jsx(IE.ItemSlot,{scope:n,disabled:s,textValue:a??v,children:r.jsx(Rxe,{asChild:!0,...i,focusable:!s,children:r.jsx(Fn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:m,onPointerMove:gn(e.onPointerMove,PE(N=>{s?l.onItemLeave(N):(l.onItemEnter(N),N.defaultPrevented||N.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:gn(e.onPointerLeave,PE(N=>l.onItemLeave(N))),onFocus:gn(e.onFocus,()=>y(!0)),onBlur:gn(e.onBlur,()=>y(!1))})})})}),Pot="MenuCheckboxItem",RLe=A.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...a}=e;return r.jsx(ULe,{scope:e.__scopeMenu,checked:n,children:r.jsx(Ese,{role:"menuitemcheckbox","aria-checked":zte(n)?"mixed":n,...a,ref:t,"data-state":Vxe(n),onSelect:gn(a.onSelect,()=>s==null?void 0:s(zte(n)?!0:!n),{checkForDefaultPrevented:!1})})})});RLe.displayName=Pot;var FLe="MenuRadioGroup",[Lot,Oot]=Tk(FLe,{value:void 0,onValueChange:()=>{}}),zLe=A.forwardRef((e,t)=>{const{value:n,onValueChange:s,...a}=e,o=sc(s);return r.jsx(Lot,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Uxe,{...a,ref:t})})});zLe.displayName=FLe;var BLe="MenuRadioItem",$Le=A.forwardRef((e,t)=>{const{value:n,...s}=e,a=Oot(BLe,e.__scopeMenu),o=n===a.value;return r.jsx(ULe,{scope:e.__scopeMenu,checked:o,children:r.jsx(Ese,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Vxe(o),onSelect:gn(s.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,n)},{checkForDefaultPrevented:!1})})})});$Le.displayName=BLe;var qxe="MenuItemIndicator",[ULe,Dot]=Tk(qxe,{checked:!1}),qLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...a}=e,o=Dot(qxe,n);return r.jsx(Ac,{present:s||zte(o.checked)||o.checked===!0,children:r.jsx(Fn.span,{...a,ref:t,"data-state":Vxe(o.checked)})})});qLe.displayName=qxe;var Rot="MenuSeparator",VLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Fn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});VLe.displayName=Rot;var Fot="MenuArrow",HLe=A.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Ase(n);return r.jsx(XI,{...a,...s,ref:t})});HLe.displayName=Fot;var zot="MenuSub",[Qer,WLe]=Tk(zot),PT="MenuSubTrigger",GLe=A.forwardRef((e,t)=>{const n=Ak(PT,e.__scopeMenu),s=sP(PT,e.__scopeMenu),a=WLe(PT,e.__scopeMenu),o=Bxe(PT,e.__scopeMenu),l=A.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:u}=o,m={__scopeMenu:e.__scopeMenu},x=A.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return A.useEffect(()=>x,[x]),A.useEffect(()=>{const y=i.current;return()=>{window.clearTimeout(y),u(null)}},[i,u]),r.jsx(Fxe,{asChild:!0,...m,children:r.jsx(DLe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":YLe(n.open),...e,ref:My(t,a.onTriggerChange),onClick:y=>{var v;(v=e.onClick)==null||v.call(e,y),!(e.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:gn(e.onPointerMove,PE(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:gn(e.onPointerLeave,PE(y=>{var b,N;x();const v=(b=n.content)==null?void 0:b.getBoundingClientRect();if(v){const k=(N=n.content)==null?void 0:N.dataset.side,M=k==="right",I=M?-5:5,T=v[M?"left":"right"],P=v[M?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+I,y:y.clientY},{x:T,y:v.top},{x:P,y:v.top},{x:P,y:v.bottom},{x:T,y:v.bottom}],side:k}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:gn(e.onKeyDown,y=>{var b;const v=o.searchRef.current!=="";e.disabled||v&&y.key===" "||vot[s.dir].includes(y.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),y.preventDefault())})})})});GLe.displayName=PT;var KLe="MenuSubContent",ZLe=A.forwardRef((e,t)=>{const n=ILe(pf,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,o=Ak(pf,e.__scopeMenu),l=sP(pf,e.__scopeMenu),i=WLe(KLe,e.__scopeMenu),u=A.useRef(null),m=ca(t,u);return r.jsx(IE.Provider,{scope:e.__scopeMenu,children:r.jsx(Ac,{present:s||o.open,children:r.jsx(IE.Slot,{scope:e.__scopeMenu,children:r.jsx($xe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,ref:m,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{var y;l.isUsingKeyboardRef.current&&((y=u.current)==null||y.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:gn(e.onFocusOutside,x=>{x.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:gn(e.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:gn(e.onKeyDown,x=>{var b;const y=x.currentTarget.contains(x.target),v=_ot[l.dir].includes(x.key);y&&v&&(o.onOpenChange(!1),(b=i.trigger)==null||b.focus(),x.preventDefault())})})})})})});ZLe.displayName=KLe;function YLe(e){return e?"open":"closed"}function zte(e){return e==="indeterminate"}function Vxe(e){return zte(e)?"indeterminate":e?"checked":"unchecked"}function Bot(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function $ot(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function Uot(e,t,n){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=$ot(e,Math.max(o,0));a.length===1&&(l=l.filter(m=>m!==n));const u=l.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function qot(e,t){const{x:n,y:s}=e;let a=!1;for(let o=0,l=t.length-1;os!=v>s&&n<(y-m)*(s-x)/(v-x)+m&&(a=!a)}return a}function Vot(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return qot(n,t)}function PE(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Hot=ELe,Wot=Fxe,Got=PLe,Kot=LLe,Zot=Uxe,Yot=OLe,Xot=Ese,Qot=RLe,Jot=zLe,elt=$Le,tlt=qLe,rlt=VLe,nlt=HLe,slt=GLe,alt=ZLe,Ise="DropdownMenu",[ilt]=cc(Ise,[TLe]),oh=TLe(),[olt,XLe]=ilt(Ise),QLe=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=e,u=oh(t),m=A.useRef(null),[x,y]=rh({prop:a,defaultProp:o??!1,onChange:l,caller:Ise});return r.jsx(olt,{scope:t,triggerId:pd(),triggerRef:m,contentId:pd(),open:x,onOpenChange:y,onOpenToggle:A.useCallback(()=>y(v=>!v),[y]),modal:i,children:r.jsx(Hot,{...u,open:x,onOpenChange:y,dir:s,modal:i,children:n})})};QLe.displayName=Ise;var JLe="DropdownMenuTrigger",eOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=e,o=XLe(JLe,n),l=oh(n);return r.jsx(Wot,{asChild:!0,...l,children:r.jsx(Fn.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,...a,ref:My(t,o.triggerRef),onPointerDown:gn(e.onPointerDown,i=>{!s&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:gn(e.onKeyDown,i=>{s||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});eOe.displayName=JLe;var llt="DropdownMenuPortal",tOe=e=>{const{__scopeDropdownMenu:t,...n}=e,s=oh(t);return r.jsx(Got,{...s,...n})};tOe.displayName=llt;var rOe="DropdownMenuContent",nOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=XLe(rOe,n),o=oh(n),l=A.useRef(!1);return r.jsx(Kot,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...s,ref:t,onCloseAutoFocus:gn(e.onCloseAutoFocus,i=>{var u;l.current||(u=a.triggerRef.current)==null||u.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:gn(e.onInteractOutside,i=>{const u=i.detail.originalEvent,m=u.button===0&&u.ctrlKey===!0,x=u.button===2||m;(!a.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)"}})});nOe.displayName=rOe;var clt="DropdownMenuGroup",dlt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(Zot,{...a,...s,ref:t})});dlt.displayName=clt;var ult="DropdownMenuLabel",sOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(Yot,{...a,...s,ref:t})});sOe.displayName=ult;var hlt="DropdownMenuItem",aOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(Xot,{...a,...s,ref:t})});aOe.displayName=hlt;var mlt="DropdownMenuCheckboxItem",iOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(Qot,{...a,...s,ref:t})});iOe.displayName=mlt;var flt="DropdownMenuRadioGroup",plt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(Jot,{...a,...s,ref:t})});plt.displayName=flt;var glt="DropdownMenuRadioItem",oOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(elt,{...a,...s,ref:t})});oOe.displayName=glt;var xlt="DropdownMenuItemIndicator",lOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(tlt,{...a,...s,ref:t})});lOe.displayName=xlt;var ylt="DropdownMenuSeparator",cOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(rlt,{...a,...s,ref:t})});cOe.displayName=ylt;var vlt="DropdownMenuArrow",_lt=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(nlt,{...a,...s,ref:t})});_lt.displayName=vlt;var blt="DropdownMenuSubTrigger",dOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(slt,{...a,...s,ref:t})});dOe.displayName=blt;var wlt="DropdownMenuSubContent",uOe=A.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=oh(n);return r.jsx(alt,{...a,...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)"}})});uOe.displayName=wlt;var jlt=QLe,klt=eOe,Nlt=tOe,hOe=nOe,mOe=sOe,fOe=aOe,pOe=iOe,gOe=oOe,xOe=lOe,yOe=cOe,vOe=dOe,_Oe=uOe;const lh=jlt,ch=klt,Slt=A.forwardRef(({className:e,inset:t,children:n,...s},a)=>r.jsxs(vOe,{ref:a,className:Ut("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(Gi,{className:"ml-auto h-4 w-4"})]}));Slt.displayName=vOe.displayName;const Clt=A.forwardRef(({className:e,...t},n)=>r.jsx(_Oe,{ref:n,className:Ut("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}));Clt.displayName=_Oe.displayName;const Nu=A.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(Nlt,{children:r.jsx(hOe,{ref:s,sideOffset:t,className:Ut("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})}));Nu.displayName=hOe.displayName;const Va=A.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(fOe,{ref:s,className:Ut("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}));Va.displayName=fOe.displayName;const Mlt=A.forwardRef(({className:e,children:t,checked:n,...s},a)=>r.jsxs(pOe,{ref:a,className:Ut("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(xOe,{children:r.jsx(mi,{className:"h-4 w-4"})})}),t]}));Mlt.displayName=pOe.displayName;const Tlt=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(gOe,{ref:s,className:Ut("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(xOe,{children:r.jsx(Ju,{className:"h-2 w-2 fill-current"})})}),t]}));Tlt.displayName=gOe.displayName;const ame=A.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(mOe,{ref:s,className:Ut("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));ame.displayName=mOe.displayName;const ik=A.forwardRef(({className:e,...t},n)=>r.jsx(yOe,{ref:n,className:Ut("-mx-1 my-1 h-px bg-muted",e),...t}));ik.displayName=yOe.displayName;const Alt=()=>{const{isAssistant:e,actingAsAgent:t,assignedAgents:n,setActingAsAgent:s}=Lxe();if(!(e&&!!t))return null;const o=l=>l.split(" ").map(i=>i[0]).join("").toUpperCase().slice(0,2);return r.jsx("div",{className:"fixed top-0 left-0 right-0 z-[2147483647] bg-primary text-primary-foreground px-4 py-1.5 shadow-lg",style:{height:"40px"},children:r.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4 h-full",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx($n,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"font-medium text-sm",children:"Acting as"}),n.length>1?r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{variant:"secondary",size:"sm",className:"gap-2 bg-primary-foreground/20 hover:bg-primary-foreground/30 text-primary-foreground border-0",children:[r.jsxs(ea,{className:"h-5 w-5",children:[r.jsx(Ci,{src:t.avatar_url||void 0}),r.jsx(ta,{className:"text-[10px] bg-primary-foreground/30",children:o(t.name)})]}),r.jsx("strong",{children:t.name}),r.jsx(Rd,{className:"h-3 w-3"})]})}),r.jsx(Nu,{align:"start",children:n.map(l=>r.jsxs(Va,{onClick:()=>s(l),className:"gap-2",children:[r.jsxs(ea,{className:"h-6 w-6",children:[r.jsx(Ci,{src:l.avatar_url||void 0}),r.jsx(ta,{className:"text-[10px]",children:o(l.name)})]}),r.jsx("span",{children:l.name}),l.id===t.id&&r.jsx(At,{variant:"secondary",className:"ml-auto text-[10px]",children:"Current"})]},l.id))})]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ea,{className:"h-5 w-5",children:[r.jsx(Ci,{src:t.avatar_url||void 0}),r.jsx(ta,{className:"text-[10px] bg-primary-foreground/30",children:o(t.name)})]}),r.jsx("strong",{children:t.name})]})]}),r.jsx(At,{variant:"secondary",className:"bg-primary-foreground/20 text-primary-foreground border-0 text-xs",children:"Assistant Mode"})]})})},Nn=({children:e,requireAdmin:t=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:a,isAdmin:o,isBrokerageManager:l}=tn();return a?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(yce,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(yce,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:e}):r.jsx(yce,{to:"/auth",replace:!0})};var Hxe={};(function e(t,n,s,a){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",i=function(){if(!t.OffscreenCanvas)return!1;try{var Te=new OffscreenCanvas(1,1),_e=Te.getContext("2d");_e.fillRect(0,0,1,1);var we=Te.transferToImageBitmap();_e.createPattern(we,"no-repeat")}catch{return!1}return!0}();function u(){}function m(Te){var _e=n.exports.Promise,we=_e!==void 0?_e:t.Promise;return typeof we=="function"?new we(Te):(Te(u,u),null)}var x=function(Te,_e){return{transform:function(we){if(Te)return we;if(_e.has(we))return _e.get(we);var ve=new OffscreenCanvas(we.width,we.height),Xe=ve.getContext("2d");return Xe.drawImage(we,0,0),_e.set(we,ve),ve},clear:function(){_e.clear()}}}(i,new Map),y=function(){var Te=Math.floor(16.666666666666668),_e,we,ve={},Xe=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(_e=function(Me){var Ie=Math.random();return ve[Ie]=requestAnimationFrame(function $e(Be){Xe===Be||Xe+Te-1{const{data:t,error:n}=await Y.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 Ilt(){const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}function Plt(){const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{error:s}=await Y.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 Pse="Dialog",[bOe,wOe]=cc(Pse),[Llt,Up]=bOe(Pse),jOe=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=e,i=A.useRef(null),u=A.useRef(null),[m,x]=rh({prop:s,defaultProp:a??!1,onChange:o,caller:Pse});return r.jsx(Llt,{scope:t,triggerRef:i,contentRef:u,contentId:pd(),titleId:pd(),descriptionId:pd(),open:m,onOpenChange:x,onOpenToggle:A.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};jOe.displayName=Pse;var kOe="DialogTrigger",NOe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(kOe,n),o=ca(t,a.triggerRef);return r.jsx(Fn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Kxe(a.open),...s,ref:o,onClick:gn(e.onClick,a.onOpenToggle)})});NOe.displayName=kOe;var Wxe="DialogPortal",[Olt,SOe]=bOe(Wxe,{forceMount:void 0}),COe=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,o=Up(Wxe,t);return r.jsx(Olt,{scope:t,forceMount:n,children:A.Children.map(s,l=>r.jsx(Ac,{present:n||o.open,children:r.jsx(g3,{asChild:!0,container:a,children:l})}))})};COe.displayName=Wxe;var Bte="DialogOverlay",MOe=A.forwardRef((e,t)=>{const n=SOe(Bte,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,o=Up(Bte,e.__scopeDialog);return o.modal?r.jsx(Ac,{present:s||o.open,children:r.jsx(Rlt,{...a,ref:t})}):null});MOe.displayName=Bte;var Dlt=uv("DialogOverlay.RemoveScroll"),Rlt=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(Bte,n);return r.jsx(rP,{as:Dlt,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Fn.div,{"data-state":Kxe(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ok="DialogContent",TOe=A.forwardRef((e,t)=>{const n=SOe(ok,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,o=Up(ok,e.__scopeDialog);return r.jsx(Ac,{present:s||o.open,children:o.modal?r.jsx(Flt,{...a,ref:t}):r.jsx(zlt,{...a,ref:t})})});TOe.displayName=ok;var Flt=A.forwardRef((e,t)=>{const n=Up(ok,e.__scopeDialog),s=A.useRef(null),a=ca(t,n.contentRef,s);return A.useEffect(()=>{const o=s.current;if(o)return Mse(o)},[]),r.jsx(AOe,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gn(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:gn(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:gn(e.onFocusOutside,o=>o.preventDefault())})}),zlt=A.forwardRef((e,t)=>{const n=Up(ok,e.__scopeDialog),s=A.useRef(!1),a=A.useRef(!1);return r.jsx(AOe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var u,m;(u=e.onInteractOutside)==null||u.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((m=n.triggerRef.current)==null?void 0:m.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),AOe=A.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=e,i=Up(ok,n),u=A.useRef(null),m=ca(t,u);return Cse(),r.jsxs(r.Fragment,{children:[r.jsx(eP,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(wv,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Kxe(i.open),...l,ref:m,onDismiss:()=>i.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx($lt,{titleId:i.titleId}),r.jsx(qlt,{contentRef:u,descriptionId:i.descriptionId})]})]})}),Gxe="DialogTitle",EOe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(Gxe,n);return r.jsx(Fn.h2,{id:a.titleId,...s,ref:t})});EOe.displayName=Gxe;var IOe="DialogDescription",POe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(IOe,n);return r.jsx(Fn.p,{id:a.descriptionId,...s,ref:t})});POe.displayName=IOe;var LOe="DialogClose",OOe=A.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Up(LOe,n);return r.jsx(Fn.button,{type:"button",...s,ref:t,onClick:gn(e.onClick,()=>a.onOpenChange(!1))})});OOe.displayName=LOe;function Kxe(e){return e?"open":"closed"}var DOe="DialogTitleWarning",[Blt,ROe]=xXe(DOe,{contentName:ok,titleName:Gxe,docsSlug:"dialog"}),$lt=({titleId:e})=>{const t=ROe(DOe),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 A.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ult="DialogDescriptionWarning",qlt=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ROe(Ult).contentName}}.`;return A.useEffect(()=>{var o;const a=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Lse=jOe,Zxe=NOe,Ose=COe,T3=MOe,A3=TOe,aP=EOe,iP=POe,Dse=OOe;const Rr=Lse,Fo=Zxe,Vlt=Ose,FOe=A.forwardRef(({className:e,...t},n)=>r.jsx(T3,{ref:n,className:Ut("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}));FOe.displayName=T3.displayName;const Dr=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Vlt,{children:[r.jsx(FOe,{}),r.jsxs(A3,{ref:s,className:Ut("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(Dse,{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(ds,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Dr.displayName=A3.displayName;const $r=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});$r.displayName="DialogHeader";const Vs=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Vs.displayName="DialogFooter";const Br=A.forwardRef(({className:e,...t},n)=>r.jsx(aP,{ref:n,className:Ut("text-lg font-semibold leading-none tracking-tight",e),...t}));Br.displayName=aP.displayName;const Yn=A.forwardRef(({className:e,...t},n)=>r.jsx(iP,{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));Yn.displayName=iP.displayName;const Hlt={points_earned:io,listing_created:ya,deal_closed:Fd,custom:ks},Wke={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 Wlt(){const{user:e}=tn(),t=Vr(),{data:n}=Elt(),s=Ilt(),[a,o]=A.useState(null),[l,i]=A.useState(!1),u=A.useCallback(()=>{const b=Date.now()+3e3,N={startVelocity:30,spread:360,ticks:60,zIndex:9999},k=(I,T)=>Math.random()*(T-I)+I,M=setInterval(()=>{const I=b-Date.now();if(I<=0){clearInterval(M);return}const T=50*(I/3e3);Hke({...N,particleCount:T,origin:{x:k(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),Hke({...N,particleCount:T,origin:{x:k(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);A.useEffect(()=>{n&&n.length>0&&!a&&(o(n[0]),i(!0),setTimeout(u,100))},[n,a,u]);const m=async()=>{if(a){const v=a.id;i(!1),o(null),t.setQueryData(["celebrations","pending",e==null?void 0:e.id],b=>(b==null?void 0:b.filter(N=>N.id!==v))??[]),await s.mutateAsync(v)}};if(!a)return null;const x=Hlt[a.celebration_type]||ks,y=Wke[a.celebration_type]||Wke.custom;return r.jsx(Rr,{open:l,onOpenChange:v=>!v&&m(),children:r.jsxs(Dr,{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(Os,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Os,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Os,{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:["🎉 ",a.title]}),a.points_amount&&a.points_amount>0&&r.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",a.points_amount," points!"]}),a.message&&r.jsx("p",{className:"text-muted-foreground mb-6",children:a.message}),r.jsx(Q,{onClick:m,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 Yxe="/assets/levelup-logo-horizontal-DEFNc0ms.png",Xxe="/assets/levelup-logo-white-C2RAgAoG.png",Glt="/assets/listings-hero-BI9Ki9Dq.jpg",lt=A.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:Ut("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}));lt.displayName="Input";var zOe={exports:{}};(function(e,t){(function(n,s){e.exports=s()})(Qx,function(){var n,s,a;function o(i,u){if(!n)n=u;else if(!s)s=u;else{var m="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),a=u(x),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(a.workerUrl=window.URL.createObjectURL(new Blob([m],{type:"text/javascript"})))}}o(["exports"],function(i){var u=1e-6,m=typeof Float32Array<"u"?Float32Array:Array;function x(f,c){var h=c[0],g=c[1],_=c[2],S=c[3],C=h*S-_*g;return C?(f[0]=S*(C=1/C),f[1]=-g*C,f[2]=-_*C,f[3]=h*C,f):null}function y(){var f=new m(9);return m!=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 v(f,c){var h=c[0],g=c[1],_=c[2],S=c[3],C=c[4],L=c[5],z=c[6],$=c[7],K=c[8];return f[0]=C*K-L*$,f[1]=_*$-g*K,f[2]=g*L-_*C,f[3]=L*z-S*K,f[4]=h*K-_*z,f[5]=_*S-h*L,f[6]=S*$-C*z,f[7]=g*z-h*$,f[8]=h*C-g*S,f}function b(f,c,h){var g=c[0],_=c[1],S=c[2],C=c[3],L=c[4],z=c[5],$=c[6],K=c[7],Z=c[8],J=h[0],re=h[1],ie=h[2],ge=h[3],Se=h[4],Ne=h[5],Fe=h[6],Ue=h[7],Qe=h[8];return f[0]=J*g+re*C+ie*$,f[1]=J*_+re*L+ie*K,f[2]=J*S+re*z+ie*Z,f[3]=ge*g+Se*C+Ne*$,f[4]=ge*_+Se*L+Ne*K,f[5]=ge*S+Se*z+Ne*Z,f[6]=Fe*g+Ue*C+Qe*$,f[7]=Fe*_+Ue*L+Qe*K,f[8]=Fe*S+Ue*z+Qe*Z,f}function N(){var f=new m(16);return m!=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 k(f){var c=new m(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 M(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 I(f,c){var h=c[0],g=c[1],_=c[2],S=c[3],C=c[4],L=c[5],z=c[6],$=c[7],K=c[8],Z=c[9],J=c[10],re=c[11],ie=c[12],ge=c[13],Se=c[14],Ne=c[15],Fe=h*L-g*C,Ue=h*z-_*C,Qe=h*$-S*C,xt=g*z-_*L,mt=g*$-S*L,wt=_*$-S*z,Ct=K*ge-Z*ie,Pt=K*Se-J*ie,Qt=K*Ne-re*ie,Ft=Z*Se-J*ge,nr=Z*Ne-re*ge,ur=J*Ne-re*Se,hr=Fe*ur-Ue*nr+Qe*Ft+xt*Qt-mt*Pt+wt*Ct;return hr?(f[0]=(L*ur-z*nr+$*Ft)*(hr=1/hr),f[1]=(_*nr-g*ur-S*Ft)*hr,f[2]=(ge*wt-Se*mt+Ne*xt)*hr,f[3]=(J*mt-Z*wt-re*xt)*hr,f[4]=(z*Qt-C*ur-$*Pt)*hr,f[5]=(h*ur-_*Qt+S*Pt)*hr,f[6]=(Se*Qe-ie*wt-Ne*Ue)*hr,f[7]=(K*wt-J*Qe+re*Ue)*hr,f[8]=(C*nr-L*Qt+$*Ct)*hr,f[9]=(g*Qt-h*nr-S*Ct)*hr,f[10]=(ie*mt-ge*Qe+Ne*Fe)*hr,f[11]=(Z*Qe-K*mt-re*Fe)*hr,f[12]=(L*Pt-C*Ft-z*Ct)*hr,f[13]=(h*Ft-g*Pt+_*Ct)*hr,f[14]=(ge*Ue-ie*xt-Se*Fe)*hr,f[15]=(K*xt-Z*Ue+J*Fe)*hr,f):null}function T(f,c,h){var g=c[0],_=c[1],S=c[2],C=c[3],L=c[4],z=c[5],$=c[6],K=c[7],Z=c[8],J=c[9],re=c[10],ie=c[11],ge=c[12],Se=c[13],Ne=c[14],Fe=c[15],Ue=h[0],Qe=h[1],xt=h[2],mt=h[3];return f[0]=Ue*g+Qe*L+xt*Z+mt*ge,f[1]=Ue*_+Qe*z+xt*J+mt*Se,f[2]=Ue*S+Qe*$+xt*re+mt*Ne,f[3]=Ue*C+Qe*K+xt*ie+mt*Fe,f[4]=(Ue=h[4])*g+(Qe=h[5])*L+(xt=h[6])*Z+(mt=h[7])*ge,f[5]=Ue*_+Qe*z+xt*J+mt*Se,f[6]=Ue*S+Qe*$+xt*re+mt*Ne,f[7]=Ue*C+Qe*K+xt*ie+mt*Fe,f[8]=(Ue=h[8])*g+(Qe=h[9])*L+(xt=h[10])*Z+(mt=h[11])*ge,f[9]=Ue*_+Qe*z+xt*J+mt*Se,f[10]=Ue*S+Qe*$+xt*re+mt*Ne,f[11]=Ue*C+Qe*K+xt*ie+mt*Fe,f[12]=(Ue=h[12])*g+(Qe=h[13])*L+(xt=h[14])*Z+(mt=h[15])*ge,f[13]=Ue*_+Qe*z+xt*J+mt*Se,f[14]=Ue*S+Qe*$+xt*re+mt*Ne,f[15]=Ue*C+Qe*K+xt*ie+mt*Fe,f}function P(f,c,h){var g,_,S,C,L,z,$,K,Z,J,re,ie,ge=h[0],Se=h[1],Ne=h[2];return c===f?(f[12]=c[0]*ge+c[4]*Se+c[8]*Ne+c[12],f[13]=c[1]*ge+c[5]*Se+c[9]*Ne+c[13],f[14]=c[2]*ge+c[6]*Se+c[10]*Ne+c[14],f[15]=c[3]*ge+c[7]*Se+c[11]*Ne+c[15]):(_=c[1],S=c[2],C=c[3],L=c[4],z=c[5],$=c[6],K=c[7],Z=c[8],J=c[9],re=c[10],ie=c[11],f[0]=g=c[0],f[1]=_,f[2]=S,f[3]=C,f[4]=L,f[5]=z,f[6]=$,f[7]=K,f[8]=Z,f[9]=J,f[10]=re,f[11]=ie,f[12]=g*ge+L*Se+Z*Ne+c[12],f[13]=_*ge+z*Se+J*Ne+c[13],f[14]=S*ge+$*Se+re*Ne+c[14],f[15]=C*ge+K*Se+ie*Ne+c[15]),f}function F(f,c,h){var g=h[0],_=h[1],S=h[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]*_,f[5]=c[5]*_,f[6]=c[6]*_,f[7]=c[7]*_,f[8]=c[8]*S,f[9]=c[9]*S,f[10]=c[10]*S,f[11]=c[11]*S,f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15],f}function D(f,c,h){var g=Math.sin(h),_=Math.cos(h),S=c[4],C=c[5],L=c[6],z=c[7],$=c[8],K=c[9],Z=c[10],J=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]=S*_+$*g,f[5]=C*_+K*g,f[6]=L*_+Z*g,f[7]=z*_+J*g,f[8]=$*_-S*g,f[9]=K*_-C*g,f[10]=Z*_-L*g,f[11]=J*_-z*g,f}function U(f,c,h){var g=Math.sin(h),_=Math.cos(h),S=c[0],C=c[1],L=c[2],z=c[3],$=c[8],K=c[9],Z=c[10],J=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]=S*_-$*g,f[1]=C*_-K*g,f[2]=L*_-Z*g,f[3]=z*_-J*g,f[8]=S*g+$*_,f[9]=C*g+K*_,f[10]=L*g+Z*_,f[11]=z*g+J*_,f}function V(f,c,h){var g=Math.sin(h),_=Math.cos(h),S=c[0],C=c[1],L=c[2],z=c[3],$=c[4],K=c[5],Z=c[6],J=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]=S*_+$*g,f[1]=C*_+K*g,f[2]=L*_+Z*g,f[3]=z*_+J*g,f[4]=$*_-S*g,f[5]=K*_-C*g,f[6]=Z*_-L*g,f[7]=J*_-z*g,f}function W(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 G(f,c,h){var g,_,S,C=h[0],L=h[1],z=h[2],$=Math.sqrt(C*C+L*L+z*z);return $0&&(S=1/Math.sqrt(S)),f[0]=c[0]*S,f[1]=c[1]*S,f[2]=c[2]*S,f}function ot(f,c){return f[0]*c[0]+f[1]*c[1]+f[2]*c[2]}function Tt(f,c,h){var g=c[0],_=c[1],S=c[2],C=h[0],L=h[1],z=h[2];return f[0]=_*z-S*L,f[1]=S*C-g*z,f[2]=g*L-_*C,f}function Oe(f,c,h,g){var _=c[0],S=c[1],C=c[2];return f[0]=_+g*(h[0]-_),f[1]=S+g*(h[1]-S),f[2]=C+g*(h[2]-C),f}function at(f,c,h){var g=c[0],_=c[1],S=c[2],C=h[3]*g+h[7]*_+h[11]*S+h[15];return f[0]=(h[0]*g+h[4]*_+h[8]*S+h[12])/(C=C||1),f[1]=(h[1]*g+h[5]*_+h[9]*S+h[13])/C,f[2]=(h[2]*g+h[6]*_+h[10]*S+h[14])/C,f}function le(f,c,h){var g=c[0],_=c[1],S=c[2];return f[0]=g*h[0]+_*h[3]+S*h[6],f[1]=g*h[1]+_*h[4]+S*h[7],f[2]=g*h[2]+_*h[5]+S*h[8],f}function qe(f,c,h){var g=h[0],_=h[1],S=h[2],C=h[3],L=c[0],z=c[1],$=c[2],K=_*$-S*z,Z=S*L-g*$,J=g*z-_*L;return f[0]=L+C*(K+=K)+_*(J+=J)-S*(Z+=Z),f[1]=z+C*Z+S*K-g*J,f[2]=$+C*J+g*Z-_*K,f}function Je(f){return f[0]=0,f[1]=0,f[2]=0,f}function st(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var je=xe,ut=Te,Ce=fe;function Ee(){var f=new m(4);return m!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function Ze(f,c,h){return f[0]=c[0]*h,f[1]=c[1]*h,f[2]=c[2]*h,f[3]=c[3]*h,f}function Le(f,c){var h=c[0],g=c[1],_=c[2],S=c[3],C=h*h+g*g+_*_+S*S;return C>0&&(C=1/Math.sqrt(C)),f[0]=h*C,f[1]=g*C,f[2]=_*C,f[3]=S*C,f}function Ke(f,c,h){var g=c[0],_=c[1],S=c[2],C=c[3];return f[0]=h[0]*g+h[4]*_+h[8]*S+h[12]*C,f[1]=h[1]*g+h[5]*_+h[9]*S+h[13]*C,f[2]=h[2]*g+h[6]*_+h[10]*S+h[14]*C,f[3]=h[3]*g+h[7]*_+h[11]*S+h[15]*C,f}function tt(){var f=new m(4);return m!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),f[3]=1,f}function ct(f){return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f}function it(f,c,h){h*=.5;var g=c[0],_=c[1],S=c[2],C=c[3],L=Math.sin(h),z=Math.cos(h);return f[0]=g*z+C*L,f[1]=_*z+S*L,f[2]=S*z-_*L,f[3]=C*z-g*L,f}function zt(f,c,h){h*=.5;var g=c[0],_=c[1],S=c[2],C=c[3],L=Math.sin(h),z=Math.cos(h);return f[0]=g*z-S*L,f[1]=_*z+C*L,f[2]=S*z+g*L,f[3]=C*z-_*L,f}pe(),Ee();var Lt,lr,Ar,Mr=Le,Zr=(Lt=pe(),lr=se(1,0,0),Ar=se(0,1,0),function(f,c,h){var g=ot(c,h);return g<-.999999?(Tt(Lt,lr,c),Ce(Lt)<1e-6&&Tt(Lt,Ar,c),Ve(Lt,Lt),function(_,S,C){C*=.5;var L=Math.sin(C);_[0]=L*S[0],_[1]=L*S[1],_[2]=L*S[2],_[3]=Math.cos(C)}(f,Lt,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(Tt(Lt,c,h),f[0]=Lt[0],f[1]=Lt[1],f[2]=Lt[2],f[3]=1+g,Mr(f,f))});function Xn(){var f=new m(2);return m!=Float32Array&&(f[0]=0,f[1]=0),f}function dr(f,c){var h=new m(2);return h[0]=f,h[1]=c,h}function En(f,c,h){return f[0]=c,f[1]=h,f}function Es(f,c,h){return f[0]=c[0]+h[0],f[1]=c[1]+h[1],f}function Hs(f,c,h){return f[0]=c[0]-h[0],f[1]=c[1]-h[1],f}function Ei(f,c,h){return f[0]=c[0]*h,f[1]=c[1]*h,f}function Ii(f){var c=f[0],h=f[1];return Math.sqrt(c*c+h*h)}function Ho(f,c){var h=c[0],g=c[1],_=h*h+g*g;return _>0&&(_=1/Math.sqrt(_)),f[0]=c[0]*_,f[1]=c[1]*_,f}function Ha(f,c){return f[0]*c[0]+f[1]*c[1]}tt(),tt(),y();var us,ra,hs=Hs;function Ys(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}Xn();var zs=function(){if(ra)return us;function f(c,h,g,_){this.cx=3*c,this.bx=3*(g-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*h,this.by=3*(_-h)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=h,this.p2x=g,this.p2y=_}return ra=1,us=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,h){if(h===void 0&&(h=1e-6),c<0)return 0;if(c>1)return 1;for(var g=c,_=0;_<8;_++){var S=this.sampleCurveX(g)-c;if(Math.abs(S)S?L=g:z=g,g=.5*(z-L)+L;return g},solve:function(c,h){return this.sampleCurveY(this.solveCurveX(c,h))}},us}(),ji=Ys(zs);function ir(f,c){this.x=f,this.y=c}function Pa(f,c){if(Array.isArray(f)){if(!Array.isArray(c)||f.length!==c.length)return!1;for(let h=0;h=1)return 1;const c=f*f,h=c*f;return 4*(f<.5?h:3*(f-c)+h-.75)}function uc(f,c,h,g){const _=new ji(f,c,h,g);return function(S){return _.solve(S)}}const rt=uc(.25,.1,.25,1);function ye(f,c,h){return Math.min(h,Math.max(c,f))}function Pe(f,c,h){return(h=ye((h-f)/(c-f),0,1))*h*(3-2*h)}function Ye(f,c,h){const g=h-c,_=((f-c)%g+g)%g+c;return _===c?h:_}function Nt(f,c,h){if(!f.length)return h(null,[]);let g=f.length;const _=new Array(f.length);let S=null;f.forEach((C,L)=>{c(C,(z,$)=>{z&&(S=z),_[L]=$,--g==0&&h(S,_)})})}let bt=1;function It(){return bt++}function qt(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log2(f)))}function Ot(f,c){f.forEach(h=>{c[h]&&(c[h]=c[h].bind(c))})}function Wt(f,c,h){const g={};for(const _ in f)g[_]=c.call(this,f[_],_,f);return g}function pr(f,c,h){const g={};for(const _ in f)c.call(this,f[_],_,f)&&(g[_]=f[_]);return g}function cr(f){return Array.isArray(f)?f.map(cr):typeof f=="object"&&f?Wt(f,cr):f}function Xr(f,c){for(let h=0;h=0)return!0;return!1}const Cn={};function Kr(f){Cn[f]||(typeof console<"u"&&console.warn(f),Cn[f]=!0)}function is(f,c,h){return(h.y-f.y)*(c.x-f.x)>(c.y-f.y)*(h.x-f.x)}function ls(f){let c=0;for(let h,g,_=0,S=f.length,C=S-1;_@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,g,_,S)=>{const C=_||S;return c[g]=!C||C.toLowerCase(),""}),c["max-age"]){const h=parseInt(c["max-age"],10);isNaN(h)?delete c["max-age"]:c["max-age"]=h}return c}let jo=null;function ba(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function Co(f,c,h,g){for(;c>1;f[_]>1;f[_]<=g?c=_+1:h=_}return c}function na(f){return f>0?1/(1.001-f):1+f}function Li(f){return f>0?1-1/(1.001-f):-f}function Wa(f,c,h){return(f-c.min)*(h.max-h.min)/(c.max-c.min)+h.min}const Is={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(!Is.API_URL)return null;try{const f=new URL(Is.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 Oi(f){return Is.API_URL_REGEX.test(f)}function bl(f){return Is.API_SPRITE_REGEX.test(f)}let El,Xc,Tm,Yo,Hd,hc;function dh(){return El==null&&(El=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),El}const Xo={now:()=>Yo!==void 0?Yo:performance.now(),setNow(f){Yo=f},restoreNow(){Yo=void 0},frame(f){const c=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(f,c=0){const{width:h,height:g}=f;Hd||(Hd=document.createElement("canvas"));const _=Hd.getContext("2d",{willReadFrequently:!0});if(!_)throw new Error("failed to create canvas 2d context");return(h>Hd.width||g>Hd.height)&&(Hd.width=h,Hd.height=g),_.clearRect(-c,-c,h+2*c,g+2*c),_.drawImage(f,0,0,h,g),_.getImageData(-c,-c,h+2*c,g+2*c)},resolveURL:f=>(Xc||(Xc=document.createElement("a")),Xc.href=f,Xc.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Tm==null&&(Tm=window.matchMedia("(prefers-reduced-motion: reduce)")),Tm.matches)},hasCanvasFingerprintNoise(){if(hc!==void 0)return hc;if(!dh())return hc=!1,!1;const f=new OffscreenCanvas(85,1),c=f.getContext("2d",{willReadFrequently:!0});let h=0;for(let _=0;_0?`?${S}`:""}`}const Zy="mapbox-tiles";let Yy=500,Xy=50;const Uh=["language","worldview","jobid"];let Au,Qc;function lu(){try{return caches}catch{}}function mc(){const f=lu();f&&Au==null&&(Au=f.open(Zy))}let Jc=1/0;const Wo={supported:!1,testSupport:function(f){!Wd&&qh&&(Tf?ux(f):Eu=f)}};let Eu,qh,Wd=!1,Tf=!1;const Qy=typeof self<"u"?self:{};function ux(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,qh),f.isContextLost())return;Wo.supported=!0}catch{}f.deleteTexture(c),Wd=!0}Qy.document&&(qh=Qy.document.createElement("img"),qh.onload=function(){Eu&&ux(Eu),Eu=null,Tf=!0},qh.onerror=function(){Wd=!0,Eu=null},qh.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Af={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(Af);class yd extends Error{constructor(c,h,g){h===401&&Oi(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=h,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Jy=Ws()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Am=function(f,c){if(!(/^file:/.test(h=f.url)||/^file:/.test(Jy())&&!/^\w+:/.test(h))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,_){const S=new AbortController,C=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:Jy(),referrerPolicy:g.referrerPolicy,signal:S.signal});let L=!1,z=!1;const $=(K=C.url).indexOf("sku=")>0&&Oi(K);var K;g.type==="json"&&C.headers.set("Accept","application/json");const Z=(re,ie,ge)=>{if(z)return;if(re&&re.message!=="SecurityError"&&Kr(re.toString()),ie&&ge)return J(ie);const Se=Date.now();fetch(C).then(Ne=>{if(Ne.ok){const Fe=$?Ne.clone():null;return J(Ne,Fe,Se)}return _(new yd(Ne.statusText,Ne.status,g.url))}).catch(Ne=>{Ne.name!=="AbortError"&&_(new Error(`${Ne.message} ${g.url}`))})},J=(re,ie,ge)=>{(g.type==="arrayBuffer"?re.arrayBuffer():g.type==="json"?re.json():re.text()).then(Se=>{z||(ie&&ge&&function(Ne,Fe,Ue){if(mc(),Au==null)return;const Qe=$i(Fe.headers.get("Cache-Control")||"");if(Qe["no-store"])return;const xt={status:Fe.status,statusText:Fe.statusText,headers:new Headers};Fe.headers.forEach((Ct,Pt)=>xt.headers.set(Pt,Ct)),Qe["max-age"]&&xt.headers.set("Expires",new Date(Ue+1e3*Qe["max-age"]).toUTCString());const mt=xt.headers.get("Expires");if(!mt||new Date(mt).getTime()-Ue<42e4)return;let wt=Gp(Ne.url,{persistentParams:Uh});if(Fe.status===206){const Ct=Ne.headers.get("Range");if(!Ct)return;xt.status=200,wt=Mf(wt,{range:Ct})}(function(Ct,Pt){if(Qc===void 0)try{new Response(new ReadableStream),Qc=!0}catch{Qc=!1}Qc?Pt(Ct.body):Ct.blob().then(Pt).catch(Qt=>Kr(Qt.message))})(Fe,Ct=>{const Pt=new Response((Qt=Fe.status)!==200&&Qt!==404&&[101,103,204,205,304].includes(Qt)?null:Ct,xt);var Qt;mc(),Au!=null&&Au.then(Ft=>Ft.put(wt,Pt)).catch(Ft=>Kr(Ft.message))})}(C,ie,ge),L=!0,_(null,Se,re.headers))}).catch(Se=>{z||_(new Error(Se.message))})};return $?function(re,ie){if(mc(),Au==null)return ie(null);Au.then(ge=>{let Se=Gp(re.url,{persistentParams:Uh});const Ne=re.headers.get("Range");Ne&&(Se=Mf(Se,{range:Ne})),ge.match(Se).then(Fe=>{const Ue=function(Qe){if(!Qe)return!1;const xt=new Date(Qe.headers.get("Expires")||0),mt=$i(Qe.headers.get("Cache-Control")||"");return Number(xt)>Date.now()&&!mt["no-cache"]}(Fe);ge.delete(Se).catch(ie),Ue&&ge.put(Se,Fe.clone()).catch(ie),ie(null,Fe,Ue)}).catch(ie)}).catch(ie)}(C,Z):Z(null,null),{cancel:()=>{z=!0,L||S.abort()}}}(f,c);if(Ws(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,c,void 0,!0)}var h;return function(g,_){const S=new XMLHttpRequest;S.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(S.responseType="arraybuffer");for(const C in g.headers)S.setRequestHeader(C,g.headers[C]);return g.type==="json"&&(S.responseType="text",S.setRequestHeader("Accept","application/json")),S.withCredentials=g.credentials==="include",S.onerror=()=>{_(new Error(S.statusText))},S.onload=()=>{if((S.status>=200&&S.status<300||S.status===0)&&S.response!==null){let C=S.response;if(g.type==="json")try{C=JSON.parse(S.response)}catch(z){return _(z)}const L=new Headers;S.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(z=>{const $=z.split(": "),K=$.shift(),Z=$.join(": ");L.append(K,Z)}),_(null,C,L)}else _(new yd(S.statusText,S.status,g.url))},S.send(g.body),{cancel:()=>S.abort()}}(f,c)},Iu=function(f,c){return Am(Object.assign(f,{type:"arrayBuffer"}),c)};function e5(f){const c=document.createElement("a");return c.href=f,c.protocol===location.protocol&&c.host===location.host}const Rk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let hx,Xs;hx=[],Xs=0;const e0=function(f,c){if(Wo.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),Xs>=Is.MAX_PARALLEL_IMAGE_REQUESTS){const S={requestParameters:f,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return hx.push(S),S}Xs++;let h=!1;const g=()=>{if(!h)for(h=!0,Xs--;hx.length&&Xs{g(),S?c(S):C&&(self.createImageBitmap?function(z,$){const K=new Blob([new Uint8Array(z)],{type:"image/png"});createImageBitmap(K).then(Z=>{$(null,Z)}).catch(Z=>{$(new Error(`Could not load image because of ${Z.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(C,(z,$)=>c(z,$,L)):function(z,$){const K=new Image;K.onload=()=>{$(null,K),URL.revokeObjectURL(K.src),K.onload=null,requestAnimationFrame(()=>{K.src=Rk})},K.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 Z=new Blob([new Uint8Array(z)],{type:"image/png"});K.src=z.byteLength?URL.createObjectURL(Z):Rk}(C,(z,$)=>c(z,$,L)))});return{cancel:()=>{_.cancel(),g()}}};var Rv,Fk,zk,Em={exports:{}},Kp={exports:{}},mx={exports:{}},kt=function(){if(zk)return Em.exports;zk=1;var f=(Rv||(Rv=1,Kp.exports=function(h,g){var _,S,C,L,z,$,K,Z;for(S=h.length-(_=3&h.length),C=g,z=3432918353,$=461845907,Z=0;Z>>16)*z&65535)<<16)&4294967295)<<15|K>>>17))*$+(((K>>>16)*$&65535)<<16)&4294967295)<<13|C>>>19))+((5*(C>>>16)&65535)<<16)&4294967295))+((58964+(L>>>16)&65535)<<16);switch(K=0,_){case 3:K^=(255&h.charCodeAt(Z+2))<<16;case 2:K^=(255&h.charCodeAt(Z+1))<<8;case 1:C^=K=(65535&(K=(K=(65535&(K^=255&h.charCodeAt(Z)))*z+(((K>>>16)*z&65535)<<16)&4294967295)<<15|K>>>17))*$+(((K>>>16)*$&65535)<<16)&4294967295}return C^=h.length,C=2246822507*(65535&(C^=C>>>16))+((2246822507*(C>>>16)&65535)<<16)&4294967295,C=3266489909*(65535&(C^=C>>>13))+((3266489909*(C>>>16)&65535)<<16)&4294967295,(C^=C>>>16)>>>0}),Kp.exports),c=(Fk||(Fk=1,mx.exports=function(h,g){for(var _,S=h.length,C=g^S,L=0;S>=4;)_=1540483477*(65535&(_=255&h.charCodeAt(L)|(255&h.charCodeAt(++L))<<8|(255&h.charCodeAt(++L))<<16|(255&h.charCodeAt(++L))<<24))+((1540483477*(_>>>16)&65535)<<16),C=1540483477*(65535&C)+((1540483477*(C>>>16)&65535)<<16)^(_=1540483477*(65535&(_^=_>>>24))+((1540483477*(_>>>16)&65535)<<16)),S-=4,++L;switch(S){case 3:C^=(255&h.charCodeAt(L+2))<<16;case 2:C^=(255&h.charCodeAt(L+1))<<8;case 1:C=1540483477*(65535&(C^=255&h.charCodeAt(L)))+((1540483477*(C>>>16)&65535)<<16)}return C=1540483477*(65535&(C^=C>>>13))+((1540483477*(C>>>16)&65535)<<16),(C^=C>>>15)>>>0}),mx.exports);return Em.exports=f,Em.exports.murmur3=f,Em.exports.murmur2=c,Em.exports}(),gr=Ys(kt);class Or{constructor(c,...h){Object.assign(this,h[0]||{}),this.type=c}}class ns extends Or{constructor(c,h={}){super("error",Object.assign({error:c},h))}}function ss(f,c,h){h[f]&&h[f].indexOf(c)!==-1||(h[f]=h[f]||[],h[f].push(c))}function sa(f,c,h){if(h&&h[f]){const g=h[f].indexOf(c);g!==-1&&h[f].splice(g,1)}}class Ps{on(c,h){return this._listeners=this._listeners||{},ss(c,h,this._listeners),this}off(c,h){return sa(c,h,this._listeners),sa(c,h,this._oneTimeListeners),this}once(c,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},ss(c,h,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,h){const g=typeof c=="string"?new Or(c,h):c,_=g.type;if(this.listens(_)){g.target=this;const S=this._listeners&&this._listeners[_]?this._listeners[_].slice():[];for(const z of S)z.call(this,g);const C=this._oneTimeListeners&&this._oneTimeListeners[_]?this._oneTimeListeners[_].slice():[];for(const z of C)sa(_,z,this._oneTimeListeners),z.call(this,g);const L=this._eventedParent;if(L){const z=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,z),L.fire(g)}}else g instanceof ns&&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,h){return this._eventedParent=c,this._eventedParentData=h,this}}class wa{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new wa(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[h,g]=c.split("");return new wa({name:h,iconsetId:g})}static isEqual(c,h){return c.name===h.name&&c.iconsetId===h.iconsetId}toString(){return wa.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Vh,cu={},Il=function(){if(Vh)return cu;Vh=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(S){return(S=Math.round(S))<0?0:S>255?255:S}function h(S){return c(S[S.length-1]==="%"?parseFloat(S)/100*255:parseInt(S))}function g(S){return(C=S[S.length-1]==="%"?parseFloat(S)/100:parseFloat(S))<0?0:C>1?1:C;var C}function _(S,C,L){return L<0?L+=1:L>1&&(L-=1),6*L<1?S+(C-S)*L*6:2*L<1?C:3*L<2?S+(C-S)*(2/3-L)*6:S}try{cu.parseCSSColor=function(S){var C,L=S.replace(/ /g,"").toLowerCase();if(L in f)return f[L].slice();if(L[0]==="#")return L.length===4?(C=parseInt(L.substr(1),16))>=0&&C<=4095?[(3840&C)>>4|(3840&C)>>8,240&C|(240&C)>>4,15&C|(15&C)<<4,1]:null:L.length===7&&(C=parseInt(L.substr(1),16))>=0&&C<=16777215?[(16711680&C)>>16,(65280&C)>>8,255&C,1]:null;var z=L.indexOf("("),$=L.indexOf(")");if(z!==-1&&$+1===L.length){var K=L.substr(0,z),Z=L.substr(z+1,$-(z+1)).split(","),J=1;switch(K){case"rgba":if(Z.length!==4)return null;J=g(Z.pop());case"rgb":return Z.length!==3?null:[h(Z[0]),h(Z[1]),h(Z[2]),J];case"hsla":if(Z.length!==4)return null;J=g(Z.pop());case"hsl":if(Z.length!==3)return null;var re=(parseFloat(Z[0])%360+360)%360/360,ie=g(Z[1]),ge=g(Z[2]),Se=ge<=.5?ge*(ie+1):ge+ie-ge*ie,Ne=2*ge-Se;return[c(255*_(Ne,Se,re+1/3)),c(255*_(Ne,Se,re)),c(255*_(Ne,Se,re-1/3)),J];default:return null}}return null}}catch{}return cu}();class ja{constructor(c,h,g,_=1){this.r=c,this.g=h,this.b=g,this.a=_}static parse(c){if(!c)return;if(c instanceof ja)return c;if(typeof c!="string")return;const h=Il.parseCSSColor(c);return h?new ja(h[0]/255,h[1]/255,h[2]/255,h[3]):void 0}toString(){const[c,h,g,_]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*h)},${Math.round(255*g)},${_})`}toNonPremultipliedRenderColor(c){const{r:h,g,b:_,a:S}=this;return new EP(c,h,g,_,S)}toPremultipliedRenderColor(c){const{r:h,g,b:_,a:S}=this;return new IP(c,h*S,g*S,_*S,S)}clone(){return new ja(this.r,this.g,this.b,this.a)}}class Bk{constructor(c,h,g,_,S,C=!1){if(this.premultiplied=!1,this.premultiplied=C,c){const L=c.image.height,z=L*L;this.premultiplied?(h=S===0?0:h/S*(L-1),g=S===0?0:g/S*(L-1),_=S===0?0:_/S*(L-1)):(h*=L-1,g*=L-1,_*=L-1);const $=Math.floor(h),K=Math.floor(g),Z=Math.floor(_),J=Math.ceil(h),re=Math.ceil(g),ie=Math.ceil(_),ge=h-$,Se=g-K,Ne=_-Z,Fe=c.image.data,Ue=4*($+K*z+Z*L),Qe=4*($+K*z+ie*L),xt=4*($+re*z+Z*L),mt=4*($+re*z+ie*L),wt=4*(J+K*z+Z*L),Ct=4*(J+K*z+ie*L),Pt=4*(J+re*z+Z*L),Qt=4*(J+re*z+ie*L);if(Ue<0||Qt>=Fe.length)throw new Error("out of range");this.r=zn(zn(zn(Fe[Ue],Fe[Qe],Ne),zn(Fe[xt],Fe[mt],Ne),Se),zn(zn(Fe[wt],Fe[Ct],Ne),zn(Fe[Pt],Fe[Qt],Ne),Se),ge)/255*(this.premultiplied?S:1),this.g=zn(zn(zn(Fe[Ue+1],Fe[Qe+1],Ne),zn(Fe[xt+1],Fe[mt+1],Ne),Se),zn(zn(Fe[wt+1],Fe[Ct+1],Ne),zn(Fe[Pt+1],Fe[Qt+1],Ne),Se),ge)/255*(this.premultiplied?S:1),this.b=zn(zn(zn(Fe[Ue+2],Fe[Qe+2],Ne),zn(Fe[xt+2],Fe[mt+2],Ne),Se),zn(zn(Fe[wt+2],Fe[Ct+2],Ne),zn(Fe[Pt+2],Fe[Qt+2],Ne),Se),ge)/255*(this.premultiplied?S:1),this.a=S}else this.r=h,this.g=g,this.b=_,this.a=S}toArray(){const{r:c,g:h,b:g,a:_}=this;return[255*c,255*h,255*g,_]}toHslaArray(){let{r:c,g:h,b:g,a:_}=this;if(this.premultiplied){if(_===0)return[0,0,0,0];const ie=1/_;c*=ie,h*=ie,g*=ie}const S=Math.min(Math.max(c,0),1),C=Math.min(Math.max(h,0),1),L=Math.min(Math.max(g,0),1),z=Math.min(S,C,L),$=Math.max(S,C,L),K=$-z,Z=.5*(z+$);if(K===0)return[0,0,100*Z,_];const J=Z>.5?K/(2-$-z):K/($+z);let re;switch($){case S:re=60*((C-L)/K+(Czn(g,c[_],h))}ja.black=new ja(0,0,0,1),ja.white=new ja(1,1,1,1),ja.transparent=new ja(0,0,0,0),ja.red=new ja(1,0,0,1),ja.blue=new ja(0,0,1,1);var Fv=Object.freeze({__proto__:null,array:t5,color:function(f,c,h){return new ja(zn(f.r,c.r,h),zn(f.g,c.g,h),zn(f.b,c.b,h),zn(f.a,c.a,h))},number:zn});class uh extends Error{constructor(c,h){super(h),this.message=h,this.key=c}}class t0{constructor(c,h=[]){this.parent=c,this.bindings={};for(const[g,_]of h)this.bindings[g]=_}concat(c){return new t0(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 Hh={kind:"null"},wn={kind:"number"},aa={kind:"string"},Ua={kind:"boolean"},Gd={kind:"color"},Im={kind:"object"},La={kind:"value"},$k={kind:"collator"},zv={kind:"formatted"},Bv={kind:"resolvedImage"};function Ic(f,c){return{kind:"array",itemType:f,N:c}}function Bo(f){if(f.kind==="array"){const c=Bo(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const zie=[Hh,wn,aa,Ua,Gd,zv,Im,Ic(La),Bv];function Zp(f,c){if(c.kind==="error")return null;if(f.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Zp(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 h of zie)if(!Zp(h,c))return null}}return`Expected ${Bo(f)} but found ${Bo(c)} instead.`}function r5(f,c){return c.some(h=>h.kind===f.kind)}function $v(f,c){return c.some(h=>h==="null"?f===null:h==="array"?Array.isArray(f):h==="object"?f&&!Array.isArray(f)&&typeof f=="object":h===typeof f)}function Uk(f,c){return f.kind==="array"&&c.kind==="array"?f.N===c.N&&Uk(f.itemType,c.itemType):f.kind===c.kind}class n5{constructor(c,h,g){this.sensitivity=c?h?"variant":"case":h?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(c,h){return this.collator.compare(c,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class qk{constructor(c,h,g,_,S){this.text=c.normalize?c.normalize():c,this.image=h,this.scale=g,this.fontStack=_,this.textColor=S}}class vd{constructor(c){this.sections=c}static fromString(c){return new vd([new qk(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 vd?c:vd.fromString(c)}toString(){return this.sections.length===0?"":this.sections.map(c=>c.text).join("")}serialize(){const c=["format"];for(const h of this.sections){if(h.image){const _=h.image.getPrimary().id.toString();c.push(["image",_]);continue}c.push(h.text);const g={};h.fontStack&&(g["text-font"]=["literal",h.fontStack.split(",")]),h.scale&&(g["font-scale"]=h.scale),h.textColor&&(g["text-color"]=["rgba"].concat(h.textColor.toNonPremultipliedRenderColor(null).toArray())),c.push(g)}return c}}class Ef{constructor(c,h={}){this.id=wa.from(c),this.params=h.params,this.sx=h.sx||1,this.sy=h.sy||1}toString(){return JSON.stringify(this)}static parse(c){let h,g,_,S;try{({id:h,params:g,sx:_,sy:S}=JSON.parse(c)||{})}catch{return null}return h?new Ef(h,{params:g,sx:_,sy:S}):null}scaleSelf(c,h=c){return this.sx*=c,this.sy*=h,this}}class _d{constructor(c,h,g,_,S=!1){this.primaryId=wa.from(c),this.primaryOptions=h,g&&(this.secondaryId=wa.from(g)),this.secondaryOptions=_,this.available=S}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Ef(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Ef(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?_d.build({name:c}):c}static build(c,h,g,_){return!c||typeof c=="object"&&!("name"in c)?null:new _d(c,g,h,_)}}function fx(f,c,h,g){return typeof f=="number"&&f>=0&&f<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof h=="number"&&h>=0&&h<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,c,h,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,c,h,g]:[f,c,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function r0(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof ja||f instanceof n5||f instanceof vd||f instanceof _d)return!0;if(Array.isArray(f)){for(const c of f)if(!r0(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!r0(f[c]))return!1;return!0}return!1}function wl(f){if(f===null)return Hh;if(typeof f=="string")return aa;if(typeof f=="boolean")return Ua;if(typeof f=="number")return wn;if(f instanceof ja)return Gd;if(f instanceof n5)return $k;if(f instanceof vd)return zv;if(f instanceof _d)return Bv;if(Array.isArray(f)){const c=f.length;let h;for(const g of f){const _=wl(g);if(h){if(h===_)continue;h=La;break}h=_}return Ic(h||La,c)}return Im}function hh(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof vd||f instanceof _d||f instanceof ja?f.toString():JSON.stringify(f)}class If{constructor(c,h){this.type=c,this.value=h}static parse(c,h){if(c.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${c.length-1} instead.`);if(!r0(c[1]))return h.error("invalid value");const g=c[1];let _=wl(g);const S=h.expectedType;return _.kind!=="array"||_.N!==0||!S||S.kind!=="array"||typeof S.N=="number"&&S.N!==0||(_=S),new If(_,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 ja?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof vd?this.value.serialize():this.value}}class dl{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const s5={string:aa,number:wn,boolean:Ua,object:Im};class Wh{constructor(c,h){this.type=c,this.args=h}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");let g,_=1;const S=c[0];if(S==="array"){let L,z;if(c.length>2){const $=c[1];if(typeof $!="string"||!($ in s5)||$==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);L=s5[$],_++}else L=La;if(c.length>3){if(c[2]!==null&&(typeof c[2]!="number"||c[2]<0||c[2]!==Math.floor(c[2])))return h.error('The length argument to "array" must be a positive integer literal',2);z=c[2],_++}g=Ic(L,z)}else g=s5[S];const C=[];for(;_c.outputDefined())}serialize(){const c=this.type,h=[c.kind];if(c.kind==="array"){const g=c.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){h.push(g.kind);const _=c.N;(typeof _=="number"||this.args.length>1)&&h.push(_)}}return h.concat(this.args.map(g=>g.serialize()))}}class Pm{constructor(c){this.type=zv,this.sections=c}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");const g=c[1];if(!Array.isArray(g)&&typeof g=="object")return h.error("First argument must be an image or text section.");const _=[];let S=!1;for(let C=1;C<=c.length-1;++C){const L=c[C];if(S&&typeof L=="object"&&!Array.isArray(L)){S=!1;let z=null;if(L["font-scale"]&&(z=h.parseObjectValue(L["font-scale"],C,"font-scale",wn),!z))return null;let $=null;if(L["text-font"]&&($=h.parseObjectValue(L["text-font"],C,"text-font",Ic(aa)),!$))return null;let K=null;if(L["text-color"]&&(K=h.parseObjectValue(L["text-color"],C,"text-color",Gd),!K))return null;const Z=_[_.length-1];Z.scale=z,Z.font=$,Z.textColor=K}else{const z=h.parse(c[C],C,La);if(!z)return null;const $=z.type.kind;if($!=="string"&&$!=="value"&&$!=="null"&&$!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");S=!0,_.push({content:z,scale:null,font:null,textColor:null})}}return new Pm(_)}evaluate(c){return new vd(this.sections.map(h=>{const g=h.content.evaluate(c);return Uk(wl(g),Bv)?new qk("",g,null,null,null):new qk(hh(g),null,h.scale?h.scale.evaluate(c):null,h.font?h.font.evaluate(c).join(","):null,h.textColor?h.textColor.evaluate(c):null)}))}eachChild(c){for(const h of this.sections)c(h.content),h.scale&&c(h.scale),h.font&&c(h.font),h.textColor&&c(h.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const h of this.sections){c.push(h.content.serialize());const g={};h.scale&&(g["font-scale"]=h.scale.serialize()),h.font&&(g["text-font"]=h.font.serialize()),h.textColor&&(g["text-color"]=h.textColor.serialize()),c.push(g)}return c}}class ms{constructor(c,h,g,_){this._imageWarnHistory={},this.type=Bv,this.namePrimary=c,this.nameSecondary=h,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),_&&(this.paramsSecondary=_.params,this.iconsetIdSecondary=_.iconset?_.iconset.id:void 0)}static parse(c,h){if(c.length<2)return h.error("Expected two or more arguments.");let g=1;const _=[];function S(){if(gwa.isEqual(C,S)),_.available){const C=_.getSecondary()?_.getSecondary().id:null;C&&(_.available=c.availableImages.some(L=>wa.isEqual(L,C)))}}return _}eachChild(c){if(c(this.namePrimary),this.paramsPrimary)for(const h in this.paramsPrimary)this.paramsPrimary[h]&&c(this.paramsPrimary[h]);if(this.nameSecondary&&(c(this.nameSecondary),this.paramsSecondary))for(const h in this.paramsSecondary)this.paramsSecondary[h]&&c(this.paramsSecondary[h])}outputDefined(){return!1}serializeOptions(c,h){const g={};if(h&&(g.iconset={id:h}),c){g.params={};for(const _ in c)c[_]&&(g.params[_]=c[_].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const c=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const h=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);h&&c.push(h)}if(this.nameSecondary&&(c.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const h=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);h&&c.push(h)}return c}}function yn(f){return Hn(f)?"string":n0(f)?"number":Hk(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 Hn(f){return typeof f=="string"||f instanceof String}function n0(f){return typeof f=="number"||f instanceof Number}function Hk(f){return typeof f=="boolean"||f instanceof Boolean}const Un={"to-boolean":Ua,"to-color":Gd,"to-number":wn,"to-string":aa};class Lm{constructor(c,h){this.type=c,this.args=h}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");const g=c[0],_=[];let S=Hh;if(g==="to-array"){if(!Array.isArray(c[1]))return null;const C=c[1].length;if(h.expectedType){if(h.expectedType.kind!=="array")return h.error(`Expected ${h.expectedType.kind} but found array.`);S=Ic(h.expectedType.itemType,C)}else{if(!(C>0&&r0(c[1][0])))return null;S=Ic(wl(c[1][0]),C)}for(let L=0;L4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:fx(h[0],h[1],h[2],h[3]),!g))return new ja(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new dl(g||`Could not parse color from value '${typeof h=="string"?h:String(JSON.stringify(h))}'`)}if(this.type.kind==="number"){let h=null;for(const g of this.args){if(h=g.evaluate(c),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new dl(`Could not convert ${JSON.stringify(h)} to number.`)}return this.type.kind==="formatted"?vd.fromString(hh(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?_d.build(hh(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(h=>h.evaluate(c)):hh(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 Pm([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ms(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(h=>{c.push(h.serialize())}),c}}const a5=["Unknown","Point","LineString","Polygon"];class Wk{constructor(c,h,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=h,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"?a5[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,h=this.featureDistanceData.scale,{x:g,y:_}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*h-c[0])+this.featureDistanceData.bearing[1]*(_*h-c[1])}return 0}parseColor(c){let h=this._parseColorCache[c];return h||(h=this._parseColorCache[c]=ja.parse(c)),h}getConfig(c){return this.options?this.options.get(c):null}}class bd{constructor(c,h,g,_,S){this.name=c,this.type=h,this._evaluate=g,this.args=_,this._overloadIndex=S}evaluate(c){if(!this._evaluate){const h=bd.definitions[this.name];this._evaluate=Array.isArray(h)?h[2]:h.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,h){const g=c[0],_=bd.definitions[g];if(!_)return h.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const S=Array.isArray(_)?_[0]:_.type,C=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,L=[];let z=null,$=-1;for(const[K,Z]of C){if(Array.isArray(K)&&K.length!==c.length-1)continue;L.push(K),$++,z=new sN(h.registry,h.path,null,h.scope,void 0,h._scope,h.options,h.iconImageUseTheme);const J=[];let re=!1;for(let ie=1;ieJ)).map(Gk).join(" | "),Z=[];for(let J=1;Jh;){if(g-h>600){const z=g-h+1,$=c-h+1,K=Math.log(z),Z=.5*Math.exp(2*K/3),J=.5*Math.sqrt(K*Z*(z-Z)/z)*($-z/2<0?-1:1);Kk(f,c,Math.max(h,Math.floor(c-$*Z/z+J)),Math.min(g,Math.floor(c+(z-$)*Z/z+J)),_)}const S=f[c];let C=h,L=g;for(Gh(f,h,c),_(f[g],S)>0&&Gh(f,h,g);C0;)L--}_(f[h],S)===0?Gh(f,h,L):(L++,Gh(f,L,g)),L<=c&&(h=L+1),c<=L&&(g=L-1)}}function Gh(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function i5(f,c){return fc?1:0}function Yp(f){let c=0;for(let h,g,_=0,S=f.length,C=S-1;_=c[2]||f[1]<=c[1]||f[3]>=c[3])}function Bie(f,c,h){const g=f[0]-c[0],_=f[1]-c[1],S=f[0]-h[0],C=f[1]-h[1];return g*C-S*_==0&&g*S<=0&&_*C<=0}function s0(f,c,h=!1){let g=!1;for(let L=0,z=c.length;L(_=f)[1]!=(C=ie)[1]>_[1]&&_[0]<(C[0]-S[0])*(_[1]-S[1])/(C[1]-S[1])+S[0]&&(g=!g)}}var _,S,C;return g}function qv(f,c,h,g){const _=g[0]-h[0],S=g[1]-h[1],C=(f[0]-h[0])*S-_*(f[1]-h[1]),L=(c[0]-h[0])*S-_*(c[1]-h[1]);return C>0&&L<0||C<0&&L>0}function Vv(f,c,h,g){return(_=[g[0]-h[0],g[1]-h[1]])[0]*(S=[c[0]-f[0],c[1]-f[1]])[1]-_[1]*S[0]!=0&&!(!qv(f,c,h,g)||!qv(h,g,f,c));var _,S}function Pf(f){const c=new ir(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=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),h.xh[2]){const _=.5*g;let S=f[0]-h[0]>_?-g:h[0]-f[0]>_?g:0;S===0&&(S=f[0]-h[2]>_?-g:h[2]-f[0]>_?g:0),f[0]+=S}mh(c,f)}function DP(f,c,h,g){const _=Math.pow(2,g.z)*Xp,S=[g.x*Xp,g.y*Xp],C=[];if(!f)return C;for(const L of f)for(const z of L){const $=[z.x+S[0],z.y+S[1]];OP($,c,h,_),C.push($)}return C}function Zk(f,c,h,g){const _=Math.pow(2,g.z)*Xp,S=[g.x*Xp,g.y*Xp],C=[];if(!f)return C;for(const z of f){const $=[];for(const K of z){const Z=[K.x+S[0],K.y+S[1]];mh(c,Z),$.push(Z)}C.push($)}if(c[2]-c[0]<=_/2){(L=c)[0]=L[1]=1/0,L[2]=L[3]=-1/0;for(const z of C)for(const $ of z)OP($,c,h,_)}var L;return C}class Jp{constructor(c,h){this.type=Ua,this.geojson=c,this.geometries=h}static parse(c,h){if(c.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${c.length-1} instead.`);if(r0(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let _=0;_h)return Yk(S,C,(h-(g-L))/L)}return c[c.length-1]}pointToSegmentDistance(c,h,g){let[_,S]=h,C=Pu(g[0]-_)*this.kx,L=(g[1]-S)*this.ky;if(C!==0||L!==0){const z=(Pu(c[0]-_)*this.kx*C+(c[1]-S)*this.ky*L)/(C*C+L*L);z>1?(_=g[0],S=g[1]):z>0&&(_+=C/this.kx*z,S+=L/this.ky*z)}return C=Pu(c[0]-_)*this.kx,L=(c[1]-S)*this.ky,Math.sqrt(C*C+L*L)}pointOnLine(c,h){let g=1/0,_=c[0][0],S=c[0][1],C=0,L=0;for(let z=0;z1?($=c[z+1][0],K=c[z+1][1]):re>0&&($+=Z/this.kx*re,K+=J/this.ky*re)),Z=Pu(h[0]-$)*this.kx,J=(h[1]-K)*this.ky;const ie=Z*Z+J*J;ieS.index||_.index===S.index&&_.t>S.t){const $=_;_=S,S=$}const C=[_.point],L=_.index+1,z=S.index;!c5(g[L],C[0])&&L<=z&&C.push(g[L]);for(let $=L+1;$<=z;$++)C.push(g[$]);return c5(g[z],S.point)||C.push(S.point),C}lineSliceAlong(c,h,g){let _=0;const S=[];for(let C=0;Cc&&S.length===0&&S.push(Yk(L,z,(c-(_-$))/$)),_>=h)return S.push(Yk(L,z,(h-(_-$))/$)),S;_>c&&S.push(z)}return S}bufferPoint(c,h){const g=h/this.ky,_=h/this.kx;return[c[0]-_,c[1]-g,c[0]+_,c[1]+g]}bufferBBox(c,h){const g=h/this.ky,_=h/this.kx;return[c[0]-_,c[1]-g,c[2]+_,c[3]+g]}insideBBox(c,h){return Pu(c[0]-h[0])>=0&&Pu(c[0]-h[2])<=0&&c[1]>=h[1]&&c[1]<=h[3]}}function c5(f,c){return f[0]===c[0]&&f[1]===c[1]}function Yk(f,c,h){const g=Pu(c[0]-f[0]);return[f[0]+g*h,f[1]+(c[1]-f[1])*h]}function Pu(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class Xk{constructor(c=[],h=(g,_)=>g<_?-1:g>_?1:0){if(this.data=c,this.length=this.data.length,this.compare=h,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],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:h,compare:g}=this,_=h[c];for(;c>0;){const S=c-1>>1,C=h[S];if(g(_,C)>=0)break;h[c]=C,c=S}h[c]=_}_down(c){const{data:h,compare:g}=this,_=this.length>>1,S=h[c];for(;c<_;){let C=1+(c<<1);const L=C+1;if(L=0)break;h[c]=h[C],c=C}h[c]=S}}var Ir=8192;function d5(f,c){return c.dist-f.dist}const Qk=100,Jk=50;function u5(f){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==f.length)return!1;for(let h=0;h=f[0]&&f[1]f[1])return[null,null];const h=Wv(f);if(c){if(h===2)return[f,null];const g=Math.floor(h/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(h===1)return[f,null];const g=Math.floor(h/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function px(f,c){const h=[1/0,1/0,-1/0,-1/0];if(!Om(c,f.length))return h;for(let g=c[0];g<=c[1];++g)mh(h,f[g]);return h}function gx(f){const c=[1/0,1/0,-1/0,-1/0];for(let h=0;hc[2]&&(g=f[0]-c[2]),f[1]>c[3]&&(_=f[1]-c[3]),f[3]=g)return g;if(Uv(_,S)){if(f5(f,c))return 0}else if(f5(c,f))return 0;let C=g;for(const L of f)for(let z=0,$=L.length,K=$-1;z<$;K=z++)for(const Z of c)for(let J=0,re=Z.length,ie=re-1;J=S)continue;const K=$.range1;if(Wv(K)<=L){if(!Om(K,f.length))return NaN;if(c){const Z=Wie(f,K,h,g);if((S=Math.min(S,Z))===0)return S}else for(let Z=K[0];Z<=K[1];++Z){const J=Hie(f[Z],h,g);if((S=Math.min(S,J))===0)return S}}else{const Z=h5(K,c);if(Z[0]!==null){const J=eg(px(f,Z[0]),z,g);J=C)continue;const Z=K.range1,J=K.range2;if(Wv(Z)<=z&&Wv(J)<=$){if(!Om(Z,f.length)||!Om(J,h.length))return NaN;if(c&&g?C=Math.min(C,ia(f,Z,h,J,_)):c||g?c&&!g?C=Math.min(C,m5(h,J,f,Z,_)):!c&&g&&(C=Math.min(C,m5(f,Z,h,J,_))):C=Math.min(C,Vie(f,Z,h,J,_)),C===0)return C}else{const re=h5(Z,c),ie=h5(J,g);Di(L,C,_,f,h,re[0],ie[0]),Di(L,C,_,f,h,re[0],ie[1]),Di(L,C,_,f,h,re[1],ie[0]),Di(L,C,_,f,h,re[1],ie[1])}}return C}function p5(f,c,h,g,_=1/0){let S=_;const C=px(f,[0,f.length-1]);for(const L of h)if(!(S!==1/0&&eg(C,px(L,[0,L.length-1]),g)>=S)&&(S=Math.min(S,BP(f,c,L,!0,g,S)),S===0))return S;return S}function rN(f,c,h,g,_=1/0){let S=_;const C=px(f,[0,f.length-1]);for(const L of h){if(S!==1/0&&eg(C,gx(L),g)>=S)continue;const z=Kie(f,c,L,g,S);if(isNaN(z))return z;if((S=Math.min(S,z))===0)return S}return S}function g5(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class xx{constructor(c,h){this.type=wn,this.geojson=c,this.geometries=h}static parse(c,h){if(c.length!==2)return h.error(`'distance' expression requires either one argument, but found ' ${c.length-1} instead.`);if(r0(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let _=0;_{c&&!o0(h)&&(c=!1)}),c}function Gv(f){if(f instanceof bd&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(h=>{c&&!Gv(h)&&(c=!1)}),c}function l0(f,c){if(f instanceof bd&&c.indexOf(f.name)>=0)return!1;let h=!0;return f.eachChild(g=>{h&&!l0(g,c)&&(h=!1)}),h}function $P(f,c,h){return[f,c,h].filter(Boolean).join("")}function x5(f,c){switch(f){case"string":return hh(c);case"number":return+c;case"boolean":return!!c;case"color":return ja.parse(c);case"formatted":return vd.fromString(hh(c));case"resolvedImage":return _d.build(hh(c))}return c}function UP(f,c,h,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fh&&(f=h),f}class c0{constructor(c,h,g,_=!1){this.type=c,this.key=h,this.scope=g,this.featureConstant=_}static parse(c,h){let g=h.expectedType;if(g==null&&(g=La),c.length<2||c.length>3)return h.error("Invalid number of arguments for 'config' expression.");const _=h.parse(c[1],1);if(!(_ instanceof If))return h.error("Key name of 'config' expression must be a string literal.");let S,C=!0;const L=hh(_.value);if(c.length>=3){const z=h.parse(c[2],2);if(!(z instanceof If))return h.error("Scope of 'config' expression must be a string literal.");S=hh(z.value)}if(h.options){const z=$P(L,S,h._scope),$=h.options.get(z);$&&(C=o0($.value||$.default))}return new c0(g,L,S,C)}evaluate(c){const h=$P(this.key,this.scope,c.scope),g=c.getConfig(h);if(!g)return null;const{type:_,value:S,values:C,minValue:L,maxValue:z,stepValue:$}=g,K=g.default.evaluate(c);let Z=K;if(S){const J=c.scope;c.scope=(J||"").split("").slice(1).join(""),Z=S.evaluate(c),c.scope=J}return _&&(Z=x5(_,Z)),Z===void 0||L===void 0&&z===void 0&&$===void 0||(typeof Z=="number"?Z=UP(Z,L,z,$):Array.isArray(Z)&&(Z=Z.map(J=>typeof J=="number"?UP(J,L,z,$):J))),S!==void 0&&Z!==void 0&&C&&!C.includes(Z)&&(Z=K,_&&(Z=x5(_,Z))),(_&&_!==this.type||Z!==void 0&&!Uk(wl(Z),this.type))&&(Z=x5(this.type.kind,Z)),Z}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class nN{constructor(c,h){this.type=h.type,this.name=c,this.boundExpression=h}static parse(c,h){if(c.length!==2||typeof c[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const g=c[1];return h.scope.has(g)?new nN(g,h.scope.get(g)):h.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 sN{constructor(c,h=[],g,_=new t0,S=[],C,L,z){this.registry=c,this.path=h,this.key=h.map($=>typeof $=="string"?`['${$}']`:`[${$}]`).join(""),this.scope=_,this.errors=S,this.expectedType=g,this._scope=C,this.options=L,this.iconImageUseTheme=z}parse(c,h,g,_,S={}){return h||g?this.concat(h,null,g,_)._parse(c,S):this._parse(c,S)}parseObjectValue(c,h,g,_,S,C={}){return this.concat(h,g,_,S)._parse(c,C)}_parse(c,h){function g(_,S,C){return C==="assert"?new Wh(S,[_]):C==="coerce"?new Lm(S,[_]):_}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 _=typeof c[0]=="string"?this.registry[c[0]]:void 0;if(_){let S=_.parse(c,this);if(!S)return null;if(this.expectedType){const C=this.expectedType,L=S.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||L.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string"){if(this.checkSubtype(C,L))return null}else S=g(S,C,h.typeAnnotation||"coerce");else S=g(S,C,h.typeAnnotation||"assert")}if(!(S instanceof If)&&S.type.kind!=="resolvedImage"&&y5(S)){const C=new Wk(this._scope,this.options,this.iconImageUseTheme);try{S=new If(S.type,S.evaluate(C))}catch(L){return this.error(L.message),null}}return S}return Lm.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,h,g,_){let S=typeof c=="number"?this.path.concat(c):this.path;S=typeof h=="string"?S.concat(h):S;const C=_?this.scope.concat(_):this.scope;return new sN(this.registry,S,g||null,C,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...h){const g=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new uh(g,c))}checkSubtype(c,h){const g=Zp(c,h);return g&&this.error(g),g}}function y5(f){if(f instanceof nN)return y5(f.boundExpression);if(f instanceof bd&&f.name==="error"||f instanceof Pl||f instanceof Jp||f instanceof xx||f instanceof c0)return!1;const c=f instanceof Lm||f instanceof Wh;let h=!0;return f.eachChild(g=>{h=c?h&&y5(g):h&&g instanceof If}),!!h&&o0(f)&&l0(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 aN(f,c){const h=f.length-1;let g,_,S=0,C=h,L=0;for(;S<=C;)if(L=Math.floor((S+C)/2),g=f[L],_=f[L+1],g<=c){if(L===h||c<_)return L;S=L+1}else{if(!(g>c))throw new dl("Input is not a number.");C=L-1}return 0}class Kv{constructor(c,h,g){this.type=c,this.input=h,this.labels=[],this.outputs=[];for(const[_,S]of g)this.labels.push(_),this.outputs.push(S)}static parse(c,h){if(c.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if((c.length-1)%2!=0)return h.error("Expected an even number of arguments.");const g=h.parse(c[1],1,wn);if(!g)return null;const _=[];let S=null;h.expectedType&&h.expectedType.kind!=="value"&&(S=h.expectedType);for(let C=1;C=L)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',$);const Z=h.parse(z,K,S);if(!Z)return null;S=S||Z.type,_.push([L,Z])}return new Kv(S,g,_)}evaluate(c){const h=this.labels,g=this.outputs;if(h.length===1)return g[0].evaluate(c);const _=this.input.evaluate(c);if(_<=h[0])return g[0].evaluate(c);const S=h.length;return _>=h[S-1]?g[S-1].evaluate(c):g[aN(h,_)].evaluate(c)}eachChild(c){c(this.input);for(const h of this.outputs)c(h)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){const c=["step",this.input.serialize()];for(let h=0;h0&&c.push(this.labels[h]),c.push(this.outputs[h].serialize());return c}}const qP=.95047,VP=1.08883,HP=4/29,d0=6/29,WP=3*d0*d0,Zie=d0*d0*d0,Yie=Math.PI/180,Xie=180/Math.PI;function v5(f){return f>Zie?Math.pow(f,1/3):f/WP+HP}function _5(f){return f>d0?f*f*f:WP*(f-HP)}function b5(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function w5(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function GP(f){const c=w5(f.r),h=w5(f.g),g=w5(f.b),_=v5((.4124564*c+.3575761*h+.1804375*g)/qP),S=v5((.2126729*c+.7151522*h+.072175*g)/1);return{l:116*S-16,a:500*(_-S),b:200*(S-v5((.0193339*c+.119192*h+.9503041*g)/VP)),alpha:f.a}}function iN(f){let c=(f.l+16)/116,h=isNaN(f.a)?c:c+f.a/500,g=isNaN(f.b)?c:c-f.b/200;return c=1*_5(c),h=qP*_5(h),g=VP*_5(g),new ja(b5(3.2404542*h-1.5371385*c-.4985314*g),b5(-.969266*h+1.8760108*c+.041556*g),b5(.0556434*h-.2040259*c+1.0572252*g),f.alpha)}function oN(f,c,h){const g=c-f;return f+h*(g>180||g<-180?g-360*Math.round(g/360):g)}const u0={forward:GP,reverse:iN,interpolate:function(f,c,h){return{l:zn(f.l,c.l,h),a:zn(f.a,c.a,h),b:zn(f.b,c.b,h),alpha:zn(f.alpha,c.alpha,h)}}},Zv={forward:function(f){const{l:c,a:h,b:g}=GP(f),_=Math.atan2(g,h)*Xie;return{h:_<0?_+360:_,c:Math.sqrt(h*h+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*Yie,h=f.c;return iN({l:f.l,a:Math.cos(c)*h,b:Math.sin(c)*h,alpha:f.alpha})},interpolate:function(f,c,h){return{h:oN(f.h,c.h,h),c:zn(f.c,c.c,h),l:zn(f.l,c.l,h),alpha:zn(f.alpha,c.alpha,h)}}};var KP=Object.freeze({__proto__:null,hcl:Zv,lab:u0});class Lu{constructor(c,h,g,_,S){this.type=c,this.operator=h,this.interpolation=g,this.input=_,this.labels=[],this.outputs=[];for(const[C,L]of S)this.labels.push(C),this.outputs.push(L)}static interpolationFactor(c,h,g,_){let S=0;if(c.name==="exponential")S=lN(h,c.base,g,_);else if(c.name==="linear")S=lN(h,1,g,_);else if(c.name==="cubic-bezier"){const C=c.controlPoints;S=new ji(C[0],C[1],C[2],C[3]).solve(lN(h,1,g,_))}return S}static parse(c,h){let[g,_,S,...C]=c;if(!Array.isArray(_)||_.length===0)return h.error("Expected an interpolation type expression.",1);if(_[0]==="linear")_={name:"linear"};else if(_[0]==="exponential"){const $=_[1];if(typeof $!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);_={name:"exponential",base:$}}else{if(_[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(_[0])}`,1,0);{const $=_.slice(1);if($.length!==4||$.some(K=>typeof K!="number"||K<0||K>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:$}}}if(c.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length-1>3&&(c.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(S=h.parse(S,2,wn),!S)return null;const L=[];let z=null;g==="interpolate-hcl"||g==="interpolate-lab"?z=Gd:h.expectedType&&h.expectedType.kind!=="value"&&(z=h.expectedType);for(let $=0;$=K)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',J);const ie=h.parse(Z,re,z);if(!ie)return null;z=z||ie.type,L.push([K,ie])}return z.kind==="number"||z.kind==="color"||z.kind==="array"&&z.itemType.kind==="number"&&typeof z.N=="number"?new Lu(z,g,_,S,L):h.error(`Type ${Bo(z)} is not interpolatable.`)}evaluate(c){const h=this.labels,g=this.outputs;if(h.length===1)return g[0].evaluate(c);const _=this.input.evaluate(c);if(_<=h[0])return g[0].evaluate(c);const S=h.length;if(_>=h[S-1])return g[S-1].evaluate(c);const C=aN(h,_),L=Lu.interpolationFactor(this.interpolation,_,h[C],h[C+1]),z=g[C].evaluate(c),$=g[C+1].evaluate(c);return this.operator==="interpolate"?Fv[this.type.kind.toLowerCase()](z,$,L):this.operator==="interpolate-hcl"?Zv.reverse(Zv.interpolate(Zv.forward(z),Zv.forward($),L)):u0.reverse(u0.interpolate(u0.forward(z),u0.forward($),L))}eachChild(c){c(this.input);for(const h of this.outputs)c(h)}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 h=[this.operator,c,this.input.serialize()];for(let g=0;gZp(_,L.type));return new Yv(C?La:g,S)}evaluate(c){let h,g=null,_=0;for(const S of this.args){if(_++,g=S.evaluate(c),g&&g instanceof _d&&!g.available&&(h||(h=g),g=null,_===this.args.length))return h;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(h=>{c.push(h.serialize())}),c}}class Lf{constructor(c,h){this.type=h.type,this.bindings=[].concat(c),this.result=h}evaluate(c){return this.result.evaluate(c)}eachChild(c){for(const h of this.bindings)c(h[1]);c(this.result)}static parse(c,h){if(c.length<4)return h.error(`Expected at least 3 arguments, but found ${c.length-1} instead.`);const g=[];for(let S=1;S=g.length)throw new dl("Array index out of bounds: index exceeds array size");if(h!==Math.floor(h))throw new dl("Array index must be an integer. Use at-interpolated for fractional indices");return g[h]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class dN{constructor(c,h,g){this.type=c,this.index=h,this.input=g}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,wn),_=h.parse(c[2],2,Ic(h.expectedType||La));return g&&_?new dN(_.type.itemType,g,_):null}evaluate(c){const h=this.index.evaluate(c),g=this.input.evaluate(c);if(h<0)throw new dl(`Array index out of bounds: ${h} < 0.`);if(h>g.length-1)throw new dl(`Array index out of bounds: ${h} > ${g.length-1}.`);if(h===Math.floor(h))return g[h];const _=Math.floor(h),S=Math.ceil(h),C=g[_],L=g[S];if(typeof C!="number"||typeof L!="number")throw new dl(`Cannot interpolate between non-number values at index ${h}.`);const z=h-_;return C*(1-z)+L*z}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class j5{constructor(c,h){this.type=Ua,this.needle=c,this.haystack=h}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,La),_=h.parse(c[2],2,La);return g&&_?r5(g.type,[Ua,aa,wn,Hh,La])?new j5(g,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bo(g.type)} instead`):null}evaluate(c){const h=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!$v(h,["boolean","string","number","null"]))throw new dl(`Expected first argument to be of type boolean, string, number or null, but found ${Bo(wl(h))} instead.`);if(!$v(g,["string","array"]))throw new dl(`Expected second argument to be of type array or string, but found ${Bo(wl(g))} instead.`);return g.indexOf(h)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class h0{constructor(c,h,g){this.type=wn,this.needle=c,this.haystack=h,this.fromIndex=g}static parse(c,h){if(c.length<=2||c.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,La),_=h.parse(c[2],2,La);if(!g||!_)return null;if(!r5(g.type,[Ua,aa,wn,Hh,La]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bo(g.type)} instead`);if(c.length===4){const S=h.parse(c[3],3,wn);return S?new h0(g,_,S):null}return new h0(g,_)}evaluate(c){const h=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(!$v(h,["boolean","string","number","null"]))throw new dl(`Expected first argument to be of type boolean, string, number or null, but found ${Bo(wl(h))} instead.`);if(!$v(g,["string","array"]))throw new dl(`Expected second argument to be of type array or string, but found ${Bo(wl(g))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(c);return g.indexOf(h,_)}return g.indexOf(h)}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 Xv{constructor(c,h,g,_,S,C){this.inputType=c,this.type=h,this.input=g,this.cases=_,this.outputs=S,this.otherwise=C}static parse(c,h){if(c.length<5)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length%2!=1)return h.error("Expected an even number of arguments.");let g,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const S={},C=[];for(let $=2;$Number.MAX_SAFE_INTEGER)return J.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ie=="number"&&Math.floor(ie)!==ie)return J.error("Numeric branch labels must be integer values.");if(g){if(J.checkSubtype(g,wl(ie)))return null}else g=wl(ie);if(S[String(ie)]!==void 0)return J.error("Branch labels must be unique.");S[String(ie)]=C.length}const re=h.parse(Z,$,_);if(!re)return null;_=_||re.type,C.push(re)}const L=h.parse(c[1],1,La);if(!L)return null;const z=h.parse(c[c.length-1],c.length-1,_);return z?L.type.kind!=="value"&&h.concat(1).checkSubtype(g,L.type)?null:new Xv(g,_,L,S,C,z):null}evaluate(c){const h=this.input.evaluate(c);return(Uk(wl(h),this.inputType)&&this.outputs[this.cases[h]]||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()],h=Object.keys(this.cases).sort(),g=[],_={};for(const C of h){const L=_[this.cases[C]];L===void 0?(_[this.cases[C]]=g.length,g.push([this.cases[C],[C]])):g[L][1].push(C)}const S=C=>this.inputType.kind==="number"?Number(C):C;for(const[C,L]of g)c.push(L.length===1?S(L[0]):L.map(S)),c.push(this.outputs[C].serialize());return c.push(this.otherwise.serialize()),c}}class Qv{constructor(c,h,g){this.type=c,this.branches=h,this.otherwise=g}static parse(c,h){if(c.length<4)return h.error(`Expected at least 3 arguments, but found only ${c.length-1}.`);if(c.length%2!=0)return h.error("Expected an odd number of arguments.");let g;h.expectedType&&h.expectedType.kind!=="value"&&(g=h.expectedType);const _=[];for(let C=1;Ch.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(h=>{c.push(h.serialize())}),c}}class uN{constructor(c,h,g,_){this.type=c,this.input=h,this.beginIndex=g,this.endIndex=_}static parse(c,h){if(c.length<=2||c.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,La),_=h.parse(c[2],2,wn);if(!g||!_)return null;if(!r5(g.type,[Ic(La),aa,La]))return h.error(`Expected first argument to be of type array or string, but found ${Bo(g.type)} instead`);if(c.length===4){const S=h.parse(c[3],3,wn);return S?new uN(g.type,g,_,S):null}return new uN(g.type,g,_)}evaluate(c){const h=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!$v(h,["string","array"]))throw new dl(`Expected first argument to be of type array or string, but found ${Bo(wl(h))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(c);return h.slice(g,_)}return h.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 k5{constructor(c,h){this.type=Ic(aa),this.str=c,this.delimiter=h}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,aa),_=h.parse(c[2],2,aa);return g&&_?new k5(g,_):void 0}evaluate(c){const h=this.str.evaluate(c),g=this.delimiter.evaluate(c);return h.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,h,g){return g.compare(c,h)===0}function m0(f,c,h){const g=f!=="=="&&f!=="!=";return class BOe{constructor(S,C,L){this.type=Ua,this.lhs=S,this.rhs=C,this.collator=L,this.hasUntypedArgument=S.type.kind==="value"||C.type.kind==="value"}static parse(S,C){if(S.length!==3&&S.length!==4)return C.error("Expected two or three arguments.");const L=S[0];let z=C.parse(S[1],1,La);if(!z)return null;if(!N5(L,z.type))return C.concat(1).error(`"${L}" comparisons are not supported for type '${Bo(z.type)}'.`);let $=C.parse(S[2],2,La);if(!$)return null;if(!N5(L,$.type))return C.concat(2).error(`"${L}" comparisons are not supported for type '${Bo($.type)}'.`);if(z.type.kind!==$.type.kind&&z.type.kind!=="value"&&$.type.kind!=="value")return C.error(`Cannot compare types '${Bo(z.type)}' and '${Bo($.type)}'.`);g&&(z.type.kind==="value"&&$.type.kind!=="value"?z=new Wh($.type,[z]):z.type.kind!=="value"&&$.type.kind==="value"&&($=new Wh(z.type,[$])));let K=null;if(S.length===4){if(z.type.kind!=="string"&&$.type.kind!=="string"&&z.type.kind!=="value"&&$.type.kind!=="value")return C.error("Cannot use collator to compare non-string types.");if(K=C.parse(S[3],3,$k),!K)return null}return new BOe(z,$,K)}evaluate(S){const C=this.lhs.evaluate(S),L=this.rhs.evaluate(S);if(g&&this.hasUntypedArgument){const z=wl(C),$=wl(L);if(z.kind!==$.kind||z.kind!=="string"&&z.kind!=="number")throw new dl(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${z.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const z=wl(C),$=wl(L);if(z.kind!=="string"||$.kind!=="string")return c(S,C,L)}return this.collator?h(S,C,L,this.collator.evaluate(S)):c(S,C,L)}eachChild(S){S(this.lhs),S(this.rhs),this.collator&&S(this.collator)}outputDefined(){return!0}serialize(){const S=[f];return this.eachChild(C=>{S.push(C.serialize())}),S}}}const Qie=m0("==",function(f,c,h){return c===h},S5),Jie=m0("!=",function(f,c,h){return c!==h},function(f,c,h,g){return!S5(0,c,h,g)}),ZP=m0("<",function(f,c,h){return c",function(f,c,h){return c>h},function(f,c,h,g){return g.compare(c,h)>0}),hN=m0("<=",function(f,c,h){return c<=h},function(f,c,h,g){return g.compare(c,h)<=0}),eoe=m0(">=",function(f,c,h){return c>=h},function(f,c,h,g){return g.compare(c,h)>=0});class mN{constructor(c,h,g,_,S,C){this.type=aa,this.number=c,this.locale=h,this.currency=g,this.unit=_,this.minFractionDigits=S,this.maxFractionDigits=C}static parse(c,h){if(c.length!==3)return h.error("Expected two arguments.");const g=h.parse(c[1],1,wn);if(!g)return null;const _=c[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let S=null;if(_.locale&&(S=h.parseObjectValue(_.locale,2,"locale",aa),!S))return null;let C=null;if(_.currency&&(C=h.parseObjectValue(_.currency,2,"currency",aa),!C))return null;let L=null;if(_.unit&&(L=h.parseObjectValue(_.unit,2,"unit",aa),!L))return null;let z=null;if(_["min-fraction-digits"]&&(z=h.parseObjectValue(_["min-fraction-digits"],2,"min-fraction-digits",wn),!z))return null;let $=null;return _["max-fraction-digits"]&&($=h.parseObjectValue(_["max-fraction-digits"],2,"max-fraction-digits",wn),!$)?null:new mN(g,S,C,L,z,$)}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 C5{constructor(c){this.type=wn,this.input=c}static parse(c,h){if(c.length!==2)return h.error(`Expected 1 argument, but found ${c.length-1} instead.`);const g=h.parse(c[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${Bo(g.type)} instead.`):new C5(g):null}evaluate(c){const h=this.input.evaluate(c);if(typeof h=="string"||Array.isArray(h))return h.length;throw new dl(`Expected value to be of type string or array, but found ${Bo(wl(h))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(h=>{c.push(h.serialize())}),c}}function XP(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 f0={"==":Qie,"!=":Jie,">":YP,"<":ZP,">=":eoe,"<=":hN,array:Wh,at:cN,"at-interpolated":dN,boolean:Wh,case:Qv,coalesce:Yv,collator:Pl,format:Pm,image:ms,in:j5,"index-of":h0,interpolate:Lu,"interpolate-hcl":Lu,"interpolate-lab":Lu,length:C5,let:Lf,literal:If,match:Xv,number:Wh,"number-format":mN,object:Wh,slice:uN,step:Kv,string:Wh,"to-boolean":Lm,"to-color":Lm,"to-number":Lm,"to-string":Lm,var:nN,within:Jp,distance:xx,config:c0,split:k5};function M5(f,[c,h,g,_]){c=c.evaluate(f),h=h.evaluate(f),g=g.evaluate(f);const S=_?_.evaluate(f):1,C=fx(c,h,g,S);if(C)throw new dl(C);return new ja(c/255,h/255,g/255,S)}function T5(f,[c,h,g,_]){c=c.evaluate(f),h=h.evaluate(f),g=g.evaluate(f);const S=_?_.evaluate(f):1,C=function($,K,Z,J){return typeof $=="number"&&$>=0&&$<=360?typeof K=="number"&&K>=0&&K<=100&&typeof Z=="number"&&Z>=0&&Z<=100?J===void 0||typeof J=="number"&&J>=0&&J<=1?null:`Invalid hsla value [${[$,K,Z,J].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof J=="number"?[$,K,Z,J]:[$,K,Z]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof J=="number"?[$,K,Z,J]:[$,K,Z]).join(", ")}]: 'h' must be between 0 and 360.`}(c,h,g,S);if(C)throw new dl(C);const L=`hsla(${c}, ${h}%, ${g}%, ${S})`,z=ja.parse(L);if(!z)throw new dl(`Failed to parse HSLA color: ${L}`);return z}function QP(f,c){return f in c}function A5(f,c){const h=c[f];return h===void 0?null:h}function rg(f){return{type:f}}function yx(f){if(f instanceof c0)return new Set([f.key]);let c=new Set;return f.eachChild(h=>{c=new Set([...c,...yx(h)])}),c}function fN(f){if(f instanceof bd&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(h=>{!c&&fN(h)&&(c=!0)}),c}function JP(f){return{result:"success",value:f}}function ng(f){return{result:"error",value:f}}function E5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Jv(f){return f["property-type"]==="data-driven"}function e6(f){return E5(f.expression,"measure-light")}function t6(f){return E5(f.expression,"zoom")}function pN(f){return!!f.expression&&f.expression.interpolated}function gN(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function r6(f){return f}function n6(f,c){const h=c.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",_=g||!(g||f.property!==void 0),S=f.type||(pN(c)?"exponential":"interval");if(h&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map($=>[$[0],ja.parse($[1])])),f.default=ja.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!KP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let C,L,z;if(S==="exponential")C=s6;else if(S==="interval")C=roe;else if(S==="categorical"){C=toe,L=Object.create(null);for(const $ of f.stops)L[$[0]]=$[1];z=typeof f.stops[0][0]}else{if(S!=="identity")throw new Error(`Unknown function type "${S}"`);C=a6}if(g){const $={},K=[];for(let re=0;rere[0]),evaluate:({zoom:re},ie)=>s6({stops:Z,base:f.base},c,re).evaluate(re,ie)}}if(_){const $=S==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:$,interpolationFactor:Lu.interpolationFactor.bind(void 0,$),zoomStops:f.stops.map(K=>K[0]),evaluate:({zoom:K})=>C(f,c,K,L,z)}}return{kind:"source",evaluate($,K){const Z=K&&K.properties?K.properties[f.property]:void 0;return Z===void 0?Dm(f.default,c.default):C(f,c,Z,L,z)}}}function Dm(f,c,h){return f!==void 0?f:c!==void 0?c:h!==void 0?h:void 0}function toe(f,c,h,g,_){return Dm(typeof h===_?g[h]:void 0,f.default,c.default)}function roe(f,c,h){if(!n0(h))return Dm(f.default,c.default);const g=f.stops.length;if(g===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[g-1][0])return f.stops[g-1][1];const _=aN(f.stops.map(S=>S[0]),h);return f.stops[_][1]}function s6(f,c,h){const g=f.base!==void 0?f.base:1;if(!n0(h))return Dm(f.default,c.default);const _=f.stops.length;if(_===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[_-1][0])return f.stops[_-1][1];const S=aN(f.stops.map(K=>K[0]),h),C=function(K,Z,J,re){const ie=re-J,ge=K-J;return ie===0?0:Z===1?ge/ie:(Math.pow(Z,ge)-1)/(Math.pow(Z,ie)-1)}(h,g,f.stops[S][0],f.stops[S+1][0]),L=f.stops[S][1],z=f.stops[S+1][1];let $=Fv[c.type]||r6;if(f.colorSpace&&f.colorSpace!=="rgb"){const K=KP[f.colorSpace];$=(Z,J)=>K.reverse(K.interpolate(K.forward(Z),K.forward(J),C))}return typeof L.evaluate=="function"?{evaluate(...K){const Z=L.evaluate.apply(void 0,K),J=z.evaluate.apply(void 0,K);if(Z!==void 0&&J!==void 0)return $(Z,J,C)}}:$(L,z,C)}function a6(f,c,h){return c.type==="color"?h=ja.parse(h):c.type==="formatted"?h=vd.fromString(h.toString()):c.type==="resolvedImage"?h=_d.build(h.toString()):yn(h)===c.type||c.type==="enum"&&c.values[h]||(h=void 0),Dm(h,f.default,c.default)}bd.register(f0,{error:[{kind:"error"},[aa],(f,[c])=>{throw new dl(c.evaluate(f))}],typeof:[aa,[La],(f,[c])=>Bo(wl(c.evaluate(f)))],"to-rgba":[Ic(wn,4),[Gd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Ic(wn,4),[Gd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Gd,[wn,wn,wn],M5],rgba:[Gd,[wn,wn,wn,wn],M5],hsl:[Gd,[wn,wn,wn],T5],hsla:[Gd,[wn,wn,wn,wn],T5],has:{type:Ua,overloads:[[[aa],(f,[c])=>QP(c.evaluate(f),f.properties())],[[aa,Im],(f,[c,h])=>QP(c.evaluate(f),h.evaluate(f))]]},get:{type:La,overloads:[[[aa],(f,[c])=>A5(c.evaluate(f),f.properties())],[[aa,Im],(f,[c,h])=>A5(c.evaluate(f),h.evaluate(f))]]},"feature-state":[La,[aa],(f,[c])=>A5(c.evaluate(f),f.featureState||{})],properties:[Im,[],f=>f.properties()],"geometry-type":[aa,[],f=>f.geometryType()],worldview:[aa,[],f=>f.globals.worldview||""],"is-active-floor":[Ua,rg(aa),(f,c)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const h=f.globals.activeFloors;return c.some(g=>{const _=g.evaluate(f);return h.has(_)})}],id:[La,[],f=>f.id()],zoom:[wn,[],f=>f.globals.zoom],pitch:[wn,[],f=>f.globals.pitch||0],"distance-from-center":[wn,[],f=>f.distanceFromCenter()],"measure-light":[wn,[aa],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[wn,[],f=>f.globals.heatmapDensity||0],"line-progress":[wn,[],f=>f.globals.lineProgress||0],"raster-value":[wn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[wn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[wn,[],f=>f.globals.skyRadialProgress||0],accumulated:[La,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[wn,rg(wn),(f,c)=>{let h=0;for(const g of c)h+=g.evaluate(f);return h}],"*":[wn,rg(wn),(f,c)=>{let h=1;for(const g of c)h*=g.evaluate(f);return h}],"-":{type:wn,overloads:[[[wn,wn],(f,[c,h])=>c.evaluate(f)-h.evaluate(f)],[[wn],(f,[c])=>-c.evaluate(f)]]},"/":[wn,[wn,wn],(f,[c,h])=>c.evaluate(f)/h.evaluate(f)],"%":[wn,[wn,wn],(f,[c,h])=>c.evaluate(f)%h.evaluate(f)],ln2:[wn,[],()=>Math.LN2],pi:[wn,[],()=>Math.PI],e:[wn,[],()=>Math.E],"^":[wn,[wn,wn],(f,[c,h])=>Math.pow(c.evaluate(f),h.evaluate(f))],sqrt:[wn,[wn],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[wn,[wn],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[wn,[wn],(f,[c])=>Math.log(c.evaluate(f))],log2:[wn,[wn],(f,[c])=>Math.log2(c.evaluate(f))],sin:[wn,[wn],(f,[c])=>Math.sin(c.evaluate(f))],cos:[wn,[wn],(f,[c])=>Math.cos(c.evaluate(f))],tan:[wn,[wn],(f,[c])=>Math.tan(c.evaluate(f))],asin:[wn,[wn],(f,[c])=>Math.asin(c.evaluate(f))],acos:[wn,[wn],(f,[c])=>Math.acos(c.evaluate(f))],atan:[wn,[wn],(f,[c])=>Math.atan(c.evaluate(f))],min:[wn,rg(wn),(f,c)=>Math.min(...c.map(h=>h.evaluate(f)))],max:[wn,rg(wn),(f,c)=>Math.max(...c.map(h=>h.evaluate(f)))],abs:[wn,[wn],(f,[c])=>Math.abs(c.evaluate(f))],round:[wn,[wn],(f,[c])=>{const h=c.evaluate(f);return h<0?-Math.round(-h):Math.round(h)}],floor:[wn,[wn],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[wn,[wn],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[Ua,[aa,La],(f,[c,h])=>f.properties()[c.value]===h.value],"filter-id-==":[Ua,[La],(f,[c])=>f.id()===c.value],"filter-type-==":[Ua,[aa],(f,[c])=>f.geometryType()===c.value],"filter-<":[Ua,[aa,La],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g<_}],"filter-id-<":[Ua,[La],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h":[Ua,[aa,La],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g>_}],"filter-id->":[Ua,[La],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>g}],"filter-<=":[Ua,[aa,La],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g<=_}],"filter-id-<=":[Ua,[La],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h<=g}],"filter->=":[Ua,[aa,La],(f,[c,h])=>{const g=f.properties()[c.value],_=h.value;return typeof g==typeof _&&g>=_}],"filter-id->=":[Ua,[La],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>=g}],"filter-has":[Ua,[La],(f,[c])=>c.value in f.properties()],"filter-has-id":[Ua,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Ua,[Ic(aa)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[Ua,[Ic(La)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[Ua,[aa,Ic(La)],(f,[c,h])=>h.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[Ua,[aa,Ic(La)],(f,[c,h])=>function(g,_,S,C){for(;S<=C;){const L=S+C>>1;if(_[L]===g)return!0;_[L]>g?C=L-1:S=L+1}return!1}(f.properties()[c.value],h.value,0,h.value.length-1)],all:{type:Ua,overloads:[[[Ua,Ua],(f,[c,h])=>c.evaluate(f)&&h.evaluate(f)],[rg(Ua),(f,c)=>{for(const h of c)if(!h.evaluate(f))return!1;return!0}]]},any:{type:Ua,overloads:[[[Ua,Ua],(f,[c,h])=>c.evaluate(f)||h.evaluate(f)],[rg(Ua),(f,c)=>{for(const h of c)if(h.evaluate(f))return!0;return!1}]]},"!":[Ua,[Ua],(f,[c])=>!c.evaluate(f)],"is-supported-script":[Ua,[aa],(f,[c])=>{const h=f.globals&&f.globals.isSupportedScript;return!h||h(c.evaluate(f))}],upcase:[aa,[aa],(f,[c])=>c.evaluate(f).toUpperCase()],downcase:[aa,[aa],(f,[c])=>c.evaluate(f).toLowerCase()],concat:[aa,rg(La),(f,c)=>c.map(h=>hh(h.evaluate(f))).join("")],"resolved-locale":[aa,[$k],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[wn,[wn,wn,La],(f,c)=>{const[h,g,_]=c.map(C=>C.evaluate(f));if(h>g||h===g)return h;let S;if(typeof _=="string")S=function(C){let L=0;if(C.length===0)return L;for(let z=0;zJSON.stringify(Z)).join(", ")}, but found ${JSON.stringify(K)} instead.`);return K}catch(K){const Z=K;return this._warningHistory[Z.message]||(this._warningHistory[Z.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${Z.message}`)),this._defaultValue}}}function e_(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in f0}function sg(f,c,h,g,_){const S=new sN(f0,[],c?function(L){const z={color:Gd,string:aa,number:wn,enum:aa,boolean:Ua,formatted:zv,resolvedImage:Bv};return L.type==="array"?Ic(z[L.value]||La,L.length):z[L.type]}(c):void 0,void 0,void 0,h,g,_),C=S.parse(f,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return C?JP(new xN(C,c,h,g,_)):ng(S.errors)}class p0{constructor(c,h,g,_){this.kind=c,this._styleExpression=h,this.isLightConstant=g,this.isLineProgressConstant=_,this.isStateDependent=c!=="constant"&&!Gv(h.expression),this.configDependencies=yx(h.expression),this.isIndoorDependent=fN(h.expression)}evaluateWithoutErrorHandling(c,h,g,_,S,C){return this._styleExpression.evaluateWithoutErrorHandling(c,h,g,_,S,C)}evaluate(c,h,g,_,S,C,L){return this._styleExpression.evaluate(c,h,g,_,S,C,void 0,void 0,L)}}class vx{constructor(c,h,g,_,S,C){this.kind=c,this.zoomStops=g,this._styleExpression=h,this.isStateDependent=c!=="camera"&&!Gv(h.expression),this.isIndoorDependent=fN(h.expression),this.isLightConstant=S,this.isLineProgressConstant=C,this.configDependencies=yx(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(c,h,g,_,S,C){return this._styleExpression.evaluateWithoutErrorHandling(c,h,g,_,S,C)}evaluate(c,h,g,_,S,C){return this._styleExpression.evaluate(c,h,g,_,S,C)}interpolationFactor(c,h,g){return this.interpolationType?Lu.interpolationFactor(this.interpolationType,c,h,g):0}}function I5(f,c,h,g,_){if((f=sg(f,c,h,g,_)).result==="error")return f;const S=f.value.expression,C=o0(S);if(!C&&!Jv(c))return ng([new uh("","data expressions not supported")]);const L=l0(S,["zoom","pitch","distance-from-center"]);if(!L&&!t6(c))return ng([new uh("","zoom expressions not supported")]);const z=l0(S,["measure-light"]);if(!z&&!e6(c))return ng([new uh("","measure-light expression not supported")]);const $=l0(S,["line-progress"]);if(!$&&!function(J){return E5(J.expression,"line-progress")}(c))return ng([new uh("","line-progress expression not supported")]);const K=c.expression&&c.expression.relaxZoomRestriction,Z=Kh(S);return Z||L||K?Z instanceof uh?ng([Z]):Z instanceof Lu&&!pN(c)?ng([new uh("",'"interpolate" expressions cannot be used with this property')]):JP(Z?new vx(C&&$?"camera":"composite",f.value,Z.labels,Z instanceof Lu?Z.interpolation:void 0,z,$):new p0(C&&$?"constant":"source",f.value,z,$)):ng([new uh("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class yN{constructor(c,h){this._parameters=c,this._specification=h,Object.assign(this,n6(this._parameters,this._specification))}static deserialize(c){return new yN(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Kh(f){let c=null;if(f instanceof Lf)c=Kh(f.result);else if(f instanceof Yv){for(const h of f.args)if(c=Kh(h),c)break}else(f instanceof Kv||f instanceof Lu)&&f.input instanceof bd&&f.input.name==="zoom"&&(c=f);return c instanceof uh||f.eachChild(h=>{const g=Kh(h);g instanceof uh?c=g:c&&g&&c!==g&&(c=new uh("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var P5,i6,o6=function(){if(i6)return P5;i6=1,P5=c;var f=3;function c(h,g,_){var S=this.cells=[];if(h instanceof ArrayBuffer){this.arrayBuffer=h;var C=new Int32Array(this.arrayBuffer);h=C[0],this.d=(g=C[1])+2*(_=C[2]);for(var L=0;L=J[ge+0]&&S>=J[ge+1])?(z[ie]=!0,L.push(Z[ie])):z[ie]=!1}}},c.prototype._forEachCell=function(h,g,_,S,C,L,z,$){for(var K=this._convertToCellCoord(h),Z=this._convertToCellCoord(g),J=this._convertToCellCoord(_),re=this._convertToCellCoord(S),ie=K;ie<=J;ie++)for(var ge=Z;ge<=re;ge++){var Se=this.d*ge+ie;if((!$||$(this._convertFromCellCoord(ie),this._convertFromCellCoord(ge),this._convertFromCellCoord(ie+1),this._convertFromCellCoord(ge+1)))&&C.call(this,h,g,_,S,Se,L,z,$))return}},c.prototype._convertFromCellCoord=function(h){return(h-this.padding)/this.scale},c.prototype._convertToCellCoord=function(h){return Math.max(0,Math.min(this.d-1,Math.floor(h*this.scale)+this.padding))},c.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var h=this.cells,g=f+this.cells.length+1+1,_=0,S=0;S=0||(_[S]=Of(f[S],c)));f instanceof Error&&(_.message=f.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return g!=="Object"&&(_.$name=g),_}throw new Error("can't serialize object of type "+typeof f)}function ag(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||t_(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(ag);if(typeof f=="object"){const c=f.$name||"Object";if(c==="Map"){const _=f.entries||[],S=new Map;for(let C=0;C<_.length;C+=2)S.set(ag(_[C]),ag(_[C+1]));return S}if(c==="Set"){const _=new Set;for(const S of Object.keys(f))S!=="$name"&&_.add(ag(f[S]));return _}if(c==="BigInt")return BigInt(f.value);const{klass:h}=_x[c];if(!h)throw new Error(`Can't deserialize unregistered class "${c}".`);if(h.deserialize)return h.deserialize(f);const g=Object.create(h.prototype);for(const _ of Object.keys(f))_!=="$name"&&(g[_]=ag(f[_]));return g}throw new Error("can't deserialize object of type "+typeof f)}const In={"Latin-1 Supplement":f=>f>=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 r_(f){for(const c of f)if(vN(c.charCodeAt(0)))return!0;return!1}function L5(f){for(const c of f)if(!l6(c.charCodeAt(0)))return!1;return!0}function l6(f){return!(In.Arabic(f)||In["Arabic Supplement"](f)||In["Arabic Extended-A"](f)||In["Arabic Presentation Forms-A"](f)||In["Arabic Presentation Forms-B"](f))}function vN(f){return!(f!==746&&f!==747&&(f<4352||!(In["Bopomofo Extended"](f)||In.Bopomofo(f)||In["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||In["CJK Compatibility Ideographs"](f)||In["CJK Compatibility"](f)||In["CJK Radicals Supplement"](f)||In["CJK Strokes"](f)||!(!In["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||In["CJK Unified Ideographs Extension A"](f)||In["CJK Unified Ideographs"](f)||In["Enclosed CJK Letters and Months"](f)||In["Hangul Compatibility Jamo"](f)||In["Hangul Jamo Extended-A"](f)||In["Hangul Jamo Extended-B"](f)||In["Hangul Jamo"](f)||In["Hangul Syllables"](f)||In.Hiragana(f)||In["Ideographic Description Characters"](f)||In.Kanbun(f)||In["Kangxi Radicals"](f)||In["Katakana Phonetic Extensions"](f)||In.Katakana(f)&&f!==12540||!(!In["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)||!(!In["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||In["Unified Canadian Aboriginal Syllabics"](f)||In["Unified Canadian Aboriginal Syllabics Extended"](f)||In["Vertical Forms"](f)||In["Yijing Hexagram Symbols"](f)||In["Yi Syllables"](f)||In["Yi Radicals"](f))))}function _N(f){return!(vN(f)||function(c){return!!(In["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||In["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)||In["Letterlike Symbols"](c)||In["Number Forms"](c)||In["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)||In["Control Pictures"](c)&&c!==9251||In["Optical Character Recognition"](c)||In["Enclosed Alphanumerics"](c)||In["Geometric Shapes"](c)||In["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||In["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||In["CJK Symbols and Punctuation"](c)||In.Katakana(c)||In["Private Use Area"](c)||In["CJK Compatibility Forms"](c)||In["Small Form Variants"](c)||In["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 bN(f){return In.Arabic(f)||In["Arabic Supplement"](f)||In["Arabic Extended-A"](f)||In["Arabic Presentation Forms-A"](f)||In["Arabic Presentation Forms-B"](f)}function O5(f){return f>=1424&&f<=2303||In["Arabic Presentation Forms-A"](f)||In["Arabic Presentation Forms-B"](f)}function Df(f,c){return!(!c&&O5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||In.Khmer(f))}function noe(f){for(const c of f)if(O5(c.charCodeAt(0)))return!0;return!1}const du={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let D5=null,wd=du.unavailable,Rf=null;const n_=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(wd=du.error),D5&&D5(f)};function wN(){jN.fire(new Or("pluginStateChange",{pluginStatus:wd,pluginURL:Rf}))}const jN=new Ps,s_=function(){return wd},c6=function(){if(wd!==du.deferred||!Rf)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");wd=du.loading,wN(),Rf&&Iu({url:Rf},f=>{f?n_(f):(wd=du.loaded,wN())})},Ff={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>wd===du.loaded||Ff.applyArabicShaping!=null,isLoading:()=>wd===du.loading,setState(f){wd=f.pluginStatus,Rf=f.pluginURL},isParsing:()=>wd===du.parsing,isParsed:()=>wd===du.parsed,getPluginURL:()=>Rf};class li{constructor(c,h){this.zoom=c,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.transition=h.transition,this.pitch=h.pitch,this.brightness=h.brightness,this.worldview=h.worldview,this.activeFloors=h.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(c){return function(h,g){for(const _ of h)if(!Df(_.charCodeAt(0),g))return!1;return!0}(c,Ff.isLoaded())}}class kN{constructor(c,h,g,_,S){this.property=c,this.value=h,this.expression=function(C,L,z,$,K){if(gN(C))return new yN(C,L);if(e_(C)||Array.isArray(C)&&C.length>0){const Z=I5(C,L,z,$,K);if(Z.result==="error")throw new Error(Z.value.map(J=>`${J.key}: ${J.message}`).join(", "));return Z.value}{let Z=C;return typeof C=="string"&&L.type==="color"&&(Z=ja.parse(C)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>Z}}}(h===void 0?c.specification.default:h,c.specification,g,_,S)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,h,g,_){return this.property.possiblyEvaluate(this,c,h,g,_)}}class R5{constructor(c,h,g,_){this.property=c,this.value=new kN(c,void 0,h,g,_)}transitioned(c,h){return new u6(this.property,this.value,h,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new u6(this.property,this.value,null,{},0)}}class d6{constructor(c,h,g,_){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=h,this._options=g,this._iconImageUseTheme=_,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return cr(this._values[c].value.value)}setValue(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new R5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new kN(this._values[c].property,h===null?void 0:cr(h),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,h){h&&(this._options=h);const g=this._properties.properties;if(c)for(const _ in c){const S=c[_];if(_.endsWith("-transition")){const C=_.slice(0,-11);g[C]&&this.setTransition(C,S)}else g.hasOwnProperty(_)&&this.setValue(_,S)}}getTransition(c){return cr(this._values[c].transition)}setTransition(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new R5(this._values[c].property)),this._values[c].transition=cr(h)||void 0}serialize(){const c={};for(const h of Object.keys(this._values)){const g=this.getValue(h);g!==void 0&&(c[h]=g);const _=this.getTransition(h);_!==void 0&&(c[`${h}-transition`]=_)}return c}transitioned(c,h){const g=new h6(this._properties);for(const _ of Object.keys(this._values))g._values[_]=this._values[_].transitioned(c,h._values[_]);return g}untransitioned(){const c=new h6(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class u6{constructor(c,h,g,_,S){const C=_.delay||0,L=_.duration||0;S=S||0,this.property=c,this.value=h,this.begin=S+C,this.end=this.begin+L,c.specification.transition&&(_.delay||_.duration)&&(this.prior=g)}possiblyEvaluate(c,h,g){const _=c.now||0,S=this.value.possiblyEvaluate(c,h,g),C=this.prior;if(C){if(_>this.end)return this.prior=null,S;if(this.value.isDataDriven())return this.prior=null,S;if(_":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 f6(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function NN(f){if(Array.isArray(f))return f.map(NN);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const c={};for(const h in f)c[h]=NN(f[h]);return c}return f6(f)}function Rm(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(!Rm(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function SN(f,c="",h=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Rm(f)||(f=CN(f));const _=f;let S=!0;try{S=function(K){if(!x0(K))return K;let Z=NN(K);return p6(Z),Z=kx(Z),Z}(_)}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(_,null,2)} `)}let C=null,L=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){L=Bt[`filter_${g}`];const K=sg(S,L,c,h);if(K.result==="error")throw new Error(K.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));C=(Z,J,re)=>K.value.evaluate(Z,J,{},re)}let z=null,$=null;if(S!==_){const K=sg(_,L,c,h);if(K.result==="error")throw new Error(K.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));z=(Z,J,re,ie,ge)=>K.value.evaluate(Z,J,{},re,void 0,void 0,ie,ge),$=!o0(K.value.expression)}return{filter:C,dynamicFilter:z||void 0,needGeometry:g6(S),needFeature:!!$}}function kx(f){if(!Array.isArray(f))return f;const c=function(h){if(soe.has(h[0])){for(let g=1;gkx(h))}function p6(f){let c=!1;const h=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function aoe(f,c){return fc?1:0}function g6(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?MN(f[1],f[2],c):c==="any"?(h=f.slice(1),["any"].concat(h.map(CN))):c==="all"?["all"].concat(f.slice(1).map(CN)):c==="none"?["all"].concat(f.slice(1).map(CN).map(a_)):c==="in"?TN(f[1],f.slice(2)):c==="!in"?a_(TN(f[1],f.slice(2))):c==="has"?AN(f[1]):c!=="!has"||a_(AN(f[1]));var h}function MN(f,c,h){switch(f){case"$type":return[`filter-type-${h}`,c];case"$id":return[`filter-id-${h}`,c];default:return[`filter-${h}`,f,c]}}function TN(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(h=>typeof h!=typeof c[0])?["filter-in-large",f,["literal",c.sort(aoe)]]:["filter-in-small",f,["literal",c]]}}function AN(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function a_(f){return["!",f]}const Nx="";function Zh(f,c){return c?`${f}${Nx}${c}`:f}let x6;const y6=()=>x6||(x6=new to({"icon-size":new zr(Bt.layout_symbol["icon-size"]),"icon-image":new zr(Bt.layout_symbol["icon-image"]),"icon-rotate":new zr(Bt.layout_symbol["icon-rotate"]),"icon-offset":new zr(Bt.layout_symbol["icon-offset"]),"text-size":new zr(Bt.layout_symbol["text-size"]),"text-rotate":new zr(Bt.layout_symbol["text-rotate"]),"text-offset":new zr(Bt.layout_symbol["text-offset"])}));class v6{constructor(c,h,g,_,S,C){const L=sg(c,Bt.appearance.condition);if(L.result==="success"&&(this.condition=L.value),this.name=h,g){this.properties=new wx(y6()),this.unevaluatedLayout=new m6(y6(),_,S,C);for(const z in g)this.unevaluatedLayout.setValue(z,g[z])}}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,h,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,h,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"),h=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),_=this.hasProperty("icon-rotate");return c||h||g||_}hasTextProperties(){const c=this.hasProperty("text-size"),h=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return c||h||g}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const _6="-transition",Fm=new Set(["fill","line","background","hillshade","raster"]);class jd extends Ps{constructor(c,h,g,_,S,C){if(super(),this.id=c.id,this.fqid=Zh(this.id,g),this.type=c.type,this.scope=g,this.lut=_,this.options=S,this.iconImageUseTheme=C,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 L=sg(this.filter,Bt[`filter_${c.type}`]);L.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...L.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||L.value.isIndoorDependent)}if(c.slot&&(this.slot=c.slot),c.appearances&&this.setAppearances(c.appearances),h.layout&&(this._unevaluatedLayout=new m6(h.layout,this.scope,S,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),h.paint){this._transitionablePaint=new d6(h.paint,this.scope,S);for(const L in c.paint)this.setPaintProperty(L,c.paint[L]);for(const L in c.layout)this.setLayoutProperty(L,c.layout[L]);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 wx(h.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&Fm.has(this.type)}getLayoutProperty(c){return c==="visibility"?this.visibility:this._unevaluatedLayout.getValue(c)}setLayoutProperty(c,h){if(this.type==="custom"&&c==="visibility")return void(this.visibility=h);const g=this._unevaluatedLayout;g._properties.properties[c]&&(g.setValue(c,h),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(h=>{this.appearances.push(new v6(h.condition,h.name,h.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(_6)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,h){const g=this._transitionablePaint,_=g._properties.properties;if(c.endsWith(_6)){const Z=c.slice(0,-11);return _[Z]&&g.setTransition(Z,h||void 0),!1}if(!_[c])return!1;const S=g._values[c],C=S.value.isDataDriven(),L=S.value;g.setValue(c,h),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const z=g._values[c].value,$=z.isDataDriven(),K=c.endsWith("pattern")||c==="line-dasharray";return $||C||K||this._handleOverridablePaintPropertyUpdate(c,L,z)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,h,g){return null}_handleOverridablePaintPropertyUpdate(c,h,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,h){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,h,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,h)}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(h=>h.serialize())),pr(c,(h,g)=>!(h===void 0||g==="layout"&&!Object.keys(h).length||g==="paint"&&!Object.keys(h).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 h=this.paint.get(c);if(h instanceof bx&&Jv(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}for(const c of this.appearances)if(!Gv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=SN(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,h,g){return{}}queryRadius(c){}queryIntersectsFeature(c,h,g,_,S,C,L,z,$){}}const b6={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class i_{constructor(c,h){this._structArray=c,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const ioe=new ArrayBuffer(0);class ki{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(c,h){return c._trim(),h&&c.arrayBuffer&&h.add(c.arrayBuffer),{length:c.length,arrayBuffer:c.arrayBuffer}}static deserialize(c){const h=Object.create(this.prototype);return h.arrayBuffer=c.arrayBuffer,h.length=c.length,c.arrayBuffer?h.capacity=c.arrayBuffer.byteLength/h.bytesPerElement:(h.capacity=0,h.arrayBuffer=ioe),h._refreshViews(),h}_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 h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}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 Bs(f,c=1){let h=0,g=0;return{members:f.map(_=>{const S=b6[_.type].BYTES_PER_ELEMENT,C=h=w6(h,Math.max(c,S)),L=_.components||1;return g=Math.max(g,S),h+=S*L,{name:_.name,type:_.type,components:L,offset:C}}),size:w6(h,Math.max(g,c)),alignment:c}}function w6(f,c){return Math.ceil(f/c)*c}class ig extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const _=2*c;return this.int16[_+0]=h,this.int16[_+1]=g,c}}ig.prototype.bytesPerElement=4,nn(ig,"StructArrayLayout2i4");class y0 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,g)}emplace(c,h,g,_){const S=3*c;return this.int16[S+0]=h,this.int16[S+1]=g,this.int16[S+2]=_,c}}y0.prototype.bytesPerElement=6,nn(y0,"StructArrayLayout3i6");class v0 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,_){const S=this.length;return this.resize(S+1),this.emplace(S,c,h,g,_)}emplace(c,h,g,_,S){const C=4*c;return this.int16[C+0]=h,this.int16[C+1]=g,this.int16[C+2]=_,this.int16[C+3]=S,c}}v0.prototype.bytesPerElement=8,nn(v0,"StructArrayLayout4i8");class zf extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.float32[1*c+0]=h,c}}zf.prototype.bytesPerElement=4,nn(zf,"StructArrayLayout1f4");class F5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,g)}emplace(c,h,g,_){const S=4*c,C=2*c;return this.int16[S+0]=h,this.int16[S+1]=g,this.float32[C+1]=_,c}}F5.prototype.bytesPerElement=8,nn(F5,"StructArrayLayout2i1f8");class z5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,g)}emplace(c,h,g,_){const S=4*c;return this.int16[S+0]=h,this.int16[S+1]=g,this.int16[S+2]=_,c}}z5.prototype.bytesPerElement=8,nn(z5,"StructArrayLayout3i8");class B5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,_,S)}emplace(c,h,g,_,S,C){const L=5*c;return this.int16[L+0]=h,this.int16[L+1]=g,this.int16[L+2]=_,this.int16[L+3]=S,this.int16[L+4]=C,c}}B5.prototype.bytesPerElement=10,nn(B5,"StructArrayLayout5i10");class EN extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,g,_,S,C,L)}emplace(c,h,g,_,S,C,L,z){const $=6*c,K=12*c,Z=3*c;return this.int16[$+0]=h,this.int16[$+1]=g,this.uint8[K+4]=_,this.uint8[K+5]=S,this.uint8[K+6]=C,this.uint8[K+7]=L,this.float32[Z+2]=z,c}}EN.prototype.bytesPerElement=12,nn(EN,"StructArrayLayout2i4ub1f12");class Ou extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,g)}emplace(c,h,g,_){const S=3*c;return this.float32[S+0]=h,this.float32[S+1]=g,this.float32[S+2]=_,c}}Ou.prototype.bytesPerElement=12,nn(Ou,"StructArrayLayout3f12");class Kd extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,_,S)}emplace(c,h,g,_,S,C){const L=6*c,z=3*c;return this.uint16[L+0]=h,this.uint16[L+1]=g,this.uint16[L+2]=_,this.uint16[L+3]=S,this.float32[z+2]=C,c}}Kd.prototype.bytesPerElement=12,nn(Kd,"StructArrayLayout4ui1f12");class Sx extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,_){const S=this.length;return this.resize(S+1),this.emplace(S,c,h,g,_)}emplace(c,h,g,_,S){const C=4*c;return this.uint16[C+0]=h,this.uint16[C+1]=g,this.uint16[C+2]=_,this.uint16[C+3]=S,c}}Sx.prototype.bytesPerElement=8,nn(Sx,"StructArrayLayout4ui8");class IN extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,_,S,C)}emplace(c,h,g,_,S,C,L){const z=6*c;return this.int16[z+0]=h,this.int16[z+1]=g,this.int16[z+2]=_,this.int16[z+3]=S,this.int16[z+4]=C,this.int16[z+5]=L,c}}IN.prototype.bytesPerElement=12,nn(IN,"StructArrayLayout6i12");class $5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L,z,$,K,Z,J){const re=this.length;return this.resize(re+1),this.emplace(re,c,h,g,_,S,C,L,z,$,K,Z,J)}emplace(c,h,g,_,S,C,L,z,$,K,Z,J,re){const ie=12*c;return this.int16[ie+0]=h,this.int16[ie+1]=g,this.int16[ie+2]=_,this.int16[ie+3]=S,this.uint16[ie+4]=C,this.uint16[ie+5]=L,this.uint16[ie+6]=z,this.uint16[ie+7]=$,this.int16[ie+8]=K,this.int16[ie+9]=Z,this.int16[ie+10]=J,this.int16[ie+11]=re,c}}$5.prototype.bytesPerElement=24,nn($5,"StructArrayLayout4i4ui4i24");class U5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,_,S,C)}emplace(c,h,g,_,S,C,L){const z=10*c,$=5*c;return this.int16[z+0]=h,this.int16[z+1]=g,this.int16[z+2]=_,this.float32[$+2]=S,this.float32[$+3]=C,this.float32[$+4]=L,c}}U5.prototype.bytesPerElement=20,nn(U5,"StructArrayLayout3i3f20");class og extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_){const S=this.length;return this.resize(S+1),this.emplace(S,c,h,g,_)}emplace(c,h,g,_,S){const C=4*c;return this.float32[C+0]=h,this.float32[C+1]=g,this.float32[C+2]=_,this.float32[C+3]=S,c}}og.prototype.bytesPerElement=16,nn(og,"StructArrayLayout4f16");class PN extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint32[1*c+0]=h,c}}PN.prototype.bytesPerElement=4,nn(PN,"StructArrayLayout1ul4");class Du extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const _=2*c;return this.uint16[_+0]=h,this.uint16[_+1]=g,c}}Du.prototype.bytesPerElement=4,nn(Du,"StructArrayLayout2ui4");class LN extends ki{_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,h,g,_,S,C,L,z,$,K,Z,J,re){const ie=this.length;return this.resize(ie+1),this.emplace(ie,c,h,g,_,S,C,L,z,$,K,Z,J,re)}emplace(c,h,g,_,S,C,L,z,$,K,Z,J,re,ie){const ge=20*c,Se=10*c;return this.int16[ge+0]=h,this.int16[ge+1]=g,this.int16[ge+2]=_,this.int16[ge+3]=S,this.int16[ge+4]=C,this.float32[Se+3]=L,this.float32[Se+4]=z,this.float32[Se+5]=$,this.float32[Se+6]=K,this.int16[ge+14]=Z,this.uint32[Se+8]=J,this.uint16[ge+18]=re,this.uint16[ge+19]=ie,c}}LN.prototype.bytesPerElement=40,nn(LN,"StructArrayLayout5i4f1i1ul2ui40");class ON extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,g,_,S,C,L)}emplace(c,h,g,_,S,C,L,z){const $=8*c;return this.int16[$+0]=h,this.int16[$+1]=g,this.int16[$+2]=_,this.int16[$+4]=S,this.int16[$+5]=C,this.int16[$+6]=L,this.int16[$+7]=z,c}}ON.prototype.bytesPerElement=16,nn(ON,"StructArrayLayout3i2i2i16");class DN extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,_,S)}emplace(c,h,g,_,S,C){const L=4*c,z=8*c;return this.float32[L+0]=h,this.float32[L+1]=g,this.float32[L+2]=_,this.int16[z+6]=S,this.int16[z+7]=C,c}}DN.prototype.bytesPerElement=16,nn(DN,"StructArrayLayout2f1f2i16");class q5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,_,S,C)}emplace(c,h,g,_,S,C,L){const z=20*c,$=5*c;return this.uint8[z+0]=h,this.uint8[z+1]=g,this.float32[$+1]=_,this.float32[$+2]=S,this.float32[$+3]=C,this.float32[$+4]=L,c}}q5.prototype.bytesPerElement=20,nn(q5,"StructArrayLayout2ub4f20");class Qo extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g){const _=this.length;return this.resize(_+1),this.emplace(_,c,h,g)}emplace(c,h,g,_){const S=3*c;return this.uint16[S+0]=h,this.uint16[S+1]=g,this.uint16[S+2]=_,c}}Qo.prototype.bytesPerElement=6,nn(Qo,"StructArrayLayout3ui6");class _0 extends ki{_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,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe,Ue,Qe,xt){const mt=this.length;return this.resize(mt+1),this.emplace(mt,c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe,Ue,Qe,xt)}emplace(c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe,Ue,Qe,xt,mt){const wt=30*c,Ct=15*c,Pt=60*c;return this.int16[wt+0]=h,this.int16[wt+1]=g,this.int16[wt+2]=_,this.float32[Ct+2]=S,this.float32[Ct+3]=C,this.uint16[wt+8]=L,this.uint16[wt+9]=z,this.uint32[Ct+5]=$,this.uint32[Ct+6]=K,this.uint32[Ct+7]=Z,this.uint16[wt+16]=J,this.uint16[wt+17]=re,this.uint16[wt+18]=ie,this.float32[Ct+10]=ge,this.float32[Ct+11]=Se,this.uint8[Pt+48]=Ne,this.uint8[Pt+49]=Fe,this.uint8[Pt+50]=Ue,this.uint32[Ct+13]=Qe,this.int16[wt+28]=xt,this.uint8[Pt+58]=mt,c}}_0.prototype.bytesPerElement=60,nn(_0,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class V5 extends ki{_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,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe,Ue,Qe,xt,mt,wt,Ct,Pt,Qt,Ft,nr,ur,hr,vr,br,fr){const xr=this.length;return this.resize(xr+1),this.emplace(xr,c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe,Ue,Qe,xt,mt,wt,Ct,Pt,Qt,Ft,nr,ur,hr,vr,br,fr)}emplace(c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe,Ue,Qe,xt,mt,wt,Ct,Pt,Qt,Ft,nr,ur,hr,vr,br,fr,xr){const rr=20*c,Jt=40*c,yr=80*c;return this.float32[rr+0]=h,this.float32[rr+1]=g,this.int16[Jt+4]=_,this.int16[Jt+5]=S,this.int16[Jt+6]=C,this.int16[Jt+7]=L,this.int16[Jt+8]=z,this.int16[Jt+9]=$,this.int16[Jt+10]=K,this.int16[Jt+11]=Z,this.int16[Jt+12]=J,this.uint16[Jt+13]=re,this.uint16[Jt+14]=ie,this.uint16[Jt+15]=ge,this.uint16[Jt+16]=Se,this.uint16[Jt+17]=Ne,this.uint16[Jt+18]=Fe,this.uint16[Jt+19]=Ue,this.uint16[Jt+20]=Qe,this.uint16[Jt+21]=xt,this.uint16[Jt+22]=mt,this.uint16[Jt+23]=wt,this.uint16[Jt+24]=Ct,this.uint16[Jt+25]=Pt,this.uint16[Jt+26]=Qt,this.uint16[Jt+27]=Ft,this.uint32[rr+14]=nr,this.float32[rr+15]=ur,this.float32[rr+16]=hr,this.float32[rr+17]=vr,this.float32[rr+18]=br,this.uint8[yr+76]=fr,this.uint16[Jt+39]=xr,c}}V5.prototype.bytesPerElement=80,nn(V5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class H5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,_,S,C)}emplace(c,h,g,_,S,C,L){const z=6*c;return this.float32[z+0]=h,this.float32[z+1]=g,this.float32[z+2]=_,this.float32[z+3]=S,this.float32[z+4]=C,this.float32[z+5]=L,c}}H5.prototype.bytesPerElement=24,nn(H5,"StructArrayLayout6f24");class Cx extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,_,S)}emplace(c,h,g,_,S,C){const L=5*c;return this.float32[L+0]=h,this.float32[L+1]=g,this.float32[L+2]=_,this.float32[L+3]=S,this.float32[L+4]=C,c}}Cx.prototype.bytesPerElement=20,nn(Cx,"StructArrayLayout5f20");class W5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,g,_,S,C,L)}emplace(c,h,g,_,S,C,L,z){const $=7*c;return this.float32[$+0]=h,this.float32[$+1]=g,this.float32[$+2]=_,this.float32[$+3]=S,this.float32[$+4]=C,this.float32[$+5]=L,this.float32[$+6]=z,c}}W5.prototype.bytesPerElement=28,nn(W5,"StructArrayLayout7f28");class G5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L,z,$,K,Z){const J=this.length;return this.resize(J+1),this.emplace(J,c,h,g,_,S,C,L,z,$,K,Z)}emplace(c,h,g,_,S,C,L,z,$,K,Z,J){const re=11*c;return this.float32[re+0]=h,this.float32[re+1]=g,this.float32[re+2]=_,this.float32[re+3]=S,this.float32[re+4]=C,this.float32[re+5]=L,this.float32[re+6]=z,this.float32[re+7]=$,this.float32[re+8]=K,this.float32[re+9]=Z,this.float32[re+10]=J,c}}G5.prototype.bytesPerElement=44,nn(G5,"StructArrayLayout11f44");class b0 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L,z,$){const K=this.length;return this.resize(K+1),this.emplace(K,c,h,g,_,S,C,L,z,$)}emplace(c,h,g,_,S,C,L,z,$,K){const Z=9*c;return this.float32[Z+0]=h,this.float32[Z+1]=g,this.float32[Z+2]=_,this.float32[Z+3]=S,this.float32[Z+4]=C,this.float32[Z+5]=L,this.float32[Z+6]=z,this.float32[Z+7]=$,this.float32[Z+8]=K,c}}b0.prototype.bytesPerElement=36,nn(b0,"StructArrayLayout9f36");class zm extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const _=2*c;return this.float32[_+0]=h,this.float32[_+1]=g,c}}zm.prototype.bytesPerElement=8,nn(zm,"StructArrayLayout2f8");class Zd extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,_){const S=this.length;return this.resize(S+1),this.emplace(S,c,h,g,_)}emplace(c,h,g,_,S){const C=6*c;return this.uint32[3*c+0]=h,this.uint16[C+2]=g,this.uint16[C+3]=_,this.uint16[C+4]=S,c}}Zd.prototype.bytesPerElement=12,nn(Zd,"StructArrayLayout1ul3ui12");class lg extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint16[1*c+0]=h,c}}lg.prototype.bytesPerElement=2,nn(lg,"StructArrayLayout1ui2");class K5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se){const Ne=this.length;return this.resize(Ne+1),this.emplace(Ne,c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se)}emplace(c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne){const Fe=16*c;return this.float32[Fe+0]=h,this.float32[Fe+1]=g,this.float32[Fe+2]=_,this.float32[Fe+3]=S,this.float32[Fe+4]=C,this.float32[Fe+5]=L,this.float32[Fe+6]=z,this.float32[Fe+7]=$,this.float32[Fe+8]=K,this.float32[Fe+9]=Z,this.float32[Fe+10]=J,this.float32[Fe+11]=re,this.float32[Fe+12]=ie,this.float32[Fe+13]=ge,this.float32[Fe+14]=Se,this.float32[Fe+15]=Ne,c}}K5.prototype.bytesPerElement=64,nn(K5,"StructArrayLayout16f64");class RN extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,_,S,C,L){const z=this.length;return this.resize(z+1),this.emplace(z,c,h,g,_,S,C,L)}emplace(c,h,g,_,S,C,L,z){const $=10*c,K=5*c;return this.uint16[$+0]=h,this.uint16[$+1]=g,this.uint16[$+2]=_,this.uint16[$+3]=S,this.float32[K+2]=C,this.float32[K+3]=L,this.float32[K+4]=z,c}}RN.prototype.bytesPerElement=20,nn(RN,"StructArrayLayout4ui3f20");class Z5 extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.int16[1*c+0]=h,c}}Z5.prototype.bytesPerElement=2,nn(Z5,"StructArrayLayout1i2");class FN extends ki{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint8[1*c+0]=h,c}}FN.prototype.bytesPerElement=1,nn(FN,"StructArrayLayout1ub1");class zN extends i_{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]}}zN.prototype.size=40;class j6 extends LN{get(c){return new zN(this,c)}}nn(j6,"CollisionBoxArray");class BN extends i_{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}}BN.prototype.size=60;class k6 extends _0{get(c){return new BN(this,c)}}nn(k6,"PlacedSymbolArray");class N6 extends i_{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]}}N6.prototype.size=80;class Y5 extends V5{get(c){return new N6(this,c)}}nn(Y5,"SymbolInstanceArray");class $N extends zf{getoffsetX(c){return this.float32[1*c+0]}}nn($N,"GlyphOffsetArray");class S6 extends ig{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}nn(S6,"SymbolLineVertexArray");class X5 extends i_{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]}}X5.prototype.size=12;class Q5 extends Zd{get(c){return new X5(this,c)}}nn(Q5,"FeatureIndexArray");class C6 extends Du{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}nn(C6,"FillExtrusionCentroidArray");class UN extends i_{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]}}UN.prototype.size=6;class o_ extends y0{get(c){return new UN(this,c)}}nn(o_,"FillExtrusionWallArray");const M6=Bs([{name:"a_pos",components:2,type:"Int16"}],4),ooe=Bs([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),T6=Bs([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ui{constructor(c=[]){this.segments=c}_prepareSegment(c,h,g,_){let S=this.segments[this.segments.length-1];return c>Ui.MAX_VERTEX_ARRAY_LENGTH&&Kr(`Max vertices per segment is ${Ui.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!S||S.vertexLength+c>Ui.MAX_VERTEX_ARRAY_LENGTH||S.sortKey!==_)&&(S={vertexOffset:h,primitiveOffset:g,vertexLength:0,primitiveLength:0},_!==void 0&&(S.sortKey=_),this.segments.push(S)),S}prepareSegment(c,h,g,_){return this._prepareSegment(c,h.length,g.length,_)}get(){return this.segments}destroy(){for(const c of this.segments)for(const h in c.vaos)c.vaos[h].destroy()}static simpleSegment(c,h,g,_){return new Ui([{vertexOffset:c,primitiveOffset:h,vertexLength:g,primitiveLength:_,vaos:{},sortKey:0}])}}function qN(f,c){return 256*(f=ye(Math.floor(f),0,255))+ye(Math.floor(c),0,255)}Ui.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,nn(Ui,"SegmentVector");const loe=Bs([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),coe=Bs([{name:"a_pattern_b",components:4,type:"Uint16"}]),doe=Bs([{name:"a_dash",components:4,type:"Uint16"}]);class l_{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,h,g,_){this.ids.push(J5(c)),this.positions.push(h,g,_)}eachPosition(c,h){const g=J5(c);let _=0,S=this.ids.length-1;for(;_>1;this.ids[C]>=g?S=C:_=C+1}for(;this.ids[_]===g;)h(this.positions[3*_],this.positions[3*_+1],this.positions[3*_+2]),_++}static serialize(c,h){const g=new Float64Array(c.ids),_=new Uint32Array(c.positions);return eM(g,_,0,g.length-1),h&&(h.add(g.buffer),h.add(_.buffer)),{ids:g,positions:_}}static deserialize(c){const h=new l_;let g;h.ids=c.ids,h.positions=c.positions;for(const _ of h.ids)_!==g&&h.uniqueIds.push(_),g=_;return h.indexed=!0,h}}function J5(f){const c=+f;return Number.isSafeInteger(c)?c:gr(String(f))}function eM(f,c,h,g){for(;h>1];let S=h-1,C=g+1;for(;;){do S++;while(f[S]<_);do C--;while(f[C]>_);if(S>=C)break;VN(f,S,C),VN(c,3*S,3*C),VN(c,3*S+1,3*C+1),VN(c,3*S+2,3*C+2)}C-h`u_${S}`),this.type=g,this.context=_}setUniform(c,h,g,_,S){const C=_.constantOr(this.value);h.set(c,S,C instanceof ja?C.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):C)}getBinding(c,h){return this.type==="color"?new d_(c):new Jo(c)}}class w0{constructor(c,h){this.uniformNames=h.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(c,h){this.pixelRatio=c.pixelRatio||1,this.pattern=c.tl.concat(c.br),this.patternTransition=h?h.tl.concat(h.br):this.pattern}setUniform(c,h,g,_,S){let C=null;S!=="u_pattern"&&S!=="u_dash"||(C=this.pattern),S==="u_pattern_b"&&(C=this.patternTransition),S==="u_pixel_ratio"&&(C=this.pixelRatio),C&&h.set(c,S,C)}getBinding(c,h){return h==="u_pattern"||h==="u_pattern_b"||h==="u_dash"?new WN(c):new Jo(c)}}class $f{constructor(c,h,g,_){this.expression=c,this.type=g,this.maxValue=0,this.paintVertexAttributes=h.map(S=>({name:`a_${S}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(c,h,g,_,S,C,L,z){const $=this.paintVertexArray.length,K=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new li(0,{brightness:C,worldview:z}),h,{},S,_,L):this.expression.kind==="constant"&&this.expression.value,Z=h_(this.lutExpression,h,{},_,S,C,L,z);this.paintVertexArray.resize(c),this._setPaintValue($,c,K,Z?null:this.context.lut)}updatePaintArray(c,h,g,_,S,C,L,z){const $=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:L,worldview:z},g,_,void 0,S):this.expression.kind==="constant"&&this.expression.value,K=h_(this.lutExpression,g,_,S,void 0,L,void 0,z);this._setPaintValue(c,h,$,K?null:this.context.lut)}_setPaintValue(c,h,g,_){if(this.type==="color"){const S=tM(g.toPremultipliedRenderColor(_));for(let C=c;C`u_${L}_t`),this.type=g,this.useIntegerZoom=_,this.context=S,this.maxValue=0,this.paintVertexAttributes=h.map(L=>({name:`a_${L}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new C}populatePaintArray(c,h,g,_,S,C,L,z){const $=this.expression.evaluate(new li(this.context.zoom,{brightness:C,worldview:z}),h,{},S,_,L),K=this.expression.evaluate(new li(this.context.zoom+1,{brightness:C,worldview:z}),h,{},S,_,L),Z=h_(this.lutExpression,h,{},_,S,C,L,z),J=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(J,c,$,K,Z?null:this.context.lut)}updatePaintArray(c,h,g,_,S,C,L,z){const $=this.expression.evaluate({zoom:this.context.zoom,brightness:L,worldview:z},g,_,void 0,S),K=this.expression.evaluate({zoom:this.context.zoom+1,brightness:L,worldview:z},g,_,void 0,S),Z=h_(this.lutExpression,g,_,S,void 0,L,void 0,z);this._setPaintValue(c,h,$,K,Z?null:this.context.lut)}_setPaintValue(c,h,g,_,S){if(this.type==="color"){const C=tM(g.toPremultipliedRenderColor(S)),L=tM(g.toPremultipliedRenderColor(S));for(let z=c;z!0){this.binders={},this._buffers=[],this.context=h;const _=[];for(const S in c.paint._values){const C=c.paint.get(S);if(S.endsWith("-use-theme")||!g(S)||!(C instanceof bx&&Jv(C.property.specification)))continue;const L=foe(S,c.type),z=C.value,$=C.property.specification.type,K=!!C.property.useIntegerZoom,Z=S==="line-dasharray"||S.endsWith("pattern"),J=c.paint.get(`${S}-use-theme`),re=S==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||J&&J.value.kind!=="constant";if(z.kind!=="constant"||re)if(z.kind==="source"||re||Z){const ie=rM(S,$,"source");this.binders[S]=Z?new qf(z,L,$,ie,c.id):new $f(z,L,$,ie),_.push(`/a_${S}`)}else{const ie=rM(S,$,"composite");this.binders[S]=new Uf(z,L,$,K,h,ie),_.push(`/z_${S}`)}else this.binders[S]=Z?new w0(z.value,L):new m_(z.value,L,$,h),_.push(`/u_${S}`);J&&(this.binders[S].lutExpression=J.value)}this.cacheKey=_.sort().join("")}getMaxValue(c){const h=this.binders[c];return h instanceof $f||h instanceof Uf?h.maxValue:0}populatePaintArrays(c,h,g,_,S,C,L,z){for(const $ in this.binders){const K=this.binders[$];K.context=this.context,(K instanceof $f||K instanceof Uf||K instanceof qf)&&K.populatePaintArray(c,h,g,_,S,C,L,z)}}setConstantPatternPositions(c,h){for(const g in this.binders){const _=this.binders[g];_ instanceof w0&&_.setConstantPatternPositions(c,h)}}getPatternTransitionVertexBuffer(c){const h=this.binders[c];return h instanceof qf?h.paintTransitionVertexBuffer:null}updatePaintArrays(c,h,g,_,S,C,L,z,$,K){let Z=!1;const J=Object.keys(c),re=J.length!==0&&!z,ie=re?J:h.uniqueIds;this.context.lut=S.lut;for(const ge in this.binders){const Se=this.binders[ge];if(Se.context=this.context,(Se instanceof $f||Se instanceof Uf||Se instanceof qf)&&Se.expression&&Se.expression.kind&&Se.expression.kind!=="constant"&&(Se.expression.isStateDependent===!0||Se.expression.isLightConstant===!1)){const Ne=S.paint.get(ge);Se.expression=Ne.value;for(const Fe of ie){const Ue=c[Fe.toString()];h.eachPosition(Fe,(Qe,xt,mt)=>{const wt=_.feature(Qe);Se.updatePaintArray(xt,mt,wt,Ue,C,L,$,K)})}if(!re)for(const Fe of g.uniqueIds){const Ue=c[Fe.toString()];g.eachPosition(Fe,(Qe,xt,mt)=>{const wt=_.feature(Qe);Se.updatePaintArray(xt,mt,wt,Ue,C,L,$,K)})}Z=!0}}return Z}defines(){const c=[];for(const h in this.binders){const g=this.binders[h];(g instanceof m_||g instanceof w0)&&c.push(...g.uniformNames.map(_=>`#define HAS_UNIFORM_${_}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const h=[];for(const g in this.binders){const _=this.binders[g];if(_ instanceof m_||_ instanceof w0||_ instanceof Uf)for(const S of _.uniformNames)h.push({name:S,property:g,binding:_.getBinding(c,S)})}return h}setUniforms(c,h,g,_,S){for(const{name:C,property:L,binding:z}of g)this.binders[L].setUniform(c,z,S,_.get(L),C)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const h=this.binders[c];(h instanceof $f||h instanceof Uf||h instanceof qf)&&h.paintVertexBuffer&&this._buffers.push(h.paintVertexBuffer),h instanceof qf&&h.paintTransitionVertexBuffer&&this._buffers.push(h.paintTransitionVertexBuffer)}}upload(c){for(const h in this.binders){const g=this.binders[h];(g instanceof $f||g instanceof Uf||g instanceof qf)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const h=this.binders[c];(h instanceof $f||h instanceof Uf||h instanceof qf)&&h.destroy()}}}class Yh{constructor(c,h,g=()=>!0){this.programConfigurations={};for(const _ of c)this.programConfigurations[_.id]=new cg(_,h,g);this.needsUpload=!1,this._featureMap=new l_,this._featureMapWithoutIds=new l_,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,h,g,_,S,C,L,z,$){for(const K in this.programConfigurations)this.programConfigurations[K].populatePaintArrays(c,h,_,S,C,L,z,$);h.id!==void 0?this._featureMap.add(h.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,h,g,_,S,C,L,z){for(const $ of g)this.needsUpload=this.programConfigurations[$.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,h,$,_,S,C,L||0,z)||this.needsUpload}get(c){return this.programConfigurations[c]}upload(c){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(c);this.needsUpload=!1}}destroy(){for(const c in this.programConfigurations)this.programConfigurations[c].destroy()}}const moe={"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 foe(f,c){return moe[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const poe={"line-pattern":{source:Kd,composite:Kd},"fill-pattern":{source:Kd,composite:Kd},"fill-extrusion-pattern":{source:Kd,composite:Kd},"line-dasharray":{source:Sx,composite:Sx}},goe={color:{source:zm,composite:og},number:{source:zf,composite:zm}};function rM(f,c,h){const g=poe[f];return g&&g[h]||goe[c][h]}nn(m_,"ConstantBinder"),nn(w0,"PatternConstantBinder"),nn($f,"SourceExpressionBinder"),nn(qf,"PatternCompositeBinder"),nn(Uf,"CompositeExpressionBinder"),nn(cg,"ProgramConfiguration",{omit:["_buffers"]}),nn(Yh,"ProgramConfigurationSet");const Pc=Ir/Math.PI/2,ph=5,ZN=6,xoe=16383,j0=64,nM=[j0,32,16],gh=-Pc,xh=Pc;function Mx(f,c,h,g=Pc){return h=qn(h),[f*Math.sin(h)*g,-c*g,f*Math.cos(h)*g]}function k0(f,c,h){return Mx(Math.cos(qn(f)),Math.sin(qn(f)),c,h)}const w=63710088e-1,d=2*Math.PI*w;class p{constructor(c,h){if(isNaN(c)||isNaN(h))throw new Error(`Invalid LngLat object: (${c}, ${h})`);if(this.lng=+c,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new p(Ye(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const h=Math.PI/180,g=this.lat*h,_=c.lat*h,S=Math.sin(g)*Math.sin(_)+Math.cos(g)*Math.cos(_)*Math.cos((c.lng-this.lng)*h);return w*Math.acos(Math.min(S,1))}toBounds(c=0){const h=360*c/40075017,g=h/Math.cos(Math.PI/180*this.lat);return new j({lng:this.lng-g,lat:this.lat-h},{lng:this.lng+g,lat:this.lat+h})}toEcef(c){return k0(this.lat,this.lng,Pc+c*Pc/w)}static convert(c){if(c instanceof p)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new p(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new p(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 j{constructor(c,h){c&&(h?this.setSouthWest(c).setNorthEast(h):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 p?new p(c.lng,c.lat):p.convert(c),this}setSouthWest(c){return this._sw=c instanceof p?new p(c.lng,c.lat):p.convert(c),this}extend(c){const h=this._sw,g=this._ne;let _,S;if(c instanceof p)_=c,S=c;else{if(!(c instanceof j))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(j.convert(c)):this.extend(p.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(p.convert(c)):this;if(_=c._sw,S=c._ne,!_||!S)return this}return h||g?(h.lng=Math.min(_.lng,h.lng),h.lat=Math.min(_.lat,h.lat),g.lng=Math.max(S.lng,g.lng),g.lat=Math.max(S.lat,g.lat)):(this._sw=new p(_.lng,_.lat),this._ne=new p(S.lng,S.lat)),this}getCenter(){return new p((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 p(this.getWest(),this.getNorth())}getSouthEast(){return new p(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:h,lat:g}=p.convert(c);let _=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(_=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&_}static convert(c){if(c)return c instanceof j?c:new j(c)}}const E=0,O=25.5;function R(f){return d*Math.cos(f*Math.PI/180)}function B(f){return(180+f)/360}function H(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function X(f,c){return f/R(c)}function te(f){return 360*f-180}function de(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function ce(f,c){return f*R(de(c))}const he=85.051129;function ke(f){return Math.cos(qn(ye(f,-he,he)))}function be(f,c){const h=ye(c,E,O),g=Math.pow(2,h);return ke(f)*d/(512*g)}function Re(f){return 1/Math.cos(f*Math.PI/180)}function De(f,c=0){const h=Math.exp(Math.PI*(1-(f.y+c/Ir)/(1<=z?(nt(f,c,h,$,K,S,Z,L,z),nt(f,$,K,g,_,Z,C,L,z)):f.push(C)}function Ge(f,c,h){let g=f[0],_=g.x,S=g.y;c(g);const C=[g];for(let L=1;Lf.x+1||gf.y+1)&&Kr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function St(f,c,h){const g=f.loadGeometry(),_=f.extent,S=Ir/_;if(c&&h&&h.projection.isReprojectedInTileSpace){const C=1<{const re=te((c.x+J.x/_)/C),ie=de((c.y+J.y/_)/C),ge=K.project(re,ie);J.x=(ge.x*L-z)*_,J.y=(ge.y*L-$)*_};for(let J=0;J=_||ie.y<0||ie.y>=_||(Z(ie),re.push(ie));g[J]=re}}for(const C of g)for(const L of C)ht(L,S);return g}function Rt(f,c){return{type:f.type,id:f.id,properties:f.properties,geometry:c?St(f):[]}}class Dt{constructor(c,h,g,_,S){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=c,this._geometry=-1,this._keys=_,this._values=S,c.readFields(Yt,this,h)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const h=c.readVarint()+c.pos,g=[];let _,S=1,C=0,L=0,z=0;for(;c.pos>3}if(C--,S===1||S===2)L+=c.readSVarint(),z+=c.readSVarint(),S===1&&(_&&g.push(_),_=[]),_&&_.push(new ir(L,z));else{if(S!==7)throw new Error(`unknown command ${S}`);_&&_.push(_[0].clone())}}return _&&g.push(_),g}bbox(){const c=this._pbf;c.pos=this._geometry;const h=c.readVarint()+c.pos;let g=1,_=0,S=0,C=0,L=1/0,z=-1/0,$=1/0,K=-1/0;for(;c.pos>3}if(_--,g===1||g===2)S+=c.readSVarint(),C+=c.readSVarint(),Sz&&(z=S),C<$&&($=C),C>K&&(K=C);else if(g!==7)throw new Error(`unknown command ${g}`)}return[L,$,z,K]}toGeoJSON(c,h,g){const _=this.extent*Math.pow(2,g),S=this.extent*c,C=this.extent*h,L=this.loadGeometry();function z(J){return[360*(J.x+S)/_-180,360/Math.PI*Math.atan(Math.exp((1-2*(J.y+C)/_)*Math.PI))-90]}function $(J){return J.map(z)}let K;if(this.type===1){const J=[];for(const ie of L)J.push(ie[0]);const re=$(J);K=J.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const J=L.map($);K=J.length===1?{type:"LineString",coordinates:J[0]}:{type:"MultiLineString",coordinates:J}}else{if(this.type!==3)throw new Error("unknown feature type");{const J=function(ie){const ge=ie.length;if(ge<=1)return[ie];const Se=[];let Ne,Fe;for(let Ue=0;Ue=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];const h=this._pbf.readVarint()+this._pbf.pos;return new Dt(this._pbf,h,this.extent,this._keys,this._values)}}function wr(f,c,h){f===15?c.version=h.readVarint():f===1?c.name=h.readString():f===5?c.extent=h.readVarint():f===2?c._features.push(h.pos):f===3?c._keys.push(h.readString()):f===4&&c._values.push(function(g){let _=null;const S=g.readVarint()+g.pos;for(;g.pos>3;_=C===1?g.readString():C===2?g.readFloat():C===3?g.readDouble():C===4?g.readVarint64():C===5?g.readVarint():C===6?g.readSVarint():C===7?g.readBoolean():null}if(_==null)throw new Error("unknown feature value");return _}(h))}class Vt{constructor(c,h){this.layers=c.readFields(Et,{},h)}}function Et(f,c,h){if(f===3){const g=new or(h,h.readVarint()+h.pos);g.length&&(c[g.name]=g)}}const er="3d_elevation_id",Kt="level";class mr{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,h){return this._valid&&c(h(this._geometry)),this}require(c,h,g){return this.get(c,!0,h,g)}optional(c,h,g){return this.get(c,!1,h,g)}success(){return this._valid}get(c,h,g,_){const S=this.feature.properties.hasOwnProperty(c)?+this.feature.properties[c]:void 0;return this._valid&&S!==void 0&&!Number.isNaN(S)?g(_?_(S):S):h&&(this._valid=!1),this}}class Lr{constructor(c,h){this.featureFunc=c,this.vertexFunc=h}parseFeature(c,h,g){return this.featureFunc(c,h,g)}parseVertex(c,h,g){return this.vertexFunc(c,h,g)}}const Yr=new Lr((f,c,h)=>f.reset(c).require(er,g=>{h.id=g}).optional("fixed_height_relative",g=>{h.constantHeight=g},jr.decodeRelativeHeight).geometry(g=>{h.bounds=g},Pf).success(),(f,c,h)=>f.reset(c).require(er,g=>{h.id=g}).require("elevation_idx",g=>{h.idx=g}).require("extent",g=>{h.extent=g}).require("height_relative",g=>{h.height=g},jr.decodeRelativeHeight).geometry(g=>{h.position=g},jr.getPoint).success()),Tr=new Lr((f,c,h)=>f.reset(c).require(er,g=>{h.id=g}).optional("fixed_height",g=>{h.constantHeight=g},jr.decodeMetricHeight).geometry(g=>{h.bounds=g},Pf).success(),(f,c,h)=>f.reset(c).require(er,g=>{h.id=g}).require("elevation_idx",g=>{h.idx=g}).require("extent",g=>{h.extent=g}).require("height",g=>{h.height=g},jr.decodeMetricHeight).geometry(g=>{h.position=g},jr.getPoint).success());class jr{static getPoint(c){return dr(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"?Tr:void 0:Yr}static parse(c){const h=[],g=[],_=c.length,S=new mr;for(let C=0;C<_;C++){const L=c.feature(C),z=L.properties.version,$=jr.getVersionSchema(z);if($===void 0){Kr(`Unknown elevation feature version number ${z||"(unknown)"}`);continue}const K=L.properties.type;if(!K)continue;const Z=Dt.types[L.type];if(Z==="Point"&&K==="curve_point"){const J={};$.parseVertex(S,L,J)&&h.push(J)}else if(Z==="Polygon"&&K==="curve_meta"){const J={};$.parseFeature(S,L,J)&&g.push(J)}}return{vertices:h,features:g}}}class fn{constructor(c,h){this.pos=c,this.dir=h}intersectsPlane(c,h,g){const _=Ha(h,this.dir);if(Math.abs(_)<1e-6)return!1;const S=((c[0]-this.pos[0])*h[0]+(c[1]-this.pos[1])*h[1])/_;return g[0]=this.pos[0]+this.dir[0]*S,g[1]=this.pos[1]+this.dir[1]*S,!0}}class an{constructor(c,h){this.pos=c,this.dir=h}intersectsPlane(c,h,g){const _=ot(h,this.dir);if(Math.abs(_)<1e-6)return!1;const S=((c[0]-this.pos[0])*h[0]+(c[1]-this.pos[1])*h[1]+(c[2]-this.pos[2])*h[2])/_;return g[0]=this.pos[0]+this.dir[0]*S,g[1]=this.pos[1]+this.dir[1]*S,g[2]=this.pos[2]+this.dir[2]*S,!0}closestPointOnSphere(c,h,g){if(function(re,ie){var ge=re[0],Se=re[1],Ne=re[2],Fe=ie[0],Ue=ie[1],Qe=ie[2];return Math.abs(ge-Fe)<=u*Math.max(1,Math.abs(ge),Math.abs(Fe))&&Math.abs(Se-Ue)<=u*Math.max(1,Math.abs(Se),Math.abs(Ue))&&Math.abs(Ne-Qe)<=u*Math.max(1,Math.abs(Ne),Math.abs(Qe))}(this.pos,c)||h===0)return g[0]=g[1]=g[2]=0,!1;const[_,S,C]=this.dir,L=this.pos[0]-c[0],z=this.pos[1]-c[1],$=this.pos[2]-c[2],K=_*_+S*S+C*C,Z=2*(L*_+z*S+$*C),J=Z*Z-4*K*(L*L+z*z+$*$-h*h);if(J<0){const re=Math.max(-Z/2,0),ie=L+_*re,ge=z+S*re,Se=$+C*re,Ne=Math.hypot(ie,ge,Se);return g[0]=ie*h/Ne,g[1]=ge*h/Ne,g[2]=Se*h/Ne,!1}{const re=(-Z-Math.sqrt(J))/(2*K);if(re<0){const ie=Math.hypot(L,z,$);return g[0]=L*h/ie,g[1]=z*h/ie,g[2]=$*h/ie,!1}return g[0]=L+_*re,g[1]=z+S*re,g[2]=$+C*re,!0}}}class Hr{constructor(c,h,g,_,S){this.TL=c,this.TR=h,this.BR=g,this.BL=_,this.horizon=S}static fromInvProjectionMatrix(c,h,g){const _=[-1,1,1],S=[1,1,1],C=[1,-1,1],L=[-1,-1,1],z=at(_,_,c),$=at(S,S,c),K=at(C,C,c),Z=at(L,L,c);return new Hr(z,$,K,Z,h/g)}}function Qr(f,c,h){let g=1/0,_=-1/0;const S=[];for(const C of f){je(S,C,c);const L=ot(S,h);g=Math.min(g,L),_=Math.max(_,L)}return[g,_]}function Mn(f,c){let h=!0;for(let g=0;g=0);if(S===0)return 0;S!==c.length&&(h=!1)}return h?2:1}function rs(f,c){for(const h of f.projections){const g=Qr(c,f.points[0],h.axis);if(h.projection[1]g[1])return 0}return 1}function Gs(f,c){let h=0;const g=[0,0,0,0];for(let C=0;C=0&&h++;var _,S;return h}class ka{constructor(c,h){this.points=c||new Array(8).fill([0,0,0]),this.planes=h||new Array(6).fill([0,0,0,0]),this.bounds=xn.fromPoints(this.points),this.projections=[],this.frustumEdges=[je([],this.points[2],this.points[3]),je([],this.points[0],this.points[3]),je([],this.points[4],this.points[0]),je([],this.points[5],this.points[1]),je([],this.points[6],this.points[2]),je([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const _=[0,-g[2],g[1]],S=[g[2],0,-g[0]];this.projections.push({axis:_,projection:Qr(this.points,this.points[0],_)}),this.projections.push({axis:S,projection:Qr(this.points,this.points[0],S)})}}static fromInvProjectionMatrix(c,h,g,_){const S=Math.pow(2,g),C=[[-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 K=Ke([],$,c),Z=1/K[3]/h*S;return(J=K)[0]=(re=K)[0]*(ie=[Z,Z,_?1/K[3]:Z,Z])[0],J[1]=re[1]*ie[1],J[2]=re[2]*ie[2],J[3]=re[3]*ie[3],J;var J,re,ie}),L=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map($=>{const K=Ve([],Tt([],je([],C[$[0]],C[$[1]]),je([],C[$[2]],C[$[1]]))),Z=-ot(K,C[$[1]]);return K.concat(Z)}),z=[];for(let $=0;$$[1]||$[0]>z[1])return 0}return 1}containsPoint(c){for(const h of this.planes){const g=h[3];if(ot([h[0],h[1],h[2]],c)+g<0)return!1}return!0}}class xn{static fromPoints(c){const h=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const _ of c)_e(h,h,_),we(g,g,_);return new xn(h,g)}static fromTileIdAndHeight(c,h,g){const _=1<c.max[h]||c.min[h]>this.max[h])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 h=0;h<3;h++)this.min[h]=Math.min(this.min[h],c.min[h]),this.max[h]=Math.max(this.max[h],c.max[h])}encapsulatePoint(c){for(let h=0;h<3;h++)this.min[h]=Math.min(this.min[h],c[h]),this.max[h]=Math.max(this.max[h],c[h])}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])]}}nn(xn,"Aabb");class fa{constructor(c,h){this.feature=c,this.metersToTile=h,this.index=0}get(){const c=this.feature.vertices[this.index],h=this.feature.vertexProps[this.index].dir,g=h[1],_=-h[0],S=(c.extent+1)*this.metersToTile;return[new ir(Math.trunc(c.position[0]+g*S),Math.trunc(c.position[1]+_*S)),new ir(Math.trunc(c.position[0]-g*S),Math.trunc(c.position[1]-_*S))]}next(){this.index++}valid(){return this.index{return L.a0?ve(z,z,1/$):me(z,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let h=0,g=Number.POSITIVE_INFINITY,_=0;const[S,C,L,z,$,K,Z]=this._tmpVec2;En(Z,c.x,c.y);const J=new fn(Z,null);for(let re=0;re0?Ha(z,L)/Qe:0,mt=ye(xt,0,1),wt=Math.abs((xt-mt)*this.edgeProps[re].len);Hs($,Z,Se),En(K,ge[1],-ge[0]);const Ct=wt+Math.abs(Ha($,K));Ct=0;--C){const L=this.edges[C].a,z=this.edges[C].b,{position:$,height:K,extent:Z}=this.vertices[L],{position:J,height:re,extent:ie}=this.vertices[z],ge=this.vertexProps[L].dir,Se=this.vertexProps[z].dir;if(me(h,$[0]/c,$[1]/c,K),me(g,J[0]/c,J[1]/c,re),me(_,ge[1],-ge[0],0),ve(_,_,Z),me(S,Se[1],-Se[0],0),ve(S,S,ie),this.distSqLines(se(h[0]+.5*_[0],h[1]+.5*_[1],h[2]+.5*_[2]),se(g[0]-.5*S[0],g[1]-.5*S[1],g[2]-.5*S[2]),se(h[0]-.5*_[0],h[1]-.5*_[1],h[2]-.5*_[2]),se(g[0]+.5*S[0],g[1]+.5*S[1],g[2]+.5*S[2]))<=.0025000000000000005)continue;const Ne=this.vertices.length,Fe=Es(Xn(),$,J);this.vertices.push({position:Ei(Fe,Fe,.5),height:.5*(K+re),extent:.5*(Z+ie)});const Ue=Es(Xn(),ge,Se);this.vertexProps.push({dir:Ho(Ue,Ue)}),this.edges.splice(C,1),this.edgeProps.splice(C,1),this.edges.push({a:L,b:Ne}),this.edges.push({a:Ne,b:z});const Qe=Hs(Xn(),this.vertices[Ne].position,$),xt=Ii(Qe),mt={vec:Qe,dir:Ei(Xn(),Qe,1/xt),len:xt};this.edgeProps.push(mt),this.edgeProps.push(mt)}}distSqLines(c,h,g,_){const S=xe(pe(),h,c),C=xe(pe(),_,g),L=xe(pe(),c,g),z=ot(S,S),$=ot(S,C),K=ot(S,L),Z=ot(C,C),J=ot(C,L),re=z*Z-$*$;if(re===0)return Ie(Oe(S,g,_,ot(L,C)/ot(C,C)),c);const ie=(z*J-$*K)/re;return Ie(Oe(S,c,h,($*J-K*Z)/re),Oe(C,g,_,ie))}}class Ma{static parseFrom(c,h){const g=jr.parse(c);if(!g)return[];let{vertices:_,features:S}=g;const C=1/De(h);S.sort((K,Z)=>K.id-Z.id),_.sort((K,Z)=>K.id-Z.id||K.idx-Z.idx),_=_.filter((K,Z,J)=>Z===J.findIndex(re=>re.id===K.id&&re.idx===K.idx));const L=new Array;let z=0;const $=_.length;for(const K of S){if(K.constantHeight){L.push(new Qn(K.id,K.bounds,K.constantHeight));continue}for(;z!==$&&_[z].id_.id===g)}}class qa{constructor(c,h){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(h)||(this.zScale=Math.pow(2,h.z-c.z),this.xOffset=(c.x*this.zScale-h.x)*Ir,this.yOffset=(c.y*this.zScale-h.y)*Ir)}constantElevation(c,h){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,h)}pointElevation(c,h,g){const _=this.constantElevation(h,g);return _??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(h.pointElevation(c),g))}computeBiasedHeight(c,h){return h<=0?c:c+h*Pe(0,h,c>=0?c:Math.abs(.5*c))}}nn(Qn,"ElevationFeature");class Da{constructor(c){this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.projection=c.projection,this.layoutVertexArray=new ig,this.indexArray=new Qo,this.segments=new Ui,this.programConfigurations=new Yh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new zf),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,_){}populate(c,h,g,_){const S=this.layers[0],C=[];let L=null;S.type==="circle"&&(L=S.layout.get("circle-sort-key"));for(const{feature:$,id:K,index:Z,sourceLayerIndex:J}of c){const re=this.layers[0]._featureFilter.needGeometry,ie=Rt($,re);if(!this.layers[0]._featureFilter.filter(new li(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ie,g))continue;const ge=L?L.evaluate(ie,{},g):void 0,Se={id:K,properties:$.properties,type:$.type,sourceLayerIndex:J,index:Z,geometry:re?ie.geometry:St($,g,_),patterns:{},sortKey:ge};C.push(Se)}L&&C.sort(($,K)=>$.sortKey-K.sortKey);let z=null;_.projection.name==="globe"&&(this.globeExtVertexArray=new IN,z=_.projection);for(const $ of C){const{geometry:K,index:Z,sourceLayerIndex:J}=$,re=c[Z].feature;this.addFeature($,K,Z,h.availableImages,g,z,h.brightness,h.elevationFeatures),h.featureIndex.insert(re,K,Z,J,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,h,g,_,S,C,L){this.programConfigurations.updatePaintArrays(c,h,S,g,_,C,L,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,M6.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,T6.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,ooe.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,h,g,_,S,C,L,z){let $;this.elevationMode!=="none"&&($=Ma.getElevationFeature(c,z));for(const K of h)for(const Z of K){const J=Z.x,re=Z.y;if(J<0||J>=Ir||re<0||re>=Ir)continue;if(C){const Se=C.projectTilePoint(J,re,S),Ne=C.upVector(S,J,re);this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne)}const ie=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),ge=ie.vertexLength;if(this.addCircleVertex(J,re,-1,-1),this.addCircleVertex(J,re,1,-1),this.addCircleVertex(J,re,1,1),this.addCircleVertex(J,re,-1,1),this.elevationMode!=="none"){const Se=$?$.pointElevation(new ir(J,re)):0;this.hasElevation=this.hasElevation||Se!==0;for(let Ne=0;Ne<4;Ne++)this.elevatedLayoutVertexArray.emplaceBack(Se)}this.indexArray.emplaceBack(ge,ge+1,ge+2),this.indexArray.emplaceBack(ge,ge+2,ge+3),ie.vertexLength+=4,ie.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,{},_,S,L,void 0,this.worldview)}addCircleVertex(c,h,g,_){this.layoutVertexArray.emplaceBack(2*c+(g+1)/2,2*h+(_+1)/2)}addGlobeExtVertex(c,h){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}}function ha(f,c){for(let h=0;h1){if(Ni(f,c))return!0;for(let g=0;g1?h:h.sub(c)._mult(_)._add(c))}function qi(f,c){let h,g,_,S=!1;for(let C=0;Cc.y!=_.y>c.y&&c.x<(_.x-g.x)*(c.y-g.y)/(_.y-g.y)+g.x&&(S=!S)}return S}function Ja(f,c){let h=!1;for(let g=0,_=f.length-1;gc.y!=C.y>c.y&&c.x<(C.x-S.x)*(c.y-S.y)/(C.y-S.y)+S.x&&(h=!h)}return h}function kd(f,c,h,g,_){for(const C of f)if(c<=C.x&&h<=C.y&&g>=C.x&&_>=C.y)return!0;const S=[new ir(c,h),new ir(c,_),new ir(g,_),new ir(g,h)];if(f.length>2){for(const C of S)if(Ja(f,C))return!0}for(let C=0;C_.x&&c.x>_.x||f.y_.y&&c.y>_.y)return!1;const S=is(f,c,h[0]);return S!==is(f,c,h[1])||S!==is(f,c,h[2])||S!==is(f,c,h[3])}function el(f,c,h,g,_,S){let C=c.y-f.y,L=f.x-c.x;if(S=S||0){const z=C*C+L*L;if(z===0)return!0;const $=Math.sqrt(z);C/=$,L/=$}return!((h.x-f.x)*C+(h.y-f.y)*L-S<0||(g.x-f.x)*C+(g.y-f.y)*L-S<0||(_.x-f.x)*C+(_.y-f.y)*L-S<0)}function Lc(f,c,h,g,_,S,C){return!(el(f,c,g,_,S,C)||el(c,h,g,_,S,C)||el(h,f,g,_,S,C)||el(g,_,f,c,h,C)||el(_,S,f,c,h,C)||el(S,g,f,c,h,C))}function Oc(f,c,h){const g=c.paint.get(f).value;return g.kind==="constant"?g.value:h.programConfigurations.get(c.id).getMaxValue(f)}function Gl(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function Ru(f,c,h,g,_){if(!c[0]&&!c[1])return f;const S=ir.convert(c)._mult(_);h==="viewport"&&S._rotate(-g);const C=[];for(let L=0;L>h&&c.y===this.y>>h}url(c,h){const g=function(S,C,L){var z=xo(256*S,256*(C=Math.pow(2,L)-C-1),L),$=xo(256*(S+1),256*(C+1),L);return z[0]+","+z[1]+","+$[0]+","+$[1]}(this.x,this.y,this.z),_=function(S,C,L){let z,$="";for(let K=S;K>0;K--)z=1<this.canonical.z?new Yi(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Yi(c,this.wrap,c,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(c,h=!0){if(this.overscaledZ===c&&h)return this.key;if(c>this.canonical.z)return Vi(this.wrap*+h,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Vi(this.wrap*+h,c,c,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(c){if(c.wrap!==this.wrap)return!1;const h=this.canonical.z-c.canonical.z;return c.overscaledZ===0||c.overscaledZ>h&&c.canonical.y===this.canonical.y>>h}children(c){if(this.overscaledZ>=c)return[new Yi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,g=2*this.canonical.x,_=2*this.canonical.y;return[new Yi(h,this.wrap,h,g,_),new Yi(h,this.wrap,h,g+1,_),new Yi(h,this.wrap,h,g,_+1),new Yi(h,this.wrap,h,g+1,_+1)]}isLessThan(c){return this.wrapc.wrap)&&(this.overscaledZc.overscaledZ)&&(this.canonical.xc.canonical.x)&&this.canonical.y{let c=f.canonical.x-1,h=f.wrap;return c<0&&(c=(1<{let c=f.canonical.x+1,h=f.wrap;return c===1<new Yi(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Yi(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,_,S,C){const L=Math.sin(S);return g*(Math.sin((1-C)*S)/L)+_*(Math.sin(C*S)/L)}(f.a[c],f.b[c],f.angle,ye(h,0,1))+f.center[c]}function Qh(f){if(f.z<=1)return Vf[f.z+2*f.y+f.x];const c=yoe(A6(f));return xn.fromPoints(c)}function Wf(f,c,h){return ve(f,f,1-h),Xe(f,f,c,h)}function dve(f,c,h){for(const g of f)at(g,g,c),ve(g,g,h)}function uve(f,c,h,g){const _=c/f.worldSize,S=f.globeMatrix;if(h.z<=1){const Pt=Qh(h).getCorners();return dve(Pt,S,_),xn.fromPoints(Pt)}const C=A6(h,g),L=yoe(C,Pc+$m(f._tileCoverLift));dve(L,S,_);const z=Number.MAX_VALUE,$=[-z,-z,-z],K=[z,z,z];if(C.contains(f.center)){for(const Ft of L)_e(K,K,Ft),we($,$,Ft);$[2]=0;const Pt=f.point,Qt=[Pt.x*_,Pt.y*_,0];return _e(K,K,Qt),we($,$,Qt),new xn(K,$)}if(f._tileCoverLift>0){for(const Pt of L)_e(K,K,Pt),we($,$,Pt);return new xn(K,$)}const Z=[S[12]*_,S[13]*_,S[14]*_],J=C.getCenter(),re=ye(f.center.lat,-he,he),ie=ye(J.lat,-he,he),ge=B(f.center.lng),Se=H(re);let Ne=ge-B(J.lng);const Fe=Se-H(ie);Ne>.5?Ne-=1:Ne<-.5&&(Ne+=1);let Ue=0;Math.abs(Ne)>Math.abs(Fe)?Ue=Ne>=0?1:3:(Ue=Fe>=0?0:2,Xe(Z,Z,[S[4]*_,S[5]*_,S[6]*_],-Math.sin(qn(Fe>=0?C.getSouth():C.getNorth()))*Pc));const Qe=L[Ue],xt=L[(Ue+1)%4],mt=new dg(Qe,xt,Z),wt=[Hf(mt,0)||Qe[0],Hf(mt,1)||Qe[1],Hf(mt,2)||Qe[2]],Ct=C0(f.zoom);if(Ct>0){const Pt=function({x:Ft,y:nr,z:ur},hr,vr,br,fr){const xr=1/(1<.5?kr=-1:vn<-.5&&(kr=1),rr=((rr+kr)*hr-(br*=hr))*vr+br,Jt=((Jt+kr)*hr-br)*vr+br,yr=(yr*hr-(fr*=hr))*vr+fr,Pr=(Pr*hr-fr)*vr+fr,[[rr,Pr,0],[Jt,Pr,0],[Jt,yr,0],[rr,yr,0]]}(h,c,f._pixelsPerMercatorPixel,ge,Se);for(let Ft=0;FtMath.PI/2*1.01}const gve=qn(85),tHe=Math.cos(gve),rHe=Math.sin(gve),nHe=N(),xve=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 yve(f,c,h,g,_,S,C,L,z){if(S&&f.queryGeometry.isAboveHorizon)return!1;S&&(z*=f.pixelToTileUnitsFactor);const $=f.tileID.canonical,K=h.projection.upVectorScale($,h.center.lat,h.worldSize).metersToTile;for(const Z of c)for(const J of Z){const re=J.add(L),ie=_&&h.elevation?h.elevation.exaggeration()*_.getElevationAt(re.x,re.y,!0):0,ge=h.projection.projectTilePoint(re.x,re.y,$);if(ie>0){const Ue=h.projection.upVector($,re.x,re.y);ge.x+=Ue[0]*K*ie,ge.y+=Ue[1]*K*ie,ge.z+=Ue[2]*K*ie}const Se=S?re:sHe(ge.x,ge.y,ge.z,g),Ne=S?f.tilespaceRays.map(Ue=>iHe(Ue,ie)):f.queryGeometry.screenGeometry,Fe=Ke([],[ge.x,ge.y,ge.z,1],g);if(!C&&S?z*=Fe[3]/h.cameraToCenterDistance:C&&!S&&(z*=h.cameraToCenterDistance/Fe[3]),S){const Ue=de((J.y/Ir+$.y)/(1<<$.z));z/=h.projection.pixelsPerMeter(Ue,1)/X(1,Ue)}if(fs(Ne,Se,z))return!0}return!1}function sHe(f,c,h,g){const _=Ke([],[f,c,h,1],g);return new ir(_[0]/_[3],_[1]/_[3])}const vve=se(0,0,0),aHe=se(0,0,1);function iHe(f,c){const h=pe();return vve[2]=c,f.intersectsPlane(vve,aHe,h),new ir(h[0],h[1])}class _ve extends Da{}let bve,wve,jve,kve;function Nve(f,{width:c,height:h},g,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==c*h*g)throw new RangeError("mismatched image size")}else _=new Uint8Array(c*h*g);return f.width=c,f.height=h,f.data=_,f}function Sve(f,c,h){const{width:g,height:_}=c;g===f.width&&_===f.height||(woe(f,c,{x:0,y:0},{x:0,y:0},{width:Math.min(f.width,g),height:Math.min(f.height,_)},h,null),f.width=g,f.height=_,f.data=c.data)}function woe(f,c,h,g,_,S,C,L){if(_.width===0||_.height===0)return c;if(_.width>f.width||_.height>f.height||h.x>f.width-_.width||h.y>f.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>c.width||_.height>c.height||g.x>c.width-_.width||g.y>c.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const z=f.data,$=c.data,K=S===4&&L;for(let Z=0;Z<_.height;Z++){const J=((h.y+Z)*f.width+h.x)*S,re=((g.y+Z)*c.width+g.x)*S;if(K)for(let ie=0;ie<_.width;ie++){const ge=J+ie*S+3,Se=re+ie*S;$[Se+0]=255,$[Se+1]=255,$[Se+2]=255,$[Se+3]=z[ge]}else if(C)for(let ie=0;ie<_.width;ie++){const ge=J+ie*S,Se=re+ie*S,Ne=new ja(z[ge+0]/255,z[ge+1]/255,z[ge+2]/255,z[ge+3]).toNonPremultipliedRenderColor(C).toArray();$[Se+0]=Ne[0],$[Se+1]=Ne[1],$[Se+2]=Ne[2],$[Se+3]=Ne[3]}else for(let ie=0;ie<_.width*S;ie++)$[re+ie]=z[J+ie]}return c}nn(_ve,"HeatmapBucket",{omit:["layers"]});class M0{constructor(c,h){Nve(this,c,1,h)}resize(c){Sve(this,new M0(c),1)}clone(){return new M0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(c,h,g,_,S){woe(c,h,g,_,S,1,null)}}class Dc{constructor(c,h){Nve(this,c,4,h)}resize(c){Sve(this,new Dc(c),4)}replace(c,h){h?this.data.set(c):this.data=c instanceof Uint8ClampedArray?new Uint8Array(c.buffer):c}clone(){return new Dc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(c,h,g,_,S,C,L){woe(c,h,g,_,S,4,C,L)}}class Cve{constructor(c,h){this.width=c.width,this.height=c.height,this.data=h instanceof Uint8Array?new Float32Array(h.buffer):h}}function aM(f){const c={},h=f.resolution||256,g=f.clips?f.clips.length:1,_=f.image||new Dc({width:h,height:g}),S=(C,L,z)=>{c[f.evaluationKey]=z;const $=f.expression.evaluate(c),K=$?$.toNonPremultipliedRenderColor(null):null;K&&(_.data[C+L+0]=Math.floor(255*K.r),_.data[C+L+1]=Math.floor(255*K.g),_.data[C+L+2]=Math.floor(255*K.b),_.data[C+L+3]=Math.floor(255*K.a))};if(f.clips)for(let C=0,L=0;C80*h){L=f[0],z=f[1];let K=L,Z=z;for(let J=h;J<_;J+=h){const re=f[J],ie=f[J+1];reK&&(K=re),ie>Z&&(Z=ie)}$=Math.max(K-L,Z-z),$=$!==0?32767/$:0}return iM(S,C,h,L,z,$,0),C}function Mve(f,c,h,g,_){let S;if(_===function(C,L,z,$){let K=0;for(let Z=L,J=z-$;Z0)for(let C=c;C=c;C-=g)S=Ive(C/g|0,f[C],f[C+1],S);return S&&XN(S,S.next)&&(cM(S),S=S.next),S}function g_(f,c){if(!f)return f;c||(c=f);let h,g=f;do if(h=!1,g.steiner||!XN(g,g.next)&&Ll(g.prev,g,g.next)!==0)g=g.next;else{if(cM(g),g=c=g.prev,g===g.next)break;h=!0}while(h||g!==c);return c}function iM(f,c,h,g,_,S,C){if(!f)return;!C&&S&&function(z,$,K,Z){let J=z;do J.z===0&&(J.z=joe(J.x,J.y,$,K,Z)),J.prevZ=J.prev,J.nextZ=J.next,J=J.next;while(J!==z);J.prevZ.nextZ=null,J.prevZ=null,function(re){let ie,ge=1;do{let Se,Ne=re;re=null;let Fe=null;for(ie=0;Ne;){ie++;let Ue=Ne,Qe=0;for(let mt=0;mt0||xt>0&&Ue;)Qe!==0&&(xt===0||!Ue||Ne.z<=Ue.z)?(Se=Ne,Ne=Ne.nextZ,Qe--):(Se=Ue,Ue=Ue.nextZ,xt--),Fe?Fe.nextZ=Se:re=Se,Se.prevZ=Fe,Fe=Se;Ne=Ue}Fe.nextZ=null,ge*=2}while(ie>1)}(J)}(f,g,_,S);let L=f;for(;f.prev!==f.next;){const z=f.prev,$=f.next;if(S?hHe(f,g,_,S):uHe(f))c.push(z.i,f.i,$.i),cM(f),f=$.next,L=$.next;else if((f=$)===L){C?C===1?iM(f=mHe(g_(f),c),c,h,g,_,S,2):C===2&&fHe(f,c,h,g,_,S):iM(g_(f),c,h,g,_,S,1);break}}}function uHe(f){const c=f.prev,h=f,g=f.next;if(Ll(c,h,g)>=0)return!1;const _=c.x,S=h.x,C=g.x,L=c.y,z=h.y,$=g.y,K=Math.min(_,S,C),Z=Math.min(L,z,$),J=Math.max(_,S,C),re=Math.max(L,z,$);let ie=g.next;for(;ie!==c;){if(ie.x>=K&&ie.x<=J&&ie.y>=Z&&ie.y<=re&&oM(_,L,S,z,C,$,ie.x,ie.y)&&Ll(ie.prev,ie,ie.next)>=0)return!1;ie=ie.next}return!0}function hHe(f,c,h,g){const _=f.prev,S=f,C=f.next;if(Ll(_,S,C)>=0)return!1;const L=_.x,z=S.x,$=C.x,K=_.y,Z=S.y,J=C.y,re=Math.min(L,z,$),ie=Math.min(K,Z,J),ge=Math.max(L,z,$),Se=Math.max(K,Z,J),Ne=joe(re,ie,c,h,g),Fe=joe(ge,Se,c,h,g);let Ue=f.prevZ,Qe=f.nextZ;for(;Ue&&Ue.z>=Ne&&Qe&&Qe.z<=Fe;){if(Ue.x>=re&&Ue.x<=ge&&Ue.y>=ie&&Ue.y<=Se&&Ue!==_&&Ue!==C&&oM(L,K,z,Z,$,J,Ue.x,Ue.y)&&Ll(Ue.prev,Ue,Ue.next)>=0||(Ue=Ue.prevZ,Qe.x>=re&&Qe.x<=ge&&Qe.y>=ie&&Qe.y<=Se&&Qe!==_&&Qe!==C&&oM(L,K,z,Z,$,J,Qe.x,Qe.y)&&Ll(Qe.prev,Qe,Qe.next)>=0))return!1;Qe=Qe.nextZ}for(;Ue&&Ue.z>=Ne;){if(Ue.x>=re&&Ue.x<=ge&&Ue.y>=ie&&Ue.y<=Se&&Ue!==_&&Ue!==C&&oM(L,K,z,Z,$,J,Ue.x,Ue.y)&&Ll(Ue.prev,Ue,Ue.next)>=0)return!1;Ue=Ue.prevZ}for(;Qe&&Qe.z<=Fe;){if(Qe.x>=re&&Qe.x<=ge&&Qe.y>=ie&&Qe.y<=Se&&Qe!==_&&Qe!==C&&oM(L,K,z,Z,$,J,Qe.x,Qe.y)&&Ll(Qe.prev,Qe,Qe.next)>=0)return!1;Qe=Qe.nextZ}return!0}function mHe(f,c){let h=f;do{const g=h.prev,_=h.next.next;!XN(g,_)&&Ave(g,h,h.next,_)&&lM(g,_)&&lM(_,g)&&(c.push(g.i,h.i,_.i),cM(h),cM(h.next),h=f=_),h=h.next}while(h!==f);return g_(h)}function fHe(f,c,h,g,_,S){let C=f;do{let L=C.next.next;for(;L!==C.prev;){if(C.i!==L.i&&vHe(C,L)){let z=Eve(C,L);return C=g_(C,C.next),z=g_(z,z.next),iM(C,c,h,g,_,S,0),void iM(z,c,h,g,_,S,0)}L=L.next}C=C.next}while(C!==f)}function pHe(f,c){let h=f.x-c.x;return h===0&&(h=f.y-c.y,h===0)&&(h=(f.next.y-f.y)/(f.next.x-f.x)-(c.next.y-c.y)/(c.next.x-c.x)),h}function gHe(f,c){const h=function(_,S){let C=S;const L=_.x,z=_.y;let $,K=-1/0;if(XN(_,C))return C;do{if(XN(_,C.next))return C.next;if(z<=C.y&&z>=C.next.y&&C.next.y!==C.y){const ge=C.x+(z-C.y)*(C.next.x-C.x)/(C.next.y-C.y);if(ge<=L&&ge>K&&(K=ge,$=C.x=C.x&&C.x>=J&&L!==C.x&&Tve(z$.x||C.x===$.x&&xHe($,C)))&&($=C,ie=ge)}C=C.next}while(C!==Z);return $}(f,c);if(!h)return c;const g=Eve(h,f);return g_(g,g.next),g_(h,h.next)}function xHe(f,c){return Ll(f.prev,f,c.prev)<0&&Ll(c.next,f,f.next)<0}function joe(f,c,h,g,_){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-h)*_|0)|f<<8))|f<<4))|f<<2))|f<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-g)*_|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function yHe(f){let c=f,h=f;do(c.x=(f-C)*(S-L)&&(f-C)*(g-L)>=(h-C)*(c-L)&&(h-C)*(S-L)>=(_-C)*(g-L)}function oM(f,c,h,g,_,S,C,L){return!(f===C&&c===L)&&Tve(f,c,h,g,_,S,C,L)}function vHe(f,c){return f.next.i!==c.i&&f.prev.i!==c.i&&!function(h,g){let _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==g.i&&_.next.i!==g.i&&Ave(_,_.next,h,g))return!0;_=_.next}while(_!==h);return!1}(f,c)&&(lM(f,c)&&lM(c,f)&&function(h,g){let _=h,S=!1;const C=(h.x+g.x)/2,L=(h.y+g.y)/2;do _.y>L!=_.next.y>L&&_.next.y!==_.y&&C<(_.next.x-_.x)*(L-_.y)/(_.next.y-_.y)+_.x&&(S=!S),_=_.next;while(_!==h);return S}(f,c)&&(Ll(f.prev,f,c.prev)||Ll(f,c.prev,c))||XN(f,c)&&Ll(f.prev,f,f.next)>0&&Ll(c.prev,c,c.next)>0)}function Ll(f,c,h){return(c.y-f.y)*(h.x-c.x)-(c.x-f.x)*(h.y-c.y)}function XN(f,c){return f.x===c.x&&f.y===c.y}function Ave(f,c,h,g){const _=L6(Ll(f,c,h)),S=L6(Ll(f,c,g)),C=L6(Ll(h,g,f)),L=L6(Ll(h,g,c));return _!==S&&C!==L||!(_!==0||!P6(f,h,c))||!(S!==0||!P6(f,g,c))||!(C!==0||!P6(h,f,g))||!(L!==0||!P6(h,c,g))}function P6(f,c,h){return c.x<=Math.max(f.x,h.x)&&c.x>=Math.min(f.x,h.x)&&c.y<=Math.max(f.y,h.y)&&c.y>=Math.min(f.y,h.y)}function L6(f){return f>0?1:f<0?-1:0}function lM(f,c){return Ll(f.prev,f,f.next)<0?Ll(f,c,f.next)>=0&&Ll(f,f.prev,c)>=0:Ll(f,c,f.prev)<0||Ll(f,f.next,c)<0}function Eve(f,c){const h=koe(f.i,f.x,f.y),g=koe(c.i,c.x,c.y),_=f.next,S=c.prev;return f.next=c,c.prev=f,h.next=_,_.prev=h,g.next=h,h.prev=g,S.next=g,g.prev=S,g}function Ive(f,c,h,g){const _=koe(f,c,h);return g?(_.next=g.next,_.prev=g,g.next.prev=_,g.next=_):(_.prev=_,_.next=_),_}function cM(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 koe(f,c,h){return{i:f,x:c,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function dM(f,c){const h=f.length;if(h<=1)return[f];const g=[];let _,S;for(let C=0;C1)for(let C=0;C=Ir&&h>=Ir}static evaluate(c){if(c.length===0)return new Tx;let h=[];for(const z of c)h.push(...z.portals);if(h.length===0)return new Tx;for(const z of h){const $=z.va,K=z.vb;(Tx.isOnBorder($.x,K.x)||Tx.isOnBorder($.y,K.y))&&(z.type="border")}const g=h.filter(z=>z.type!=="unevaluated"),_=h.filter(z=>z.type==="unevaluated");if(_.length===0)return new Tx;_.sort((z,$)=>z.hash===$.hash?z.isTunnel===$.isTunnel?0:z.isTunnel?-1:1:z.hash<$.hash?1:-1),h=g.concat(_);let S=g.length,C=S,L=S;do if(C++,C===h.length||h[S].hash!==h[C].hash){if(C-S==2){Lz.hash<$.hash?1:-1),{portals:h}}}nn(Tx,"ElevationPortalGraph"),nn(Lve,"ElevationPolygons");class bHe{constructor(c,h,g){this.outPositions=c,this.outNormals=h,this.outIndices=g,this.vertexLookup=new Map}addVertex(c,h,g){let _=c[2];g!=null&&(_*=g);const S=`${c[0]},${c[1]},${c[2]},${h[0]},${h[1]},${h[2]}`,C=this.vertexLookup.get(S);if(C!=null)return C;const L=this.outPositions.length;this.vertexLookup.set(S,L);const z=Math.trunc(16384*h[0]),$=Math.trunc(16384*h[1]),K=Math.trunc(16384*h[2]);return this.outPositions.emplaceBack(c[0],c[1],_),this.outNormals.emplaceBack(z,$,K),L}addTriangle(c,h,g){this.outIndices.emplaceBack(c,h,g)}addTriangles(c,h,g){if(c.length===0)return;const _=g.length===1,S=pe(),C=pe();for(let L=0;LS!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Yh(h,{zoom:g,lut:_},S=>S!=="fill-bridge-guard-rail-color")}addVertices(c,h){const g=this.unevalVertices.length;for(let _=0;_=S.min.x&&Z.x<=S.max.x&&Z.y>=S.min.y&&Z.y<=S.max.y||J.x>=S.min.x&&J.x<=S.max.x&&J.y>=S.min.y&&J.y<=S.max.y||fc(Z,J,L))||this.isOnBorder(Z.x,J.x)||this.isOnBorder(Z.y,J.y))continue;const re=Fu.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[K]);let ie,ge=this.vertexHashLookup.get(Fu.computePosHash(Z));ge!=null?ie=ge.next:(ge=this.vertexHashLookup.get(Fu.computePosHash(J)),ie=ge!=null?ge.prev:re),this.unevalEdges.push({polygonIdx:c,a:$,b:K,hash:re,portalHash:ie,isTunnel:_,type:"unevaluated",featureInfo:C})}}addPortalCandidates(c,h,g,_,S){if(h.length===0)return;this.portalPolygons.add(c,{geometry:h,zLevel:S});const C=h[0];this.vertexHashLookup.clear();let L=Fu.computeEdgeHash(C[C.length-2],C[C.length-1]);for(let z=0;z({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=J=>{J.primitiveLength=this.indexArray.length-J.primitiveOffset},_=new bHe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const S=h(),C=h(),L=h(),z=(J,re)=>{J.sort((ge,Se)=>ge.type===re&&Se.type!==re?-1:ge.type!==re&&Se.type===re?1:0);const ie=J.findIndex(ge=>ge.type!==re);return ie>=0?ie:J.length};let $=0;this.unevalEdges.length>0&&($=z(this.unevalEdges,"none"),this.constructBridgeStructures(_,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},this.tileToMeters)),g(L);const K=h(),Z=h();if(this.unevalEdges.length>0){const J=this.unevalEdges.splice($),re=z(J,"tunnel")+$;this.unevalEdges.push(...J),this.constructTunnelStructures(_,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},{min:$,max:re})}g(K),_.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(Z),_.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(C),_.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(S),this.maskSegments=Ui.simpleSegment(0,Z.primitiveOffset,0,Z.primitiveLength),this.depthSegments=Ui.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength),this.renderableBridgeSegments=Ui.simpleSegment(0,L.primitiveOffset,0,L.primitiveLength),this.renderableTunnelSegments=Ui.simpleSegment(0,K.primitiveOffset,0,K.primitiveLength),this.shadowCasterSegments=Ui.simpleSegment(0,S.primitiveOffset,0,S.primitiveLength)}update(c,h,g,_,S,C,L,z){this.bridgeProgramConfigurations.updatePaintArrays(c,h,S,g,_,C,L,z),this.tunnelProgramConfigurations.updatePaintArrays(c,h,S,g,_,C,L,z)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,cHe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,dHe.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,h,g,_,S){const C=(L,z)=>{for(let $=0;$me(vr,h[br].x,h[br].y,g[br]*z),Z=pe(),J=pe(),re=pe(),ie=pe(),ge=pe(),Se=(vr,br)=>{const fr=L.get(Fu.computePosHash(h[br])),xr=fr.from,rr=fr.to;if(!xr||!rr)return;K(Z,xr),K(J,br),K(re,rr),Je(ie),st(Z,J)||(je(ge,J,Z),Ve(ie,ge)),st(re,J)||(je(ge,re,J),ue(ie,ie,Ve(ge,ge)));const Jt=Ce(ie);return Jt>0?ve(vr,ie,1/Jt):void 0};let Ne=Number.POSITIVE_INFINITY;this.sortSubarray(_,S.min,S.max,(vr,br)=>vr.featureInfo.featureIndex-br.featureInfo.featureIndex);const Fe=pe(),Ue=pe(),Qe=pe(),xt=pe(),mt=pe(),wt=pe(),Ct=pe(),Pt=pe(),Qt=pe(),Ft=[pe(),pe(),pe(),pe()],nr=[pe(),pe(),pe(),pe()],ur=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],hr=(vr,br)=>vr>br;for(let vr=S.min;vrNe.featureInfo.featureIndex-Fe.featureInfo.featureIndex;this.sortSubarray(_,S.min,S.max,z),this.sortSubarray(_,C.min,C.max,z);const $=Ne=>Ve(Ne,Ne),K=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],Z=(Ne,Fe)=>NeL.hash===z.hash?z.polygonIdx-L.polygonIdx:z.hash>L.hash?1:-1);let g=0,_=0,S=0,C=h[g].polygonIdx;do _++,(_===h.length||h[g].hash!==h[_].hash)&&((_-g==1||h[_-1].polygonIdx!==C)&&(S$.portalHashK.hash?L++:K.hash>$.portalHash?z++:($.type=K.type,L++)}}}isOnBorder(c,h){return c<=0&&h<=0||c>=Ir&&h>=Ir}addFeatureSection(c,h,g,_){return c!==h&&(h=c,g.push({featureIndex:c,vertexStart:_.getVertexCount()}),_.clearVertexLookup()),h}sortSubarray(c,h,g,_){const S=c.slice(h,g);S.sort(_),c.splice(h,S.length,...S)}static computeEdgeHash(c,h){return(c.y===h.y&&c.x>h.x||c.y>h.y)&&([c,h]=[h,c]),BigInt(Fu.computePosHash(c))<<32n|BigInt(Fu.computePosHash(h))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var Ove,Dve={exports:{}},Rve=(Ove||(Ove=1,function(f){function c(ft,vt){return ft>vt?1:ft0){var bn=_r+Math.floor(qr/2),kn={key:vt[bn],data:sr[bn],parent:ft};return kn.left=_(kn,vt,sr,_r,bn),kn.right=_(kn,vt,sr,bn+1,Ur),kn}return null}function S(ft,vt,sr,_r,Ur){if(!(sr>=_r)){for(var qr=ft[sr+_r>>1],bn=sr-1,kn=_r+1;;){do bn++;while(Ur(ft[bn],qr)<0);do kn--;while(Ur(ft[kn],qr)>0);if(bn>=kn)break;var as=ft[bn];ft[bn]=ft[kn],ft[kn]=as,as=vt[bn],vt[bn]=vt[kn],vt[kn]=as}S(ft,vt,sr,kn,Ur),S(ft,vt,kn+1,_r,Ur)}}h.prototype.rotateLeft=function(ft){var vt=ft.right;vt&&(ft.right=vt.left,vt.left&&(vt.left.parent=ft),vt.parent=ft.parent),ft.parent?ft===ft.parent.left?ft.parent.left=vt:ft.parent.right=vt:this._root=vt,vt&&(vt.left=ft),ft.parent=vt},h.prototype.rotateRight=function(ft){var vt=ft.left;vt&&(ft.left=vt.right,vt.right&&(vt.right.parent=ft),vt.parent=ft.parent),ft.parent?ft===ft.parent.left?ft.parent.left=vt:ft.parent.right=vt:this._root=vt,vt&&(vt.right=ft),ft.parent=vt},h.prototype._splay=function(ft){for(;ft.parent;){var vt=ft.parent;vt.parent?vt.left===ft&&vt.parent.left===vt?(this.rotateRight(vt.parent),this.rotateRight(vt)):vt.right===ft&&vt.parent.right===vt?(this.rotateLeft(vt.parent),this.rotateLeft(vt)):vt.left===ft&&vt.parent.right===vt?(this.rotateRight(vt),this.rotateLeft(vt)):(this.rotateLeft(vt),this.rotateRight(vt)):vt.left===ft?this.rotateRight(vt):this.rotateLeft(vt)}},h.prototype.splay=function(ft){for(var vt,sr,_r,Ur,qr;ft.parent;)(sr=(vt=ft.parent).parent)&&sr.parent?((_r=sr.parent).left===sr?_r.left=ft:_r.right=ft,ft.parent=_r):(ft.parent=null,this._root=ft),Ur=ft.left,qr=ft.right,ft===vt.left?(sr&&(sr.left===vt?(vt.right?(sr.left=vt.right,sr.left.parent=sr):sr.left=null,vt.right=sr,sr.parent=vt):(Ur?(sr.right=Ur,Ur.parent=sr):sr.right=null,ft.left=sr,sr.parent=ft)),qr?(vt.left=qr,qr.parent=vt):vt.left=null,ft.right=vt,vt.parent=ft):(sr&&(sr.right===vt?(vt.left?(sr.right=vt.left,sr.right.parent=sr):sr.right=null,vt.left=sr,sr.parent=vt):(qr?(sr.left=qr,qr.parent=sr):sr.left=null,ft.right=sr,sr.parent=ft)),Ur?(vt.right=Ur,Ur.parent=vt):vt.right=null,ft.left=vt,vt.parent=ft)},h.prototype.replace=function(ft,vt){ft.parent?ft===ft.parent.left?ft.parent.left=vt:ft.parent.right=vt:this._root=vt,vt&&(vt.parent=ft.parent)},h.prototype.minNode=function(ft){if(ft===void 0&&(ft=this._root),ft)for(;ft.left;)ft=ft.left;return ft},h.prototype.maxNode=function(ft){if(ft===void 0&&(ft=this._root),ft)for(;ft.right;)ft=ft.right;return ft},h.prototype.insert=function(ft,vt){var sr=this._root,_r=null,Ur=this._compare;if(this._noDuplicates)for(;sr;){if(_r=sr,Ur(sr.key,ft)===0)return;sr=Ur(sr.key,ft)<0?sr.right:sr.left}else for(;sr;)_r=sr,sr=Ur(sr.key,ft)<0?sr.right:sr.left;return sr={key:ft,data:vt,left:null,right:null,parent:_r},_r?Ur(_r.key,sr.key)<0?_r.right=sr:_r.left=sr:this._root=sr,this.splay(sr),this._size++,sr},h.prototype.find=function(ft){for(var vt=this._root,sr=this._compare;vt;){var _r=sr(vt.key,ft);if(_r<0)vt=vt.right;else{if(!(_r>0))return vt;vt=vt.left}}return null},h.prototype.contains=function(ft){for(var vt=this._root,sr=this._compare;vt;){var _r=sr(ft,vt.key);if(_r===0)return!0;vt=_r<0?vt.left:vt.right}return!1},h.prototype.remove=function(ft){var vt=this.find(ft);if(!vt)return!1;if(this.splay(vt),vt.left)if(vt.right){var sr=this.minNode(vt.right);sr.parent!==vt&&(this.replace(sr,sr.right),sr.right=vt.right,sr.right.parent=sr),this.replace(vt,sr),sr.left=vt.left,sr.left.parent=sr}else this.replace(vt,vt.left);else this.replace(vt,vt.right);return this._size--,!0},h.prototype.removeNode=function(ft){if(!ft)return!1;if(this.splay(ft),ft.left)if(ft.right){var vt=this.minNode(ft.right);vt.parent!==ft&&(this.replace(vt,vt.right),vt.right=ft.right,vt.right.parent=vt),this.replace(ft,vt),vt.left=ft.left,vt.left.parent=vt}else this.replace(ft,ft.left);else this.replace(ft,ft.right);return this._size--,!0},h.prototype.erase=function(ft){var vt=this.find(ft);if(vt){this.splay(vt);var sr=vt.left,_r=vt.right,Ur=null;sr&&(sr.parent=null,Ur=this.maxNode(sr),this.splay(Ur),this._root=Ur),_r&&(sr?Ur.right=_r:this._root=_r,_r.parent=Ur),this._size--}},h.prototype.pop=function(){var ft=this._root,vt=null;if(ft){for(;ft.left;)ft=ft.left;vt={key:ft.key,data:ft.data},this.remove(ft.key)}return vt},h.prototype.next=function(ft){var vt=ft;if(vt)if(vt.right)for(vt=vt.right;vt&&vt.left;)vt=vt.left;else for(vt=ft.parent;vt&&vt.right===ft;)ft=vt,vt=vt.parent;return vt},h.prototype.prev=function(ft){var vt=ft;if(vt)if(vt.left)for(vt=vt.left;vt&&vt.right;)vt=vt.right;else for(vt=ft.parent;vt&&vt.left===ft;)ft=vt,vt=vt.parent;return vt},h.prototype.forEach=function(ft){for(var vt=this._root,sr=[],_r=!1,Ur=0;!_r;)vt?(sr.push(vt),vt=vt.left):sr.length>0?(ft(vt=sr.pop(),Ur++),vt=vt.right):_r=!0;return this},h.prototype.range=function(ft,vt,sr,_r){for(var Ur=[],qr=this._compare,bn=this._root;Ur.length!==0||bn;)if(bn)Ur.push(bn),bn=bn.left;else{if(qr((bn=Ur.pop()).key,vt)>0)break;if(qr(bn.key,ft)>=0&&sr.call(_r,bn))return this;bn=bn.right}return this},h.prototype.keys=function(){for(var ft=this._root,vt=[],sr=[],_r=!1;!_r;)ft?(vt.push(ft),ft=ft.left):vt.length>0?(ft=vt.pop(),sr.push(ft.key),ft=ft.right):_r=!0;return sr},h.prototype.values=function(){for(var ft=this._root,vt=[],sr=[],_r=!1;!_r;)ft?(vt.push(ft),ft=ft.left):vt.length>0?(ft=vt.pop(),sr.push(ft.data),ft=ft.right):_r=!0;return sr},h.prototype.at=function(ft){for(var vt=this._root,sr=[],_r=!1,Ur=0;!_r;)if(vt)sr.push(vt),vt=vt.left;else if(sr.length>0){if(vt=sr.pop(),Ur===ft)return vt;Ur++,vt=vt.right}else _r=!0;return null},h.prototype.load=function(ft,vt,sr){if(ft===void 0&&(ft=[]),vt===void 0&&(vt=[]),sr===void 0&&(sr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var _r=ft.length;return sr&&S(ft,vt,0,_r-1,this._compare),this._root=_(null,ft,vt,0,_r),this._size=_r,this},h.prototype.min=function(){var ft=this.minNode(this._root);return ft?ft.key:null},h.prototype.max=function(){var ft=this.maxNode(this._root);return ft?ft.key:null},h.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},h.createTree=function(ft,vt,sr,_r,Ur){return new h(sr,Ur).load(ft,vt,_r)},Object.defineProperties(h.prototype,g);var C=0,L=1,z=2,$=3,K=0,Z=1,J=2,re=3;function ie(ft,vt,sr){vt===null?(ft.inOut=!1,ft.otherInOut=!0):(ft.isSubject===vt.isSubject?(ft.inOut=!vt.inOut,ft.otherInOut=vt.otherInOut):(ft.inOut=!vt.otherInOut,ft.otherInOut=vt.isVertical()?!vt.inOut:vt.inOut),vt&&(ft.prevInResult=!ge(vt,sr)||vt.isVertical()?vt.prevInResult:vt));var _r=ge(ft,sr);ft.resultTransition=_r?function(Ur,qr){var bn,kn=!Ur.inOut,as=!Ur.otherInOut;switch(qr){case K:bn=kn&&as;break;case Z:bn=kn||as;break;case re:bn=kn^as;break;case J:bn=Ur.isSubject?kn&&!as:as&&!kn}return bn?1:-1}(ft,sr):0}function ge(ft,vt){switch(ft.type){case C:switch(vt){case K:return!ft.otherInOut;case Z:return ft.otherInOut;case J:return ft.isSubject&&ft.otherInOut||!ft.isSubject&&!ft.otherInOut;case re:return!0}break;case z:return vt===K||vt===Z;case $:return vt===J;case L:return!1}return!1}var Se=function(ft,vt,sr,_r,Ur){this.left=vt,this.point=ft,this.otherEvent=sr,this.isSubject=_r,this.type=Ur||C,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},Ne={inResult:{configurable:!0}};function Fe(ft,vt){return ft[0]===vt[0]&&ft[1]===vt[1]}Se.prototype.isBelow=function(ft){var vt=this.point,sr=this.otherEvent.point;return this.left?(vt[0]-ft[0])*(sr[1]-ft[1])-(sr[0]-ft[0])*(vt[1]-ft[1])>0:(sr[0]-ft[0])*(vt[1]-ft[1])-(vt[0]-ft[0])*(sr[1]-ft[1])>0},Se.prototype.isAbove=function(ft){return!this.isBelow(ft)},Se.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},Ne.inResult.get=function(){return this.resultTransition!==0},Se.prototype.clone=function(){var ft=new Se(this.point,this.left,this.otherEvent,this.isSubject,this.type);return ft.contourId=this.contourId,ft.resultTransition=this.resultTransition,ft.prevInResult=this.prevInResult,ft.isExteriorRing=this.isExteriorRing,ft.inOut=this.inOut,ft.otherInOut=this.otherInOut,ft},Object.defineProperties(Se.prototype,Ne);var Ue=11102230246251565e-32,Qe=134217729,xt=(3+8*Ue)*Ue;function mt(ft,vt,sr,_r,Ur){var qr,bn,kn,as,gs=vt[0],_s=_r[0],$s=0,On=0;_s>gs==_s>-gs?(qr=gs,gs=vt[++$s]):(qr=_s,_s=_r[++On]);var Wn=0;if($sgs==_s>-gs?(kn=qr-((bn=gs+qr)-gs),gs=vt[++$s]):(kn=qr-((bn=_s+qr)-_s),_s=_r[++On]),qr=bn,kn!==0&&(Ur[Wn++]=kn);$sgs==_s>-gs?(kn=qr-((bn=qr+gs)-(as=bn-qr))+(gs-as),gs=vt[++$s]):(kn=qr-((bn=qr+_s)-(as=bn-qr))+(_s-as),_s=_r[++On]),qr=bn,kn!==0&&(Ur[Wn++]=kn);for(;$s0!=$s>0)return On;var Wn=Math.abs(_s+$s);return Math.abs(On)>=Ct*Wn?On:-function(da,pa,ga,Ra,ti,Ka,Na){var Aa,xs,Qs,Ri,Pn,Us,Ya,si,ci,yo,ai,Ln,Hi,Fa,Si,tl,kl,$o,Uo=da-ti,hl=ga-ti,Xd=pa-Ka,ii=Ra-Ka;Ft[0]=(Si=(si=Uo-(Ya=(Us=Qe*Uo)-(Us-Uo)))*(yo=ii-(ci=(Us=Qe*ii)-(Us-ii)))-((Fa=Uo*ii)-Ya*ci-si*ci-Ya*yo))-((ai=Si-(kl=(si=Xd-(Ya=(Us=Qe*Xd)-(Us-Xd)))*(yo=hl-(ci=(Us=Qe*hl)-(Us-hl)))-((tl=Xd*hl)-Ya*ci-si*ci-Ya*yo)))+(Pn=Si-ai))+(Pn-kl),Ft[1]=(Hi=Fa-((Ln=Fa+ai)-(Pn=Ln-Fa))+(ai-Pn))-((ai=Hi-tl)+(Pn=Hi-ai))+(Pn-tl),Ft[2]=Ln-(($o=Ln+ai)-(Pn=$o-Ln))+(ai-Pn),Ft[3]=$o;var mo=function(mg,pc){for(var Nd=pc[0],Bu=1;Bu<4;Bu++)Nd+=pc[Bu];return Nd}(0,Ft),vo=Pt*Na;if(mo>=vo||-mo>=vo||(Aa=da-(Uo+(Pn=da-Uo))+(Pn-ti),Qs=ga-(hl+(Pn=ga-hl))+(Pn-ti),xs=pa-(Xd+(Pn=pa-Xd))+(Pn-Ka),Ri=Ra-(ii+(Pn=Ra-ii))+(Pn-Ka),Aa===0&&xs===0&&Qs===0&&Ri===0)||(vo=Qt*Na+xt*Math.abs(mo),(mo+=Uo*Ri+ii*Aa-(Xd*Qs+hl*xs))>=vo||-mo>=vo))return mo;vr[0]=(Si=(si=Aa-(Ya=(Us=Qe*Aa)-(Us-Aa)))*(yo=ii-(ci=(Us=Qe*ii)-(Us-ii)))-((Fa=Aa*ii)-Ya*ci-si*ci-Ya*yo))-((ai=Si-(kl=(si=xs-(Ya=(Us=Qe*xs)-(Us-xs)))*(yo=hl-(ci=(Us=Qe*hl)-(Us-hl)))-((tl=xs*hl)-Ya*ci-si*ci-Ya*yo)))+(Pn=Si-ai))+(Pn-kl),vr[1]=(Hi=Fa-((Ln=Fa+ai)-(Pn=Ln-Fa))+(ai-Pn))-((ai=Hi-tl)+(Pn=Hi-ai))+(Pn-tl),vr[2]=Ln-(($o=Ln+ai)-(Pn=$o-Ln))+(ai-Pn),vr[3]=$o;var uu=mt(4,Ft,4,vr,nr);vr[0]=(Si=(si=Uo-(Ya=(Us=Qe*Uo)-(Us-Uo)))*(yo=Ri-(ci=(Us=Qe*Ri)-(Us-Ri)))-((Fa=Uo*Ri)-Ya*ci-si*ci-Ya*yo))-((ai=Si-(kl=(si=Xd-(Ya=(Us=Qe*Xd)-(Us-Xd)))*(yo=Qs-(ci=(Us=Qe*Qs)-(Us-Qs)))-((tl=Xd*Qs)-Ya*ci-si*ci-Ya*yo)))+(Pn=Si-ai))+(Pn-kl),vr[1]=(Hi=Fa-((Ln=Fa+ai)-(Pn=Ln-Fa))+(ai-Pn))-((ai=Hi-tl)+(Pn=Hi-ai))+(Pn-tl),vr[2]=Ln-(($o=Ln+ai)-(Pn=$o-Ln))+(ai-Pn),vr[3]=$o;var rl=mt(uu,nr,4,vr,ur);vr[0]=(Si=(si=Aa-(Ya=(Us=Qe*Aa)-(Us-Aa)))*(yo=Ri-(ci=(Us=Qe*Ri)-(Us-Ri)))-((Fa=Aa*Ri)-Ya*ci-si*ci-Ya*yo))-((ai=Si-(kl=(si=xs-(Ya=(Us=Qe*xs)-(Us-xs)))*(yo=Qs-(ci=(Us=Qe*Qs)-(Us-Qs)))-((tl=xs*Qs)-Ya*ci-si*ci-Ya*yo)))+(Pn=Si-ai))+(Pn-kl),vr[1]=(Hi=Fa-((Ln=Fa+ai)-(Pn=Ln-Fa))+(ai-Pn))-((ai=Hi-tl)+(Pn=Hi-ai))+(Pn-tl),vr[2]=Ln-(($o=Ln+ai)-(Pn=$o-Ln))+(ai-Pn),vr[3]=$o;var qm=mt(rl,ur,4,vr,hr);return hr[qm-1]}(Ur,qr,bn,kn,as,gs,Wn)}(ft[0],ft[1],vt[0],vt[1],sr[0],sr[1]);return _r>0?-1:_r<0?1:0}function fr(ft,vt){var sr=ft.point,_r=vt.point;return sr[0]>_r[0]?1:sr[0]<_r[0]?-1:sr[1]!==_r[1]?sr[1]>_r[1]?1:-1:function(Ur,qr,bn,kn){return Ur.left!==qr.left?Ur.left?1:-1:br(bn,Ur.otherEvent.point,qr.otherEvent.point)!==0?Ur.isBelow(qr.otherEvent.point)?-1:1:!Ur.isSubject&&qr.isSubject?1:-1}(ft,vt,sr)}function xr(ft,vt,sr){var _r=new Se(vt,!1,ft,ft.isSubject),Ur=new Se(vt,!0,ft.otherEvent,ft.isSubject);return Fe(ft.point,ft.otherEvent.point)&&console.warn("what is that, a collapsed segment?",ft),_r.contourId=Ur.contourId=ft.contourId,fr(Ur,ft.otherEvent)>0&&(ft.otherEvent.left=!0,Ur.left=!1),ft.otherEvent.otherEvent=Ur,ft.otherEvent=_r,sr.push(Ur),sr.push(_r),sr}function rr(ft,vt){return ft[0]*vt[1]-ft[1]*vt[0]}function Jt(ft,vt){return ft[0]*vt[0]+ft[1]*vt[1]}function yr(ft,vt,sr){var _r=function(as,gs,_s,$s,On){var Wn=[gs[0]-as[0],gs[1]-as[1]],da=[$s[0]-_s[0],$s[1]-_s[1]];function pa(Us,Ya,si){return[Us[0]+Ya*si[0],Us[1]+Ya*si[1]]}var ga=[_s[0]-as[0],_s[1]-as[1]],Ra=rr(Wn,da),ti=Ra*Ra,Ka=Jt(Wn,Wn);if(ti>0){var Na=rr(ga,da)/Ra;if(Na<0||Na>1)return null;var Aa=rr(ga,Wn)/Ra;return Aa<0||Aa>1?null:Na===0||Na===1?[pa(as,Na,Wn)]:Aa===0||Aa===1?[pa(_s,Aa,da)]:[pa(as,Na,Wn)]}if((ti=(Ra=rr(ga,Wn))*Ra)>0)return null;var xs=Jt(Wn,ga)/Ka,Qs=xs+Jt(Wn,da)/Ka,Ri=Math.min(xs,Qs),Pn=Math.max(xs,Qs);return Ri<=1&&Pn>=0?Ri===1?[pa(as,Ri>0?Ri:0,Wn)]:Pn===0?[pa(as,Pn<1?Pn:1,Wn)]:[pa(as,Ri>0?Ri:0,Wn),pa(as,Pn<1?Pn:1,Wn)]:null}(ft.point,ft.otherEvent.point,vt.point,vt.otherEvent.point),Ur=_r?_r.length:0;if(Ur===0||Ur===1&&(Fe(ft.point,vt.point)||Fe(ft.otherEvent.point,vt.otherEvent.point))||Ur===2&&ft.isSubject===vt.isSubject)return 0;if(Ur===1)return Fe(ft.point,_r[0])||Fe(ft.otherEvent.point,_r[0])||xr(ft,_r[0],sr),Fe(vt.point,_r[0])||Fe(vt.otherEvent.point,_r[0])||xr(vt,_r[0],sr),1;var qr=[],bn=!1,kn=!1;return Fe(ft.point,vt.point)?bn=!0:fr(ft,vt)===1?qr.push(vt,ft):qr.push(ft,vt),Fe(ft.otherEvent.point,vt.otherEvent.point)?kn=!0:fr(ft.otherEvent,vt.otherEvent)===1?qr.push(vt.otherEvent,ft.otherEvent):qr.push(ft.otherEvent,vt.otherEvent),bn&&kn||bn?(vt.type=L,ft.type=vt.inOut===ft.inOut?z:$,bn&&!kn&&xr(qr[1].otherEvent,qr[0].point,sr),2):kn?(xr(qr[0],qr[1].point,sr),3):qr[0]!==qr[3].otherEvent?(xr(qr[0],qr[1].point,sr),xr(qr[1],qr[2].point,sr),3):(xr(qr[0],qr[1].point,sr),xr(qr[3].otherEvent,qr[2].point,sr),3)}function Pr(ft,vt){if(ft===vt)return 0;if(br(ft.point,ft.otherEvent.point,vt.point)!==0||br(ft.point,ft.otherEvent.point,vt.otherEvent.point)!==0)return Fe(ft.point,vt.point)?ft.isBelow(vt.otherEvent.point)?-1:1:ft.point[0]===vt.point[0]?ft.point[1]vt.contourId?1:-1:fr(ft,vt)===1?1:-1}var kr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function vn(ft,vt,sr,_r){var Ur,qr=ft+1,bn=vt[ft].point,kn=vt.length;for(qr_r;)qr--;return qr}kr.prototype.isExterior=function(){return this.holeOf==null};var Wr=dn,Jr=dn;function dn(ft,vt){if(!(this instanceof dn))return new dn(ft,vt);if(this.data=ft||[],this.length=this.data.length,this.compare=vt||bs,this.length>0)for(var sr=(this.length>>1)-1;sr>=0;sr--)this._down(sr)}function bs(ft,vt){return ftvt?1:0}dn.prototype={push:function(ft){this.data.push(ft),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var ft=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),ft}},peek:function(){return this.data[0]},_up:function(ft){for(var vt=this.data,sr=this.compare,_r=vt[ft];ft>0;){var Ur=ft-1>>1,qr=vt[Ur];if(sr(_r,qr)>=0)break;vt[ft]=qr,ft=Ur}vt[ft]=_r},_down:function(ft){for(var vt=this.data,sr=this.compare,_r=this.length>>1,Ur=vt[ft];ft<_r;){var qr=1+(ft<<1),bn=qr+1,kn=vt[qr];if(bn=0)break;vt[ft]=kn,ft=qr}vt[ft]=Ur}},Wr.default=Jr;var Nr=Math.max,hn=Math.min,Gn=0;function Ks(ft,vt,sr,_r,Ur,qr){var bn,kn,as,gs,_s,$s;for(bn=0,kn=ft.length-1;bn0?$s.left=!0:_s.left=!0;var On=as[0],Wn=as[1];Ur[0]=hn(Ur[0],On),Ur[1]=hn(Ur[1],Wn),Ur[2]=Nr(Ur[2],On),Ur[3]=Nr(Ur[3],Wn),_r.push(_s),_r.push($s)}}var Js=[];function cs(ft,vt,sr){typeof ft[0][0][0]=="number"&&(ft=[ft]),typeof vt[0][0][0]=="number"&&(vt=[vt]);var _r=function(Wn,da,pa){var ga=null;return Wn.length*da.length==0&&(pa===K?ga=Js:pa===J?ga=Wn:pa!==Z&&pa!==re||(ga=Wn.length===0?da:Wn)),ga}(ft,vt,sr);if(_r)return _r===Js?null:_r;var Ur=[1/0,1/0,-1/0,-1/0],qr=[1/0,1/0,-1/0,-1/0],bn=function(Wn,da,pa,ga,Ra){var ti,Ka,Na,Aa,xs,Qs,Ri=new Wr(null,fr);for(Na=0,Aa=Wn.length;Naga[2]||ga[0]>pa[2]||pa[1]>ga[3]||ga[1]>pa[3])&&(Ra===K?ti=Js:Ra===J?ti=Wn:Ra!==Z&&Ra!==re||(ti=Wn.concat(da))),ti}(ft,vt,Ur,qr,sr))return _r===Js?null:_r;for(var kn=function(Wn){var da,pa,ga=function(Na){var Aa,xs,Qs,Ri,Pn=[];for(xs=0,Qs=Na.length;xs0){var ai=Us[yo];if(ai.holeOf!=null){var Ln=ai.holeOf;Us[Ln].holeIds.push(Ya),si.holeOf=Ln,si.depth=Us[yo].depth}else Us[yo].holeIds.push(Ya),si.holeOf=yo,si.depth=Us[yo].depth+1}else si.holeOf=null,si.depth=Us[yo].depth}else si.holeOf=null,si.depth=0;return si}(ga[da],ti,Na),xs=function(Pn){Ra[Pn]=!0,Pn=ga.length)&&ga[Qs];);ti.push(Aa)}};for(da=0,pa=ga.length;daRi||ti===J&&Pn.point[0]>ga[2])break;if(Pn.left){Na=Ka=xs.insert(Pn),Ka=Ka!==(Aa=xs.minNode())?xs.prev(Ka):null,Na=xs.next(Na);var Us=Ka?Ka.key:null;if(ie(Pn,Us,ti),Na&&yr(Pn,Na.key,Wn)===2&&(ie(Pn,Us,ti),ie(Na.key,Pn,ti)),Ka&&yr(Ka.key,Pn,Wn)===2){var Ya=Ka;ie(Us,(Ya=Ya!==Aa?xs.prev(Ya):null)?Ya.key:null,ti),ie(Pn,Us,ti)}}else Na=Ka=xs.find(Pn=Pn.otherEvent),Ka&&Na&&(Ka=Ka!==Aa?xs.prev(Ka):null,Na=xs.next(Na),xs.remove(Pn),Na&&Ka&&yr(Ka.key,Na.key,Wn))}return Qs}(bn,0,0,Ur,qr,sr)),as=[],gs=0;gs * @license MIT * @preserve */function O6(f,c,h,g){const _=[],S=g===0?(C,L,z,$,K,Z)=>{C.push(new ir(Z,z+(Z-L)/($-L)*(K-z)))}:(C,L,z,$,K,Z)=>{C.push(new ir(L+(Z-z)/(K-z)*($-L),Z))};for(const C of f){const L=[];for(const z of C){if(z.length<=2)continue;const $=[];for(let J=0;Jc&&S($,re,ie,ge,Se,c):Ne>h?Fe=c&&S($,re,ie,ge,Se,c),Fe>h&&Ne<=h&&S($,re,ie,ge,Se,h)}let K=z[z.length-1];const Z=g===0?K.x:K.y;Z>=c&&Z<=h&&$.push(K),$.length&&(K=$[$.length-1],$[0].x===K.x&&$[0].y===K.y||$.push($[0]),L.push($))}L.length&&_.push(L)}return _}function wHe(f,c){const h=Coe(f),g=Coe([c]),_=Rve.intersection(h,g);return _==null?[]:Fve(_)}function jHe(f,c){let g=Coe(f,65536);const _=[];for(;c.valid();c.next()){const[S,C]=c.get(),L=S.x*65536,z=S.y*65536,$=C.x*65536,K=C.y*65536,Z=$-L,J=K-z,re=Math.hypot(Z,J);if(re===0)continue;const ie=Math.trunc(J/re*3),ge=-Math.trunc(Z/re*3);_.push([[[L,z],[$,K],[$+ie,K+ge],[L+ie,z+ge],[L,z]]])}return _.length>0&&(g=Rve.diff(g,_)),Fve(g,1/65536)}function Coe(f,c=1){return[f.map(h=>h.map(g=>[g.x*c,g.y*c]))]}function Fve(f,c=1){return f.map(h=>h.map((g,_)=>{const S=g.map(C=>new ir(C[0]*c,C[1]*c).round());return _>0&&S.reverse(),S}))}class Moe{constructor(c,h){this.layoutVertexArray=new ig,this.indexArray=new Qo,this.lineIndexArray=new Du,this.triangleSegments=new Ui,this.lineSegments=new Ui,this.programConfigurations=new Yh(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,h&&(this.elevatedLayoutVertexArray=new zf)}update(c,h,g,_,S,C,L,z){this.programConfigurations.updatePaintArrays(c,h,S,g,_,C,L,z)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,oHe.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,lHe.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,h,g,_,S,C,L){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,h,g,_,S,C,void 0,L)}}class Toe{constructor(c){this.zoom=c.zoom,this.pixelRatio=c.pixelRatio,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=c.lut,this.bufferData=new Moe(c,!1),this.elevationBufferData=new Moe(c,!0),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.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,h){}updateAppearances(c,h,g,_){}populate(c,h,g,_){this.hasPattern=Noe("fill",this.layers,this.pixelRatio,h);const S=this.layers[0].layout.get("fill-sort-key"),C=[];for(const{feature:L,id:z,index:$,sourceLayerIndex:K}of c){const Z=this.layers[0]._featureFilter.needGeometry,J=Rt(L,Z);if(!this.layers[0]._featureFilter.filter(new li(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),J,g))continue;const re=S?S.evaluate(J,{},g,h.availableImages):void 0,ie={id:z,properties:L.properties,type:L.type,sourceLayerIndex:K,index:$,geometry:Z?J.geometry:St(L,g,_),patterns:{},sortKey:re};C.push(ie)}S&&C.sort((L,z)=>L.sortKey-z.sortKey);for(const L of C){const{geometry:z,index:$,sourceLayerIndex:K}=L;if(this.hasPattern){const Z=Soe("fill",this.layers,L,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Z)}else this.addFeature(L,z,$,g,{},h.availableImages,h.brightness,h.elevationFeatures);h.featureIndex.insert(c[$].feature,z,$,K,this.index)}}update(c,h,g,_,S,C,L){this.bufferData.update(c,h,g,_,S,C,L,this.worldview),this.elevationBufferData.update(c,h,g,_,S,C,L,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,h,g,_,S,C,L,this.worldview)}addFeatures(c,h,g,_,S,C){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,g,_,C,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,h,g,_,S,C=[],L,z){const $=dM(h,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,$,_,g,z):this.addGeometry($,this.bufferData),this.bufferData.populatePaintArrays(c,g,S,C,_,L,this.worldview),this.elevationBufferData.populatePaintArrays(c,g,S,C,_,L,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,h,g,_,S){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(h,g,_,S,this.worldview))}addElevatedRoadFeature(c,h,g,_,S){const C=new Array,L=Ma.getElevationFeature(c,S);if(!L)return void this.addGeometry(h,this.bufferData);{const $=this.clipPolygonsToTile(h,1);$.length>0&&C.push({polygons:$,elevationFeature:L,elevationTileID:g})}const z={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},g),featureIndex:_};for(const $ of C)if($.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Fu($.elevationTileID,this.layers,this.zoom,this.lut));const Z=$.elevationFeature.isTunnel();let J=0;c.properties.hasOwnProperty(Kt)&&(J=+c.properties[Kt]);for(const re of $.polygons)this.elevatedStructures.addPortalCandidates($.elevationFeature.id,re,Z,$.elevationFeature,J)}$.elevationFeature.constantHeight==null&&($.polygons=this.prepareElevatedPolygons($.polygons,$.elevationFeature,$.elevationTileID));const K=new qa(g,$.elevationTileID);this.addElevatedGeometry($.polygons,K,$.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,_,z)}}addElevatedGeometry(c,h,g,_,S,C){const L={elevation:g,elevationSampler:h,bias:_,index:S,featureInfo:C},[z,$]=this.addGeometry(c,this.elevationBufferData,L);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:z,max:$}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,z),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,$))}addGeometry(c,h,g){let _=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,C=null;g&&(C=g.elevationSampler.constantElevation(g.elevation,g.bias),C!=null&&(_=C,S=C));const L=(z,$,K)=>{if(g!=null)if($.push(z),C!=null)h.elevatedLayoutVertexArray.emplaceBack(C),K.push(C);else{const Z=g.elevationSampler.pointElevation(z,g.elevation,g.bias);h.elevatedLayoutVertexArray.emplaceBack(Z),K.push(Z),_=Math.min(_,Z),S=Math.max(S,Z)}};for(const z of c){let $=0;for(const Ue of z)$+=Ue.length;const K=h.triangleSegments.prepareSegment($,h.layoutVertexArray,h.indexArray),Z=K.vertexLength,J=[],re=[],ie=[],ge=[],Se=[],Ne=h.layoutVertexArray.length;for(const Ue of z){if(Ue.length===0)continue;Ue!==z[0]&&re.push(J.length/2);const Qe=h.lineSegments.prepareSegment(Ue.length,h.layoutVertexArray,h.lineIndexArray),xt=Qe.vertexLength;g&&Se.push(h.layoutVertexArray.length-Ne),L(Ue[0],ie,ge),h.layoutVertexArray.emplaceBack(Ue[0].x,Ue[0].y),h.lineIndexArray.emplaceBack(xt+Ue.length-1,xt),J.push(Ue[0].x),J.push(Ue[0].y);for(let mt=1;mt0&&g&&this.elevationMode==="hd-road-base"){const Ue=g.elevation.isTunnel(),Qe=g.elevation.safeArea,xt=this.elevatedStructures.addVertices(ie,ge);this.elevatedStructures.addTriangles(Fe,xt,Ue);const mt=Se.length;if(mt>0){for(let wt=0;wt=g&&re.max.x<=S&&re.min.y>=_&&re.max.y<=C?z:$).push(J)}if(z.length===c.length)return c;const K=[new ir(g,_),new ir(S,_),new ir(S,C),new ir(g,C),new ir(g,_)],Z=z;for(const J of $)Z.push(...wHe(J,K));return Z}}let zve,Bve,$ve,Uve;nn(Toe,"FillBucket",{omit:["layers","patternFeatures"]}),nn(Moe,"FillBufferData"),nn(Fu,"ElevatedStructures");class D6{constructor(c,h,g,_){if(this.triangleCount=h.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[S,C]=[c[0].clone(),c[0].clone()];for(let Z=1;ZZ.cellIdx-J.cellIdx||Z.triIdx-J.triIdx);let K=0;for(;K<$.length;){const Z=$[K].cellIdx,J={start:this.payload.length,len:0};for(;K<$.length&&$[K].cellIdx===Z;)++J.len,this.payload.push($[K++].triIdx);this.cells[Z]=J}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(c,h){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=ug(c.x-this.min.x,this.xScale,this.cellsX),_=ug(c.y-this.min.y,this.yScale,this.cellsY),S=this.cells[_*this.cellsX+g];if(S){this._lazyInitLookup();for(let C=0;Cthis.max.x||this.min.x>h.x||c.y>this.max.y||this.min.y>h.y)return;this._lazyInitLookup();const _=ug(c.x-this.min.x,this.xScale,this.cellsX),S=ug(h.x-this.min.x,this.xScale,this.cellsX),C=ug(c.y-this.min.y,this.yScale,this.cellsY),L=ug(h.y-this.min.y,this.yScale,this.cellsY);for(let z=C;z<=L;z++)for(let $=_;$<=S;$++){const K=this.cells[z*this.cellsX+$];if(K)for(let Z=0;Zh.fqid),this.index=c.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.footprints=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){for(const g of this.footprints)h.push({footprint:g,id:c})}updateAppearances(c,h,g,_){}populate(c,h,g,_){const S=[];for(const{feature:C,id:L,index:z,sourceLayerIndex:$}of c){const K=this.layers[0]._featureFilter.needGeometry,Z=Rt(C,K);if(!this.layers[0]._featureFilter.filter(new li(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const J={id:L,properties:C.properties,type:C.type,sourceLayerIndex:$,index:z,geometry:K?Z.geometry:St(C,g,_),patterns:{}};S.push(J)}for(const C of S){const{geometry:L,index:z,sourceLayerIndex:$}=C;this.addFeature(C,L,z,g,{},h.availableImages,h.brightness),h.featureIndex.insert(c[z].feature,L,z,$,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,h,g,_,S,C,L){}destroy(){}addFeature(c,h,g,_,S,C=[],L){for(const z of dM(h,2)){const $=[],K=[],Z=[],J=new ir(1/0,1/0),re=new ir(-1/0,-1/0);for(const Se of z)if(Se.length!==0){Se!==z[0]&&Z.push(K.length/2);for(let Ne=0;NeC===_)===void 0}(g,f.clipScope)}function R6(f,c){return f.x-c.x||f.y-c.y}function Wve(f,c){return R6(f.min,c.min)===0&&R6(f.max,c.max)===0}function Aoe(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew ir((z.x+S.x*Ir)*L-C.x*Ir,(z.y+S.y*Ir)*L-C.y*Ir))}return Eoe(h,_,f.indices,0,f.indices.length,0,0)}function Zve(f,c,h,g){const _=Math.pow(2,g.z-h.z);return new ir((f+h.x*Ir)*_-g.x*Ir,(c+h.y*Ir)*_-g.y*Ir)}function Yve(f,c){const h=[];c.grid.queryPoint(f,h);const g=c.indices,_=c.vertices;for(let S=0;S0&&(g.length>1&&h.push(g),g=[])}return g.length>1&&h.push(g),h}const Poe=Dt.types,PHe=["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"],LHe=["fill-extrusion-flood-light-ground-radius"],OHe=Math.pow(2,13),DHe=Math.pow(2,15)-1,Qve=new ir(0,1),Ax=2147483648,Jve=7,e_e=450;function hM(f,c,h,g,_,S,C,L){f.emplaceBack((c<<1)+C,(h<<1)+S,(Math.floor(g*OHe)<<1)+_,Math.round(L))}function mM(f,c,h){f.emplaceBack(c.x*Ir,c.y*Ir,h?1:0)}function z6(f,c,h,g,_,S){f.emplaceBack(c.x,c.y,(h.x<<1)+g,(h.y<<1)+_,S)}function fM(f,c,h){f.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}class t_e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class r_e{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 n_e{constructor(){this.acc=new ir(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(c,h){c.min.x===Number.MAX_VALUE&&(c.min.x=c.max.x=h.x,c.min.y=c.max.y=h.y)}appendEdge(c,h,g){this.accCount++,this.acc._add(h);let _=!!this.borders;h.xc.max.x&&(c.max.x=h.x,_=!0),h.yc.max.y&&(c.max.y=h.y,_=!0),((h.x===0||h.x===Ir)&&h.x===g.x)!=((h.y===0||h.y===Ir)&&h.y===g.y)&&this.processBorderOverlap(h,g),_&&this.checkBorderIntersection(h,g)}checkBorderIntersection(c,h){h.x<0!=c.x<0&&this.addBorderIntersection(0,zn(h.y,c.y,(0-h.x)/(c.x-h.x))),h.x>Ir!=c.x>Ir&&this.addBorderIntersection(1,zn(h.y,c.y,(Ir-h.x)/(c.x-h.x))),h.y<0!=c.y<0&&this.addBorderIntersection(2,zn(h.x,c.x,(0-h.y)/(c.y-h.y))),h.y>Ir!=c.y>Ir&&this.addBorderIntersection(3,zn(h.x,c.x,(Ir-h.y)/(c.y-h.y)))}addBorderIntersection(c,h){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];hg[1]&&(g[1]=h)}processBorderOverlap(c,h){if(c.x===h.x){if(c.y===h.y)return;const g=c.x===0?0:1;this.addBorderIntersection(g,h.y),this.addBorderIntersection(g,c.y)}else{const g=c.y===0?2:3;this.addBorderIntersection(g,h.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,h)=>c+ +(h[0]!==Number.MAX_VALUE),0):0}}function s_e(f,c){const h=f.add(c)._unit(),g=ye(f.x*h.x+f.y*h.y,-1,1);var _,S,C;return _=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(_)))/4*DHe*((S=f).x*(C=c).y-S.y*C.x<0?-1:1)}const RHe=[f=>f.x<0,f=>f.x>Ir,f=>f.y<0,f=>f.y>Ir];function FHe(f,c,h,g){const _=[4];if(g===0)return _;h._mult(g);const S=f.sub(h),C=c.sub(h),L=[f,c,S,C];for(let z=0;z<4;z++)for(const $ of L)if(RHe[z]($)){_.push(z);break}return _}class Loe{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new B5,this.indexArray=new Qo,this.programConfigurations=new Yh(c.layers,{zoom:c.zoom,lut:c.lut},h=>LHe.includes(h)),this._segments=new Ui,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 Ui}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,h,g,_=!1){const S=c.length;if(S>2){let C=Math.max(0,this._segments.get().length-1);const L=this._segments._prepareSegment(4*S,this.vertexArray.length,2*this._segmentToGroundQuads[C].length);let z;C!==this._segments.get().length-1&&(C++,this._segmentToGroundQuads[C]=[],this._segmentToRegionTriCounts[C]=[0,0,0,0,0]);{const $=c[0],K=c[1];z=s_e($.sub(c[S-1])._perp()._unit(),K.sub($)._perp()._unit())}for(let $=0;$_.region-S.region);for(let g=0;gz+$,0);let L=0;for(let z=0;z<=4;z++){const $=C[z];if($!==0){let K=this.regionSegments[z];K||(K=this.regionSegments[z]=new Ui);const Z={vertexOffset:S.vertexOffset,primitiveOffset:S.primitiveOffset+L,vertexLength:S.vertexLength,primitiveLength:$};K.get().push(Z)}L+=$}for(let z=0;z<_.length;z++){const $=_[z].id;this.indexArray.emplaceBack($,$+1,$+3),this.indexArray.emplaceBack($,$+3,$+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(c,h,g,_,S,C,L){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,c,h,g,_,S,C,void 0,L)}upload(c){this.hasData()&&(this.vertexBuffer=c.createVertexBuffer(this.vertexArray,NHe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=c.createVertexBuffer(this.groundRadiusArray,SHe.members)))}uploadPaintProperties(c){this.hasData()&&this.programConfigurations.upload(c)}update(c,h,g,_,S,C,L,z){this.hasData()&&this.programConfigurations.updatePaintArrays(c,h,g,_,S,C,L,z)}updateHiddenByLandmark(c){this.updateHiddenByLandmarkRange(c.groundVertexArrayOffset,c.groundVertexCount,!!(c.flags&Ax))}updateHiddenByLandmarkRange(c,h,g){if(!this.hasData())return;const _=h+c;if(h!==0){for(let S=c;S<_;++S)this.hiddenByLandmarkVertexArray.emplace(S,g?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(c){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,THe.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 h=this.regionSegments[c];h&&h.destroy()}}}}class B6{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(h=>h.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 Qo,this.footprintVertices=new ig,this.footprintSegments=[],this.layoutVertexArray=new v0,this.centroidVertexArray=new C6,this.wallVertexArray=new o_,this.indexArray=new Qo,this.programConfigurations=new Yh(c.layers,{zoom:c.zoom,lut:c.lut},h=>PHe.includes(h)),this.segments=new Ui,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.groundEffect=new Loe(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,_){}populate(c,h,g,_){this.features=[],this.hasPattern=Noe("fill-extrusion",this.layers,this.pixelRatio,h),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=De(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:S,id:C,index:L,sourceLayerIndex:z}of c){const $=this.layers[0]._featureFilter.needGeometry,K=Rt(S,$);if(!this.layers[0]._featureFilter.filter(new li(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),K,g))continue;const Z={id:C,sourceLayerIndex:z,index:L,geometry:$?K.geometry:St(S,g,_),properties:S.properties,type:S.type,patterns:{}},J=this.layoutVertexArray.length,re=Poe[Z.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:S.id,feature:Soe("fill-extrusion",this.layers,Z,this.zoom,this.pixelRatio,h)});else if(this.wallMode)for(const ie of Z.geometry)for(const ge of Xve(ie,re))this.addFeature(S.id,Z,[ge],L,g,{},h.availableImages,_,h.brightness);else this.addFeature(S.id,Z,Z.geometry,L,g,{},h.availableImages,_,h.brightness);h.featureIndex.insert(S,Z.geometry,L,z,this.index,J)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,h,g,_,S,C){for(const{featureId:L,feature:z}of this.features){const $=Poe[z.type]==="Polygon",{geometry:K}=z;if(this.wallMode)for(const Z of K)for(const J of Xve(Z,$))this.addFeature(L,z,[J],z.index,h,g,_,S,C);else this.addFeature(L,z,K,z.index,h,g,_,S,C)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,h,g,_,S,C,L){this.programConfigurations.updatePaintArrays(c,h,S,g,_,C,L,this.worldview),this.groundEffect.update(c,h,S,g,_,C,L,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,EHe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,MHe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,AHe.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,CHe.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,h,g,_,S,C,L,z,$){const K=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(h,{})/this.tileToMeter,Z=[new ir(0,0),new ir(Ir,Ir)],J=z.projection,re=J.name==="globe",ie=this.wallMode||Poe[h.type]==="Polygon",ge=new n_e;ge.centroidDataIndex=this.centroidData.length;const Se=new r_e;Se.buildingId=c,h.properties&&h.properties.hasOwnProperty("building_id")&&(Se.buildingId=h.properties.building_id);const Ne=this.layers[0].paint.get("fill-extrusion-base").evaluate(h,{},S)<=0,Fe=this.layers[0].paint.get("fill-extrusion-height").evaluate(h,{},S);let Ue;if(Se.height=Fe,Se.vertexArrayOffset=this.layoutVertexArray.length,Se.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new IN),this.wallMode){if(re)return void Kr("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;Ue=function(Ft){const nr=Ft[0].x===Ft[Ft.length-1].x&&Ft[0].y===Ft[Ft.length-1].y;(function(Jr){let dn=0;const bs=Jr.length;for(let Nr=0;Nr=0})(Ft)||(Ft=Ft.reverse());const hr={geometry:[],joinNormals:[],indices:[]},vr=[],br=[],fr=[];let xr=Ft.length;for(;xr>=2&&Ft[xr-1].equals(Ft[xr-2]);)xr--;if(xr<(nr?3:2))return hr;let rr,Jt,yr,Pr,kr,vn=0;for(;vn0;let Gn="miter";const Ks=2;Gn==="miter"&&Nr>Ks&&(Gn="bevel"),Gn==="bevel"&&(Nr>100&&(Gn="flipbevel"),Nr{const sr=new ir(cs.x,cs.y),_r=new ir(cs.x,cs.y);sr.x+=Ga.x*vt,sr.y+=Ga.y*vt,_r.x-=Ga.x*Math.max(ft,1),_r.y-=Ga.y*Math.max(ft,1),fr.push(Ga),vr.push(sr),br.push(_r)};if(Gn==="miter")dn._mult(Nr),Js(rr,dn,0,0);else if(Gn==="flipbevel")dn=kr.mult(-1),Js(rr,dn,0,0),Js(rr,dn.mult(-1),0,0);else{const cs=-Math.sqrt(Nr*Nr-1),Ga=hn?cs:0,ft=hn?0:cs;Jt&&Js(rr,Pr,Ga,ft),yr&&Js(rr,kr,Ga,ft)}}hr.geometry=[...vr,...br.reverse(),vr[0]],hr.joinNormals=[...fr,...fr.reverse(),fr[fr.length-1]];const Wr=hr.geometry.length-1;for(let Jr=0;JrFt<(nr.length-1)/2||Ft===nr.length-1,xt=this.wallMode?[g]:dM(g,500);for(let Ft=xt.length-1;Ft>=0;Ft--){const nr=xt[Ft];(nr.length===0||(mt=nr[0]).every(ur=>ur.x<=0)||mt.every(ur=>ur.x>=Ir)||mt.every(ur=>ur.y<=0)||mt.every(ur=>ur.y>=Ir))&&xt.splice(Ft,1)}var mt;let wt;if(re)wt=u_e(xt,Z,S);else{wt=[];for(const Ft of xt)wt.push({polygon:Ft,bounds:Z})}const Ct=ie?this.edgeRadius:0,Pt=Ct>0&&this.zoom<17,Qt=(Ft,nr)=>{if(Ft.length===0)return!1;const ur=Ft[Ft.length-1];return nr.x===ur.x&&nr.y===ur.y};for(const{polygon:Ft,bounds:nr}of wt){let ur=0,hr=0;for(const xr of Ft)ie&&!xr[0].equals(xr[xr.length-1])&&xr.push(xr[0]),hr+=ie?xr.length-1:xr.length;const vr=this.segments.prepareSegment((ie?5:4)*hr,this.layoutVertexArray,this.indexArray);Se.footprintSegIdx<0&&(Se.footprintSegIdx=this.footprintSegments.length),Se.polygonSegIdx<0&&(Se.polygonSegIdx=this.polygonSegments.length);const br={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},fr=new t_e;if(fr.vertexOffset=this.footprintVertices.length,fr.indexOffset=3*this.footprintIndices.length,fr.ringIndices=[],ie){const xr=[],rr=[];ur=vr.vertexLength;for(let yr=0;yr4&&l_e(rr[rr.length-2],rr[0],rr[1]),yr=Ct?zHe(rr[rr.length-2],rr[0],rr[1],Ct):0;const Pr=[];let kr,vn,Wr;vn=rr[1].sub(rr[0])._perp()._unit();let Jr=!0;for(let dn=1,bs=0;dn0?1:0,Ga=Nr.dist(hn);if(bs+Ga>32768&&(bs=0),Ct){Wr=Gn.sub(hn)._perp()._unit();let _r=i_e(Nr,hn,Gn,a_e(vn,Wr),Ct);isNaN(_r)&&(_r=0);const Ur=hn.sub(Nr)._unit();Nr=Nr.add(Ur.mult(yr))._round(),hn=hn.add(Ur.mult(-_r))._round(),yr=_r,vn=Wr,Ne&&this.zoom>=17&&(Qt(Pr,Nr)||Pr.push(Nr),Qt(Pr,hn)||Pr.push(hn))}const ft=vr.vertexLength,vt=rr.length>4&&l_e(Nr,hn,Gn);let sr=c_e(bs,Jt,Jr);if(hM(this.layoutVertexArray,Nr.x,Nr.y,Js,cs,0,0,sr),hM(this.layoutVertexArray,Nr.x,Nr.y,Js,cs,0,1,sr),this.wallMode){const _r=Qe(dn-1,rr),Ur=Ue.joinNormals[dn-1];mM(this.wallVertexArray,Ur,_r),mM(this.wallVertexArray,Ur,_r)}if(bs+=Ga,sr=c_e(bs,vt,!Jr),Jt=vt,hM(this.layoutVertexArray,hn.x,hn.y,Js,cs,0,0,sr),hM(this.layoutVertexArray,hn.x,hn.y,Js,cs,0,1,sr),this.wallMode){const _r=Qe(dn,rr),Ur=Ue.joinNormals[dn];mM(this.wallVertexArray,Ur,_r),mM(this.wallVertexArray,Ur,_r)}if(vr.vertexLength+=4,this.indexArray.emplaceBack(ft+0,ft+1,ft+2),this.indexArray.emplaceBack(ft+1,ft+3,ft+2),vr.primitiveLength+=2,Ct){const _r=ur+(dn===1?rr.length-2:dn-2),Ur=dn===1?ur:_r+1;if(this.indexArray.emplaceBack(ft+1,_r,ft+3),this.indexArray.emplaceBack(_r,Ur,ft+3),vr.primitiveLength+=2,kr===void 0&&(kr=ft),!Ooe(Gn,rr[dn],nr)){const qr=dn===rr.length-1?kr:vr.vertexLength;this.indexArray.emplaceBack(ft+2,ft+3,qr),this.indexArray.emplaceBack(ft+3,qr+1,qr),this.indexArray.emplaceBack(ft+3,Ur,qr+1),vr.primitiveLength+=3}Jr=!Jr}if(re){const _r=this.layoutVertexExtArray,Ur=J.projectTilePoint(Nr.x,Nr.y,S),qr=J.projectTilePoint(hn.x,hn.y,S),bn=J.upVector(S,Nr.x,Nr.y),kn=J.upVector(S,hn.x,hn.y);fM(_r,Ur,bn),fM(_r,Ur,bn),fM(_r,qr,kn),fM(_r,qr,kn)}}ie&&(ur+=rr.length-1),Ne&&Ct&&this.zoom>=17&&(Pr.length!==0&&Qt(Pr,Pr[0])&&Pr.pop(),this.groundEffect.addData(Pr,nr,K,Ct>0))}this.footprintSegments.push(fr),br.triangleCount=this.indexArray.length-br.triangleArrayOffset,this.polygonSegments.push(br),++Se.footprintSegLen,++Se.polygonSegLen}if(Se.vertexCount=this.layoutVertexArray.length-Se.vertexArrayOffset,Se.groundVertexCount=this.groundEffect.vertexArray.length-Se.groundVertexArrayOffset,Se.vertexCount!==0){if(Se.centroidXY=ge.borders?Qve:this.encodeCentroid(ge,Se),this.centroidData.push(Se),ge.borders){this.featuresOnBorder.push(ge);const Ft=this.featuresOnBorder.length-1;for(let nr=0;nrthis.featuresOnBorder[h].borders[c][0]-this.featuresOnBorder[g].borders[c][0])}splitToSubtiles(){const c=[];for(let L=0;LIr),K=2*$+(+(z.min.x+z.max.x>Ir)^$);for(let Z=0;ZL.triangleSegmentIdx===z.triangleSegmentIdx?L.subtile-z.subtile:L.triangleSegmentIdx-z.triangleSegmentIdx);let g=0,_=0,S=0;for(const L of c){if(L.triangleSegmentIdx!==g)break;S++}const C=c.length;for(;_!==c.length;){g=c[_].triangleSegmentIdx;let L=0,z=_,$=_;for(let K=z;K0&&this.triangleSubSegments.push({segment:re,min:Z,max:J}),z=$;for(let ie=z;ie[ge[0]*(1-Ne[0])+Se[0]*Ne[0],ge[1]*(1-Ne[1])+Se[1]*Ne[1]],re=[],ie=[];for(const ge of this.triangleSubSegments){re[0]=ge.min.x/Ir,re[1]=ge.min.y/Ir,ie[0]=ge.max.x/Ir,ie[1]=ge.max.y/Ir;const Se=J(K,Z,re),Ne=J(K,Z,ie);if(new xn([Se[0],Se[1],S],[Ne[0],Ne[1],C]).intersectsPrecise(g)===0){$&&(_.segments.push($),$=void 0);continue}const Fe=ge.segment;$&&$.vertexOffset!==Fe.vertexOffset&&(_.segments.push($),$=void 0),$?($.vertexLength+=Fe.vertexLength,$.primitiveLength+=Fe.primitiveLength):$={vertexOffset:Fe.vertexOffset,primitiveLength:Fe.primitiveLength,vertexLength:Fe.vertexLength,primitiveOffset:Fe.primitiveOffset,sortKey:void 0,vaos:{}}}return $&&_.segments.push($),_}encodeCentroid(c,h){const g=c.centroid(),_=h.span(),S=Math.min(7,Math.round(_.x*this.tileToMeter/10)),C=Math.min(7,Math.round(_.y*this.tileToMeter/10));return new ir(ye(g.x,1,Ir-1)<<3|S,ye(g.y,1,Ir-1)<<3|C)}encodeBorderCentroid(c){if(!c.borders)return new ir(0,0);const h=c.borders,g=Number.MAX_VALUE;if(h[0][0]!==g||h[1][0]!==g){const _=h[0][0]!==g?0:1;return new ir(6|(h[0][0]!==g?0:65528),(h[_][0]+h[_][1])/2<<3|6)}{const _=h[2][0]!==g?2:3;return new ir((h[_][0]+h[_][1])/2<<3|6,6|(h[2][0]!==g?0:65528))}}showCentroid(c){const h=this.centroidData[c.centroidDataIndex];h.flags&=2147483647,h.centroidXY.x=0,h.centroidXY.y=0,this.writeCentroidToBuffer(h)}writeCentroidToBuffer(c){this.groundEffect.updateHiddenByLandmark(c);const h=c.vertexArrayOffset,g=c.vertexCount+c.vertexArrayOffset,_=c.flags&Ax?Qve:c.centroidXY,S=this.centroidVertexArray.geta_centroid_pos0(h);if(this.centroidVertexArray.geta_centroid_pos1(h)!==_.y||S!==_.x){for(let C=h;Cz.max.x||z.min.x>C.max.x||C.min.y>z.max.y||z.min.y>C.max.y||C.footprint.buildingIds.has(z.buildingId)&&(z.flags|=Ax);else for(const z of this.centroidData)if(!(z.flags&Ax||C.min.x>z.max.x||z.min.x>C.max.x||C.min.y>z.max.y||z.min.y>C.max.y))for(let $=0;$h!=re>h&&c<(this.footprintVertices.int16[2*(K+C.vertexOffset)+0]-Z)*(h-J)/(re-J)+Z&&(_=!_)}L=z}}return _}getHeightAtTileCoord(c,h){let g=Number.NEGATIVE_INFINITY,_=!0;const S=4*(c+Ir)*Ir+(h+Ir);if(this.partLookup.hasOwnProperty(S)){const C=this.partLookup[S];return C?{height:C.height,hidden:!!(C.flags&Ax)}:void 0}for(const C of this.centroidData)c>C.max.x||C.min.x>c||h>C.max.y||C.min.y>h||C.height<=g||this.footprintContainsPoint(c,h,C)&&(g=C.height,this.partLookup[S]=C,_=!!(C.flags&Ax));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:_};this.partLookup[S]=void 0}}function a_e(f,c){const h=f.add(c)._unit();return f.x*h.x+f.y*h.y}function zHe(f,c,h,g){const _=c.sub(f)._perp()._unit(),S=h.sub(c)._perp()._unit();return i_e(f,c,h,a_e(_,S),g)}function i_e(f,c,h,g,_){const S=Math.sqrt(1-g*g);return Math.min(f.dist(c)/3,c.dist(h)/3,_*S/g)}function Ooe(f,c,h){return f.xh[1].x&&c.x>h[1].x||f.yh[1].y&&c.y>h[1].y}function o_e(f,c){return f.xc[1].x||f.yc[1].y}function l_e(f,c,h){if(f.x<0||f.x>=Ir||c.x<0||c.x>=Ir||h.x<0||h.x>=Ir)return!1;const g=h.sub(c),_=g.perp(),S=f.sub(c);return(g.x*S.x+g.y*S.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(S.x*S.x+S.y*S.y))>-.866&&_.x*S.x+_.y*S.y<0}function c_e(f,c,h){const g=c?2|f:-3&f;return h?1|g:-2&g}function d_e(){const f=Math.PI/32,c=Math.tan(f),h=w;return h*Math.sqrt(1+2*c*c)-h}function u_e(f,c,h){const g=1<{for(const Ct of mt)ie.push({polygon:Ct,bounds:wt})},Se=Math.ceil(Math.log2(K)),Ne=Math.ceil(Math.log2(Z)),Fe=Se-Ne,Ue=[];for(let mt=0;mt0?0:1);for(let mt=0;mtwt+1?xt.push({polygons:hr,bounds:br,depth:wt+1}):ge(hr,br)}if(vr.length){const br=[new ir(Ct===0?ur:Pt.x,Ct===1?ur:Pt.y),Qt];Ue.length>wt+1?xt.push({polygons:vr,bounds:br,depth:wt+1}):ge(vr,br)}}return ie}(f,c,Math.ceil((S-_)/11.25),Math.ceil((C-L)/11.25),1,(z,$,K)=>{if(z===0)return .5*($+K);{const Z=de((h.y+$/Ir)/g);return(H(.5*(de((h.y+K/Ir)/g)+Z))*g-h.y)*Ir}})}function BHe(f,c,h,g,_,S){const C=Math.pow(2,g.z-_.z);for(let L=0;L=z[C]&&(L=c,z=f),L[C]<_&&z[C]>_&&p_e(L,z,C,_),L[C]S&&p_e(z,L,C,S)}}function $6(f,c,h,g,_,S){const C=[];for(let L=0;L=g&&ie.x>=g||(re.x>=g?re=new ir(g,re.y+(g-re.x)/(ie.x-re.x)*(ie.y-re.y))._round():ie.x>=g&&(ie=new ir(g,re.y+(g-re.x)/(ie.x-re.x)*(ie.y-re.y))._round()),re.y>=_&&ie.y>=_||(re.y>=_?re=new ir(re.x+(_-re.y)/(ie.y-re.y)*(ie.x-re.x),_)._round():ie.y>=_&&(ie=new ir(re.x+(_-re.y)/(ie.y-re.y)*(ie.x-re.x),_)._round()),$&&re.equals($[$.length-1])||($=[re],C.push($),S&&S.push({progress:{min:Se+x_e(Ne,Fe,re)*ge,max:1},parentIndex:L,prevPoint:Ne,nextPoint:Fe})),$.push(ie),S&&(S[S.length-1].progress.max=Se+x_e(Ne,Fe,ie)*ge,S[S.length-1].nextPoint=Fe)))))}if(S&&Z>0)for(let J=K;J$.t-K.t);let C=0,L=0,z=[];for(g.push(z);C!==f.length;){if(L===S.length){for(;C!==f.length;)z.length!==0&&z[z.length-1].equals(f[C])||z.push(f[C]),C++;break}S[L].t<=C?(z.length!==0&&z[z.length-1].equals(S[L].point)||z.push(S[L].point),Math.trunc(S[L].t),L++):(z.length!==0&&z[z.length-1].equals(f[C])||z.push(f[C]),C++)}}function x_e(f,c,h){return f.x!==c.x?(h.x-f.x)/(c.x-f.x):f.y!==c.y?(h.y-f.y)/(c.y-f.y):0}function pM(f,c){return f.x*c.x+f.y*c.y}function y_e(f,c){if(f.length===1){let h=0;const g=c[h++];let _;for(;!_||g.equals(_);)if(_=c[h++],!_)return 1/0;for(;h{ur[0]=hr,ur[1]=vr,ur[2]=br,ur[3]=1},nr=d_e();re>0&&(re+=nr),ie+=nr;for(const ur of J){const hr=[],vr=[];for(const br of ur){const fr=br.x+ge.x,xr=br.y+ge.y,rr=Z.projection.projectTilePoint(fr,xr,xt),Jt=Z.projection.upVector(xt,br.x,br.y);let yr=re,Pr=ie;if(Ne){const kr=b_e(fr,xr,re,ie,Ne,Fe,Ue,Qe);yr+=kr.base,Pr+=kr.top}re!==0?Ft(Pt,rr.x+Jt[0]*Ct*yr,rr.y+Jt[1]*Ct*yr,rr.z+Jt[2]*Ct*yr):Ft(Pt,rr.x,rr.y,rr.z),Ft(Qt,rr.x+Jt[0]*Ct*Pr,rr.y+Jt[1]*Ct*Pr,rr.z+Jt[2]*Ct*Pr),at(Pt,Pt,Se),at(Qt,Qt,Se),hr.push(new x_(Pt[0],Pt[1],Pt[2])),vr.push(new x_(Qt[0],Qt[1],Qt[2]))}mt.push(hr),wt.push(vr)}return[mt,wt]}(f,c,h,g,_,S,C,L,z,$,K):C?function(Z,J,re,ie,ge,Se,Ne,Fe,Ue){const Qe=[],xt=[],mt=[0,0,0,1];for(const wt of Z){const Ct=[],Pt=[];for(const Qt of wt){const Ft=Qt.x+ie.x,nr=Qt.y+ie.y,ur=b_e(Ft,nr,J,re,Se,Ne,Fe,Ue);mt[0]=Ft,mt[1]=nr,mt[2]=ur.base,mt[3]=1,Ke(mt,mt,ge),mt[3]=Math.max(mt[3],1e-5);const hr=new x_(mt[0]/mt[3],mt[1]/mt[3],mt[2]/mt[3]);mt[0]=Ft,mt[1]=nr,mt[2]=ur.top,mt[3]=1,Ke(mt,mt,ge),mt[3]=Math.max(mt[3],1e-5);const vr=new x_(mt[0]/mt[3],mt[1]/mt[3],mt[2]/mt[3]);Ct.push(hr),Pt.push(vr)}Qe.push(Ct),xt.push(Pt)}return[Qe,xt]}(c,h,g,_,S,C,L,z,$):function(Z,J,re,ie,ge){const Se=[],Ne=[],Fe=ge[8]*J,Ue=ge[9]*J,Qe=ge[10]*J,xt=ge[11]*J,mt=ge[8]*re,wt=ge[9]*re,Ct=ge[10]*re,Pt=ge[11]*re;for(const Qt of Z){const Ft=[],nr=[];for(const ur of Qt){const hr=ur.x+ie.x,vr=ur.y+ie.y,br=ge[0]*hr+ge[4]*vr+ge[12],fr=ge[1]*hr+ge[5]*vr+ge[13],xr=ge[2]*hr+ge[6]*vr+ge[14],rr=ge[3]*hr+ge[7]*vr+ge[15],Jt=br+Fe,yr=fr+Ue,Pr=xr+Qe,kr=Math.max(rr+xt,1e-5),vn=br+mt,Wr=fr+wt,Jr=xr+Ct,dn=Math.max(rr+Pt,1e-5);Ft.push(new x_(Jt/kr,yr/kr,Pr/kr)),nr.push(new x_(vn/dn,Wr/dn,Jr/dn))}Se.push(Ft),Ne.push(nr)}return[Se,Ne]}(c,h,g,_,S)}function b_e(f,c,h,g,_,S,C,L){const z=C*_.getElevationAt(f,c,!0,!0),$=S[0]!==0,K=$?S[1]===0?C*(S[0]/Jve-e_e):C*function(Z,J,re){const ie=Math.floor(J[0]/8),ge=Math.floor(J[1]/8),Se=10*(J[0]-8*ie),Ne=10*(J[1]-8*ge),Fe=Z.getElevationAt(ie,ge,!0,!0),Ue=Z.getMeterToDEM(re),Qe=Math.floor(.5*(Se*Ue-1)),xt=Math.floor(.5*(Ne*Ue-1)),mt=Z.tileCoordToPixel(ie,ge),wt=2*Qe+1,Ct=2*xt+1,Pt=function(vr,br,fr,xr,rr){return[vr.getElevationAtPixel(br,fr,!0),vr.getElevationAtPixel(br+rr,fr,!0),vr.getElevationAtPixel(br,fr+rr,!0),vr.getElevationAtPixel(br+xr,fr+rr,!0)]}(Z,mt.x-Qe,mt.y-xt,wt,Ct),Qt=Math.abs(Pt[0]-Pt[1]),Ft=Math.abs(Pt[2]-Pt[3]),nr=Math.abs(Pt[0]-Pt[2])+Math.abs(Pt[1]-Pt[3]),ur=Math.min(.25,.5*Ue*(Qt+Ft)/wt),hr=Math.min(.25,.5*Ue*nr/Ct);return Fe+Math.max(ur*Se,hr*Ne)}(_,S,L):z;return{base:z+(h===0?-1:h),top:$?Math.max(K+g,z+h+2):z+g}}class UHe{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 qHe{constructor(){this.tasks={},this.taskQueue=[],Ot(["process"],this),this.invoker=new UHe(this.process),this.nextId=0}add(c,h){const g=this.nextId++,_=function({type:S,isSymbolTile:C,zoom:L}){return L=L||0,S==="message"?0:S!=="maybePrepare"||C?S!=="parseTile"||C?S==="parseTile"&&C?300-L:S==="maybePrepare"&&C?400-L:500:200-L:100-L}(h);if(_===0){try{c()}finally{}return null}return this.tasks[g]={fn:c,metadata:h,priority:_,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 h=this.tasks[c];if(delete this.tasks[c],this.taskQueue.length&&this.invoker.trigger(),!h)return;h.fn()}finally{}}pick(){let c=null,h=1/0;for(let _=0;_{g&&delete this.callbacks[L],this.target.postMessage({id:L,type:"",targetMapId:_,sourceMapId:this.mapId})}}}receive(c){const h=c.data;if(!h)return;const g=h.id;if(g&&(!h.targetMapId||this.mapId===h.targetMapId))if(h.type===""){const _=this.cancelCallbacks[g];delete this.cancelCallbacks[g],_&&_.cancel()}else if(h.mustQueue||Ws(self)){const _=this.callbacks[g],S=this.scheduler.add(()=>this.processTask(g,h),_&&_.metadata||{type:"message"});S&&(this.cancelCallbacks[g]=S)}else this.processTask(g,h)}processTask(c,h){if(delete this.cancelCallbacks[c],h.type===""){const g=this.callbacks[c];delete this.callbacks[c],g&&(h.error?g(ag(h.error)):g(null,ag(h.data)))}else{const g=new Set,_=h.hasCallback?(C,L)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:C?Of(C):null,data:Of(L,g)},g)}:()=>{},S=ag(h.data);if(this.parent[h.type])this.parent[h.type](h.sourceMapId,S,_);else if(this.parent.getWorkerSource){const C=h.type.split("."),{source:L,scope:z}=S;this.parent.getWorkerSource(h.sourceMapId,C[0],L,z)[C[1]](S,_)}else _(new Error(`Could not find function ${h.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var gM={workerUrl:"",workerClass:null,workerParams:void 0};const Doe="mapboxgl_preloaded_worker_pool";class y_{constructor(c){this.active={},this.name=c}acquire(c,h=y_.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Doe]}numActive(){return Object.keys(this.active).length}}y_.workerCount=2;class QN{constructor(c,h,g="Worker",_=y_.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=It();const S=this.workerPool.acquire(this.id,_);for(let C=0;C{this.ready=!0})}broadcast(c,h,g){Nt(this.actors,(_,S)=>{_.send(c,h,S)},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 xM,Roe;function U6(){return xM||(xM=new y_),xM}QN.Actor=w_e;const Foe=4096;class VHe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Foe),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Foe?-1:(new Int32Array(this.module.heap32.buffer,h,c.length).set(c),h)}createFloatArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Foe?-1:(new Float32Array(this.module.heapF32.buffer,h,c.length).set(c),h)}readStringBuffer(c){let h="";for(;this.module.heapU8[c]!==0;)h+=String.fromCharCode(this.module.heapU8[c]),++c;return h}setStyle(c){const h=c.normalScale;this.module.setStyle(h[0],h[1],h[2],c.tileToMeters)}setAOOptions(c,h){this.module.setAOOptions(c?1:0,h)}setMetricOptions(c,h){this.module.setMetricOptions(c?1:0,h)}setStructuralOptions(c){this.module.setStructuralOptions(c?1:0)}setFacadeOptions(c,h){this.module.setFacadeOptions(c,h?1:0)}setFauxFacadeOptions(c,h,g){this.module.setFauxFacadeOptions(c?1:0,h?1:0,g)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,h){this.memoryStackNextFree=this.memoryStack;for(const L of c){const z=this.createIntArray(L.ringIndices),$=this.createFloatArray(L.coordinates);if(z===-1||$===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(L.id,L.sourceId,L.minHeight,L.height,L.roofType,$,z,L.ringIndices.length-1)}for(const L of h){let z;z=L.entrances?JSON.parse(L.entrances):[];const $=this.createFloatArray(z),K=this.createFloatArray(L.coordinates);if($===-1||K===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(L.sourceId,L.crossPerc,L.distanceToRoad,$,z.length,K,L.coordinates.length)}if(!this.module.generateMesh()){const L=this.module.getLastError();return this.readStringBuffer(L)}const g=this.module.getMeshCount(),_=new Array(g);for(let L=0;L_.arrayBuffer()).then(_=>{c.buffers[h]=_})}function A_e(f,c){const h=f.json.bufferViews[c];return new Uint8Array(f.buffers[h.buffer],h.byteOffset||0,h.byteLength)}function YHe(f,c,h,g){if(f.uri){const _=T_e(f.uri,g);return fetch(_).then(S=>S.blob()).then(S=>createImageBitmap(S)).then(S=>{c.images[h]=S})}if(f.bufferView!==void 0){const _=A_e(c,f.bufferView),S=new Blob([_],{type:f.mimeType});return createImageBitmap(S).then(C=>{c.images[h]=C})}}function E_e(f,c=0,h){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===C_e){const K=new Uint32Array(f,c);let Z=2;const J=(K[Z++]>>2)-3,re=K[Z++]>>2;if(Z++,g.json=JSON.parse(M_e.decode(K.subarray(Z,Z+re))),Z+=re,Z{const K=[],Z=L&&L.includes($oe),J=L&&L.includes(H6);if(Z&&K.push(function(){if(!Gf)return yM??(yM=function(re){let ie,ge=null;function Se(){ie=new Uint8Array(ge.buffer)}function Ne(){throw new Error("Unexpected Draco error.")}const Fe={a:{a:Ne,d:function(Ue,Qe,xt){return ie.copyWithin(Ue,Qe,Qe+xt)},c:function(Ue){const Qe=ie.length,xt=Math.max(Ue>>>0,Math.ceil(1.2*Qe)),mt=Math.ceil((xt-Qe)/65536);try{return ge.grow(mt),Se(),!0}catch{return!1}},b:Ne}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,Fe):re.then(Ue=>Ue.arrayBuffer()).then(Ue=>WebAssembly.instantiate(Ue,Fe))).then(Ue=>{const{Rb:Qe,Qb:xt,P:mt,T:wt,X:Ct,Ja:Pt,La:Qt,Qa:Ft,Va:nr,Wa:ur,eb:hr,jb:vr,f:br,e:fr,yb:xr,zb:rr,Ab:Jt,Bb:yr,Db:Pr,Gb:kr}=Ue.instance.exports;ge=fr;const vn=(()=>{let Wr=0,Jr=0,dn=0,bs=0;return Nr=>{dn&&(Qe(bs),Qe(Wr),Jr+=dn,dn=Wr=0),Wr||(Jr+=128,Wr=xt(Jr));const hn=Nr.length+7&-8;let Gn=Wr;hn>=Jr&&(dn=hn,Gn=bs=xt(hn));for(let Ks=0;Ks{Gf=re,yM=void 0}))}()),J&&K.push(function(){if(Boe)return;const re=function(ie){let ge;const Se=WebAssembly.instantiateStreaming(ie,{}).then(Ue=>{ge=Ue.instance,ge.exports.__wasm_call_ctors()}),Ne={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Fe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Se,supported:!0,decodeGltfBuffer(Ue,Qe,xt,mt,wt,Ct){(function(Pt,Qt,Ft,nr,ur,hr,vr){const br=Pt.exports.sbrk,fr=nr+3&-4,xr=br(fr*ur),rr=br(hr.length),Jt=new Uint8Array(Pt.exports.memory.buffer);Jt.set(hr,rr);const yr=Qt(xr,nr,ur,rr,hr.length);if(yr===0&&vr&&vr(xr,fr,ur),Ft.set(Jt.subarray(xr,xr+nr*ur)),br(xr-br(0)),yr!==0)throw new Error(`Malformed buffer data: ${yr}`)})(ge,ge.exports[Fe[wt]],Ue,Qe,xt,mt,ge.exports[Ne[Ct]])}}}(fetch(N_e()));return re.ready.then(()=>{Boe=re})}()),S)for(let re=0;re{if(Z&&C)for(const{primitives:re}of C)for(const ie of re)GHe(ie,g);if(J&&C&&z)for(const re of z)KHe(re,g);return g})})}function I_e(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>E_e(c,0,f))}function Uoe(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 qoe(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 Voe{constructor(c,h,g,_){this.context=c,this.format=g,this.useMipmap=_&&_.useMipmap,this.texture=c.gl.createTexture(),this.update(h,{premultiply:_&&_.premultiply})}update(c,h){const g=c&&c instanceof HTMLVideoElement&&c.width===0?c.videoWidth:c.width,_=c&&c instanceof HTMLVideoElement&&c.height===0?c.videoHeight:c.height,{context:S}=this,{gl:C}=S,{x:L,y:z}=h&&h.position?h.position:{x:0,y:0},$=L+g,K=z+_;!this.size||this.size[0]===$&&this.size[1]===K||(C.bindTexture(C.TEXTURE_2D,null),C.deleteTexture(this.texture),this.texture=C.createTexture(),this.size=null),C.bindTexture(C.TEXTURE_2D,this.texture),S.pixelStoreUnpackFlipY.set(!1),S.pixelStoreUnpack.set(1),S.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA8&&(!h||h.premultiply!==!1));const Z=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&$>0&&K>0){const J=this.useMipmap?Math.floor(Math.log2(Math.max($,K)))+1:1;C.texStorage2D(C.TEXTURE_2D,J,this.format,$,K),this.size=[$,K]}this.size&&(Z?C.texSubImage2D(C.TEXTURE_2D,0,L,z,Uoe(this.format),qoe(this.format),c):"data"in c&&c.data&&C.texSubImage2D(C.TEXTURE_2D,0,L,z,g,_,Uoe(this.format),qoe(this.format),c.data)),this.useMipmap&&C.generateMipmap(C.TEXTURE_2D)}bind(c,h,g=!1){const{context:_}=this,{gl:S}=_;S.bindTexture(S.TEXTURE_2D,this.texture),c!==this.minFilter&&(S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MAG_FILTER,c),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_MIN_FILTER,this.useMipmap&&!g?c===S.NEAREST?S.NEAREST_MIPMAP_NEAREST:S.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),h!==this.wrapS&&(S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_S,h),S.texParameteri(S.TEXTURE_2D,S.TEXTURE_WRAP_T,h),this.wrapS=h)}bindExtraParam(c,h,g,_,S){const{context:C}=this,{gl:L}=C;L.bindTexture(L.TEXTURE_2D,this.texture),h!==this.magFilter&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,h),this.magFilter=h),c!==this.minFilter&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,this.useMipmap?c===L.NEAREST?L.NEAREST_MIPMAP_NEAREST:L.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),g!==this.wrapS&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,g),this.wrapS=g),_!==this.wrapT&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,_),this.wrapT=_),S!==this.compareMode&&(S?(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.COMPARE_REF_TO_TEXTURE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_FUNC,S)):L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.NONE),this.compareMode=S)}destroy(){const{gl:c}=this.context;c.deleteTexture(this.texture),this.texture=null}}class _M{constructor(c,h){this.context=c,this.texture=h}bind(c,h){const{context:g}=this,{gl:_}=g;_.bindTexture(_.TEXTURE_2D,this.texture),c!==this.minFilter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,c),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,c),this.minFilter=c),h!==this.wrapS&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,h),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,h),this.wrapS=h)}}const XHe=Bs([{name:"a_pos_3f",components:3,type:"Float32"}]),QHe=Bs([{name:"a_color_3f",components:3,type:"Float32"}]),JHe=Bs([{name:"a_color_4f",components:4,type:"Float32"}]),eWe=Bs([{name:"a_uv_2f",components:2,type:"Float32"}]),tWe=Bs([{name:"a_normal_3f",components:3,type:"Float32"}]),rWe=Bs([{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"}]),nWe=Bs([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function P_e(f,c){const h=W6(f.projection,f.zoom,f.width,f.height),g=function(S,C,L,z,$){const K=new p(L.lng-180*T0,L.lat),Z=new p(L.lng+180*T0,L.lat),J=S.project(K.lng,K.lat),re=S.project(Z.lng,Z.lat),ie=-Math.atan2(re.y-J.y,re.x-J.x),ge=We.fromLngLat(L);ge.y=ye(ge.y,-1+T0,1-T0);const Se=ge.toLngLat(),Ne=S.project(Se.lng,Se.lat),Fe=We.fromLngLat(Se);Fe.x+=T0;const Ue=Fe.toLngLat(),Qe=S.project(Ue.lng,Ue.lat),xt=O_e(Qe.x-Ne.x,Qe.y-Ne.y,ie),mt=We.fromLngLat(Se);mt.y+=T0;const wt=mt.toLngLat(),Ct=S.project(wt.lng,wt.lat),Pt=O_e(Ct.x-Ne.x,Ct.y-Ne.y,ie),Qt=Math.abs(xt.x)/Math.abs(Pt.y),Ft=M([]);V(Ft,Ft,-ie*(1-($?0:z)));const nr=M([]);return F(nr,nr,[1,1-(1-Qt)*z,1]),nr[4]=-Pt.x/Pt.y*z,V(nr,nr,ie),T(nr,Ft,nr),nr}(f.projection,0,f.center,h,c),_=L_e(f);return F(g,g,[_,_,1]),g}function L_e(f){const c=f.projection,h=W6(f.projection,f.zoom,f.width,f.height),g=Hoe(c,f.center),_=Hoe(c,p.convert(c.center));return Math.pow(2,g*h+(1-h)*_)}function W6(f,c,h,g,_=1/0){const S=f.range;if(!S)return 0;const C=Math.min(_,Math.max(h,g)),L=Math.log2(C/1024);return Pe(S[0]+L,S[1]+L,c)}const T0=1/4e4;function Hoe(f,c){const h=ye(c.lat,-he,he),g=new p(c.lng-180*T0,h),_=new p(c.lng+180*T0,h),S=f.project(g.lng,h),C=f.project(_.lng,h),L=We.fromLngLat(g),z=We.fromLngLat(_),$=C.x-S.x,K=C.y-S.y,Z=z.x-L.x,J=z.y-L.y,re=Math.sqrt((Z*Z+J*J)/($*$+K*K));return Math.log2(re)}function O_e(f,c,h){const g=Math.cos(h),_=Math.sin(h);return{x:f*g-c*_,y:f*_+c*g}}function D_e(f,c,h){M(f),V(f,f,qn(c[2])),D(f,f,qn(c[0])),U(f,f,qn(c[1])),F(f,f,h),T(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function G6(f,c,h,g,_,S,C,L){const z=[h[0]-c[0],h[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(fe(z)<1e-12||fe($)<1e-12)return ct(f);const K=Tt([],z,$);Ve(K,K),xe($,g,c),z[2]=(S-_)*L,$[2]=(C-_)*L;const Z=z;return Tt(Z,z,$),Ve(Z,Z),Zr(f,K,Z)}function K6(f,c,h=!1){const g=C0(c.zoom),_=function(S,C,L){const z=C.worldSize,$=[S[12],S[13],S[14]],K=de($[1]/z),Z=te($[0]/z),J=M([]),re=X(1,K)*z,ie=X(1,0)*z*be(K,C.zoom),ge=1/_oe(z);let Se=ie*ge;if(L){const Qe=W6(C.projection,C.zoom,C.width,C.height,1024);Se=ge*C.projection.pixelSpaceConversion(C.center.lat,z,Qe)}const Ne=k0(K,Z);ue(Ne,Ne,ve([],Ve([],Ne),re*Se*$[2]));const Fe=function(Qe){const xt=[Qe[0],Qe[1],Qe[2]];let mt=[0,1,0];const wt=Tt([],mt,xt);return Tt(mt,xt,wt),$e(mt)===0&&(mt=[0,1,0],Tt(wt,xt,mt)),Ve(wt,wt),Ve(mt,mt),Ve(xt,xt),[wt[0],wt[1],wt[2],0,mt[0],mt[1],mt[2],0,xt[0],xt[1],xt[2],0,Qe[0],Qe[1],Qe[2],1]}(Ne);F(J,J,[Se,Se,Se*re]),P(J,J,[-$[0],-$[1],-$[2]]);const Ue=T([],C.globeMatrix,Fe);return T(Ue,Ue,J),T(Ue,Ue,S),Ue}(f,c,h);if(g>0){const S=function(C,L){const z=L.worldSize,$=X(1,0)*z*be(L.center.lat,L.zoom)/_oe(z),K=X(1,L.center.lat)*z,Z=M([]);U(Z,Z,qn(L.center.lng)),D(Z,Z,qn(L.center.lat)),P(Z,Z,[0,0,Pc]),F(Z,Z,[$,$,$*K]);const J=L.point;return P(Z,Z,[-J.x,-J.y,0]),T(Z,Z,C),T(Z,L.globeMatrix,Z)}(f,c);return function(C,L,z){const $=(ie,ge,Se)=>{const Ne=fe(ie),Fe=fe(ge),Ue=Wf(ie,ge,Se);return ve(Ue,Ue,1/fe(Ue)*zn(Ne,Fe,Se))},K=$([C[0],C[1],C[2]],[L[0],L[1],L[2]],z),Z=$([C[4],C[5],C[6]],[L[4],L[5],L[6]],z),J=$([C[8],C[9],C[10]],[L[8],L[9],L[10]],z),re=Wf([C[12],C[13],C[14]],[L[12],L[13],L[14]],z);return[K[0],K[1],K[2],0,Z[0],Z[1],Z[2],0,J[0],J[1],J[2],0,re[0],re[1],re[2],1]}(_,S,g)}return _}function Woe(f,c,h,g){const _=xn.projectAabbCorners(g,h);let S=Number.MAX_VALUE;for(let L=0;L<_.length;++L){const z=_[L];z[0]=(.5*z[0]+.5)*c.width,z[1]=(.5-.5*z[1])*c.height,z[2]0||Se===0&&ie[0]*ge[0]+ie[1]*ge[1]>=0&&ie[0]*ie[0]+ie[1]*ie[1]>ge[0]*ge[0]+ge[1]*ge[1])&&(K=re)}Z=K}while(Z!==$);return z.length>0&&z.push(z[0]),z}(_);if(ha(f,C))return S}const v_=64,rS={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Z6(f,c,h,g,_,S,C,L,z,$=!1){const K=h.zoom,Z=h.project(g),J=be(g.lat,K),re=1/J;M(f),P(f,f,[Z.x+C[0]*re,Z.y+C[1]*re,C[2]]);let ie=1,ge=1;const Se=h.worldSize;if($){if(h.projection.name==="mercator"){let Qe=0;h.elevation&&(Qe=h.elevation.getAtPointOrZero(new We(Z.x/Se,Z.y/Se),0));const xt=Ke([],[Z.x,Z.y,Qe,1],h.projMatrix)[3]/h.cameraToCenterDistance;ie=xt,ge=xt*be(h.center.lat,K)}else if(h.projection.name==="globe"){const Qe=K6(f,h),xt=[0,0,0,1];Ke(xt,xt,T([],h.projMatrix,Qe));const mt=xt[3]/h.cameraToCenterDistance,wt=C0(K),Ct=h.projection.pixelsPerMeter(g.lat,Se)*be(g.lat,K),Pt=h.projection.pixelsPerMeter(h.center.lat,Se)*be(h.center.lat,K);ie=mt/zn(Ct,ke(h.center.lat),wt),ge=mt*J/Ct,ie*=Pt,ge*=Pt}}else ie=re;F(f,f,[ie,ie,ge]);const Ne=[...f],Fe=c.orientation,Ue=[];if(D_e(Ue,[Fe[0]+(_?_[0]:0),Fe[1]+(_?_[1]:0),Fe[2]+(_?_[2]:0)],S),T(f,Ne,Ue),L&&h.elevation){let Qe=0;const xt=[];if(z&&h.elevation){Qe=function(wt,Ct,Pt,Qt,Ft){const nr=Ct.elevation;if(!nr)return 0;const ur=xn.projectAabbCorners(Pt,Qt),hr=X(1,Ft.lat)*Ct.worldSize,vr=function(Jr,dn){const bs=[0,0,1],Nr=[{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 hn of Nr){const Gn=Jr[hn.corners[0]],Ks=Jr[hn.corners[1]],Js=Jr[hn.corners[2]],cs=[Ks[0]-Gn[0],Ks[1]-Gn[1],dn*(Ks[2]-Gn[2])],Ga=Tt(cs,cs,[Js[0]-Gn[0],Js[1]-Gn[1],dn*(Js[2]-Gn[2])]);Ve(Ga,Ga),hn.dotProductWithUp=ot(Ga,bs)}return Nr.sort((hn,Gn)=>hn.dotProductWithUp-Gn.dotProductWithUp),Nr[0].corners}(ur,hr),br=ur[vr[0]],fr=ur[vr[1]],xr=ur[vr[2]],rr=ur[vr[3]],Jt=nr.getAtPointOrZero(new We(br[0]/Ct.worldSize,br[1]/Ct.worldSize),0),yr=nr.getAtPointOrZero(new We(fr[0]/Ct.worldSize,fr[1]/Ct.worldSize),0),Pr=nr.getAtPointOrZero(new We(xr[0]/Ct.worldSize,xr[1]/Ct.worldSize),0),kr=nr.getAtPointOrZero(new We(rr[0]/Ct.worldSize,rr[1]/Ct.worldSize),0),vn=(Jt+kr)/2,Wr=(yr+Pr)/2;return vn>Wr?yr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function sWe(f,c,h){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,XHe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,tWe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,eWe.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?QHe:JHe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,nWe.members,!0)),f.segments=Ui.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&bM(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&bM(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&bM(g.normalTexture,c),g.occlusionTexture&&bM(g.occlusionTexture,c,h),g.emissionTexture&&bM(g.emissionTexture,c)}function Goe(f,c,h){if(f.meshes)for(const g of f.meshes)sWe(g,c,h);if(f.children)for(const g of f.children)Goe(g,c,h)}function Y6(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)Y6(c)}function Koe(f){if(f.meshes)for(const h of f.meshes)h.vertexBuffer&&(h.vertexBuffer.destroy(),h.indexBuffer.destroy(),h.normalBuffer&&h.normalBuffer.destroy(),h.texcoordBuffer&&h.texcoordBuffer.destroy(),h.colorBuffer&&h.colorBuffer.destroy(),h.pbrBuffer&&h.pbrBuffer.destroy(),h.segments.destroy(),h.material&&((c=h.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 h of f.children)Koe(h)}function __(f,c){const h=f.json.bufferViews[c.bufferView],g=V6[c.componentType];return new g(f.buffers[h.buffer],(c.byteOffset||0)+(h.byteOffset||0),c.count*(h.byteStride&&h.byteStride!==vM[c.type]*g.BYTES_PER_ELEMENT?h.byteStride/g.BYTES_PER_ELEMENT:vM[c.type]))}function Zoe(f,c,h,g){const _=V6[c.componentType],S=function(K){switch(K){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(_),C=f.json.bufferViews[c.bufferView],L=C.byteStride?C.byteStride/_.BYTES_PER_ELEMENT:vM[c.type],z=h.float32,$=z.length/h.capacity;for(let K=0,Z=0;K0){for(let Se=0;Se0){S.texcoordArray=new zm;const J=c.json.accessors[_.TEXCOORD_0];S.texcoordArray.resize(J.count);const re=__(c,J);Zoe(c,J,S.texcoordArray,re)}if(_._FEATURE_ID_RGBA4444!==void 0){const J=c.json.accessors[_._FEATURE_ID_RGBA4444];c.json.extensionsUsed&&c.json.extensionsUsed.includes("EXT_meshopt_compression")&&(S.featureData=__(c,J))}_._FEATURE_RGBA4444!==void 0&&(S.featureData=new Uint32Array(__(c,c.json.accessors[_._FEATURE_RGBA4444]).buffer));const Z=f.material;return S.material=function(J,re){const{emissiveFactor:ie=[0,0,0],alphaMode:ge="OPAQUE",alphaCutoff:Se=.5,normalTexture:Ne,occlusionTexture:Fe,emissiveTexture:Ue,doubleSided:Qe,name:xt}=J,{baseColorFactor:mt=[1,1,1,1],metallicFactor:wt=1,roughnessFactor:Ct=1,baseColorTexture:Pt,metallicRoughnessTexture:Qt}=J.pbrMetallicRoughness||{},Ft=Fe?re[Fe.index]:void 0;if(Fe&&Fe.extensions&&Fe.extensions.KHR_texture_transform&&Ft){const nr=Fe.extensions.KHR_texture_transform;Ft.offsetScale=[nr.offset[0],nr.offset[1],nr.scale[0],nr.scale[1]]}return{name:xt,pbrMetallicRoughness:{baseColorFactor:new ja(...mt),metallicFactor:wt,roughnessFactor:Ct,baseColorTexture:Pt?re[Pt.index]:void 0,metallicRoughnessTexture:Qt?re[Qt.index]:void 0},doubleSided:Qe,emissiveFactor:new ja(...ie),alphaMode:ge,alphaCutoff:Se,normalTexture:Ne?re[Ne.index]:void 0,occlusionTexture:Ft,emissionTexture:Ue?re[Ue.index]:void 0,defined:J.defined===void 0}}(Z!==void 0?c.json.materials[Z]:{defined:!1},h),S}function F_e(f,c,h){const{matrix:g,rotation:_,translation:S,scale:C,mesh:L,extras:z,children:$,name:K}=f,Z={};if(Z.name=K,Z.localMatrix=g||function(J,re,ie,ge){var Se=re[0],Ne=re[1],Fe=re[2],Ue=re[3],Qe=Se+Se,xt=Ne+Ne,mt=Fe+Fe,wt=Se*Qe,Ct=Se*xt,Pt=Se*mt,Qt=Ne*xt,Ft=Ne*mt,nr=Fe*mt,ur=Ue*Qe,hr=Ue*xt,vr=Ue*mt,br=ge[0],fr=ge[1],xr=ge[2];return J[0]=(1-(Qt+nr))*br,J[1]=(Ct+vr)*br,J[2]=(Pt-hr)*br,J[3]=0,J[4]=(Ct-vr)*fr,J[5]=(1-(wt+nr))*fr,J[6]=(Ft+ur)*fr,J[7]=0,J[8]=(Pt+hr)*xr,J[9]=(Ft-ur)*xr,J[10]=(1-(wt+Qt))*xr,J[11]=0,J[12]=ie[0],J[13]=ie[1],J[14]=ie[2],J[15]=1,J}([],_||[0,0,0,1],S||[0,0,0],C||[1,1,1]),Z.globalMatrix=k(Z.localMatrix),L!==void 0){Z.meshes=h[L];const J=Z.anchor=[0,0];for(const re of Z.meshes){const{min:ie,max:ge}=re.aabb;J[0]+=ie[0]+ge[0],J[1]+=ie[1]+ge[1]}J[0]=Math.floor(J[0]/Z.meshes.length/2),J[1]=Math.floor(J[1]/Z.meshes.length/2)}if(z&&(z.id&&(Z.id=z.id),z.lights&&(Z.lights=function(J){if(!J.length)return[];const re=function(Fe){const Ue=atob(Fe),Qe=new Uint8Array(Ue.length);for(let xt=0;xt1&&g[g.length-1].equals(g[0])&&g.pop();let _=0;for(let C=0;C0&&g.reverse();const S=YN(g.flatMap(C=>[C.x,C.y]),[]);return S.length===0?null:{vertices:g,indices:S}}function lWe(f,c){const h=[],g=[];let _=0;const S=[];for(const C of f){_=h.length;const L=C.vertexArray.float32,z=C.indexArray.uint16;for(let $=0;$0&&([g[C+1],g[C+2]]=[g[C+2],g[C+1]])}return{vertices:h,indices:g}}function Yoe(f){const c=function(z,$){const K=[],Z=WebGL2RenderingContext;if(z.json.textures)for(const J of z.json.textures){const re={magFilter:Z.LINEAR,minFilter:Z.NEAREST,wrapS:Z.REPEAT,wrapT:Z.REPEAT};J.sampler!==void 0&&Object.assign(re,z.json.samplers[J.sampler]),K.push({image:$[J.source],sampler:re,uploaded:!1})}return K}(f,f.images),h=function(z,$){const K=[];for(const Z of z.json.meshes){const J=[];for(const re of Z.primitives)J.push(aWe(re,z,$));K.push(J)}return K}(f,c),{scenes:g,scene:_,nodes:S}=f.json,C=g?g[_||0].nodes:[...S.keys()],L=[];for(const z of C)L.push(F_e(S[z],f,h));return function(z,$,K){const Z={},J=new Set;for(let re=0;re0){const re=Array.from(J.values()).sort((ie,ge)=>ie-ge);for(let ie=re.length-1;ie>=0;ie--)z.splice(re[ie],1)}}(L,C,f.json.nodes),L}function cWe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const c=f.vertexArray.float32,h=f.aabb.min[0]-1,g=f.aabb.min[1]-1,_=v_/(f.aabb.max[0]-h+2),S=v_/(f.aabb.max[1]-g+2);for(let C=0;Cf.heightmap[$*v_+z]&&(f.heightmap[$*v_+z]=L)}}function z_e(f,c,h,g,_){h.reserve(h.length+4*f.length),g.reserve(g.length+10*f.length),_.reserve(_.length+10*f.length);let S=g.length;for(const C of f){const L=Math.min(10,Math.max(4,1.3*C.height))*c,z=[-C.normal[1],C.normal[0],0],$=Math.min(.29,.1*C.width/C.depth),K=C.width-2*C.depth*c*($+.01),Z=Xe([],C.pos,z,K/2),J=Xe([],C.pos,z,-K/2),re=[Z[0],Z[1],Z[2]+C.height],ie=[J[0],J[1],J[2]+C.height],ge=Xe([],C.normal,z,$);ve(ge,ge,L);const Se=Xe([],C.normal,z,-$);ve(Se,Se,L),ue(ge,Z,ge),ue(Se,J,Se),Z[2]+=.1,J[2]+=.1,g.emplaceBack(ge[0],ge[1],ge[2]),g.emplaceBack(Se[0],Se[1],Se[2]),g.emplaceBack(Z[0],Z[1],Z[2]),g.emplaceBack(J[0],J[1],J[2]),g.emplaceBack(re[0],re[1],re[2]),g.emplaceBack(ie[0],ie[1],ie[2]),g.emplaceBack(Z[0],Z[1],Z[2]),g.emplaceBack(J[0],J[1],J[2]),g.emplaceBack(ge[0],ge[1],ge[2]),g.emplaceBack(Se[0],Se[1],Se[2]);const Ne=K/L/2;_.emplaceBack(-Ne-$,-1,Ne,.8),_.emplaceBack(Ne+$,-1,Ne,.8),_.emplaceBack(-Ne,0,Ne,1.3),_.emplaceBack(Ne,0,Ne,1.3),_.emplaceBack(Ne+$,-.8,Ne,.7),_.emplaceBack(Ne+$,-.8,Ne,.7),_.emplaceBack(0,0,Ne,1.3),_.emplaceBack(0,0,Ne,1.3),_.emplaceBack(Ne+$,-1.2,Ne,.8),_.emplaceBack(Ne+$,-1.2,Ne,.8),h.emplaceBack(6+S,4+S,8+S),h.emplaceBack(7+S,9+S,5+S),h.emplaceBack(0+S,1+S,2+S),h.emplaceBack(1+S,3+S,2+S),S+=10}}function dWe(f,c){const h={};h.indexArray=new Qo,h.vertexArray=new Ou,h.colorArray=new og,z_e(f,c,h.indexArray,h.vertexArray,h.colorArray);const g={defined:!0};g.emissiveFactor=ja.black;const _={};return _.baseColorFactor=ja.white,g.pbrMetallicRoughness=_,h.material=g,h.aabb=new xn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),h}const B_e=Bs([{name:"a_pos_3f",components:3,type:"Float32"}]),uWe=Bs([{name:"a_normal_3",components:3,type:"Int16"}]),hWe=Bs([{name:"a_centroid_3",components:3,type:"Int16"}]),$_e=Bs([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),mWe=Bs([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),fWe=Bs([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),pWe=Bs([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),gWe=Bs([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),xWe=Bs([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),U_e=Dt.types,X6=32767;function yWe(f,c){const h=Ir+c;for(const g of f)for(const _ of g)if(_.x<-c||_.x>h||_.y<-c||_.y>h)return!1;return!0}function vWe(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 Xoe{constructor(){this.layoutVertexArray=new Ou,this.layoutAttenuationArray=new og,this.layoutColorArray=new Du,this.indexArray=new Qo,this.indexArrayForConflation=new Qo,this.segmentsBucket=new Ui}}class Qoe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Ui,this.entranceBloom=new Xoe;const h=66560;this.layoutVertexArray=new Ou,this.layoutVertexArray.reserve(h),this.layoutNormalArray=new y0,this.layoutNormalArray.reserve(h),this.layoutCentroidArray=new y0,this.layoutCentroidArray.reserve(h),this.layoutColorArray=new Du,this.layoutColorArray.reserve(h),this.layoutFloodLightDataArray=new lg,this.layoutFloodLightDataArray.reserve(h),this.layoutAOArray=new FN,this.layoutAOArray.reserve(h),this.indexArray=new Qo,this.indexArray.reserve(66560),this.indexArrayForConflation=new Qo,this.segmentsBucket=new Ui,this.entranceBloom=new Xoe,c&&(this.layoutFacadePaintArray=new Du,this.layoutFacadeDataArray=new Sx,this.layoutFacadeVerticalRangeArray=new Du)}reserve(c,h,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(h),g&&(this.layoutFacadePaintArray.reserveForAdditional(c),this.layoutFacadeDataArray.reserveForAdditional(c),this.layoutFacadeVerticalRangeArray.reserveForAdditional(c))}}class q_e{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new zm,this.footprintsIndices=new lg,this.footprintsMin=new ir(1/0,1/0),this.footprintsMax=new ir(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Qoe(!1),this.buildingWithFacade=new Qoe(!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(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.worldview=c.worldview,this.lut=c.lut,this.programConfigurations=new Yh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.projection=c.projection,this.groundEffect=new Loe(c),this.groundEffect.groundRadiusArray=new zf,this.hasAppearances=null}updateFootprints(c,h){const g=new D6([],[],1),_={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};h.push({footprint:_,id:c})}updateAppearances(c,h,g,_){}prepare(){return function(){if(q6!=null||j_e!=null)return null;if(tS!=null)return tS;const c=fetch(Is.BUILDING_GEN_URL);return tS=function(h){let g,_,S,C,L;function z(){g=new Uint8Array(L.buffer),_=new Int16Array(L.buffer),S=new Int32Array(L.buffer),C=new Float32Array(L.buffer)}function $(){throw new Error("Unexpected BuildingGen error.")}const K=()=>{},Z={a:{a:$,f:function(J){const re=g.length,ie=Math.max(J>>>0,Math.ceil(1.2*re)),ge=Math.ceil((ie-re)/65536);try{return L.grow(ge),z(),!0}catch{return!1}},g:$,b:K,c:K,d:K,e:K}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(h,Z):h.then(J=>J.arrayBuffer()).then(J=>WebAssembly.instantiate(J,Z))).then(J=>{const re=J.instance.exports;return(0,re.g)(),L=re.f,z(),new VHe({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:_,heap32:S,heapF32:C})})}(c).then(h=>(tS=null,q6=h,q6)).catch(h=>{Kr("Could not load building-gen"),tS=null,j_e=h}),tS}()}populate(c,h,g,_){const S=HHe();if(!S)return;const C=De(g);this.tileToMeter=C,this.brightness=h.brightness,S.setStyle({normalScale:[1,-1,C],tileToMeters:C}),S.setAOOptions(!1,.3),S.setMetricOptions(!1,16),S.setStructuralOptions(!0),S.setFacadeClassifierOptions(3);const L=new Map,z=new Map;let $=0;for(const{feature:Ne}of c){if(U_e[Ne.type]!=="LineString"){L.set(Ne.id,Ne.properties.source_id);continue}const Fe=this.layers[0]._featureFilter.needGeometry;if(Fe&&!this.layers[0]._featureFilter.filter(new li(this.zoom),Ne,g))continue;const Ue=Rt(Ne,Fe);if(!Fe&&!this.layers[0]._featureFilter.filter(new li(this.zoom),Ue,g))continue;const Qe=Fe?Ue.geometry:St(Ne,g,_),xt=[];for(const Pt of Qe)for(const Qt of Pt)xt.push(Qt.x),xt.push(Qt.y);const mt={coordinates:xt,crossPerc:Ne.properties.cross_perc,distanceToRoad:Ne.properties.distance_to_road,entrances:Ne.properties.entrances,sourceId:0},wt=Ne.properties.source_id;let Ct=z.get(wt);Ct||(Ct=[],z.set(wt,Ct)),Ct.push(mt),++$}this.maxHeight=0;const K=new Array,Z=new Set,J=Ne=>{Ne!=null&&Z.add(Ne)},re=(Ne,Fe)=>{Ne!=null&&K.push({buildingId:Ne,footprintIndex:Fe})},ie=64*(c.length-$),ge=ie/2;this.buildingWithFacade.reserve(ie,ge,!0),this.buildingWithoutFacade.reserve(2*ie,2*ge,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:Ne,id:Fe,index:Ue,sourceLayerIndex:Qe}of c){if(U_e[Ne.type]==="LineString")continue;const xt=this.layers[0]._featureFilter.needGeometry;if(xt&&!this.layers[0]._featureFilter.filter(new li(this.zoom),Ne,g))continue;let mt=null;if(Ne.properties&&Ne.properties.hasOwnProperty("building_id")&&(mt=Ne.properties.building_id,Z.has(mt)))continue;const wt=Rt(Ne,xt);if(!xt&&!this.layers[0]._featureFilter.filter(new li(this.zoom),wt,g))continue;const Ct=xt?wt.geometry:St(Ne,g,_),Pt=dM(Ct,500);let Qt=!1;for(const Ln of Pt)if(Ln.length!==1){Qt=!0;break}if(Qt){J(mt);continue}if(!yWe(Ct,163)){J(mt);continue}const Ft=this.layers[0],nr=vWe(Ft.layout.get("building-roof-shape").evaluate(Ne,{},g)),ur=Ft.layout.get("building-base").evaluate(Ne,{},g),hr=Ft.layout.get("building-height").evaluate(Ne,{},g),vr=Ft.layout.get("building-flood-light-ground-radius").evaluate(Ne,{},g),br=Ft.paint.get("building-ambient-occlusion-intensity"),fr=vr/this.tileToMeter;Ne.properties["building-part"]="roof";const xr=Ft.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),rr=Ft.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="wall";const Jt=Ft.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),yr=Ft.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="window";const Pr=Ft.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),kr=Ft.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="door";const vn=Ft.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),Wr=Ft.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);let Jr=Ft.layout.get("building-flood-light-wall-radius").evaluate(Ne,{},g);Jr=ye(Jr,0,2048);const dn=Jr/2048*X6,bs=L.get(Fe),Nr=z.get(bs)||[],hn=Nr.length!==0&&Ft.layout.get("building-facade").evaluate(Ne,{},g);S.setFacadeOptions(4,!0),S.setFauxFacadeOptions(hn,!1,1);let Gn=0,Ks=0,Js=0,cs=0,Ga=0,ft=0,vt=0,sr=0,_r=0,Ur=0,qr=0;if(hn){let Ln=Math.round(Ft.layout.get("building-facade-floors").evaluate(Ne,{},g));if(ur===0){Ln=Math.max(1,Ln-(Nr.length>0?1:0));let Fa=4;if(hr>100){const Si=[10,13,15];Fa=Si[Ne.id?Ne.id%Si.length:0]}else hr<=10&&(Fa=3);S.setFacadeOptions(Fa,!0),Ga=(hr<15?1.3:1.61803)*Fa/C}else Ga=ur/C;ft=hr/C,Ga=Math.min(Ga,ft),Js=Ft.layout.get("building-facade-unit-width").evaluate(Ne,{},g)/C,cs=(ft-Ga)/Ln,S.setFauxFacadeOptions(!0,!0,Js);const Hi=Ft.layout.get("building-facade-window").evaluate(Ne,{},g);Gn=Hi[0],Ks=Hi[1],vt=Math.floor(65535*Math.min(1,Ga/Ir)),sr=Math.floor(65535*Math.min(1,ft/Ir)),_r=Math.floor(255*Gn)<<8|Math.floor(255*Ks),Ur=Math.floor(65535*Math.min(1,Js/Ir)),qr=Math.floor(65535*Math.min(1,cs/Ir))}const bn=Array(Pt.length),kn={x:1/0,y:1/0},as={x:-1/0,y:-1/0},gs={x:0,y:0};let _s=0;for(let Ln=0;Ln0){const Fa=[],Si=Array(Hi.length+1);Si[0]=0;for(let tl=0;tlIr||kn.y<0||as.y>Ir)&&this.featuresOnBorder.push({featureId:Ne.id,footprintIndex:this.footprints.length});{const Ln=YN(Ya,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Ln.length),this.footprintsIndices.uint16.set(Ln,Pn),this.buildingIds.add(mt??Ne.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,si.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,si.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ci.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ci.y);const Hi={footprintVertexOffset:Us,footprintVertexLength:this.footprintsVertices.length-Us,footprintIndexOffset:Pn,footprintIndexLength:this.footprintsIndices.length-Pn,min:si,max:ci,hiddenFlags:0,indicesOffset:Aa,indicesLength:Ri,bloomIndicesOffset:Ra,bloomIndicesLength:ti,groundEffectVertexOffset:yo,groundEffectVertexLength:ai,hasFauxFacade:hn,height:xs,promoteId:Fe,feature:wt,parts:pa,buildingBloom:ga},Fa=this.footprints.length;Ne.id!==void 0&&this.featureFootprintLookup.set(Ne.id,Fa),re(mt,Fa),this.footprints.push(Hi)}this.programConfigurations.populatePaintArrays(On.layoutVertexArray.length,Ne,Ue,{},h.availableImages,g,h.brightness),this.groundEffect.addPaintPropertiesData(Ne,Ue,{},h.availableImages,g,h.brightness),h.featureIndex.insert(Ne,Ct,Ue,Qe,this.index,Ka)}K.forEach(({buildingId:Ne,footprintIndex:Fe})=>{Z.has(Ne)&&(this.footprints[Fe].hiddenFlags|=4)});const Se=new Set;this.buildingIds.forEach((Ne,Fe,Ue)=>{Z.has(Ne)||Se.add(Ne)}),this.buildingIds=Se,this.groundEffect.prepareBorderSegments()}update(c,h,g,_,S,C,L){this.programConfigurations.updatePaintArrays(c,h,S,g,_,C,L),this.groundEffect.update(c,h,S,g,_,C,L),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 h=g=>{g.layoutVertexBuffer=c.createVertexBuffer(g.layoutVertexArray,B_e.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,uWe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,hWe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,xWe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,fWe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,pWe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,B_e.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,gWe.members)),this.uploadUpdatedColorBuffer(c),this.uploadUpdatedIndexBuffer(c)};this.uploaded||(h(this.buildingWithoutFacade),h(this.buildingWithFacade),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){const c=h=>{h.layoutVertexBuffer&&(h.layoutVertexBuffer.destroy(),h.layoutNormalBuffer.destroy(),h.layoutColorBuffer.destroy(),h.segmentsBucket.destroy(),h.indexBuffer&&h.indexBuffer.destroy(),h.entranceBloom.layoutVertexBuffer&&(h.entranceBloom.layoutVertexBuffer.destroy(),h.entranceBloom.layoutColorBuffer.destroy(),h.entranceBloom.layoutAttenuationBuffer.destroy(),h.entranceBloom.indexBuffer.destroy(),h.entranceBloom.segmentsBucket.destroy()))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(c,h,g=!0){let _=!1;const S=g?h:0,C=0|(g?-1:~h);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const L of c){const z=this.footprints[L],$=z.hiddenFlags&C|S;z.hiddenFlags!==$&&(z.hiddenFlags=$,_=!0,this.groundEffect.updateHiddenByLandmarkRange(z.groundEffectVertexOffset,z.groundEffectVertexLength,z.hiddenFlags!==0))}return _&&(this.indexArrayForConflationUploaded=!1),_}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const h=_=>{_.indexArray.length!==0&&(_.indexArrayForConflation.resize(_.indexArray.length),_.indexArrayForConflation.uint16.set(_.indexArray.uint16),_.entranceBloom.indexArrayForConflation.resize(_.entranceBloom.indexArray.length),_.entranceBloom.indexArrayForConflation.uint16.set(_.entranceBloom.indexArray.uint16))};h(this.buildingWithoutFacade),h(this.buildingWithFacade);for(const _ of this.footprints){const S=_.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,C=_.indicesOffset+_.indicesLength;if(_.hiddenFlags!==0){for(let z=_.indicesOffset;z{_.indexArray.length!==0&&(_.indexBuffer?_.indexBuffer.updateData(_.indexArrayForConflation):_.indexBuffer=c.createIndexBuffer(_.indexArrayForConflation,!0),_.entranceBloom.indexBuffer?_.entranceBloom.indexBuffer.updateData(_.entranceBloom.indexArrayForConflation):_.entranceBloom.indexBuffer=c.createIndexBuffer(_.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(c){const h=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=c.createVertexBuffer(g.layoutColorArray,$_e.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,mWe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,$_e.members,!0)};h(this.buildingWithoutFacade),h(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,h){const g=c.paint.get("building-ambient-occlusion-intensity");for(const _ of this.footprints){if(4&_.hiddenFlags)continue;const S=h[_.promoteId],C=_.feature;C.properties["building-part"]="roof";const L=c.paint.get("building-color").evaluate(C,S,this.canonical).toPremultipliedRenderColor(this.lut),z=c.paint.get("building-emissive-strength").evaluate(C,S,this.canonical);C.properties["building-part"]="wall";const $=c.paint.get("building-color").evaluate(C,S,this.canonical).toPremultipliedRenderColor(this.lut),K=c.paint.get("building-emissive-strength").evaluate(C,S,this.canonical);C.properties["building-part"]="window";const Z=c.paint.get("building-color").evaluate(C,S,this.canonical).toPremultipliedRenderColor(this.lut),J=c.paint.get("building-emissive-strength").evaluate(C,S,this.canonical);C.properties["building-part"]="door";const re=c.paint.get("building-color").evaluate(C,S,this.canonical).toPremultipliedRenderColor(this.lut),ie=c.paint.get("building-emissive-strength").evaluate(C,S,this.canonical),ge=_.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const Ne of _.parts){let Fe,Ue=L;Ne.part===1?(Ue=L,Fe=z):Ne.part===0?(Ue=$,Fe=K):Ne.part===2?(Ue=Z,Fe=J):Ne.part===3&&(Ue=re,Fe=ie),Fe=ye(Fe,0,1);for(let Qe=0;QeC.max.x||z.max.xC.max.y||z.max.yL.max.x||L.min.x>c||h>L.max.y||L.min.y>h||L.height<=g||_We(C,this.footprintsVertices.float32.subarray(2*L.footprintVertexOffset,2*(L.footprintVertexOffset+L.footprintVertexLength)),this.footprintsIndices.uint16.subarray(L.footprintIndexOffset,L.footprintIndexOffset+L.footprintIndexLength))&&(g=L.height,this.footprintLookup[S]=L,_=L.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:_};this.footprintLookup[S]=void 0}}function _We(f,c,h){for(let g=0;g1&&(z=c[++L]);const K=Math.abs($-z.left),Z=Math.abs($-z.right),J=Math.min(K,Z);let re;const ie=S/g*(_+1);if(z.isDash){const ge=_-Math.abs(ie);re=Math.sqrt(J*J+ge*ge)}else re=_-Math.sqrt(J*J+ie*ie);this.image.data[C+$]=Math.max(0,Math.min(255,re+128))}}}addRegularDash(c,h){for(let z=c.length-1;z>=0;--z){const $=c[z],K=c[z+1];$.zeroLength?c.splice(z,1):K&&K.isDash===$.isDash&&(K.left=$.left,c.splice(z,1))}const g=c[0],_=c[c.length-1];g.isDash===_.isDash&&(g.left=_.left-this.width,_.right=g.right+this.width);const S=this.width*this.nextRow;let C=0,L=c[C];for(let z=0;z1&&(L=c[++C]);const $=Math.abs(z-L.left),K=Math.abs(z-L.right),Z=Math.min($,K);this.image.data[S+z]=Math.max(0,Math.min(255,(L.isDash?Z:-Z)+h+128))}}addDash(c,h){const g=this.getKey(c,h);if(this.positions[g])return this.positions[g];const _=h==="round",S=_?7:0,C=2*S+1;if(this.nextRow+C>this.height)return Kr("LineAtlas out of space"),null;c.length===0&&c.push(1);let L=0;for(let K=0;Kh.fqid),this.index=c.index,this.projection=c.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new EN,this.layoutVertexArray2=new Ou,this.patternVertexArray=new Ou,this.indexArray=new Qo,this.programConfigurations=new Yh(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Ui,this.maxLineLength=0,this.zOffsetVertexArray=new Ou,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Ir/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,_){}populate(c,h,g,_){this.hasPattern=Noe("line",this.layers,this.pixelRatio,h);const S=this.layers[0].layout.get("line-sort-key");this.tileToMeter=De(g);const C=this.layers[0].layout.get("line-elevation-reference");if(C==="hd-road-markup")this.elevationType="road";else{const J=this.layers[0].layout.get("line-z-offset"),re=J.isConstant()&&!J.constantOr(0);this.elevationType=C!=="sea"&&C!=="ground"&&re?"none":"offset",this.elevationType==="offset"&&C==="none"&&Kr(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const L=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&L!==void 0;const z=[];for(const{feature:J,id:re,index:ie,sourceLayerIndex:ge}of c){const Se=this.layers[0]._featureFilter.needGeometry,Ne=Rt(J,Se);if(!this.layers[0]._featureFilter.filter(new li(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Ne,g))continue;const Fe=S?S.evaluate(Ne,{},g):void 0,Ue={id:re,properties:J.properties,type:J.type,sourceLayerIndex:ge,index:ie,geometry:Se?Ne.geometry:St(J,g,_),patterns:{},sortKey:Fe};z.push(Ue)}S&&z.sort((J,re)=>J.sortKey-re.sortKey);const{lineAtlas:$,featureIndex:K}=h,Z=this.addConstantDashes($);for(const J of z){const{geometry:re,index:ie,sourceLayerIndex:ge}=J;if(Z&&this.addFeatureDashes(J,$),this.hasPattern){const Se=Soe("line",this.layers,J,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Se)}else this.addFeature(J,re,ie,g,$.positions,h.availableImages,h.brightness,h.elevationFeatures);K.insert(c[ie].feature,re,ie,ge,this.index)}}addConstantDashes(c){let h=!1;for(const g of this.layers){const _=g.paint.get("line-dasharray").value,S=g.layout.get("line-cap").value;if(_.kind!=="constant"||S.kind!=="constant")h=!0;else{const C=S.value,L=_.value;if(!L)continue;c.addDash(L,C)}}return h}addFeatureDashes(c,h){const g=this.zoom;for(const _ of this.layers){const S=_.paint.get("line-dasharray").value,C=_.layout.get("line-cap").value;if(S.kind==="constant"&&C.kind==="constant")continue;let L,z;if(S.kind==="constant"){if(L=S.value,!L)continue}else L=S.evaluate({zoom:g},c);z=C.kind==="constant"?C.value:C.evaluate({zoom:g},c),h.addDash(L,z),c.patterns[_.id]=[h.getKey(L,z)]}}update(c,h,g,_,S,C,L,z){this.programConfigurations.updatePaintArrays(c,h,S,g,_,C,L,z)}addFeatures(c,h,g,_,S,C){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,g,_,C,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,SWe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,MWe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,jWe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,kWe),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,h){let g,_;if(h&&h>0?(g=`mapbox_clip_start_${h}`,_=`mapbox_clip_end_${h}`):(g="mapbox_clip_start",_="mapbox_clip_end"),c.properties&&c.properties.hasOwnProperty(g)&&c.properties.hasOwnProperty(_))return{start:+c.properties[g],end:+c.properties[_]}}addFeature(c,h,g,_,S,C,L,z){const $=this.layers[0].layout,K=$.get("line-join").evaluate(c,{}),Z=$.get("line-cap").evaluate(c,{}),J=$.get("line-miter-limit"),re=$.get("line-round-limit");this.lineClips=this.lineFeatureClips(c),this.lineFeature=c;const ie=!(!c.properties||!c.properties.hasOwnProperty("mapbox_line_metrics"))&&c.properties.mapbox_line_metrics;this.zOffsetValue=$.get("line-z-offset").value;const ge=this.layers[0].paint.get("line-width").value;if(ge.kind!=="constant"&&ge.isLineProgressConstant===!1&&(this.variableWidthValue=ge),this.elevationType==="road"){const Se=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,h,_,z,K,Z,J,re)){const[Ne,Fe]=this.clipRuntimeLinesToTile(h,1);for(let Ue=0;Ue0?xt.parentIndex:null)}this.fillNonElevatedRoadSegment(Se)}}else for(let Se=0;Se0?Se:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,S,C,_,L,void 0,this.worldview)}computeSegNextDir(c,h){return c.nextPoint.sub(h.at(-2)).unit()}computeSegPrevDir(c,h){return h[1].sub(c.prevPoint).unit()}clipLinesToTile(c,h){return $6(c,-h,-h,Ir+h,Ir+h)}clipRuntimeLinesToTile(c,h){const g=[];return[$6(c,-h,-h,Ir+h,Ir+h,g),g]}addElevatedRoadFeature(c,h,g,_,S,C,L,z){const $=[],K=Ma.getElevationFeature(c,_);if(K){const Z=this.clipLinesToTile(h,1),J=this.prepareElevatedLines(Z,K,g);for(const re of J)$.push({geometry:re,elevation:K,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if($.length===0)return!1;for(const Z of $){const J=this.layoutVertexArray.length;this.addLine(Z.geometry,c,g,S,C,L,z);const re=new qa(g,Z.elevationTileID);if(Z.elevation)for(let ie=J;ie>1,this.layoutVertexArray.int16[6*ie+1]>>1),Se=re.pointElevation(ge,Z.elevation,.05);this.updateHeightRange(Se),this.zOffsetVertexArray.emplaceBack(Se,0,0)}else this.fillNonElevatedRoadSegment(J)}return!0}prepareElevatedLines(c,h,g){if(h.constantHeight!=null)return c;const _=[],S=1/De(g);for(const C of c)$He(C,new fa(h,S),0,_);return _}fillNonElevatedRoadSegment(c){for(let h=c;h0,J=z&&z.progress.max<1;if(this.lineClips){let Pt={min:this.lineClips.start,max:this.lineClips.end},Qt=1;if(z){const ur=this.lineClips.end-this.lineClips.start;Pt=function(hr,vr,br){return{min:Wa(hr.min,vr,br),max:Wa(hr.max,vr,br)}}(z.progress,{min:0,max:1},Pt),ur>0&&(Qt=(Pt.max-Pt.min)/ur)}const Ft=+h.properties.mapbox_clip_feature_len,nr=+h.properties.mapbox_clip_seg_len;if(Number.isNaN(Ft)||Number.isNaN(nr)){for(let hr=0;hr=2&&c[ie-1].equals(c[ie-2]);)ie--;let ge=0;for(;ge0,rr=this.overscaling<=16?15*Ir/(512*this.overscaling):0;if(Qt&&Ft==="round"){if(vrC&&(Ft="bevel"),Ft==="bevel"&&(vr>2&&(Ft="flipbevel"),vr2*rr){const Pr=Ne.sub(Ne.sub(Fe)._mult(rr/Jt)._round());this.updateDistance(Fe,Pr),this.addCurrentVertex(Pr,Qe,0,0,Se,Ct),Fe=Pr}this.updateDistance(Fe,Ne),ur._mult(vr),this.addCurrentVertex(Ne,ur,0,0,Se,Ct);const yr=Ne.dist(Ue);if(yr>2*rr){const Pr=Ne.add(Ue.sub(Ne)._mult(rr/yr)._round());this.updateDistance(Ne,Pr),this.addCurrentVertex(Pr,xt,0,0,Se,Ct),Ne=Pr}}else ur._mult(vr),this.addCurrentVertex(Ne,ur,0,0,Se,Ct);else if(Ft==="flipbevel"){if(vr>100)ur=xt.mult(-1);else{const Jt=vr*Qe.add(xt).mag()/Qe.sub(xt).mag();ur._perp()._mult(Jt*(xr?-1:1))}this.addCurrentVertex(Ne,ur,0,0,Se,Ct),this.addCurrentVertex(Ne,ur.mult(-1),0,0,Se,Ct)}else if(Ft==="bevel"||Ft==="fakeround"){Ct!=null&&Fe&&this.addCurrentVertex(Ne,wt||Qe,-1,-1,Se,Ct);const Jt=Ne.dist(Fe)<=2*rr&&Ft!=="bevel",yr=ur.mult(xr?1:-1);yr._mult(vr);const Pr=xt.mult(xr?-1:1),kr=Qe.mult(xr?-1:1),vn=this.evaluateLineProgressFeatures(this.distance);if(Ct==null&&(this.addHalfVertex(Ne,yr.x,yr.y,!1,!xr,0,Se,vn),Jt||this.addHalfVertex(Ne,yr.x+2*kr.x,yr.y+2*kr.y,!1,xr,0,Se,vn)),Ft==="fakeround"){const Wr=Math.round(180*br/Math.PI/20);this.addHalfVertex(Ne,kr.x,kr.y,!1,xr,0,Se,vn);for(let Jr=0;Jr1){this.lineSoFar=c.w;const ge=(h.x-c.x)/Z,Se=(h.y-c.y)/Z,Ne=(h.z-c.z)/Z,Fe=(h.w-c.w)/Z;for(let Ue=1;Ue=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,K),z.primitiveLength++),C?this.e2=K:this.e1=K,$!=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,h){this.prevDistance=this.distance,this.distance+=c.dist(h),this.updateScaledDistance()}}function ele(f,c,h){return f.xh||f.yh}let G_e,K_e;function Z_e(f,c,h){return c*(Ir/(f.tileSize*Math.pow(2,h-f.tileID.overscaledZ)))}nn(Joe,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Y_e=(f,c,h)=>(1-h)*f+h*c;function X_e(f,c){return 1/Z_e(f,1,c.tileZoom)}function Q_e(f,c,h,g){return f.translatePosMatrix(g||c.tileID.projMatrix,c,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const J_e=f=>{const c=[];ebe(f)&&c.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const h=f.paint.get("line-trim-offset");h[0]===0&&h[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",_=!!f.paint.get("line-pattern").constantOr(1);return g&&_&&c.push("LINE_JOIN_NONE"),c};function ebe(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let tle;const tbe=()=>tle||(tle={layout:G_e||(G_e=new to({"line-cap":new zr(Bt.layout_line["line-cap"]),"line-join":new zr(Bt.layout_line["line-join"]),"line-miter-limit":new Cr(Bt.layout_line["line-miter-limit"]),"line-round-limit":new Cr(Bt.layout_line["line-round-limit"]),"line-sort-key":new zr(Bt.layout_line["line-sort-key"]),"line-z-offset":new zr(Bt.layout_line["line-z-offset"]),"line-elevation-reference":new Cr(Bt.layout_line["line-elevation-reference"]),"line-cross-slope":new Cr(Bt.layout_line["line-cross-slope"]),visibility:new Cr(Bt.layout_line.visibility),"line-width-unit":new Cr(Bt.layout_line["line-width-unit"])})),paint:K_e||(K_e=new to({"line-opacity":new zr(Bt.paint_line["line-opacity"]),"line-color":new zr(Bt.paint_line["line-color"]),"line-translate":new Cr(Bt.paint_line["line-translate"]),"line-translate-anchor":new Cr(Bt.paint_line["line-translate-anchor"]),"line-width":new zr(Bt.paint_line["line-width"]),"line-gap-width":new zr(Bt.paint_line["line-gap-width"]),"line-offset":new zr(Bt.paint_line["line-offset"]),"line-blur":new zr(Bt.paint_line["line-blur"]),"line-dasharray":new zr(Bt.paint_line["line-dasharray"]),"line-pattern":new zr(Bt.paint_line["line-pattern"]),"line-pattern-cross-fade":new Cr(Bt.paint_line["line-pattern-cross-fade"]),"line-gradient":new jx(Bt.paint_line["line-gradient"]),"line-trim-offset":new Cr(Bt.paint_line["line-trim-offset"]),"line-trim-fade-range":new Cr(Bt.paint_line["line-trim-fade-range"]),"line-trim-color":new Cr(Bt.paint_line["line-trim-color"]),"line-emissive-strength":new zr(Bt.paint_line["line-emissive-strength"]),"line-border-width":new zr(Bt.paint_line["line-border-width"]),"line-border-color":new zr(Bt.paint_line["line-border-color"]),"line-occlusion-opacity":new Cr(Bt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"})}))},tle);class IWe extends zr{possiblyEvaluate(c,h){return h=new li(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,transition:h.transition,worldview:h.worldview}),super.possiblyEvaluate(c,h)}evaluate(c,h,g,_){return h=Object.assign({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(c,h,g,_)}}let wM;function rbe(f,c){return c>0?c+2*f:f}const PWe=Bs([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),LWe=Bs([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),OWe=Bs([{name:"a_projected_pos",components:4,type:"Float32"}],4);Bs([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const DWe=Bs([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),RWe=Bs([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),FWe=Bs([{name:"a_texb",components:2,type:"Uint16"}]),zWe=Bs([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),BWe=Bs([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Bs([{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 nbe=Bs([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),$We=Bs([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Bs([{name:"triangle",components:3,type:"Uint16"}]),Bs([{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"}]),Bs([{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"}]),Bs([{type:"Float32",name:"offsetX"}]),Bs([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var jl=24;function UWe(f,c,h){return f.sections.forEach(g=>{g.text=function(_,S,C){const L=S.layout.get("text-transform").evaluate(C,{});return L==="uppercase"?_=_.toLocaleUpperCase():L==="lowercase"&&(_=_.toLocaleLowerCase()),Ff.applyArabicShaping&&(_=Ff.applyArabicShaping(_)),_}(g.text,c,h)}),f}const jM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function qWe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function VWe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const rle=4294967296,sbe=1/rle,abe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Q6=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,h=this.length){for(;this.pos>3,S=this.pos;this.type=7&g,f(_,c,this),this.pos===S&&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)*rle;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*rle;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 h,g;return g=c[this.pos++],h=127&g,g<128?h:(g=c[this.pos++],h|=(127&g)<<7,g<128?h:(g=c[this.pos++],h|=(127&g)<<14,g<128?h:(g=c[this.pos++],h|=(127&g)<<21,g<128?h:(g=c[this.pos],h|=(15&g)<<28,function(_,S,C){const L=C.buf;let z,$;if($=L[C.pos++],z=(112&$)>>4,$<128||($=L[C.pos++],z|=(127&$)<<3,$<128)||($=L[C.pos++],z|=(127&$)<<10,$<128)||($=L[C.pos++],z|=(127&$)<<17,$<128)||($=L[C.pos++],z|=(127&$)<<24,$<128)||($=L[C.pos++],z|=(1&$)<<31,$<128))return nS(_,z,S);throw new Error("Expected varint not more than 10 bytes")}(h,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&&abe?abe.decode(this.buf.subarray(c,f)):function(h,g,_){let S="",C=g;for(;C<_;){const L=h[C];let z,$,K,Z=null,J=L>239?4:L>223?3:L>191?2:1;if(C+J>_)break;J===1?L<128&&(Z=L):J===2?(z=h[C+1],(192&z)==128&&(Z=(31&L)<<6|63&z,Z<=127&&(Z=null))):J===3?(z=h[C+1],$=h[C+2],(192&z)==128&&(192&$)==128&&(Z=(15&L)<<12|(63&z)<<6|63&$,(Z<=2047||Z>=55296&&Z<=57343)&&(Z=null))):J===4&&(z=h[C+1],$=h[C+2],K=h[C+3],(192&z)==128&&(192&$)==128&&(192&K)==128&&(Z=(15&L)<<18|(63&z)<<12|(63&$)<<6|63&K,(Z<=65535||Z>=1114112)&&(Z=null))),Z===null?(Z=65533,J=1):Z>65535&&(Z-=65536,S+=String.fromCharCode(Z>>>10&1023|55296),Z=56320|1023&Z),S+=String.fromCharCode(Z),C+=J}return S}(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 h=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,h){let g,_;if(c>=0?(g=c%4294967296|0,_=c/4294967296|0):(g=~(-c%4294967296),_=~(-c/4294967296),4294967295^g?g=g+1|0:(g=0,_=_+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(S,C,L){L.buf[L.pos++]=127&S|128,S>>>=7,L.buf[L.pos++]=127&S|128,S>>>=7,L.buf[L.pos++]=127&S|128,S>>>=7,L.buf[L.pos++]=127&S|128,L.buf[L.pos]=127&(S>>>=7)}(g,0,h),function(S,C){const L=(7&S)<<4;C.buf[C.pos++]|=L|((S>>>=3)?128:0),S&&(C.buf[C.pos++]=127&S|((S>>>=7)?128:0),S&&(C.buf[C.pos++]=127&S|((S>>>=7)?128:0),S&&(C.buf[C.pos++]=127&S|((S>>>=7)?128:0),S&&(C.buf[C.pos++]=127&S|((S>>>=7)?128:0),S&&(C.buf[C.pos++]=127&S)))))}(_,h)}(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,_,S){for(let C,L,z=0;z<_.length;z++){if(C=_.charCodeAt(z),C>55295&&C<57344){if(!L){C>56319||z+1===_.length?(g[S++]=239,g[S++]=191,g[S++]=189):L=C;continue}if(C<56320){g[S++]=239,g[S++]=191,g[S++]=189,L=C;continue}C=L-55296<<10|C-56320|65536,L=null}else L&&(g[S++]=239,g[S++]=191,g[S++]=189,L=null);C<128?g[S++]=C:(C<2048?g[S++]=C>>6|192:(C<65536?g[S++]=C>>12|224:(g[S++]=C>>18|240,g[S++]=C>>12&63|128),g[S++]=C>>6&63|128),g[S++]=63&C|128)}return S}(this.buf,f,this.pos);const h=this.pos-c;h>=128&&ibe(c,h,this),this.pos=c-1,this.writeVarint(h),this.pos+=h}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 h=0;h=128&&ibe(h,g,this),this.pos=h-1,this.writeVarint(g),this.pos+=g}writeMessage(f,c,h){this.writeTag(f,2),this.writeRawMessage(c,h)}writePackedVarint(f,c){c.length&&this.writeMessage(f,HWe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,WWe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,ZWe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,GWe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,KWe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,YWe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,XWe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,QWe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,JWe,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 nS(f,c,h){return h?4294967296*c+(f>>>0):4294967296*(c>>>0)+(f>>>0)}function ibe(f,c,h){const g=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));h.realloc(g);for(let _=h.pos-1;_>=f;_--)h.buf[_+g]=h.buf[_]}function HWe(f,c){for(let h=0;h=0&&g>=c&&J6[this.text.charCodeAt(g)];g--)h--;this.text=this.text.substring(c,h),this.sectionIndex=this.sectionIndex.slice(c,h)}substring(c,h){const g=new sS;return g.text=this.text.substring(c,h),g.sectionIndex=this.sectionIndex.slice(c,h),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((c,h)=>Math.max(c,this.sections[h].scale),0)}addTextSection(c,h){this.text+=c.text,this.sections.push(kM.forText(c.scale,c.fontStack||h));const g=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function sle(f,c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge=1){const Se=sS.fromFeature(f,_,ge);Z===zu.vertical&&Se.verticalizePunctuation(J);let Ne=[];const Fe=function(wt,Ct,Pt,Qt,Ft,nr){if(!wt)return[];const ur=[],hr=function(xr,rr,Jt,yr,Pr,kr){let vn=0;for(let Wr=0;Wr=0;let br=0;for(let xr=0;xr0&&ga>cs&&(cs=ga)}else{const da=Pt[_r.fontStack];if(!da)continue;da[qr]&&(as=da[qr]);const pa=Ct[_r.fontStack];if(!pa)continue;const ga=pa.glyphs[qr];if(!ga)continue;if(kn=ga.metrics,_s=qr!==8203?jl:0,kr){const Ra=pa.ascender!==void 0?Math.abs(pa.ascender):0,ti=pa.descender!==void 0?Math.abs(pa.descender):0,Ka=(Ra+ti)*bn;Ga-h/2;){if(C--,C<0)return!1;L-=f[C].dist(S),S=f[C]}L+=f[C].dist(f[C+1]),C++;const z=[];let $=0;for(;Lg;)$-=z.shift().angleDelta;if($>_)return!1;C++,L+=K.dist(Z)}return!0}function xbe(f){let c=0;for(let h=0;h$){const ie=($-z)/re,ge=zn(Z.x,J.x,ie),Se=zn(Z.y,J.y,ie),Ne=new Ex(ge,Se,0,J.angleTo(Z),K);return!C||gbe(f,Ne,L,C,c)?Ne:void 0}z+=re}}function iGe(f,c,h,g,_,S,C,L,z){const $=ybe(g,S,C),K=vbe(g,_),Z=K*C,J=f[0].x===0||f[0].x===z||f[0].y===0||f[0].y===z;return c-Z=0&&Qe=0&&xt=0&&J+$<=K){const mt=new Ex(Qe,xt,0,Fe,ie);g&&!gbe(f,mt,S,g,_)||re.push(mt)}}Z+=Ne}return L||re.length||C||(re=_be(f,Z/2,h,g,_,S,C,!0,z)),re}function bbe(f){let c=0,h=0;for(const C of f)c+=C.w*C.h,h=Math.max(h,C.w);f.sort((C,L)=>L.h-C.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),h),h:1/0}];let _=0,S=0;for(const C of f)for(let L=g.length-1;L>=0;L--){const z=g[L];if(!(C.w>z.w||C.h>z.h)){if(C.x=z.x,C.y=z.y,S=Math.max(S,C.y+C.h),_=Math.max(_,C.x+C.w),C.w===z.w&&C.h===z.h){const $=g.pop();$&&L1?ie-1:ie,Dc.copy(Z.data,$,{x:0,y:0},{x:ge,y:Se},Z.data,g),Dc.copy(Z.data,$,{x:0,y:Fe-ie},{x:ge,y:Se-ie},{width:Ne,height:ie},g),Dc.copy(Z.data,$,{x:0,y:0},{x:ge,y:Se+Fe},{width:Ne,height:ie},g),Dc.copy(Z.data,$,{x:Ne-ie,y:0},{x:ge-ie,y:Se},{width:ie,height:Fe},g),Dc.copy(Z.data,$,{x:0,y:0},{x:ge+Ne,y:Se},{width:ie,height:Fe},g),Dc.copy(Z.data,$,{x:Ne-ie,y:Fe-ie},{x:ge-ie,y:Se-ie},{width:ie,height:ie},g),Dc.copy(Z.data,$,{x:0,y:Fe-ie},{x:ge+Ne,y:Se-ie},{width:ie,height:ie},g),Dc.copy(Z.data,$,{x:0,y:0},{x:ge+Ne,y:Se+Fe},{width:ie,height:ie},g),Dc.copy(Z.data,$,{x:Ne-ie,y:0},{x:ge-ie,y:Se+Fe},{width:ie,height:ie},g)}this.lut=g,this.image=$,this.iconPositions=_,this.patternPositions=S}addImages(c,h,g,_){for(const[S,C]of c.entries()){const{bin:L,imagePosition:z,imageVariant:$}=cle(S,C,g);h.set(S,z),_.push(L),C.hasRenderCallback&&this.haveRenderCallbacks.push($.id)}}patchUpdatedImages(c,h,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(_=>c.hasImage(_,g)),c.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const _ of c.getUpdatedImages(g)){for(const S of this.iconPositions.keys()){const C=Ef.parse(S);if(wa.isEqual(C.id,_)){const L=c.getImage(_,g);this.patchUpdatedImage(this.iconPositions.get(S),L,h,null)}}for(const S of this.patternPositions.keys()){const C=Ef.parse(S);if(wa.isEqual(C.id,_)){const L=c.getImage(_,g);this.patchUpdatedImage(this.patternPositions.get(S),L,h,this.lut)}}}}patchUpdatedImage(c,h,g,_=null){if(!c||!h||c.version===h.version)return;c.version=h.version;const[S,C]=c.tl,L=c.sdf;if(this.lut||L){const z={width:h.data.width,height:h.data.height},$=new Dc(z);Dc.copy(h.data,$,{x:0,y:0},{x:0,y:0},z,_,L),g.update($,{position:{x:S,y:C}})}else g.update(h.data,{position:{x:S,y:C}})}}nn(NM,"ImagePosition"),nn(wbe,"ImageAtlas");const SM=1e20;function jbe(f,c,h,g,_,S,C,L,z){for(let $=c;$-1);z++,S[z]=L,C[z]=$,C[z+1]=SM}for(let L=0,z=0;L{let z=this.entries[S];z||(z=this.entries[S]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let $=z.glyphs[C];if($!==void 0)return void L(null,{stack:S,id:C,glyph:$});if($=this._tinySDF(z,S,C),$)return z.glyphs[C]=$,void L(null,{stack:S,id:C,glyph:$});const K=Math.floor(C/256);if(256*K>65535)return Kr("glyphs > 65535 not supported"),void L(null,{stack:S,id:C,glyph:$});if(z.ranges[K])return void L(null,{stack:S,id:C,glyph:$});let Z=z.requests[K];Z||(Z=z.requests[K]=[],oS.loadGlyphRange(S,K,_,this.requestManager,(J,re)=>{if(re){z.ascender=re.ascender,z.descender=re.descender;for(const ie in re.glyphs)this._doesCharSupportLocalGlyph(+ie)||(z.glyphs[+ie]=re.glyphs[+ie]);z.ranges[K]=!0}for(const ie of Z)ie(J,re);delete z.requests[K]})),Z.push((J,re)=>{J?L(J):re&&L(null,{stack:S,id:C,glyph:re.glyphs[C]||null})})},(S,C)=>{if(S)h(S);else if(C){const L={};for(const{stack:z,id:$,glyph:K}of C)L[z]===void 0&&(L[z]={}),L[z].glyphs===void 0&&(L[z].glyphs={}),L[z].glyphs[$]=K&&{id:K.id,bitmap:K.bitmap.clone(),metrics:K.metrics},L[z].ascender=this.entries[z].ascender,L[z].descender=this.entries[z].descender;h(null,L)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==dle.none&&(this.localGlyphMode===dle.all?!!this.localFontFamily:!!this.localFontFamily&&(In["CJK Unified Ideographs"](c)||In["Hangul Syllables"](c)||In.Hiragana(c)||In.Katakana(c)||In["CJK Symbols and Punctuation"](c)||In["CJK Unified Ideographs Extension A"](c)||In["CJK Unified Ideographs Extension B"](c)||In.Osage(c)))}_tinySDF(c,h,g){const _=this.localFontFamily;if(!_||!this._doesCharSupportLocalGlyph(g))return;let S=c.tinySDF;if(!S){let ge="400";/bold/i.test(h)?ge="900":/medium/i.test(h)?ge="500":/light/i.test(h)&&(ge="200"),S=c.tinySDF=new oS.TinySDF({fontFamily:_,fontWeight:ge,fontSize:24*Zf,buffer:3*Zf,radius:8*Zf}),S.fontWeight=ge}if(this.localGlyphs[S.fontWeight][g])return this.localGlyphs[S.fontWeight][g];const C=String.fromCodePoint(g),{data:L,width:z,height:$,glyphWidth:K,glyphHeight:Z,glyphLeft:J,glyphTop:re,glyphAdvance:ie}=S.draw(C);return this.localGlyphs[S.fontWeight][g]={id:g,bitmap:new M0({width:z,height:$},L),metrics:{width:K/Zf,height:Z/Zf,left:J/Zf,top:re/Zf-27,advance:ie/Zf,localGlyph:!0}}}}oS.loadGlyphRange=function(f,c,h,g,_){const S=256*c,C=S+255,L=g.transformRequest(g.normalizeGlyphsURL(h).replace("{fontstack}",f).replace("{range}",`${S}-${C}`),Af.Glyphs);Iu(L,(z,$)=>{if(z)_(z);else if($){const K={},Z=function(J){return new Q6(J).readFields(eGe,{})}($);for(const J of Z.glyphs)K[J.id]=J;_(null,{glyphs:K,ascender:Z.ascender,descender:Z.descender})}})},oS.TinySDF=class{constructor({fontSize:f=24,buffer:c=3,radius:h=8,cutoff:g=.25,fontFamily:_="sans-serif",fontWeight:S="normal",fontStyle:C="normal",lang:L=null}={}){this.buffer=c,this.cutoff=g,this.radius=h,this.lang=L;const z=this.size=f+4*c,$=this._createCanvas(z),K=this.ctx=$.getContext("2d",{willReadFrequently:!0});K.font=`${C} ${S} ${f}px ${_}`,K.textBaseline="alphabetic",K.textAlign="left",K.fillStyle="black",this.gridOuter=new Float64Array(z*z),this.gridInner=new Float64Array(z*z),this.f=new Float64Array(z),this.z=new Float64Array(z+1),this.v=new Uint16Array(z)}_createCanvas(f){const c=document.createElement("canvas");return c.width=c.height=f,c}draw(f){const{width:c,actualBoundingBoxAscent:h,actualBoundingBoxDescent:g,actualBoundingBoxLeft:_,actualBoundingBoxRight:S}=this.ctx.measureText(f),C=Math.ceil(h),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(S-_))),z=Math.min(this.size-this.buffer,C+Math.ceil(g)),$=L+2*this.buffer,K=z+2*this.buffer,Z=Math.max($*K,0),J=new Uint8ClampedArray(Z),re={data:J,width:$,height:K,glyphWidth:L,glyphHeight:z,glyphTop:C,glyphLeft:0,glyphAdvance:c};if(L===0||z===0)return re;const{ctx:ie,buffer:ge,gridInner:Se,gridOuter:Ne}=this;this.lang&&(ie.lang=this.lang),ie.clearRect(ge,ge,L,z),ie.fillText(f,ge,ge+C);const Fe=ie.getImageData(ge,ge,L,z);Ne.fill(SM,0,Z),Se.fill(0,0,Z);for(let Ue=0;Ue0?wt*wt:0,Se[mt]=wt<0?wt*wt:0}}jbe(Ne,0,0,$,K,$,this.f,this.v,this.z),jbe(Se,ge,ge,L,z,$,this.f,this.v,this.z);for(let Ue=0;Ue{const vr=rL(Ft.stretch-Fe,Ue,K,f.left*_),br=nL(Ft.fixed-mt,wt,Ft.stretch,ie),fr=rL(nr.stretch-Qe,xt,Z,f.top*_),xr=nL(nr.fixed-Ct,Pt,nr.stretch,ge),rr=rL(ur.stretch-Fe,Ue,K,f.left*_),Jt=nL(ur.fixed-mt,wt,ur.stretch,ie),yr=rL(hr.stretch-Qe,xt,Z,f.top*_),Pr=nL(hr.fixed-Ct,Pt,hr.stretch,ge),kr=new ir(vr,fr),vn=new ir(rr,fr),Wr=new ir(rr,yr),Jr=new ir(vr,yr),dn=new ir(br/L,xr/L),bs=new ir(Jt/L,Pr/L),Nr=c*Math.PI/180;if(Nr){const Ga=Math.sin(Nr),ft=Math.cos(Nr),vt=[ft,-Ga,Ga,ft];kr._matMult(vt),vn._matMult(vt),Jr._matMult(vt),Wr._matMult(vt)}const hn=Ft.stretch+Ft.fixed,Gn=ur.stretch+ur.fixed,Ks=nr.stretch+nr.fixed,Js=hr.stretch+hr.fixed,cs=f.imageSecondary;return{tl:kr,tr:vn,bl:Jr,br:Wr,texPrimary:{x:C.paddedRect.x+hg+hn,y:C.paddedRect.y+hg+Ks,w:Gn-hn,h:Js-Ks},texSecondary:cs?{x:cs.paddedRect.x+hg+hn,y:cs.paddedRect.y+hg+Ks,w:Gn-hn,h:Js-Ks}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:dn,pixelOffsetBR:bs,minFontScaleX:wt/L/K,minFontScaleY:Pt/L/Z,isSDF:h}};if(g&&(C.stretchX||C.stretchY)){const Ft=Sbe(J,Se,ie),nr=Sbe(re,Ne,ge);for(let ur=0;urS)&&(S=ie.x),(!re||ie.y>C)&&(C=ie.y)}const z=Math.min(S-g,C-_);let $=z/2;const K=new Xk([],dGe);if(z===0)return new ir(g,_);for(let re=g;reZ.d||!Z.d)&&(Z=re,h&&console.log("found best %d after %d probes",Math.round(1e4*re.d)/1e4,J)),re.max-Z.d<=c||($=re.h/2,K.push(new lS(re.p.x-$,re.p.y-$,$,f)),K.push(new lS(re.p.x+$,re.p.y-$,$,f)),K.push(new lS(re.p.x-$,re.p.y+$,$,f)),K.push(new lS(re.p.x+$,re.p.y+$,$,f)),J+=4)}return h&&(console.log(`num probes: ${J}`),console.log(`best distance: ${Z.d}`)),Z.p}function dGe(f,c){return c.max-f.max}class lS{constructor(c,h,g,_){this.p=new ir(c,h),this.h=g,this.d=function(S,C){let L=!1,z=1/0;for(let $=0;$S.y!=ge.y>S.y&&S.x<(ge.x-ie.x)*(S.y-ie.y)/(ge.y-ie.y)+ie.x&&(L=!L),z=Math.min(z,ho(S,ie,ge))}}return(L?1:-1)*Math.sqrt(z)}(this.p,_),this.max=this.d+this.h*Math.SQRT2}}const uGe=Object.keys,hle=Number.POSITIVE_INFINITY,hGe=Math.sqrt(2);function A0(f,c,h,g,_){const S=ile(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],C={top:f.top-S[1],bottom:f.bottom+S[3],left:f.left-S[0],right:f.right+S[2],scaled:!1};return g!==void 0&&function(L,z){L.top*=z,L.bottom*=z,L.left*=z,L.right*=z,L.scaled=!0}(C,g),h&&function(L,z){if(!z)return;const $=qn(z),K=new ir(L.left,L.top),Z=new ir(L.right,L.top),J=new ir(L.left,L.bottom),re=new ir(L.right,L.bottom),ie=new ir(0,0);K._rotateAround($,ie),Z._rotateAround($,ie),J._rotateAround($,ie),re._rotateAround($,ie),L.left=Math.min(K.x,Z.x,J.x,re.x),L.right=Math.max(K.x,Z.x,J.x,re.x),L.top=Math.min(K.y,Z.y,J.y,re.y),L.bottom=Math.max(K.y,Z.y,J.y,re.y)}(C,h),_&&(C.left+=_[0],C.right+=_[0],C.top+=_[1],C.bottom+=_[1]),c?{top:Math.min(c.top,C.top),bottom:Math.max(c.bottom,C.bottom),left:Math.min(c.left,C.left),right:Math.max(c.right,C.right),scaled:c.scaled||C.scaled}:C}function Mbe(f,[c,h]){let g=0,_=0;if(h===hle){c<0&&(c=0);const S=c/hGe;switch(f){case"top-right":case"top-left":_=S-7;break;case"bottom-right":case"bottom-left":_=7-S;break;case"bottom":_=7-c;break;case"top":_=c-7}switch(f){case"top-right":case"bottom-right":g=-S;break;case"top-left":case"bottom-left":g=S;break;case"left":g=c;break;case"right":g=-c}}else{switch(c=Math.abs(c),h=Math.abs(h),f){case"top-right":case"top-left":case"top":_=h-7;break;case"bottom-right":case"bottom-left":case"bottom":_=7-h}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,_]}function mGe(f,c,h,g,_,S,C,L,z,$,K,Z,J,re){const ie=f.layers[0],ge=ie.appearances;if(ge.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Se={iconBBox:null,iconVerticalBBox:null},Ne={textBBox:null,textVerticalBBox:null},{baseIconRotate:Fe,baseTextRotate:Ue,iconScaleFactor:Qe}=function(mt,wt,Ct){const Pt=mt.get("icon-rotate").evaluate(wt,{},Ct),Qt=mt.get("text-rotate").evaluate(wt,{},Ct),[Ft,nr]=mt.get("icon-size-scale-range");return{baseIconRotate:Pt,baseTextRotate:Qt,iconScaleFactor:ye(1,Ft,nr)}}(g,_,S);c&&(Se.iconBBox=A0(c,Se.iconBBox,Fe,C),h)&&(Se.iconVerticalBBox=A0(h,Se.iconVerticalBBox,Fe+90,C));const xt=aL(Z.horizontal);xt&&(Ne.textBBox=A0(xt,Ne.textBBox,Ue,1,re)),Z.vertical&&(Ne.textVerticalBBox=A0(Z.vertical,Ne.textVerticalBBox,Ue+90,1,re));for(const mt of ge)mt.hasIconProperties()&&fGe(Se,f,ie,mt,_,S,L,Fe,C,z,c,$,Qe,K),mt.hasTextProperties()&&pGe(Ne,ie,mt,_,S,re,Ue,J,xt,Z.vertical);return{iconBBox:Se.iconBBox,iconVerticalBBox:Se.iconVerticalBBox,textBBox:Ne.textBBox,textVerticalBBox:Ne.textVerticalBBox}}function fGe(f,c,h,g,_,S,C,L,z,$,K,Z,J,re){const{appearanceIconOffset:ie,appearanceIconRotate:ge,appearanceIconSize:Se}=function(Qe,xt,mt,wt,Ct,Pt,Qt,Ft){const nr=Qe.hasProperty("icon-offset")?xt.getAppearanceValueAndResolveTokens(Qe,"icon-offset",mt,wt,[]):null,ur=nr&&Array.isArray(nr)?nr:Ct,hr=Qe.hasProperty("icon-rotate")?xt.getAppearanceValueAndResolveTokens(Qe,"icon-rotate",mt,wt,[]):null,vr=typeof hr=="number"?hr:Pt,br=Qe.hasProperty("icon-size")?xt.getAppearanceValueAndResolveTokens(Qe,"icon-size",mt,wt,[]):null;return{appearanceIconOffset:ur,appearanceIconRotate:vr,appearanceIconSize:typeof br=="number"?br*Ft.iconScaleFactor:Qt}}(g,h,_,S,C,L,z,$);let Ne=null,Fe=null,Ue=null;g.hasProperty("icon-image")?Ue=function(Qe,xt,mt,wt,Ct,Pt,Qt){let Ft=null;const nr=xt.getAppearanceValueAndResolveTokens(mt,"icon-image",wt,Ct,[]);if(nr){const ur=Qe.getResolvedImageFromTokens(nr),hr=mt.getUnevaluatedProperty("icon-size"),vr=CM(ur,aS(Qe.zoom,hr,Qe.worldview),hr,Ct,Qe.zoom,wt,Qe.pixelRatio,Qt,Qe.worldview);Ft=Pt.get(vr.iconPrimary.toString())}return Ft}(c,h,g,_,S,Z,J):K&&(Ue=K.imagePrimary),Ue&&(Ne=eL(Ue,null,ie,re),c.allowVerticalPlacement&&(Fe=eL(Ue,null,ie,re))),Ne&&(f.iconBBox=A0(Ne,f.iconBBox,ge,Se)),Fe&&(f.iconVerticalBBox=A0(Fe,f.iconVerticalBBox,ge+90,Se))}function pGe(f,c,h,g,_,S,C,L,z,$){const{appearanceTextOffset:K,appearanceTextRotate:Z,appearanceTextSize:J}=function(ie,ge,Se,Ne,Fe,Ue,Qe){const xt=ie.hasProperty("text-offset")?ge.getAppearanceValueAndResolveTokens(ie,"text-offset",Se,Ne,[]):null,mt=xt&&Array.isArray(xt)?[xt[0]*jl,xt[1]*jl]:Fe,wt=ie.hasProperty("text-rotate")?ge.getAppearanceValueAndResolveTokens(ie,"text-rotate",Se,Ne,[]):null,Ct=typeof wt=="number"?wt:Ue,Pt=ie.hasProperty("text-size")?ge.getAppearanceValueAndResolveTokens(ie,"text-size",Se,Ne,[]):null;return{appearanceTextOffset:mt,appearanceTextRotate:Ct,appearanceTextSize:typeof Pt=="number"?Pt:Qe}}(h,c,g,_,S,C,L),re=J/L;z&&(f.textBBox=A0(z,f.textBBox,Z,re,K)),$&&(f.textVerticalBBox=A0($,f.textVerticalBBox,Z+90,re,K))}function sL(f,c,h,g,_,S,C,L,z){if(!c||!c.usvg)return;const $=pbe(g),K=pbe(_),Z=S!=="both"&&S!=="width"||!mbe(g)?1:K.width/$.width,J=S!=="both"&&S!=="height"||!fbe(g)?1:K.height/$.height;h.scaleSelf(Z,J);const re=h.toString();C.set(re,h),L.set(re,c);const{imagePosition:ie}=cle(re,c,b_);z.set(re,ie)}function Tbe(f,c,h,g,_,S,C,L,z){if(!f)return;const $=function(K,Z,J,re,ie,ge){if(K.kind==="camera")return K.maxSize;if(K.kind==="composite"){const Se=Z.possiblyEvaluate(new li(K.maxZoom,{worldview:ge}),J).evaluate(ie,{},J),Ne=Z.possiblyEvaluate(new li(K.minZoom,{worldview:ge}),J).evaluate(ie,{},J);return Math.max(Se,Ne)}return Z.possiblyEvaluate(new li(re,{worldview:ge})).evaluate(ie,{},J)}(c,h,g,_,S,z);return f.scaleSelf($*L*C)}function CM(f,c,h,g,_,S,C,L,z){return{iconPrimary:Tbe(f.getPrimary(),c,h,g,_,S,C,L,z),iconSecondary:Tbe(f.getSecondary(),c,h,g,_,S,C,L,z)}}function gGe(f,c,h){if(!c)return;const g=h.get(f.toString()),_=h.get(c.toString());g&&_&&(g.paddedRect.w===_.paddedRect.w&&g.paddedRect.h===_.paddedRect.h||Kr(`Mismatch in icon variant sizes: ${f.toString()} and ${c.toString()}`),g.usvg!==_.usvg&&Kr(`Mismatch in icon variant image types: ${f.id} and ${c.id}`))}function Abe(f,c,h,g){if(!f)return;const _=c.get(h.toString());if(f.imagePrimary=_,g){const S=c.get(g.toString());f.imageSecondary=S}}function xGe(f,c){for(const h in f.horizontal)Ebe(f.horizontal[h],c);Ebe(f.vertical,c)}function Ebe(f,c){if(f){for(const h of f.positionedLines)for(const g of h.positionedGlyphs)if(g.image!==null){const _=g.image.toString();g.rect=c.get(_).paddedRect}}}function mle(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 yGe(f,c,h,g,_,S,C,L,z){const $=aL(S.horizontal)||S.vertical,K=h.get("icon-text-fit-padding").evaluate(g,{},_);let Z,J=c;return c&&z!=="none"&&(f.allowVerticalPlacement&&S.vertical&&(Z=ole(c,S.vertical,z,K,L,C)),$&&(J=ole(c,$,z,K,L,C))),{defaultShapedIcon:J,verticallyShapedIcon:Z}}function vGe(f,c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe,Ue,Qe,xt,mt,wt){let Ct=C.textMaxSize.evaluate(c,{},J);Ct===void 0?Ct=L*C.textScaleFactor:Ct*=C.textScaleFactor;const Pt=f.layers[0].layout,Qt=jl,Ft=L*C.textScaleFactor/Qt,nr=aL(h.horizontal)||h.vertical;if(Se!=="none"&&f.appearanceFeatureData&&c.index18&&yr>2&&(yr>>=1),Math.max(Ir/(512*yr),1)*Pt.get("symbol-spacing")),br=Pt.get("text-padding")*f.tilePixelRatio,fr=Pt.get("icon-padding")*f.tilePixelRatio,xr=qn(Pt.get("text-max-angle")),rr=Pt.get("icon-rotation-alignment")==="map"&&Ue!=="point",Jt=vr/2;var yr;f.hasAnyIconTextFit===!1&&Se!=="none"&&(f.hasAnyIconTextFit=!0);const Pr=c.properties?+c.properties[er]:null,kr=Pr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Pr):65535,vn=(Wr,Jr,dn)=>{if(Jr.x<0||Jr.x>=Ir||Jr.y<0||Jr.y>=Ir)return;let bs=null;if(ur){const{x:Nr,y:hn,z:Gn}=re.projectTilePoint(Jr.x,Jr.y,dn);bs={anchor:new Ex(Nr,hn,Gn,0,void 0),up:re.upVector(dn,Jr.x,Jr.y)}}(function(Nr,hn,Gn,Ks,Js,cs,Ga,ft,vt,sr,_r,Ur,qr,bn,kn,as,gs,_s,$s,On,Wn,da,pa,ga,Ra,ti,Ka,Na,Aa,xs,Qs,Ri,Pn){const Us=Nr.addToLineVertexArray(hn,Ks);let Ya,si,ci,yo,ai,Ln,Hi,Fa=0,Si=0,tl=0,kl=0,$o=-1,Uo=-1;const hl={};let Xd=gr("");const ii=Gn?Gn.anchor:hn,mo=Na!=="none";let vo=0,uu=0;if(vt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const pc=vt.layout.get("text-offset").evaluate(Wn,{},Ra);vo=pc[0]*jl,uu=pc[1]*jl}else vo=vt.layout.get("text-radial-offset").evaluate(Wn,{},Ra)*jl,uu=hle;if(Nr.allowVerticalPlacement&&Js.vertical){const pc=Js.vertical;if(kn)Ln=fle(pc),ft&&(Hi=fle(ft));else{const Nd=vt.layout.get("text-rotate").evaluate(Wn,{},Ra)+90;ci=iL(sr,ii,hn,_r,Ur,qr,pc,bn,Nd,as,Ri),ft&&(yo=iL(sr,ii,hn,_r,Ur,qr,ft,_s,Nd,null,Qs))}}if(cs){const pc=Nr.iconSizeData,Nd=vt.layout.get("icon-rotate").evaluate(Wn,{},Ra),Bu=ule(cs,Nd,pa,mo,da.iconScaleFactor),P0=ft?ule(ft,Nd,pa,mo,da.iconScaleFactor):void 0;si=iL(sr,ii,hn,_r,Ur,qr,cs,_s,Nd,null,xs);const pS=function(Jf,HM,Y2e,EKe,X2e,Q2e,IKe,PKe){const J2e=Jf.layers[0],ewe=J2e.appearances;let gS=HM.length;if(Y2e&&(gS=Math.max(gS,Y2e.length)),ewe.length===0)return gS;const[LKe,OKe]=EKe.get("icon-size-scale-range"),DKe=ye(1,LKe,OKe);for(const twe of ewe){const rwe=twe.getUnevaluatedProperties();if(rwe._values["icon-image"].value!==void 0){const nwe=J2e.getAppearanceValueAndResolveTokens(twe,"icon-image",X2e,Q2e,[]);if(nwe){const swe=Jf.getResolvedImageFromTokens(nwe);if(swe){const awe=rwe._values["icon-size"],RKe=CM(swe,aS(Jf.zoom,awe,Jf.worldview),awe,Q2e,Jf.zoom,X2e,Jf.pixelRatio,DKe,Jf.worldview),FKe=IKe.get(RKe.iconPrimary.toString());gS=Math.max(gS,oGe(FKe,PKe))}}}}return gS}(Nr,Bu,P0,vt.layout,Wn,Ra,Nr.iconAtlasPositions,mo);Fa=4*pS;let Qf=null;pc.kind==="source"?(Qf=[Kf*vt.layout.get("icon-size").evaluate(Wn,{},Ra)*da.iconScaleFactor],Qf[0]>Ix&&Kr(`${Nr.layerIds[0]}: Value for "icon-size" is >= ${MM}. Reduce your "icon-size".`)):pc.kind==="composite"&&(Qf=[Kf*da.compositeIconSizes[0].evaluate(Wn,{},Ra)*da.iconScaleFactor,Kf*da.compositeIconSizes[1].evaluate(Wn,{},Ra)*da.iconScaleFactor],(Qf[0]>Ix||Qf[1]>Ix)&&Kr(`${Nr.layerIds[0]}: Value for "icon-size" is >= ${MM}. Reduce your "icon-size".`)),Nr.addSymbols(Nr.icon,Bu,Qf,On,$s,Wn,void 0,Gn,hn,Us.lineStartIndex,Us.lineLength,-1,ga,Ra,ti,Ka,Nr.symbolInstances.length,pS),$o=Nr.icon.placedSymbolArray.length-1,P0&&(Si=4*pS,Nr.addSymbols(Nr.icon,P0,Qf,On,$s,Wn,zu.vertical,Gn,hn,Us.lineStartIndex,Us.lineLength,-1,ga,Ra,ti,Ka,Nr.symbolInstances.length,pS),Uo=Nr.icon.placedSymbolArray.length-1)}for(const pc in Js.horizontal){const Nd=pc,Bu=Js.horizontal[Nd];Ya||(Xd=gr(Bu.text),kn?ai=fle(Bu):Ya=iL(sr,ii,hn,_r,Ur,qr,Bu,bn,vt.layout.get("text-rotate").evaluate(Wn,{},Ra),as,Ri));const P0=Bu.positionedLines.length===1;if(tl+=Ibe(Nr,Gn,hn,Bu,Ga,vt,kn,Wn,as,Us,Js.vertical?zu.horizontal:zu.horizontalOnly,P0?uGe(Js.horizontal):[Nd],hl,$o,da,ga,Ra,Nr.symbolInstances.length,ti),P0)break}Js.vertical&&(kl+=Ibe(Nr,Gn,hn,Js.vertical,Ga,vt,kn,Wn,as,Us,zu.vertical,["vertical"],hl,Uo,da,ga,Ra,Nr.symbolInstances.length,ti));let rl=-1;const qm=(pc,Nd)=>pc?Math.max(pc,Nd):Nd;rl=qm(ai,rl),rl=qm(Ln,rl),rl=qm(Hi,rl);const mg=rl>-1?1:0;Nr.glyphOffsetArray.length>=65535&&Kr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Wn.sortKey!==void 0&&Nr.addToSortKeyRanges(Nr.symbolInstances.length,Wn.sortKey),Nr.symbolInstances.emplaceBack(hn.x,hn.y,ii.x,ii.y,ii.z,hl.right>=0?hl.right:-1,hl.center>=0?hl.center:-1,hl.left>=0?hl.left:-1,hl.vertical>=0?hl.vertical:-1,$o,Uo,Xd,Ya!==void 0?Ya:Nr.collisionBoxArray.length,Ya!==void 0?Ya+1:Nr.collisionBoxArray.length,ci!==void 0?ci:Nr.collisionBoxArray.length,ci!==void 0?ci+1:Nr.collisionBoxArray.length,si!==void 0?si:Nr.collisionBoxArray.length,si!==void 0?si+1:Nr.collisionBoxArray.length,yo||Nr.collisionBoxArray.length,yo?yo+1:Nr.collisionBoxArray.length,_r,tl,kl,Fa,Si,mg,0,vo,uu,rl,0,mo?1:0,Aa)})(f,Jr,bs,Wr,h,g,S,_,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,br,Fe,$,0,fr,rr,Ne,c,C,K,Z,J,ie,ge,Se,kr,Qe,xt,mt)};if(Ue==="line")for(const Wr of $6(c.geometry,0,0,Ir,Ir)){const Jr=iGe(Wr,vr,xr,h.vertical||nr,g,Qt,hr,f.overscaling,Ir);for(const dn of Jr)nr&&_Ge(f,nr.text,Jt,dn)||vn(Wr,dn,J)}else if(Ue==="line-center"){for(const Wr of c.geometry)if(Wr.length>1){const Jr=aGe(Wr,xr,h.vertical||nr,g,Qt,hr);Jr&&vn(Wr,Jr,J)}}else if(c.type==="Polygon")for(const Wr of dM(c.geometry,0)){const Jr=cGe(Wr,16);vn(Wr[0],new Ex(Jr.x,Jr.y,0,0,void 0),J)}else if(c.type==="LineString")for(const Wr of c.geometry)vn(Wr,new Ex(Wr[0].x,Wr[0].y,0,0,void 0),J);else if(c.type==="Point")for(const Wr of c.geometry)for(const Jr of Wr)vn([Jr],new Ex(Jr.x,Jr.y,0,0,void 0),J)}const MM=255,Ix=MM*Kf;function Ibe(f,c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe){const Ue=function(mt,wt,Ct,Pt,Qt,Ft,nr,ur){const hr=[];if(wt.positionedLines.length===0)return hr;const vr=Pt.layout.get("text-rotate").evaluate(Ft,{})*Math.PI/180,br=function(yr){const Pr=yr[0],kr=yr[1],vn=Pr*kr;return vn>0?[Pr,-kr]:vn<0?[-Pr,kr]:Pr===0?[kr,Pr]:[kr,-Pr]}(Ct);let fr=Math.abs(wt.top-wt.bottom);for(const yr of wt.positionedLines)fr-=yr.lineOffset;const xr=wt.positionedLines.length,rr=fr/xr;let Jt=wt.top-Ct[1];for(let yr=0;yrIx&&Kr(`${f.layerIds[0]}: Value for "text-size" is >= ${MM}. Reduce your "text-size".`)):Qe.kind==="composite"&&(xt=[Kf*ie.compositeTextSizes[0].evaluate(L,{},Se)*ie.textScaleFactor,Kf*ie.compositeTextSizes[1].evaluate(L,{},Se)*ie.textScaleFactor],(xt[0]>Ix||xt[1]>Ix)&&Kr(`${f.layerIds[0]}: Value for "text-size" is >= ${MM}. Reduce your "text-size".`)),f.addSymbols(f.text,Ue,xt,z,C,L,K,c,h,$.lineStartIndex,$.lineLength,re,ge,Se,Fe,!1,Ne,Ue.length);for(const mt of Z)J[mt]=f.text.placedSymbolArray.length-1;return 4*Ue.length}function aL(f){for(const c in f)return f[c];return null}function iL(f,c,h,g,_,S,C,L,z,$,K){let Z,J,re,ie;if(Z=K?K.top:C.top,J=K?K.bottom:C.bottom,re=K?K.left:C.left,ie=K?K.right:C.right,ile(C)&&C.collisionPadding){const ge=C.collisionPadding;re-=ge[0],Z-=ge[1],ie+=ge[2],J+=ge[3]}if(z){const ge=new ir(re,Z),Se=new ir(ie,Z),Ne=new ir(re,J),Fe=new ir(ie,J),Ue=qn(z);let Qe=new ir(0,0);$&&(Qe=new ir($[0],$[1])),ge._rotateAround(Ue,Qe),Se._rotateAround(Ue,Qe),Ne._rotateAround(Ue,Qe),Fe._rotateAround(Ue,Qe),re=Math.min(ge.x,Se.x,Ne.x,Fe.x),ie=Math.max(ge.x,Se.x,Ne.x,Fe.x),Z=Math.min(ge.y,Se.y,Ne.y,Fe.y),J=Math.max(ge.y,Se.y,Ne.y,Fe.y)}return f.emplaceBack(c.x,c.y,c.z,h.x,h.y,re,Z,ie,J,L,g,_,S),f.length-1}function fle(f){ile(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 _Ge(f,c,h,g){const _=f.compareText;if(c in _){const S=_[c];for(let C=S.length-1;C>=0;C--)if(g.dist(S[C])Ue&&(Qe(mt,hr,Ct,Pt,nr,ur),Qe(hr,wt,nr,ur,Qt,Ft))}Qe(Z,J,g,S,_,S),Qe(J,re,_,S,_,C),Qe(re,ie,_,C,g,C),Qe(ie,Z,g,C,g,S),ge-=Ue,Se-=Ue,Ne+=Ue,Fe+=Ue;const xt=1/Math.max(Ne-ge,Fe-Se);return{scale:xt,x:ge*xt,y:Se*xt,x2:Ne*xt,y2:Fe*xt,projection:c}}function Lbe(f,{x:c,y:h},g=0){return new ir(((c-g)*f.scale-f.x)*Ir,(h*f.scale-f.y)*Ir)}const bGe=M(new Float32Array(16));class E0{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,h){return{x:0,y:0,z:0}}unproject(c,h){return new p(0,0)}projectTilePoint(c,h,g){return{x:c,y:h,z:0}}locationPoint(c,h,g,_=!0){return c._coordinatePoint(c.locationCoordinate(h,g),_)}pixelsPerMeter(c,h){return X(1,c)*h}pixelSpaceConversion(c,h,g){return 1}farthestPixelDistance(c){return Pbe(c,c.pixelsPerMeter)}pointCoordinate(c,h,g,_){const S=c.horizonLineFromTop(!1),C=new ir(h,Math.max(S,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(C,_))}pointCoordinate3D(c,h,g){const _=new ir(h,g);if(c.elevation)return c.elevation.pointCoordinate(_);{const S=this.pointCoordinate(c,_.x,_.y,0);return[S.x,S.y,S.z]}}isPointAboveHorizon(c,h){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,h.x,h.y);const g=c.horizonLineFromTop();return h.y0?h<-cS+g&&(h=-cS+g):h>cS-g&&(h=cS-g);const C=S/Math.pow(lL(h),_);let L=C*Math.sin(_*c),z=S-C*Math.cos(_*c);return L=.5*(L/Math.PI+.5),z=.5*(z/Math.PI+.5),{x:L,y:this.southernCenter?z:1-z,z:0}}unproject(c,h){c=(2*c-.5)*Math.PI,this.southernCenter&&(h=1-h),h=(2*(1-h)-.5)*Math.PI;const{n:g,f:_}=this,S=_-h,C=Math.sign(S),L=Math.sign(g)*Math.sqrt(c*c+S*S);let z=Math.atan2(c,Math.abs(S))*C;S*g<0&&(z-=Math.PI*Math.sign(c)*C);const $=ye(Ki(z/g)+this.center[0],-180,180),K=ye(Ki(2*Math.atan(Math.pow(_/L,1/g))-cS),-he,he);return new p($,this.southernCenter?-K:K)}}class Obe extends E0{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,h){return{x:B(c),y:H(h),z:0}}unproject(c,h){const g=te(c),_=de(h);return new p(g,_)}}const Dbe=qn(he);class SGe extends E0{project(c,h){const g=(h=qn(h))*h,_=g*g;return{x:.5*((c=qn(c))*(.8707-.131979*g+_*(_*(.003971*g-.001529*_)-.013791))/Math.PI+.5),y:1-.5*(h*(1.007226+g*(.015085+_*(.028874*g-.044475-.005916*_)))/Math.PI+1),z:0}}unproject(c,h){c=(2*c-.5)*Math.PI;let g=h=(2*(1-h)-1)*Math.PI,_=25,S=0,C=g*g;do{C=g*g;const $=C*C;S=(g*(1.007226+C*(.015085+$*(.028874*C-.044475-.005916*$)))-h)/(1.007226+C*(.045255+$*(.259866*C-.311325-.005916*11*$))),g=ye(g-S,-Dbe,Dbe)}while(Math.abs(S)>1e-6&&--_>0);C=g*g;const L=ye(Ki(c/(.8707+C*(C*(C*C*C*(.003971-.001529*C)-.013791)-.131979))),-180,180),z=Ki(g);return new p(L,z)}}const Rbe=qn(he);class CGe extends E0{project(c,h){h=qn(h),c=qn(c);const g=Math.cos(h),_=2/Math.PI,S=Math.acos(g*Math.cos(c/2)),C=Math.sin(S)/S,L=.5*(c*_+2*g*Math.sin(c/2)/C)||0,z=.5*(h+Math.sin(h)/C)||0;return{x:.5*(L/Math.PI+.5),y:1-.5*(z/Math.PI+1),z:0}}unproject(c,h){let g=c=(2*c-.5)*Math.PI,_=h=(2*(1-h)-1)*Math.PI,S=25;const C=1e-6;let L=0,z=0;do{const $=Math.cos(_),K=Math.sin(_),Z=2*K*$,J=K*K,re=$*$,ie=Math.cos(g/2),ge=Math.sin(g/2),Se=2*ie*ge,Ne=ge*ge,Fe=1-re*ie*ie,Ue=Fe?1/Fe:0,Qe=Fe?Math.acos($*ie)*Math.sqrt(1/Fe):0,xt=.5*(2*Qe*$*ge+2*g/Math.PI)-c,mt=.5*(Qe*K+_)-h,wt=.5*Ue*(re*Ne+Qe*$*ie*J)+1/Math.PI,Ct=Ue*(Se*Z/4-Qe*K*ge),Pt=.125*Ue*(Z*ge-Qe*K*re*Se),Qt=.5*Ue*(J*ie+Qe*Ne*$)+.5,Ft=Ct*Pt-Qt*wt;L=(mt*Ct-xt*Qt)/Ft,z=(xt*Pt-mt*wt)/Ft,g=ye(g-L,-Math.PI,Math.PI),_=ye(_-z,-Rbe,Rbe)}while((Math.abs(L)>C||Math.abs(z)>C)&&--S>0);return new p(Ki(g),Ki(_))}}class Fbe extends E0{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(qn(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(c,h){const{scale:g,cosPhi:_}=this;return{x:qn(c)*_*g+.5,y:-Math.sin(qn(h))/_*g+.5,z:0}}unproject(c,h){const{scale:g,cosPhi:_}=this,S=-(h-.5)/g,C=ye(Ki((c-.5)/g)/_,-180,180),L=Math.asin(ye(S*_,-1,1)),z=ye(Ki(L),-he,he);return new p(C,z)}}class MGe extends Obe{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,h,g){const _=sM(c,h,g);return at(_,_,I6(Qh(g))),{x:_[0],y:_[1],z:_[2]}}locationPoint(c,h,g){const _=k0(h.lat,h.lng),S=Ve([],_),C=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(h),c._centerAltitude):c._centerAltitude;Xe(_,_,S,X(1,0)*Ir*C);const L=M(new Float64Array(16));return T(L,c.pixelMatrix,c.globeMatrix),at(_,_,L),new ir(_[0],_[1])}pixelsPerMeter(c,h){return X(1,0)*h}pixelSpaceConversion(c,h,g){const _=X(1,c)*h,S=zn(X(1,45)*h,_,g);return this.pixelsPerMeter(c,h)/S}createTileMatrix(c,h,g){const _=voe(Qh(g.canonical));return T(new Float64Array(16),c.globeMatrix,_)}createInversionMatrix(c,h){const{center:g}=c,_=I6(Qh(h));return U(_,_,qn(g.lng)),D(_,_,qn(g.lat)),F(_,_,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(_)}pointCoordinate(c,h,g,_){return S0(c,h,g,!0)||new We(0,0)}pointCoordinate3D(c,h,g){const _=this.pointCoordinate(c,h,g,0);return[_.x,_.y,_.z]}isPointAboveHorizon(c,h){return!S0(c,h.x,h.y,!1)}farthestPixelDistance(c){const h=function(_,S){const C=_.cameraToCenterDistance,L=_._centerAltitude*S,z=_._camera,$=_._camera.forward(),K=ue([],ve([],$,-C),[0,0,L]),Z=_.worldSize/(2*Math.PI),J=[0,0,-Z],re=_.width/_.height,ie=Math.tan(_.fovAboveCenter),ge=ve([],z.up(),ie),Se=ve([],z.right(),ie*re),Ne=Ve([],ue([],ue([],$,ge),Se)),Fe=[];let Ue;if(new an(K,Ne).closestPointOnSphere(J,Z,Fe)){const Qe=ue([],Fe,J),xt=je([],Qe,K);Ue=Math.cos(_.fovAboveCenter)*fe(xt)}else{const Qe=je([],K,J),xt=je([],J,K);Ve(xt,xt);const mt=fe(Qe)-Z;Ue=Math.sqrt(mt*(mt+2*Z));const wt=Math.acos(Ue/(Z+mt))-Math.acos(ot($,xt));Ue*=Math.cos(wt)}return 1.01*Ue}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=C0(c.zoom);if(g>0){const _=Pbe(c,X(1,c.center.lat)*c.worldSize),S=c.worldSize/(2*Math.PI),C=Math.max(c.width,c.height)/c.worldSize*Math.PI;return zn(h,_+S*(1-Math.cos(C)),Math.pow(g,10))}return h}upVector(c,h,g){return sM(h,g,c,1)}upVectorScale(c){return{metersToTile:$m(E6(Qh(c)))}}}function zbe(f){const c=f.parallels,h=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new Obe(f);case"equirectangular":return new kGe(f);case"naturalEarth":return new SGe(f);case"equalEarth":return new jGe(f);case"winkelTripel":return new CGe(f);case"albers":return h?new Fbe(f):new wGe(f);case"lambertConformalConic":return h?new Fbe(f):new NGe(f);case"globe":return new MGe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const TGe=Dt.types,AGe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function LM(f,c,h,g,_,S,C,L,z,$,K,Z,J){const re=L?Math.min(Ix,Math.round(L[0])):0,ie=L?Math.min(Ix,Math.round(L[1])):0;f.emplaceBack(c,h,Math.round(32*g),Math.round(32*_),S,C,(re<<1)+(z?1:0),0+(ie<<1),16*$,16*K,256*Z,256*J)}function OM(f,c,h){f.emplaceBack(c,h)}function DM(f,c,h,g,_,S,C){f.emplaceBack(c,h,g,_,S,C)}const cL=(f,c,h,g)=>{for(let _=0;_0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,FWe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,LWe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||S)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,DWe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,RWe.members,!0)),this.opacityVertexBuffer.itemSize=1),(g||_)&&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())}}nn(ple,"SymbolBuffers");class gle{constructor(c,h,g){this.layoutVertexArray=new c,this.layoutAttributes=h,this.indexArray=new g,this.segments=new Ui,this.collisionVertexArray=new q5,this.collisionVertexArrayExt=new og}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,zWe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,BWe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}nn(gle,"CollisionBuffers");class dL{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(C=>C.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=M([]),this.placementViewportMatrix=M([]);const h=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=aS(this.zoom,h["text-size"],this.worldview),this.iconSizeData=aS(this.zoom,h["icon-size"],this.worldview);const g=this.layers[0].layout,_=g.get("symbol-sort-key"),S=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=S!=="viewport-y"&&_.constantOr(1)!==void 0,this.sortFeaturesByY=(S==="viewport-y"||S==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(C=>zu[C]),this.stateDependentLayerIds=this.layers.filter(C=>C.isStateDependent()).map(C=>C.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 h=this.layers[0].getAppearances();return!(!h||h.length===0)&&h.some(g=>g.getProperty(c)!=null)}createArrays(){this.text=new ple(new Yh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new ple(new Yh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new $N,this.lineVertexArray=new S6,this.symbolInstances=new Y5}calculateGlyphDependencies(c,h,g,_,S){for(const C of c){const L=C.codePointAt(0);if(L===void 0)break;if(h[L]=!0,_&&S&&L<=65535){const z=jM[C];z&&(h[z.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,h,g,_,S,C){let L=1;const z=c.getUnevaluatedProperties()._values["icon-size"],$=aS(this.zoom,z,this.worldview),K=iS($,h);if($.kind!=="constant"&&$.kind!=="camera"||(L=K.uSize),$.kind==="composite"){const{minZoom:Z,maxZoom:J}=$,re=z.possiblyEvaluate(new li(Z,{worldview:this.worldview}),_),ie=z.possiblyEvaluate(new li(J,{worldview:this.worldview}),_),ge=re.evaluate(g,{},_,S);L=ge+(ie.evaluate(g,{},_,S)-ge)*K.uSizeT}return $.kind==="source"&&(L=z.possiblyEvaluate(new li(this.zoom,{worldview:this.worldview}),_).evaluate(g,{},_,S)),L*C}updateFootprints(c,h){}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const g=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!F6(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?_d.build(c):c}populate(c,h,g,_){const S=this.layers[0],C=S.layout,L=this.projection.name==="globe",z=C.get("text-font"),$=C.get("text-field"),K=C.get("icon-image"),[Z,J]=C.get("icon-size-scale-range"),re=ye(h.scaleFactor||1,Z,J),ie=($.value.kind!=="constant"||$.value.value instanceof vd&&!$.value.value.isEmpty()||$.value.value.toString().length>0)&&(z.value.kind!=="constant"||z.value.value.length>0),ge=K.value.kind!=="constant"||!!K.value.value||Object.keys(K.parameters).length>0,Se=this.hasAnyAppearanceProperty("icon-image"),Ne=C.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!ie&&!ge&&!Se)return;const Fe=h.iconDependencies,Ue=h.glyphDependencies,Qe=h.availableImages,xt=new li(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),mt=wt=>{const Ct=wt.id.toString();Fe.has(Ct)?Fe.get(Ct).push(wt):Fe.set(Ct,[wt])};for(const wt of c){const{feature:Ct,id:Pt,index:Qt,sourceLayerIndex:Ft}=wt,nr=S._featureFilter.needGeometry,ur=Rt(Ct,nr);if(!S._featureFilter.filter(xt,ur,g))continue;if(nr||(ur.geometry=St(Ct,g,_)),L&&Ct.type!==1&&g.z<=5){const yr=ur.geometry,Pr=.98078528056,kr=(vn,Wr)=>ot(sM(vn.x,vn.y,g,1),sM(Wr.x,Wr.y,g,1)){if(!yr.getProperty("icon-image"))return;const Pr=this.getCombinedIconPrimary(yr,br,ur,g,Qe,rr,re);Pr&&mt(Pr)}),hr){const yr=z.evaluate(ur,{},g).join(","),Pr=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(zu.vertical)>=0;for(const kr of hr.sections)if(kr.image){const vn=kr.image.getPrimary().scaleSelf(this.pixelRatio),Wr=vn.id.toString(),Jr=Fe.get(Wr)||[];Jr.push(vn),Fe.set(Wr,Jr)}else{const vn=r_(hr.toString()),Wr=kr.fontStack||yr,Jr=Ue[Wr]=Ue[Wr]||{};this.calculateGlyphDependencies(kr.text,Jr,Pr,this.allowVerticalPlacement,vn)}}}if(C.get("symbol-placement")==="line"&&(this.features=function(wt){const Ct={},Pt={},Qt=[];let Ft=0;function nr(br){Qt.push(wt[br]),Ft++}function ur(br,fr,xr){const rr=Pt[br];return delete Pt[br],Pt[fr]=rr,Qt[rr].geometry[0].pop(),Qt[rr].geometry[0]=Qt[rr].geometry[0].concat(xr[0]),rr}function hr(br,fr,xr){const rr=Ct[fr];return delete Ct[fr],Ct[br]=rr,Qt[rr].geometry[0].shift(),Qt[rr].geometry[0]=xr[0].concat(Qt[rr].geometry[0]),rr}function vr(br,fr,xr){const rr=xr?fr[0][fr[0].length-1]:fr[0][0];return`${br}:${rr.x}:${rr.y}`}for(let br=0;brbr.geometry)}(this.features)),C.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",h.elevationFeatures){!this.elevationFeatures&&h.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const wt of h.elevationFeatures)this.elevationFeatureIdToIndex.set(wt.id,this.elevationFeatures.length),this.elevationFeatures.push(wt)}}else C.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((wt,Ct)=>wt.sortKey-Ct.sortKey)}getCombinedIconPrimary(c,h,g,_,S,C,L){let z,$;const K=c.getUnevaluatedProperties();if(K._values["icon-image"].value!==void 0){const Z=h.getAppearanceValueAndResolveTokens(c,"icon-image",g,_,S);z=this.getResolvedImageFromTokens(Z)}else{const Z=h.getValueAndResolveTokens("icon-image",g,_,S);z=this.getResolvedImageFromTokens(Z)}if(z){const Z=K._values["icon-size"]||h._unevaluatedLayout._values["icon-size"];$=CM(z,aS(this.zoom,Z,this.worldview),Z,_,this.zoom,C,this.pixelRatio,L,this.worldview).iconPrimary}return $}updateAppearanceBasedIconTextures(c,h,g,_){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const S=this.layers[0];let C=!1,L=0;const z=S.layout,[$,K]=z.get("icon-size-scale-range"),Z=ye(1,$,K);for(let J=0;J=0){const Se=ge.id,Ne=h&&Se!==void 0?h[String(Se)]:void 0,Fe={type:"Point",id:ge.id,properties:ge.properties,geometry:[]},Ue=this.layers[0].appearances&&this.layers[0].appearances.find(Qe=>Qe.isActive({globals:_,feature:Fe,canonical:c,featureState:Ne}));if(ge.activeAppearance===Ue){L+=re.numIconVertices;continue}if(Ue){ge.activeAppearance=Ue;const Qe=this.getCombinedIconPrimary(Ue,S,Fe,c,g,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:ge.properties,type:"Point",id:ge.id},Z);if(!Qe)continue;const xt=Qe.toString(),mt=this.iconAtlasPositions&&this.iconAtlasPositions.get(xt);if(mt){const wt=S.getAppearanceValueAndResolveTokens(Ue,"icon-offset",Fe,c,g),Ct=wt&&Array.isArray(wt)?wt:[0,0];let Pt=eL(mt,void 0,Ct,S.layout.get("icon-anchor").evaluate(Fe,{},c));const Qt=S.getAppearanceValueAndResolveTokens(Ue,"icon-rotate",Fe,c,g),Ft=typeof Qt=="number"?Qt:0,nr=mt.sdf,ur=S.layout.get("icon-text-fit").constantOr("none");ur!=="none"&&ge.textShaping&&ge.iconTextFitPadding&&ge.fontScale&&(Pt=ole(Pt,ge.textShaping,ur,ge.iconTextFitPadding,Ct,ge.fontScale));const hr=this.calculateEffectiveAppearanceIconSize(Ue,_.zoom,Fe,c,g,Z),vr=0,br=1+(Math.min(Ix,Math.round(hr*Kf))<<1),fr=ule(Pt,Ft,nr,ur!=="none",Z);ge.isUsingAppearanceVertexData||(ge.isUsingAppearanceVertexData=!0,ge.layoutBasedVertexData=this.icon.getIconVertexData(L,re.numIconVertices));for(let rr=0;rr0&&(this.icon.updateIconVertexData(L,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+3,0,0,0,0,0,0,0,0,0,0,0,0),C=!0),L+=re.numIconVertices,ge.activeAppearance=null;else if(ge.isUsingAppearanceVertexData){const xt=ge.layoutBasedVertexData.length/12;for(let mt=0;mt0||J>0,Se=re>0,Ne=this.elevationFeatures[z.elevationFeatureIndex];if(Ne){const Fe=new ir(z.tileAnchorX,z.tileAnchorY),Ue=.075+Ne.pointElevation(Fe);z.zOffset!==Ue&&(h=!0,z.zOffset=Ue),Ue!==0&&(this.hasAnyZOffset=!0);const Qe=Ne.computeSlopeNormal(Fe,_),xt=Zr(tt(),se(0,0,1),Qe);qe($,$,xt),qe(K,K,xt),$[2]*=g,K[2]*=g,$[0]===1&&$[1]===0&&$[2]===0&&K[0]===0&&K[1]===1&&K[2]===0||(S=S||ge,C=C||Se)}if(ge&&(cL(this.text.orientationVertexArray,Z,$,K),cL(this.text.orientationVertexArray,J,$,K)),Se){const{placedIconSymbolIndex:Fe,verticalPlacedIconSymbolIndex:Ue}=z;Fe>=0&&cL(this.icon.orientationVertexArray,re,$,K),Ue>=0&&cL(this.icon.orientationVertexArray,ie,$,K)}}S||(this.text.orientationVertexArray=void 0),C||(this.icon.orientationVertexArray=void 0),h&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(S,C,L)=>{g+=C,g>S.length&&S.resize(g);for(let z=-C;z<0;z++)S.emplace(z+g,L)},h=(S,C,L)=>{_+=C,_>S.length&&S.resize(_);for(let z=-C;z<0;z++)S.emplace(z+_,L)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,_=0;for(let S=0;S0;if((L>0||z>0)&&(c(this.text.zOffsetVertexArray,L,K),c(this.text.zOffsetVertexArray,z,K)),Z){const{placedIconSymbolIndex:J,verticalPlacedIconSymbolIndex:re}=C;J>=0&&h(this.icon.zOffsetVertexArray,$,K),re>=0&&h(this.icon.zOffsetVertexArray,C.numVerticalIconVertices,K)}}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,h,g,_,S){!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(C=>C.appearances&&C.appearances.length>0)),this.icon.upload(c,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(c,h,g,_){return!!(c&&h&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,h,g,_)&&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=zbe(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,h){const g=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:_,y:S}of h)this.lineVertexArray.emplaceBack(_,S);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge,Se,Ne,Fe){const Ue=c.indexArray,Qe=c.layoutVertexArray,xt=c.globeExtVertexArray,mt=c.segments.prepareSegment(4*Fe,Qe,Ue,this.canOverlap?C.sortKey:void 0),wt=this.glyphOffsetArray.length,Ct=mt.vertexLength,Pt=this.allowVerticalPlacement&&L===zu.vertical?Math.PI/2:0,Qt=C.text&&C.text.sections;for(let ur=0;ur=0?h.rightJustifiedTextSymbolIndex:h.centerJustifiedTextSymbolIndex>=0?h.centerJustifiedTextSymbolIndex:h.leftJustifiedTextSymbolIndex>=0?h.leftJustifiedTextSymbolIndex:h.verticalPlacedTextSymbolIndex>=0?h.verticalPlacedTextSymbolIndex:_),C=lle(this.textSizeData,c,S)/jl;return this.tilePixelRatio*C}getSymbolInstanceIconSize(c,h,g){const _=this.icon.placedSymbolArray.get(g),S=lle(this.iconSizeData,c,_);return this.tilePixelRatio*S}_commitDebugCollisionVertexUpdate(c,h,g,_){c.emplaceBack(h,-g,-g,_),c.emplaceBack(h,g,-g,_),c.emplaceBack(h,g,g,_),c.emplaceBack(h,-g,g,_)}_updateTextDebugCollisionBoxes(c,h,g,_,S,C,L){for(let z=_;z0}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,h){const g=c.placedSymbolArray.get(h),_=g.vertexStartIndex+4*g.numGlyphs;for(let S=g.vertexStartIndex;S<_;S+=4)c.indexArray.emplaceBack(S,S+1,S+2),c.indexArray.emplaceBack(S+1,S+2,S+3)}getSortedSymbolIndexes(c){if(this.sortedAngle===c&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(c),g=Math.cos(c),_=[],S=[],C=[];for(let L=0;L_[L]-_[z]||S[z]-S[L]),C}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let c=0;cthis.symbolInstances.get(h).zOffset-this.symbolInstances.get(c).zOffset)}addToSortKeyRanges(c,h){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===h?g.symbolInstanceEnd=c+1:this.sortKeyRanges.push({sortKey:h,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 h of this.symbolInstanceIndexes){const g=this.symbolInstances.get(h);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:S,leftJustifiedTextSymbolIndex:C,verticalPlacedTextSymbolIndex:L,placedIconSymbolIndex:z,verticalPlacedIconSymbolIndex:$}=g;_>=0&&this.addIndicesForPlacedSymbol(this.text,_),S>=0&&S!==_&&this.addIndicesForPlacedSymbol(this.text,S),C>=0&&C!==S&&C!==_&&this.addIndicesForPlacedSymbol(this.text,C),L>=0&&this.addIndicesForPlacedSymbol(this.text,L),z>=0&&this.addIndicesForPlacedSymbol(this.icon,z),$>=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 h=this.symbolInstances.get(this.text.symbolInstanceIndices[c]).elevationFeatureIndex;let g;return this.elevationFeatures&&hg in f?String(f[g]):"")}let $be,Ube,xle;nn(dL,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),dL.addDynamicAttributes=dS;class qbe{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Hh,this.defaultValue=c}evaluate(c){if(c.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(c.formattedSection))return h.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}}nn(qbe,"FormatSectionOverride",{omit:["defaultValue"]});const yle=()=>xle||(xle={layout:$be||($be=new to({"symbol-placement":new Cr(Bt.layout_symbol["symbol-placement"]),"symbol-spacing":new Cr(Bt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Cr(Bt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new zr(Bt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Cr(Bt.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Cr(Bt.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Cr(Bt.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Cr(Bt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Cr(Bt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Cr(Bt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Cr(Bt.layout_symbol["icon-rotation-alignment"]),"icon-size":new zr(Bt.layout_symbol["icon-size"]),"icon-size-scale-range":new Cr(Bt.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new zr(Bt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new zr(Bt.layout_symbol["icon-text-fit-padding"]),"icon-image":new zr(Bt.layout_symbol["icon-image"]),"icon-image-use-theme":new Cr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new zr(Bt.layout_symbol["icon-rotate"]),"icon-padding":new Cr(Bt.layout_symbol["icon-padding"]),"icon-keep-upright":new Cr(Bt.layout_symbol["icon-keep-upright"]),"icon-offset":new zr(Bt.layout_symbol["icon-offset"]),"icon-anchor":new zr(Bt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Cr(Bt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Cr(Bt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Cr(Bt.layout_symbol["text-rotation-alignment"]),"text-field":new zr(Bt.layout_symbol["text-field"]),"text-font":new zr(Bt.layout_symbol["text-font"]),"text-size":new zr(Bt.layout_symbol["text-size"]),"text-size-scale-range":new Cr(Bt.layout_symbol["text-size-scale-range"]),"text-max-width":new zr(Bt.layout_symbol["text-max-width"]),"text-line-height":new zr(Bt.layout_symbol["text-line-height"]),"text-letter-spacing":new zr(Bt.layout_symbol["text-letter-spacing"]),"text-justify":new zr(Bt.layout_symbol["text-justify"]),"text-radial-offset":new zr(Bt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Cr(Bt.layout_symbol["text-variable-anchor"]),"text-anchor":new zr(Bt.layout_symbol["text-anchor"]),"text-max-angle":new Cr(Bt.layout_symbol["text-max-angle"]),"text-writing-mode":new Cr(Bt.layout_symbol["text-writing-mode"]),"text-rotate":new zr(Bt.layout_symbol["text-rotate"]),"text-padding":new Cr(Bt.layout_symbol["text-padding"]),"text-keep-upright":new Cr(Bt.layout_symbol["text-keep-upright"]),"text-transform":new zr(Bt.layout_symbol["text-transform"]),"text-offset":new zr(Bt.layout_symbol["text-offset"]),"text-allow-overlap":new Cr(Bt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Cr(Bt.layout_symbol["text-ignore-placement"]),"text-optional":new Cr(Bt.layout_symbol["text-optional"]),visibility:new Cr(Bt.layout_symbol.visibility)})),paint:Ube||(Ube=new to({"icon-opacity":new zr(Bt.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new zr(Bt.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new zr(Bt.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new zr(Bt.paint_symbol["text-emissive-strength"]),"icon-color":new zr(Bt.paint_symbol["icon-color"]),"icon-halo-color":new zr(Bt.paint_symbol["icon-halo-color"]),"icon-halo-width":new zr(Bt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new zr(Bt.paint_symbol["icon-halo-blur"]),"icon-translate":new Cr(Bt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Cr(Bt.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Cr(Bt.paint_symbol["icon-image-cross-fade"]),"text-opacity":new zr(Bt.paint_symbol["text-opacity"]),"text-occlusion-opacity":new zr(Bt.paint_symbol["text-occlusion-opacity"]),"text-color":new zr(Bt.paint_symbol["text-color"],{runtimeType:Gd,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new zr(Bt.paint_symbol["text-halo-color"]),"text-halo-width":new zr(Bt.paint_symbol["text-halo-width"]),"text-halo-blur":new zr(Bt.paint_symbol["text-halo-blur"]),"text-translate":new Cr(Bt.paint_symbol["text-translate"]),"text-translate-anchor":new Cr(Bt.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Cr(Bt.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Cr(Bt.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Cr(Bt.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Cr(Bt.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new zr(Bt.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"})}))},xle);class uL extends jd{constructor(c,h,g,_){super(c,yle(),h,g,_,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=M([]),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,h){super.recalculate(c,h),this.appearances&&this.appearances.forEach(_=>{_.recalculate(c,h,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 _=[];for(const S of g)_.indexOf(S)<0&&_.push(S);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(c,h,g,_){return this._saturation===c&&this._contrast===h&&this._brightnessMin===g&&this._brightnessMax===_||(this._colorAdjustmentMatrix=function(S,C,L,z){S=Li(S),C=na(C);const $=N(),K=S/3,Z=1-2*K,J=[Z,K,K,0,K,Z,K,0,K,K,Z,0,0,0,0,1],re=.5-.5*C,ie=z-L;return T($,[ie,0,0,0,0,ie,0,0,0,0,ie,0,L,L,L,1],[C,0,0,0,0,C,0,0,0,0,C,0,re,re,re,1]),T($,$,J),$}(c,h,g,_),this._saturation=c,this._contrast=h,this._brightnessMin=g,this._brightnessMax=_),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,h,g,_){const S=this.layout.get(c).evaluate(h,{},g,_),C=this._unevaluatedLayout._values[c];return C.isDataDriven()||e_(C.value)||!S?S:Bbe(h.properties,S)}getAppearanceValueAndResolveTokens(c,h,g,_,S){const C=c.getProperty(h);if(!C)return;const L=C.evaluate(g,{},_,S),z=c.getUnevaluatedProperties()._values[h];return z.isDataDriven()||e_(z.value)||!L||typeof L!="string"?L:Bbe(g.properties,L)}createBucket(c){return new dL(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of yle().paint.overridableProperties){if(!uL.hasPaintOverride(this.layout,c))continue;const h=this.paint.get(c),g=new qbe(h),_=new xN(g,h.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let S=null;S=h.value.kind==="constant"||h.value.kind==="source"?new p0("source",_):new vx("composite",_,h.value.zoomStops,h.value.interpolationType),this.paint._values[c]=new bx(h.property,S,h.parameters)}}_handleOverridablePaintPropertyUpdate(c,h,g){return!(!this.layout||h.isDataDriven()||g.isDataDriven())&&uL.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,h){const g=c.get("text-field"),_=yle().paint.properties[h];let S=!1;const C=L=>{for(const z of L)if(_.overrides&&_.overrides.hasOverride(z))return void(S=!0)};if(g.value.kind==="constant"&&g.value.value instanceof vd)C(g.value.value.sections);else if(g.value.kind==="source"){const L=$=>{S||($ instanceof If&&wl($.value)===zv?C($.value.sections):$ instanceof Pm?C($.sections):$.eachChild(L))},z=g.value;z._styleExpression&&L(z._styleExpression.expression)}return S}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,h,g){return{config:new cg(this,{zoom:h,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let Vbe,Hbe,Wbe,Gbe;var vle=Bs([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function hL(f,c,h,g,_,S,C,L){const z=[f,c,1,h,g,1,_,S,1],$=[C,L,1],K=v([],z),[Z,J,re]=le($,$,K);return b(z,z,[Z,0,0,0,J,0,0,0,re])}function Kbe(f,c,h,g,_,S,C,L){const z=function($,K,Z,J,re,ie,ge,Se){const Ne=hL(0,0,1,0,1,1,0,1),Fe=hL($,K,Z,J,re,ie,ge,Se);return b(Fe,Fe,v([],Ne))}(f,c,h,g,_,S,C,L);return[z[2]/z[8]/Ir,z[5]/z[8]/Ir]}function mL(f){return[f[0],Math.min(Math.max(f[1],-he),he)]}class Zbe extends Ps{constructor(c,h,g,_){super(),this.id=c,this.dispatcher=g,this.coordinates=h.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(_),this.options=h,this._dirty=!1}load(c,h){if(this._loaded=h||!1,this.fire(new Or("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=e0(this.map._requestManager.transformRequest(this.url,Af.Image),(g,_)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new ns(g)):_&&(this.image=_ instanceof HTMLImageElement?Xo.getImageData(_):_,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 _M(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 Or("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 _M||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 h=c[0][1],g=c[0][1];for(const S of c)S[1]>g&&(g=S[1]),S[1]he?this.onNorthPole=!0:_<-he&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const S=c.map(We.fromLngLat);this.tileID=function(C){let L=1/0,z=1/0,$=-1/0,K=-1/0;for(const ge of C)L=Math.min(L,ge.x),z=Math.min(z,ge.y),$=Math.max($,ge.x),K=Math.max(K,ge.y);const Z=Math.max($-L,K-z),J=Math.max(0,Math.floor(-Math.log2(Z))),re=Math.pow(2,J);let ie=Math.floor((L+$)/2*re);return ie>1&&(ie-=1),new ei(J,ie,Math.floor((z+K)/2*re))}(S),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Or("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof _M||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(c){for(const Ne in this.tiles){const Fe=this.tiles[Ne];Fe.state!=="loaded"&&(Fe.state="loaded",Fe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const h=TM(new ei(0,0,0),this.map.transform.projection),g=[h.projection.project(this.coordinates[0][0],this.coordinates[0][1]),h.projection.project(this.coordinates[1][0],this.coordinates[1][1]),h.projection.project(this.coordinates[2][0],this.coordinates[2][1]),h.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(Ne){const Fe=Ne[1].x-Ne[0].x,Ue=Ne[1].y-Ne[0].y,Qe=Ne[2].x-Ne[1].x,xt=Ne[2].y-Ne[1].y,mt=Ne[3].x-Ne[2].x,wt=Ne[3].y-Ne[2].y,Ct=Ne[0].x-Ne[3].x,Pt=Ne[0].y-Ne[3].y,Qt=Fe*xt-Qe*Ue,Ft=Qe*wt-mt*xt,nr=mt*Pt-Ct*wt,ur=Ct*Ue-Fe*Pt;return Qt>0&&Ft>0&&nr>0&&ur>0||Qt<0&&Ft<0&&nr<0&&ur<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const _=TM(this.tileID,this.map.transform.projection),[S,C,L,z]=this.coordinates.map(Ne=>{const Fe=_.projection.project(Ne[0],Ne[1]);return Lbe(_,Fe)._round()});this.perspectiveTransform=Kbe(S.x,S.y,C.x,C.y,L.x,L.y,z.x,z.y);const $=this._boundsArray=new v0;$.emplaceBack(S.x,S.y,0,0),$.emplaceBack(C.x,C.y,Ir,0),$.emplaceBack(z.x,z.y,0,Ir),$.emplaceBack(L.x,L.y,Ir,Ir),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,vle.members),this.boundsSegments=Ui.simpleSegment(0,0,4,2);const K=[],Z=[mL((J=this.coordinates)[0]),mL(J[1]),mL(J[2]),mL(J[3])];var J;const[re,ie,ge,Se]=function(Ne){let Fe=Ne[0][0],Ue=Fe,Qe=Ne[0][1],xt=Qe;for(let mt=1;mtUe&&(Ue=Ne[mt][0]),Ne[mt][1]xt&&(xt=Ne[mt][1]);return[Fe,Qe,Ue-Fe,xt-Qe]}(Z);{const Ne=new v0,[Fe,Ue,Qe,xt]=function(fr){let xr=fr[0].x,rr=xr,Jt=fr[0].y,yr=Jt;for(let Pr=1;Prrr&&(rr=fr[Pr].x),fr[Pr].yyr&&(yr=fr[Pr].y);return[xr,Jt,rr-xr,yr-Jt]}(g),mt=fr=>[(fr.x-Fe)/Qe,(fr.y-Ue)/xt],[wt,Ct,Pt,Qt]=g.map(mt),Ft=function(fr,xr,rr,Jt,yr,Pr,kr,vn){const Wr=hL(0,0,1,0,1,1,0,1);return b(Wr,Wr,v([],hL(fr,xr,rr,Jt,yr,Pr,kr,vn)))}(wt[0],wt[1],Ct[0],Ct[1],Pt[0],Pt[1],Qt[0],Qt[1]);this.elevatedGlobePerspectiveTransform=Kbe(wt[0],wt[1],Ct[0],Ct[1],Pt[0],Pt[1],Qt[0],Qt[1]);const nr=(fr,xr)=>{K.push(fr.lng);const rr=Math.round((fr.lng-re)/ge*Ir),Jt=Math.round((fr.lat-ie)/Se*Ir),yr=mt(xr),Pr=le([],[yr[0],yr[1],1],Ft),kr=Math.round(Pr[0]/Pr[2]*Ir),vn=Math.round(Pr[1]/Pr[2]*Ir);Ne.emplaceBack(rr,Jt,kr,vn)},ur=g[3].x-g[0].x,hr=g[3].y-g[0].y,vr=g[2].x-g[1].x,br=g[2].y-g[1].y;for(let fr=0;fr<65;fr++){const xr=fr/64,rr=[g[0].x+xr*ur,g[0].y+xr*hr],Jt=[g[1].x+xr*vr,g[1].y+xr*br],yr=Jt[0]-rr[0],Pr=Jt[1]-rr[1];for(let kr=0;kr<65;kr++){const vn=kr/64,Wr={x:rr[0]+yr*vn,y:rr[1]+Pr*vn};nr(h.projection.unproject(Wr.x,Wr.y),Wr)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(Ne,vle.members)}{this.maxLongitudeTriangleSize=0;let Ne=[],Fe=new Qo;const Ue=(Qe,xt,mt)=>{Fe.emplaceBack(Qe,xt,mt);const wt=K[Qe],Ct=K[xt],Pt=K[mt],Qt=Math.min(Math.min(wt,Ct),Pt),Ft=Math.max(Math.max(wt,Ct),Pt)-Qt;Ft>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Ft),Ne.push(Qt+Ft/2)};for(let Qe=0;Qe<64;Qe++)for(let xt=0;xt<64;xt++){const mt=65*Qe+xt,wt=mt+1,Ct=mt+65,Pt=Ct+1;Ue(mt,Ct,wt),Ue(wt,Ct,Pt)}[Ne,Fe]=function(Qe,xt){const mt=Array.from({length:Qe.length},(Pt,Qt)=>Qt);mt.sort((Pt,Qt)=>Qe[Pt]-Qe[Qt]);const wt=[],Ct=new Qo;for(let Pt=0;Pt{C.segments.push({vertexOffset:0,primitiveOffset:Z,vertexLength:h.segments[0].vertexLength,primitiveLength:J,sortKey:void 0,vaos:{}})},z=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-_)<=z){const Z=Pi(g,0,g.length,_+z);return Z===g.length||L(Z,Co(g,Z+1,g.length,_+360-z)-Z),C}_Ir?_-Ir:_,new ir(Math.trunc(_),Math.trunc(g[h+1]))}translationForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+4],g[h+5],g[h+6]]}rotationScaleForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+7],g[h+8],g[h+9],g[h+10],g[h+11],g[h+12],g[h+13],g[h+14],g[h+15]]}transformForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+7],g[h+8],g[h+9],g[h+4],g[h+10],g[h+11],g[h+12],g[h+5],g[h+13],g[h+14],g[h+15],g[h+6],0,0,0,1]}}class wle{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(h=>h.fqid),this.projection=c.projection,this.index=c.index,this.worldview=c.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.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,h){}updateAppearances(c,h,g,_){}populate(c,h,g,_){this.tileToMeter=De(g);const S=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:C,id:L,index:z,sourceLayerIndex:$}of c){const K=L??(C.properties&&C.properties.hasOwnProperty("id")?C.properties.id:void 0),Z=Rt(C,S);if(!this.layers[0]._featureFilter.filter(new li(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const J={id:K,sourceLayerIndex:$,index:z,geometry:S?Z.geometry:St(C,g,_),properties:C.properties,type:C.type,patterns:{}},re=this.addFeature(J,J.geometry,Z);re&&h.featureIndex.insert(C,J.geometry,z,$,this.index,this.instancesPerModel[re].instancedDataArray.length,Ir/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,h=this.layers[0].scope;let g=0;for(const _ of this.modelUris){const S=c.getModel(_,h);if(!S)continue;const C=this.instancesPerModel[_];if(C){const L=.5*Me(S.aabb.max,S.aabb.min)*C.maxScale+C.maxXYTranslationDistance,z=Math.min(Ir,Math.max(L/this.tileToMeter,Ir/32));g=Math.max(z,g)}}return g}update(c,h,g,_){for(const S in this.instancesPerModel){const C=this.instancesPerModel[S];for(const L in c)C.idToFeaturesIndex.hasOwnProperty(L)&&(this.evaluate(C.features[C.idToFeaturesIndex[L]],c[L],C,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const h in this.instancesPerModel){const g=this.instancesPerModel[h];for(const _ of g.features){const S=this.layers[0],C=_.feature,L=this.canonical,z=S.paint.get("model-rotation").evaluate(C,{},L),$=S.paint.get("model-scale").evaluate(C,{},L),K=S.paint.get("model-translation").evaluate(C,{},L);st(_.rotation,z)&&st(_.scale,$)&&st(_.translation,K)||(this.evaluate(_,_.featureStates,g,!0),c=!0)}}return c}updateReplacement(c,h,g,_){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const S=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(F6(this.activeReplacements,S))return!1;this.activeReplacements=S;let C=!1;for(const L in this.instancesPerModel){const z=this.instancesPerModel[L],$=z.instancedDataArray;for(const K of z.features){const Z=K.instancedDataOffset,J=K.instancedDataCount;for(let re=0;reIr;ge=Se?ge-Ir:ge;const Ne=Math.floor(ge),Fe=Math.floor($.float32[ie+1]);let Ue=!1;for(const Qe of this.activeReplacements)if(!Hve(Qe,g,n2e.Model,_)&&!(Qe.min.x>Ne||Ne>Qe.max.x||Qe.min.y>Fe||Fe>Qe.max.y)&&(Ue=Yve(Zve(Ne,Fe,c.canonical,Qe.footprintTileId.canonical),Qe.footprint),Ue))break;$.float32[ie]=Ue?ge+Ir:ge,C=C||Ue!==Se}}}return C}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 h in this.instancesPerModel){const g=this.instancesPerModel[h];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=c.createVertexBuffer(g.instancedDataArray,rWe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(c){for(const g in this.instancesPerModel){const _=this.instancesPerModel[g];_.instancedDataArray.length!==0&&_.instancedDataBuffer&&_.instancedDataBuffer.destroy()}const h=this.layers[0].modelManager;if(c&&h&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)h.removeModel(g,"",!0)}addFeature(c,h,g){const _=this.layers[0],S=_.layout.get("model-id").evaluate(g,{},this.canonical);if(!S)return Kr(`modelId is not evaluated for layer ${_.id} and it is not going to get rendered.`),S;(ble(S,!1)||this.styleDefinedModelURLs[S]!==void 0)&&(this.modelUris.includes(S)||this.modelUris.push(S)),this.instancesPerModel[S]||(this.instancesPerModel[S]=new a2e);const C=this.instancesPerModel[S],L=C.instancedDataArray,z=new s2e(g,L.length);for(const $ of h)for(const K of $){if(K.x<0||K.x>=Ir||K.y<0||K.y>=Ir)continue;if(this.lookupDim!==0){const J=(this.lookupDim-1)/Ir,re=this.lookupDim*(K.y*J|0)+K.x*J|0;if(this.lookup){if(this.lookup[re]!==0)continue;this.lookup[re]=1}}this.instanceCount++;const Z=L.length;L.resize(Z+1),C.instancesEvaluatedElevation.push(0),L.float32[16*Z]=K.x,L.float32[16*Z+1]=K.y}return z.instancedDataCount=C.instancedDataArray.length-z.instancedDataOffset,z.instancedDataCount>0&&(c.id&&(C.idToFeaturesIndex[c.id]=C.features.length),C.features.push(z),this.evaluate(z,{},C,!1)),S}getModelUris(){return this.modelUris}evaluate(c,h,g,_){const S=this.layers[0],C=c.feature,L=this.canonical,z=c.rotation=S.paint.get("model-rotation").evaluate(C,h,L),$=c.scale=S.paint.get("model-scale").evaluate(C,h,L),K=c.translation=S.paint.get("model-translation").evaluate(C,h,L),Z=Object.assign({},S.paint.get("model-color").evaluate(C,h,L));Z.a=S.paint.get("model-color-mix-intensity").evaluate(C,h,L);const J=[];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,ie),this.maxScale=Math.max(Math.max(this.maxScale,$[0]),Math.max($[1],$[2])),D_e(J,z,$);const ge=Math.round(100*Z.a)+Z.b/1.05;for(let Se=0;Se10?this.tileToMeter:De(L,xt)),Ue[Fe+4]=K[0],Ue[Fe+5]=K[1],Ue[Fe+6]=K[2]+Qe,Ue[Fe+7]=J[0],Ue[Fe+8]=J[1],Ue[Fe+9]=J[2],Ue[Fe+10]=J[4],Ue[Fe+11]=J[5],Ue[Fe+12]=J[6],Ue[Fe+13]=J[8],Ue[Fe+14]=J[9],Ue[Fe+15]=J[10],g.instancesEvaluatedElevation[Ne]=K[2]}}}let i2e,o2e;nn(wle,"ModelBucket",{omit:["layers"]}),nn(a2e,"PerModelAttributes"),nn(s2e,"ModelFeature");class uS{constructor(c,h,g){this._demTile=c,this._dem=this._demTile.dem,this._scale=h,this._offset=g}static create(c,h,g){const _=g||c.findDEMTileFor(h);if(!_||!_.dem)return;const S=_.dem,C=_.tileID,L=1<$.fqid),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id),this.modelTraits|=rS.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,_&&(this.modelTraits|=rS.HasMapboxMeshFeatures),S&&(this.modelTraits|=rS.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=C,this.worldview=z,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const $ of h)this.nodesInfo.push(new u2e($)),c2e($,L.featureIndexArray.length,L.grid),L.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,L.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(c,h){for(const g of this.getNodesInfo()){const _=g.node;_.footprint&&h.push({footprint:_.footprint,id:c})}}updateAppearances(c,h,g,_){}update(c){const h=Object.keys(c).length!==0;if(h&&!this.stateDependentLayers.length)return;const g=h?this.stateDependentLayers:this.layers;if(!Pa(c,this.states))for(const _ of g)this.evaluate(_,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 h=this.getNodesInfo();for(const g of h){const _=g.node;this.uploaded?this.updatePbrBuffer(_):Goe(_,c,!0)}for(const g of h)Y6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let h=!1;if(!c.meshes)return h;for(const g of c.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),h=!0);return h}needsReEvaluation(c,h,g){const _=c.transform.projectionOptions,S=c.style.getBrightness(),C=this.brightness!==S;if(!this.uploaded||this.dirty||_.name!==this.projection.name||RM(g.paint.get("model-color").value,C)||RM(g.paint.get("model-color-mix-intensity").value,C)||RM(g.paint.get("model-roughness").value,C)||RM(g.paint.get("model-emissive-strength").value,C)||RM(g.paint.get("model-height-based-emissive-strength-multiplier").value,C)){this.projection=_,this.brightness=S;const L=this.getNodesInfo();for(const z of L)z.state=null;return!0}return!1}evaluateTransform(c,h){if(c.transform.zoom===this.zoom)return;this.zoom=c.transform.zoom;const g=this.getNodesInfo(),_=this.id.canonical;for(const S of g){const C=S.feature;S.evaluatedTranslation=h.paint.get("model-translation").evaluate(C,{},_),S.evaluatedScale=h.paint.get("model-scale").evaluate(C,{},_)}}evaluate(c,h){const g=this.getNodesInfo();for(const _ of g){if(!_.node.meshes)continue;const S=_.feature,C=h&&h[S.id];if(Pa(C,_.state))continue;_.state=structuredClone(C);const L=_.node.meshes&&_.node.meshes[0].featureData,z=_.evaluatedColor[2],$=_.evaluatedRMEA[2],K=this.id.canonical;if(_.hasTranslucentParts=!1,L){for(let Z=0;Z=mt)continue;const fr=jle[br],xr=Math.abs(fr);xr>Ft&&(Qt=fr,Ft=xr,nr=vr,ur=hr)}if(Ft>.1){const hr=1-(mt+.5*Math.abs(nr*ur))/ie;let vr=h._dem.get(Ct,wt)+Qt*hr;const br=h._dem.get(Ct+nr,wt+ur),fr=h._dem.get(Ct-nr,wt-ur,!0);(vr-br)*(vr-fr)>0&&(vr=(br+fr)/2),jle[Pt]=h._dem.set(Ct,wt,vr),w_[Pt]=mt}}}}}L&&(h._demTile.needsDEMTextureUpload=!0,h._dem._timestamp=Xo.now())}setFilter(c){this.filter=c?SN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new li(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const h of c)Y6(h.node),Koe(h.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=h.updateTime;const g=h.getReplacementRegionsForTile(c.toUnwrapped());for(const _ of this.getNodesInfo()){const S=_.node.footprint;_.hiddenByReplacement=!!S&&!g.find(C=>C.footprint===S)}}getHeightAtTileCoord(c,h){const g=[],_=[0,0,0],S=M([]);for(const C of this.getNodesInfo()){const L=C.node.meshes[0],z=L.transformedAabb;if(cz.max[0]||h>z.max[1])continue;if(C.node.hidden===!0)return{height:1/0,maxHeight:C.feature.properties.height,hidden:!1,verticalScale:C.evaluatedScale[2]};I(S,C.node.globalMatrix),_[0]=c,_[1]=h,at(_,_,S);const $=(_[0]-L.aabb.min[0])/(L.aabb.max[0]-L.aabb.min[0])*v_|0,K=Math.min(63,(_[1]-L.aabb.min[1])/(L.aabb.max[1]-L.aabb.min[1])*v_|0)*v_+Math.min(63,$),Z=L.heightmap[K];if(!(Z<0&&C.node.footprint))return C.hiddenByReplacement?void 0:{height:Z,maxHeight:C.feature.properties.height,hidden:!1,verticalScale:C.evaluatedScale[2]};if(C.node.footprint.grid.query(new ir(c,h),new ir(c,h),g),g.length>0)return{height:void 0,maxHeight:C.feature.properties.height,hidden:C.hiddenByReplacement,verticalScale:C.evaluatedScale[2]}}}}function RM(f,c){return f instanceof p0&&!f.isLightConstant&&c}function LGe(f,c,h,g,_,S,C,L){let z=(61440&c|(61440&c)>>4)>>8,$=(3840&c|(3840&c)>>4)>>4,K=240&c|(240&c)>>4;h[3]>0&&(z=zn(z,255*h[0],h[3]),$=zn($,255*h[1],h[3]),K=zn(K,255*h[2],h[3]));const Z=z<<8|$,J=K<<8|Math.floor(255*g[3]),re=function(mt){const wt=ye(mt,0,2);return Math.min(Math.round(.5*wt*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],ie=ye(_[0],0,1),ge=ye(_[1],0,1),Se=ye(_[2],0,1),Ne=ye(_[3],0,1);let Fe,Ue,Qe,xt;if(ie!==ge&&C!==S&&ge!==ie){const mt=C-S;Ue=1/(mt*(ge-ie)),Qe=-(S+mt*ie)/(mt*(ge-ie));const wt=ye(_[4],-1,1);xt=Math.pow(10,wt),Fe=255*Se<<8|255*Ne}else Fe=65535,Ue=0,Qe=1,xt=1;if(f.emplaceBack(Z,J,re,Fe,Ue,Qe,xt),L){const mt=L.length;L.clear();for(let wt=0;wt>16&65535,K=S?z>>16&65535:65535&z,Z=(15&K)<8?15&K:0,J=f.evaluatedRMEA[Z],re=f.evaluatedColor[Z],ie=f.emissionHeightBasedParams[Z];let ge;if(L&&Z===2&&g.lights&&(ge=new RN,ge.resize(10*g.lights.length)),LGe(C.featureArray,$,re,J,ie,C.aabb.min[2],C.aabb.max[2],ge),ge&&L){L=!1;const Se=g.meshes[g.lightMeshIndex];Se.featureArray=ge,Se.featureArray._trim()}}C.featureArray._trim(),_++}}nn(pL,"Tiled3dModelBucket",{omit:["layers"]}),nn(u2e,"Tiled3dModelFeature");const DGe=["id","tile","layer","source","sourceLayer","state"];class j_{constructor(c,h,g,_,S){this.type="Feature",this._vectorTileFeature=c,this._z=h,this._x=g,this._y=_,this.properties=c?c.properties:{},this.id=S}clone(){const c=new j_(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 h of DGe)this[h]!==void 0&&(c[h]=this[h]);return c}}class k_ extends Ps{constructor(c,h,g,_){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=h,this._modelsInfo=new Map}load(){const c=[];for(const h in this._options.models){const g=this._options.models[h],_=this._modelsInfo.get(h);if(_){const S=_.model;S.position=g.position!=null?new p(g.position[0],g.position[1]):new p(0,0),S.orientation=g.orientation!=null?g.orientation:[0,0,0],_.modelSpec=g,k_.applyModelSpecification(S,g),S.computeBoundsAndApplyParent(),this.models.push(S)}else{const S=I_e(this.map._requestManager.transformRequest(g.uri,Af.Model).url).then(C=>{if(!C)return;const L=Yoe(C),z=new R_e(h,g.uri,g.position,g.orientation,L);k_.applyModelSpecification(z,g),z.computeBoundsAndApplyParent(),this.models.push(z),this._modelsInfo.set(h,{modelSpec:g,model:z})}).catch(C=>{this.fire(new ns(new Error(`Could not load model ${h} from ${g.uri}: ${C.message}`)))});c.push(S)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new Or("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(h=>{this._loaded=!0,this.fire(new ns(new Error(`Could not load models: ${h.message}`)))})}static applyModelSpecification(c,h){h.nodeOverrides&&k_.convertNodeOverrides(c,h.nodeOverrides),h.materialOverrides&&k_.convertMaterialOverrides(c,h.materialOverrides),h.nodeOverrideNames&&(c.nodeOverrideNames=[...h.nodeOverrideNames]),h.materialOverrideNames&&(c.materialOverrideNames=[...h.materialOverrideNames]),h.featureProperties&&(c.featureProperties=h.featureProperties)}static convertNodeOverrides(c,h){if(Array.isArray(h)&&h.every(g=>typeof g=="string")){c.nodeOverrideNames=[];for(const g of h)c.nodeOverrideNames.push(g)}else Object.entries(h).forEach(([g,_])=>{const S={orientation:[0,0,0]};if(_.hasOwnProperty("orientation")){const C=_.orientation;C&&(S.orientation=C)}c.nodeOverrides.set(g,S)})}static convertMaterialOverrides(c,h){if(Array.isArray(h)&&h.every(g=>typeof g=="string")){c.materialOverrideNames=[];for(const g of h)c.materialOverrideNames.push(g)}else Object.entries(h).forEach(([g,_])=>{const S={color:new ja(1,1,1),colorMix:0,emissionStrength:0,opacity:1},C=_["model-color"];C!==void 0&&(S.color.r=C[0],S.color.g=C[1],S.color.b=C[2]);const L=_["model-color-mix-intensity"];L!==void 0&&(S.colorMix=L);const z=_["model-emissive-strength"];z!==void 0&&(S.emissionStrength=z);const $=_["model-opacity"];$!==void 0&&(S.opacity=$),c.materialOverrides.set(g,S)})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,h){}serialize(){return this._options}setProperty(c,h){return!1}reload(){const c=Zh(this.id,this.scope);this.map.style.clearSource(c),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(c){this.models=[];const h=new Map;for(const g in c){const _=c[g];if(this._modelsInfo.has(g)){const S=this._modelsInfo.get(g);S&&S.modelSpec.uri===_.uri&&h.set(g,S)}}this._modelsInfo=h,this._options.models=c,this._loaded=!1,this.load()}}function kle(f,c,h,g){const _=1<Qe.polygon).flat());const Se=re?L:null,[Ne,Fe]=__e(S,g,Z,K,$,C,Se,J,ie,S.center.lat,f.tileID.canonical),Ue=f.queryGeometry;return v_e(Ne,Fe,Ue.isPointQuery()?Ue.screenBounds:Ue.screenGeometry)}},building:class extends jd{constructor(f,c,h,g){super(f,{layout:V_e||(V_e=new to({visibility:new Cr(Bt.layout_building.visibility),"building-facade":new zr(Bt.layout_building["building-facade"]),"building-facade-floors":new zr(Bt.layout_building["building-facade-floors"]),"building-facade-unit-width":new zr(Bt.layout_building["building-facade-unit-width"]),"building-facade-window":new zr(Bt.layout_building["building-facade-window"]),"building-roof-shape":new zr(Bt.layout_building["building-roof-shape"]),"building-height":new zr(Bt.layout_building["building-height"]),"building-base":new zr(Bt.layout_building["building-base"]),"building-flood-light-wall-radius":new zr(Bt.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new zr(Bt.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new zr(Bt.layout_building["building-flip-roof-orientation"])})),paint:H_e||(H_e=new to({"building-opacity":new Cr(Bt.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Cr(Bt.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Cr(Bt.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Cr(Bt.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Cr(Bt.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Cr(Bt.paint_building["building-vertical-scale"]),"building-cast-shadows":new Cr(Bt.paint_building["building-cast-shadows"]),"building-color":new zr(Bt.paint_building["building-color"]),"building-emissive-strength":new zr(Bt.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Cr(Bt.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Cr(Bt.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Cr(Bt.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Cr(Bt.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Cr(Bt.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new zr({type:"string",default:"default","property-type":"data-driven"})}))},c,h,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new q_e(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,h,g,_,S,C,L,z){let $=this.layout.get("building-height").evaluate(c,h);const K=this.layout.get("building-base").evaluate(c,h),Z=f.tile.getBucket(this).getFootprint(c);if(Z){if(Z.hiddenFlags!==0)return!1;$=Z.height}const[J,re]=__e(S,g,K,$,new ir(0,0),C,null,[0,0],1,S.center.lat,f.tileID.canonical),ie=f.queryGeometry;return v_e(J,re,ie.isPointQuery()?ie.screenBounds:ie.screenGeometry)}},line:class extends jd{constructor(f,c,h,g){const _=tbe();super(f,_,c,h,g),_.layout&&(this.layout=new wx(_.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 Kv,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(wM)return wM;const h=tbe();return wM=new IWe(h.paint.properties["line-width"].specification),wM.useIntegerZoom=!0,wM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new Joe(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,h){const g=J_e(this);return{config:new cg(this,{zoom:c,lut:h}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,h=rbe(Oc("line-width",this,c),Oc("line-gap-width",this,c)),g=Oc("line-offset",this,c);return h/2+Math.abs(g)+Gl(this.paint.get("line-translate"))}queryIntersectsFeature(f,c,h,g,_,S){if(f.queryGeometry.isAboveHorizon)return!1;const C=Ru(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,f.pixelToTileUnitsFactor),L=f.pixelToTileUnitsFactor/2*rbe(this.paint.get("line-width").evaluate(c,h),this.paint.get("line-gap-width").evaluate(c,h)),z=this.paint.get("line-offset").evaluate(c,h);return z&&(g=function($,K){const Z=[],J=new ir(0,0);for(let re=0;re<$.length;re++){const ie=$[re],ge=[];for(let Se=0;Se=3){for(let ie=0;ie>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function XGe(f,c,h){f===1?(c.rgb_color=vL(h.readVarint()),c.paint="rgb_color"):f===2?(c.linear_gradient_idx=h.readVarint(),c.paint="linear_gradient_idx"):f===3?(c.radial_gradient_idx=h.readVarint(),c.paint="radial_gradient_idx"):f===5?h.readPackedFloat(c.dasharray):f===6?c.dashoffset=h.readFloat():f===7?c.miterlimit=h.readFloat():f===8?c.opacity=h.readVarint():f===9?c.width=h.readFloat():f===10?c.linecap=h.readVarint():f===11&&(c.linejoin=h.readVarint())}function QGe(f,c,h){f===1?c.transform=yL(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(p2e(h,h.readVarint()+h.pos)):f===4?c.x1=h.readFloat():f===5?c.y1=h.readFloat():f===6?c.x2=h.readFloat():f===7&&(c.y2=h.readFloat())}function p2e(f,c){return f.readFields(JGe,{offset:0,opacity:255,rgb_color:Nle},c)}function JGe(f,c,h){f===1?c.offset=h.readFloat():f===2?c.opacity=h.readVarint():f===3&&(c.rgb_color=vL(h.readVarint()))}function eKe(f,c,h){f===1?c.transform=yL(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(p2e(h,h.readVarint()+h.pos)):f===4?c.cx=h.readFloat():f===5?c.cy=h.readFloat():f===6?c.r=h.readFloat():f===7?c.fx=h.readFloat():f===8?c.fy=h.readFloat():f===9&&(c.fr=h.readFloat())}function tKe(f,c,h){f===1?c.transform=yL(h,h.readVarint()+h.pos):f===2?c.clip_path_idx=h.readVarint():f===3&&c.children.push(xL(h,h.readVarint()+h.pos))}function rKe(f,c,h){f===1?c.left=c.top=h.readFloat():f===2?c.width=c.height=h.readFloat():f===3?c.top=h.readFloat():f===4?c.height=h.readFloat():f===5?c.mask_type=h.readVarint():f===6?c.mask_idx=h.readVarint():f===7&&c.children.push(xL(h,h.readVarint()+h.pos))}class nKe{static calculate(c={},h=[]){const g=new Map,_=new Map;if(Object.keys(c).length===0)return g;h.forEach(S=>{_.set(S.name,S.rgb_color||new ja(0,0,0))});for(const[S,C]of Object.entries(c))_.has(S)?g.set(_.get(S).toString(),C):console.warn(`Ignoring unknown image variable "${S}"`);return g}}function hS(f,c=255,h){const g=c/255,_=f.toString(),S=h.has(_)?h.get(_).clone():f.clone();return S.a*=g,S.toString()}function zM(f,c){if(!dh()){const h=document.createElement("canvas");return h.width=f,h.height=c,h}return new OffscreenCanvas(f,c)}let Mle,BM=null;function Tle(f,c,h,g,_){for(const S of g.children)g2e(f,c,h,S,_)}function g2e(f,c,h,g,_){g.group?(f.save(),function(S,C,L,z,$){const K=z.mask_idx!=null?L.masks[z.mask_idx]:null,Z=z.clip_path_idx!=null?L.clip_paths[z.clip_path_idx]:null;if(z.transform&&(C=mS(z.transform).preMultiplySelf(C)),!function(ie,ge,Se){return ie.opacity!==255||ge||Se}(z,Z!=null,K!=null))return void Tle(S,C,L,z,$);const J=zM(S.canvas.width,S.canvas.height),re=J.getContext("2d");Tle(re,C,L,z,$),Z&&j2e(re,C,L,Z),K&&k2e(re,C,L,K,$),S.globalAlpha=z.opacity/255,S.drawImage(J,0,0)}(f,c,h,g.group,_),f.restore()):g.path&&(f.save(),function(S,C,L,z,$){S.setTransform(C),z.paint_order===zGe.PAINT_ORDER_FILL_AND_STROKE?(x2e(S,L,z,$),v2e(S,L,z,$)):(v2e(S,L,z,$),x2e(S,L,z,$))}(f,c,h,g.path,_),f.restore())}function x2e(f,c,h,g){const _=h.fill;if(!_)return;const S=_.opacity/255;switch(f.save(),f.beginPath(),N2e(h,f),_.paint){case"rgb_color":f.fillStyle=hS(_.rgb_color,_.opacity,g);break;case"linear_gradient_idx":{const C=c.linear_gradients[_.linear_gradient_idx];C.transform&&f.setTransform(mS(C.transform).preMultiplySelf(f.getTransform())),f.fillStyle=_2e(f,C,S,g);break}case"radial_gradient_idx":{const C=c.radial_gradients[_.radial_gradient_idx];C.transform&&f.setTransform(mS(C.transform).preMultiplySelf(f.getTransform())),f.fillStyle=b2e(f,C,S,g)}}f.fill(y2e(h)),f.restore()}function y2e(f){return f.rule===Sle.PATH_RULE_NON_ZERO?"nonzero":f.rule===Sle.PATH_RULE_EVEN_ODD?"evenodd":void 0}function v2e(f,c,h,g){const _=h.stroke;if(!_)return;const S=S2e(h);f.lineWidth=_.width,f.miterLimit=_.miterlimit,f.setLineDash(_.dasharray),f.lineDashOffset=_.dashoffset;const C=_.opacity/255;switch(_.paint){case"rgb_color":f.strokeStyle=hS(_.rgb_color,_.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=_2e(f,c.linear_gradients[_.linear_gradient_idx],C,g,!0);break;case"radial_gradient_idx":f.strokeStyle=b2e(f,c.radial_gradients[_.radial_gradient_idx],C,g,!0)}switch(_.linejoin){case gL.LINE_JOIN_MITER_CLIP:case gL.LINE_JOIN_MITER:f.lineJoin="miter";break;case gL.LINE_JOIN_ROUND:f.lineJoin="round";break;case gL.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(_.linecap){case Cle.LINE_CAP_BUTT:f.lineCap="butt";break;case Cle.LINE_CAP_ROUND:f.lineCap="round";break;case Cle.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(S)}function _2e(f,c,h,g,_=!1){if(c.stops.length===1){const J=c.stops[0];return hS(J.rgb_color,J.opacity*h,g)}const{x1:S,y1:C,x2:L,y2:z}=c;let $=new DOMPoint(S,C),K=new DOMPoint(L,z);if(_){const J=mS(c.transform);$=J.transformPoint($),K=J.transformPoint(K)}const Z=f.createLinearGradient($.x,$.y,K.x,K.y);for(const J of c.stops)Z.addColorStop(J.offset,hS(J.rgb_color,J.opacity*h,g));return Z}function b2e(f,c,h,g,_=!1){if(c.stops.length===1){const Ne=c.stops[0];return hS(Ne.rgb_color,Ne.opacity*h,g)}const S=mS(c.transform),{fx:C,fy:L,fr:z,cx:$,cy:K,r:Z}=c;let J=new DOMPoint(C,L),re=new DOMPoint($,K),ie=z,ge=Z;if(_){J=S.transformPoint(J),re=S.transformPoint(re);const Ne=(S.a+S.d)/2;ie=z*Ne,ge=c.r*Ne}const Se=f.createRadialGradient(J.x,J.y,ie,re.x,re.y,ge);for(const Ne of c.stops)Se.addColorStop(Ne.offset,hS(Ne.rgb_color,Ne.opacity*h,g));return Se}function w2e(f,c,h,g){const _=g.transform?mS(g.transform).preMultiplySelf(c):c,S=zM(f.canvas.width,f.canvas.height),C=S.getContext("2d");for(const z of g.children)if(z.group)w2e(C,_,h,z.group);else if(z.path){const $=z.path,K=new Path2D;K.addPath(S2e($),_),C.fill(K,y2e($))}const L=g.clip_path_idx!=null?h.clip_paths[g.clip_path_idx]:null;L&&j2e(C,_,h,L),f.globalCompositeOperation="source-over",f.drawImage(S,0,0)}function j2e(f,c,h,g){const _=zM(f.canvas.width,f.canvas.height);w2e(_.getContext("2d"),c,h,g),f.globalCompositeOperation="destination-in",f.drawImage(_,0,0)}function k2e(f,c,h,g,_){if(g.children.length===0)return;const S=g.mask_idx!=null?h.masks[g.mask_idx]:null;S&&k2e(f,c,h,S,_);const C=f.canvas.width,L=f.canvas.height,z=zM(C,L),$=z.getContext("2d"),K=g.width,Z=g.height,J=g.left,re=g.top,ie=new Path2D,ge=new Path2D;ge.rect(J,re,K,Z),ie.addPath(ge,c),$.clip(ie);for(const Fe of g.children)g2e($,c,h,Fe,_);const Se=$.getImageData(0,0,C,L),Ne=Se.data;if(g.mask_type===h2e.MASK_TYPE_LUMINANCE)for(let Fe=0;Fec[C])return null}else{const L=1/g[C];let z=(f[C]-h[C])*L,$=(c[C]-h[C])*L;if(z>$){const K=z;z=$,$=K}if(z>_&&(_=z),$S)return null}return _}function T2e(f,c,h,g,_,S,C,L,z,$,K){const Z=g-f,J=_-c,re=S-h,ie=C-f,ge=L-c,Se=z-h,Ne=K[1]*Se-K[2]*ge,Fe=K[2]*ie-K[0]*Se,Ue=K[0]*ge-K[1]*ie,Qe=Z*Ne+J*Fe+re*Ue;if(Math.abs(Qe)<1e-15)return null;const xt=1/Qe,mt=$[0]-f,wt=$[1]-c,Ct=$[2]-h,Pt=(mt*Ne+wt*Fe+Ct*Ue)*xt;if(Pt<0||Pt>1)return null;const Qt=wt*re-Ct*J,Ft=Ct*Z-mt*re,nr=mt*J-wt*Z,ur=(K[0]*Qt+K[1]*Ft+K[2]*nr)*xt;return ur<0||Pt+ur>1?null:(ie*Qt+ge*Ft+Se*nr)*xt}function A2e(f,c,h){return(f-c)/(h-c)}function E2e(f,c,h,g,_,S,C,L,z){const $=1<{const Fe=Se?1:0,Ue=(re+1)*ge-Fe,Qe=ie*ge,xt=(ie+1)*ge-Fe;Ne[0]=re*ge,Ne[1]=Qe,Ne[2]=Ue,Ne[3]=xt};let Z=new C2e(z);const J=[];for(let re=0;re=1;z/=2){const re=L[L.length-1];Z=new C2e(z);for(let ie=0;ie0;){const{idx:ie,t:ge,nodex:Se,nodey:Ne,depth:Fe}=re.pop();if(this.leaves[ie]){E2e(Se,Ne,Fe,c,h,g,_,Z,J);const Qe=1<=br[2])return ge}continue}let Ue=0;for(let Qe=0;Qe=$[K[Ct]]&&(K.splice(Ct,0,Qe),wt=!0);wt||(K[Ue]=Qe),Ue++}}for(let Qe=0;Qe=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(c+1)}static pack(c,h){const g=[0,0,0,0],_=bL.getUnpackVector(h);let S=Math.floor((c+_[3])/_[2]);return g[2]=S%256,S=Math.floor(S/256),g[1]=S%256,S=Math.floor(S/256),g[0]=S,g}getPixels(){return new Cve({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,h,g){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,S=h*this.dim+this.dim,C=g*this.dim,L=g*this.dim+this.dim;switch(h){case-1:_=S-1;break;case 1:S=_+1}switch(g){case-1:C=L-1;break;case 1:L=C+1}const z=-h*this.dim,$=-g*this.dim;for(let K=C;K=1;g--){const _=g===1?1:0,S=g===2?1:0;for(let C=0;C>>1^-(1&f[c]);return f}function xKe(f,c){switch(c){case"uint32":return f;case"uint16":for(let h=0;h>4|(61440&g)>>8|(240&_)<<4|61440&_,f[h+1]=15&g|(3840&g)>>4|(15&_)<<8|(3840&_)<<4}return f;case"uint8":for(let h=0;h>6|(192&_)>>4|(192&S)>>2|192&C,f[h+1]=(48&g)>>4|(48&_)>>2|48&S|(48&C)<<2,f[h+2]=(12&g)>>2|12&_|(12&S)<<2|(12&C)<<4,f[h+3]=3&g|(3&_)<<2|(3&S)<<4|(3&C)<<6}return f;default:throw new Error(`Invalid pixel format, "${c}"`)}}nn(bL,"DEMData"),nn(I2e,"DemMinMaxQuadTree",{omit:["dem"]});var Jh=Uint8Array,$M=Uint16Array,yKe=Int32Array,L2e=new Jh([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]),O2e=new Jh([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]),vKe=new Jh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),D2e=function(f,c){for(var h=new $M(31),g=0;g<31;++g)h[g]=c+=1<>1|(21845&ul)<<1;z2e[ul]=((65280&(fS=(61680&(fS=(52428&fS)>>2|(13107&fS)<<2))>>4|(3855&fS)<<4))>>8|(255&fS)<<8)>>1}var UM=function(f,c,h){for(var g=f.length,_=0,S=new $M(c);_>z]=$;return C},qM=new Jh(288);for(ul=0;ul<144;++ul)qM[ul]=8;for(ul=144;ul<256;++ul)qM[ul]=9;for(ul=256;ul<280;++ul)qM[ul]=7;for(ul=280;ul<288;++ul)qM[ul]=8;var B2e=new Jh(32);for(ul=0;ul<32;++ul)B2e[ul]=5;var wKe=UM(qM,9),jKe=UM(B2e,5),Ele=function(f){for(var c=f[0],h=1;hc&&(c=f[h]);return c},Yf=function(f,c,h){var g=c/8|0;return(f[g]|f[g+1]<<8)>>(7&c)&h},Ile=function(f,c){var h=c/8|0;return(f[h]|f[h+1]<<8|f[h+2]<<16)>>(7&c)},kKe=["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"],Xf=function(f,c,h){var g=new Error(c||kKe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Xf),!h)throw g;return g},NKe=new Jh(0),SKe=typeof TextDecoder<"u"&&new TextDecoder;try{SKe.decode(NKe,{stream:!0})}catch{}const CKe={gzip_data:"gzip"};class Um extends Error{constructor(c){super(c),this.name="MRTError"}}const MKe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},$2e={uint32:1,uint16:2,uint8:4},TKe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Ple;class wL{constructor(c=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=c}getLayer(c){const h=this.layers[c];if(!h)throw new Um(`Layer '${c}' not found`);return h}getHeaderLength(c){const h=new Uint8Array(c),g=new DataView(c);if(h[0]!==13)throw new Um("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(c){const h=new Uint8Array(c),g=this.getHeaderLength(c);if(h.length= ${g} but got buffer of length ${h.length}`);const _=new Ple(h.subarray(0,g)).readFields(oKe,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==_.x||this.y!==_.y||this.z!==_.z))throw new Um(`Invalid attempt to parse header ${_.z}/${_.x}/${_.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=_.x,this.y=_.y,this.z=_.z;for(const S of _.layers)this.layers[S.name]=new U2e(S,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const h=[],g=this.getLayer(c.layerName);for(let _ of c.blockIndices){const S=g.dataIndex[_],C=S.firstByte-c.firstByte,L=S.lastByte-c.firstByte;if(g._blocksInProgress.has(_))continue;const z={layerName:g.name,firstByte:C,lastByte:L,pixelFormat:g.pixelFormat,blockIndex:_,blockShape:[S.bands.length].concat(g.bandShape),buffer:g.buffer,codec:S.codec.codec,filters:S.filters.map($=>$.filter)};g._blocksInProgress.add(_),h.push(z)}return new q2e(h,()=>{h.forEach(_=>g._blocksInProgress.delete(_.blockIndex))},(_,S)=>{if(h.forEach(C=>g._blocksInProgress.delete(C.blockIndex)),_)throw _;S.forEach(C=>{this.getLayer(C.layerName).processDecodedData(C)})})}}class U2e{constructor({version:c,name:h,units:g,tileSize:_,pixelFormat:S,buffer:C,dataIndex:L},z){if(this.version=c,this.version!==1)throw new Um(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=h,this.units=g,this.tileSize=_,this.buffer=C,this.pixelFormat=MKe[S],this.dataIndex=L,this.bandShape=[_+2*C,_+2*C,$2e[this.pixelFormat]],this._decodedBlocks=new _L(z?z.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return $2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:c})=>c).flat()}processDecodedData(c){const h=c.blockIndex.toString();this._decodedBlocks.get(h)||this._decodedBlocks.put(h,c.data)}getBlockForBand(c){let h=0;switch(typeof c){case"string":for(const[g,_]of this.dataIndex.entries()){for(const[S,C]of _.bands.entries())if(C===c)return{bandIndex:h+S,blockIndex:g,blockBandIndex:S};h+=_.bands.length}break;case"number":for(const[g,_]of this.dataIndex.entries()){if(c>=h&&cthis.cacheSize)throw new Um(`Number of blocks to decode (${S.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:h,lastByte:g,blockIndices:_}}hasBand(c){const{blockIndex:h}=this.getBlockForBand(c);return h>=0}hasDataForBand(c){const{blockIndex:h}=this.getBlockForBand(c);return h>=0&&!!this._decodedBlocks.get(h.toString())}getBandView(c){const{blockIndex:h,blockBandIndex:g}=this.getBlockForBand(c);if(h<0)throw new Um(`Band not found: ${JSON.stringify(c)}`);const _=this._decodedBlocks.get(h.toString());if(!_)throw new Um(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const S=this.dataIndex[h],C=this.bandShape.reduce(($,K)=>$*K,1),L=g*C,z=_.subarray(L,L+C);return{data:z,bytes:new Uint8Array(z.buffer).subarray(z.byteOffset,z.byteOffset+z.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:S.offset,scale:S.scale}}}wL.setPbf=function(f){Ple=f};class q2e{constructor(c,h,g){this.tasks=c,this._onCancel=h,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,h){this._finalized||(this._onComplete(c,h),this._finalized=!0)}}wL.performDecoding=function(f,c){const h=new Uint8Array(f);return Promise.all(c.tasks.map(g=>{const{layerName:_,firstByte:S,lastByte:C,pixelFormat:L,blockShape:z,blockIndex:$,filters:K,codec:Z}=g,J=h.subarray(S,C+1),re=new Uint32Array(z[0]*z[1]*z[2]);let ie;if(Z!=="gzip_data")throw new Um(`Unhandled codec: ${Z}`);return ie=function(ge,Se){if(!globalThis.DecompressionStream&&Se==="gzip_data")return Promise.resolve(((Qe=function(wt){wt[0]==31&&wt[1]==139&&wt[2]==8||Xf(6,"invalid gzip data");var Ct=wt[3],Pt=10;4&Ct&&(Pt+=2+(wt[10]|wt[11]<<8));for(var Qt=(Ct>>3&1)+(Ct>>4&1);Qt>0;Qt-=!wt[Pt++]);return Pt+(2&Ct)}(Ue=ge))+8>Ue.length&&Xf(6,"invalid gzip data"),function(wt,Ct,Pt,Qt){var Ft=wt.length;if(!Ft||Ct.f&&!Ct.l)return Pt||new Jh(0);var nr=!Pt,ur=nr||Ct.i!=2,hr=Ct.i;nr&&(Pt=new Jh(3*Ft));var vr,br,fr=function(Ka){var Na=Pt.length;if(Ka>Na){var Aa=new Jh(Math.max(2*Na,Ka));Aa.set(Pt),Pt=Aa}},xr=Ct.f||0,rr=Ct.p||0,Jt=Ct.b||0,yr=Ct.l,Pr=Ct.d,kr=Ct.m,vn=Ct.n,Wr=8*Ft;do{if(!yr){xr=Yf(wt,rr,1);var Jr=Yf(wt,rr+1,3);if(rr+=3,!Jr){var dn=wt[(sr=4+((rr+7)/8|0))-4]|wt[sr-3]<<8,bs=sr+dn;if(bs>Ft){hr&&Xf(0);break}ur&&fr(Jt+dn),Pt.set(wt.subarray(sr,bs),Jt),Ct.b=Jt+=dn,Ct.p=rr=8*bs,Ct.f=xr;continue}if(Jr==1)yr=wKe,Pr=jKe,kr=9,vn=5;else if(Jr==2){var Nr=Yf(wt,rr,31)+257,hn=Yf(wt,rr+10,15)+4,Gn=Nr+Yf(wt,rr+5,31)+1;rr+=14;for(var Ks=new Jh(Gn),Js=new Jh(19),cs=0;cs>4)<16)Ks[cs++]=sr;else{var Ur=0,qr=0;for(sr==16?(qr=3+Yf(wt,rr,3),rr+=2,Ur=Ks[cs-1]):sr==17?(qr=3+Yf(wt,rr,7),rr+=3):sr==18&&(qr=11+Yf(wt,rr,127),rr+=7);qr--;)Ks[cs++]=Ur}}var bn=Ks.subarray(0,Nr),kn=Ks.subarray(Nr);kr=Ele(bn),vn=Ele(kn),yr=UM(bn,kr),Pr=UM(kn,vn)}else Xf(1);if(rr>Wr){hr&&Xf(0);break}}ur&&fr(Jt+131072);for(var as=(1<>4;if((rr+=15&Ur)>Wr){hr&&Xf(0);break}if(Ur||Xf(2),$s<256)Pt[Jt++]=$s;else{if($s==256){_s=rr,yr=null;break}var On=$s-254;$s>264&&(On=Yf(wt,rr,(1<<(pa=L2e[cs=$s-257]))-1)+F2e[cs],rr+=pa);var Wn=Pr[Ile(wt,rr)&gs],da=Wn>>4;if(Wn||Xf(3),rr+=15&Wn,kn=bKe[da],da>3){var pa=O2e[da];kn+=Ile(wt,rr)&(1<Wr){hr&&Xf(0);break}ur&&fr(Jt+131072);var ga=Jt+On;if(Jtvr.length)&&(br=vr.length),new Jh(vr.subarray(0,br))):Pt.subarray(0,Jt)}(Ue.subarray(Qe,-8),{i:2},new Jh(((Ne=Ue)[(Fe=Ne.length)-4]|Ne[Fe-3]<<8|Ne[Fe-2]<<16|Ne[Fe-1]<<24)>>>0))));var Ne,Fe,Ue,Qe;const xt=CKe[Se];if(!xt)throw new Error(`Unhandled codec: ${Se}`);const mt=new globalThis.DecompressionStream(xt);return new Response(new Blob([ge]).stream().pipeThrough(mt)).arrayBuffer().then(wt=>new Uint8Array(wt))}(J,Z).then(ge=>(function(Se,Ne){Se.readFields(mKe,Ne)}(new Ple(ge),re),new TKe[L](re.buffer))),ie.then(ge=>{for(let Se=K.length-1;Se>=0;Se--)switch(K[Se]){case"delta_filter":pKe(ge,z);break;case"zigzag_filter":gKe(ge);break;case"bitshuffle_filter":xKe(ge,L);break;default:throw new Um(`Unhandled filter "${K[Se]}"`)}return{layerName:_,blockIndex:$,data:ge}}).catch(ge=>{throw ge})}))},nn(q2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),nn(wL,"MapboxRasterTile"),nn(U2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class V2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let h=0;h=0&&J[3]>=0&&$.insert(z,J[0],J[1],J[2],J[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Vt(new Q6(this.rawTileData)).layers,this.sourceLayerCoder=new V2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const c in this.vtLayers)this.vtFeatures[c]=[]}return this.vtLayers}query(c,h){const{tilespaceGeometry:g,transform:_,tileTransform:S,pixelPosMatrix:C,availableImages:L,worldview:z}=h;this.loadVTLayers(),this.serializedLayersCache.clear();const $=h.queryRadius?h.queryRadius:0,K=g.bufferedTilespaceBounds,Z=this.grid.query(K.min.x,K.min.y,K.max.x,K.max.y,(ge,Se,Ne,Fe)=>kd(g.bufferedTilespaceGeometry,ge-$,Se-$,Ne+$,Fe+$));Z.sort(AKe);let J=null;_.elevation&&Z.length>0&&(J=uS.create(_.elevation,this.tileID));const re={};let ie;for(let ge=0;ge(Fe||(Fe=St(Ue,this.tileID.canonical,S)),Qe.queryIntersectsFeature(g,Ue,xt,Fe,this.z,_,C,J,mt)))}return re}loadMatchingFeature(c,h,g,_,S,C){const{featureIndex:L,bucketIndex:z,sourceLayerIndex:$,layoutVertexArrayOffset:K}=h,Z=this.bucketLayerIDs[z],J=g.layers,re=Object.keys(J);if(re.length&&!Xr(re,Z))return;const ie=g.sourceCache,ge=this.sourceLayerCoder.decode($),Se=this.vtLayers[ge].feature(L),Ne=this.getId(Se,ge);for(let Fe=0;Fe`${L.key}: ${L.message}`).join(", ");return void Kr(`Failed to create expression for promoteId: ${C}`)}this.promoteIdExpression=S.value}g=this.promoteIdExpression.evaluate({zoom:0},c)}else g=c.properties[_];typeof g=="boolean"&&(g=Number(g))}return g}}function W2e(f,c,h,g,_){return Wt(f,(S,C)=>{const L=c instanceof wx?c.get(C):null;return L&&L.evaluate?L.evaluate(h,g,void 0,_):L})}function AKe(f,c){return c-f}nn(H2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const G2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Lle{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,g]=new Uint8Array(c,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const _=g>>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const S=G2e[15&g];if(!S)throw new Error("Unrecognized array type.");const[C]=new Uint16Array(c,2,1),[L]=new Uint32Array(c,4,1);return new Lle(L,C,S,c)}constructor(c,h=64,g=Float64Array,_){if(isNaN(c)||c<0)throw new Error(`Unpexpected numItems value: ${c}.`);this.numItems=+c,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=g,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const S=G2e.indexOf(this.ArrayType),C=2*c*this.ArrayType.BYTES_PER_ELEMENT,L=c*this.IndexArrayType.BYTES_PER_ELEMENT,z=(8-L%8)%8;if(S<0)throw new Error(`Unexpected typed array class: ${g}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+z,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+C+L+z),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+z,2*c),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+S]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=c)}add(c,h){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=c,this.coords[this._pos++]=h,g}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return Ole(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,h,g,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:S,coords:C,nodeSize:L}=this,z=[0,S.length-1,0],$=[];for(;z.length;){const K=z.pop()||0,Z=z.pop()||0,J=z.pop()||0;if(Z-J<=L){for(let Se=J;Se<=Z;Se++){const Ne=C[2*Se],Fe=C[2*Se+1];Ne>=c&&Ne<=g&&Fe>=h&&Fe<=_&&$.push(S[Se])}continue}const re=J+Z>>1,ie=C[2*re],ge=C[2*re+1];ie>=c&&ie<=g&&ge>=h&&ge<=_&&$.push(S[re]),(K===0?c<=ie:h<=ge)&&(z.push(J),z.push(re-1),z.push(1-K)),(K===0?g>=ie:_>=ge)&&(z.push(re+1),z.push(Z),z.push(1-K))}return $}within(c,h,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:S,nodeSize:C}=this,L=[0,_.length-1,0],z=[],$=g*g;for(;L.length;){const K=L.pop()||0,Z=L.pop()||0,J=L.pop()||0;if(Z-J<=C){for(let Se=J;Se<=Z;Se++)Z2e(S[2*Se],S[2*Se+1],c,h)<=$&&z.push(_[Se]);continue}const re=J+Z>>1,ie=S[2*re],ge=S[2*re+1];Z2e(ie,ge,c,h)<=$&&z.push(_[re]),(K===0?c-g<=ie:h-g<=ge)&&(L.push(J),L.push(re-1),L.push(1-K)),(K===0?c+g>=ie:h+g>=ge)&&(L.push(re+1),L.push(Z),L.push(1-K))}return z}}function Ole(f,c,h,g,_,S){if(_-g<=h)return;const C=g+_>>1;K2e(f,c,C,g,_,S),Ole(f,c,h,g,C-1,1-S),Ole(f,c,h,C+1,_,1-S)}function K2e(f,c,h,g,_,S){for(;_>g;){if(_-g>600){const $=_-g+1,K=h-g+1,Z=Math.log($),J=.5*Math.exp(2*Z/3),re=.5*Math.sqrt(Z*J*($-J)/$)*(K-$/2<0?-1:1);K2e(f,c,h,Math.max(g,Math.floor(h-K*J/$+re)),Math.min(_,Math.floor(h+($-K)*J/$+re)),S)}const C=c[2*h+S];let L=g,z=_;for(VM(f,c,g,h),c[2*_+S]>C&&VM(f,c,g,_);LC;)z--}c[2*g+S]===C?VM(f,c,g,z):(z++,VM(f,c,z,_)),z<=h&&(g=z+1),h<=z&&(_=z-1)}}function VM(f,c,h,g){Dle(f,h,g),Dle(c,2*h,2*g),Dle(c,2*h+1,2*g+1)}function Dle(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function Z2e(f,c,h,g){const _=f-h,S=c-g;return _*_+S*S}i.$=Hk,i.A=Ef,i.B=Zh,i.C=2,i.D=QN,i.E=Ps,i.F=NM,i.G=bbe,i.H=Vk,i.I=wa,i.J=f6,i.K=yn,i.L=n0,i.M=pN,i.N=Jv,i.O=t6,i.P=ir,i.Q=e_,i.R=Af,i.S=NN,i.T=Voe,i.U=sg,i.V=fL,i.W=I5,i.X=l0,i.Y=o0,i.Z=Gv,i._=bd,i.a=function(f){return Is.API_CDN_URL_REGEX.test(f)},i.a$=de,i.a0=Hn,i.a1=Il,i.a2=Rm,i.a3=class extends fL{},i.a4=gN,i.a5=e6,i.a6=Bt,i.a7=function(f){const c=f.value;return c?Hn(c)?ble(c,!0)?[]:[new fL(f.key,c,`invalid url "${c}"`)]:[new fL(f.key,c,`string expected, "${yn(c)}" found`)]:[]},i.a8=d6,i.a9=to,i.aA=ye,i.aB=T,i.aC=Ke,i.aD=Pc,i.aE=Ja,i.aF=B,i.aG=Ge,i.aH=function(f,c){const h={};for(let g=0;g{g(S,C)},c):g(S,C),()=>{}}return _.callbacks.push(g),_.cancel||(_.cancel=h((S,C)=>{_.result=[S,C];for(const L of _.callbacks)this.scheduler?this.scheduler.add(()=>{L(S,C)},c):L(S,C);setTimeout(()=>delete this.entries[f],3e3)})),()=>{_.result||(_.callbacks=_.callbacks.filter(S=>S!==g),_.callbacks.length||(_.cancel(),delete this.entries[f]))}}},i.aL=function(f,c,h){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},_=>{const S=Iu(f.request,(C,L,z)=>{C?_(C):L&&_(null,{rawData:L,vectorTile:h?void 0:new Vt(new Q6(L)),responseHeaders:new Map(z.entries())})});return()=>{S.cancel(),_()}},c)},i.aM=function(f){return f?{cacheControl:f.get("Cache-Control"),expires:f.get("Expires")}:{cacheControl:void 0,expires:void 0}},i.aN=yd,i.aO=function(f){Jc++,Jc>Xy&&(f.getActor().send("enforceCacheSizeLimit",Yy),Jc=0)},i.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},i.aQ=Yi,i.aR=Ybe,i.aS=r2e,i.aT=p,i.aU=Zbe,i.aV=function(f,c){const h=document.createElement("video");h.muted=!0,h.onloadstart=function(){c(null,h)};for(let g=0;g{}}},i.aW=_M,i.aX=k_,i.aY=Ot,i.aZ=TM,i.a_=te,i.aa=Cr,i.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return ts(f.expression.evaluate(c))}interpolate(f,c,h){return{x:zn(f.x,c.x,h),y:zn(f.y,c.y,h),z:zn(f.z,c.z,h),azimuthal:zn(f.azimuthal,c.azimuthal,h),polar:zn(f.polar,c.polar,h)}}},i.ac=li,i.ad=vx,i.ae=We,i.af=at,i.ag=fe,i.ah=Pe,i.ai=wx,i.aj=C0,i.ak=zn,i.al=Ir,i.am=t5,i.an=qn,i.ao=ja,i.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([h,g]){const _=ts([1,h,g]);return{x:_.x,y:_.y,z:_.z}}(f.expression.evaluate(c))}interpolate(f,c,h){return{x:zn(f.x,c.x,h),y:zn(f.y,c.y,h),z:zn(f.z,c.z,h)}}},i.aq=function(f,c,h=0,g=!0){const _=new ir(h,h),S=f.sub(_),C=c.add(_),L=[S,new ir(C.x,S.y),C,new ir(S.x,C.y)];return g&&L.push(S.clone()),L},i.ar=function(f,c){const h=[];for(let g=0;g1)return!1;const h=c.getSource().maxzoom,g=1<1)return c;const _=g.getSource().maxzoom,S=1<<_,C=Math.floor(f.x),L=f.x-C,z=new Yi(_,C,_,Math.floor(L*S),Math.floor(f.y*S)),$=this.findDEMTileFor(z);if(!$||!$.dem)return c;const K=$.dem,Z=1<<$.tileID.canonical.z,J=(L*Z-$.tileID.canonical.x)*K.dim,re=(f.y*Z-$.tileID.canonical.y)*K.dim,ie=Math.floor(J),ge=Math.floor(re);return(h?this.exaggeration():1)*zn(zn(K.get(ie,ge),K.get(ie,ge+1),re-ge),zn(K.get(ie+1,ge),K.get(ie+1,ge+1),re-ge),J-ie)}static getAtTileOffset(f,c,h,g){const _=1<{const L=this.getAtTileOffset(f,_,S,C),z=g.upVector(f.canonical,_.x,_.y);return ve(z,z,L*g.upVectorScale(f.canonical,c,h).metersToTile),z}}getForTilePoints(f,c,h,g){if(this.isUsingMockSource())return!1;const _=uS.create(this,f,g);return!!_&&(c.forEach(S=>{S[2]=this.exaggeration()*_.getElevationAt(S[0],S[1],h)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(f);if(!c||!c.dem)return null;const h=c.dem.tree,g=c.tileID,_=1<0&&(g+=(f[_]-0)*(f[_]-0)),c[_]<0&&(g+=(0-c[_])*(0-c[_]));return g},i.c0=Yve,i.c1=ale,i.c2=Mbe,i.c3=mle,i.c4=Lle,i.c5=ve,i.c6=Ce,i.c7=ct,i.c8=function(f,c,h){h*=.5;var g=c[0],_=c[1],S=c[2],C=c[3],L=Math.sin(h),z=Math.cos(h);return f[0]=g*z+_*L,f[1]=_*z-g*L,f[2]=S*z+C*L,f[3]=C*z-S*L,f},i.c9=it,i.cA=pe,i.cB=ka,i.cC=L_e,i.cD=ei,i.cE=uve,i.cF=function(f,c,h,g,_,S,C,L,z){if(z.name==="globe")return uve(f,c,new ei(h,g,_),!1);const $=TM({z:h,x:g,y:_},z);return new xn([(S+$.x/$.scale)*c,c*($.y/$.scale),C],[(S+$.x2/$.scale)*c,c*($.y2/$.scale),L])},i.cG=function(f,c,h){return f[0]=Math.min(c[0],h[0]),f[1]=Math.min(c[1],h[1]),f[2]=Math.min(c[2],h[2]),f[3]=Math.min(c[3],h[3]),f},i.cH=function(f,c,h){return f[0]=Math.max(c[0],h[0]),f[1]=Math.max(c[1],h[1]),f[2]=Math.max(c[2],h[2]),f[3]=Math.max(c[3],h[3]),f},i.cI=function(f){const c=Math.round((f+45+360)%360/90)%4;return dc[c]},i.cJ=he,i.cK=Ze,i.cL=ZN,i.cM=function(f){const c=M(new Float64Array(16));T(c,f.pixelMatrix,f.globeMatrix);const h=[0,gh,0],g=[0,xh,0];return at(h,h,c),at(g,g,c),[h[0]>0&&h[0]<=f.width&&h[1]>0&&h[1]<=f.height&&!boe(f,new p(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!boe(f,new p(f.center.lat,-90))]},i.cN=function(f,c){const{scale:h}=f.tileTransform,g=h*Ir/(f.tileSize*Math.pow(2,c.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(_,S,C){var L=S[1],z=S[2],$=S[3],K=C[0],Z=C[1];return _[0]=S[0]*K,_[1]=L*K,_[2]=z*Z,_[3]=$*Z,_}(new Float32Array(4),c.inverseAdjustmentMatrix,[g,g])},i.cO=W6,i.cP=oe,i.cQ=P_e,i.cR=function(f){const c=P_e(f,!0);return x([],[c[0],c[1],c[4],c[5]])},i.cS=F,i.cT=Hr,i.cU=D,i.cV=function(f){const{x:c,y:h}=f.point,{lng:g,lat:_}=f._center;return fve(c,h,f.worldSize,g,_)},i.cW=Te,i.cX=Ki,i.cY=Vi,i.cZ=fc,i.c_=ph,i.ca=ba,i.cb=function(f,c){return f[0]=-c[0],f[1]=-c[1],f[2]=-c[2],f[3]=c[3],f},i.cc=ae,i.cd=function(f,c,h,g,_){var S=1/Math.tan(c/2);if(f[0]=S/h,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=S,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=-1,f[12]=0,f[13]=0,f[15]=0,_!=null&&_!==1/0){var C=1/(g-_);f[10]=(_+g)*C,f[14]=2*_*g*C}else f[10]=-1,f[14]=-2*g;return f},i.ce=function(f,c,h,g,_,S,C){var L=1/(c-h),z=1/(g-_),$=1/(S-C);return f[0]=-2*L,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*z,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*$,f[11]=0,f[12]=(c+h)*L,f[13]=(_+g)*z,f[14]=(C+S)*$,f[15]=1,f},i.cf=X,i.cg=function(f,c,h){f[4*c+0]=h[0],f[4*c+1]=h[1],f[4*c+2]=h[2],f[4*c+3]=h[3]},i.ch=HN,i.ci=c_,i.cj=Jo,i.ck=Bm,i.cl=u_,i.cm=zbe,i.cn=function(){var f=new m(4);return m!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f},i.co=function(f,c,h){var g=c[0],_=c[1],S=c[2],C=c[3],L=Math.sin(h),z=Math.cos(h);return f[0]=g*z+S*L,f[1]=_*z+C*L,f[2]=g*-L+S*z,f[3]=_*-L+C*z,f},i.cp=function(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]&&f[3]===c[3]},i.cq=st,i.cr=function(f){var c=f[0],h=f[1],g=f[2],_=f[3];return Math.sqrt(c*c+h*h+g*g+_*_)},i.cs=Mr,i.ct=qe,i.cu=Mo,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Oe,i.d=function(f){return Is.API_TILEJSON_REGEX.test(f)},i.d$=class{constructor(f,c,h,g){this.context=f,this.format=g,this.size=h,this.texture=f.gl.createTexture();const[_,S,C]=this.size,{gl:L}=f;L.bindTexture(L.TEXTURE_3D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&L.texImage3D(L.TEXTURE_3D,0,this.format,_,S,C,0,Uoe(this.format),qoe(this.format),c.data)}bind(f,c){const{context:h}=this,{gl:g}=h;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}},i.d0=function(f){return f*f*f*f*f},i.d1=R,i.d2=45,i.d3=WN,i.d4=function(f,c,h){const g=Math.sqrt(f*f+c*c+h*h),_=g>0?Math.acos(h/g)*bi:0;let S=f!==0||c!==0?Math.atan2(-c,-f)*bi+90:0;return S<0&&(S+=360),[g,S,_]},i.d5=se,i.d6=ts,i.d7=De,i.d8=ue,i.d9=xn,i.dA=function(f){return f({pluginStatus:wd,pluginURL:Rf}),jN.on("pluginStateChange",f),f},i.dB=d_,i.dC=class extends Bf{constructor(f){super(f),this.current=GN}set(f,c,h){if(this.fetchUniformLocation(f,c)){for(let g=0;g<9;g++)if(h[g]!==this.current[g]){this.current=h,this.gl.uniformMatrix3fv(this.location,!1,h);break}}}},i.dD=go,i.dE=function(f,c,h){const g=C0(h.zoom),_=f.style.map._antialias,S=f.terrain&&f.terrain.exaggeration()>0;return g===0&&!_&&!S},i.dF=function(f){const c=f.pixelsPerMeter,h=c/X(1,f.center.lat),g=M(new Float64Array(16));return P(g,g,[f.point.x,f.point.y,0]),F(g,g,[h,h,c]),Float32Array.from(g)},i.dG=A6,i.dH=function(f){const c=he-5;f=ye(f,-c,c)/c*90;const h=Math.pow(Math.abs(Math.sin(qn(f))),3);return Math.round(h*(nM.length-1))},i.dI=function(f,c,h,g){const _=c.getNorth(),S=c.getSouth(),C=c.getWest(),L=c.getEast(),z=1<0){const ie=180/g;b(re,re,[ie/$+1,0,0,0,ie/K+1,0,-.5*ie/Z,.5*ie/J,1])}return re[2]=z,re[5]=f.x,re[8]=f.y,re},i.dJ=Qh,i.dK=function(f,c,h){const g=M(new Float64Array(16)),_=(c/(1<({u_matrix:new u_(f),u_texsize:new Bm(f),u_pixels_to_tile_units:new KN(f),u_device_pixel_ratio:new Jo(f),u_width_scale:new Jo(f),u_floor_width_scale:new Jo(f),u_image:new HN(f),u_units_to_pixels:new Bm(f),u_tile_units_to_pixels:new Jo(f),u_alpha_discard_threshold:new Jo(f),u_trim_offset:new Bm(f),u_trim_fade_range:new Bm(f),u_trim_color:new WN(f),u_zbias_factor:new Jo(f),u_tile_to_meter:new Jo(f),u_ground_shadow_factor:new c_(f),u_pattern_transition:new Jo(f)}),i.dX=f=>({u_matrix:new u_(f),u_pixels_to_tile_units:new KN(f),u_device_pixel_ratio:new Jo(f),u_width_scale:new Jo(f),u_floor_width_scale:new Jo(f),u_units_to_pixels:new Bm(f),u_dash_image:new HN(f),u_gradient_image:new HN(f),u_image_height:new Jo(f),u_texsize:new Bm(f),u_tile_units_to_pixels:new Jo(f),u_alpha_discard_threshold:new Jo(f),u_trim_offset:new Bm(f),u_trim_fade_range:new Bm(f),u_trim_color:new WN(f),u_zbias_factor:new Jo(f),u_tile_to_meter:new Jo(f),u_ground_shadow_factor:new c_(f)}),i.dY=f=>({u_camera_to_center_distance:new Jo(f),u_extrude_scale:new KN(f),u_device_pixel_ratio:new Jo(f),u_matrix:new u_(f),u_inv_rot_matrix:new u_(f),u_merc_center:new Bm(f),u_tile_id:new c_(f),u_zoom_transition:new Jo(f),u_up_dir:new c_(f),u_emissive_strength:new Jo(f)}),i.dZ=DN,i.d_=$We,i.da=xe,i.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)]},i.dc=I_e,i.dd=Yoe,i.de=R_e,i.df=ble,i.dg=function(f,c){return f.readFields(BGe,{icons:[]},c)},i.dh=U6,i.di=oS,i.dj=dle,i.dk=Jy,i.dl=n_,i.dm=Gp,i.dn=gr,i.dp=cr,i.dq=function(f){const c=f.indexOf(Nx);return c>=0?f.slice(0,c):f},i.dr=function(f){return f.indexOf(Nx)>=0},i.ds=function(f){const c=f.lastIndexOf(Nx);return c>=0?f.slice(c+1):""},i.dt=function(f){const c=[],h=f.id;return h===void 0&&c.push({message:`layers.${h}: missing required property "id"`}),f.render===void 0&&c.push({message:`layers.${h}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&c.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),c},i.du=function(f,c,h,g){return f.type==="custom"?new PGe(f,c):new FGe[f.type](f,c,h,g)},i.dv=pr,i.dw=function(f){const c=f.indexOf(Nx);return c>=0?f.slice(c+1):""},i.dx=class extends j_{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}},i.dy=jN,i.dz=Am,i.e=Is,i.e$=me,i.e0=xve,i.e1=(f,c,h,g,_,S)=>{const C=f.transform,L=C.projection.name==="globe";let z;if(S.paint.get("circle-pitch-alignment")==="map")if(L){const K=mve(C.zoom,c.canonical)*C._pixelsPerMercatorPixel;z=Float32Array.from([K,0,0,K])}else z=C.calculatePixelsToTileUnitsMatrix(h);else z=new Float32Array([C.pixelsToGLUnits[0],0,0,C.pixelsToGLUnits[1]]);const $={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(C.projection),u_matrix:f.translatePosMatrix(c.projMatrix,h,S.paint.get("circle-translate"),S.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Xo.devicePixelRatio,u_extrude_scale:z,u_inv_rot_matrix:nHe,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:S.paint.get("circle-emissive-strength")};if(L){$.u_inv_rot_matrix=g,$.u_merc_center=_,$.u_tile_id=[c.canonical.x,c.canonical.y,1<{const K=f.transform,Z=K.pitch<15?Y_e(.07,.7,ye((14-K.zoom)/5,0,1)):.07,J=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Q_e(f,c,h,g),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:K.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:_,u_width_scale:S,u_floor_width_scale:C,u_image:0,u_tile_units_to_pixels:X_e(c,K),u_units_to_pixels:[1/K.pixelsToGLUnits[0],1/K.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:L,u_trim_fade_range:h.paint.get("line-trim-fade-range"),u_trim_color:h.paint.get("line-trim-color").toPremultipliedRenderColor(J?null:h.lut).toArray01(),u_zbias_factor:Z,u_tile_to_meter:De(c.tileID.canonical,0),u_ground_shadow_factor:z,u_pattern_transition:$}},i.e5=(f,c,h,g,_,S,C,L,z,$)=>{const K=f.transform,Z=K.calculatePixelsToTileUnitsMatrix(c),J=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=K.pitch<15?Y_e(.07,.7,ye((14-K.zoom)/5,0,1)):.07;return{u_matrix:Q_e(f,c,h,g),u_pixels_to_tile_units:Z,u_device_pixel_ratio:S,u_width_scale:C,u_floor_width_scale:L,u_units_to_pixels:[1/K.pixelsToGLUnits[0],1/K.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:_,u_texsize:ebe(h)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:X_e(c,f.transform),u_alpha_discard_threshold:0,u_trim_offset:z,u_trim_fade_range:h.paint.get("line-trim-fade-range"),u_trim_color:h.paint.get("line-trim-color").toPremultipliedRenderColor(J?null:h.lut).toArray01(),u_zbias_factor:re,u_tile_to_meter:De(c.tileID.canonical,0),u_ground_shadow_factor:$}},i.e6=qt,i.e7=aM,i.e8=ce,i.e9=vh,i.eA=function(f,c){var h=2*Math.acos(c[3]),g=Math.sin(h/2);return g>u?(f[0]=c[0]/g,f[1]=c[1]/g,f[2]=c[2]/g):(f[0]=1,f[1]=0,f[2]=0),h},i.eB=kle,i.eC=Z6,i.eD=K6,i.eE=[1,1,1],i.eF=uS,i.eG=Ee,i.eH=function(f,c,h,g){var _=c[0],S=c[1],C=c[2],L=c[3];return f[0]=_+g*(h[0]-_),f[1]=S+g*(h[1]-S),f[2]=C+g*(h[2]-C),f[3]=L+g*(h[3]-L),f},i.eI=rS,i.eJ=Du,i.eK=zm,i.eL=function(f,c,h,g,_,S,C,L,z,$,K,Z,J,re,ie,ge){var Se=new m(16);return Se[0]=f,Se[1]=c,Se[2]=h,Se[3]=g,Se[4]=_,Se[5]=S,Se[6]=C,Se[7]=L,Se[8]=z,Se[9]=$,Se[10]=K,Se[11]=Z,Se[12]=J,Se[13]=re,Se[14]=ie,Se[15]=ge,Se},i.eM=w,i.eN=b0,i.eO=G5,i.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 h=Gve(new ir(0,0),new ir(Ir,Ir),f),g=[];if(c&&!Aoe(h,this._globalClipBounds))return g;for(const _ of this._activeRegions){if(_.hiddenByOverlap||!Aoe(h,_))continue;const S=IHe(_.min,_.max,f);g.push({min:S.min,max:S.max,sourceId:this._sourceIds[_.priority],footprint:_.footprint,footprintTileId:_.tileId,order:_.order,clipMask:_.clipMask,clipScope:_.clipScope})}return g}setSources(f){this._setSources(f.map(c=>({getSourceId:()=>c.cache.id,getFootprints:()=>{const h=[];for(const g of c.cache.getVisibleCoordinates()){const _=c.cache.getTile(g).buckets[c.layer];_&&_.updateFootprints(g.toUnwrapped(),h)}return h},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(f){const c=f.getFootprints();if(c.length===0)return;const h=f.getOrder(),g=f.getClipMask(),_=f.getClipScope();for(const S of c){if(!S.footprint)continue;const C=Gve(S.footprint.min,S.footprint.max,S.id);this._activeRegions.push({min:C.min,max:C.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:S.id,footprint:S.footprint,order:h,clipMask:g,clipScope:_})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,h)=>c.priority-h.priority||R6(c.min,h.min)||R6(c.max,h.max)||c.order-h.order||c.clipMask-h.clipMask||function(g,_){const S=(C,L)=>C+L;return g.length-_.length||g.reduce(S,"").localeCompare(_.reduce(S,""))}(c.clipScope,h.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let c=0;for(;!f&&c!==this._activeRegions.length;){const h=this._activeRegions[c],g=this._prevRegions[c];f=h.priority!==g.priority||!Wve(h,g)||h.order!==g.order||h.clipMask!==g.clipMask||!Pa(h.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const h of this._activeRegions)h.order!==uM&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,h.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,h.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,h.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,h.max.y));const c=h=>{const g=this._activeRegions;if(h>=g.length)return h;const _=g[h].priority;for(;h1){let h=0,g=c(h);for(;h!==g;){let _=h;const S=h;for(;_!==g;){const C=this._activeRegions[_];C.hiddenByOverlap=!1;for(let L=0;L=0;c--)this._addSource(f[c]);this._computeReplacement()}},i.eQ=uM,i.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 h=new ig,g=new Qo,_=[],S=f+1+2,C=c[0]+1,L=c[0]+1+(1+c.length),z=($,K,Z)=>{let J=$===S-1?$-2:$===0?$:$-1;return J+=Z?24575:0,[J,K]};for(let $=0;$0?(Se=2*Math.sqrt(ge+1),f[3]=.25*Se,f[0]=(Z-re)/Se,f[1]=(J-z)/Se,f[2]=(L-$)/Se):C>K&&C>ie?(Se=2*Math.sqrt(1+C-K-ie),f[3]=(Z-re)/Se,f[0]=.25*Se,f[1]=(L+$)/Se,f[2]=(J+z)/Se):K>ie?(Se=2*Math.sqrt(1+K-C-ie),f[3]=(J-z)/Se,f[0]=(L+$)/Se,f[1]=.25*Se,f[2]=(Z+re)/Se):(Se=2*Math.sqrt(1+ie-C-K),f[3]=(L-$)/Se,f[0]=(J+z)/Se,f[1]=(Z+re)/Se,f[2]=.25*Se),f},i.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(c,h)=>String.fromCharCode(+("0x"+h))))},i.f0=function([f,c,h]){const g=Math.hypot(f,c,h),_=Math.atan2(f,h),S=.5*Math.PI-Math.acos(-c/g);return new p(Ki(_),Ki(S))},i.f1=Le,i.f2=Hoe,i.f3=function(f){const c=f.navigator?f.navigator.userAgent:null;return!!function(h){if(jo==null){const g=h.navigator?h.navigator.userAgent:null;jo=!!h.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return jo}(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/)))},i.f4=function(f,c){Yy=f,Xy=c},i.f5=boe,i.f6=pve,i.f7=function(f){const c=[0,0,0],h=M(new Float64Array(16));return T(h,f.pixelMatrix,f.globeMatrix),at(c,c,h),new ir(c[0],c[1])},i.f8=function(){const f=xM;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Doe),xM=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()"))},i.f9=function(){U6().acquire(Doe)},i.fA=bL,i.fB=Dt,i.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==C_e){const h=new Uint32Array(f,0,7),[,,g,_,S,C]=h;c=h.byteLength+_+S+C+S,(g!==f.byteLength||c>=f.byteLength)&&Kr("Invalid b3dm header information.")}return E_e(f,c)},i.fD=function(f,c){const h=Yoe(f);for(const g of h){for(const _ of g.meshes)cWe(_);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(dWe(g.lights,c)))}return h},i.fE=pL,i.fF=Ws,i.fG=w_e,i.fH=Ff,i.fI=du,i.fJ=function(f){mc(),Au!=null&&Au.then(c=>{c.keys().then(h=>{for(let g=0;gKr(_.message))}).catch(h=>Kr(h.message))}).catch(c=>Kr(c.message))},i.fa=s_,i.fb=function(f,c,h=!1){if(wd===du.deferred||wd===du.loading||wd===du.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rf=Xo.resolveURL(f),wd=du.deferred,D5=c,wN(),h||c6()},i.fc=function(f){JN=Xo.resolveURL(f),eS||(eS=new QN(U6(),new Ps)),eS.broadcast("setMeshoptUrl",JN)},i.fd=N_e,i.fe=function(f){zoe=Xo.resolveURL(f),eS||(eS=new QN(U6(),new Ps)),eS.broadcast("setDracoUrl",zoe)},i.ff=k_e,i.fg=gM,i.fh=function(f){const c=lu();if(!c)return;const h=c.delete(Zy);f&&h.then(()=>f()).catch(f)},i.fi=y_,i.fj=nn,i.fk=M0,i.fl=Zf,i.fm=V2e,i.fn=H2e,i.fo=W_e,i.fp=er,i.fq="hd_road_elevation",i.fr=Ma,i.fs=Wt,i.ft=Tx,i.fu=cle,i.fv=b_,i.fw=function(f,c,h,g,_,S,C,L=1,z,$,K){f.createArrays(),f.tilePixelRatio=Ir/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const Z=f.layers[0].layout,J=f.layers[0]._unevaluatedLayout._values,re={};re.scaleFactor=L,re.textSizeScaleRange=Z.get("text-size-scale-range"),re.iconSizeScaleRange=Z.get("icon-size-scale-range");const[ie,ge]=re.textSizeScaleRange,[Se,Ne]=re.iconSizeScaleRange;re.textScaleFactor=ye(re.scaleFactor,ie,ge),re.iconScaleFactor=ye(re.scaleFactor,Se,Ne);const Fe=J["text-size"],Ue=J["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Pt,maxZoom:Qt}=f.textSizeData;re.compositeTextSizes=[Fe.possiblyEvaluate(new li(Pt,{worldview:K}),S),Fe.possiblyEvaluate(new li(Qt,{worldview:K}),S)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Pt,maxZoom:Qt}=f.iconSizeData;re.compositeIconSizes=[Ue.possiblyEvaluate(new li(Pt,{worldview:K}),S),Ue.possiblyEvaluate(new li(Qt,{worldview:K}),S)]}re.layoutTextSize=Fe.possiblyEvaluate(new li(C+1,{worldview:K}),S),re.layoutIconSize=Ue.possiblyEvaluate(new li(C+1,{worldview:K}),S),re.textMaxSize=Fe.possiblyEvaluate(new li(18,{worldview:K}),S);const Qe=Z.get("symbol-placement"),xt=Z.get("text-rotation-alignment")==="map"&&Qe!=="point",mt=Z.get("text-size");let wt=!1;const Ct=[];for(const Pt of f.features){const Qt=Z.get("text-font").evaluate(Pt,{},S).join(","),Ft=mt.evaluate(Pt,{},S)*re.textScaleFactor,nr=re.layoutTextSize.evaluate(Pt,{},S)*re.textScaleFactor,ur=re.layoutIconSize.evaluate(Pt,{},S)*re.iconScaleFactor,hr={horizontal:{},vertical:void 0},vr=Pt.text;let br,fr=[0,0];if(vr){const cs=vr.toString(),Ga=Z.get("text-letter-spacing").evaluate(Pt,{},S)*jl,ft=Z.get("text-line-height").evaluate(Pt,{},S)*jl,vt=L5(cs)?Ga:0,sr=Z.get("text-anchor").evaluate(Pt,{},S),_r=Z.get("text-variable-anchor");if(!_r){const as=Z.get("text-radial-offset").evaluate(Pt,{},S);if(as)fr=Mbe(sr,[as*jl,hle]);else{const gs=Z.get("text-offset").evaluate(Pt,{},S);fr=[gs[0]*jl,gs[1]*jl]}}let Ur=xt?"center":Z.get("text-justify").evaluate(Pt,{},S);const qr=Qe==="point",bn=qr?Z.get("text-max-width").evaluate(Pt,{},S)*jl:1/0,kn=as=>{f.allowVerticalPlacement&&r_(cs)&&(hr.vertical=sle(vr,c,h,_,Qt,bn,ft,sr,as,vt,fr,zu.vertical,!0,nr,Ft,z))};if(!xt&&_r){const as=Ur==="auto"?_r.map(_s=>mle(_s)):[Ur];let gs=!1;for(let _s=0;_s=0||!r_(cs)){const as=sle(vr,c,h,_,Qt,bn,ft,sr,Ur,vt,fr,zu.horizontal,!1,nr,Ft,z);as&&(hr.horizontal[Ur]=as)}kn(qr?"left":Ur)}}let xr,rr,Jt,yr,Pr,kr,vn=!1;const Wr=Z.get("icon-text-fit").evaluate(Pt,{},S);if(Pt.icon&&Pt.icon.hasPrimary()){const cs=CM(Pt.icon,f.iconSizeData,J["icon-size"],S,f.zoom,Pt,z,re.iconScaleFactor,K);xr=cs.iconPrimary,Jt=cs.iconSecondary;const Ga=xr.toString();if(rr=g.get(Ga),rr&&(Pr=Z.get("icon-offset").evaluate(Pt,{},S),kr=Z.get("icon-anchor").evaluate(Pt,{},S),br=eL(_.get(Ga),Jt?_.get(Jt.toString()):void 0,Pr,kr),vn=rr.sdf,f.sdfIcons===void 0?f.sdfIcons=rr.sdf:f.sdfIcons!==rr.sdf&&Kr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(rr.pixelRatio!==f.pixelRatio||Z.get("icon-rotate").constantOr(1)!==0)&&(f.iconsNeedLinear=!0)),Jt){const ft=Jt.toString();yr=g.get(ft)}}wt=wt||!(!Pt.icon||!Pt.icon.hasSecondary());const Jr=aL(hr.horizontal)||hr.vertical;f.iconsInText||(f.iconsInText=!!Jr&&Jr.iconsInText);const dn=nr*re.textScaleFactor/jl,{defaultShapedIcon:bs,verticallyShapedIcon:Nr}=yGe(f,br,Z,Pt,S,hr,dn,Pr,Wr);Wr!=="none"&&br&&(mbe(br)||fbe(br))&&(sL(0,rr,xr,br,bs,Wr,$,g,_),sL(0,yr,Jt,br,bs,Wr,$,g,_),Nr&&(sL(0,rr,xr,br,Nr,Wr,$,g,_),sL(0,yr,Jt,br,Nr,Wr,$,g,_))),br=bs;const{iconBBox:hn,iconVerticalBBox:Gn,textBBox:Ks,textVerticalBBox:Js}=mGe(f,br,Nr,Z,Pt,S,ur,Pr,re,_,kr,hr,nr,fr);Ct.push({feature:Pt,shapedTextOrientations:hr,shapedText:Jr,shapedIcon:br,iconPrimary:xr,iconSecondary:Jt,iconOffset:Pr,iconAnchor:kr,verticallyShapedIcon:Nr,layoutTextSize:nr,layoutIconSize:ur,textOffset:fr,isSDFIcon:vn,iconTextFit:Wr,iconCollisionBounds:hn,iconVerticalCollisionBounds:Gn,textCollisionBounds:Ks,textVerticalCollisionBounds:Js})}return{featureData:Ct,sizes:re,hasAnySecondaryIcon:wt,textAlongLine:xt,symbolPlacement:Qe}},i.fx=wbe,i.fy=function(f,c,h,g,_,S,C,L,z,$){f.iconAtlasPositions=$.iconPositions;const{featureData:K,hasAnySecondaryIcon:Z,sizes:J,textAlongLine:re,symbolPlacement:ie}=c;for(const ge of K){const{shapedIcon:Se,verticallyShapedIcon:Ne,feature:Fe,shapedTextOrientations:Ue,shapedText:Qe,layoutTextSize:xt,textOffset:mt,isSDFIcon:wt,iconPrimary:Ct,iconSecondary:Pt,iconTextFit:Qt,iconOffset:Ft,iconCollisionBounds:nr,iconVerticalCollisionBounds:ur,textCollisionBounds:hr}=ge;Abe(Se,$.iconPositions,Ct,Pt),Abe(Ne,$.iconPositions,Ct,Pt),xGe(Ue,$.iconPositions),gGe(Ct,Pt,$.iconPositions),(Qe||Se)&&vGe(f,Fe,Ue,Se,Ne,z,J,xt,0,mt,wt,g,_,C,L,Z,Qt,Ft,re,ie,nr,ur,hr)}h&&f.generateCollisionDebugBuffers(S,f.collisionBoxArray,J.textScaleFactor)},i.fz=Vt,i.g=function(f,c){return Am(Object.assign(f,{method:"GET"}),c)},i.h=function(f){return f.indexOf("mapbox:")===0},i.i=function(f){return Is.API_STYLE_REGEX.test(f)&&!bl(f)},i.j=Oi,i.k=Wo,i.l=function(f){return decodeURIComponent(atob(f).split("").map(c=>"%"+("00"+c.charCodeAt(0).toString(16)).slice(-2)).join(""))},i.m=function(f,c){return Am(Object.assign(f,{type:"json"}),c)},i.n=e0,i.o=Xo,i.p=function(f,c){return Am(Object.assign(f,{method:"POST"}),c)},i.q=Dc,i.r=dh,i.s=function(f){try{const c=self[f];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}},i.t=function(){return Roe||(Roe=new y_("ImageRasterizer")),Roe},i.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)}()},i.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)},i.w=Kr,i.x=Ale,i.y=ns,i.z=Or}),o(["./shared"],function(i){function u(rt){const ye=rt?rt.url.toString():void 0;return ye?performance.getEntriesByName(ye):[]}function m(rt){if(typeof rt=="number"||typeof rt=="boolean"||typeof rt=="string"||rt==null)return JSON.stringify(rt);if(Array.isArray(rt)){let Pe="[";for(const Ye of rt)Pe+=`${m(Ye)},`;return`${Pe}]`}let ye="{";for(const Pe of Object.keys(rt).sort())ye+=`${Pe}:${m(rt[Pe])},`;return`${ye}}`}function x(rt){let ye="";for(const Pe of i.bx)ye+=`/${m(rt[Pe])}`;return ye}class y{constructor(ye){this.keyCache={},this._layers={},this._layerConfigs={},ye&&this.replace(ye)}replace(ye,Pe){this._layerConfigs={},this._layers={},this.update(ye,[],Pe)}update(ye,Pe,Ye){this._options=Ye;for(const bt of ye)this._layerConfigs[bt.id]=bt,(this._layers[bt.id]=i.du(bt,this.scope,null,this._options)).compileFilter(Ye),this.keyCache[bt.id]&&delete this.keyCache[bt.id];for(const bt of Pe)delete this.keyCache[bt],delete this._layerConfigs[bt],delete this._layers[bt];this.familiesBySource={};const Nt=function(bt,It){const qt={};for(let Wt=0;Wtthis._layers[Xr.id]),qt=It[0];if(qt.visibility==="none")continue;const Ot=qt.source||"";let Wt=this.familiesBySource[Ot];Wt||(Wt=this.familiesBySource[Ot]={});const pr=qt.sourceLayer||"_geojsonTileLayer";let cr=Wt[pr];cr||(cr=Wt[pr]=[]),cr.push(It)}}}const v=1*i.fl;class b{constructor(ye){const Pe={},Ye=[];for(const qt in ye){const Ot=ye[qt],Wt=Pe[qt]={};for(const pr in Ot.glyphs){const cr=Ot.glyphs[+pr];if(!cr||cr.bitmap.width===0||cr.bitmap.height===0)continue;const Xr=cr.metrics.localGlyph?v:1,Cn={x:0,y:0,w:cr.bitmap.width+2*Xr,h:cr.bitmap.height+2*Xr};Ye.push(Cn),Wt[pr]=Cn}}const{w:Nt,h:bt}=i.G(Ye),It=new i.fk({width:Nt||1,height:bt||1});for(const qt in ye){const Ot=ye[qt];for(const Wt in Ot.glyphs){const pr=Ot.glyphs[+Wt];if(!pr||pr.bitmap.width===0||pr.bitmap.height===0)continue;const cr=Pe[qt][Wt],Xr=pr.metrics.localGlyph?v:1;i.fk.copy(pr.bitmap,It,{x:0,y:0},{x:cr.x+Xr,y:cr.y+Xr},pr.bitmap)}}this.image=It,this.positions=Pe}}function N(rt,ye,Pe){rt[ye]?Pe&&(rt[ye].center=Pe):rt[ye]={floorIds:new Set,center:Pe||[0,0],floors:{}}}function k(rt,ye,Pe,Ye){for(const Nt of ye)N(rt,Nt),rt[Nt].floors[Pe]=Ye,rt[Nt].floorIds.add(Pe)}function M(rt){return{id:rt.properties.id.toString(),center:rt.properties.center.toString().split(";").map(Number)}}function I(rt){return{id:rt.properties.id.toString(),isDefault:!!rt.properties.is_default&&rt.properties.is_default,connections:rt.properties.connected_floor_ids?new Set(rt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:rt.properties.conflicted_floor_ids?new Set(rt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:rt.properties.building_ids?new Set(rt.properties.building_ids.toString().split(";")):new Set,name:rt.properties.name.toString(),zIndex:rt.properties.z_index}}function T(rt,ye){return ye.every(Pe=>rt.properties&&rt.properties[Pe]!=null)}function P(rt){return T(rt,["type","id","name"])&&rt.properties.type==="building"}function F(rt){return T(rt,["type","id","name","z_index"])&&rt.properties.type==="floor"}i.fj(b,"GlyphAtlas");class D{constructor(ye){this.tileID=new i.aQ(ye.tileID.overscaledZ,ye.tileID.wrap,ye.tileID.canonical.z,ye.tileID.canonical.x,ye.tileID.canonical.y),this.tileZoom=ye.tileZoom,this.uid=ye.uid,this.zoom=ye.zoom,this.lut=ye.lut,this.canonical=ye.tileID.canonical,this.pixelRatio=ye.pixelRatio,this.tileSize=ye.tileSize,this.source=ye.source,this.scope=ye.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=ye.showCollisionBoxes,this.collectResourceTiming=!!ye.request&&ye.request.collectResourceTiming,this.promoteId=ye.promoteId,this.isSymbolTile=ye.isSymbolTile,this.tileTransform=i.aZ(ye.tileID.canonical,ye.projection),this.projection=ye.projection,this.worldview=ye.worldview,this.localizableLayerIds=ye.localizableLayerIds,this.brightness=ye.brightness,this.extraShadowCaster=!!ye.extraShadowCaster,this.tessellationStep=ye.tessellationStep,this.scaleFactor=ye.scaleFactor,this.worldview=ye.worldview,this.indoor=ye.indoor}parse(ye,Pe,Ye,Nt,bt,It){this.status="parsing",this.data=ye,this.collisionBoxArray=new i.b3;const qt=new i.fm(Object.keys(ye.layers).sort()),Ot=new i.fn(this.tileID,this.promoteId);Ot.bucketLayerIDs=[];const Wt={},pr=new i.fo(256,256),cr={featureIndex:Ot,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:pr,availableImages:Ye,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const is=this.indoor.indoorState.activeFloorsVisible,ls=function(ts,Ws,$i){const jo=function(Pi,na){if(!Pi)return i.w("No source layers defined in indoor specification"),na;if(Pi.size===0)return na;const Li=Pi.difference(na);for(const Wa of Li)i.w(`Missing source layer required in indoor specification: ${Wa}`);return na.intersection(na)}(Ws.sourceLayers,new Set(Object.keys(ts.layers))),ba=Ws.indoorState,Co=function(Pi,na,Li,Wa){const Is=new Set,Oi=new Set,bl=new Set,El=new Map,Xc={},Tm=Yo=>{const Hd=El.get(Yo)||new Set;for(const hc of Is)if((El.get(hc)||new Set).has(Yo)||Hd.has(hc))return!0;return!1};for(const Yo of na){const Hd=Pi.layers[Yo];if(Hd)for(let hc=0;hc=Li.maxzoom||Li.visibility==="none")continue;U(na,this.zoom,cr.brightness,Ye,this.worldview);const Wa=Wt[Li.id]=Li.createBucket({index:Ot.bucketLayerIDs.length,layers:na,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:jo,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:Nt,worldview:this.worldview,localizable:Co});Ot.bucketLayerIDs.push(na.map(Oi=>i.B(Oi.id,Oi.scope)));let Is=Wa.prepare?Wa.prepare():null;Is!=null?(Is=Is.then(()=>Wa.populate(ba,cr,this.tileID.canonical,this.tileTransform)),Xr.push(Is)):Wa.populate(ba,cr,this.tileID.canonical,this.tileTransform)}}const Kr=()=>{let is,ls,ts,Ws,$i,jo;pr.trim();const ba={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Co=()=>{if(is)return this.status="done",It(is);if(this.extraShadowCaster)this.status="done",It(null,{buckets:Object.values(Wt).filter(na=>!na.isEmpty()),featureIndex:Ot,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:cr.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(ls&&ts&&Ws){const na=new b(ls),Li=new Map;for(const[Oi,bl]of ts.entries()){const{imagePosition:El}=i.fu(Oi,bl,i.fv);Li.set(Oi,El)}const Wa={};for(const Oi in Wt){const bl=Wt[Oi];bl instanceof i.b4&&(U(bl.layers,this.zoom,cr.brightness,Ye,this.worldview),Wa[Oi]=i.fw(bl,ls,na.positions,ts,Li,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,$i,this.worldview))}const Is={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(bt,ts,$i,()=>{Is.iconsPending=!1,Pi(Wa,na,Is)}),this.rasterizeIfNeeded(bt,Ws,jo,()=>{Is.patternsPending=!1,Pi(Wa,na,Is)})}},Pi=(na,Li,Wa,Is)=>{if(Wa.iconsPending||Wa.patternsPending)return;const Oi=new i.fx(ts,Ws,this.lut);for(const bl in Wt){const El=Wt[bl];if(bl in na)i.fy(El,na[bl],this.showCollisionBoxes,Ye,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,ts,Oi);else if(El.hasPattern&&(El instanceof i.ba||El instanceof i.bb||El instanceof i.ea)){U(El.layers,this.zoom,cr.brightness,Ye,this.worldview);const Xc=Object.fromEntries(Oi.patternPositions);El.addFeatures(cr,this.tileID.canonical,Xc,Ye,this.tileTransform,this.brightness)}}this.status="done",It(null,{buckets:Object.values(Wt).filter(bl=>!bl.isEmpty()),featureIndex:Ot,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Li.image,lineAtlas:pr,imageAtlas:Oi,brightness:cr.brightness})};if(!this.extraShadowCaster){const na=i.fs(cr.glyphDependencies,Is=>Object.keys(Is).map(Number));Object.keys(na).length?bt.send("getGlyphs",{uid:this.uid,stacks:na},(Is,Oi)=>{is||(is=Is,ls=Oi,Co())},void 0,!1,ba):ls={};const Li=Array.from(cr.iconDependencies.keys()).map(Is=>i.I.parse(Is));Li.length?bt.send("getImages",{images:Li,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Is,Oi)=>{is||(is=Is,ts=new Map,$i=this.updateImageMapAndGetImageTaskQueue(ts,Oi,cr.iconDependencies),Co())},void 0,!1,ba):(ts=new Map,$i=new Map);const Wa=Array.from(cr.patternDependencies.keys()).map(Is=>i.I.parse(Is));Wa.length?bt.send("getImages",{images:Wa,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Is,Oi)=>{is||(is=Is,Ws=new Map,jo=this.updateImageMapAndGetImageTaskQueue(Ws,Oi,cr.patternDependencies),Co())},void 0,!1,ba):(Ws=new Map,jo=new Map)}if(cr.elevationFeatures&&cr.elevationFeatures.length>0){const na=[];for(const Wa of Object.values(Wt))if(Wa instanceof i.bb){const Is=Wa.getUnevaluatedPortalGraph();Is&&na.push(Is)}const Li=i.ft.evaluate(na);for(const Wa of Object.values(Wt))if(Wa instanceof i.bb){const Is=ye.layers[qt.decode(Wa.sourceLayerIndex)];Wa.setEvaluatedPortalGraph(Li,Is,this.tileID.canonical,cr.availableImages,cr.brightness)}}Co()};Xr.length>0?Promise.allSettled(Xr).then(Kr).catch(It):Kr()}updateParameters(ye){this.scaleFactor=ye.scaleFactor,this.showCollisionBoxes=ye.showCollisionBoxes,this.projection=ye.projection,this.brightness=ye.brightness,this.tileTransform=i.aZ(ye.tileID.canonical,ye.projection),this.extraShadowCaster=ye.extraShadowCaster,this.lut=ye.lut,this.worldview=ye.worldview,this.indoor=ye.indoor}rasterizeIfNeeded(ye,Pe,Ye,Nt){Array.from(Pe.values()).some(bt=>bt.usvg)?this.rasterize(ye,Pe,Ye,Nt):Nt()}updateImageMapAndGetImageTaskQueue(ye,Pe,Ye){const Nt=new Map;for(const bt of Pe.keys()){const It=Ye.get(bt)||[];for(const qt of It){const Ot=qt.toString(),Wt=Pe.get(qt.id.toString());Wt.usvg?Nt.has(Ot)||(Nt.set(Ot,qt),ye.set(Ot,Object.assign({},Wt))):ye.set(Ot,Wt)}}return Nt}rasterize(ye,Pe,Ye,Nt){this.rasterizeTask=ye.send("rasterizeImages",{scope:this.scope,tasks:Ye},(bt,It)=>{if(!bt)for(const[qt,Ot]of It.entries()){const Wt=Object.assign(Pe.get(qt),{data:Ot});Pe.set(qt,Wt)}Nt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function U(rt,ye,Pe,Ye,Nt){const bt=new i.ac(ye,{brightness:Pe,worldview:Nt});for(const It of rt)It.recalculate(bt,Ye)}class V extends i.E{constructor(ye,Pe,Ye,Nt,bt,It,qt){super(),this.actor=ye,this.layerIndex=Pe,this.availableImages=Ye,this.availableModels=Nt,this.loadVectorData=It||i.aL,this.loading={},this.loaded={},this.deduped=new i.aK(ye.scheduler),this.isSpriteLoaded=bt,this.scheduler=ye.scheduler,this.brightness=qt}loadTile(ye,Pe){const Ye=ye.uid,Nt=ye&&ye.request,bt=Nt&&Nt.collectResourceTiming,It=this.loading[Ye]=new D(ye);It.abort=this.loadVectorData(ye,(qt,Ot)=>{const Wt=!this.loading[Ye];if(delete this.loading[Ye],It.cancelRasterize(),Wt||qt||!Ot)return It.status="done",Wt||(this.loaded[Ye]=It),Pe(qt);const pr=Ot.rawData,cr={},Xr=i.aM(Ot.responseHeaders);Xr&&Xr.expires&&(cr.expires=Xr.expires),Xr&&Xr.cacheControl&&(cr.cacheControl=Xr.cacheControl),It.vectorTile=Ot.vectorTile||new i.fz(new i.bt(pr));const Cn=()=>{It.parse(It.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Kr,is)=>{if(Kr||!is)return Pe(Kr);const ls={};if(bt){const ts=u(Nt);ts.length>0&&(ls.resourceTiming=JSON.parse(JSON.stringify(ts)))}Pe(null,Object.assign({rawTileData:pr.slice(0),responseHeaders:Ot.responseHeaders},is,cr,ls))})};this.isSpriteLoaded?Cn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Cn,{type:"parseTile",isSymbolTile:ye.isSymbolTile,zoom:ye.tileZoom}):Cn()}),this.loaded=this.loaded||{},this.loaded[Ye]=It})}reloadTile(ye,Pe){const Ye=this.loaded,Nt=ye.uid;if(Ye&&Ye[Nt]){const bt=Ye[Nt];bt.updateParameters(ye);const It=(qt,Ot)=>{const Wt=bt.reloadCallback;Wt&&(delete bt.reloadCallback,bt.parse(bt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Wt)),Pe(qt,Ot)};bt.status==="parsing"?bt.reloadCallback=It:bt.status==="done"&&(bt.vectorTile?bt.parse(bt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,It):It())}else Pe(null,void 0)}abortTile(ye,Pe){const Ye=ye.uid,Nt=this.loading[Ye];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ye]),Pe()}removeTile(ye,Pe){const Ye=this.loaded,Nt=ye.uid;Ye&&Ye[Nt]&&delete Ye[Nt],Pe()}}class W{loadTile(ye,Pe){const{uid:Ye,encoding:Nt,rawImageData:bt,padding:It}=ye,qt=ImageBitmap&&bt instanceof ImageBitmap?this.getImageData(bt,It):bt;Pe(null,new i.fA(Ye,qt,Nt,It<1))}reloadTile(ye,Pe){Pe(null,null)}abortTile(ye,Pe){Pe()}removeTile(ye,Pe){Pe()}getImageData(ye,Pe){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(ye.width,ye.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=ye.width,this.offscreenCanvas.height=ye.height,this.offscreenCanvasContext.drawImage(ye,0,0,ye.width,ye.height);const Ye=this.offscreenCanvasContext.getImageData(-Pe,-Pe,ye.width+2*Pe,ye.height+2*Pe);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ye}}i.bs.setPbf(i.bt);class G{constructor(ye){this._mrt=new i.bs(ye.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=ye.uid,this.tileID=ye.tileID,this.source=ye.source}parse(ye,Pe){const Ye=this._mrt;this.status="parsing",this._entireBuffer=ye;try{Ye.parseHeader(ye),this._isHeaderLoaded=!0;const Nt=[];for(const bt in Ye.layers){const It=Ye.getLayer(bt),qt=It.getDataRange(It.getBandList()),Ot=Ye.createDecodingTask(qt),Wt=ye.slice(qt.firstByte,qt.lastByte+1),pr=i.bs.performDecoding(Wt,Ot).then(cr=>Ot.complete(null,cr)).catch(cr=>Ot.complete(cr,null));Nt.push(pr)}Promise.allSettled(Nt).then(()=>Pe(null,Ye)).catch(bt=>Pe(bt))}catch(Nt){Pe(Nt)}}}class ee{constructor(ye){this.actor=ye,this.loading={},this.loaded={}}loadTile(ye,Pe){const Ye=ye.uid,Nt=ye.request,bt=this.loading[Ye]=new G(ye),{cancel:It}=i.bu(Nt,(qt,Ot,Wt)=>{const pr=!this.loading[Ye];if(delete this.loading[Ye],pr||qt||!Ot)return bt.status="done",pr||(this.loaded[Ye]=bt),Pe(qt);bt.parse(Ot,(cr,Xr)=>{if(cr||!Xr)return Pe(cr);Pe(null,Xr,Wt)}),this.loaded[Ye]=bt});bt.abort=It}reloadTile(ye,Pe){Pe(null,void 0)}abortTile(ye,Pe){const Ye=ye.uid,Nt=this.loading[Ye];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ye]),Pe()}removeTile(ye,Pe){const Ye=ye.uid;this.loaded[Ye]&&delete this.loaded[Ye],Pe()}decodeRasterArray(ye,Pe){i.bs.performDecoding(ye.buffer,ye.task).then(Ye=>Pe(null,Ye)).catch(Ye=>Pe(Ye))}}const ae=i.fB.prototype.toGeoJSON;class oe{constructor(ye){this._feature=ye,this.extent=i.al,this.type=ye.type,this.properties=ye.tags,"id"in ye&&!isNaN(ye.id)&&(this.id=parseInt(ye.id,10))}loadGeometry(){if(this._feature.type===1){const ye=[];for(const Pe of this._feature.geometry)ye.push([new i.P(Pe[0],Pe[1])]);return ye}{const ye=[];for(const Pe of this._feature.geometry){const Ye=[];for(const Nt of Pe)Ye.push(new i.P(Nt[0],Nt[1]));ye.push(Ye)}return ye}}toGeoJSON(ye,Pe,Ye){return ae.call(this,ye,Pe,Ye)}}class pe{constructor(ye,Pe){this.name=ye,this.extent=i.al,this.length=Pe.length,this._jsonFeatures=Pe}feature(ye){return new oe(this._jsonFeatures[ye])}}class ne{constructor(ye){this.layers={},this.extent=i.al;for(const Pe of Object.keys(ye))this.layers[Pe]=new pe(Pe,ye[Pe])}}const fe=64/4096,se=128;class me{constructor(){this.features=new Map}clear(){this.features.clear()}load(ye=[],Pe){for(const Ye of ye){const Nt=Ye.id;if(Nt==null)continue;let bt=this.features.get(Nt);bt&&this.updateCache(bt,Pe),Ye.geometry?(bt=xe(Ye),this.updateCache(bt,Pe),this.features.set(Nt,bt)):this.features.delete(Nt),this.updateCache(bt,Pe)}}updateCache(ye,Pe){for(const{canonical:Ye,uid:Nt}of Object.values(Pe)){const{z:bt,x:It,y:qt}=Ye;ue(ye,Math.pow(2,bt),It,qt)&&delete Pe[Nt]}}getTile(ye,Pe,Ye){const Nt=Math.pow(2,ye),bt=[];for(const It of this.features.values())ue(It,Nt,Pe,Ye)&&bt.push(ve(It,Nt,Pe,Ye));return{features:bt}}getFeatures(){return[...this.features.values()]}}function ue({minX:rt,minY:ye,maxX:Pe,maxY:Ye},Nt,bt,It){return rt<(bt+1+fe)/Nt&&ye<(It+1+fe)/Nt&&Pe>(bt-fe)/Nt&&Ye>(It-fe)/Nt}function xe(rt){const{id:ye,geometry:Pe,properties:Ye}=rt;if(!Pe)return;if(Pe.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:Nt,coordinates:bt}=Pe,It={id:ye,type:1,geometry:[],tags:Ye,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},qt=It.geometry;if(Nt==="Point")Te(bt,qt,It);else if(Nt==="MultiPoint")for(const Ot of bt)Te(Ot,qt,It);else if(Nt==="LineString")It.type=2,_e(bt,qt,It);else if(Nt==="MultiLineString")It.type=2,we(bt,qt,It);else if(Nt==="Polygon")It.type=3,we(bt,qt,It,!0);else{if(Nt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");It.type=3;for(const Ot of bt)we(Ot,qt,It,!0)}return It}function Te([rt,ye],Pe,Ye){const Nt=i.aF(rt);let bt=i.aJ(ye);bt=bt<0?0:bt>1?1:bt,Pe.push(Nt,bt),Ye.minX=Math.min(Ye.minX,Nt),Ye.minY=Math.min(Ye.minY,bt),Ye.maxX=Math.max(Ye.maxX,Nt),Ye.maxY=Math.max(Ye.maxY,bt)}function _e(rt,ye,Pe,Ye=!1,Nt=!1){const bt=[];for(const It of rt)Te(It,bt,Pe);ye.push(bt),Ye&&function(It,qt){let Ot=0;for(let Wt=0,pr=It.length,cr=pr-2;Wt0===qt)for(let Wt=0,pr=It.length;Wt=It&&cr>=It||(Wt>=It?(pr+=Math.round(Kr*((It-Wt)/Cn)),Wt=It):cr>=It&&(Xr=pr+Math.round(Kr*((It-Wt)/Cn)),cr=It),pr>=It&&Xr>=It||(pr>=It?(Wt+=Math.round(Cn*((It-pr)/Kr)),pr=It):Xr>=It&&(cr=Wt+Math.round(Cn*((It-pr)/Kr)),Xr=It),qt&&Wt===qt[qt.length-1][0]&&pr===qt[qt.length-1][1]||(qt=[[Wt,pr]],Nt.push(qt)),qt.push([cr,Xr])))))}}function Me(rt,ye,Pe,Ye,Nt){const bt=(Pe-fe)/ye,It=(Ye-fe)/ye,qt=(Pe+1+fe)/ye,Ot=(Ye+1+fe)/ye;function Wt(Xr,Cn){let Kr=0;return Xrqt&&(Kr|=2),CnOt&&(Kr|=8),Kr}let pr=[];for(let Xr=1;Xr<=8;Xr*=2){let Cn=rt[rt.length-2],Kr=rt[rt.length-1],is=!(Wt(Cn,Kr)&Xr);for(let ls=0;ls>31}function Tt(rt,ye){const{geometry:Pe,type:Ye}=rt;let Nt=0,bt=0;if(Ye===1){ye.writeVarint(Ve(1,Pe.length));for(const It of Pe){const qt=It[0]-Nt,Ot=It[1]-bt;ye.writeVarint(ot(qt)),ye.writeVarint(ot(Ot)),Nt+=qt,bt+=Ot}}else for(const It of Pe){ye.writeVarint(Ve(1,1));const qt=It.length-(Ye===3?1:0);for(let Ot=0;Otrt},le=Math.fround||(qe=new Float32Array(1),rt=>(qe[0]=+rt,qe[0]));var qe;const Je=3,st=5,je=6;class ut{constructor(ye){this.options=Object.assign(Object.create(at),ye),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(ye){const{log:Pe,minZoom:Ye,maxZoom:Nt}=this.options;Pe&&console.time("total time");const bt=`prepare ${ye.length} points`;Pe&&console.time(bt),this.points=ye;const It=[];for(let Ot=0;Ot=Ye;Ot--){const Wt=+Date.now();qt=this.trees[Ot]=this._createTree(this._cluster(qt,Ot)),Pe&&console.log("z%d: %d clusters in %dms",Ot,qt.numItems,+Date.now()-Wt)}return Pe&&console.timeEnd("total time"),this}getClusters(ye,Pe){let Ye=((ye[0]+180)%360+360)%360-180;const Nt=Math.max(-90,Math.min(90,ye[1]));let bt=ye[2]===180?180:((ye[2]+180)%360+360)%360-180;const It=Math.max(-90,Math.min(90,ye[3]));if(ye[2]-ye[0]>=360)Ye=-180,bt=180;else if(Ye>bt){const cr=this.getClusters([Ye,Nt,180,It],Pe),Xr=this.getClusters([-180,Nt,bt,It],Pe);return cr.concat(Xr)}const qt=this.trees[this._limitZoom(Pe)],Ot=qt.range(Ze(Ye),Le(It),Ze(bt),Le(Nt)),Wt=qt.data,pr=[];for(const cr of Ot){const Xr=this.stride*cr;pr.push(Wt[Xr+st]>1?Ce(Wt,Xr,this.clusterProps):this.points[Wt[Xr+Je]])}return pr}getChildren(ye){const Pe=this._getOriginId(ye),Ye=this._getOriginZoom(ye),Nt="No cluster with the specified id.",bt=this.trees[Ye];if(!bt)throw new Error(Nt);const It=bt.data;if(Pe*this.stride>=It.length)throw new Error(Nt);const qt=this.options.radius/(this.options.extent*Math.pow(2,Ye-1)),Ot=bt.within(It[Pe*this.stride],It[Pe*this.stride+1],qt),Wt=[];for(const pr of Ot){const cr=pr*this.stride;It[cr+4]===ye&&Wt.push(It[cr+st]>1?Ce(It,cr,this.clusterProps):this.points[It[cr+Je]])}if(Wt.length===0)throw new Error(Nt);return Wt}getLeaves(ye,Pe,Ye){const Nt=[];return this._appendLeaves(Nt,ye,Pe=Pe||10,Ye=Ye||0,0),Nt}getTile(ye,Pe,Ye){const Nt=this.trees[this._limitZoom(ye)],bt=Math.pow(2,ye),{extent:It,radius:qt}=this.options,Ot=qt/It,Wt=(Ye-Ot)/bt,pr=(Ye+1+Ot)/bt,cr={features:[]};return this._addTileFeatures(Nt.range((Pe-Ot)/bt,Wt,(Pe+1+Ot)/bt,pr),Nt.data,Pe,Ye,bt,cr),Pe===0&&this._addTileFeatures(Nt.range(1-Ot/bt,Wt,1,pr),Nt.data,bt,Ye,bt,cr),Pe===bt-1&&this._addTileFeatures(Nt.range(0,Wt,Ot/bt,pr),Nt.data,-1,Ye,bt,cr),cr.features.length?cr:null}getClusterExpansionZoom(ye){let Pe=this._getOriginZoom(ye)-1;for(;Pe<=this.options.maxZoom;){const Ye=this.getChildren(ye);if(Pe++,Ye.length!==1)break;ye=Ye[0].properties.cluster_id}return Pe}_appendLeaves(ye,Pe,Ye,Nt,bt){const It=this.getChildren(Pe);for(const qt of It){const Ot=qt.properties;if(Ot&&Ot.cluster?bt+Ot.point_count<=Nt?bt+=Ot.point_count:bt=this._appendLeaves(ye,Ot.cluster_id,Ye,Nt,bt):bt1;let pr,cr,Xr;if(Wt)pr=Ee(Pe,Ot,this.clusterProps),cr=Pe[Ot],Xr=Pe[Ot+1];else{const is=this.points[Pe[Ot+Je]];pr=is.properties;const[ls,ts]=is.geometry.coordinates;cr=Ze(ls),Xr=Le(ts)}const Cn={type:1,geometry:[[Math.round(this.options.extent*(cr*bt-Ye)),Math.round(this.options.extent*(Xr*bt-Nt))]],tags:pr};let Kr;Kr=Wt||this.options.generateId?Pe[Ot+Je]:this.points[Pe[Ot+Je]].id,Kr!==void 0&&(Cn.id=Kr),It.features.push(Cn)}}_limitZoom(ye){return Math.max(this.options.minZoom,Math.min(Math.floor(+ye),this.options.maxZoom+1))}_cluster(ye,Pe){const{radius:Ye,extent:Nt,reduce:bt,minPoints:It}=this.options,qt=Ye/(Nt*Math.pow(2,Pe)),Ot=ye.data,Wt=[],pr=this.stride;for(let cr=0;crPe&&(ls+=Ot[Ws+st])}if(ls>is&&ls>=It){let ts,Ws=Xr*is,$i=Cn*is,jo=-1;const ba=(cr/pr<<5)+(Pe+1)+this.points.length;for(const Co of Kr){const Pi=Co*pr;if(Ot[Pi+2]<=Pe)continue;Ot[Pi+2]=Pe;const na=Ot[Pi+st];Ws+=Ot[Pi]*na,$i+=Ot[Pi+1]*na,Ot[Pi+4]=ba,bt&&(ts||(ts=this._map(Ot,cr,!0),jo=this.clusterProps.length,this.clusterProps.push(ts)),bt(ts,this._map(Ot,Pi)))}Ot[cr+4]=ba,Wt.push(Ws/ls,$i/ls,1/0,ba,-1,ls),bt&&Wt.push(jo)}else{for(let ts=0;ts1)for(const ts of Kr){const Ws=ts*pr;if(!(Ot[Ws+2]<=Pe)){Ot[Ws+2]=Pe;for(let $i=0;$i>5}_getOriginZoom(ye){return(ye-this.points.length)%32}_map(ye,Pe,Ye){if(ye[Pe+st]>1){const It=this.clusterProps[ye[Pe+je]];return Ye?Object.assign({},It):It}const Nt=this.points[ye[Pe+Je]].properties,bt=this.options.map(Nt);return Ye&&bt===Nt?Object.assign({},bt):bt}}function Ce(rt,ye,Pe){return{type:"Feature",id:rt[ye+Je],properties:Ee(rt,ye,Pe),geometry:{type:"Point",coordinates:[(Ye=rt[ye],360*(Ye-.5)),Ke(rt[ye+1])]}};var Ye}function Ee(rt,ye,Pe){const Ye=rt[ye+st],Nt=Ye>=1e4?`${Math.round(Ye/1e3)}k`:Ye>=1e3?Math.round(Ye/100)/10+"k":Ye,bt=rt[ye+je],It=bt===-1?{}:Object.assign({},Pe[bt]);return Object.assign(It,{cluster:!0,cluster_id:rt[ye+Je],point_count:Ye,point_count_abbreviated:Nt})}function Ze(rt){return rt/360+.5}function Le(rt){const ye=Math.sin(rt*Math.PI/180),Pe=.5-.25*Math.log((1+ye)/(1-ye))/Math.PI;return Pe<0?0:Pe>1?1:Pe}function Ke(rt){const ye=(180-360*rt)*Math.PI/180;return 360*Math.atan(Math.exp(ye))/Math.PI-90}function tt(rt,ye,Pe,Ye){let Nt=Ye;const bt=ye+(Pe-ye>>1);let It,qt=Pe-ye;const Ot=rt[ye],Wt=rt[ye+1],pr=rt[Pe],cr=rt[Pe+1];for(let Xr=ye+3;XrNt)It=Xr,Nt=Cn;else if(Cn===Nt){const Kr=Math.abs(Xr-bt);KrYe&&(It-ye>3&&tt(rt,ye,It,Ye),rt[It+2]=Nt,Pe-It>3&&tt(rt,It,Pe,Ye))}function ct(rt,ye,Pe,Ye,Nt,bt){let It=Nt-Pe,qt=bt-Ye;if(It!==0||qt!==0){const Ot=((rt-Pe)*It+(ye-Ye)*qt)/(It*It+qt*qt);Ot>1?(Pe=Nt,Ye=bt):Ot>0&&(Pe+=It*Ot,Ye+=qt*Ot)}return It=rt-Pe,qt=ye-Ye,It*It+qt*qt}function it(rt,ye,Pe,Ye){const Nt={id:rt??null,type:ye,geometry:Pe,tags:Ye,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(ye==="Point"||ye==="MultiPoint"||ye==="LineString")zt(Nt,Pe);else if(ye==="Polygon")zt(Nt,Pe[0]);else if(ye==="MultiLineString")for(const bt of Pe)zt(Nt,bt);else if(ye==="MultiPolygon")for(const bt of Pe)zt(Nt,bt[0]);return Nt}function zt(rt,ye){for(let Pe=0;Pe0&&(It+=Ye?(Nt*pr-Wt*bt)/2:Math.sqrt(Math.pow(Wt-Nt,2)+Math.pow(pr-bt,2))),Nt=Wt,bt=pr}const qt=ye.length-3;ye[2]=1,tt(ye,0,qt,Pe),ye[qt+2]=1,ye.size=Math.abs(It),ye.start=0,ye.end=ye.size}function Mr(rt,ye,Pe,Ye){for(let Nt=0;Nt1?1:Pe}function dr(rt,ye,Pe,Ye,Nt,bt,It,qt){if(Ye/=ye,bt>=(Pe/=ye)&&It=Ye)return null;const Ot=[];for(const Wt of rt){const pr=Wt.geometry;let cr=Wt.type;const Xr=Nt===0?Wt.minX:Wt.minY,Cn=Nt===0?Wt.maxX:Wt.maxY;if(Xr>=Pe&&Cn=Ye)continue;let Kr=[];if(cr==="Point"||cr==="MultiPoint")En(pr,Kr,Pe,Ye,Nt);else if(cr==="LineString")Es(pr,Kr,Pe,Ye,Nt,!1,qt.lineMetrics);else if(cr==="MultiLineString")Ei(pr,Kr,Pe,Ye,Nt,!1);else if(cr==="Polygon")Ei(pr,Kr,Pe,Ye,Nt,!0);else if(cr==="MultiPolygon")for(const is of pr){const ls=[];Ei(is,ls,Pe,Ye,Nt,!0),ls.length&&Kr.push(ls)}if(Kr.length){if(qt.lineMetrics&&cr==="LineString"){for(const is of Kr)Ot.push(it(Wt.id,cr,is,Wt.tags));continue}cr!=="LineString"&&cr!=="MultiLineString"||(Kr.length===1?(cr="LineString",Kr=Kr[0]):cr="MultiLineString"),cr!=="Point"&&cr!=="MultiPoint"||(cr=Kr.length===3?"Point":"MultiPoint"),Ot.push(it(Wt.id,cr,Kr,Wt.tags))}}return Ot.length?Ot:null}function En(rt,ye,Pe,Ye,Nt){for(let bt=0;bt=Pe&&It<=Ye&&Ii(ye,rt[bt],rt[bt+1],rt[bt+2])}}function Es(rt,ye,Pe,Ye,Nt,bt,It){let qt=Hs(rt);const Ot=Nt===0?Ho:Ha;let Wt,pr,cr=rt.start;for(let ls=0;lsPe&&(pr=Ot(qt,ts,Ws,jo,ba,Pe),It&&(qt.start=cr+Wt*pr)):Co>Ye?Pi=Pe&&(pr=Ot(qt,ts,Ws,jo,ba,Pe),na=!0),Pi>Ye&&Co<=Ye&&(pr=Ot(qt,ts,Ws,jo,ba,Ye),na=!0),!bt&&na&&(It&&(qt.end=cr+Wt*pr),ye.push(qt),qt=Hs(rt)),It&&(cr+=Wt)}let Xr=rt.length-3;const Cn=rt[Xr],Kr=rt[Xr+1],is=Nt===0?Cn:Kr;is>=Pe&&is<=Ye&&Ii(qt,Cn,Kr,rt[Xr+2]),Xr=qt.length-3,bt&&Xr>=3&&(qt[Xr]!==qt[0]||qt[Xr+1]!==qt[1])&&Ii(qt,qt[0],qt[1],qt[2]),qt.length&&ye.push(qt)}function Hs(rt){const ye=[];return ye.size=rt.size,ye.start=rt.start,ye.end=rt.end,ye}function Ei(rt,ye,Pe,Ye,Nt,bt){for(const It of rt)Es(It,ye,Pe,Ye,Nt,bt,!1)}function Ii(rt,ye,Pe,Ye){rt.push(ye,Pe,Ye)}function Ho(rt,ye,Pe,Ye,Nt,bt){const It=(bt-ye)/(Ye-ye);return Ii(rt,bt,Pe+(Nt-Pe)*It,1),It}function Ha(rt,ye,Pe,Ye,Nt,bt){const It=(bt-Pe)/(Nt-Pe);return Ii(rt,ye+(Ye-ye)*It,bt,1),It}function us(rt,ye){const Pe=[];for(let Ye=0;Ye0&&ye.size<(Nt?It:Ye))return void(Pe.numPoints+=ye.length/3);const qt=[];for(let Ot=0;OtIt)&&(Pe.numSimplified++,qt.push(ye[Ot],ye[Ot+1])),Pe.numPoints++;Nt&&function(Ot,Wt){let pr=0;for(let cr=0,Xr=Ot.length,Cn=Xr-2;cr0===Wt)for(let cr=0,Xr=Ot.length;cr24)throw new Error("maxZoom should be in the 0-24 range");if(Pe.promoteId&&Pe.generateId)throw new Error("promoteId and generateId cannot be used together.");let Nt=function(bt,It){const qt=[];if(bt.type==="FeatureCollection")for(let Ot=0;Ot1&&console.time("creation"),Cn=this.tiles[Xr]=zs(ye,Pe,Ye,Nt,Wt),this.tileCoords.push({z:Pe,x:Ye,y:Nt}),pr)){pr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Pe,Ye,Nt,Cn.numFeatures,Cn.numPoints,Cn.numSimplified),console.timeEnd("creation"));const na=`z${Pe}`;this.stats[na]=(this.stats[na]||0)+1,this.total++}if(Cn.source=ye,bt==null){if(Pe===Wt.indexMaxZoom||Cn.numPoints<=Wt.indexMaxPoints)continue}else{if(Pe===Wt.maxZoom||Pe===bt)continue;if(bt!=null){const na=bt-Pe;if(Ye!==It>>na||Nt!==qt>>na)continue}}if(Cn.source=null,ye.length===0)continue;pr>1&&console.time("clipping");const Kr=.5*Wt.buffer/Wt.extent,is=.5-Kr,ls=.5+Kr,ts=1+Kr;let Ws=null,$i=null,jo=null,ba=null,Co=dr(ye,cr,Ye-Kr,Ye+ls,0,Cn.minX,Cn.maxX,Wt),Pi=dr(ye,cr,Ye+is,Ye+ts,0,Cn.minX,Cn.maxX,Wt);ye=null,Co&&(Ws=dr(Co,cr,Nt-Kr,Nt+ls,1,Cn.minY,Cn.maxY,Wt),$i=dr(Co,cr,Nt+is,Nt+ts,1,Cn.minY,Cn.maxY,Wt),Co=null),Pi&&(jo=dr(Pi,cr,Nt-Kr,Nt+ls,1,Cn.minY,Cn.maxY,Wt),ba=dr(Pi,cr,Nt+is,Nt+ts,1,Cn.minY,Cn.maxY,Wt),Pi=null),pr>1&&console.timeEnd("clipping"),Ot.push(Ws||[],Pe+1,2*Ye,2*Nt),Ot.push($i||[],Pe+1,2*Ye,2*Nt+1),Ot.push(jo||[],Pe+1,2*Ye+1,2*Nt),Ot.push(ba||[],Pe+1,2*Ye+1,2*Nt+1)}}getTile(ye,Pe,Ye){ye=+ye,Pe=+Pe,Ye=+Ye;const Nt=this.options,{extent:bt,debug:It}=Nt;if(ye<0||ye>24)return null;const qt=1<1&&console.log("drilling down to z%d-%d-%d",ye,Pe,Ye);let Wt,pr=ye,cr=Pe,Xr=Ye;for(;!Wt&&pr>0;)pr--,cr>>=1,Xr>>=1,Wt=this.tiles[bi(pr,cr,Xr)];return Wt&&Wt.source?(It>1&&(console.log("found parent tile z%d-%d-%d",pr,cr,Xr),console.time("drilling down")),this.splitTile(Wt.source,pr,cr,Xr,ye,Pe,Ye),It>1&&console.timeEnd("drilling down"),this.tiles[Ot]?hs(this.tiles[Ot],bt):null):null}}function bi(rt,ye,Pe){return 32*((1<Wt.tags&&"3d_elevation_id"in Wt.tags&&"source"in Wt.tags&&Wt.tags.source==="elevation",bt=Ye.features.filter(Wt=>Nt(Wt));let It={_geojsonTileLayer:Ye.features};bt.length>0&&(It={_geojsonTileLayer:Ye.features.filter(Wt=>!Nt(Wt)),hd_road_elevation:bt});const qt=new ne(It),Ot=function(Wt){const pr=new i.bt;for(const cr of Object.keys(Wt))pr.writeMessage(3,Ie,{name:cr,features:Wt[cr]});return pr.finish()}(It).buffer;ye(null,{vectorTile:qt,rawData:Ot})}class Ki extends V{constructor(ye,Pe,Ye,Nt,bt,It,qt){super(ye,Pe,Ye,Nt,bt,qn,qt),It&&(this.loadGeoJSON=It),this._dynamicIndex=new me}loadData(ye,Pe){const Ye=ye&&ye.request,Nt=Ye&&Ye.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(ye,(bt,It)=>{if(bt||!It)return Pe(bt);if(typeof It!="object")return Pe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`));{try{if(ye.filter){const Ot=i.U(ye.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Ot.result==="error")throw new Error(Ot.value.map(Wt=>`${Wt.key}: ${Wt.message}`).join(", "));It.features=It.features.filter(Wt=>Ot.value.evaluate({zoom:0},Wt))}ye.dynamic?(It.type==="Feature"&&(It={type:"FeatureCollection",features:[It]}),ye.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(It.features,this.loaded),ye.cluster&&(It.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=ye.cluster?new ut(function({superclusterOptions:Ot,clusterProperties:Wt}){if(!Wt||!Ot)return Ot;const pr={},cr={},Xr={accumulated:null,zoom:0},Cn={properties:null},Kr=Object.keys(Wt);for(const is of Kr){const[ls,ts]=Wt[is],Ws=i.U(ts),$i=i.U(typeof ls=="string"?[ls,["accumulated"],["get",is]]:ls);pr[is]=Ws.value,cr[is]=$i.value}return Ot.map=is=>{Cn.properties=is;const ls={};for(const ts of Kr)ls[ts]=pr[ts].evaluate(Xr,Cn);return ls},Ot.reduce=(is,ls)=>{Cn.properties=ls;for(const ts of Kr)Xr.accumulated=is[ts],is[ts]=cr[ts].evaluate(Xr,Cn)},Ot}(ye)).load(It.features):ye.dynamic?this._dynamicIndex:function(Ot,Wt){return new oo(Ot,Wt)}(It,ye.geojsonVtOptions)}catch(Ot){return Pe(Ot)}const qt={};if(Nt){const Ot=u(Ye);Ot&&(qt.resourceTiming={},qt.resourceTiming[ye.source]=JSON.parse(JSON.stringify(Ot)))}Pe(null,qt)}})}reloadTile(ye,Pe){const Ye=this.loaded;return Ye&&Ye[ye.uid]?ye.partial?Pe(null,void 0):super.reloadTile(ye,Pe):this.loadTile(ye,Pe)}loadGeoJSON(ye,Pe){if(ye.request)i.m(ye.request,Pe);else{if(typeof ye.data!="string")return Pe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Pe(null,JSON.parse(ye.data))}catch{return Pe(new Error(`Input data given to '${ye.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(ye,Pe){try{Pe(null,this._geoJSONIndex.getClusterExpansionZoom(ye.clusterId))}catch(Ye){Pe(Ye)}}getClusterChildren(ye,Pe){try{Pe(null,this._geoJSONIndex.getChildren(ye.clusterId))}catch(Ye){Pe(Ye)}}getClusterLeaves(ye,Pe){try{Pe(null,this._geoJSONIndex.getLeaves(ye.clusterId,ye.limit,ye.offset))}catch(Ye){Pe(Ye)}}}class dc{constructor(ye,Pe,Ye){this.tileID=new i.aQ(ye.tileID.overscaledZ,ye.tileID.wrap,ye.tileID.canonical.z,ye.tileID.canonical.x,ye.tileID.canonical.y),this.tileZoom=ye.tileZoom,this.uid=ye.uid,this.zoom=ye.zoom,this.canonical=ye.tileID.canonical,this.pixelRatio=ye.pixelRatio,this.tileSize=ye.tileSize,this.source=ye.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=ye.projection,this.brightness=Pe,this.worldview=Ye}parse(ye,Pe,Ye,Nt){this.status="parsing";const bt=new i.aQ(Ye.tileID.overscaledZ,Ye.tileID.wrap,Ye.tileID.canonical.z,Ye.tileID.canonical.x,Ye.tileID.canonical.y),It=[],qt=Pe.familiesBySource[Ye.source],Ot=new i.fn(bt,Ye.promoteId);Ot.bucketLayerIDs=[],Ot.is3DTile=!0,i.fC(ye).then(Wt=>{if(!Wt)return Nt(new Error("Could not parse tile"));const pr=Wt.json.extensionsUsed&&Wt.json.extensionsUsed.includes("MAPBOX_mesh_features")||Wt.json.asset.extras&&Wt.json.asset.extras.MAPBOX_mesh_features,cr=Wt.json.extensionsUsed&&Wt.json.extensionsUsed.includes("EXT_meshopt_compression"),Xr=new i.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const Cn in qt)for(const Kr of qt[Cn]){const is=Kr[0];Ot.bucketLayerIDs.push(Kr.map(Ws=>i.B(Ws.id,Ws.scope))),is.recalculate(Xr,[]);const ls=i.fD(Wt,1/i.d7(Ye.tileID.canonical)),ts=new i.fE(Kr,ls,bt,pr,cr,this.brightness,Ot,this.worldview);pr||(ts.needsUpload=!0),It.push(ts),ts.evaluate(is)}this.status="done",Nt(null,{buckets:It,featureIndex:Ot,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Wt=>Nt(new Error(Wt.message)))}}class go{constructor(ye,Pe,Ye,Nt,bt,It,qt,Ot){this.actor=ye,this.layerIndex=Pe,this.availableImages=Ye,this.availableModels=Nt,this.brightness=qt,this.loading={},this.loaded={},this.worldview=Ot}loadTile(ye,Pe){const Ye=ye.uid,Nt=this.loading[Ye]=new dc(ye,this.brightness,this.worldview);i.bu(ye.request,(bt,It)=>{const qt=!this.loading[Ye];return delete this.loading[Ye],qt||bt?(Nt.status="done",qt||(this.loaded[Ye]=Nt),Pe(bt)):It&&It.byteLength!==0?void Nt.parse(It,this.layerIndex,ye,(Ot,Wt)=>{Nt.status="done",this.loaded=this.loaded||{},this.loaded[Ye]=Nt,Ot||!Wt?Pe(Ot):Pe(null,Wt)}):(Nt.status="done",this.loaded[Ye]=Nt,Pe())})}reloadTile(ye,Pe){const Ye=this.loaded,Nt=ye.uid;if(Ye&&Ye[Nt]){const bt=Ye[Nt];bt.projection=ye.projection,bt.brightness=ye.brightness;const It=(qt,Ot)=>{bt.reloadCallback&&(delete bt.reloadCallback,this.loadTile(ye,Pe)),Pe(qt,Ot)};bt.status==="parsing"?bt.reloadCallback=It:bt.status==="done"&&this.loadTile(ye,Pe)}}abortTile(ye,Pe){const Ye=ye.uid;this.loading[Ye]&&delete this.loading[Ye],Pe()}removeTile(ye,Pe){const Ye=this.loaded,Nt=ye.uid;Ye&&Ye[Nt]&&delete Ye[Nt],Pe()}}class uc{constructor(ye){this.self=ye,this.actor=new i.fG(ye,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new i.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=i.cm({name:"mercator"}),this.workerSourceTypes={vector:V,geojson:Ki,"raster-dem":W,"raster-array":ee,"batched-model":go},this.workerSources={},this.self.registerWorkerSource=(Pe,Ye)=>{if(this.workerSourceTypes[Pe])throw new Error(`Worker source with name "${Pe}" already registered.`);this.workerSourceTypes[Pe]=Ye},this.self.registerRTLTextPlugin=Pe=>{if(i.fH.isParsed())throw new Error("RTL text plugin already registered.");i.fH.setState({pluginStatus:i.fI.parsed,pluginURL:i.fH.getPluginURL()}),i.fH.applyArabicShaping=Pe.applyArabicShaping,i.fH.processBidirectionalText=Pe.processBidirectionalText,i.fH.processStyledBidirectionalText=Pe.processStyledBidirectionalText;for(const Ye of this.rtlPluginParsingListeners)Ye(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(ye,Pe,Ye){delete this.layerIndexes[ye],delete this.availableImages[ye],delete this.availableModels[ye],delete this.workerSources[ye],Ye()}checkIfReady(ye,Pe,Ye){Ye()}setReferrer(ye,Pe){this.referrer=Pe}spriteLoaded(ye,Pe){this.isSpriteLoaded[ye]||(this.isSpriteLoaded[ye]={});const{scope:Ye,isLoaded:Nt}=Pe;if(this.isSpriteLoaded[ye][Ye]=Nt,this.workerSources[ye]&&this.workerSources[ye][Ye])for(const bt in this.workerSources[ye][Ye]){const It=this.workerSources[ye][Ye][bt];for(const qt in It){const Ot=It[qt];Ot instanceof V&&(Ot.isSpriteLoaded=Nt,Ot.fire(new i.z("isSpriteLoaded")))}}}setImages(ye,Pe,Ye){this.availableImages[ye]||(this.availableImages[ye]={});const{scope:Nt,images:bt}=Pe;if(this.availableImages[ye][Nt]=bt,this.workerSources[ye]&&this.workerSources[ye][Nt]){for(const It in this.workerSources[ye][Nt]){const qt=this.workerSources[ye][Nt][It];for(const Ot in qt)qt[Ot].availableImages=bt}Ye()}else Ye()}setModels(ye,{scope:Pe,models:Ye},Nt){if(this.availableModels[ye]||(this.availableModels[ye]={}),this.availableModels[ye][Pe]=Ye,this.workerSources[ye]&&this.workerSources[ye][Pe]){for(const bt in this.workerSources[ye][Pe]){const It=this.workerSources[ye][Pe][bt];for(const qt in It)It[qt].availableModels=Ye}Nt()}else Nt()}setProjection(ye,Pe){this.projections[ye]=i.cm(Pe)}setBrightness(ye,Pe,Ye){this.brightness=Pe,Ye()}setWorldview(ye,Pe,Ye){this.worldview=Pe,Ye()}setLayers(ye,Pe,Ye){this.getLayerIndex(ye,Pe.scope).replace(Pe.layers,Pe.options),Ye()}updateLayers(ye,Pe,Ye){this.getLayerIndex(ye,Pe.scope).update(Pe.layers,Pe.removedIds,Pe.options),Ye()}loadTile(ye,Pe,Ye){Pe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).loadTile(Pe,Ye)}decodeRasterArray(ye,Pe,Ye){this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).decodeRasterArray(Pe,Ye)}reloadTile(ye,Pe,Ye){Pe.projection=this.projections[ye]||this.defaultProjection,this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).reloadTile(Pe,Ye)}abortTile(ye,Pe,Ye){this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).abortTile(Pe,Ye)}removeTile(ye,Pe,Ye){this.getWorkerSource(ye,Pe.type,Pe.source,Pe.scope).removeTile(Pe,Ye)}removeSource(ye,Pe,Ye){if(!(this.workerSources[ye]&&this.workerSources[ye][Pe.scope]&&this.workerSources[ye][Pe.scope][Pe.type]&&this.workerSources[ye][Pe.scope][Pe.type][Pe.source]))return;const Nt=this.workerSources[ye][Pe.scope][Pe.type][Pe.source];delete this.workerSources[ye][Pe.scope][Pe.type][Pe.source],Nt.removeSource!==void 0?Nt.removeSource(Pe,Ye):Ye()}loadWorkerSource(ye,Pe,Ye){try{this.self.importScripts(Pe.url),Ye()}catch(Nt){Ye(Nt)}}syncRTLPluginState(ye,Pe,Ye){if(i.fH.isParsed())Ye(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ye);else try{i.fH.setState(Pe);const Nt=i.fH.getPluginURL();!i.fH.isLoaded()||i.fH.isParsed()||i.fH.isParsing()||Nt==null||(i.fH.setState({pluginStatus:i.fI.parsing,pluginURL:i.fH.getPluginURL()}),this.self.importScripts(Nt),i.fH.isParsed()?Ye(null,!0):this.rtlPluginParsingListeners.push(Ye))}catch(Nt){Ye(Nt)}}setDracoUrl(ye,Pe){this.dracoUrl=Pe}getAvailableImages(ye,Pe){this.availableImages[ye]||(this.availableImages[ye]={});let Ye=this.availableImages[ye][Pe];return Ye||(Ye=[]),Ye}getAvailableModels(ye,Pe){this.availableModels[ye]||(this.availableModels[ye]={});let Ye=this.availableModels[ye][Pe];return Ye||(Ye={}),Ye}getLayerIndex(ye,Pe){this.layerIndexes[ye]||(this.layerIndexes[ye]={});let Ye=this.layerIndexes[ye][Pe];return Ye||(Ye=this.layerIndexes[ye][Pe]=new y,Ye.scope=Pe),Ye}getWorkerSource(ye,Pe,Ye,Nt){const bt=this.workerSources;return bt[ye]||(bt[ye]={}),bt[ye][Nt]||(bt[ye][Nt]={}),bt[ye][Nt][Pe]||(bt[ye][Nt][Pe]={}),this.isSpriteLoaded[ye]||(this.isSpriteLoaded[ye]={}),bt[ye][Nt][Pe][Ye]||(bt[ye][Nt][Pe][Ye]=new this.workerSourceTypes[Pe]({send:(It,qt,Ot,Wt,pr,cr)=>this.actor.send(It,qt,Ot,ye,pr,cr),scheduler:this.actor.scheduler},this.getLayerIndex(ye,Nt),this.getAvailableImages(ye,Nt),this.getAvailableModels(ye,Nt),this.isSpriteLoaded[ye][Nt],void 0,this.brightness,this.worldview)),bt[ye][Nt][Pe][Ye]}rasterizeImagesWorker(ye,Pe,Ye){const Nt=new Map;for(const[bt,{image:It,imageVariant:qt}]of Pe.tasks.entries()){const Ot=this.imageRasterizer.rasterize(qt,It,Pe.scope,ye);Nt.set(bt,Ot)}Ye(void 0,Nt)}removeRasterizedImages(ye,Pe,Ye){this.imageRasterizer.removeImagesFromCacheByIds(Pe.imageIds,Pe.scope,ye),Ye()}enforceCacheSizeLimit(ye,Pe){i.fJ(Pe)}getWorkerPerformanceMetrics(ye,Pe,Ye){Ye(void 0,void 0)}}return i.fF(self)&&(self.worker=new uc(self)),uc}),o(["./shared"],function(i){var u="3.17.0";const m={create:"create",load:"load",fullLoad:"fullLoad"},x={mark(w){performance.mark(w)},measure(w,d,p){performance.measure(w,d,p)}};function y(w){const d=w.name.split("?")[0];return i.a(d)&&d.includes("mapbox-gl.js")?"javascript":i.a(d)&&d.includes("mapbox-gl.css")?"css":i.b(d)?"fontRange":i.c(d)?"sprite":i.i(d)?"style":i.d(d)?"tilejson":"other"}var v,b={},N=function(){if(v)return b;function w(j){return!d(j)}function d(j){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,R,B=new Blob([""],{type:"text/javascript"}),H=URL.createObjectURL(B);try{R=new Worker(H),O=!0}catch{O=!1}return R&&R.terminate(),URL.revokeObjectURL(H),O}()?function(){var O=document.createElement("canvas");O.width=O.height=1;var R=O.getContext("2d");if(!R)return!1;var B=R.getImageData(0,0,1,1);return B&&B.width===O.width}()?(p[E=j&&j.failIfMajorPerformanceCaveat]===void 0&&(p[E]=function(O){var R,B=function(H){var X=document.createElement("canvas"),te=Object.create(w.webGLContextAttributes);return te.failIfMajorPerformanceCaveat=H,X.getContext("webgl2",te)}(O);if(!B)return!1;try{R=B.createShader(B.VERTEX_SHADER)}catch{return!1}return!(!R||B.isContextLost())&&(B.shaderSource(R,"void main() {}"),B.compileShader(R),B.getShaderParameter(R,B.COMPILE_STATUS)===!0)}(E)),p[E]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var E}v=1,b.supported=w,b.notSupportedReason=d;var p={};return w.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},b}();function k(w,d,p){const j=document.createElement(w);return d!=null&&(j.className=d),p&&p.appendChild(j),j}function M(w,d,p){const j=document.createElementNS("http://www.w3.org/2000/svg",w);for(const E of Object.keys(d))j.setAttributeNS(null,E,String(d[E]));return p&&p.appendChild(j),j}const I=typeof document<"u"?document.documentElement&&document.documentElement.style:null,T=I&&I.userSelect!==void 0?"userSelect":"WebkitUserSelect";let P;function F(){I&&T&&(P=I[T],I[T]="none")}function D(){I&&T&&(I[T]=P)}function U(w){w.preventDefault(),w.stopPropagation(),window.removeEventListener("click",U,!0)}function V(){window.addEventListener("click",U,!0),window.setTimeout(()=>{window.removeEventListener("click",U,!0)},0)}function W(w,d){const p=w.getBoundingClientRect();return ae(w,p,d)}function G(w,d){const p=w.getBoundingClientRect(),j=[];for(let E=0;Ethis._skuTokenExpiresAt}transformRequest(d,p){return this._transformRequestFn&&this._transformRequestFn(d,p)||{url:d}}normalizeStyleURL(d,p){if(!i.h(d))return d;const j=se(d);return j.params.push(`sdk=js-${u}`),j.path=`/styles/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||p)}normalizeGlyphsURL(d,p){if(!i.h(d))return d;const j=se(d);return j.path=`/fonts/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||p)}normalizeModelURL(d,p){if(!i.h(d))return d;const j=se(d);return j.path=`/models/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||p)}normalizeSourceURL(d,p,j,E){if(!i.h(d))return d;const O=se(d);return O.path=`/v4/${O.authority}.json`,O.params.push("secure"),j&&O.params.push(`language=${j}`),E&&O.params.push(`worldview=${E}`),this._makeAPIURL(O,this._customAccessToken||p)}normalizeIconsetURL(d,p){const j=se(d);return i.h(d)?(j.path=`/styles/v1${j.path}/iconset.pbf`,this._makeAPIURL(j,this._customAccessToken||p)):me(j)}normalizeSpriteURL(d,p,j,E){const O=se(d);return i.h(d)?(O.path=`/styles/v1${O.path}/sprite${p}${j}`,this._makeAPIURL(O,this._customAccessToken||E)):(O.path+=`${p}${j}`,me(O))}normalizeTileURL(d,p,j){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!i.h(d))return d;const E=se(d);E.path=E.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${p||j&&E.authority!=="raster"&&j===512?"@2x":""}${i.k.supported?".webp":"$1"}`),E.authority==="raster"?E.path=`/${i.e.RASTER_URL_PREFIX}${E.path}`:E.authority==="rasterarrays"?E.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${E.path}`:E.authority==="3dtiles"?E.path=`/${i.e.TILES3D_URL_PREFIX}${E.path}`:(E.path=E.path.replace(/^.+\/v4\//,"/"),E.path=`/${i.e.TILE_URL_VERSION}${E.path}`);const O=this._customAccessToken||function(R){for(const B of R){const H=B.match(/^access_token=(.*)$/);if(H)return H[1]}return null}(E.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&O&&this._skuToken&&E.params.push(`sku=${this._skuToken}`),this._makeAPIURL(E,O)}canonicalizeTileURL(d,p){const j=se(d);if(!j.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!j.path.match(/\.[\w]+$/))return d;let E="mapbox://";j.path.match(/^\/raster\/v1\//)?E+=`raster/${j.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:j.path.match(/^\/rasterarrays\/v1\//)?E+=`rasterarrays/${j.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:E+=`tiles/${j.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let O=j.params;return p&&(O=O.filter(R=>!R.match(/^access_token=/))),O.length&&(E+=`?${O.join("&")}`),E}canonicalizeTileset(d,p){const j=!!p&&i.h(p),E=[];for(const O of d.tiles||[])i.j(O)?E.push(this.canonicalizeTileURL(O,j)):E.push(O);return E}_makeAPIURL(d,p){const j="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",E=se(i.e.API_URL);if(d.protocol=E.protocol,d.authority=E.authority,d.protocol==="http"){const O=d.params.indexOf("secure");O>=0&&d.params.splice(O,1)}if(E.path!=="/"&&(d.path=`${E.path}${d.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return me(d);if(p=p||i.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!p)throw new Error(`An API access token is required to use Mapbox GL. ${j}`);if(p[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${j}`)}return d.params=d.params.filter(O=>O.indexOf("access_token")===-1),d.params.push(`access_token=${p||""}`),me(d)}}const fe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function se(w){const d=w.match(fe);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 me(w){const d=w.params.length?`?${w.params.join("&")}`:"";return`${w.protocol}://${w.authority}${w.path}${d}`}const ue="mapbox.eventData";function xe(w){if(!w)return null;const d=w.split(".");if(!d||d.length!==3)return null;try{return JSON.parse(i.l(d[1]))}catch{return null}}class Te{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const p=xe(i.e.ACCESS_TOKEN);let j="";return j=p&&p.u?i.f(p.u):i.e.ACCESS_TOKEN||"",d?`${ue}.${d}:${j}`:`${ue}:${j}`}fetchEventData(){const d=i.s("localStorage"),p=this.getStorageKey(),j=this.getStorageKey("uuid"),E=this.getStorageKey("uuidTimestamp");if(d)try{const O=localStorage.getItem(p);O&&(this.eventData=JSON.parse(O));const R=localStorage.getItem(j);R&&(this.anonId=R);const B=localStorage.getItem(E);B&&(this.anonIdTimestamp=Number(B));const H=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(p,JSON.stringify(this.eventData)),R&&localStorage.setItem(E,R.toString())}catch{i.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,p,j,E){if(!i.e.EVENTS_URL)return;const O=se(i.e.EVENTS_URL);O.params.push(`access_token=${E||i.e.ACCESS_TOKEN||""}`);const R={event:this.type,created:new Date(d).toISOString()},B=p?Object.assign(R,p):R,H={url:me(O),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=i.p(H,X=>{this.pendingRequest=null,j(X),this.saveEventData(),this.processRequests(E)})}queueRequest(d,p){this.queue.push(d),this.processRequests(p)}}class _e extends Te{constructor(d){super("metrics"),d&&(this.data=d)}postMetricsEvent(d){if(!i.e.EVENTS_URL||!d&&!i.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID();const p=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:p},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:p,payload:j}=this.queue.shift();this.postEvent(p,j,()=>{},d)}}const we=new class extends Te{constructor(w){super("appUserTurnstile"),this._customAccessToken=w}postTurnstileEvent(w,d){i.e.EVENTS_URL&&i.e.ACCESS_TOKEN&&Array.isArray(w)&&w.some(p=>i.h(p)||i.j(p))&&this.queueRequest(Date.now(),d)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=xe(i.e.ACCESS_TOKEN),p=d?d.u:i.e.ACCESS_TOKEN;let j=p!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),j=!0);const E=this.queue.shift();if(this.eventData.lastSuccess){const O=new Date(this.eventData.lastSuccess),R=new Date(E),B=(E-this.eventData.lastSuccess)/864e5;j=j||B>=1||B<-1||O.getDate()!==R.getDate()}else j=!0;j?this.postEvent(E,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:oe,"enabled.telemetry":!1,userId:this.anonId},O=>{O||(this.eventData.lastSuccess=E,this.eventData.tokenU=p)},w):this.processRequests()}},ve=we.postTurnstileEvent.bind(we),Xe=new class extends Te{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(w,d,p,j){this.skuToken=d,this.errorCb=j,i.e.EVENTS_URL&&(p||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},p):this.errorCb(new Error(pe)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:p}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(p,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:oe,skuToken:this.skuToken,userId:this.anonId},j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},w))}remove(){this.errorCb=null}},Me=Xe.postMapLoadEvent.bind(Xe),Ie=new class extends Te{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(w){let d=this.mapInstanceIdMap.get(w);return d||(d=i.u(),this.mapInstanceIdMap.set(w,d)),d}getEventId(w){const d=this.eventIdPerMapInstanceMap.get(w)||0;return this.eventIdPerMapInstanceMap.set(w,d+1),d}postStyleLoadEvent(w,d){const{map:p,style:j,importedStyles:E}=d;if(!i.e.EVENTS_URL||!w&&!i.e.ACCESS_TOKEN)return;const O=this.getMapInstanceId(p),R={mapInstanceId:O,eventId:this.getEventId(O),style:j};E.length&&(R.importedStyles=E),this.queueRequest({timestamp:Date.now(),payload:R},w)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:p}=this.queue.shift();this.postEvent(d,p,()=>{},w)}},$e=Ie.postStyleLoadEvent.bind(Ie),Be=new _e({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Ve=Be.postMetricsEvent.bind(Be),ot=new _e({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Tt=ot.postMetricsEvent.bind(ot),Oe=new class extends Te{constructor(){super("gljs.performance")}postPerformanceEvent(w,d){i.e.EVENTS_URL&&(w||i.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},w)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:p}=this.queue.shift(),j=function(E){const O=performance.getEntriesByType("resource"),R=performance.getEntriesByType("mark"),B=function(he){const ke={};if(he){for(const be in he)if(be!=="other")for(const Re of he[be]){const De=`${be}ResolveRangeMin`,We=`${be}ResolveRangeMax`,nt=`${be}RequestCount`,Ge=`${be}RequestCachedCount`;ke[De]=Math.min(ke[De]||1/0,Re.startTime),ke[We]=Math.max(ke[We]||-1/0,Re.responseEnd);const jt=gt=>{ke[gt]===void 0&&(ke[gt]=0),++ke[gt]};Re.transferSize!==void 0&&Re.transferSize===0&&jt(Ge),jt(nt)}}return ke}(function(he,ke){const be={};if(he)for(const Re of he){const De=ke(Re);be[De]===void 0&&(be[De]=[]),be[De].push(Re)}return be}(O,y)),H=window.devicePixelRatio,X=navigator.connection||navigator.mozConnection||navigator.webkitConnection,te=X?X.effectiveType:void 0,de={counters:[],metadata:[],attributes:[]},ce=(he,ke,be)=>{be!=null&&he.push({name:ke,value:be.toString()})};for(const he in B)ce(de.counters,he,B[he]);if(E.interactionRange[0]!==1/0&&E.interactionRange[1]!==-1/0&&(ce(de.counters,"interactionRangeMin",E.interactionRange[0]),ce(de.counters,"interactionRangeMax",E.interactionRange[1])),R)for(const he of Object.values(m)){const ke=R.find(be=>be.name===he);ke&&ce(de.counters,he,ke.startTime)}return ce(de.counters,"visibilityHidden",E.visibilityHidden),ce(de.attributes,"style",function(he){if(he)for(const ke of he){const be=ke.name.split("?")[0];if(i.i(be)){const Re=be.split("/").slice(-2);if(Re.length===2)return`mapbox://styles/${Re[0]}/${Re[1]}`}}}(O)),ce(de.attributes,"terrainEnabled",E.terrainEnabled?"true":"false"),ce(de.attributes,"fogEnabled",E.fogEnabled?"true":"false"),ce(de.attributes,"projection",E.projection),ce(de.attributes,"zoom",E.zoom),ce(de.metadata,"devicePixelRatio",H),ce(de.metadata,"connectionEffectiveType",te),ce(de.metadata,"navigatorUserAgent",navigator.userAgent),ce(de.metadata,"screenWidth",window.screen.width),ce(de.metadata,"screenHeight",window.screen.height),ce(de.metadata,"windowWidth",window.innerWidth),ce(de.metadata,"windowHeight",window.innerHeight),ce(de.metadata,"mapWidth",E.width/H),ce(de.metadata,"mapHeight",E.height/H),ce(de.metadata,"webglRenderer",E.renderer),ce(de.metadata,"webglVendor",E.vendor),ce(de.metadata,"sdkVersion",u),ce(de.metadata,"sdkIdentifier","mapbox-gl-js"),de}(p);for(const E of j.metadata);for(const E of j.counters);for(const E of j.attributes);this.postEvent(d,j,()=>{},w)}},at=Oe.postPerformanceEvent.bind(Oe),le=new class extends Te{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(w,d,p,j){if(!i.e.API_URL||!i.e.SESSION_PATH)return;const E=se(i.e.API_URL+i.e.SESSION_PATH);E.params.push(`sku=${d||""}`),E.params.push(`access_token=${j||i.e.ACCESS_TOKEN||""}`);const O={url:me(E),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(O,R=>{this.pendingRequest=null,p(R),this.saveEventData(),this.processRequests(j)})}getSessionAPI(w,d,p,j){this.skuToken=d,this.errorCb=j,i.e.SESSION_PATH&&i.e.API_URL&&(p||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},p):this.errorCb(new Error(pe)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:p}=this.queue.shift();d&&this.success[d]||this.getSession(p,this.skuToken,j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},w)}remove(){this.errorCb=null}},qe=le.getSessionAPI.bind(le),Je=new Set;function st(w,d){d?Je.add(w):Je.delete(w)}class je{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,p){this._updatedSourceCaches[d]=p,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const p=d.scope;this._updatedLayers[p]=this._updatedLayers[p]||new Set,this._updatedLayers[p].add(d.id),this.setDirty()}removeLayer(d){const p=d.scope;this._removedLayers[p]=this._removedLayers[p]||{},this._updatedLayers[p]=this._updatedLayers[p]||new Set,this._removedLayers[p][d.id]=d,this._updatedLayers[p].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 p in this._updatedLayers)d[p]=d[p]||{},d[p].updatedIds=Array.from(this._updatedLayers[p].values());for(const p in this._removedLayers)d[p]=d[p]||{},d[p].removedIds=Object.keys(this._removedLayers[p]);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,p){this._updatedImages[p]=this._updatedImages[p]||new Set,this._updatedImages[p].add(i.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 ut(w){const{userImage:d}=w;return!!(d&&d.render&&d.render())&&(w.data.replace(new Uint8Array(d.data.buffer)),!0)}class Ce extends i.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"&&i.r()&&(this.imageRasterizerDispatcher=new i.D(i.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 i.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 p=this.atlasTexture.get(d);p&&(p.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,p){this.imageProviders.has(p)||this.imageProviders.set(p,new Map),this.imageProviders.get(p).set(d.id,d)}removeImageProvider(d,p){this.imageProviders.has(p)&&this.imageProviders.get(p).delete(d)}getPendingImageProviders(){const d=[];for(const p of this.imageProviders.values())for(const j of p.values())j.hasPendingRequests()&&d.push(j);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new i.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,p){if(this.loaded.get(p)!==d&&(this.loaded.set(p,d),d)){for(const{ids:j,callback:E}of this.requestors)this._notify(j,p,E);this.requestors=[]}}hasImage(d,p){return!!this.getImage(d,p)}getImage(d,p){return this.images.get(p).get(d.toString())}addImage(d,p,j){this._validate(d,j)&&this.images.get(p).set(d.toString(),j)}_validate(d,p){let j=!0;return this._validateStretch(p.stretchX,p.data&&p.data.width)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),j=!1),this._validateStretch(p.stretchY,p.data&&p.data.height)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),j=!1),this._validateContent(p.content,p)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "content" value`))),j=!1),j}_validateStretch(d,p){if(!d)return!0;let j=0;for(const E of d){if(E[0]i.I.from(p))}getImages(d,p,j){const E=[],O=[],R=this.imageProviders.get(p);for(const te of d){if(!te.iconsetId){E.push(te);continue}const de=R.get(te.iconsetId);de&&(this.getImage(te,p)?O.push(te):de.addPendingRequest(te))}if(E.length===0)return void this._notify(O,p,j);let B=!0;const H=!!this.loaded.get(p),X=this.images.get(p);if(!H)for(const te of E)X.has(te.toString())||(B=!1);H||B?this._notify(E,p,j):this.requestors.push({ids:E,scope:p,callback:j})}rasterizeImages(d,p){const j=new Map,{tasks:E,scope:O}=d;for(const[R,B]of E.entries()){const H=this.getImage(B.id,O);H&&j.set(R,{image:H,imageVariant:B})}this._rasterizeImages(O,j,p)}_rasterizeImages(d,p,j){if(i.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:p,scope:d},j);else{const E=new Map;for(const[O,{image:R,imageVariant:B}]of p.entries())E.set(O,this.imageRasterizer.rasterize(B,R,d,0));j(void 0,E)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,p,j){const E=this.images.get(p),O=new Map;for(const R of d){if(!E.get(R.toString())){if(R.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:R.name}))}const B=E.get(R.toString());if(!B){i.w(`Image "${R.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 H={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(H,{width:B.icon.usvg_tree.width,height:B.icon.usvg_tree.height}),O.set(i.I.toString(R),H)}j(null,O)}getPixelSize(d){const{width:p,height:j}=this.atlasImage.get(d);return{width:p,height:j}}getPattern(d,p,j){const E=d.toString(),O=this.patterns.get(p),R=O.get(E),B=this.getImage(d,p);if(!B)return null;if(R){if(R.position.version===B.version)return R.position;R.position.version=B.version}else{if(B.usvg&&!B.data){const H=this.getPatternInFlightId(E,p);if(this.patternsInFlight.has(H))return null;this.patternsInFlight.add(H);const X=new i.A(d).scaleSelf(i.o.devicePixelRatio),te=new Map([[X.toString(),{image:B,imageVariant:X}]]);return this._rasterizeImages(p,te,(de,ce)=>this.storePatternImage(X,p,B,j,ce)),null}this.storePattern(d,p,B)}return this._updatePatternAtlas(p,j),O.get(E).position}getPatternInFlightId(d,p){return i.B(d,p)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,p,j,E,O){const R=d.toString(),B=O?O.get(R):void 0;B&&(j.data=B,this.storePattern(d.id,p,j),this._updatePatternAtlas(p,E),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),p)))}storePattern(d,p,j){const E={w:j.data.width+2*i.C,h:j.data.height+2*i.C,x:0,y:0},O=new i.F(E,j,i.C);this.patterns.get(p).set(d.toString(),{bin:E,position:O})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,p){const j=d.gl;let E=this.atlasTexture.get(p);E?this.dirty&&(E.update(this.atlasImage.get(p)),this.dirty=!1):(E=new i.T(d,this.atlasImage.get(p),j.RGBA8),this.atlasTexture.set(p,E)),E.bind(j.LINEAR,j.CLAMP_TO_EDGE)}_updatePatternAtlas(d,p){const j=this.patterns.get(d),E=Array.from(j.values()).map(({bin:X})=>X),{w:O,h:R}=i.G(E),B=this.atlasImage.get(d);B.resize({width:O||1,height:R||1});const H=this.images.get(d);for(const[X,{bin:te,position:de}]of j.entries()){let ce=de.padding;const he=te.x+ce,ke=te.y+ce,be=H.get(X).data,Re=be.width,De=be.height;ce=ce>1?ce-1:ce,i.q.copy(be,B,{x:0,y:0},{x:he,y:ke},{width:Re,height:De},p),i.q.copy(be,B,{x:0,y:De-ce},{x:he,y:ke-ce},{width:Re,height:ce},p),i.q.copy(be,B,{x:0,y:0},{x:he,y:ke+De},{width:Re,height:ce},p),i.q.copy(be,B,{x:Re-ce,y:0},{x:he-ce,y:ke},{width:ce,height:De},p),i.q.copy(be,B,{x:0,y:0},{x:he+Re,y:ke},{width:ce,height:De},p),i.q.copy(be,B,{x:Re-ce,y:De-ce},{x:he-ce,y:ke-ce},{width:ce,height:ce},p),i.q.copy(be,B,{x:0,y:De-ce},{x:he+Re,y:ke-ce},{width:ce,height:ce},p),i.q.copy(be,B,{x:0,y:0},{x:he+Re,y:ke+De},{width:ce,height:ce},p),i.q.copy(be,B,{x:Re-ce,y:0},{x:he-ce,y:ke+De},{width:ce,height:ce},p)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,p){const j=this.images.get(p);for(const E of d){if(this.callbackDispatchedThisFrame.get(p).has(E.toString()))continue;this.callbackDispatchedThisFrame.get(p).add(E.toString());const O=j.get(E.toString());ut(O)&&this.updateImage(E,p,O)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Ee(w){const d=w.value,p=w.valueSpec,j=w.style,E=w.styleSpec,O=w.key,R=w.arrayElementValidator||us;if(!Array.isArray(d))return[new i.V(O,d,`array expected, ${i.K(d)} found`)];if(p.length&&d.length!==p.length)return[new i.V(O,d,`array length ${p.length} expected, length ${d.length} found`)];if(p["min-length"]&&d.lengthE)return[new i.V(d,p,`${p} is greater than the maximum value ${E}`)]}return[]}function Le(w){const d=w.key,p=w.value;if(!i.H(p))return[new i.V(d,p,`object expected, ${i.K(p)} found`)];const j=w.valueSpec,E=i.J(p.type);let O,R,B,H={};const X=E!=="categorical"&&p.property===void 0,te=!X,de=function(be){const Re=be.stops;return Array.isArray(Re)&&Array.isArray(Re[0])&&i.H(Re[0][0])}(p),ce=ra({key:w.key,value:w.value,valueSpec:w.styleSpec.function,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{stops:function(be){if(E==="identity")return[new i.V(be.key,be.value,'identity function may not have a "stops" property')];let Re=[];const De=be.value;return Re=Re.concat(Ee({key:be.key,value:De,valueSpec:be.valueSpec,style:be.style,styleSpec:be.styleSpec,arrayElementValidator:he})),Array.isArray(De)&&De.length===0&&Re.push(new i.V(be.key,De,"array must have at least one stop")),Re},default:function(be){return us({key:be.key,value:be.value,valueSpec:j,style:be.style,styleSpec:be.styleSpec})}}});return E==="identity"&&X&&ce.push(new i.V(w.key,w.value,'missing required property "property"')),E==="identity"||p.stops||ce.push(new i.V(w.key,w.value,'missing required property "stops"')),E==="exponential"&&j.expression&&!i.M(j)&&ce.push(new i.V(w.key,w.value,"exponential functions not supported")),w.styleSpec.$version>=8&&(te&&!i.N(j)?ce.push(new i.V(w.key,w.value,"property functions not supported")):X&&!i.O(j)&&ce.push(new i.V(w.key,w.value,"zoom functions not supported"))),E!=="categorical"&&!de||p.property!==void 0||ce.push(new i.V(w.key,w.value,'"property" property is required')),ce;function he(be){let Re=[];const De=be.value,We=be.key;if(!Array.isArray(De))return[new i.V(We,De,`array expected, ${i.K(De)} found`)];if(De.length!==2)return[new i.V(We,De,`array length 2 expected, length ${De.length} found`)];if(de){if(!i.H(De[0]))return[new i.V(We,De,`object expected, ${i.K(De[0])} found`)];const nt=De[0];if(nt.zoom===void 0)return[new i.V(We,De,"object stop key must have zoom")];if(nt.value===void 0)return[new i.V(We,De,"object stop key must have value")];const Ge=i.J(nt.zoom);if(typeof Ge!="number")return[new i.V(We,nt.zoom,"stop zoom values must be numbers")];if(B&&B>Ge)return[new i.V(We,nt.zoom,"stop zoom values must appear in ascending order")];Ge!==B&&(B=Ge,R=void 0,H={}),Re=Re.concat(ra({key:`${We}[0]`,value:De[0],valueSpec:{zoom:{}},style:be.style,styleSpec:be.styleSpec,objectElementValidators:{zoom:Ze,value:ke}}))}else Re=Re.concat(ke({key:`${We}[0]`,value:De[0],style:be.style,styleSpec:be.styleSpec},De));return i.Q(i.S(De[1]))?Re.concat([new i.V(`${We}[1]`,De[1],"expressions are not allowed in function stops.")]):Re.concat(us({key:`${We}[1]`,value:De[1],valueSpec:j,style:be.style,styleSpec:be.styleSpec}))}function ke(be,Re){const De=i.K(be.value),We=i.J(be.value),nt=be.value!==null?be.value:Re;if(O){if(De!==O)return[new i.V(be.key,nt,`${De} stop domain type must match previous stop domain type ${O}`)]}else O=De;if(De!=="number"&&De!=="string"&&De!=="boolean"&&typeof We!="number"&&typeof We!="string"&&typeof We!="boolean")return[new i.V(be.key,nt,"stop domain value must be a number, string, or boolean")];if(De!=="number"&&E!=="categorical"){let Ge=`number expected, ${De} found`;return i.N(j)&&E===void 0&&(Ge+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(be.key,nt,Ge)]}return E!=="categorical"||De!=="number"||typeof We=="number"&&isFinite(We)&&Math.floor(We)===We?E!=="categorical"&&De==="number"&&typeof We=="number"&&typeof R=="number"&&R!==void 0&&Wenew i.V(`${w.key}${j.key}`,w.value,j.message));const p=d.value.expression||d.value._styleExpression.expression;if(w.expressionContext==="property"&&w.propertyKey==="text-font"&&!p.outputDefined())return[new i.V(w.key,w.value,`Invalid data expression for "${w.propertyKey}". Output values must be contained as literals within the expression.`)];if(w.expressionContext==="property"&&w.propertyType==="layout"&&!i.Z(p))return[new i.V(w.key,w.value,'"feature-state" data expressions are not supported with layout properties.')];if(w.expressionContext==="filter")return tt(p,w);if(w.expressionContext==="appearance")return ct(p,w);if(w.expressionContext&&w.expressionContext.indexOf("cluster")===0){if(!i.X(p,["zoom","feature-state"]))return[new i.V(w.key,w.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(w.expressionContext==="cluster-initial"&&!i.Y(p))return[new i.V(w.key,w.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function tt(w,d){const p=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const E of d.valueSpec.expression.parameters)p.delete(E);if(p.size===0)return[];const j=[];return w instanceof i._&&p.has(w.name)?[new i.V(d.key,d.value,`["${w.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(w.eachChild(E=>{j.push(...tt(E,d))}),j)}function ct(w,d){const p=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const E of d.valueSpec.expression.parameters)p.add(E);if(p.size===0)return[];const j=[];return w instanceof i._&&!p.has(w.name)?[new i.V(d.key,d.value,`["${w.name}"] is not an allowed parameter`)]:(w.eachChild(E=>{j.push(...ct(E,d))}),j)}function it(w){const d=w.key,p=w.value,j=w.valueSpec,E=[];return Array.isArray(j.values)?j.values.indexOf(i.J(p))===-1&&E.push(new i.V(d,p,`expected one of [${j.values.join(", ")}], ${JSON.stringify(p)} found`)):Object.keys(j.values).indexOf(i.J(p))===-1&&E.push(new i.V(d,p,`expected one of [${Object.keys(j.values).join(", ")}], ${JSON.stringify(p)} found`)),E}function zt(w){return i.a2(i.S(w.value))?Ke(Object.assign({},w,{expressionContext:"filter",valueSpec:w.styleSpec[`filter_${w.layerType||"fill"}`]})):Lt(w)}function Lt(w){const d=w.value,p=w.key;if(!Array.isArray(d))return[new i.V(p,d,`array expected, ${i.K(d)} found`)];if(d.length<1)return[new i.V(p,d,"filter array must have at least 1 element")];const j=w.styleSpec;let E=it({key:`${p}[0]`,value:d[0],valueSpec:j.filter_operator});const O=()=>{d.length>=2&&(i.a0(d[1])||E.push(new i.V(`${p}[1]`,d[1],`string expected, ${i.K(d[1])} found`)));for(let R=2;R":case">=":d.length>=2&&i.J(d[1])==="$type"&&E.push(new i.V(p,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&E.push(new i.V(p,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"==":case"!=":d.length!==3&&E.push(new i.V(p,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 R=1;R{X in p&&d.push(new i.V(j,p[X],`"${X}" is prohibited for ref layers`))}),E.layers.forEach(X=>{i.J(X.id)===B&&(H=X)}),H?H.ref?d.push(new i.V(j,p.ref,"ref cannot reference another ref layer")):R=i.J(H.type):typeof B=="string"&&d.push(new i.V(j,p.ref,`ref layer "${B}" not found`))}else if(R!=="background"&&R!=="sky"&&R!=="slot")if(p.source)if(i.a0(p.source)){const H=E.sources&&E.sources[p.source],X=H&&i.J(H.type);H?X==="vector"&&R==="raster"?d.push(new i.V(j,p.source,`layer "${p.id}" requires a raster source`)):X==="raster"&&R!=="raster"?d.push(new i.V(j,p.source,`layer "${p.id}" requires a vector source`)):X!=="vector"||p["source-layer"]?X==="raster-dem"&&R!=="hillshade"?d.push(new i.V(j,p.source,"raster-dem source can only be used with layer type 'hillshade'.")):X!=="raster-array"||["raster","raster-particle"].includes(R)?R==="line"&&p.paint&&(p.paint["line-gradient"]||p.paint["line-trim-offset"])&&X==="geojson"&&!H.lineMetrics?d.push(new i.V(j,p,`layer "${p.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):R==="raster-particle"&&X!=="raster-array"&&d.push(new i.V(j,p.source,`layer "${p.id}" requires a 'raster-array' source.`)):d.push(new i.V(j,p.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new i.V(j,p,`layer "${p.id}" must specify a "source-layer"`)):d.push(new i.V(j,p.source,`source "${p.source}" not found`))}else d.push(new i.V(`${j}.source`,p.source,'"source" must be a string'));else d.push(new i.V(j,p,'missing required property "source"'));return d=d.concat(ra({key:j,value:p,valueSpec:O.layer,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":()=>[],type:()=>us({key:`${j}.type`,value:p.type,valueSpec:O.layer.type,style:w.style,styleSpec:w.styleSpec,object:p,objectKey:"type"}),filter:H=>zt(Object.assign({layerType:R},H)),layout:H=>ra({layer:p,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":X=>Mr(Object.assign({layerType:R},X))}}),paint:H=>ra({layer:p,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":X=>Ar(Object.assign({layerType:R,layer:p},X))}}),appearances(H){const X=Ee({key:H.key,value:H.value,valueSpec:H.valueSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:ce=>function(he){const{key:ke,layer:be,layerType:Re}=he,De=i.J(he.value),We=i.J(De.name),nt=i.J(De.condition),Ge=ra({key:ke,value:De,valueSpec:he.styleSpec.appearance,style:he.style,styleSpec:he.styleSpec,objectElementValidators:{condition:jt=>function(gt){const _t=[];return _t.push(...Ke({key:gt.key,value:gt.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),_t}(Object.assign({layer:be,layerType:Re},jt)),properties:jt=>function(gt){const _t=[],{styleSpec:pt,layer:ht,layerType:St}=gt,Rt=pt[`paint_${St}`],Dt=pt[`layout_${St}`],Yt=gt.object[gt.objectKey];for(const Xt in Yt){const or=Xt in Rt?"paint":Xt in Dt?"layout":void 0;if(!or){_t.push(new i.V(gt.key,Xt,`unknown property "${Xt}" for layer type "${St}"`));continue}const wr=Object.assign({},gt,{key:`${gt.key}.${Xt}`,object:Yt,objectKey:Xt,layer:ht,layerType:St,value:Yt[Xt],valueSpec:or==="paint"?Rt[Xt]:Dt[Xt]});_t.push(...lr(wr,or))}return _t}(Object.assign({layer:be,layerType:Re},jt))}});return We!=="hidden"&&nt===void 0&&Ge.push(new i.V(he.key,"name",'Appearance with name different than "hidden" must have a condition')),Ge}(Object.assign({layerType:R,layer:p},ce))}),te=Array.isArray(H.value)?H.value:[],de=new Set;return te.forEach((ce,he)=>{const ke=i.J(ce.name);if(ke)if(de.has(ke)){const be=i.J(p.id);X.push(new i.V(H.key,ke,`Duplicated appearance name "${ke}" for layer "${be}"`))}else de.add(ke)}),X}}})),d}function Xn({key:w,value:d}){return i.a0(d)?[]:[new i.V(w,d,`string expected, ${i.K(d)} found`)]}const dr={promoteId:function w({key:d,value:p}){if(i.a0(p))return Xn({key:d,value:p});if(Array.isArray(p)){const E=[],O=i.S(p),R=i.U(O);return R.result==="error"&&R.value.forEach(B=>{E.push(new i.V(`${d}${B.key}`,null,`${B.message}`))}),i.X(R.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"])||E.push(new i.V(`${d}`,null,"promoteId expression should be only feature dependent")),E}if(!i.H(p))return[new i.V(d,p,`string, expression or object expected, "${i.K(p)}" found`)];const j=[];for(const E in p)j.push(...w({key:`${d}.${E}`,value:p[E]}));return j}};function En(w){const d=w.value,p=w.key,j=w.styleSpec,E=w.style;if(!i.H(d))return[new i.V(p,d,`object expected, ${i.K(d)} found`)];if(!("type"in d))return[new i.V(p,d,'"type" is required')];const O=i.J(d.type);let R=[];switch(["vector","raster","raster-dem","raster-array"].includes(O)&&("url"in d||"tiles"in d||R.push(new i.a3(p,d,'Either "url" or "tiles" is required.'))),O){case"vector":case"raster":case"raster-dem":case"raster-array":return R=R.concat(ra({key:p,value:d,valueSpec:j[`source_${O.replace("-","_")}`],style:w.style,styleSpec:j,objectElementValidators:dr})),R;case"geojson":if(R=ra({key:p,value:d,valueSpec:j.source_geojson,style:E,styleSpec:j,objectElementValidators:dr}),"cluster"in d&&"clusterProperties"in d){if(!i.H(d.clusterProperties))return[new i.V(`${p}.clusterProperties`,d,`object expected, ${i.K(d)} found`)];for(const B in d.clusterProperties){const H=d.clusterProperties[B];if(!Array.isArray(H))return[new i.V(`${p}.clusterProperties.${B}`,H,"array expected")];const[X,te]=H,de=typeof X=="string"?[X,["accumulated"],["get",B]]:X;R.push(...Ke({key:`${p}.${B}.map`,value:te,expressionContext:"cluster-map"})),R.push(...Ke({key:`${p}.${B}.reduce`,value:de,expressionContext:"cluster-reduce"}))}}return R;case"video":return ra({key:p,value:d,valueSpec:j.source_video,style:E,styleSpec:j});case"image":return ra({key:p,value:d,valueSpec:j.source_image,style:E,styleSpec:j});case"canvas":return[new i.V(p,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return it({key:`${p}.type`,value:d.type,valueSpec:{values:Es(j)}})}}function Es(w){return w.source.reduce((d,p)=>{const j=w[p];return j.type.type==="enum"&&(d=d.concat(Object.keys(j.type.values||{}))),d},[])}function Hs(w){const d=w.value,p=w.styleSpec,j=p.light,E=w.style;if(d===void 0)return[];if(!i.H(d))return[new i.V("light",d,`object expected, ${i.K(d)} found`)];let O=[];for(const R in d){const B=R.match(/^(.*)-transition$/),H=R.match(/^(.*)-use-theme$/);O=O.concat(H&&j[H[1]]?us({key:R,value:d[R],valueSpec:{type:"string"},style:E,styleSpec:p}):B&&j[B[1]]&&j[B[1]].transition?us({key:R,value:d[R],valueSpec:p.transition,style:E,styleSpec:p}):j[R]?us({key:R,value:d[R],valueSpec:j[R],style:E,styleSpec:p}):[new i.V(R,d[R],`unknown property "${R}"`)])}return O}function Ei(w){const d=w.value;if(!d)return[];const p=w.key;if(!i.H(d))return[new i.V(p,d,`object expected, ${i.K(d)} found`)];let j=[];const E=w.styleSpec,O=E["light-3d"],R=w.style,B=w.style.lights;for(const te of["type","id"])if(!(te in d))return j=j.concat([new i.V(p,d,`missing property "${te}"`)]),j;if(!i.a0(d.type))return j=j.concat([new i.V(`${p}.type`,d.type,"string expected")]),j;if(B)for(let te=0;te[],array:Ee,boolean:function(w){const d=w.value,p=w.key;return i.$(d)?[]:[new i.V(p,d,`boolean expected, ${i.K(d)} found`)]},number:Ze,color:function({key:w,value:d}){return i.a0(d)?i.a1.parseCSSColor(d)===null?[new i.V(w,d,`color expected, "${d}" found`)]:[]:[new i.V(w,d,`color expected, ${i.K(d)} found`)]},enum:it,filter:zt,function:Le,layer:Zr,object:ra,source:En,model:i.a7,light:Hs,"light-3d":Ei,terrain:Ii,fog:Ho,string:Xn,formatted:function(w){return Xn(w).length===0?[]:Ke(w)},resolvedImage:function(w){return Xn(w).length===0?[]:Ke(w)},projection:function(w){const d=w.value,p=w.styleSpec,j=p.projection,E=w.style;if(i.H(d)){let O=[];for(const R in d)O=O.concat(us({key:R,value:d[R],valueSpec:j[R],style:E,styleSpec:p}));return O}return i.a0(d)?[]:[new i.V("projection",d,`object or string expected, ${i.K(d)} found`)]},import:function(w){const d=w.key,{value:p,styleSpec:j}=w;if(!i.H(p))return[new i.V(d,p,"import must be an object")];const{data:E,...O}=p;Object.defineProperty(O,"__line__",{value:p.__line__,enumerable:!1});let R=ra(Object.assign({},w,{value:O,valueSpec:j.import}));return i.J(O.id)===""&&R.push(new i.V(`${w.key}.id`,O,"import id can't be an empty string")),E&&(R=R.concat(Ys(E,j,{key:`${w.key}.data`}))),R},iconset:function(w){const d=w.value,p=w.key,j=w.styleSpec,E=w.style;if(!i.H(d))return[new i.V(p,d,"object expected")];if(!d.type)return[new i.V(p,d,'"type" is required')];const O=i.J(d.type);let R=[];if(R=R.concat(ra({key:p,value:d,valueSpec:j[`iconset_${O}`],style:E,styleSpec:j})),function(B,H){return!(B!=="source"||!H.source)}(O,d)){const B=E.sources&&E.sources[d.source],H=B&&i.J(B.type);B?H!=="raster-array"&&R.push(new i.V(p,d.source,`iconset cannot be used with a source of type ${String(H)}, it only be used with a "raster-array" source type`)):R.push(new i.V(p,d.source,`source "${d.source}" not found`))}return R}};function us(w,d=!1){const p=w.value,j=w.valueSpec,E=w.styleSpec;if(j.expression){if(i.a4(i.J(p)))return Le(w);if(i.Q(i.S(p)))return Ke(w)}if(j.type&&Ha[j.type]){const O=Ha[j.type](w);return d===!0&&O.length>0&&Array.isArray(w.value)?Ke(w):O}return ra(Object.assign({},w,{valueSpec:j.type?E[j.type]:j}))}function ra(w){const d=w.key,p=w.value,j=w.valueSpec||{},E=w.objectElementValidators||{},O=w.style,R=w.styleSpec;if(!i.H(p))return[new i.V(d,p,`object expected, ${i.K(p)} found`)];let B=[];for(const H in p){const X=H.split(".")[0];let te;E[X]?te=E[X]:j[X]?te=us:E["*"]?te=E["*"]:j["*"]&&(te=us),te?B=B.concat(te({key:(d&&`${d}.`)+H,value:p[H],valueSpec:j[X]||j["*"],style:O,styleSpec:R,object:p,objectKey:H},p)):B.push(new i.a3(d,p[H],`unknown property "${H}"`))}for(const H in j){if(E[H])continue;const X=j[H];X.required&&X.default===void 0&&p[H]===void 0&&B.push(new i.V(d,p,`missing required property "${H}"`))}return B}function hs({key:w,value:d}){const p=Xn({key:w,value:d});if(p.length)return p;const j=d;return j.indexOf("{fontstack}")===-1&&p.push(new i.V(w,d,'"glyphs" url must include a "{fontstack}" token')),j.indexOf("{range}")===-1&&p.push(new i.V(w,d,'"glyphs" url must include a "{range}" token')),p}function Ys(w,d=i.a6,p={}){return ra({key:p.key||"",value:w,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:w,objectElementValidators:{glyphs:hs}})}function zs(w,d=i.a6){return Pe(Ys(w,d))}const ji=w=>Pe(En(w)),ir=w=>Pe(Hs(w)),Pa=w=>Pe(Ei(w)),oo=w=>Pe(Ii(w)),bi=w=>Pe(Ho(w)),qn=w=>Pe(function(d){const p=d.value,j=d.style,E=d.styleSpec,O=E.snow;if(p===void 0)return[];if(!i.H(p))return[new i.V("snow",p,`object expected, ${i.K(p)} found`)];let R=[];for(const B in p){const H=B.match(/^(.*)-transition$/);R=R.concat(H&&O[H[1]]&&O[H[1]].transition?us({key:B,value:p[B],valueSpec:E.transition,style:j,styleSpec:E}):O[B]?us({key:B,value:p[B],valueSpec:O[B],style:j,styleSpec:E}):[new i.a3(B,p[B],`unknown property "${B}"`)])}return R}(w)),Ki=w=>Pe(function(d){const p=d.value,j=d.style,E=d.styleSpec,O=E.rain;if(p===void 0)return[];if(!i.H(p))return[new i.V("rain",p,`object expected, ${i.K(p)} found`)];let R=[];for(const B in p){const H=B.match(/^(.*)-transition$/);R=R.concat(H&&O[H[1]]&&O[H[1]].transition?us({key:B,value:p[B],valueSpec:E.transition,style:j,styleSpec:E}):O[B]?us({key:B,value:p[B],valueSpec:O[B],style:j,styleSpec:E}):[new i.a3(B,p[B],`unknown property "${B}"`)])}return R}(w)),dc=w=>Pe(Zr(w)),go=w=>Pe(zt(w)),uc=w=>Pe(Ar(w)),rt=w=>Pe(Mr(w)),ye=w=>Pe(i.a7(w));function Pe(w){return w.slice().sort((d,p)=>d.line&&p.line?d.line-p.line:0)}function Ye(w,d){let p=!1;if(d&&d.length)for(const j of d)j instanceof i.a3?i.w(j.message):(w.fire(new i.y(new Error(j.message))),p=!0);return p}const Nt=i.a6.light;let bt;class It extends i.E{constructor(d,p="flat"){super(),this._transitionable=new i.a8(bt||(bt=new i.a9({anchor:new i.aa(Nt.anchor),position:new i.ab(Nt.position),color:new i.aa(Nt.color),intensity:new i.aa(Nt.intensity)}))),this.setLight(d,p),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,p,j={}){this._validate(ir,d,j)||(this._transitionable.setTransitionOrValue(d),this.id=p)}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,p,j){return(!j||j.validate!==!1)&&Ye(this,d.call(zs,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}const qt=i.a6.terrain;let Ot=class extends i.E{constructor(w,d,p,j,E){super(),this.scope=p,this._transitionable=new i.a8(new i.a9({source:new i.aa(qt.source),exaggeration:new i.aa(qt.exaggeration)}),p,j),this._transitionable.setTransitionOrValue(w,j),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=E}get(){return this._transitionable.serialize()}set(w,d){this._transitionable.setTransitionOrValue(w,d)}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}getExaggeration(w){return this._transitioning.possiblyEvaluate(new i.ac(w,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const w=this._transitionable._values.exaggeration;if(!w)return null;const d=w.value.expression;if(!d)return null;let p=-1,j=-1,E=1;for(const O of d.zoomStops)E=d.evaluate(new i.ac(O,{worldview:this.worldview})),E>.01?(p=O,j=-1):j=O;return E<.01&&p>0&&j>p?[p,j]:null}isZoomDependent(){const w=this._transitionable._values.exaggeration;return w!=null&&w.value!=null&&w.value.expression!=null&&w.value.expression instanceof i.ad}};const Wt=45,pr=65,cr=.05;function Xr(w,d,p,j){const E=i.ah(Wt,pr,p),[O,R]=Cn(w,j);let B=1-Math.min(1,Math.exp((d-O)/(R-O)*-6));return B*=B*B,B=Math.min(1,1.00747*B),B*E*w.alpha}function Cn(w,d){const p=.5/Math.tan(.5*d);return[w.range[0]+p,w.range[1]+p]}function Kr(w,d,p,j,E){const O=i.af([],[d,p,j],E.mercatorFogMatrix);return Xr(w,i.ag(O),E.pitch,E._fov)}function is(w,d,p,j,E,O,R){const B=[[p,j,0],[E,j,0],[E,O,0],[p,O,0]];let H=Number.MAX_VALUE,X=-Number.MAX_VALUE;for(const te of B){const de=i.af([],te,d),ce=i.ag(de);H=Math.min(H,ce),X=Math.max(X,ce)}return[Xr(w,H,R.pitch,R._fov),Xr(w,X,R.pitch,R._fov)]}const ls=i.a6.fog;class ts extends i.E{constructor(d,p,j,E){super();const O=new i.a9({range:new i.aa(ls.range),color:new i.aa(ls.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(ls["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(ls["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(ls["horizon-blend"]),"star-intensity":new i.aa(ls["star-intensity"]),"vertical-range":new i.aa(ls["vertical-range"])});this._transitionable=new i.a8(O,j,new Map(E)),this.set(d,E),this._transitioning=this._transitionable.untransitioned(),this._transform=p,this.properties=new i.ai(O),this.scope=j}get state(){const d=this._transform,p=d.projection.name==="globe",j=i.aj(d.zoom),E=this.properties.get("range"),O=[.5,3];return{range:p?[i.ak(O[0],E[0],j),i.ak(O[1],E[1],j)]:E,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,p,j={}){if(this._validate(bi,d,j))return;const E=Object.assign({},d);for(const O of Object.keys(ls))E[O]===void 0&&(E[O]=ls[O].default);this._options=E,this._transitionable.setTransitionOrValue(this._options,p)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const p=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:i.ah(Wt,pr,d))*p.a}getOpacityAtLatLng(d,p){return this._transform.projection.supportsFog?function(j,E,O){const R=i.ae.fromLngLat(E),B=O.elevation?O.elevation.getAtPointOrZero(R):0;return Kr(j,R.x,R.y,B,O)}(this.state,d,p):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const p=this._transform.calculateFogTileMatrix(d.toUnwrapped());return is(this.state,p,0,0,i.al,i.al,this._transform)}getOpacityForBounds(d,p,j,E,O){return this._transform.projection.supportsFog?is(this.state,d,p,j,E,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?Cn(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const p=[4,5,6,7];for(const j of p){const E=d.points[j];let O;if(E[2]>=0)O=E;else{const R=d.points[j-4];O=i.am(R,E,R[2]/(R[2]-E[2]))}if(Kr(this.state,O[0],O[1],0,this._transform)>=cr)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,p,j){return(!j||j.validate!==!1)&&Ye(this,d.call(zs,Object.assign({value:p,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let Ws,$i,jo,ba,Co=class extends i.E{constructor(w,d,p,j){super();const E=Ws||(Ws=new i.a9({density:new i.aa(i.a6.snow.density),intensity:new i.aa(i.a6.snow.intensity),color:new i.aa(i.a6.snow.color),opacity:new i.aa(i.a6.snow.opacity),vignette:new i.aa(i.a6.snow.vignette),"vignette-color":new i.aa(i.a6.snow["vignette-color"]),"center-thinning":new i.aa(i.a6.snow["center-thinning"]),direction:new i.aa(i.a6.snow.direction),"flake-size":new i.aa(i.a6.snow["flake-size"])}));this._transitionable=new i.a8(E,p,new Map(j)),this.set(w,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(E),this.scope=p}get state(){const w=this.properties.get("opacity"),d=this.properties.get("color"),p=this.properties.get("direction"),j=i.an(p[0]),E=-Math.max(i.an(p[1]),.01),O=[Math.cos(j)*Math.cos(E),Math.sin(j)*Math.cos(E),Math.sin(E)],R=this.properties.get("vignette"),B=this.properties.get("vignette-color");return B.a=R,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(d.r,d.g,d.b,d.a*w),direction:O,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:B}}get(){return this._transitionable.serialize()}set(w,d,p={}){if(this._validate(qn,w,p))return;const j=Object.assign({},w),E=i.a6.snow;for(const O of Object.keys(E))j[O]===void 0&&(j[O]=E[O].default);this._options=j,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(w){this._transitionable.setTransitionOrValue(this._options,new Map(w))}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}_validate(w,d,p){return(!p||p.validate!==!1)&&Ye(this,w.call(zs,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},Pi=class extends i.E{constructor(w,d,p,j){super();const E=$i||($i=new i.a9({density:new i.aa(i.a6.rain.density),intensity:new i.aa(i.a6.rain.intensity),color:new i.aa(i.a6.rain.color),opacity:new i.aa(i.a6.rain.opacity),vignette:new i.aa(i.a6.rain.vignette),"vignette-color":new i.aa(i.a6.rain["vignette-color"]),"center-thinning":new i.aa(i.a6.rain["center-thinning"]),direction:new i.aa(i.a6.rain.direction),"droplet-size":new i.aa(i.a6.rain["droplet-size"]),"distortion-strength":new i.aa(i.a6.rain["distortion-strength"])}));this._transitionable=new i.a8(E,p,new Map(j)),this.set(w,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(E),this.scope=p}get state(){const w=this.properties.get("opacity"),d=this.properties.get("color"),p=this.properties.get("direction"),j=i.an(p[0]),E=-Math.max(i.an(p[1]),.01),O=[Math.cos(j)*Math.cos(E),Math.sin(j)*Math.cos(E),Math.sin(E)],R=this.properties.get("vignette-color");return R.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(d.r,d.g,d.b,d.a*w),direction:O,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:R}}get(){return this._transitionable.serialize()}set(w,d,p={}){if(this._validate(Ki,w,p))return;const j=Object.assign({},w),E=i.a6.rain;for(const O of Object.keys(E))j[O]===void 0&&(j[O]=E[O].default);this._options=j,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(w){this._transitionable.setTransitionOrValue(this._options,new Map(w))}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}_validate(w,d,p){return(!p||p.validate!==!1)&&Ye(this,w.call(zs,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}};class na extends i.E{constructor(d,p,j,E){super(),this.scope=j,this._options=d,this.properties=new i.ai(p),this._transitionable=new i.a8(p,j,new Map(E)),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,p){this._options=d,this._transitionable.setTransitionOrValue(d.properties,p)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class Li{constructor(d,p,j){this.screenBounds=d,this.cameraPoint=j.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=p,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,j)}static createFromScreenPoints(d,p){let j,E;if(d instanceof i.P||typeof d[0]=="number"){const O=i.P.convert(d);j=[O],E=p.isPointAboveHorizon(O)}else{const O=i.P.convert(d[0]),R=i.P.convert(d[1]),B=O.add(R)._div(2);j=[O,R],E=i.aq(O,R).every(H=>p.isPointAboveHorizon(H))&&p.isPointAboveHorizon(B)}return new Li(j,E,p)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return i.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const p=this.screenBounds[0],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],E=i.aq(p,j,0,!1);return this.cameraPoint.y>j.y&&(this.cameraPoint.x>p.x&&this.cameraPoint.x=j.x?E[2]=this.cameraPoint:this.cameraPoint.x<=p.x&&(E[3]=this.cameraPoint)),i.ar(E,d)}bufferedCameraGeometryGlobe(d){const p=this.screenBounds[0],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],E=i.aq(p,j,d),O=this.cameraPoint.clone();switch(3*((O.y>p.y)+(O.y>j.y))+((O.x>p.x)+(O.x>j.x))){case 0:E[0]=O,E[4]=O.clone();break;case 1:E.splice(1,0,O);break;case 2:E[1]=O;break;case 3:E.splice(4,0,O);break;case 5:E.splice(2,0,O);break;case 6:E[3]=O;break;case 7:E.splice(3,0,O);break;case 8:E[2]=O}return E}containsTile(d,p,j,E=0){const O=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/p._pixelsPerMercatorPixel+1,R=j?this._bufferedCameraMercator(O,p):this._bufferedScreenMercator(O,p);let B=d.tileID.wrap+(R.unwrapped?E:0);const H=R.polygon.map(Re=>i.as(d.tileTransform,Re,B));if(!i.at(H,0,0,i.al,i.al))return;B=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?E:0);const X=this.screenGeometryMercator.polygon.map(Re=>i.au(d.tileTransform,Re,B)),te=X.map(Re=>new i.P(Re[0],Re[1])),de=p.getFreeCameraOptions().position||new i.ae(0,0,0),ce=i.au(d.tileTransform,de,B),he=X.map(Re=>{const De=i.av(Re,Re,ce);return i.aw(De,De),new i.ax(ce,De)}),ke=i.ay(d,1,p.zoom)*p._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:te,tilespaceRays:he,bufferedTilespaceGeometry:H,bufferedTilespaceBounds:(be=i.az(H),be.min.x=i.aA(be.min.x,0,i.al),be.min.y=i.aA(be.min.y,0,i.al),be.max.x=i.aA(be.max.x,0,i.al),be.max.y=i.aA(be.max.y,0,i.al),be),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:ke};var be}_bufferedScreenMercator(d,p){const j=Oi(d);if(this._screenRaycastCache[j])return this._screenRaycastCache[j];{let E;return E=p.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),p):{polygon:this.bufferedScreenGeometry(d).map(O=>p.pointCoordinate3D(O)),unwrapped:!0},this._screenRaycastCache[j]=E,E}}_bufferedCameraMercator(d,p){const j=Oi(d);if(this._cameraRaycastCache[j])return this._cameraRaycastCache[j];{let E;return E=p.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),p):{polygon:this.bufferedCameraGeometry(d).map(O=>p.pointCoordinate3D(O)),unwrapped:!0},this._cameraRaycastCache[j]=E,E}}_projectAndResample(d,p){const j=function(O,R){const B=i.aB([],R.pixelMatrix,R.globeMatrix),H=[0,-i.aD,0,1],X=[0,i.aD,0,1],te=[0,0,0,1];i.aC(H,H,B),i.aC(X,X,B),i.aC(te,te,B);const de=new i.P(H[0]/H[3],H[1]/H[3]),ce=new i.P(X[0]/X[3],X[1]/X[3]),he=i.aE(O,de)&&H[3]1?Wa(O.slice(0,Re),R):[],nt=Renew i.P(Is(_t.x),_t.y)),nt=nt.map(_t=>new i.P(Is(_t.x),_t.y));const Ge=[...We];Ge.length===0&&Ge.push(nt[nt.length-1]);const jt=i.ak(Ge[Ge.length-1].y,(nt.length===0?We[0]:nt[0]).y,De);let gt;return gt=he?[new i.P(0,jt),new i.P(0,0),new i.P(1,0),new i.P(1,jt)]:[new i.P(1,jt),new i.P(1,1),new i.P(0,1),new i.P(0,jt)],Ge.push(...gt),nt.length===0?Ge.push(We[0]):Ge.push(...nt),{polygon:Ge.map(_t=>new i.ae(_t.x,_t.y)),unwrapped:!1}}(d,p);if(j)return j;const E=function(O,R){let B=!1,H=-1/0,X=0;for(let de=0;deH&&(H=O[de].x,X=de);for(let de=0;de.5&&(he.x{de.x-=1}),{polygon:O,unwrapped:B}}(Wa(d,p).map(O=>new i.P(Is(O.x),O.y)),p);return{polygon:E.polygon.map(O=>new i.ae(O.x,O.y)),unwrapped:E.unwrapped}}}function Wa(w,d){return i.aG(w,p=>{const j=d.pointCoordinate3D(p);p.x=j.x,p.y=j.y},1/256)}function Is(w){return w<0?1+w%1:w%1}function Oi(w){return 100*w|0}function bl(w,d,p,j,E){const O=function(B,H){if(B)return E(B);if(H){if(w.url&&H.tiles&&w.tiles&&delete w.tiles,H.variants){if(!Array.isArray(H.variants))return E(new Error("variants must be an array"));for(const te of H.variants){if(te==null||typeof te!="object"||te.constructor!==Object)return E(new Error("variant must be an object"));if(!Array.isArray(te.capabilities))return E(new Error("capabilities must be an array"));if(te.capabilities.length===1&&te.capabilities[0]==="meshopt"){H=Object.assign(H,te);break}}}const X=i.aH(Object.assign({},H,w),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);X.tiles=d.canonicalizeTileset(X,w.url),E(null,X)}},R=function(B,H,X){if(!B)return null;if(!H&&!X)return B;X=X||B.worldview_default;const te=Object.values(B.language||{});if(te.length===0)return null;const de=Object.values(B.worldview||{});if(de.length===0)return null;const ce=te.every(ke=>ke===H),he=de.every(ke=>ke===X);return ce&&he?B:H in(B.language_options||{})||X in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(w.data,p,j);return R?i.o.frame(()=>O(null,R)):w.url?i.m(d.transformRequest(d.normalizeSourceURL(w.url,null,p,j),i.R.Source),O):i.o.frame(()=>{const{data:B,...H}=w;O(null,H)})}function El(w,d){const p=Math.pow(2,d.z),j=Math.floor(i.aF(w.getWest())*p),E=Math.floor(i.aJ(w.getNorth())*p),O=Math.ceil(i.aF(w.getEast())*p),R=Math.ceil(i.aJ(w.getSouth())*p);return d.x>=j&&d.x=E&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,E)p&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${p}`),j&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${j}`),this.fire(new i.y(E));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 R of O.vector_layers)this.vectorLayerIds.push(R.id),O.worldview&&O.worldview[R.source]&&this.localizableLayerIds.add(R.id)}this.tileBounds=Xc.fromTileJSON(O),ve(O.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}d&&d(E)})}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=i.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,p){const j=d.tileID.canonical.url(this.tiles,this.scheme),E=this.map._requestManager.normalizeTileURL(j),O=this.map._requestManager.transformRequest(E,i.R.Tile),R=this.map.style?this.map.style.getLut(this.scope):null,B=R?{image:R.image.clone()}:null,H={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:i.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&&i.h(j)&&(H.localizableLayerIds=this.localizableLayerIds),H.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=p:d.request=d.actor.send("reloadTile",H,X.bind(this));else if(d.actor=this._tileWorkers[E]=this._tileWorkers[E]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",H,X.bind(this),void 0,!0);else{const te=i.aL.call({deduped:this._deduped},H,(de,ce)=>{if(de||!ce)X.call(this,de);else{const he=i.aM(ce.responseHeaders);H.data={rawData:ce.rawData.slice(0),expires:he.expires,cacheControl:he.cacheControl},d.actor&&d.actor.send("loadTile",H,X.bind(this),void 0,!0)}},!0);d.request={cancel:te}}function X(te,de){return delete d.request,d.aborted?p(null):te&&te instanceof i.aN&&te.status!==404?p(te):(de&&de.resourceTiming&&(d.resourceTiming=de.resourceTiming),this.map._refreshExpiredTiles&&de&&d.setExpiryData(de),d.loadVectorData(de,this.map.painter),i.aO(this.dispatcher),p(null,de),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,p){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 Yo extends i.E{constructor(d,p,j,E){super(),this.id=d,this.dispatcher=j,this.setEventedParent(E),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"},p),Object.assign(this,i.aH(p,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));const p=this.map.getWorldview();this._tileJSONRequest=bl(this._options,this.map._requestManager,null,p,(j,E)=>{this._tileJSONRequest=null,this._loaded=!0,j?this.fire(new i.y(j)):E&&(Object.assign(this,E),E.raster_layers&&(this.rasterLayers=E.raster_layers,this.rasterLayerIds=this.rasterLayers.map(O=>O.id)),this.tileBounds=Xc.fromTileJSON(E),ve(E.tiles),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(j)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=i.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,p){const j=i.o.devicePixelRatio>=2,E=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),j,this.tileSize);d.request=i.n(this.map._requestManager.transformRequest(E,i.R.Tile),(O,R,B)=>{if(delete d.request,d.aborted)return d.state="unloaded",p(null);if(O)return d.state="errored",p(O);if(!R)return p(null);const H=i.aM(B);this.map._refreshExpiredTiles&&d.setExpiryData(H),d.setTexture(R,this.map.painter),d.state="loaded",i.aO(this.dispatcher),p(null)})}abortTile(d,p){d.request&&(d.request.cancel(),delete d.request),p&&p()}unloadTile(d,p){d.texture&&d.texture instanceof i.T?(d.destroy(!1),d.texture&&d.texture instanceof i.T&&this.map.painter.saveTileTexture(d.texture)):d.destroy(),p&&p()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function Hd([w,d],p,j,{scaled:E=!0}={}){const{tileSize:O,buffer:R}=j,{x:B,y:H,z:X}=p;if(!isFinite(B)||!isFinite(H)||!isFinite(X))throw new Error("Invalid MRT header");const te=2**X,de=te*i.aF(w),ce=te*i.aJ(d);return function([he,ke],be,{scaled:Re=!0}={}){if(!be)throw new Error("bandView is undefined");const{data:De,tileSize:We,buffer:nt,offset:Ge,scale:jt,dimension:gt}=be;if(he<-nt||he>We+nt||ke<-nt||ke>We+nt)throw new Error(`Point (${he}, ${ke}) out of bounds for tileSize=${We}, buffer=${nt}`);const _t=(ke+nt)*(We+2*nt)+(he+nt);if(new Uint32Array(De.buffer)[_t]===4294967295)return null;let pt=[];pt=Re?[]:new be.data.constructor(gt);for(let ht=0;ht{if(delete d.request,d.aborted)return d.state="unloaded",p(null);if(B)return B.name==="AbortError"?void 0:(d.state="errored",p(B));if(this.map._refreshExpiredTiles&&H){const te=i.aM(X);d.setExpiryData(te)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!H)return p(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=H}p(null)};d.request=this.partial?d.fetchHeader(void 0,R.bind(this)):d.actor.send("loadTile",O,R.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,p){const j=d.texturePerLayer;if(d.flushAllQueues(),j.size){d.destroy(!1);for(const E of j.values())this.map.painter.saveTileTexture(E)}else d.destroy()}prepareTile(d,p,j,E){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(p,j,E,(O,R)=>{if(O)return d.state="errored",this.fire(new i.y(O)),void this.triggerRepaint(d);R&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(j,R,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const p=this.rasterLayers.find(({id:O})=>O===d),j=p&&p.fields,E=j&&j.bands&&j.bands;return E?E[0]:0}getTextureDescriptor(d,p,j){if(!d)return;const E=p.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!E)return;let O=null;p instanceof i.aR?O=p.paint.get("raster-array-band"):p instanceof i.aS&&(O=p.paint.get("raster-particle-array-band"));const R=O||this.getInitialBand(E);if(R==null)return;if(!d.textureDescriptorPerLayer.get(p.id))return void this.prepareTile(d,E,p.id,R);if(d.updateNeeded(p.id,R)&&!j)return;const B=d.textureDescriptorPerLayer.get(p.id);return Object.assign({},B,{texture:d.texturePerLayer.get(p.id)})}getImages(d,p){const j=new Map;for(const E of d)for(const O of p){const[R,B]=O.split("/"),H=E.getLayer(R);if(!H||!H.hasBand(B)||!H.hasDataForBand(B))continue;const{bytes:X,tileSize:te,buffer:de}=H.getBandView(B),ce=te+2*de,he={data:new i.q({width:ce,height:ce},X),pixelRatio:2,sdf:!1,usvg:!1,version:0};j.set(O,he)}return j}queryRasterArrayValueByBandId(d,p,j){const E=p._mrt;return new Promise(O=>{const R={},B=new Set;for(const[H,X]of Object.entries(E.layers)){if(j.layerName&&H!==j.layerName)continue;const te={};R[H]=te;for(const{bands:de}of X.dataIndex)for(const ce of de)j.bands&&!j.bands.includes(ce)||(B.add(i.B(H,ce)),p.fetchBand(H,null,ce,he=>{i.o.frame(()=>{te[ce]=he?null:Hd([d.lng,d.lat],E,X.getBandView(ce)),B.delete(i.B(H,ce)),B.size===0&&O(R)})},!1))}B.size===0&&O(R)})}_loadTileForQuery(d,p){if(this._loadTileLoaded[d.uid])return void p(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(p);this._loadTilePending[d.uid]=[p];const j=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),E=this.map._requestManager.transformRequest(j,i.R.Tile);d.actor.send("loadTile",{request:E,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(O,R,B)=>{if(O)return this._loadTilePending[d.uid].forEach(H=>H(O,null)),void delete this._loadTilePending[d.uid];if(!R)return this._loadTilePending[d.uid].forEach(H=>H(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&R){const H=i.aM(B);d.setExpiryData(H)}d._mrt=R,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(H=>H(null,R)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,p,j){return new Promise((E,O)=>{this._loadTileForQuery(p,(R,B)=>{R?O(R):E(B?this.queryRasterArrayValueByBandId(d,p,j):null)})})}queryRasterArrayValue(d,p){const j=i.aT.convert(d),E=this.findLoadedParent(j);return E&&E._mrt?p.bands||!this.partial?this.queryRasterArrayValueByBandId(j,E,p):this.queryRasterArrayValueByAllBands(j,E,p):Promise.resolve(null)}findLoadedParent(d){const p=i.ae.fromLngLat(d,this.map.transform.tileSize),j=this.maxzoom+1,E=1<0&&(B[new i.aQ(w.overscaledZ,E,d.z,j,d.y-1).key]={backfilled:!1},B[new i.aQ(w.overscaledZ,w.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},B[new i.aQ(w.overscaledZ,R,d.z,O,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,j)this.fire(new i.y(j));else{const O={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&E&&E.resourceTiming&&E.resourceTiming[this.id]&&(O.resourceTiming=E.resourceTiming[this.id]),w&&(this._partialReload=!0),this.fire(new i.z("data",O)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(w),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const w=i.B(this.id,this.scope);this.map.style.clearSource(w),this._updateWorkerData()}loadTile(w,d){const p=w.actor?"reloadTile":"loadTile";w.actor=this.actor;const j=this.map.style?this.map.style.getLut(this.scope):null,E=j?{image:j.image.clone()}:null,O=this._partialReload,R={type:this.type,uid:w.uid,tileID:w.tileID,tileZoom:w.tileZoom,zoom:w.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:E,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:w.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:O,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};w.request=this.actor.send(p,R,(B,H)=>O&&!H?(w.state="loaded",d(null)):(delete w.request,w.destroy(!1),w.aborted?d(null):B?d(B):(w.loadVectorData(H,this.map.painter,p==="reloadTile"),d(null))),void 0,p==="loadTile")}abortTile(w){w.request&&(w.request.cancel(),delete w.request),w.aborted=!0}unloadTile(w,d){this.actor.send("removeTile",{uid:w.uid,type:this.type,source:this.id,scope:this.scope}),w.destroy()}onRemove(w){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends i.aU{constructor(w,d,p,j){super(w,d,p,j),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const w=this.options;this.urls=[];for(const d of w.urls)this.urls.push(this.map._requestManager.transformRequest(d,i.R.Source).url);i.aV(this.urls,(d,p)=>{this._loaded=!0,d?this.fire(new i.y(d)):p&&(this.video=p,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(w){if(this.video){const d=this.video.seekable;wd.end(0)?this.fire(new i.y(new i.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=w}}getVideo(){return this.video}onAdd(w){this.map||(this.map=w,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 w=this.map.painter.context,d=w.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 i.T(w,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(w)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:i.aU,model:i.aX,"batched-model":class extends i.E{constructor(w,d,p,j){super(),this.type="batched-model",this.id=w,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=p,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(j)}onAdd(w){this.map=w,this.load()}reload(){this.cancelTileJSONRequest();const w=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(w))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(w){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));const d=Array.isArray(this.map._language)?this.map._language.join():this.map._language,p=this.map.getWorldview();this._tileJSONRequest=bl(this._options,this.map._requestManager,d,p,(j,E)=>{this._tileJSONRequest=null,this._loaded=!0,j?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),p&&p.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${p}`),this.fire(new i.y(j))):E&&(Object.assign(this,E),E.bounds&&(this.tileBounds=new Xc(E.bounds,this.minzoom,this.maxzoom)),ve(E.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),w&&w(j)})}hasTransition(){return!1}hasTile(w){return!this.tileBounds||this.tileBounds.contains(w.canonical)}loaded(){return this._loaded}loadTile(w,d){const p=this.map._requestManager.normalizeTileURL(w.tileID.canonical.url(this.tiles,this.scheme)),j={request:this.map._requestManager.transformRequest(p,i.R.Tile),data:void 0,uid:w.uid,tileID:w.tileID,tileZoom:w.tileZoom,zoom:w.tileID.overscaledZ,tileSize:this.tileSize*w.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:w.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:i.o.devicePixelRatio,promoteId:this.promoteId};if(w.actor&&w.state!=="expired")if(w.state==="loading")w.reloadCallback=d;else{if(w.buckets){const O=Object.values(w.buckets);for(const R of O)R.dirty=!0;return void(w.state="loaded")}w.request=w.actor.send("reloadTile",j,E.bind(this))}else w.actor=this.dispatcher.getActor(),w.request=w.actor.send("loadTile",j,E.bind(this),void 0,!0);function E(O,R){return w.aborted?d(null):O&&O.status!==404?d(O):(this.map._refreshExpiredTiles&&R&&w.setExpiryData(R),w.loadModelData(R,this.map.painter),w.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aU{constructor(w,d,p,j){super(w,d,p,j),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(E=>!Array.isArray(E)||E.length!==2||E.some(O=>typeof O!="number"))||this.fire(new i.y(new i.V(`sources.${w}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.y(new i.V(`sources.${w}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new i.y(new i.V(`sources.${w}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new i.y(new i.V(`sources.${w}`,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 i.y(new i.V(`sources.${w}`,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 i.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(w){this.map=w,this.load(),this.canvas&&this.animate&&this.play()}onRemove(w){this.pause()}prepare(){let w=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,w=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,w=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!w&&!this._playing||this.texture instanceof i.aW||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.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 w of[this.canvas.width,this.canvas.height])if(isNaN(w)||w<=0)return!0;return!1}},custom:class extends i.E{constructor(w,d,p,j){super(),this.id=w,this.type="custom",this._dataType="raster",this._dispatcher=p,this._implementation=d,this.setEventedParent(j),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Xc(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,i.aH(d,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.aH(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(w){this.map=w,this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(w),this.load()}onRemove(w){this._implementation.onRemove&&this._implementation.onRemove(w)}hasTile(w){if(this._implementation.hasTile){const{x:d,y:p,z:j}=w.canonical;return this._implementation.hasTile({x:d,y:p,z:j})}return!this.tileBounds||this.tileBounds.contains(w.canonical)}loadTile(w,d){const{x:p,y:j,z:E}=w.tileID.canonical,O=new AbortController;w.request=Promise.resolve(this._implementation.loadTile({x:p,y:j,z:E},{signal:O.signal})).then((function(R){return delete w.request,w.aborted?(w.state="unloaded",d(null)):R===void 0?(w.state="errored",d(null)):R===null?(this.loadTileData(w,{width:this.tileSize,height:this.tileSize,data:null}),w.state="loaded",d(null)):function(B){return B instanceof ImageData||B instanceof HTMLCanvasElement||B instanceof ImageBitmap||B instanceof HTMLImageElement}(R)?(this.loadTileData(w,R),w.state="loaded",void d(null)):(w.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(R=>{R.name!=="AbortError"&&(w.state="errored",d(R))}),w.request.cancel=()=>O.abort()}loadTileData(w,d){w.setTexture(d,this.map.painter)}unloadTile(w,d){if(w.texture&&w.texture instanceof i.T?(w.destroy(!1),w.texture&&w.texture instanceof i.T&&this.map.painter.saveTileTexture(w.texture)):w.destroy(),this._implementation.unloadTile){const{x:p,y:j,z:E}=w.tileID.canonical;this._implementation.unloadTile({x:p,y:j,z:E})}d&&d()}abortTile(w,d){w.request&&w.request.cancel&&(w.request.cancel(),delete w.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(w=>({x:w.canonical.x,y:w.canonical.y,z:w.canonical.z}))}_clearTiles(){const w=i.B(this.id,this.scope);this.map.style.clearSource(w)}_update(){this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}}},Xo=function(w,d,p,j){const E=new dh[d.type](w,d,p,j);if(E.id!==w)throw new Error(`Expected Source id to be ${w} instead of ${E.id}`);return i.aY(["load","abort","unload","serialize","prepare"],E),E};function Mf(w,d,p=""){return`${p}:${d.id||""}:${d.layer.id}:${function(j){if("layerId"in j)return`layer:${j.layerId}`;{const{featuresetId:E,importId:O}=j;return`featureset:${E}${O?`:import:${O}`:""}`}}(w.target)}`}function Gp(w,d,p,j=""){if(w.uniqueFeatureID){const E=Mf(w,d,j);if(p.has(E))return!0;p.add(E)}return!1}function Zy(w,d,p,j,E=!1){const O=d.sourceCache.transform,R=d.sourceCache.tilesIn(w,d.has3DLayers,E);R.sort(Uh);const B=[];for(const H of R){const X=H.tile.queryRenderedFeatures(d,H,p,j,O,E);Object.keys(X).length&&B.push({wrappedTileID:H.tile.tileID.wrapped().key,queryResults:X})}for(const H in d.layers){const X=d.layers[H];if(X.styleLayer){const te=X.styleLayer.queryRenderedFeatures(w,d.sourceCache,j);Object.keys(te).length&&B.push({wrappedTileID:0,queryResults:te})}}return B.length===0?{}:function(H){const X={},te={};for(const de of H){const ce=de.queryResults,he=de.wrappedTileID,ke=te[he]=te[he]||{};for(const be in ce){const Re=ce[be],De=ke[be]=ke[be]||{},We=X[be]=X[be]||[];for(const nt of Re)De[nt.featureIndex]||(De[nt.featureIndex]=!0,We.push(nt))}}return X}(B)}function Yy(w,d,p,j,E,O){const R={},B=j.queryRenderedSymbols(w),H=[];for(const X of Object.keys(B).map(Number))H.push(E[X]);H.sort(Uh);for(const X of H){const te=X.featureIndex.lookupSymbolFeatures(B[X.bucketInstanceId],X.bucketIndex,X.sourceLayerIndex,d,p,O);for(const de in te){const ce=R[de]=R[de]||[],he=te[de];he.sort((ke,be)=>{const Re=X.featureSortOrder;if(Re){const De=Re.indexOf(ke.featureIndex);return Re.indexOf(be.featureIndex)-De}return be.featureIndex-ke.featureIndex});for(const ke of he)ce.push(ke)}}return R}function Xy(w,d){const p=w.getRenderableIds().map(O=>w.getTileByID(O)),j=[],E={};for(let O=0;Od.getLayer(O)).filter(Boolean);if(E.length!==0){j.layers=E,j.stateDependentLayerIds&&(j.stateDependentLayers=j.stateDependentLayerIds.map(O=>E.filter(R=>R.id===O)[0]));for(const O of E)p[O.fqid]=j}}return p}const Qc=32,lu=33,mc=new Uint16Array(8184);for(let w=0;w<2046;w++){let d=w+2,p=0,j=0,E=0,O=0,R=0,B=0;for(1&d?E=O=R=Qc:p=j=B=Qc;(d>>=1)>1;){const X=p+E>>1,te=j+O>>1;1&d?(E=p,O=j,p=R,j=B):(p=E,j=O,E=R,O=B),R=X,B=te}const H=4*w;mc[H+0]=p,mc[H+1]=j,mc[H+2]=E,mc[H+3]=O}const Jc=new Uint16Array(2178),Wo=new Uint8Array(1089),Eu=new Uint16Array(1089);function qh(w){return w===0?-.03125:w===32?.03125:0}const Wd={type:2,extent:i.al,loadGeometry:()=>[[new i.P(0,0),new i.P(i.al+1,0),new i.P(i.al+1,i.al+1),new i.P(0,i.al+1),new i.P(0,0)]]};class Tf{constructor(d,p,j,E,O,R){this.tileID=d,this.uid=i.b2(),this.uses=0,this.tileSize=p,this.tileZoom=j,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=O,E&&E.style&&(this._lastUpdatedBrightness=E.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",E&&E.transform&&(this.projection=E.transform.projection),this.worldview=R,this._hasAppearances=null}registerFadeDuration(d){const p=d+this.timeAdded;pj)E=!1;else if(p)if(this.expirationTimej.appearances&&j.appearances.length>0))return!0;return!1}updateBuckets(d,p){if(!this.latestFeatureIndex||!d.style)return;const j=d.style.listImages(),E=d.style.getBrightness();for(const O in this.buckets){if(!d.style.hasLayer(O))continue;const R=this.buckets[O],B=R.layers[0],H=B.sourceLayer||"_geojsonTileLayer",X=d.style.getLayerSourceCache(B);let te={};X&&(te=X._state.getState(H,void 0));const de=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},ce=Object.keys(te).length>0&&!p;R.hasAppearances=R.layers.some(be=>be.appearances&&be.appearances.length>0);const he=ce?R.stateDependentLayers:R.layers;if(ce&&R.stateDependentLayers.length!==0||p){const be=this.latestFeatureIndex.loadVTLayers();R.update(te,be[H],j,de,he,p,E)}if(ce&&R.stateDependentLayers.length!==0||p||R.hasAppearances){const be={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};R.updateAppearances(this.tileID.canonical,te,j,be)}(R instanceof i.ba||R instanceof i.bb)&&d._terrain&&d._terrain.enabled&&X&&R.uploadPending()&&d._terrain._clearRenderCacheForTile(X.id,this.tileID);const ke=d&&d.style&&d.style.getOwnLayer(O);ke&&(this.queryPadding=Math.max(this.queryPadding,ke.queryRadius(R)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Re--){const De=4*Re,We=mc[De+0],nt=mc[De+1],Ge=mc[De+2],jt=mc[De+3],gt=We+Ge>>1,_t=nt+jt>>1,pt=gt+_t-nt,ht=_t+We-gt,St=nt*lu+We,Rt=jt*lu+Ge,Dt=_t*lu+gt,Yt=Math.hypot((Jc[2*St+0]+Jc[2*Rt+0])/2-Jc[2*Dt+0],(Jc[2*St+1]+Jc[2*Rt+1])/2-Jc[2*Dt+1])>=16;Wo[Dt]=Wo[Dt]||(Yt?1:0),Re<1022&&(Wo[Dt]=Wo[Dt]||Wo[(nt+ht>>1)*lu+(We+pt>>1)]||Wo[(jt+ht>>1)*lu+(Ge+pt>>1)])}const de=new i.b1,ce=new i.b0;let he=0;function ke(Re,De){const We=De*lu+Re;return Eu[We]===0&&(de.emplaceBack(Jc[2*We+0],Jc[2*We+1],Re*i.al/Qc,De*i.al/Qc),Eu[We]=++he),Eu[We]-1}function be(Re,De,We,nt,Ge,jt){const gt=Re+We>>1,_t=De+nt>>1;if(Math.abs(Re-Ge)+Math.abs(De-jt)>1&&Wo[_t*lu+gt])be(Ge,jt,Re,De,gt,_t),be(We,nt,Ge,jt,gt,_t);else{const pt=ke(Re,De),ht=ke(We,nt),St=ke(Ge,jt);ce.emplaceBack(pt,ht,St)}}return be(0,0,Qc,Qc,Qc,0),be(Qc,Qc,0,0,0,Qc),{vertices:de,indices:ce}}(this.tileID.canonical,p);E=R.vertices,O=R.indices}else{E=new i.b1,O=new i.b0;for(const{x:B,y:H}of j)E.emplaceBack(B,H,0,0);const R=i.bh(E.int16.subarray(0,4*E.length),void 0,4);for(let B=0;B0&&(H=i.bl(new Float64Array(16),p.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,E,p,R,H,B),this._makeGlobeTileDebugTextBuffer(d,E,p,R,H,B)}_globePoint(d,p,j,E,O,R,B){let H=i.bm(d,p,j);if(R){const X=1<.5?he=-1:ce<-.5&&(he=1);let ke=(d/i.al+j.x)/X+he,be=(p/i.al+j.y)/X;ke=(ke-te)*E._pixelsPerMercatorPixel+te,be=(be-de)*E._pixelsPerMercatorPixel+de;const Re=[ke*E.worldSize,be*E.worldSize,0];i.af(Re,Re,R),H=i.bn(H,Re,B)}return i.af(H,H,O)}_makeGlobeTileDebugBorderBuffer(d,p,j,E,O,R){const B=new i.bd,H=new i.be,X=new i.bo,te=(ce,he,ke,be,Re)=>{const De=(ke-ce)/(Re-1),We=(be-he)/(Re-1),nt=B.length;for(let Ge=0;Gede*he+ke;for(let he=0;he{if(O)p(O);else try{const H=j.getHeaderLength(R);if(H>d)return void(this.request=this.fetchHeader(H,p));j.parseHeader(R),this._isHeaderLoaded=!0;let X=0;for(const te of Object.values(j.layers))X=Math.max(X,te.dataIndex[te.dataIndex.length-1].lastByte);R.byteLength>=X&&(this.entireBuffer=R),p(null,this.entireBuffer||R,B)}catch(H){p(H)}}),this.request}fetchBandForRender(d,p,j,E){this.fetchBand(d,p,j,O=>{if(O)return void E(O);this.updateTextureDescriptor(d,p,j);const R=this.textureDescriptorPerLayer.get(p);E(null,R?R.img:null)})}fetchBand(d,p,j,E,O=!0){const R=this._mrt;if(!this._isHeaderLoaded||!R)return void E(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void E(new Error("Can't fetch tile band without an actor"));let H;const X=i.B(String(j),i.B(this.tileID.key,d));let te=this._taskQueue.get(X);te?te.add(E):(te=new Set,te.add(E),this._taskQueue.set(X,te));const de=(be,Re)=>{H.complete(be,Re),be?E(be):(te.forEach(De=>De(null,Re)),this._taskQueue.delete(X))},ce=(be,Re)=>{if(be)return E(be);const De=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Re,task:H},de,void 0,!0);if(p!==null){const We=this._workQueuePerLayer.get(p)||[];We.push(()=>{De&&De.cancel(),H.cancel()}),this._workQueuePerLayer.has(p)||this._workQueuePerLayer.set(p,We)}};let he;try{he=R.getLayer(d)}catch(be){if(this.state==="reloading")return;throw be}if(!he)return void E(new Error(`Unknown sourceLayer "${d}"`));if(he.hasDataForBand(j))return te.forEach(be=>be(null,null)),void this._taskQueue.delete(X);const ke=he.getDataRange([j]);if(H=R.createDecodingTask(ke),!H||H.tasks.length)if(p!==null&&this.flushQueues(p),this.entireBuffer)ce(null,this.entireBuffer.slice(ke.firstByte,ke.lastByte+1));else{const be=Object.assign({},this.requestParams,{headers:{Range:`bytes=${ke.firstByte}-${ke.lastByte}`}}),Re=i.bu(be,ce);if(p!==null){const De=this._fetchQueuePerLayer.get(p)||[];De.push(()=>{Re.cancel(),H.cancel()}),this._fetchQueuePerLayer.has(p)||this._fetchQueuePerLayer.set(p,De)}}}updateNeeded(d,p){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==p||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,p,j){if(!this._mrt)return;const E=this._mrt.getLayer(d);if(!E||!E.hasBand(j)||!E.hasDataForBand(j))return;const{bytes:O,tileSize:R,buffer:B,offset:H,scale:X}=E.getBandView(j),te=R+2*B,de=new i.q({width:te,height:te},O),ce=this.texturePerLayer.get(p);ce&&ce instanceof i.T&&ce.update(de,{premultiply:!1}),this.textureDescriptorPerLayer.set(p,{layer:d,band:j,img:de,buffer:B,offset:H,tileSize:R,format:E.pixelFormat,mix:[X,256*X,65536*X,16777216*X]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const p of this.texturePerLayer.values())p&&p instanceof i.T&&p.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 ux{constructor(d,p){this.max=d,this.onRemove=p,this.reset()}reset(){for(const d in this.data)for(const p of this.data[d])p.timeout&&clearTimeout(p.timeout),this.onRemove(p.value);return this.data={},this.order=[],this}add(d,p,j){const E=d.wrapped().key;this.data[E]===void 0&&(this.data[E]=[]);const O={value:p,timeout:void 0};if(j!==void 0&&(O.timeout=setTimeout(()=>{this.remove(d,O)},j)),this.data[E].push(O),this.order.push(E),this.order.length>this.max){const R=this._getAndRemoveByKey(this.order[0]);R&&this.onRemove(R)}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 p=this.data[d].shift();return p.timeout&&clearTimeout(p.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),p.value}getByKey(d){const p=this.data[d];return p?p[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,p){if(!this.has(d))return this;const j=d.wrapped().key,E=p===void 0?0:this.data[j].indexOf(p),O=this.data[j][E];return this.data[j].splice(E,1),O.timeout&&clearTimeout(O.timeout),this.data[j].length===0&&delete this.data[j],this.onRemove(O.value),this.order.splice(this.order.indexOf(j),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const p=this._getAndRemoveByKey(this.order[0]);p&&this.onRemove(p)}return this}filter(d){const p=[];for(const j in this.data)for(const E of this.data[j])d(E.value)||p.push(E);for(const j of p)this.remove(j.value.tileID,j)}}class Af{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,p,j){const E=String(p);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][E]=this.stateChanges[d][E]||{},Object.assign(this.stateChanges[d][E],j),this.deletedStates[d]===null){this.deletedStates[d]={};for(const O in this.state[d])O!==E&&(this.deletedStates[d][O]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][E]===null){this.deletedStates[d][E]={};for(const O in this.state[d][E])j[O]||(this.deletedStates[d][E][O]=null)}else for(const O in j)this.deletedStates[d]&&this.deletedStates[d][E]&&this.deletedStates[d][E][O]===null&&delete this.deletedStates[d][E][O]}removeFeatureState(d,p,j){if(this.deletedStates[d]===null)return;const E=String(p);if(this.deletedStates[d]=this.deletedStates[d]||{},j&&p!==void 0)this.deletedStates[d][E]!==null&&(this.deletedStates[d][E]=this.deletedStates[d][E]||{},this.deletedStates[d][E][j]=null);else if(p!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][E])for(j in this.deletedStates[d][E]={},this.stateChanges[d][E])this.deletedStates[d][E][j]=null;else this.deletedStates[d][E]=null;else this.deletedStates[d]=null}getState(d,p){const j=this.state[d]||{},E=this.stateChanges[d]||{},O=this.deletedStates[d];if(O===null)return{};if(p!==void 0){const B=String(p),H=Object.assign({},j[B],E[B]);if(O){const X=O[p];if(X===null)return{};for(const te in X)delete H[te]}return H}const R=Object.assign({},j,E);if(O)for(const B in O)delete R[B];return R}initializeTileState(d,p){d.refreshFeatureState(p)}coalesceChanges(d,p){const j={};for(const E in this.stateChanges){this.state[E]=this.state[E]||{};const O={};for(const R in this.stateChanges[E])this.state[E][R]||(this.state[E][R]={}),Object.assign(this.state[E][R],this.stateChanges[E][R]),O[R]=this.state[E][R];j[E]=O}for(const E in this.deletedStates){this.state[E]=this.state[E]||{};const O={};if(this.deletedStates[E]===null)for(const R in this.state[E])O[R]={},this.state[E][R]={};else for(const R in this.deletedStates[E]){if(this.deletedStates[E][R]===null)this.state[E][R]={};else if(this.state[E][R])for(const B of Object.keys(this.deletedStates[E][R]))delete this.state[E][R][B];O[R]=this.state[E][R]}j[E]=j[E]||{},Object.assign(j[E],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(j).length!==0)for(const E in d)d[E].refreshFeatureState(p)}}class yd extends i.E{constructor(d,p,j){super(),this.id=d,this._onlySymbols=j,p.on("data",E=>{E.dataType==="source"&&E.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&E.dataType==="source"&&E.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),p.on("error",()=>{this._sourceErrored=!0}),this._source=p,this._tiles={},this._cache=new ux(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=p.minTileCacheSize,this._maxTileCacheSize=p.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Af,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,p){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,p)}_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 p in this._tiles){const j=this._tiles[p];j.upload(d,this.map?this.map.painter:void 0),j.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(Jy).map(d=>d.key)}getRenderableIds(d,p){const j=[];for(const E in this._tiles)this._isIdRenderable(+E,d,p)&&j.push(this._tiles[E]);return d?j.sort((E,O)=>{const R=E.tileID,B=O.tileID,H=new i.P(R.canonical.x,R.canonical.y)._rotate(this.transform.angle),X=new i.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return R.overscaledZ-B.overscaledZ||X.y-H.y||X.x-H.x}).map(E=>E.tileID.key):j.map(E=>E.tileID).sort(Jy).map(E=>E.key)}hasRenderableParent(d){const p=this.findLoadedParent(d,0);return!!p&&this._isIdRenderable(p.tileID.key)}_isIdRenderable(d,p,j){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(p||!this._tiles[d].holdingForFade())&&(j||!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,p){const j=this._tiles[d];j&&(j.state!=="loading"&&(j.state=p),this._loadTile(j,this._tileLoaded.bind(this,j,d,p)))}_tileLoaded(d,p,j,E,O){if(E){if(d.state="errored",E.status!==404)this._source.fire(new i.y(E,{tile:d}));else{if(this._source.fire(new i.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=i.o.now(),j==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(p,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let R=new Map;O&&O.responseHeaders&&(R=O.responseHeaders),this._source.fire(new i.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:R}))}_backfillDEM(d){const p=this.getRenderableIds();for(let E=0;E1||(Math.abs(R)>1&&(Math.abs(R+H)===1?R+=H:Math.abs(R-H)===1&&(R-=H)),O.dem&&E.dem&&(E.dem.backfillBorder(O.dem,R,B),E.neighboringTiles&&E.neighboringTiles[X]&&(E.neighboringTiles[X].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,p,j,E){for(const O in this._tiles){let R=this._tiles[O];if(E[O]||!R.hasData()||R.tileID.overscaledZ<=p||R.tileID.overscaledZ>j)continue;let B=R.tileID;for(;R&&R.tileID.overscaledZ>p+1;){const X=R.tileID.scaledTo(R.tileID.overscaledZ-1);R=this._tiles[X.key],R&&R.hasData()&&(B=X)}let H=B;for(;H.overscaledZ>p;)if(H=H.scaledTo(H.overscaledZ-1),d[H.key]){E[B.key]=B;break}}}findLoadedParent(d,p){if(d.key in this._loadedParentTiles){const j=this._loadedParentTiles[d.key];return j&&j.tileID.overscaledZ>=p?j:null}for(let j=d.overscaledZ-1;j>=p;j--){const E=d.scaledTo(j),O=this._getLoadedTile(E);if(O)return O}}_getLoadedTile(d){const p=this._tiles[d.key];return p&&p.hasData()?p:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,p){p=p||this._source.tileSize;const j=Math.ceil(d.width/p)+1,E=Math.ceil(d.height/p)+1,O=Math.floor(j*E*5),R=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,O):O,B=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,R):R;this._cache.setMaxSize(B)}handleWrapJump(d){const p=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,p){const j={};for(const E in this._tiles){const O=this._tiles[E];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+p),j[O.tileID.key]=O}this._tiles=j;for(const E in this._timers)clearTimeout(this._timers[E]),delete this._timers[E];for(const E in this._tiles)this._setTileReloadTimer(+E,this._tiles[E])}}update(d,p,j,E,O){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!j)return;this.updateCacheSize(d,p),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const R=this._source.type==="batched-model";let B,H=this._source.maxzoom;const X=this.map&&this.map.painter?this.map.painter._terrain:null;if(X&&X.sourceCache===this&&X.attenuationRange()){const ce=X.attenuationRange()[0],he=Math.floor(ce)-Math.log2(X.getDemUpscale());H>he&&(H=he)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(ce=>new i.aQ(ce.canonical.z,ce.wrap,ce.canonical.z,ce.canonical.x,ce.canonical.y));else if(this.tileCoverLift!==0){const ce=d.clone();ce.tileCoverLift=this.tileCoverLift,B=ce.coveringTiles({tileSize:p||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:H,roundZoom:this._source.roundZoom&&!j,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:R}),this._source.minzoom<=1&&d.projection.name==="globe"&&(B.push(new i.aQ(1,0,1,0,0)),B.push(new i.aQ(1,0,1,1,0)),B.push(new i.aQ(1,0,1,0,1)),B.push(new i.aQ(1,0,1,1,1)))}else if(B=d.coveringTiles({tileSize:p||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:H,roundZoom:this._source.roundZoom&&!j,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:R}),this._source.hasTile){const ce=this._source.hasTile.bind(this._source);B=B.filter(he=>ce(he))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Am(this._source.type)){const ce=d.coveringZoomLevel({tileSize:p||this._source.tileSize,roundZoom:this._source.roundZoom&&!j}),he=Math.min(ce,this._source.maxzoom);if(R){const ke=d.extendTileCover(B,he);for(const be of ke)B.push(be)}else if(O){const ke=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(he),he);for(const be of ke)B.push(be)}else if(this.castsShadows&&E){const ke=d.extendTileCover(B,he,E,16);for(const be of ke)this._shadowCasterTiles[be.key]=!0,B.push(be)}}const te=this._updateRetainedTiles(B);if(Am(this._source.type)&&B.length!==0){const ce={},he={},ke=Object.keys(te);for(const Re of ke){const De=te[Re],We=this._tiles[Re];if(!We||We.fadeEndTime&&We.fadeEndTime<=i.o.now())continue;const nt=this.findLoadedParent(De,Math.max(De.overscaledZ-yd.maxOverzooming,this._source.minzoom));nt&&(this._addTile(nt.tileID),ce[nt.tileID.key]=nt.tileID),he[Re]=De}const be=B[B.length-1].overscaledZ;for(const Re in this._tiles){const De=this._tiles[Re];if(te[Re]||!De.hasData())continue;let We=De.tileID;for(;We.overscaledZ>be;){We=We.scaledTo(We.overscaledZ-1);const nt=this._tiles[We.key];if(nt&&nt.hasData()&&he[We.key]){te[Re]=De.tileID;break}}}for(const Re in ce)te[Re]||(this._coveredTiles[Re]=!0,te[Re]=ce[Re])}for(const ce in te)this._tiles[ce].clearFadeHold();const de=i.bv(this._tiles,te);for(const ce of de){const he=this._tiles[ce];he.hasSymbolBuckets&&!he.holdingForFade()?he.setHoldDuration(this.map._fadeDuration):he.hasSymbolBuckets&&!he.symbolFadeFinished()||this._removeTile(+ce)}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 p={};if(d.length===0)return p;const j={},E=d.reduce((X,te)=>Math.min(X,te.overscaledZ),1/0),O=d[0].overscaledZ,R=Math.max(O-yd.maxOverzooming,this._source.minzoom),B=Math.max(O+yd.maxUnderzooming,this._source.minzoom),H={};for(const X of d){const te=this._addTile(X);p[X.key]=X,te.hasData()||E=this._source.maxzoom){const ce=X.children(this._source.maxzoom)[0],he=this.getTile(ce);if(he&&he.hasData()){p[ce.key]=ce;continue}}else{const ce=X.children(this._source.maxzoom);if(p[ce[0].key]&&p[ce[1].key]&&p[ce[2].key]&&p[ce[3].key])continue}let de=te.wasRequested();for(let ce=X.overscaledZ-1;ce>=R;--ce){const he=X.scaledTo(ce);if(j[he.key]||(j[he.key]=!0,te=this.getTile(he),!te&&de&&(te=this._addTile(he)),te&&(p[he.key]=he,de=te.wasRequested(),te.hasData())))break}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const p=[];let j,E=this._tiles[d].tileID;for(;E.overscaledZ>0;){if(E.key in this._loadedParentTiles){j=this._loadedParentTiles[E.key];break}p.push(E.key);const O=E.scaledTo(E.overscaledZ-1);if(j=this._getLoadedTile(O),j)break;E=O}for(const O of p)this._loadedParentTiles[O]=j}}_addTile(d){let p=this._tiles[d.key];if(p)return p.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),p;p=this._cache.getAndRemove(d),p&&(this._setTileReloadTimer(d.key,p),p.tileID=d,this._state.initializeTileState(p,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,p)));const j=!!p;if(!j){const E=this.map?this.map.painter:null,O=this._source.tileSize*d.overscaleFactor();p=this._source.type==="raster-array"?new Qy(d,O,this.transform.tileZoom,E,this._isRaster):new Tf(d,O,this.transform.tileZoom,E,this._isRaster,this._source.worldview),this._loadTile(p,this._tileLoaded.bind(this,p,d.key,p.state))}return p.uses++,this._tiles[d.key]=p,j||this._source.fire(new i.z("dataloading",{tile:p,coord:p.tileID,dataType:"source"})),p}_setTileReloadTimer(d,p){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const j=p.getExpiryTimeout();j&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},j))}_removeTile(d){const p=this._tiles[d];p&&(p.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),p.uses>0||(p.hasData()&&p.state!=="reloading"||p.state==="empty"?this._cache.add(p.tileID,p,p.getExpiryTimeout()):(p.aborted=!0,this._abortTile(p),this._unloadTile(p))))}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,p,j){const E=[],O=this.transform;if(!O)return E;const R=O.projection.name==="globe",B=i.aF(O.center.lng);for(const H in this._tiles){const X=this._tiles[H];if(j&&X.clearQueryDebugViz(),X.holdingForFade())continue;let te;if(R){const de=X.tileID.canonical;if(de.z===0){const ce=[Math.abs(i.aA(B,...Iu(de,-1))-B),Math.abs(i.aA(B,...Iu(de,1))-B)];te=[0,2*ce.indexOf(Math.min(...ce))-1]}else{const ce=[Math.abs(i.aA(B,...Iu(de,-1))-B),Math.abs(i.aA(B,...Iu(de,0))-B),Math.abs(i.aA(B,...Iu(de,1))-B)];te=[ce.indexOf(Math.min(...ce))-1]}}else te=[0];for(const de of te){const ce=d.containsTile(X,O,p,de);ce&&E.push(ce)}}return E}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,p){const j=this.getRenderableIds(d,p).map(O=>this._tiles[O].tileID),E=this.transform.projection.name==="globe";for(const O of j)O.projMatrix=this.transform.calculateProjMatrix(O.toUnwrapped()),O.expandedProjMatrix=E?this.transform.calculateProjMatrix(O.toUnwrapped(),!1,!0):O.projMatrix;return j}sortCoordinatesByDistance(d){const p=d.slice(),j=this.transform._camera.position,E=this.transform._camera.forward(),O={};for(const R of p){const B=1/(1<O[R.key]-O[B.key]),p}hasTransition(){if(this._source.hasTransition())return!0;if(Am(this._source.type))for(const d in this._tiles){const p=this._tiles[d];if(p.fadeEndTime!==void 0&&p.fadeEndTime>=i.o.now())return!0}return!1}setFeatureState(d,p,j){this._state.updateState(d=d||"_geojsonTileLayer",p,j)}removeFeatureState(d,p,j){this._state.removeFeatureState(d=d||"_geojsonTileLayer",p,j)}getFeatureState(d,p){return this._state.getState(d=d||"_geojsonTileLayer",p)}setDependencies(d,p,j){const E=this._tiles[d];E&&E.setDependencies(p,j)}reloadTilesForDependencies(d,p){for(const j in this._tiles)this._tiles[j].hasDependency(d,p)&&this._reloadTile(+j,"reloading");this._cache.filter(j=>!j.hasDependency(d,p))}_preloadTiles(d,p){if(!this._sourceLoaded){const H=()=>{this._sourceLoaded&&(this._source.off("data",H),this._preloadTiles(d,p))};return void this._source.on("data",H)}const j=new Map,E=Array.isArray(d)?d:[d],O=this.map.painter.terrain,R=this.usedForTerrain&&O?O.getScaledDemTileSize():this._source.tileSize;for(const H of E){const X=H.coveringTiles({tileSize:R,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const te of X)j.set(te.key,te);this.usedForTerrain&&H.updateElevation(!1)}const B=Array.from(j.values());i.bw(B,(H,X)=>{const te=new Tf(H,this._source.tileSize*H.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(te,de=>{this._source.type==="raster-dem"&&te.dem&&this._backfillDEM(te),X(de,te)})},p)}}function Jy(w,d){const p=Math.abs(2*w.wrap)-+(w.wrap<0),j=Math.abs(2*d.wrap)-+(d.wrap<0);return w.overscaledZ-d.overscaledZ||j-p||d.canonical.y-w.canonical.y||d.canonical.x-w.canonical.x}function Am(w){return w==="raster"||w==="image"||w==="video"||w==="custom"}function Iu(w,d){const p=1<0:j.type==="building"?E=!j.isHidden(d)&&j.paint.get("building-opacity")>0:j.type==="model"&&(E=!j.isHidden(d)&&j.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!E&&p.visible,p.visible=E}}updateZOffset(d,p){this.currentBuildingBuckets=[];for(const E of this.layers){const O=E.layer,R=this.style.getLayerSourceCache(O);let B=1;O.type==="fill-extrusion"?B=E.visible?O.paint.get("fill-extrusion-vertical-scale"):0:O.type==="building"&&(B=E.visible?O.paint.get("building-vertical-scale"):0);let H=R?R.getTile(p):null;if(!H&&R)for(const X in R._tiles){const te=R._tiles[X];if(p.canonical.isChildOf(te.tileID.canonical)){H=te;break}}this.currentBuildingBuckets.push({bucket:H?H.getBucket(O):null,tileID:H?H.tileID:p,verticalScale:B})}d.hasAnyZOffset=!1;let j=!1;for(let E=0;E{j in d&&(p[j]=d[j])}),p}function hx(w){w=w.slice();const d=Object.create(null);for(let p=0;p0?(E-R)/B:0;return this.points[O].mult(1-H).add(this.points[p].mult(H))}}class ss{constructor(d,p,j){const E=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(d/j),this.yCellCount=Math.ceil(p/j);for(let R=0;Rthis.width||E<0||p>this.height)return!O&&[];const B=[];if(d<=0&&p<=0&&this.width<=j&&this.height<=E){if(O)return!0;for(let H=0;H0:B}_queryCircle(d,p,j,E,O){const R=d-j,B=d+j,H=p-j,X=p+j;if(B<0||R>this.width||X<0||H>this.height)return!E&&[];const te=[];return this._forEachCell(R,H,B,X,this._queryCellCircle,te,{hitTest:E,circle:{x:d,y:p,radius:j},seenUids:{box:{},circle:{}}},O),E?te.length>0:te}query(d,p,j,E,O){return this._query(d,p,j,E,!1,O)}hitTest(d,p,j,E,O){return this._query(d,p,j,E,!0,O)}hitTestCircle(d,p,j,E){return this._queryCircle(d,p,j,!0,E)}_queryCell(d,p,j,E,O,R,B,H){const X=B.seenUids,te=this.boxCells[O];if(te!==null){const ce=this.bboxes;for(const he of te)if(!X.box[he]){X.box[he]=!0;const ke=4*he;if(d<=ce[ke+2]&&p<=ce[ke+3]&&j>=ce[ke+0]&&E>=ce[ke+1]&&(!H||H(this.boxKeys[he]))){if(B.hitTest)return R.push(!0),!0;R.push({key:this.boxKeys[he],x1:ce[ke],y1:ce[ke+1],x2:ce[ke+2],y2:ce[ke+3]})}}}const de=this.circleCells[O];if(de!==null){const ce=this.circles;for(const he of de)if(!X.circle[he]){X.circle[he]=!0;const ke=3*he;if(this._circleAndRectCollide(ce[ke],ce[ke+1],ce[ke+2],d,p,j,E)&&(!H||H(this.circleKeys[he]))){if(B.hitTest)return R.push(!0),!0;{const be=ce[ke],Re=ce[ke+1],De=ce[ke+2];R.push({key:this.circleKeys[he],x1:be-De,y1:Re-De,x2:be+De,y2:Re+De})}}}}}_queryCellCircle(d,p,j,E,O,R,B,H){const X=B.circle,te=B.seenUids,de=this.boxCells[O];if(de!==null){const he=this.bboxes;for(const ke of de)if(!te.box[ke]){te.box[ke]=!0;const be=4*ke;if(this._circleAndRectCollide(X.x,X.y,X.radius,he[be+0],he[be+1],he[be+2],he[be+3])&&(!H||H(this.boxKeys[ke])))return R.push(!0),!0}}const ce=this.circleCells[O];if(ce!==null){const he=this.circles;for(const ke of ce)if(!te.circle[ke]){te.circle[ke]=!0;const be=3*ke;if(this._circlesCollide(he[be],he[be+1],he[be+2],X.x,X.y,X.radius)&&(!H||H(this.circleKeys[ke])))return R.push(!0),!0}}}_forEachCell(d,p,j,E,O,R,B,H){const X=this._convertToXCellCoord(d),te=this._convertToYCellCoord(p),de=this._convertToXCellCoord(j),ce=this._convertToYCellCoord(E);for(let he=X;he<=de;he++)for(let ke=te;ke<=ce;ke++)if(O.call(this,d,p,j,E,this.xCellCount*ke+he,R,B,H))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,p,j,E,O,R){const B=E-d,H=O-p,X=j+R;return X*X>B*B+H*H}_circleAndRectCollide(d,p,j,E,O,R,B){const H=(R-E)/2,X=Math.abs(d-(E+H));if(X>H+j)return!1;const te=(B-O)/2,de=Math.abs(p-(O+te));if(de>te+j)return!1;if(X<=H||de<=te)return!0;const ce=X-H,he=de-te;return ce*ce+he*he<=j*j}}const sa={unknown:0,flipRequired:1,flipNotRequired:2},Ps=Math.tan(85*Math.PI/180);function wa(w,d,p,j,E,O,R){const B=i.bC();if(p)if(O.name==="globe"){const H=i.bD(E,d);i.aB(B,B,H)}else{const H=i.bE([],R);B[0]=H[0],B[1]=H[1],B[4]=H[2],B[5]=H[3],j||i.bB(B,B,E.angle)}else i.aB(B,E.labelPlaneMatrix,w);return B}function Vh(w,d,p,j,E,O,R){const B=wa(w,d,p,j,E,O,R);return O.name==="globe"&&p||(B[2]=B[6]=B[10]=B[14]=0),B}function cu(w,d,p,j,E,O,R){if(p){if(O.name==="globe"){const B=wa(w,d,p,j,E,O,R);return i.bl(B,B),i.aB(B,w,B),B}{const B=i.bz(w),H=i.bA([]);return H[0]=R[0],H[1]=R[1],H[4]=R[2],H[5]=R[3],i.aB(B,B,H),j||i.bB(B,B,-E.angle),B}}return E.glCoordMatrix}function Il(w,d,p,j){const E=[w,d,p,1];p?i.aC(E,E,j):wn(E,E,j);const O=E[3];return E[0]/=O,E[1]/=O,E[2]/=O,E}function ja(w,d){return Math.min(.5+w/d*.5,1.5)}function Bk(w,d){const p=w[0]/w[3],j=w[1]/w[3];return p>=-d[0]&&p<=d[0]&&j>=-d[1]&&j<=d[1]}function EP(w,d,p,j,E,O,R,B,H,X,te=1){const de=p.transform,ce=j?w.textSizeData:w.iconSizeData,he=i.bK(ce,p.transform.zoom,te),ke=de.projection.name==="globe",be=[256/p.width*2+1,256/p.height*2+1],Re=j?w.text.dynamicLayoutVertexArray:w.icon.dynamicLayoutVertexArray;Re.clear();let De=null;ke&&(De=j?w.text.globeExtVertexArray:w.icon.globeExtVertexArray);const We=w.lineVertexArray,nt=j?w.text.placedSymbolArray:w.icon.placedSymbolArray,Ge=p.transform.width/p.transform.height;let jt,gt=!1;for(let _t=0;_tMath.abs(p)?{useVertical:!0}:w===i.bL.vertical?j>0?{needsFlipping:!0}:null:d!==sa.unknown&&function(E,O){return E===0||Math.abs(O/E)>Ps}(p,j)?d===sa.flipRequired?{needsFlipping:!0}:null:p<0?{needsFlipping:!0}:null}function t5(w,d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re,De,We,nt){const Ge=d/24,jt=w.lineOffsetX*Ge,gt=w.lineOffsetY*Ge,{lineStartIndex:_t,glyphStartIndex:pt,numGlyphs:ht,segment:St,writingMode:Rt,flipState:Dt}=w,Yt=_t+w.lineLength,Xt=or=>{if(te){const[er,Kt,mr]=or.up,Lr=X.length;i.bN(te,Lr+0,er,Kt,mr),i.bN(te,Lr+1,er,Kt,mr),i.bN(te,Lr+2,er,Kt,mr),i.bN(te,Lr+3,er,Kt,mr)}const[wr,Vt,Et]=or.point;i.bO(X,wr,Vt,Et,or.angle)};if(ht>1){const or=IP(Ge,B,jt,gt,p,de,ce,w,H,O,he,be,!1,Re,De,We,nt);if(!or)return{notEnoughRoom:!0};if(j&&!p){let[wr,Vt,Et]=or.first.point,[er,Kt,mr]=or.last.point;[wr,Vt]=Il(wr,Vt,Et,R),[er,Kt]=Il(er,Kt,mr,R);const Lr=zn(Rt,Dt,(er-wr)*ke,Kt-Vt);if(w.flipState=Lr&&Lr.needsFlipping?sa.flipRequired:sa.flipNotRequired,Lr)return Lr}Xt(or.first);for(let wr=pt+1;wr0?er:uh(ce,Et,wr,1,E,void 0,Re,De.canonical),mr=zn(Rt,Dt,(Kt[0]-wr[0])*ke,Kt[1]-wr[1]);if(w.flipState=mr&&mr.needsFlipping?sa.flipRequired:sa.flipNotRequired,mr)return mr}const or=t0(Ge*B.getoffsetX(pt),jt,gt,p,de,ce,St,_t,Yt,H,O,he,be,!1,!1,Re,De,We,nt);if(!or)return{notEnoughRoom:!0};Xt(or)}return{}}function Fv(w,d,p,j,E){const{x:O,y:R,z:B}=j.projectTilePoint(w.x,w.y,d);if(!E)return Il(O,R,B,p);const[H,X,te]=E.getElevation(w,E.elevation,E.elevationFeature);return Il(O+H,R+X,B+te,p)}function uh(w,d,p,j,E,O,R,B){const H=Fv(w.sub(d)._unit()._add(w),B,E,R,O);return i.av(H,p,H),i.aw(H,H),i.bH(H,p,H,j)}function t0(w,d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re,De,We){const nt=j?w-d:w+d;let Ge=nt>0?1:-1,jt=0;j&&(Ge*=-1,jt=Math.PI),Ge<0&&(jt+=Math.PI);let gt=B+R+(Ge>0?0:1)|0,_t=E,pt=E,ht=0,St=0;const Rt=Math.abs(nt),Dt=[],Yt=[];let Xt=O,or=Xt,wr=i.bF([]);const Vt=()=>uh(or,Xt,pt,Rt-ht+1,te,ce,be,Re.canonical);for(;ht+St<=Rt;){if(gt+=Ge,gt=H)return null;if(pt=_t,or=Xt,Dt.push(pt),he&&Yt.push(or),Xt=new i.P(X.getx(gt),X.gety(gt)),_t=de[gt],!_t){const an=Fv(Xt,Re.canonical,te,be,ce);_t=an[3]>0?de[gt]=an:Vt()}ht+=St;const jr=i.av([],_t,pt),fn=i.bG(pt,_t);if(p&&fn>0&&St>0&&i.bJ(wr,jr)/(St*fn)0,nt),_t=X*gt.perspectiveRatio,pt=(j.x1*p+B.x-j.padding)*_t+gt.point.x,ht=(j.y1*p+B.y-j.padding)*_t+gt.point.y,St=(j.x2*p+B.x+j.padding)*_t+gt.point.x,Rt=(j.y2*p+B.y+j.padding)*_t+gt.point.y,Dt=gt.perspectiveRatio<=.55||gt.occluded;return!this.isInsideGrid(pt,ht,St,Rt)||!H&&this.grid.hitTest(pt,ht,St,Rt,de)||Dt?{box:[],offscreen:!1,occluded:gt.occluded}:{box:[pt,ht,St,Rt],offscreen:this.isOffscreen(pt,ht,St,Rt),occluded:!1}}placeCollisionCircles(d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re){const De=[],We=this.transform.elevation,nt=d.getProjection(),Ge=d.elevationType==="road",jt=!!We||Ge,gt=i.bV.getAtTileOffsetFunc(Re,this.transform.center.lat,this.transform.worldSize,nt),_t=new i.P(j.tileAnchorX,j.tileAnchorY),pt=new i.P(j.tileAnchorX,j.tileAnchorY);let{x:ht,y:St,z:Rt}=nt.projectTilePoint(pt.x,pt.y,Re.canonical),Dt=null;if(jt){const fn=Ge?d.getElevationFeatureForText(E):null;Dt={getElevation:gt,elevation:We,elevationFeature:fn};const[an,Hr,Qr]=gt(_t,We,fn);ht+=an,St+=Hr,Rt+=Qr}const Yt=nt.name==="globe",Xt=this.projectAndGetPerspectiveRatio(H,ht,St,Rt,Re,Yt||!!We||this.transform.pitch>0,nt),{perspectiveRatio:or}=Xt,wr=(ce?B/or:B*or)/i.bY,Vt=Il(ht,St,Rt,X),Et=j.lineOffsetX*wr,er=j.lineOffsetY*wr,Kt=i.an(d.layers[0].layout.get("text-max-angle")),mr=Math.cos(Kt),Lr=Xt.signedDistanceFromCamera>0?IP(wr,R,Et,er,Ge&&j.flipState===1,Vt,pt,j,O,X,{},jt&&!ce?Dt:null,ce&&jt,nt,Re,ce,mr):null;let Yr=!1,Tr=!1,jr=!0;if(Lr&&!Xt.occluded){const fn=.5*ke*or+be,an=new i.P(-100,-100),Hr=new i.P(this.screenRightBoundary,this.screenBottomBoundary),Qr=new ns,{first:Mn,last:rs}=Lr,Gs=Mn.path.length;let ka=[];for(let Qn=Gs-1;Qn>=1;Qn--)ka.push(Mn.path[Qn]);for(let Qn=1;Qn(jt&&!Yt&&(qa=gt(DaQn[3]<=0)&&(ka=[]));let fa=[];if(ka.length>0){let Qn=1/0,Ma=-1/0,qa=1/0,Da=-1/0;for(const ha of ka)Qn=Math.min(Qn,ha[0]),qa=Math.min(qa,ha[1]),Ma=Math.max(Ma,ha[0]),Da=Math.max(Da,ha[1]);Ma>=an.x&&Qn<=Hr.x&&Da>=an.y&&qa<=Hr.y&&(fa=[ka.map(ha=>new i.P(ha[0],ha[1]))],(QnHr.x||qaHr.y)&&(fa=i.bW(fa,an.x,an.y,Hr.x,Hr.y)))}for(const Qn of fa){Qr.reset(Qn,.25*fn);let Ma=0;Ma=Qr.length<=.5*fn?1:Math.ceil(Qr.paddedLength/xn)+1;for(let qa=0;qa0?(i.aC(H,H,d),this.fogState&&O&&B.name!=="globe"&&(X=function(ce,he,ke,be,Re,De){const We=De.calculateFogTileMatrix(Re),nt=[he,ke,be];return i.af(nt,nt,We),Xr(ce,i.ag(nt),De.pitch,De._fov)}(this.fogState,p,j,E,O.toUnwrapped(),this.transform)>.9)):wn(H,H,d);const te=H[3];return{point:new i.P((H[0]/te+1)/2*this.transform.width+aa,(-H[1]/te+1)/2*this.transform.height+aa),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/te*.5,1.5),signedDistanceFromCamera:te,occluded:R&&H[2]>te||X}}isOffscreen(d,p,j,E){return j=this.screenRightBoundary||Ethis.screenBottomBoundary}isInsideGrid(d,p,j,E){return j>=0&&d=0&&pj.collisionGroupID===p}}return this.collisionGroups[d]}}function Ic(w,d,p,j,E){const{horizontalAlign:O,verticalAlign:R}=i.c1(w),B=-(O-.5)*d,H=-(R-.5)*p,X=i.c2(w,j);return new i.P(B+X[0]*E,H+X[1]*E)}function Bo(w,d,p,j,E){const O=new i.P(w,d);return p&&O._rotate(j?E:-E),O}class zie{constructor(d,p,j,E,O,R){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Ua(this.transform,O),this.buildingIndex=R,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=p,this.retainedQueryData={},this.collisionGroups=new Bv(j),this.collisionCircleArrays={},this.prevPlacement=E,E&&(E.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,p,j,E,O=1){const R=j.getBucket(p),B=j.latestFeatureIndex;if(!R||!B||p.fqid!==R.layerIds[0])return;const H=R.layers[0].layout,X=R.layers[0].paint,te=j.collisionBoxArray,de=Math.pow(2,this.transform.zoom-j.tileID.overscaledZ),ce=j.tileSize/i.al,he=j.tileID.toUnwrapped();this.transform.setProjection(R.projection);const ke=(be=j.tileID,Re=R.getProjection(),De=this.transform,Re.name===this.projection?De.calculateProjMatrix(be.toUnwrapped()):kt(De,Re,be));var be,Re,De;const We=H.get("text-pitch-alignment")==="map",nt=H.get("text-rotation-alignment")==="map";p.compileFilter(p.options);const Ge=p.dynamicFilter(),jt=p.dynamicFilterNeedsFeature(),gt=this.transform.calculatePixelsToTileUnitsMatrix(j),_t=Vh(ke,j.tileID.canonical,We,nt,this.transform,R.getProjection(),gt);let pt=null;const ht=R.getProjection().createInversionMatrix(this.transform,j.tileID.canonical);if(We){const Et=cu(ke,j.tileID.canonical,We,nt,this.transform,R.getProjection(),gt);pt=i.aB([],this.transform.labelPlaneMatrix,Et)}let St=null;Ge&&j.latestFeatureIndex&&(St={unwrappedTileID:he,dynamicFilter:Ge,dynamicFilterNeedsFeature:jt}),this.retainedQueryData[R.bucketInstanceId]=new zv(R.bucketInstanceId,B,R.sourceLayerIndex,R.index,j.tileID);const[Rt,Dt]=R.layers[0].layout.get("text-size-scale-range"),Yt=i.aA(O,Rt,Dt),[Xt,or]=H.get("icon-size-scale-range"),wr=i.aA(O,Xt,or),Vt={bucket:R,layout:H,paint:X,posMatrix:ke,invMatrix:ht,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:_t,labelToScreenMatrix:pt,clippingData:St,scale:de,textPixelRatio:ce,holdingForFade:j.holdingForFade(),collisionBoxArray:te,partiallyEvaluatedTextSize:i.bK(R.textSizeData,this.transform.zoom,Yt),partiallyEvaluatedIconSize:i.bK(R.iconSizeData,this.transform.zoom,wr),collisionGroup:this.collisionGroups.get(R.sourceID),latestFeatureIndex:j.latestFeatureIndex};if(E)for(const Et of R.sortKeyRanges){const{sortKey:er,symbolInstanceStart:Kt,symbolInstanceEnd:mr}=Et;d.push({sortKey:er,symbolInstanceStart:Kt,symbolInstanceEnd:mr,parameters:Vt})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:R.symbolInstances.length,parameters:Vt})}attemptAnchorPlacement(d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re,De,We,nt,Ge,jt){const{textOffset0:gt,textOffset1:_t,crossTileID:pt}=be,ht=[gt,_t],St=Ic(d,R,B,ht,H),Rt=this.collisionIndex.placeCollisionBox(De,H,p,j,E,O,Bo(St.x,St.y,X,te,this.transform.angle),ke,de,ce,he.predicate);if(nt){const Dt=De.getSymbolInstanceIconSize(jt,this.transform.zoom,be.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(De,Dt,nt,j,E,O,Bo(St.x,St.y,X,te,this.transform.angle),ke,de,ce,he.predicate).box.length===0)return}if(Rt.box.length>0){let Dt;return this.prevPlacement&&this.prevPlacement.variableOffsets[pt]&&this.prevPlacement.placements[pt]&&this.prevPlacement.placements[pt].text&&(Dt=this.prevPlacement.variableOffsets[pt].anchor),this.variableOffsets[pt]={textOffset:ht,width:R,height:B,anchor:d,textScale:H,prevAnchor:Dt},this.markUsedJustification(De,d,be,We),De.allowVerticalPlacement&&(this.markUsedOrientation(De,We,be),this.placedOrientations[pt]=We),{shift:St,placedGlyphBoxes:Rt}}}placeLayerBucketPart(d,p,j,E,O=1){const{bucket:R,layout:B,paint:H,posMatrix:X,textLabelPlaneMatrix:te,labelToScreenMatrix:de,clippingData:ce,textPixelRatio:he,mercatorCenter:ke,invMatrix:be,holdingForFade:Re,collisionBoxArray:De,partiallyEvaluatedTextSize:We,partiallyEvaluatedIconSize:nt,collisionGroup:Ge,latestFeatureIndex:jt}=d.parameters,gt=B.get("text-optional"),_t=B.get("icon-optional"),pt=B.get("text-allow-overlap"),ht=B.get("icon-allow-overlap"),St=B.get("text-rotation-alignment")==="map",Rt=B.get("icon-rotation-alignment")==="map",Dt=B.get("text-pitch-alignment")==="map",Yt=H.get("symbol-z-offset"),Xt=B.get("symbol-elevation-reference")==="sea",or=B.get("symbol-placement"),[wr,Vt]=B.get("text-size-scale-range"),[Et,er]=B.get("icon-size-scale-range"),Kt=i.aA(O,wr,Vt),mr=i.aA(O,Et,er),Lr=B.get("text-variable-anchor"),Yr=St&&or!=="point",Tr=Rt&&or!=="point",jr=Lr&&R.hasTextData(),fn=R.hasIconTextFit()&&jr&&R.hasIconData();this.transform.setProjection(R.projection);const an=jr||Yr,Hr=Tr||fn;let Qr=pt&&(ht||!R.hasIconData()||_t),Mn=ht&&(pt||!R.hasTextData()||gt);const rs=!Yt.isConstant();!R.collisionArrays&&De&&R.deserializeCollisionBoxes(De),j&&E&&R.updateCollisionDebugBuffers(this.transform.zoom,De,Kt,mr);const Gs=(xn,fa,Qn)=>{const{crossTileID:Ma,numVerticalGlyphVertices:qa}=xn;let Da=null;if(ce&&ce.dynamicFilterNeedsFeature||rs){const ro=this.retainedQueryData[R.bucketInstanceId];Da=jt.loadFeature({featureIndex:xn.featureIndex,bucketIndex:ro.bucketIndex,sourceLayerIndex:ro.sourceLayerIndex,layoutVertexArrayOffset:0});const xo=Da.properties?Da.properties.worldview:null;if(R.localizable&&R.worldview&&typeof xo=="string")if(xo==="all")Da.properties.$localized=!0;else{if(!xo.split(",").includes(R.worldview))return;Da.properties.$localized=!0,Da.properties.worldview=R.worldview}}if(ce&&!(0,ce.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:R.worldview},Da,this.retainedQueryData[R.bucketInstanceId].tileID.canonical,new i.P(xn.tileAnchorX,xn.tileAnchorY),this.transform.calculateDistanceTileData(ce.unwrappedTileID)))return this.placements[Ma]=new La(!1,!1,!1,!0),void p.add(Ma);const ha=Yt.evaluate(Da,{});if(p.has(Ma))return;if(Re)return void(this.placements[Ma]=new La(!1,!1,!1));let fs=!1,Ca=!1,Zi=!0,Ni=!1,Ta=!1,oa=null,ps={box:null,offscreen:null,occluded:null},pi={box:null},ho=null,qi=null,Ja=null,kd=0,fc=0,el=0;Qn.textFeatureIndex?kd=Qn.textFeatureIndex:xn.useRuntimeCollisionCircles&&(kd=xn.featureIndex),Qn.verticalTextFeatureIndex&&(fc=Qn.verticalTextFeatureIndex);const Lc=R.elevationFeatures?R.elevationFeatures[xn.elevationFeatureIndex]:void 0,Oc=ro=>{ro.tileID=this.retainedQueryData[R.bucketInstanceId].tileID;const xo=this.transform.elevation;ro.elevation=Xt?ha:ha+i.bV.getAtTileOffset(ro.tileID,new i.P(ro.tileAnchorX,ro.tileAnchorY),xo,Lc),ro.elevation+=xn.zOffset},Gl=Qn.textBox;if(Gl){Oc(Gl);const ro=ei=>{let Mo=i.bL.horizontal;if(R.allowVerticalPlacement&&!ei&&this.prevPlacement){const Yi=this.prevPlacement.placedOrientations[Ma];Yi&&(this.placedOrientations[Ma]=Yi,Mo=Yi,this.markUsedOrientation(R,Mo,xn))}return Mo},xo=(ei,Mo)=>{if(R.allowVerticalPlacement&&qa>0&&Qn.verticalTextBox){for(const Yi of R.writingModes)if(Yi===i.bL.vertical?(ps=Mo(),pi=ps):ps=ei(),ps&&ps.box&&ps.box.length)break}else ps=ei()};if(Lr){let ei=Lr;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ma]){const Vi=this.prevPlacement.variableOffsets[Ma];ei.indexOf(Vi.anchor)>0&&(ei=ei.filter(vh=>vh!==Vi.anchor),ei.unshift(Vi.anchor))}const Mo=(Vi,vh,f_)=>{const Xh=R.getSymbolInstanceTextSize(We,xn,this.transform.zoom,fa),p_=(Vi.x2-Vi.x1)*Xh+2*Vi.padding,N0=(Vi.y2-Vi.y1)*Xh+2*Vi.padding,$m=xn.hasIconTextFit&&!ht?vh:null;$m&&Oc($m);let Vf={box:[],offscreen:!1,occluded:!1};const S0=pt?2*ei.length:ei.length;for(let dg=0;dg=ei.length,xn,fa,R,f_,$m,We,nt);if(Hf&&(Vf=Hf.placedGlyphBoxes,Vf&&Vf.box&&Vf.box.length)){fs=!0,oa=Hf.shift;break}}return Vf};xo(()=>Mo(Gl,Qn.iconBox,i.bL.horizontal),()=>{const Vi=Qn.verticalTextBox;return Vi&&Oc(Vi),R.allowVerticalPlacement&&!(ps&&ps.box&&ps.box.length)&&qa>0&&Vi?Mo(Vi,Qn.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),ps&&(fs=ps.box,Zi=ps.offscreen,Ni=ps.occluded);const Yi=ro(!(!ps||!ps.box));if(!fs&&this.prevPlacement){const Vi=this.prevPlacement.variableOffsets[Ma];Vi&&(this.variableOffsets[Ma]=Vi,this.markUsedJustification(R,Vi.anchor,xn,Yi))}}else{const ei=(Mo,Yi)=>{const Vi=R.getSymbolInstanceTextSize(We,xn,this.transform.zoom,fa),vh=this.collisionIndex.placeCollisionBox(R,Vi,Mo,ke,be,an,new i.P(0,0),pt,he,X,Ge.predicate);return vh&&vh.box&&vh.box.length&&(this.markUsedOrientation(R,Yi,xn),this.placedOrientations[Ma]=Yi),vh};xo(()=>ei(Gl,i.bL.horizontal),()=>{const Mo=Qn.verticalTextBox;return R.allowVerticalPlacement&&qa>0&&Mo?(Oc(Mo),ei(Mo,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),ro(!!(ps&&ps.box&&ps.box.length))}}if(ho=ps,fs=ho&&ho.box&&ho.box.length>0,Zi=ho&&ho.offscreen,Ni=ho&&ho.occluded,xn.useRuntimeCollisionCircles){const ro=xn.centerJustifiedTextSymbolIndex>=0?xn.centerJustifiedTextSymbolIndex:xn.verticalPlacedTextSymbolIndex,xo=R.text.placedSymbolArray.get(ro),ei=i.bM(R.textSizeData,We,xo),Mo=B.get("text-padding");qi=this.collisionIndex.placeCollisionCircles(R,pt,xo,ro,R.lineVertexArray,R.glyphOffsetArray,ei,X,te,de,j,Dt,Ge.predicate,xn.collisionCircleDiameter*ei/i.bY,Mo,this.retainedQueryData[R.bucketInstanceId].tileID),fs=pt||qi.circles.length>0&&!qi.collisionDetected,Zi=Zi&&qi.offscreen,Ni=qi.occluded}if(Qn.iconFeatureIndex&&(el=Qn.iconFeatureIndex),Qn.iconBox){const ro=xo=>{Oc(xo);const ei=xn.hasIconTextFit&&oa?Bo(oa.x,oa.y,St,Dt,this.transform.angle):new i.P(0,0),Mo=R.getSymbolInstanceIconSize(nt,this.transform.zoom,xn.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(R,Mo,xo,ke,be,Hr,ei,ht,he,X,Ge.predicate)};pi&&pi.box&&pi.box.length&&Qn.verticalIconBox?(Ja=ro(Qn.verticalIconBox),Ca=Ja.box.length>0):(Ja=ro(Qn.iconBox),Ca=Ja.box.length>0),Zi=Zi&&Ja.offscreen,Ta=Ja.occluded}const Ru=gt||xn.numHorizontalGlyphVertices===0&&qa===0,yh=_t||xn.numIconVertices===0;if(Ru||yh?yh?Ru||(Ca=Ca&&fs):fs=Ca&&fs:Ca=fs=Ca&&fs,fs&&ho&&ho.box&&this.collisionIndex.insertCollisionBox(ho.box,B.get("text-ignore-placement"),R.bucketInstanceId,pi&&pi.box&&fc?fc:kd,Ge.ID),Ca&&Ja&&this.collisionIndex.insertCollisionBox(Ja.box,B.get("icon-ignore-placement"),R.bucketInstanceId,el,Ge.ID),qi&&(fs&&this.collisionIndex.insertCollisionCircles(qi.circles,B.get("text-ignore-placement"),R.bucketInstanceId,kd,Ge.ID),j)){const ro=R.bucketInstanceId;let xo=this.collisionCircleArrays[ro];xo===void 0&&(xo=this.collisionCircleArrays[ro]=new $k);for(let ei=0;ei=0;--fa){const Qn=xn[fa];Gs(R.symbolInstances.get(Qn),Qn,R.collisionArrays[Qn])}R.hasAnyZOffset&&i.w(`${R.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(R.hasAnyZOffset){const xn=R.getSortedIndexesByZOffset();for(let fa=0;fa=0&&(d.text.placedSymbolArray.get(O).crossTileID=de>=0&&O!==de?0:X),R>=0&&(d.text.placedSymbolArray.get(R).crossTileID=de>=0&&R!==de?0:X),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=de>=0&&B!==de?0:X),H>=0&&(d.text.placedSymbolArray.get(H).crossTileID=de>=0&&H!==de?0:X)}markUsedOrientation(d,p,j){const E=p===i.bL.horizontal||p===i.bL.horizontalOnly?p:0,O=p===i.bL.vertical?p:0,{leftJustifiedTextSymbolIndex:R,centerJustifiedTextSymbolIndex:B,rightJustifiedTextSymbolIndex:H,verticalPlacedTextSymbolIndex:X}=j,te=d.text.placedSymbolArray;R>=0&&(te.get(R).placedOrientation=E),B>=0&&(te.get(B).placedOrientation=E),H>=0&&(te.get(H).placedOrientation=E),X>=0&&(te.get(X).placedOrientation=O)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const p=this.prevPlacement;let j=!1;this.prevZoomAdjustment=p?p.zoomAdjustment(this.transform.zoom):0;const E=p?p.symbolFadeChange(d):1,O=p?p.opacities:{},R=p?p.variableOffsets:{},B=p?p.placedOrientations:{};for(const H in this.placements){const X=this.placements[H],te=O[H];te?(this.opacities[H]=new Im(te,E,X.text,X.icon,null,X.clipped),j=j||X.text!==te.text.placed||X.icon!==te.icon.placed):(this.opacities[H]=new Im(null,E,X.text,X.icon,X.skipFade,X.clipped),j=j||X.text||X.icon)}for(const H in O){const X=O[H];if(!this.opacities[H]){const te=new Im(X,E,!1,!1);te.isHidden()||(this.opacities[H]=te,j=j||X.text.placed||X.icon.placed)}}for(const H in R)this.variableOffsets[H]||!this.opacities[H]||this.opacities[H].isHidden()||(this.variableOffsets[H]=R[H]);for(const H in B)this.placedOrientations[H]||!this.opacities[H]||this.opacities[H].isHidden()||(this.placedOrientations[H]=B[H]);j?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=p?p.lastPlacementChangeTime:d)}updateLayerOpacities(d,p,j,E){E&&(this.lastReplacementSourceUpdateTime=E.updateTime);const O=new Set;for(const R of p){const B=R.getBucket(d);B&&R.latestFeatureIndex&&d.fqid===B.layerIds[0]&&(this.updateBucketOpacities(B,O,R,R.collisionBoxArray,j,E,R.tileID,d.scope),B.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(B,R.tileID),B.elevationType==="road"&&B.updateRoadElevation(R.tileID.canonical),B.updateZOffset())}}updateBucketOpacities(d,p,j,E,O,R,B,H){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 X=d.layers[0].layout,te=d.layers[0].paint,de=!!d.layers[0].dynamicFilter(),ce=new Im(null,0,!1,!1,!0),he=X.get("text-allow-overlap"),ke=X.get("icon-allow-overlap"),be=X.get("text-variable-anchor"),Re=X.get("text-rotation-alignment")==="map",De=X.get("text-pitch-alignment")==="map",We=te.get("symbol-z-offset"),nt=X.get("symbol-elevation-reference")==="sea",Ge=!We.isConstant(),jt=new Im(null,0,he&&(ke||!d.hasIconData()||X.get("icon-optional")),ke&&(he||!d.hasTextData()||X.get("text-optional")),!0);!d.collisionArrays&&E&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(E);const gt=(pt,ht,St)=>{for(let Rt=0;Rt0||Rt>0,Lr=Yt>0,Yr=this.placedOrientations[Dt],Tr=Yr===i.bL.vertical,jr=Yr===i.bL.horizontal||Yr===i.bL.horizontalOnly;!mr&&!Lr||Kt.isHidden()||_t++;let fn=!1;if((mr||Lr)&&R)for(const an of d.activeReplacements){if(i.bZ(an,O,i.b_.Symbol,H)||an.min.x>Xt||Xt>an.max.x||an.min.y>or||or>an.max.y)continue;const Hr=i.b$(Xt,or,B.canonical,an.footprintTileId.canonical);if(fn=i.c0(Hr,an.footprint),fn)break}if(mr){const an=fn?fx:_d(Kt.text);gt(d.text,St,Tr?fx:an),gt(d.text,Rt,jr?fx:an);const Hr=Kt.text.isHidden(),{leftJustifiedTextSymbolIndex:Qr,centerJustifiedTextSymbolIndex:Mn,rightJustifiedTextSymbolIndex:rs,verticalPlacedTextSymbolIndex:Gs}=ht,ka=d.text.placedSymbolArray,xn=Hr||Tr?1:0;Qr>=0&&(ka.get(Qr).hidden=xn),Mn>=0&&(ka.get(Mn).hidden=xn),rs>=0&&(ka.get(rs).hidden=xn),Gs>=0&&(ka.get(Gs).hidden=Hr||jr?1:0);const fa=this.variableOffsets[Dt];fa&&this.markUsedJustification(d,fa.anchor,ht,Yr);const Qn=this.placedOrientations[Dt];Qn&&(this.markUsedJustification(d,"left",ht,Qn),this.markUsedOrientation(d,Qn,ht))}if(Lr){const an=fn?fx:_d(Kt.icon),{placedIconSymbolIndex:Hr,verticalPlacedIconSymbolIndex:Qr}=ht,Mn=d.icon.placedSymbolArray,rs=Kt.icon.isHidden()?1:0;Hr>=0&&(gt(d.icon,Yt,Tr?fx:an),Mn.get(Hr).hidden=rs),Qr>=0&&(gt(d.icon,ht.numVerticalIconVertices,jr?fx:an),Mn.get(Qr).hidden=rs)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const an=d.collisionArrays[pt];if(an){let Hr=new i.P(0,0),Qr=!0;if(an.textBox||an.verticalTextBox){if(be){const rs=this.variableOffsets[Dt];rs?(Hr=Ic(rs.anchor,rs.width,rs.height,rs.textOffset,rs.textScale),Re&&Hr._rotate(De?this.transform.angle:-this.transform.angle)):Qr=!1}de&&(Qr=!Kt.clipped),an.textBox&&Zp(d.textCollisionBox.collisionVertexArray,Kt.text.placed,!Qr||Tr,Et,nt,Hr.x,Hr.y),an.verticalTextBox&&Zp(d.textCollisionBox.collisionVertexArray,Kt.text.placed,!Qr||jr,Et,nt,Hr.x,Hr.y)}const Mn=Qr&&!!(!jr&&an.verticalIconBox);an.iconBox&&Zp(d.iconCollisionBox.collisionVertexArray,Kt.icon.placed,Mn,Et,nt,ht.hasIconTextFit?Hr.x:0,ht.hasIconTextFit?Hr.y:0),an.verticalIconBox&&Zp(d.iconCollisionBox.collisionVertexArray,Kt.icon.placed,!Mn,Et,nt,ht.hasIconTextFit?Hr.x:0,ht.hasIconTextFit?Hr.y:0)}}}if(d.fullyClipped=_t===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 pt=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=pt.invProjMatrix,d.placementViewportMatrix=pt.viewportMatrix,d.collisionCircleArray=pt.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 Zp(w,d,p,j,E,O,R){w.emplaceBack(d?1:0,p?1:0,O||0,R||0,j,E?1:0),w.emplaceBack(d?1:0,p?1:0,O||0,R||0,j,E?1:0),w.emplaceBack(d?1:0,p?1:0,O||0,R||0,j,E?1:0),w.emplaceBack(d?1:0,p?1:0,O||0,R||0,j,E?1:0)}const r5=Math.pow(2,25),$v=Math.pow(2,24),Uk=Math.pow(2,17),n5=Math.pow(2,16),qk=Math.pow(2,9),vd=Math.pow(2,8),Ef=Math.pow(2,1);function _d(w){if(w.opacity===0&&!w.placed)return 0;if(w.opacity===1&&w.placed)return 4294967295;const d=w.placed?1:0,p=Math.floor(127*w.opacity);return p*r5+d*$v+p*Uk+d*n5+p*qk+d*vd+p*Ef+d}const fx=0;class r0{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,p,j,E,O,R){const B=this._bucketParts;for(;this._currentTileIndexH.sortKey-X.sortKey));this._currentPartIndex{const H=i.o.now()-R;return!this._forceFullPlacement&&H>2};for(;this._currentPlacementIndex>=0;){const H=p[d[this._currentPlacementIndex]],X=this.placement.collisionIndex.transform.zoom;if(H.type==="symbol"&&H.visibility!=="none"&&(!H.minzoom||H.minzoom<=X)&&(!H.maxzoom||H.maxzoom>X)){const te=H,de=te.layout.get("symbol-z-elevate"),ce=te.layout.get("symbol-sort-key").constantOr(1)!==void 0,he=te.layout.get("symbol-z-order"),ke=he==="viewport-y"||he==="auto"&&!(he!=="viewport-y"&&ce),be=te.layout.get("text-allow-overlap")||te.layout.get("icon-allow-overlap")||te.layout.get("text-ignore-placement")||te.layout.get("icon-ignore-placement"),Re=ke&&be,De=this._inProgressLayer=this._inProgressLayer||new r0(te),We=i.B(H.source,H.scope);if(De.continuePlacement(de||Re?E[We]:j[We],this.placement,this._showCollisionBoxes,H,B,O))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const hh=512/i.al/2;class If{constructor(d,p,j){this.tileID=d,this.bucketInstanceId=j,this.index=new i.c4(p.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const E=d.canonical.x*i.al,O=d.canonical.y*i.al;for(let R=0;RRe-De);for(const Re of be){const De=this.crossTileIDs[Re];if(this.keys[Re]===te&&!j.has(De)){j.add(De),X.crossTileID=De;break}}}}}class dl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class s5{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const p=Math.round((d-this.lng)/360);if(p!==0)for(const j in this.indexes){const E=this.indexes[j],O={};for(const R in E){const B=E[R];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+p),O[B.tileID.key]=B}this.indexes[j]=O}this.lng=d}addBucket(d,p,j){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===p.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let O=0;Od.overscaledZ)for(const B in R){const H=R[B];H.tileID.isChildOf(d)&&H.findMatches(p.symbolInstances,d,E)}else{const B=R[d.scaledTo(Number(O)).key];B&&B.findMatches(p.symbolInstances,d,E)}}for(let O=0;O{p[j]=!0});for(const j in this.layerIndexes)p[j]||delete this.layerIndexes[j]}}const Pm=771;class ms{constructor(d,p,j,E){this.blendFunction=d,this.blendColor=p.toNonPremultipliedRenderColor(null),this.mask=j,this.blendEquation=E}}ms.Replace=[1,0,1,0],ms.disabled=new ms(ms.Replace,i.ao.transparent,[!1,!1,!1,!1]),ms.unblended=new ms(ms.Replace,i.ao.transparent,[!0,!0,!0,!0]),ms.alphaBlended=new ms([1,Pm,1,Pm],i.ao.transparent,[!0,!0,!0,!0]),ms.alphaBlendedNonPremultiplied=new ms([770,Pm,770,Pm],i.ao.transparent,[!0,!0,!0,!0]),ms.multiply=new ms([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),ms.additive=new ms([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class yn{constructor(d,p,j){this.func=d,this.mask=p,this.range=j}}yn.ReadOnly=!1,yn.ReadWrite=!0,yn.disabled=new yn(519,yn.ReadOnly,[0,1]);const Vk=7680;class Hn{constructor(d,p,j,E,O,R){this.test=d,this.ref=p,this.mask=j,this.fail=E,this.depthFail=O,this.pass=R}}Hn.disabled=new Hn({func:519,mask:0},0,0,Vk,Vk,Vk);const n0=1029,Hk=2305;class Un{constructor(d,p,j){this.enable=d,this.mode=p,this.frontFace=j}}function Lm(w,d){const p=i.ca(w,3);i.cc(w,d),i.cg(w,3,p)}function a5(w,d){const p=i.c7([]);return i.c8(p,p,-d),i.c9(p,p,-w),p}function Wk(w,d){const p=[w[0],w[1],0],j=[d[0],d[1],0];if(i.ag(p)>=1e-15){const R=i.aw([],p);i.c5(j,R,i.bJ(j,R)),d[0]=j[0],d[1]=j[1]}const E=i.bI([],d,w);if(i.c6(E)<1e-15)return null;const O=Math.atan2(-E[1],E[0]);return a5(Math.atan2(Math.sqrt(w[0]*w[0]+w[1]*w[1]),-w[2]),O)}Un.disabled=new Un(!1,n0,Hk),Un.backCCW=new Un(!0,n0,Hk),Un.backCW=new Un(!0,n0,2304),Un.frontCW=new Un(!0,1028,2304),Un.frontCCW=new Un(!0,1028,Hk);class bd{constructor(d,p){this.position=d,this.orientation=p}get position(){return this._position}set position(d){if(d){const p=d instanceof i.ae?d:new i.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(p.x=i.bT(p.x,0,1)),this._position=p}else this._position=null}lookAtPoint(d,p,j){if(this.orientation=null,!this.position)return;const E=this.position,O=j||(this._elevation?this._elevation.getAtPointOrZero(i.ae.fromLngLat(d)):0),R=i.ae.fromLngLat(d,O),B=[R.x-E.x,R.y-E.y,R.z-E.z];p||(p=[0,0,1]),p[2]=Math.abs(p[2]),this.orientation=Wk(B,p)}setPitchBearing(d,p){this.orientation=a5(i.an(d),i.an(-p))}}class Gk{constructor(d,p){this._transform=i.bA([]),this.orientation=p,this.position=d}get mercatorPosition(){const d=this.position;return new i.ae(d[0],d[1],d[2])}get position(){const d=i.ca(this._transform,3);return[d[0],d[1],d[2]]}set position(d){var p;d&&i.cg(this._transform,3,[(p=d)[0],p[1],p[2],1])}get orientation(){return this._orientation}set orientation(d){this._orientation=d||i.c7([]),d&&Lm(this._transform,this._orientation)}getPitchBearing(){const d=this.forward(),p=this.right();return{bearing:Math.atan2(-p[1],p[0]),pitch:Math.atan2(Math.sqrt(d[0]*d[0]+d[1]*d[1]),-d[2])}}setPitchBearing(d,p){this._orientation=a5(d,p),Lm(this._transform,this._orientation)}forward(){const d=i.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=i.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=i.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,p){const j=new Float64Array(16);return i.bl(j,this.getWorldToCamera(d,p)),j}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,p,j){const E=this.position;i.c5(E,E,-d);const O=new Float64Array(16);return i.bq(O,[j,j,j]),i.br(O,O,E),O[10]*=p,O}getWorldToCamera(d,p){const j=new Float64Array(16),E=new Float64Array(4),O=this.position;return i.cb(E,this._orientation),i.c5(O,O,-d),i.cc(j,E),i.br(j,j,O),j[1]*=-1,j[5]*=-1,j[9]*=-1,j[13]*=-1,j[8]*=p,j[9]*=p,j[10]*=p,j[11]*=p,j}getCameraToClipPerspective(d,p,j,E){const O=new Float64Array(16);return i.cd(O,d,p,j,E),O}getCameraToClipOrthographic(d,p,j,E,O,R){const B=new Float64Array(16);return i.ce(B,d,p,j,E,O,R),B}getDistanceToElevation(d,p=!1){const j=d===0?0:i.cf(d,p?i.a$(this.position[1]):this.position[1]),E=this.forward();return(j-this.position[2])/E[2]}clone(){return new Gk([...this.position],[...this.orientation])}}const Pl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Kk{constructor(d=0,p=0,j=0,E=0){if(isNaN(d)||d<0||isNaN(p)||p<0||isNaN(j)||j<0||isNaN(E)||E<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=p,this.left=j,this.right=E}interpolate(d,p,j){return p.top!=null&&d.top!=null&&(this.top=i.ak(d.top,p.top,j)),p.bottom!=null&&d.bottom!=null&&(this.bottom=i.ak(d.bottom,p.bottom,j)),p.left!=null&&d.left!=null&&(this.left=i.ak(d.left,p.left,j)),p.right!=null&&d.right!=null&&(this.right=i.ak(d.right,p.right,j)),this}getCenter(d,p){const j=i.aA((this.left+d-this.right)/2,0,d),E=i.aA((this.top+p-this.bottom)/2,0,p);return new i.P(j,E)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new Kk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Gh=15;class i5{constructor(d,p,j,E,O,R,B){this.tileSize=512,this._renderWorldCopies=O===void 0||O,this._minZoom=d||0,this._maxZoom=p||22,this._minPitch=j??0,this._maxPitch=E??60,this.setProjection(R),this.setMaxBounds(B),this.width=0,this.height=0,this._center=new i.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 Kk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Gk,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 i5(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&&(!p||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const j=this._elevation;p||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&j.exaggeration()&&this._centerAltitudeValidForExaggeration!==j.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*j.exaggeration(),this._centerAltitudeValidForExaggeration=j.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=j.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,p=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],j=this.horizonLineFromTop();let E=0,O=0;for(let R=0;R{const Re=i.cY(ce,de,he,ke,be);H.has(Re)||(O.push(new i.aQ(de,ce,he,ke,be)),H.add(Re))};for(let de=0;dece.canonical.z)continue;const he=ce.canonical,ke=ce.overscaledZ,be=ce.wrap,Re=1<0,nt=he.y+10,jt=ce.wrap-(We?0:1),gt=ce.wrap+(De?0:1),_t=We?he.x-1:Re-1,pt=De?he.x+1:0;if(R)j[0]<0?(X(ke,gt,he.z,pt,he.y),j[1]<0&&nt&&(X(ke,be,he.z,he.x,he.y+1),X(ke,gt,he.z,pt,he.y+1)),j[1]>0&&Ge&&(X(ke,be,he.z,he.x,he.y-1),X(ke,gt,he.z,pt,he.y-1))):j[0]>0?(X(ke,jt,he.z,_t,he.y),j[1]<0&&nt&&(X(ke,be,he.z,he.x,he.y+1),X(ke,jt,he.z,_t,he.y+1)),j[1]>0&&Ge&&(X(ke,be,he.z,he.x,he.y-1),X(ke,jt,he.z,_t,he.y-1))):j[1]<0&&nt?X(ke,be,he.z,he.x,he.y+1):Ge&&X(ke,be,he.z,he.x,he.y-1);else{const ht=ce.visibleQuadrants;1&ht&&(X(ke,jt,he.z,_t,he.y),Ge&&(X(ke,be,he.z,he.x,he.y-1),X(ke,jt,he.z,_t,he.y-1))),2&ht&&(X(ke,gt,he.z,pt,he.y),Ge&&(X(ke,be,he.z,he.x,he.y-1),X(ke,gt,he.z,pt,he.y-1))),4&ht&&(X(ke,jt,he.z,_t,he.y),nt&&(X(ke,be,he.z,he.x,he.y+1),X(ke,jt,he.z,_t,he.y+1))),8&ht&&(X(ke,gt,he.z,pt,he.y),nt&&(X(ke,be,he.z,he.x,he.y+1),X(ke,gt,he.z,pt,he.y+1)))}}const te=[];for(const de of O)O.some(ce=>de.isChildOf(ce))||te.push(de);if(O=te.filter(de=>!d.some(ce=>!!(de.overscaledZ{const De=Re.canonical.x+.5-he[0],We=Re.canonical.y+.5-he[1];return De*De+We*We{const _t=i.cY(nt,We,Ge,jt,gt);O.has(_t)||(E.push(new i.aQ(We,nt,Ge,jt,gt)),O.add(_t))},B=d.reduce((We,nt)=>Math.max(We,nt.overscaledZ),j),H=1<{const Ge=Math.floor(We[0]),jt=Math.floor(We[1]),gt=(We[0]-Ge)*i.al,_t=(We[1]-jt)*i.al,pt=Math.floor(nt[0]),ht=Math.floor(nt[1]),St=(nt[0]-pt)*i.al,Rt=(nt[1]-ht)*i.al;for(let Dt=-1;Dt<=1;Dt++){const Yt=Ge+Dt;if(!(Yt<0||Yt>=H)){te.x=gt-Dt*i.al,de.x=St-(Yt-pt)*i.al;for(let Xt=-1;Xt<=1;Xt++){const or=jt+Xt;te.y=_t-Xt*i.al,de.y=Rt-(or-ht)*i.al,i.cZ(te,de,X)&&R(B,0,j,Yt,or)}}}},he=p.points,ke=he[i.cv],be=he[i.cw],Re=this._projectToGround(ke,he[i.cx]),De=this._projectToGround(be,he[i.cy]);return ce(ke,Re),ce(be,De),E}_projectToGround(d,p){return i.cz(i.cA(),d,p,d[2]/(d[2]-p[2]))}coveringTiles(d){let p=this.coveringZoomLevel(d);const j=p,E=this.elevation&&this.elevation.exaggeration(),O=E&&!d.isTerrainDEM,R=this.projection.name==="mercator";if(d.minzoom!==void 0&&pd.maxzoom&&(p=d.maxzoom);const B=this.locationCoordinate(this.center),H=this.center.lat,X=1<{const Kt=new i.ae(Et.x+25e-6,Et.y,Et.z),mr=new i.ae(Et.x,Et.y+25e-6,Et.z),Lr=Et.toLngLat(),Yr=Kt.toLngLat(),Tr=mr.toLngLat(),jr=this.locationCoordinate(Lr),fn=this.locationCoordinate(Yr),an=this.locationCoordinate(Tr),Hr=Math.hypot(fn.x-jr.x,fn.y-jr.y),Qr=Math.hypot(an.x-jr.x,an.y-jr.y);return Math.sqrt(Hr*Qr)*_t/25e-6},ht=Et=>{const er=jt,Kt=gt;return{aabb:i.cF(this,X,0,0,0,Et,Kt,er,this.projection),zoom:0,x:0,y:0,minZ:Kt,maxZ:er,wrap:Et,fullyVisible:!1}},St=[];let Rt=[];const Dt=p,Yt=d.reparseOverscaled?j:p,Xt=(Re-this._centerAltitude)*be,or=Et=>{if(!this._elevation||!Et.tileID||!R)return;const er=this._elevation.getMinMaxForTile(Et.tileID),Kt=Et.aabb;er?(Kt.min[2]=er.min,Kt.max[2]=er.max,Kt.center[2]=(Kt.min[2]+Kt.max[2])/2):(Et.shouldSplit=Vt(Et),Et.shouldSplit||(Kt.min[2]=Kt.max[2]=Kt.center[2]=this._centerAltitude))},wr=(Et,er)=>{if(.707*er{if(Et.zoom=.9)return!0}else if(O&&(mr=Et.aabb.distanceZ(De)*be),this.projection.isReprojectedInTileSpace&&j<=5){const Qr=Math.pow(2,Et.zoom),Mn=pt(new i.ae((Et.x+.5)/Qr,(Et.y+.5)/Qr));Lr=Mn>.85?1:Mn}if(!R&&!de){const Qr=Math.sqrt(er*er+Kt*Kt+mr*mr);let Mn=(1<0;){const Et=St.pop(),er=Et.x,Kt=Et.y;let mr=Et.fullyVisible;const Lr=()=>this.projection.name==="globe"&&(Et.y===0||Et.y===(1<>1),fn={aabb:R?Et.aabb.quadrant(Yr):i.cF(this,X,Et.zoom+1,Tr,jr,Et.wrap,Et.minZ,Et.maxZ,this.projection),zoom:Et.zoom+1,x:Tr,y:jr,wrap:Et.wrap,fullyVisible:mr,tileID:void 0,shouldSplit:void 0,minZ:Et.minZ,maxZ:Et.maxZ};O&&!de&&(fn.tileID=new i.aQ(Et.zoom+1===Dt?Yt:Et.zoom+1,Et.wrap,Et.zoom+1,Tr,jr),or(fn)),St.push(fn)}else{const Yr=Et.zoom===Dt?Yt:Et.zoom;if(d.minzoom&&d.minzoom>Yr)continue;let Tr=0;if(!mr){let Hr=We?Et.aabb.intersectsPrecise(he):Et.aabb.intersectsPreciseFlat(he);if(Hr===0&&Lr()){const Qr=new i.cD(Et.zoom,er,Kt);Hr=i.cE(this,X,Qr,!0).intersectsPrecise(he)}if(Hr===0)continue;if(d.calculateQuadrantVisibility)if(he.containsPoint(Et.aabb.center))Tr=15;else for(let Qr=0;Qr<4;Qr++)Et.aabb.quadrant(Qr).intersects(he)!==0&&(Tr|=1<{const mr=[0,0,0,1],Lr=[i.al,i.al,0,1],Yr=this.calculateFogTileMatrix(Kt.tileID.toUnwrapped());i.aC(mr,mr,Yr),i.aC(Lr,Lr,Yr);const Tr=i.cG([],mr,Lr),jr=i.cH([],mr,Lr),fn=i.c$(Tr,jr);if(fn===0)return!0;let an=!1;const Hr=this._elevation;if(Hr&&fn>Et&&er!==0){const Qr=this.calculateProjMatrix(Kt.tileID.toUnwrapped());let Mn;d.isTerrainDEM||(Mn=Hr.getMinMaxForTile(Kt.tileID)),Mn||(Mn={min:gt,max:jt});const rs=i.cI(this.rotation),Gs=[rs[0]*i.al,rs[1]*i.al,Mn.max];i.af(Gs,Gs,Qr),an=(1-Gs[1])*this.height*.5Et.distanceSq-er.distanceSq).map(Et=>Et.tileID)}resize(d,p){this.width=d,this.height=p,this.pixelsToGLUnits=[2/d,-2/p],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 p=i.aA(d.lat,-i.cJ,i.cJ),j=this.projection.project(d.lng,p);return new i.P(j.x*this.worldSize,j.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/i.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,p){let j,E;const O=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;j=(p.x-O.x)/B,E=(p.y-O.y)/B}else{const B=this.pointCoordinate(p),H=this.pointCoordinate(O);j=B.x-H.x,E=B.y-H.y}const R=this.locationCoordinate(d);this.setLocation(new i.ae(R.x-j,R.y-E))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,p){return this.projection.locationPoint(this,d,p)}locationPoint3D(d,p){return this.projection.locationPoint(this,d,p,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,p){return this.coordinateLocation(this.pointCoordinate3D(d,p))}locationCoordinate(d,p){const j=p?i.cf(p,d.lat):void 0,E=this.projection.project(d.lng,d.lat);return new i.ae(E.x,E.y,j)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,p){const j=p??this._centerAltitude,E=[d.x,d.y,0,1],O=[d.x,d.y,1,1];i.aC(E,E,this.pixelMatrixInverse),i.aC(O,O,this.pixelMatrixInverse);const R=O[3];i.cK(E,E,1/E[3]),i.cK(O,O,1/R);const B=E[2],H=O[2];return{p0:E,p1:O,t:B===H?0:(j-B)/(H-B)}}screenPointToMercatorRay(d){const p=[d.x,d.y,0,1],j=[d.x,d.y,1,1];return i.aC(p,p,this.pixelMatrixInverse),i.aC(j,j,this.pixelMatrixInverse),i.cK(p,p,1/p[3]),i.cK(j,j,1/j[3]),p[2]=i.cf(p[2],this._center.lat)*this.worldSize,j[2]=i.cf(j[2],this._center.lat)*this.worldSize,i.cK(p,p,1/this.worldSize),i.cK(j,j,1/this.worldSize),new i.ax([p[0],p[1],p[2]],i.aw([],i.av([],j,p)))}rayIntersectionCoordinate(d){const{p0:p,p1:j,t:E}=d,O=i.cf(p[2],this._center.lat),R=i.cf(j[2],this._center.lat);return new i.ae(i.ak(p[0],j[0],E)/this.worldSize,i.ak(p[1],j[1],E)/this.worldSize,i.ak(O,R,E))}pointCoordinate(d,p=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,p)}pointCoordinate3D(d,p){if(!this.elevation)return this.pointCoordinate(d,p);let j=this.projection.pointCoordinate3D(this,d.x,d.y);if(j)return new i.ae(j[0],j[1],j[2]);let E=0,O=this.horizonLineFromTop();if(d.y>O)return this.pointCoordinate(d,p);const R=.02*O,B=d.clone();for(let H=0;H<10&&O-E>R;H++){B.y=i.ak(E,O,.66);const X=this.projection.pointCoordinate3D(this,B.x,B.y);X?(O=B.y,j=X):E=B.y}return j?new i.ae(j[0],j[1],j[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>=i.cL)return!this.isPointAboveHorizon(d);const p=this.pointCoordinate(d);return p.y>=0&&p.y<=1}_coordinatePoint(d,p){const j=p&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,E=[d.x*this.worldSize,d.y*this.worldSize,j+d.toAltitude(),1];return i.aC(E,E,this.pixelMatrix),E[3]>0?new i.P(E[0]/E[3],E[1]/E[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:p}=this._edgeInsets,j=this.height-this._edgeInsets.bottom,E=this.width-this._edgeInsets.right,O=this.pointLocation3D(new i.P(p,d)),R=this.pointLocation3D(new i.P(E,d)),B=this.pointLocation3D(new i.P(E,j)),H=this.pointLocation3D(new i.P(p,j));let X=Math.min(O.lng,R.lng,B.lng,H.lng),te=Math.max(O.lng,R.lng,B.lng,H.lng),de=Math.min(O.lat,R.lat,B.lat,H.lat),ce=Math.max(O.lat,R.lat,B.lat,H.lat);const he=Math.pow(2,-this.zoom)/16*270,ke=this.projection.name==="globe"?1:4,be=(Re,De,We,nt,Ge)=>{const jt=(Re+We)/2,gt=(De+nt)/2,_t=new i.P(jt,gt),{lng:pt,lat:ht}=this.pointLocation3D(_t),St=Math.max(0,X-pt,de-ht,pt-te,ht-ce);X=Math.min(X,pt),te=Math.max(te,pt),de=Math.min(de,ht),ce=Math.max(ce,ht),(Gehe)&&(be(Re,De,jt,gt,Ge+1),be(jt,gt,We,nt,Ge+1))};if(be(p,d,E,d,1),be(E,d,E,j,1),be(E,j,p,j,1),be(p,j,p,d,1),this.projection.name==="globe"){const[Re,De]=i.cM(this);Re?(ce=90,te=180,X=-180):De&&(de=-90,te=180,X=-180)}return new i.aI(new i.aT(X,de),new i.aT(te,ce))}_getBoundsRectangular(d,p){const{top:j,left:E}=this._edgeInsets,O=this.height-this._edgeInsets.bottom,R=this.width-this._edgeInsets.right,B=new i.P(E,j),H=new i.P(R,j),X=new i.P(R,O),te=new i.P(E,O);let de=this.pointCoordinate(B,d),ce=this.pointCoordinate(H,d);const he=this.pointCoordinate(X,p),ke=this.pointCoordinate(te,p),be=(Re,De)=>(De.y-Re.y)/(De.x-Re.x);return de.y>1&&ce.y>=0?de=new i.ae((1-ke.y)/be(ke,de)+ke.x,1):de.y<0&&ce.y<=1&&(de=new i.ae(-ke.y/be(ke,de)+ke.x,0)),ce.y>1&&de.y>=0?ce=new i.ae((1-he.y)/be(he,ce)+he.x,1):ce.y<0&&de.y<=1&&(ce=new i.ae(-he.y/be(he,ce)+he.x,0)),new i.aI().extend(this.coordinateLocation(de)).extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(ke)).extend(this.coordinateLocation(he))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const p=d.visibleDemTiles.reduce((j,E)=>{if(E.dem){const O=E.dem.tree;j.min=Math.min(j.min,O.minimums[0]),j.max=Math.max(j.max,O.maximums[0])}return j},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(p.min*d.exaggeration(),p.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 p=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,j=this.height/2-p*(1-this._horizonShift);return d?Math.max(0,j):j}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-i.cJ,this.maxLat=i.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.maxLngde&&(B=de-X),de-tehe&&(R=he-H),he-ce{for(let Vt=0;Vt<16;Vt++)Yt[Vt]=i.ak(Xt[Vt],or[Vt],wr)})(B,B,H,i.d0(this.pitch>=Gh?1:this.pitch/Gh))}else B=H;const X=i.cP([],H,R);let te=i.cP([],B,R);if(this.projection.isReprojectedInTileSpace){const ht=this.locationCoordinate(this.center),St=i.bA([]);i.br(St,St,[ht.x*this.worldSize,ht.y*this.worldSize,0]),i.aB(St,St,i.cQ(this)),i.br(St,St,[-ht.x*this.worldSize,-ht.y*this.worldSize,0]),i.aB(te,te,St),i.aB(X,X,St),this.inverseAdjustmentMatrix=i.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=i.cS([],te,[this.worldSize,this.worldSize,this.worldSize/O,1]),this.projMatrix=te,this.invProjMatrix=i.bl(new Float64Array(16),this.projMatrix),p){const ht=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ht[8]=2*-d.x/this.width,ht[9]=2*d.y/this.height,this.expandedFarZProjMatrix=i.cP([],ht,R)}else this.expandedFarZProjMatrix=this.projMatrix;const de=i.bl([],B);this.frustumCorners=i.cT.fromInvProjectionMatrix(de,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!p);const ce=new Float32Array(16);i.bA(ce),i.cS(ce,ce,[1,-1,1]),i.cU(ce,ce,this._pitch),i.bB(ce,ce,this.angle);const he=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(he);const ke=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;he[8]=2*-d.x/this.width,he[9]=2*(d.y+ke)/this.height,this.skyboxMatrix=i.aB(ce,he,ce);const be=this.point,Re=be.x,De=be.y,We=this.width%2/2,nt=this.height%2/2,Ge=Math.cos(this.angle),jt=Math.sin(this.angle),gt=Re-Math.round(Re)+Ge*We+jt*nt,_t=De-Math.round(De)+Ge*nt+jt*We,pt=new Float64Array(te);if(i.br(pt,pt,[gt>.5?gt-1:gt,_t>.5?_t-1:_t,0]),this.alignedProjMatrix=pt,te=i.bC(),i.cS(te,te,[this.width/2,-this.height/2,1]),i.br(te,te,[1,-1,0]),this.labelPlaneMatrix=te,te=i.bC(),i.cS(te,te,[1,-1,1]),i.br(te,te,[-1,-1,0]),i.cS(te,te,[2/this.width,2/this.height,1]),this.glCoordMatrix=te,this.pixelMatrix=i.aB(new Float64Array(16),this.labelPlaneMatrix,X),this._calcFogMatrices(),this._distanceTileDataCache={},te=i.bl(new Float64Array(16),this.pixelMatrix),!te)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=te,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=i.cV(this);const ht=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.af(ht,ht,R),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=te;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,p=this.cameraPixelsPerMeter,j=this._camera.position,E=1/this.height/this._pixelsPerMercatorPixel,O=[d,d,p];i.c5(O,O,E),i.c5(j,j,-1),i.cW(j,j,O);const R=i.bC();i.br(R,R,j),i.cS(R,R,O),this.mercatorFogMatrix=R,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,p,E)}_computeCameraPosition(d){const p=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,j=this._camera.forward(),E=this.point,O=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*p-d/this.worldSize*this._centerAltitude;return[E.x/this.worldSize-j[0]*O,E.y/this.worldSize-j[1]*O,d/this.worldSize*this._centerAltitude-j[2]*O]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const p=this._maxCameraBoundsDistance()*Math.cos(this._pitch),j=this._camera.position[2],E=d[2];let O=1;this.projection.wrap&&(this.center=this.center.wrap()),E>0&&(O=Math.min((p-j)/E,1)),this._camera.position=i.bH([],this._camera.position,d,O),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,p=this._camera.forward(),{pitch:j,bearing:E}=this._camera.getPitchBearing(),O=i.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,R=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.an(this._maxPitch)),B=Math.max((d[2]-O)/Math.cos(j),R),H=this._zoomFromMercatorZ(B);i.bH(d,d,p,B),this._pitch=i.aA(j,i.an(this.minPitch),i.an(this.maxPitch)),this.angle=i.bT(E,-Math.PI,Math.PI),this._setZoom(i.aA(H,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.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 p=0,j=i.cL,E=0,O=1/0;for(;j-p>1e-6&&j>p;){const R=p+.5*(j-p),B=this.tileSize*Math.pow(2,R),H=this.getCameraToCenterDistance(this.projection,R,B),X=this.scaleZoom(H/(Math.max(0,d)*this.tileSize)),te=Math.abs(R-X);teX||ce.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.P(0,0),new i.P(this.width,this.height))}zoomDeltaToMovement(d,p){const j=i.ag(i.av([],this._camera.position,d)),E=this._zoomFromMercatorZ(j)+p;return j-this._mercatorZfromZoom(E)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([p,j,E],O){const R=[p,j,E,1];i.aC(R,R,O);const B=R[3]=Math.max(R[3],1e-6);return R[0]/=B,R[1]/=B,R[2]/=B,R}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,d))}}getCameraToCenterDistance(d,p=this.zoom,j=this.worldSize){const E=i.cO(d,p,this.width,this.height,1024),O=d.pixelSpaceConversion(this.center.lat,j,E);let R=.5/Math.tan(.5*this._fov)*this.height*O;return this.isOrthographic&&(R=i.ak(1,R,i.d0(this.pitch>=Gh?1:this.pitch/Gh))),R}getWorldToCameraMatrix(){const d=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&i.aB(d,d,this.globeMatrix),d}getFrustum(d){return i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d,this.projection.zAxisUnit==="meters")}}const Yp=(w,d)=>{if(d>0&&w.terrain&&i.w("Cutoff is currently disabled on terrain"),d<=0||w.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const p=w.transform,j=Math.max(Math.abs(p._zoom-(w.minCutoffZoom-1)),1),E=p.isLODDisabled(!1)?i.ah(60,45,p.pitch):i.ah(30,15,p.pitch),O=p._farZ-p._nearZ,R=d*p.height,B=((1-(H=E))*p.cameraToCenterDistance+H*(p._farZ+R))*j;var H;return{shouldRenderCutoff:E<1,uniformValues:{u_cutoff_params:[p._nearZ,p._farZ,(B-p._nearZ)/O,(B-R-p._nearZ)/O]}}},mh=2048;class Uv{constructor(d,p){this.aabb=d,this.lastCascade=p}}class Bie{add(d,p){const j=this.receivers[d.key];j!==void 0?(j.aabb.min[0]=Math.min(j.aabb.min[0],p.min[0]),j.aabb.min[1]=Math.min(j.aabb.min[1],p.min[1]),j.aabb.min[2]=Math.min(j.aabb.min[2],p.min[2]),j.aabb.max[0]=Math.max(j.aabb.max[0],p.max[0]),j.aabb.max[1]=Math.max(j.aabb.max[1],p.max[1]),j.aabb.max[2]=Math.max(j.aabb.max[2],p.max[2])):this.receivers[d.key]=new Uv(p,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,p,j){const E=i.d9.fromPoints(d.points);let O=0;for(const R in this.receivers){const B=this.receivers[R];if(!B||!E.intersectsAabb(B.aabb))continue;B.aabb.min=E.closestPoint(B.aabb.min),B.aabb.max=E.closestPoint(B.aabb.max);const H=B.aabb.getCorners();for(let X=0;X1||ce[1]<-1||ce[1]>1){te=!1;break}}if(B.lastCascade=X,O=Math.max(O,X),te)break}}return O+1}}class s0{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Bie,this._depthMode=new yn(d.context.gl.LEQUAL,yn.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,p){const j=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!p||!p.properties)return;const E=p.properties.get("shadow-intensity");if(!p.shadowsEnabled()||E<=0||(this._shadowLayerCount=j.style.order.reduce((ke,be)=>{const Re=j.style._mergedLayers[be];return ke+(Re.hasShadowPass()&&!Re.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=j.context,R=mh,B=mh;if(this._cascades.length===0||mh!==this._cascades[0].texture.size[0]){this._cascades=[];for(let ke=0;ke<2;++ke){const be=j._shadowMapDebug,Re=O.gl,De=O.createFramebuffer(R,B,be?1:0,"texture"),We=new i.T(O,{width:R,height:B,data:null},Re.DEPTH_COMPONENT16);if(De.depthAttachment.set(We.texture),be){const nt=new i.T(O,{width:R,height:B,data:null},Re.RGBA8);De.colorAttachment0.set(nt.texture)}this._cascades.push({framebuffer:De,texture:We,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cB,scale:0})}}this.shadowDirection=Vv(p);let H=0;if(d.elevation){const ke=d.elevation,be=[1e4,-1e4];ke.visibleDemTiles.filter(Re=>Re.dem).forEach(Re=>{const De=Re.dem.tree;be[0]=Math.min(be[0],De.minimums[0]),be[1]=Math.max(be[1],De.maximums[0])}),be[0]!==1e4&&(H=(be[1]-be[0])*ke.exaggeration())}const X=1.5*d.cameraToCenterDistance,te=3*X,de=new Float64Array(16);for(let ke=0;ke=0)return{};const O=function(H,X,te){const de=te/(1<0&&(i.d8(O[1],O[1],[E[0]*R,0,0]),i.d8(O[2],O[2],[E[0]*R,0,0])),E[1]<0?(i.d8(O[0],O[0],[0,E[1]*R,0]),i.d8(O[1],O[1],[0,E[1]*R,0])):E[1]>0&&(i.d8(O[2],O[2],[0,E[1]*R,0]),i.d8(O[3],O[3],[0,E[1]*R,0]));const B={};return B.vertices=O,B.planes=[qv(O[1],O[0],O[4]),qv(O[2],O[1],O[5]),qv(O[3],O[2],O[6]),qv(O[0],O[3],O[7])],B}addShadowReceiver(d,p,j){this._receivers.add(d,i.d9.fromTileIdAndHeight(d,p,j))}getMaxCascadeForTile(d){const p=this._receivers.get(d);return p&&p.lastCascade?p.lastCascade:0}}function qv(w,d,p){const j=i.av([],p,d),E=i.av([],w,d),O=i.bI([],j,E),R=i.ag(O);return R===0?[0,0,1,0]:(i.c5(O,O,1/R),[O[0],O[1],O[2],-i.bJ(O,d)])}function Vv(w){const d=w.properties.get("direction"),p=i.d4(d.x,d.y,d.z);p[2]=i.aA(p[2],0,75);const j=i.d6([p[0],p[1],p[2]]);return i.d5(j.x,j.y,j.z)}function Pf(w,d,p){const j=d.properties.get("color-use-theme")==="none",E=d.properties.get("color"),O=d.properties.get("intensity"),R=d.properties.get("direction"),B=[R.x,R.y,R.z],H=p.properties.get("color-use-theme")==="none",X=p.properties.get("color"),te=p.properties.get("intensity"),de=Math.max(i.bJ([0,0,1],B),0),ce=[0,0,0];i.c5(ce,X.toPremultipliedRenderColor(H?null:w.getLut(d.scope)).toArray01Linear().slice(0,3),te);const he=[0,0,0];return i.c5(he,E.toPremultipliedRenderColor(j?null:w.getLut(p.scope)).toArray01Linear().slice(0,3),de*O),i.db([ce[0]>0?ce[0]/(ce[0]+he[0]):0,ce[1]>0?ce[1]/(ce[1]+he[1]):0,ce[2]>0?ce[2]/(ce[2]+he[2]):0])}function Xp(w,d,p,j,E,O){const R=w.zoom,B=w.scale,H=w.worldSize,X=1/H,te=w.aspect,de=Math.sqrt(1+te*te)*Math.tan(.5*w.fovX),ce=de*de,he=j-p,ke=j+p;let be,Re;ce>he/ke?(be=j,Re=j*de):(be=.5*ke*(1+ce),Re=.5*Math.sqrt(he*he+2*(j*j+p*p)*ce+ke*ke*ce*ce));const De=w.projection.pixelsPerMeter(w.center.lat,H),We=w._camera.getCameraToWorldMercator(),nt=[0,0,-be*X];i.af(nt,nt,We);let Ge=Re*X;const jt=w._edgeInsets;if(!(jt.left===0&&jt.top===0&&jt.right===0&&jt.bottom===0||jt.left===jt.right&&jt.top===jt.bottom)){const mr=w._camera.getWorldToCamera(w.worldSize,w.projection.zAxisUnit==="meters"?De:1),Lr=w._camera.getCameraToClipPerspective(w._fov,w.width/w.height,p,j);Lr[8]=2*-w.centerOffset.x/w.width,Lr[9]=2*w.centerOffset.y/w.height;const Yr=new Float64Array(16);i.cP(Yr,Lr,mr);const Tr=new Float64Array(16);i.bl(Tr,Yr);const jr=i.cB.fromInvProjectionMatrix(Tr,H,R,!0);for(const fn of jr.points){const an=((gt=fn)[0]/=B,gt[1]/=B,gt[2]=i.cf(gt[2],w._center.lat),gt);Ge=Math.max(Ge,i.c6(i.da([],nt,an)))}}var gt;Ge*=E/(E-1);const _t=Math.acos(d[2]),pt=Math.atan2(-d[0],-d[1]),ht=new Gk;ht.position=nt,ht.setPitchBearing(_t,pt);const St=ht.getWorldToCamera(H,De),Rt=Ge*H,Dt=Math.min(w._mercatorZfromZoom(17)*H*-2,-2*Rt),Yt=ht.getCameraToClipOrthographic(-Rt,Rt,-Rt,Rt,Dt,(Rt+O*De)/d[2]),Xt=new Float64Array(16);i.aB(Xt,Yt,St);const or=i.d5(Math.floor(1e6*nt[0])/1e6*H,Math.floor(1e6*nt[1])/1e6*H,0),wr=.5*E,Vt=[0,0,0];i.af(Vt,or,Xt),i.c5(Vt,Vt,wr);const Et=[Math.floor(Vt[0]),Math.floor(Vt[1]),Math.floor(Vt[2])],er=[0,0,0];i.av(er,Vt,Et),i.c5(er,er,-1/wr);const Kt=new Float64Array(16);return i.bA(Kt),i.br(Kt,Kt,er),i.aB(Xt,Kt,Xt),[Xt,Rt]}class $ie extends i.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,p){return i.dc(this.requestManager.transformRequest(p,i.R.Model).url).then(j=>{if(!j)return;const E=i.dd(j),O=new i.de(d,p,void 0,void 0,E);return O.computeBoundsAndApplyParent(),O}).catch(j=>{if(j&&j.status===404)return null;this.fire(new i.y(new Error(`Could not load model ${d} from ${p}: ${j.message}`)))})}load(d,p,j={forceReload:!1}){this.models[p]||(this.models[p]={});const E=Object.keys(d),O=[],R=[];for(const B of E){const H=d[B];this.hasURLBeenRequested(H)&&!j.forceReload||(this.modelByURL[H]={modelId:B,scope:p},O.push(this.loadModel(B,H)),R.push(B)),this.models[p][B]||(this.models[p][B]={model:null,numReferences:1})}this.numModelsLoading[p]=(this.numModelsLoading[p]||0)+R.length,Promise.allSettled(O).then(B=>{for(let H=0;H{this.fire(new i.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,p,j={exactIdMatch:!1}){return!!(j.exactIdMatch?this.getModel(d,p):this.getModelByURL(this.modelUris[p][d]))}getModel(d,p){return this.models[p]||(this.models[p]={}),this.models[p][d]?this.models[p][d].model:void 0}getModelByURL(d){if(!d)return null;const p=this.modelByURL[d];return p?this.models[p.scope][p.modelId].model:null}hasModelBeenAdded(d,p){return this.models[p]&&this.models[p][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,p,j){this.models[j]||(this.models[j]={}),this.modelUris[j]||(this.modelUris[j]={});const E=this.requestManager.normalizeModelURL(p);if((this.hasModel(d,j,{exactIdMatch:!0})||this.hasModelBeenAdded(d,j))&&this.modelUris[j][d]===E)this.models[j][d].numReferences++;else if(this.hasURLBeenRequested(E)){const{scope:O,modelId:R}=this.modelByURL[E];this.models[O][R].numReferences++}else this.modelUris[j][d]=E,this.load({[d]:this.modelUris[j][d]},j)}addModelURLs(d,p){this.models[p]||(this.models[p]={}),this.modelUris[p]||(this.modelUris[p]={});const j=this.modelUris[p];for(const E in d)j[E]=this.requestManager.normalizeModelURL(d[E])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,p){this.models[p]||(this.models[p]={}),this.modelUris[p]||(this.modelUris[p]={});const j={};for(const E of d)this.hasModel(E,p,{exactIdMatch:!0})||this.hasURLBeenRequested(E)?this.models[p][E].numReferences++:this.modelUris[p][E]&&!this.hasURLBeenRequested(E)?j[E]=this.modelUris[p][E]:!this.hasURLBeenRequested(E)&&i.df(E,!1)&&(this.modelUris[p][E]=this.requestManager.normalizeModelURL(E),j[E]=this.modelUris[p][E]);this.load(j,p)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,p,j=!1,E=!1){if(this.models[p]&&this.models[p][d]&&(this.models[p][d].numReferences--,this.models[p][d].numReferences===0||E)){const O=this.modelUris[p][d];j||delete this.modelUris[p][d],delete this.modelByURL[O];const R=this.models[p][d].model;if(!R)return;delete this.models[p][d],R.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const p of Object.keys(this.models[d])){const j=this.models[d][p].model;delete this.models[d][p],j&&j.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,p){this.models[p]||(this.models[p]={});for(const j in this.models[p])this.models[p][j].model&&this.models[p][j].model.upload(d.context)}}const o5=i.a6.colorTheme,Uie=new i.a9({data:new i.aa(o5.data)});function PP(w){if(!w.metadata||!w.metadata.content_area)return;const d=i.o.devicePixelRatio,{left:p,top:j,width:E,height:O}=w.metadata.content_area,R=p*d,B=j*d;return[R,B,R+E*d,B+O*d]}function LP(w){if(w)return w.map(([d,p])=>[d*i.o.devicePixelRatio,p*i.o.devicePixelRatio])}class l5{constructor(d,p,j){this.id=d,this.scope=p,this.sourceCache=j,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 p=this.sourceCache.getVisibleCoordinates();if(p.length===0)return d;const j=this.sourceCache.getSource();if(!(j instanceof hc))return d;const E=p.map(R=>this.sourceCache.getTile(R)),O=j.getImages(E,Array.from(this.pendingRequests));for(const[R,B]of O)d.set(i.I.from({name:R,iconsetId:this.id}),B),this.pendingRequests.delete(R);for(const R of this.pendingRequests)this.missingRequests.add(R);return this.pendingRequests.clear(),d}}const Qp=(w,d)=>Ye(w,d&&d.filter(p=>p.identifier!=="source.canvas")),OP=i.aH(Xs,["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"]),DP=i.aH(Xs,["setCenter","setZoom","setBearing","setPitch"]),Zk=new Set(["background","sky","slot","custom"]),Jp={version:8,layers:[],sources:{}},Hv={duration:300,delay:0};class fh extends i.E{constructor(d,p={}){super(),this.map=d,this.scope=p.scope||"",this.globalId=null,this.fragments=[],this.importDepth=p.importDepth||0,this.importsCache=p.importsCache||new Map,this.resolvedImports=p.resolvedImports||new Set,this.transition=Object.assign({},Hv),this._buildingIndex=new e5(this),this.crossTileSymbolIndex=new Wh,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=p.styleChanges||new je,this._hasDataDrivenEmissive=!1,this.dispatcher=p.dispatcher?p.dispatcher:new i.D(i.dh(),this),p.imageManager?this.imageManager=p.imageManager:(this.imageManager=new Ce(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=p.glyphManager?p.glyphManager:new i.di(d._requestManager,p.localFontFamily?i.dj.all:p.localIdeographFontFamily?i.dj.ideographs:i.dj.none,p.localFontFamily||p.localIdeographFontFamily),p.modelManager?this.modelManager=p.modelManager:(this.modelManager=new $ie(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=p.configOptions?p.configOptions:new Map,this._configDependentLayers=p.configDependentLayers?p.configDependentLayers:new Set,this._indoorDependentLayers=p.indoorDependentLayers?p.indoorDependentLayers:new Set,this._config=p.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:p.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=p.initialConfig,this.dispatcher.broadcast("setReferrer",i.dk());const j=this;this._rtlTextPluginCallback=fh.registerForPluginStateChange(E=>{j.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:E.pluginStatus,pluginURL:E.pluginURL},(O,R)=>{if(i.dl(O),R&&R.every(B=>B))for(const B in j._sourceCaches){const H=j._sourceCaches[B],X=H.getSource().type;X!=="vector"&&X!=="geojson"||H.reload()}})}),this.on("data",E=>{if(E.dataType!=="source"||E.sourceDataType!=="metadata")return;const O=this.getOwnSource(E.sourceId);if(O&&O.vectorLayerIds)for(const R in this._layers){const B=this._layers[R];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(i.h(d))return d;const p=i.dm(d);if(!p.startsWith("http"))try{return new URL(p,location.href).toString()}catch{return p}return p}return`json://${i.dn(JSON.stringify(d))}`}_diffStyle(d,p,j){this.globalId=this._getGlobalId(d);const E=(O,R)=>{try{R(null,this.setState(O,j))}catch(B){R(B,!1)}};if(typeof d=="string"){const O=this.map._requestManager.normalizeStyleURL(d),R=this.map._requestManager.transformRequest(O,i.R.Style);i.m(R,(B,H)=>{B?this.fire(new i.y(B)):H&&E(H,p)})}else typeof d=="object"&&E(d,p)}loadURL(d,p={}){this.fire(new i.z("dataloading",{dataType:"style"}));const j=typeof p.validate=="boolean"?p.validate:!i.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,p.accessToken),this.resolvedImports.add(d);const E=this.importsCache.get(d);if(E)return this._load(E,j);const O=this.map._requestManager.transformRequest(d,i.R.Style);this._request=i.m(O,(R,B)=>{if(this._request=null,R)this.fire(new i.y(R));else if(B)return this.importsCache.set(d,B),this._load(B,j)})}loadJSON(d,p={}){this.fire(new i.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=i.o.frame(()=>{this._request=null,this._load(d,p.validate!==!1)})}loadEmpty(){this.fire(new i.z("dataloading",{dataType:"style"})),this._load(Jp,!1)}_loadImports(d,p,j){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const E=[];for(const O of d){const R=this._createFragmentStyle(O),B=new Promise(te=>{R.once("style.import.load",te),R.once("error",te)}).then(()=>this.mergeAll());if(E.push(B),this.resolvedImports.has(O.url)){R.loadEmpty();continue}const H=O.data||this.importsCache.get(O.url);H?(R.loadJSON(H,{validate:p}),this._isInternalStyle(H)&&(R.globalId=null)):O.url?R.loadURL(O.url,{validate:p}):R.loadEmpty();const X={style:R,id:O.id,config:O.config};if(j){const te=this.fragments.findIndex(({id:de})=>de===j);this.fragments=this.fragments.slice(0,te).concat(X).concat(this.fragments.slice(te))}else this.fragments.push(X)}return Promise.allSettled(E)}getImportGlobalIds(d=this,p=new Set){for(const j of d.fragments)j.style.globalId&&p.add(j.style.globalId),this.getImportGlobalIds(j.style,p);return[...p.values()]}_createFragmentStyle(d){const p=this.scope?i.B(d.id,this.scope):d.id;let j;const E=this._initialConfig&&this._initialConfig[p];(d.config||E)&&(j=Object.assign({},d.config,E));const O=new fh(this.map,{scope:p,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:j,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,p){if(this._isInternalStyle(d)){const O=Object.assign({},Jp,{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,p)}if(this.updateConfig(this._config,d.schema),p&&Qp(this,zs(d)))return;this._loaded=!0,this.stylesheet=i.dp(d);const j=()=>{for(const H in d.sources)this.addSource(H,d.sources[H],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const H in d.iconsets)this.addIconset(H,d.iconsets[H]);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=hx(this.stylesheet.layers);if(this._order=O.map(H=>H.id),this.stylesheet.light&&i.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 H=this.stylesheet.lights[0];this.light=new It(H.properties,H.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new It(this.stylesheet.light)),this._layers={};for(const H of O){const X=i.du(H,this.scope,this._styleColorTheme.lut,this.options);X.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(X.fqid),X.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(X.fqid),this._hasAppearances=this._hasAppearances||X.getAppearances().length!==0,X.setEventedParent(this,{layer:{id:X.id}}),this._layers[X.id]=X;const te=this.getOwnLayerSourceCache(X),de=!!this.directionalLight&&this.directionalLight.shadowsEnabled();te&&X.canCastShadows()&&de&&(te.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const R=this.stylesheet.terrain;R&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(R,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 i.z("data",{dataType:"style"}));const B=this.isRootStyle();d.imports?this._loadImports(d.imports,p).then(()=>{this._reloadImports(),this.fire(new i.z(B?"style.load":"style.import.load"))}).catch(H=>{this.fire(new i.y(new Error("Failed to load imports",H))),this.fire(new i.z(B?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new i.z(B?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const E=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(E){const O=this._evaluateColorThemeData(E);this._loadColorTheme(O).then(()=>{j()}).catch(R=>{i.w(`Couldn't load color theme from the stylesheet: ${R}`),j()})}else this._styleColorTheme.lut=null,j()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,p,j,E,O,R,B,H,X,te;const de={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(ce=>{if(ce.stylesheet){if(ce.light!=null&&(d=ce.light),ce.stylesheet.lights)for(const he of ce.stylesheet.lights)he.type==="ambient"&&ce.ambientLight!=null&&(p=ce.ambientLight),he.type==="directional"&&ce.directionalLight!=null&&(j=ce.directionalLight);E=this._prioritizeTerrain(E,ce.terrain,ce.stylesheet.terrain),ce.stylesheet.fog&&ce.fog!=null&&(O=ce.fog),ce.stylesheet.snow&&ce.snow!=null&&(R=ce.snow),ce.stylesheet.rain&&ce.rain!=null&&(B=ce.rain),ce.stylesheet.camera!=null&&(te=ce.stylesheet.camera),ce.stylesheet.projection!=null&&(H=ce.stylesheet.projection),ce.stylesheet.transition!=null&&(X=ce.stylesheet.transition),de[ce.scope]=ce._styleColorTheme}}),this.light=d,this.ambientLight=p,this.directionalLight=j,this.fog=O,this.snow=R,this.rain=B,this._styleColorThemeForScope=de,E===null?delete this.terrain:this.terrain=E,this.camera=te||{"camera-projection":"perspective"},this.projection=H||{name:"mercator"},this.transition=Object.assign({},Hv,X),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const p=j=>{for(const E of j.fragments)p(E.style);d(j)};p(this)}_prioritizeTerrain(d,p,j){const E=d&&d.drapeRenderMode===0;return j===null?p&&p.drapeRenderMode===0?p:E?d:null:p!=null&&(!d||E||p&&p.drapeRenderMode===1)?p:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(p=>{d=this._prioritizeTerrain(d,p.terrain,p.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(p=>{p.stylesheet.projection!=null&&(d=p.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},p={},j={};this.forEachFragmentStyle(E=>{for(const O in E._sourceCaches){const R=i.B(O,E.scope);d[R]=E._sourceCaches[O]}for(const O in E._otherSourceCaches){const R=i.B(O,E.scope);p[R]=E._otherSourceCaches[O]}for(const O in E._symbolSourceCaches){const R=i.B(O,E.scope);j[R]=E._symbolSourceCaches[O]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=p,this._mergedSymbolSourceCaches=j}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const p of Object.values(d.stylesheet.indoor)){const j=p,E=i.B(j.sourceId,d.scope);this._mergedIndoor[E]=new Set(j.sourceLayers||[])}})}mergeLayers(){const d={},p=[],j={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(R=>{for(const B of R._order){const H=R._layers[B];if(H.type==="slot"){const X=i.dq(B);if(d[X])continue;d[X]=[]}H.slot&&d[H.slot]?d[H.slot].push(H):p.push(H)}}),this._mergedOrder=[];let E=-1;const O=(R=[])=>{for(const B of R)if(B.type==="slot"){const H=i.dq(B.id);d[H]&&O(d[H]),this._mergedSlots.push(H)}else{const H=i.B(B.id,B.scope);this._mergedOrder.push(H),j[H]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,E=this._mergedOrder.length-1),B.type==="circle"&&(this._hasCircleLayers=!0),B.type==="symbol"&&(this._hasSymbolLayers=!0),B.type==="clip"&&(this._clipLayerPresent=!0)}};if(O(p),this._has3DLayers){const R={};for(let B=0;BR[B]-R[H])}this._mergedLayers=j,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(p,j,E,O){const R=Object.assign({},j);for(const H of Object.keys(o5))R[H]===void 0&&(R[H]=o5[H].default);const B=new i.a8(Uie,p,new Map(E));return B.setTransitionOrValue(R,E),B.untransitioned().possiblyEvaluate(new i.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const p=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((j,E)=>{const O="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void j();let R=d;R.startsWith(O)||(R=O+R);const B=i.I.from("mapbox-reserved-lut"),H=new Image;H.src=R,H.onerror=()=>{this._styleColorTheme.lutLoading=!1,E(new Error("Failed to load image data"))},H.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==p)return void j();this._styleColorTheme.lutLoading=!1;const{width:X,height:te,data:de}=i.o.getImageData(H);if(te>32)return void E(new Error("The height of the image must be less than or equal to 32 pixels."));if(X!==te*te)return void E(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 i.q({width:X,height:te},de),pixelRatio:1,sdf:!1,usvg:!1,version:0});const ce=this.imageManager.getImage(B,this.scope);ce?(this._styleColorTheme.lut={image:ce.data,data:d},j()):E(new Error("Missing LUT image."))}})}getLut(d){const p=this._styleColorThemeForScope[d];return p?p.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(p,j,E){let O,R,B;const H=i.o.devicePixelRatio>1?"@2x":"";let X=i.m(j.transformRequest(j.normalizeSpriteURL(p,H,".json"),i.R.SpriteJSON),(ce,he)=>{X=null,B||(B=ce,O=he,de())}),te=i.n(j.transformRequest(j.normalizeSpriteURL(p,H,".png"),i.R.SpriteImage),(ce,he)=>{te=null,B||(B=ce,R=he,de())});function de(){if(B)E(B);else if(O&&R){const ce=i.o.getImageData(R),he={};for(const ke in O){const{width:be,height:Re,x:De,y:We,sdf:nt,pixelRatio:Ge,stretchX:jt,stretchY:gt,content:_t}=O[ke],pt=new i.q({width:be,height:Re});i.q.copy(ce,pt,{x:De,y:We},{x:0,y:0},{width:be,height:Re},null),he[ke]={data:pt,pixelRatio:Ge!==void 0?Ge:1,sdf:nt!==void 0&&nt,stretchX:jt,stretchY:gt,content:_t,usvg:!1,version:0}}E(null,he)}}return{cancel(){X&&(X.cancel(),X=null),te&&(te.cancel(),te=null)}}}(d,this.map._requestManager,(p,j)=>{if(this._spriteRequest=null,p)this.fire(new i.y(p));else if(j){const E=new Map;for(const O in j)E.set(i.I.from(O),j[O]);this.addImages(E)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))})}addIconset(d,p){if(p.type==="sprite")return void this._loadSprite(p.url);const j=this.getOwnSourceCache(p.source);if(!j)return void this.fire(new i.y(new Error(`Source "${p.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const E=j.getSource();if(E.type!=="raster-array")return void this.fire(new i.y(new Error(`Source "${p.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));E.partial=!1;const O=new l5(d,this.scope,j);this.imageManager.addImageProvider(O,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!i.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const p=this.map._spriteFormat==="auto";var j,E;this._spriteRequest=(E=(O,R)=>{if(this._spriteRequest=null,O)p?this._loadSprite(d):this.fire(new i.y(O));else if(R){const B=new Map;for(const H in R)B.set(i.I.from(H),R[H]);this.addImages(B)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))},i.bu((j=this.map._requestManager).transformRequest(j.normalizeIconsetURL(d),i.R.Iconset),(O,R)=>{if(O)return void E(O);const B={},H=i.dg(new i.bt(R));for(const X of H.icons){const te={version:1,pixelRatio:i.o.devicePixelRatio,content:PP(X),stretchX:X.metadata?LP(X.metadata.stretch_x_areas):void 0,stretchY:X.metadata?LP(X.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:X};B[X.name]=te}E(null,B)}))}_validateLayer(d){const p=this.getOwnSource(d.source);if(!p)return;const j=d.sourceLayer;j&&(p.type==="geojson"||p.vectorLayerIds&&p.vectorLayerIds.indexOf(j)===-1)&&this.fire(new i.y(new Error(`Source layer "${j}" does not exist on source "${p.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,p)=>{const j=this.fragments[p];return j&&j.style&&(d.data=j.style.serialize()),d})}_serializeSources(){const d={};for(const p in this._sourceCaches){const j=this._sourceCaches[p].getSource();d[j.id]||(d[j.id]=j.serialize())}return d}_serializeLayers(d){const p=[];for(const j of d){const E=this._layers[j];E&&E.type!=="custom"&&p.push(E.serialize())}return p}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 p=this._mergedLayers[d];if(p._transitionablePaint&&p._transitionablePaint._values){const j=p._transitionablePaint._values["line-emissive-strength"];if(j&&j.value&&j.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 p=this.getOwnLayer(d);if(p)return p;this.fire(new i.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const p=this.getOwnSource(d);if(p)return p;this.fire(new i.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,p){const j=this.map.painter;if(j)for(let E=d.minzoom||0;E<(d.maxzoom||25.5);E++){const O=d.getProgramIds();if(O)for(const R of O){const B=d.getDefaultProgramParams(R,p.zoom,this._styleColorTheme.lut);B&&(j.style=this,this.fog&&(j._fogVisible=!0,B.overrideFog=!0,j.getOrCreateProgram(R,B)),j._fogVisible=!1,B.overrideFog=!1,j.getOrCreateProgram(R,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,j.getOrCreateProgram(R,B)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const p=this.calculateLightsBrightness();d.brightness=p||0,p!==this._brightness&&(this._brightness=p,this.dispatcher.broadcast("setBrightness",p)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const j=this._changes.isDirty();let E=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const H in B){const{updatedIds:X,removedIds:te}=B[H];(X||te)&&(this._updateWorkerLayers(H,X,te),E=!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 H=this._mergedSourceCaches[B];O[B]=H.used,H.used=!1,H.tileCoverLift=0}for(const B of this._mergedOrder){const H=this._mergedLayers[B];if(H.visibility!=="none"&&H.recalculate(d,this._availableImages),!H.isHidden(d.zoom)){const X=this.getLayerSourceCache(H);X&&(X.used=!0,X.tileCoverLift=Math.max(X.tileCoverLift,H.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(H,d)}):this.precompilePrograms(H,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&E&&this.mergeLayers();const R=this.imageManager.getPendingImageProviders();for(const B of R)B.sourceCache.used=!0;for(const B in O){const H=this._mergedSourceCaches[B];O[B]!==H.used&&H.getSource().fire(new i.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:H.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),j&&this.fire(new i.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const p of d){const j=p.resolvePendingRequests(),E=this.getFragmentStyle(p.scope);E&&E.addImages(j)}}_updateTilesForChangedImages(){const d={};for(const p in this._mergedSourceCaches){const j=this._mergedSourceCaches[p].getSource().scope;d[j]=d[j]||this._changes.getUpdatedImages(j),d[j].length!==0&&this._mergedSourceCaches[p].reloadTilesForDependencies(["icons","patterns"],d[j])}for(const p in d)this._changes.resetUpdatedImages(p)}_updateWorkerLayers(d,p,j){const E=this.getFragmentStyle(d);E&&this.dispatcher.broadcast("updateLayers",{layers:p?E._serializeLayers(p):[],scope:d,removedIds:j||[],options:E.options})}setState(d,p){if(this._checkLoaded(),Qp(this,zs(d)))return!1;(d=i.dp(d)).layers=hx(d.layers);const j=function(R,B){if(!R)return[{command:Xs.setStyle,args:[B]}];let H=[];try{if(!i.by(R.version,B.version))return[{command:Xs.setStyle,args:[B]}];if(i.by(R.center,B.center)||H.push({command:Xs.setCenter,args:[B.center]}),i.by(R.zoom,B.zoom)||H.push({command:Xs.setZoom,args:[B.zoom]}),i.by(R.bearing,B.bearing)||H.push({command:Xs.setBearing,args:[B.bearing]}),i.by(R.pitch,B.pitch)||H.push({command:Xs.setPitch,args:[B.pitch]}),i.by(R.sprite,B.sprite)||H.push({command:Xs.setSprite,args:[B.sprite]}),i.by(R.glyphs,B.glyphs)||H.push({command:Xs.setGlyphs,args:[B.glyphs]}),i.by(R.imports,B.imports)||function(he=[],ke=[],be){ke=ke||[];const Re=(he=he||[]).map(Kp),De=ke.map(Kp),We=he.reduce(mx,{}),nt=ke.reduce(mx,{}),Ge=Re.slice();let jt,gt,_t,pt;for(jt=0,gt=0;jt{he.source&&X[he.source]?H.push({command:Xs.removeLayer,args:[he.id]}):de.push(he)});let ce=R.terrain;ce&&X[ce.source]&&(H.push({command:Xs.setTerrain,args:[void 0]}),ce=void 0),H=H.concat(te),i.by(ce,B.terrain)||H.push({command:Xs.setTerrain,args:[B.terrain]}),function(he,ke,be){ke=ke||[];const Re=(he=he||[]).map(Kp),De=ke.map(Kp),We=he.reduce(mx,{}),nt=ke.reduce(mx,{}),Ge=Re.slice(),jt=Object.create(null);let gt,_t,pt,ht,St,Rt,Dt;for(gt=0,_t=0;gt!(R.command in DP));if(j.length===0)return!1;const E=j.filter(R=>!(R.command in OP));if(E.length>0)throw new Error(`Unimplemented: ${E.map(R=>R.command).join(", ")}.`);const O=[];return j.forEach(R=>{O.push(this[R.command](...R.args))}),p&&Promise.all(O).then(p).catch(p),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[p,j]of d.entries()){if(this.getImage(p))return this.fire(new i.y(new Error(`An image with the name "${p.name}" already exists.`)));this.imageManager.addImage(p,this.scope,j),this._changes.updateImage(p,this.scope)}return this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this}addImage(d,p){return this.getImage(d)?this.fire(new i.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,p),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this)}updateImage(d,p,j=!1){this.imageManager.updateImage(d,this.scope,p),j&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.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 i.z("data",{dataType:"style"})),this):this.fire(new i.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 i.z("data",{dataType:"style"})),this}addModel(d,p,j={}){return this._checkLoaded(),this._validate(ye,`models.${d}`,p,null,j)||(this.modelManager.addModel(d,p,this.getActualScope()),this.fire(new i.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 i.z("data",{dataType:"style"})),this):this.fire(new i.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,p,j={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!p.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(p).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(p.type)>=0&&this._validate(ji,`sources.${d}`,p,null,j))return;this.map&&this.map._collectResourceTiming&&(p.collectResourceTiming=!0);const E=Xo(d,p,this.dispatcher,this);E.scope=this.scope,E.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(E.id),source:E.serialize(),sourceId:E.id}));const O=R=>{const B=(R?"symbol:":"other:")+E.id,H=i.B(B,this.scope),X=this._sourceCaches[B]=new yd(H,E,R);(R?this._symbolSourceCaches:this._otherSourceCaches)[E.id]=X,X.onAdd(this.map)};O(!1),p.type!=="vector"&&p.type!=="geojson"||O(!0),E.onAdd&&E.onAdd(this.map),j.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const p=this.getOwnSource(d);if(!p)throw new Error("There is no source with this ID");for(const E in this._layers)if(this._layers[E].source===d)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while layer "${E}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===d)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const E=Object.entries(this.stylesheet.iconsets).find(([O,R])=>R.type==="source"&&R.source===d);if(E)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while iconset "${E[0]}" is using it.`)))}const j=this.getOwnSourceCaches(d);for(const E of j){const O=i.dq(E.id);delete this._sourceCaches[O],this._changes.discardSourceCacheUpdate(E.id),E.fire(new i.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:E.getSource().id})),E.setEventedParent(null),E.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),p.setEventedParent(null),p.onRemove&&p.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,p){this._checkLoaded(),this.getOwnSource(d).setData(p),this._changes.setDirty()}getOwnSource(d){const p=this.getOwnSourceCache(d);return p&&p.getSource()}getOwnSources(){const d=[];for(const p in this._otherSourceCaches){const j=this.getOwnSourceCache(p);j&&d.push(j.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const p in d){const j=d[p]._tiles;for(const E in j){const O=j[E];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 p=this._getTransitionParameters();for(const O of d){if(this._validate(Pa,"lights",O))return;switch(O.type){case"ambient":if(this.ambientLight){const R=this.ambientLight;R.set(O),R.updateTransitions(p)}else this.ambientLight=new na(O,jo||(jo=new i.a9({color:new i.aa(i.a6.properties_light_ambient.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const R=this.directionalLight;R.set(O),R.updateTransitions(p)}else this.directionalLight=new na(O,ba||(ba=new i.a9({direction:new i.ap(i.a6.properties_light_directional.direction),color:new i.aa(i.a6.properties_light_directional.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_directional.intensity),"cast-shadows":new i.aa(i.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new i.aa(i.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.aa(i.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const j=Object.assign(p,{worldview:this.map.getWorldview()}),E=new i.ac(this.z||0,j);this.ambientLight&&this.ambientLight.recalculate(E),this.directionalLight&&this.directionalLight.recalculate(E),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,p=this.ambientLight;if(!d||!p)return;const j=ce=>.2126*(ce[0]<=.03928?ce[0]/12.92:Math.pow((ce[0]+.055)/1.055,2.4))+.7152*(ce[1]<=.03928?ce[1]/12.92:Math.pow((ce[1]+.055)/1.055,2.4))+.0722*(ce[2]<=.03928?ce[2]/12.92:Math.pow((ce[2]+.055)/1.055,2.4)),E=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),O=d.properties.get("intensity"),R=d.properties.get("direction"),B=1-i.d4(R.x,R.y,R.z)[2]/90,H=j(E)*O*B,X=p.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),te=p.properties.get("intensity"),de=j(X)*te;return Number(((H+de)/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(i.dr(d)){const p=i.ds(d),j=this.fragments.find(({id:O})=>O===p);if(!j)return;const E=i.dq(d);return j.style.getFragmentStyle(E)}{const p=this.fragments.find(({id:j})=>j===d);return p?p.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const p={},j=(E,O="")=>`${E}::${O}`;this._featuresetSelectors={};for(const E in d){const O=this._featuresetSelectors[E]=[];for(const R of d[E].selectors){if(R.featureNamespace){const H=this.getOwnLayer(R.layer);if(!H){i.w(`Layer is undefined for selector: ${R.layer}`);continue}const X=j(H.source,H.sourceLayer);if(X in p&&p[X]!==R.featureNamespace){i.w(`"featureNamespace ${R.featureNamespace} of featureset ${E}'s selector is not associated to the same source, skip this selector`);continue}p[X]=R.featureNamespace}let B;if(R.properties)for(const H in R.properties){const X=i.U(R.properties[H]);X.result==="success"&&(B=B||{},B[H]=X.value)}O.push({layerId:R.layer,namespace:R.featureNamespace,properties:B,uniqueFeatureID:R._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const p=this.getFragmentStyle(d);if(!p||!p.stylesheet.featuresets)return[];const j=[];for(const E in p.stylesheet.featuresets)j.push({featuresetId:E,importId:p.scope?p.scope:void 0});return j}getFeaturesetLayers(d,p){const j=this.getFragmentStyle(p),E=j.stylesheet.featuresets;if(!E||!E[d])return this.fire(new i.y(new Error(`The featureset '${d}' does not exist in the map's style and cannot be queried.`))),[];const O=[];for(const R of E[d].selectors){const B=j.getOwnLayer(R.layer);B&&O.push(B)}return O}getConfigProperty(d,p){const j=this.getFragmentStyle(d);if(!j)return null;const E=i.B(p,j.scope),O=j.options.get(E),R=O?O.value||O.default:null;return R?R.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,p){const j=i.B(d,p);return this._mergedIndoor[j]}setIndoorData(d,p){this.map.indoor.setIndoorData(p)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,p,j){const E=this.getFragmentStyle(d);if(!E)return;const O=E.stylesheet.schema;if(!O||!O[p])return;const R=i.U(j);if(R.result!=="success")return void Qp(this,R.value);const B=R.value.expression,H=i.B(p,E.scope),X=E.options.get(H);if(!X)return;let te;const{minValue:de,maxValue:ce,stepValue:he,type:ke,values:be}=O[p],Re=i.U(O[p].default);Re.result==="success"&&(te=Re.value.expression),te?(this.options.set(H,Object.assign({},X,{value:B,default:te,minValue:de,maxValue:ce,stepValue:he,type:ke,values:be})),this.updateConfigDependencies(p)):this.fire(new i.y(new Error(`No schema defined for the config option "${p}" in the "${d}" fragment.`)))}getConfig(d){const p=this.getFragmentStyle(d);if(!p)return null;const j=p.stylesheet.schema;if(!j)return null;const E={};for(const O in j){const R=i.B(O,p.scope),B=p.options.get(R),H=B?B.value||B.default:null;E[O]=H?H.serialize():null}return E}setConfig(d,p){const j=this.getFragmentStyle(d);j&&(j.updateConfig(p,j.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const p=this.getFragmentStyle(d);return p?p.stylesheet.schema:null}setSchema(d,p){const j=this.getFragmentStyle(d);j&&(j.stylesheet.schema=p,j.updateConfig(j._config,p),this.updateConfigDependencies())}updateConfig(d,p){if(this._config=d,d||p)if(p)for(const j in p){let E,O;const R=i.U(p[j].default);if(R.result==="success"&&(E=R.value.expression),d&&d[j]!==void 0){const ce=i.U(d[j]);ce.result==="success"&&(O=ce.value.expression)}const{minValue:B,maxValue:H,stepValue:X,type:te,values:de}=p[j];if(E){const ce=i.B(j,this.scope);this.options.set(ce,{default:E,value:O,minValue:B,maxValue:H,stepValue:X,type:te,values:de})}else this.fire(new i.y(new Error(`No schema defined for config option "${j}".`)))}else this.fire(new i.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,p=()=>!0){for(const j of d){const E=this.getLayer(j);E&&p(E)&&(E.possiblyEvaluateVisibility(),this._updateLayer(E),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,p=>!d||p.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(p=>{const j=p._styleColorTheme.colorThemeOverride?p._styleColorTheme.colorThemeOverride:p._styleColorTheme.colorTheme;if(j){const E=p._evaluateColorThemeData(j);(!p._styleColorTheme.lut&&E!==""||p._styleColorTheme.lut&&E!==p._styleColorTheme.lut.data)&&p.setColorTheme(j)}}),this._changes.setDirty()}addLayer(d,p,j={}){this._checkLoaded();const E=d.id;if(this._layers[E])return void this.fire(new i.y(new Error(`Layer with id "${E}" already exists on this map`)));let O;if(d.type==="custom"){if(Qp(this,i.dt(d)))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(E,d.source),d=i.dp(d),d=Object.assign(d,{source:E})),this._validate(dc,`layers.${E}`,d,{arrayIndex:-1},j))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(O),O.setEventedParent(this,{layer:{id:E}})}const R=i.B(O.source,O.scope);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(R),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(R);let B=this._order.length;if(p){const de=this._order.indexOf(p);if(de===-1)return void this.fire(new i.y(new Error(`Layer with id "${p}" does not exist on this map.`)));O.slot===this._layers[p].slot?B=de:i.w(`Layer with id "${p}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,E),this._layerOrderChanged=!0,this._layers[E]=O;const H=this.getOwnLayerSourceCache(O),X=!!this.directionalLight&&this.directionalLight.shadowsEnabled();H&&O.canCastShadows()&&X&&(H.castsShadows=!0);const te=this._changes.getRemovedLayer(O);if(te&&O.source&&H&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const de=i.B(O.source,O.scope);te.type!==O.type?this._changes.updateSourceCache(de,"clear"):(this._changes.updateSourceCache(de,"reload"),H.pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map),O.scope=this.scope,this.mergeLayers()}moveLayer(d,p){this._checkLoaded();const j=this._checkLayer(d);if(!j||d===p)return;const E=this._order.indexOf(d);this._order.splice(E,1);let O=this._order.length;if(p){const R=this._order.indexOf(p);if(R===-1)return void this.fire(new i.y(new Error(`Layer with id "${p}" does not exist on this map.`)));j.slot===this._layers[p].slot?O=R:i.w(`Layer with id "${p}" 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 p=this._checkLayer(d);if(!p)return;p.setEventedParent(null);const j=this._order.indexOf(d);this._order.splice(j,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(p.fqid),this._indoorDependentLayers.delete(p.fqid),this._changes.removeLayer(p);const E=this.getOwnLayerSourceCache(p);if(E&&E.castsShadows){let O=!1;for(const R in this._layers)if(this._layers[R].source===p.source&&this._layers[R].canCastShadows()){O=!0;break}E.castsShadows=O}p.onRemove&&p.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const p in this._layers)if(this._layers[p].type===d)return!0;return!1}setLayerZoomRange(d,p,j){this._checkLoaded();const E=this._checkLayer(d);E&&(E.minzoom===p&&E.maxzoom===j||(p!=null&&(E.minzoom=p),j!=null&&(E.maxzoom=j),this._updateLayer(E)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,p){this._checkLoaded();const j=this._checkLayer(d);j&&j.slot!==p&&(j.slot=p,this._updateLayer(j))}setFilter(d,p,j={}){this._checkLoaded();const E=this._checkLayer(d);if(E&&!i.by(E.filter,p))return p==null?(E.filter=void 0,void this._updateLayer(E)):void(this._validate(go,`layers.${E.id}.filter`,p,{layerType:E.type},j)||(E.filter=i.dp(p),this._updateLayer(E)))}getFilter(d){const p=this._checkLayer(d);if(p)return i.dp(p.filter)}setLayoutProperty(d,p,j,E={}){this._checkLoaded();const O=this._checkLayer(d);if(O&&!i.by(O.getLayoutProperty(p),j)){if(j!=null&&(!E||E.validate!==!1)&&Qp(O,rt.call(zs,{key:`layers.${d}.layout.${p}`,layerType:O.type,objectKey:p,value:j,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;O.setLayoutProperty(p,j),O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),this._updateLayer(O)}}setLayerProperty(d,p,j,E={}){this._checkLoaded();const O=this._checkLayer(d);O&&(p==="appearances"?(O.setAppearances(j),this._changes.setDirty()):O.isPaintProperty(p)?this.setPaintProperty(d,p,j,E):this.setLayoutProperty(d,p,j,E))}getLayoutProperty(d,p){const j=this._checkLayer(d);if(j)return j.getLayoutProperty(p)}setPaintProperty(d,p,j,E={}){this._checkLoaded();const O=this._checkLayer(d);if(!O||i.by(O.getPaintProperty(p),j)||j!=null&&(!E||E.validate!==!1)&&Qp(O,uc.call(zs,{key:`layers.${d}.paint.${p}`,layerType:O.type,objectKey:p,value:j,styleSpec:i.a6})))return;const R=O.setPaintProperty(p,j);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),R&&this._updateLayer(O),this._changes.updatePaintProperties(O)}getPaintProperty(d,p){const j=this._checkLayer(d);if(j)return j.getPaintProperty(p)}setFeatureState(d,p){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:X}=d.target,te=this.getFragmentStyle(X),de=te.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:he}of de)te.setFeatureState({id:d.id,source:ce,sourceLayer:he},p)}else if("layerId"in d.target){const{layerId:H}=d.target,X=this.getLayer(H);this.setFeatureState({id:d.id,source:X.source,sourceLayer:X.sourceLayer},p)}return}const j=d.source,E=d.sourceLayer,O=this._checkSource(j);if(!O)return;const R=O.type;if(R==="geojson"&&E)return void this.fire(new i.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(R==="vector"&&!E)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided.")));const B=this.getOwnSourceCaches(j);for(const H of B)H.setFeatureState(E,d.id,p)}removeFeatureState(d,p){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:X}=d.target,te=this.getFragmentStyle(X),de=te.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:he}of de)te.removeFeatureState({id:d.id,source:ce,sourceLayer:he},p)}else if("layerId"in d.target){const{layerId:H}=d.target,X=this.getLayer(H);this.removeFeatureState({id:d.id,source:X.source,sourceLayer:X.sourceLayer},p)}return}const j=d.source,E=this._checkSource(j);if(!E)return;const O=E.type,R=O==="vector"?d.sourceLayer:void 0;if(O==="vector"&&!R)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(p&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new i.y(new Error("A feature id is required to remove its specific state property.")));const B=this.getOwnSourceCaches(j);for(const H of B)H.removeFeatureState(R,d.id,p)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let O;if("featuresetId"in d.target){const{featuresetId:R,importId:B}=d.target,H=this.getFragmentStyle(B),X=H.getFeaturesetLayers(R);for(const{source:te,sourceLayer:de}of X){const ce=H.getFeatureState({id:d.id,source:te,sourceLayer:de});if(ce&&!O)O=ce;else if(!i.by(O,ce))return void this.fire(new i.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:R}=d.target,B=this.getLayer(R);O=this.getFeatureState({id:d.id,source:B.source,sourceLayer:B.sourceLayer})}return O}const p=d.source,j=d.sourceLayer,E=this._checkSource(p);if(E){if(E.type!=="vector"||j)return d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(p)[0].getFeatureState(j,d.id);this.fire(new i.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(),p=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return i.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:p,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)},j=>j!==void 0)}_updateFilteredLayers(d){for(const p of Object.values(this._mergedLayers))d(p)&&this._updateLayer(p)}_updateLayer(d){this._changes.updateLayer(d);const p=this.getLayerSourceCache(d),j=i.B(d.source,d.scope),E=this._changes.getUpdatedSourceCaches();d.source&&!E[j]&&p&&p.getSource().type!=="raster"&&(this._changes.updateSourceCache(j,"reload"),p.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const p=B=>this._mergedLayers[B].is3D(!!this.terrain),j=this.order,E={},O=[];for(let B=j.length-1;B>=0;B--){const H=j[B];if(p(H)){E[H]=B;for(const X of d){const te=X[H];if(te)for(const de of te)O.push(de)}}}O.sort((B,H)=>H.intersectionZ-B.intersectionZ);const R=[];for(let B=j.length-1;B>=0;B--){const H=j[B];if(p(H))for(let X=O.length-1;X>=0;X--){const te=O[X].feature;if(te.layer&&E[te.layer.id]{if(Zk.has(te.type))return;const de=this.getOwnLayerSourceCache(te),ce=O[de.id]=O[de.id]||{sourceCache:de,layers:{},has3DLayers:!1};te.is3D(!!this.terrain)&&(ce.has3DLayers=!0),ce.layers[te.fqid]=ce.layers[te.fqid]||{styleLayer:te,targets:[]},ce.layers[te.fqid].targets.push({filter:E})};if(p&&p.layers){if(!Array.isArray(p.layers))return this.fire(new i.y(new Error("parameters.layers must be an Array."))),[];for(const te of p.layers){const de=this._layers[te];if(!de)return this.fire(new i.y(new Error(`The layer '${te}' does not exist in the map's style and cannot be queried for features.`))),[];R(de)}}else for(const te in this._layers)R(this._layers[te]);const B=this._queryRenderedFeatures(d,O,j),H=this._flattenAndSortRenderedFeatures(B),X=[];for(const te of H)i.dw(te.layer.id)===this.scope&&X.push(te);return X}queryRenderedFeatureset(d,p,j){let E;p&&!Array.isArray(p)&&p.filter&&(this._validate(go,"queryRenderedFeatures.filter",p.filter,null,p),E=i.b6(p.filter));const O="mock",R=[];if(p&&p.target)R.push(Object.assign({},p,{targetId:O,filter:E}));else{const te=this.getFeaturesetDescriptors();for(const de of te)R.push({targetId:O,filter:E,target:de});for(const{style:de}of this.fragments){const ce=de.getFeaturesetDescriptors();for(const he of ce)R.push({targetId:O,filter:E,target:he})}}const B=this.queryRenderedTargets(d,R,j),H=[],X=new Set;for(const te of B)for(const de of te.variants[O])Gp(de,te,X)||H.push(new i.dx(te,de));return H}queryRenderedTargets(d,p,j){const E={},O=(B,H,X,te)=>{const de=E[H.id]=E[H.id]||{sourceCache:H,layers:{},has3DLayers:!1};if(de.layers[B.fqid]=de.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(de.has3DLayers=!0),!te)return X.uniqueFeatureID=!1,void de.layers[B.fqid].targets.push(X);de.layers[B.fqid].targets.push(Object.assign({},X,{namespace:te.namespace,properties:te.properties,uniqueFeatureID:te.uniqueFeatureID}))};for(const B of p)if("featuresetId"in B.target){const{featuresetId:H,importId:X}=B.target,te=this.getFragmentStyle(X);if(!te||!te._featuresetSelectors)continue;const de=te._featuresetSelectors[H];if(!de){this.fire(new i.y(new Error(`The featureset '${H}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const ce of de){const he=te.getOwnLayer(ce.layerId);he&&!Zk.has(he.type)&&O(he,te.getOwnLayerSourceCache(he),B,ce)}}else if("layerId"in B.target){const{layerId:H}=B.target,X=this.getLayer(H);if(!X||Zk.has(X.type))continue;O(X,this.getLayerSourceCache(X),B)}const R=this._queryRenderedFeatures(d,E,j);return this._flattenAndSortRenderedFeatures(R)}_queryRenderedFeatures(d,p,j){const E=[],O=!!this.map._showQueryGeometry,R=Li.createFromScreenPoints(d,j);for(const B in p){const H=Zy(R,p[B],this._availableImages,j,O);Object.keys(H).length&&E.push(H)}if(this.placement)for(const B in p){if(!p[B].sourceCache._onlySymbols)continue;const H=Yy(R.screenGeometry,p[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(H).length&&E.push(H)}return E}querySourceFeatures(d,p){const j=p&&p.filter;j&&this._validate(go,"querySourceFeatures.filter",j,null,p);let E=[];const O=this.getOwnSourceCaches(d);for(const R of O)E=E.concat(Xy(R,p));return E}addSourceType(d,p,j){return fh.getSourceType(d)?j(new Error(`A source type called "${d}" already exists.`)):(fh.setSourceType(d,p),p.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:p.workerSourceURL},j):j(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,p,j={}){this._checkLoaded();const E=this.light.getLight();let O=!1;for(const B in d)if(!i.by(d[B],E[B])){O=!0;break}if(!O)return;const R=this._getTransitionParameters();this.light.setLight(d,p,j),this.light.updateTransitions(R)}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=i.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&i.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,p=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),p===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let j=d;const E=!("source"in d)||d.source==null;if(p===1){if(this.disableElevatedTerrain)return;if("source"in j&&typeof j.source=="object"){const B="terrain-dem-src";this.addSource(B,j.source),j=i.dp(j),j=Object.assign(j,{source:B})}const O=Object.assign({},j),R={};if(this.terrain&&E){O.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(R.style=B.serialize())}if(this._validate(oo,"terrain",O,R))return}if(!this.terrain||this.terrain.scope!==this.scope&&!E||this.terrain&&p!==this.terrain.drapeRenderMode){if(!j)return;this._createTerrain(j,p),this.fire(new i.z("data",{dataType:"style"}))}else{const O=this.terrain,R=O.get();for(const B of Object.keys(i.a6.terrain))!j.hasOwnProperty(B)&&i.a6.terrain[B].default&&(j[B]=i.a6.terrain[B].default);for(const B in d)if(!i.by(d[B],R[B])){O.set(d,this.options),this.stylesheet.terrain=d;const H=this._getTransitionParameters({duration:0});O.updateTransitions(H),this.fire(new i.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const p=this.fog=new ts(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=p.get();const j=this._getTransitionParameters({duration:0});p.updateTransitions(j)}_createSnow(d){const p=this.snow=new Co(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=p.get();const j=this._getTransitionParameters({duration:0});p.updateTransitions(j)}_createRain(d){const p=this.rain=new Pi(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=p.get();const j=this._getTransitionParameters({duration:0});p.updateTransitions(j)}_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 p=this.fog;if(!i.by(p.get(),d)){p.set(d,this.options),this.stylesheet.fog=p.get();const j=this._getTransitionParameters({duration:0});p.updateTransitions(j)}}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 p=this.snow;if(!i.by(p.get(),d)){p.set(d,this.options),this.stylesheet.snow=p.get();const j=this._getTransitionParameters({duration:0});p.updateTransitions(j)}}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 p=this.rain;if(!i.by(p.get(),d)){p.set(d,this.options),this.stylesheet.rain=p.get();const j=this._getTransitionParameters({duration:0});p.updateTransitions(j)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const E in this._layers)this._layers[E].lut=this._styleColorTheme.lut;for(const E in this._sourceCaches)this._sourceCaches[E].clearTiles()},p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!p)return this._styleColorTheme.lut=null,void d();const j=this._evaluateColorThemeData(p);this._loadColorTheme(j).then(()=>{this.fire(new i.z("colorthemeset")),d()}).catch(E=>{i.w(`Couldn't set color theme: ${E}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&i.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,p){const j=this.getFragmentStyle(d);j&&(j._styleColorTheme.colorThemeOverride=p,j._reloadColorTheme())}_getTransitionParameters(d){return{now:i.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],p=[];for(const j of this._mergedOrder)this.isLayerDraped(this._mergedLayers[j])?d.push(j):p.push(j);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...p)}_createTerrain(d,p){const j=this.terrain=new Ot(d,p,this.scope,this.options,this.map.getWorldview());p===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const E=this._getTransitionParameters({duration:0});j.updateTransitions(E)}_force3DLayerUpdate(){for(const d in this._layers){const p=this._layers[d];p.type==="fill-extrusion"&&this._updateLayer(p)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const p=this._layers[d];p.type==="symbol"&&this._updateLayer(p)}}_validate(d,p,j,E,O={}){if(O&&O.validate===!1)return!1;const R=Object.assign({},this.serialize());return Qp(this,d.call(zs,Object.assign({key:p,style:R,value:j,styleSpec:i.a6},E)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.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 p=this.getSourceCaches(d);for(const j of p)j.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const p=this._mergedLayers[d];p._clear&&p._clear()}}reloadSource(d){const p=this.getSourceCaches(d);for(const j of p)j.resume(),j.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 p;this.directionalLight&&(p=Vv(this.directionalLight));const j=new Set,E=new Set;for(const O in this._mergedLayers){const R=this._mergedLayers[O];R.type==="building"&&j.add(R.source),R.hasElevation()&&!E.has(R.source)&&E.add(R.source)}for(const O in this._mergedSourceCaches){const R=this._mergedSourceCaches[O],B=E.has(R._source.id);j.has(R._source.id)&&(R._source.reparseOverscaled=!1),R.update(d,void 0,void 0,p,B)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const p=this._sourceCaches[d];p.resume(),p.reload()}}_updatePlacement(d,p,j,E,O,R,B=!1){let H=!1,X=!1;const te={},de={};for(const be of this._mergedOrder){const Re=this._mergedLayers[be];if(Re.type!=="symbol")continue;const De=i.B(Re.source,Re.scope);let We=te[De];if(!We){const Ge=this.getLayerSourceCache(Re);if(!Ge)continue;const jt=Ge.getRenderableIds(!0).map(gt=>Ge.getTileByID(gt));de[De]=jt.slice(),We=te[De]=jt.sort((gt,_t)=>_t.tileID.overscaledZ-gt.tileID.overscaledZ||(gt.tileID.isLessThan(_t.tileID)?-1:1))}const nt=this.crossTileSymbolIndex.addLayer(Re,We,p.center.lng,p.projection);H=H||nt}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new i.z("neworder"));const ce=!!(this.placement&&!p.equals(this.placement.transform)),he=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!R||this.placement.lastReplacementSourceUpdateTime!==R.updateTime)),ke=(ce||he||H||this.placement&&this.placement.isStale())&&E===0;if((B||!this.pauseablePlacement||ke||E!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),p.zoom))&&(this.pauseablePlacement=new wl(p,this._mergedOrder,B||E===0,j,E,O,this.placement,this.fog&&p.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,te,de,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),X=!0),H&&this.pauseablePlacement.placement.setStale()),X||H){this._buildingIndex.onNewFrame(p.zoom);for(let be=0;beO===d.id)!==-1)return void this.fire(new i.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!p)return j.push(d),this._loadImports([d],!0);const E=j.findIndex(({id:O})=>O===p);return E===-1&&this.fire(new i.y(new Error(`Import with id "${p}" does not exist on this map.`))),this.stylesheet.imports=j.slice(0,E).concat(d).concat(j.slice(E)),this._loadImports([d],!0,p)}updateImport(d,p){this._checkLoaded();const j=this.stylesheet.imports||[],E=this.getImportIndex(d);return E===-1?this:typeof p=="string"?(this.setImportUrl(d,p),this):(p.url&&p.url!==j[E].url&&this.setImportUrl(d,p.url),i.by(p.config,j[E].config)||this.setImportConfig(d,p.config,p.data.schema),i.by(p.data,j[E].data)||this.setImportData(d,p.data),this)}moveImport(d,p){this._checkLoaded();let j=this.stylesheet.imports||[];const E=this.getImportIndex(d);if(E===-1)return this;const O=this.getImportIndex(p);if(O===-1)return this;const R=j[E],B=this.fragments[E];return j=j.filter(({id:H})=>H!==d),this.fragments=this.fragments.filter(({id:H})=>H!==d),this.stylesheet.imports=j.slice(0,O).concat(R).concat(j.slice(O)),this.fragments=this.fragments.slice(0,O).concat(B).concat(this.fragments.slice(O)),this.mergeLayers(),this}setImportUrl(d,p){this._checkLoaded();const j=this.stylesheet.imports||[],E=this.getImportIndex(d);if(E===-1)return this;j[E].url=p;const O=this.fragments[E];return O.style=this._createFragmentStyle(j[E]),O.style.on("style.import.load",()=>this.mergeAll()),O.style.loadURL(p),this}setImportData(d,p){this._checkLoaded();const j=this.getImportIndex(d),E=this.stylesheet.imports||[];return j===-1?this:p?(this.fragments[j].style.setState(p),this._reloadImports(),this):(delete E[j].data,this.setImportUrl(d,E[j].url))}setImportConfig(d,p,j){this._checkLoaded();const E=this.getImportIndex(d),O=this.stylesheet.imports||[];if(E===-1)return this;p?O[E].config=p:delete O[E].config;const R=this.fragments[E];j&&R.style.stylesheet&&(R.style.stylesheet.schema=j);const B=R.style.stylesheet&&R.style.stylesheet.schema;return R.config=p,R.style.updateConfig(p,B),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const p=this.stylesheet.imports||[],j=this.getImportIndex(d);j!==-1&&(p.splice(j,1),this.fragments[j].style._remove(),this.fragments.splice(j,1),this._reloadImports())}getImportIndex(d){const p=(this.stylesheet.imports||[]).findIndex(j=>j.id===d);return p===-1&&this.fire(new i.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),p}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const p in this._mergedOtherSourceCaches){const j=this._mergedOtherSourceCaches[p];j&&d.push(j.getSource())}return d}getSource(d,p){const j=this.getSourceCache(d,p);return j&&j.getSource()}getLayerSource(d){const p=this.getLayerSourceCache(d);return p&&p.getSource()}getSourceCache(d,p){const j=i.B(d,p);return this._mergedOtherSourceCaches[j]}getLayerSourceCache(d){const p=i.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[p]:this._mergedOtherSourceCaches[p]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const p=[];return this._mergedOtherSourceCaches[d]&&p.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&p.push(this._mergedSymbolSourceCaches[d]),p}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const p in d){const j=d[p];j==="reload"?this.reloadSource(p):j==="clear"&&this.clearSource(p)}}updateLayers(d){const p=this._changes.getUpdatedPaintProperties();for(const j of p){const E=this.getLayer(j);E&&E.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,p,j){this.imageManager.getImages(p.images,p.scope,j),this._updateTilesForChangedImages();const E=R=>{if(R){const B=p.images.map(H=>i.I.toString(H));R.setDependencies(p.tileID.key,p.type,B)}},O=i.B(p.source,p.scope);E(this._mergedOtherSourceCaches[O]),E(this._mergedSymbolSourceCaches[O]),p.images.some(R=>R.iconsetId)&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(d,p,j){this.imageManager.rasterizeImages(p,j)}getGlyphs(d,p,j){this.glyphManager.getGlyphs(p.stacks,j)}getResource(d,p,j){return i.dz(p,j)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const p=[];return this._otherSourceCaches[d]&&p.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&p.push(this._symbolSourceCaches[d]),p}_isSourceCacheLoaded(d){const p=this.getOwnSourceCaches(d);return p.length===0?(this.fire(new i.y(new Error(`There is no source with ID '${d}'`))),!1):p.every(j=>j.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,p){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const j=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),E=d.type==="building";if(d.is3D(!!this.terrain)){if(j||E||p&&p.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)}}fh.getSourceType=function(w){return dh[w]},fh.setSourceType=function(w,d){dh[w]=d},fh.registerForPluginStateChange=i.dA;class RP extends i.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},i.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[p,j]of Object.entries(d.buildings))if(this._buildings[p])for(const E of j.floorIds)this._buildings[p].floors[E]||(this._buildings[p].floors[E]=j.floors[E]);else this._buildings[p]=j;for(const p of d.activeFloors)this._activeFloors.add(p);this._updateIndoorSelector()}getIndoorTileOptions(d,p){const j=this._style.getIndoorSourceLayers(d,p);return j&&this._indoorState?{sourceLayers:j,indoorState:this._indoorState}:null}_updateUI(d,p,j){const E=function(O,R,B,H){let X=null,te=Number.MAX_SAFE_INTEGER;if(H<16)return null;for(const[de,ce]of Object.entries(O)){const he=ce.center;if(he){const ke=R.distanceTo(i.aT.convert(he));ke({id:R,name:j.floors[R].name,zIndex:j.floors[R].zIndex})).sort((R,B)=>B.zIndex-R.zIndex);this.fire(new i.z("selector-update",{selectedFloorId:E,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 a0=` #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`,i0=` #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;}`,c5=` #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`,Yk="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;}",Pu=` #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`,Xk=`#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`,Ir=`#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`,d5=`#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`,Qk=`#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;}`,Jk=`#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`,u5=`#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 Wv=/#include\s+"([^"]+)"/g,Om=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,h5=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,px=new Set(["ifdef","ifndef","elif","if","defined"]),gx=new Set;tg(a0,gx),tg(c5,gx),tg(i0,gx);const eg={"_prelude_fog.vertex.glsl":Xk,"_prelude_terrain.vertex.glsl":Pu,"_prelude_shadow.vertex.glsl":Jk,"_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":Ir,"_prelude_shadow.fragment.glsl":u5,"_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":d5,"_prelude_raster_particle.glsl":Qk},eN={};ia("",Pu),ia(Ir,Xk),ia(u5,Jk),ia(d5,""),ia(Qk,"");const FP=ia(i0,c5),tN=a0,qie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",tN,FP.fragmentSource].join(` `),zP=["precision highp float;",tN,FP.vertexSource].join(` `);var m5={background:ia(`#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:ia(`#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:ia(`#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:ia(`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:ia(`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:ia(`#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:ia("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:ia(`#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:ia(`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:ia("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:ia("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:ia("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:ia(`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:ia(`#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:ia(`#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:ia(`#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:ia(`#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:ia(`#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:ia(`#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:ia(`#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:ia(`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:ia(`#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:ia(`#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:ia(`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:ia(`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:ia(`#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:ia(`#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:ia(`#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:ia(`#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:ia(`#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:ia("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:ia("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:ia(`#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:ia(`#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:ia(`#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:ia("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:ia(`#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 }`,Yk),skyboxGradient:ia(`#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 }`,Yk),skyboxCapture:ia(` 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:ia(`#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:ia(`#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:ia(`#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:ia(`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:ia(`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:ia("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:ia("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:ia("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:ia("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 tg(w,d){const p=w.split(` `);for(let j of p){if(j=j.trimStart(),j[0]!=="#"||!j.includes("if")||j.startsWith("#endif"))continue;const E=j.match(h5);if(E)for(const O of E)px.has(O)||d.add(O)}}function ia(w,d){const p=new Set,j=[],E=[];w=w.replace(Wv,(R,B)=>(E.push(B),"")),d=d.replace(Wv,(R,B)=>(j.push(B),""));let O=new Set(gx);tg(w,O),tg(d,O);for(const R of[...j,...E])eN[R]||(eN[R]=new Set,tg(eg[R],eN[R])),O=new Set([...O,...eN[R]]);return{fragmentSource:w=w.replace(Om,(R,B,H,X,te)=>(p.add(te),B==="define"?` #ifndef HAS_UNIFORM_u_${te} in ${H} ${X} ${te}; #else uniform ${H} ${X} u_${te}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${te} ${H} ${X} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${X} ${te}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(Om,(R,B,H,X,te)=>{const de=`MATERIAL_ATTRIBUTE_OFFSET_${te}`,ce=X==="float"?"vec2":X,he=`GET_ATTRIBUTE_${ce}(a_${te}, materialInfo, ${de})`,ke=te.match(/color/)?"color":ce;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${X} a_${te}; #endif `:p.has(te)?B==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${de}) in ${H} ${ce} a_${te}; #endif out ${H} ${X} ${te}; #else uniform ${H} ${X} u_${te}; #endif `:B==="initialize"?ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} ${te} = a_${te}; #else ${H} ${X} ${te} = u_${te}; #endif `:` #if !defined(HAS_UNIFORM_u_${te}) #ifdef ${de} ${te} = unpack_mix_${ke}(${he}, u_${te}_t); #else ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${H} ${X} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${X} a_${te}; out ${H} ${X} ${te}; #endif `:B==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} ${te} = a_${te}; #endif `:void 0:B==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${de}) in ${H} ${ce} a_${te}; #endif #else uniform ${H} ${X} u_${te}; #endif `:B==="define-instanced"?ke==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${te}0; in vec4 a_${te}1; in vec4 a_${te}2; in vec4 a_${te}3; #else uniform ${H} ${X} u_${te}; #endif `:` #ifdef INSTANCED_ARRAYS in ${H} ${ce} a_${te}; #else uniform ${H} ${X} u_${te}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${te} ${H} ${X} ${te} = a_${te}; #endif `:ke==="vec4"?` #ifndef HAS_UNIFORM_u_${te} #ifdef ${de} ${H} ${X} ${te} = ${he}; #else ${H} ${X} ${te} = a_${te}; #endif #else ${H} ${X} ${te} = u_${te}; #endif `:` #ifndef HAS_UNIFORM_u_${te} #ifdef ${de} ${H} ${X} ${te} = unpack_mix_${ke}(${he}, u_${te}_t); #else ${H} ${X} ${te} = unpack_mix_${ke}(a_${te}, u_${te}_t); #endif #else ${H} ${X} ${te} = u_${te}; #endif `}),usedDefines:O,vertexIncludes:j,fragmentIncludes:E}}class Vie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,p,j,E,O,R,B,H){this.context=d;let X=this.boundPaintVertexBuffers.length!==E.length;for(let de=0;!X&&de{const jt=nt.paint.get("hillshade-shadow-color"),gt=nt.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",_t=nt.paint.get("hillshade-highlight-color"),pt=nt.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",ht=nt.paint.get("hillshade-accent-color"),St=nt.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Rt=nt.paint.get("hillshade-emissive-strength");let Dt=i.an(nt.paint.get("hillshade-illumination-direction"));if(nt.paint.get("hillshade-illumination-anchor")==="viewport")Dt-=De.transform.angle;else if(De.style&&De.style.enable3dLights()&&De.style.directionalLight){const Xt=De.style.directionalLight.properties.get("direction"),or=i.d4(Xt.x,Xt.y,Xt.z);Dt=i.an(or[1])}const Yt=!De.options.moving;return{u_matrix:Ge||De.transform.calculateProjMatrix(We.tileID.toUnwrapped(),Yt),u_image:0,u_latrange:Hie(0,We.tileID),u_light:[nt.paint.get("hillshade-exaggeration"),Dt],u_shadow:jt.toPremultipliedRenderColor(gt?null:nt.lut),u_highlight:_t.toPremultipliedRenderColor(pt?null:nt.lut),u_emissive_strength:Rt,u_accent:ht.toPremultipliedRenderColor(St?null:nt.lut)}})(w,p,j,w.terrain?d.projMatrix:null);w.uploadCommonUniforms(B,ce,d.toUnwrapped());const{tileBoundsBuffer:ke,tileBoundsIndexBuffer:be,tileBoundsSegments:Re}=w.getTileBoundsBuffers(p);ce.draw(w,H.TRIANGLES,E,O,R,Un.disabled,he,j.id,ke,be,Re)}function f5(w,d,p){if(!d.needsDEMTextureUpload)return;const j=w.context,E=j.gl;j.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||w.getTileTexture(p.stride);const O=p.getPixels();d.demTexture?d.demTexture.update(O,{premultiply:!1}):d.demTexture=new i.T(j,O,E.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function Gie(w,d,p){const j=w.context,E=j.gl;if(!d.dem)return;const O=d.dem;if(j.activeTexture.set(E.TEXTURE1),f5(w,d,O),!d.demTexture)return;d.demTexture.bind(E.NEAREST,E.CLAMP_TO_EDGE);const R=O.dim;j.activeTexture.set(E.TEXTURE0);let B=d.hillshadeFBO;if(!B){const ce=new i.T(j,{width:R,height:R,data:null},E.RGBA8);ce.bind(E.LINEAR,E.CLAMP_TO_EDGE),B=d.hillshadeFBO=j.createFramebuffer(R,R,1,"renderbuffer"),B.colorAttachment0.set(ce.texture)}j.bindFramebuffer.set(B.framebuffer),j.viewport.set([0,0,R,R]);const{tileBoundsBuffer:H,tileBoundsIndexBuffer:X,tileBoundsSegments:te}=w.getMercatorTileBoundsBuffers(),de=[];w.linearFloatFilteringSupported()&&de.push("TERRAIN_DEM_FLOAT_FORMAT"),w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&de.push("USE_MRT1"),w.getOrCreateProgram("hillshadePrepare",{defines:de}).draw(w,E.TRIANGLES,yn.disabled,Hn.disabled,ms.unblended,Un.disabled,((ce,he)=>{const ke=he.stride,be=i.bC();return i.ce(be,0,i.al,-i.al,0,0,1),i.br(be,be,[0,-i.al,0]),{u_matrix:be,u_image:1,u_dimension:[ke,ke],u_zoom:ce.overscaledZ}})(d.tileID,O),p.id,H,X,te),d.needsHillshadePrepare=!1}class Di{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 Kie extends Di{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const p=this.current;(d.r!==p.r||d.g!==p.g||d.b!==p.b||d.a!==p.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class BP extends Di{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class p5 extends Di{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class rN extends Di{getDefault(){return[!0,!0,!0,!0]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class g5 extends Di{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class xx extends Di{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class o0 extends Di{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const p=this.current;(d.func!==p.func||d.ref!==p.ref||d.mask!==p.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class Gv extends Di{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class l0 extends Di{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.STENCIL_TEST):p.disable(p.STENCIL_TEST),this.current=d,this.dirty=!1}}class $P extends Di{getDefault(){return[0,1]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class x5 extends Di{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.DEPTH_TEST):p.disable(p.DEPTH_TEST),this.current=d,this.dirty=!1}}class UP extends Di{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class c0 extends Di{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.BLEND):p.disable(p.BLEND),this.current=d,this.dirty=!1}}class nN extends Di{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class sN extends Di{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const p=this.current;(d.r!==p.r||d.g!==p.g||d.b!==p.b||d.a!==p.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class y5 extends Di{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 aN extends Di{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;d?p.enable(p.CULL_FACE):p.disable(p.CULL_FACE),this.current=d,this.dirty=!1}}class Kv extends Di{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class qP extends Di{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let VP=class extends Di{getDefault(){return null}set(w){(w!==this.current||this.dirty)&&(this.gl.useProgram(w),this.current=w,this.dirty=!1)}};class HP extends Di{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class d0 extends Di{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const p=this.current;(d[0]!==p[0]||d[1]!==p[1]||d[2]!==p[2]||d[3]!==p[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class WP extends Di{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindFramebuffer(p.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class Zie extends Di{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindRenderbuffer(p.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Yie extends Di{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindTexture(p.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Xie extends Di{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.bindBuffer(p.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class v5 extends Di{getDefault(){return null}set(d){const p=this.gl;p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class _5 extends Di{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class b5 extends Di{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class w5 extends Di{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class GP extends Di{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const p=this.gl;p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class iN extends Di{constructor(d,p){super(d),this.context=d,this.parent=p}getDefault(){return null}}class oN extends iN{constructor(d,p,j=0){super(d,p),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+j}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferTexture2D(p.FRAMEBUFFER,this.attachmentPoint,p.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class u0 extends iN{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferRenderbuffer(p.FRAMEBUFFER,this.attachment(),p.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Zv extends iN{attachment(){return this.gl.DEPTH_ATTACHMENT}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const p=this.gl;p.framebufferTexture2D(p.FRAMEBUFFER,this.attachment(),p.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class KP extends u0{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Lu=(w,d,p,j)=>({u_matrix:w,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:p,u_emissive_texture_available:j}),lN=(w,d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re)=>({u_proj_matrix:Float32Array.from(w),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(j),u_merc_matrix:p,u_zoom_transition:E,u_merc_center:O,u_image0:0,u_image1:1,u_frustum_tl:R,u_frustum_tr:B,u_frustum_br:H,u_frustum_bl:X,u_globe_pos:te,u_globe_radius:de,u_viewport:ce,u_grid_matrix:Re?Float32Array.from(Re):new Float32Array(9),u_skirt_height:he,u_far_z_cutoff:ke,u_emissive_texture_available:be});function Yv(w,d){return w!=null&&d!=null&&!(!w.hasData()||!d.hasData())&&w.demTexture!=null&&d.demTexture!=null&&w.tileID.key!==d.tileID.key}const Lf=new class{constructor(){this.operations={}}newMorphing(w,d,p,j,E){if(w in this.operations){const O=this.operations[w];O.to.tileID.key!==p.tileID.key&&(O.queued=p)}else this.operations[w]={startTime:j,phase:0,duration:E,from:d,to:p,queued:null}}getMorphValuesForProxy(w){if(!(w in this.operations))return null;const d=this.operations[w];return{from:d.from,to:d.to,phase:d.phase}}update(w){for(const d in this.operations){const p=this.operations[d];for(p.phase=(w-p.startTime)/p.duration;p.phase>=1||!this._validOp(p);)if(!this._nextOp(p,w)){delete this.operations[d];break}}}_nextOp(w,d){return!!w.queued&&(w.from=w.to,w.to=w.queued,w.queued=null,w.phase=0,w.startTime=d,!0)}_validOp(w){return w.from.hasData()&&w.to.hasData()}},cN={0:null,1:"TERRAIN_VERTEX_MORPHING"};function dN(w,d,p){if(d===0)return 0;const j=d<1&&p===514?.25/d:1;return 6*Math.pow(1.5,22-w)*Math.max(d,1)*j}function j5(w,d){const p=1<({u_matrix:w});function Qv(w,d,p,j,E){if(E>0){const O=i.o.now(),R=(O-w.timeAdded)/E,B=d?(O-d.timeAdded)/E:-1,H=p.getSource(),X=j.coveringZoomLevel({tileSize:H.tileSize,roundZoom:H.roundZoom}),te=!d||Math.abs(d.tileID.overscaledZ-X)>Math.abs(w.tileID.overscaledZ-X),de=te&&w.refreshedUponExpiration?1:i.aA(te?R:1-B,0,1);return d?{opacity:1,mix:1-de,isFading:R<1}:{opacity:de,mix:0,isFading:R<1}}return{opacity:1,mix:0,isFading:!1}}class uN extends yd{constructor(d){const p=Xo("mock-dem",{type:"raster-dem",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("mock-dem",p,!1),p.setEventedParent(this),this._sourceLoaded=!0}_loadTile(d,p){d.state="loaded",p(null)}}class k5 extends yd{constructor(d){const p=Xo("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",p,!1),p.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,p,j){if(d.freezeTileCoverage)return;this.transform=d;const E=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((O,R)=>{if(O[R.key]="",!this._tiles[R.key]){const B=new Tf(R,this._source.tileSize*R.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);B.state="loaded",this._tiles[R.key]=B}return O},{});for(const O in this._tiles)O in E||(this.freeFBO(O),this._tiles[O].unloadVectorData(),delete this._tiles[O])}freeFBO(d){const p=this.proxyCachedFBO[d];if(p!==void 0){const j=Object.values(p);this.renderCachePool.push(...j),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class N5 extends i.aQ{constructor(d,p,j){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=p,this.projMatrix=j}}class S5 extends i.bV{constructor(d,p){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[j,E,O]=function(H){const X=new i.bd,te=new i.b0,de=131;X.reserve(17161),te.reserve(33800);const ce=i.al/128,he=i.al+ce/2,ke=he+ce;for(let Re=-ce;Rehe||Re<0||Re>he?24575:0,nt=i.aA(Math.round(De),0,i.al),Ge=i.aA(Math.round(Re),0,i.al);X.emplaceBack(nt+We,Ge)}const be=(Re,De)=>{const We=De*de+Re;te.emplaceBack(We+1,We,We+de),te.emplaceBack(We+de,We+de+1,We+1)};for(let Re=1;Re<129;Re++)for(let De=1;De<129;De++)be(De,Re);return[0,129].forEach(Re=>{for(let De=0;De<130;De++)be(De,Re),be(Re,De)}),[X,te,32768]}(),R=d.context;this.gridBuffer=R.createVertexBuffer(j,i.bf.members),this.gridIndexBuffer=R.createIndexBuffer(E),this.gridSegments=i.bg.simpleSegment(0,0,j.length,E.length),this.gridNoSkirtSegments=i.bg.simpleSegment(0,0,j.length,O),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new k5(p.map),this.orthoMatrix=i.bC(),i.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,i.al,0,i.al,0,1);const B=R.gl;this._overlapStencilMode=new Hn({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=p,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new uN(p.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,p,j){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const E=d.terrain.properties,O=d.terrain.drapeRenderMode===0,R=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();const B=d.terrain&&d.terrain.scope,H=E.get("source"),X=O?this._mockSourceCache:d.getSourceCache(H,B);if(!X)return void i.w(`Couldn't find terrain source "${H}".`);if(this.sourceCache=X,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=R?this.calculateExaggeration(p):E.get("exaggeration"),!p.projection.requiresDraping&&R&&this._exaggeration===0)return void this._disable();this.enabled=!0;const te=()=>{this.sourceCache.used&&i.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 de=this.getScaledDemTileSize();this.sourceCache.update(p,de,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,te(),this._initializing=!0),te(),p.updateElevation(!0,j),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(p),this._emptyDEMTextureDirty=!0,this._previousZoom=p.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const p=this._previousCameraAltitude,j=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=j;const E=p!=null?j-p:Number.MAX_VALUE;if(Math.abs(E)<2)return this._exaggeration;const O=d.zoom,R=this._style.terrain;if(!this._previousUpdateTimestamp)return R.getExaggeration(O);let B=O-this._previousZoom;const H=this._previousUpdateTimestamp;let X=O;this._evaluationZoom!=null&&(X=this._evaluationZoom,Math.abs(O-X)>.5&&(B=.5*(O-X+B)),B*E<0&&(X+=B)),this._evaluationZoom=X;const te=R.getExaggeration(X),de=te===R.getExaggeration(Math.max(0,X-.1));if(de&&Math.abs(te-this._exaggeration)<.01)return te;let ce=Math.min(.1,.00375*(this._updateTimestamp-H));return(de||te<.1||Math.abs(B)<1e-4)&&(ce=Math.min(.2,4*ce)),i.ak(this._exaggeration,te,ce)}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 p=this.proxySourceCache,j=this.painter.transform;this._initializing&&(this._initializing=j._centerAltitude===0&&this.getAtPointOrZero(i.ae.fromLngLat(j.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const E=this.proxyCoords=p.getIds().map(H=>{const X=p.getTileByID(H).tileID;return X.projMatrix=j.calculateProjMatrix(X.toUnwrapped()),X});(function(H,X){const te=X.transform.pointCoordinate(X.transform.getCameraPoint()),de=new i.P(te.x,te.y);H.sort((ce,he)=>{if(he.overscaledZ-ce.overscaledZ)return he.overscaledZ-ce.overscaledZ;const ke=new i.P(ce.canonical.x+(1<{this.proxyToSource[H.key]={}}),this.terrainTileForTile={};const R=this._style._mergedSourceCaches;for(const H in R){const X=R[H];if(!X.used||(X!==this.sourceCache&&this.resetTileLookupCache(X.id),this._setupProxiedCoordsForOrtho(X,d[H],O),X.usedForTerrain))continue;const te=d[H];X.getSource().reparseOverscaled&&this._assignTerrainTiles(te)}this.proxiedCoords[p.id]=E.map(H=>new N5(H,H.key,this.orthoMatrix)),this._assignTerrainTiles(E),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(O),this.renderingToTexture=!1;const B={};this._visibleDemTiles=[];for(const H of this.proxyCoords){const X=this.terrainTileForTile[H.key];if(!X)continue;const te=X.tileID.key;te in B||(this._visibleDemTiles.push(X),B[te]=te)}}_assignTerrainTiles(d){this._initializing||d.forEach(p=>{if(this.terrainTileForTile[p.key])return;const j=this._findTileCoveringTileID(p,this.sourceCache);j&&(this.terrainTileForTile[p.key]=j)})}_prepareDEMTextures(){const d=this.painter.context,p=d.gl;for(const j in this.terrainTileForTile){const E=this.terrainTileForTile[j],O=E.dem;!O||E.demTexture&&!E.needsDEMTextureUpload||(d.activeTexture.set(p.TEXTURE1),f5(this.painter,E,O))}}_prepareDemTileUniforms(d,p,j,E){if(!p||p.demTexture==null)return!1;const O=d.tileID.canonical,R=Math.pow(2,p.tileID.canonical.z-O.z),B=E||"";return j[`u_dem_tl${B}`]=[O.x*R%1,O.y*R%1],j[`u_dem_scale${B}`]=R,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const p=this._visibleDemTiles.reduce((j,E)=>{if(!E.dem)return j;const O=E.dem.tree.minimums[0];return O>0&&d++,j+O},0);return d?p/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,p=d.gl;d.activeTexture.set(p.TEXTURE2);const j=this._getLoadedAreaMinimum(),E=new i.dL({width:1,height:1},new Float32Array([j]));this._emptyDEMTextureDirty=!1;let O=this._emptyDEMTexture;return O?O.update(E,{premultiply:!1}):O=this._emptyDEMTexture=new i.T(d,E,p.R32F,{premultiply:!1}),O}setupElevationDraw(d,p,j){const E=this.painter.context,O=E.gl,R={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};R.u_exaggeration=this.exaggeration();let B=null,H=null,X=1;if(j&&j.morphing&&this._useVertexMorphing){const he=j.morphing.srcDemTile,ke=j.morphing.dstDemTile;X=j.morphing.phase,he&&ke&&(this._prepareDemTileUniforms(d,he,R,"_prev")&&(H=he),this._prepareDemTileUniforms(d,ke,R)&&(B=ke))}const te=he=>he&&he.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let de=null;var ce;if(this.enabled?H&&B?(de=B.demTexture,E.activeTexture.set(O.TEXTURE4),H.demTexture.bind(te(H),O.CLAMP_TO_EDGE),R.u_dem_lerp=X):(B=this.terrainTileForTile[d.tileID.key],de=this._prepareDemTileUniforms(d,B,R)?B.demTexture:this.emptyDEMTexture):de=this.emptyDEMTexture,E.activeTexture.set(O.TEXTURE2),de&&(R.u_dem_size=(ce=de).size[0]===1?1:ce.size[0]-2,de.bind(te(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(j&&j.useDepthForOcclusion,p,R),j&&j.useMeterToDem&&B){const he=(1<{if(De===Xt)return;const or=[cN[Xt],"PROJECTION_GLOBE_VIEW"];nt&&or.push("CUSTOM_ANTIALIASING");const wr=X.isTileAffectedByFog(Yt);Re=X.getOrCreateProgram("globeRaster",{defines:or,overrideFog:wr}),De=Xt},jt=X.colorModeForRenderPass(),gt=new yn(be.LEQUAL,yn.ReadWrite,X.depthRangeFor3D);Lf.update(he);const _t=i.dF(We),pt=[i.aF(We.center.lng),i.aJ(We.center.lat)],ht=X.globeSharedBuffers,St=[We.width*i.o.devicePixelRatio,We.height*i.o.devicePixelRatio],Rt=Float32Array.from(We.globeMatrix),Dt={useDenormalizedUpVectorScale:!0};{const Yt=X.transform,Xt=dN(Yt.zoom,te.exaggeration(),te.sourceCache._source.tileSize);De=-1;const or=be.TRIANGLES;for(const wr of ce){const Vt=de.getTile(wr),Et=Hn.disabled,er=te.prevTerrainTileForTile[wr.key],Kt=te.terrainTileForTile[wr.key];Yv(er,Kt)&&Lf.newMorphing(wr.key,er,Kt,he,250),h0(X,Vt.emissiveTexture),ke.activeTexture.set(be.TEXTURE0),Vt.texture&&Vt.texture.bind(be.LINEAR,be.CLAMP_TO_EDGE);const mr=Lf.getMorphValuesForProxy(wr.key),Lr=mr?1:0;mr&&Object.assign(Dt,{morphing:{srcDemTile:mr.from,dstDemTile:mr.to,phase:i.dD(mr.phase)}});const Yr=i.dG(wr.canonical),Tr=i.dH(Yr.getCenter().lat),jr=i.dI(wr.canonical,Yr,Tr,Yt.worldSize/Yt._pixelsPerMercatorPixel),fn=i.bk(i.dJ(wr.canonical)),an=X.emissiveMode==="mrt-fallback"?1:0,Hr=lN(Yt.expandedFarZProjMatrix,Rt,_t,fn,i.aj(Yt.zoom),pt,Yt.frustumCorners.TL,Yt.frustumCorners.TR,Yt.frustumCorners.BR,Yt.frustumCorners.BL,Yt.globeCenterInViewSpace,Yt.globeRadius,St,Xt,Yt._farZ,an,jr);if(Ge(wr,Lr),Re&&(te.setupElevationDraw(Vt,Re,Dt),X.uploadCommonUniforms(ke,Re,wr.toUnwrapped()),ht)){const[Qr,Mn,rs]=ht.getGridBuffers(Tr,Xt!==0);Re.draw(X,or,gt,Et,jt,Un.backCCW,Hr,"globe_raster",Qr,Mn,rs)}}}if(ht&&(X.renderDefaultNorthPole||X.renderDefaultSouthPole)){const Yt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];nt&&Yt.push("CUSTOM_ANTIALIASING"),Re=X.getOrCreateProgram("globeRaster",{defines:Yt});for(const Xt of ce){const{x:or,y:wr,z:Vt}=Xt.canonical,Et=wr===0,er=wr===(1<Qr.draw(X,be.TRIANGLES,gt,Hn.disabled,jt,Un.disabled,lN(We.expandedFarZProjMatrix,jr,jr,fn,0,pt,We.frustumCorners.TL,We.frustumCorners.TR,We.frustumCorners.BR,We.frustumCorners.BL,We.globeCenterInViewSpace,We.globeRadius,St,0,We._farZ,an),"globe_pole_raster",Mn,Lr,Yr);te.setupElevationDraw(Tr,Re,Dt),X.uploadCommonUniforms(ke,Re,Xt.toUnwrapped()),Et&&X.renderDefaultNorthPole&&Hr(Re,Kt),er&&X.renderDefaultSouthPole&&(jr=i.cS(i.bC(),jr,[1,-1,1]),Hr(Re,mr))}}}})(E,O,R,B,H);else{const X=E.context,te=X.gl;let de,ce;const he=E.shadowRenderer,ke=Yp(E,E.longestCutoffRange),be=jt=>{if(ce===jt)return;const gt=[];gt.push(cN[jt]),ke.shouldRenderCutoff&>.push("RENDER_CUTOFF"),he&&(gt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),he.useNormalOffset&>.push("NORMAL_OFFSET")),de=E.getOrCreateProgram("terrainRaster",{defines:gt}),ce=jt},Re=E.colorModeForRenderPass(),De=new yn(te.LEQUAL,yn.ReadWrite,E.depthRangeFor3D);Lf.update(H);const We=E.transform,nt=dN(We.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let Ge=[0,0,0];if(he){const jt=E.style.directionalLight,gt=E.style.ambientLight;jt&>&&(Ge=Pf(E.style,jt,gt))}{ce=-1;const jt=te.TRIANGLES,[gt,_t]=[O.gridIndexBuffer,O.gridSegments];for(const pt of B){const ht=R.getTile(pt),St=Hn.disabled,Rt=O.prevTerrainTileForTile[pt.key],Dt=O.terrainTileForTile[pt.key];Yv(Rt,Dt)&&Lf.newMorphing(pt.key,Rt,Dt,H,250),h0(E,ht.emissiveTexture),X.activeTexture.set(te.TEXTURE0),ht.texture&&ht.texture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const Yt=Lf.getMorphValuesForProxy(pt.key),Xt=Yt?1:0;let or;Yt&&(or={morphing:{srcDemTile:Yt.from,dstDemTile:Yt.to,phase:i.dD(Yt.phase)}});const wr=E.emissiveMode==="mrt-fallback"?1:0,Vt=Lu(pt.projMatrix,j5(pt.canonical,We.renderWorldCopies)?nt/10:nt,Ge,wr);if(be(Xt),!de)continue;O.setupElevationDraw(ht,de,or);const Et=pt.toUnwrapped();he&&he.setupShadows(Et,de),E.uploadCommonUniforms(X,de,Et,null,ke),de.draw(E,jt,De,St,Re,Un.backCCW,Vt,"terrain_raster",O.gridBuffer,gt,_t)}}}}(p,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,p.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const p=this.painter,j=this.painter.context,E=this.proxySourceCache,O=this.proxiedCoords[E.id],R=this._drapedRenderBatches.shift(),B=p.style.order,H=[];this._updateFBOs(p.emissiveMode==="mrt-fallback");let X=0;for(const te of O){const de=E.getTileByID(te.proxyTileKey),ce=E.proxyCachedFBO[te.key]?E.proxyCachedFBO[te.key][d]:void 0,he=ce!==void 0?E.renderCache[ce]:this.pool[X++],ke=ce!==void 0;if(de.texture=he.tex,de.emissiveTexture=he.emissiveTex,ke&&!he.dirty){H.push(de.tileID);continue}j.bindFramebuffer.set(he.fb.framebuffer);const be=j.gl;let Re;be.drawBuffers(p.emissiveMode==="mrt-fallback"?[be.COLOR_ATTACHMENT0,be.COLOR_ATTACHMENT1]:[be.COLOR_ATTACHMENT0]),this.renderedToTile=!1,he.dirty&&(j.clear({color:i.ao.transparent,stencil:0}),he.dirty=!1);for(let De=R.start;De<=R.end;++De){const We=p.style._mergedLayers[B[De]];if(We.isHidden(p.transform.zoom))continue;const nt=p.style.getLayerSourceCache(We),Ge=nt?this.proxyToSource[te.key][nt.id]:[te];if(!Ge)continue;const jt=Ge;j.viewport.set([0,0,he.fb.width,he.fb.height]),Re!==(nt?nt.id:null)&&(this._setupStencil(he,Ge,We,nt),Re=nt?nt.id:null),p.renderLayer(p,nt,We,jt)}if(be.drawBuffers([be.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const De of this._pendingGroundEffectLayers){const We=p.style._mergedLayers[B[De]];if(We.isHidden(p.transform.zoom))continue;const nt=p.style.getLayerSourceCache(We),Ge=nt?this.proxyToSource[te.key][nt.id]:[te];if(!Ge)continue;const jt=Ge;j.viewport.set([0,0,he.fb.width,he.fb.height]),Re!==(nt?nt.id:null)&&(this._setupStencil(he,Ge,We,nt),Re=nt?nt.id:null),p.renderLayer(p,nt,We,jt)}this.renderedToTile?(he.dirty=!0,H.push(de.tileID)):ke||--X,X===5&&(X=0,this.renderToBackBuffer(H))}return this.renderToBackBuffer(H),this.renderingToTexture=!1,j.bindFramebuffer.set(null),j.viewport.set([0,0,p.width,p.height]),R.end+1}postRender(){}isLayerOrderingCorrect(d){const p=d.order.length;let j=-1,E=p;for(let O=0;Oj}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(p=>p.dem).forEach(p=>{d=Math.min(d,p.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,p,j){if(!this._visibleDemTiles)return null;const E=this._visibleDemTiles.filter(O=>O.dem).map(O=>{const R=O.tileID,B=1<(O.t!==null?O.t:Number.MAX_VALUE)-(R.t!==null?R.t:Number.MAX_VALUE));for(const O of E){if(O.t==null)return null;const R=O.tile.dem.tree.raycast(O.minx,O.miny,O.maxx,O.maxy,d,p,j);if(R!=null)return R}return null}_createFBO(){const d=this.painter.context,p=d.gl,j=this.drapeBufferSize;d.activeTexture.set(p.TEXTURE0);const E=new i.T(d,{width:j[0],height:j[1],data:null},p.RGBA8);E.bind(p.LINEAR,p.CLAMP_TO_EDGE);const O=d.createFramebuffer(j[0],j[1],1,null);let R;return O.colorAttachment0.set(E.texture),this._emissiveTexture&&(R=new i.T(d,{width:j[0],height:j[1],data:null},p.R8),R.bind(p.LINEAR,p.CLAMP_TO_EDGE),O.createColorAttachment(d,1),O.colorAttachment1.set(R.texture)),O.depthAttachment=new KP(d,O.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,j[0],j[1]),this._stencilRef=0,O.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):O.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&p.texParameterf(p.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:O,tex:E,emissiveTex:R,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const p of this.pool)this._updateFBO(p,d);for(const p of this.proxySourceCache.renderCache)this._updateFBO(p,d);this._emissiveTexture=d}}_updateFBO(d,p){const j=d.fb,E=this.painter.context,O=E.gl,R=this.drapeBufferSize;if(p){const B=new i.T(E,{width:R[0],height:R[1],data:null},O.R8);B.bind(O.LINEAR,O.CLAMP_TO_EDGE),d.emissiveTex=B,j.createColorAttachment(E,1),j.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,j.removeColorAttachment(E,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const p=this._style._mergedLayers[d],j=p.isHidden(this.painter.transform.zoom);return p.type==="hillshade"||p.type==="custom"?!j&&p.shouldRedrape():!j&&p.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const j of this._style.getSources())if(j instanceof Tm){d=!0;break}if(!d)return;const p={};for(let j=0;jH>B.end)||i.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=j}_setupRenderCache(d){const p=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,p.renderCache.length>p.renderCachePool.length){const R=Object.values(p.proxyCachedFBO);p.proxyCachedFBO={};for(let B=0;B=0;R--){const B=j[R];if(p.getTileByID(B.key),p.proxyCachedFBO[B.key]!==void 0){const H=d[B.key],X=this.proxyToSource[B.key];let te=0;for(const de in X){const ce=X[de],he=H[de];if(!he||he.length!==ce.length||ce.some((ke,be)=>ke!==he[be]||E[de]&&E[de].hasOwnProperty(ke.key))){te=-1;break}++te}for(const de in p.proxyCachedFBO[B.key])p.renderCache[p.proxyCachedFBO[B.key][de]].dirty=te<0||te!==Object.values(H).length}}const O=[...this._drapedRenderBatches];O.sort((R,B)=>B.end-B.start-(R.end-R.start));for(const R of O)for(const B of j){if(p.proxyCachedFBO[B.key])continue;let H=p.renderCachePool.pop();H===void 0&&p.renderCache.length<50&&(H=p.renderCache.length,p.renderCache.push(this._createFBO())),H!==void 0&&(p.proxyCachedFBO[B.key]={},p.proxyCachedFBO[B.key][R.start]=H,p.renderCache[H].dirty=!0)}this._tilesDirty={}}_setupStencil(d,p,j,E){if(!E||!this._sourceTilesOverlap[E.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const O=this.painter.context,R=O.gl;if(p.length<=1)return void(this._overlapStencilType=!1);let B;if(j.isTileClipped())B=p.length,this._overlapStencilMode.test={func:R.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(p[0].overscaledZ>p[p.length-1].overscaledZ))return void(this._overlapStencilType=!1);B=1,this._overlapStencilMode.test={func:R.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,j.isTileClipped()&&this._renderTileClippingMasks(p,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):Hn.disabled}_renderTileClippingMasks(d,p){const j=this.painter,E=this.painter.context,O=E.gl;j._tileClippingMaskIDs={},E.setColorMode(ms.disabled),E.setDepthMode(yn.disabled);const R=j.getOrCreateProgram("clippingMask");for(const B of d){const H=j._tileClippingMaskIDs[B.key]=--p;R.draw(j,O.TRIANGLES,yn.disabled,new Hn({func:O.ALWAYS,mask:0},H,255,O.KEEP,O.KEEP,O.REPLACE),ms.disabled,Un.disabled,Xv(B.projMatrix),"$clipping",j.tileExtentBuffer,j.quadTriangleIndexBuffer,j.tileExtentSegments)}}pointCoordinate(d){const p=this.painter.transform;if(d.x<0||d.x>p.width||d.y<0||d.y>p.height)return null;const j=[d.x,d.y,1,1];i.aC(j,j,p.pixelMatrixInverse),i.cK(j,j,1/j[3]),j[0]/=p.worldSize,j[1]/=p.worldSize;const E=p._camera.position,O=i.cf(1,p.center.lat),R=[E[0],E[1],E[2]/O,0],B=i.da([],j.slice(0,3),R);i.aw(B,B);const H=this.raycast(R,B,this._exaggeration);return H!==null&&H?(i.bH(R,R,B,H),R[3]=R[2],R[2]*=O,R):null}_setupProxiedCoordsForOrtho(d,p,j){if(d.getSource()instanceof i.aU)return this._setupProxiedCoordsForImageSource(d,p,j);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const E=this.proxiedCoords[d.id]=[],O=this.proxyCoords;for(let H=0;Hte.overscaledZ-X.overscaledZ)}_setupProxiedCoordsForImageSource(d,p,j){if(!d.getSource().loaded())return;const E=this.proxiedCoords[d.id]=[],O=this.proxyCoords,R=d.getSource(),B=R.tileID;if(!B)return;const H=new i.P(B.x,B.y)._div(1<(de.min.x=Math.min(de.min.x,ce.x-H.x),de.min.y=Math.min(de.min.y,ce.y-H.y),de.max.x=Math.max(de.max.x,ce.x-H.x),de.max.y=Math.max(de.max.y,ce.y-H.y),de),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),te=(de,ce)=>{const he=de.wrap+de.canonical.x/(1<Re+X.max.x||ke+beDe+X.max.y};for(let de=0;deR.key===p.tileID.key);if(O)return O}if(p.tileID.key!==d.key){const O=d.canonical.z-p.tileID.canonical.z;let R,B,H;E=i.bC();const X=p.tileID.wrap-d.wrap<0?(R=i.al>>O,B=R*((p.tileID.canonical.x<=de){const ce=d.canonical.z-de;p.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,p.transform.tileZoom),R=new i.aQ(B,d.wrap,de,d.canonical.x>>ce,d.canonical.y>>ce)):ce!==0&&(B=de,R=new i.aQ(B,d.wrap,de,d.canonical.x>>ce,d.canonical.y>>ce))}R.key!==d.key&&(X.push(R.key),j=p.getTile(R))}const te=de=>{X.forEach(ce=>{E[ce]=de}),X.length=0};for(B-=1;B>=H&&(!j||!j.hasData());B--){j&&te(j.tileID.key);const de=R.calculateScaledKey(B);if(j=p.getTileByID(de),j&&j.hasData())break;const ce=E[de];if(ce===null)break;ce===void 0?X.push(de):j=p.getTileByID(ce)}return te(j?j.tileID.key:null),j&&j.hasData()?j:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,p){let j=this._tilesDirty[d];j||(j=this._tilesDirty[d]={}),j[p.key]=!0}}function m0(w,d,p){const j=function(B,H,X){const te=i.bJ(H,B),de=i.bJ(X,[.2126,.7152,.0722]),ce=(ke,be,Re)=>(1-Re)*ke+Re*be,he=ce(1-.3*Math.min(de,1),1,Math.min(te+1,1));return ce(.92,1,Math.asin(i.aA(H[2],-1,1))/Math.PI+.5)*he}(w,[0,0,1],d),E=[0,0,0];i.c5(E,p.slice(0,3),j);const O=[0,0,0];i.c5(O,d.slice(0,3),w[2]);const R=[0,0,0];return i.d8(R,E,O),i.db(R)}const Qie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Jie=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class ZP{static cacheKey(d,p,j,E){const O=[p];E&&O.push(E.cacheKey);for(const R of j)d.usedDefines.has(R)&&O.push(R);return O.join("/")}constructor(d,p,j,E,O,R){const B=d.gl;this.program=B.createProgram(),this.configuration=E,this.name=p,this.fixedDefines=[...R];const H=`#version 300 es ${(E?E.defines():[]).concat(R.map(be=>`#define ${be}`)).join(` `)}`,X=[H,qie];for(const be of j.fragmentIncludes)X.push(eg[be]);X.push(j.fragmentSource);const te=X.join(` `),de=[H,zP];for(const be of j.vertexIncludes)de.push(eg[be]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&j.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&de.push("uniform int u_instanceID;"),de.push(j.vertexSource);let ce=de.join(` `);this.forceManualRenderingForInstanceIDShaders&&(ce=ce.replaceAll("gl_InstanceID","u_instanceID"));const he=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(he,te),B.compileShader(he),B.attachShader(this.program,he);const ke=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(ke,ce),B.compileShader(ke),B.attachShader(this.program,ke),this.attributes={},B.linkProgram(this.program),B.deleteShader(ke),B.deleteShader(he),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=E?E.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(be=>({u_instanceID:new i.ch(be)}))(d)),(R.includes("TERRAIN")||p.includes("symbol")||p.includes("circle"))&&(this.terrainUniforms=(be=>({u_dem:new i.ch(be),u_dem_prev:new i.ch(be),u_dem_tl:new i.ck(be),u_dem_scale:new i.cj(be),u_dem_tl_prev:new i.ck(be),u_dem_scale_prev:new i.cj(be),u_dem_size:new i.cj(be),u_dem_lerp:new i.cj(be),u_exaggeration:new i.cj(be),u_depth:new i.ch(be),u_depth_size_inv:new i.ck(be),u_depth_range_unpack:new i.ck(be),u_occluder_half_size:new i.cj(be),u_occlusion_depth_offset:new i.cj(be),u_meter_to_dem:new i.cj(be),u_label_plane_matrix_inv:new i.cl(be)}))(d)),R.includes("GLOBE")&&(this.globeUniforms=(be=>({u_tile_tl_up:new i.ci(be),u_tile_tr_up:new i.ci(be),u_tile_br_up:new i.ci(be),u_tile_bl_up:new i.ci(be),u_tile_up_scale:new i.cj(be)}))(d)),R.includes("FOG")&&(this.fogUniforms=(be=>({u_fog_matrix:new i.cl(be),u_fog_range:new i.ck(be),u_fog_color:new i.d3(be),u_fog_horizon_blend:new i.cj(be),u_fog_vertical_limit:new i.ck(be),u_fog_temporal_offset:new i.cj(be),u_frustum_tl:new i.ci(be),u_frustum_tr:new i.ci(be),u_frustum_br:new i.ci(be),u_frustum_bl:new i.ci(be),u_globe_pos:new i.ci(be),u_globe_radius:new i.cj(be),u_globe_transition:new i.cj(be),u_is_globe:new i.ch(be),u_viewport:new i.ck(be)}))(d)),R.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(be=>({u_cutoff_params:new i.d3(be)}))(d)),R.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(be=>({u_lighting_ambient_color:new i.ci(be),u_lighting_directional_dir:new i.ci(be),u_lighting_directional_color:new i.ci(be),u_ground_radiance:new i.ci(be)}))(d)),R.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(be=>({u_light_matrix_0:new i.cl(be),u_light_matrix_1:new i.cl(be),u_fade_range:new i.ck(be),u_shadow_normal_offset:new i.ci(be),u_shadow_intensity:new i.cj(be),u_shadow_texel_size:new i.cj(be),u_shadow_map_resolution:new i.cj(be),u_shadow_direction:new i.ci(be),u_shadow_bias:new i.ci(be),u_shadowmap_0:new i.ch(be),u_shadowmap_1:new i.ch(be)}))(d)))}getAttributeLocation(d,p){let j=this.attributes[p];return j===void 0&&(j=this.attributes[p]=d.getAttribLocation(this.program,p)),j}setTerrainUniformValues(d,p){if(!this.terrainUniforms)return;const j=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const E in p)j[E]&&j[E].set(this.program,E,p[E])}}setGlobeUniformValues(d,p){if(!this.globeUniforms)return;const j=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const E in p)j[E]&&j[E].set(this.program,E,p[E])}}setFogUniformValues(d,p){if(!this.fogUniforms)return;const j=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const E in p)j[E].set(this.program,E,p[E])}}setCutoffUniformValues(d,p){if(!this.cutoffUniforms)return;const j=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const E in p)j[E].set(this.program,E,p[E])}}setLightsUniformValues(d,p){if(!this.lightsUniforms)return;const j=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const E in p)j[E].set(this.program,E,p[E])}}setShadowUniformValues(d,p){if(this.failedToCreate||!this.shadowUniforms)return;const j=this.shadowUniforms;d.program.set(this.program);for(const E in p)j[E].set(this.program,E,p[E])}_drawDebugWireframe(d,p,j,E,O,R,B,H,X,te){const de=d.options.wireframe;if(de.terrain===!1&&de.layers2D===!1&&de.layers3D===!1)return;const ce=d.context;if(!(!(!de.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!de.layers2D||d._terrain&&d._terrain.renderingToTexture||!Qie.includes(this.name))||!(!de.layers3D||!Jie.includes(this.name))))return;const he=ce.gl,ke=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,ce);if(!ke)return;const be=[...this.fixedDefines,"DEBUG_WIREFRAME"],Re=d.getOrCreateProgram(this.name,{config:this.configuration,defines:be});ce.program.set(Re.program);const De=(Ge,jt,gt)=>{if(jt[Ge]&>[Ge])for(const _t in jt[Ge])gt[Ge][_t]&>[Ge][_t].set(gt.program,_t,jt[Ge][_t].current)};X&&X.setUniforms(Re.program,ce,Re.binderUniforms,B,{zoom:H}),De("fixedUniforms",this,Re),De("terrainUniforms",this,Re),De("globeUniforms",this,Re),De("fogUniforms",this,Re),De("lightsUniforms",this,Re),De("shadowUniforms",this,Re),ke.bind(),ce.setColorMode(new ms([he.ONE,he.ONE_MINUS_SRC_ALPHA,he.ZERO,he.ONE],i.ao.transparent,[!0,!0,!0,!1])),ce.setDepthMode(new yn(p.func===he.LESS?he.LEQUAL:p.func,yn.ReadOnly,p.range)),ce.setStencilMode(Hn.disabled);const We=3*R.primitiveLength*2,nt=3*R.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Ge=te||1;for(let jt=0;jt1?he.drawElementsInstanced(he.LINES,We,he.UNSIGNED_SHORT,nt,te):he.drawElements(he.LINES,We,he.UNSIGNED_SHORT,nt);O.bind(),ce.program.set(this.program),ce.setDepthMode(p),ce.setStencilMode(j),ce.setColorMode(E)}checkUniforms(d,p,j){if(this.fixedDefines.includes(p)){for(const E of Object.keys(j))if(!j[E].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${E} not set but required by ${p} being defined`)}}draw(d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re){const De=d.context,We=De.gl;if(this.failedToCreate)return;De.program.set(this.program),De.setDepthMode(j),De.setStencilMode(E),De.setColorMode(O),De.setCullFace(R);for(const[pt,ht]of this.fixedUniformsEntries)ht.set(this.program,pt,B[pt]);ke&&ke.setUniforms(this.program,De,this.binderUniforms,ce,{zoom:he});const nt={[We.POINTS]:1,[We.LINES]:2,[We.TRIANGLES]:3,[We.LINE_STRIP]:1}[p];this.checkUniforms(H,"RENDER_SHADOWS",this.shadowUniforms);const Ge=be||[],jt=ke?ke.getPaintVertexBuffers():[],gt=p===We.TRIANGLES&&te,_t=Re&&Re>0?1:void 0;for(const pt of de.get()){const ht=pt.vaos||(pt.vaos={});if((ht[H]||(ht[H]=new Vie)).bind(De,this,X,jt,te,pt.vertexOffset,Ge,_t),this.forceManualRenderingForInstanceIDShaders){const St=Re||1;for(let Rt=0;Rt1?We.drawElementsInstanced(p,pt.primitiveLength*nt,We.UNSIGNED_SHORT,pt.primitiveOffset*nt*2,Re):te?We.drawElements(p,pt.primitiveLength*nt,We.UNSIGNED_SHORT,pt.primitiveOffset*nt*2):We.drawArrays(p,pt.vertexOffset,pt.vertexLength);gt&&this._drawDebugWireframe(d,j,E,O,te,pt,ce,he,ke,Re)}}}function YP(w,d,p=0){const j=Math.pow(2,d.tileID.overscaledZ),E=d.tileSize*Math.pow(2,w.transform.tileZoom)/j,O=E*(d.tileID.canonical.x+d.tileID.wrap*j),R=E*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture?d.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/i.ay(d,1,w.transform.tileZoom),u_pixel_coord_upper:[O>>16,R>>16],u_pixel_coord_lower:[65535&O,65535&R],u_pattern_transition:p}}const hN={terrain:0,flat:1},eoe=i.bC(),mN=(w,d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re,De)=>{const We=d.style.light,nt=We.properties.get("position"),Ge=[nt.x,nt.y,nt.z],jt=i.dO();We.properties.get("anchor")==="viewport"&&(i.dP(jt,-d.transform.angle),i.dQ(Ge,Ge,jt));const gt=We.properties.get("color").toPremultipliedRenderColor(null),_t=d.transform,pt={u_matrix:w,u_lightpos:Ge,u_lightintensity:We.properties.get("intensity"),u_lightcolor:[gt.r,gt.g,gt.b],u_vertical_gradient:+p,u_opacity:j,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:eoe,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:hN[X],u_base_type:hN[te],u_ao:E,u_edge_radius:O,u_width_scale:R,u_flood_light_color:ke,u_vertical_scale:be,u_flood_light_intensity:Re,u_ground_shadow_factor:De};return _t.projection.name==="globe"&&(pt.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:w,u_edge_radius:d,u_width_scale:p,u_vertical_scale:j,u_height_type:hN[E],u_base_type:hN[O]}),XP=(w,d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re,De)=>{const We=mN(w,d,p,j,E,O,R,B,X,te,de,ce,he,ke,be,Re,1,[0,0,0]),nt={u_height_factor:-Math.pow(2,B.overscaledZ)/H.tileSize/8};return Object.assign(We,YP(d,H,De),nt)},f0=(w,d,p,j,E,O,R,B,H,X,te)=>({u_matrix:d,u_opacity:p,u_ao_pass:j?1:0,u_meter_to_tile:E,u_ao:O,u_flood_light_intensity:R,u_flood_light_color:B,u_attenuation:H,u_edge_radius:X,u_fb:0,u_fb_size:te,u_dynamic_offset:1}),M5=(w,d,p)=>({u_matrix:w,u_emissive_strength:d,u_ground_shadow_factor:p}),T5=(w,d,p,j,E,O=0)=>Object.assign(M5(w,d,E),YP(p,j,O)),QP=(w,d,p,j)=>({u_matrix:w,u_world:p,u_emissive_strength:d,u_ground_shadow_factor:j}),A5=(w,d,p,j,E,O,R=0)=>Object.assign(T5(w,d,p,j,O,R),{u_world:E}),rg=(w,d)=>({u_matrix:w,u_ground_shadow_factor:d}),yx=(w,d,p,j,E)=>({u_matrix:w,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:p,u_height_scale:j,u_reset_depth:E}),fN=(w,d,p,j,E,O,R,B,H)=>({u_matrix:w,u_normal_matrix:d,u_opacity:p,u_faux_facade_ao_intensity:j,u_camera_pos:E,u_tile_to_meter:O,u_facade_emissive_chance:R,u_flood_light_color:B,u_flood_light_intensity:H}),JP=w=>({u_matrix:w}),ng=w=>({u_matrix:w}),E5=(w,d,p,j,E,O,R,B)=>{const H=i.al/O.tileSize;return{u_matrix:w,u_inv_rot_matrix:d,u_camera_to_center_distance:p.getCameraToCenterDistance(B),u_extrude_scale:[p.pixelsToGLUnits[0]/H,p.pixelsToGLUnits[1]/H],u_zoom_transition:j,u_tile_id:R,u_merc_center:E}},Jv=(w,d,p=1)=>({u_matrix:w,u_color:d,u_overlay:0,u_overlay_scale:p}),e6=i.bC(),t6=(w,d,p,j,E,O,R)=>{const B=w.transform,H=B.projection.name==="globe",X=H?i.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:i.ay(p,1,O),te={u_matrix:d.projMatrix,u_extrude_scale:X,u_intensity:R,u_inv_rot_matrix:e6,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(H){te.u_inv_rot_matrix=j,te.u_merc_center=E,te.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:w,u_normalize_matrix:d,u_globe_matrix:p,u_merc_matrix:j,u_grid_matrix:E,u_tl_parent:O,u_scale_parent:X,u_fade_t:te.mix,u_opacity:te.opacity*de.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:de.paint.get("raster-brightness-min"),u_brightness_high:de.paint.get("raster-brightness-max"),u_saturation_factor:i.dT(de.paint.get("raster-saturation")),u_contrast_factor:i.dS(de.paint.get("raster-contrast")),u_spin_weights:n6(de.paint.get("raster-hue-rotate")),u_perspective_transform:ce,u_raster_elevation:he,u_zoom_transition:R,u_merc_center:B,u_cutoff_params:H,u_colorization_mix:pN(i.dU,be,De),u_colorization_offset:gN(i.dU,Re,De),u_color_ramp:ke,u_texture_offset:[nt/(We+2*nt),We/(We+2*nt)],u_texture_res:[We+2*nt,We+2*nt],u_emissive_strength:Ge});function n6(w){w*=Math.PI/180;const d=Math.sin(w),p=Math.cos(w);return[(2*p+1)/3,(-Math.sqrt(3)*d-p+1)/3,(Math.sqrt(3)*d-p+1)/3]}const Dm=.05,toe=(w,d,p,j,E,O,R,B,H,X,te,de)=>({u_matrix:w,u_normalize_matrix:d,u_globe_matrix:p,u_merc_matrix:j,u_grid_matrix:E,u_tl_parent:O,u_scale_parent:X,u_fade_t:te.mix,u_opacity:te.opacity,u_image0:0,u_image1:1,u_raster_elevation:de,u_zoom_transition:R,u_merc_center:B,u_cutoff_params:H}),roe=(w,d,p,j,E,O,R,B,H,X)=>({u_particle_texture:w,u_particle_texture_side_len:d,u_tile_offset:p,u_velocity:j,u_color_ramp:O,u_velocity_res:E,u_max_speed:R,u_uv_offset:B,u_data_scale:[255*H[0],255*H[1]],u_data_offset:X,u_particle_pos_scale:1.1,u_particle_pos_offset:[Dm,Dm]}),s6=(w,d,p,j,E,O,R,B,H,X)=>({u_particle_texture:w,u_particle_texture_side_len:d,u_velocity:p,u_velocity_res:j,u_max_speed:E,u_speed_factor:O,u_reset_rate:R,u_rand_seed:Math.random(),u_uv_offset:B,u_data_scale:[255*H[0],255*H[1]],u_data_offset:X,u_particle_pos_scale:1.1,u_particle_pos_offset:[Dm,Dm]}),a6=i.bC(),xN=(w,d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re,De,We,nt,Ge,jt,gt,_t)=>{const pt=E.transform,ht={u_is_size_zoom_constant:+(w==="constant"||w==="source"),u_is_size_feature_constant:+(w==="constant"||w==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:pt.getCameraToCenterDistance(We),u_rotate_symbol:+p,u_aspect_ratio:pt.width/pt.height,u_fade_change:E.options.fadeDuration?E.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:R,u_coord_matrix:B,u_is_text:+X,u_elevation_from_sea:H?1:0,u_pitch_with_map:+j,u_texsize:te,u_texsize_icon:de,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:a6,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:a6,u_up_vector:[0,-1,0],u_color_adj_mat:jt,u_icon_transition:gt||0,u_gamma_scale:j?E.transform.getCameraToCenterDistance(We)*Math.cos(E.terrain?0:E.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:_t||1,u_ground_shadow_factor:nt,u_inv_matrix:i.bl(i.bC(),R),u_normal_scale:Ge,u_lutTexture:Pl.LUT};return We.name==="globe"&&(ht.u_tile_id=[he.canonical.x,he.canonical.y,1<({u_matrix:w,u_emissive_strength:d,u_opacity:p,u_color:j}),sg=(w,d,p,j,E,O,R,B,H)=>Object.assign(function(X,te,de,ce,he,ke){const{width:be,height:Re}=ce.imageManager.getPixelSize(te),De=Math.pow(2,ke.tileID.overscaledZ),We=ke.tileSize*Math.pow(2,ce.transform.tileZoom)/De,nt=We*(ke.tileID.canonical.x+ke.tileID.wrap*De),Ge=We*ke.tileID.canonical.y;return{u_image:0,u_pattern_tl:de.tl,u_pattern_br:de.br,u_texsize:[be,Re],u_pattern_size:de.displaySize,u_pattern_units_to_pixels:he?[ce.transform.width,-1*ce.transform.height]:[1/i.ay(ke,1,ce.transform.tileZoom),1/i.ay(ke,1,ce.transform.tileZoom)],u_pixel_coord_upper:[nt>>16,Ge>>16],u_pixel_coord_lower:[65535&nt,65535&Ge]}}(0,O,R,j,B,H),{u_matrix:w,u_emissive_strength:d,u_opacity:p}),p0=new Float32Array(i.bA([])),vx=(w,d,p,j,E,O,R,B,H,X,te,de,ce,he=[0,0,0],ke,be,Re)=>{const De=E.style.light,We=De.properties.get("position"),nt=[-We.x,-We.y,We.z],Ge=i.dO();De.properties.get("anchor")==="viewport"&&(i.dP(Ge,-E.transform.angle),i.dQ(nt,nt,Ge));const jt=te.alphaMode==="MASK",gt=De.properties.get("color").toNonPremultipliedRenderColor(null),_t=ce.paint.get("model-ambient-occlusion-intensity"),pt=ce.paint.get("model-color").constantOr(i.ao.white).toNonPremultipliedRenderColor(null);return pt.a=ce.paint.get("model-color-mix-intensity").constantOr(0),Re&&(pt.r=Re[0],pt.g=Re[1],pt.b=Re[2],pt.a=Re[3]),be&&(pt.r=be.color.r,pt.g=be.color.g,pt.b=be.color.b,pt.a=be.colorMix,de=be.emissionStrength,O*=be.opacity),{u_matrix:w,u_lighting_matrix:d,u_normal_matrix:p,u_node_matrix:j||p0,u_lightpos:nt,u_lightintensity:De.properties.get("intensity"),u_lightcolor:[gt.r,gt.g,gt.b],u_camera_pos:he,u_opacity:O,u_baseTextureIsAlpha:0,u_alphaMask:+jt,u_alphaCutoff:te.alphaCutoff,u_baseColorFactor:R.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:H,u_roughnessFactor:X,u_baseColorTexture:Pl.BaseColor,u_metallicRoughnessTexture:Pl.MetallicRoughness,u_normalTexture:Pl.Normal,u_occlusionTexture:Pl.Occlusion,u_emissionTexture:Pl.Emission,u_lutTexture:Pl.LUT,u_color_mix:pt.toArray01(),u_aoIntensity:_t,u_emissive_strength:de,u_occlusionTextureTransform:ke||[0,0,0,0]}},I5=(w,d=p0,p=p0)=>({u_matrix:w,u_instance:d,u_node_matrix:p}),yN={fillExtrusion:w=>({u_matrix:new i.cl(w),u_lightpos:new i.ci(w),u_lightintensity:new i.cj(w),u_lightcolor:new i.ci(w),u_vertical_gradient:new i.cj(w),u_opacity:new i.cj(w),u_edge_radius:new i.cj(w),u_width_scale:new i.cj(w),u_ao:new i.ck(w),u_height_type:new i.ch(w),u_base_type:new i.ch(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_up_dir:new i.ci(w),u_height_lift:new i.cj(w),u_flood_light_color:new i.ci(w),u_vertical_scale:new i.cj(w),u_flood_light_intensity:new i.cj(w),u_ground_shadow_factor:new i.ci(w)}),fillExtrusionDepth:w=>({u_matrix:new i.cl(w),u_edge_radius:new i.cj(w),u_width_scale:new i.cj(w),u_vertical_scale:new i.cj(w),u_height_type:new i.ch(w),u_base_type:new i.ch(w)}),fillExtrusionPattern:w=>({u_matrix:new i.cl(w),u_lightpos:new i.ci(w),u_lightintensity:new i.cj(w),u_lightcolor:new i.ci(w),u_vertical_gradient:new i.cj(w),u_height_factor:new i.cj(w),u_edge_radius:new i.cj(w),u_width_scale:new i.cj(w),u_ao:new i.ck(w),u_height_type:new i.ch(w),u_base_type:new i.ch(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_up_dir:new i.ci(w),u_height_lift:new i.cj(w),u_image:new i.ch(w),u_texsize:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_tile_units_to_pixels:new i.cj(w),u_opacity:new i.cj(w),u_pattern_transition:new i.cj(w)}),fillExtrusionGroundEffect:w=>({u_matrix:new i.cl(w),u_opacity:new i.cj(w),u_ao_pass:new i.cj(w),u_meter_to_tile:new i.cj(w),u_ao:new i.ck(w),u_flood_light_intensity:new i.cj(w),u_flood_light_color:new i.ci(w),u_attenuation:new i.cj(w),u_edge_radius:new i.cj(w),u_fb:new i.ch(w),u_fb_size:new i.cj(w),u_dynamic_offset:new i.cj(w)}),fill:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_ground_shadow_factor:new i.ci(w)}),fillPattern:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_image:new i.ch(w),u_texsize:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_tile_units_to_pixels:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_pattern_transition:new i.cj(w)}),fillOutline:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_world:new i.ck(w),u_ground_shadow_factor:new i.ci(w)}),fillOutlinePattern:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_world:new i.ck(w),u_image:new i.ch(w),u_texsize:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_tile_units_to_pixels:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_pattern_transition:new i.cj(w)}),building:w=>({u_matrix:new i.cl(w),u_normal_matrix:new i.cl(w),u_opacity:new i.cj(w),u_faux_facade_ao_intensity:new i.cj(w),u_camera_pos:new i.ci(w),u_tile_to_meter:new i.cj(w),u_facade_emissive_chance:new i.cj(w),u_flood_light_color:new i.ci(w),u_flood_light_intensity:new i.cj(w)}),buildingBloom:w=>({u_matrix:new i.cl(w)}),buildingDepth:w=>({u_matrix:new i.cl(w)}),elevatedStructuresDepth:w=>({u_matrix:new i.cl(w),u_depth_bias:new i.cj(w)}),elevatedStructures:w=>({u_matrix:new i.cl(w),u_ground_shadow_factor:new i.ci(w)}),elevatedStructuresDepthReconstruct:w=>({u_matrix:new i.cl(w),u_camera_pos:new i.ci(w),u_depth_bias:new i.cj(w),u_height_scale:new i.cj(w),u_reset_depth:new i.cj(w)}),circle:i.dY,collisionBox:w=>({u_matrix:new i.cl(w),u_inv_rot_matrix:new i.cl(w),u_camera_to_center_distance:new i.cj(w),u_extrude_scale:new i.ck(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_tile_id:new i.ci(w)}),collisionCircle:w=>({u_matrix:new i.cl(w),u_inv_matrix:new i.cl(w),u_camera_to_center_distance:new i.cj(w),u_viewport_size:new i.ck(w)}),debug:w=>({u_color:new i.dB(w),u_matrix:new i.cl(w),u_overlay:new i.ch(w),u_overlay_scale:new i.cj(w)}),clippingMask:w=>({u_matrix:new i.cl(w)}),heatmap:w=>({u_extrude_scale:new i.cj(w),u_intensity:new i.cj(w),u_matrix:new i.cl(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_up_dir:new i.ci(w)}),heatmapTexture:w=>({u_image:new i.ch(w),u_color_ramp:new i.ch(w),u_opacity:new i.cj(w)}),hillshade:w=>({u_matrix:new i.cl(w),u_image:new i.ch(w),u_latrange:new i.ck(w),u_light:new i.ck(w),u_shadow:new i.dB(w),u_highlight:new i.dB(w),u_emissive_strength:new i.cj(w),u_accent:new i.dB(w)}),hillshadePrepare:w=>({u_matrix:new i.cl(w),u_image:new i.ch(w),u_dimension:new i.ck(w),u_zoom:new i.cj(w)}),line:i.dX,linePattern:i.dW,raster:w=>({u_matrix:new i.cl(w),u_normalize_matrix:new i.cl(w),u_globe_matrix:new i.cl(w),u_merc_matrix:new i.cl(w),u_grid_matrix:new i.dC(w),u_tl_parent:new i.ck(w),u_scale_parent:new i.cj(w),u_fade_t:new i.cj(w),u_opacity:new i.cj(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_brightness_low:new i.cj(w),u_brightness_high:new i.cj(w),u_saturation_factor:new i.cj(w),u_contrast_factor:new i.cj(w),u_spin_weights:new i.ci(w),u_perspective_transform:new i.ck(w),u_raster_elevation:new i.cj(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_cutoff_params:new i.d3(w),u_colorization_mix:new i.d3(w),u_colorization_offset:new i.cj(w),u_color_ramp:new i.ch(w),u_texture_offset:new i.ck(w),u_texture_res:new i.ck(w),u_emissive_strength:new i.cj(w)}),rasterParticle:w=>({u_matrix:new i.cl(w),u_normalize_matrix:new i.cl(w),u_globe_matrix:new i.cl(w),u_merc_matrix:new i.cl(w),u_grid_matrix:new i.dC(w),u_tl_parent:new i.ck(w),u_scale_parent:new i.cj(w),u_fade_t:new i.cj(w),u_opacity:new i.cj(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_raster_elevation:new i.cj(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_cutoff_params:new i.d3(w)}),rasterParticleTexture:w=>({u_texture:new i.ch(w),u_opacity:new i.cj(w)}),rasterParticleDraw:w=>({u_particle_texture:new i.ch(w),u_particle_texture_side_len:new i.cj(w),u_tile_offset:new i.ck(w),u_velocity:new i.ch(w),u_color_ramp:new i.ch(w),u_velocity_res:new i.ck(w),u_max_speed:new i.cj(w),u_uv_offset:new i.ck(w),u_data_scale:new i.ck(w),u_data_offset:new i.cj(w),u_particle_pos_scale:new i.cj(w),u_particle_pos_offset:new i.ck(w)}),rasterParticleUpdate:w=>({u_particle_texture:new i.ch(w),u_particle_texture_side_len:new i.cj(w),u_velocity:new i.ch(w),u_velocity_res:new i.ck(w),u_max_speed:new i.cj(w),u_speed_factor:new i.cj(w),u_reset_rate:new i.cj(w),u_rand_seed:new i.cj(w),u_uv_offset:new i.ck(w),u_data_scale:new i.ck(w),u_data_offset:new i.cj(w),u_particle_pos_scale:new i.cj(w),u_particle_pos_offset:new i.ck(w)}),symbol:w=>({u_is_size_zoom_constant:new i.ch(w),u_is_size_feature_constant:new i.ch(w),u_size_t:new i.cj(w),u_size:new i.cj(w),u_camera_to_center_distance:new i.cj(w),u_rotate_symbol:new i.ch(w),u_aspect_ratio:new i.cj(w),u_fade_change:new i.cj(w),u_matrix:new i.cl(w),u_label_plane_matrix:new i.cl(w),u_coord_matrix:new i.cl(w),u_is_text:new i.ch(w),u_elevation_from_sea:new i.ch(w),u_pitch_with_map:new i.ch(w),u_texsize:new i.ck(w),u_texsize_icon:new i.ck(w),u_texture:new i.ch(w),u_texture_icon:new i.ch(w),u_gamma_scale:new i.cj(w),u_device_pixel_ratio:new i.cj(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_camera_forward:new i.ci(w),u_tile_matrix:new i.cl(w),u_up_vector:new i.ci(w),u_ecef_origin:new i.ci(w),u_is_halo:new i.ch(w),u_icon_transition:new i.cj(w),u_color_adj_mat:new i.cl(w),u_scale_factor:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_inv_matrix:new i.cl(w),u_normal_scale:new i.cj(w),u_lutTexture:new i.ch(w)}),background:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_opacity:new i.cj(w),u_color:new i.dB(w)}),backgroundPattern:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_opacity:new i.cj(w),u_image:new i.ch(w),u_pattern_tl:new i.ck(w),u_pattern_br:new i.ck(w),u_texsize:new i.ck(w),u_pattern_size:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_pattern_units_to_pixels:new i.ck(w)}),terrainRaster:w=>({u_matrix:new i.cl(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_skirt_height:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_emissive_texture_available:new i.cj(w)}),skybox:w=>({u_matrix:new i.cl(w),u_sun_direction:new i.ci(w),u_cubemap:new i.ch(w),u_opacity:new i.cj(w),u_temporal_offset:new i.cj(w)}),skyboxGradient:w=>({u_matrix:new i.cl(w),u_color_ramp:new i.ch(w),u_center_direction:new i.ci(w),u_radius:new i.cj(w),u_opacity:new i.cj(w),u_temporal_offset:new i.cj(w)}),skyboxCapture:w=>({u_matrix_3f:new i.dC(w),u_sun_direction:new i.ci(w),u_sun_intensity:new i.cj(w),u_color_tint_r:new i.d3(w),u_color_tint_m:new i.d3(w),u_luminance:new i.cj(w)}),globeRaster:w=>({u_proj_matrix:new i.cl(w),u_globe_matrix:new i.cl(w),u_normalize_matrix:new i.cl(w),u_merc_matrix:new i.cl(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_grid_matrix:new i.dC(w),u_skirt_height:new i.cj(w),u_far_z_cutoff:new i.cj(w),u_frustum_tl:new i.ci(w),u_frustum_tr:new i.ci(w),u_frustum_br:new i.ci(w),u_frustum_bl:new i.ci(w),u_globe_pos:new i.ci(w),u_globe_radius:new i.cj(w),u_viewport:new i.ck(w),u_emissive_texture_available:new i.cj(w)}),globeAtmosphere:w=>({u_frustum_tl:new i.ci(w),u_frustum_tr:new i.ci(w),u_frustum_br:new i.ci(w),u_frustum_bl:new i.ci(w),u_horizon:new i.cj(w),u_transition:new i.cj(w),u_fadeout_range:new i.cj(w),u_atmosphere_fog_color:new i.d3(w),u_high_color:new i.d3(w),u_space_color:new i.d3(w),u_temporal_offset:new i.cj(w),u_horizon_angle:new i.cj(w)}),model:w=>({u_matrix:new i.cl(w),u_lighting_matrix:new i.cl(w),u_normal_matrix:new i.cl(w),u_node_matrix:new i.cl(w),u_lightpos:new i.ci(w),u_lightintensity:new i.cj(w),u_lightcolor:new i.ci(w),u_camera_pos:new i.ci(w),u_opacity:new i.cj(w),u_baseColorFactor:new i.d3(w),u_emissiveFactor:new i.d3(w),u_metallicFactor:new i.cj(w),u_roughnessFactor:new i.cj(w),u_baseTextureIsAlpha:new i.ch(w),u_alphaMask:new i.ch(w),u_alphaCutoff:new i.cj(w),u_baseColorTexture:new i.ch(w),u_metallicRoughnessTexture:new i.ch(w),u_normalTexture:new i.ch(w),u_occlusionTexture:new i.ch(w),u_emissionTexture:new i.ch(w),u_lutTexture:new i.ch(w),u_color_mix:new i.d3(w),u_aoIntensity:new i.cj(w),u_emissive_strength:new i.cj(w),u_occlusionTextureTransform:new i.d3(w)}),modelDepth:w=>({u_matrix:new i.cl(w),u_instance:new i.cl(w),u_node_matrix:new i.cl(w)}),groundShadow:w=>({u_matrix:new i.cl(w),u_ground_shadow_factor:new i.ci(w)}),stars:w=>({u_matrix:new i.cl(w),u_up:new i.ci(w),u_right:new i.ci(w),u_intensity_multiplier:new i.cj(w)}),snowParticle:w=>({u_modelview:new i.cl(w),u_projection:new i.cl(w),u_time:new i.cj(w),u_cam_pos:new i.ci(w),u_velocityConeAperture:new i.cj(w),u_velocity:new i.cj(w),u_horizontalOscillationRadius:new i.cj(w),u_horizontalOscillationRate:new i.cj(w),u_boxSize:new i.cj(w),u_billboardSize:new i.cj(w),u_simpleShapeParameters:new i.ck(w),u_screenSize:new i.ck(w),u_thinningCenterPos:new i.ck(w),u_thinningShape:new i.ci(w),u_thinningAffectedRatio:new i.cj(w),u_thinningParticleOffset:new i.cj(w),u_particleColor:new i.d3(w),u_direction:new i.ci(w)}),rainParticle:w=>({u_modelview:new i.cl(w),u_projection:new i.cl(w),u_time:new i.cj(w),u_cam_pos:new i.ci(w),u_texScreen:new i.ch(w),u_velocityConeAperture:new i.cj(w),u_velocity:new i.cj(w),u_boxSize:new i.cj(w),u_rainDropletSize:new i.ck(w),u_distortionStrength:new i.cj(w),u_rainDirection:new i.ci(w),u_color:new i.d3(w),u_screenSize:new i.ck(w),u_thinningCenterPos:new i.ck(w),u_thinningShape:new i.ci(w),u_thinningAffectedRatio:new i.cj(w),u_thinningParticleOffset:new i.cj(w),u_shapeDirectionalPower:new i.cj(w),u_shapeNormalPower:new i.cj(w),u_mode:new i.cj(w)}),vignette:w=>({u_vignetteShape:new i.ci(w),u_vignetteColor:new i.d3(w)}),occlusion:w=>({u_matrix:new i.cl(w),u_anchorPos:new i.ci(w),u_screenSizePx:new i.ck(w),u_occluderSizePx:new i.ck(w),u_color:new i.d3(w)})};class Kh{constructor(d,p,j,E){this.id=Kh.uniqueIdxCounter,Kh.uniqueIdxCounter++,this.context=d;const O=d.gl;this.buffer=O.createBuffer(),this.dynamicDraw=!!j,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),O.bufferData(O.ELEMENT_ARRAY_BUFFER,p.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||E||p.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Kh.uniqueIdxCounter,Kh.uniqueIdxCounter++;const p=this.context.gl;this.context.unbindVAO(),this.bind(),p.bufferSubData(p.ELEMENT_ARRAY_BUFFER,0,d.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Kh.uniqueIdxCounter=0;const P5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class i6{constructor(d,p,j,E,O,R){this.length=p.length,this.attributes=j,this.itemSize=p.bytesPerElement,this.dynamicDraw=E,this.instanceCount=R,this.context=d;const B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,p.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||O||p.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const p=this.context.gl;this.bind(),p.bufferSubData(p.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,p){for(let j=0;j0&&d.vertexAttribDivisor(O,j)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class o6{constructor(d,p,j,E,O){this.context=d,this.width=p,this.height=j;const R=this.framebuffer=d.gl.createFramebuffer();E>0&&(this.colorAttachment0=new oN(d,R,0)),E>1&&(this.colorAttachment1=new oN(d,R,1)),O&&(this.depthAttachmentType=O,this.depthAttachment=O==="renderbuffer"?new u0(d,R):new Zv(d,R))}createColorAttachment(d,p){p===0?this.colorAttachment0=new oN(d,this.framebuffer,0):p===1&&(this.colorAttachment1=new oN(d,this.framebuffer,1))}removeColorAttachment(d,p){const j=this.context.gl;let E;p===0?(E=this.colorAttachment0.get(),this.colorAttachment0=void 0):p===1&&(E=this.colorAttachment1.get(),this.colorAttachment1=void 0),E&&j.deleteTexture(E)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const p=this.colorAttachment0.get();p&&d.deleteTexture(p)}if(this.colorAttachment1){const p=this.colorAttachment1.get();p&&d.deleteTexture(p)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const p=this.depthAttachment.get();p&&d.deleteRenderbuffer(p)}else{const p=this.depthAttachment.get();p&&d.deleteTexture(p)}d.deleteFramebuffer(this.framebuffer)}}class g0{constructor(d,p){this.gl=d,this.clearColor=new Kie(this),this.clearDepth=new BP(this),this.clearStencil=new p5(this),this.colorMask=new rN(this),this.depthMask=new g5(this),this.stencilMask=new xx(this),this.stencilFunc=new o0(this),this.stencilOp=new Gv(this),this.stencilTest=new l0(this),this.depthRange=new $P(this),this.depthTest=new x5(this),this.depthFunc=new UP(this),this.blend=new c0(this),this.blendFunc=new nN(this),this.blendColor=new sN(this),this.blendEquation=new y5(this),this.cullFace=new aN(this),this.cullFaceSide=new Kv(this),this.frontFace=new qP(this),this.program=new VP(this),this.activeTexture=new HP(this),this.viewport=new d0(this),this.bindFramebuffer=new WP(this),this.bindRenderbuffer=new Zie(this),this.bindTexture=new Yie(this),this.bindVertexBuffer=new Xie(this),this.bindElementBuffer=new v5(this),this.bindVertexArrayOES=new _5(this),this.pixelStoreUnpack=new b5(this),this.pixelStoreUnpackPremultiplyAlpha=new w5(this),this.pixelStoreUnpackFlipY=new GP(this),this.options=p?Object.assign({},p):{},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=p&&!!p.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,p,j){return new Kh(this,d,p,j)}createVertexBuffer(d,p,j,E,O){return new i6(this,d,p,j,E,O)}createRenderbuffer(d,p,j){const E=this.gl,O=E.createRenderbuffer();return this.bindRenderbuffer.set(O),E.renderbufferStorage(E.RENDERBUFFER,d,p,j),this.bindRenderbuffer.set(null),O}createFramebuffer(d,p,j,E){return new o6(this,d,p,j,E)}clear({color:d,depth:p,stencil:j,colorMask:E}){const O=this.gl;let R=0;d&&(R|=O.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(E||[!0,!0,!0,!0])),p!==void 0&&(R|=O.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(p),this.depthMask.set(!0)),j!==void 0&&(R|=O.STENCIL_BUFFER_BIT,this.clearStencil.set(j),this.stencilMask.set(255)),O.clear(R)}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){i.by(d.blendFunction,ms.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 _x;function nn(w,d,p,j,E,O,R){const B=w.context,H=B.gl,X=w.transform,te=[i.aF(X.center.lng),i.aJ(X.center.lat)],de=p.layout.get("symbol-placement"),ce=p.layout.get("text-variable-anchor"),he=p.layout.get("icon-rotation-alignment")==="map",ke=p.layout.get("text-rotation-alignment")==="map",be=de!=="point",Re=[];let De=0,We=0;for(let ht=0;ht0){const Hr=i.bC(),Qr=Tr;i.cP(Hr,Dt.placementInvProjMatrix,X.glCoordMatrix),i.cP(Hr,Hr,Dt.placementViewportMatrix),Re.push({circleArray:fn,circleOffset:We,transform:Qr,invTransform:Hr,projection:Dt.getProjection()}),De+=fn.length/4,We=De}if(!jr)continue;w.terrain&&w.terrain.setupElevationDraw(Rt,Yr);const an=mr?[St.canonical.x,St.canonical.y,1<=0&&(he[nt.associatedIconIndex]={x:Dt,y:Yt,z:Xt,angle:er})}else Hh(gt,de)}if(X){ce.clear();const We=w.icon.placedSymbolArray;for(let nt=0;nt{let oa=[0,0,0];if(Ta){const ps=w.style.directionalLight,pi=w.style.ambientLight;ps&&pi&&(oa=Pf(w.style,ps,pi))}return oa},fa=Ta=>{ht.depthOcclusionForSymbolsAndCircles&&(p.hasOcclusionOpacityProperties||w.terrain)&&(Ta.push("DEPTH_D24"),Ta.push("DEPTH_OCCLUSION"))},Qn=Ta=>{p.lut&&!gt&&(p.lut.texture||(p.lut.texture=new i.d$(w.context,p.lut.image,[p.lut.image.height,p.lut.image.height,p.lut.image.height],_t.gl.RGBA8)),_t.activeTexture.set(_t.gl.TEXTURE0+Pl.LUT),p.lut.texture&&p.lut.texture.bind(_t.gl.LINEAR,_t.gl.CLAMP_TO_EDGE),Ta.push("APPLY_LUT_ON_GPU"))},Ma=()=>{const Ta=St&&p.layout.get("symbol-placement")!=="point",oa=[];fa(oa),Qn(oa);const ps=Ta||rs,pi=jr.elevationType==="road",ho=w.shadowRenderer,qi=pi&&Dt&&!!ho&&ho.enabled,Ja=xn(qi),kd=pi&&Dt&&!w.terrain?Vt:wr,fc=p.paint.get("icon-image-cross-fade");w.terrainRenderModeElevated()&&Dt&&oa.push("PITCH_WITH_MAP_TERRAIN"),fn&&(oa.push("PROJECTION_GLOBE_VIEW"),ps&&oa.push("PROJECTED_POS_ON_VIEWPORT")),fc>0&&jr.hasAnySecondaryIcon&&oa.push("ICON_TRANSITION"),!jr.icon.zOffsetVertexBuffer||pi&&w.terrain||oa.push("Z_OFFSET"),De===0&&We===0&&nt===0&&Ge===1||oa.push("COLOR_ADJUSTMENT"),jr.sdfIcons&&oa.push("RENDER_SDF"),qi&&oa.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),pi&&Dt&&!w.terrain&&jr.icon.orientationVertexBuffer&&oa.push("ELEVATED_ROADS");const el=jr.icon.programConfigurations.get(p.id),Lc=w.getOrCreateProgram("symbol",{config:el,defines:oa}),Oc=Tr.imageAtlasTexture?Tr.imageAtlasTexture.size:[0,0],Gl=jr.iconSizeData,Ru=i.bK(Gl,ht.zoom),yh=Dt||!ht.isOrthographic,Yd=wa(Hr,Tr.tileID.canonical,Dt,St,ht,jr.getProjection(),Qr),ro=cu(Hr,Tr.tileID.canonical,Dt,St,ht,jr.getProjection(),Qr),xo=w.translatePosMatrix(ro,Tr,B,X,!0),ei=w.translatePosMatrix(Hr,Tr,B,X),Mo=ps?t_:Yd,Yi=St&&!Dt&&!Ta;let Vi=Lr;!Kt&&!ht.mercatorFromTransition||St||(Vi=Of(ht));const vh=fn?Vi:Lr,f_=p.getColorAdjustmentMatrix(De,We,nt,Ge),Xh=xN(Gl.kind,Ru,Yi,Dt,w,ei,Mo,xo,jt,!1,Oc,[0,0],0,Yr,an,Et,Gs,vh,jr.getProjection(),Ja,ka,f_,fc,null),p_=Tr.imageAtlasTexture?Tr.imageAtlasTexture:null,N0=p.layout.get("icon-size").constantOr(0)!==1||jr.iconsNeedLinear,$m=jr.sdfIcons||w.options.rotating||w.options.zooming||N0||yh?pt.LINEAR:pt.NEAREST,Vf=jr.sdfIcons&&p.paint.get("icon-halo-width").constantOr(1)!==0,S0=w.terrain&&Dt&&Ta?i.bl(i.bC(),Yd):t_;if(Ta&&jr.icon){const dg=i.bV.getAtTileOffsetFunc(Yr,ht.center.lat,ht.worldSize,jr.getProjection()),Hf=Vh(Hr,Tr.tileID.canonical,Dt,St,ht,jr.getProjection(),Qr),Qh=p.layout.get("icon-size-scale-range"),Wf=i.aA(w.scaleFactor,Qh[0],Qh[1]);EP(jr,Hr,w,!1,Hf,ro,Dt,be,dg,Yr,Wf)}return{program:Lc,buffers:jr.icon,uniformValues:Xh,atlasTexture:p_,atlasTextureIcon:null,atlasInterpolation:$m,atlasInterpolationIcon:null,isSDF:jr.sdfIcons,hasHalo:Vf,depthMode:kd,tile:Tr,renderWithShadows:qi,labelPlaneMatrixInv:S0}},qa=()=>{const Ta=Rt&&p.layout.get("symbol-placement")!=="point",oa=[],ps=Ta||er||rs,pi=jr.elevationType==="road",ho=w.shadowRenderer,qi=pi&&Yt&&!!ho&&ho.enabled,Ja=xn(qi),kd=pi&&Yt&&!w.terrain?Vt:wr;w.terrainRenderModeElevated()&&Yt&&oa.push("PITCH_WITH_MAP_TERRAIN"),fn&&(oa.push("PROJECTION_GLOBE_VIEW"),ps&&oa.push("PROJECTED_POS_ON_VIEWPORT")),!jr.text.zOffsetVertexBuffer||pi&&w.terrain||oa.push("Z_OFFSET"),jr.iconsInText&&oa.push("RENDER_TEXT_AND_SYMBOL"),oa.push("RENDER_SDF"),qi&&oa.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),pi&&Yt&&!w.terrain&&jr.text.orientationVertexBuffer&&oa.push("ELEVATED_ROADS"),fa(oa);const fc=jr.text.programConfigurations.get(p.id),el=w.getOrCreateProgram("symbol",{config:fc,defines:oa});let Lc,Oc=[0,0],Gl=null;const Ru=jr.textSizeData;jr.iconsInText&&(Oc=Tr.imageAtlasTexture?Tr.imageAtlasTexture.size:[0,0],Gl=Tr.imageAtlasTexture?Tr.imageAtlasTexture:null,Lc=Yt||!ht.isOrthographic||w.options.rotating||w.options.zooming||Ru.kind==="composite"||Ru.kind==="camera"?pt.LINEAR:pt.NEAREST);const yh=Tr.glyphAtlasTexture?Tr.glyphAtlasTexture.size:[0,0],Yd=p.layout.get("text-size-scale-range"),ro=i.aA(w.scaleFactor,Yd[0],Yd[1]),xo=i.bK(Ru,ht.zoom,ro),ei=wa(Hr,Tr.tileID.canonical,Yt,Rt,ht,jr.getProjection(),Qr),Mo=cu(Hr,Tr.tileID.canonical,Yt,Rt,ht,jr.getProjection(),Qr),Yi=w.translatePosMatrix(Mo,Tr,H,te,!0),Vi=w.translatePosMatrix(Hr,Tr,H,te),vh=ps?t_:ei,f_=Rt&&!Yt&&!Ta;let Xh=Lr;!Kt&&!ht.mercatorFromTransition||Rt||(Xh=Of(ht));const p_=xN(Ru.kind,xo,f_,Yt,w,Vi,vh,Yi,jt,!0,yh,Oc,0,Yr,an,Et,Gs,fn?Xh:Lr,jr.getProjection(),Ja,ka,null,null,ro),N0=Tr.glyphAtlasTexture?Tr.glyphAtlasTexture:null,$m=pt.LINEAR,Vf=p.paint.get("text-halo-width").constantOr(1)!==0,S0=w.terrain&&Yt&&Ta?i.bl(i.bC(),ei):t_;if(Ta&&jr.text){const dg=i.bV.getAtTileOffsetFunc(Yr,ht.center.lat,ht.worldSize,jr.getProjection()),Hf=Vh(Hr,Tr.tileID.canonical,Yt,Rt,ht,jr.getProjection(),Qr);EP(jr,Hr,w,!0,Hf,Mo,Yt,Re,dg,Yr,ro)}return{program:el,buffers:jr.text,uniformValues:p_,atlasTexture:N0,atlasTextureIcon:Gl,atlasInterpolation:$m,atlasInterpolationIcon:Lc,isSDF:!0,hasHalo:Vf,depthMode:kd,tile:Tr,renderWithShadows:qi,labelPlaneMatrixInv:S0}},Da=jr.icon.segments.get().length,ha=jr.text.segments.get().length,fs=Da&&!R.onlyText?Ma():null,Ca=ha&&!R.onlyIcons?qa():null,Zi=p.paint.get("icon-opacity").constantOr(1),Ni=p.paint.get("text-opacity").constantOr(1);if(Xt&&jr.canOverlap){or=!0;const Ta=Zi&&!R.onlyText?jr.icon.segments.get():[],oa=Ni&&!R.onlyIcons?jr.text.segments.get():[];for(const ps of Ta)mr.push({segments:new i.bg([ps]),sortKey:ps.sortKey,state:fs});for(const ps of oa)mr.push({segments:new i.bg([ps]),sortKey:ps.sortKey,state:Ca})}else R.onlyText||mr.push({segments:Zi?jr.icon.segments:new i.bg([]),sortKey:0,state:fs}),R.onlyIcons||mr.push({segments:Ni?jr.text.segments:new i.bg([]),sortKey:0,state:Ca})}or&&mr.sort((Yr,Tr)=>Yr.sortKey-Tr.sortKey);for(const Yr of mr){const Tr=Yr.state;if(Tr)if(w.terrain?w.terrain.setupElevationDraw(Tr.tile,Tr.program,{useDepthForOcclusion:ht.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Tr.labelPlaneMatrixInv}):w.setupDepthForOcclusion(ht.depthOcclusionForSymbolsAndCircles,Tr.program),_t.activeTexture.set(pt.TEXTURE0),Tr.atlasTexture&&Tr.atlasTexture.bind(Tr.atlasInterpolation,pt.CLAMP_TO_EDGE,!0),Tr.atlasTextureIcon&&(_t.activeTexture.set(pt.TEXTURE1),Tr.atlasTextureIcon&&Tr.atlasTextureIcon.bind(Tr.atlasInterpolationIcon,pt.CLAMP_TO_EDGE,!0)),Tr.renderWithShadows&&w.shadowRenderer.setupShadows(Tr.tile.tileID.toUnwrapped(),Tr.program,"vector-tile"),w.uploadCommonLightUniforms(w.context,Tr.program),Tr.hasHalo){const jr=Tr.uniformValues;jr.u_is_halo=1,L5(Tr.buffers,Yr.segments,p,w,Tr.program,Tr.depthMode,E,O,jr,2),jr.u_is_halo=0}else{if(Tr.isSDF){const jr=Tr.uniformValues;Tr.hasHalo&&(jr.u_is_halo=1,L5(Tr.buffers,Yr.segments,p,w,Tr.program,Tr.depthMode,E,O,jr,1)),jr.u_is_halo=0}L5(Tr.buffers,Yr.segments,p,w,Tr.program,Tr.depthMode,E,O,Tr.uniformValues,1)}}}function L5(w,d,p,j,E,O,R,B,H,X){const te=[w.dynamicLayoutVertexBuffer,w.opacityVertexBuffer,w.iconTransitioningVertexBuffer,w.globeExtVertexBuffer,w.zOffsetVertexBuffer,w.orientationVertexBuffer];E.draw(j,j.context.gl.TRIANGLES,O,R,B,Un.disabled,H,p.id,w.layoutVertexBuffer,w.indexBuffer,d,p.paint,j.transform.zoom,w.programConfigurations.get(p.id),te,X)}function l6(w,d){const p=1<=Gh?1:he.pitch/Gh))),2*ke}(w.transform),X=w.transform.getFreeCameraOptions().position,te="elevatedStructuresDepthReconstruct",de=w.getOrCreateProgram(te,{defines:["DEPTH_RECONSTRUCTION"]}),ce=w.getOrCreateProgram(te);for(const he of j){const ke=d.getTile(he),be=ke.getBucket(p);if(!be)continue;const Re=be.elevatedStructures;if(!Re)continue;const De=be.elevationBufferData.heightRange,We=l6(he.toUnwrapped(),X),nt=w.translatePosMatrix(he.projMatrix,ke,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));let Ge,jt,gt,_t;if(E==="initialize"){if(!De||De.min>=1||Re.depthSegments.segments[0].primitiveLength===0)continue;Ge=yx(nt,We,H,1,0),jt=R,gt=Re.depthSegments,_t=de}else if(E==="reset"){if(!De||De.min>=0||Re.maskSegments.segments[0].primitiveLength===0)continue;Ge=yx(nt,We,0,0,1),jt=B,gt=Re.maskSegments,_t=de}else if(E==="geometry"){if(Re.depthSegments.segments[0].primitiveLength===0)continue;Ge=yx(nt,We,H,1,0),jt=R,gt=Re.depthSegments,_t=ce}_t.draw(w,O.TRIANGLES,jt,Hn.disabled,ms.disabled,Un.disabled,Ge,p.id,Re.vertexBuffer,Re.indexBuffer,gt,p.paint,w.transform.zoom)}}function _N(w,d,p,j){const{painter:E,sourceCache:O,layer:R,coords:B,colorMode:H,elevationType:X,terrainEnabled:te,pass:de}=w,ce=E.context.gl,he=R.paint.get("fill-pattern"),ke=R.paint.get("fill-pattern-cross-fade"),be=he.constantOr(null);let Re=X;X!=="road"||d&&!te||(Re="none");const De=Re==="road",We=w.painter.shadowRenderer,nt=De&&!!We&&We.enabled,Ge=new yn(E.context.gl.LEQUAL,yn.ReadOnly,E.depthRangeFor3D);let jt=[0,0,0];if(nt){const ht=E.style.directionalLight,St=E.style.ambientLight;ht&&St&&(jt=Pf(E.style,ht,St))}const gt=he&&he.constantOr(1),_t=E.terrain&&E.terrain.renderingToTexture,pt=(ht,St)=>{let Rt,Dt,Yt,Xt,or;St?(Rt=gt&&!R.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Yt=ce.LINES):(Rt=gt?"fillPattern":"fill",Yt=ce.TRIANGLES);for(const wr of B){const Vt=O.getTile(wr);if(gt&&!Vt.patternsLoaded())continue;const Et=Vt.getBucket(R);if(!Et)continue;const er=d?Et.elevationBufferData:Et.bufferData;if(er.isEmpty())continue;E.prepareDrawTile();const Kt=er.programConfigurations.get(R.id),mr=E.isTileAffectedByFog(wr),Lr=[],Yr=[];De&&(Lr.push("ELEVATED_ROADS"),Yr.push(er.elevatedLayoutVertexBuffer)),nt&&Lr.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),_t&&p&&Lr.push("USE_MRT1"),gt&&(E.context.activeTexture.set(ce.TEXTURE0),Vt.imageAtlasTexture&&Vt.imageAtlasTexture.bind(ce.LINEAR,ce.CLAMP_TO_EDGE),Kt.updatePaintBuffers());let Tr=!1;if(be&&Vt.imageAtlas){const Qr=Vt.imageAtlas,Mn=i.e3.from(be),rs=Mn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Gs=Mn.getSecondary(),ka=Qr.patternPositions.get(rs),xn=Gs?Qr.patternPositions.get(Gs.scaleSelf(i.o.devicePixelRatio).toString()):null;Tr=!!ka&&!!xn,ka&&Kt.setConstantPatternPositions(ka,xn)}ke>0&&(Tr||Kt.getPatternTransitionVertexBuffer("fill-pattern"))&&Lr.push("FILL_PATTERN_TRANSITION");const jr=E.getOrCreateProgram(Rt,{config:Kt,overrideFog:mr,defines:Lr}),fn=E.translatePosMatrix(wr.projMatrix,Vt,R.paint.get("fill-translate"),R.paint.get("fill-translate-anchor"));nt&&We.setupShadows(Vt.tileID.toUnwrapped(),jr,"vector-tile");const an=R.paint.get("fill-emissive-strength");if(St){Xt=er.lineIndexBuffer,or=er.lineSegments;const Qr=E.terrain&&E.terrain.renderingToTexture?E.terrain.drapeBufferSize:[ce.drawingBufferWidth,ce.drawingBufferHeight];Dt=Rt==="fillOutlinePattern"&>?A5(fn,an,E,Vt,Qr,jt,ke):QP(fn,an,Qr,jt)}else Xt=er.indexBuffer,or=er.triangleSegments,Dt=gt?T5(fn,an,E,Vt,jt,ke):M5(fn,an,jt);E.uploadCommonUniforms(E.context,jr,wr.toUnwrapped());let Hr=ht;(X==="road"&&!te||X==="offset")&&(Hr=Ge),jr.draw(E,Yt,Hr,j||E.stencilModeForClipping(wr),H,Un.disabled,Dt,R.id,er.layoutVertexBuffer,Xt,or,R.paint,E.transform.zoom,Kt,Yr)}};E.renderPass===de&&pt(E.depthModeForSublayer(1,E.renderPass==="opaque"?yn.ReadWrite:yn.ReadOnly),!1),Re==="none"&&E.renderPass==="translucent"&&R.paint.get("fill-antialias")&&pt(E.depthModeForSublayer(R.getPaintProperty("fill-outline-color")?2:0,yn.ReadOnly),!0)}function bN(w,d,p,j,E,O,R,B){p.resetLayerRenderingStats(w);const H=w.context,X=H.gl,te=w.transform,de=p.paint.get("fill-extrusion-pattern"),ce=p.paint.get("fill-extrusion-pattern-cross-fade"),he=de.constantOr(null),ke=de.constantOr(1),be=p.paint.get("fill-extrusion-opacity"),Re=w.style.enable3dLights(),De=p.paint.get(Re&&!ke?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),We=[p.paint.get("fill-extrusion-ambient-occlusion-intensity"),De],nt=p.layout.get("fill-extrusion-edge-radius"),Ge=nt>0&&!p.paint.get("fill-extrusion-rounded-roof"),jt=Ge?0:nt,gt=te.projection.name==="globe"?i.eb():0,_t=te.projection.name==="globe",pt=_t?i.aj(te.zoom):0,ht=[i.aF(te.center.lng),i.aJ(te.center.lat)],St=p.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Rt=p.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(St?null:p.lut).toArray01().slice(0,3),Dt=p.paint.get("fill-extrusion-flood-light-intensity"),Yt=p.paint.get("fill-extrusion-vertical-scale"),Xt=p.paint.get("fill-extrusion-line-width").constantOr(1)!==0,or=p.paint.get("fill-extrusion-height-alignment"),wr=p.paint.get("fill-extrusion-base-alignment"),Vt=Yp(w,p.paint.get("fill-extrusion-cutoff-fade-range")),Et=[];let er;_t&&Et.push("PROJECTION_GLOBE_VIEW"),We[0]>0&&Et.push("FAUX_AO"),Ge&&Et.push("ZERO_ROOF_RADIUS"),B&&Et.push("HAS_CENTROID"),Dt>0&&Et.push("FLOOD_LIGHT"),Vt.shouldRenderCutoff&&Et.push("RENDER_CUTOFF"),Xt&&Et.push("RENDER_WALL_MODE");const Kt=w.renderPass==="shadow",mr=w.shadowRenderer,Lr=Kt&&!!mr,Yr=Kt?Un.disabled:Un.backCCW;w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0);let Tr=[0,0,0];if(mr){const an=w.style.directionalLight,Hr=w.style.ambientLight;an&&Hr&&(Tr=Pf(w.style,an,Hr)),Kt||(Et.push("RENDER_SHADOWS","DEPTH_TEXTURE"),mr.useNormalOffset&&Et.push("NORMAL_OFFSET")),er=Et.concat(["SHADOWS_SINGLE_CASCADE"])}const jr=Lr?"fillExtrusionDepth":ke?"fillExtrusionPattern":"fillExtrusion",fn=p.getLayerRenderingStats();for(const an of j){const Hr=d.getTile(an),Qr=Hr.getBucket(p);if(!Qr||Qr.projection.name!==te.projection.name)continue;let Mn=!1;mr&&(Mn=mr.getMaxCascadeForTile(an.toUnwrapped())===0);const rs=w.isTileAffectedByFog(an),Gs=Qr.programConfigurations.get(p.id);let ka=!1;if(he&&Hr.imageAtlas){const ha=Hr.imageAtlas,fs=i.e3.from(he),Ca=fs.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Zi=fs.getSecondary(),Ni=ha.patternPositions.get(Ca),Ta=Zi?ha.patternPositions.get(Zi.scaleSelf(i.o.devicePixelRatio).toString()):null;ka=!!Ni&&!!Ta,Ni&&Gs.setConstantPatternPositions(Ni,Ta)}ce>0&&(ka||Gs.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Et.push("FILL_EXTRUSION_PATTERN_TRANSITION");const xn=w.getOrCreateProgram(jr,{config:Gs,defines:Mn?er:Et,overrideFog:rs});if(w.terrain&&w.terrain.setupElevationDraw(Hr,xn,{useMeterToDem:!0}),!Qr.centroidVertexBuffer){const ha=xn.getAttributeLocation(X,"a_centroid_pos");ha!==-1&&X.vertexAttrib2f(ha,0,0)}!Kt&&mr&&mr.setupShadows(Hr.tileID.toUnwrapped(),xn,"vector-tile"),ke&&(w.context.activeTexture.set(X.TEXTURE0),Hr.imageAtlasTexture&&Hr.imageAtlasTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),Gs.updatePaintBuffers());const fa=p.paint.get("fill-extrusion-vertical-gradient"),Qn=1/Qr.tileToMeter;let Ma;if(Kt&&mr){if(Rf(Hr.tileID,Qr.maxHeight,w))continue;const ha=mr.calculateShadowPassMatrixFromTile(Hr.tileID.toUnwrapped());Ma=C5(ha,jt,Qn,Yt,or,wr)}else{const ha=w.translatePosMatrix(an.expandedProjMatrix,Hr,p.paint.get("fill-extrusion-translate"),p.paint.get("fill-extrusion-translate-anchor")),fs=te.projection.createInversionMatrix(te,an.canonical);Ma=ke?XP(ha,w,fa,be,We,jt,Qn,an,Hr,gt,or,wr,pt,ht,fs,Rt,Yt,ce):mN(ha,w,fa,be,We,jt,Qn,an,gt,or,wr,pt,ht,fs,Rt,Yt,Dt,Tr)}w.uploadCommonUniforms(H,xn,an.toUnwrapped(),null,Vt);let qa=Qr.segments;if(te.projection.name==="mercator"&&!Kt&&(qa=Qr.getVisibleSegments(Hr.tileID,w.terrain,w.transform.getFrustum(0)),!qa.get().length))continue;if(fn)if(Kt)for(const ha of qa.get())fn.numRenderedVerticesInShadowPass+=ha.primitiveLength;else for(const ha of qa.get())fn.numRenderedVerticesInTransparentPass+=ha.primitiveLength;const Da=[];(w.terrain||B)&&Da.push(Qr.centroidVertexBuffer),_t&&Da.push(Qr.layoutVertexExtBuffer),Xt&&Da.push(Qr.wallVertexBuffer),xn.draw(w,H.gl.TRIANGLES,E,O,R,Yr,Ma,p.id,Qr.layoutVertexBuffer,Qr.indexBuffer,qa,p.paint,w.transform.zoom,Gs,Da)}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1)}class O5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Df(w,d,p,j,E,O,R,B,H,X,te,de,ce,he,ke,be,Re,De,We,nt){const Ge=d.context,jt=Ge.gl,gt=d.transform,_t=d.transform.zoom,pt=[],ht=w.translate,St=w.translateAnchor,Rt=w.edgeRadius,Dt=Yp(d,w.cutoffFadeRange);te==="clear"?(pt.push("CLEAR_SUBPASS"),nt&&(pt.push("CLEAR_FROM_TEXTURE"),Ge.activeTexture.set(jt.TEXTURE0),nt.bind(jt.LINEAR,jt.CLAMP_TO_EDGE))):te==="sdf"?pt.push("SDF_SUBPASS"):te==="emissive"&&(pt.push("USE_MRT1"),Ge.activeTexture.set(jt.TEXTURE0),nt.bind(jt.LINEAR,jt.CLAMP_TO_EDGE)),De&&pt.push("HAS_CENTROID"),Dt.shouldRenderCutoff&&pt.push("RENDER_CUTOFF");const Yt=(Xt,or,wr,Vt,Et)=>{let er=pt;or.groundRadiusBuffer!=null&&(er=pt.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Kt=or.programConfigurations.get(j.id),mr=d.isTileAffectedByFog(Xt),Lr=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:Kt,defines:er,overrideFog:mr}),Yr=f0(d,Vt,de,X,Et,[ce,he*Et],ke,be,Re,_t>=17?0:Rt*Et,nt?nt.size[0]:0),Tr=[];De&&Tr.push(or.hiddenByLandmarkVertexBuffer),or.groundRadiusBuffer!=null&&Tr.push(or.groundRadiusBuffer),d.uploadCommonUniforms(Ge,Lr,Xt.toUnwrapped(),null,Dt),Lr.draw(d,Ge.gl.TRIANGLES,O,R,B,H,Yr,j.id,or.vertexBuffer,or.indexBuffer,wr,j.paint,_t,Kt,Tr)};for(const Xt of E){const or=p.getTile(Xt),wr=or.getBucket(j);if(!wr||wr.projection.name!==gt.projection.name||!wr.groundEffect||wr.groundEffect&&!wr.groundEffect.hasData())continue;const Vt=wr.groundEffect,Et=1/wr.tileToMeter;{const er=d.translatePosMatrix(Xt.projMatrix,or,ht,St),Kt=Vt.getDefaultSegment();Yt(Xt,Vt,Kt,er,Et)}if(We)for(let er=0;er<4;er++){const Kt=i.e9[er](Xt),mr=p.getTile(Kt);if(!mr)continue;const Lr=mr.getBucket(j);if(!Lr||Lr.projection.name!==gt.projection.name||!Lr.groundEffect||Lr.groundEffect&&!Lr.groundEffect.hasData())continue;const Yr=Lr.groundEffect;let Tr,jr;er===0?(Tr=[-i.al,0,0],jr=1):er===1?(Tr=[i.al,0,0],jr=0):er===2?(Tr=[0,-i.al,0],jr=3):(Tr=[0,i.al,0],jr=2);const fn=Yr.regionSegments[jr];if(!fn)continue;const an=new Float32Array(16);i.br(an,Xt.projMatrix,Tr),Yt(Xt,Yr,fn,d.translatePosMatrix(an,or,ht,St),Et)}}}function noe(w,d,p,j,E,O,R){j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const B=O?O.findDEMTileFor(p):null;if(!(B&&B.dem||R))return;O&&B&&B.dem&&j.selfDEMTileTimestamp!==B.dem._timestamp&&(j.borderDoneWithNeighborZ=[-1,-1,-1,-1],j.selfDEMTileTimestamp=B.dem._timestamp);const H=De=>new i.P(Math.ceil((De+i.ed)*i.ee),0),X=De=>{const We=d.getSource().minzoom,nt=jt=>{const gt=d.getTileByID(jt);if(gt&>.hasData())return gt.getBucket(E)},Ge=[0,-1,1];for(const jt of Ge){if(De.overscaledZ+jt(te[0]=Math.min(De.min.y,We.min.y),te[1]=Math.max(De.max.y,We.max.y),te[2]=i.al-We.min.x>De.max.x?We.min.x-i.al:De.max.x,te),ce=(De,We)=>(te[0]=Math.min(De.min.x,We.min.x),te[1]=Math.max(De.max.x,We.max.x),te[2]=i.al-We.min.y>De.max.y?We.min.y-i.al:De.max.y,te),he=[(De,We)=>de(De,We),(De,We)=>de(We,De),(De,We)=>ce(De,We),(De,We)=>ce(We,De)],ke=(De,We,nt,Ge,jt,gt,_t)=>{if(!O)return 0;const pt=[[gt?nt:De,gt?De:nt,0],[gt?nt:We,gt?We:nt,0]],ht=_t<0?i.al+_t:_t,St=[gt?ht:(De+We)/2,gt?(De+We)/2:ht,0];return nt===0&&_t<0||nt!==0&&_t>0?O.getForTilePoints(jt,[St],!0,Ge):pt.push(St),O.getForTilePoints(p,pt,!0,B),Math.max(pt[0][2],pt[1][2],St[2])/O.exaggeration()};for(let De=0;De<4;De++){const We=j.borderFeatureIndices[De];if(We.length===0)continue;const nt=i.e9[De](p),Ge=X(nt);if(!(Ge&&Ge instanceof i.ea))continue;const jt=O?O.findDEMTileFor(nt):null;if(!(jt&&jt.dem||R)||(O&&jt&&jt.dem&&j.borderDEMTileTimestamp[De]!==jt.dem._timestamp&&(j.borderDoneWithNeighborZ[De]=-1,j.borderDEMTileTimestamp[De]=jt.dem._timestamp),j.borderDoneWithNeighborZ[De]===Ge.canonical.z))continue;Ge.centroidVertexArray.length===0&&Ge.createCentroidsBuffer();const gt=(De<2?1:5)-De,_t=Ge.borderDoneWithNeighborZ[gt]!==j.canonical.z,pt=Ge.borderFeatureIndices[gt];let ht=0;if(j.canonical.z!==Ge.canonical.z){for(const St of We)j.showCentroid(j.featuresOnBorder[St]);if(_t)for(const St of pt)Ge.showCentroid(Ge.featuresOnBorder[St]);j.borderDoneWithNeighborZ[De]=Ge.canonical.z,Ge.borderDoneWithNeighborZ[gt]=j.canonical.z}for(const St of We){const Rt=j.featuresOnBorder[St],Dt=j.centroidData[Rt.centroidDataIndex],Yt=Rt.borders[De];let Xt;for(;htYt[0]+3||or[0]>Yt[0]-3)break;Ge.showCentroid(Xt),ht++}if(Xt&&htYt[1]-3)&&(wr++,++ht!==pt.length);)Xt=Ge.featuresOnBorder[pt[ht]];Xt=Ge.featuresOnBorder[pt[or]];let Vt=!1;if(wr>=1){const Kt=Xt.borders[gt];Math.abs(Yt[0]-Kt[0])<3&&Math.abs(Yt[1]-Kt[1])<3&&(wr=1,Vt=!0,ht=or+1)}else if(wr===0){j.showCentroid(Rt);continue}const Et=Ge.centroidData[Xt.centroidDataIndex];R&&Vt&&(((be=Dt).flags|(Re=Et).flags)&i.ec?(be.flags|=i.ec,Re.flags|=i.ec):(be.flags&=~i.ec,Re.flags&=~i.ec));const er=Rt.intersectsCount()>1||Xt.intersectsCount()>1;if(wr>1)ht=or,Dt.centroidXY=Et.centroidXY=new i.P(0,0);else if(jt&&jt.dem&&!er){const Kt=he[De](Dt,Et),mr=De%2?i.al-1:0,Lr=ke(Kt[0],Math.min(i.al-1,Kt[1]),mr,jt,nt,De<2,Kt[2]);Dt.centroidXY=Et.centroidXY=H(Lr)}else er?Dt.centroidXY=Et.centroidXY=new i.P(0,0):(Dt.centroidXY=j.encodeBorderCentroid(Rt),Et.centroidXY=Ge.encodeBorderCentroid(Xt));j.writeCentroidToBuffer(Dt),Ge.writeCentroidToBuffer(Et)}else j.showCentroid(Rt)}j.borderDoneWithNeighborZ[De]=Ge.canonical.z,Ge.borderDoneWithNeighborZ[gt]=j.canonical.z}var be,Re;(j.needsCentroidUpdate||!j.centroidVertexBuffer&&j.centroidVertexArray.length!==0)&&j.uploadCentroid(w)}const du=[1,0,0],D5=[0,1,0],wd=[0,0,1];function Rf(w,d,p){const j=p.transform,E=p.shadowRenderer;if(!E)return!0;const O=w.toUnwrapped(),R=j.tileSize*E._cascades[p.currentShadowCascade].scale;let B=d;if(j.elevation){const be=j.elevation.getMinMaxForTile(w);be&&(B+=be.max)}const H=[...E.shadowDirection];H[2]=-H[2];const X=E.computeSimplifiedTileShadowVolume(O,B,R,H);if(!X)return!1;const te=[du,D5,wd,H,[H[0],0,H[2]],[0,H[1],H[2]]],de=j.projection.name==="globe",ce=j.scaleZoom(R),he=i.cB.fromInvProjectionMatrix(j.invProjMatrix,j.worldSize,ce,!de),ke=E.getCurrentCascadeFrustum();return he.intersectsPrecise(X.vertices,X.planes,te)===0||ke.intersectsPrecise(X.vertices,X.planes,te)===0}function n_(w){const{painter:d,source:p,layer:j,coords:E}=w;let O=w.defines;const R=d.context,B=d.renderPass==="shadow",H=d.renderPass==="light-beam",X=d.shadowRenderer,te=i.ef(d.transform.center.lat,d.transform.zoom),de=Yp(d,j.paint.get("building-cutoff-fade-range"));de.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),w.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const ce of E){const he=p.getTile(ce),ke=he.getBucket(j);if(!ke)continue;X&&X.getMaxCascadeForTile(ce.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const be=ke.programConfigurations.get(j.id);let Re,De,We,nt=d.translatePosMatrix(ce.expandedProjMatrix,he,[0,0],"map");if(nt=i.cS(i.bC(),nt,[1,1,w.verticalScale]),B&&X){if(Rf(he.tileID,ke.maxHeight*te,d))continue;let jt=X.calculateShadowPassMatrixFromTile(he.tileID.toUnwrapped());jt=i.cS(i.bC(),jt,[1,1,w.verticalScale]),We=ng(jt),Re=De=d.getOrCreateProgram("buildingDepth",{config:be,defines:O,overrideFog:!1})}else if(H)Re=De=d.getOrCreateProgram("buildingBloom",{config:be,defines:O,overrideFog:!1}),We=JP(nt);else{const jt=d.transform.calculatePosMatrix(ce.toUnwrapped(),d.transform.worldSize);i.cS(jt,jt,[1,1,w.verticalScale]);const gt=i.bC();i.cS(gt,jt,[1,-1,1/te]),i.bl(gt,gt),i.eg(gt,gt);const _t=d.transform.getFreeCameraOptions().position,pt=1<{if(H){const _t=jt.entranceBloom;gt.draw(d,R.gl.TRIANGLES,w.depthMode,Hn.disabled,w.blendMode,Un.disabled,We,j.id,_t.layoutVertexBuffer,_t.indexBuffer,_t.segmentsBucket,j.paint,d.transform.zoom,be,[_t.layoutAttenuationBuffer,_t.layoutColorBuffer])}else{const _t=jt.segmentsBucket;let pt=[jt.layoutNormalBuffer,jt.layoutCentroidBuffer,jt.layoutColorBuffer,jt.layoutFloodLightDataBuffer];jt.layoutFacadePaintBuffer&&(pt=pt.concat([jt.layoutFacadeDataBuffer,jt.layoutFacadeVerticalRangeBuffer,jt.layoutFacadePaintBuffer])),gt.draw(d,R.gl.TRIANGLES,w.depthMode,Hn.disabled,w.blendMode,B?Un.disabled:Un.backCW,We,j.id,jt.layoutVertexBuffer,jt.indexBuffer,_t,j.paint,d.transform.zoom,be,pt)}};d.uploadCommonUniforms(R,De,ce.toUnwrapped(),null,de),ke.buildingWithoutFacade&&Ge(ke.buildingWithoutFacade,De),ke.buildingWithFacade&&(Re!==De&&d.uploadCommonUniforms(R,Re,ce.toUnwrapped(),null,de),Ge(ke.buildingWithFacade,Re))}}function wN(w,d,p,j,E,O,R,B,H,X,te,de,ce){const he=w.context.gl,ke=w.depthModeForSublayer(1,yn.ReadOnly,he.LEQUAL,!0),be=.1*(1-(Re=te))+3*Re;var Re;const De=w._showOverdrawInspector,We=de,nt=new O5;De||Df(nt,w,d,p,j,ke,new Hn({func:he.ALWAYS,mask:255},255,255,he.KEEP,he.KEEP,he.REPLACE),new ms([he.ONE,he.ONE,he.ONE,he.ONE],i.ao.transparent,[!1,!1,!1,!0],he.MIN),Un.disabled,E,"sdf",O,R,B,H,X,be,We,!1);{const Ge=De?Hn.disabled:new Hn({func:he.EQUAL,mask:255},255,255,he.KEEP,he.DECR,he.DECR),jt=De?w.colorModeForRenderPass():new ms([he.ONE_MINUS_DST_ALPHA,he.DST_ALPHA,he.ONE,he.ONE],i.ao.transparent,[!0,!0,!0,!0]);Df(nt,w,d,p,j,ke,Ge,jt,Un.disabled,E,"color",O,R,B,H,X,be,We,!1)}}function jN(w){return[w[0]*i.eh,w[1]*i.eh,w[2]*i.eh,0]}function s_(w,d,p,j,E,O,R,B,H){const X=j.getSource(),te=p.globeSharedBuffers;if(!te)return;let de,ce,he;if(d&&(de=j.getTile(d)),X instanceof i.aU?(ce=X.texture,he=i.dK(0,0,p.transform)):de&&d&&(ce=de.texture,he=i.dK(d.canonical.z,d.canonical.x,p.transform)),!ce||!he)return;w||(he=i.cS(i.bC(),he,[1,-1,1]));const ke=p.context,be=ke.gl,Re=E.paint.get("raster-resampling")==="nearest"?be.NEAREST:be.LINEAR,De=p.colorModeForDrapableLayerRenderPass(O),We=R.defines;We.push("GLOBE_POLES");const nt=new yn(be.LEQUAL,yn.ReadWrite,p.depthRangeFor3D),Ge=Float32Array.from(p.transform.expandedFarZProjMatrix),jt=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0))));p.terrain&&p.terrain.prepareDrawTile(),ke.activeTexture.set(be.TEXTURE0),ce.bind(Re,be.CLAMP_TO_EDGE),ke.activeTexture.set(be.TEXTURE1),ce.bind(Re,be.CLAMP_TO_EDGE),"useMipmap"in ce&&ke.extTextureFilterAnisotropic&&p.transform.pitch>20&&be.texParameterf(be.TEXTURE_2D,ke.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,ke.extTextureFilterAnisotropicMax);const[gt,_t,pt,ht]=d?te.getPoleBuffers(d.canonical.z,!1):te.getPoleBuffers(0,!0),St=E.paint.get("raster-elevation");let Rt;w?(Rt=gt,p.renderDefaultNorthPole=St!==0):(Rt=_t,p.renderDefaultSouthPole=St!==0);const Dt=jN(R.mix),Yt=((or,wr,Vt,Et,er,Kt,mr,Lr,Yr,Tr,jr,fn,an)=>r6(or,wr,Vt,new Float32Array(16),new Float32Array(9),[0,0],Et,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Kt,[0,0],Lr,2,Tr,jr,fn,1,0,an))(Ge,jt,he,i.aj(p.transform.zoom),0,E,0,St,0,Dt,R.offset,R.range,O),Xt=p.getOrCreateProgram("raster",{defines:We});p.uploadCommonUniforms(ke,Xt,null),Xt.draw(p,be.TRIANGLES,nt,H,De,B,Yt,E.id,Rt,pt,ht)}function c6(w){const d=w._nearZ,p=w.projection.farthestPixelDistance(w),j=p-d,E=.2*w.height,O=d+E;return[d,p,(O-E-d)/j,(O-d)/j]}function Ff(w,d,p,j){if(w)return d instanceof hc&&w instanceof Qy?d.getTextureDescriptor(w,p,!0):{texture:w.texture,mix:jN(j.mix),offset:j.offset,buffer:0,tileSize:1}}var li=i.ei([{name:"a_index",type:"Int16",components:1}]);class kN{constructor(d,p,j,E){const O={width:j[0],height:j[1],data:null},R=d.gl;this.targetColorTexture=new i.T(d,O,R.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(d,O,R.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(p,E),this.lastInvalidatedAt=0}updateParticleTexture(d,p){if(this.particleTextureDimension===p.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const j=this.context.gl,E=p.width*p.height;this.particleTexture0=new i.T(this.context,p,j.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,p,j.RGBA8,{premultiply:!1,useMipmap:!1});const O=new i.ej;O.reserve(E);for(let R=0;R0){const Dt=i.bj(p.canonical,H),Yt=i.el(Dt);ce=i.aB(new Float32Array(16),H.globeMatrix,Yt),i.aB(ce,H.projMatrix,ce)}const he=i.bC();he[12]+=2*E/(i.o.devicePixelRatio*H.width),he[13]+=2*O/(i.o.devicePixelRatio*H.height),i.aB(ce,he,ce);const ke=w.getOrCreateProgram("debug",{defines:de}),be=d.getTileByID(p.key);w.terrain&&w.terrain.setupElevationDraw(be,ke);const Re=yn.disabled,De=Hn.disabled,We=w.colorModeForRenderPass(),nt="$debug";B.activeTexture.set(X.TEXTURE0),w.emptyTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE),te?be._makeGlobeTileDebugBuffers(w.context,H):be._makeDebugTileBoundsBuffers(w.context,H.projection);const Ge=be._tileDebugBuffer||w.debugBuffer,jt=be._tileDebugIndexBuffer||w.debugIndexBuffer,gt=be._tileDebugSegments||w.debugSegments;if(ke.draw(w,X.LINE_STRIP,Re,De,We,Un.disabled,Jv(ce,j.toPremultipliedRenderColor(null)),nt,Ge,jt,gt,null,null,null,[be._globeTileDebugBorderBuffer]),R){const Dt=be.latestRawTileData,Yt=Math.floor((Dt&&Dt.byteLength||0)/1024);let Xt=p.canonical.toString();p.overscaledZ!==p.canonical.z&&(Xt+=` => ${p.overscaledZ}`),Xt+=` ${be.state}`,Xt+=` ${Yt}kb`,function(or,wr){or.initDebugOverlayCanvas();const Vt=or.debugOverlayCanvas,Et=or.context.gl,er=or.debugOverlayCanvas.getContext("2d");er.clearRect(0,0,Vt.width,Vt.height),er.shadowColor="white",er.shadowBlur=2,er.lineWidth=1.5,er.strokeStyle="white",er.textBaseline="top",er.font="bold 36px Open Sans, sans-serif",er.fillText(wr,5,5),er.strokeText(wr,5,5),or.debugOverlayTexture.update(Vt),or.debugOverlayTexture.bind(Et.LINEAR,Et.CLAMP_TO_EDGE)}(w,Xt)}const _t=d.getTile(p).tileSize,pt=512/Math.min(_t,512)*(p.overscaledZ/H.zoom)*.5,ht=be._tileDebugTextBuffer||w.debugBuffer,St=be._tileDebugTextIndexBuffer||w.quadTriangleIndexBuffer,Rt=be._tileDebugTextSegments||w.debugSegments;ke.draw(w,X.TRIANGLES,Re,De,ms.alphaBlended,Un.disabled,Jv(ce,i.ao.transparent.toPremultipliedRenderColor(null),pt),nt,ht,St,Rt,null,null,null,[be._globeTileDebugTextBuffer])}function jx(w,d,p,j){Bt(w,0,d+p/2,w.transform.width,p,j)}function to(w,d,p,j){Bt(w,d-p/2,0,p,w.transform.height,j)}function Bt(w,d,p,j,E,O){const R=w.context,B=R.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*i.o.devicePixelRatio,p*i.o.devicePixelRatio,j*i.o.devicePixelRatio,E*i.o.devicePixelRatio),R.clear({color:O}),B.disable(B.SCISSOR_TEST)}const f6=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:NN}=f6;function Rm(w,d,p,j){w.emplaceBack(d,p,j)}class SN{constructor(d){this.vertexArray=new i.em,this.indices=new i.b0,Rm(this.vertexArray,-1,-1,1),Rm(this.vertexArray,1,-1,1),Rm(this.vertexArray,-1,1,1),Rm(this.vertexArray,1,1,1),Rm(this.vertexArray,-1,-1,-1),Rm(this.vertexArray,1,-1,-1),Rm(this.vertexArray,-1,1,-1),Rm(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,NN),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=i.bg.simpleSegment(0,0,36,12)}}function kx(w,d,p,j,E,O){const R=w.context.gl,B=d.paint.get("sky-atmosphere-color"),H=d.paint.get("sky-atmosphere-halo-color"),X=d.paint.get("sky-atmosphere-sun-intensity"),te=((de,ce,he,ke,be)=>({u_matrix_3f:de,u_sun_direction:ce,u_sun_intensity:he,u_color_tint_r:[ke.r,ke.g,ke.b,ke.a],u_color_tint_m:[be.r,be.g,be.b,be.a],u_luminance:5e-5}))(i.eo(i.dO(),j),E,X,B.toPremultipliedRenderColor(null),H.toPremultipliedRenderColor(null));R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+O,d.skyboxTexture,0),p.draw(w,R.TRIANGLES,yn.disabled,Hn.disabled,ms.unblended,Un.frontCW,te,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const p6=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class x0{constructor(d){const p=new i.ep;p.emplaceBack(-1,1,1,0,0),p.emplaceBack(1,1,1,1,0),p.emplaceBack(1,-1,1,1,1),p.emplaceBack(-1,-1,1,0,1);const j=new i.b0;j.emplaceBack(0,1,2),j.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(p,p6.members),this.indexBuffer=d.createIndexBuffer(j),this.segments=i.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const soe=i.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 aoe{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class g6{constructor(d){this.colorModeAlphaBlendedWriteRGB=new ms([1,Pm,1,Pm],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ms([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new aoe,this.updateNeeded=!0}update(d){const p=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new x0(p);const j=this.params.sizeRange,E=this.params.intensityRange,O=function(te){const de=i.eq(30),ce=[];for(let he=0;he{const pt=O.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];_t&&pt.push("ALPHA_PASS");const ht=d.getOrCreateProgram("globeAtmosphere",{defines:pt}),St=((Dt,Yt,Xt,or,wr,Vt,Et,er,Kt,mr,Lr,Yr)=>({u_frustum_tl:Dt,u_frustum_tr:Yt,u_frustum_br:Xt,u_frustum_bl:or,u_horizon:wr,u_transition:Vt,u_fadeout_range:Et,u_atmosphere_fog_color:er.toArray01(),u_high_color:Kt.toArray01(),u_space_color:mr.toArray01(),u_temporal_offset:Lr,u_horizon_angle:Yr}))(O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.frustumCorners.horizon,B,Re,te,ce,ke,We,jt);d.uploadCommonUniforms(j,ht);const Rt=this.atmosphereBuffer;Rt&&ht.draw(d,E.TRIANGLES,R,Hn.disabled,_t?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,Un.backCW,St,_t?"atmosphere_glow_alpha":"atmosphere_glow",Rt.vertexBuffer,Rt.indexBuffer,Rt.segments)};gt(!1),gt(!0)}drawStars(d,p){const j=i.aA(p.properties.get("star-intensity"),0,1);if(j===0)return;const E=d.context,O=E.gl,R=d.transform,B=d.getOrCreateProgram("stars"),H=i.c7([]);i.c9(H,H,-R._pitch),i.c8(H,H,-R.angle),i.c9(H,H,i.an(R._center.lat)),i.et(H,H,-i.an(R._center.lng));const X=i.cc(new Float32Array(16),H),te=i.aB([],R.starsProjMatrix,X),de=i.eo([],X),ce=i.eu([],de),he=[0,1,0];i.dQ(he,he,ce),i.c5(he,he,this.params.sizeMultiplier);const ke=[1,0,0];i.dQ(ke,ke,ce),i.c5(ke,ke,this.params.sizeMultiplier);const be=(Re=he,De=ke,We=j,{u_matrix:Float32Array.from(te),u_up:Re,u_right:De,u_intensity_multiplier:We});var Re,De,We;d.uploadCommonUniforms(E,B),this.starsVx&&this.starsIdx&&B.draw(d,O.TRIANGLES,yn.disabled,Hn.disabled,this.colorModeAlphaBlendedWriteRGB,Un.disabled,be,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class CN{constructor(){this.visibleTiles=[]}updateBorders(d,p){const j=[],E=[],O=d._getRenderableCoordinates(!1,!0);for(const H of O){const X=d.getTile(H);if(!X.hasData())continue;const te=X.getBucket(p);te&&(te.isEmpty()||(j.push(H.key),E.push({bucket:te,tileID:H.canonical})))}let R=j.length!==this.visibleTiles.length;if(!R){j.sort();for(let H=0;HH.tileID.z-X.tileID.z||H.tileID.x-X.tileID.x||H.tileID.y-X.tileID.y);for(const H of E){const X=new Array,te=new Array,de=H.bucket;for(const ce of de.featuresOnBorder)B.has(ce.featureId)?te.push(ce.footprintIndex):(B.add(ce.featureId),X.push(ce.footprintIndex));de.updateFootprintHiddenFlags(X,i.ev,!1),de.updateFootprintHiddenFlags(te,i.ev,!0)}}}function MN(w,d){const p=[...w],j=d.cameraWorldSizeForFog/d.worldSize,E=i.bA([]);return i.cS(E,E,[j,j,1]),i.aB(p,E,p),i.aB(p,d.worldToFogMatrix,p),p}function TN(w,d,p,j,E){const O=p.material,R=j.context,{baseColorTexture:B,metallicRoughnessTexture:H}=O.pbrMetallicRoughness,{normalTexture:X,occlusionTexture:te,emissionTexture:de}=O;function ce(ke,be,Re){if(ke&&(w.push(be),R.activeTexture.set(R.gl.TEXTURE0+Re),ke.gfxTexture)){const{minFilter:De,magFilter:We,wrapS:nt,wrapT:Ge}=ke.sampler;ke.gfxTexture.bindExtraParam(De,We,nt,Ge)}}ce(B,"HAS_TEXTURE_u_baseColorTexture",Pl.BaseColor),ce(H,"HAS_TEXTURE_u_metallicRoughnessTexture",Pl.MetallicRoughness),ce(X,"HAS_TEXTURE_u_normalTexture",Pl.Normal),ce(te,"HAS_TEXTURE_u_occlusionTexture",Pl.Occlusion),ce(de,"HAS_TEXTURE_u_emissionTexture",Pl.Emission),E&&(E.texture||(E.texture=new i.d$(j.context,E.image,[E.image.height,E.image.height,E.image.height],R.gl.RGBA8)),R.activeTexture.set(R.gl.TEXTURE0+Pl.LUT),E.texture&&E.texture.bind(R.gl.LINEAR,R.gl.CLAMP_TO_EDGE),w.push("APPLY_LUT_ON_GPU")),p.texcoordBuffer&&(w.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(p.texcoordBuffer)),p.colorBuffer&&(w.push(p.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(p.colorBuffer)),p.normalBuffer&&(w.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(p.normalBuffer)),p.pbrBuffer&&(w.push("HAS_ATTRIBUTE_a_pbr"),w.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(p.pbrBuffer)),O.alphaMode!=="OPAQUE"&&O.alphaMode!=="MASK"||w.push("UNPREMULT_TEXTURE_IN_SHADER"),O.defined||w.push("DIFFUSE_SHADED");const he=j.shadowRenderer;he&&(w.push("RENDER_SHADOWS","DEPTH_TEXTURE"),he.useNormalOffset&&w.push("NORMAL_OFFSET"))}function AN(w,d,p,j,E,O){const R=w.modelOpacity,B=d.context,H=new yn(d.context.gl.LEQUAL,w.isLightMesh?yn.ReadOnly:yn.ReadWrite,d.depthRangeFor3D),X=d.transform,te=w.mesh,de=te.material,ce=de.pbrMetallicRoughness,he=d.style.fog;let ke;ke=d.transform.projection.zAxisUnit==="pixels"?[...w.nodeModelMatrix]:i.aB([],j.zScaleMatrix,w.nodeModelMatrix),i.aB(ke,j.negCameraPosMatrix,ke);const be=i.bl([],ke);i.eg(be,be);const Re=p.paint.get("model-color-use-theme").constantOr("default")==="none",De=p.paint.get("model-emissive-strength").constantOr(0),We=vx(new Float32Array(w.worldViewProjection),new Float32Array(ke),new Float32Array(be),null,d,R,ce.baseColorFactor,de.emissiveFactor,ce.metallicFactor,ce.roughnessFactor,de,De,p,void 0,void 0,w.materialOverride,w.modelColor),nt={defines:[]},Ge=[],jt=d.shadowRenderer;jt&&(jt.useNormalOffset=!1),TN(nt.defines,Ge,te,d,Re?null:p.lut);let gt=null;if(he){const ht=MN(w.nodeModelMatrix,d.transform);if(gt=new Float32Array(ht),X.projection.name!=="globe"){const St=te.aabb.min,Rt=te.aabb.max,[Dt,Yt]=he.getOpacityForBounds(ht,St[0],St[1],Rt[0],Rt[1]);nt.overrideFog=Dt>=cr||Yt>=cr}}const _t=Yp(d,p.paint.get("model-cutoff-fade-range"));_t.shouldRenderCutoff&&nt.defines.push("RENDER_CUTOFF");const pt=d.getOrCreateProgram("model",nt);d.uploadCommonUniforms(B,pt,null,gt,_t),d.renderPass!=="shadow"&&jt&&jt.setupShadowsFromMatrix(w.nodeModelMatrix,pt),pt.draw(d,B.gl.TRIANGLES,H,E,O,te.material.doubleSided?Un.disabled:Un.backCCW,We,p.id,te.vertexBuffer,te.indexBuffer,te.segments,p.paint,d.transform.zoom,void 0,Ge)}function a_(w,d){return w.style._importedAsBasemap?"basemap":d.scope}function Nx(w,d,p,j,E,O,R,B,H,X){const te=w.transform,de=!!d.isGeometryBloom&&d.isGeometryBloom;if(de&&w.renderPass==="shadow")return;const ce=te.projection.name==="globe"?i.eD(p,te):[...p];i.aB(ce,ce,d.globalMatrix);const he=i.aB([],j,ce);if(d.meshes)for(const ke of d.meshes){const be=B.get(ke.material.name);if(be&&be.opacity<=0)continue;if(ke.material.alphaMode!=="BLEND"){R.push({mesh:ke,depth:0,modelIndex:E,worldViewProjection:he,nodeModelMatrix:ce,isLightMesh:de,materialOverride:be,modelOpacity:H,modelColor:X});continue}const Re=i.af([],ke.centroid,he);!te.isOrthographic&&Re[2]<=0||O.push({mesh:ke,depth:Re[2],modelIndex:E,worldViewProjection:he,nodeModelMatrix:ce,isLightMesh:de,materialOverride:be,modelOpacity:H,modelColor:X})}if(d.children)for(const ke of d.children)Nx(w,ke,p,j,E,O,R,B,H,X)}function Zh(w,d,p,j){const E=p.shadowRenderer;if(!E)return;const O=E.getShadowPassDepthMode(),R=E.getShadowPassColorMode(),B=E.calculateShadowPassMatrixFromMatrix(d),H=I5(B);p.getOrCreateProgram("modelDepth",{defines:p._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(p,p.context.gl.TRIANGLES,O,Hn.disabled,R,Un.disabled,H,j.id,w.vertexBuffer,w.indexBuffer,w.segments,j.paint,p.transform.zoom,void 0,void 0)}function x6(w,d,p,j,E,O){for(const R of E){const B=Object.assign({},j);B.part=R;const H={type:"Unknown",id:d,properties:B},X={orientation:w.paint.get("model-rotation").evaluate(H,p)};O.set(R,X)}}function y6(w,d,p,j,E,O){for(const R of E){const B=Object.assign({},j);B.part=R;const H={type:"Unknown",id:d,properties:B},X={color:w.paint.get("model-color").evaluate(H,p),colorMix:w.paint.get("model-color-mix-intensity").evaluate(H,p),opacity:w.paint.get("model-opacity").evaluate(H,p),emissionStrength:w.paint.get("model-emissive-strength").evaluate(H,p)};O.set(R,X)}}function v6(w,d,p,j,E){let O=!1;for(const B of j)B.modelOpacity!==1&&(AN(B,w,d,E[B.modelIndex],Hn.disabled,ms.disabled),O=!0);for(const B of j)AN(B,w,d,E[B.modelIndex],B.modelOpacity!==1?w.stencilModeFor3D():Hn.disabled,w.colorModeForRenderPass());O&&w.resetStencilClippingMasks();const R=ms.additive;for(const B of p)AN(B,w,d,E[B.modelIndex],Hn.disabled,B.isLightMesh?R:w.colorModeForRenderPass())}function _6(w,d,p){const j=d.updateZoomBasedPaintProperties(),E=function(O,R,B){let H,X,te,de=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&de>0){const ce=O.terrain,he=ce.findDEMTileFor(B);he&&he.dem?H=i.eF.create(ce,B,he):de=0}if(de===0&&(R.terrainElevationMin=0,R.terrainElevationMax=0),de===R.validForExaggeration&&(de===0||H&&H._demTile&&H._demTile.tileID===R.validForDEMTile.id&&H._dem._timestamp===R.validForDEMTile.timestamp))return!1;for(const ce in R.instancesPerModel){const he=R.instancesPerModel[ce];for(let ke=0;keX&&(X=he.max)}const te=i.aA(j.x,O,R)-j.x,de=i.aA(j.y,B,H)-j.y,ce=i.cf(X,d.center.lat)-j.z;return d._zoomFromMercatorZ(Math.sqrt(te*te+de*de+ce*ce))}function b6(w,d,p,j,E,O,R){const B=w.context,H=w.renderPass==="shadow",X=w.shadowRenderer,te=H&&X?X.getShadowPassDepthMode():new yn(B.gl.LEQUAL,yn.ReadWrite,w.depthRangeFor3D),de=w.isTileAffectedByFog(O),ce=w.transform.projection.name==="globe";if(p.meshes)for(const he of p.meshes){const ke=ce?[]:["MODEL_POSITION_ON_GPU"],be=[];let Re,De,We;const nt=!ce&&j.instancedDataArray.length>20;nt&&ke.push("INSTANCED_ARRAYS");const Ge=Yp(w,d.paint.get("model-cutoff-fade-range"));if(Ge.shouldRenderCutoff&&ke.push("RENDER_CUTOFF"),H&&X)Re=w.getOrCreateProgram("modelDepth",{defines:ke}),De=I5(R.shadowTileMatrix,R.shadowTileMatrix,Float32Array.from(p.globalMatrix)),We=X.getShadowPassColorMode();else{TN(ke,be,he,w,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Re=w.getOrCreateProgram("model",{defines:ke,overrideFog:de});const gt=he.material,_t=gt.pbrMetallicRoughness,pt=d.paint.get("model-opacity").constantOr(1),ht=d.paint.get("model-emissive-strength").constantOr(0);De=vx(O.expandedProjMatrix,Float32Array.from(p.globalMatrix),new Float32Array(16),null,w,pt,_t.baseColorFactor,gt.emissiveFactor,_t.metallicFactor,_t.roughnessFactor,gt,ht,d,E),X&&(R.shadowUniformsInitialized?Re.setShadowUniformValues(B,X.getShadowUniformValues()):(X.setupShadows(O.toUnwrapped(),Re,"model-tile"),R.shadowUniformsInitialized=!0)),We=Ge.shouldRenderCutoff||pt<1||gt.alphaMode!=="OPAQUE"?ms.alphaBlended:ms.unblended}w.uploadCommonUniforms(B,Re,O.toUnwrapped(),null,Ge);const jt=he.material.doubleSided?Un.disabled:Un.backCCW;if(nt)be.push(j.instancedDataBuffer),Re.draw(w,B.gl.TRIANGLES,te,Hn.disabled,We,jt,De,d.id,he.vertexBuffer,he.indexBuffer,he.segments,d.paint,w.transform.zoom,void 0,be,j.instancedDataArray.length);else{const gt=H?"u_instance":"u_normal_matrix";for(let _t=0;_tH[1]?R:H,O[0]=p.max[0],R=i.aC(i.eG(),O,E),B=R[1]H[1]?R:H,O[1]=p.min[1],R=i.aC(i.eG(),O,E),B=R[1]H[1]?R:H;const X=i.aA(j[0],0,1),te=100*d.pixelsPerMeter*i.aA(j[1],0,1),de=i.aA(j[2],0,1),ce=i.eH(i.eG(),B,H,X),he=Math.tan(.5*d.fovX),ke=-ce[2]*he;if(te===0)return ce[1]<-Math.abs(ke)?de:1;const be=(-Math.abs(ke)-ce[1])/te,Re=(We,nt,Ge)=>(1-Ge)*We+Ge*nt,De=i.aA(Re(1,de,be),de,1);return Re(1,De,i.aA((d.pitch-20)/20,0,1))}class w6{}class ig{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,p,j){{const de=this._storage.get(p.id);if(de)return de.lastUsedFrameIdx=d,de.buf}const E=j.gl,O=E.getBufferParameter(E.ELEMENT_ARRAY_BUFFER,E.BUFFER_SIZE),R=new ArrayBuffer(O),B=new Int16Array(R);E.getBufferSubData(E.ELEMENT_ARRAY_BUFFER,0,new Int16Array(R));const H=new i.eJ;for(let de=0;de30&&(j.buf.destroy(),this._storage.delete(p))}destroy(){for(const[d,p]of this._storage)p.buf.destroy(),this._storage.delete(d)}}class y0{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const v0=i.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class zf{constructor(d){this.revealStart=11,this.revealRange=2}}const F5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class z5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,p){const j=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const R=new i.eK,B=new i.b0;R.emplaceBack(-1,-1),R.emplaceBack(1,-1),R.emplaceBack(1,1),R.emplaceBack(-1,1),B.emplaceBack(0,1,2),B.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(R,F5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const E=i.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,j);const R={u_vignetteShape:(O={vignetteShape:[p.start,p.range,Math.pow(10,p.fadePower)],vignetteColor:[p.color.r,p.color.g,p.color.b,p.color.a*p.strength]}).vignetteShape,u_vignetteColor:O.vignetteColor};j.draw(d,d.context.gl.TRIANGLES,yn.disabled,Hn.disabled,ms.alphaBlended,Un.disabled,R,"vignette",this.vignetteVx,this.vignetteIdx,E)}var O}}class B5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,p){const j=d.getFreeCameraOptions().position,E=j.toAltitude(),O=j.toLngLat(),R=i.an(O.lng),B=i.an(O.lat),H=d.pixelsPerMeter/p,X=R*i.eM,te=i.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 de=-this._offsetYPrev+te,ce=-this._elevationPrev+E;this._accumulatedOffsetX+=(-this._offsetXPrev+X)*H,this._accumulatedOffsetY+=de*H,this._accumulatedElevation+=ce*H,this._offsetXPrev=X,this._offsetYPrev=te,this._elevationPrev=E}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function EN(w,d){return[-(w[0]-Math.floor(w[0]/d)*d),-(w[1]-Math.floor(w[1]/d)*d),-(w[2]-Math.floor(w[2]/d)*d)]}function Ou(w){const d=i.eq(1323123451230),p=[];for(let j=0;j 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 p=d.context;if(!this.particlesVx){const j=Ou(this.particlesCount),E=new i.eN,O=new i.b0;let R=0;const B=i.eq(1323123451230);for(let H=0;Hj)return;const E=Kd(0,1,p.revealStart,p.revealStart+p.revealRange,j);if(!this.particlesVx||!this.particlesIdx)return;const O=structuredClone(this._params);let R=[-O.direction.x,O.direction.y,-100];i.aw(R,R);const B=structuredClone(this._vignetteParams);B.strength*=E,O.overrideStyleParameters||(O.intensity=d.style.rain.state.density,O.timeFactor=d.style.rain.state.intensity,O.color=structuredClone(d.style.rain.state.color),R=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 H=this.updateOnRender(d,O.timeFactor),X=d.context,te=X.gl,de=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new i.T(X,{width:d.width,height:d.height,data:null},te.RGBA8)),O.distortionStrength>0&&(X.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),te.copyTexSubImage2D(te.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const ce=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(X,ce),X.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const he=[O.color.r,O.color.g,O.color.b,O.color.a],ke=(be,Re)=>{const De=EN(this._movement.getPosition(),be),We=O.dropletSizeX,nt=O.dropletSizeX*O.dropletSizeYScale,Ge=d.width/2,jt=d.height/2,gt=Kd(0,O.screenThinning.start,0,1,O.screenThinning.intensity),_t=Kd(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),pt=Kd(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),ht=(St={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:De,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,boxSize:be,rainDropletSize:[We,nt],distortionStrength:O.distortionStrength,rainDirection:R,color:he,screenSize:[de.width,de.height],thinningCenterPos:[Ge,jt],thinningShape:[gt,_t,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:pt,shapeDirectionalPower:O.shapeDirPower,shapeNormalPower:O.shapeNormalPower,mode:Re?0:1},{u_modelview:Float32Array.from(St.modelview),u_projection:Float32Array.from(St.projection),u_time:St.time,u_cam_pos:St.camPos,u_texScreen:0,u_velocityConeAperture:St.velocityConeAperture,u_velocity:St.velocity,u_boxSize:St.boxSize,u_rainDropletSize:St.rainDropletSize,u_distortionStrength:St.distortionStrength,u_rainDirection:St.rainDirection,u_color:St.color,u_screenSize:St.screenSize,u_thinningCenterPos:St.thinningCenterPos,u_thinningShape:St.thinningShape,u_thinningAffectedRatio:St.thinningAffectedRatio,u_thinningParticleOffset:St.thinningParticleOffset,u_shapeDirectionalPower:St.shapeDirectionalPower,u_shapeNormalPower:St.shapeNormalPower,u_mode:St.mode});var St;const Rt=Math.round(O.intensity*this.particlesCount),Dt=i.bg.simpleSegment(0,0,4*Rt,2*Rt);ce.draw(d,te.TRIANGLES,yn.disabled,Hn.disabled,ms.alphaBlended,Un.disabled,ht,"rain_particles",this.particlesVx,this.particlesIdx,Dt)};O.distortionStrength>0&&ke(O.boxSize,!0),ke(O.boxSize,!1),this._vignette.draw(d,B)}}const $5=i.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 U5 extends Sx{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 zf("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 p=d.context;if(!this.particlesVx){const j=Ou(this.particlesCount),E=new i.eO,O=new i.b0;let R=0;const B=i.eq(1323123451230);for(let H=0;HR)return;const B=Kd(0,1,O.revealStart,O.revealStart+O.revealRange,R);E.strength*=B,p.overrideStyleParameters||(p.intensity=d.style.snow.state.density,p.timeFactor=d.style.snow.state.intensity,p.color=structuredClone(d.style.snow.state.color),j=structuredClone(d.style.snow.state.direction),p.screenThinning.intensity=d.style.snow.state.centerThinning,p.billboardSize=2.79*d.style.snow.state.flakeSize,E.strength=1,E.color=structuredClone(d.style.snow.state.vignetteColor));const H=this.updateOnRender(d,p.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const X=d.context,te=X.gl,de=d.transform,ce=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(X,ce),((he,ke,be)=>{const Re=EN(this._movement.getPosition(),he),De=de.width/2,We=de.height/2,nt=Kd(0,be.screenThinning.start,0,1,be.screenThinning.intensity),Ge=Kd(.001,be.screenThinning.range,0,1,be.screenThinning.intensity),jt=Kd(0,be.screenThinning.particleOffset,0,1,be.screenThinning.intensity),gt=(_t={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Re,velocityConeAperture:be.velocityConeAperture,velocity:be.velocity,horizontalOscillationRadius:be.horizontalOscillationRadius,horizontalOscillationRate:be.horizontalOscillationRate,boxSize:he,billboardSize:1*be.billboardSize,simpleShapeParameters:[be.shapeFadeStart,be.shapeFadePower],screenSize:[de.width,de.height],thinningCenterPos:[De,We],thinningShape:[nt,Ge,Math.pow(10,be.screenThinning.fadePower)],thinningAffectedRatio:be.screenThinning.affectedRatio,thinningParticleOffset:jt,color:[be.color.r,be.color.g,be.color.b,be.color.a],direction:j},{u_modelview:Float32Array.from(_t.modelview),u_projection:Float32Array.from(_t.projection),u_time:_t.time,u_cam_pos:_t.camPos,u_velocityConeAperture:_t.velocityConeAperture,u_velocity:_t.velocity,u_horizontalOscillationRadius:_t.horizontalOscillationRadius,u_horizontalOscillationRate:_t.horizontalOscillationRate,u_boxSize:_t.boxSize,u_billboardSize:_t.billboardSize,u_simpleShapeParameters:_t.simpleShapeParameters,u_screenSize:_t.screenSize,u_thinningCenterPos:_t.thinningCenterPos,u_thinningShape:_t.thinningShape,u_thinningAffectedRatio:_t.thinningAffectedRatio,u_thinningParticleOffset:_t.thinningParticleOffset,u_particleColor:_t.color,u_direction:_t.direction});var _t;const pt=Math.round(be.intensity*this.particlesCount),ht=i.bg.simpleSegment(0,0,4*pt,2*pt);this.particlesVx&&this.particlesIdx&&ce.draw(d,te.TRIANGLES,yn.disabled,Hn.disabled,ms.alphaBlended,Un.disabled,gt,"snow_particles",this.particlesVx,this.particlesIdx,ht)})(p.boxSize,0,p),this._vignette.draw(d,E)}}const og={symbol:function(w,d,p,j,E){if(w.renderPass!=="translucent")return;const O=Hn.disabled,R=w.colorModeForRenderPass(),B=p.layout.get("text-variable-anchor"),H=p.layout.get("text-size-scale-range"),X=i.aA(w.scaleFactor,H[0],H[1]);B&&function(ce,he,ke,be,Re,De,We,nt){const Ge=he.transform,jt=Re==="map",gt=De==="map";for(const _t of ce){const pt=be.getTile(_t),ht=pt.getBucket(ke);if(!ht||!ht.text||!ht.text.segments.get().length)continue;const St=i.bK(ht.textSizeData,Ge.zoom,nt),Rt=Or(_t,ht.getProjection(),Ge),Dt=Ge.calculatePixelsToTileUnitsMatrix(pt),Yt=wa(Rt,pt.tileID.canonical,gt,jt,Ge,ht.getProjection(),Dt),Xt=ht.hasIconTextFit()&&ht.hasIconData();St&&In(ht,jt,gt,We,Ge,Yt,_t,Math.pow(2,Ge.zoom-pt.tileID.overscaledZ),St,Xt)}}(j,w,p,d,p.layout.get("text-rotation-alignment"),p.layout.get("text-pitch-alignment"),E,X);const te=p.paint.get("icon-opacity").constantOr(1)!==0,de=p.paint.get("text-opacity").constantOr(1)!==0;p.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(te||de)?r_(w,d,p,j,O,R):(te&&r_(w,d,p,j,O,R,{onlyIcons:!0}),de&&r_(w,d,p,j,O,R,{onlyText:!0})),d.map.showCollisionBoxes&&(nn(w,d,p,j,p.paint.get("text-translate"),p.paint.get("text-translate-anchor"),!0),nn(w,d,p,j,p.paint.get("icon-translate"),p.paint.get("icon-translate-anchor"),!1))},circle:function(w,d,p,j){if(w.renderPass!=="translucent")return;const E=p.paint.get("circle-opacity"),O=p.paint.get("circle-stroke-width"),R=p.paint.get("circle-stroke-opacity"),B=p.layout.get("circle-sort-key").constantOr(1)!==void 0,H=p.paint.get("circle-emissive-strength");if(E.constantOr(1)===0&&(O.constantOr(1)===0||R.constantOr(1)===0))return;const X=w.context,te=X.gl,de=w.transform,ce=!(!w.terrain||!w.terrain.enabled),he=p.layout.get("circle-elevation-reference"),ke=w.depthModeForSublayer(0,yn.ReadOnly),be=new yn(w.context.gl.LEQUAL,yn.ReadOnly,w.depthRangeFor3D),Re=he==="none"||ce?ke:be,De=Hn.disabled,We=w.colorModeForDrapableLayerRenderPass(H),nt=de.projection.name==="globe",Ge=[i.aF(de.center.lng),i.aJ(de.center.lat)],jt=[];for(let _t=0;_t_t.sortKey-pt.sortKey);const gt={useDepthForOcclusion:de.depthOcclusionForSymbolsAndCircles};for(const _t of jt){const{programConfiguration:pt,program:ht,layoutVertexBuffer:St,dynamicBuffers:Rt,indexBuffer:Dt,uniformValues:Yt,tile:Xt}=_t.state,or=_t.segments;w.terrain&&w.terrain.setupElevationDraw(Xt,ht,gt),w.uploadCommonUniforms(X,ht,Xt.tileID.toUnwrapped()),ht.draw(w,te.TRIANGLES,Re,De,We,Un.disabled,Yt,p.id,St,Dt,or,p.paint,de.zoom,pt,Rt)}},heatmap:function(w,d,p,j){if(p.paint.get("heatmap-opacity")!==0)if(w.renderPass==="offscreen"){const E=w.context,O=E.gl,R=Hn.disabled,B=new ms([O.ONE,O.ONE,O.ONE,O.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(he,ke,be,Re){const De=he.gl,We=ke.width*Re,nt=ke.height*Re;he.activeTexture.set(De.TEXTURE1),he.viewport.set([0,0,We,nt]);let Ge=be.heatmapFbo;if(!Ge||Ge&&(Ge.width!==We||Ge.height!==nt)){Ge&&Ge.destroy();const jt=De.createTexture();De.bindTexture(De.TEXTURE_2D,jt),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_WRAP_S,De.CLAMP_TO_EDGE),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_WRAP_T,De.CLAMP_TO_EDGE),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_MIN_FILTER,De.LINEAR),De.texParameteri(De.TEXTURE_2D,De.TEXTURE_MAG_FILTER,De.LINEAR),Ge=be.heatmapFbo=he.createFramebuffer(We,nt,1,null),function(gt,_t,pt,ht,St,Rt){const Dt=gt.gl;Dt.texImage2D(Dt.TEXTURE_2D,0,gt.extRenderToTextureHalfFloat?Dt.RGBA16F:Dt.RGBA,St,Rt,0,Dt.RGBA,gt.extRenderToTextureHalfFloat?Dt.HALF_FLOAT:Dt.UNSIGNED_BYTE,null),ht.colorAttachment0.set(pt)}(he,0,jt,Ge,We,nt)}else De.bindTexture(De.TEXTURE_2D,Ge.colorAttachment0.get()),he.bindFramebuffer.set(Ge.framebuffer)})(E,w,p,w.transform.projection.name==="globe"?.5:.25),E.clear({color:i.ao.transparent});const H=w.transform,X=H.projection.name==="globe",te=X?["PROJECTION_GLOBE_VIEW"]:[],de=X?Un.frontCCW:Un.disabled,ce=[i.aF(H.center.lng),i.aJ(H.center.lat)];for(let he=0;he({u_image:0,u_color_ramp:1,u_opacity:de.paint.get("heatmap-opacity")}))(0,O),O.id,E.viewportBuffer,E.quadTriangleIndexBuffer,E.viewportSegments,O.paint,E.transform.zoom)}(w,p))},line:function(w,d,p,j){if(w.renderPass!=="translucent")return;const E=p.paint.get("line-opacity"),O=p.paint.get("line-width");if(E.constantOr(1)===0||O.constantOr(1)===0)return;const R=p.paint.get("line-emissive-strength").isConstant(),B=p.paint.get("line-emissive-strength").constantOr(0),H=p.paint.get("line-occlusion-opacity"),X=p.layout.get("line-elevation-reference"),te=p.layout.get("line-width-unit")==="meters",de=X==="sea",ce=!(!w.terrain||!w.terrain.enabled),he=w.context,ke=he.gl;if(p.hasElevatedBuckets&&w.transform.projection.name==="globe")return;const be=p.layout.get("line-cross-slope"),Re=be!==void 0,De=be<1,We=w.colorModeForDrapableLayerRenderPass(R?B:null),nt=w.terrain&&w.terrain.renderingToTexture,Ge=nt?1:i.o.devicePixelRatio,jt=p.paint.get("line-dasharray"),gt=jt.constantOr(1),_t=p.layout.get("line-cap"),pt=jt.constantOr(null),ht=_t.constantOr(null),St=p.paint.get("line-pattern"),Rt=St.constantOr(1),Dt=p.paint.get("line-pattern-cross-fade"),Yt=St.constantOr(null),Xt=p.paint.get("line-opacity").constantOr(1);let or=!Rt&&Xt!==1||w.depthOcclusion&&H>0&&H<1;const wr=p.paint.get("line-gradient"),Vt=Rt?"linePattern":"line",Et=i.e2(p);let er;if(nt&&w.terrain&&w.terrain.clipOrMaskOverlapStencilType()&&(or=!1),H!==0&&w.depthOcclusion){const Yr=p.paint._values["line-opacity"];Yr&&Yr.value&&Yr.value.kind==="constant"?er=Yr.value:i.w(`Occlusion opacity for layer ${p.id} is supported only when line-opacity isn't data-driven.`)}O.value.kind!=="constant"&&O.value.isLineProgressConstant===!1&&Et.push("VARIABLE_LINE_WIDTH"),nt&&(w.emissiveMode!=="dual-source-blending"||R?w.emissiveMode==="mrt-fallback"&&Et.push("USE_MRT1"):Et.push("DUAL_SOURCE_BLENDING"));const Kt=(Yr,Tr,jr,fn,an,Hr)=>{for(const Qr of Yr){const Mn=d.getTile(Qr);if(Rt&&!Mn.patternsLoaded())continue;const rs=Mn.getBucket(p);if(!rs||rs.elevationType!=="none"&&!an||rs.elevationType==="none"&&an)continue;w.prepareDrawTile();const Gs=[...Tr],ka=w.shadowRenderer,xn=rs.elevationType==="road"&&!!ka&&ka.enabled;let fa=[0,0,0];if(xn){const ps=w.style.directionalLight,pi=w.style.ambientLight;ps&&pi&&(fa=Pf(w.style,ps,pi)),Gs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Qn=rs.programConfigurations.get(p.id);let Ma=!1;if(Yt&&Mn.imageAtlas){const ps=i.e3.from(Yt),pi=ps.getPrimary().scaleSelf(Ge).toString(),ho=Mn.imageAtlas.patternPositions.get(pi),qi=ps.getSecondary(),Ja=qi?Mn.imageAtlas.patternPositions.get(qi.scaleSelf(Ge).toString()):null;Ma=!!ho&&!!Ja,ho&&Qn.setConstantPatternPositions(ho,Ja)}Dt>0&&(Ma||Qn.getPatternTransitionVertexBuffer("line-pattern"))&&Gs.push("LINE_PATTERN_TRANSITION");const qa=w.isTileAffectedByFog(Qr),Da=w.getOrCreateProgram(Vt,{config:Qn,defines:Gs,overrideFog:qa});if(!Rt&&pt&&ht&&Mn.lineAtlas){const ps=Mn.lineAtlas.getDash(pt,ht);ps&&Qn.setConstantPatternPositions(ps)}xn&&ka.setupShadows(Mn.tileID.toUnwrapped(),Da,"vector-tile");let[ha,fs]=p.paint.get("line-trim-offset");(ht==="round"||ht==="square")&&ha!==fs&&(ha===0&&(ha-=1),fs===1&&(fs+=1));const Ca=nt?Qr.projMatrix:null,Zi=te?1/rs.tileToMeter/i.ay(Mn,1,w.transform.zoom):1,Ni=te?1/rs.tileToMeter/i.ay(Mn,1,Math.floor(w.transform.zoom)):1,Ta=Rt?i.e4(w,Mn,p,Ca,Ge,Zi,Ni,[ha,fs],fa,Dt):i.e5(w,Mn,p,Ca,rs.lineClipsArray.length,Ge,Zi,Ni,[ha,fs],fa);if(wr){const ps=rs.gradients[p.id];let pi=ps.texture;if(p.gradientVersion!==ps.version){let ho=256;if(p.stepInterpolant){const qi=d.getSource().maxzoom,Ja=Qr.canonical.z===qi?Math.ceil(1<{er!=null&&(er.value=Xt*H),Da.draw(w,ke.TRIANGLES,jr,ps,We,Un.disabled,Ta,p.id,rs.layoutVertexBuffer,rs.indexBuffer,rs.segments,p.paint,w.transform.zoom,Qn,[rs.layoutVertexBuffer2,rs.patternVertexBuffer,rs.zOffsetVertexBuffer]),er!=null&&(er.value=Xt)};if(or&&!an){const ps=w.stencilModeForClipping(Qr).ref;ps===0&&nt&&he.clear({stencil:0});const pi={func:ke.EQUAL,mask:255};Ta.u_alpha_discard_threshold=.8,oa(new Hn(pi,ps,255,ke.KEEP,ke.KEEP,ke.INVERT)),Ta.u_alpha_discard_threshold=0,oa(new Hn(pi,ps,255,ke.KEEP,ke.KEEP,ke.KEEP))}else Ta.u_alpha_discard_threshold=or&&an&&Hr?.8:0,oa(an?fn:w.stencilModeForClipping(Qr))}};let mr=w.depthModeForSublayer(0,yn.ReadOnly);const Lr=new yn(w.depthOcclusion?ke.GREATER:ke.LEQUAL,yn.ReadOnly,w.depthRangeFor3D);if(p.hasNonElevatedBuckets){const Yr=!nt&&w.terrain;H!==0&&Yr?i.w(`Occlusion opacity for layer ${p.id} is supported on terrain only if the layer has line-z-offset enabled.`):Yr?i.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${p.id}.`):Kt(j,Et,mr,Hn.disabled,!1,!0)}if(p.hasElevatedBuckets){X==="hd-road-markup"?ce||(mr=Lr,Et.push("ELEVATED_ROADS")):(Et.push("ELEVATED"),mr=Lr,Re&&Et.push(De?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),de&&Et.push("ELEVATION_REFERENCE_SEA"));const Yr=or?w.stencilModeFor3D():Hn.disabled;w.forceTerrainMode=!0,Kt(j,Et,mr,Yr,!0,!0),or&&Kt(j,Et,mr,Yr,!0,!1),w.forceTerrainMode=!1}or&&(w.resetStencilClippingMasks(),nt&&he.clear({stencil:0})),H===0||w.depthOcclusion||nt||w.layersWithOcclusionOpacity.push(w.currentLayer)},fill:function(w,d,p,j){const E=p.paint.get("fill-color"),O=p.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const R=p.paint.get("fill-emissive-strength"),B=w.colorModeForDrapableLayerRenderPass(R),H=p.paint.get("fill-pattern"),X=w.opaquePassEnabledForLayer()&&!H.constantOr(1)&&E.constantOr(i.ao.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";let te="none";p.layout.get("fill-elevation-reference")!=="none"?te="road":p.paint.get("fill-z-offset").constantOr(1)!==0&&(te="offset");const de=!(!w.terrain||!w.terrain.enabled),ce={painter:w,sourceCache:d,layer:p,coords:j,colorMode:B,elevationType:te,terrainEnabled:de,pass:X};if(w.renderPass==="shadow")return void(w.shadowRenderer&&te==="road"&&!de&&function(ke){const{painter:be,sourceCache:Re,layer:De,coords:We}=ke,nt=be.context.gl,Ge=ke.painter.shadowRenderer;for(const jt of We){const gt=Re.getTile(jt),_t=gt.getBucket(De);if(!_t)continue;const pt=_t.elevatedStructures;if(!pt||!pt.shadowCasterSegments||pt.shadowCasterSegments.segments[0].primitiveLength===0)continue;be.prepareDrawTile();const ht=_t.bufferData.programConfigurations.get(De.id),St=be.isTileAffectedByFog(jt),Rt=be.getOrCreateProgram("elevatedStructuresDepth",{config:ht,overrideFog:St}),Dt=Ge.calculateShadowPassMatrixFromTile(gt.tileID.toUnwrapped());be.uploadCommonUniforms(be.context,Rt,jt.toUnwrapped());const Yt={u_matrix:Dt,u_depth_bias:0};Rt.draw(be,nt.TRIANGLES,Ge.getShadowPassDepthMode(),Hn.disabled,Ge.getShadowPassColorMode(),Un.disabled,Yt,De.id,pt.vertexBuffer,pt.indexBuffer,pt.shadowCasterSegments,De.paint,be.transform.zoom,ht)}}(ce));const he=w.emissiveMode==="mrt-fallback";if(te!=="offset"){if(_N(ce,!1,he),te==="road"){const ke=!de&&w.renderPass==="translucent";ke&&vN(w,d,p,j,"geometry"),_N(ce,!0,he,Hn.disabled),ke&&function(be){const{painter:Re,sourceCache:De,layer:We,coords:nt,colorMode:Ge}=be,jt=Re.context.gl,gt=be.painter.shadowRenderer,_t=!!gt&>.enabled,pt=new yn(Re.context.gl.LEQUAL,yn.ReadOnly,Re.depthRangeFor3D);let ht=[0,0,0];if(_t){const Rt=Re.style.directionalLight,Dt=Re.style.ambientLight;Rt&&Dt&&(ht=Pf(Re.style,Rt,Dt))}const St=Rt=>{for(const Dt of nt){const Yt=De.getTile(Dt),Xt=Yt.getBucket(We);if(!Xt)continue;const or=Xt.elevatedStructures;if(!or)continue;let wr,Vt;if(Rt?(wr=or.renderableBridgeSegments,Vt=or.bridgeProgramConfigurations.get(We.id)):(wr=or.renderableTunnelSegments,Vt=or.tunnelProgramConfigurations.get(We.id)),!wr||wr.segments[0].primitiveLength===0)continue;Vt.updatePaintBuffers(),Re.prepareDrawTile();const Et=Re.isTileAffectedByFog(Dt),er=[];_t&&er.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Kt=Re.getOrCreateProgram("elevatedStructures",{config:Vt,overrideFog:Et,defines:er}),mr=Re.translatePosMatrix(Dt.projMatrix,Yt,We.paint.get("fill-translate"),We.paint.get("fill-translate-anchor"));_t&>.setupShadows(Yt.tileID.toUnwrapped(),Kt,"vector-tile");const Lr=rg(mr,ht);Re.uploadCommonUniforms(Re.context,Kt,Dt.toUnwrapped()),Kt.draw(Re,jt.TRIANGLES,pt,Hn.disabled,Ge,Un.backCCW,Lr,We.id,or.vertexBuffer,or.indexBuffer,wr,We.paint,Re.transform.zoom,Vt,[or.vertexBufferNormal])}};St(!0),St(!1)}(ce)}}else _N(ce,!1,he,w.stencilModeFor3D())},"fill-extrusion":function(w,d,p,j){const E=p.paint.get("fill-extrusion-opacity"),O=w.context,R=O.gl,B=w.terrain,H=B&&B.renderingToTexture;if(E===0)return;const X=w.emissiveMode==="mrt-fallback",te=w.conflationActive&&w.style.isLayerClipped(p,d.getSource()),de=w.style.order.indexOf(p.fqid);if(te&&function(ce,he,ke,be,Re){for(const De of be){const We=he.getTile(De).getBucket(ke);We&&(We.updateReplacement(De,ce.replacementSource,Re),We.uploadCentroid(ce.context))}}(w,d,p,j,de),B||te)for(const ce of j){const he=d.getTile(ce).getBucket(p);he&&noe(w.context,d,ce,he,p,B,te)}if(w.renderPass==="shadow"&&w.shadowRenderer){const ce=w.shadowRenderer;if(B&&E<.65&&p._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ad)return;const he=ce.getShadowPassDepthMode(),ke=ce.getShadowPassColorMode();bN(w,d,p,j,he,Hn.disabled,ke,te)}else if(w.renderPass==="translucent"){const ce=!p.paint.get("fill-extrusion-pattern").constantOr(1),he=p.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!H&&he.a!==0){const ke=new yn(w.context.gl.LEQUAL,yn.ReadWrite,w.depthRangeFor3D);E===1&&ce?bN(w,d,p,j,ke,Hn.disabled,ms.unblended,te):(bN(w,d,p,j,ke,Hn.disabled,ms.disabled,te),bN(w,d,p,j,ke,w.stencilModeFor3D(),w.colorModeForRenderPass(),te),w.resetStencilClippingMasks())}if(w.style.enable3dLights()&&ce&&(!B&&w.transform.projection.name!=="globe"||H)){const ke=p.paint.get("fill-extrusion-opacity"),be=p.paint.get("fill-extrusion-ambient-occlusion-intensity"),Re=p.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),De=p.paint.get("fill-extrusion-flood-light-intensity"),We=p.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",nt=p.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(We?null:p.lut).toArray01().slice(0,3),Ge=be>0&&Re>0,jt=De>0,gt=(ht,St,Rt)=>(1-Rt)*ht+Rt*St,_t=new O5;_t.translate=p.paint.get("fill-extrusion-translate"),_t.translateAnchor=p.paint.get("fill-extrusion-translate-anchor"),_t.edgeRadius=p.layout.get("fill-extrusion-edge-radius"),_t.cutoffFadeRange=p.paint.get("fill-extrusion-cutoff-fade-range");const pt=ht=>{const St=w.depthModeForSublayer(1,yn.ReadOnly,R.LEQUAL,!0),Rt=p.paint.get(ht?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Dt=gt(.1,3,Rt),Yt=w._showOverdrawInspector;if(!Yt){const Xt=new Hn({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),or=new ms([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0],R.MIN);Df(_t,w,d,p,j,St,Xt,or,Un.disabled,ht,"sdf",ke,be,Re,De,nt,Dt,te,!1)}{const Xt=Yt?Hn.disabled:new Hn({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),or=Yt?w.colorModeForRenderPass():new ms([R.ONE_MINUS_DST_ALPHA,R.DST_ALPHA,R.ONE,R.ONE],i.ao.transparent,[!0,!0,!0,!0]);Df(_t,w,d,p,j,St,Xt,or,Un.disabled,ht,"color",ke,be,Re,De,nt,Dt,te,!1)}};if(H){const ht=()=>{const Rt=B.drapeBufferSize[0],Dt=B.drapeBufferSize[1];let Yt=B.framebufferCopyTexture;return Yt&&(!Yt||Yt.size[0]===Rt&&Yt.size[1]===Dt)||(Yt&&Yt.destroy(),Yt=B.framebufferCopyTexture=new i.T(O,new i.q({width:Rt,height:Dt}),R.RGBA8)),Yt.bind(R.LINEAR,R.CLAMP_TO_EDGE),R.copyTexSubImage2D(R.TEXTURE_2D,0,0,0,0,0,Rt,Dt),Yt},St=(Rt,Dt,Yt)=>{const Xt=w.depthModeForSublayer(1,yn.ReadOnly,R.LEQUAL,!1),or=p.paint.get(Rt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),wr=gt(.1,3,or);{const Vt=new ms([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0]);Df(_t,w,d,p,j,Xt,Hn.disabled,Vt,Un.disabled,Rt,"clear",ke,be,Re,De,nt,wr,te,Dt)}{const Vt=new Hn({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),Et=new ms([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0],R.MIN);Df(_t,w,d,p,j,Xt,Vt,Et,Un.disabled,Rt,"sdf",ke,be,Re,De,nt,wr,te,Dt)}X&&!Rt&&(Yt=ht());{const Vt=Rt?R.ZERO:R.ONE_MINUS_DST_ALPHA,Et=new Hn({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),er=new ms([Vt,R.DST_ALPHA,R.ONE_MINUS_DST_ALPHA,R.ZERO],i.ao.transparent,[!0,!0,!0,!0]);Df(_t,w,d,p,j,Xt,Et,er,Un.disabled,Rt,"color",ke,be,Re,De,nt,wr,te,Dt)}if(!X||Rt){const Vt=new ms([R.ONE,R.ONE,R.ONE,Rt?R.ZERO:R.ONE],i.ao.transparent,[!1,!1,!1,!0],Rt?R.FUNC_ADD:R.MAX);Df(_t,w,d,p,j,Xt,Hn.disabled,Vt,Un.disabled,Rt,"clear",ke,be,Re,De,nt,wr,te,Dt,Yt)}else{R.drawBuffers([R.NONE,R.COLOR_ATTACHMENT1]);const Vt=new Hn({func:R.EQUAL,mask:255},254,255,R.KEEP,R.DECR,R.DECR),Et=new ms([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!0,!1,!1,!1],R.MAX);Df(_t,w,d,p,j,Xt,Vt,Et,Un.disabled,Rt,"emissive",ke,be,Re,De,nt,wr,te,Dt,Yt),R.drawBuffers([R.COLOR_ATTACHMENT0])}};if(Ge||jt){let Rt;w.prepareDrawTile(),X&&!Ge||(Rt=ht()),Ge&&St(!0,!1,Rt),jt&&St(!1,!0,Rt)}}else Ge&&pt(!0),jt&&pt(!1),(Ge||jt)&&w.resetStencilClippingMasks()}}},building:function(w,d,p,j){w.currentLayer0&&O>0,X=!0;const te=p.paint.get("building-vertical-scale");if(te<=0)return;w.shadowRenderer||(X=!1);const de=w.conflationActive&&w.style.isLayerClipped(p,d.getSource()),ce=w.style.order.indexOf(p.fqid);if(function(he,ke,be,Re,De,We){for(const nt of We){const Ge=ke.getTile(nt).getBucket(be);Ge&&(De&&Ge.updateReplacement(nt,he.replacementSource,Re),Ge.uploadUpdatedIndexBuffer(he.context))}}(w,d,p,ce,de,j),function(he,ke,be,Re){for(const De of Re){const We=ke.getTile(De).getBucket(be);We&&We.needsEvaluation()&&We.uploadUpdatedColorBuffer(he.context)}}(w,d,p,j),p.resetLayerRenderingStats(w),w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0),w.renderPass==="shadow"&&w.shadowRenderer){const he=w.shadowRenderer,ke=[],be=he.getShadowPassDepthMode();n_({painter:w,source:d,layer:p,coords:j,defines:ke,blendMode:he.getShadowPassColorMode(),depthMode:be,opacity:B,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(w.renderPass==="translucent"){let he=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];X&&(he=he.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),w.shadowRenderer&&w.shadowRenderer.useNormalOffset&&(he=he.concat("NORMAL_OFFSET"));const ke=p.paint.get("building-facade-emissive-chance"),be=p.paint.get("building-ambient-occlusion-intensity"),Re=p.paint.get("building-flood-light-intensity"),De=p.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",We=p.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(De?null:p.lut).toArray01().slice(0,3),nt=p.paint.get("building-flood-light-ground-attenuation"),Ge=Re>0,jt=new yn(w.context.gl.LEQUAL,yn.ReadWrite,w.depthRangeFor3D);B<1&&n_({painter:w,source:d,layer:p,coords:j,defines:he,blendMode:ms.disabled,depthMode:jt,opacity:B,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:be,floodLightIntensity:Re,floodLightColor:We,depthOnly:!0});const gt=w.colorModeForRenderPass();n_({painter:w,source:d,layer:p,coords:j,defines:he,blendMode:gt,depthMode:jt,opacity:B,verticalScale:te,facadeEmissiveChance:ke,facadeAOIntensity:be,floodLightIntensity:Re,floodLightColor:We}),H&&wN(w,d,p,j,!0,B,E,O,Re,We,R,de),Ge&&wN(w,d,p,j,!1,B,E,O,Re,We,nt,de)}else if(w.renderPass==="light-beam"){const he=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],ke=new yn(w.context.gl.LEQUAL,yn.ReadOnly,w.depthRangeFor3D);n_({painter:w,source:d,layer:p,coords:j,defines:he,blendMode:ms.alphaBlended,depthMode:ke,opacity:B,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1),w.resetStencilClippingMasks()},hillshade:function(w,d,p,j){if(w.renderPass!=="offscreen"&&w.renderPass!=="translucent"||w.style.disableElevatedTerrain)return;const E=w.context,O=w.terrain&&w.terrain.renderingToTexture,[R,B]=w.renderPass!=="translucent"||O?[{},j]:w.stencilConfigForOverlap(j);for(const H of B){const X=d.getTile(H);if(X.needsHillshadePrepare&&w.renderPass==="offscreen")Gie(w,X,p);else if(w.renderPass==="translucent"){const te=w.depthModeForSublayer(0,yn.ReadOnly),de=p.paint.get("hillshade-emissive-strength"),ce=w.colorModeForDrapableLayerRenderPass(de),he=O&&w.terrain?w.terrain.stencilModeForRTTOverlap(H):R[H.overscaledZ];Wie(w,H,X,p,te,he,ce)}}E.viewport.set([0,0,w.width,w.height]),w.resetStencilClippingMasks()},raster:function(w,d,p,j,E,O){if(w.renderPass!=="translucent"||p.paint.get("raster-opacity")===0)return;const R=w.transform.projection.name==="globe",B=p.paint.get("raster-elevation")!==0,H=B&&R;if(w.renderElevatedRasterBackface&&!H)return;const X=w.context,te=X.gl,de=d.getSource(),ce=function(gt,_t,pt,ht,St){const Rt=_t.paint.get("raster-color"),Dt=gt.type==="raster-array",Yt=[],Xt=_t.paint.get("raster-resampling"),or=_t.paint.get("raster-color-mix");let wr=_t.paint.get("raster-color-range");const Vt=[or[0],or[1],or[2],0],Et=or[3];let er=Xt==="nearest"?ht.NEAREST:ht.LINEAR;if(Dt&&(Yt.push("RASTER_ARRAY"),Rt||Yt.push("RASTER_COLOR"),Xt==="linear"&&Yt.push("RASTER_ARRAY_LINEAR"),er=ht.NEAREST,!wr&>.rasterLayers)){const Kt=gt.rasterLayers.find(({id:mr})=>mr===_t.sourceLayer);Kt&&Kt.fields&&Kt.fields.range&&(wr=Kt.fields.range)}if(wr=wr||[0,1],Rt){Yt.push("RASTER_COLOR"),pt.activeTexture.set(ht.TEXTURE2),_t.updateColorRamp(wr);let Kt=_t.colorRampTexture;Kt||(Kt=_t.colorRampTexture=new i.T(pt,_t.colorRamp,ht.RGBA8)),Kt.bind(ht.LINEAR,ht.CLAMP_TO_EDGE)}return St&&Yt.push("USE_MRT1"),{mix:Vt,range:wr,offset:Et,defines:Yt,resampling:er}}(de,p,X,te,w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback");if(de instanceof i.aU&&!j.length&&!R)return;const he=p.paint.get("raster-emissive-strength"),ke=w.colorModeForDrapableLayerRenderPass(he),be=w.terrain&&w.terrain.renderingToTexture,Re=!w.options.moving,De=p.paint.get("raster-resampling")==="nearest"?te.NEAREST:te.LINEAR;if(de instanceof i.aU&&!j.length&&(de.onNorthPole||de.onSouthPole)){const gt=B?w.stencilModeFor3D():Hn.disabled;return void s_(!!de.onNorthPole,null,w,d,p,he,ce,Un.disabled,gt)}if(!j.length)return;const[We,nt]=de instanceof i.aU||be?[{},j]:w.stencilConfigForOverlap(j),Ge=nt[nt.length-1].overscaledZ;H&&ce.defines.push("PROJECTION_GLOBE_VIEW"),B&&ce.defines.push("RENDER_CUTOFF");const jt=(gt,_t,pt)=>{for(const ht of gt){const St=ht.toUnwrapped(),Rt=d.getTile(ht);if(be&&(!Rt||!Rt.hasData()))continue;X.activeTexture.set(te.TEXTURE0);const Dt=Ff(Rt,de,p,ce);if(!Dt||!Dt.texture)continue;const{texture:Yt,mix:Xt,offset:or,tileSize:wr,buffer:Vt}=Dt;let Et,er;be?(Et=yn.disabled,er=ht.projMatrix):B?(Et=new yn(te.LEQUAL,yn.ReadWrite,w.depthRangeFor3D),er=R?Float32Array.from(w.transform.expandedFarZProjMatrix):w.transform.calculateProjMatrix(St,Re)):(Et=w.depthModeForSublayer(ht.overscaledZ-Ge,p.paint.get("raster-opacity")===1?yn.ReadWrite:yn.ReadOnly,te.LESS),er=w.transform.calculateProjMatrix(St,Re));const Kt=w.terrain&&be?w.terrain.stencilModeForRTTOverlap(ht):We[ht.overscaledZ],mr=O?0:p.paint.get("raster-fade-duration");Rt.registerFadeDuration(mr);const Lr=d.findLoadedParent(ht,0),Yr=Qv(Rt,Lr,d,w.transform,mr);let Tr,jr;!Yr.isFading&&Rt.refreshedUponExpiration&&(Rt.refreshedUponExpiration=!1),w.terrain&&w.terrain.prepareDrawTile(),X.activeTexture.set(te.TEXTURE0),Yt.bind(De,te.CLAMP_TO_EDGE),X.activeTexture.set(te.TEXTURE1),Lr?(Lr.texture&&Lr.texture.bind(De,te.CLAMP_TO_EDGE),Tr=Math.pow(2,Lr.tileID.overscaledZ-Rt.tileID.overscaledZ),jr=[Rt.tileID.canonical.x*Tr%1,Rt.tileID.canonical.y*Tr%1]):Yt.bind(De,te.CLAMP_TO_EDGE),"useMipmap"in Yt&&X.extTextureFilterAnisotropic&&w.transform.pitch>20&&te.texParameterf(te.TEXTURE_2D,X.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,X.extTextureFilterAnisotropicMax);const fn=w.transform;let an;const Hr=B?c6(fn):[0,0,0,0];let Qr,Mn,rs,Gs,ka,xn=0;if(H&&de instanceof i.aU&&de.coordinates.length>3)Qr=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),Mn=Float32Array.from(fn.globeMatrix),rs=Float32Array.from(i.dF(fn)),Gs=[i.aF(fn.center.lng),i.aJ(fn.center.lat)],an=de.elevatedGlobePerspectiveTransform,ka=de.elevatedGlobeGridMatrix||new Float32Array(9);else if(H){const qa=i.dG(ht.canonical);xn=i.dH(qa.getCenter().lat),Qr=Float32Array.from(i.bk(i.dJ(ht.canonical))),Mn=Float32Array.from(fn.globeMatrix),rs=Float32Array.from(i.dF(fn)),Gs=[i.aF(fn.center.lng),i.aJ(fn.center.lat)],an=[0,0],ka=Float32Array.from(i.dI(ht.canonical,qa,xn,fn.worldSize/fn._pixelsPerMercatorPixel))}else an=de instanceof i.aU?de.perspectiveTransform:[0,0],Qr=new Float32Array(16),Mn=new Float32Array(9),rs=new Float32Array(16),Gs=[0,0],ka=new Float32Array(9);const fa=r6(er,Qr,Mn,rs,ka,jr||[0,0],i.aj(w.transform.zoom),Gs,Hr,Tr||1,Yr,p,an,B?p.paint.get("raster-elevation"):0,2,Xt,or,ce.range,wr,Vt,he),Qn=w.isTileAffectedByFog(ht),Ma=w.getOrCreateProgram("raster",{defines:ce.defines,overrideFog:Qn});if(w.uploadCommonUniforms(X,Ma,St),de instanceof i.aU){const qa=de.elevatedGlobeVertexBuffer,Da=de.elevatedGlobeIndexBuffer;if(be||!R)de.boundsBuffer&&de.boundsSegments&&Ma.draw(w,te.TRIANGLES,Et,Hn.disabled,ke,Un.disabled,fa,p.id,de.boundsBuffer,w.quadTriangleIndexBuffer,de.boundsSegments);else if(qa&&Da){const ha=fn.zoom<=i.c_?de.elevatedGlobeSegments:de.getSegmentsForLongitude(fn.center.lng);ha&&Ma.draw(w,te.TRIANGLES,Et,Hn.disabled,ke,_t,fa,p.id,qa,Da,ha)}}else if(H){Et=new yn(te.LEQUAL,yn.ReadOnly,w.depthRangeFor3D);const qa=w.globeSharedBuffers;if(qa){const[Da,ha,fs]=qa.getGridBuffers(xn,!1);Ma.draw(w,te.TRIANGLES,Et,pt||Kt,w.colorModeForRenderPass(),_t,fa,p.id,Da,ha,fs)}}else{const{tileBoundsBuffer:qa,tileBoundsIndexBuffer:Da,tileBoundsSegments:ha}=w.getTileBoundsBuffers(Rt);Ma.draw(w,te.TRIANGLES,Et,Kt,ke,Un.disabled,fa,p.id,qa,Da,ha)}}if(!(de instanceof i.aU)&&H)for(const ht of gt){const St=ht.canonical.y===(1<>>16,2654435769),((ht=Math.imul(ht^ht>>>16,2654435769))>>>0)/4294967296},pt=1/1.1;for(let ht=0;hti.e9[Kt](Yt));Vt.push(Yt);const Et=Yt.canonical.x,er=Yt.canonical.y;for(const Kt of Vt){const mr=Ge.getTile(St?Kt.wrapped():Kt);if(!mr)continue;const Lr=mr.rasterParticleState;if(!Lr)continue;const Yr=Kt.canonical.x+(1<_t.tileID)),he&&(X.activeTexture.set(te.TEXTURE0),w.imageManager.bind(w.context,p.scope));const gt=[];if(w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&>.push("USE_MRT1"),H){const _t=w.getOrCreateProgram(nt,{overrideFog:!1,overrideRtt:!0,defines:gt}),pt=new Float32Array(i.bA([])),ht=new i.aQ(0,0,0,0,0),St=he?sg(pt,B,R,w,0,p.scope,ke,H,{tileID:ht,tileSize:ce}):e_(pt,B,R,E.toPremultipliedRenderColor(O?null:p.lut));_t.draw(w,te.TRIANGLES,De,Re,We,Un.disabled,St,p.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments)}else for(const _t of jt){const pt=w.isTileAffectedByFog(_t),ht=w.getOrCreateProgram(nt,{overrideFog:pt,defines:gt}),St=_t.toUnwrapped(),Rt=j?_t.projMatrix:w.transform.calculateProjMatrix(St);w.prepareDrawTile();const Dt=d?d.getTile(_t):Ge?Ge[_t.key]:new Tf(_t,ce,de.zoom,w),Yt=he?sg(Rt,B,R,w,0,p.scope,ke,H,{tileID:_t,tileSize:ce}):e_(Rt,B,R,E.toPremultipliedRenderColor(O?null:p.lut));w.uploadCommonUniforms(X,ht,St);const{tileBoundsBuffer:Xt,tileBoundsIndexBuffer:or,tileBoundsSegments:wr}=w.getTileBoundsBuffers(Dt);ht.draw(w,te.TRIANGLES,De,Re,We,Un.disabled,Yt,p.id,Xt,or,wr)}},sky:function(w,d,p){const j=w._atmosphere?i.aj(w.transform.zoom):1,E=p.paint.get("sky-opacity")*j;if(E===0)return;const O=w.context,R=p.paint.get("sky-type"),B=new yn(O.gl.LEQUAL,yn.ReadOnly,[0,1]),H=w.frameCounter/1e3%1;R==="atmosphere"?w.renderPass==="offscreen"?p.needsSkyboxCapture(w)&&(function(X,te,de,ce){const he=X.context,ke=he.gl;let be=te.skyboxFbo;if(!be){be=te.skyboxFbo=he.createFramebuffer(32,32,1,null),te.skyboxGeometry=new SN(he),te.skyboxTexture=he.gl.createTexture(),ke.bindTexture(ke.TEXTURE_CUBE_MAP,te.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 nt=0;nt<6;++nt)ke.texImage2D(ke.TEXTURE_CUBE_MAP_POSITIVE_X+nt,0,ke.RGBA,32,32,0,ke.RGBA,ke.UNSIGNED_BYTE,null)}he.bindFramebuffer.set(be.framebuffer),he.viewport.set([0,0,32,32]);const Re=te.getCenter(X,!0),De=X.getOrCreateProgram("skyboxCapture"),We=new Float64Array(16);i.bA(We),i.en(We,We,.5*-Math.PI),kx(X,te,De,We,Re,0),i.bA(We),i.en(We,We,.5*Math.PI),kx(X,te,De,We,Re,1),i.bA(We),i.cU(We,We,.5*-Math.PI),kx(X,te,De,We,Re,2),i.bA(We),i.cU(We,We,.5*Math.PI),kx(X,te,De,We,Re,3),i.bA(We),kx(X,te,De,We,Re,4),i.bA(We),i.en(We,We,Math.PI),kx(X,te,De,We,Re,5),he.viewport.set([0,0,X.width,X.height])}(w,p),p.markSkyboxValid(w)):w.renderPass==="sky"&&function(X,te,de,ce,he){const ke=X.context,be=ke.gl,Re=X.transform,De=X.getOrCreateProgram("skybox");ke.activeTexture.set(be.TEXTURE0),be.bindTexture(be.TEXTURE_CUBE_MAP,te.skyboxTexture);const We=((nt,Ge,jt,gt,_t)=>({u_matrix:nt,u_sun_direction:Ge,u_cubemap:0,u_opacity:gt,u_temporal_offset:_t}))(Re.skyboxMatrix,te.getCenter(X,!1),0,ce,he);X.uploadCommonUniforms(ke,De),De.draw(X,be.TRIANGLES,de,Hn.disabled,X.colorModeForRenderPass(),Un.backCW,We,"skybox",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,p,B,E,H):R==="gradient"&&w.renderPass==="sky"&&function(X,te,de,ce,he){const ke=X.context,be=ke.gl,Re=X.transform,De=X.getOrCreateProgram("skyboxGradient");te.skyboxGeometry||(te.skyboxGeometry=new SN(ke)),ke.activeTexture.set(be.TEXTURE0);let We=te.colorRampTexture;We||(We=te.colorRampTexture=new i.T(ke,te.colorRamp,be.RGBA8)),We.bind(be.LINEAR,be.CLAMP_TO_EDGE);const nt=((Ge,jt,gt,_t,pt)=>({u_matrix:Ge,u_color_ramp:0,u_center_direction:jt,u_radius:i.an(gt),u_opacity:_t,u_temporal_offset:pt}))(Re.skyboxMatrix,te.getCenter(X,!1),te.paint.get("sky-gradient-radius"),ce,he);X.uploadCommonUniforms(ke,De),De.draw(X,be.TRIANGLES,de,Hn.disabled,X.colorModeForRenderPass(),Un.backCW,nt,"skyboxGradient",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,p,B,E,H)},custom:function(w,d,p,j){const E=w.context,O=p.implementation;if(!w.transform.projection.unsupportedLayers||!w.transform.projection.unsupportedLayers.includes("custom")||w.terrain&&(w.terrain.renderingToTexture||w.renderPass==="offscreen")&&p.isDraped(d)){if(w.renderPass==="offscreen"){const R=O.prerender;if(R){if(w.setCustomLayerDefaults(),E.setColorMode(w.colorModeForRenderPass()),w.transform.projection.name==="globe"){const B=w.transform.pointMerc;R.call(O,E.gl,w.transform.customLayerMatrix(),w.transform.getProjection(),w.transform.globeToMercatorMatrix(),i.aj(w.transform.zoom),[B.x,B.y],w.transform.pixelsPerMeterRatio)}else R.call(O,E.gl,w.transform.customLayerMatrix());E.setDirty(),w.setBaseState()}}else if(w.renderPass==="translucent"){if(w.terrain&&w.terrain.renderingToTexture){const B=O.renderToTile;if(B){const H=j[0].canonical,X={x:H.x+j[0].wrap*(O.wrapTileId?0:1<{X&&(X.useNormalOffset=!0,te||(X.enabled=!0))},ce=d.getSource();if(w.renderPass==="light-beam"&&ce.type!=="batched-model")return;if(ce.type==="vector"||ce.type==="geojson")return function(Ge,jt,gt,_t,pt){const ht=Ge.transform,St=ht.projection.name==="globe",Rt=ht.getFreeCameraOptions().position;if(!Ge.modelManager)return;const Dt=Ge.modelManager;gt.modelManager=Dt;const Yt=Ge.shadowRenderer;if(!gt._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Xt=gt._unevaluatedLayout._values["model-id"],or=Object.assign({},gt.layout.get("model-id").parameters),wr=Ge.style.order.indexOf(gt.fqid),Vt=gt.paint.get("model-opacity").constantOr(1);for(const Et of _t){const er=jt.getTile(Et).getBucket(gt);if(!er||er.projection.name!==ht.projection.name)continue;const Kt=er.getModelUris();if(Kt&&!er.modelsRequested&&(Dt.addModelsFromBucket(Kt,pt),er.modelsRequested=!0),St)or.zoom=Et.overscaledZ;else{const Hr=jd(Et,ht);or.zoom=Hr}const mr=Xt.possiblyEvaluate(or);if(_6(Ge,er,Et),Fm.shadowUniformsInitialized=!1,Fm.useSingleShadowCascade=!!Yt&&Yt.getMaxCascadeForTile(Et.toUnwrapped())===0,Ge.renderPass==="shadow"&&Yt){if(Ge.currentShadowCascade===1&&er.isInsideFirstShadowMapFrustum)continue;const Hr=ht.calculatePosMatrix(Et.toUnwrapped(),ht.worldSize);if(Fm.tileMatrix.set(Hr),Fm.shadowTileMatrix=Float32Array.from(Yt.calculateShadowPassMatrixFromMatrix(Hr)),Fm.aabb.min=[0,0,0],Fm.aabb.max[0]=Fm.aabb.max[1]=i.al,Fm.aabb.max[2]=0,ioe(er,Fm,Ge,gt.scope))continue}const Lr=1<0&&Ge.style.isLayerClipped(gt,jt.getSource())&&er.updateReplacement(Et,Ge.replacementSource,wr,gt.scope)&&(er.uploaded=!1,er.upload(Ge.context));let Tr=0;const jr=new Array,fn=new Array,an=new Array;for(let Hr in er.instancesPerModel){const Qr=er.instancesPerModel[Hr];Qr.features.length>0&&!St&&(Hr=mr.evaluate(Qr.features[0].feature,{}));const Mn=Dt.getModel(Hr,pt);if(Mn||Dt.hasURLBeenRequested(Hr)||er.modelUris.includes(Hr)||(er.modelUris.push(Hr),er.modelsRequested=!1),Mn&&Mn.uploaded)if(St){const rs=i.c5([],[Rt.x,Rt.y,Rt.z],Ge.transform.worldSize);i.ew(rs,rs);for(let Gs=0;Gs0&&fa.elevationUpdate(Hr.terrain,Gs,xn,Mn.source),fa.needsReEvaluation(Hr,ka,Mn)&&fa.evaluate(Mn))}})(Ge,jt,gt,_t),function(){let Hr,Qr,Mn;jr?(Hr=_t.length-1,Qr=-1,Mn=-1):(Hr=0,Qr=_t.length,Mn=1);const rs=new Float64Array(16),Gs=i.cA(),ka=new i.P(0,0);for(let xn=Hr;xn!==Qr;xn+=Mn){const fa=_t[xn],Qn=jt.getTile(fa).getBucket(gt);if(!Qn||!Qn.uploaded)continue;let Ma=!1;Rt&&(Ma=Rt.getMaxCascadeForTile(fa.toUnwrapped())===0);const qa=ht.calculatePosMatrix(fa.toUnwrapped(),ht.worldSize),Da=Qn.modelTraits;!Lr&&jr&&(i.bl(rs,qa),i.af(Gs,Yt,rs),ka.x=Gs[0],ka.y=Gs[1]);const ha=[];Qn.setFilter(gt.filter);for(const fs of Qn.getNodesInfo()){if(fs.hiddenByReplacement||!fs.node.meshes)continue;const Ca=fs.node;let Zi=0;Ge.terrain&&Ca.elevation&&(Zi=Ca.elevation*Ge.terrain.exaggeration());const Ni=(()=>{const Lc=fs.aabb;return mr.min=[...Lc.min],mr.max=[...Lc.max],mr.min[2]+=Zi,mr.max[2]+=Zi,i.af(mr.min,mr.min,qa),i.af(mr.max,mr.max,qa),mr})(),Ta=fs.evaluatedScale;if(Ta[0]<=1&&Ta[1]<=1&&Ta[2]<=1&&Ni.intersects(Yr)===0)continue;if(!Lr&&jr){const Lc=.16666666666666666;fs.cameraCollisionOpacity=Yt[0]>Ni.min[0]&&Yt[0]Ni.min[1]&&Yt[1]!jr||fs.opacity===1&&Ca.opacity===1?fs.depthCa.depth?-1:1);for(const fs of ha){const Ca=fs.nodeInfo,Zi=Ca.node;let Ni=i.aB([],Vt,fs.tileModelMatrix);i.aB(Ni,or,Ni);const Ta=i.bl([],Ni);i.eg(Ta,Ta),i.cS(Ta,Ta,i_),Ni=i.aB(Ni,Ni,Zi.globalMatrix);const oa=Ge.renderPass==="light-beam",ps=gt.paint.get("model-color-use-theme").constantOr("default")==="none",pi=Da&i.eI.HasMapboxMeshFeatures,ho=pi?0:Ca.evaluatedRMEA[0][2];for(let qi=0;qi=cr||Vi>=cr}}const Gl=Ja.material;let Ru;Gl.occlusionTexture&&Gl.occlusionTexture.offsetScale&&(Ru=Gl.occlusionTexture.offsetScale,el.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const yh=Ge.getOrCreateProgram("model",el);!Lr&&Rt&&Rt.setupShadowsFromMatrix(fs.tileModelMatrix,yh,Rt.useNormalOffset),Ge.uploadCommonUniforms(pt,yh,null,Oc);const Yd=Gl.pbrMetallicRoughness;Yd.metallicFactor=.9,Yd.roughnessFactor=.5;const ro=vx(new Float32Array(fc),new Float32Array(Ni),new Float32Array(Ta),new Float32Array(Zi.globalMatrix),Ge,fs.opacity,Yd.baseColorFactor,Gl.emissiveFactor,Yd.metallicFactor,Yd.roughnessFactor,Gl,ho,gt,[0,0,0],Ru);!kd&&(Ca.hasTranslucentParts||fs.opacity<1)&&yh.draw(Ge,pt.gl.TRIANGLES,er,Hn.disabled,ms.disabled,Un.backCCW,ro,gt.id,Ja.vertexBuffer,Ja.indexBuffer,Ja.segments,gt.paint,Ge.transform.zoom,void 0,Lc),yh.draw(Ge,pt.gl.TRIANGLES,kd?Kt:er,Hn.disabled,kd||fs.opacity<1||Ca.hasTranslucentParts?ms.alphaBlended:ms.unblended,Un.backCCW,ro,gt.id,Ja.vertexBuffer,Ja.indexBuffer,Ja.segments,gt.paint,Ge.transform.zoom,void 0,Lc)}}}}()}(w,d,p,j),void de();if(ce.type!=="model")return;const he=ce.getModels(),ke=[],be=w.transform.getFreeCameraOptions().position,Re=i.c5([],[be.x,be.y,be.z],w.transform.worldSize);i.ew(Re,Re);const De=[],We=[];let nt=0;for(const Ge of he){const jt=d.getFeatureState("",Ge.id),gt={type:"Unknown",id:Ge.id,properties:Ge.featureProperties},_t=p.paint.get("model-rotation").evaluate(gt,jt),pt=p.paint.get("model-scale").evaluate(gt,jt),ht=p.paint.get("model-translation").evaluate(gt,jt),St=p.paint.get("model-opacity").evaluate(gt,jt);x6(p,Ge.id,jt,Ge.featureProperties,Ge.nodeOverrideNames,Ge.nodeOverrides),y6(p,Ge.id,jt,Ge.featureProperties,Ge.materialOverrideNames,Ge.materialOverrides),Ge.nodeOverrides.size>0&&Ge.computeBoundsAndApplyParent(),Ge.computeModelMatrix(w,_t,pt,ht,B,R,!1);const Rt=i.bA([]),Dt=i.ef(Ge.position.lat,w.transform.zoom),Yt=i.bq([],[1,1,1/Dt]);i.br(Rt,Rt,Re),ke.push({zScaleMatrix:Yt,negCameraPosMatrix:Rt});for(const Xt of Ge.nodes)Nx(w,Xt,Ge.matrix,w.transform.expandedFarZProjMatrix,nt,De,We,Ge.materialOverrides,St);nt++}if(De.sort((Ge,jt)=>jt.depth-Ge.depth),w.renderPass!=="shadow")v6(w,p,De,We,ke),de();else{for(const Ge of We)Zh(Ge.mesh,Ge.nodeModelMatrix,w,p);for(const Ge of De)Zh(Ge.mesh,Ge.nodeModelMatrix,w,p);de()}}},PN={line:function(w,d,p){if(w.hasElevatedBuckets=!1,w.hasNonElevatedBuckets=!1,w._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||w._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const j=d.getVisibleCoordinates();for(const E of j){const O=d.getTile(E).getBucket(w);if(O&&(O.elevationType!=="none"?w.hasElevatedBuckets=!0:w.hasNonElevatedBuckets=!0,w.hasElevatedBuckets&&w.hasNonElevatedBuckets))break}}}else w.hasNonElevatedBuckets=!0},model:function(w,d,p){const j=d.getSource();if(!j.loaded())return;if(j.type==="vector"||j.type==="geojson")return void(p.modelManager&&p.modelManager.upload(p,a_(p,w)));if(j.type==="batched-model"||j.type!=="model")return;const E=j.getModels();for(const O of E)O.upload(p.context)},raster:function(w,d,p){const j=d.getSource();if(!(j instanceof hc&&j.loaded()))return;const E=w.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!E)return;const O=w.paint.get("raster-array-band")||j.getInitialBand(E);if(O==null)return;const R=d.getIds().map(B=>d.getTileByID(B));for(const B of R)B.updateNeeded(w.id,O)&&j.prepareTile(B,E,w.id,O)},"raster-particle":function(w,d,p){const j=d.getSource();if(!(j instanceof hc&&j.loaded()))return;const E=w.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!E)return;const O=w.paint.get("raster-particle-array-band")||j.getInitialBand(E);if(O==null)return;const R=d.getIds().map(B=>d.getTileByID(B));for(const B of R)B.updateNeeded(w.id,O)&&j.prepareTile(B,E,w.id,O)}},Du={fill:vN},LN={fill:function(w,d,p,j){if(!p.layout||p.layout.get("fill-elevation-reference")==="none"||p.paint.get("fill-opacity").constantOr(1)===0)return;const E=w.context.gl,O=new yn(E.LEQUAL,yn.ReadOnly,w.depthRangeFor3D),R=new Hn({func:E.ALWAYS,mask:255},255,255,E.KEEP,E.KEEP,E.REPLACE),B=w.transform.getFreeCameraOptions().position,H=w.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const X of j){const te=d.getTile(X),de=te.getBucket(p);if(!de)continue;const ce=de.elevatedStructures;if(!ce||ce.depthSegments.segments[0].primitiveLength===0)continue;const he=l6(X.toUnwrapped(),B),ke=w.translatePosMatrix(X.projMatrix,te,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor")),be=yx(ke,he,0,1,0);H.draw(w,E.TRIANGLES,O,R,ms.disabled,Un.disabled,be,p.id,ce.vertexBuffer,ce.indexBuffer,ce.depthSegments,p.paint,w.transform.zoom)}}};class ON{constructor(d,p,j,E,O){this.context=new g0(d,p),this.transform=j,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=i.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const R=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const H of R)this._debugParams.enabledLayers[H]=!0;for(const H of R);this.occlusionParams=new y0,this.setup(),this.numSublayers=yd.maxUnderzooming+yd.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new i.eP,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new s0(this),this._wireframeDebugCache=new ig,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const B=new i.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.T(this.context,B,d.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=E,this.worldview=O,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,p){const j=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(j||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new S5(this,d));const E=this._terrain;this.transform.elevation=j?E:null,E.update(d,this.transform,p),this.transform.elevation&&!E.enabled&&(this.transform.elevation=null)}_updateFog(d){const p=d.fog;if(!p||this.transform.projection.name==="globe"||p.getOpacity(this.transform.pitch)<1||p.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[j,E]=p.getFovAdjustedRange(this.transform._fov);if(j>E)return void(this.transform.fogCullDistSq=null);const O=j+.78*(E-j);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,p){if(this.width=d*i.o.devicePixelRatio,this.height=p*i.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const j of this.style.order)this.style._mergedLayers[j].resize()}setup(){const d=this.context,p=new i.bd;p.emplaceBack(0,0),p.emplaceBack(i.al,0),p.emplaceBack(0,i.al),p.emplaceBack(i.al,i.al),this.tileExtentBuffer=d.createVertexBuffer(p,i.bf.members),this.tileExtentSegments=i.bg.simpleSegment(0,0,4,2);const j=new i.bd;j.emplaceBack(0,0),j.emplaceBack(i.al,0),j.emplaceBack(0,i.al),j.emplaceBack(i.al,i.al),this.debugBuffer=d.createVertexBuffer(j,i.bf.members),this.debugSegments=i.bg.simpleSegment(0,0,4,5);const E=new i.bd;E.emplaceBack(-1,-1),E.emplaceBack(1,-1),E.emplaceBack(-1,1),E.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(E,i.bf.members),this.viewportSegments=i.bg.simpleSegment(0,0,4,2);const O=new i.b1;O.emplaceBack(0,0,0,0),O.emplaceBack(i.al,0,i.al,0),O.emplaceBack(0,i.al,0,i.al),O.emplaceBack(i.al,i.al,i.al,i.al),this.mercatorBoundsBuffer=d.createVertexBuffer(O,i.bi.members),this.mercatorBoundsSegments=i.bg.simpleSegment(0,0,4,2);const R=new i.b0;R.emplaceBack(0,1,2),R.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(R);const B=new i.be;for(const X of[0,1,3,2,0])B.emplaceBack(X);this.debugIndexBuffer=d.createIndexBuffer(B),this.emptyTexture=new i.T(d,new i.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=i.bC();const H=this.context.gl;this.stencilClearMode=new Hn({func:H.ALWAYS,mask:0},0,255,H.ZERO,H.ZERO,H.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,yn.disabled,this.stencilClearMode,ms.disabled,Un.disabled,Xv(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,p,j){if(!p||this.currentStencilSource===p.id||!d.isTileClipped()||!j||j.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const H of j)if(this._tileClippingMaskIDs[H.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=p.id;const E=this.context,O=E.gl;this.nextStencilID+j.length>256&&this.clearStencil(),E.setColorMode(ms.disabled),E.setDepthMode(yn.disabled);const R=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of j){const H=p.getTile(B),X=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:te,tileBoundsIndexBuffer:de,tileBoundsSegments:ce}=this.getTileBoundsBuffers(H);R.draw(this,O.TRIANGLES,yn.disabled,new Hn({func:O.ALWAYS,mask:0},X,255,O.KEEP,O.KEEP,O.REPLACE),ms.disabled,Un.disabled,Xv(B.projMatrix),"$clipping",te,de,ce)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,p=this.context.gl;return new Hn({func:p.NOTEQUAL,mask:255},d,255,p.KEEP,p.KEEP,p.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const p=this.context.gl;return new Hn({func:p.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,p.KEEP,p.KEEP,p.REPLACE)}stencilConfigForOverlap(d){const p=this.context.gl,j=d.sort((R,B)=>B.overscaledZ-R.overscaledZ),E=j[j.length-1].overscaledZ,O=j[0].overscaledZ-E+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const R={};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,p)=>d+p/this._fpsHistory.length,0))}render(d,p){const j=i.o.now();this._dt=j-this._timeStamp,this._timeStamp=j,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=p;const E=this.style._mergedLayers,O=!(!this.terrain||!this.terrain.enabled),R=()=>this.style._getOrder(O).filter(Vt=>{const Et=E[Vt];return!(Et.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Et.type]});let B=R(),H=!1,X=!1,te=null,de=0,ce=!1;for(const Vt of B){const Et=E[Vt];Et.visibility!=="none"&&(Et.type==="circle"?H=!0:Et.type==="building"?(te=Et,++de):Et.type==="symbol"&&(Et.hasOcclusionOpacityProperties?X=!0:H=!0))}this.updateEmissiveMode();let he=B.map(Vt=>E[Vt]);const ke=this.style._mergedSourceCaches;this.imageManager=d.imageManager,this.modelManager=d.modelManager,this.symbolFadeChange=d.placement.symbolFadeChange(i.o.now()),this.imageManager.beginFrame();for(const Vt in ke){const Et=ke[Vt];Et.used&&(Et.prepare(this.context),Et.getSource().usedInConflation&&++de)}let be=!1;for(const Vt of he)Vt.isHidden(this.transform.zoom)||(Vt.type==="clip"&&(be=!0),this.prepareLayer(Vt));const Re={},De={},We={},nt={},Ge={};for(const Vt in ke){const Et=ke[Vt];Re[Vt]=Et.getVisibleCoordinates(),De[Vt]=Re[Vt].slice().reverse(),We[Vt]=Et.getVisibleCoordinates(!0).reverse(),nt[Vt]=Et.getShadowCasterCoordinates(),Ge[Vt]=Et.sortCoordinatesByDistance(Re[Vt])}const jt=Vt=>{const Et=this.style.getLayerSourceCache(Vt);return Et&&Et.used?Et.getSource():null};if(de||be||this._clippingActiveLastFrame){const Vt=[],Et=[];let er=0;for(const Kt of he)this.isSourceForClippingOrConflation(Kt,jt(Kt))&&(Vt.push(Kt),Et.push(er)),er++;if(Vt&&(be||Vt.length>1)||this._clippingActiveLastFrame){be=!1;const Kt=[];for(let mr=0;mr0){const Kt=jt(Et);Kt&&(this.minCutoffZoom=Math.max(Kt.minzoom,this.minCutoffZoom)),Et.minzoom&&(this.minCutoffZoom=Math.max(Et.minzoom,this.minCutoffZoom))}Et.is3D(O)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Vt),this._lastOcclusionLayer=Vt)}const gt=this.style&&this.style.fog;gt?(this._fogVisible=gt.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=gt.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(We),this.opaquePassCutoff=0,B=R(),he=B.map(Vt=>E[Vt]));const _t=this._shadowRenderer;if(_t){_t.updateShadowParameters(this.transform,this.style.directionalLight);for(const Vt in ke)for(const Et of Re[Vt]){let er={min:0,max:0};this.terrain&&(er=this.terrain.getMinMaxForTile(Et)||er),_t.addShadowReceiver(Et.toUnwrapped(),er.min,er.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new i.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new g6(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const pt=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),ht=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(pt&&!this._snow&&(this._snow=new U5(this)),!pt&&this._snow&&(this._snow.destroy(),delete this._snow),ht&&!this._rain&&(this._rain=new IN(this)),!ht&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),te){this.buildingTileBorderManager||(this.buildingTileBorderManager=new CN);const Vt=this.style.getLayerSourceCache(te);this.buildingTileBorderManager.updateBorders(Vt,te)}if(!Je.has(this.context.gl))return;this.renderPass="offscreen";for(const Vt of he){const Et=d.getLayerSourceCache(Vt);if(!Vt.hasOffscreenPass()||Vt.isHidden(this.transform.zoom))continue;const er=Et?De[Et.id]:void 0;(Vt.type==="custom"||Vt.type==="raster"||Vt.type==="raster-particle"||Vt.isSky()||er&&er.length)&&this.renderLayer(this,Et,Vt,er)}this.depthRangeFor3D=[0,1-(he.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,nt)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const St=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Rt=(()=>{if(p.showOverdrawInspector)return i.ao.black;const Vt=this.style.fog;if(Vt&&this.transform.projection.supportsFog){const Et=this.style.getLut(Vt.scope);if(!St){const er=Vt.properties.get("color-use-theme")==="none",Kt=Vt.properties.get("color").toNonPremultipliedRenderColor(er?null:Et).toArray01();return new i.ao(...Kt)}if(St){const er=Vt.properties.get("space-color-use-theme")==="none",Kt=Vt.properties.get("space-color").toNonPremultipliedRenderColor(er?null:Et).toArray01();return new i.ao(...Kt)}}return i.ao.transparent})();if(this.context.clear({color:Rt,depth:1}),this.clearStencil(),this._showOverdrawInspector=p.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&St&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=B.length-1;this.currentLayer>=0;this.currentLayer--){const Vt=he[this.currentLayer],Et=d.getLayerSourceCache(Vt);if(Vt.isSky())continue;const er=Et?(Vt.is3D(O)?Ge:De)[Et.id]:void 0;this._renderTileClippingMasks(Vt,Et,er),this.renderLayer(this,Et,Vt,er)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&St&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||i.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&&Vt.hasShadowPass()&&--Yt==0){{this.clearStencil(),this.resetStencilClippingMasks();const er=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const er=this.currentLayer;this.depthOcclusion=!0;for(const Kt of this.layersWithOcclusionOpacity){this.currentLayer=Kt;const mr=he[this.currentLayer],Lr=d.getLayerSourceCache(mr),Yr=Lr?De[Lr.id]:void 0;this.terrain||this._renderTileClippingMasks(mr,Lr,Lr?Re[Lr.id]:void 0),this.renderLayer(this,Lr,mr,Yr)}this.depthOcclusion=!1,this.currentLayer=er,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 Vt=null;he.forEach(Et=>{const er=d.getLayerSourceCache(Et);er&&!Et.isHidden(this.transform.zoom)&&er.getVisibleCoordinates().length&&(!Vt||Vt.getSource().maxzoom0?p.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,p,j){const E=j===void 0?this.terrain&&this.terrain.renderingToTexture:j,O=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(O.push("LIGHTING_3D_MODE"),O.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):E||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||E||p!==void 0&&!p||O.push("FOG","FOG_DITHERING"),E&&O.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&O.push("OVERDRAW_INSPECTOR"),O}getOrCreateProgram(d,p){this.cache=this.cache||{};const j=p&&p.defines||[],E=p&&p.config,O=this.currentGlobalDefines(d,p&&p.overrideFog,p&&p.overrideRtt).concat(j),R=ZP.cacheKey(m5[d],d,O,E);return this.cache[R]||(this.cache[R]=new ZP(this.context,d,m5[d],E,yN[d],O)),this.cache[R]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const 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 i.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,p){if(this.style.enable3dLights()){const j=this.style.directionalLight,E=this.style.ambientLight;if(j&&E){const O=((R,B,H)=>{const X=R.properties.get("direction"),te=R.properties.get("color-use-theme")==="none",de=R.properties.get("color").toNonPremultipliedRenderColor(te?null:H.getLut(R.scope)).toArray01(),ce=R.properties.get("intensity"),he=B.properties.get("color-use-theme")==="none",ke=B.properties.get("color").toNonPremultipliedRenderColor(he?null:H.getLut(B.scope)).toArray01(),be=B.properties.get("intensity"),Re=[X.x,X.y,X.z],De=i.dN(ke,be),We=i.dN(de,ce);return{u_lighting_ambient_color:De,u_lighting_directional_dir:Re,u_lighting_directional_color:We,u_ground_radiance:m0(Re,We,De)}})(j,E,this.style);p.setLightsUniformValues(d,O)}}}uploadCommonUniforms(d,p,j,E,O){if(this.uploadCommonLightUniforms(d,p),this.terrain&&this.terrain.renderingToTexture)return;const R=this.style.fog;if(R){const B=R.getOpacity(this.transform.pitch),H=((X,te,de,ce,he,ke,be,Re,De,We,nt,Ge)=>{const jt=X.transform,gt=te.properties.get("color-use-theme")==="none",_t=te.properties.get("color").toNonPremultipliedRenderColor(gt?null:X.style.getLut(te.scope)).toArray01();_t[3]=ce;const pt=X.frameCounter/1e3%1,[ht,St]=te.properties.get("vertical-range");return{u_fog_matrix:de?jt.calculateFogTileMatrix(de):Ge||X.identityMat,u_fog_range:te.getFovAdjustedRange(jt._fov),u_fog_color:_t,u_fog_horizon_blend:te.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ht,St),St],u_fog_temporal_offset:pt,u_frustum_tl:he,u_frustum_tr:ke,u_frustum_br:be,u_frustum_bl:Re,u_globe_pos:De,u_globe_radius:We,u_viewport:nt,u_globe_transition:i.aj(jt.zoom),u_is_globe:+(jt.projection.name==="globe")}})(this,R,j,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*i.o.devicePixelRatio,this.transform.height*i.o.devicePixelRatio],E);p.setFogUniformValues(d,H)}O&&p.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,p=d.createTexture();return d.bindTexture(d.TEXTURE_2D,p),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),p}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,p=this._backgroundTiles={},j=this.transform.coveringTiles({tileSize:512});for(const E of j)p[E.key]=d[E.key]||new Tf(E,512,this.transform.tileZoom,this,void 0,this.worldview);return p}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,p){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")&&(!p||p.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let p=this._cachedTileFogOpacities[d.key];return p||(this._cachedTileFogOpacities[d.key]=p=this.style.fog.getOpacityForTile(d)),p[0]>=cr||p[1]>=cr}setupDepthForOcclusion(d,p,j){const E=this.context,O=E.gl,R=!!j;var B;j||(j={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),E.activeTexture.set(O.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),j.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],j.u_depth_range_unpack=[2/((B=this.depthRangeFor3D)[1]-B[0]),-1-2*B[0]/(B[1]-B[0])],j.u_occluder_half_size=.5*this.occlusionParams.occluderSize,j.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),E.activeTexture.set(O.TEXTURE0),R||p.setTerrainUniformValues(E,j)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function DN(w,d){let p=!1,j=null;const E=()=>{j=null,p&&(w(),j=setTimeout(E,d),p=!1)};return()=>(p=!0,j||E(),j)}class q5{constructor(d){this._hashName=d&&encodeURIComponent(d),i.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=DN(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 p=Qo(d);if(this._hashName){const j=this._hashName;let E=!1;const O=location.hash.slice(1).split("&").map(R=>{const B=R.split("=")[0];return B===j?(E=!0,`${B}=${p}`):R}).filter(R=>R);return E||O.push(`${j}=${p}`),`#${O.join("&")}`}return`#${p}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let p;return d.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(p=j)}),(p&&p[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const p=this._getCurrentHash();if(p.length>=3&&!p.some(j=>isNaN(Number(j)))){const j=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(p[3]||0):d.getBearing();return d.jumpTo({center:[+p[2],+p[1]],zoom:+p[0],bearing:j,pitch:+(p[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Qo(w,d){const p=w.getCenter(),j=Math.round(100*w.getZoom())/100,E=Math.ceil((j*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,E),R=Math.round(p.lng*O)/O,B=Math.round(p.lat*O)/O,H=w.getBearing(),X=w.getPitch();let te=d?`/${R}/${B}/${j}`:`${j}/${B}/${R}`;return(H||X)&&(te+="/"+Math.round(10*H)/10),X&&(te+=`/${Math.round(X)}`),te}const _0={linearity:.3,easing:i.eT(0,0,.3,1)},V5=Object.assign({deceleration:2500,maxSpeed:1400},_0),H5=Object.assign({deceleration:20,maxSpeed:1400},_0),Cx=Object.assign({deceleration:1e3,maxSpeed:360},_0),W5=Object.assign({deceleration:1e3,maxSpeed:90},_0);class G5{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,p=i.o.now();for(;d.length>0&&p-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const p={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:O}of this._inertiaBuffer)p.zoom+=O.zoomDelta||0,p.bearing+=O.bearingDelta||0,p.pitch+=O.pitchDelta||0,O.panDelta&&p.pan._add(O.panDelta),O.around&&(p.around=O.around),O.pinchAround&&(p.pinchAround=O.pinchAround);const j=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,E={};if(p.pan.mag()){const O=zm(p.pan.mag(),j,Object.assign({},V5,d||{}));E.offset=p.pan.mult(O.amount/p.pan.mag()),E.center=this._map.transform.center,b0(E,O)}if(p.zoom){const O=zm(p.zoom,j,H5);E.zoom=this._map.transform.zoom+O.amount,b0(E,O)}if(p.bearing){const O=zm(p.bearing,j,Cx);E.bearing=this._map.transform.bearing+i.aA(O.amount,-179,179),b0(E,O)}if(p.pitch){const O=zm(p.pitch,j,W5);E.pitch=this._map.transform.pitch+O.amount,b0(E,O)}if(E.zoom||E.bearing){const O=p.pinchAround===void 0?p.around:p.pinchAround;E.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),E.noMoveStart=!0,E}}function b0(w,d){(!w.duration||w.durationp.unproject(H)),B=O.reduce((H,X,te,de)=>H.add(X.div(de.length)),new i.P(0,0));super(d,{points:O,point:B,lngLats:R,lngLat:p.unproject(B),originalEvent:j}),this._defaultPrevented=!1}}class K5 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,p){super("wheel",{originalEvent:p}),this._defaultPrevented=!1}}class RN{constructor(d,p){this._map=d,this._clickTolerance=p.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new K5(this._map,d))}mousedown(d,p){return this._mousedownPos=p,this._firePreventable(new Zd(d.type,this._map,d))}mouseup(d){this._map.fire(new Zd(d.type,this._map,d))}preclick(d){const p=new MouseEvent("preclick",d);this._map.fire(new Zd(p.type,this._map,p))}click(d,p){this._mousedownPos&&this._mousedownPos.dist(p)>=this._clickTolerance||(this.preclick(d),this._map.fire(new Zd(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new Zd(d.type,this._map,d))}mouseover(d){this._map.fire(new Zd(d.type,this._map,d))}mouseout(d){this._map.fire(new Zd(d.type,this._map,d))}touchstart(d){return this._firePreventable(new lg(d.type,this._map,d))}touchmove(d){this._map.fire(new lg(d.type,this._map,d))}touchend(d){this._map.fire(new lg(d.type,this._map,d))}touchcancel(d){this._map.fire(new lg(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Z5{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new Zd(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Zd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new Zd(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class FN{constructor(d,p){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=p.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,p){this.isEnabled()&&d.shiftKey&&d.button===0&&(F(),this._startPos=this._lastPos=p,this._active=!0)}mousemoveWindow(d,p){if(!this._active)return;const j=p,E=this._startPos,O=this._lastPos;if(!E||!O||O.equals(j)||!this._box&&j.dist(E){this._box&&(this._box.style.transform=`translate(${R}px,${H}px)`,this._box.style.width=B-R+"px",this._box.style.height=X-H+"px")})}mouseupWindow(d,p){if(!this._active)return;const j=this._startPos,E=p;if(j&&d.button===0){if(this.reset(),V(),j.x!==E.x||j.y!==E.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:d})),{cameraAnimation:O=>O.fitScreenCoordinates(j,E,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),D(),delete this._startPos,delete this._lastPos}_fireEvent(d,p){return this._map.fire(new i.z(d,{originalEvent:p}))}}function zN(w,d){const p={};for(let j=0;jthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),j.length===this.numTouches&&(this.centroid=function(E){const O=new i.P(0,0);for(const R of E)O._add(R);return O.div(E.length)}(p),this.touches=zN(j,p)))}touchmove(d,p,j){if(this.aborted||!this.centroid)return;const E=zN(j,p);for(const O in this.touches){const R=E[O];(!R||R.dist(this.touches[O])>30)&&(this.aborted=!0)}}touchend(d,p,j){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),j.length===0){const E=!this.aborted&&this.centroid;if(this.reset(),E)return E}}}class BN{constructor(d){this.singleTap=new j6(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,p,j){this.singleTap.touchstart(d,p,j)}touchmove(d,p,j){this.singleTap.touchmove(d,p,j)}touchend(d,p,j){const E=this.singleTap.touchend(d,p,j);if(E){const O=d.timeStamp-this.lastTime<500,R=!this.lastTap||this.lastTap.dist(E)<30;if(O&&R||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=E,this.count===this.numTaps)return this.reset(),E}}}class k6{constructor(){this._zoomIn=new BN({numTouches:1,numTaps:2}),this._zoomOut=new BN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,p,j){this._zoomIn.touchstart(d,p,j),this._zoomOut.touchstart(d,p,j)}touchmove(d,p,j){this._zoomIn.touchmove(d,p,j),this._zoomOut.touchmove(d,p,j)}touchend(d,p,j){const E=this._zoomIn.touchend(d,p,j),O=this._zoomOut.touchend(d,p,j);return E?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:R=>R.easeTo({duration:300,zoom:R.getZoom()+1,around:R.unproject(E)},{originalEvent:d})}):O?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:R=>R.easeTo({duration:300,zoom:R.getZoom()-1,around:R.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 N6={0:1,2:2},Y5={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class $N{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,p){return!1}_move(d,p){return{}}mousedown(d,p){if(this._lastPoint)return;const j=ee(d);this._correctButton(d,j)&&(this._lastPoint=p,this._eventButton=j)}mousemoveWindow(d,p){const j=this._lastPoint;if(j){if(d.preventDefault(),this._eventButton!=null&&function(E,O){const R=N6[O];return E.buttons===void 0||(E.buttons&R)!==R}(d,this._eventButton))this.reset();else if(this._moved||!(p.dist(j)0&&(this._active=!0);const E=zN(j,p),O=new i.P(0,0),R=new i.P(0,0);let B=0;for(const X in E){const te=E[X],de=this._touches[X];de&&(O._add(te),R._add(te.sub(de)),B++,E[X]=te)}if(this._touches=E,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class UN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,p,j){return{}}touchstart(d,p,j){this._firstTwoTouches||j.length<2||(this._firstTwoTouches=[j[0].identifier,j[1].identifier],this._start([p[0],p[1]]))}touchmove(d,p,j){const E=this._firstTwoTouches;if(!E)return;d.preventDefault();const[O,R]=E,B=o_(j,p,O),H=o_(j,p,R);if(!B||!H)return;const X=this._aroundCenter?null:B.add(H).div(2);return this._move([B,H],X,d)}touchend(d,p,j){if(!this._firstTwoTouches)return;const[E,O]=this._firstTwoTouches,R=o_(j,p,E),B=o_(j,p,O);R&&B||(this._active&&V(),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 o_(w,d,p){for(let j=0;jMath.abs(w.x)}class loe extends UN{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,qN(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,p,j){const E=this._lastPoints;if(!E)return;const O=d[0].sub(E[0]),R=d[1].sub(E[1]);return this._map._cooperativeGestures&&!i.eU()&&j.touches.length<3||(this._valid=this.gestureBeginsVertically(O,R,j.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(O.y+R.y)/2*-.5})}gestureBeginsVertically(d,p,j){if(this._valid!==void 0)return this._valid;const E=d.mag()>=2,O=p.mag()>=2;if(!E&&!O)return;if(!E||!O)return this._firstMove==null&&(this._firstMove=j),j-this._firstMove<100&&void 0;const R=d.y>0==p.y>0;return qN(d)&&qN(p)&&R}}const coe={panStep:100,bearingStep:15,pitchStep:10};class doe{constructor(){const d=coe;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 p=0,j=0,E=0,O=0,R=0;switch(d.keyCode){case 61:case 107:case 171:case 187:p=1;break;case 189:case 109:case 173:p=-1;break;case 37:d.shiftKey?j=-1:(d.preventDefault(),O=-1);break;case 39:d.shiftKey?j=1:(d.preventDefault(),O=1);break;case 38:d.shiftKey?E=1:(d.preventDefault(),R=-1);break;case 40:d.shiftKey?E=-1:(d.preventDefault(),R=1);break;default:return}return this._rotationDisabled&&(j=0,E=0),{cameraAnimation:B=>{const H=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:l_,zoom:p?Math.round(H)+p*(d.shiftKey?2:1):H,bearing:B.getBearing()+j*this._bearingStep,pitch:B.getPitch()+E*this._pitchStep,offset:[-O*this._panStep,-R*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 l_(w){return w*(2-w)}const J5=4.000244140625,eM=1/450;class VN{constructor(d,p){this._map=d,this._el=d.getCanvasContainer(),this._handler=p,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=eM,i.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()||i.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let p=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const j=i.o.now(),E=j-(this._lastWheelEventTime||0);this._lastWheelEventTime=j,p!==0&&p%J5==0?this._type="wheel":p!==0&&Math.abs(p)<4?this._type="trackpad":E>400?(this._type=null,this._lastValue=p,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(E*p)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,p+=this._lastValue)),d.shiftKey&&p&&(p/=4),this._type&&(this._lastWheelEvent=d,this._delta-=p,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 p=W(this._el,d);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:p,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 p=()=>d._terrainEnabled()&&this._aroundCoord?d.computeZoomRelativeTo(this._aroundCoord):d.zoom;if(this._delta!==0){const X=this._type==="wheel"&&Math.abs(this._delta)>J5?this._wheelZoomRate:this._defaultZoomRate;let te=2/(1+Math.exp(-Math.abs(this._delta*X)));this._delta<0&&te!==0&&(te=1/te);const de=p(),ce=Math.pow(2,de),he=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):ce;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(he*te))),this._type==="wheel"&&(this._startZoom=de,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const j=typeof this._targetZoom=="number"?this._targetZoom:p(),E=this._startZoom,O=this._easing;let R,B=!1;if(this._type==="wheel"&&E&&O){const X=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),te=O(X);R=i.ak(E,j,te),X<1?this._frameId||(this._frameId=!0):B=!0}else R=j,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 H=R-p();return H*this._lastDelta<0&&(H=0),{noInertia:!0,needsRenderFrame:!B,zoomDelta:H,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let p=i.eV;if(this._prevEase){const j=this._prevEase,E=(i.o.now()-j.start)/j.duration,O=j.easing(E+.01)-j.easing(E),R=.27/Math.sqrt(O*O+1e-4)*.01,B=Math.sqrt(.0729-R*R);p=i.eT(R,B,.25,1)}return this._prevEase={start:i.o.now(),duration:d,easing:p},p}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=k("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 Bf{constructor(d,p){this._clickZoom=d,this._tapZoom=p}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 HN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,p){return d.preventDefault(),{cameraAnimation:j=>{j.easeTo({duration:300,zoom:j.getZoom()+(d.shiftKey?-1:1),around:j.unproject(p)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jo{constructor(){this._tap=new BN({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,p,j){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?j.length>0&&(this._swipePoint=p[0],this._swipeTouch=j[0].identifier):this._tap.touchstart(d,p,j))}touchmove(d,p,j){if(this._tapTime){if(this._swipePoint){if(j[0].identifier!==this._swipeTouch)return;const E=p[0],O=E.y-this._swipePoint.y;return this._swipePoint=E,d.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(d,p,j)}touchend(d,p,j){this._tapTime?this._swipePoint&&j.length===0&&this.reset():this._tap.touchend(d,p,j)&&(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 Bm{constructor(d,p,j){this._el=d,this._mousePan=p,this._touchPan=j}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 c_{constructor(d,p,j){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=p,this._mousePitch=j}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 WN{constructor(d,p,j,E){this._el=d,this._touchZoom=p,this._touchRotate=j,this._tapDragZoom=E,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 d_=w=>w.zoom||w.drag||w.pitch||w.rotate;class uoe extends i.z{}class u_{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,p){const j=i.av([],p,d);this.radius=i.ag(j[2]<0?i.eX([],j,this.constants):[j[0],j[1],0])}projectRay(d){i.eX(d,d,this.constants),i.aw(d,d),i.eY(d,d,this.constants);const p=i.c5([],d,this.radius);if(p[2]>0){const j=i.c5([],[0,0,1],i.bJ(p,[0,0,1])),E=i.c5([],i.aw([],[p[0],p[1],0]),this.radius),O=i.d8([],p,i.c5([],i.av([],i.d8([],E,j),p),2));p[0]=O[0],p[1]=O[1]}return p}}function GN(w){return w.panDelta&&w.panDelta.mag()||w.zoomDelta||w.bearingDelta||w.pitchDelta}class hoe{constructor(d,p){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new G5(d),this._bearingSnap=p.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new u_,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(p),i.aY(["handleEvent","handleWindowEvent"],this);const j=this._el;this._listeners=[[j,"touchstart",{passive:!0}],[j,"touchmove",{passive:!1}],[j,"touchend",void 0],[j,"touchcancel",void 0],[j,"mousedown",void 0],[j,"mousemove",void 0],[j,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[j,"mouseover",void 0],[j,"mouseout",void 0],[j,"dblclick",void 0],[j,"click",void 0],[j,"keydown",{capture:!1}],[j,"keyup",void 0],[j,"wheel",{passive:!1}],[j,"contextmenu",void 0],[window,"blur",void 0]];for(const[E,O,R]of this._listeners){const B=E===document?this.handleWindowEvent:this.handleEvent;E.addEventListener(O,B,R)}}destroy(){for(const[d,p,j]of this._listeners){const E=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(p,E,j)}}_addDefaultHandlers(d){const p=this._map,j=p.getCanvasContainer();this._add("mapEvent",new RN(p,d));const E=p.boxZoom=new FN(p,d);this._add("boxZoom",E);const O=new k6,R=new HN;p.doubleClickZoom=new Bf(R,O),this._add("tapZoom",O),this._add("clickZoom",R);const B=new Jo;this._add("tapDragZoom",B);const H=p.touchPitch=new loe(p);this._add("touchPitch",H);const X=new X5(d),te=new Q5(d);p.dragRotate=new c_(d,X,te),this._add("mouseRotate",X,["mousePitch"]),this._add("mousePitch",te,["mouseRotate"]);const de=new S6(d),ce=new C6(p,d);p.dragPan=new Bm(j,de,ce),this._add("mousePan",de),this._add("touchPan",ce,["touchZoom","touchRotate"]);const he=new Ui,ke=new ooe;p.touchZoomRotate=new WN(j,ke,he,B),this._add("touchRotate",he,["touchPan","touchZoom"]),this._add("touchZoom",ke,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Z5(p));const be=p.scrollZoom=new VN(p,this);this._add("scrollZoom",be,["mousePan"]);const Re=p.keyboard=new doe;this._add("keyboard",Re);for(const De of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[De]&&p[De].enable(d[De])}_add(d,p,j){this._handlers.push({handlerName:d,handler:p,allowed:j}),this._handlersById[d]=p}stop(d){if(!this._updatingCamera){for(const{handler:p}of this._handlers)p.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!!d_(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,p,j){for(const E in d)if(E!==j&&(!p||p.indexOf(E)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const p=[];for(const j of d)this._el.contains(j.target)&&p.push(j);return p}handleEvent(d,p){this._updatingCamera=!0;const j=d.type==="renderFrame",E=j?void 0:d,O={needsRenderFrame:!1},R={},B={},H=d.touches?this._getMapTouches(d.touches):void 0,X=H?G(this._el,H):j?void 0:W(this._el,d);for(const{handlerName:ce,handler:he,allowed:ke}of this._handlers){if(!he.isEnabled())continue;let be;this._blockedByActive(B,ke,ce)?he.reset():he[p||d.type]&&(be=he[p||d.type](d,X,H),this.mergeHandlerResult(O,R,be,ce,E),be&&be.needsRenderFrame&&this._triggerRenderFrame()),(be||he.isActive())&&(B[ce]=he)}const te={};for(const ce in this._previousActiveHandlers)B[ce]||(te[ce]=E);this._previousActiveHandlers=B,(Object.keys(te).length||GN(O))&&(this._changes.push([O,R,te]),this._triggerRenderFrame()),(Object.keys(B).length||GN(O))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:de}=O;de&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],de(this._map))}mergeHandlerResult(d,p,j,E,O){if(!j)return;Object.assign(d,j);const R={handlerName:E,originalEvent:j.originalEvent||O};j.zoomDelta!==void 0&&(p.zoom=R),j.panDelta!==void 0&&(p.drag=R),j.pitchDelta!==void 0&&(p.pitch=R),j.bearingDelta!==void 0&&(p.rotate=R)}_applyChanges(){const d={},p={},j={};for(const[E,O,R]of this._changes)E.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(E.panDelta)),E.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+E.zoomDelta),E.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+E.bearingDelta),E.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+E.pitchDelta),E.around!==void 0&&(d.around=E.around),E.aroundCoord!==void 0&&(d.aroundCoord=E.aroundCoord),E.pinchAround!==void 0&&(d.pinchAround=E.pinchAround),E.noInertia&&(d.noInertia=E.noInertia),Object.assign(p,O),Object.assign(j,R);this._updateMapTransform(d,p,j),this._changes=[]}_updateMapTransform(d,p,j){const E=this._map,O=E.transform,R=We=>[We.x,We.y,We.z];if((We=>{const nt=this._eventsInProgress.drag;return nt&&!this._handlersById[nt.handlerName].isActive()})()&&!GN(d)){const We=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"),We!==O.zoom&&this._map._update(!0)}if(O._isCameraConstrained&&E._stop(!0),!GN(d))return void this._fireEvents(p,j,!0);let{panDelta:B,zoomDelta:H,bearingDelta:X,pitchDelta:te,around:de,aroundCoord:ce,pinchAround:he}=d;O._isCameraConstrained&&(H>0&&(H=0),O._isCameraConstrained=!1),he!==void 0&&(de=he),(H||(We=>p[We]&&!this._eventsInProgress[We])("drag"))&&de&&(this._dragOrigin=R(O.pointCoordinate3D(de)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",E._stop(!0),de=de||E.transform.centerPoint,X&&(O.bearing+=X),te&&(O.pitch+=te),O._updateCameraState();const ke=[0,0,0];if(B)if(O.projection.name==="mercator"){const We=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(de).dir),nt=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(de.sub(B)).dir);ke[0]=nt[0]-We[0],ke[1]=nt[1]-We[1]}else{const We=O.pointCoordinate(de);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const nt=O._pixelsPerMercatorPixel/O.worldSize;ke[0]=-B.x*i.eW(i.a$(We.y))*nt,ke[1]=-B.y*i.eW(O.center.lat)*nt}else{const nt=O.pointCoordinate(de.sub(B));We&&nt&&(ke[0]=nt.x-We.x,ke[1]=nt.y-We.y)}}const be=O.zoom,Re=[0,0,0];if(H){const We=R(ce||O.pointCoordinate3D(de)),nt={dir:i.aw([],i.av([],We,O._camera.position))};if(nt.dir[2]<0){const Ge=O.zoomDeltaToMovement(We,H);i.c5(Re,nt.dir,Ge)}}const De=i.d8(ke,ke,Re);O._translateCameraConstrained(De),H&&Math.abs(O.zoom-be)>1e-4&&O.recenterOnTerrain(),O.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(p,j,!0)}_fireEvents(d,p,j){const E=d_(this._eventsInProgress),O=d_(d),R={};for(const te in d){const{originalEvent:de}=d[te];this._eventsInProgress[te]||(R[`${te}start`]=de),this._eventsInProgress[te]=d[te]}!E&&O&&this._fireEvent("movestart",O.originalEvent);for(const te in R)this._fireEvent(te,R[te]);O&&this._fireEvent("move",O.originalEvent);for(const te in d){const{originalEvent:de}=d[te];this._fireEvent(te,de)}const B={};let H;for(const te in this._eventsInProgress){const{handlerName:de,originalEvent:ce}=this._eventsInProgress[te];this._handlersById[de].isActive()||(delete this._eventsInProgress[te],H=p[de]||ce,B[`${te}end`]=H)}for(const te in B)this._fireEvent(te,B[te]);const X=d_(this._eventsInProgress);if(j&&(E||O)&&!X){this._updatingCamera=!0;const te=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),de=ce=>ce!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new uoe("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const KN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class tM extends i.E{constructor(d,p){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=p.bearingSnap,this._respectPrefersReducedMotion=p.respectPrefersReducedMotion!==!1,i.aY(["_renderFrameCallback"],this)}getCenter(){return new i.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,p){return this.jumpTo({center:d},p)}panBy(d,p,j){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},p),j)}panTo(d,p,j){return this.easeTo(Object.assign({center:d},p),j)}getZoom(){return this.transform.zoom}setZoom(d,p){return this.jumpTo({zoom:d},p),this}zoomTo(d,p,j){return this.easeTo(Object.assign({zoom:d},p),j)}zoomIn(d,p){return this.zoomTo(this.getZoom()+1,d,p),this}zoomOut(d,p){return this.zoomTo(this.getZoom()-1,d,p),this}getBearing(){return this.transform.bearing}setBearing(d,p){return this.jumpTo({bearing:d},p),this}getPadding(){return this.transform.padding}setPadding(d,p){return this.jumpTo({padding:d},p),this}rotateTo(d,p,j){return this.easeTo(Object.assign({bearing:d},p),j)}resetNorth(d,p){return this.rotateTo(0,Object.assign({duration:1e3},d),p),this}resetNorthPitch(d,p){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),p),this}snapToNorth(d,p){return Math.abs(this.getBearing())d.aspect?j/(2*Math.tan(.5*d.fovX)*d.aspect):E/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,p,j,E,O,R){const B=d.clone(),H=this._extendCameraOptions(R);B.bearing=E,B.pitch=O;const X=i.aT.convert(p),te=i.aT.convert(j),de=.5*(X.lat+te.lat),ce=.5*(X.lng+te.lng),he=i.eZ(de,ce),ke=i.aw([],he),be=i.aw([],i.bI([],ke,[0,1,0])),Re=i.bI([],be,ke),De=[be[0],be[1],be[2],0,Re[0],Re[1],Re[2],0,ke[0],ke[1],ke[2],0,0,0,0,1],We=[he,i.eZ(X.lat,X.lng),i.eZ(te.lat,X.lng),i.eZ(te.lat,te.lng),i.eZ(X.lat,te.lng),i.eZ(de,X.lng),i.eZ(de,te.lng),i.eZ(X.lat,ce),i.eZ(te.lat,ce)];let nt=i.d9.fromPoints(We.map(Kt=>[i.bJ(be,Kt),i.bJ(Re,Kt),i.bJ(ke,Kt)]));const Ge=i.af([],nt.center,De);i.e_(Ge)===0&&i.e$(Ge,0,0,1),i.aw(Ge,Ge),i.c5(Ge,Ge,i.aD),B.center=i.f0(Ge);const jt=B.getWorldToCameraMatrix(),gt=i.bl(new Float64Array(16),jt);nt=i.d9.applyTransform(nt,i.aB([],jt,De));const _t=this._extendAABB(nt,B,H,E);if(!_t)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");nt=_t,i.af(Ge,Ge,jt);const pt=.5*(nt.max[2]-nt.min[2]),ht=this._minimumAABBFrustumDistance(B,nt),St=i.c5([],[0,0,1],pt),Rt=i.d8(St,Ge,St),Dt=ht+(B.pitch===0?0:i.bG(Ge,Rt)),Yt=B.globeCenterInViewSpace,Xt=i.av([],Ge,[Yt[0],Yt[1],Yt[2]]);i.aw(Xt,Xt),i.c5(Xt,Xt,Dt);const or=i.d8([],Ge,Xt);i.af(or,or,gt);const wr=i.eM/i.aD,Vt=i.ag(or),Et=i.cf(Math.max(Vt*wr-i.eM,Number.EPSILON),0),er=Math.min(B.zoomFromMercatorZAdjusted(Et),H.maxZoom);return er>.5*(i.c_+i.cL)?(B.setProjection({name:"mercator"}),B.zoom=er,this._cameraForBounds(B,p,j,E,O,R)):{center:B.center,zoom:er,bearing:E,pitch:O}}_extendAABB(d,p,j,E){const O=.5*((j.padding.left||0)+(j.padding.right||0)),R=.5*((j.padding.top||0)+(j.padding.bottom||0)),B=R,H=O,X=O,te=R,de=p.width-(H+X),ce=p.height-(B+te),he=i.av([],d.max,d.min),ke=Math.min(de/he[0],ce/he[1]),be=Math.min(p.scaleZoom(p.scale*ke),j.maxZoom);if(isNaN(be))return null;const Re=p.scale/p.zoomScale(be),De=new i.d9([d.min[0]-H*Re,d.min[1]-te*Re,d.min[2]],[d.max[0]+X*Re,d.max[1]+B*Re,d.max[2]]),We=(typeof j.offset.x=="number"&&typeof j.offset.y=="number"?new i.P(j.offset.x,j.offset.y):i.P.convert(j.offset)).rotate(-i.an(E));return De.center[0]-=We.x*Re,De.center[1]+=We.y*Re,De}queryTerrainElevation(d,p){const j=this.transform.elevation;return j?(p=Object.assign({},{exaggerated:!0},p),j.getAtPoint(i.ae.fromLngLat(d),null,p.exaggerated)):null}_cameraForBounds(d,p,j,E,O,R){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,p,j,E,O,R);const B=d.clone(),H=this._extendCameraOptions(R);B.bearing=E,B.pitch=O;const X=i.aT.convert(p),te=i.aT.convert(j),de=new i.aT(X.lng,te.lat),ce=new i.aT(te.lng,X.lat),he=B.project(X),ke=B.project(te),be=this.queryTerrainElevation(X),Re=this.queryTerrainElevation(te),De=this.queryTerrainElevation(de),We=this.queryTerrainElevation(ce),nt=[[he.x,he.y,Math.min(be||0,Re||0,De||0,We||0)],[ke.x,ke.y,Math.max(be||0,Re||0,De||0,We||0)]];let Ge=i.d9.fromPoints(nt);const jt=B.getWorldToCameraMatrix(),gt=i.bl(new Float64Array(16),jt);Ge=i.d9.applyTransform(Ge,jt);const _t=this._extendAABB(Ge,B,H,E);if(!_t)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ge=_t;const pt=.5*i.av([],Ge.max,Ge.min)[2],ht=this._minimumAABBFrustumDistance(B,Ge),St=[0,0,1,0];i.aC(St,St,jt),i.f1(St,St);const Rt=i.c5([],St,ht+pt),Dt=i.d8([],Ge.center,Rt);i.af(Ge.center,Ge.center,gt),i.af(Dt,Dt,gt);const Yt=B.unproject(new i.P(Ge.center[0],Ge.center[1])),Xt=i.f2(B.projection,Yt),or=Math.pow(2,Xt),wr=Math.min(B._zoomFromMercatorZ(Dt[2]*B.pixelsPerMeter*or/B.worldSize),H.maxZoom);return B.mercatorFromTransition&&wr<.5*(i.c_+i.cL)?(B.setProjection({name:"globe"}),B.zoom=wr,this._cameraForBounds(B,p,j,E,O,R)):{center:Yt,zoom:wr,bearing:E,pitch:O}}fitBounds(d,p,j){const E=this.cameraForBounds(d,p);return this._fitInternal(E,p,j)}fitScreenCoordinates(d,p,j,E,O){const R=i.P.convert(d),B=i.P.convert(p),H=new i.P(Math.min(R.x,B.x),Math.min(R.y,B.y)),X=new i.P(Math.max(R.x,B.x),Math.max(R.y,B.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(R,B))return this;const te=this.transform.pointLocation3D(H),de=this.transform.pointLocation3D(X),ce=this.transform.pointLocation3D(new i.P(H.x,X.y)),he=this.transform.pointLocation3D(new i.P(X.x,H.y)),ke=[Math.min(te.lng,de.lng,ce.lng,he.lng),Math.min(te.lat,de.lat,ce.lat,he.lat)],be=[Math.max(te.lng,de.lng,ce.lng,he.lng),Math.max(te.lat,de.lat,ce.lat,he.lat)],Re=E&&E.pitch?E.pitch:this.getPitch(),De=this._cameraForBounds(this.transform,ke,be,j,Re,E);return this._fitInternal(De,E,O)}_fitInternal(d,p,j){return d?(p=Object.assign(d,p)).linear?this.easeTo(p,j):this.flyTo(p,j):this}jumpTo(d,p){this.stop();const j=d.preloadOnly?this.transform.clone():this.transform;let E=!1,O=!1,R=!1;"zoom"in d&&j.zoom!==+d.zoom&&(E=!0,j.zoom=+d.zoom),d.center!==void 0&&(j.center=i.aT.convert(d.center)),"bearing"in d&&j.bearing!==+d.bearing&&(O=!0,j.bearing=+d.bearing),"pitch"in d&&j.pitch!==+d.pitch&&(R=!0,j.pitch=+d.pitch);const B=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!j.isPaddingEqual(B))if(d.retainPadding===!1){const H=j.clone();H.padding=B,j.setLocationAtPoint(j.center,H.centerPoint)}else j.padding=B;return d.preloadOnly?(this._preloadTiles(j),this):(this.fire(new i.z("movestart",p)).fire(new i.z("move",p)),E&&this.fire(new i.z("zoomstart",p)).fire(new i.z("zoom",p)).fire(new i.z("zoomend",p)),O&&this.fire(new i.z("rotatestart",p)).fire(new i.z("rotate",p)).fire(new i.z("rotateend",p)),R&&this.fire(new i.z("pitchstart",p)).fire(new i.z("pitch",p)).fire(new i.z("pitchend",p)),this.fire(new i.z("moveend",p)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(KN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,p){const j=this.transform;if(!j.projection.supportsFreeCamera)return i.w(KN),this;this.stop();const E=j.zoom,O=j.pitch,R=j.bearing;j.setFreeCameraOptions(d);const B=E!==j.zoom,H=O!==j.pitch,X=R!==j.bearing;return this.fire(new i.z("movestart",p)).fire(new i.z("move",p)),B&&this.fire(new i.z("zoomstart",p)).fire(new i.z("zoom",p)).fire(new i.z("zoomend",p)),X&&this.fire(new i.z("rotatestart",p)).fire(new i.z("rotate",p)).fire(new i.z("rotateend",p)),H&&this.fire(new i.z("pitchstart",p)).fire(new i.z("pitch",p)).fire(new i.z("pitchend",p)),this.fire(new i.z("moveend",p)),this}easeTo(d,p){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:i.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const j=this.transform,E=this.getZoom(),O=this.getBearing(),R=this.getPitch(),B=this.getPadding(),H="zoom"in d?+d.zoom:E,X="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:R,de=this._extendPadding(d.padding),ce=i.P.convert(d.offset);let he,ke,be;if(j.projection.name==="globe"){const St=i.ae.fromLngLat(j.center),Rt=ce.rotate(-j.angle);St.x+=Rt.x/j.worldSize,St.y+=Rt.y/j.worldSize;const Dt=St.toLngLat(),Yt=i.aT.convert(d.center||Dt);this._normalizeCenter(Yt),he=j.centerPoint.add(Rt),ke=new i.P(St.x,St.y).mult(j.worldSize),be=new i.P(i.aF(Yt.lng),i.aJ(Yt.lat)).mult(j.worldSize).sub(ke)}else{he=j.centerPoint.add(ce);const St=j.pointLocation(he),Rt=i.aT.convert(d.center||St);this._normalizeCenter(Rt),ke=j.project(St),be=j.project(Rt).sub(ke)}const Re=j.zoomScale(H-E);let De,We;d.around&&(De=i.aT.convert(d.around),We=j.locationPoint(De));const nt=this._zooming||H!==E,Ge=this._rotating||O!==X,jt=this._pitching||te!==R,gt=!j.isPaddingEqual(de),_t=d.retainPadding===!1?j.clone():j,pt=St=>Rt=>{if(nt&&(St.zoom=i.ak(E,H,Rt)),Ge&&(St.bearing=i.ak(O,X,Rt)),jt&&(St.pitch=i.ak(R,te,Rt)),gt&&(_t.interpolatePadding(B,de,Rt),he=_t.centerPoint.add(ce)),De)St.setLocationAtPoint(De,We);else{const Dt=St.zoomScale(St.zoom-E),Yt=H>E?Math.min(2,Re):Math.max(.5,Re),Xt=Math.pow(Yt,1-Rt),or=St.unproject(ke.add(be.mult(Rt*Xt)).mult(Dt));St.setLocationAtPoint(St.renderWorldCopies?or.wrap():or,he)}return d.preloadOnly||this._fireMoveEvents(p),St};if(d.preloadOnly){const St=this._emulate(pt,d.duration,j);return this._preloadTiles(St),this}const ht={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=nt,this._rotating=Ge,this._pitching=jt,this._padding=gt,this._easeId=d.easeId,this._prepareEase(p,d.noMoveStart,ht),this._ease(pt(j),St=>{j.cameraElevationReference==="sea"&&j.recenterOnTerrain(),this._afterEase(p,St)},d),this}_prepareEase(d,p,j={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),p||j.moving||this.fire(new i.z("movestart",d)),this._zooming&&!j.zooming&&this.fire(new i.z("zoomstart",d)),this._rotating&&!j.rotating&&this.fire(new i.z("rotatestart",d)),this._pitching&&!j.pitching&&this.fire(new i.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new i.z("move",d)),this._zooming&&this.fire(new i.z("zoom",d)),this._rotating&&this.fire(new i.z("rotate",d)),this._pitching&&this.fire(new i.z("pitch",d))}_afterEase(d,p){if(this._easeId&&p&&this._easeId===p)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const j=this._zooming,E=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,j&&this.fire(new i.z("zoomend",d)),E&&this.fire(new i.z("rotateend",d)),O&&this.fire(new i.z("pitchend",d)),this.fire(new i.z("moveend",d))}flyTo(d,p){if(this._prefersReducedMotion(d)){const Kt=i.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Kt,p)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eV},d);const j=this.transform,E=this.getZoom(),O=this.getBearing(),R=this.getPitch(),B=this.getPadding(),H="zoom"in d?i.aA(+d.zoom,j.minZoom,j.maxZoom):E,X="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:R,de=this._extendPadding(d.padding),ce=j.zoomScale(H-E),he=i.P.convert(d.offset);let ke=j.centerPoint.add(he);const be=j.pointLocation(ke),Re=i.aT.convert(d.center||be);this._normalizeCenter(Re);const De=j.project(be),We=j.project(Re).sub(De);let nt=d.curve;const Ge=Math.max(j.width,j.height),jt=Ge/ce,gt=We.mag();if("minZoom"in d){const Kt=i.aA(Math.min(d.minZoom,E,H),j.minZoom,j.maxZoom),mr=Ge/j.zoomScale(Kt-E);nt=Math.sqrt(mr/gt*2)}const _t=nt*nt;function pt(Kt){const mr=(jt*jt-Ge*Ge+(Kt?-1:1)*_t*_t*gt*gt)/(2*(Kt?jt:Ge)*_t*gt);return Math.log(Math.sqrt(mr*mr+1)-mr)}function ht(Kt){return(Math.exp(Kt)-Math.exp(-Kt))/2}function St(Kt){return(Math.exp(Kt)+Math.exp(-Kt))/2}const Rt=pt(0);let Dt=function(Kt){return St(Rt)/St(Rt+nt*Kt)},Yt=function(Kt){return Ge*((St(Rt)*(ht(mr=Rt+nt*Kt)/St(mr))-ht(Rt))/_t)/gt;var mr},Xt=(pt(1)-Rt)/nt;if(Math.abs(gt)<1e-6||!isFinite(Xt)){if(Math.abs(Ge-jt)<1e-6)return this.easeTo(d,p);const Kt=jtd.maxDuration&&(d.duration=0);const or=O!==X,wr=te!==R,Vt=!j.isPaddingEqual(de),Et=d.retainPadding===!1?j.clone():j,er=Kt=>mr=>{const Lr=mr*Xt,Yr=1/Dt(Lr);Kt.zoom=mr===1?H:E+Kt.scaleZoom(Yr),or&&(Kt.bearing=i.ak(O,X,mr)),wr&&(Kt.pitch=i.ak(R,te,mr)),Vt&&(Et.interpolatePadding(B,de,mr),ke=Et.centerPoint.add(he));const Tr=mr===1?Re:Kt.unproject(De.add(We.mult(Yt(Lr))).mult(Yr));return Kt.setLocationAtPoint(Kt.renderWorldCopies?Tr.wrap():Tr,ke),Kt._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(p),Kt};if(d.preloadOnly){const Kt=this._emulate(er,d.duration,j);return this._preloadTiles(Kt),this}return this._zooming=!0,this._rotating=or,this._pitching=wr,this._padding=Vt,this._prepareEase(p,!1),this._ease(er(j),()=>this._afterEase(p),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,p){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const j=this._onEaseEnd;this._onEaseEnd=void 0,j.call(this,p)}if(!d){const j=this.handlers;j&&j.stop(!1)}return this}_ease(d,p,j){j.animate===!1||j.duration===0?(d(1),p()):(this._easeStart=i.o.now(),this._easeOptions=j,this._onEaseFrame=d,this._onEaseEnd=p,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),p=this._onEaseFrame;p&&p(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,p){d=i.bT(d,-180,180);const j=Math.abs(d-p);return Math.abs(d-360-p)180?-360:j<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,p,j){const E=Math.ceil(15*p/1e3),O=[],R=d(j.clone());for(let B=0;B<=E;B++){const H=R(B/E);O.push(H.clone())}return O}_preloadTiles(d,p){}}class h_{constructor(d={}){this.options=d,i.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const p=this.options&&this.options.compact,j=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=k("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=k("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",j);const E=k("span","mapboxgl-ctrl-icon",this._compactButton);return E.setAttribute("aria-hidden","true"),E.setAttribute("title",j),this._innerContainer=k("div","mapboxgl-ctrl-attrib-inner",this._container),p&&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),p===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 p=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.e.ACCESS_TOKEN}];if(d){const j=p.reduce((E,O,R)=>(O.value&&(E+=`${O.key}=${O.value}${RE.length-O.length),d=d.filter((E,O)=>{for(let R=O+1;R=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const j=d.map(E=>function(O){const R=new DOMParser().parseFromString(O,"text/html");return Array.from(R.body.querySelectorAll("*")).forEach(B=>{const H=B.textContent||"";if(B.tagName!=="A")return void B.replaceWith(R.createTextNode(H));const X=B.getAttribute("href");if(!X||!/^(https?:|mailto:)/i.test(X))return void B.replaceWith(R.createTextNode(H));const te=R.createElement("a");te.href=X,te.textContent=H,te.rel="noopener nofollow";const de=B.getAttribute("class");de&&(te.className=de),B.replaceWith(te)}),R.body.innerHTML}(E)).join(" | ");j!==this._attribHTML&&(this._attribHTML=j,d.length?(this._innerContainer.innerHTML=j,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 m_{constructor(){i.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=k("div","mapboxgl-ctrl");const p=k("a","mapboxgl-ctrl-logo");return p.target="_blank",p.rel="noopener nofollow",p.href="https://www.mapbox.com/",p.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),p.setAttribute("rel","noopener nofollow"),this._container.appendChild(p),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 p in d){const j=d[p].getSource();if(j.hasOwnProperty("mapbox_logo")&&!j.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const p=d[0];this._map.getCanvasContainer().offsetWidth<250?p.classList.add("mapboxgl-compact"):p.classList.remove("mapboxgl-compact")}}}class w0{constructor(){i.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=k("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",p=>this._onIndoorUpdate(p)),this._container}_createButton(d,p){const j=k("button",d,this._container);return j.type="button",j.addEventListener("click",p),j}_createSeparator(){return k("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,p){this._map&&(d.setAttribute("aria-label",p),d.textContent=p)}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 p=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",p&&Array.from(this._container.children).forEach(j=>j.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 p=this._map;this._model&&p&&p._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});k("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,p){for(let j=0;j{this._map._selectIndoorFloor(E.id)});this._setButtonTitle(O,E.zIndex.toString()),this._model&&E.id===this._model.selectedFloorId&&p&&O.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(O),j=this._endTime)return this._end;const p=i.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-p)+this._end*p}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,p,j){this._start=this.getValue(p),this._end=d,this._startTime=p,this._endTime=p+j}}const qf={"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 cg extends i.z{constructor(d,p,j,E){const{point:O,lngLat:R,originalEvent:B,target:H}=d;super(d.type,{point:O,lngLat:R,originalEvent:B,target:H}),this.preventDefault=()=>{d.preventDefault()},this.id=p,this.interaction=j,this.feature=E}}class Yh{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,p){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const j=p.filter;let E=p.type;j&&this.filters.set(d,i.b6(j)),E==="mouseover"&&(E="mouseenter"),E==="mouseout"&&(E="mouseleave");const O=this.interactionsByType.get(E)||new Map;E==="mouseenter"||E==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(d,p)):O.size===0&&this.map.on(E,this.handleType),O.size===0&&this.interactionsByType.set(E,O),O.set(d,p),this.typeById.set(d,E)}get(d){const p=this.typeById.get(d);if(!p)return;const j=this.interactionsByType.get(p);return j?j.get(d):void 0}remove(d){const p=this.typeById.get(d);if(!p)return;this.typeById.delete(d),this.filters.delete(d);const j=this.interactionsByType.get(p);j&&(j.delete(d),p==="mouseenter"||p==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):j.size===0&&this.map.off(p,this.handleType))}queryTargets(d,p){const j=[];for(const[E,O]of p)O.target&&j.push({targetId:E,target:O.target,filter:this.filters.get(E)});return this.map.style.queryRenderedTargets(d,j,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const p=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());p.length&&(d.type="mouseenter",this.handleType(d,p));const j=new Map;for(const[E,{feature:O}]of this.prevHoveredFeatures)this.hoveredFeatures.has(E)||j.set(O.id,O);j.size&&(d.type="mouseleave",this.handleType(d,Array.from(j.values())))}handleOut(d){const p=Array.from(this.hoveredFeatures.values()).map(({feature:j})=>j);p.length&&(d.type="mouseleave",this.handleType(d,p)),this.hoveredFeatures.clear()}handleType(d,p){const j=d.type==="mouseenter";if(j&&!this.interactionsByType.has(d.type))return void i.w("mouseenter interaction required for mouseleave to work.");const E=Array.from(this.interactionsByType.get(d.type)).reverse(),O=!!p;p=p||this.queryTargets(d.point,E);let R=!1;const B=new Set;for(const H of p){for(const[X,te]of E){if(!te.target)continue;const de=H.variants?H.variants[X]:null;if(de){for(const ce of de){if(Gp(ce,H,B,X))continue;const he=new i.dx(H,ce),ke=Mf(ce,H,X);O&&he.id!==void 0&&(he.state=this.map.getFeatureState(he));const be=j?this.prevHoveredFeatures.get(ke):null,Re=new cg(d,X,te,he),De=be?be.stop:te.handler(Re);if(j&&this.hoveredFeatures.set(ke,{feature:H,stop:De}),De!==!1){R=!0;break}}if(R)break}}if(R)break}if(!R)for(const[H,X]of E){const{handler:te,target:de}=X;if(!de&&te(new cg(d,H,X,null))!==!1)break}}}function moe(w,d){if(Array.isArray(w)&&Array.isArray(d)){const p=new Set(w),j=new Set(d);return p.size===j.size&&w.every(E=>j.has(E))}return i.by(w,d)}const foe={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"},poe={showCompass:!0,showZoom:!0,visualizePitch:!1};class goe{constructor(d,p,j=!1){this._clickTolerance=10,this.element=p,this.mouseRotate=new X5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,j&&(this.mousePitch=new Q5({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),i.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),p.addEventListener("mousedown",this.mousedown),p.addEventListener("touchstart",this.touchstart,{passive:!1}),p.addEventListener("touchmove",this.touchmove),p.addEventListener("touchend",this.touchend),p.addEventListener("touchcancel",this.reset)}down(d,p){this.mouseRotate.mousedown(d,p),this.mousePitch&&this.mousePitch.mousedown(d,p),F()}move(d,p){const j=this.map,E=this.mouseRotate.mousemoveWindow(d,p),O=E&&E.bearingDelta;if(O&&j.setBearing(j.getBearing()+O),this.mousePitch){const R=this.mousePitch.mousemoveWindow(d,p),B=R&&R.pitchDelta;B&&j.setPitch(j.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(){D(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(d){this.down(Object.assign({},d,{ctrlKey:!0,preventDefault:()=>d.preventDefault()}),W(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,W(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=G(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=G(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)p.width||d.y>p.height;p.locationPoint3D(j).distSqr(d)180;){const j=p.locationPoint3D(w);if(j.x>=0&&j.y>=0&&j.x<=p.width&&j.y<=p.height)break;w.lng>p.center.lng?w.lng-=360:w.lng+=360}return w}const Pc={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%)"},ph={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class ZN extends i.E{constructor(d,p){super(),(d instanceof HTMLElement||p)&&(d=Object.assign({element:d},p)),i.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:j="center",color:E="#3FB1CE",scale:O=1,draggable:R=!1,clickTolerance:B=0,rotation:H=ph.rotation,rotationAlignment:X=ph.rotationAlignment,pitchAlignment:te=ph.pitchAlignment,occludedOpacity:de=ph.occludedOpacity,altitude:ce=ph.altitude}=d||{};this._anchor=j,this._color=E,this._scale=O,this._draggable=R,this._clickTolerance=B,this._rotation=H,this._rotationAlignment=X,this._pitchAlignment=te,this._occludedOpacity=de,this._altitude=ce,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),d&&d.element?(this._element=d.element,this._offset=i.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.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",be=>{be.preventDefault()}),this._element.addEventListener("mousedown",be=>{be.preventDefault()});const he=this._element.classList;for(const be in Pc)he.remove(`mapboxgl-marker-anchor-${be}`);he.add(`mapboxgl-marker-anchor-${this._anchor}`);const ke=d&&d.className?d.className.trim().split(/\s+/):[];he.add(...ke),this._popup=null}_createDefaultMarker(){const d=k("div"),p=M("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const j=M("radialGradient",{id:"shadowGradient"},M("defs",{},p));M("stop",{offset:"10%","stop-opacity":.4},j),M("stop",{offset:"100%","stop-opacity":.05},j),M("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},p)}return M("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"},p),M("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"},p),M("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},p),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=i.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||ph.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 E=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":[E,-1*(38.1-13.5+E)],"bottom-right":[-E,-1*(38.1-13.5+E)],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 p=d.code,j=d.charCode||d.keyCode;p!=="Space"&&p!=="Enter"&&j!==32&&j!==13||this.togglePopup()}_onMapClick(d){const p=d.originalEvent.target,j=this._element;this._popup&&(p===j||j.contains(p))&&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,p=this._pos;if(!d||!p)return!1;const j=d.unproject(p,this._altitude),E=d.getFreeCameraOptions();if(!E.position)return!1;const O=E.position.toLngLat();return O.distanceTo(j)<.9*O.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const p=this._pos;if(!p||p.x<0||p.x>d.transform.width||p.y<0||p.y>d.transform.height)return void this._clearFadeTimer();const j=d.unproject(p,this._altitude);let E;d._showingGlobe()&&i.f5(d.transform,this._lngLat)?E=0:(E=1-d._queryFogOpacity(j),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(E*=this._occludedOpacity)),this._element.style.opacity=`${E}`,this._element.style.pointerEvents=E>0?"auto":"none",this._popup&&this._popup._setOpacity(E),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const d=this._pos;if(!d||!this._map)return;const p=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${Pc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${p.x}px,${p.y}px) `}_calculateXYTransform(){const d=this._pos,p=this._map,j=this.getPitchAlignment();if(!p||!d||j!=="map")return"";if(!p._showingGlobe()){const H=p.getPitch();return H?`rotateX(${H}deg)`:""}const E=i.cX(i.f6(p.transform,this._lngLat)),O=d.sub(i.f7(p.transform)),R=Math.abs(O.x)+Math.abs(O.y);if(R===0)return"";const B=E/R;return`rotateX(${-O.y*B}deg) rotateY(${O.x*B}deg)`}_calculateZTransform(){const d=this._pos,p=this._map;if(!p||!d)return"";let j=0;const E=this.getRotationAlignment();if(E==="map")if(p._showingGlobe()){const O=p.project(new i.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),R=p.project(new i.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(O);j=i.cX(Math.atan2(R.y,R.x))-90}else j=-p.getBearing();else if(E==="horizon"){const O=i.ah(4,6,p.getZoom()),R=i.f7(p.transform);R.y+=O*p.transform.height;const B=d.sub(R),H=i.cX(Math.atan2(B.y,B.x));j=(H>90?H-270:H+90)*(1-O)}return j+=this._rotation,j?`rotateZ(${j}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const p=this._map;p&&(p.transform.renderWorldCopies&&(this._lngLat=rM(this._lngLat,this._pos,p.transform)),this._pos=p.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(),p._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(p._showingGlobe()||p.getTerrain()||p.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=i.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 p=this._map;if(!p)return;const j=this._pointerdownPos,E=this._positionDelta;if(j&&E){if(!this._isDragging){const O=this._clickTolerance||p._clickTolerance;if(d.point.dist(j)w.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(w.minPitch!=null&&w.maxPitch!=null&&w.minPitch>w.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(w.minPitch!=null&&w.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(w.maxPitch!=null&&w.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(w.antialias&&i.f3(window)&&(w.antialias=!1,i.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new i5(w.minZoom,w.maxZoom,w.minPitch,w.maxPitch,w.renderWorldCopies,null,null),w),this._repaint=!!w.repaint,this._interactive=w.interactive,this._minTileCacheSize=w.minTileCacheSize,this._maxTileCacheSize=w.maxTileCacheSize,this._failIfMajorPerformanceCaveat=w.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=w.preserveDrawingBuffer,this._antialias=w.antialias,this._trackResize=w.trackResize,this._bearingSnap=w.bearingSnap,this._refreshExpiredTiles=w.refreshExpiredTiles,this._fadeDuration=w.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=w.crossSourceCollisions,this._collectResourceTiming=w.collectResourceTiming,this._language=this._parseLanguage(w.language),this._worldview=w.worldview,this._renderTaskQueue=new $f,this._domRenderTaskQueue=new $f,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.b2(),this._locale=Object.assign({},qf,w.locale),this._clickTolerance=w.clickTolerance,this._cooperativeGestures=w.cooperativeGestures,this._performanceMetricsCollection=w.performanceMetricsCollection,this._tessellationStep=w.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=w.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Uf(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=w.scaleFactor,this._requestManager=new ne(w.transformRequest,w.accessToken,w.testMode),this._silenceAuthErrors=!!w.testMode,this._contextCreateOptions=w.contextCreateOptions?Object.assign({},w.contextCreateOptions):{},typeof w.container=="string"){const p=document.getElementById(w.container);if(!p)throw new Error(`Container '${w.container.toString()}' not found.`);this._container=p}else{if(!(w.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=w.container}if(this._container.childNodes.length>0&&i.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."),w.maxBounds&&this.setMaxBounds(w.maxBounds),this._spriteFormat=w.spriteFormat,i.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 hoe(this,w),this._localFontFamily=w.localFontFamily,this._localIdeographFontFamily=w.localIdeographFontFamily,(w.style||!w.testMode)&&this.setStyle(w.style||i.e.DEFAULT_STYLE,{config:w.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),w.projection&&this.setProjection(w.projection),w.hash&&(this._hash=new q5(typeof w.hash=="string"&&w.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:w.center,zoom:w.zoom,bearing:w.bearing,pitch:w.pitch});const p=w.bounds;p&&(this.resize(),this.fitBounds(p,Object.assign({},w.fitBoundsOptions,{duration:0})))}this.resize(),w.attributionControl&&this.addControl(new h_({customAttribution:w.customAttribution})),this._logoControl=new m_,this.addControl(this._logoControl,w.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",p=>{this._update(p.dataType==="style"),this.fire(new i.z(`${p.dataType}data`,p))}),this.on("dataloading",p=>{this.fire(new i.z(`${p.dataType}dataloading`,p))}),this._interactions=new Yh(this)}_getMapId(){return this._mapId}addControl(w,d){if(d===void 0&&(d=w.getDefaultPosition?w.getDefaultPosition():"top-right"),!w||!w.onAdd)return this.fire(new i.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const p=w.onAdd(this);this._controls.push(w);const j=this._controlPositions[d];return d.indexOf("bottom")!==-1?j.insertBefore(p,j.firstChild):j.appendChild(p),this}removeControl(w){if(!w||!w.onRemove)return this.fire(new i.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const d=this._controls.indexOf(w);return d>-1&&this._controls.splice(d,1),w.onRemove(this),this}hasControl(w){return this._controls.indexOf(w)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(w){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 i.z("movestart",w)).fire(new i.z("move",w)),this.fire(new i.z("resize",w)),d&&this.fire(new i.z("moveend",w)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(w){return this.transform.setMaxBounds(i.aI.convert(w)),this._update()}setMinZoom(w){if((w=w??-2)>=-2&&w<=this.transform.maxZoom)return this.transform.minZoom=w,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=w,this._update(),this.getZoom()>w?this.setZoom(w):this.fire(new i.z("zoomstart")).fire(new i.z("zoom")).fire(new i.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(w){if((w=w??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(w>=0&&w<=this.transform.maxPitch)return this.transform.minPitch=w,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(w>=this.transform.minPitch)return this.transform.maxPitch=w,this._update(),this.getPitch()>w?this.setPitch(w):this.fire(new i.z("pitchstart")).fire(new i.z("pitch")).fire(new i.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(w){return this._scaleFactor=w,this.painter.scaleFactor=w,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(w){return this.transform.renderWorldCopies=w,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(w){return w==="auto"?navigator.language:Array.isArray(w)?w.length===0?void 0:w.map(d=>d==="auto"?navigator.language:d):w}setLanguage(w){const d=this._parseLanguage(w);if(!this.style||d===this._language)return this;this._language=d,this.style.reloadSources();for(const p of this._controls)p._setLanguage&&p._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(w){return this.style&&w!==this._worldview?(this._worldview=w,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(w){return this._lazyInitEmptyStyle(),w?typeof w=="string"&&(w={name:w}):w=null,this._useExplicitProjection=!!w,this._prioritizeAndUpdateProjection(w,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const w=this.transform,d=w.projection.name;let p;d==="globe"&&w.zoom>=i.cL?(w.setMercatorFromTransition(),p=!0):d==="mercator"&&w.zoom=i.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(w),this.style.applyProjectionUpdate();const j=this.transform.getProjection().name==="mercator"&&p!==this.transform.mercatorFromTransition;return(d||j)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(w,d){return this.transform.locationPoint3D(i.aT.convert(w),d)}unproject(w,d){return this.transform.pointLocation3D(i.P.convert(w),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(w,d,p){const j=E=>{let O=[];if(Array.isArray(d)){const R=d.filter(B=>this.getLayer(B));O=R.length?this.queryRenderedFeatures(E,{layers:R}):[]}else O=this.queryRenderedFeatures(E,{target:d});return O};if(w==="mouseenter"||w==="mouseover"){let E=!1;return{listener:p,targets:d,delegates:{mousemove:R=>{const B=j(R.point);B.length?E||(E=!0,p.call(this,new Zd(w,this,R.originalEvent,{features:B}))):E=!1},mouseout:()=>{E=!1}}}}if(w==="mouseleave"||w==="mouseout"){let E=!1;return{listener:p,targets:d,delegates:{mousemove:B=>{j(B.point).length?E=!0:E&&(E=!1,p.call(this,new Zd(w,this,B.originalEvent)))},mouseout:B=>{E&&(E=!1,p.call(this,new Zd(w,this,B.originalEvent)))}}}}{const E=O=>{const R=j(O.point);R.length&&(O.features=R,p.call(this,O),delete O.features)};return{listener:p,targets:d,delegates:{[w]:E}}}}on(w,d,p){if(typeof d=="function"||p===void 0)return super.on(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._createDelegatedListener(w,d,p);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[w]=this._delegatedListeners[w]||[],this._delegatedListeners[w].push(j);for(const E in j.delegates)this.on(E,j.delegates[E]);return this}once(w,d,p){if(typeof d=="function"||p===void 0)return super.once(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._createDelegatedListener(w,d,p);for(const E in j.delegates)this.once(E,j.delegates[E]);return this}off(w,d,p){if(typeof d=="function"||p===void 0)return super.off(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._delegatedListeners?this._delegatedListeners[w]:void 0;return j&&(E=>{for(let O=0;O{if(p){const E=typeof p=="string"?p:p instanceof Error?p.message:p.error;i.w(`Unable to perform style diff: ${E}. Rebuilding the style from scratch.`),this._updateStyle(w,d)}else j&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(w,d))}_getUIString(w){const d=this._locale[w];if(d==null)throw new Error(`Missing UI string '${w}'`);return d}_updateStyle(w,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),w){const p=Object.assign({},d);d&&d.config&&(p.initialConfig=d.config,delete p.config),this.style=new fh(this,p).load(w),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new fh(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():(i.w("There is no style added to the map."),!1)}_isValidId(w){return w==null?(this.fire(new i.y(new Error("IDs can't be empty."))),!1):!i.dr(w)||(this.fire(new i.y(new Error(`IDs can't contain special symbols: "${w}".`))),!1)}_isTargetValid(w){return"featuresetId"in w?this._isValidId("importId"in w?w.importId:w.featuresetId):"layerId"in w&&this._isValidId(w.layerId)}_areTargetsValid(w){if(Array.isArray(w)){for(const d of w)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(w)}addSource(w,d){return this._isValidId(w)?(this._lazyInitEmptyStyle(),this.style.addSource(w,d),this._update(!0)):this}isSourceLoaded(w){return!!this._isValidId(w)&&!!this.style&&this.style._isSourceCacheLoaded(w)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(w,d,p){this._lazyInitEmptyStyle(),this.style.addSourceType(w,d,p)}removeSource(w){return this._isValidId(w)?(this.style.removeSource(w),this._updateTerrain(),this._update(!0)):this}getSource(w){return this._isValidId(w)?this.style.getOwnSource(w):null}addImage(w,d,{pixelRatio:p=1,sdf:j=!1,stretchX:E,stretchY:O,content:R}={}){this._lazyInitEmptyStyle();const B=i.I.from(w);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:H,height:X,data:te}=i.o.getImageData(d);this.style.addImage(B,{data:new i.q({width:H,height:X},te),pixelRatio:p,stretchX:E,stretchY:O,content:R,sdf:j,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new i.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:H,height:X}=d,te=d;this.style.addImage(B,{data:new i.q({width:H,height:X},new Uint8Array(te.data)),pixelRatio:p,stretchX:E,stretchY:O,content:R,sdf:j,usvg:!1,version:0,userImage:te}),te.onAdd&&te.onAdd(this,w)}}updateImage(w,d){this._lazyInitEmptyStyle();const p=i.I.from(w),j=this.style.getImage(p);if(!j)return void this.fire(new i.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const E=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?i.o.getImageData(d):d,{width:O,height:R,data:B}=E;if(O===void 0||R===void 0)return void this.fire(new i.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!==(j.usvg?j.icon.usvg_tree.width:j.data.width)||R!==(j.usvg?j.icon.usvg_tree.height:j.data.height))return void this.fire(new i.y(new Error(`The width and height of the updated image (${O}, ${R}) must be that same as the previous version of the image (${j.data.width}, ${j.data.height})`)));const H=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let X=!1;j.usvg?(j.data=new i.q({width:O,height:R},new Uint8Array(B)),j.usvg=!1,j.icon=void 0,X=!0):j.data.replace(B,H),this.style.updateImage(p,j,X)}hasImage(w){return w?!!this.style&&!!this.style.getImage(i.I.from(w)):(this.fire(new i.y(new Error("Missing required image id"))),!1)}removeImage(w){this.style.removeImage(i.I.from(w))}loadImage(w,d){i.n(this._requestManager.transformRequest(w,i.R.Image),(p,j)=>{d(p,j instanceof HTMLImageElement?i.o.getImageData(j):j)})}listImages(){return this.style.listImages().map(w=>w.name)}addModel(w,d){this._lazyInitEmptyStyle(),this.style.addModel(w,d)}hasModel(w){return w?this.style.hasModel(w):(this.fire(new i.y(new Error("Missing required model id"))),!1)}removeModel(w){this.style.removeModel(w)}listModels(){return this.style.listModels()}addLayer(w,d){return this._isValidId(w.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(w,d),this._update(!0)):this}getSlot(w){const d=this.getLayer(w);return d&&d.slot||null}setSlot(w,d){return this.style.setSlot(w,d),this.style.mergeLayers(),this._update(!0)}addImport(w,d){return this.style.addImport(w,d).catch(p=>this.fire(new i.y(new Error("Failed to add import",p)))),this}updateImport(w,d){return typeof d!="string"&&d.id!==w?(this.removeImport(w),this.addImport(d)):(this.style.updateImport(w,d),this._update(!0))}removeImport(w){return this.style.removeImport(w),this}moveImport(w,d){return this.style.moveImport(w,d),this._update(!0)}moveLayer(w,d){return this._isValidId(w)?(this.style.moveLayer(w,d),this._update(!0)):this}removeLayer(w){return this._isValidId(w)?(this.style.removeLayer(w),this._update(!0)):this}getLayer(w){if(!this._isValidId(w))return null;const d=this.style.getOwnLayer(w);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(w,d,p){return this._isValidId(w)?(this.style.setLayerZoomRange(w,d,p),this._update(!0)):this}setFilter(w,d,p={}){return this._isValidId(w)?(this.style.setFilter(w,d,p),this._update(!0)):this}getFilter(w){return this._isValidId(w)?this.style.getFilter(w):null}setPaintProperty(w,d,p,j={}){return this._isValidId(w)?(this.style.setPaintProperty(w,d,p,j),this._update(!0)):this}getPaintProperty(w,d){return this._isValidId(w)?this.style.getPaintProperty(w,d):null}setLayoutProperty(w,d,p,j={}){return this._isValidId(w)?(this.style.setLayoutProperty(w,d,p,j),this._update(!0)):this}getLayoutProperty(w,d){return this._isValidId(w)?this.style.getLayoutProperty(w,d):null}setLayerProperty(w,d,p,j={}){return this._isValidId(w)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(w,d,p,j),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(w){return this.style.setGlyphsUrl(w),this._update(!0)}getSchema(w){return this.style.getSchema(w)}setSchema(w,d){return this.style.setSchema(w,d),this._update(!0)}getConfig(w){return this.style.getConfig(w)}setConfig(w,d){return this.style.setConfig(w,d),this._update(!0)}getConfigProperty(w,d){return this.style.getConfigProperty(w,d)}setConfigProperty(w,d,p){return this.style.setConfigProperty(w,d,p),this._update(!0)}getFeaturesetDescriptors(w){return this.style.getFeaturesetDescriptors(w)}setLights(w){if(this._lazyInitEmptyStyle(),w&&w.length===1&&w[0].type==="flat"){const d=w[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(w),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const w=this.style.getLights()||[];return w.length===0&&w.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),w}setLight(w,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:w}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(w){return this._lazyInitEmptyStyle(),!w&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(w),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(w){return this._lazyInitEmptyStyle(),this.style.setFog(w),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(w){return this._lazyInitEmptyStyle(),this.style.setSnow(w),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(w){return this._lazyInitEmptyStyle(),this.style.setRain(w),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(w){return this._lazyInitEmptyStyle(),this.style.setColorTheme(w),this._update(!0)}setImportColorTheme(w,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(w,d),this._update(!0)}setCamera(w){return this.style.setCamera(w),this._triggerCameraUpdate(w)}_triggerCameraUpdate(w){return this._update(this.transform.setOrthographicProjectionAtLowPitch(w["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(w){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.aT.convert(w),this.transform):0}setFeatureState(w,d){return w.source&&!this._isValidId(w.source)?this:(this.style.setFeatureState(w,d),this._update())}removeFeatureState(w,d){return w.source&&!this._isValidId(w.source)?this:(this.style.removeFeatureState(w,d),this._update())}getFeatureState(w){return w.source&&!this._isValidId(w.source)?null:this.style.getFeatureState(w)}_selectIndoorFloor(w){this.indoor.selectFloor(w)}_setIndoorActiveFloorsVisibility(w){this.indoor.setActiveFloorsVisibility(w)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new w0),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const w=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let p,j,E,O=this._container;for(;O&&(!j||!E);){const R=window.getComputedStyle(O).transform;R&&R!=="none"&&(p=R.match(/matrix.*\((.+)\)/)[1].split(", "),p[0]&&p[0]!=="0"&&p[0]!=="1"&&(j=p[0]),p[3]&&p[3]!=="0"&&p[3]!=="1"&&(E=p[3])),O=O.parentElement}this._containerWidth=j?Math.abs(w/j):w,this._containerHeight=E?Math.abs(d/E):d}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&i.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 RP(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 w=this._container;w.classList.add("mapboxgl-map"),(this._missingCSSCanary=k("div","mapboxgl-canary",w)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=k("div","mapboxgl-canvas-container",w);this._canvas=k("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 p=this._controlContainer=k("div","mapboxgl-control-container",w),j=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(E=>{j[E]=k("div",`mapboxgl-ctrl-${E}`,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(w,d){const p=i.o.devicePixelRatio||1;this._canvas.width=p*Math.ceil(w),this._canvas.height=p*Math.ceil(d),this._canvas.style.width=`${w}px`,this._canvas.style.height=`${d}px`}_addMarker(w){this._markers.push(w)}_removeMarker(w){const d=this._markers.indexOf(w);d!==-1&&this._markers.splice(d,1)}_addPopup(w){this._popups.push(w)}_removePopup(w){const d=this._popups.indexOf(w);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const w=Object.assign({},N.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",w);d?(st(d,!0),this.painter=new ON(d,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",p=>{p.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),i.k.testSupport(d)):this.fire(new i.y(new Error("Failed to initialize WebGL")))}_contextLost(w){w.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.z("webglcontextlost",{originalEvent:w}))}_contextRestored(w){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 i.z("webglcontextrestored",{originalEvent:w}))}_onMapScroll(w){if(w.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(w){return this.style?(this._styleDirty=this._styleDirty||w,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(w){return this._update(),this._renderTaskQueue.add(w)}_cancelRenderFrame(w){this._renderTaskQueue.remove(w)}_requestDomTask(w){!this.loaded()||this.loaded()&&!this.isMoving()?w():this._domRenderTaskQueue.add(w)}_render(w){let d;this.fire(new i.z("renderstart")),++this._frameId;const p=this.painter.context.extTimerQuery,j=i.o.now(),E=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=E.createQuery(),E.beginQuery(p.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(w),this._domRenderTaskQueue.run(w),this._removed)return;this._updateProjectionTransition();const O=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const X=this.transform.zoom,te=this.transform.pitch,de=i.o.now(),ce=new i.ac(X,{now:de,fadeDuration:O,pitch:te,transition:this.style.transition,worldview:this._worldview});this.style.update(ce)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let R=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),R=this._updateAverageElevation(j),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):R=this._updateAverageElevation(j);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 i.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,x.mark(m.load),this.fire(new i.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 X=i.o.now()-j;E.endQuery(p.TIME_ELAPSED_EXT),setTimeout(()=>{const te=E.getQueryParameter(d,E.QUERY_RESULT)/1e6;E.deleteQuery(d),this.fire(new i.z("gpu-timing-frame",{cpuTime:X,gpuTime:te}))},50)}if(this.listens("gpu-timing-layer")){const X=this.painter.collectGpuTimers();setTimeout(()=>{const te=this.painter.queryGpuTimers(X);this.fire(new i.z("gpu-timing-layer",{layerTimes:te}))},50)}if(this.listens("gpu-timing-deferred-render")){const X=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const te=this.painter.queryGpuTimeDeferredRender(X);this.fire(new i.z("gpu-timing-deferred-render",{gpuTime:te}))},50)}const H=this._sourcesDirty||this._styleDirty||this._placementDirty||R;if(H||this._repaint)this.triggerRepaint();else{const X=this.idle();if(X&&(R=this._updateAverageElevation(j,!0)),R)this.triggerRepaint();else if(this._triggerFrame(!1),X&&(this.fire(new i.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const te=this._calculateSpeedIndex();this.fire(new i.z("speedindexcompleted",{speedIndex:te})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||H||(this._fullyLoaded=!0,x.mark(m.fullLoad),this._performanceMetricsCollection&&at(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(w){for(const d of this._markers)w&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!w||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(w,d=!1){const p=E=>(this.transform.averageElevation=E,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&p(0);const j=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(j||(d||w-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(w)){const E=this.transform.averageElevation;let O=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(O)?O=0:this._averageElevationLastSampledAt=w;const R=Math.abs(E-O);if(R>1){if(this._isInitialLoad||j)return this._averageElevation.jumpTo(O),p(O);this._averageElevation.easeTo(O,w,300)}else if(R>1e-4)return this._averageElevation.jumpTo(O),p(O)}return!!this._averageElevation.isEasing(w)&&p(this._averageElevation.getValue(w))}_authenticate(){qe(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,w=>{if(w&&(w.message===pe||w.status===401)){const d=this.painter.context.gl;st(d,!1),this._logoControl instanceof m_&&this._logoControl._updateLogo(),d&&d.clear(d.DEPTH_BUFFER_BIT|d.COLOR_BUFFER_BIT|d.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.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/")))}}),Me(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&$e(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Ve(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Tt(this._requestManager._customAccessToken)}_updateTerrain(){const w=this._isDragging();this.painter.updateTerrain(this.style,w)}_calculateSpeedIndex(){const w=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const p=this.painter.context.gl,j=p.createFramebuffer();function E(O){p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,O,0);const R=new Uint8Array(p.drawingBufferWidth*p.drawingBufferHeight*4);return p.readPixels(0,0,p.drawingBufferWidth,p.drawingBufferHeight,p.RGBA,p.UNSIGNED_BYTE,R),R}return p.bindFramebuffer(p.FRAMEBUFFER,j),this._canvasPixelComparison(E(w),d.canvasCopies.map(E),d.timeStamps)}_canvasPixelComparison(w,d,p){let j=p[1]-p[0];const E=w.length/4;for(let O=0;O{const p=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,p&&this._render(d)}))}_preloadTiles(w){const d=this.style?this.style.getSourceCaches():[];return i.bw(d,(p,j)=>p._preloadTiles(w,j),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(w){this._trackResize&&this.resize({originalEvent:w})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(w){this._showTileBoundaries!==w&&(this._showTileBoundaries=w,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(w){this._showParseStatus!==w&&(this._showParseStatus=w,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(w){this._showTerrainWireframe!==w&&(this._showTerrainWireframe=w,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(w){this._showLayers2DWireframe!==w&&(this._showLayers2DWireframe=w,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(w){this._showLayers3DWireframe!==w&&(this._showLayers3DWireframe=w,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(w){this._speedIndexTiming!==w&&(this._speedIndexTiming=w,this._update())}get showPadding(){return!!this._showPadding}set showPadding(w){this._showPadding!==w&&(this._showPadding=w,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(w){this._showCollisionBoxes!==w&&(this._showCollisionBoxes=w,this.style&&w?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(w){this._showOverdrawInspector!==w&&(this._showOverdrawInspector=w,this._update())}get repaint(){return!!this._repaint}set repaint(w){this._repaint!==w&&(this._repaint=w,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(w){this._vertices=w,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(w){this._showTileAABBs!==w&&(this._showTileAABBs=w,w&&this._update())}_setCacheLimits(w,d){i.f4(w,d)}get version(){return u}},NavigationControl:class{constructor(w={}){this.options=Object.assign({},poe,w),this._container=k("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",d=>d.preventDefault()),this.options.showZoom&&(i.aY(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",d=>{this._map&&this._map.zoomIn({},{originalEvent:d})}),k("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})}),k("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.aY(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",d=>{const p=this._map;p&&(this.options.visualizePitch?p.resetNorthPitch({},{originalEvent:d}):p.resetNorth({},{originalEvent:d}))}),this._compassIcon=k("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const w=this._map;if(!w)return;const d=w.getZoom(),p=d===w.getMaxZoom(),j=d===w.getMinZoom();this._zoomInButton.disabled=p,this._zoomOutButton.disabled=j,this._zoomInButton.setAttribute("aria-disabled",p.toString()),this._zoomOutButton.setAttribute("aria-disabled",j.toString())}_rotateCompassArrow(){const w=this._map;if(!w)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(w.transform.pitch*(Math.PI/180)),.5)}) rotateX(${w.transform.pitch}deg) rotateZ(${w.transform.angle*(180/Math.PI)}deg)`:`rotate(${w.transform.angle*(180/Math.PI)}deg)`;w._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(w){return this._map=w,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),w.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&w.on("pitch",this._rotateCompassArrow),w.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new goe(w,this._compass,this.options.visualizePitch)),this._container}onRemove(){const w=this._map;w&&(this._container.remove(),this.options.showZoom&&w.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&w.off("pitch",this._rotateCompassArrow),w.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(w,d){const p=k("button",w,this._container);return p.type="button",p.addEventListener("click",d),p}_setButtonTitle(w,d){if(!this._map)return;const p=this._map._getUIString(`NavigationControl.${d}`);w.setAttribute("aria-label",p),w.firstElementChild&&w.firstElementChild.setAttribute("title",p)}},GeolocateControl:class extends i.E{constructor(w={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},xoe,w),i.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=DN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(w){return this._map=w,this._container=k("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(w){const d=(p=!!this.options.geolocation)=>{this._supportsGeolocation=p,w(p)};this._supportsGeolocation!==void 0?w(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(p=>d(p.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(w){const d=this._map.getMaxBounds(),p=w.coords;return!!d&&(p.longituded.getEast()||p.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(w){if(this._map){if(this._isOutOfMapMaxBounds(w))return this._setErrorState(),this.fire(new i.z("outofmaxbounds",w)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=w,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(w),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(w),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("geolocate",Object.assign({coords:w.coords,timestamp:w.timestamp},w.toJSON?{toJSON:w.toJSON.bind(w)}:{}))),this._finish()}}_updateCamera(w){const d=new i.aT(w.coords.longitude,w.coords.latitude),p=w.coords.accuracy,j=this._map.getBearing(),E=Object.assign({bearing:j},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(p),E,{geolocateSource:!0})}_updateMarker(w){if(w){const d=new i.aT(w.coords.longitude,w.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=w.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const w=this._map.transform,d=i.cf(1,w._center.lat)*w.worldSize,p=Math.ceil(2*this._accuracy*d);this._circleElement.style.width=`${p}px`,this._circleElement.style.height=`${p}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(w){if(this._map){if(this.options.trackUserLocation)if(w.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(w.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("error",w)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(w){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=k("button","mapboxgl-ctrl-geolocate",this._container),k("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",w===!1){i.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=k("div","mapboxgl-user-location"),this._dotElement.appendChild(k("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(k("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new ZN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=k("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ZN({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 i.z("trackuserlocationend")))})}}_onDeviceOrientation(w){this._userLocationDotMarker&&(w.webkitCompassHeading?this._heading=w.webkitCompassHeading:w.absolute===!0&&(this._heading=-1*w.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.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 i.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 i.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 i.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 w;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(w={maximumAge:6e5,timeout:0},this._noTimeout=!0):(w=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,w),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 w=()=>{"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"&&w()}).catch(console.error):w()}_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:h_,ScaleControl:class{constructor(w={}){this.options=Object.assign({},j0,w),i.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const w=this.options.maxWidth||100,d=this._map,p=d._containerHeight/2,j=d._containerWidth/2-w/2,E=d.unproject([j,p]),O=d.unproject([j+w,p]),R=E.distanceTo(O);if(this.options.unit==="imperial"){const B=3.2808*R;B>5280?this._setScale(w,B/5280,"mile"):this._setScale(w,B,"foot")}else this.options.unit==="nautical"?this._setScale(w,R/1852,"nautical-mile"):R>=1e3?this._setScale(w,R/1e3,"kilometer"):this._setScale(w,R,"meter")}_setScale(w,d,p){this._map._requestDomTask(()=>{const j=function(O){const R=Math.pow(10,`${Math.floor(O)}`.length-1);let B=O/R;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(H){const X=Math.pow(10,Math.ceil(-Math.log(H)/Math.LN10));return Math.round(H*X)/X}(B),R*B}(d),E=j/d;this._container.innerHTML=p!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:p}).format(j):`${j} ${nM[p]}`,this._container.style.width=w*E+"px"})}onAdd(w){return this._map=w,this._language=w.getLanguage(),this._container=k("div","mapboxgl-ctrl mapboxgl-ctrl-scale",w.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(w){this._language=w,this._update()}setUnit(w){this.options.unit=w,this._update()}},FullscreenControl:class{constructor(w={}){this._fullscreen=!1,w&&w.container&&(w.container instanceof HTMLElement?this._container=w.container:i.w("Full screen control 'container' must be a DOM element.")),i.aY(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(w){return this._map=w,this._container||(this._container=this._map.getContainer()),this._controlContainer=k("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.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 w=this._fullscreenButton=k("button","mapboxgl-ctrl-fullscreen",this._controlContainer);k("span","mapboxgl-ctrl-icon",w).setAttribute("aria-hidden","true"),w.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const w=this._getTitle();this._fullscreenButton.setAttribute("aria-label",w),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",w)}_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:w0,Popup:class extends i.E{constructor(w){super(),this.options=Object.assign(Object.create(gh),w),this._altitude=this.options.altitude,i.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(w&&w.className?w.className.trim().split(/\s+/):[])}addTo(w){return this._map&&this.remove(),this._map=w,this.options.closeOnClick&&w.on("preclick",this._onClose),this.options.closeOnMove&&w.on("move",this._onClose),w.on("remove",this.remove),this._update(),w._addPopup(this),this._focusFirstElement(),this._trackPointer?(w.on("mousemove",this._onMouseEvent),w.on("mouseup",this._onMouseEvent),w._canvasContainer.classList.add("mapboxgl-track-pointer")):w.on("move",this._update),this.fire(new i.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const w=this._map;return w&&(w.off("move",this._update),w.off("move",this._onClose),w.off("preclick",this._onClose),w.off("click",this._onClose),w.off("remove",this.remove),w.off("mousemove",this._onMouseEvent),w.off("mouseup",this._onMouseEvent),w.off("drag",this._onMouseEvent),w._canvasContainer&&w._canvasContainer.classList.remove("mapboxgl-track-pointer"),w._removePopup(this),this._map=void 0),this.fire(new i.z("close")),this}getLngLat(){return this._lngLat}setLngLat(w){this._lngLat=i.aT.convert(w),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(w){return this._altitude=w,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const w=this._map;return w&&(w.off("move",this._update),w.on("mousemove",this._onMouseEvent),w.on("drag",this._onMouseEvent),w._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(w){return this.setDOMContent(document.createTextNode(w))}setHTML(w){const d=document.createDocumentFragment(),p=document.createElement("body");let j;for(p.innerHTML=w;j=p.firstChild,j;)d.appendChild(j);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(w){return this.options.maxWidth=w,this._update(),this}setDOMContent(w){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=k("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(w),this.options.closeButton){const p=this._closeButton=k("button","mapboxgl-popup-close-button",d);p.type="button",p.setAttribute("aria-label","Close popup"),p.innerHTML='',p.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(w){return this._classList.add(w),this._updateClassList(),this}removeClassName(w){return this._classList.delete(w),this._updateClassList(),this}setOffset(w){return this.options.offset=w,this._update(),this}toggleClassName(w){let d;return this._classList.delete(w)?d=!1:(this._classList.add(w),d=!0),this._updateClassList(),d}_onMouseEvent(w){this._update(w.point)}_getAnchor(w){if(this.options.anchor)return this.options.anchor;const d=this._map,p=this._container,j=this._pos;if(!d||!p||!j)return"bottom";const E=p.offsetWidth,O=p.offsetHeight,R=j.xd.transform.width-E/2;if(j.y+wd.transform.height-O){if(R)return"bottom-left";if(B)return"bottom-right"}return R?"left":B?"right":"bottom"}_updateClassList(){const w=this._container;if(!w)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"),w.className=d.join(" ")}_update(w){const d=this._map,p=this._content;if(!d||!this._lngLat&&!this._trackPointer||!p)return;let j=this._container;if(j||(j=this._container=k("div","mapboxgl-popup",d.getContainer()),this._tip=k("div","mapboxgl-popup-tip",j),j.appendChild(p)),this.options.maxWidth&&j.style.maxWidth!==this.options.maxWidth&&(j.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=rM(this._lngLat,this._pos,d.transform)),!this._trackPointer||w){const E=this._pos=this._trackPointer&&w instanceof i.P?w:d.project(this._lngLat,this._altitude),O=Mx(this.options.offset),R=this._anchor=this._getAnchor(O.y),B=Mx(this.options.offset,R),H=E.add(B).round();d._requestDomTask(()=>{this._container&&R&&(this._container.style.transform=`${Pc[R]} translate(${H.x}px,${H.y}px)`)})}if(!this._marker&&d._showingGlobe()){const E=i.f5(d.transform,this._lngLat)?0:1;this._setOpacity(E)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const w=this._container.querySelector(xh);w&&w.focus()}_onClose(){this.remove()}_setOpacity(w){this._container&&(this._container.style.opacity=`${w}`),this._content&&(this._content.style.pointerEvents=w?"auto":"none")}},Marker:ZN,Style:fh,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:bd,Evented:i.E,config:i.e,prewarm:i.f9,clearPrewarmedResources:i.f8,get accessToken(){return i.e.ACCESS_TOKEN},set accessToken(w){i.e.ACCESS_TOKEN=w},get baseApiUrl(){return i.e.API_URL},set baseApiUrl(w){i.e.API_URL=w},get workerCount(){return i.fi.workerCount},set workerCount(w){i.fi.workerCount=w},get maxParallelImageRequests(){return i.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(w){i.e.MAX_PARALLEL_IMAGE_REQUESTS=w},clearStorage(w){i.fh(w)},get workerUrl(){return i.fg.workerUrl},set workerUrl(w){i.fg.workerUrl=w},get workerClass(){return i.fg.workerClass},set workerClass(w){i.fg.workerClass=w},get workerParams(){return i.fg.workerParams},set workerParams(w){i.fg.workerParams=w},get dracoUrl(){return i.ff()},set dracoUrl(w){i.fe(w)},get meshoptUrl(){return i.fd()},set meshoptUrl(w){i.fc(w)},setNow:i.o.setNow,restoreNow:i.o.restoreNow}});var l=a;return l})})(zOe);var Klt=zOe.exports;const rc=eo(Klt);function Er({className:e,...t}){return r.jsx("div",{className:Ut("animate-pulse rounded-md bg-muted",e),...t})}const Gke={coming_soon:"#3B82F6",active:"#10B981",price_improvement:"#F97316",under_contract:"#8B5CF6",sold:"#6B7280"},Kke={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function Zlt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function Ylt({listings:e,isLoading:t}){const n=Vn(),s=A.useRef(null),a=A.useRef(null),o=A.useRef([]),[l,i]=A.useState(""),[u,m]=A.useState(!0);return A.useEffect(()=>{(async()=>{m(!0);try{const{data:v}=await Y.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();v!=null&&v.value&&i(v.value)}catch(v){console.error("Error fetching mapbox token:",v)}m(!1)})()},[]),A.useEffect(()=>{if(!s.current||!l||a.current)return;rc.accessToken=l;const y=e.filter(N=>N.latitude!=null&&N.longitude!=null);let v=[-98.5795,39.8283],b=4;if(y.length>0){const N=y.reduce((M,I)=>M+I.longitude,0)/y.length,k=y.reduce((M,I)=>M+I.latitude,0)/y.length;v=[N,k],b=y.length===1?12:10}return a.current=new rc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:b,center:v}),a.current.addControl(new rc.NavigationControl,"top-right"),()=>{var N;(N=a.current)==null||N.remove(),a.current=null}},[l]),A.useEffect(()=>{if(!a.current||!l)return;o.current.forEach(v=>v.remove()),o.current=[];const y=e.filter(v=>v.latitude!=null&&v.longitude!=null);if(y.forEach(v=>{var F,D,U;const b=Gke[v.status]||"#10B981",N=((F=v.photos)==null?void 0:F.find(V=>V.is_primary))||((D=v.photos)==null?void 0:D[0]),M=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${v.slug||v.id}`:`/public/listing/${v.slug||v.id}`,I=document.createElement("div");I.className="cursor-pointer",I.innerHTML=`
`;const T=new rc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${N!=null&&N.photo_url?``:""}
${Zlt(v.price)}
${v.property_address||""}
${v.city}, ${v.state}
${Kke[v.status]||v.status} ${v.bedrooms?`${v.bedrooms} bed`:""} ${v.bathrooms?`${v.bathrooms} bath`:""}
${(U=v.agent)!=null&&U.name?`
Listed by ${v.agent.name}
`:""}
Click to view details →
`),P=new rc.Marker(I).setLngLat([v.longitude,v.latitude]).setPopup(T).addTo(a.current);o.current.push(P)}),y.length>1){const v=new rc.LngLatBounds;y.forEach(b=>v.extend([b.longitude,b.latitude])),a.current.fitBounds(v,{padding:60,maxZoom:13})}else y.length===1&&a.current.flyTo({center:[y[0].longitude,y[0].latitude],zoom:12})},[e,l]),A.useEffect(()=>(window.__navigateToPublicListing__=y=>{n(y)},()=>{delete window.__navigateToPublicListing__}),[n]),u||t?r.jsx(Er,{className:"w-full h-[500px] rounded-lg"}):!l||e.filter(y=>y.latitude!=null&&y.longitude!=null).length===0?null:r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:Object.entries(Gke).map(([y,v])=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:v}}),r.jsx("span",{className:"text-xs text-gray-600",children:Kke[y]})]},y))}),r.jsx("div",{ref:s,className:"w-full h-[500px] rounded-lg shadow-lg border border-gray-200"})]})}function LE(e,[t,n]){return Math.min(n,Math.max(t,e))}function oP(e){const t=A.useRef({value:e,previous:e});return A.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Xlt=[" ","Enter","ArrowUp","ArrowDown"],Qlt=[" ","Enter"],lk="Select",[Rse,Fse,Jlt]=HI(lk),[E3]=cc(lk,[Jlt,ax]),zse=ax(),[ect,Sv]=E3(lk),[tct,rct]=E3(lk),$Oe=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:a,onOpenChange:o,value:l,defaultValue:i,onValueChange:u,dir:m,name:x,autoComplete:y,disabled:v,required:b,form:N}=e,k=zse(t),[M,I]=A.useState(null),[T,P]=A.useState(null),[F,D]=A.useState(!1),U=Mk(m),[V,W]=rh({prop:s,defaultProp:a??!1,onChange:o,caller:lk}),[G,ee]=rh({prop:l,defaultProp:i,onChange:u,caller:lk}),ae=A.useRef(null),oe=M?N||!!M.closest("form"):!0,[pe,ne]=A.useState(new Set),fe=Array.from(pe).map(se=>se.props.value).join(";");return r.jsx(ZI,{...k,children:r.jsxs(ect,{required:b,scope:t,trigger:M,onTriggerChange:I,valueNode:T,onValueNodeChange:P,valueNodeHasChildren:F,onValueNodeHasChildrenChange:D,contentId:pd(),value:G,onValueChange:ee,open:V,onOpenChange:W,dir:U,triggerPointerDownPosRef:ae,disabled:v,children:[r.jsx(Rse.Provider,{scope:t,children:r.jsx(tct,{scope:e.__scopeSelect,onNativeOptionAdd:A.useCallback(se=>{ne(me=>new Set(me).add(se))},[]),onNativeOptionRemove:A.useCallback(se=>{ne(me=>{const ue=new Set(me);return ue.delete(se),ue})},[]),children:n})}),oe?r.jsxs(u8e,{"aria-hidden":!0,required:b,tabIndex:-1,name:x,autoComplete:y,value:G,onChange:se=>ee(se.target.value),disabled:v,form:N,children:[G===void 0?r.jsx("option",{value:""}):null,Array.from(pe)]},fe):null]})})};$Oe.displayName=lk;var UOe="SelectTrigger",qOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...a}=e,o=zse(n),l=Sv(UOe,n),i=l.disabled||s,u=ca(t,l.onTriggerChange),m=Fse(n),x=A.useRef("touch"),[y,v,b]=m8e(k=>{const M=m().filter(P=>!P.disabled),I=M.find(P=>P.value===l.value),T=f8e(M,k,I);T!==void 0&&l.onValueChange(T.value)}),N=k=>{i||(l.onOpenChange(!0),b()),k&&(l.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})};return r.jsx(b3,{asChild:!0,...o,children:r.jsx(Fn.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:i,"data-disabled":i?"":void 0,"data-placeholder":h8e(l.value)?"":void 0,...a,ref:u,onClick:gn(a.onClick,k=>{k.currentTarget.focus(),x.current!=="mouse"&&N(k)}),onPointerDown:gn(a.onPointerDown,k=>{x.current=k.pointerType;const M=k.target;M.hasPointerCapture(k.pointerId)&&M.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(N(k),k.preventDefault())}),onKeyDown:gn(a.onKeyDown,k=>{const M=y.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&v(k.key),!(M&&k.key===" ")&&Xlt.includes(k.key)&&(N(),k.preventDefault())})})})});qOe.displayName=UOe;var VOe="SelectValue",HOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,children:o,placeholder:l="",...i}=e,u=Sv(VOe,n),{onValueNodeHasChildrenChange:m}=u,x=o!==void 0,y=ca(t,u.onValueNodeChange);return oc(()=>{m(x)},[m,x]),r.jsx(Fn.span,{...i,ref:y,style:{pointerEvents:"none"},children:h8e(u.value)?r.jsx(r.Fragment,{children:l}):o})});HOe.displayName=VOe;var nct="SelectIcon",WOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...a}=e;return r.jsx(Fn.span,{"aria-hidden":!0,...a,ref:t,children:s||"▼"})});WOe.displayName=nct;var sct="SelectPortal",GOe=e=>r.jsx(g3,{asChild:!0,...e});GOe.displayName=sct;var ck="SelectContent",KOe=A.forwardRef((e,t)=>{const n=Sv(ck,e.__scopeSelect),[s,a]=A.useState();if(oc(()=>{a(new DocumentFragment)},[]),!n.open){const o=s;return o?Th.createPortal(r.jsx(ZOe,{scope:e.__scopeSelect,children:r.jsx(Rse.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(YOe,{...e,ref:t})});KOe.displayName=ck;var ip=10,[ZOe,Cv]=E3(ck),act="SelectContentImpl",ict=uv("SelectContent.RemoveScroll"),YOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:i,sideOffset:u,align:m,alignOffset:x,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:N,hideWhenDetached:k,avoidCollisions:M,...I}=e,T=Sv(ck,n),[P,F]=A.useState(null),[D,U]=A.useState(null),V=ca(t,$e=>F($e)),[W,G]=A.useState(null),[ee,ae]=A.useState(null),oe=Fse(n),[pe,ne]=A.useState(!1),fe=A.useRef(!1);A.useEffect(()=>{if(P)return Mse(P)},[P]),Cse();const se=A.useCallback($e=>{const[Be,...Ve]=oe().map(Oe=>Oe.ref.current),[ot]=Ve.slice(-1),Tt=document.activeElement;for(const Oe of $e)if(Oe===Tt||(Oe==null||Oe.scrollIntoView({block:"nearest"}),Oe===Be&&D&&(D.scrollTop=0),Oe===ot&&D&&(D.scrollTop=D.scrollHeight),Oe==null||Oe.focus(),document.activeElement!==Tt))return},[oe,D]),me=A.useCallback(()=>se([W,P]),[se,W,P]);A.useEffect(()=>{pe&&me()},[pe,me]);const{onOpenChange:ue,triggerPointerDownPosRef:xe}=T;A.useEffect(()=>{if(P){let $e={x:0,y:0};const Be=ot=>{var Tt,Oe;$e={x:Math.abs(Math.round(ot.pageX)-(((Tt=xe.current)==null?void 0:Tt.x)??0)),y:Math.abs(Math.round(ot.pageY)-(((Oe=xe.current)==null?void 0:Oe.y)??0))}},Ve=ot=>{$e.x<=10&&$e.y<=10?ot.preventDefault():P.contains(ot.target)||ue(!1),document.removeEventListener("pointermove",Be),xe.current=null};return xe.current!==null&&(document.addEventListener("pointermove",Be),document.addEventListener("pointerup",Ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Be),document.removeEventListener("pointerup",Ve,{capture:!0})}}},[P,ue,xe]),A.useEffect(()=>{const $e=()=>ue(!1);return window.addEventListener("blur",$e),window.addEventListener("resize",$e),()=>{window.removeEventListener("blur",$e),window.removeEventListener("resize",$e)}},[ue]);const[Te,_e]=m8e($e=>{const Be=oe().filter(Tt=>!Tt.disabled),Ve=Be.find(Tt=>Tt.ref.current===document.activeElement),ot=f8e(Be,$e,Ve);ot&&setTimeout(()=>ot.ref.current.focus())}),we=A.useCallback(($e,Be,Ve)=>{const ot=!fe.current&&!Ve;(T.value!==void 0&&T.value===Be||ot)&&(G($e),ot&&(fe.current=!0))},[T.value]),ve=A.useCallback(()=>P==null?void 0:P.focus(),[P]),Xe=A.useCallback(($e,Be,Ve)=>{const ot=!fe.current&&!Ve;(T.value!==void 0&&T.value===Be||ot)&&ae($e)},[T.value]),Me=s==="popper"?ime:XOe,Ie=Me===ime?{side:i,sideOffset:u,align:m,alignOffset:x,arrowPadding:y,collisionBoundary:v,collisionPadding:b,sticky:N,hideWhenDetached:k,avoidCollisions:M}:{};return r.jsx(ZOe,{scope:n,content:P,viewport:D,onViewportChange:U,itemRefCallback:we,selectedItem:W,onItemLeave:ve,itemTextRefCallback:Xe,focusSelectedItem:me,selectedItemText:ee,position:s,isPositioned:pe,searchRef:Te,children:r.jsx(rP,{as:ict,allowPinchZoom:!0,children:r.jsx(eP,{asChild:!0,trapped:T.open,onMountAutoFocus:$e=>{$e.preventDefault()},onUnmountAutoFocus:gn(a,$e=>{var Be;(Be=T.trigger)==null||Be.focus({preventScroll:!0}),$e.preventDefault()}),children:r.jsx(wv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:$e=>$e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:r.jsx(Me,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:$e=>$e.preventDefault(),...I,...Ie,onPlaced:()=>ne(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...I.style},onKeyDown:gn(I.onKeyDown,$e=>{const Be=$e.ctrlKey||$e.altKey||$e.metaKey;if($e.key==="Tab"&&$e.preventDefault(),!Be&&$e.key.length===1&&_e($e.key),["ArrowUp","ArrowDown","Home","End"].includes($e.key)){let ot=oe().filter(Tt=>!Tt.disabled).map(Tt=>Tt.ref.current);if(["ArrowUp","End"].includes($e.key)&&(ot=ot.slice().reverse()),["ArrowUp","ArrowDown"].includes($e.key)){const Tt=$e.target,Oe=ot.indexOf(Tt);ot=ot.slice(Oe+1)}setTimeout(()=>se(ot)),$e.preventDefault()}})})})})})})});YOe.displayName=act;var oct="SelectItemAlignedPosition",XOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...a}=e,o=Sv(ck,n),l=Cv(ck,n),[i,u]=A.useState(null),[m,x]=A.useState(null),y=ca(t,V=>x(V)),v=Fse(n),b=A.useRef(!1),N=A.useRef(!0),{viewport:k,selectedItem:M,selectedItemText:I,focusSelectedItem:T}=l,P=A.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&m&&k&&M&&I){const V=o.trigger.getBoundingClientRect(),W=m.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),ee=I.getBoundingClientRect();if(o.dir!=="rtl"){const Tt=ee.left-W.left,Oe=G.left-Tt,at=V.left-Oe,le=V.width+at,qe=Math.max(le,W.width),Je=window.innerWidth-ip,st=LE(Oe,[ip,Math.max(ip,Je-qe)]);i.style.minWidth=le+"px",i.style.left=st+"px"}else{const Tt=W.right-ee.right,Oe=window.innerWidth-G.right-Tt,at=window.innerWidth-V.right-Oe,le=V.width+at,qe=Math.max(le,W.width),Je=window.innerWidth-ip,st=LE(Oe,[ip,Math.max(ip,Je-qe)]);i.style.minWidth=le+"px",i.style.right=st+"px"}const ae=v(),oe=window.innerHeight-ip*2,pe=k.scrollHeight,ne=window.getComputedStyle(m),fe=parseInt(ne.borderTopWidth,10),se=parseInt(ne.paddingTop,10),me=parseInt(ne.borderBottomWidth,10),ue=parseInt(ne.paddingBottom,10),xe=fe+se+pe+ue+me,Te=Math.min(M.offsetHeight*5,xe),_e=window.getComputedStyle(k),we=parseInt(_e.paddingTop,10),ve=parseInt(_e.paddingBottom,10),Xe=V.top+V.height/2-ip,Me=oe-Xe,Ie=M.offsetHeight/2,$e=M.offsetTop+Ie,Be=fe+se+$e,Ve=xe-Be;if(Be<=Xe){const Tt=ae.length>0&&M===ae[ae.length-1].ref.current;i.style.bottom="0px";const Oe=m.clientHeight-k.offsetTop-k.offsetHeight,at=Math.max(Me,Ie+(Tt?ve:0)+Oe+me),le=Be+at;i.style.height=le+"px"}else{const Tt=ae.length>0&&M===ae[0].ref.current;i.style.top="0px";const at=Math.max(Xe,fe+k.offsetTop+(Tt?we:0)+Ie)+Ve;i.style.height=at+"px",k.scrollTop=Be-Xe+k.offsetTop}i.style.margin=`${ip}px 0`,i.style.minHeight=Te+"px",i.style.maxHeight=oe+"px",s==null||s(),requestAnimationFrame(()=>b.current=!0)}},[v,o.trigger,o.valueNode,i,m,k,M,I,o.dir,s]);oc(()=>P(),[P]);const[F,D]=A.useState();oc(()=>{m&&D(window.getComputedStyle(m).zIndex)},[m]);const U=A.useCallback(V=>{V&&N.current===!0&&(P(),T==null||T(),N.current=!1)},[P,T]);return r.jsx(cct,{scope:n,contentWrapper:i,shouldExpandOnScrollRef:b,onScrollButtonChange:U,children:r.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:r.jsx(Fn.div,{...a,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});XOe.displayName=oct;var lct="SelectPopperPosition",ime=A.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=ip,...o}=e,l=zse(n);return r.jsx(YI,{...l,...o,ref:t,align:s,collisionPadding:a,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)"}})});ime.displayName=lct;var[cct,Qxe]=E3(ck,{}),ome="SelectViewport",QOe=A.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...a}=e,o=Cv(ome,n),l=Qxe(ome,n),i=ca(t,o.onViewportChange),u=A.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(Rse.Slot,{scope:n,children:r.jsx(Fn.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:gn(a.onScroll,m=>{const x=m.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:v}=l;if(v!=null&&v.current&&y){const b=Math.abs(u.current-x.scrollTop);if(b>0){const N=window.innerHeight-ip*2,k=parseFloat(y.style.minHeight),M=parseFloat(y.style.height),I=Math.max(k,M);if(I0?F:0,y.style.justifyContent="flex-end")}}}u.current=x.scrollTop})})})]})});QOe.displayName=ome;var JOe="SelectGroup",[dct,uct]=E3(JOe),hct=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=pd();return r.jsx(dct,{scope:n,id:a,children:r.jsx(Fn.div,{role:"group","aria-labelledby":a,...s,ref:t})})});hct.displayName=JOe;var e8e="SelectLabel",t8e=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=uct(e8e,n);return r.jsx(Fn.div,{id:a.id,...s,ref:t})});t8e.displayName=e8e;var $te="SelectItem",[mct,r8e]=E3($te),n8e=A.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:o,...l}=e,i=Sv($te,n),u=Cv($te,n),m=i.value===s,[x,y]=A.useState(o??""),[v,b]=A.useState(!1),N=ca(t,T=>{var P;return(P=u.itemRefCallback)==null?void 0:P.call(u,T,s,a)}),k=pd(),M=A.useRef("touch"),I=()=>{a||(i.onValueChange(s),i.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(mct,{scope:n,value:s,disabled:a,textId:k,isSelected:m,onItemTextChange:A.useCallback(T=>{y(P=>P||((T==null?void 0:T.textContent)??"").trim())},[]),children:r.jsx(Rse.ItemSlot,{scope:n,value:s,disabled:a,textValue:x,children:r.jsx(Fn.div,{role:"option","aria-labelledby":k,"data-highlighted":v?"":void 0,"aria-selected":m&&v,"data-state":m?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:N,onFocus:gn(l.onFocus,()=>b(!0)),onBlur:gn(l.onBlur,()=>b(!1)),onClick:gn(l.onClick,()=>{M.current!=="mouse"&&I()}),onPointerUp:gn(l.onPointerUp,()=>{M.current==="mouse"&&I()}),onPointerDown:gn(l.onPointerDown,T=>{M.current=T.pointerType}),onPointerMove:gn(l.onPointerMove,T=>{var P;M.current=T.pointerType,a?(P=u.onItemLeave)==null||P.call(u):M.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:gn(l.onPointerLeave,T=>{var P;T.currentTarget===document.activeElement&&((P=u.onItemLeave)==null||P.call(u))}),onKeyDown:gn(l.onKeyDown,T=>{var F;((F=u.searchRef)==null?void 0:F.current)!==""&&T.key===" "||(Qlt.includes(T.key)&&I(),T.key===" "&&T.preventDefault())})})})})});n8e.displayName=$te;var LT="SelectItemText",s8e=A.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,...o}=e,l=Sv(LT,n),i=Cv(LT,n),u=r8e(LT,n),m=rct(LT,n),[x,y]=A.useState(null),v=ca(t,I=>y(I),u.onItemTextChange,I=>{var T;return(T=i.itemTextRefCallback)==null?void 0:T.call(i,I,u.value,u.disabled)}),b=x==null?void 0:x.textContent,N=A.useMemo(()=>r.jsx("option",{value:u.value,disabled:u.disabled,children:b},u.value),[u.disabled,u.value,b]),{onNativeOptionAdd:k,onNativeOptionRemove:M}=m;return oc(()=>(k(N),()=>M(N)),[k,M,N]),r.jsxs(r.Fragment,{children:[r.jsx(Fn.span,{id:u.textId,...o,ref:v}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Th.createPortal(o.children,l.valueNode):null]})});s8e.displayName=LT;var a8e="SelectItemIndicator",i8e=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r8e(a8e,n).isSelected?r.jsx(Fn.span,{"aria-hidden":!0,...s,ref:t}):null});i8e.displayName=a8e;var lme="SelectScrollUpButton",o8e=A.forwardRef((e,t)=>{const n=Cv(lme,e.__scopeSelect),s=Qxe(lme,e.__scopeSelect),[a,o]=A.useState(!1),l=ca(t,s.onScrollButtonChange);return oc(()=>{if(n.viewport&&n.isPositioned){let i=function(){const m=u.scrollTop>0;o(m)};const u=n.viewport;return i(),u.addEventListener("scroll",i),()=>u.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(c8e,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop-u.offsetHeight)}}):null});o8e.displayName=lme;var cme="SelectScrollDownButton",l8e=A.forwardRef((e,t)=>{const n=Cv(cme,e.__scopeSelect),s=Qxe(cme,e.__scopeSelect),[a,o]=A.useState(!1),l=ca(t,s.onScrollButtonChange);return oc(()=>{if(n.viewport&&n.isPositioned){let i=function(){const m=u.scrollHeight-u.clientHeight,x=Math.ceil(u.scrollTop)u.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(c8e,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop+u.offsetHeight)}}):null});l8e.displayName=cme;var c8e=A.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=e,o=Cv("SelectScrollButton",n),l=A.useRef(null),i=Fse(n),u=A.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return A.useEffect(()=>()=>u(),[u]),oc(()=>{var x;const m=i().find(y=>y.ref.current===document.activeElement);(x=m==null?void 0:m.ref.current)==null||x.scrollIntoView({block:"nearest"})},[i]),r.jsx(Fn.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:gn(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:gn(a.onPointerMove,()=>{var m;(m=o.onItemLeave)==null||m.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:gn(a.onPointerLeave,()=>{u()})})}),fct="SelectSeparator",d8e=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Fn.div,{"aria-hidden":!0,...s,ref:t})});d8e.displayName=fct;var dme="SelectArrow",pct=A.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=zse(n),o=Sv(dme,n),l=Cv(dme,n);return o.open&&l.position==="popper"?r.jsx(XI,{...a,...s,ref:t}):null});pct.displayName=dme;var gct="SelectBubbleInput",u8e=A.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const a=A.useRef(null),o=ca(s,a),l=oP(t);return A.useEffect(()=>{const i=a.current;if(!i)return;const u=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&x){const y=new Event("change",{bubbles:!0});x.call(i,t),i.dispatchEvent(y)}},[l,t]),r.jsx(Fn.select,{...n,style:{...cIe,...n.style},ref:o,defaultValue:t})});u8e.displayName=gct;function h8e(e){return e===""||e===void 0}function m8e(e){const t=sc(e),n=A.useRef(""),s=A.useRef(0),a=A.useCallback(l=>{const i=n.current+l;t(i),function u(m){n.current=m,window.clearTimeout(s.current),m!==""&&(s.current=window.setTimeout(()=>u(""),1e3))}(i)},[t]),o=A.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return A.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,o]}function f8e(e,t,n){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=xct(e,Math.max(o,0));a.length===1&&(l=l.filter(m=>m!==n));const u=l.find(m=>m.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function xct(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var yct=$Oe,p8e=qOe,vct=HOe,_ct=WOe,bct=GOe,g8e=KOe,wct=QOe,x8e=t8e,y8e=n8e,jct=s8e,kct=i8e,v8e=o8e,_8e=l8e,b8e=d8e;const un=yct,mn=vct,ln=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(p8e,{ref:s,className:Ut("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(_ct,{asChild:!0,children:r.jsx(Rd,{className:"h-4 w-4 opacity-50"})})]}));ln.displayName=p8e.displayName;const w8e=A.forwardRef(({className:e,...t},n)=>r.jsx(v8e,{ref:n,className:Ut("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(ly,{className:"h-4 w-4"})}));w8e.displayName=v8e.displayName;const j8e=A.forwardRef(({className:e,...t},n)=>r.jsx(_8e,{ref:n,className:Ut("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Rd,{className:"h-4 w-4"})}));j8e.displayName=_8e.displayName;const cn=A.forwardRef(({className:e,children:t,position:n="popper",...s},a)=>r.jsx(bct,{children:r.jsxs(g8e,{ref:a,className:Ut("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(w8e,{}),r.jsx(wct,{className:Ut("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(j8e,{})]})}));cn.displayName=g8e.displayName;const Nct=A.forwardRef(({className:e,...t},n)=>r.jsx(x8e,{ref:n,className:Ut("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Nct.displayName=x8e.displayName;const $t=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(y8e,{ref:s,className:Ut("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(kct,{children:r.jsx(mi,{className:"h-4 w-4"})})}),r.jsx(jct,{children:t})]}));$t.displayName=y8e.displayName;const Sct=A.forwardRef(({className:e,...t},n)=>r.jsx(b8e,{ref:n,className:Ut("-mx-1 my-1 h-px bg-muted",e),...t}));Sct.displayName=b8e.displayName;const Cct=e=>Zt({queryKey:["public-listings",e],queryFn:async()=>{let t=Y.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, latitude, longitude, 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}}),k8e=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=Y.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, latitude, longitude, 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:a}=await n.single();if(a)throw a;return s},enabled:!!e}),N8e=()=>ar({mutationFn:async({listingId:e,agentId:t,firstName:n,lastName:s,email:a,phone:o,shareToken:l})=>{let i=null,u=null;if(l){const{data:v}=await Y.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",e).maybeSingle();v&&(i=v.id,u=v.sharing_agent_id)}const{data:m,error:x}=await Y.from("listing_leads").insert({listing_id:e,agent_id:u||t,first_name:n,last_name:s,email:a,phone:o,share_id:i,referred_by_agent_id:u}).select().single();if(x)throw x;const{error:y}=await Y.functions.invoke("process-listing-lead",{body:{leadId:m.id}});return y&&console.error("Error processing lead:",y),m}}),Mct=()=>ar({mutationFn:async e=>{const{error:t}=await Y.rpc("increment_listing_share_click",{p_share_token:e});if(t)throw t}}),Tct={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Zke={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Act={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function S8e(){const[e,t]=A.useState(""),[n,s]=A.useState(!1),[a,o]=A.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=Cct({city:e||void 0,status:a.status||void 0,propertyType:a.propertyType||void 0,minPrice:a.minPrice?Number(a.minPrice):void 0,maxPrice:a.maxPrice?Number(a.maxPrice):void 0}),u=y=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(y),m=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),t("")},x=e||a.status||a.propertyType||a.minPrice||a.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs($p,{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(co,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:Yxe,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(${Glt})`},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(ma,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(lt,{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(Q,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(ma,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(Q,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(NA,{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(un,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[r.jsx(ln,{className:"bg-white",children:r.jsx(mn,{placeholder:"Any status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"Any status"}),Object.entries(Zke).map(([y,v])=>r.jsx($t,{value:y,children:v},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(un,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[r.jsx(ln,{className:"bg-white",children:r.jsx(mn,{placeholder:"Any type"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"Any type"}),Object.entries(Act).map(([y,v])=>r.jsx($t,{value:y,children:v},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(lt,{type:"number",placeholder:"No min",value:a.minPrice,onChange:y=>o({...a,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(lt,{type:"number",placeholder:"No max",value:a.maxPrice,onChange:y=>o({...a,maxPrice:y.target.value}),className:"bg-white"})]})]}),x&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(Q,{variant:"ghost",size:"sm",onClick:m,className:"gap-1 text-gray-500",children:[r.jsx(ds,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),l&&l.length>0&&r.jsx("section",{className:"py-8 bg-white border-b border-gray-200",children:r.jsxs("div",{className:"max-w-7xl mx-auto px-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:"Explore on Map"}),r.jsx(Ylt,{listings:l,isLoading:i})]})}),r.jsx("section",{className:"py-8",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:i?r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((y,v)=>r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[r.jsx(Er,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Er,{className:"h-7 w-28"}),r.jsx(Er,{className:"h-4 w-full"}),r.jsx(Er,{className:"h-4 w-3/4"})]})]},v))}):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 k,M,I;const v=((k=y.photos)==null?void 0:k.find(T=>T.is_primary))||((M=y.photos)==null?void 0:M[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(co,{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:[v?r.jsx("img",{src:v.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(ya,{className:"h-12 w-12 text-gray-300"})}),r.jsx(At,{className:`absolute top-2 left-2 ${Tct[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:Zke[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(vi,{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:u(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}),((I=y.agent.brokerage)==null?void 0:I.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(ya,{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(Q,{variant:"outline",onClick:m,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:Xxe,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 He=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ut("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));He.displayName="Card";const Ht=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ut("flex flex-col space-y-1.5 p-6",e),...t}));Ht.displayName="CardHeader";const Gt=A.forwardRef(({className:e,...t},n)=>r.jsx("h3",{ref:n,className:Ut("text-2xl font-semibold leading-none tracking-tight",e),...t}));Gt.displayName="CardTitle";const jn=A.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));jn.displayName="CardDescription";const et=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ut("p-6 pt-0",e),...t}));et.displayName="CardContent";const OA=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ut("flex items-center p-6 pt-0",e),...t}));OA.displayName="CardFooter";var Ect="Label",C8e=A.forwardRef((e,t)=>r.jsx(Fn.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));C8e.displayName=Ect;var M8e=C8e;const Ict=x3("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ze=A.forwardRef(({className:e,...t},n)=>r.jsx(M8e,{ref:n,className:Ut(Ict(),e),...t}));ze.displayName=M8e.displayName;const Ute="/assets/levelup-logo-color-D3mY9gCJ.png";function Pct(){const e=wf(),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(S8e,{}):s.startsWith("public/")?null:r.jsx(Lct,{slug:s})}function Lct({slug:e}){return r.jsx(Rct,{slug:e})}const Oct={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Dct={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Yke={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Rct({slug:e}){var G,ee;const{data:t,isLoading:n}=k8e(e),s=N8e(),[a,o]=A.useState(""),[l,i]=A.useState(""),[u,m]=A.useState(""),[x,y]=A.useState(""),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,I]=A.useState(null),T=ae=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ae),P=async ae=>{if(ae.preventDefault(),!(!a.trim()||!u.trim()||!t)){b(!0);try{await s.mutateAsync({listingId:t.id,agentId:t.agent_id,firstName:a.trim(),lastName:l.trim(),email:u.trim(),phone:x.trim()}),k(!0),Ae.success("Thanks! The agent will be in touch soon.")}catch(oe){console.error("Lead submission error:",oe),Ae.error(`Failed to submit: ${oe.message||"Please try again"}`)}finally{b(!1)}}},F=(t==null?void 0:t.photos)||[],D=F.find(ae=>ae.is_primary)||F[0],U=()=>{M!==null&&I(M===0?F.length-1:M-1)},V=()=>{M!==null&&I(M===F.length-1?0:M+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(Er,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Er,{className:"h-10 w-48 mb-6"}),r.jsx(Er,{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(Er,{className:"h-12 w-48"}),r.jsx(Er,{className:"h-6 w-full"}),r.jsx(Er,{className:"h-6 w-3/4"})]}),r.jsx(Er,{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:Ute,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(ya,{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(Q,{asChild:!0,children:r.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const W=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($p,{children:[r.jsxs("title",{children:[W," | 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":""} ${Yke[t.property_type]} in ${t.city}, ${t.state}. ${((G=t.description)==null?void 0:G.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:W}),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"}),D&&r.jsx("meta",{property:"og:image",content:D.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:Ute,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(Wi,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),F.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:()=>I(0),children:r.jsx("img",{src:D==null?void 0:D.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:F.slice(1,5).map((ae,oe)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>I(oe+1),children:[r.jsx("img",{src:ae.photo_url,alt:`Photo ${oe+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),oe===3&&F.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",F.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(At,{className:`${Oct[t.status]} text-white border-0`,children:Dct[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(Do,{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($1,{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(B1,{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(Ug,{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(Cs,{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(At,{variant:"secondary",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),Yke[t.property_type]]}),t.lot_size&&r.jsxs(At,{variant:"secondary",children:["Lot: ",t.lot_size]}),t.has_hoa&&r.jsx(At,{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(Q,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:t.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[t.agent&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx(ic,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-semibold text-lg",children:t.agent.name}),((ee=t.agent.brokerage)==null?void 0:ee.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.agent.brokerage.name})]})]}),r.jsxs(He,{className:"border-primary",children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{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(ws,{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:P,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"firstName",children:"First Name *"}),r.jsx(lt,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:ae=>o(ae.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lastName",children:"Last Name"}),r.jsx(lt,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ae=>i(ae.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email *"}),r.jsx(lt,{id:"email",type:"email",placeholder:"you@example.com",value:u,onChange:ae=>m(ae.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(lt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ae=>y(ae.target.value)})]}),r.jsx(Q,{type:"submit",className:"w-full",disabled:v,children:v?"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(Rr,{open:M!==null,onOpenChange:()=>I(null),children:r.jsxs(Dr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx($r,{className:"sr-only",children:r.jsx(Br,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>I(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(ds,{className:"h-5 w-5"})}),M!==null&&F[M]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:F[M].photo_url,alt:`Photo ${M+1}`,className:"w-full max-h-[80vh] object-contain"}),F.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:U,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(kc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:V,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(Gi,{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:[M+1," / ",F.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 Bse({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 a={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 ${a.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 ${a.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 ${a.text}`,children:e.team_name})]})]})})}const T8e=e=>Zt({queryKey:["agent-card-public",e],queryFn:async()=>{if(!e)throw new Error("No slug provided");const{data:t,error:n}=await Y.from("agent_cards").select("*").eq("slug",e).eq("is_published",!0).single();if(n)throw n;const{data:s}=await Y.from("profiles").select("name, email, phone, brokerage_id").eq("id",t.user_id).single();let a=null;if(s!=null&&s.brokerage_id){const{data:l}=await Y.from("brokerages").select("name").eq("id",s.brokerage_id).single();a=(l==null?void 0:l.name)||null}let o=null;try{const{data:l}=await Y.from("profiles").select("avatar_url").eq("id",t.user_id).single();if(l!=null&&l.avatar_url)o=l.avatar_url;else{const{data:i}=await Y.storage.from("avatars").list(`${t.user_id}`);if(i&&i.length>0){const{data:u}=Y.storage.from("avatars").getPublicUrl(`${t.user_id}/${i[0].name}`);o=`${u.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||a,avatar_url:o}},enabled:!!e}),Fct=()=>Zt({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:e,error:t}=await Y.from("agent_cards").select("*").order("created_at",{ascending:!1});if(t)throw t;return e}}),zct=e=>Zt({queryKey:["agent-card",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Y.from("agent_cards").select("*").eq("user_id",e).maybeSingle();if(n)throw n;return t},enabled:!!e}),A8e=()=>{const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.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"]}),Ae.success("Agent card created")},onError:t=>Ae.error(t.message)})},E8e=()=>{const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("agent_cards").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),Ae.success("Agent card updated")},onError:t=>Ae.error(t.message)})},zi=async(e,t,n,s)=>{const a=new URLSearchParams(window.location.search);await Y.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:a.get("utm_source")||null,utm_medium:a.get("utm_medium")||null,utm_campaign:a.get("utm_campaign")||null,metadata:{}})},Bct=async(e,t)=>{const{error:n}=await Y.from("agent_card_leads").insert({card_id:e,...t});if(n)throw n},I8e=e=>Zt({queryKey:["agent-card-analytics",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Y.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:a}=await Y.from("agent_card_leads").select("*").eq("card_id",e).order("created_at",{ascending:!1});if(a)throw a;const o=(t==null?void 0:t.filter(u=>u.interaction_type==="card_view").length)||0,l=(t==null?void 0:t.filter(u=>u.interaction_type==="button_click").length)||0,i=(t==null?void 0:t.filter(u=>u.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:i,leads:s||[],interactions:t||[]}},enabled:!!e});function $se({open:e,onOpenChange:t,cardId:n,type:s,agentName:a}){const[o,l]=A.useState(""),[i,u]=A.useState(""),[m,x]=A.useState(""),[y,v]=A.useState(""),[b,N]=A.useState(""),[k,M]=A.useState(!1),I=async T=>{if(T.preventDefault(),!o.trim()){Ae.error("Please enter your name");return}M(!0);try{await Bct(n,{lead_type:s,name:o.trim(),email:i.trim()||void 0,phone:m.trim()||void 0,message:b.trim()||void 0,intent:y||void 0}),zi(n,"lead_submitted",s),Y.functions.invoke("card-lead-notify",{body:{cardId:n,leadType:s,name:o.trim(),email:i.trim()||void 0,phone:m.trim()||void 0,message:b.trim()||void 0,intent:y||void 0}}).catch(P=>console.error("Card lead notify failed:",P)),Ae.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(""),u(""),x(""),v(""),N("")}catch{Ae.error("Something went wrong. Please try again.")}finally{M(!1)}};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs($r,{children:[r.jsx(Br,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(Yn,{children:s==="booking"?`Let ${a} know you'd like to connect.`:s==="connect"?`Share your info and ${a} will reach out.`:`Know someone who could use ${a}'s help?`})]}),r.jsxs("form",{onSubmit:I,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-name",children:"Name *"}),r.jsx(lt,{id:"lead-name",value:o,onChange:T=>l(T.target.value),placeholder:"Your name",required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-phone",children:"Phone"}),r.jsx(lt,{id:"lead-phone",type:"tel",value:m,onChange:T=>x(T.target.value),placeholder:"(555) 123-4567"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-email",children:"Email"}),r.jsx(lt,{id:"lead-email",type:"email",value:i,onChange:T=>u(T.target.value),placeholder:"you@example.com"})]}),s==="booking"&&r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(un,{value:y,onValueChange:v,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select one"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"buy",children:"Buy a home"}),r.jsx($t,{value:"sell",children:"Sell my home"}),r.jsx($t,{value:"both",children:"Buy & Sell"}),r.jsx($t,{value:"other",children:"Something else"})]})]})]}),s!=="connect"&&r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lead-message",children:s==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(lt,{id:"lead-message",value:b,onChange:T=>N(T.target.value),placeholder:s==="referral"?"Their name, phone, situation...":"Anything you'd like us to know"})]}),r.jsx(Q,{type:"submit",className:"w-full rounded-2xl",disabled:k,children:k?"Sending...":"Submit"})]})]})})}const $ct=e=>Zt({queryKey:["card-blocks",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.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}),Uct=e=>Zt({queryKey:["card-blocks-all",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.from("card_blocks").select("*").eq("card_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t||[]},enabled:!!e}),qct=()=>{const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.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]}),Ae.success("Block added")},onError:t=>Ae.error(t.message)})},Vct=()=>{const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("card_blocks").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),Ae.success("Block updated")},onError:t=>Ae.error(t.message)})},Hct=()=>{const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("card_blocks").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),Ae.success("Block removed")},onError:t=>Ae.error(t.message)})};function Wct(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 Gct(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 Kct={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 Zct({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"),a=Gct(n.video_url),o=s||!!a,l=s?Wct(n.video_url):a||n.video_url;return r.jsx("div",{className:Kct[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 Yct={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 Xct({block:e,variant:t}){const s=e.config.testimonials||[],[a,o]=A.useState(0);if(s.length===0)return null;const l=Yct[t],i=s[a];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(vA,{className:"h-4 w-4 mb-2 opacity-30"}),r.jsxs("p",{className:`${l.quote} mb-3`,children:['"',i.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:l.name,children:i.name}),i.role&&r.jsx("p",{className:l.role,children:i.role})]})]}),s.length>1&&r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[r.jsx("button",{onClick:()=>o(u=>(u-1+s.length)%s.length),className:l.nav,children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:s.map((u,m)=>r.jsx("div",{className:`h-1.5 w-1.5 rounded-full transition-colors cursor-pointer ${m===a?l.dot:l.dotInactive}`,onClick:()=>o(m)},m))}),r.jsx("button",{onClick:()=>o(u=>(u+1)%s.length),className:l.nav,children:r.jsx(Gi,{className:"h-4 w-4"})})]})]})}const Qct={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 Jct({block:e,variant:t}){const s=e.config.tags||[];if(s.length===0)return null;const a=Qct[t];return r.jsx("div",{className:a.container,children:s.map((o,l)=>r.jsx("span",{className:a.tag,children:o},l))})}const edt={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 tdt({block:e,cardId:t,variant:n}){const a=e.config.links||[];if(a.length===0)return null;const o=edt[n];return r.jsx("div",{className:o.container,children:a.map((l,i)=>r.jsxs("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(t,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(Ss,{className:`h-4 w-4 ${o.icon}`})]},i))})}const ume={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"},spotify:{label:"Spotify",icon:"M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z",color:"#1DB954",hoverBg:"hover:bg-[#1DB954]/10"},apple_music:{label:"Apple Music",icon:"M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043A5.022 5.022 0 0019.7.198a10.7 10.7 0 00-1.564-.15C17.637.017 17.14 0 12.002 0h-.004C6.858 0 6.362.017 5.862.047 5.34.08 4.82.13 4.309.325a5.017 5.017 0 00-1.874.826C1.317 2.07.573 3.07.255 4.38A9.234 9.234 0 00.02 6.57C-.013 7.068-.03 7.564 0 12.002v.004c-.03 4.438.013 4.934.047 5.432.033.522.083 1.042.278 1.554a5.017 5.017 0 00.826 1.874c.92 1.118 1.92 1.862 3.23 2.18a9.23 9.23 0 002.19.24c.498.03.994.013 5.432.047h.004c4.438.034 4.934-.013 5.432-.047a9.23 9.23 0 002.19-.24c1.31-.317 2.31-1.062 3.043-2.18a5.022 5.022 0 00.627-1.874c.195-.492.245-1.012.278-1.534.03-.498.047-.994.047-5.432v-.004c.034-4.438-.013-4.934-.047-5.432zM17.42 16.41c0 .612-.15 1.21-.44 1.758a3.58 3.58 0 01-1.207 1.31c-.518.339-1.09.521-1.705.545-.13.005-.26 0-.39-.017a2.617 2.617 0 01-1.653-.772 2.305 2.305 0 01-.668-1.653c-.005-.13 0-.26.017-.39.07-.52.275-.986.602-1.39a2.998 2.998 0 011.218-.94 3.14 3.14 0 011.12-.282c.17-.009.336.002.502.034V9.472L10.2 10.637v7.093c0 .612-.15 1.21-.44 1.758a3.58 3.58 0 01-1.207 1.31c-.518.339-1.09.521-1.705.545-.13.005-.26 0-.39-.017a2.617 2.617 0 01-1.653-.772A2.305 2.305 0 014.137 18.9c-.005-.13 0-.26.017-.39.07-.52.275-.986.602-1.39a2.998 2.998 0 011.218-.94 3.14 3.14 0 011.12-.282c.17-.009.336.002.502.034V8.377c0-.453.066-.903.195-1.34a3.2 3.2 0 01.694-1.204 2.62 2.62 0 011.063-.738c.39-.14.793-.208 1.196-.196l4.84-1.01v10.52z",color:"#FA243C",hoverBg:"hover:bg-[#FA243C]/10"}};function rdt({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 ndt={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 sdt({block:e,cardId:t,variant:n}){const a=e.config.platforms||[],o=ndt[n];return a.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:a.map((l,i)=>{const u=ume[l.platform.toLowerCase()];return!u||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(t,"button_click",`social_${l.platform}`),className:o.linkClass,title:u.label,children:r.jsx(rdt,{path:u.icon,color:u.color})},i)})})]})}function Use({cardId:e,variant:t}){const{data:n}=$ct(e);if(!n||n.length===0)return null;const s=n.filter(l=>l.block_type==="social_media"&&l.is_visible),a=n.filter(l=>l.block_type!=="social_media"),o=s.length>0?{...s[0],config:{platforms:s.flatMap(l=>l.config.platforms||[])}}:null;return n.findIndex(l=>l.block_type==="social_media"),r.jsxs(r.Fragment,{children:[a.map(l=>{switch(l.block_type){case"video_intro":return r.jsx(Zct,{block:l,variant:t},l.id);case"testimonials":return r.jsx(Xct,{block:l,variant:t},l.id);case"specialties":return r.jsx(Jct,{block:l,variant:t},l.id);case"custom_links":return r.jsx(tdt,{block:l,cardId:e,variant:t},l.id);default:return null}}),o&&r.jsx(sdt,{block:o,cardId:e,variant:t})]})}async function adt(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(a=>{const o=new FileReader;o.onloadend=()=>{const i=o.result.split(",")[1];a({base64:i,mimeType:s})},o.onerror=()=>a(null),o.readAsDataURL(n)})}catch{return null}}function idt(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 qse(e){const{first:t,last:n}=idt(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 i=await adt(e.avatarUrl);if(i){const m={"image/jpeg":"JPEG","image/jpg":"JPEG","image/png":"PNG","image/gif":"GIF","image/webp":"JPEG"}[i.mimeType]||"JPEG";s.push(`PHOTO;ENCODING=b;TYPE=${m}:${i.base64}`)}}s.push("END:VCARD");const a=new Blob([s.join(`\r `)],{type:"text/vcard"}),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=`${e.name.replace(/\s+/g,"_")}.vcf`,l.click(),URL.revokeObjectURL(o),Ae.success("Contact saved!")}function odt({card:e}){var I;const[t,n]=A.useState(!1),[s,a]=A.useState("booking"),o=((I=e.profile)==null?void 0:I.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{zi(e.id,"button_click",T),P()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Ae.error("Phone number not available")}),m=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Ae.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Ae.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},v=()=>{var T,P;zi(e.id,"contact_saved"),qse({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(P=e.profile)==null?void 0:P.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},b=async()=>{if(zi(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),Ae.success("Link copied!")},N=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},k=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},M={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(ea,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ci,{src:e.avatar_url||void 0,alt:o}),r.jsx(ta,{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(Q,{onClick:u,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(Ai,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),r.jsxs(Q,{onClick:m,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(Ro,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),r.jsxs(Q,{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(ws,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),r.jsxs(Q,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[r.jsx(Cs,{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(ks,{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(Bse,{card:e,variant:"standard"}),r.jsx(Use,{cardId:e.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[e.show_save_contact&&r.jsxs(Q,{variant:"ghost",onClick:v,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(so,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs(Q,{variant:"ghost",onClick:()=>{zi(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(ks,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),e.show_refer_friend&&r.jsxs(Q,{variant:"ghost",onClick:N,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx($n,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),r.jsxs(Q,{variant:"ghost",onClick:k,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(th,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),r.jsxs(Q,{variant:"ghost",onClick:b,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Nc,{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,P)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(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:M[T.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-slate-400",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function ldt({card:e}){var I;const[t,n]=A.useState(!1),[s,a]=A.useState("booking"),o=((I=e.profile)==null?void 0:I.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{zi(e.id,"button_click",T),P()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Ae.error("Phone number not available")}),m=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Ae.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Ae.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},v=()=>{var T,P;zi(e.id,"contact_saved"),qse({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(P=e.profile)==null?void 0:P.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},b=async()=>{if(zi(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),Ae.success("Link copied!")},N=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},k=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},M={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(ea,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(Ci,{src:e.avatar_url||void 0,alt:o}),r.jsx(ta,{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:Ai,label:"Call",handler:u},{icon:Ro,label:"Text",handler:m},{icon:ws,label:"Email",handler:x}].map(({icon:T,label:P,handler:F})=>r.jsxs("button",{onClick:F,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:P})]},P))}),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(Cs,{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(ks,{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(Bse,{card:e,variant:"luxury"}),r.jsx(Use,{cardId:e.id,variant:"luxury"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:v,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(so,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{zi(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(ks,{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($n,{className:"h-4 w-4 text-[#c9a84c]"})," Refer a Friend"]}),r.jsxs("button",{onClick:k,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(th,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),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(Nc,{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,P)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(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:M[T.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function cdt({card:e}){var P,F,D,U;const[t,n]=A.useState(!1),[s,a]=A.useState("booking"),o=((P=e.profile)==null?void 0:P.name)||"Agent",l=o.split(" ").map(V=>V[0]).join("").toUpperCase().slice(0,2),i={accent:((F=e.bold_theme_colors)==null?void 0:F.accent)||"#ff5722",dark:((D=e.bold_theme_colors)==null?void 0:D.dark)||"#1a1a2e",button:((U=e.bold_theme_colors)==null?void 0:U.button)||"#ff5722"},u=(V,W)=>{const G=parseInt(V.replace("#",""),16),ee=Math.max(0,(G>>16)-W),ae=Math.max(0,(G>>8&255)-W),oe=Math.max(0,(G&255)-W);return`#${(ee<<16|ae<<8|oe).toString(16).padStart(6,"0")}`};u(i.accent,25),u(i.dark,-20),u(i.button,25);const m=(V,W)=>{zi(e.id,"button_click",V),W()},x=()=>m("call",()=>{var V;(V=e.profile)!=null&&V.phone?window.location.href=`tel:${e.profile.phone}`:Ae.error("Phone number not available")}),y=()=>m("text",()=>{var V;(V=e.profile)!=null&&V.phone?window.location.href=`sms:${e.profile.phone}`:Ae.error("Phone number not available")}),v=()=>m("email",()=>{var V;(V=e.profile)!=null&&V.email?window.location.href=`mailto:${e.profile.email}`:Ae.error("Email not available")}),b=()=>{e.booking_url?m("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},N=()=>{var V,W;zi(e.id,"contact_saved"),qse({name:o,phone:(V=e.profile)==null?void 0:V.phone,email:(W=e.profile)==null?void 0:W.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},k=async()=>{if(zi(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),Ae.success("Link copied!")},M=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},I=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},T={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen",style:{backgroundColor:i.accent},children:[r.jsxs("div",{className:"px-5 pt-10 pb-14 text-center relative",style:{backgroundColor:i.dark},children:[e.show_photo&&r.jsxs(ea,{className:"h-28 w-28 mx-auto mb-4 shadow-2xl",style:{boxShadow:`0 0 0 4px ${i.accent}`},children:[r.jsx(Ci,{src:e.avatar_url||void 0,alt:o}),r.jsx(ta,{className:"text-2xl font-black text-white",style:{backgroundColor:i.accent},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 mb-1",style:{color:`${i.accent}cc`},children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-bold uppercase tracking-wider mb-1",style:{color:i.accent},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 font-bold text-lg leading-snug mb-6 max-w-xs mx-auto",style:{color:i.dark},children:e.positioning_statement}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:Ai,label:"Call",handler:x},{icon:Ro,label:"Text",handler:y},{icon:ws,label:"Email",handler:v}].map(({icon:V,label:W,handler:G})=>r.jsxs("button",{onClick:G,className:"flex flex-col items-center gap-1.5 py-4 text-white rounded-2xl transition-opacity font-bold hover:opacity-85",style:{backgroundColor:i.dark},children:[r.jsx(V,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs",children:W})]},W))}),r.jsxs("button",{onClick:b,className:"w-full h-14 text-base font-black rounded-2xl mb-6 text-white transition-opacity hover:opacity-90 flex items-center justify-center gap-2 uppercase tracking-wide",style:{backgroundColor:i.button},children:[r.jsx(Cs,{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(ks,{className:"h-5 w-5",style:{color:i.accent,fill:i.accent}}),r.jsx("span",{className:"font-black text-2xl",style:{color:i.dark},children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"rounded-2xl p-4 mb-6",style:{backgroundColor:`${i.accent}15`},children:r.jsxs("p",{className:"text-sm font-medium text-center",style:{color:i.dark},children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-xs font-black mb-2 uppercase tracking-wider",style:{color:i.accent},children:"About Me"}),r.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:e.bio})]}),r.jsx(Bse,{card:e,variant:"bold"}),r.jsx(Use,{cardId:e.id,variant:"bold"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(so,{className:"h-4 w-4",style:{color:i.accent}})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{zi(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 hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(ks,{className:"h-4 w-4",style:{color:i.accent}})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:M,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx($n,{className:"h-4 w-4",style:{color:i.accent}})," Refer a Friend"]}),r.jsxs("button",{onClick:I,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(th,{className:"h-4 w-4",style:{color:i.accent}})," Connect with Me"]}),r.jsxs("button",{onClick:k,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(Nc,{className:"h-4 w-4",style:{color:i.accent}})," 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((V,W)=>r.jsx("a",{href:V.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(e.id,"button_click",`social_${V.platform}`),className:"h-10 w-10 rounded-full flex items-center justify-center text-lg transition-opacity hover:opacity-85",style:{backgroundColor:i.dark},children:T[V.platform.toLowerCase()]||"🔗"},W))})]}),r.jsx("div",{className:"text-center py-6",children:r.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function ddt({card:e}){var I;const[t,n]=A.useState(!1),[s,a]=A.useState("booking"),o=((I=e.profile)==null?void 0:I.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,P)=>{zi(e.id,"button_click",T),P()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Ae.error("Phone number not available")}),m=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Ae.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Ae.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},v=()=>{var T,P;zi(e.id,"contact_saved"),qse({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(P=e.profile)==null?void 0:P.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},b=async()=>{if(zi(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),Ae.success("Link copied!")},N=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},k=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},M={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(ea,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ci,{src:e.avatar_url||void 0,alt:o}),r.jsx(ta,{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:Ai,label:"Call",handler:u},{icon:Ro,label:"Text",handler:m},{icon:ws,label:"Email",handler:x}].map(({icon:T,label:P,handler:F})=>r.jsxs("button",{onClick:F,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:P})]},P))}),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(Cs,{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(ks,{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(Bse,{card:e,variant:"classic"}),r.jsx(Use,{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:v,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(so,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{zi(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(ks,{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($n,{className:"h-4 w-4 text-[#5a7a6f]"})," Refer a Friend"]}),r.jsxs("button",{onClick:k,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(th,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),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(Nc,{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,P)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(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:M[T.platform.toLowerCase()]||"🔗"},P))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Jxe({card:e}){switch(e.theme){case"luxury":return r.jsx(ldt,{card:e});case"bold":return r.jsx(cdt,{card:e});case"classic":return r.jsx(ddt,{card:e});case"standard":default:return r.jsx(odt,{card:e})}}function udt(){const e=wf();A.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(hdt,{slug:t})}function hdt({slug:e}){return r.jsx(mdt,{slug:e})}function mdt({slug:e}){var o;const{data:t,isLoading:n,error:s}=T8e(e);if(A.useEffect(()=>{t!=null&&t.id&&zi(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(Er,{className:"h-28 w-28 rounded-full"}),r.jsx(Er,{className:"h-6 w-48"}),r.jsx(Er,{className:"h-4 w-36"})]}),r.jsx(Er,{className:"h-12 w-full"}),r.jsx(Er,{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 a=((o=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs($p,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:t.positioning_statement||`Connect with ${a}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(Jxe,{card:t})]})}function P8e({presentationId:e,ctaLabel:t,agentName:n,prefillName:s,prefillEmail:a,prefillPhone:o}){const[l,i]=A.useState(s||""),[u,m]=A.useState(a||""),[x,y]=A.useState(o||""),[v,b]=A.useState(""),[N,k]=A.useState(""),[M,I]=A.useState(!1),[T,P]=A.useState(!1),F=async D=>{if(D.preventDefault(),!l.trim()){Ae.error("Please enter your name");return}I(!0);try{const{error:U}=await Y.from("smart_presentation_leads").insert({presentation_id:e,name:l.trim(),email:u.trim()||null,phone:x.trim()||null,intent:v||null,message:N.trim()||null});if(U)throw U;try{await Y.rpc("log_presentation_view",{p_presentation_id:e,p_section_index:null,p_cta_clicked:!0,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:null})}catch{}Y.functions.invoke("presentation-lead-notify",{body:{presentationId:e,name:l.trim(),email:u.trim()||void 0,phone:x.trim()||void 0,intent:v||void 0,message:N.trim()||void 0}}).catch(V=>console.error("Presentation lead notify failed:",V)),P(!0)}catch{Ae.error("Something went wrong. Please try again.")}finally{I(!1)}};return T?r.jsxs("div",{className:"text-center py-8",children:[r.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-100 flex items-center justify-center mx-auto mb-4",children:r.jsx(mi,{className:"h-8 w-8 text-emerald-600"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Thank you!"}),r.jsx("p",{className:"text-gray-500",children:n?`${n} will be in touch soon.`:"We'll be in touch soon."})]}):r.jsxs("form",{onSubmit:F,className:"space-y-4 max-w-md mx-auto",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"pres-lead-name",children:"Name *"}),r.jsx(lt,{id:"pres-lead-name",value:l,onChange:D=>i(D.target.value),placeholder:"Your name",required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"pres-lead-phone",children:"Phone"}),r.jsx(lt,{id:"pres-lead-phone",type:"tel",value:x,onChange:D=>y(D.target.value),placeholder:"(555) 123-4567"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"pres-lead-email",children:"Email"}),r.jsx(lt,{id:"pres-lead-email",type:"email",value:u,onChange:D=>m(D.target.value),placeholder:"you@example.com"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"pres-lead-intent",children:"I'm looking to..."}),r.jsxs(un,{value:v,onValueChange:b,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select one"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"buy",children:"Buy a home"}),r.jsx($t,{value:"sell",children:"Sell my home"}),r.jsx($t,{value:"both",children:"Buy & Sell"}),r.jsx($t,{value:"other",children:"Something else"})]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"pres-lead-message",children:"Message (optional)"}),r.jsx(lt,{id:"pres-lead-message",value:N,onChange:D=>k(D.target.value),placeholder:"Anything you'd like us to know"})]}),r.jsx(Q,{type:"submit",className:"w-full text-lg py-6 rounded-xl bg-blue-600 hover:bg-blue-700 text-white shadow-lg",disabled:M,children:M?"Sending...":t})]})}function fdt(){const e=wf();A.useEffect(()=>(document.body.classList.add("presentation-page"),()=>{document.body.classList.remove("presentation-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:"Smart Presentations"}),r.jsx("p",{className:"text-slate-500",children:"Visit a specific presentation URL to view it."})]})}):r.jsx(pdt,{shareToken:t})}function pdt({shareToken:e}){var N;const[t,n]=A.useState(null),[s,a]=A.useState(!0),[o,l]=A.useState(0),[i,u]=A.useState(!1);A.useEffect(()=>{m()},[e]);const m=async()=>{const{data:k,error:M}=await Y.from("smart_presentations").select("*").eq("share_token",e).eq("status","published").single();if(M||!k){u(!0),a(!1);return}const{data:I}=await Y.from("profiles").select("name, email, phone, avatar_url, title, brokerage_id").eq("id",k.owner_user_id).single();let T;if(I!=null&&I.brokerage_id){const{data:F}=await Y.from("brokerages").select("name").eq("id",I.brokerage_id).single();T=(F==null?void 0:F.name)||void 0}let P=null;if(k.contact_id){const{data:F}=await Y.from("innercircle_contacts").select("first_name, last_name, email, phone").eq("id",k.contact_id).single();P=F}n({...k,owner_name:I==null?void 0:I.name,owner_email:I==null?void 0:I.email,owner_phone:I==null?void 0:I.phone,owner_avatar:I==null?void 0:I.avatar_url,owner_title:(I==null?void 0:I.title)||void 0,brokerage_name:T,contact_name:P?[P.first_name,P.last_name].filter(Boolean).join(" "):void 0,contact_email:(P==null?void 0:P.email)||void 0,contact_phone:(P==null?void 0:P.phone)||void 0}),a(!1);try{await Y.rpc("log_presentation_view",{p_presentation_id:k.id,p_section_index:0,p_cta_clicked:!1,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch{}},x=async()=>{if(t){try{await Y.rpc("log_presentation_view",{p_presentation_id:t.id,p_section_index:null,p_cta_clicked:!0,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:null})}catch{}t.cta_url&&window.open(t.cta_url,"_blank")}},y=k=>{const M=k.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);if(M)return`https://www.youtube.com/embed/${M[1]}?rel=0`;if(k.includes("iframe.mediadelivery.net/play/")){const P=k.replace("/play/","/embed/"),F=P.includes("?")?"&":"?";return`${P}${F}responsive=true`}if(k.includes("iframe.mediadelivery.net")){const P=k.includes("?")?"&":"?";return`${k}${P}responsive=true`}const I=k.match(/loom\.com\/share\/([a-zA-Z0-9]+)/);if(I)return`https://www.loom.com/embed/${I[1]}`;const T=k.match(/video\.bunnycdn\.com\/play\/(\d+)\/([a-f0-9-]+)/);return T?`https://iframe.mediadelivery.net/embed/${T[1]}/${T[2]}?responsive=true`:k};if(s)return r.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:r.jsxs("div",{className:"space-y-4 w-full max-w-2xl px-4",children:[r.jsx(Er,{className:"h-12 w-3/4 mx-auto"}),r.jsx(Er,{className:"h-64 w-full"}),r.jsx(Er,{className:"h-8 w-1/2 mx-auto"})]})});if(i||!t)return r.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Presentation Not Found"}),r.jsx("p",{className:"text-gray-500",children:"This presentation may have been removed or is no longer available."})]})});const v=t.sections.filter(k=>k.is_visible!==!1),b=v[o];return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[r.jsx("header",{className:"bg-white border-b border-gray-100 sticky top-0 z-10",children:r.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("img",{src:Yxe,alt:"LevelUp",className:"h-7"}),r.jsxs("div",{className:"flex items-center gap-3",children:[t.owner_avatar&&r.jsx("img",{src:t.owner_avatar,alt:t.owner_name||"Agent",className:"h-10 w-10 rounded-full object-cover border border-gray-200"}),r.jsxs("div",{className:"text-right text-sm",children:[r.jsx("p",{className:"font-semibold text-gray-900",children:t.owner_name}),t.owner_title&&r.jsx("p",{className:"text-gray-500 text-xs",children:t.owner_title}),t.brokerage_name&&!t.owner_title&&r.jsx("p",{className:"text-gray-500 text-xs",children:t.brokerage_name})]})]})]})}),r.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsxs("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:["Welcome, ",t.client_name||"there","!"]}),t.property_address&&r.jsxs("p",{className:"text-lg text-gray-600",children:["Here's the plan for your home at ",r.jsx("strong",{children:t.property_address}),"."]})]}),r.jsxs("div",{className:"grid md:grid-cols-5 gap-8",children:[r.jsxs("div",{className:"md:col-span-3",children:[b!=null&&b.video_url?r.jsx("div",{className:"relative w-full rounded-xl overflow-hidden shadow-lg bg-gray-900",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:y(b.video_url),className:"absolute inset-0 w-full h-full border-0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,loading:"lazy"})}):b!=null&&b.image_url?r.jsx("div",{className:"rounded-xl overflow-hidden shadow-lg",children:r.jsx("img",{src:b.image_url,alt:b.title,className:"w-full h-auto object-cover",loading:"lazy"})}):r.jsxs("div",{className:"aspect-video bg-gradient-to-br from-blue-50 to-slate-100 rounded-xl flex flex-col items-center justify-center shadow-lg",children:[r.jsx("span",{className:"text-5xl mb-3",children:b==null?void 0:b.icon}),r.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:b==null?void 0:b.title}),r.jsx("p",{className:"text-gray-500 mt-1 text-sm",children:b==null?void 0:b.description})]}),(b==null?void 0:b.text)&&r.jsx("div",{className:"mt-4 p-4 bg-white rounded-lg border text-gray-700 text-sm leading-relaxed",children:b.text})]}),r.jsx("div",{className:"md:col-span-2 space-y-3",children:v.map((k,M)=>r.jsx("button",{onClick:()=>l(M),className:Ut("w-full text-left p-4 rounded-xl border transition-all",o===M?"border-blue-500 bg-blue-50 shadow-sm":"border-gray-200 bg-white hover:border-blue-200 hover:bg-blue-50/50"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("span",{className:"text-blue-600 font-bold text-sm mt-0.5",children:[String(M+1).padStart(2,"0"),"."]}),r.jsxs("div",{children:[r.jsx("span",{className:"mr-2",children:k.icon}),r.jsx("span",{className:"font-semibold text-gray-900",children:k.title}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:k.description})]})]})},M))})]}),r.jsxs("div",{className:"mt-12 max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6 text-center",children:[t.owner_avatar&&r.jsx("img",{src:t.owner_avatar,alt:t.owner_name||"Agent",className:"h-20 w-20 rounded-full object-cover mx-auto mb-3 border-2 border-gray-100"}),r.jsx("h3",{className:"text-lg font-bold text-gray-900",children:t.owner_name}),t.owner_title&&r.jsx("p",{className:"text-sm text-gray-500",children:t.owner_title}),t.brokerage_name&&r.jsx("p",{className:"text-sm text-gray-500",children:t.brokerage_name}),r.jsxs("div",{className:"mt-3 flex flex-col items-center gap-1 text-sm text-gray-600",children:[t.owner_phone&&r.jsx("a",{href:`tel:${t.owner_phone}`,className:"hover:text-blue-600 transition-colors",children:t.owner_phone}),t.owner_email&&r.jsx("a",{href:`mailto:${t.owner_email}`,className:"hover:text-blue-600 transition-colors",children:t.owner_email})]})]}),t.cta_label&&r.jsxs("div",{className:"text-center mt-8 py-8",children:[r.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Ready to Get Started?"}),(N=t.cta_url)!=null&&N.trim()?r.jsxs(Q,{size:"lg",onClick:x,className:"text-lg px-8 py-6 rounded-xl bg-blue-600 hover:bg-blue-700 text-white shadow-lg",children:[t.cta_label,r.jsx(Ss,{className:"h-5 w-5 ml-2"})]}):r.jsx("div",{className:"max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6",children:r.jsx(P8e,{presentationId:t.id,ctaLabel:t.cta_label,agentName:t.owner_name||void 0,prefillName:t.contact_name,prefillEmail:t.contact_email,prefillPhone:t.contact_phone})})]})]}),r.jsx("footer",{className:"border-t border-gray-100 bg-white mt-12 py-6 text-center text-xs text-gray-400",children:"Powered by LevelUp"})]})}const hme="levelup_affiliate_ref",gdt=30,xdt=()=>{const[e]=Zc();A.useEffect(()=>{const t=e.get("ref");if(t){const n={code:t.toUpperCase(),timestamp:Date.now()};localStorage.setItem(hme,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",t)}},[e])},ydt=()=>{try{const e=localStorage.getItem(hme);if(!e)return null;const t=JSON.parse(e),n=gdt*24*60*60*1e3;return Date.now()-t.timestamp>n?(localStorage.removeItem(hme),console.log("[Affiliate] Referral code expired"),null):t.code}catch{return null}},qte="/assets/levelup-logo-header-_ZX7DvlA.png",vdt="/assets/scale-your-team-ku4MPatU.png";function _dt({open:e,onOpenChange:t}){return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx($r,{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(hi,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Br,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(Yn,{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"]}},bdt=[{icon:rf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Vc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Cs,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Ul,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:_a,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:ao,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],wdt=[{icon:$n,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Os,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ai,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:mm,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Do,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:_c,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:vi,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Vg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],jdt=[{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."}],kdt=()=>{const{user:e,loading:t}=tn(),n=Vn(),[s]=Zc();A.useEffect(()=>{const V=window.location.host==="listings.relevelup.com",W=window.location.pathname==="/";if(V&&W){n("/public/listings",{replace:!0});return}},[n]);const[a,o]=A.useState(null),[l,i]=A.useState(null),[u,m]=A.useState(!1),[x,y]=A.useState(""),[v,b]=A.useState(""),[N,k]=A.useState(""),[M,I]=A.useState(!1),[T,P]=A.useState(!1),F=(V,W=!1)=>{i({tier:V,skipTrial:W}),m(!0)};xdt(),A.useEffect(()=>{const V=window.location.host==="listings.relevelup.com",W=location.pathname.startsWith("/public/");!t&&e&&!V&&!W&&n("/dashboard")},[e,t,n,location.pathname]),A.useEffect(()=>{s.get("canceled")==="true"&&Ae.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const D=async(V,W=!1)=>{if(!x){Ae.error("Please enter your email address");return}if(!v.trim()){Ae.error("Please enter your full name");return}I(!0),o(V+(W?"_direct":""));const G=ydt();try{const{data:ee,error:ae}=await Y.functions.invoke("create-checkout",{body:{tier:V,email:x,name:v.trim(),couponCode:N.trim()||void 0,skipTrial:W,referralCode:G}});if(ae)throw ae;if(ee!=null&&ee.url)window.open(ee.url,"_blank","noopener,noreferrer"),Ae.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(ee){console.error("Checkout error:",ee),Ae.error(ee.message||"Failed to start checkout. Please try again.")}finally{I(!1),o(null),m(!1),i(null)}},U=()=>{l&&D(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:qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(Q,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("features"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(Q,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(Q,{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(Q,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("free-trial"))==null?void 0:V.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(No,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(Q,{size:"lg",variant:"outline",onClick:()=>{var V;return(V=document.getElementById("features"))==null?void 0:V.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(Q,{size:"lg",variant:"outline",onClick:()=>{var V;return(V=document.getElementById("brokerage"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(hi,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(Q,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(ic,{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:bdt.map((V,W)=>r.jsxs(He,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Ht,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(V.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Gt,{className:"text-xl font-sans",children:V.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:V.description})})]},W))})]})}),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(Os,{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:wdt.map((V,W)=>r.jsxs(He,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Ht,{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(V.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Gt,{className:"text-lg font-semibold text-white",children:V.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:V.description})})]},W))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(Q,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.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(No,{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(hi,{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((V,W)=>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(mi,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:V})]},W))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(Q,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Gi,{className:"ml-2 w-5 h-5"})]}),r.jsxs(Q,{size:"lg",variant:"outline",onClick:()=>P(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(Cs,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:vdt,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:jdt.map((V,W)=>r.jsx(He,{className:"bg-muted/30 border-0",children:r.jsxs(et,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(G=>r.jsx(ks,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},G))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',V.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:V.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:V.role})]})]})},W))})]})}),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(Q,{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:()=>F("individual_agent"),children:["Start Free Trial",r.jsx(No,{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(He,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Ht,{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(ic,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Gt,{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(jn,{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(Xa,{className:"w-4 h-4"}),Sd.individual_agent.trial]})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Sd.individual_agent.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(mi,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsxs(OA,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(Q,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>F("individual_agent"),children:"Start Free Trial"}),r.jsx(Q,{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:()=>F("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),r.jsxs(He,{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(Ht,{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(hi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Gt,{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(jn,{className:"text-base mt-2",children:Sd.brokerage_under_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Sd.brokerage_under_25.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(mi,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsx(OA,{className:"pt-4",children:r.jsx(Q,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>F("brokerage_under_25"),children:"Get Started"})})]}),r.jsxs(He,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Ht,{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(hi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Gt,{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(jn,{className:"text-base mt-2",children:Sd.brokerage_over_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Sd.brokerage_over_25.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(mi,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsx(OA,{className:"pt-4",children:r.jsx(Q,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>F("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(Q,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.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(No,{className:"ml-2 w-5 h-5"})]}),r.jsx(Q,{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:qte,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(_dt,{open:T,onOpenChange:P}),r.jsx(Rr,{open:u,onOpenChange:m,children:r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsx(Br,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(Yn,{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(ze,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(lt,{id:"dialog-name",type:"text",placeholder:"John Smith",value:v,onChange:V=>b(V.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(ze,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(lt,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:V=>y(V.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(ze,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(lt,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:N,onChange:V=>k(V.target.value),className:"mt-1"})]})]}),r.jsx(Q,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:U,disabled:M,children:M?"Loading...":"Continue to Checkout"})]})})]})},Ndt=()=>r.jsxs(r.Fragment,{children:[r.jsxs($p,{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"})]})]})]})]})})]}),Sdt=()=>r.jsxs(r.Fragment,{children:[r.jsxs($p,{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"})]})]})]})]})})]}),Cdt=()=>r.jsxs(r.Fragment,{children:[r.jsxs($p,{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 fo;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const o={};for(const l of a)o[l]=l;return o},e.getValidEnumValues=a=>{const o=e.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),l={};for(const i of o)l[i]=a[i];return e.objectValues(l)},e.objectValues=a=>e.objectKeys(a).map(function(o){return a[o]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},e.find=(a,o)=>{for(const l of a)if(o(l))return l},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,o=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}e.joinValues=s,e.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(fo||(fo={}));var Xke;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Xke||(Xke={}));const Ls=fo.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 Ls.undefined;case"string":return Ls.string;case"number":return Number.isNaN(e)?Ls.nan:Ls.number;case"boolean":return Ls.boolean;case"function":return Ls.function;case"bigint":return Ls.bigint;case"symbol":return Ls.symbol;case"object":return Array.isArray(e)?Ls.array:e===null?Ls.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ls.promise:typeof Map<"u"&&e instanceof Map?Ls.map:typeof Set<"u"&&e instanceof Set?Ls.set:typeof Date<"u"&&e instanceof Date?Ls.date:Ls.object;default:return Ls.unknown}},Dn=fo.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 Qg 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:[]},a=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)s._errors.push(n(l));else{let i=s,u=0;for(;un.message){const n={},s=[];for(const a of this.issues)if(a.path.length>0){const o=a.path[0];n[o]=n[o]||[],n[o].push(t(a))}else s.push(t(a));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}Qg.create=e=>new Qg(e);const mme=(e,t)=>{let n;switch(e.code){case Dn.invalid_type:e.received===Ls.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Dn.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,fo.jsonStringifyReplacer)}`;break;case Dn.unrecognized_keys:n=`Unrecognized key(s) in object: ${fo.joinValues(e.keys,", ")}`;break;case Dn.invalid_union:n="Invalid input";break;case Dn.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${fo.joinValues(e.options)}`;break;case Dn.invalid_enum_value:n=`Invalid enum value. Expected ${fo.joinValues(e.options)}, received '${e.received}'`;break;case Dn.invalid_arguments:n="Invalid function arguments";break;case Dn.invalid_return_type:n="Invalid function return type";break;case Dn.invalid_date:n="Invalid date";break;case Dn.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}"`:fo.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Dn.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 Dn.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 Dn.custom:n="Invalid input";break;case Dn.invalid_intersection_types:n="Intersection results could not be merged";break;case Dn.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Dn.not_finite:n="Number must be finite";break;default:n=t.defaultError,fo.assertNever(e)}return{message:n}};let Mdt=mme;function Tdt(){return Mdt}const Adt=e=>{const{data:t,path:n,errorMaps:s,issueData:a}=e,o=[...n,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const u=s.filter(m=>!!m).slice().reverse();for(const m of u)i=m(l,{data:t,defaultError:i}).message;return{...a,path:o,message:i}};function vs(e,t){const n=Tdt(),s=Adt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===mme?void 0:mme].filter(a=>!!a)});e.common.issues.push(s)}class km{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 a of n){if(a.status==="aborted")return ri;a.status==="dirty"&&t.dirty(),s.push(a.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){const s=[];for(const a of n){const o=await a.key,l=await a.value;s.push({key:o,value:l})}return km.mergeObjectSync(t,s)}static mergeObjectSync(t,n){const s={};for(const a of n){const{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return ri;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(s[o.value]=l.value)}return{status:t.value,value:s}}}const ri=Object.freeze({status:"aborted"}),OT=e=>({status:"dirty",value:e}),jf=e=>({status:"valid",value:e}),Qke=e=>e.status==="aborted",Jke=e=>e.status==="dirty",AC=e=>e.status==="valid",Vte=e=>typeof Promise<"u"&&e instanceof Promise;var Zs;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Zs||(Zs={}));class fv{constructor(t,n,s,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=s,this._key=a}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 eNe=(e,t)=>{if(AC(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 Qg(e.common.issues);return this._error=n,this._error}}};function Mi(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:a}=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:a}:{errorMap:(l,i)=>{const{message:u}=e;return l.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:u??n??i.defaultError}},description:a}}class uo{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 km,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(Vte(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)},a=this._parseSync({data:t,path:s.path,parent:s});return eNe(s,a)}"~validate"(t){var s,a;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 AC(o)?{value:o.value}:{issues:n.common.issues}}catch(o){(a=(s=o==null?void 0:o.message)==null?void 0:s.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(o=>AC(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)},a=this._parse({data:t,path:s.path,parent:s}),o=await(Vte(a)?a:Promise.resolve(a));return eNe(s,o)}refine(t,n){const s=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{const l=t(a),i=()=>o.addIssue({code:Dn.custom,...s(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(u=>u?!0:(i(),!1)):l?!0:(i(),!1)})}refinement(t,n){return this._refinement((s,a)=>t(s)?!0:(a.addIssue(typeof n=="function"?n(s,a):n),!1))}_refinement(t){return new PC({schema:this,typeName:ni.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 tv.create(this,this._def)}nullable(){return LC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kg.create(this)}promise(){return Kte.create(this,this._def)}or(t){return Wte.create([this,t],this._def)}and(t){return Gte.create(this,t,this._def)}transform(t){return new PC({...Mi(this._def),schema:this,typeName:ni.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new xme({...Mi(this._def),innerType:this,defaultValue:n,typeName:ni.ZodDefault})}brand(){return new Jdt({typeName:ni.ZodBranded,type:this,...Mi(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new yme({...Mi(this._def),innerType:this,catchValue:n,typeName:ni.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return eye.create(this,t)}readonly(){return vme.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Edt=/^c[^\s-]{8,}$/i,Idt=/^[0-9a-z]+$/,Pdt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ldt=/^[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,Odt=/^[a-z0-9_-]{21}$/i,Ddt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Rdt=/^[-+]?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)?)??$/,Fdt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zdt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bce;const Bdt=/^(?:(?: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])$/,$dt=/^(?:(?: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])$/,Udt=/^(([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]))$/,qdt=/^(([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])$/,Vdt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hdt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L8e="((\\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])))",Wdt=new RegExp(`^${L8e}$`);function O8e(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 Gdt(e){return new RegExp(`^${O8e(e)}$`)}function Kdt(e){let t=`${L8e}T${O8e(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 Zdt(e,t){return!!((t==="v4"||!t)&&Bdt.test(e)||(t==="v6"||!t)&&Udt.test(e))}function Ydt(e,t){if(!Ddt.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,"="),a=JSON.parse(atob(s));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&a.alg!==t)}catch{return!1}}function Xdt(e,t){return!!((t==="v4"||!t)&&$dt.test(e)||(t==="v6"||!t)&&qdt.test(e))}class C1 extends uo{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ls.string){const o=this._getOrReturnCtx(t);return vs(o,{code:Dn.invalid_type,expected:Ls.string,received:o.parsedType}),ri}const s=new km;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(a=this._getOrReturnCtx(t,a),vs(a,{code:Dn.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,i=t.data.lengtht.test(a),{validation:n,code:Dn.invalid_string,...Zs.errToObj(s)})}_addCheck(t){return new C1({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Zs.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Zs.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Zs.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Zs.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Zs.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Zs.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Zs.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Zs.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Zs.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Zs.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Zs.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Zs.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Zs.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,...Zs.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,...Zs.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Zs.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Zs.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Zs.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Zs.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Zs.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Zs.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Zs.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Zs.errToObj(n)})}nonempty(t){return this.min(1,Zs.errToObj(t))}trim(){return new C1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C1({...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 C1({checks:[],typeName:ni.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Mi(e)});function Qdt(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,a=n>s?n:s,o=Number.parseInt(e.toFixed(a).replace(".","")),l=Number.parseInt(t.toFixed(a).replace(".",""));return o%l/10**a}class EC extends uo{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)!==Ls.number){const o=this._getOrReturnCtx(t);return vs(o,{code:Dn.invalid_type,expected:Ls.number,received:o.parsedType}),ri}let s;const a=new km;for(const o of this._def.checks)o.kind==="int"?fo.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),vs(s,{code:Dn.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),vs(s,{code:Dn.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Qdt(t.data,o.value)!==0&&(s=this._getOrReturnCtx(t,s),vs(s,{code:Dn.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),vs(s,{code:Dn.not_finite,message:o.message}),a.dirty()):fo.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Zs.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Zs.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Zs.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Zs.toString(n))}setLimit(t,n,s,a){return new EC({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Zs.toString(a)}]})}_addCheck(t){return new EC({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Zs.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Zs.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Zs.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Zs.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Zs.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Zs.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Zs.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Zs.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Zs.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"&&fo.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 EC({checks:[],typeName:ni.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Mi(e)});class OE extends uo{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)!==Ls.bigint)return this._getInvalidInput(t);let s;const a=new km;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),vs(s,{code:Dn.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),vs(s,{code:Dn.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):fo.assertNever(o);return{status:a.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return vs(n,{code:Dn.invalid_type,expected:Ls.bigint,received:n.parsedType}),ri}gte(t,n){return this.setLimit("min",t,!0,Zs.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Zs.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Zs.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Zs.toString(n))}setLimit(t,n,s,a){return new OE({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Zs.toString(a)}]})}_addCheck(t){return new OE({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Zs.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Zs.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Zs.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Zs.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Zs.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 OE({checks:[],typeName:ni.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Mi(e)});class fme extends uo{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ls.boolean){const s=this._getOrReturnCtx(t);return vs(s,{code:Dn.invalid_type,expected:Ls.boolean,received:s.parsedType}),ri}return jf(t.data)}}fme.create=e=>new fme({typeName:ni.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Mi(e)});class Hte extends uo{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ls.date){const o=this._getOrReturnCtx(t);return vs(o,{code:Dn.invalid_type,expected:Ls.date,received:o.parsedType}),ri}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return vs(o,{code:Dn.invalid_date}),ri}const s=new km;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(a=this._getOrReturnCtx(t,a),vs(a,{code:Dn.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):fo.assertNever(o);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hte({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Zs.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Zs.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 Hte({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ni.ZodDate,...Mi(e)});class tNe extends uo{_parse(t){if(this._getType(t)!==Ls.symbol){const s=this._getOrReturnCtx(t);return vs(s,{code:Dn.invalid_type,expected:Ls.symbol,received:s.parsedType}),ri}return jf(t.data)}}tNe.create=e=>new tNe({typeName:ni.ZodSymbol,...Mi(e)});class rNe extends uo{_parse(t){if(this._getType(t)!==Ls.undefined){const s=this._getOrReturnCtx(t);return vs(s,{code:Dn.invalid_type,expected:Ls.undefined,received:s.parsedType}),ri}return jf(t.data)}}rNe.create=e=>new rNe({typeName:ni.ZodUndefined,...Mi(e)});class nNe extends uo{_parse(t){if(this._getType(t)!==Ls.null){const s=this._getOrReturnCtx(t);return vs(s,{code:Dn.invalid_type,expected:Ls.null,received:s.parsedType}),ri}return jf(t.data)}}nNe.create=e=>new nNe({typeName:ni.ZodNull,...Mi(e)});class sNe extends uo{constructor(){super(...arguments),this._any=!0}_parse(t){return jf(t.data)}}sNe.create=e=>new sNe({typeName:ni.ZodAny,...Mi(e)});class aNe extends uo{constructor(){super(...arguments),this._unknown=!0}_parse(t){return jf(t.data)}}aNe.create=e=>new aNe({typeName:ni.ZodUnknown,...Mi(e)});class pv extends uo{_parse(t){const n=this._getOrReturnCtx(t);return vs(n,{code:Dn.invalid_type,expected:Ls.never,received:n.parsedType}),ri}}pv.create=e=>new pv({typeName:ni.ZodNever,...Mi(e)});class iNe extends uo{_parse(t){if(this._getType(t)!==Ls.undefined){const s=this._getOrReturnCtx(t);return vs(s,{code:Dn.invalid_type,expected:Ls.void,received:s.parsedType}),ri}return jf(t.data)}}iNe.create=e=>new iNe({typeName:ni.ZodVoid,...Mi(e)});class Kg extends uo{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),a=this._def;if(n.parsedType!==Ls.array)return vs(n,{code:Dn.invalid_type,expected:Ls.array,received:n.parsedType}),ri;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,i=n.data.lengtha.maxLength.value&&(vs(n,{code:Dn.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((l,i)=>a.type._parseAsync(new fv(n,l,n.path,i)))).then(l=>km.mergeArray(s,l));const o=[...n.data].map((l,i)=>a.type._parseSync(new fv(n,l,n.path,i)));return km.mergeArray(s,o)}get element(){return this._def.type}min(t,n){return new Kg({...this._def,minLength:{value:t,message:Zs.toString(n)}})}max(t,n){return new Kg({...this._def,maxLength:{value:t,message:Zs.toString(n)}})}length(t,n){return new Kg({...this._def,exactLength:{value:t,message:Zs.toString(n)}})}nonempty(t){return this.min(1,t)}}Kg.create=(e,t)=>new Kg({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ni.ZodArray,...Mi(t)});function BS(e){if(e instanceof Bc){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=tv.create(BS(s))}return new Bc({...e._def,shape:()=>t})}else return e instanceof Kg?new Kg({...e._def,type:BS(e.element)}):e instanceof tv?tv.create(BS(e.unwrap())):e instanceof LC?LC.create(BS(e.unwrap())):e instanceof dk?dk.create(e.items.map(t=>BS(t))):e}class Bc extends uo{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=fo.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ls.object){const m=this._getOrReturnCtx(t);return vs(m,{code:Dn.invalid_type,expected:Ls.object,received:m.parsedType}),ri}const{status:s,ctx:a}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof pv&&this._def.unknownKeys==="strip"))for(const m in a.data)l.includes(m)||i.push(m);const u=[];for(const m of l){const x=o[m],y=a.data[m];u.push({key:{status:"valid",value:m},value:x._parse(new fv(a,y,a.path,m)),alwaysSet:m in a.data})}if(this._def.catchall instanceof pv){const m=this._def.unknownKeys;if(m==="passthrough")for(const x of i)u.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(m==="strict")i.length>0&&(vs(a,{code:Dn.unrecognized_keys,keys:i}),s.dirty());else if(m!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const m=this._def.catchall;for(const x of i){const y=a.data[x];u.push({key:{status:"valid",value:x},value:m._parse(new fv(a,y,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const m=[];for(const x of u){const y=await x.key,v=await x.value;m.push({key:y,value:v,alwaysSet:x.alwaysSet})}return m}).then(m=>km.mergeObjectSync(s,m)):km.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(t){return Zs.errToObj,new Bc({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,s)=>{var o,l;const a=((l=(o=this._def).errorMap)==null?void 0:l.call(o,n,s).message)??s.defaultError;return n.code==="unrecognized_keys"?{message:Zs.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new Bc({...this._def,unknownKeys:"strip"})}passthrough(){return new Bc({...this._def,unknownKeys:"passthrough"})}extend(t){return new Bc({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Bc({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ni.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Bc({...this._def,catchall:t})}pick(t){const n={};for(const s of fo.objectKeys(t))t[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new Bc({...this._def,shape:()=>n})}omit(t){const n={};for(const s of fo.objectKeys(this.shape))t[s]||(n[s]=this.shape[s]);return new Bc({...this._def,shape:()=>n})}deepPartial(){return BS(this)}partial(t){const n={};for(const s of fo.objectKeys(this.shape)){const a=this.shape[s];t&&!t[s]?n[s]=a:n[s]=a.optional()}return new Bc({...this._def,shape:()=>n})}required(t){const n={};for(const s of fo.objectKeys(this.shape))if(t&&!t[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof tv;)o=o._def.innerType;n[s]=o}return new Bc({...this._def,shape:()=>n})}keyof(){return D8e(fo.objectKeys(this.shape))}}Bc.create=(e,t)=>new Bc({shape:()=>e,unknownKeys:"strip",catchall:pv.create(),typeName:ni.ZodObject,...Mi(t)});Bc.strictCreate=(e,t)=>new Bc({shape:()=>e,unknownKeys:"strict",catchall:pv.create(),typeName:ni.ZodObject,...Mi(t)});Bc.lazycreate=(e,t)=>new Bc({shape:e,unknownKeys:"strip",catchall:pv.create(),typeName:ni.ZodObject,...Mi(t)});class Wte extends uo{_parse(t){const{ctx:n}=this._processInputParams(t),s=this._def.options;function a(o){for(const i of o)if(i.result.status==="valid")return i.result;for(const i of o)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(i=>new Qg(i.ctx.common.issues));return vs(n,{code:Dn.invalid_union,unionErrors:l}),ri}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(a);{let o;const l=[];for(const u of s){const m={...n,common:{...n.common,issues:[]},parent:null},x=u._parseSync({data:n.data,path:n.path,parent:m});if(x.status==="valid")return x;x.status==="dirty"&&!o&&(o={result:x,ctx:m}),m.common.issues.length&&l.push(m.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const i=l.map(u=>new Qg(u));return vs(n,{code:Dn.invalid_union,unionErrors:i}),ri}}get options(){return this._def.options}}Wte.create=(e,t)=>new Wte({options:e,typeName:ni.ZodUnion,...Mi(t)});function pme(e,t){const n=X0(e),s=X0(t);if(e===t)return{valid:!0,data:e};if(n===Ls.object&&s===Ls.object){const a=fo.objectKeys(t),o=fo.objectKeys(e).filter(i=>a.indexOf(i)!==-1),l={...e,...t};for(const i of o){const u=pme(e[i],t[i]);if(!u.valid)return{valid:!1};l[i]=u.data}return{valid:!0,data:l}}else if(n===Ls.array&&s===Ls.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o{if(Qke(o)||Qke(l))return ri;const i=pme(o.value,l.value);return i.valid?((Jke(o)||Jke(l))&&n.dirty(),{status:n.value,value:i.data}):(vs(s,{code:Dn.invalid_intersection_types}),ri)};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])=>a(o,l)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Gte.create=(e,t,n)=>new Gte({left:e,right:t,typeName:ni.ZodIntersection,...Mi(n)});class dk extends uo{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ls.array)return vs(s,{code:Dn.invalid_type,expected:Ls.array,received:s.parsedType}),ri;if(s.data.lengththis._def.items.length&&(vs(s,{code:Dn.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((l,i)=>{const u=this._def.items[i]||this._def.rest;return u?u._parse(new fv(s,l,s.path,i)):null}).filter(l=>!!l);return s.common.async?Promise.all(o).then(l=>km.mergeArray(n,l)):km.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new dk({...this._def,rest:t})}}dk.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new dk({items:e,typeName:ni.ZodTuple,rest:null,...Mi(t)})};class oNe extends uo{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!==Ls.map)return vs(s,{code:Dn.invalid_type,expected:Ls.map,received:s.parsedType}),ri;const a=this._def.keyType,o=this._def.valueType,l=[...s.data.entries()].map(([i,u],m)=>({key:a._parse(new fv(s,i,s.path,[m,"key"])),value:o._parse(new fv(s,u,s.path,[m,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const u of l){const m=await u.key,x=await u.value;if(m.status==="aborted"||x.status==="aborted")return ri;(m.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(m.value,x.value)}return{status:n.value,value:i}})}else{const i=new Map;for(const u of l){const m=u.key,x=u.value;if(m.status==="aborted"||x.status==="aborted")return ri;(m.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(m.value,x.value)}return{status:n.value,value:i}}}}oNe.create=(e,t,n)=>new oNe({valueType:t,keyType:e,typeName:ni.ZodMap,...Mi(n)});class DE extends uo{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ls.set)return vs(s,{code:Dn.invalid_type,expected:Ls.set,received:s.parsedType}),ri;const a=this._def;a.minSize!==null&&s.data.sizea.maxSize.value&&(vs(s,{code:Dn.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const o=this._def.valueType;function l(u){const m=new Set;for(const x of u){if(x.status==="aborted")return ri;x.status==="dirty"&&n.dirty(),m.add(x.value)}return{status:n.value,value:m}}const i=[...s.data.values()].map((u,m)=>o._parse(new fv(s,u,s.path,m)));return s.common.async?Promise.all(i).then(u=>l(u)):l(i)}min(t,n){return new DE({...this._def,minSize:{value:t,message:Zs.toString(n)}})}max(t,n){return new DE({...this._def,maxSize:{value:t,message:Zs.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}DE.create=(e,t)=>new DE({valueType:e,minSize:null,maxSize:null,typeName:ni.ZodSet,...Mi(t)});class lNe extends uo{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})}}lNe.create=(e,t)=>new lNe({getter:e,typeName:ni.ZodLazy,...Mi(t)});class gme extends uo{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return vs(n,{received:n.data,code:Dn.invalid_literal,expected:this._def.value}),ri}return{status:"valid",value:t.data}}get value(){return this._def.value}}gme.create=(e,t)=>new gme({value:e,typeName:ni.ZodLiteral,...Mi(t)});function D8e(e,t){return new IC({values:e,typeName:ni.ZodEnum,...Mi(t)})}class IC extends uo{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return vs(n,{expected:fo.joinValues(s),received:n.parsedType,code:Dn.invalid_type}),ri}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 vs(n,{received:n.data,code:Dn.invalid_enum_value,options:s}),ri}return jf(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 IC.create(t,{...this._def,...n})}exclude(t,n=this._def){return IC.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}IC.create=D8e;class cNe extends uo{_parse(t){const n=fo.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Ls.string&&s.parsedType!==Ls.number){const a=fo.objectValues(n);return vs(s,{expected:fo.joinValues(a),received:s.parsedType,code:Dn.invalid_type}),ri}if(this._cache||(this._cache=new Set(fo.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=fo.objectValues(n);return vs(s,{received:s.data,code:Dn.invalid_enum_value,options:a}),ri}return jf(t.data)}get enum(){return this._def.values}}cNe.create=(e,t)=>new cNe({values:e,typeName:ni.ZodNativeEnum,...Mi(t)});class Kte extends uo{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ls.promise&&n.common.async===!1)return vs(n,{code:Dn.invalid_type,expected:Ls.promise,received:n.parsedType}),ri;const s=n.parsedType===Ls.promise?n.data:Promise.resolve(n.data);return jf(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Kte.create=(e,t)=>new Kte({type:e,typeName:ni.ZodPromise,...Mi(t)});class PC extends uo{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ni.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:l=>{vs(s,l),l.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const l=a.transform(s.data,o);if(s.common.async)return Promise.resolve(l).then(async i=>{if(n.value==="aborted")return ri;const u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?ri:u.status==="dirty"||n.value==="dirty"?OT(u.value):u});{if(n.value==="aborted")return ri;const i=this._def.schema._parseSync({data:l,path:s.path,parent:s});return i.status==="aborted"?ri:i.status==="dirty"||n.value==="dirty"?OT(i.value):i}}if(a.type==="refinement"){const l=i=>{const u=a.refinement(i,o);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?ri:(i.status==="dirty"&&n.dirty(),l(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?ri:(i.status==="dirty"&&n.dirty(),l(i.value).then(()=>({status:n.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){const l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!AC(l))return ri;const i=a.transform(l.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>AC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:n.value,value:i})):ri);fo.assertNever(a)}}PC.create=(e,t,n)=>new PC({schema:e,typeName:ni.ZodEffects,effect:t,...Mi(n)});PC.createWithPreprocess=(e,t,n)=>new PC({schema:t,effect:{type:"preprocess",transform:e},typeName:ni.ZodEffects,...Mi(n)});class tv extends uo{_parse(t){return this._getType(t)===Ls.undefined?jf(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}tv.create=(e,t)=>new tv({innerType:e,typeName:ni.ZodOptional,...Mi(t)});class LC extends uo{_parse(t){return this._getType(t)===Ls.null?jf(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}LC.create=(e,t)=>new LC({innerType:e,typeName:ni.ZodNullable,...Mi(t)});class xme extends uo{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===Ls.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}xme.create=(e,t)=>new xme({innerType:e,typeName:ni.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Mi(t)});class yme extends uo{_parse(t){const{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Vte(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Qg(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Qg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}yme.create=(e,t)=>new yme({innerType:e,typeName:ni.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Mi(t)});class dNe extends uo{_parse(t){if(this._getType(t)!==Ls.nan){const s=this._getOrReturnCtx(t);return vs(s,{code:Dn.invalid_type,expected:Ls.nan,received:s.parsedType}),ri}return{status:"valid",value:t.data}}}dNe.create=e=>new dNe({typeName:ni.ZodNaN,...Mi(e)});class Jdt extends uo{_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 eye extends uo{_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"?ri:o.status==="dirty"?(n.dirty(),OT(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?ri:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(t,n){return new eye({in:t,out:n,typeName:ni.ZodPipeline})}}class vme extends uo{_parse(t){const n=this._def.innerType._parse(t),s=a=>(AC(a)&&(a.value=Object.freeze(a.value)),a);return Vte(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}}vme.create=(e,t)=>new vme({innerType:e,typeName:ni.ZodReadonly,...Mi(t)});var ni;(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"})(ni||(ni={}));const xc=C1.create,DA=EC.create,eut=fme.create;pv.create;Kg.create;const I3=Bc.create;Wte.create;Gte.create;dk.create;const uNe=gme.create,R8e=IC.create;Kte.create;tv.create;LC.create;const tut=I3({email:xc().email("Invalid email address"),password:xc().min(6,"Password must be at least 6 characters")}),rut=()=>{const{signIn:e,user:t}=tn(),n=Vn(),[s,a]=A.useState(!1),[o,l]=A.useState({}),[i,u]=A.useState(""),[m,x]=A.useState(!1),[y,v]=A.useState(!1);A.useEffect(()=>{t&&n("/dashboard")},[t,n]);const b=async k=>{k.preventDefault(),l({}),a(!0);const M=new FormData(k.currentTarget),I=M.get("email"),T=M.get("password");try{tut.parse({email:I,password:T}),await e(I,T)}catch(P){if(P instanceof Qg){const F={};P.errors.forEach(D=>{D.path[0]&&(F[D.path[0]]=D.message)}),l(F)}}finally{a(!1)}},N=async()=>{if(!i){Ae.error("Please enter your email address");return}x(!0);try{const{error:k}=await Y.functions.invoke("send-password-reset",{body:{email:i,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(k)throw k;Ae.success("Password reset email sent! Check your inbox."),v(!1),u("")}catch(k){Ae.error(k.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(co,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(Wi,{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:Yxe,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(He,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Ht,{className:"space-y-1 text-center pb-4",children:[r.jsx(Gt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(jn,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(et,{children:r.jsxs("form",{onSubmit:b,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(lt,{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(ze,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(lt,{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(Q,{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(Rr,{open:y,onOpenChange:v,children:[r.jsx(Fo,{asChild:!0,children:r.jsx(Q,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Dr,{className:"bg-white",children:[r.jsxs($r,{children:[r.jsx(Br,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(Yn,{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(ze,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(lt,{id:"reset-email",type:"email",placeholder:"your@email.com",value:i,onChange:k=>u(k.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(Q,{onClick:N,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:m,children:m?"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(co,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},nut=()=>{const[e]=Zc(),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(He,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{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(oi,{className:"w-10 h-10 text-green-500"})}),r.jsx(Gt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(jn,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(et,{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(ws,{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."})})]})]})})},F8e=e=>{const[t,n]=A.useState(null),[s,a]=A.useState(!0);return A.useEffect(()=>{if(!e){a(!1);return}(async()=>{try{const{data:i}=await Y.storage.from("avatars").list(`${e}`);if(i&&i.length>0){const{data:u}=Y.storage.from("avatars").getPublicUrl(`${e}/${i[0].name}`);n(`${u.publicUrl}?t=${Date.now()}`)}else n(null)}catch(i){console.error("Error fetching avatar:",i),n(null)}finally{a(!1)}})()},[e]),{avatarUrl:t,loading:s,refreshAvatar:async()=>{if(e)try{const{data:l}=await Y.storage.from("avatars").list(`${e}`);if(l&&l.length>0){const{data:i}=Y.storage.from("avatars").getPublicUrl(`${e}/${l[0].name}`);n(`${i.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},z8e=async e=>{const t=new Map;return await Promise.all(e.map(async n=>{try{const{data:s}=await Y.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:a}=Y.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);t.set(n,a.publicUrl)}}catch{}})),t},sut=e=>{const[t,n]=A.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return A.useEffect(()=>{if(!e){n(a=>({...a,loading:!1}));return}(async()=>{try{const{data:a,error:o}=await Y.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(u=>({...u,loading:!1}));return}const l=(a==null?void 0:a.subscription_status)==="trialing"&&(a==null?void 0:a.subscription_end_date),i=(a==null?void 0:a.is_trial)&&(a==null?void 0:a.trial_expires_at);if(l){const u=new Date().getTime(),m=new Date(a.subscription_end_date).getTime(),x=Math.ceil((m-u)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.subscription_end_date,daysLeft:y?0:x,loading:!1})}else if(i){const u=new Date().getTime(),m=new Date(a.trial_expires_at).getTime(),x=Math.ceil((m-u)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.trial_expires_at,daysLeft:y?0:x,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(a){console.error("Error in useTrialStatus:",a),n(o=>({...o,loading:!1}))}})()},[e]),t},B8e=()=>{const{data:e,isLoading:t}=Zt({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:a}=await Y.from("feature_flags").select("*");if(a)throw a;return s}}),n=s=>{if(!e)return!1;const a=e.find(o=>o.key===s);return(a==null?void 0:a.enabled)??!1};return{flags:e,isLoading:t,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},hNe="community_last_seen_post_at";function aut(){const{user:e}=tn(),t=wf(),[n,s]=A.useState(0),[a,o]=A.useState(null);A.useEffect(()=>{if(!e)return;const i=localStorage.getItem(`${hNe}_${e.id}`);o(i)},[e]),A.useEffect(()=>{if(!e)return;(async()=>{let u=Y.from("community_posts").select("id",{count:"exact",head:!0});a&&(u=u.gt("created_at",a));const{data:m}=await Y.from("profiles").select("brokerage_id").eq("id",e.id).single(),{count:x,error:y}=await u;!y&&x!==null&&s(x)})()},[e,a]),A.useEffect(()=>{if(!e)return;const i=Y.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async u=>{const m=u.new;if(m.user_id===e.id)return;const x=t.pathname==="/community";x||s(N=>N+1);const{data:y}=await Y.from("profiles").select("name").eq("id",m.user_id).single(),v=(y==null?void 0:y.name)||"Someone",b=m.content.length>50?m.content.substring(0,50)+"...":m.content;x||Ae("New Community Post",{description:`${v}: ${b}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{Y.removeChannel(i)}},[e,t.pathname]);const l=A.useCallback(()=>{if(!e)return;const i=new Date().toISOString();localStorage.setItem(`${hNe}_${e.id}`,i),o(i),s(0)},[e]);return A.useEffect(()=>{t.pathname==="/community"&&n>0&&l()},[t.pathname,n,l]),{unreadCount:n,markAsRead:l}}function iut(){const{isAdmin:e}=tn(),{data:t=0}=Zt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await Y.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 Vse=Lse,tye=Zxe,out=Ose,$8e=A.forwardRef(({className:e,...t},n)=>r.jsx(T3,{className:Ut("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}));$8e.displayName=T3.displayName;const lut=x3("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"}}),lP=A.forwardRef(({side:e="right",className:t,children:n,...s},a)=>r.jsxs(out,{children:[r.jsx($8e,{}),r.jsxs(A3,{ref:a,className:Ut(lut({side:e}),t),...s,children:[n,r.jsxs(Dse,{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(ds,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));lP.displayName=A3.displayName;const Hse=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col space-y-2 text-center sm:text-left",e),...t});Hse.displayName="SheetHeader";const Wse=A.forwardRef(({className:e,...t},n)=>r.jsx(aP,{ref:n,className:Ut("text-lg font-semibold text-foreground",e),...t}));Wse.displayName=aP.displayName;const cut=A.forwardRef(({className:e,...t},n)=>r.jsx(iP,{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));cut.displayName=iP.displayName;function dut(e,t){return A.useReducer((n,s)=>t[n][s]??n,e)}var rye="ScrollArea",[U8e]=cc(rye),[uut,kf]=U8e(rye),q8e=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:s="hover",dir:a,scrollHideDelay:o=600,...l}=e,[i,u]=A.useState(null),[m,x]=A.useState(null),[y,v]=A.useState(null),[b,N]=A.useState(null),[k,M]=A.useState(null),[I,T]=A.useState(0),[P,F]=A.useState(0),[D,U]=A.useState(!1),[V,W]=A.useState(!1),G=ca(t,ae=>u(ae)),ee=Mk(a);return r.jsx(uut,{scope:n,type:s,dir:ee,scrollHideDelay:o,scrollArea:i,viewport:m,onViewportChange:x,content:y,onContentChange:v,scrollbarX:b,onScrollbarXChange:N,scrollbarXEnabled:D,onScrollbarXEnabledChange:U,scrollbarY:k,onScrollbarYChange:M,scrollbarYEnabled:V,onScrollbarYEnabledChange:W,onCornerWidthChange:T,onCornerHeightChange:F,children:r.jsx(Fn.div,{dir:ee,...l,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":I+"px","--radix-scroll-area-corner-height":P+"px",...e.style}})})});q8e.displayName=rye;var V8e="ScrollAreaViewport",H8e=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:a,...o}=e,l=kf(V8e,n),i=A.useRef(null),u=ca(t,i,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:a}),r.jsx(Fn.div,{"data-radix-scroll-area-viewport":"",...o,ref:u,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})})]})});H8e.displayName=V8e;var ox="ScrollAreaScrollbar",nye=A.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=kf(ox,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,i=e.orientation==="horizontal";return A.useEffect(()=>(i?o(!0):l(!0),()=>{i?o(!1):l(!1)}),[i,o,l]),a.type==="hover"?r.jsx(hut,{...s,ref:t,forceMount:n}):a.type==="scroll"?r.jsx(mut,{...s,ref:t,forceMount:n}):a.type==="auto"?r.jsx(W8e,{...s,ref:t,forceMount:n}):a.type==="always"?r.jsx(sye,{...s,ref:t}):null});nye.displayName=ox;var hut=A.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=kf(ox,e.__scopeScrollArea),[o,l]=A.useState(!1);return A.useEffect(()=>{const i=a.scrollArea;let u=0;if(i){const m=()=>{window.clearTimeout(u),l(!0)},x=()=>{u=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",m),i.addEventListener("pointerleave",x),()=>{window.clearTimeout(u),i.removeEventListener("pointerenter",m),i.removeEventListener("pointerleave",x)}}},[a.scrollArea,a.scrollHideDelay]),r.jsx(Ac,{present:n||o,children:r.jsx(W8e,{"data-state":o?"visible":"hidden",...s,ref:t})})}),mut=A.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=kf(ox,e.__scopeScrollArea),o=e.orientation==="horizontal",l=Kse(()=>u("SCROLL_END"),100),[i,u]=dut("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 A.useEffect(()=>{if(i==="idle"){const m=window.setTimeout(()=>u("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(m)}},[i,a.scrollHideDelay,u]),A.useEffect(()=>{const m=a.viewport,x=o?"scrollLeft":"scrollTop";if(m){let y=m[x];const v=()=>{const b=m[x];y!==b&&(u("SCROLL"),l()),y=b};return m.addEventListener("scroll",v),()=>m.removeEventListener("scroll",v)}},[a.viewport,o,u,l]),r.jsx(Ac,{present:n||i!=="hidden",children:r.jsx(sye,{"data-state":i==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:gn(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:gn(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),W8e=A.forwardRef((e,t)=>{const n=kf(ox,e.__scopeScrollArea),{forceMount:s,...a}=e,[o,l]=A.useState(!1),i=e.orientation==="horizontal",u=Kse(()=>{if(n.viewport){const m=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=e,a=kf(ox,e.__scopeScrollArea),o=A.useRef(null),l=A.useRef(0),[i,u]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=X8e(i.viewport,i.content),x={...s,sizes:i,onSizesChange:u,hasThumb:m>0&&m<1,onThumbChange:v=>o.current=v,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:v=>l.current=v};function y(v,b){return vut(v,l.current,i,b)}return n==="horizontal"?r.jsx(fut,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollLeft,b=mNe(v,i,a.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollLeft=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollLeft=y(v,a.dir))}}):n==="vertical"?r.jsx(put,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const v=a.viewport.scrollTop,b=mNe(v,i);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:v=>{a.viewport&&(a.viewport.scrollTop=v)},onDragScroll:v=>{a.viewport&&(a.viewport.scrollTop=y(v))}}):null}),fut=A.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...a}=e,o=kf(ox,e.__scopeScrollArea),[l,i]=A.useState(),u=A.useRef(null),m=ca(t,u,o.onScrollbarXChange);return A.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(K8e,{"data-orientation":"horizontal",...a,ref:m,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":Gse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.x),onDragScroll:x=>e.onDragScroll(x.x),onWheelScroll:(x,y)=>{if(o.viewport){const v=o.viewport.scrollLeft+x.deltaX;e.onWheelScroll(v),J8e(v,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Yte(l.paddingLeft),paddingEnd:Yte(l.paddingRight)}})}})}),put=A.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...a}=e,o=kf(ox,e.__scopeScrollArea),[l,i]=A.useState(),u=A.useRef(null),m=ca(t,u,o.onScrollbarYChange);return A.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(K8e,{"data-orientation":"vertical",...a,ref:m,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":Gse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.y),onDragScroll:x=>e.onDragScroll(x.y),onWheelScroll:(x,y)=>{if(o.viewport){const v=o.viewport.scrollTop+x.deltaY;e.onWheelScroll(v),J8e(v,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Yte(l.paddingTop),paddingEnd:Yte(l.paddingBottom)}})}})}),[gut,G8e]=U8e(ox),K8e=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:u,onDragScroll:m,onWheelScroll:x,onResize:y,...v}=e,b=kf(ox,n),[N,k]=A.useState(null),M=ca(t,G=>k(G)),I=A.useRef(null),T=A.useRef(""),P=b.viewport,F=s.content-s.viewport,D=sc(x),U=sc(u),V=Kse(y,10);function W(G){if(I.current){const ee=G.clientX-I.current.left,ae=G.clientY-I.current.top;m({x:ee,y:ae})}}return A.useEffect(()=>{const G=ee=>{const ae=ee.target;(N==null?void 0:N.contains(ae))&&D(ee,F)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[P,N,F,D]),A.useEffect(U,[s,U]),OC(N,V),OC(b.content,V),r.jsx(gut,{scope:n,scrollbar:N,hasThumb:a,onThumbChange:sc(o),onThumbPointerUp:sc(l),onThumbPositionChange:U,onThumbPointerDown:sc(i),children:r.jsx(Fn.div,{...v,ref:M,style:{position:"absolute",...v.style},onPointerDown:gn(e.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),I.current=N.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),W(G))}),onPointerMove:gn(e.onPointerMove,W),onPointerUp:gn(e.onPointerUp,G=>{const ee=G.target;ee.hasPointerCapture(G.pointerId)&&ee.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=T.current,b.viewport&&(b.viewport.style.scrollBehavior=""),I.current=null})})})}),Zte="ScrollAreaThumb",Z8e=A.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=G8e(Zte,e.__scopeScrollArea);return r.jsx(Ac,{present:n||a.hasThumb,children:r.jsx(xut,{ref:t,...s})})}),xut=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...a}=e,o=kf(Zte,n),l=G8e(Zte,n),{onThumbPositionChange:i}=l,u=ca(t,y=>l.onThumbChange(y)),m=A.useRef(void 0),x=Kse(()=>{m.current&&(m.current(),m.current=void 0)},100);return A.useEffect(()=>{const y=o.viewport;if(y){const v=()=>{if(x(),!m.current){const b=_ut(y,i);m.current=b,i()}};return i(),y.addEventListener("scroll",v),()=>y.removeEventListener("scroll",v)}},[o.viewport,x,i]),r.jsx(Fn.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:gn(e.onPointerDownCapture,y=>{const b=y.target.getBoundingClientRect(),N=y.clientX-b.left,k=y.clientY-b.top;l.onThumbPointerDown({x:N,y:k})}),onPointerUp:gn(e.onPointerUp,l.onThumbPointerUp)})});Z8e.displayName=Zte;var aye="ScrollAreaCorner",Y8e=A.forwardRef((e,t)=>{const n=kf(aye,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(yut,{...e,ref:t}):null});Y8e.displayName=aye;var yut=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,...s}=e,a=kf(aye,n),[o,l]=A.useState(0),[i,u]=A.useState(0),m=!!(o&&i);return OC(a.scrollbarX,()=>{var y;const x=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(x),u(x)}),OC(a.scrollbarY,()=>{var y;const x=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(x),l(x)}),m?r.jsx(Fn.div,{...s,ref:t,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Yte(e){return e?parseInt(e,10):0}function X8e(e,t){const n=e/t;return isNaN(n)?0:n}function Gse(e){const t=X8e(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function vut(e,t,n,s="ltr"){const a=Gse(n),o=a/2,l=t||o,i=a-l,u=n.scrollbar.paddingStart+l,m=n.scrollbar.size-n.scrollbar.paddingEnd-i,x=n.content-n.viewport,y=s==="ltr"?[0,x]:[x*-1,0];return Q8e([u,m],y)(e)}function mNe(e,t,n="ltr"){const s=Gse(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,i=o-s,u=n==="ltr"?[0,l]:[l*-1,0],m=LE(e,u);return Q8e([0,l],[0,i])(m)}function Q8e(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 J8e(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},s=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=n.left!==o.left,i=n.top!==o.top;(l||i)&&t(),n=o,s=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(s)};function Kse(e,t){const n=sc(e),s=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(s.current),[]),A.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,t)},[n,t])}function OC(e,t){const n=sc(t);oc(()=>{let s=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(s),a.unobserve(e)}}},[e,n])}var eDe=q8e,but=H8e,wut=Y8e;const Vo=A.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(eDe,{ref:s,className:Ut("relative overflow-hidden",e),...n,children:[r.jsx(but,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(iye,{}),r.jsx(wut,{})]}));Vo.displayName=eDe.displayName;const iye=A.forwardRef(({className:e,orientation:t="vertical",...n},s)=>r.jsx(nye,{ref:s,orientation:t,className:Ut("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(Z8e,{className:"relative flex-1 rounded-full bg-border"})}));iye.displayName=nye.displayName;var Zse="Collapsible",[jut]=cc(Zse),[kut,oye]=jut(Zse),tDe=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:a,disabled:o,onOpenChange:l,...i}=e,[u,m]=rh({prop:s,defaultProp:a??!1,onChange:l,caller:Zse});return r.jsx(kut,{scope:n,disabled:o,contentId:pd(),open:u,onOpenToggle:A.useCallback(()=>m(x=>!x),[m]),children:r.jsx(Fn.div,{"data-state":cye(u),"data-disabled":o?"":void 0,...i,ref:t})})});tDe.displayName=Zse;var rDe="CollapsibleTrigger",nDe=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,a=oye(rDe,n);return r.jsx(Fn.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":cye(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...s,ref:t,onClick:gn(e.onClick,a.onOpenToggle)})});nDe.displayName=rDe;var lye="CollapsibleContent",sDe=A.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=oye(lye,e.__scopeCollapsible);return r.jsx(Ac,{present:n||a.open,children:({present:o})=>r.jsx(Nut,{...s,ref:t,present:o})})});sDe.displayName=lye;var Nut=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:a,...o}=e,l=oye(lye,n),[i,u]=A.useState(s),m=A.useRef(null),x=ca(t,m),y=A.useRef(0),v=y.current,b=A.useRef(0),N=b.current,k=l.open||i,M=A.useRef(k),I=A.useRef(void 0);return A.useEffect(()=>{const T=requestAnimationFrame(()=>M.current=!1);return()=>cancelAnimationFrame(T)},[]),oc(()=>{const T=m.current;if(T){I.current=I.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const P=T.getBoundingClientRect();y.current=P.height,b.current=P.width,M.current||(T.style.transitionDuration=I.current.transitionDuration,T.style.animationName=I.current.animationName),u(s)}},[l.open,s]),r.jsx(Fn.div,{"data-state":cye(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!k,...o,ref:x,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":N?`${N}px`:void 0,...e.style},children:k&&a})});function cye(e){return e?"open":"closed"}var Sut=tDe;const W4=Sut,G4=nDe,K4=sDe,fNe="/assets/levelup-logo-Eif24dqY.png",Cut="/assets/levelup-logo-icon-C-7iromj.png";var cP=e=>e.type==="checkbox",ij=e=>e instanceof Date,Wu=e=>e==null;const aDe=e=>typeof e=="object";var Cc=e=>!Wu(e)&&!Array.isArray(e)&&aDe(e)&&!ij(e),iDe=e=>Cc(e)&&e.target?cP(e.target)?e.target.checked:e.target.value:e,Mut=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,oDe=(e,t)=>e.has(Mut(t)),Tut=e=>{const t=e.constructor&&e.constructor.prototype;return Cc(t)&&t.hasOwnProperty("isPrototypeOf")},dye=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function nd(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(!(dye&&(e instanceof Blob||s))&&(n||Cc(e)))if(t=n?[]:{},!n&&!Tut(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=nd(e[a]));else return e;return t}var Yse=e=>/^\w*$/.test(e),yc=e=>e===void 0,uye=e=>Array.isArray(e)?e.filter(Boolean):[],hye=e=>uye(e.replace(/["|']|\]/g,"").split(/\.|\[/)),es=(e,t,n)=>{if(!t||!Cc(e))return n;const s=(Yse(t)?[t]:hye(t)).reduce((a,o)=>Wu(a)?a:a[o],e);return yc(s)||s===e?yc(e[t])?n:e[t]:s},sm=e=>typeof e=="boolean",To=(e,t,n)=>{let s=-1;const a=Yse(t)?[t]:hye(t),o=a.length,l=o-1;for(;++sdt.useContext(mye),Aut=e=>{const{children:t,...n}=e;return dt.createElement(mye.Provider,{value:n},t)};var lDe=(e,t,n,s=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const l=o;return t._proxyFormState[l]!==xp.all&&(t._proxyFormState[l]=!s||xp.all),n&&(n[l]=!0),e[l]}});return a};const fye=typeof window<"u"?dt.useLayoutEffect:dt.useEffect;function Eut(e){const t=Xse(),{control:n=t.control,disabled:s,name:a,exact:o}=e||{},[l,i]=dt.useState(n._formState),u=dt.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return fye(()=>n._subscribe({name:a,formState:u.current,exact:o,callback:m=>{!s&&i({...n._formState,...m})}}),[a,s,o]),dt.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),dt.useMemo(()=>lDe(l,n,u.current,!1),[l,n])}var Tg=e=>typeof e=="string",cDe=(e,t,n,s,a)=>Tg(e)?(s&&t.watch.add(e),es(n,e,a)):Array.isArray(e)?e.map(o=>(s&&t.watch.add(o),es(n,o))):(s&&(t.watchAll=!0),n),_me=e=>Wu(e)||!aDe(e);function Xx(e,t,n=new WeakSet){if(_me(e)||_me(t))return e===t;if(ij(e)&&ij(t))return e.getTime()===t.getTime();const s=Object.keys(e),a=Object.keys(t);if(s.length!==a.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(!a.includes(o))return!1;if(o!=="ref"){const i=t[o];if(ij(l)&&ij(i)||Cc(l)&&Cc(i)||Array.isArray(l)&&Array.isArray(i)?!Xx(l,i,n):l!==i)return!1}}return!0}function Iut(e){const t=Xse(),{control:n=t.control,name:s,defaultValue:a,disabled:o,exact:l,compute:i}=e||{},u=dt.useRef(a),m=dt.useRef(i),x=dt.useRef(void 0);m.current=i;const y=dt.useMemo(()=>n._getWatch(s,u.current),[n,s]),[v,b]=dt.useState(m.current?m.current(y):y);return fye(()=>n._subscribe({name:s,formState:{values:!0},exact:l,callback:N=>{if(!o){const k=cDe(s,n._names,N.values||n._formValues,!1,u.current);if(m.current){const M=m.current(k);Xx(M,x.current)||(b(M),x.current=M)}else b(k)}}}),[n,o,s,l]),dt.useEffect(()=>n._removeUnmounted()),v}function Put(e){const t=Xse(),{name:n,disabled:s,control:a=t.control,shouldUnregister:o,defaultValue:l}=e,i=oDe(a._names.array,n),u=dt.useMemo(()=>es(a._formValues,n,es(a._defaultValues,n,l)),[a,n,l]),m=Iut({control:a,name:n,defaultValue:u,exact:!0}),x=Eut({control:a,name:n,exact:!0}),y=dt.useRef(e),v=dt.useRef(a.register(n,{...e.rules,value:m,...sm(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const b=dt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!es(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!es(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!es(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!es(x.validatingFields,n)},error:{enumerable:!0,get:()=>es(x.errors,n)}}),[x,n]),N=dt.useCallback(T=>v.current.onChange({target:{value:iDe(T),name:n},type:Xte.CHANGE}),[n]),k=dt.useCallback(()=>v.current.onBlur({target:{value:es(a._formValues,n),name:n},type:Xte.BLUR}),[n,a._formValues]),M=dt.useCallback(T=>{const P=es(a._fields,n);P&&T&&(P._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:F=>T.setCustomValidity(F),reportValidity:()=>T.reportValidity()})},[a._fields,n]),I=dt.useMemo(()=>({name:n,value:m,...sm(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:N,onBlur:k,ref:M}),[n,s,x.disabled,N,k,M,m]);return dt.useEffect(()=>{const T=a._options.shouldUnregister||o;a.register(n,{...y.current.rules,...sm(y.current.disabled)?{disabled:y.current.disabled}:{}});const P=(F,D)=>{const U=es(a._fields,F);U&&U._f&&(U._f.mount=D)};if(P(n,!0),T){const F=nd(es(a._options.defaultValues,n));To(a._defaultValues,n,F),yc(es(a._formValues,n))&&To(a._formValues,n,F)}return!i&&a.register(n),()=>{(i?T&&!a._state.action:T)?a.unregister(n):P(n,!1)}},[n,a,i,o]),dt.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),dt.useMemo(()=>({field:I,formState:x,fieldState:b}),[I,x,b])}const Lut=e=>e.render(Put(e));var dDe=(e,t,n,s,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:a||!0}}:{},RA=e=>Array.isArray(e)?e:[e],pNe=()=>{let e=[];return{get observers(){return e},next:a=>{for(const o of e)o.next&&o.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(o=>o!==a)}}),unsubscribe:()=>{e=[]}}},wh=e=>Cc(e)&&!Object.keys(e).length,pye=e=>e.type==="file",yp=e=>typeof e=="function",Qte=e=>{if(!dye)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},uDe=e=>e.type==="select-multiple",gye=e=>e.type==="radio",Out=e=>gye(e)||cP(e),$ce=e=>Qte(e)&&e.isConnected;function Dut(e,t){const n=t.slice(0,-1).length;let s=0;for(;s{for(const t in e)if(yp(e[t]))return!0;return!1};function Jte(e,t={}){const n=Array.isArray(e);if(Cc(e)||n)for(const s in e)Array.isArray(e[s])||Cc(e[s])&&!hDe(e[s])?(t[s]=Array.isArray(e[s])?[]:{},Jte(e[s],t[s])):Wu(e[s])||(t[s]=!0);return t}function mDe(e,t,n){const s=Array.isArray(e);if(Cc(e)||s)for(const a in e)Array.isArray(e[a])||Cc(e[a])&&!hDe(e[a])?yc(t)||_me(n[a])?n[a]=Array.isArray(e[a])?Jte(e[a],[]):{...Jte(e[a])}:mDe(e[a],Wu(t)?{}:t[a],n[a]):n[a]=!Xx(e[a],t[a]);return n}var aT=(e,t)=>mDe(e,t,Jte(t));const gNe={value:!1,isValid:!1},xNe={value:!0,isValid:!0};var fDe=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&&!yc(e[0].attributes.value)?yc(e[0].value)||e[0].value===""?xNe:{value:e[0].value,isValid:!0}:xNe:gNe}return gNe},pDe=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:s})=>yc(e)?e:t?e===""?NaN:e&&+e:n&&Tg(e)?new Date(e):s?s(e):e;const yNe={isValid:!1,value:null};var gDe=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,yNe):yNe;function vNe(e){const t=e.ref;return pye(t)?t.files:gye(t)?gDe(e.refs).value:uDe(t)?[...t.selectedOptions].map(({value:n})=>n):cP(t)?fDe(e.refs).value:pDe(yc(t.value)?e.ref.value:t.value,e)}var Fut=(e,t,n,s)=>{const a={};for(const o of e){const l=es(t,o);l&&To(a,o,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:s}},ere=e=>e instanceof RegExp,iT=e=>yc(e)?e:ere(e)?e.source:Cc(e)?ere(e.value)?e.value.source:e.value:e,_Ne=e=>({isOnSubmit:!e||e===xp.onSubmit,isOnBlur:e===xp.onBlur,isOnChange:e===xp.onChange,isOnAll:e===xp.all,isOnTouch:e===xp.onTouched});const bNe="AsyncFunction";var zut=e=>!!e&&!!e.validate&&!!(yp(e.validate)&&e.validate.constructor.name===bNe||Cc(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===bNe)),But=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),wNe=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const FA=(e,t,n,s)=>{for(const a of n||Object.keys(e)){const o=es(e,a);if(o){const{_f:l,...i}=o;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!s)return!0;if(l.ref&&t(l.ref,l.name)&&!s)return!0;if(FA(i,t))break}else if(Cc(i)&&FA(i,t))break}}};function jNe(e,t,n){const s=es(e,n);if(s||Yse(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),l=es(t,o),i=es(e,o);if(l&&!Array.isArray(l)&&n!==o)return{name:n};if(i&&i.type)return{name:o,error:i};if(i&&i.root&&i.root.type)return{name:`${o}.root`,error:i.root};a.pop()}return{name:n}}var $ut=(e,t,n,s)=>{n(e);const{name:a,...o}=e;return wh(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(l=>t[l]===(!s||xp.all))},Uut=(e,t,n)=>!e||!t||e===t||RA(e).some(s=>s&&(n?s===t:s.startsWith(t)||t.startsWith(s))),qut=(e,t,n,s,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?s.isOnBlur:a.isOnBlur)?!e:(n?s.isOnChange:a.isOnChange)?e:!0,Vut=(e,t)=>!uye(es(e,t)).length&&Rc(e,t),Hut=(e,t,n)=>{const s=RA(es(e,n));return To(s,"root",t[n]),To(e,n,s),e},Uee=e=>Tg(e);function kNe(e,t,n="validate"){if(Uee(e)||Array.isArray(e)&&e.every(Uee)||sm(e)&&!e)return{type:n,message:Uee(e)?e:"",ref:t}}var CS=e=>Cc(e)&&!ere(e)?e:{value:e,message:""},NNe=async(e,t,n,s,a,o)=>{const{ref:l,refs:i,required:u,maxLength:m,minLength:x,min:y,max:v,pattern:b,validate:N,name:k,valueAsNumber:M,mount:I}=e._f,T=es(n,k);if(!I||t.has(k))return{};const P=i?i[0]:l,F=oe=>{a&&P.reportValidity&&(P.setCustomValidity(sm(oe)?"":oe||""),P.reportValidity())},D={},U=gye(l),V=cP(l),W=U||V,G=(M||pye(l))&&yc(l.value)&&yc(T)||Qte(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,ee=dDe.bind(null,k,s,D),ae=(oe,pe,ne,fe=Lx.maxLength,se=Lx.minLength)=>{const me=oe?pe:ne;D[k]={type:oe?fe:se,message:me,ref:l,...ee(oe?fe:se,me)}};if(o?!Array.isArray(T)||!T.length:u&&(!W&&(G||Wu(T))||sm(T)&&!T||V&&!fDe(i).isValid||U&&!gDe(i).isValid)){const{value:oe,message:pe}=Uee(u)?{value:!!u,message:u}:CS(u);if(oe&&(D[k]={type:Lx.required,message:pe,ref:P,...ee(Lx.required,pe)},!s))return F(pe),D}if(!G&&(!Wu(y)||!Wu(v))){let oe,pe;const ne=CS(v),fe=CS(y);if(!Wu(T)&&!isNaN(T)){const se=l.valueAsNumber||T&&+T;Wu(ne.value)||(oe=se>ne.value),Wu(fe.value)||(pe=senew Date(new Date().toDateString()+" "+Te),ue=l.type=="time",xe=l.type=="week";Tg(ne.value)&&T&&(oe=ue?me(T)>me(ne.value):xe?T>ne.value:se>new Date(ne.value)),Tg(fe.value)&&T&&(pe=ue?me(T)+oe.value,fe=!Wu(pe.value)&&T.length<+pe.value;if((ne||fe)&&(ae(ne,oe.message,pe.message),!s))return F(D[k].message),D}if(b&&!G&&Tg(T)){const{value:oe,message:pe}=CS(b);if(ere(oe)&&!T.match(oe)&&(D[k]={type:Lx.pattern,message:pe,ref:l,...ee(Lx.pattern,pe)},!s))return F(pe),D}if(N){if(yp(N)){const oe=await N(T,n),pe=kNe(oe,P);if(pe&&(D[k]={...pe,...ee(Lx.validate,pe.message)},!s))return F(pe.message),D}else if(Cc(N)){let oe={};for(const pe in N){if(!wh(oe)&&!s)break;const ne=kNe(await N[pe](T,n),P,pe);ne&&(oe={...ne,...ee(pe,ne.message)},F(ne.message),s&&(D[k]=oe))}if(!wh(oe)&&(D[k]={ref:P,...oe},!s))return D}}return F(!0),D};const Wut={mode:xp.onSubmit,reValidateMode:xp.onChange,shouldFocusError:!0};function Gut(e={}){let t={...Wut,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:yp(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},a=Cc(t.defaultValues)||Cc(t.values)?nd(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:nd(a),l={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u,m=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...x};const v={array:pNe(),state:pNe()},b=t.criteriaMode===xp.all,N=Ce=>Ee=>{clearTimeout(m),m=setTimeout(Ce,Ee)},k=async Ce=>{if(!t.disabled&&(x.isValid||y.isValid||Ce)){const Ee=t.resolver?wh((await V()).errors):await G(s,!0);Ee!==n.isValid&&v.state.next({isValid:Ee})}},M=(Ce,Ee)=>{!t.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&((Ce||Array.from(i.mount)).forEach(Ze=>{Ze&&(Ee?To(n.validatingFields,Ze,Ee):Rc(n.validatingFields,Ze))}),v.state.next({validatingFields:n.validatingFields,isValidating:!wh(n.validatingFields)}))},I=(Ce,Ee=[],Ze,Le,Ke=!0,tt=!0)=>{if(Le&&Ze&&!t.disabled){if(l.action=!0,tt&&Array.isArray(es(s,Ce))){const ct=Ze(es(s,Ce),Le.argA,Le.argB);Ke&&To(s,Ce,ct)}if(tt&&Array.isArray(es(n.errors,Ce))){const ct=Ze(es(n.errors,Ce),Le.argA,Le.argB);Ke&&To(n.errors,Ce,ct),Vut(n.errors,Ce)}if((x.touchedFields||y.touchedFields)&&tt&&Array.isArray(es(n.touchedFields,Ce))){const ct=Ze(es(n.touchedFields,Ce),Le.argA,Le.argB);Ke&&To(n.touchedFields,Ce,ct)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=aT(a,o)),v.state.next({name:Ce,isDirty:ae(Ce,Ee),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else To(o,Ce,Ee)},T=(Ce,Ee)=>{To(n.errors,Ce,Ee),v.state.next({errors:n.errors})},P=Ce=>{n.errors=Ce,v.state.next({errors:n.errors,isValid:!1})},F=(Ce,Ee,Ze,Le)=>{const Ke=es(s,Ce);if(Ke){const tt=es(o,Ce,yc(Ze)?es(a,Ce):Ze);yc(tt)||Le&&Le.defaultChecked||Ee?To(o,Ce,Ee?tt:vNe(Ke._f)):ne(Ce,tt),l.mount&&k()}},D=(Ce,Ee,Ze,Le,Ke)=>{let tt=!1,ct=!1;const it={name:Ce};if(!t.disabled){if(!Ze||Le){(x.isDirty||y.isDirty)&&(ct=n.isDirty,n.isDirty=it.isDirty=ae(),tt=ct!==it.isDirty);const zt=Xx(es(a,Ce),Ee);ct=!!es(n.dirtyFields,Ce),zt?Rc(n.dirtyFields,Ce):To(n.dirtyFields,Ce,!0),it.dirtyFields=n.dirtyFields,tt=tt||(x.dirtyFields||y.dirtyFields)&&ct!==!zt}if(Ze){const zt=es(n.touchedFields,Ce);zt||(To(n.touchedFields,Ce,Ze),it.touchedFields=n.touchedFields,tt=tt||(x.touchedFields||y.touchedFields)&&zt!==Ze)}tt&&Ke&&v.state.next(it)}return tt?it:{}},U=(Ce,Ee,Ze,Le)=>{const Ke=es(n.errors,Ce),tt=(x.isValid||y.isValid)&&sm(Ee)&&n.isValid!==Ee;if(t.delayError&&Ze?(u=N(()=>T(Ce,Ze)),u(t.delayError)):(clearTimeout(m),u=null,Ze?To(n.errors,Ce,Ze):Rc(n.errors,Ce)),(Ze?!Xx(Ke,Ze):Ke)||!wh(Le)||tt){const ct={...Le,...tt&&sm(Ee)?{isValid:Ee}:{},errors:n.errors,name:Ce};n={...n,...ct},v.state.next(ct)}},V=async Ce=>{M(Ce,!0);const Ee=await t.resolver(o,t.context,Fut(Ce||i.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return M(Ce),Ee},W=async Ce=>{const{errors:Ee}=await V(Ce);if(Ce)for(const Ze of Ce){const Le=es(Ee,Ze);Le?To(n.errors,Ze,Le):Rc(n.errors,Ze)}else n.errors=Ee;return Ee},G=async(Ce,Ee,Ze={valid:!0})=>{for(const Le in Ce){const Ke=Ce[Le];if(Ke){const{_f:tt,...ct}=Ke;if(tt){const it=i.array.has(tt.name),zt=Ke._f&&zut(Ke._f);zt&&x.validatingFields&&M([Le],!0);const Lt=await NNe(Ke,i.disabled,o,b,t.shouldUseNativeValidation&&!Ee,it);if(zt&&x.validatingFields&&M([Le]),Lt[tt.name]&&(Ze.valid=!1,Ee))break;!Ee&&(es(Lt,tt.name)?it?Hut(n.errors,Lt,tt.name):To(n.errors,tt.name,Lt[tt.name]):Rc(n.errors,tt.name))}!wh(ct)&&await G(ct,Ee,Ze)}}return Ze.valid},ee=()=>{for(const Ce of i.unMount){const Ee=es(s,Ce);Ee&&(Ee._f.refs?Ee._f.refs.every(Ze=>!$ce(Ze)):!$ce(Ee._f.ref))&&$e(Ce)}i.unMount=new Set},ae=(Ce,Ee)=>!t.disabled&&(Ce&&Ee&&To(o,Ce,Ee),!Xx(Te(),a)),oe=(Ce,Ee,Ze)=>cDe(Ce,i,{...l.mount?o:yc(Ee)?a:Tg(Ce)?{[Ce]:Ee}:Ee},Ze,Ee),pe=Ce=>uye(es(l.mount?o:a,Ce,t.shouldUnregister?es(a,Ce,[]):[])),ne=(Ce,Ee,Ze={})=>{const Le=es(s,Ce);let Ke=Ee;if(Le){const tt=Le._f;tt&&(!tt.disabled&&To(o,Ce,pDe(Ee,tt)),Ke=Qte(tt.ref)&&Wu(Ee)?"":Ee,uDe(tt.ref)?[...tt.ref.options].forEach(ct=>ct.selected=Ke.includes(ct.value)):tt.refs?cP(tt.ref)?tt.refs.forEach(ct=>{(!ct.defaultChecked||!ct.disabled)&&(Array.isArray(Ke)?ct.checked=!!Ke.find(it=>it===ct.value):ct.checked=Ke===ct.value||!!Ke)}):tt.refs.forEach(ct=>ct.checked=ct.value===Ke):pye(tt.ref)?tt.ref.value="":(tt.ref.value=Ke,tt.ref.type||v.state.next({name:Ce,values:nd(o)})))}(Ze.shouldDirty||Ze.shouldTouch)&&D(Ce,Ke,Ze.shouldTouch,Ze.shouldDirty,!0),Ze.shouldValidate&&xe(Ce)},fe=(Ce,Ee,Ze)=>{for(const Le in Ee){if(!Ee.hasOwnProperty(Le))return;const Ke=Ee[Le],tt=Ce+"."+Le,ct=es(s,tt);(i.array.has(Ce)||Cc(Ke)||ct&&!ct._f)&&!ij(Ke)?fe(tt,Ke,Ze):ne(tt,Ke,Ze)}},se=(Ce,Ee,Ze={})=>{const Le=es(s,Ce),Ke=i.array.has(Ce),tt=nd(Ee);To(o,Ce,tt),Ke?(v.array.next({name:Ce,values:nd(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&Ze.shouldDirty&&v.state.next({name:Ce,dirtyFields:aT(a,o),isDirty:ae(Ce,tt)})):Le&&!Le._f&&!Wu(tt)?fe(Ce,tt,Ze):ne(Ce,tt,Ze),wNe(Ce,i)&&v.state.next({...n,name:Ce}),v.state.next({name:l.mount?Ce:void 0,values:nd(o)})},me=async Ce=>{l.mount=!0;const Ee=Ce.target;let Ze=Ee.name,Le=!0;const Ke=es(s,Ze),tt=zt=>{Le=Number.isNaN(zt)||ij(zt)&&isNaN(zt.getTime())||Xx(zt,es(o,Ze,zt))},ct=_Ne(t.mode),it=_Ne(t.reValidateMode);if(Ke){let zt,Lt;const lr=Ee.type?vNe(Ke._f):iDe(Ce),Ar=Ce.type===Xte.BLUR||Ce.type===Xte.FOCUS_OUT,Mr=!But(Ke._f)&&!t.resolver&&!es(n.errors,Ze)&&!Ke._f.deps||qut(Ar,es(n.touchedFields,Ze),n.isSubmitted,it,ct),Zr=wNe(Ze,i,Ar);To(o,Ze,lr),Ar?(Ke._f.onBlur&&Ke._f.onBlur(Ce),u&&u(0)):Ke._f.onChange&&Ke._f.onChange(Ce);const Xn=D(Ze,lr,Ar),dr=!wh(Xn)||Zr;if(!Ar&&v.state.next({name:Ze,type:Ce.type,values:nd(o)}),Mr)return(x.isValid||y.isValid)&&(t.mode==="onBlur"?Ar&&k():Ar||k()),dr&&v.state.next({name:Ze,...Zr?{}:Xn});if(!Ar&&Zr&&v.state.next({...n}),t.resolver){const{errors:En}=await V([Ze]);if(tt(lr),Le){const Es=jNe(n.errors,s,Ze),Hs=jNe(En,s,Es.name||Ze);zt=Hs.error,Ze=Hs.name,Lt=wh(En)}}else M([Ze],!0),zt=(await NNe(Ke,i.disabled,o,b,t.shouldUseNativeValidation))[Ze],M([Ze]),tt(lr),Le&&(zt?Lt=!1:(x.isValid||y.isValid)&&(Lt=await G(s,!0)));Le&&(Ke._f.deps&&xe(Ke._f.deps),U(Ze,Lt,zt,Xn))}},ue=(Ce,Ee)=>{if(es(n.errors,Ee)&&Ce.focus)return Ce.focus(),1},xe=async(Ce,Ee={})=>{let Ze,Le;const Ke=RA(Ce);if(t.resolver){const tt=await W(yc(Ce)?Ce:Ke);Ze=wh(tt),Le=Ce?!Ke.some(ct=>es(tt,ct)):Ze}else Ce?(Le=(await Promise.all(Ke.map(async tt=>{const ct=es(s,tt);return await G(ct&&ct._f?{[tt]:ct}:ct)}))).every(Boolean),!(!Le&&!n.isValid)&&k()):Le=Ze=await G(s);return v.state.next({...!Tg(Ce)||(x.isValid||y.isValid)&&Ze!==n.isValid?{}:{name:Ce},...t.resolver||!Ce?{isValid:Ze}:{},errors:n.errors}),Ee.shouldFocus&&!Le&&FA(s,ue,Ce?Ke:i.mount),Le},Te=Ce=>{const Ee={...l.mount?o:a};return yc(Ce)?Ee:Tg(Ce)?es(Ee,Ce):Ce.map(Ze=>es(Ee,Ze))},_e=(Ce,Ee)=>({invalid:!!es((Ee||n).errors,Ce),isDirty:!!es((Ee||n).dirtyFields,Ce),error:es((Ee||n).errors,Ce),isValidating:!!es(n.validatingFields,Ce),isTouched:!!es((Ee||n).touchedFields,Ce)}),we=Ce=>{Ce&&RA(Ce).forEach(Ee=>Rc(n.errors,Ee)),v.state.next({errors:Ce?n.errors:{}})},ve=(Ce,Ee,Ze)=>{const Le=(es(s,Ce,{_f:{}})._f||{}).ref,Ke=es(n.errors,Ce)||{},{ref:tt,message:ct,type:it,...zt}=Ke;To(n.errors,Ce,{...zt,...Ee,ref:Le}),v.state.next({name:Ce,errors:n.errors,isValid:!1}),Ze&&Ze.shouldFocus&&Le&&Le.focus&&Le.focus()},Xe=(Ce,Ee)=>yp(Ce)?v.state.subscribe({next:Ze=>"values"in Ze&&Ce(oe(void 0,Ee),Ze)}):oe(Ce,Ee,!0),Me=Ce=>v.state.subscribe({next:Ee=>{Uut(Ce.name,Ee.name,Ce.exact)&&$ut(Ee,Ce.formState||x,st,Ce.reRenderRoot)&&Ce.callback({values:{...o},...n,...Ee,defaultValues:a})}}).unsubscribe,Ie=Ce=>(l.mount=!0,y={...y,...Ce.formState},Me({...Ce,formState:y})),$e=(Ce,Ee={})=>{for(const Ze of Ce?RA(Ce):i.mount)i.mount.delete(Ze),i.array.delete(Ze),Ee.keepValue||(Rc(s,Ze),Rc(o,Ze)),!Ee.keepError&&Rc(n.errors,Ze),!Ee.keepDirty&&Rc(n.dirtyFields,Ze),!Ee.keepTouched&&Rc(n.touchedFields,Ze),!Ee.keepIsValidating&&Rc(n.validatingFields,Ze),!t.shouldUnregister&&!Ee.keepDefaultValue&&Rc(a,Ze);v.state.next({values:nd(o)}),v.state.next({...n,...Ee.keepDirty?{isDirty:ae()}:{}}),!Ee.keepIsValid&&k()},Be=({disabled:Ce,name:Ee})=>{(sm(Ce)&&l.mount||Ce||i.disabled.has(Ee))&&(Ce?i.disabled.add(Ee):i.disabled.delete(Ee))},Ve=(Ce,Ee={})=>{let Ze=es(s,Ce);const Le=sm(Ee.disabled)||sm(t.disabled);return To(s,Ce,{...Ze||{},_f:{...Ze&&Ze._f?Ze._f:{ref:{name:Ce}},name:Ce,mount:!0,...Ee}}),i.mount.add(Ce),Ze?Be({disabled:sm(Ee.disabled)?Ee.disabled:t.disabled,name:Ce}):F(Ce,!0,Ee.value),{...Le?{disabled:Ee.disabled||t.disabled}:{},...t.progressive?{required:!!Ee.required,min:iT(Ee.min),max:iT(Ee.max),minLength:iT(Ee.minLength),maxLength:iT(Ee.maxLength),pattern:iT(Ee.pattern)}:{},name:Ce,onChange:me,onBlur:me,ref:Ke=>{if(Ke){Ve(Ce,Ee),Ze=es(s,Ce);const tt=yc(Ke.value)&&Ke.querySelectorAll&&Ke.querySelectorAll("input,select,textarea")[0]||Ke,ct=Out(tt),it=Ze._f.refs||[];if(ct?it.find(zt=>zt===tt):tt===Ze._f.ref)return;To(s,Ce,{_f:{...Ze._f,...ct?{refs:[...it.filter($ce),tt,...Array.isArray(es(a,Ce))?[{}]:[]],ref:{type:tt.type,name:Ce}}:{ref:tt}}}),F(Ce,!1,void 0,tt)}else Ze=es(s,Ce,{}),Ze._f&&(Ze._f.mount=!1),(t.shouldUnregister||Ee.shouldUnregister)&&!(oDe(i.array,Ce)&&l.action)&&i.unMount.add(Ce)}}},ot=()=>t.shouldFocusError&&FA(s,ue,i.mount),Tt=Ce=>{sm(Ce)&&(v.state.next({disabled:Ce}),FA(s,(Ee,Ze)=>{const Le=es(s,Ze);Le&&(Ee.disabled=Le._f.disabled||Ce,Array.isArray(Le._f.refs)&&Le._f.refs.forEach(Ke=>{Ke.disabled=Le._f.disabled||Ce}))},0,!1))},Oe=(Ce,Ee)=>async Ze=>{let Le;Ze&&(Ze.preventDefault&&Ze.preventDefault(),Ze.persist&&Ze.persist());let Ke=nd(o);if(v.state.next({isSubmitting:!0}),t.resolver){const{errors:tt,values:ct}=await V();n.errors=tt,Ke=nd(ct)}else await G(s);if(i.disabled.size)for(const tt of i.disabled)Rc(Ke,tt);if(Rc(n.errors,"root"),wh(n.errors)){v.state.next({errors:{}});try{await Ce(Ke,Ze)}catch(tt){Le=tt}}else Ee&&await Ee({...n.errors},Ze),ot(),setTimeout(ot);if(v.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:wh(n.errors)&&!Le,submitCount:n.submitCount+1,errors:n.errors}),Le)throw Le},at=(Ce,Ee={})=>{es(s,Ce)&&(yc(Ee.defaultValue)?se(Ce,nd(es(a,Ce))):(se(Ce,Ee.defaultValue),To(a,Ce,nd(Ee.defaultValue))),Ee.keepTouched||Rc(n.touchedFields,Ce),Ee.keepDirty||(Rc(n.dirtyFields,Ce),n.isDirty=Ee.defaultValue?ae(Ce,nd(es(a,Ce))):ae()),Ee.keepError||(Rc(n.errors,Ce),x.isValid&&k()),v.state.next({...n}))},le=(Ce,Ee={})=>{const Ze=Ce?nd(Ce):a,Le=nd(Ze),Ke=wh(Ce),tt=Ke?a:Le;if(Ee.keepDefaultValues||(a=Ze),!Ee.keepValues){if(Ee.keepDirtyValues){const ct=new Set([...i.mount,...Object.keys(aT(a,o))]);for(const it of Array.from(ct))es(n.dirtyFields,it)?To(tt,it,es(o,it)):se(it,es(tt,it))}else{if(dye&&yc(Ce))for(const ct of i.mount){const it=es(s,ct);if(it&&it._f){const zt=Array.isArray(it._f.refs)?it._f.refs[0]:it._f.ref;if(Qte(zt)){const Lt=zt.closest("form");if(Lt){Lt.reset();break}}}}if(Ee.keepFieldsRef)for(const ct of i.mount)se(ct,es(tt,ct));else s={}}o=t.shouldUnregister?Ee.keepDefaultValues?nd(a):{}:nd(tt),v.array.next({values:{...tt}}),v.state.next({values:{...tt}})}i={mount:Ee.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Ee.keepIsValid||!!Ee.keepDirtyValues,l.watch=!!t.shouldUnregister,v.state.next({submitCount:Ee.keepSubmitCount?n.submitCount:0,isDirty:Ke?!1:Ee.keepDirty?n.isDirty:!!(Ee.keepDefaultValues&&!Xx(Ce,a)),isSubmitted:Ee.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Ke?{}:Ee.keepDirtyValues?Ee.keepDefaultValues&&o?aT(a,o):n.dirtyFields:Ee.keepDefaultValues&&Ce?aT(a,Ce):Ee.keepDirty?n.dirtyFields:{},touchedFields:Ee.keepTouched?n.touchedFields:{},errors:Ee.keepErrors?n.errors:{},isSubmitSuccessful:Ee.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},qe=(Ce,Ee)=>le(yp(Ce)?Ce(o):Ce,Ee),Je=(Ce,Ee={})=>{const Ze=es(s,Ce),Le=Ze&&Ze._f;if(Le){const Ke=Le.refs?Le.refs[0]:Le.ref;Ke.focus&&(Ke.focus(),Ee.shouldSelect&&yp(Ke.select)&&Ke.select())}},st=Ce=>{n={...n,...Ce}},ut={control:{register:Ve,unregister:$e,getFieldState:_e,handleSubmit:Oe,setError:ve,_subscribe:Me,_runSchema:V,_focusError:ot,_getWatch:oe,_getDirty:ae,_setValid:k,_setFieldArray:I,_setDisabledField:Be,_setErrors:P,_getFieldArray:pe,_reset:le,_resetDefaultValues:()=>yp(t.defaultValues)&&t.defaultValues().then(Ce=>{qe(Ce,t.resetOptions),v.state.next({isLoading:!1})}),_removeUnmounted:ee,_disableForm:Tt,_subjects:v,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return l},set _state(Ce){l=Ce},get _defaultValues(){return a},get _names(){return i},set _names(Ce){i=Ce},get _formState(){return n},get _options(){return t},set _options(Ce){t={...t,...Ce}}},subscribe:Ie,trigger:xe,register:Ve,handleSubmit:Oe,watch:Xe,setValue:se,getValues:Te,reset:qe,resetField:at,clearErrors:we,unregister:$e,setError:ve,setFocus:Je,getFieldState:_e};return{...ut,formControl:ut}}function Qse(e={}){const t=dt.useRef(void 0),n=dt.useRef(void 0),[s,a]=dt.useState({isDirty:!1,isValidating:!1,isLoading:yp(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:yp(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!yp(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...i}=Gut(e);t.current={...i,formState:s}}const o=t.current.control;return o._options=e,fye(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState}),reRenderRoot:!0});return a(i=>({...i,isReady:!0})),o._formState.isReady=!0,l},[o]),dt.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),dt.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),dt.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),dt.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),dt.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),dt.useEffect(()=>{e.values&&!Xx(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=e.values,a(l=>({...l}))):o._resetDefaultValues()},[o,e.values]),dt.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=lDe(s,o),t.current}const SNe=(e,t,n)=>{if(e&&"reportValidity"in e){const s=es(n,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},xDe=(e,t)=>{for(const n in t.fields){const s=t.fields[n];s&&s.ref&&"reportValidity"in s.ref?SNe(s.ref,n,e):s.refs&&s.refs.forEach(a=>SNe(a,n,e))}},Kut=(e,t)=>{t.shouldUseNativeValidation&&xDe(e,t);const n={};for(const s in e){const a=es(t.fields,s),o=Object.assign(e[s]||{},{ref:a&&a.ref});if(Zut(t.names||Object.keys(e),s)){const l=Object.assign({},es(n,s));To(l,"root",o),To(n,s,l)}else To(n,s,o)}return n},Zut=(e,t)=>e.some(n=>n.startsWith(t+"."));var Yut=function(e,t){for(var n={};e.length;){var s=e[0],a=s.code,o=s.message,l=s.path.join(".");if(!n[l])if("unionErrors"in s){var i=s.unionErrors[0].errors[0];n[l]={message:i.message,type:i.code}}else n[l]={message:o,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(x){return x.errors.forEach(function(y){return e.push(y)})}),t){var u=n[l].types,m=u&&u[s.code];n[l]=dDe(l,t,n,a,m?[].concat(m,s.message):s.message)}e.shift()}return n},Jse=function(e,t,n){return n===void 0&&(n={}),function(s,a,o){try{return Promise.resolve(function(l,i){try{var u=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](s,t)).then(function(m){return o.shouldUseNativeValidation&&xDe({},o),{errors:{},values:n.raw?s:m}})}catch(m){return i(m)}return u&&u.then?u.then(void 0,i):u}(0,function(l){if(function(i){return Array.isArray(i==null?void 0:i.errors)}(l))return{values:{},errors:Kut(Yut(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const eae=Aut,yDe=A.createContext({}),Ol=({...e})=>r.jsx(yDe.Provider,{value:{name:e.name},children:r.jsx(Lut,{...e})}),tae=()=>{const e=A.useContext(yDe),t=A.useContext(vDe),{getFieldState:n,formState:s}=Xse(),a=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`,...a}},vDe=A.createContext({}),Sl=A.forwardRef(({className:e,...t},n)=>{const s=A.useId();return r.jsx(vDe.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:Ut("space-y-2",e),...t})})});Sl.displayName="FormItem";const Cl=A.forwardRef(({className:e,...t},n)=>{const{error:s,formItemId:a}=tae();return r.jsx(ze,{ref:n,className:Ut(s&&"text-destructive",e),htmlFor:a,...t})});Cl.displayName="FormLabel";const Ml=A.forwardRef(({...e},t)=>{const{error:n,formItemId:s,formDescriptionId:a,formMessageId:o}=tae();return r.jsx(Qge,{ref:t,id:s,"aria-describedby":n?`${a} ${o}`:`${a}`,"aria-invalid":!!n,...e})});Ml.displayName="FormControl";const qee=A.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:s}=tae();return r.jsx("p",{ref:n,id:s,className:Ut("text-sm text-muted-foreground",e),...t})});qee.displayName="FormDescription";const Gu=A.forwardRef(({className:e,children:t,...n},s)=>{const{error:a,formMessageId:o}=tae(),l=a?String(a==null?void 0:a.message):t;return l?r.jsx("p",{ref:s,id:o,className:Ut("text-sm font-medium text-destructive",e),...n,children:l}):null});Gu.displayName="FormMessage";const Zn=A.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:Ut("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}));Zn.displayName="Textarea";const Xut=I3({category:R8e(["general","technology","crm","marketing"]),subject:xc().min(5,"Subject must be at least 5 characters").max(200),description:xc().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),Qut={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function bme({trigger:e}){const[t,n]=A.useState(!1),[s,a]=A.useState(!1),{user:o}=tn(),l=Qse({resolver:Jse(Xut),defaultValues:{category:"general",subject:"",description:""}}),i=async u=>{if(!o){Ae.error("You must be logged in to submit a ticket");return}a(!0);try{const{error:m}=await Y.from("support_tickets").insert({user_id:o.id,category:u.category,subject:u.subject,description:u.description});if(m)throw m;try{await Y.functions.invoke("support-ticket-notify",{body:{category:Qut[u.category],subject:u.subject}})}catch(x){console.log("Notification send attempted:",x)}Ae.success("Support ticket submitted successfully!"),l.reset(),n(!1)}catch(m){console.error("Error submitting ticket:",m),Ae.error("Failed to submit ticket. Please try again.")}finally{a(!1)}};return r.jsxs(Rr,{open:t,onOpenChange:n,children:[r.jsx(Fo,{asChild:!0,children:e||r.jsxs(Q,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(hA,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Dr,{className:"sm:max-w-[500px]",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Need Help?"}),r.jsx(Yn,{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(Ai,{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(eae,{...l,children:r.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[r.jsx(Ol,{control:l.control,name:"category",render:({field:u})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Category"}),r.jsxs(un,{onValueChange:u.onChange,defaultValue:u.value,children:[r.jsx(Ml,{children:r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select a category"})})}),r.jsxs(cn,{children:[r.jsx($t,{value:"general",children:"General Support"}),r.jsx($t,{value:"technology",children:"Technology Support"}),r.jsx($t,{value:"crm",children:"CRM Support"}),r.jsx($t,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(Gu,{})]})}),r.jsx(Ol,{control:l.control,name:"subject",render:({field:u})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Subject"}),r.jsx(Ml,{children:r.jsx(lt,{placeholder:"Brief description of your issue",...u})}),r.jsx(Gu,{})]})}),r.jsx(Ol,{control:l.control,name:"description",render:({field:u})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Description"}),r.jsx(Ml,{children:r.jsx(Zn,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...u})}),r.jsx(Gu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function Ts(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 Eo(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Ql(e,t){const n=Ts(e);return isNaN(t)?Eo(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function Fh(e,t){const n=Ts(e);if(isNaN(t))return Eo(e,NaN);if(!t)return n;const s=n.getDate(),a=Eo(e,n.getTime());a.setMonth(n.getMonth()+t+1,0);const o=a.getDate();return s>=o?a:(n.setFullYear(a.getFullYear(),a.getMonth(),s),n)}function _De(e,t){const n=+Ts(e);return Eo(e,n+t)}const xye=6048e5,Jut=864e5,bDe=6e4,wDe=36e5,eht=1e3,iO=43200,CNe=1440;function MNe(e,t){return _De(e,t*wDe)}let tht={};function Mv(){return tht}function Nm(e,t){var i,u,m,x;const n=Mv(),s=(t==null?void 0:t.weekStartsOn)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((x=(m=n.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??0,a=Ts(e),o=a.getDay(),l=(o=a.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Sm(e){const t=Ts(e);return t.setHours(0,0,0,0),t}function gv(e){const t=Ts(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 jp(e,t){const n=Sm(e),s=Sm(t),a=+n-gv(n),o=+s-gv(s);return Math.round((a-o)/Jut)}function rht(e){const t=jDe(e),n=Eo(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Ey(n)}function TNe(e,t){return _De(e,t*bDe)}function oj(e,t){const n=t*7;return Ql(e,n)}function nht(e,t){return Fh(e,t*12)}function sht(e){let t;return e.forEach(function(n){const s=Ts(n);(t===void 0||t{const s=Ts(n);(!t||t>s||isNaN(+s))&&(t=s)}),t||new Date(NaN)}function Vee(e,t){const n=Ts(e),s=Ts(t),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function iht(e){return Eo(e,Date.now())}function ac(e,t){const n=Sm(e),s=Sm(t);return+n==+s}function yye(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function wme(e){if(!yye(e)&&typeof e!="number")return!1;const t=Ts(e);return!isNaN(Number(t))}function DC(e,t){const n=Ts(e),s=Ts(t),a=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return a*12+o}function oht(e,t,n){const s=Nm(e,n),a=Nm(t,n),o=+s-gv(s),l=+a-gv(a);return Math.round((o-l)/xye)}function Iy(e,t){const n=Ts(e),s=Ts(t),a=ANe(n,s),o=Math.abs(jp(n,s));n.setDate(n.getDate()-a*o);const l=+(ANe(n,s)===-a),i=a*(o-l);return i===0?0:i}function ANe(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 lht(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function cht(e,t){return+Ts(e)-+Ts(t)}function dht(e){const t=Ts(e);return t.setHours(23,59,59,999),t}function rae(e){const t=Ts(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function uht(e){const t=Ts(e);return+dht(t)==+rae(t)}function hht(e,t){const n=Ts(e),s=Ts(t),a=Vee(n,s),o=Math.abs(DC(n,s));let l;if(o<1)l=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*o);let i=Vee(n,s)===-a;uht(Ts(e))&&o===1&&Vee(e,s)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function mht(e,t,n){const s=cht(e,t)/1e3;return lht(n==null?void 0:n.roundingMethod)(s)}function Dh(e){const t=Ts(e);return t.setDate(1),t.setHours(0,0,0,0),t}function kDe(e){const t=Ts(e),n=Eo(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function vye(e,t){var i,u,m,x;const n=Mv(),s=(t==null?void 0:t.weekStartsOn)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((x=(m=n.locale)==null?void 0:m.options)==null?void 0:x.weekStartsOn)??0,a=Ts(e),o=a.getDay(),l=(o{let s;const a=fht[e];return typeof a=="string"?s=a:t===1?s=a.one:s=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Uce(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const ght={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xht={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},yht={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},vht={date:Uce({formats:ght,defaultWidth:"full"}),time:Uce({formats:xht,defaultWidth:"full"}),dateTime:Uce({formats:yht,defaultWidth:"full"})},_ht={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},bht=(e,t,n,s)=>_ht[e];function oT(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let a;if(s==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,i=n!=null&&n.width?String(n.width):l;a=e.formattingValues[i]||e.formattingValues[l]}else{const l=e.defaultWidth,i=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[l]}const o=e.argumentCallback?e.argumentCallback(t):t;return a[o]}}const wht={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},jht={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},kht={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"]},Nht={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"]},Sht={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"}},Cht={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"}},Mht=(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"},Tht={ordinalNumber:Mht,era:oT({values:wht,defaultWidth:"wide"}),quarter:oT({values:jht,defaultWidth:"wide",argumentCallback:e=>e-1}),month:oT({values:kht,defaultWidth:"wide"}),day:oT({values:Nht,defaultWidth:"wide"}),dayPeriod:oT({values:Sht,defaultWidth:"wide",formattingValues:Cht,defaultFormattingWidth:"wide"})};function lT(e){return(t,n={})=>{const s=n.width,a=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;const l=o[0],i=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(i)?Eht(i,y=>y.test(l)):Aht(i,y=>y.test(l));let m;m=e.valueCallback?e.valueCallback(u):u,m=n.valueCallback?n.valueCallback(m):m;const x=t.slice(l.length);return{value:m,rest:x}}}function Aht(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Eht(e,t){for(let n=0;n{const s=t.match(e.matchPattern);if(!s)return null;const a=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 i=t.slice(a.length);return{value:l,rest:i}}}const Pht=/^(\d+)(th|st|nd|rd)?/i,Lht=/\d+/i,Oht={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},Dht={any:[/^b/i,/^(a|c)/i]},Rht={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Fht={any:[/1/i,/2/i,/3/i,/4/i]},zht={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},Bht={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]},$ht={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},Uht={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]},qht={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},Vht={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}},Hht={ordinalNumber:Iht({matchPattern:Pht,parsePattern:Lht,valueCallback:e=>parseInt(e,10)}),era:lT({matchPatterns:Oht,defaultMatchWidth:"wide",parsePatterns:Dht,defaultParseWidth:"any"}),quarter:lT({matchPatterns:Rht,defaultMatchWidth:"wide",parsePatterns:Fht,defaultParseWidth:"any",valueCallback:e=>e+1}),month:lT({matchPatterns:zht,defaultMatchWidth:"wide",parsePatterns:Bht,defaultParseWidth:"any"}),day:lT({matchPatterns:$ht,defaultMatchWidth:"wide",parsePatterns:Uht,defaultParseWidth:"any"}),dayPeriod:lT({matchPatterns:qht,defaultMatchWidth:"any",parsePatterns:Vht,defaultParseWidth:"any"})},nae={code:"en-US",formatDistance:pht,formatLong:vht,formatRelative:bht,localize:Tht,match:Hht,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Wht(e){const t=Ts(e);return jp(t,kDe(t))+1}function _ye(e){const t=Ts(e),n=+Ey(t)-+rht(t);return Math.round(n/xye)+1}function bye(e,t){var x,y,v,b;const n=Ts(e),s=n.getFullYear(),a=Mv(),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)??a.firstWeekContainsDate??((b=(v=a.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,l=Eo(e,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const i=Nm(l,t),u=Eo(e,0);u.setFullYear(s,0,o),u.setHours(0,0,0,0);const m=Nm(u,t);return n.getTime()>=i.getTime()?s+1:n.getTime()>=m.getTime()?s:s-1}function Ght(e,t){var i,u,m,x;const n=Mv(),s=(t==null?void 0:t.firstWeekContainsDate)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(m=n.locale)==null?void 0:m.options)==null?void 0:x.firstWeekContainsDate)??1,a=bye(e,t),o=Eo(e,0);return o.setFullYear(a,0,s),o.setHours(0,0,0,0),Nm(o,t)}function wye(e,t){const n=Ts(e),s=+Nm(n,t)-+Ght(n,t);return Math.round(s/xye)+1}function Ao(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const z0={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return Ao(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Ao(n+1,2)},d(e,t){return Ao(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 Ao(e.getHours()%12||12,t.length)},H(e,t){return Ao(e.getHours(),t.length)},m(e,t){return Ao(e.getMinutes(),t.length)},s(e,t){return Ao(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return Ao(a,t.length)}},MS={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ENe={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(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return z0.y(e,t)},Y:function(e,t,n,s){const a=bye(e,s),o=a>0?a:1-a;if(t==="YY"){const l=o%100;return Ao(l,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):Ao(o,t.length)},R:function(e,t){const n=jDe(e);return Ao(n,t.length)},u:function(e,t){const n=e.getFullYear();return Ao(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 Ao(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 Ao(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 z0.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 Ao(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 a=wye(e,s);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):Ao(a,t.length)},I:function(e,t,n){const s=_ye(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):Ao(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):z0.d(e,t)},D:function(e,t,n){const s=Wht(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):Ao(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 a=e.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Ao(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,s){const a=e.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Ao(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const s=e.getDay(),a=s===0?7:s;switch(t){case"i":return String(a);case"ii":return Ao(a,t.length);case"io":return n.ordinalNumber(a,{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 a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const s=e.getHours();let a;switch(s===12?a=MS.noon:s===0?a=MS.midnight:a=s/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const s=e.getHours();let a;switch(s>=17?a=MS.evening:s>=12?a=MS.afternoon:s>=4?a=MS.morning:a=MS.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{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 z0.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):z0.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):Ao(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):Ao(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):z0.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):z0.s(e,t)},S:function(e,t){return z0.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return PNe(s);case"XXXX":case"XX":return Gw(s);case"XXXXX":case"XXX":default:return Gw(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return PNe(s);case"xxxx":case"xx":return Gw(s);case"xxxxx":case"xxx":default:return Gw(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+INe(s,":");case"OOOO":default:return"GMT"+Gw(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+INe(s,":");case"zzzz":default:return"GMT"+Gw(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return Ao(s,t.length)},T:function(e,t,n){const s=e.getTime();return Ao(s,t.length)}};function INe(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Math.trunc(s/60),o=s%60;return o===0?n+String(a):n+String(a)+t+Ao(o,2)}function PNe(e,t){return e%60===0?(e>0?"-":"+")+Ao(Math.abs(e)/60,2):Gw(e,t)}function Gw(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Ao(Math.trunc(s/60),2),o=Ao(s%60,2);return n+a+t+o}const LNe=(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"})}},SDe=(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"})}},Kht=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return LNe(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}}",LNe(s,t)).replace("{{time}}",SDe(a,t))},jme={p:SDe,P:Kht},Zht=/^D+$/,Yht=/^Y+$/,Xht=["D","DD","YY","YYYY"];function CDe(e){return Zht.test(e)}function MDe(e){return Yht.test(e)}function kme(e,t,n){const s=Qht(e,t,n);if(console.warn(s),Xht.includes(e))throw new RangeError(s)}function Qht(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 Jht=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,emt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,tmt=/^'([^]*?)'?$/,rmt=/''/g,nmt=/[a-zA-Z]/;function on(e,t,n){var x,y,v,b,N,k,M,I;const s=Mv(),a=(n==null?void 0:n.locale)??s.locale??nae,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??((b=(v=s.locale)==null?void 0:v.options)==null?void 0:b.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((k=(N=n==null?void 0:n.locale)==null?void 0:N.options)==null?void 0:k.weekStartsOn)??s.weekStartsOn??((I=(M=s.locale)==null?void 0:M.options)==null?void 0:I.weekStartsOn)??0,i=Ts(e);if(!wme(i))throw new RangeError("Invalid time value");let u=t.match(emt).map(T=>{const P=T[0];if(P==="p"||P==="P"){const F=jme[P];return F(T,a.formatLong)}return T}).join("").match(Jht).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const P=T[0];if(P==="'")return{isToken:!1,value:smt(T)};if(ENe[P])return{isToken:!0,value:T};if(P.match(nmt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+P+"`");return{isToken:!1,value:T}});a.localize.preprocessor&&(u=a.localize.preprocessor(i,u));const m={firstWeekContainsDate:o,weekStartsOn:l,locale:a};return u.map(T=>{if(!T.isToken)return T.value;const P=T.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&MDe(P)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&CDe(P))&&kme(P,t,String(e));const F=ENe[P[0]];return F(i,P,a.localize,m)}).join("")}function smt(e){const t=e.match(tmt);return t?t[1].replace(rmt,"'"):e}function amt(e,t,n){const s=Mv(),a=(n==null?void 0:n.locale)??s.locale??nae,o=2520,l=Vee(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:l});let u,m;l>0?(u=Ts(t),m=Ts(e)):(u=Ts(e),m=Ts(t));const x=mht(m,u),y=(gv(m)-gv(u))/1e3,v=Math.round((x-y)/60);let b;if(v<2)return n!=null&&n.includeSeconds?x<5?a.formatDistance("lessThanXSeconds",5,i):x<10?a.formatDistance("lessThanXSeconds",10,i):x<20?a.formatDistance("lessThanXSeconds",20,i):x<40?a.formatDistance("halfAMinute",0,i):x<60?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",1,i):v===0?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",v,i);if(v<45)return a.formatDistance("xMinutes",v,i);if(v<90)return a.formatDistance("aboutXHours",1,i);if(vs.getTime()}function sae(e,t){const n=Ts(e),s=Ts(t);return+n<+s}function hmt(e){return+Ts(e)>Date.now()}function mmt(e,t){const n=t instanceof Date?Eo(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 fmt=10;class TDe{constructor(){Jn(this,"subPriority",0)}validate(t,n){return!0}}class pmt extends TDe{constructor(t,n,s,a,o){super(),this.value=t,this.validateValue=n,this.setValue=s,this.priority=a,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 gmt extends TDe{constructor(){super(...arguments);Jn(this,"priority",fmt);Jn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:Eo(n,mmt(n,Date))}}class wo{run(t,n,s,a){const o=this.parse(t,n,s,a);return o?{setter:new pmt(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,s){return!0}}class xmt extends wo{constructor(){super(...arguments);Jn(this,"priority",140);Jn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,a){switch(s){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})||a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"})}}set(n,s,a){return s.era=a,n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}const wc={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}/},Sg={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 jc(e,t){return e&&{value:t(e.value),rest:e.rest}}function zl(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function Cg(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,a=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*(a*wDe+o*bDe+l*eht),rest:t.slice(n[0].length)}}function ADe(e){return zl(wc.anyDigitsSigned,e)}function lc(e,t){switch(e){case 1:return zl(wc.singleDigit,t);case 2:return zl(wc.twoDigits,t);case 3:return zl(wc.threeDigits,t);case 4:return zl(wc.fourDigits,t);default:return zl(new RegExp("^\\d{1,"+e+"}"),t)}}function rre(e,t){switch(e){case 1:return zl(wc.singleDigitSigned,t);case 2:return zl(wc.twoDigitsSigned,t);case 3:return zl(wc.threeDigitsSigned,t);case 4:return zl(wc.fourDigitsSigned,t);default:return zl(new RegExp("^-?\\d{1,"+e+"}"),t)}}function jye(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 EDe(e,t){const n=t>0,s=n?t:1-t;let a;if(s<=50)a=e||100;else{const o=s+50,l=Math.trunc(o/100)*100,i=e>=o%100;a=e+l-(i?100:0)}return n?a:1-a}function IDe(e){return e%400===0||e%4===0&&e%100!==0}class ymt extends wo{constructor(){super(...arguments);Jn(this,"priority",130);Jn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,a){const o=l=>({year:l,isTwoDigitYear:s==="yy"});switch(s){case"y":return jc(lc(4,n),o);case"yo":return jc(a.ordinalNumber(n,{unit:"year"}),o);default:return jc(lc(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a){const o=n.getFullYear();if(a.isTwoDigitYear){const i=EDe(a.year,o);return n.setFullYear(i,0,1),n.setHours(0,0,0,0),n}const l=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(l,0,1),n.setHours(0,0,0,0),n}}class vmt extends wo{constructor(){super(...arguments);Jn(this,"priority",130);Jn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,a){const o=l=>({year:l,isTwoDigitYear:s==="YY"});switch(s){case"Y":return jc(lc(4,n),o);case"Yo":return jc(a.ordinalNumber(n,{unit:"year"}),o);default:return jc(lc(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a,o){const l=bye(n,o);if(a.isTwoDigitYear){const u=EDe(a.year,l);return n.setFullYear(u,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Nm(n,o)}const i=!("era"in s)||s.era===1?a.year:1-a.year;return n.setFullYear(i,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Nm(n,o)}}class _mt extends wo{constructor(){super(...arguments);Jn(this,"priority",130);Jn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return rre(s==="R"?4:s.length,n)}set(n,s,a){const o=Eo(n,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),Ey(o)}}class bmt extends wo{constructor(){super(...arguments);Jn(this,"priority",130);Jn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return rre(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class wmt extends wo{constructor(){super(...arguments);Jn(this,"priority",120);Jn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"Q":case"QQ":return lc(s.length,n);case"Qo":return a.ordinalNumber(n,{unit:"quarter"});case"QQQ":return a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return a.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return a.quarter(n,{width:"wide",context:"formatting"})||a.quarter(n,{width:"abbreviated",context:"formatting"})||a.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class jmt extends wo{constructor(){super(...arguments);Jn(this,"priority",120);Jn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"q":case"qq":return lc(s.length,n);case"qo":return a.ordinalNumber(n,{unit:"quarter"});case"qqq":return a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return a.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return a.quarter(n,{width:"wide",context:"standalone"})||a.quarter(n,{width:"abbreviated",context:"standalone"})||a.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=1&&s<=4}set(n,s,a){return n.setMonth((a-1)*3,1),n.setHours(0,0,0,0),n}}class kmt extends wo{constructor(){super(...arguments);Jn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Jn(this,"priority",110)}parse(n,s,a){const o=l=>l-1;switch(s){case"M":return jc(zl(wc.month,n),o);case"MM":return jc(lc(2,n),o);case"Mo":return jc(a.ordinalNumber(n,{unit:"month"}),o);case"MMM":return a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return a.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return a.month(n,{width:"wide",context:"formatting"})||a.month(n,{width:"abbreviated",context:"formatting"})||a.month(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}class Nmt extends wo{constructor(){super(...arguments);Jn(this,"priority",110);Jn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,a){const o=l=>l-1;switch(s){case"L":return jc(zl(wc.month,n),o);case"LL":return jc(lc(2,n),o);case"Lo":return jc(a.ordinalNumber(n,{unit:"month"}),o);case"LLL":return a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return a.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return a.month(n,{width:"wide",context:"standalone"})||a.month(n,{width:"abbreviated",context:"standalone"})||a.month(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.setMonth(a,1),n.setHours(0,0,0,0),n}}function Smt(e,t,n){const s=Ts(e),a=wye(s,n)-t;return s.setDate(s.getDate()-a*7),s}class Cmt extends wo{constructor(){super(...arguments);Jn(this,"priority",100);Jn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return zl(wc.week,n);case"wo":return a.ordinalNumber(n,{unit:"week"});default:return lc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a,o){return Nm(Smt(n,a,o),o)}}function Mmt(e,t){const n=Ts(e),s=_ye(n)-t;return n.setDate(n.getDate()-s*7),n}class Tmt extends wo{constructor(){super(...arguments);Jn(this,"priority",100);Jn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,a){switch(s){case"I":return zl(wc.week,n);case"Io":return a.ordinalNumber(n,{unit:"week"});default:return lc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a){return Ey(Mmt(n,a))}}const Amt=[31,28,31,30,31,30,31,31,30,31,30,31],Emt=[31,29,31,30,31,30,31,31,30,31,30,31];class Imt extends wo{constructor(){super(...arguments);Jn(this,"priority",90);Jn(this,"subPriority",1);Jn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return zl(wc.date,n);case"do":return a.ordinalNumber(n,{unit:"date"});default:return lc(s.length,n)}}validate(n,s){const a=n.getFullYear(),o=IDe(a),l=n.getMonth();return o?s>=1&&s<=Emt[l]:s>=1&&s<=Amt[l]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class Pmt extends wo{constructor(){super(...arguments);Jn(this,"priority",90);Jn(this,"subpriority",1);Jn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,a){switch(s){case"D":case"DD":return zl(wc.dayOfYear,n);case"Do":return a.ordinalNumber(n,{unit:"date"});default:return lc(s.length,n)}}validate(n,s){const a=n.getFullYear();return IDe(a)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,a){return n.setMonth(0,a),n.setHours(0,0,0,0),n}}function kye(e,t,n){var y,v,b,N;const s=Mv(),a=(n==null?void 0:n.weekStartsOn)??((v=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:v.weekStartsOn)??s.weekStartsOn??((N=(b=s.locale)==null?void 0:b.options)==null?void 0:N.weekStartsOn)??0,o=Ts(e),l=o.getDay(),u=(t%7+7)%7,m=7-a,x=t<0||t>6?t-(l+m)%7:(u+m)%7-(l+m)%7;return Ql(o,x)}class Lmt extends wo{constructor(){super(...arguments);Jn(this,"priority",90);Jn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=kye(n,a,o),n.setHours(0,0,0,0),n}}class Omt extends wo{constructor(){super(...arguments);Jn(this,"priority",90);Jn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,a,o){const l=i=>{const u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(s){case"e":case"ee":return jc(lc(s.length,n),l);case"eo":return jc(a.ordinalNumber(n,{unit:"day"}),l);case"eee":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeeee":return a.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=kye(n,a,o),n.setHours(0,0,0,0),n}}class Dmt extends wo{constructor(){super(...arguments);Jn(this,"priority",90);Jn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,a,o){const l=i=>{const u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(s){case"c":case"cc":return jc(lc(s.length,n),l);case"co":return jc(a.ordinalNumber(n,{unit:"day"}),l);case"ccc":return a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"ccccc":return a.day(n,{width:"narrow",context:"standalone"});case"cccccc":return a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return a.day(n,{width:"wide",context:"standalone"})||a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=kye(n,a,o),n.setHours(0,0,0,0),n}}function Rmt(e,t){const n=Ts(e),s=lmt(n),a=t-s;return Ql(n,a)}class Fmt extends wo{constructor(){super(...arguments);Jn(this,"priority",90);Jn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,a){const o=l=>l===0?7:l;switch(s){case"i":case"ii":return lc(s.length,n);case"io":return a.ordinalNumber(n,{unit:"day"});case"iii":return jc(a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o);case"iiiii":return jc(a.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return jc(a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return jc(a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o)}}validate(n,s){return s>=1&&s<=7}set(n,s,a){return n=Rmt(n,a),n.setHours(0,0,0,0),n}}class zmt extends wo{constructor(){super(...arguments);Jn(this,"priority",80);Jn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,a){switch(s){case"a":case"aa":case"aaa":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(jye(a),0,0,0),n}}class Bmt extends wo{constructor(){super(...arguments);Jn(this,"priority",80);Jn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,a){switch(s){case"b":case"bb":case"bbb":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(jye(a),0,0,0),n}}class $mt extends wo{constructor(){super(...arguments);Jn(this,"priority",80);Jn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,a){switch(s){case"B":case"BB":case"BBB":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(jye(a),0,0,0),n}}class Umt extends wo{constructor(){super(...arguments);Jn(this,"priority",70);Jn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return zl(wc.hour12h,n);case"ho":return a.ordinalNumber(n,{unit:"hour"});default:return lc(s.length,n)}}validate(n,s){return s>=1&&s<=12}set(n,s,a){const o=n.getHours()>=12;return o&&a<12?n.setHours(a+12,0,0,0):!o&&a===12?n.setHours(0,0,0,0):n.setHours(a,0,0,0),n}}class qmt extends wo{constructor(){super(...arguments);Jn(this,"priority",70);Jn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return zl(wc.hour23h,n);case"Ho":return a.ordinalNumber(n,{unit:"hour"});default:return lc(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,a){return n.setHours(a,0,0,0),n}}class Vmt extends wo{constructor(){super(...arguments);Jn(this,"priority",70);Jn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return zl(wc.hour11h,n);case"Ko":return a.ordinalNumber(n,{unit:"hour"});default:return lc(s.length,n)}}validate(n,s){return s>=0&&s<=11}set(n,s,a){return n.getHours()>=12&&a<12?n.setHours(a+12,0,0,0):n.setHours(a,0,0,0),n}}class Hmt extends wo{constructor(){super(...arguments);Jn(this,"priority",70);Jn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return zl(wc.hour24h,n);case"ko":return a.ordinalNumber(n,{unit:"hour"});default:return lc(s.length,n)}}validate(n,s){return s>=1&&s<=24}set(n,s,a){const o=a<=24?a%24:a;return n.setHours(o,0,0,0),n}}class Wmt extends wo{constructor(){super(...arguments);Jn(this,"priority",60);Jn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return zl(wc.minute,n);case"mo":return a.ordinalNumber(n,{unit:"minute"});default:return lc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setMinutes(a,0,0),n}}class Gmt extends wo{constructor(){super(...arguments);Jn(this,"priority",50);Jn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return zl(wc.second,n);case"so":return a.ordinalNumber(n,{unit:"second"});default:return lc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setSeconds(a,0),n}}class Kmt extends wo{constructor(){super(...arguments);Jn(this,"priority",30);Jn(this,"incompatibleTokens",["t","T"])}parse(n,s){const a=o=>Math.trunc(o*Math.pow(10,-s.length+3));return jc(lc(s.length,n),a)}set(n,s,a){return n.setMilliseconds(a),n}}class Zmt extends wo{constructor(){super(...arguments);Jn(this,"priority",10);Jn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return Cg(Sg.basicOptionalMinutes,n);case"XX":return Cg(Sg.basic,n);case"XXXX":return Cg(Sg.basicOptionalSeconds,n);case"XXXXX":return Cg(Sg.extendedOptionalSeconds,n);case"XXX":default:return Cg(Sg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:Eo(n,n.getTime()-gv(n)-a)}}class Ymt extends wo{constructor(){super(...arguments);Jn(this,"priority",10);Jn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return Cg(Sg.basicOptionalMinutes,n);case"xx":return Cg(Sg.basic,n);case"xxxx":return Cg(Sg.basicOptionalSeconds,n);case"xxxxx":return Cg(Sg.extendedOptionalSeconds,n);case"xxx":default:return Cg(Sg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:Eo(n,n.getTime()-gv(n)-a)}}class Xmt extends wo{constructor(){super(...arguments);Jn(this,"priority",40);Jn(this,"incompatibleTokens","*")}parse(n){return ADe(n)}set(n,s,a){return[Eo(n,a*1e3),{timestampIsSet:!0}]}}class Qmt extends wo{constructor(){super(...arguments);Jn(this,"priority",20);Jn(this,"incompatibleTokens","*")}parse(n){return ADe(n)}set(n,s,a){return[Eo(n,a),{timestampIsSet:!0}]}}const Jmt={G:new xmt,y:new ymt,Y:new vmt,R:new _mt,u:new bmt,Q:new wmt,q:new jmt,M:new kmt,L:new Nmt,w:new Cmt,I:new Tmt,d:new Imt,D:new Pmt,E:new Lmt,e:new Omt,c:new Dmt,i:new Fmt,a:new zmt,b:new Bmt,B:new $mt,h:new Umt,H:new qmt,K:new Vmt,k:new Hmt,m:new Wmt,s:new Gmt,S:new Kmt,X:new Zmt,x:new Ymt,t:new Xmt,T:new Qmt},eft=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,tft=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,rft=/^'([^]*?)'?$/,nft=/''/g,sft=/\S/,aft=/[a-zA-Z]/;function Nye(e,t,n,s){var k,M,I,T;const a=omt(),o=a.locale??nae,l=a.firstWeekContainsDate??((M=(k=a.locale)==null?void 0:k.options)==null?void 0:M.firstWeekContainsDate)??1,i=a.weekStartsOn??((T=(I=a.locale)==null?void 0:I.options)==null?void 0:T.weekStartsOn)??0;if(t==="")return e===""?Ts(n):Eo(n,NaN);const u={firstWeekContainsDate:l,weekStartsOn:i,locale:o},m=[new gmt],x=t.match(tft).map(P=>{const F=P[0];if(F in jme){const D=jme[F];return D(P,o.formatLong)}return P}).join("").match(eft),y=[];for(let P of x){MDe(P)&&kme(P,t,e),CDe(P)&&kme(P,t,e);const F=P[0],D=Jmt[F];if(D){const{incompatibleTokens:U}=D;if(Array.isArray(U)){const W=y.find(G=>U.includes(G.token)||G.token===F);if(W)throw new RangeError(`The format string mustn't contain \`${W.fullToken}\` and \`${P}\` at the same time`)}else if(D.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${P}\` and any other token at the same time`);y.push({token:F,fullToken:P});const V=D.run(e,P,o.match,u);if(!V)return Eo(n,NaN);m.push(V.setter),e=V.rest}else{if(F.match(aft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+F+"`");if(P==="''"?P="'":F==="'"&&(P=ift(P)),e.indexOf(P)===0)e=e.slice(P.length);else return Eo(n,NaN)}}if(e.length>0&&sft.test(e))return Eo(n,NaN);const v=m.map(P=>P.priority).sort((P,F)=>F-P).filter((P,F,D)=>D.indexOf(P)===F).map(P=>m.filter(F=>F.priority===P).sort((F,D)=>D.subPriority-F.subPriority)).map(P=>P[0]);let b=Ts(n);if(isNaN(b.getTime()))return Eo(n,NaN);const N={};for(const P of v){if(!P.validate(b,u))return Eo(n,NaN);const F=P.set(b,N,u);Array.isArray(F)?(b=F[0],Object.assign(N,F[1])):b=F}return Eo(n,b)}function ift(e){return e.match(rft)[1].replace(nft,"'")}function oft(e){return+Ts(e)o-l);return n>=s&&n<=a}function qce(e,t){return Ql(e,-t)}function Vce(e,t){const n=Ts(e),s=n.getFullYear(),a=n.getDate(),o=Eo(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=imt(o);return n.setMonth(t,Math.min(a,l)),n}function PDe(e,t){const n=Ts(e);return n.setHours(t),n}function LDe(e,t){const n=Ts(e);return n.setMinutes(t),n}function RNe(e,t){const n=Ts(e);return isNaN(+n)?Eo(e,NaN):(n.setFullYear(t),n)}function cft(e,t){return Fh(e,-12)}const dft=()=>{const{user:e}=tn(),t=Vn(),[n,s]=A.useState([]),[a,o]=A.useState(0),[l,i]=A.useState(!1),[u,m]=A.useState(null);A.useEffect(()=>{if(!e)return;const N=`notification_last_read_${e.id}`;let k=u;if(!k){const T=localStorage.getItem(N);T&&(k=T,m(T))}(async()=>{const{data:T,error:P}=await Y.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!P&&T){s(T);const F=k?new Date(k):null,D=T.filter(U=>F?new Date(U.created_at)>F:!0);o(D.length)}})();const I=Y.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},T=>{const P=T.new;s(D=>[P,...D].slice(0,20));const F=k?new Date(k):null;(!F||new Date(P.created_at)>F)&&o(D=>D+1),Notification.permission==="granted"&&new Notification(P.title,{body:P.body,icon:"/favicon.ico"})}).subscribe();return()=>{Y.removeChannel(I)}},[e,u]);const x=N=>{const k=N.toLowerCase();return k.includes("community")||k.includes("post")?Ro:k.includes("academy")||k.includes("video")?Ia:k.includes("template")?Vc:k.includes("event")?Cs:k.includes("newsletter")?fy:k.includes("brokerage")?Oh:k.includes("swag")||k.includes("social")?ao:k.includes("toolbox")||k.includes("tool")?yy:k.includes("brief")?Os:Ro},y=N=>{i(!1),N.url&&N.url!=="/"&&t(N.url)},v=()=>{if(!e)return;const N=new Date().toISOString(),k=`notification_last_read_${e.id}`;localStorage.setItem(k,N),m(N),o(0)},b=N=>{i(N),N&&a>0&&v()};return r.jsxs(lh,{open:l,onOpenChange:b,children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(Dg,{className:"h-5 w-5"}),a>0&&r.jsx(At,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:a>9?"9+":a})]})}),r.jsxs(Nu,{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(Q,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:v,children:"Mark all read"})]}),r.jsx(Vo,{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 k=x(N.title);return r.jsxs(Va,{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(k,{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:bu(new Date(N.created_at),{addSuffix:!0})})]})]},N.id)})})]})]})};var FNe=1,uft=.9,hft=.8,mft=.17,Hce=.1,Wce=.999,fft=.9999,pft=.99,gft=/[\\\/_+.#"@\[\(\{&]/,xft=/[\\\/_+.#"@\[\(\{&]/g,yft=/[\s-]/,ODe=/[\s-]/g;function Nme(e,t,n,s,a,o,l){if(o===t.length)return a===e.length?FNe:pft;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var u=s.charAt(o),m=n.indexOf(u,a),x=0,y,v,b,N;m>=0;)y=Nme(e,t,n,s,m+1,o+1,l),y>x&&(m===a?y*=FNe:gft.test(e.charAt(m-1))?(y*=hft,b=e.slice(a,m-1).match(xft),b&&a>0&&(y*=Math.pow(Wce,b.length))):yft.test(e.charAt(m-1))?(y*=uft,N=e.slice(a,m-1).match(ODe),N&&a>0&&(y*=Math.pow(Wce,N.length))):(y*=mft,a>0&&(y*=Math.pow(Wce,m-a))),e.charAt(m)!==t.charAt(o)&&(y*=fft)),(yy&&(y=v*Hce)),y>x&&(x=y),m=n.indexOf(u,m+1);return l[i]=x,x}function zNe(e){return e.toLowerCase().replace(ODe," ")}function vft(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Nme(e,t,zNe(e),zNe(t),0,0,{})}var cT='[cmdk-group=""]',Gce='[cmdk-group-items=""]',_ft='[cmdk-group-heading=""]',DDe='[cmdk-item=""]',BNe=`${DDe}:not([aria-disabled="true"])`,Sme="cmdk-item-select",$S="data-value",bft=(e,t,n)=>vft(e,t,n),RDe=A.createContext(void 0),dP=()=>A.useContext(RDe),FDe=A.createContext(void 0),Cye=()=>A.useContext(FDe),zDe=A.createContext(void 0),BDe=A.forwardRef((e,t)=>{let n=US(()=>{var we,ve;return{search:"",value:(ve=(we=e.value)!=null?we:e.defaultValue)!=null?ve:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=US(()=>new Set),a=US(()=>new Map),o=US(()=>new Map),l=US(()=>new Set),i=$De(e),{label:u,children:m,value:x,onValueChange:y,filter:v,shouldFilter:b,loop:N,disablePointerSelection:k=!1,vimBindings:M=!0,...I}=e,T=pd(),P=pd(),F=pd(),D=A.useRef(null),U=Ift();uk(()=>{if(x!==void 0){let we=x.trim();n.current.value=we,V.emit()}},[x]),uk(()=>{U(6,pe)},[]);let V=A.useMemo(()=>({subscribe:we=>(l.current.add(we),()=>l.current.delete(we)),snapshot:()=>n.current,setState:(we,ve,Xe)=>{var Me,Ie,$e,Be;if(!Object.is(n.current[we],ve)){if(n.current[we]=ve,we==="search")oe(),ee(),U(1,ae);else if(we==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ve=document.getElementById(F);Ve?Ve.focus():(Me=document.getElementById(T))==null||Me.focus()}if(U(7,()=>{var Ve;n.current.selectedItemId=(Ve=ne())==null?void 0:Ve.id,V.emit()}),Xe||U(5,pe),((Ie=i.current)==null?void 0:Ie.value)!==void 0){let Ve=ve??"";(Be=($e=i.current).onValueChange)==null||Be.call($e,Ve);return}}V.emit()}},emit:()=>{l.current.forEach(we=>we())}}),[]),W=A.useMemo(()=>({value:(we,ve,Xe)=>{var Me;ve!==((Me=o.current.get(we))==null?void 0:Me.value)&&(o.current.set(we,{value:ve,keywords:Xe}),n.current.filtered.items.set(we,G(ve,Xe)),U(2,()=>{ee(),V.emit()}))},item:(we,ve)=>(s.current.add(we),ve&&(a.current.has(ve)?a.current.get(ve).add(we):a.current.set(ve,new Set([we]))),U(3,()=>{oe(),ee(),n.current.value||ae(),V.emit()}),()=>{o.current.delete(we),s.current.delete(we),n.current.filtered.items.delete(we);let Xe=ne();U(4,()=>{oe(),(Xe==null?void 0:Xe.getAttribute("id"))===we&&ae(),V.emit()})}),group:we=>(a.current.has(we)||a.current.set(we,new Set),()=>{o.current.delete(we),a.current.delete(we)}),filter:()=>i.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:T,inputId:F,labelId:P,listInnerRef:D}),[]);function G(we,ve){var Xe,Me;let Ie=(Me=(Xe=i.current)==null?void 0:Xe.filter)!=null?Me:bft;return we?Ie(we,n.current.search,ve):0}function ee(){if(!n.current.search||i.current.shouldFilter===!1)return;let we=n.current.filtered.items,ve=[];n.current.filtered.groups.forEach(Me=>{let Ie=a.current.get(Me),$e=0;Ie.forEach(Be=>{let Ve=we.get(Be);$e=Math.max(Ve,$e)}),ve.push([Me,$e])});let Xe=D.current;fe().sort((Me,Ie)=>{var $e,Be;let Ve=Me.getAttribute("id"),ot=Ie.getAttribute("id");return(($e=we.get(ot))!=null?$e:0)-((Be=we.get(Ve))!=null?Be:0)}).forEach(Me=>{let Ie=Me.closest(Gce);Ie?Ie.appendChild(Me.parentElement===Ie?Me:Me.closest(`${Gce} > *`)):Xe.appendChild(Me.parentElement===Xe?Me:Me.closest(`${Gce} > *`))}),ve.sort((Me,Ie)=>Ie[1]-Me[1]).forEach(Me=>{var Ie;let $e=(Ie=D.current)==null?void 0:Ie.querySelector(`${cT}[${$S}="${encodeURIComponent(Me[0])}"]`);$e==null||$e.parentElement.appendChild($e)})}function ae(){let we=fe().find(Xe=>Xe.getAttribute("aria-disabled")!=="true"),ve=we==null?void 0:we.getAttribute($S);V.setState("value",ve||void 0)}function oe(){var we,ve,Xe,Me;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Ie=0;for(let $e of s.current){let Be=(ve=(we=o.current.get($e))==null?void 0:we.value)!=null?ve:"",Ve=(Me=(Xe=o.current.get($e))==null?void 0:Xe.keywords)!=null?Me:[],ot=G(Be,Ve);n.current.filtered.items.set($e,ot),ot>0&&Ie++}for(let[$e,Be]of a.current)for(let Ve of Be)if(n.current.filtered.items.get(Ve)>0){n.current.filtered.groups.add($e);break}n.current.filtered.count=Ie}function pe(){var we,ve,Xe;let Me=ne();Me&&(((we=Me.parentElement)==null?void 0:we.firstChild)===Me&&((Xe=(ve=Me.closest(cT))==null?void 0:ve.querySelector(_ft))==null||Xe.scrollIntoView({block:"nearest"})),Me.scrollIntoView({block:"nearest"}))}function ne(){var we;return(we=D.current)==null?void 0:we.querySelector(`${DDe}[aria-selected="true"]`)}function fe(){var we;return Array.from(((we=D.current)==null?void 0:we.querySelectorAll(BNe))||[])}function se(we){let ve=fe()[we];ve&&V.setState("value",ve.getAttribute($S))}function me(we){var ve;let Xe=ne(),Me=fe(),Ie=Me.findIndex(Be=>Be===Xe),$e=Me[Ie+we];(ve=i.current)!=null&&ve.loop&&($e=Ie+we<0?Me[Me.length-1]:Ie+we===Me.length?Me[0]:Me[Ie+we]),$e&&V.setState("value",$e.getAttribute($S))}function ue(we){let ve=ne(),Xe=ve==null?void 0:ve.closest(cT),Me;for(;Xe&&!Me;)Xe=we>0?Aft(Xe,cT):Eft(Xe,cT),Me=Xe==null?void 0:Xe.querySelector(BNe);Me?V.setState("value",Me.getAttribute($S)):me(we)}let xe=()=>se(fe().length-1),Te=we=>{we.preventDefault(),we.metaKey?xe():we.altKey?ue(1):me(1)},_e=we=>{we.preventDefault(),we.metaKey?se(0):we.altKey?ue(-1):me(-1)};return A.createElement(Fn.div,{ref:t,tabIndex:-1,...I,"cmdk-root":"",onKeyDown:we=>{var ve;(ve=I.onKeyDown)==null||ve.call(I,we);let Xe=we.nativeEvent.isComposing||we.keyCode===229;if(!(we.defaultPrevented||Xe))switch(we.key){case"n":case"j":{M&&we.ctrlKey&&Te(we);break}case"ArrowDown":{Te(we);break}case"p":case"k":{M&&we.ctrlKey&&_e(we);break}case"ArrowUp":{_e(we);break}case"Home":{we.preventDefault(),se(0);break}case"End":{we.preventDefault(),xe();break}case"Enter":{we.preventDefault();let Me=ne();if(Me){let Ie=new Event(Sme);Me.dispatchEvent(Ie)}}}}},A.createElement("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Lft},u),aae(e,we=>A.createElement(FDe.Provider,{value:V},A.createElement(RDe.Provider,{value:W},we))))}),wft=A.forwardRef((e,t)=>{var n,s;let a=pd(),o=A.useRef(null),l=A.useContext(zDe),i=dP(),u=$De(e),m=(s=(n=u.current)==null?void 0:n.forceMount)!=null?s:l==null?void 0:l.forceMount;uk(()=>{if(!m)return i.item(a,l==null?void 0:l.id)},[m]);let x=UDe(a,o,[e.value,e.children,o],e.keywords),y=Cye(),v=xv(U=>U.value&&U.value===x.current),b=xv(U=>m||i.filter()===!1?!0:U.search?U.filtered.items.get(a)>0:!0);A.useEffect(()=>{let U=o.current;if(!(!U||e.disabled))return U.addEventListener(Sme,N),()=>U.removeEventListener(Sme,N)},[b,e.onSelect,e.disabled]);function N(){var U,V;k(),(V=(U=u.current).onSelect)==null||V.call(U,x.current)}function k(){y.setState("value",x.current,!0)}if(!b)return null;let{disabled:M,value:I,onSelect:T,forceMount:P,keywords:F,...D}=e;return A.createElement(Fn.div,{ref:My(o,t),...D,id:a,"cmdk-item":"",role:"option","aria-disabled":!!M,"aria-selected":!!v,"data-disabled":!!M,"data-selected":!!v,onPointerMove:M||i.getDisablePointerSelection()?void 0:k,onClick:M?void 0:N},e.children)}),jft=A.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:a,...o}=e,l=pd(),i=A.useRef(null),u=A.useRef(null),m=pd(),x=dP(),y=xv(b=>a||x.filter()===!1?!0:b.search?b.filtered.groups.has(l):!0);uk(()=>x.group(l),[]),UDe(l,i,[e.value,e.heading,u]);let v=A.useMemo(()=>({id:l,forceMount:a}),[a]);return A.createElement(Fn.div,{ref:My(i,t),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&A.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:m},n),aae(e,b=>A.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?m:void 0},A.createElement(zDe.Provider,{value:v},b))))}),kft=A.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,a=A.useRef(null),o=xv(l=>!l.search);return!n&&!o?null:A.createElement(Fn.div,{ref:My(a,t),...s,"cmdk-separator":"",role:"separator"})}),Nft=A.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,a=e.value!=null,o=Cye(),l=xv(m=>m.search),i=xv(m=>m.selectedItemId),u=dP();return A.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),A.createElement(Fn.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":i,id:u.inputId,type:"text",value:a?e.value:l,onChange:m=>{a||o.setState("search",m.target.value),n==null||n(m.target.value)}})}),Sft=A.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...a}=e,o=A.useRef(null),l=A.useRef(null),i=xv(m=>m.selectedItemId),u=dP();return A.useEffect(()=>{if(l.current&&o.current){let m=l.current,x=o.current,y,v=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let b=m.offsetHeight;x.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return v.observe(m),()=>{cancelAnimationFrame(y),v.unobserve(m)}}},[]),A.createElement(Fn.div,{ref:My(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":s,id:u.listId},aae(e,m=>A.createElement("div",{ref:My(l,u.listInnerRef),"cmdk-list-sizer":""},m)))}),Cft=A.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:a,contentClassName:o,container:l,...i}=e;return A.createElement(Lse,{open:n,onOpenChange:s},A.createElement(Ose,{container:l},A.createElement(T3,{"cmdk-overlay":"",className:a}),A.createElement(A3,{"aria-label":e.label,"cmdk-dialog":"",className:o},A.createElement(BDe,{ref:t,...i}))))}),Mft=A.forwardRef((e,t)=>xv(n=>n.filtered.count===0)?A.createElement(Fn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Tft=A.forwardRef((e,t)=>{let{progress:n,children:s,label:a="Loading...",...o}=e;return A.createElement(Fn.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},aae(e,l=>A.createElement("div",{"aria-hidden":!0},l)))}),zh=Object.assign(BDe,{List:Sft,Item:wft,Input:Nft,Group:jft,Separator:kft,Dialog:Cft,Empty:Mft,Loading:Tft});function Aft(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Eft(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function $De(e){let t=A.useRef(e);return uk(()=>{t.current=e}),t}var uk=typeof window>"u"?A.useEffect:A.useLayoutEffect;function US(e){let t=A.useRef();return t.current===void 0&&(t.current=e()),t}function xv(e){let t=Cye(),n=()=>e(t.snapshot());return A.useSyncExternalStore(t.subscribe,n,n)}function UDe(e,t,n,s=[]){let a=A.useRef(),o=dP();return uk(()=>{var l;let i=(()=>{var m;for(let x of n){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(m=x.current.textContent)==null?void 0:m.trim():a.current}})(),u=s.map(m=>m.trim());o.value(e,i,u),(l=t.current)==null||l.setAttribute($S,i),a.current=i}),a}var Ift=()=>{let[e,t]=A.useState(),n=US(()=>new Map);return uk(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,a)=>{n.current.set(s,a),t({})}};function Pft(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function aae({asChild:e,children:t},n){return e&&A.isValidElement(t)?A.cloneElement(Pft(t),{ref:t.ref},n(t.props.children)):n(t)}var Lft={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Py=A.forwardRef(({className:e,...t},n)=>r.jsx(zh,{ref:n,className:Ut("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Py.displayName=zh.displayName;const Oft=({children:e,...t})=>r.jsx(Rr,{...t,children:r.jsx(Dr,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(Py,{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})})}),Ly=A.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(ma,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(zh.Input,{ref:n,className:Ut("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})]}));Ly.displayName=zh.Input.displayName;const Oy=A.forwardRef(({className:e,...t},n)=>r.jsx(zh.List,{ref:n,className:Ut("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Oy.displayName=zh.List.displayName;const Dy=A.forwardRef((e,t)=>r.jsx(zh.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Dy.displayName=zh.Empty.displayName;const Ry=A.forwardRef(({className:e,...t},n)=>r.jsx(zh.Group,{ref:n,className:Ut("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}));Ry.displayName=zh.Group.displayName;const Dft=A.forwardRef(({className:e,...t},n)=>r.jsx(zh.Separator,{ref:n,className:Ut("-mx-1 h-px bg-border",e),...t}));Dft.displayName=zh.Separator.displayName;const Fy=A.forwardRef(({className:e,...t},n)=>r.jsx(zh.Item,{ref:n,className:Ut("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}));Fy.displayName=zh.Item.displayName;const Rft={event:{label:"Events",icon:Tp,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Vc,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:W1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:yy,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Os,color:"bg-fuchsia-500/10 text-fuchsia-600"}},$Ne=()=>{const[e,t]=A.useState(!1),[n,s]=A.useState(""),[a,o]=A.useState([]),[l,i]=A.useState(!1),u=Vn();A.useEffect(()=>{const v=b=>{b.key==="k"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),t(N=>!N))};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[]);const m=A.useCallback(async v=>{if(!v.trim()){o([]);return}i(!0);const b=`%${v}%`;try{const[N,k,M,I,T]=await Promise.all([Y.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5),Y.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${b},description.ilike.${b}`).limit(5),Y.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5),Y.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${b},description.ilike.${b}`).limit(5),Y.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5)]),P=[];N.data&&N.data.forEach(F=>{P.push({id:F.id,title:F.title,description:F.description,type:"event",date:F.event_date,path:`/event/${F.id}`})}),k.data&&k.data.forEach(F=>{P.push({id:F.id,title:F.name,description:F.description,type:"template",date:F.publish_date,path:`/templates/${F.id}`})}),M.data&&M.data.forEach(F=>{P.push({id:F.id,title:F.title,description:F.description,type:"academy",date:F.publish_date,path:`/academy/${F.id}`})}),I.data&&I.data.forEach(F=>{P.push({id:F.id,title:F.name,description:F.description,type:"toolbox",date:F.publish_date,path:`/toolbox/${F.id}`})}),T.data&&T.data.forEach(F=>{P.push({id:F.id,title:F.title,description:F.description,type:"social-swag",date:F.publish_date,path:`/social-swag/${F.id}`})}),o(P)}catch(N){console.error("Search error:",N)}finally{i(!1)}},[]);A.useEffect(()=>{const v=setTimeout(()=>{m(n)},300);return()=>clearTimeout(v)},[n,m]);const x=v=>{t(!1),s(""),u(v)},y=a.reduce((v,b)=>(v[b.type]||(v[b.type]=[]),v[b.type].push(b),v),{});return r.jsxs(r.Fragment,{children:[r.jsxs(Q,{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(ma,{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(Oft,{open:e,onOpenChange:t,children:[r.jsx(Ly,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(Oy,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&a.length===0&&r.jsxs(Dy,{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(([v,b])=>{const N=Rft[v],k=N.icon;return r.jsx(Ry,{heading:N.label,children:b.map(M=>r.jsxs(Fy,{value:`${M.type}-${M.id}-${M.title}`,onSelect:()=>x(M.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(k,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:M.title}),M.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:M.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(At,{variant:"secondary",className:"text-xs",children:N.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:bu(new Date(M.date),{addSuffix:!0})})]})]},`${M.type}-${M.id}`))},v)})]})]})]})},Fft=({expiresAt:e,className:t,showUpgradeButton:n=!0})=>{const[s,a]=A.useState(null),o=Vn();if(A.useEffect(()=>{const m=()=>{const y=new Date().getTime(),b=new Date(e).getTime()-y;if(b<=0){a({days:0,hours:0,minutes:0});return}const N=Math.floor(b/(1e3*60*60*24)),k=Math.floor(b%(1e3*60*60*24)/(1e3*60*60)),M=Math.floor(b%(1e3*60*60)/(1e3*60));a({days:N,hours:k,minutes:M})};m();const x=setInterval(m,6e4);return()=>clearInterval(x)},[e]),!s)return null;const l=s.days===0&&s.hours===0&&s.minutes===0,i=s.days<=1,u=s.days<=3&&!i;return l?r.jsxs("div",{className:Ut("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(Nh,{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(Q,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Os,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):r.jsxs("div",{className:Ut("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",i?"bg-destructive/10 border-destructive/20":u?"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(Xa,{className:Ut("h-4 w-4",i?"text-destructive":u?"text-amber-500":"text-primary")}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:Ut("text-sm font-medium",i?"text-destructive":u?"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:Ut("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:Ut("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:Ut("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:Ut("text-xs",i?"text-destructive/70":u?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(Q,{size:"sm",onClick:()=>o("/subscription"),variant:i?"destructive":u?"default":"outline",className:Ut("text-xs h-7 px-3",u&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(Os,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},zft=()=>{const e=Vn();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(He,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Ht,{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(Nh,{className:"h-8 w-8 text-destructive"})}),r.jsx(Gt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(jn,{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(et,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(He,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(et,{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($n,{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(Q,{className:"w-full",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(He,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(et,{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(hi,{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(Q,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(hi,{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(Ai,{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(ws,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Bft=({hasUnseenBrief:e,onClick:t,className:n})=>r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsxs(Q,{variant:"ghost",size:"icon",onClick:t,className:Ut("relative transition-colors",e&&"text-primary hover:text-primary",n),children:[r.jsx(Ep,{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(Pp,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var iae="Checkbox",[$ft]=cc(iae),[Uft,Mye]=$ft(iae);function qft(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:a,disabled:o,form:l,name:i,onCheckedChange:u,required:m,value:x="on",internal_do_not_use_render:y}=e,[v,b]=rh({prop:n,defaultProp:a??!1,onChange:u,caller:iae}),[N,k]=A.useState(null),[M,I]=A.useState(null),T=A.useRef(!1),P=N?!!l||!!N.closest("form"):!0,F={checked:v,disabled:o,setChecked:b,control:N,setControl:k,name:i,form:l,value:x,hasConsumerStoppedPropagationRef:T,required:m,defaultChecked:rv(a)?!1:a,isFormControl:P,bubbleInput:M,setBubbleInput:I};return r.jsx(Uft,{scope:t,...F,children:Vft(y)?y(F):s})}var qDe="CheckboxTrigger",VDe=A.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},a)=>{const{control:o,value:l,disabled:i,checked:u,required:m,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:v,isFormControl:b,bubbleInput:N}=Mye(qDe,e),k=ca(a,x),M=A.useRef(u);return A.useEffect(()=>{const I=o==null?void 0:o.form;if(I){const T=()=>y(M.current);return I.addEventListener("reset",T),()=>I.removeEventListener("reset",T)}},[o,y]),r.jsx(Fn.button,{type:"button",role:"checkbox","aria-checked":rv(u)?"mixed":u,"aria-required":m,"data-state":ZDe(u),"data-disabled":i?"":void 0,disabled:i,value:l,...s,ref:k,onKeyDown:gn(t,I=>{I.key==="Enter"&&I.preventDefault()}),onClick:gn(n,I=>{y(T=>rv(T)?!0:!T),N&&b&&(v.current=I.isPropagationStopped(),v.current||I.stopPropagation())})})});VDe.displayName=qDe;var Tye=A.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:u,onCheckedChange:m,form:x,...y}=e;return r.jsx(qft,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:i,required:l,onCheckedChange:m,name:s,form:x,value:u,internal_do_not_use_render:({isFormControl:v})=>r.jsxs(r.Fragment,{children:[r.jsx(VDe,{...y,ref:t,__scopeCheckbox:n}),v&&r.jsx(KDe,{__scopeCheckbox:n})]})})});Tye.displayName=iae;var HDe="CheckboxIndicator",WDe=A.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...a}=e,o=Mye(HDe,n);return r.jsx(Ac,{present:s||rv(o.checked)||o.checked===!0,children:r.jsx(Fn.span,{"data-state":ZDe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});WDe.displayName=HDe;var GDe="CheckboxBubbleInput",KDe=A.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:i,disabled:u,name:m,value:x,form:y,bubbleInput:v,setBubbleInput:b}=Mye(GDe,e),N=ca(n,b),k=oP(o),M=KI(s);A.useEffect(()=>{const T=v;if(!T)return;const P=window.HTMLInputElement.prototype,D=Object.getOwnPropertyDescriptor(P,"checked").set,U=!a.current;if(k!==o&&D){const V=new Event("click",{bubbles:U});T.indeterminate=rv(o),D.call(T,rv(o)?!1:o),T.dispatchEvent(V)}},[v,k,o,a]);const I=A.useRef(rv(o)?!1:o);return r.jsx(Fn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??I.current,required:i,disabled:u,name:m,value:x,form:y,...t,tabIndex:-1,ref:N,style:{...t.style,...M,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});KDe.displayName=GDe;function Vft(e){return typeof e=="function"}function rv(e){return e==="indeterminate"}function ZDe(e){return rv(e)?"indeterminate":e?"checked":"unchecked"}const _l=A.forwardRef(({className:e,...t},n)=>r.jsx(Tye,{ref:n,className:Ut("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(WDe,{className:Ut("flex items-center justify-center text-current"),children:r.jsx(mi,{className:"h-4 w-4"})})}));_l.displayName=Tye.displayName;var Aye="Radio",[Hft,YDe]=cc(Aye),[Wft,Gft]=Hft(Aye),XDe=A.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:a=!1,required:o,disabled:l,value:i="on",onCheck:u,form:m,...x}=e,[y,v]=A.useState(null),b=ca(t,M=>v(M)),N=A.useRef(!1),k=y?m||!!y.closest("form"):!0;return r.jsxs(Wft,{scope:n,checked:a,disabled:l,children:[r.jsx(Fn.button,{type:"button",role:"radio","aria-checked":a,"data-state":tRe(a),"data-disabled":l?"":void 0,disabled:l,value:i,...x,ref:b,onClick:gn(e.onClick,M=>{a||u==null||u(),k&&(N.current=M.isPropagationStopped(),N.current||M.stopPropagation())})}),k&&r.jsx(eRe,{control:y,bubbles:!N.current,name:s,value:i,checked:a,required:o,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});XDe.displayName=Aye;var QDe="RadioIndicator",JDe=A.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...a}=e,o=Gft(QDe,n);return r.jsx(Ac,{present:s||o.checked,children:r.jsx(Fn.span,{"data-state":tRe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t})})});JDe.displayName=QDe;var Kft="RadioBubbleInput",eRe=A.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:s=!0,...a},o)=>{const l=A.useRef(null),i=ca(l,o),u=oP(n),m=KI(t);return A.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==n&&b){const N=new Event("click",{bubbles:s});b.call(x,n),x.dispatchEvent(N)}},[u,n,s]),r.jsx(Fn.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});eRe.displayName=Kft;function tRe(e){return e?"checked":"unchecked"}var Zft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],oae="RadioGroup",[Yft]=cc(oae,[M3,YDe]),rRe=M3(),nRe=YDe(),[Xft,Qft]=Yft(oae),sRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,defaultValue:a,value:o,required:l=!1,disabled:i=!1,orientation:u,dir:m,loop:x=!0,onValueChange:y,...v}=e,b=rRe(n),N=Mk(m),[k,M]=rh({prop:o,defaultProp:a??null,onChange:y,caller:oae});return r.jsx(Xft,{scope:n,name:s,required:l,disabled:i,value:k,onValueChange:M,children:r.jsx(Dxe,{asChild:!0,...b,orientation:u,dir:N,loop:x,children:r.jsx(Fn.div,{role:"radiogroup","aria-required":l,"aria-orientation":u,"data-disabled":i?"":void 0,dir:N,...v,ref:t})})})});sRe.displayName=oae;var aRe="RadioGroupItem",iRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:s,...a}=e,o=Qft(aRe,n),l=o.disabled||s,i=rRe(n),u=nRe(n),m=A.useRef(null),x=ca(t,m),y=o.value===a.value,v=A.useRef(!1);return A.useEffect(()=>{const b=k=>{Zft.includes(k.key)&&(v.current=!0)},N=()=>v.current=!1;return document.addEventListener("keydown",b),document.addEventListener("keyup",N),()=>{document.removeEventListener("keydown",b),document.removeEventListener("keyup",N)}},[]),r.jsx(Rxe,{asChild:!0,...i,focusable:!l,active:y,children:r.jsx(XDe,{disabled:l,required:o.required,checked:y,...u,...a,name:o.name,ref:x,onCheck:()=>o.onValueChange(a.value),onKeyDown:gn(b=>{b.key==="Enter"&&b.preventDefault()}),onFocus:gn(a.onFocus,()=>{var b;v.current&&((b=m.current)==null||b.click())})})})});iRe.displayName=aRe;var Jft="RadioGroupIndicator",oRe=A.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,a=nRe(n);return r.jsx(JDe,{...a,...s,ref:t})});oRe.displayName=Jft;var lRe=sRe,cRe=iRe,ept=oRe;const dRe=A.forwardRef(({className:e,...t},n)=>r.jsx(lRe,{className:Ut("grid gap-2",e),...t,ref:n}));dRe.displayName=lRe.displayName;const uRe=A.forwardRef(({className:e,...t},n)=>r.jsx(cRe,{ref:n,className:Ut("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(ept,{className:"flex items-center justify-center",children:r.jsx(Ju,{className:"h-2.5 w-2.5 fill-current text-current"})})}));uRe.displayName=cRe.displayName;const tpt=({brief:e,open:t,onClose:n,onDismiss:s})=>{const{user:a}=tn(),[o,l]=A.useState({}),[i,u]=A.useState({}),[m,x]=A.useState([]);A.useEffect(()=>{t&&a&&e.polls.length>0&&y()},[t,a,e.polls]);const y=async()=>{if(!a)return;const M=e.polls.map(T=>T.id),{data:I}=await Y.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",a.id).in("poll_id",M);if(I){const T={};I.forEach(P=>{T[P.poll_id]||(T[P.poll_id]=[]),T[P.poll_id].push(P.option_id)}),u(T)}},v=(M,I)=>{l(T=>({...T,[M]:I}))},b=(M,I,T)=>{l(P=>{const F=P[M]||[];return T?{...P,[M]:[...F,I]}:{...P,[M]:F.filter(D=>D!==I)}})},N=async M=>{if(!a)return;const I=o[M];if(!I||Array.isArray(I)&&I.length===0){Ae.error("Please select an option");return}x(T=>[...T,M]);try{await Y.from("levelup_brief_poll_responses").delete().eq("poll_id",M).eq("user_id",a.id);const T=Array.isArray(I)?I:[I],P=T.map(D=>({poll_id:M,option_id:D,user_id:a.id})),{error:F}=await Y.from("levelup_brief_poll_responses").insert(P);if(F)throw F;u(D=>({...D,[M]:T})),Ae.success("Response submitted!")}catch(T){console.error("Error submitting poll response:",T),Ae.error("Failed to submit response")}finally{x(T=>T.filter(P=>P!==M))}},k=M=>(M.includes("mediadelivery.net")||M.includes("bunny"),M);return r.jsx(Rr,{open:t,onOpenChange:M=>!M&&n(),children:r.jsxs(Dr,{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(ds,{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(Ep,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(At,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(Br,{className:"text-xl font-bold text-white",children:e.brief.title})]})]})]}),r.jsx(Vo,{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:k(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(M=>r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>window.open(M.url,"_blank"),className:"gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),M.title]},M.id))})]}),e.polls.map(M=>{var P,F;const I=((P=i[M.id])==null?void 0:P.length)>0,T=m.includes(M.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:M.question}),I&&r.jsxs(At,{variant:"secondary",className:"gap-1",children:[r.jsx(no,{className:"h-3 w-3"}),"Responded"]})]}),M.poll_type==="single"?r.jsx(dRe,{value:o[M.id]||((F=i[M.id])==null?void 0:F[0])||"",onValueChange:D=>v(M.id,D),className:"space-y-2",children:M.options.map(D=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(uRe,{value:D.id,id:D.id}),r.jsx(ze,{htmlFor:D.id,className:"cursor-pointer",children:D.option_text})]},D.id))}):r.jsx("div",{className:"space-y-2",children:M.options.map(D=>{const V=(o[M.id]||i[M.id]||[]).includes(D.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(_l,{id:D.id,checked:V,onCheckedChange:W=>b(M.id,D.id,W)}),r.jsx(ze,{htmlFor:D.id,className:"cursor-pointer",children:D.option_text})]},D.id)})}),r.jsx(Q,{size:"sm",onClick:()=>N(M.id),disabled:T,children:T?"Submitting...":I?"Update Response":"Submit"})]},M.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(Q,{onClick:n,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"})]})]})})},rpt=()=>{const{user:e}=tn(),[t,n]=A.useState(null),[s,a]=A.useState(!1),[o,l]=A.useState(!0),[i,u]=A.useState(!1),m=A.useCallback(async()=>{if(!e){l(!1);return}try{const{data:N,error:k}=await Y.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(k||!N){l(!1);return}const{data:M}=await Y.from("levelup_brief_views").select("*").eq("brief_id",N.id).eq("user_id",e.id).maybeSingle(),[I,T]=await Promise.all([Y.from("levelup_brief_links").select("*").eq("brief_id",N.id).order("sort_order"),Y.from("levelup_brief_polls").select("*").eq("brief_id",N.id).order("sort_order")]),P=[];if(T.data)for(const V of T.data){const{data:W}=await Y.from("levelup_brief_poll_options").select("*").eq("poll_id",V.id).order("sort_order");P.push({...V,options:W||[]})}const F={brief:N,links:I.data||[],polls:P};n(F);const D=!!M,U=(M==null?void 0:M.dismissed_at)!==null;if(!D)a(!0),u(!0);else if(N.show_frequency==="every_login"&&!U)a(!0),u(!0);else if(N.show_frequency==="daily"){const V=new Date(M.viewed_at);(new Date().getTime()-V.getTime())/(1e3*60*60)>=24&&!U&&(a(!0),u(!0))}else u(!U)}catch(N){console.error("Error fetching brief:",N)}finally{l(!1)}},[e]);A.useEffect(()=>{m()},[m]);const x=async()=>{if(!(!e||!t))try{const{data:N}=await Y.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();N?await Y.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",N.id):await Y.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:i,loading:o,openBrief:()=>{a(!0)},closeBrief:()=>{a(!1),x()},dismissBrief:async()=>{if(!(!e||!t))try{const{data:N}=await Y.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();N?await Y.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",N.id):await Y.from("levelup_brief_views").insert({brief_id:t.brief.id,user_id:e.id,dismissed_at:new Date().toISOString()}),a(!1),u(!1)}catch(N){console.error("Error dismissing brief:",N)}},refetch:m}};function npt(){const[e,t]=A.useState(!1),[n,s]=A.useState(!1),[a,o]=A.useState(null);A.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 v=b=>{b.preventDefault(),o(b)};return window.addEventListener("beforeinstallprompt",v),()=>{window.removeEventListener("beforeinstallprompt",v)}},[]);const l=()=>{localStorage.setItem("install-banner-dismissed","true"),t(!1)},i=async()=>{if(a){await a.prompt();const{outcome:u}=await a.userChoice;u==="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(so,{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(jA,{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&&a&&r.jsx(Q,{size:"sm",variant:"secondary",onClick:i,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(ds,{className:"h-4 w-4"})})]})]})}):null}const spt=({children:e,onRefresh:t})=>{const[n,s]=A.useState(!1),[a,o]=A.useState(0),[l,i]=A.useState(!1),u=A.useRef(null),m=A.useRef(0),x=Vr(),y=80,v=120,b=A.useCallback(T=>{const P=u.current;P&&P.scrollTop<=0&&(m.current=T.touches[0].clientY,s(!0))},[]),N=A.useCallback(T=>{if(!n||l)return;const P=u.current;if(!P||P.scrollTop>0){s(!1),o(0);return}const D=T.touches[0].clientY-m.current;if(D>0){const V=Math.min(D*.5,v);o(V),V>10&&T.preventDefault()}},[n,l]),k=A.useCallback(async()=>{if(n)if(s(!1),a>=y&&!l){i(!0),o(y);try{t?await t():await x.invalidateQueries()}catch(T){console.error("Refresh failed:",T)}finally{i(!1),o(0)}}else o(0)},[n,a,l,t,x]),M=Math.min(a/y,1),I=M*180;return r.jsxs("div",{ref:u,className:"h-full overflow-auto",onTouchStart:b,onTouchMove:N,onTouchEnd:k,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:a>0?a:0,opacity:M},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${l?"animate-spin":""}`,style:{transform:l?void 0:`rotate(${I}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:r.jsx(Go,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:a>0?`translateY(${Math.max(0,a-60)}px)`:void 0,transition:n?void 0:"transform 0.2s ease-out"},children:e})]})},hRe=()=>{const{user:e}=tn(),[t,n]=A.useState(!1),[s,a]=A.useState(!1),[o,l]=A.useState(0),[i,u]=A.useState(!0);A.useEffect(()=>{(async()=>{if(!e){u(!1);return}try{const{data:b}=await Y.from("membership_reviews").select("id").eq("user_id",e.id).maybeSingle();if(b){a(!0),n(!1),u(!1);return}const{data:N}=await Y.from("profiles").select("login_count").eq("id",e.id).single(),k=(N==null?void 0:N.login_count)||0;l(k);const M=sessionStorage.getItem("review-prompt-dismissed");n(k>=4&&!M)}catch(b){console.error("Error checking review eligibility:",b)}finally{u(!1)}})()},[e]);const m=A.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=A.useCallback(async(v,b)=>{if(!e)return{success:!1,error:"Not authenticated"};try{const{error:N}=await Y.from("membership_reviews").insert({user_id:e.id,rating:v,review_text:b});if(N)throw N;return a(!0),n(!1),{success:!0,pointsAwarded:25}}catch(N){return console.error("Error submitting review:",N),{success:!1,error:N.message}}},[e]),y=A.useCallback(async()=>{if(e)try{await Y.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",e.id)}catch(v){console.error("Error updating Google review status:",v)}},[e]);return{shouldShowPrompt:t,hasSubmittedReview:s,loginCount:o,isLoading:i,dismissPrompt:m,submitReview:x,markPostedToGoogle:y}},apt="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",ipt=()=>{const{shouldShowPrompt:e,isLoading:t,dismissPrompt:n,submitReview:s,markPostedToGoogle:a}=hRe(),[o,l]=A.useState(!1),[i,u]=A.useState("review"),[m,x]=A.useState(0),[y,v]=A.useState(0),[b,N]=A.useState(""),[k,M]=A.useState(!1),[I,T]=A.useState(!1);if(t||!e&&!I)return null;const P=async()=>{if(m===0){Sa({title:"Please select a rating",variant:"destructive"});return}M(!0);const U=await s(m,b);M(!1),U.success?(T(!0),Sa({title:"Thank you for your feedback!",description:"Your review helps us improve."}),u("google")):Sa({title:"Error submitting review",description:U.error,variant:"destructive"})},F=async U=>{U&&(await navigator.clipboard.writeText(b||`${m} star rating for LevelUp!`),Sa({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(apt,"_blank")),l(!1),n()},D=()=>{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(ks,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Rr,{open:o,onOpenChange:D,children:r.jsx(Dr,{className:"sm:max-w-md",children:i==="review"?r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsx(Br,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(Yn,{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(U=>r.jsx("button",{type:"button",onClick:()=>x(U),onMouseEnter:()=>v(U),onMouseLeave:()=>v(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(ks,{className:Ut("h-8 w-8 transition-colors",(y||m)>=U?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},U))}),r.jsx(Zn,{placeholder:"Tell us about your experience (optional)",value:b,onChange:U=>N(U.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{variant:"outline",onClick:D,className:"flex-1",children:"Maybe Later"}),r.jsx(Q,{onClick:P,disabled:k||m===0,className:"flex-1",children:k?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsx(Br,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(Yn,{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(Q,{variant:"outline",onClick:()=>F(!1),className:"flex-1",children:"No Thanks"}),r.jsx(Q,{onClick:()=>F(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function opt(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(n),a=new Uint8Array(s.length);for(let o=0;o{if(!y){l(!1);return}(async()=>{try{const k="vapid_public_key";let M=localStorage.getItem(k);if(!M){const{data:P,error:F}=await Y.functions.invoke("get-vapid-public-key",{body:{}});if(F)throw F;if(M=(P==null?void 0:P.vapidPublicKey)??null,!M)throw new Error("Missing VAPID public key");localStorage.setItem(k,M)}x(M);const I=await navigator.serviceWorker.register("/push-sw.js");u(I),n(Notification.permission);const T=await I.pushManager.getSubscription();a(!!T)}catch(k){console.error("Error initializing push notifications:",k)}finally{l(!1)}})()},[y]);const v=A.useCallback(async()=>{if(!y||!i||!e)return console.error("Push notifications not supported or user not logged in"),!1;if(!m)return Ae.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const N=await i.pushManager.getSubscription();if(N){try{await N.unsubscribe()}catch(F){console.warn("Failed to unsubscribe existing push subscription:",F)}const{error:P}=await Y.from("push_subscriptions").delete().eq("user_id",e.id);P&&console.warn("Failed to cleanup push_subscriptions rows:",P)}if(Notification.permission!=="granted"){const P=await Notification.requestPermission();if(n(P),P!=="granted")return P==="denied"?Ae.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):Ae.error("Notification permission was dismissed. Please try again."),!1}const k=opt(m);let M;try{M=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:k})}catch(P){console.error("PushManager.subscribe() failed:",P);const F=(P==null?void 0:P.message)||String(P);return F.includes("permission")?Ae.error("Push permission denied. Check your browser notification settings."):F.includes("key")||F.includes("VAPID")?Ae.error("Push configuration error. Please contact support."):F.includes("AbortError")?Ae.error("Push subscription was cancelled. Please try again."):Ae.error(`Failed to subscribe: ${F}`),!1}const I=M.toJSON(),{error:T}=await Y.from("push_subscriptions").upsert({user_id:e.id,endpoint:I.endpoint,p256dh_key:I.keys.p256dh,auth_key:I.keys.auth},{onConflict:"user_id,endpoint"});if(T)throw console.error("Error saving subscription:",T),Ae.error("Failed to save notification preferences. Please try again."),T;return a(!0),Ae.success("Push notifications enabled!"),!0}catch(N){if(console.error("Error subscribing to push notifications:",N),!(N instanceof Error&&N.message.includes("toast"))){const k=N instanceof Error?N.message:"Unknown error";Ae.error("Failed to enable push notifications: "+k)}return!1}finally{l(!1)}},[y,i,e,m]),b=A.useCallback(async()=>{if(!i||!e)return!1;try{l(!0);const N=await i.pushManager.getSubscription();return N&&await N.unsubscribe(),await Y.from("push_subscriptions").delete().eq("user_id",e.id),a(!1),Ae.success("Push notifications disabled"),!0}catch(N){console.error("Error unsubscribing:",N);const k=N instanceof Error?N.message:"Unknown error";return Ae.error("Failed to disable push notifications: "+k),!1}finally{l(!1)}},[i,e]);return{isSupported:y,permission:t,isSubscribed:s,isLoading:o,vapidPublicKey:m,subscribe:v,unsubscribe:b}}const UNe="push_notification_prompt_dismissed",lpt=()=>{const{user:e}=tn(),{isSupported:t,isSubscribed:n,isLoading:s,subscribe:a}=mRe(),[o,l]=A.useState(!1),[i,u]=A.useState(!1);A.useEffect(()=>{if(!e||!t||n||s||localStorage.getItem(`${UNe}_${e.id}`))return;const v=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(v)},[e,t,n,s]);const m=async()=>{u(!0);const y=await a();u(!1),y&&l(!1)},x=()=>{e&&localStorage.setItem(`${UNe}_${e.id}`,"true"),l(!1)};return!t||n?null:r.jsx(Rr,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsxs($r,{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(Dg,{className:"h-6 w-6 text-primary"})}),r.jsx(Br,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(Yn,{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(Q,{onClick:m,disabled:i,className:"w-full",children:i?"Enabling...":"Enable Notifications"}),r.jsx(Q,{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."})]})})},qNe=e=>{let t;const n=new Set,s=(m,x)=>{const y=typeof m=="function"?m(t):m;if(!Object.is(y,t)){const v=t;t=x??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(b=>b(t,v))}},a=()=>t,i={setState:s,getState:a,getInitialState:()=>u,subscribe:m=>(n.add(m),()=>n.delete(m))},u=t=e(s,a,i);return i},cpt=e=>e?qNe(e):qNe,dpt=e=>e;function upt(e,t=dpt){const n=dt.useSyncExternalStore(e.subscribe,dt.useCallback(()=>t(e.getState()),[e,t]),dt.useCallback(()=>t(e.getInitialState()),[e,t]));return dt.useDebugValue(n),n}const hpt=e=>{const t=cpt(e),n=s=>upt(t,s);return Object.assign(n,t),n},mpt=e=>hpt;function fpt(e,t){let n;try{n=e()}catch{return}return{getItem:a=>{var o;const l=u=>u===null?null:JSON.parse(u,void 0),i=(o=n.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>n.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>n.removeItem(a)}}const Cme=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return Cme(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Cme(s)(n)}}}},ppt=(e,t)=>(n,s,a)=>{let o={storage:fpt(()=>localStorage),partialize:k=>k,version:0,merge:(k,M)=>({...M,...k}),...t},l=!1;const i=new Set,u=new Set;let m=o.storage;if(!m)return e((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...k)},s,a);const x=()=>{const k=o.partialize({...s()});return m.setItem(o.name,{state:k,version:o.version})},y=a.setState;a.setState=(k,M)=>(y(k,M),x());const v=e((...k)=>(n(...k),x()),s,a);a.getInitialState=()=>v;let b;const N=()=>{var k,M;if(!m)return;l=!1,i.forEach(T=>{var P;return T((P=s())!=null?P:v)});const I=((M=o.onRehydrateStorage)==null?void 0:M.call(o,(k=s())!=null?k:v))||void 0;return Cme(m.getItem.bind(m))(o.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==o.version){if(o.migrate){const P=o.migrate(T.state,T.version);return P instanceof Promise?P.then(F=>[!0,F]):[!0,P]}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 P;const[F,D]=T;if(b=o.merge(D,(P=s())!=null?P:v),n(b,!0),F)return x()}).then(()=>{I==null||I(b,void 0),b=s(),l=!0,u.forEach(T=>T(b))}).catch(T=>{I==null||I(void 0,T)})};return a.persist={setOptions:k=>{o={...o,...k},k.storage&&(m=k.storage)},clearStorage:()=>{m==null||m.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>N(),hasHydrated:()=>l,onHydrate:k=>(i.add(k),()=>{i.delete(k)}),onFinishHydration:k=>(u.add(k),()=>{u.delete(k)})},o.skipHydration||N(),b||v},gpt=ppt,lae=mpt()(gpt((e,t)=>({cartItems:[],addToCart:(n,s,a=1,o)=>{e(l=>{const i=l.cartItems.findIndex(u=>{var m;return u.product.id===n.id&&((m=u.variant)==null?void 0:m.id)===(s==null?void 0:s.id)});if(i>=0){const u=[...l.cartItems];return u[i].quantity+=a,o&&(u[i].artworkUrl=o),{cartItems:u}}return{cartItems:[...l.cartItems,{product:n,variant:s,quantity:a,artworkUrl:o}]}})},removeFromCart:(n,s)=>{e(a=>({cartItems:a.cartItems.filter(o=>{var l;return!(o.product.id===n&&((l=o.variant)==null?void 0:l.id)===s)})}))},updateQuantity:(n,s,a)=>{e(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===n&&((i=l.variant)==null?void 0:i.id)===s?{...l,quantity:Math.max(1,a)}:l})}))},updateArtwork:(n,s,a)=>{e(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===n&&((i=l.variant)==null?void 0:i.id)===s?{...l,artworkUrl:a}:l})}))},clearCart:()=>e({cartItems:[]}),getItemPrice:n=>{const s=Number(n.product.base_price),a=n.variant?Number(n.variant.price_adjustment):0;return s+a},getSubtotal:()=>{const{cartItems:n,getItemPrice:s}=t();return n.reduce((a,o)=>a+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=t();return n.reduce((s,a)=>s+Number(a.product.shipping_fee)*a.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=t();return n()+s()}}),{name:"marketplace-cart",partialize:e=>({cartItems:e.cartItems})})),fRe=A.createContext({onlineUsers:[],totalOnline:0}),xpt=async e=>{try{const{data:t}=await Y.storage.from("avatars").list(`${e}`);if(t&&t.length>0){const{data:n}=Y.storage.from("avatars").getPublicUrl(`${e}/${t[0].name}`);return n.publicUrl}}catch{}},ypt=({children:e})=>{const{user:t,brokerageId:n,isAdmin:s}=tn(),[a,o]=A.useState([]),[l,i]=A.useState(null);A.useEffect(()=>{if(!t)return;const m=Y.channel("app-presence",{config:{presence:{key:t.id}}});return m.on("presence",{event:"sync"},()=>{const x=m.presenceState(),y=[];Object.entries(x).forEach(([v,b])=>{if(b&&b.length>0){const N=b[0];y.push({id:v,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:v}=await Y.from("profiles").select("name, brokerage_id").eq("id",t.id).single(),b=await xpt(t.id);await m.track({name:(v==null?void 0:v.name)||((y=t.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:b,brokerageId:v==null?void 0:v.brokerage_id,onlineSince:new Date().toISOString()})}}),i(m),()=>{m.unsubscribe()}},[t]);const u=a.filter(m=>m.id===(t==null?void 0:t.id)?!1:!!(s||n&&m.brokerageId===n||!n&&!m.brokerageId));return r.jsx(fRe.Provider,{value:{onlineUsers:u,totalOnline:a.length},children:e})},pRe=()=>A.useContext(fRe),VNe="dashboard-sidebar-collapsed",Fr=({children:e,title:t})=>{var Xe,Me,Ie;const{user:n,signOut:s,isAdmin:a,isBrokerageManager:o,brokerageId:l}=tn(),{isAssistant:i,actingAsAgent:u}=Lxe(),{isImpersonating:m}=Pxe(),y=(i&&!!u?40:0)+(m?40:0),{avatarUrl:v}=F8e(n==null?void 0:n.id),{isTrial:b,isExpired:N,expiresAt:k}=sut(n==null?void 0:n.id),{isMarketplaceEnabled:M}=B8e(),{currentBrief:I,shouldShowPopup:T,hasUnseenBrief:P,openBrief:F,closeBrief:D,dismissBrief:U}=rpt(),{unreadCount:V}=aut(),{openCount:W}=iut(),ee=lae($e=>$e.cartItems).reduce(($e,Be)=>$e+Be.quantity,0),ae=Vn(),oe=wf(),[pe,ne]=A.useState(()=>typeof window<"u"?localStorage.getItem(VNe)==="true":!1);A.useEffect(()=>{localStorage.setItem(VNe,String(pe))},[pe]);const[fe,se]=A.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),me=$e=>{se(Be=>({...Be,[$e]:!Be[$e]}))},ue=$e=>$e.split(" ").map(Be=>Be[0]).join("").toUpperCase().slice(0,2),xe=$e=>oe.pathname===$e,Te=$e=>$e.some(Be=>oe.pathname===Be),_e=({path:$e,icon:Be,label:Ve,badgeCount:ot})=>{const Tt=r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",xe($e)&&"bg-sidebar-accent text-sidebar-accent-foreground",pe?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>ae($e),children:[r.jsxs("div",{className:"relative",children:[r.jsx(Be,{className:"h-4 w-4 shrink-0"}),pe&&ot!=null&&ot>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-muted-foreground/40 border border-background"})]}),!pe&&Ve,!pe&&ot!=null&&ot>0&&r.jsx("span",{className:"ml-auto flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:ot>9?"9+":ot})]});return pe?r.jsxs(Wg,{delayDuration:0,children:[r.jsx(Gg,{asChild:!0,children:Tt}),r.jsxs(Pp,{side:"right",className:"flex items-center gap-2",children:[Ve,ot!=null&&ot>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:ot>9?"9+":ot})]})]}):Tt},we=({id:$e,label:Be,icon:Ve,children:ot,activePaths:Tt,showBetaBadge:Oe,defaultPath:at,badgeCount:le})=>{if(pe){const qe=at||Tt[0];return r.jsxs(Wg,{delayDuration:0,children:[r.jsx(Gg,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"sm",className:Ut("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",Te(Tt)&&"text-primary"),onClick:()=>ae(qe),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ve,{className:"h-4 w-4"}),le!=null&&le>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-muted-foreground/40 border border-background"})]})})}),r.jsxs(Pp,{side:"right",className:"flex items-center gap-2",children:[Be,Oe&&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"}),le!=null&&le>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:le>9?"9+":le})]})]})}return r.jsxs(W4,{open:fe[$e],onOpenChange:()=>me($e),children:[r.jsx(G4,{asChild:!0,children:r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",Te(Tt)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(Ve,{className:"h-4 w-4"}),Be,Oe&&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:[le!=null&&le>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:le>9?"9+":le}),r.jsx(Rd,{className:Ut("h-4 w-4 transition-transform duration-200",fe[$e]&&"rotate-180")})]})]})}),r.jsx(K4,{className:"pl-4 space-y-1 mt-1",children:ot})]})},ve=({isMobile:$e=!1})=>{const Be=$e?!1:pe;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:Ut("p-3 border-b border-sidebar-border",Be?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[Be?r.jsx("img",{src:Cut,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:fNe,alt:"LevelUp",className:"h-8 w-auto"}),!$e&&r.jsxs(Wg,{delayDuration:0,children:[r.jsx(Gg,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>ne(!Be),children:r.jsx(kc,{className:Ut("h-4 w-4 transition-transform duration-300",Be&&"rotate-180")})})}),r.jsx(Pp,{side:"right",children:Be?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(Vo,{className:"flex-1",children:r.jsxs("nav",{className:Ut("p-3 space-y-1",Be&&"flex flex-col items-center"),children:[r.jsx(_e,{path:"/dashboard",icon:Fj,label:"Dashboard"}),r.jsx(_e,{path:"/events",icon:Tp,label:"Events"}),r.jsxs(we,{id:"agentos",label:"Agent OS",icon:w4,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(_e,{path:"/mission-control",icon:vi,label:"Mission Control"}),r.jsx(_e,{path:"/mission-control/contacts",icon:$n,label:"Contacts"}),r.jsx(_e,{path:"/mission-control/plans",icon:Tp,label:"TouchPlans"}),r.jsx(_e,{path:"/mission-control/pipeline",icon:hy,label:"Deal Pipeline"}),r.jsx(_e,{path:"/mission-control/popbys",icon:ao,label:"Popbys"}),r.jsx(_e,{path:"/mission-control/video-library",icon:Ia,label:"Video Library"}),r.jsx(_e,{path:"/mission-control/scorecard",icon:_c,label:"Scorecard"}),r.jsx(_e,{path:"/mission-control/listings",icon:hi,label:"Listing Exchange"})]}),r.jsxs(we,{id:"tools",label:"Tools",icon:tm,activePaths:["/apps","/ai-toolkit","/mission-control/my-card","/mission-control/presentations"],defaultPath:"/apps",children:[r.jsx(_e,{path:"/apps",icon:tm,label:"Apps"}),!Be&&r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",xe("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/mission-control/my-card"),children:[r.jsx(uf,{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"})]}),Be&&r.jsx(_e,{path:"/mission-control/my-card",icon:uf,label:"Digital Card"}),a&&!Be&&r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground overflow-hidden",oe.pathname.startsWith("/mission-control/presentations")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/mission-control/presentations"),children:[r.jsx(py,{className:"h-4 w-4 shrink-0"}),r.jsx("span",{className:"truncate",children:"Presentations"}),r.jsx("span",{className:"ml-auto shrink-0 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"})]}),a&&Be&&r.jsx(_e,{path:"/mission-control/presentations",icon:py,label:"Smart Presentations"})]}),r.jsxs(we,{id:"marketing",label:"Marketing",icon:Ep,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[r.jsx(_e,{path:"/templates",icon:Vc,label:"Templates"}),r.jsx(_e,{path:"/social-swag-2",icon:gy,label:"Social Swag"}),r.jsx(_e,{path:"/newsletters",icon:fy,label:"Newsletters"})]}),r.jsxs(we,{id:"learning",label:"Learning",icon:eA,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(_e,{path:"/academy",icon:W1,label:"Academy"}),r.jsx(_e,{path:"/toolbox",icon:yy,label:"Toolbox"})]}),r.jsxs(we,{id:"community",label:"Community",icon:Ro,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:V,children:[r.jsx(_e,{path:"/community",icon:$n,label:"Community",badgeCount:V}),r.jsx(_e,{path:"/wishlist",icon:G1,label:"Wishlist",badgeCount:W}),!Be&&r.jsxs(Q,{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(Ss,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(we,{id:"goods",label:"The Goods",icon:Ah,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[M&&!Be&&r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",oe.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/marketplace"),children:[r.jsx(Ah,{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"})]}),M&&Be&&r.jsx(_e,{path:"/marketplace",icon:Ah,label:"Marketplace"}),r.jsx(_e,{path:"/reward-store",icon:io,label:"Reward Store"})]}),r.jsxs(we,{id:"help",label:"Help & Services",icon:Kx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(_e,{path:"/support",icon:M4,label:"Support"}),r.jsx(_e,{path:"/additional-services",icon:Os,label:"Additional Services"})]}),a&&r.jsxs(r.Fragment,{children:[!Be&&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"})}),Be?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(_e,{path:"/admin",icon:ff,label:"Admin Dashboard"})}):r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",oe.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/admin"),children:[r.jsx(ff,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!a&&r.jsxs(r.Fragment,{children:[!Be&&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"})}),Be?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(_e,{path:"/my-brokerage",icon:hi,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(_e,{path:"/brokerage/dashboard",icon:zd,label:"Manage Brokerages"}),r.jsx(_e,{path:"/brokerage-resources",icon:Oh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",xe("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/my-brokerage"),children:[r.jsx(hi,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",xe("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/brokerage/dashboard"),children:[r.jsx(zd,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",xe("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/brokerage-resources"),children:[r.jsx(Oh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(Q,{variant:"ghost",size:"sm",className:Ut("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",xe("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ae("/profile"),children:[r.jsx(ic,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(Q,{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(E4,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(ypt,{children:r.jsx(QI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[b&&N&&r.jsx(zft,{}),typeof document<"u"&&Th.createPortal(r.jsx("aside",{className:Ut("hidden md:flex flex-col bg-card border-r border-border fixed left-0 z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",pe?"w-16":"w-52"),style:{top:`${y}px`,height:`calc(100vh - ${y}px)`},children:r.jsx(ve,{})}),document.body),r.jsxs("div",{className:Ut("flex-1 flex flex-col overflow-hidden transition-all duration-300",pe?"md:ml-16":"md:ml-52"),style:{height:`calc(100vh - ${y}px)`,marginTop:`${y}px`},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(Vse,{children:[r.jsx(tye,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(uA,{className:"h-5 w-5"})})}),r.jsx(lP,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(ve,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:fNe,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx($Ne,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[b&&!N&&k&&r.jsx(Fft,{expiresAt:k,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx($Ne,{})}),I&&r.jsx(Bft,{hasUnseenBrief:P,onClick:F}),M&&r.jsxs(Q,{variant:"ghost",size:"icon",className:"relative",onClick:()=>ae("/marketplace/cart"),children:[r.jsx(Ah,{className:"h-5 w-5"}),ee>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:ee>99?"99+":ee})]}),r.jsx(dft,{}),r.jsx(bme,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Me=(Xe=n==null?void 0:n.user_metadata)==null?void 0:Xe.name)==null?void 0:Me.split(" ")[0])||"User","!"]}),r.jsxs(lh,{children:[r.jsx(ch,{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(ea,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Ci,{src:v||void 0}),r.jsx(ta,{className:"bg-primary text-primary-foreground font-medium text-sm",children:ue(((Ie=n==null?void 0:n.user_metadata)==null?void 0:Ie.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(Nu,{align:"end",className:"w-48",children:[r.jsxs(Va,{onClick:()=>ae("/profile"),className:"cursor-pointer",children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"Profile"]}),a&&r.jsxs(Va,{onClick:()=>ae("/mission-control/integrations"),className:"cursor-pointer",children:[r.jsx(xA,{className:"h-4 w-4 mr-2"}),"Integrations"]}),r.jsx(ik,{}),r.jsxs(Va,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(E4,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(spt,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:e})}),I&&r.jsx(tpt,{brief:I,open:T,onClose:D,onDismiss:U}),r.jsx(npt,{}),r.jsx(ipt,{}),r.jsx(lpt,{})]})]})})})},vpt=()=>{const{user:e}=tn(),[t,n]=A.useState(!1),[s,a]=A.useState(null),[o,l]=A.useState(""),i=async y=>{var v;if(!(e!=null&&e.email)){Ae.error("Please sign in to upgrade");return}n(!0),a(y);try{const{data:b,error:N}=await Y.functions.invoke("create-checkout",{body:{tier:y,email:e.email,name:((v=e.user_metadata)==null?void 0:v.full_name)||e.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(N)throw N;if(b!=null&&b.url)window.open(b.url,"_blank","noopener,noreferrer"),Ae.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(b){console.error("Checkout error:",b),Ae.error(b.message||"Failed to start checkout. Please try again.")}finally{n(!1),a(null)}},u=["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"],m=["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(Fr,{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(ze,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(lt,{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(He,{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(Ht,{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($n,{className:"h-7 w-7 text-primary"})}),r.jsx(Gt,{className:"text-xl",children:"Individual Agent"}),r.jsx(jn,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(et,{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:u.map((y,v)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(mi,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},v))}),r.jsxs(Q,{className:"w-full",size:"lg",onClick:()=>i("individual_agent"),disabled:t,children:[t&&s==="individual_agent"?r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(He,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Ht,{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(hi,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Gt,{className:"text-xl",children:"Brokerage"}),r.jsx(jn,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(et,{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:m.map((y,v)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(mi,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},v))}),r.jsxs(Q,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>i("brokerage_under_25"),disabled:t,children:[t&&s==="brokerage_under_25"?r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(hi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(He,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Ht,{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(hi,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Gt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(jn,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(et,{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,v)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(mi,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},v))}),r.jsxs(Q,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>i("brokerage_over_25"),disabled:t,children:[t&&s==="brokerage_over_25"?r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(hi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(He,{className:"bg-muted/50",children:r.jsxs(et,{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(Ai,{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(ws,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},_pt=()=>{const{user:e,loading:t,isBrokerageManager:n,brokerageId:s}=tn(),a=Vn(),[o,l]=A.useState(""),[i,u]=A.useState(!1),[m,x]=A.useState(!1);A.useEffect(()=>{!t&&!e&&a("/auth")},[e,t,a]),A.useEffect(()=>{!t&&e&&s&&a("/profile?setup=true")},[e,t,s,a]);const y=async()=>{if(!o.trim()){Ae.error("Please enter a brokerage name");return}const{data:v}=await Y.auth.getSession(),b=v.session;if(!e||!b){Ae.error("Please sign in again to create your brokerage."),a("/auth");return}u(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!e,hasSession:!!b,userId:e==null?void 0:e.id});const{data:N,error:k}=await Y.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:N,error:k}),k)throw k;if(!(N!=null&&N.ok))throw new Error((N==null?void 0:N.error)||"Failed to create brokerage");u(!1),x(!0),Ae.success("Brokerage created! Setting up your account..."),setTimeout(()=>{a("/profile?setup=true")},2e3)}catch(N){console.error("Error creating brokerage:",N),Ae.error(N.message||"Failed to create brokerage"),u(!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"})}):m?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(He,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{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(Gr,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Gt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(jn,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(oi,{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(Gr,{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(He,{className:"max-w-lg w-full",children:[r.jsxs(Ht,{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(hi,{className:"w-10 h-10 text-primary"})}),r.jsx(Gt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(jn,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(lt,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:v=>l(v.target.value),onKeyDown:v=>v.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($n,{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(oi,{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(oi,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(oi,{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(oi,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(Q,{onClick:y,className:"w-full",disabled:i||!o.trim(),children:[i?"Creating...":"Create Brokerage",r.jsx(No,{className:"w-4 h-4 ml-2"})]})]})]})})},HNe=()=>{const e=Vn(),[t,n]=A.useState("verifying"),[s,a]=A.useState("");A.useEffect(()=>{(async()=>{try{const{data:{session:i},error:u}=await Y.auth.getSession();if(u)throw u;if(i!=null&&i.user){const{data:m}=await Y.from("profiles").select("login_count").eq("id",i.user.id).single();if(((m==null?void 0:m.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",i.user.email),n("success");try{await Y.functions.invoke("trial-claim-hook",{body:{userId:i.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(i){console.error("Claim error:",i),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(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{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(Gt,{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(jn,{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(et,{children:r.jsx(Q,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},bpt=()=>{const e=Vn(),[t]=Zc(),[n,s]=A.useState(t.get("code")||""),[a,o]=A.useState(""),[l,i]=A.useState(""),[u,m]=A.useState(""),[x,y]=A.useState(!1),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,I]=A.useState(!1),[T,P]=A.useState(null),[F,D]=A.useState(null),[U,V]=A.useState(null),[W,G]=A.useState(null);A.useEffect(()=>{const pe=t.get("code");pe&&(s(pe),ee(pe))},[t]);const ee=async pe=>{k(!0);const{data:ne,error:fe}=await Y.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",pe.toUpperCase().trim()).single();if(fe||!ne){Ae.error("Invalid invite code"),k(!1);return}if(!ne.is_active){Ae.error("This invite code is no longer active"),k(!1);return}if(ne.max_uses&&ne.uses_count>=ne.max_uses){Ae.error("This invite code has reached its maximum uses"),k(!1);return}if(ne.expires_at&&new Date(ne.expires_at){pe.preventDefault(),ee(n)},oe=async pe=>{var ne;if(pe.preventDefault(),!u.trim()){Ae.error("Please enter your name");return}if(l.length<6){Ae.error("Password must be at least 6 characters");return}b(!0);try{const fe=`${window.location.origin}/`,{data:se,error:me}=await Y.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:fe,data:{name:u.trim()}}});if(me){me.message.includes("already registered")?Ae.error("This email is already registered. Please sign in instead."):Ae.error(me.message);return}se.user&&(await Y.rpc("add_default_signup_tag",{user_id:se.user.id}),F?await Y.functions.invoke("assign-brokerage",{body:{userId:se.user.id,brokerageId:F}}):W?await Y.functions.invoke("assign-brokerage",{body:{userId:se.user.id,trialDays:W}}):await Y.functions.invoke("assign-brokerage",{body:{userId:se.user.id,grandfathered:!0}}),T&&await Y.from("invite_codes").update({uses_count:((ne=(await Y.from("invite_codes").select("uses_count").eq("id",T).single()).data)==null?void 0:ne.uses_count)+1}).eq("id",T),Ae.success("Account created! You can now access the dashboard."),e("/dashboard"))}catch(fe){console.error("Signup error:",fe),Ae.error("An unexpected error occurred")}finally{b(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsx(Gt,{className:"text-2xl font-bold text-primary",children:U?`Join ${U}`:"Join LevelUp"}),r.jsx(jn,{children:M?U?`Create your account to join ${U}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(et,{children:M?r.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Full Name"}),r.jsx(lt,{id:"name",type:"text",placeholder:"John Doe",value:u,onChange:pe=>m(pe.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(lt,{id:"email",type:"email",placeholder:"you@example.com",value:a,onChange:pe=>o(pe.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(lt,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:pe=>i(pe.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(Fg,{className:"h-4 w-4"}):r.jsx(_o,{className:"h-4 w-4"})})]})]}),r.jsx(Q,{type:"submit",className:"w-full",disabled:v,children:v?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{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(ze,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(lt,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:pe=>s(pe.target.value),required:!0,autoFocus:!0})]}),r.jsx(Q,{type:"submit",className:"w-full",disabled:N,children:N?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},wpt="/assets/testimonial-avatar-1-BsCQFauB.jpg",jpt="/assets/testimonial-avatar-2-B6VPVc2t.jpg",kpt="/assets/testimonial-avatar-3-GuEFwYUE.jpg",Npt="/assets/testimonial-avatar-4-98iKMtkB.jpg",Spt="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",Cpt=[wpt,jpt,kpt,Npt,Spt],Mpt=I3({name:xc().trim().min(2,"Name must be at least 2 characters").max(100),email:xc().trim().email("Please enter a valid email address").max(255),phone:xc().trim().min(10,"Please enter a valid phone number").max(20).optional().or(uNe("")),brokerage:xc().trim().max(200).optional().or(uNe(""))}),Tpt=[{icon:rf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Vc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Cs,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Ul,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:_a,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:ao,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],Apt=[{icon:$n,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Os,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ai,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:mm,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Do,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:_c,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:vi,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Vg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],Ept=[{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."}],Ipt=()=>{const e=Vn(),[t,n]=A.useState(!1),[s,a]=A.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=A.useState({}),i=async u=>{var x,y;u.preventDefault(),l({});const m=Mpt.safeParse(s);if(!m.success){const v={};m.error.errors.forEach(b=>{b.path[0]&&(v[b.path[0]]=b.message)}),l(v);return}n(!0);try{const{data:v,error:b}=await Y.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(b){console.error("Trial signup error:",b),Ae.error(b.message||"Something went wrong. Please try again.");return}if(v!=null&&v.error){Ae.error(v.error);return}Ae.success("🎉 Welcome aboard! Check your email to claim your account."),e("/trial/success")}catch(v){console.error("Trial signup error:",v),Ae.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs($p,{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:qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(Q,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var u;return(u=document.getElementById("features"))==null?void 0:u.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(Q,{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(Os,{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(no,{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(no,{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:Cpt.map((u,m)=>r.jsx("img",{src:u,alt:`Agent ${m+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},m))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(u=>r.jsx(ks,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},u))}),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(He,{className:"bg-white shadow-2xl border-0",children:r.jsxs(et,{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(Bg,{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:i,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Full Name *"}),r.jsx(lt,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:u=>a({...s,name:u.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(ze,{htmlFor:"email",children:"Email Address *"}),r.jsx(lt,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:u=>a({...s,email:u.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(ze,{htmlFor:"phone",children:"Phone Number"}),r.jsx(lt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:u=>a({...s,phone:u.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(ze,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(lt,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:u=>a({...s,brokerage:u.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(Q,{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(Gr,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(No,{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:Tpt.map((u,m)=>r.jsxs(He,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Ht,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(u.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Gt,{className:"text-xl font-sans",children:u.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:u.description})})]},m))})]})}),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(Os,{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:Apt.map((u,m)=>r.jsxs(He,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Ht,{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(u.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Gt,{className:"text-lg font-semibold text-white",children:u.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:u.description})})]},m))})]})]}),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:Ept.map((u,m)=>r.jsx(He,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(et,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(ks,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',u.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:u.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:u.role})]})]})},m))})]})}),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(vm,{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(Vg,{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($n,{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(He,{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(et,{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(Q,{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(No,{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:Xxe,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."})]})})})]})]})},Ppt=()=>{const e=Vn();return r.jsxs(r.Fragment,{children:[r.jsx($p,{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:qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(Q,{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(He,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(et,{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(no,{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(Hc,{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(ws,{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(Q,{onClick:()=>e("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(No,{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:Xxe,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},Lpt=I3({viewerName:xc().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:xc().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:xc().max(20,"Phone must be less than 20 characters").optional(),message:xc().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Opt({shareToken:e,agentName:t,hasContact:n}){const[s,a]=A.useState(!1),[o,l]=A.useState(!1),[i,u]=A.useState(null),m=Qse({resolver:Jse(Lpt),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async y=>{a(!0),u(null);try{const{data:v,error:b}=await Y.functions.invoke("video-reply-notify",{body:{shareToken:e,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(b)throw new Error(b.message);if(!(v!=null&&v.success))throw new Error((v==null?void 0:v.error)||"Failed to send reply");l(!0)}catch(v){console.error("Failed to submit reply:",v),u(v.message||"Something went wrong. Please try again.")}finally{a(!1)}};return o?r.jsx(He,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(et,{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(no,{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(He,{children:[r.jsxs(Ht,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Ul,{className:"h-5 w-5 text-primary"}),r.jsx(Gt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(jn,{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(et,{children:r.jsx(eae,{...m,children:r.jsxs("form",{onSubmit:m.handleSubmit(x),className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsx(Ol,{control:m.control,name:"viewerName",render:({field:y})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Your Name *"}),r.jsx(Ml,{children:r.jsx(lt,{placeholder:"John Smith",...y})}),r.jsx(Gu,{})]})}),r.jsx(Ol,{control:m.control,name:"viewerEmail",render:({field:y})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Email *"}),r.jsx(Ml,{children:r.jsx(lt,{type:"email",placeholder:"john@example.com",...y})}),r.jsx(Gu,{})]})})]}),!n&&r.jsx(Ol,{control:m.control,name:"viewerPhone",render:({field:y})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Phone (optional)"}),r.jsx(Ml,{children:r.jsx(lt,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx(Gu,{})]})}),r.jsx(Ol,{control:m.control,name:"message",render:({field:y})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Message *"}),r.jsx(Ml,{children:r.jsx(Zn,{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(Gu,{})]})}),i&&r.jsx("p",{className:"text-sm text-destructive",children:i}),r.jsx(Q,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ji,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Dpt=()=>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(ks,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(ks,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(ks,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(ks,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(ks,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(dy,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Rpt=()=>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(Os,{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(ks,{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(Os,{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(ks,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(ks,{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(dy,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),Fpt=()=>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(bp,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(bp,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(bp,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(bp,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(vi,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(vi,{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(vi,{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"})]}),zpt=()=>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(Bl,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(ks,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(Bl,{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(ks,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(ks,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),Bpt=()=>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(bp,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(bp,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(j4,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),$pt=()=>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(Oj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(Oj,{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(Os,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Os,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),Upt=()=>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(Q1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(Q1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(Q1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx(N1,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(N1,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(N1,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(N1,{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(ks,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),qpt=()=>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(vi,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(vi,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Vpt=()=>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(ks,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(ks,{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(ks,{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(ks,{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(Os,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(Hc,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(Hc,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),Hpt=()=>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(ks,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Os,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Os,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),Wpt=()=>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(ty,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(ty,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(ty,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(ty,{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"})]})]})]}),Gpt=()=>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(ks,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(ks,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(Bl,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(Bl,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(dy,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),Kpt=()=>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(mm,{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(Hc,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(ao,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),Zpt=()=>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(vi,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(vi,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(vi,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(vi,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(vi,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(vi,{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(vi,{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(vi,{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"})]}),Ypt=()=>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(X1,{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(X1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(Os,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(X1,{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"})]}),Xpt=()=>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(ya,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(ya,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(pm,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(pm,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(vi,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(vi,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(Os,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(Hc,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),Qpt=()=>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(Hc,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(Hc,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(pm,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(ya,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(Os,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Os,{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"})]}),Jpt=()=>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(pm,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(pm,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(pm,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(ya,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(Hc,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(Os,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(ks,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),egt=()=>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(ya,{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(pm,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(vi,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(Os,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(Pj,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),WNe=()=>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"})]}),tgt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(vi,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(vi,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(vi,{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(vi,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),rgt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Pj,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(Os,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(ya,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),ngt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ij,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(I4,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(Ij,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),dT=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Os,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(Hc,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Os,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),GNe=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(ya,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Os,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(ya,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),Mme=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Os,{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(vi,{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(tgt,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(rA,{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(dT,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(Ij,{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(ngt,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(_c,{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($n,{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(dT,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(Bl,{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(WNe,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(Do,{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(GNe,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(I4,{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(dT,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(mm,{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(Kpt,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(vi,{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(Zpt,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(X1,{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(Ypt,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(ks,{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(Vpt,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(j4,{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(Bpt,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(bp,{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(Fpt,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(Bl,{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(zpt,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(dy,{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(Dpt,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(fm,{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(Rpt,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(Bl,{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(Gpt,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(Oj,{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($pt,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(vi,{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(qpt,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(Q1,{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(Upt,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Os,{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(Hpt,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(ty,{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(Wpt,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(ya,{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(Xpt,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(Hc,{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(Qpt,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(Cs,{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(GNe,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(Fd,{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(dT,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(qj,{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(Pj,{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(rgt,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(pm,{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(Jpt,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(ya,{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(egt,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(Bd,{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(dT,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(Bl,{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(WNe,{})}],sgt=[{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 agt(e){return Mme.filter(t=>t.category===e)}function Z4(e){return Mme.find(t=>t.id===e)||Mme[0]}function igt(){const{shareToken:e}=Ec(),[t,n]=A.useState(null),[s,a]=A.useState(null),[o,l]=A.useState(null),[i,u]=A.useState(!0),[m,x]=A.useState(null),[y,v]=A.useState(!0);A.useEffect(()=>{const U=()=>{['[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(ee=>{document.querySelectorAll(ee).forEach(ae=>{ae.style.display="none"})})};U();const V=[setTimeout(U,500),setTimeout(U,1500),setTimeout(U,3e3)],W=new MutationObserver(U);return W.observe(document.body,{childList:!0,subtree:!0}),()=>{V.forEach(clearTimeout),W.disconnect()}},[]),A.useEffect(()=>{(async()=>{if(!e){x("Invalid share link"),u(!1);return}const{data:V,error:W}=await Y.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(W||!V){x("Video not found or has been removed"),u(!1);return}n(V);try{await Y.rpc("log_video_view",{p_video_id:V.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(G){console.warn("Failed to log video view:",G)}if(V.owner_user_id){const{data:G}=await Y.from("profiles").select("id, name, email, phone").eq("id",V.owner_user_id).single();if(G){a(G);try{const{data:ee}=await Y.storage.from("avatars").list(`${V.owner_user_id}`);if(ee&&ee.length>0){const{data:ae}=Y.storage.from("avatars").getPublicUrl(`${V.owner_user_id}/${ee[0].name}`);l(ae.publicUrl)}}catch{}}}u(!1)})()},[e]);const b=U=>{if(!U)return"0:00";const V=Math.floor(U/60),W=U%60;return`${V}:${W.toString().padStart(2,"0")}`},N=U=>U.includes("iframe.mediadelivery.net/play/")?U.replace("/play/","/embed/")+"?autoplay=true&responsive=true":U,k=U=>{if(!U)return"?";const V=U.split(" ");return V.length>=2?`${V[0][0]}${V[1][0]}`.toUpperCase():U.substring(0,2).toUpperCase()},M=Z4((t==null?void 0:t.page_template)||"default"),I=(t==null?void 0:t.recipient_name)||null,T=M.headerText(I),F=`https://dashboard.relevelup.com/share/video/${e}`;if(i)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-primary"})});if(m||!t)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(He,{className:"max-w-md w-full",children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Ia,{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:m||"This video is no longer available."})]})})});const D=M.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs($p,{children:[r.jsx("title",{children:T}),r.jsx("meta",{name:"description",content:M.subText}),r.jsx("meta",{property:"og:title",content:T}),r.jsx("meta",{property:"og:description",content:M.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:F}),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:M.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:Ut("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",M.gradientClasses),children:[D&&M.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[D&&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:Ut("w-14 h-14 rounded-full flex items-center justify-center shadow-sm",M.accentColor==="primary"&&"bg-primary/10 text-primary",M.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",M.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",M.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",M.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",M.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",M.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",M.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",M.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",M.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",M.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",M.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",M.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:M.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:T}),r.jsx("p",{className:"text-muted-foreground",children:M.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(ea,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Ci,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(ta,{className:"bg-primary/10 text-primary font-semibold",children:k(s.name)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:D?"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(Q,{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(Ai,{className:"h-4 w-4"})})}),s.email&&r.jsx(Q,{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(ws,{className:"h-4 w-4"})})})]})]}),r.jsx(He,{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:()=>v(!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:U=>{var W;U.currentTarget.style.display="none";const V=(W=U.currentTarget.parentElement)==null?void 0:W.querySelector(".video-fallback");V&&(V.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(Ia,{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(Vl,{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:b(t.duration_seconds)})]})}),!D&&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(Q,{size:"lg",onClick:()=>v(!0),className:"gap-2",children:[r.jsx(Vl,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Opt,{shareToken:e,agentName:(s==null?void 0:s.name)||null,hasContact:!!t.contact_id})]})]})]})}function ogt(){return A.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(Lrt,{})}function lgt(){const{token:e}=Ec();return A.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(Gr,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const cgt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},dgt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},TS={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function ugt(){var ne,fe,se,me;const{slugOrId:e}=Ec(),[t]=Zc(),{data:n,isLoading:s}=k8e(e||""),a=N8e(),o=Mct(),l=t.get("ref"),[i,u]=A.useState(""),[m,x]=A.useState(""),[y,v]=A.useState(""),[b,N]=A.useState(""),[k,M]=A.useState(!1),[I,T]=A.useState(!1),[P,F]=A.useState(null),[D,U]=A.useState(!1);A.useEffect(()=>{l&&o.mutate(l)},[l]);const V=ue=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ue),W=async ue=>{if(ue.preventDefault(),!(!i.trim()||!y.trim()||!n)){M(!0);try{await a.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:i.trim(),lastName:m.trim(),email:y.trim(),phone:b.trim(),shareToken:l}),T(!0),Ae.success("Thanks! The agent will be in touch soon.")}catch(xe){console.error("Lead submission error:",xe),Ae.error(`Failed to submit: ${xe.message||"Please try again"}`)}finally{M(!1)}}},G=(n==null?void 0:n.photos)||[],ee=G.find(ue=>ue.is_primary)||G[0],ae=()=>{P!==null&&F(P===0?G.length-1:P-1)},oe=()=>{P!==null&&F(P===G.length-1?0:P+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(Er,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Er,{className:"h-10 w-48 mb-6"}),r.jsx(Er,{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(Er,{className:"h-12 w-48"}),r.jsx(Er,{className:"h-6 w-full"}),r.jsx(Er,{className:"h-6 w-3/4"})]}),r.jsx(Er,{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(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:Ute,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(ya,{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(Q,{asChild:!0,children:r.jsx(co,{to:"/public/listings",children:"Browse All Listings"})})]})]});const pe=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($p,{children:[r.jsxs("title",{children:[pe," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${TS[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:pe}),r.jsx("meta",{property:"og:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${TS[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}`}),ee&&r.jsx("meta",{property:"og:image",content:ee.photo_url}),ee&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${TS[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:pe}),r.jsx("meta",{name:"twitter:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),ee&&r.jsx("meta",{name:"twitter:image",content:ee.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||`${TS[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:G.map(ue=>ue.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:(fe=n.agent.brokerage)!=null&&fe.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(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:Ute,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(co,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),G.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:()=>F(0),children:r.jsx("img",{src:ee==null?void 0:ee.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${TS[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:G.slice(1,5).map((ue,xe)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>F(xe+1),children:[r.jsx("img",{src:ue.photo_url,alt:`${n.property_address||n.city} - Photo ${xe+2} of ${G.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),xe===3&&G.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",G.length-5," more"]})]},ue.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(At,{className:`${cgt[n.status]} text-white border-0`,children:dgt[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:V(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(Do,{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($1,{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(B1,{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(Ug,{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(Cs,{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(At,{variant:"secondary",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),TS[n.property_type]]}),n.lot_size&&r.jsxs(At,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(At,{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(Q,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ss,{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(He,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(et,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>U(!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(Ia,{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(Vl,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(Q,{onClick:()=>U(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(Vl,{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(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx(ic,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((se=n.agent.brokerage)==null?void 0:se.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(He,{className:"border-primary",children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{children:I?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(ws,{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:W,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"firstName",children:"First Name *"}),r.jsx(lt,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:ue=>u(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"lastName",children:"Last Name"}),r.jsx(lt,{id:"lastName",type:"text",placeholder:"Doe",value:m,onChange:ue=>x(ue.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email *"}),r.jsx(lt,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:ue=>v(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(lt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:b,onChange:ue=>N(ue.target.value)})]}),r.jsx(Q,{type:"submit",className:"w-full",disabled:k,children:k?"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(Rr,{open:P!==null,onOpenChange:()=>F(null),children:r.jsxs(Dr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx($r,{className:"sr-only",children:r.jsx(Br,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>F(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(ds,{className:"h-5 w-5"})}),P!==null&&G[P]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:G[P].photo_url,alt:`Photo ${P+1}`,className:"w-full max-h-[80vh] object-contain"}),G.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(kc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:oe,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(Gi,{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:[P+1," / ",G.length]})]})]})]})}),r.jsx(Rr,{open:D,onOpenChange:U,children:r.jsxs(Dr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx($r,{className:"sr-only",children:r.jsx(Br,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>U(!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(ds,{className:"h-5 w-5"})}),((me=n==null?void 0:n.video)==null?void 0:me.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 hgt(){var o;const{slug:e}=Ec(),{data:t,isLoading:n,error:s}=T8e(e);if(A.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),A.useEffect(()=>{t!=null&&t.id&&zi(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(Er,{className:"h-28 w-28 rounded-full"}),r.jsx(Er,{className:"h-6 w-48"}),r.jsx(Er,{className:"h-4 w-36"})]}),r.jsx(Er,{className:"h-12 w-full"}),r.jsx(Er,{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 a=((o=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs($p,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:t.positioning_statement||`Connect with ${a}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(Jxe,{card:t})]})}function uT({banners:e,autoPlayInterval:t=5e3,className:n}){const[s,a]=A.useState(0),[o,l]=A.useState(!1),i=A.useCallback(()=>{a(y=>(y+1)%e.length)},[e.length]),u=A.useCallback(()=>{a(y=>(y-1+e.length)%e.length)},[e.length]),m=A.useCallback(y=>{a(y)},[]);if(A.useEffect(()=>{if(e.length<=1||o)return;const y=setInterval(i,t);return()=>clearInterval(y)},[e.length,o,t,i]),!e||e.length===0)return null;const x=e[s];return r.jsxs("div",{className:Ut("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(Q,{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(Q,{variant:"ghost",size:"icon",className:Ut("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:u,children:r.jsx(kc,{className:"h-6 w-6"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:Ut("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:i,children:r.jsx(Gi,{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,v)=>r.jsx("button",{onClick:()=>m(v),className:Ut("w-2 h-2 rounded-full transition-all duration-300",v===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${v+1}`},v))})]})}function mgt(e){return"EST"}function RE(e){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(e),s=mgt();return`${n} ${s}`}function Y4(e){const t=new Date,n=new Date(e),s=TNe(n,-15),a=TNe(n,30);return t>a?"ended":DNe(t,{start:n,end:a})?"live":DNe(t,{start:s,end:n})?"starting_soon":"upcoming"}function Eye(e){const t=Y4(e);return t==="starting_soon"||t==="live"}const KNe=Eye,fgt=({events:e,registrations:t,onNavigateToEvents:n})=>{const[s,a]=A.useState(new Date);A.useEffect(()=>{const b=setInterval(()=>{a(new Date)},3e4);return()=>clearInterval(b)},[]);const o=e.filter(b=>Eye(b.event_date));if(o.length===0)return null;const l=o[0],i=Y4(l.event_date),u=t.find(b=>b.event_id===l.id),m=(u==null?void 0:u.zoom_join_url)||l.zoom_link,x=!!u,y=i==="live",v=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 ${v.container} border`,children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${v.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 ${v.indicator} opacity-75`}),r.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${v.indicator}`})]}),r.jsx("div",{className:`flex items-center gap-2 ${v.text} font-bold text-sm uppercase tracking-wider`,children:y?r.jsxs(r.Fragment,{children:[r.jsx(Uj,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Xa,{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 ${RE(new Date(l.event_date))}`:`Starts at ${RE(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(Q,{onClick:()=>window.open(m,"_blank"),className:`${v.button} text-white gap-2`,children:[r.jsx(Ss,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(Q,{variant:"outline",onClick:n,className:`${v.outlineButton} gap-2`,children:[r.jsx($n,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var Iye="Progress",Pye=100,[pgt]=cc(Iye),[ggt,xgt]=pgt(Iye),gRe=A.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:o=ygt,...l}=e;(a||a===0)&&!ZNe(a)&&console.error(vgt(`${a}`,"Progress"));const i=ZNe(a)?a:Pye;s!==null&&!YNe(s,i)&&console.error(_gt(`${s}`,"Progress"));const u=YNe(s,i)?s:null,m=nre(u)?o(u,i):void 0;return r.jsx(ggt,{scope:n,value:u,max:i,children:r.jsx(Fn.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":nre(u)?u:void 0,"aria-valuetext":m,role:"progressbar","data-state":vRe(u,i),"data-value":u??void 0,"data-max":i,...l,ref:t})})});gRe.displayName=Iye;var xRe="ProgressIndicator",yRe=A.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,a=xgt(xRe,n);return r.jsx(Fn.div,{"data-state":vRe(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:t})});yRe.displayName=xRe;function ygt(e,t){return`${Math.round(e/t*100)}%`}function vRe(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function nre(e){return typeof e=="number"}function ZNe(e){return nre(e)&&!isNaN(e)&&e>0}function YNe(e,t){return nre(e)&&!isNaN(e)&&e<=t&&e>=0}function vgt(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Pye}\`.`}function _gt(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 ${Pye} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var _Re=gRe,bgt=yRe;const Mc=A.forwardRef(({className:e,value:t,...n},s)=>r.jsx(_Re,{ref:s,className:Ut("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:r.jsx(bgt,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Mc.displayName=_Re.displayName;function wgt(){const{user:e,isBrokerageManager:t}=tn(),[n,s]=A.useState([]),[a,o]=A.useState([]),[l,i]=A.useState(!1),[u,m]=A.useState(!0),x=t?"brokerage_manager":"agent";A.useEffect(()=>{if(!(e!=null&&e.id)){m(!1);return}y()},[e==null?void 0:e.id,x]);const y=async()=>{if(e!=null&&e.id)try{const{data:F,error:D}=await Y.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(D)throw D;const{data:U,error:V}=await Y.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",e.id);if(V)throw V;const{data:W,error:G}=await Y.from("onboarding_checklist_dismissed").select("id").eq("user_id",e.id).maybeSingle();if(G)throw G;s(F||[]),o(U||[]),i(!!W),F&&F.length>0&&await v(F,U||[])}catch(F){console.error("Error fetching checklist data:",F)}finally{m(!1)}},v=async(F,D)=>{var Be,Ve;if(!(e!=null&&e.id))return;const U=D.map(ot=>ot.item_id),V=F.filter(ot=>!U.includes(ot.id));if(V.length===0)return;const[W,G,ee,ae,oe,pe,ne,fe,se,me,ue,xe,Te,_e,we]=await Promise.all([Y.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle(),Y.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",e.id),Y.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",e.id),Y.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",e.id),Y.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","template"),Y.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","academy_video"),Y.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","toolbox"),Y.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id),Y.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Y.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Y.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Y.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Y.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",e.id),Y.from("innercircle_contacts").select("id").eq("owner_user_id",e.id),Y.from("deal_pipeline").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id)]),ve={},Xe=(Be=W.data)==null?void 0:Be.brokerage_id;ve.share_resource=(G.count||0)>0,ve.post_community=(ee.count||0)>0,ve.register_event=(ae.count||0)>0,ve.view_template=(oe.count||0)>0,ve.watch_academy=(pe.count||0)>0,ve.use_toolbox=(ne.count||0)>0,ve.launch_app=(fe.count||0)>0,ve.add_contact=(se.count||0)>0,ve.create_video=(me.count||0)>0,ve.complete_touch=(ue.count||0)>0,ve.add_transaction=(xe.count||0)>0,ve.add_listing=(Te.count||0)>0,ve.add_deal=(we.count||0)>0;const Me=((Ve=_e.data)==null?void 0:Ve.map(ot=>ot.id))||[],Ie=[];Xe?Ie.push(Y.from("profiles").select("id").eq("brokerage_id",Xe).neq("id",e.id).then(ot=>{var Tt;ve.add_agent=(((Tt=ot.data)==null?void 0:Tt.length)||0)>0})):ve.add_agent=!1,Me.length>0?(Ie.push(Y.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",Me).then(ot=>{ve.add_plan=(ot.count||0)>0})),Ie.push(Y.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",Me).then(ot=>{ve.schedule_popby=(ot.count||0)>0}))):(ve.add_plan=!1,ve.schedule_popby=!1),await Promise.all(Ie);const $e=V.filter(ot=>ve[ot.action_type]);if($e.length>0){const ot=$e.map(Oe=>({user_id:e.id,item_id:Oe.id})),{error:Tt}=await Y.from("onboarding_checklist_progress").upsert(ot,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!Tt){const Oe=$e.map(at=>({item_id:at.id,completed_at:new Date().toISOString()}));o(at=>[...at,...Oe])}}},b=async F=>{if(e!=null&&e.id)try{const{error:D}=await Y.from("onboarding_checklist_progress").insert({user_id:e.id,item_id:F});if(D)throw D;o(U=>[...U,{item_id:F,completed_at:new Date().toISOString()}])}catch(D){console.error("Error marking item complete:",D)}},N=async()=>{if(e!=null&&e.id)try{const{error:F}=await Y.from("onboarding_checklist_dismissed").insert({user_id:e.id});if(F)throw F;i(!0)}catch(F){console.error("Error dismissing checklist:",F)}},k=a.length,M=n.length,I=M>0&&k>=M,T=M>0?k/M*100:0;return{items:n,progress:a,isDismissed:l,loading:u,completedCount:k,totalCount:M,isComplete:I,progressPercentage:T,isItemComplete:F=>a.some(D=>D.item_id===F),markComplete:b,dismiss:N,refetch:y}}const jgt={add_agent:r.jsx($n,{className:"h-4 w-4"}),share_resource:r.jsx(Nc,{className:"h-4 w-4"}),post_community:r.jsx(Ro,{className:"h-4 w-4"}),register_event:r.jsx(Cs,{className:"h-4 w-4"}),view_template:r.jsx(G0,{className:"h-4 w-4"}),watch_academy:r.jsx(W1,{className:"h-4 w-4"}),use_toolbox:r.jsx(yy,{className:"h-4 w-4"}),launch_app:r.jsx(QT,{className:"h-4 w-4"}),add_deal:r.jsx(hy,{className:"h-4 w-4"}),add_listing:r.jsx(ya,{className:"h-4 w-4"})},kgt={add_deal:"/mission-control/pipeline",add_listing:"/mission-control/listings/new",post_community:"/community",add_contact:"/mission-control/contacts"};function Ngt(){const{items:e,isDismissed:t,loading:n,completedCount:s,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:u,dismiss:m}=wgt(),x=Vn(),[y,v]=A.useState(!0);return n||t||a===0||o?null:r.jsxs(He,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Ht,{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(Bg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{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(Q,{variant:"ghost",size:"sm",onClick:()=>v(!y),className:"h-8 w-8 p-0",children:y?r.jsx(ly,{className:"h-4 w-4"}):r.jsx(Rd,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:m,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(ds,{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 ",a," complete"]})]}),r.jsx(Mc,{value:l,className:"h-2"})]})]}),y&&r.jsx(et,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:e.map(b=>{const N=i(b.id);return r.jsxs("div",{className:Ut("flex items-start gap-3 p-3 rounded-lg transition-colors",N?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>{if(N)return;const k=kgt[b.action_type];k?x(k):u(b.id)},children:[r.jsx("div",{className:"mt-0.5",children:N?r.jsx(no,{className:"h-5 w-5 text-primary"}):r.jsx(Ju,{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:jgt[b.action_type]||r.jsx(Ju,{className:"h-4 w-4"})}),r.jsx("span",{className:Ut("font-medium",N&&"line-through text-muted-foreground"),children:b.title})]}),b.description&&r.jsx("p",{className:Ut("text-sm text-muted-foreground mt-1",N&&"line-through"),children:b.description})]})]},b.id)})})})]})}const qp=()=>Zt({queryKey:["relationship-types"],queryFn:async()=>{const{data:e,error:t}=await Y.from("relationship_types").select("*").order("sort_order");if(t)throw t;return e}}),Nf=e=>{const t=Yc(),n=1e3,s=async a=>{const o=[];let l=0;for(;;){const{data:i,error:u}=await a.range(l,l+n-1);if(u)throw u;const m=i??[];if(o.push(...m),m.length{let a=Y.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(a)},enabled:!!t})},Sgt=e=>Zt({queryKey:["innercircle-contact",e],queryFn:async()=>{const{data:t,error:n}=await Y.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}),bRe=()=>{const e=Yc();return Zt({queryKey:["innercircle-contact-counts",e],queryFn:async()=>{const{data:t,error:n}=await Y.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return t==null||t.forEach(a=>{var o;(o=a.tags)==null||o.forEach(l=>{s[l.relationship_type_id]=(s[l.relationship_type_id]||0)+1})}),s},enabled:!!e})},Lye=()=>{const e=Vr(),t=Yc();return ar({mutationFn:async n=>{const{tagIds:s,...a}=n,o={...a,birthday:a.birthday||null,home_anniversary:a.home_anniversary||null,owner_user_id:t},{data:l,error:i}=await Y.from("innercircle_contacts").insert(o).select().single();if(i)throw i;if(s&&s.length>0){const{error:u}=await Y.from("innercircle_contact_tags").insert(s.map(m=>({contact_id:l.id,relationship_type_id:m})));if(u)throw u}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Sa({title:"Contact created successfully"})},onError:n=>{Sa({title:"Error creating contact",description:n.message,variant:"destructive"})}})},wRe=()=>{const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{tagIds:s,tags:a,...o}=n,l={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:i,error:u}=await Y.from("innercircle_contacts").update(l).eq("id",t).select().single();if(u)throw u;if(s!==void 0&&(await Y.from("innercircle_contact_tags").delete().eq("contact_id",t),s.length>0)){const{error:m}=await Y.from("innercircle_contact_tags").insert(s.map(x=>({contact_id:t,relationship_type_id:x})));if(m)throw m}return i},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Sa({title:"Contact updated successfully"})},onError:t=>{Sa({title:"Error updating contact",description:t.message,variant:"destructive"})}})},Oye=()=>{const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("innercircle_contacts").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Sa({title:"Contact deleted successfully"})},onError:t=>{Sa({title:"Error deleting contact",description:t.message,variant:"destructive"})}})},Dye=()=>Zt({queryKey:["action-types"],queryFn:async()=>{const{data:e,error:t}=await Y.from("action_types").select("*").order("sort_order");if(t)throw t;return e}}),Cgt=e=>Zt({queryKey:["action-scripts",e],queryFn:async()=>{let t=Y.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await t;if(s)throw s;return n}}),Mgt=()=>Zt({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:e,error:t}=await Y.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(t)throw t;return e}}),Tgt=()=>{const e=Vr(),t=Yc();return ar({mutationFn:async({name:n,description:s})=>{const{data:a,error:o}=await Y.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:t,active:!0,is_template:!1}).select().single();if(o)throw o;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Sa({title:"Plan created successfully"})},onError:n=>{Sa({title:"Error creating plan",description:n.message,variant:"destructive"})}})},Agt=()=>{const e=Vr(),t=Yc();return ar({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:a,error:o}=await Y.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!a)throw new Error("Source plan not found");const{data:l,error:i}=await Y.from("touchpoint_plans").insert({name:s,description:a.description,owner_user_id:t,active:!0,is_template:!1}).select().single();if(i)throw i;if(a.items&&a.items.length>0){const u=a.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:m}=await Y.from("touchpoint_plan_items").insert(u);if(m)throw m}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Sa({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{Sa({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},Egt=()=>{const e=Vr();return ar({mutationFn:async({id:t,name:n,description:s})=>{const{data:a,error:o}=await Y.from("touchpoint_plans").update({name:n,description:s}).eq("id",t).select().single();if(o)throw o;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Sa({title:"Plan updated successfully"})}})},Igt=()=>{const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("touchpoint_plans").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Sa({title:"Plan deleted successfully"})}})},Pgt=()=>{const e=Vr();return ar({mutationFn:async({planId:t,items:n})=>{if(await Y.from("touchpoint_plan_items").delete().eq("plan_id",t),n.length>0){const{error:s}=await Y.from("touchpoint_plan_items").insert(n.map(a=>({plan_id:t,month_number:a.month_number,action_type_id:a.action_type_id,default_script_id:a.default_script_id||null,notes:a.notes})));if(s)throw s}},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),Sa({title:"Plan schedule updated"})}})},Lgt=()=>{const e=Vr();return ar({mutationFn:async({actionTypeId:t,title:n,scriptBody:s,emailSubject:a,tone:o})=>{const{data:{user:l}}=await Y.auth.getUser(),{data:i,error:u}=await Y.from("action_scripts").insert({action_type_id:t,title:n,script_body:s,email_subject:a||null,tone:o||null,active:!0,user_id:l==null?void 0:l.id}).select().single();if(u)throw u;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["action-scripts"]}),Sa({title:"Script created successfully"})},onError:t=>{Sa({title:"Error creating script",description:t.message,variant:"destructive"})}})},Ogt=()=>{const e=Yc();return Zt({queryKey:["user-plan-enrollments",e],queryFn:async()=>{const{data:t,error:n}=await Y.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return t},enabled:!!e})},Dgt=()=>{const e=Vr(),t=Yc();return ar({mutationFn:async({planId:n,relationshipTypeId:s,active:a})=>{const{data:o}=await Y.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:l}=await Y.from("user_plan_enrollments").update({active:a}).eq("id",o.id);if(l)throw l}else if(a){const{error:l}=await Y.from("user_plan_enrollments").insert({owner_user_id:t,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"]}),Sa({title:"Plan enrollment updated"})}})},cae=(e=7)=>{const t=Yc();return Zt({queryKey:["contact-touch-logs",t,e],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-e);const{data:s,error:a}=await Y.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(a)throw a;return s},enabled:!!t})},jRe=()=>{const e=Yc();return Zt({queryKey:["contacts-last-touch",e],queryFn:async()=>{const{data:t,error:n}=await Y.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(a=>{s[a.contact_id]||(s[a.contact_id]=a.completed_at)}),s},enabled:!!e})},Rgt=(e=90)=>{const{data:t}=Nf(),{data:n}=jRe();if(!t||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-e);const a=t.filter(o=>{const l=n[o.id];return l?new Date(l){const e=Vr(),t=Yc();return ar({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:a,notes:o})=>{const{data:l,error:i}=await Y.from("contact_touch_logs").insert({owner_user_id:t,contact_id:n,action_type_id:s,script_used_id:a,notes:o,completed_at:new Date().toISOString()}).select().single();if(i)throw i;return l},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts-last-touch"]}),e.invalidateQueries({queryKey:["today-actions"]}),Sa({title:"Action completed!"})}})},NRe="agentos_weekly_touch_goal",XNe=20,sre=()=>{if(typeof window>"u")return XNe;const e=localStorage.getItem(NRe);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return XNe},SRe=e=>{localStorage.setItem(NRe,e.toString())},CRe=()=>{const{data:e}=cae(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 a=0;if(e&&e.length>0){const l=new Set(e.map(u=>new Date(u.completed_at).toDateString()));let i=new Date(t);for(;l.has(i.toDateString());)a++,i.setDate(i.getDate()-1)}const o=sre();return{actionsThisWeek:s,weeklyGoal:o,streak:a,progress:Math.min(s/o*100,100)}},Fgt=()=>{const e=Yc();return Zt({queryKey:["contact-plan-cycles",e],queryFn:async()=>{const{data:t,error:n}=await Y.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})},zgt=()=>{const e=Vr();return Yc(),ar({mutationFn:async()=>{const{data:t}=await Y.from("user_plan_enrollments").select("*").eq("active",!0);if(!t||t.length===0)return;const{data:n}=await Y.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!n)return;const{data:s}=await Y.from("contact_plan_cycles").select("contact_id, plan_id"),a=new Set((s==null?void 0:s.map(l=>`${l.contact_id}-${l.plan_id}`))||[]),o=[];for(const l of n)for(const i of l.tags||[]){const u=t.find(m=>m.relationship_type_id===i.relationship_type_id);u&&!a.has(`${l.id}-${u.plan_id}`)&&o.push({contact_id:l.id,plan_id:u.plan_id,relationship_type_id:i.relationship_type_id})}if(o.length>0){const{error:l}=await Y.from("contact_plan_cycles").insert(o);if(l)throw l}return o.length},onSuccess:t=>{e.invalidateQueries({queryKey:["contact-plan-cycles"]}),t&&t>0&&Sa({title:`${t} contact(s) enrolled in plans`})}})},MRe=()=>{const e=Yc(),{data:t}=Fgt(),{data:n}=cae(30);return Zt({queryKey:["today-actions",e,t==null?void 0:t.length,n==null?void 0:n.length],queryFn:async()=>{var N;if(!t||t.length===0)return[];const{data:s}=await Y.from("contact_snoozes").select("contact_id").gte("snoozed_until",new Date().toISOString()),a=new Set((s==null?void 0:s.map(k=>k.contact_id))||[]),o=new Date,l=[],i=new Date(o.getFullYear(),o.getMonth(),1),u=new Set((n==null?void 0:n.filter(k=>new Date(k.completed_at)>=i).map(k=>`${k.contact_id}-${k.action_type_id}`))||[]);for(const k of t){if(!((N=k.plan)!=null&&N.items)||k.plan.items.length===0||!k.contact||a.has(k.contact_id))continue;const M=new Date(k.cycle_start_date),T=Math.floor((o.getTime()-M.getTime())/(30.44*24*60*60*1e3))%12+1,P=k.plan.items.find(F=>F.month_number===T);if(P&&P.action_type){const F=`${k.contact_id}-${P.action_type_id}`;if(!u.has(F)){const{data:D}=await Y.from("relationship_types").select("name").eq("id",k.relationship_type_id).single();l.push({contact:k.contact,actionType:P.action_type,script:P.default_script||void 0,planName:k.plan.name,relationshipTypeName:(D==null?void 0:D.name)||"",monthNumber:T})}}}const m=5,x=o.getDate(),y=l.sort((k,M)=>k.contact.first_name.localeCompare(M.contact.first_name)),v=(x-1)%Math.max(1,y.length);return[...y.slice(v),...y.slice(0,v)].slice(0,m)},enabled:!!e&&!!t})};function Bgt(){const e=Vn(),{data:t,isLoading:n}=MRe(),{data:s}=Nf(),a=CRe(),[o,l]=A.useState(sre()),[i,u]=A.useState(""),[m,x]=A.useState(!1);A.useEffect(()=>{l(sre())},[]);const y=()=>{const U=parseInt(i,10);if(isNaN(U)||U<1){Sa({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(U),SRe(U),x(!1),Sa({title:"Goal updated",description:`Weekly touch goal set to ${U}`})},v=()=>{u(o.toString()),x(!0)},b=Sm(new Date),N=Ql(b,7),k=U=>{if(!U)return null;const V=U.split(/[-/T]/);if(V.length<3)return null;const W=parseInt(V[1],10)-1,G=parseInt(V[2],10);return isNaN(W)||isNaN(G)?null:new Date(b.getFullYear(),W,G)},M=(s==null?void 0:s.map(U=>{const V=k(U.birthday),W=k(U.home_anniversary),G=[];return V&&V>=b&&V<=N&&G.push({contact:U,type:"birthday",date:V,isToday:ac(V,b)}),W&&W>=b&&W<=N&&G.push({contact:U,type:"anniversary",date:W,isToday:ac(W,b)}),G}).flat().sort((U,V)=>U.date.getTime()-V.date.getTime()).slice(0,3))||[],I=(s==null?void 0:s.filter(U=>{const V=k(U.birthday),W=k(U.home_anniversary);return V&&ac(V,b)||W&&ac(W,b)}).length)||0,T=(t==null?void 0:t.length)||0,P=I+T,F=(a==null?void 0:a.actionsThisWeek)||0,D=(a==null?void 0:a.streak)||0;return n?r.jsx(He,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{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(He,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:D>0&&r.jsxs(At,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(fm,{className:"h-3 w-3"}),D," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[P>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[P," tasks"]})," for today"]}):"No tasks for today",F>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:F})," touches this week"]})]})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control/contacts?new=true")},children:[r.jsx(th,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control")},children:[r.jsx(Ai,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:U=>{U.stopPropagation(),e("/mission-control/video/record")},children:[r.jsx(Ia,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control/popbys")},children:[r.jsx(Do,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(Q,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:U=>{U.stopPropagation(),e("/mission-control/pipeline")},children:[r.jsx(hy,{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(xy,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Rr,{open:m,onOpenChange:x,children:[r.jsx(Fo,{asChild:!0,children:r.jsx("button",{onClick:v,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(zd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Dr,{className:"sm:max-w-[360px]",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Set Weekly Goal"}),r.jsx(Yn,{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(ze,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(lt,{id:"weekly-goal",type:"number",min:"1",value:i,onChange:U=>u(U.target.value),placeholder:"20",onKeyDown:U=>{U.key==="Enter"&&y()}})]}),r.jsx(Q,{onClick:y,className:"w-full",children:"Save Goal"})]})]})]})]}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-primary",children:F}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(Mc,{value:Math.min(F/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),F>=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."]}),F0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-F," more to hit your weekly goal"]})]}),M.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(mm,{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:M.map((U,V)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${U.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:W=>{W.stopPropagation(),e(`/mission-control/contacts/${U.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[U.type==="birthday"?r.jsx(mm,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(ya,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[U.contact.first_name," ",U.contact.last_name]}),U.isToday&&r.jsx(At,{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:U.isToday?U.type==="birthday"?"🎂":"🏠":on(U.date,"EEE, MMM d")}),r.jsx(Gi,{className:"h-3 w-3"})]})]},`${U.contact.id}-${U.type}-${V}`))})]}),r.jsxs(Q,{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(No,{className:"h-4 w-4"})]})]})]})}const TRe=()=>Zt({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:e,error:t}=await Y.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(t)throw t;return(e==null?void 0:e.enabled)??!1}}),ARe=e=>{const{user:t,brokerageId:n}=tn();return Zt({queryKey:["listings",e,n],queryFn:async()=>{let s=Y.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:a,error:o}=await s;if(o)throw o;let l=a||[];if(n){const{data:i}=await Y.from("profiles").select("id").eq("brokerage_id",n);if(i&&i.length>0){const u=i.map(y=>y.id);let m=Y.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",u);e!=null&&e.status&&(m=m.eq("status",e.status)),e!=null&&e.propertyType&&(m=m.eq("property_type",e.propertyType)),e!=null&&e.city&&(m=m.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(m=m.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(m=m.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(m=m.eq("open_to_referrals",!0));const{data:x}=await m;if(x){const y=new Set(l.map(b=>b.id)),v=x.filter(b=>!y.has(b.id));l=[...l,...v]}}}switch(e==null?void 0:e.sortBy){case"updated":l.sort((i,u)=>new Date(u.updated_at).getTime()-new Date(i.updated_at).getTime());break;case"price_asc":l.sort((i,u)=>i.price-u.price);break;case"price_desc":l.sort((i,u)=>u.price-i.price);break;default:l.sort((i,u)=>new Date(u.created_at).getTime()-new Date(i.created_at).getTime())}return l}})},ERe=()=>{const{user:e}=tn();return Zt({queryKey:["my-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})},IRe=e=>{const{user:t}=tn();return Zt({queryKey:["listing",e],queryFn:async()=>{const{data:n,error:s}=await Y.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 Y.from("listing_views").insert({listing_id:e,viewer_id:t.id}),n},enabled:!!e})},$gt=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s,error:a}=await Y.from("listings").insert({...n,agent_id:t.id}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Ugt=()=>{const e=Vr();return ar({mutationFn:async({agentId:t,...n})=>{const{data:s,error:a}=await Y.from("listings").insert({...n,agent_id:t}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["brokerage-listings"]})}})},qgt=()=>{const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("listings").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["listing",t.id]})}})},PRe=()=>{const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("listings").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Vgt=()=>{const e=Vr();return ar({mutationFn:async({listingId:t,photoUrl:n,isPrimary:s=!1})=>{const{data:a,error:o}=await Y.from("listing_photos").insert({listing_id:t,photo_url:n,is_primary:s}).select().single();if(o)throw o;return a},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t.listing_id]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Hgt=()=>{const e=Vr();return ar({mutationFn:async({photoId:t,listingId:n})=>{const{error:s}=await Y.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"]})}})},Wgt=()=>{const{user:e}=tn();return Zt({queryKey:["saved-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.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})},LRe=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await Y.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await Y.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await Y.from("listing_saves").insert({listing_id:n,agent_id:t.id}),{saved:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["saved-listings"]}),e.invalidateQueries({queryKey:["listings"]})}})},ORe=e=>{const{user:t}=tn();return Zt({queryKey:["listing-saved",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await Y.from("listing_saves").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},Ggt=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await Y.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await Y.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await Y.from("listing_follows").insert({listing_id:n,agent_id:t.id}),{following:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["listing-following"]})}})},Kgt=e=>{const{user:t}=tn();return Zt({queryKey:["listing-following",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await Y.from("listing_follows").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},Zgt=()=>{const{user:e}=tn();return ar({mutationFn:async({listingId:t,shareType:n})=>{if(!e)throw new Error("Not authenticated");const{error:s}=await Y.from("listing_shares").insert({listing_id:t,sharing_agent_id:e.id,share_type:n});if(s)throw s}})},Ygt=()=>{const{user:e}=tn();return Zt({queryKey:["my-referrals",e==null?void 0:e.id],queryFn:async()=>{if(!e)return{sent:[],received:[]};const[t,n]=await Promise.all([Y.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",e.id).order("created_at",{ascending:!1}),Y.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})},Xgt=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async({listingId:n,listingAgentId:s,buyerName:a,buyerType:o,notes:l})=>{if(!t)throw new Error("Not authenticated");const{data:i,error:u}=await Y.from("listing_referrals").insert({listing_id:n,sender_agent_id:t.id,listing_agent_id:s,buyer_name:a,buyer_type:o,notes:l}).select().single();if(u)throw u;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["my-referrals"]})}})},Qgt=()=>Zt({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:e}=await Y.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 m;const i=l.sharing_agent_id;if(!i)return;const u=t.get(i);u?u.count++:t.set(i,{name:((m=l.profiles)==null?void 0:m.name)||"Unknown",count:1})});const n=Array.from(t.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10),{data:s}=await Y.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),a=new Map;s==null||s.forEach(l=>{var u;const i=a.get(l.agent_id);i?i.count++:a.set(l.agent_id,{name:((u=l.agent)==null?void 0:u.name)||"Unknown",count:1})});const o=Array.from(a.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10);return{topSharers:n,topListers:o}}}),Jgt=()=>{const{user:e,brokerageId:t}=tn();return Zt({queryKey:["brokerage-listings",t],queryFn:async()=>{if(!e||!t)return[];const{data:n}=await Y.from("profiles").select("id").eq("brokerage_id",t);if(!n||n.length===0)return[];const s=n.map(l=>l.id),{data:a,error:o}=await Y.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 a},enabled:!!e&&!!t})},DRe=({className:e,variant:t="default"})=>r.jsx(At,{variant:"outline",className:Ut("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"}),ext={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"},txt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function rxt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function nxt(){const e=Vn(),{data:t,isLoading:n}=TRe(),{data:s,isLoading:a}=ARe({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),i=o.filter(x=>!x.is_featured),u=[...l,...i].slice(0,6),m=n||a;return!m&&!t?null:m?r.jsx(He,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(et,{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(DRe,{})]}),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(No,{className:"h-4 w-4"})]})]}),u.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(ya,{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(Q,{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:u.map(x=>{var v,b;const y=((v=x.photos)==null?void 0:v.find(N=>N.is_primary))||((b=x.photos)==null?void 0:b[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(ya,{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(At,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(ks,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(At,{className:`text-[10px] px-1.5 py-0.5 ${ext[x.status]}`,children:txt[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:rxt(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 RRe(e=10,t){return Zt({queryKey:["event-leaderboard",e,t],queryFn:async()=>{const{data:n}=await Y.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(v=>v.user_id))||[]);let a=null;if(t){const{data:v}=await Y.from("profiles").select("id").eq("brokerage_id",t);a=new Set((v==null?void 0:v.map(b=>b.id))||[])}const{data:o,error:l}=await Y.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 i=o.filter(v=>!s.has(v.user_id));a&&(i=i.filter(v=>a.has(v.user_id)));const u=i.slice(0,e),m=u.map(v=>v.user_id),{data:x}=await Y.from("profiles").select("id, name").in("id",m),y=new Map((x==null?void 0:x.map(v=>[v.id,{name:v.name}]))||[]);return u.map(v=>({user_id:v.user_id,total_points:v.total_points,total_events_attended:v.total_events_attended,current_streak:v.current_streak,profile:y.get(v.user_id)||null}))}})}function FRe(e){return Zt({queryKey:["user-attendance-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Y.from("agent_attendance_stats").select("*").eq("user_id",e).single();if(n&&n.code!=="PGRST116")throw n;return t},enabled:!!e})}function zRe(e){return Zt({queryKey:["user-badges",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.from("agent_badges").select("*").eq("user_id",e).order("earned_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function BRe(e,t){return Zt({queryKey:["user-rank",e,t],queryFn:async()=>{if(!e)return null;const{data:n}=await Y.from("agent_attendance_stats").select("total_points").eq("user_id",e).single();if(!n)return null;const{data:s}=await Y.from("user_roles").select("user_id").eq("role","admin"),a=new Set((s==null?void 0:s.map(u=>u.user_id))||[]),{data:o,error:l}=await Y.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(l)throw l;let i=(o==null?void 0:o.filter(u=>!a.has(u.user_id)))||[];if(t){const{data:u}=await Y.from("profiles").select("id").eq("brokerage_id",t),m=new Set((u==null?void 0:u.map(x=>x.id))||[]);i=i.filter(x=>m.has(x.user_id))}return i.length+1},enabled:!!e})}function sxt(){const{user:e,brokerageId:t,isAdmin:n}=tn();Vn();const s=!!t,[a,o]=A.useState("brokerage"),l=()=>{if(n)return null;if(s)return a==="global"?null:t},{data:i,isLoading:u}=RRe(5,l()),{data:m}=FRe(e==null?void 0:e.id),{data:x}=BRe(e==null?void 0:e.id,l()),{data:y}=zRe(e==null?void 0:e.id),v=n||s,b=()=>n?"Agent Leaderboard":s?a==="global"?"All LevelUp":"My Brokerage":"My Points";if(u)return r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(io,{className:"h-4 w-4 text-yellow-500"}),b()]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-2",children:[...Array(v?5:3)].map((k,M)=>r.jsx(Er,{className:"h-10 w-full"},M))})})]});const N=k=>k===0?r.jsx(io,{className:"h-4 w-4 text-yellow-500 mx-auto"}):k===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):k===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:k+1});if(v){const k=(i==null?void 0:i.slice(0,5))||[];return r.jsxs(He,{children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(io,{className:"h-4 w-4 text-yellow-500"}),b()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(Q,{variant:a==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(Q,{variant:a==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(et,{children:[!n&&m&&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:m.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:m.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[k.map((M,I)=>{var T,P,F;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${M.user_id===(e==null?void 0:e.id)?"bg-primary/10 border border-primary/20":I===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:N(I)}),r.jsx(ea,{className:"h-6 w-6",children:r.jsx(ta,{className:"text-xs",children:((P=(T=M.profile)==null?void 0:T.name)==null?void 0:P.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((F=M.profile)==null?void 0:F.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:M.total_points})]},M.user_id)}),k.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(co,{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(ao,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Gi,{className:"h-4 w-4"})]})]})]})}return r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(io,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(et,{children:m?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:m.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:m.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(fm,{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:[m.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(Bl,{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(k=>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:k.badge_name},k.id)),y.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",y.length-4," more"]})]})]}),r.jsxs(co,{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(ao,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Gi,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(ks,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(co,{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(ao,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Gi,{className:"h-4 w-4"})]})]})})]})}const dae=()=>Zt({queryKey:["lead-sources"],queryFn:async()=>{const{data:e,error:t}=await Y.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}}),axt=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{data:s,error:a}=await Y.from("lead_sources").insert({name:n,owner_user_id:t==null?void 0:t.id,sort_order:100}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["lead-sources"]}),Ae.success("Lead source added")},onError:n=>{Ae.error("Failed to add lead source"),console.error(n)}})},Rye=(e,t)=>{const{user:n,isAdmin:s}=tn(),a=s&&t?t:n==null?void 0:n.id;return Zt({queryKey:["scorecard-transactions",e,a],queryFn:async()=>{let o=Y.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",a).order("close_date",{ascending:!1});e&&(o=o.gte("close_date",`${e}-01-01`).lte("close_date",`${e}-12-31`));const{data:l,error:i}=await o;if(i)throw i;return l},enabled:!!a})},$Re=e=>{const{user:t,isAdmin:n}=tn(),s=n&&e?e:t==null?void 0:t.id;return Zt({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:a,error:o}=await Y.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 a},enabled:!!s})},uae=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{data:s,error:a}=await Y.from("scorecard_transactions").insert({...n,owner_user_id:t.id}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ae.success("Transaction added")},onError:n=>{Ae.error("Failed to add transaction"),console.error(n)}})},ixt=()=>{const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("scorecard_transactions").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ae.success("Transaction updated")},onError:t=>{Ae.error("Failed to update transaction"),console.error(t)}})},oxt=()=>{const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("scorecard_transactions").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ae.success("Transaction deleted")},onError:t=>{Ae.error("Failed to delete transaction"),console.error(t)}})},URe=(e,t)=>{const{user:n,isAdmin:s}=tn(),a=s&&t?t:n==null?void 0:n.id;return Zt({queryKey:["scorecard-goals",e,a],queryFn:async()=>{const{data:o,error:l}=await Y.from("scorecard_goals").select("*").eq("owner_user_id",a).eq("year",e).maybeSingle();if(l)throw l;return o},enabled:!!a})},lxt=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{data:s,error:a}=await Y.from("scorecard_goals").upsert({...n,owner_user_id:t.id},{onConflict:"owner_user_id,year"}).select().single();if(a)throw a;return s},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["scorecard-goals",s.year]}),Ae.success("Goals saved")},onError:n=>{Ae.error("Failed to save goals"),console.error(n)}})},hae=()=>{const{user:e}=tn();return Zt({queryKey:["scorecard-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.from("scorecard_settings").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t},enabled:!!(e!=null&&e.id)})},cxt=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{data:s,error:a}=await Y.from("scorecard_settings").upsert({...n,user_id:t.id},{onConflict:"user_id"}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-settings"]}),Ae.success("Settings saved")},onError:n=>{Ae.error("Failed to save settings"),console.error(n)}})},qRe=(e,t)=>{const{data:n,isLoading:s}=Rye(e,t),{data:a,isLoading:o}=$Re(t),{data:l}=hae(),i=(l==null?void 0:l.show_commission)??!0,u=m=>{if(!m||m.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const x=m.filter(F=>F.transaction_type==="buyer").length,y=m.filter(F=>F.transaction_type==="seller").length,v=m.reduce((F,D)=>F+Number(D.sale_price),0),b=m.reduce((F,D)=>F+(Number(D.commission_amount)||0),0),N={};m.forEach(F=>{var U;const D=((U=F.lead_source)==null?void 0:U.name)||"Unknown";N[D]=(N[D]||0)+1});const k=Object.entries(N).map(([F,D])=>({name:F,count:D})).sort((F,D)=>D.count-F.count),M=k[0]||null,I={};m.forEach(F=>{const D=new Date(F.close_date).toLocaleString("default",{month:"short"});I[D]=(I[D]||0)+1});const P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(F=>({month:F,count:I[F]||0}));return{totalTransactions:m.length,buyerCount:x,sellerCount:y,totalVolume:v,averagePrice:m.length>0?v/m.length:0,totalCommission:i?b:0,topLeadSource:M,transactionsByMonth:P,leadSourceBreakdown:k}};return{yearStats:u(n),lifetimeStats:u(a),isLoading:s||o,showCommission:i}},dxt=()=>{const{isAdmin:e}=tn();return Zt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:t,error:n}=await Y.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:a,error:o}=await Y.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return a},enabled:e})},Q0={recency:40,touchpoints:30,transactions:20},QNe={warm:70,cooling:40};function uxt(e){return e===null?0:e<=14?Q0.recency:e<=30?Q0.recency*.85:e<=60?Q0.recency*.65:e<=90?Q0.recency*.4:e<=180?Q0.recency*.2:Q0.recency*.05}function hxt(e){const t=Math.min(e/12,1);return Math.round(Q0.touchpoints*t)}function mxt(e){return e?Q0.transactions:0}function fxt(){return 0}function pxt(e){return e>=QNe.warm?"warm":e>=QNe.cooling?"cooling":"at-risk"}function Fye(){const{data:e,isLoading:t}=Nf(),{data:n}=jRe(),{data:s}=cae(365),{data:a}=$Re(),o=A.useMemo(()=>{if(!e)return[];const i=new Date,u=cft(i),m={};s==null||s.forEach(y=>{new Date(y.completed_at)>=u&&(m[y.contact_id]=(m[y.contact_id]||0)+1)});const x=new Set((a==null?void 0:a.filter(y=>y.contact_id).map(y=>y.contact_id))||[]);return e.map(y=>{const v=(n==null?void 0:n[y.id])||null,b=v?Iy(i,new Date(v)):null,N=m[y.id]||0,k=x.has(y.id),M=uxt(b),I=hxt(N),T=mxt(k),P=fxt(),F=Math.round(M+I+T+P),D={score:F,status:pxt(F),breakdown:{recency:Math.round(M),touchpoints:Math.round(I),transactions:Math.round(T),referrals:Math.round(P)},lastTouchDate:v,daysSinceTouch:b,touchCountLast12Months:N,hasTransaction:k};return{...y,relationshipScore:D}})},[e,n,s,a]),l=A.useMemo(()=>{const i=o.filter(v=>v.relationshipScore.status==="warm").length,u=o.filter(v=>v.relationshipScore.status==="cooling").length,m=o.filter(v=>v.relationshipScore.status==="at-risk").length,x=o.length,y=x>0?Math.round(o.reduce((v,b)=>v+b.relationshipScore.score,0)/x):0;return{warm:i,cooling:u,atRisk:m,total:x,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:t}}function VRe(){const e=Vn(),{stats:t,contactsWithScores:n,isLoading:s}=Fye();if(s)return r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Er,{className:"h-5 w-40"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Er,{className:"h-20 w-full"}),r.jsx(Er,{className:"h-16 w-full"})]})]});if(t.total===0)return r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(Q,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>e("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const a=Math.round(t.warm/t.total*100),o=Math.round(t.cooling/t.total*100),l=Math.round(t.atRisk/t.total*100),i=n.filter(u=>u.relationshipScore.status==="at-risk").sort((u,m)=>u.relationshipScore.score-m.relationshipScore.score).slice(0,3);return r.jsxs(He,{children:[r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx(eh,{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(et,{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," (",a,"%)"]})]}),r.jsx(Mc,{value:a,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(Mc,{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(Mc,{value:l,className:"h-2 bg-muted [&>div]:bg-red-500"})]})]}),i.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(qj,{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:i.map(u=>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/${u.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:[u.first_name," ",u.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:u.relationshipScore.daysSinceTouch===null?"Never":`${u.relationshipScore.daysSinceTouch}d`}),r.jsx(Gi,{className:"h-3 w-3"})]})]},u.id))})]}),r.jsxs(Q,{variant:"outline",size:"sm",className:"w-full",onClick:()=>e("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Gi,{className:"h-4 w-4 ml-1"})]})]})]})}const gxt=()=>{var ne,fe;const{user:e,isAdmin:t}=tn(),n=Vn(),[s,a]=A.useState([]),[o,l]=A.useState([]),[i,u]=A.useState([]),[m,x]=A.useState([]),[y,v]=A.useState([]),[b,N]=A.useState([]),[k,M]=A.useState(new Set),[I,T]=A.useState([]),[P,F]=A.useState([]),[D,U]=A.useState([]),[V,W]=A.useState(!0);A.useEffect(()=>{G()},[e]);const G=async()=>{var se,me,ue,xe;try{const[Te,_e,we,ve,Xe,Me,Ie,$e,Be,Ve]=await Promise.all([Y.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),Y.from("app_tiles").select("*").order("name"),Y.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),Y.from("events").select("*").order("event_date",{ascending:!0}),Y.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e==null?void 0:e.id),Y.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),Y.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Y.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Y.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),Y.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),ot=((se=Te.data)==null?void 0:se.map(Je=>Je.tag))||[],Tt=new Set(((me=we.data)==null?void 0:me.map(Je=>Je.app_id))||[]);M(Tt);const at=(((ue=_e.data)==null?void 0:ue.filter(Je=>!Je.required_tags||Je.required_tags.length===0?!0:Je.required_tags.some(st=>ot.includes(st))))||[]).sort((Je,st)=>Je.name==="LevelUp Members Portal"?-1:st.name==="LevelUp Members Portal"?1:0);a(at.slice(0,6));const le=((xe=ve.data)==null?void 0:xe.filter(Je=>Y4(Je.event_date)!=="ended"))||[];l(le.slice(0,4)),T(Xe.data||[]),u(Me.data||[]),x(Ie.data||[]),v($e.data||[]),N(Be.data||[]);const qe=Ve.data||[];F(qe.filter(Je=>Je.placement==="top")),U(qe.filter(Je=>Je.placement==="between"))}catch(Te){console.error("Error loading dashboard:",Te),Ae.error("Failed to load dashboard data")}finally{W(!1)}},ee=async se=>{var ue;const me=window.open("about:blank","_blank");try{await Y.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:se.app_id,app_name:se.name,user_agent:navigator.userAgent});const{data:xe,error:Te}=await Y.functions.invoke("sso-launch",{body:{app_id:se.app_id}});if(Te)throw Te;xe!=null&&xe.redirect_url?me&&!me.closed?(me.location.href=xe.redirect_url,(ue=me.focus)==null||ue.call(me)):window.location.assign(xe.redirect_url):(me==null||me.close(),Ae.error("Launch link unavailable"))}catch(xe){me==null||me.close(),console.error("Error launching app:",xe),Ae.error("Failed to launch app")}},ae=se=>I==null?void 0:I.some(me=>me.event_id===se),oe=se=>{const me=I==null?void 0:I.find(ue=>ue.event_id===se);return me==null?void 0:me.zoom_join_url};if(V)return r.jsx(Fr,{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 pe=se=>D.filter(me=>me.section_after===se);return r.jsxs(Fr,{title:"Dashboard",children:[r.jsx(fgt,{events:o,registrations:I,onNavigateToEvents:()=>n("/events")}),P.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(uT,{banners:P})}),r.jsx(Ngt,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((fe=(ne=e==null?void 0:e.user_metadata)==null?void 0:ne.name)==null?void 0:fe.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(Bgt,{}),r.jsx(VRe,{}),r.jsx(sxt,{})]}),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(Q,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(No,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{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 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(se=>{const me=ae(se.id),ue=oe(se.id)||se.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 ${KNe(se.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[KNe(se.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(Uj,{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(se.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(se.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:se.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(se.event_date))," at ",RE(new Date(se.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:me?r.jsxs(Q,{size:"sm",variant:"default",className:"gap-1",onClick:xe=>{xe.stopPropagation(),window.open(ue,"_blank")},children:[r.jsx(Ss,{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(Gi,{className:"h-4 w-4"})]})})]},se.id)})})]}),pe("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(uT,{banners:pe("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(Q,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(No,{className:"h-4 w-4"})]})]}),y.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(rf,{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(se=>r.jsxs("div",{onClick:()=>n(`/academy/${se.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:[se.thumbnail_url?r.jsx("img",{src:se.thumbnail_url,alt:se.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(rf,{className:"h-8 w-8 text-muted-foreground/50"})}),se.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:se.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:se.title})})]},se.id))})]}),pe("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(uT,{banners:pe("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(Q,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(No,{className:"h-4 w-4"})]})]}),m.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ap,{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:m.map(se=>r.jsxs("div",{onClick:()=>n(`/toolbox/${se.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:se.featured_image_url?r.jsx("img",{src:se.featured_image_url,alt:se.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(Ap,{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:se.name})})]},se.id))})]}),pe("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(uT,{banners:pe("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(Q,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(No,{className:"h-4 w-4"})]})]}),i.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(q1,{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:i.map(se=>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:se.preview_image_url?r.jsx("img",{src:se.preview_image_url,alt:se.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(q1,{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:se.name})})]},se.id))})]}),pe("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(uT,{banners:pe("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(nxt,{})}),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(Q,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(No,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Mp,{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(se=>{const me=k.has(se.id);return r.jsxs("div",{onClick:()=>ee(se),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:se.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:se.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:se.description})]}),me&&r.jsx(Mp,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},se.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(Q,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(No,{className:"h-4 w-4"})]})]}),b.length===0?r.jsx(He,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Os,{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:b.map(se=>r.jsxs("div",{onClick:()=>window.open(se.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:se.preview_image_url?r.jsx("img",{src:se.preview_image_url,alt:se.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(Os,{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:se.name}),se.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:se.description})]})]},se.id))})]})]})};var mae="Switch",[xxt]=cc(mae),[yxt,vxt]=xxt(mae),HRe=A.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:u="on",onCheckedChange:m,form:x,...y}=e,[v,b]=A.useState(null),N=ca(t,P=>b(P)),k=A.useRef(!1),M=v?x||!!v.closest("form"):!0,[I,T]=rh({prop:a,defaultProp:o??!1,onChange:m,caller:mae});return r.jsxs(yxt,{scope:n,checked:I,disabled:i,children:[r.jsx(Fn.button,{type:"button",role:"switch","aria-checked":I,"aria-required":l,"data-state":ZRe(I),"data-disabled":i?"":void 0,disabled:i,value:u,...y,ref:N,onClick:gn(e.onClick,P=>{T(F=>!F),M&&(k.current=P.isPropagationStopped(),k.current||P.stopPropagation())})}),M&&r.jsx(KRe,{control:v,bubbles:!k.current,name:s,value:u,checked:I,required:l,disabled:i,form:x,style:{transform:"translateX(-100%)"}})]})});HRe.displayName=mae;var WRe="SwitchThumb",GRe=A.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,a=vxt(WRe,n);return r.jsx(Fn.span,{"data-state":ZRe(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})});GRe.displayName=WRe;var _xt="SwitchBubbleInput",KRe=A.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...a},o)=>{const l=A.useRef(null),i=ca(l,o),u=oP(n),m=KI(t);return A.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==n&&b){const N=new Event("click",{bubbles:s});b.call(x,n),x.dispatchEvent(N)}},[u,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});KRe.displayName=_xt;function ZRe(e){return e?"checked":"unchecked"}var YRe=HRe,bxt=GRe;const As=A.forwardRef(({className:e,...t},n)=>r.jsx(YRe,{className:Ut("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(bxt,{className:Ut("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")})}));As.displayName=YRe.displayName;var XRe="AlertDialog",[wxt]=cc(XRe,[wOe]),Vy=wOe(),QRe=e=>{const{__scopeAlertDialog:t,...n}=e,s=Vy(t);return r.jsx(Lse,{...s,...n,modal:!0})};QRe.displayName=XRe;var jxt="AlertDialogTrigger",JRe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vy(n);return r.jsx(Zxe,{...a,...s,ref:t})});JRe.displayName=jxt;var kxt="AlertDialogPortal",eFe=e=>{const{__scopeAlertDialog:t,...n}=e,s=Vy(t);return r.jsx(Ose,{...s,...n})};eFe.displayName=kxt;var Nxt="AlertDialogOverlay",tFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vy(n);return r.jsx(T3,{...a,...s,ref:t})});tFe.displayName=Nxt;var X4="AlertDialogContent",[Sxt,Cxt]=wxt(X4),Mxt=aIe("AlertDialogContent"),rFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,o=Vy(n),l=A.useRef(null),i=ca(t,l),u=A.useRef(null);return r.jsx(Blt,{contentName:X4,titleName:nFe,docsSlug:"alert-dialog",children:r.jsx(Sxt,{scope:n,cancelRef:u,children:r.jsxs(A3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:gn(a.onOpenAutoFocus,m=>{var x;m.preventDefault(),(x=u.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(Mxt,{children:s}),r.jsx(Axt,{contentRef:l})]})})})});rFe.displayName=X4;var nFe="AlertDialogTitle",sFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vy(n);return r.jsx(aP,{...a,...s,ref:t})});sFe.displayName=nFe;var aFe="AlertDialogDescription",iFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vy(n);return r.jsx(iP,{...a,...s,ref:t})});iFe.displayName=aFe;var Txt="AlertDialogAction",oFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Vy(n);return r.jsx(Dse,{...a,...s,ref:t})});oFe.displayName=Txt;var lFe="AlertDialogCancel",cFe=A.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=Cxt(lFe,n),o=Vy(n),l=ca(t,a);return r.jsx(Dse,{...o,...s,ref:l})});cFe.displayName=lFe;var Axt=({contentRef:e})=>{const t=`\`${X4}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${X4}\` by passing a \`${aFe}\` 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 \`${X4}\`. 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 A.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Ext=QRe,Ixt=JRe,Pxt=eFe,dFe=tFe,uFe=rFe,hFe=oFe,mFe=cFe,fFe=sFe,pFe=iFe;const Pd=Ext,kp=Ixt,Lxt=Pxt,gFe=A.forwardRef(({className:e,...t},n)=>r.jsx(dFe,{className:Ut("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}));gFe.displayName=dFe.displayName;const ld=A.forwardRef(({className:e,...t},n)=>r.jsxs(Lxt,{children:[r.jsx(gFe,{}),r.jsx(uFe,{ref:n,className:Ut("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})]}));ld.displayName=uFe.displayName;const cd=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col space-y-2 text-center sm:text-left",e),...t});cd.displayName="AlertDialogHeader";const dd=({className:e,...t})=>r.jsx("div",{className:Ut("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});dd.displayName="AlertDialogFooter";const ud=A.forwardRef(({className:e,...t},n)=>r.jsx(fFe,{ref:n,className:Ut("text-lg font-semibold",e),...t}));ud.displayName=fFe.displayName;const hd=A.forwardRef(({className:e,...t},n)=>r.jsx(pFe,{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));hd.displayName=pFe.displayName;const Uc=A.forwardRef(({className:e,...t},n)=>r.jsx(hFe,{ref:n,className:Ut(EE(),e),...t}));Uc.displayName=hFe.displayName;const md=A.forwardRef(({className:e,...t},n)=>r.jsx(mFe,{ref:n,className:Ut(EE({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));md.displayName=mFe.displayName;const Oxt=[{key:"contacts",label:"Contacts",icon:Ai,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:Fj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:Ia,description:"View and upload videos"},{key:"listings",label:"Listings",icon:ya,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:aA,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:Do,description:"View and log pop-bys"}];function Dxt(){var D;const{user:e}=tn(),[t,n]=A.useState([]),[s,a]=A.useState(!0),[o,l]=A.useState(!1),[i,u]=A.useState(!1),[m,x]=A.useState(null),[y,v]=A.useState({email:"",name:"",password:""}),[b,N]=A.useState(!1),[k,M]=A.useState(null);A.useEffect(()=>{e&&I()},[e]);const I=async()=>{if(e){a(!0);try{const{data:U,error:V}=await Y.from("agent_assistant_assignments").select("id, assistant_id, permissions, created_at").eq("agent_id",e.id);if(V)throw V;if(U&&U.length>0){const W=U.map(ae=>ae.assistant_id),{data:G}=await Y.from("profiles").select("id, name, email").in("id",W),ee=U.map(ae=>{const oe=G==null?void 0:G.find(pe=>pe.id===ae.assistant_id);return{...ae,permissions:ae.permissions,assistant_profile:oe?{name:oe.name||"",email:oe.email||""}:void 0}});n(ee)}else n([])}catch(U){console.error("Error loading assistants:",U)}finally{a(!1)}}},T=async()=>{if(!e||!y.email.trim()||!y.name.trim()||!y.password.trim()){Ae.error("Please fill in all fields");return}if(y.password.length<6){Ae.error("Password must be at least 6 characters");return}if(t.length>=1){Ae.error("You can only have 1 assistant");return}N(!0);try{const{data:{session:U}}=await Y.auth.getSession();if(!U)throw new Error("Not authenticated");const V=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${U.access_token}`},body:JSON.stringify({email:y.email.trim(),password:y.password,name:y.name.trim(),purpose:"assistant"})}),W=await V.json();if(!V.ok)throw new Error(W.error||"Failed to create assistant account");const G=W.userId||W.id;if(!G)throw new Error("No user ID returned");const ee=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${U.access_token}`},body:JSON.stringify({userId:G,role:"assistant",action:"add",agentId:e.id})}),ae=await ee.json();if(!ee.ok)throw new Error(ae.error||"Failed to assign assistant role");const{error:oe}=await Y.from("agent_assistant_assignments").insert({agent_id:e.id,assistant_id:G,permissions:{contacts:!0,pipeline:!0,videos:!1,listings:!1,scorecard:!1,popbys:!1}});if(oe)throw oe;Ae.success(`Assistant account created for ${y.name.trim()}`),l(!1),v({email:"",name:"",password:""}),I()}catch(U){console.error("Error adding assistant:",U),Ae.error(U.message||"Failed to add assistant")}finally{N(!1)}},P=async()=>{if(!(!m||!e))try{const{data:{session:U}}=await Y.auth.getSession();if(!U)throw new Error("Not authenticated");const{error:V}=await Y.from("agent_assistant_assignments").delete().eq("id",m.id);if(V)throw V;const{data:W}=await Y.from("agent_assistant_assignments").select("id").eq("assistant_id",m.assistant_id);(!W||W.length===0)&&await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${U.access_token}`},body:JSON.stringify({userId:m.assistant_id,role:"assistant",action:"remove"})}),Ae.success("Assistant removed"),u(!1),x(null),I()}catch(U){console.error("Error removing assistant:",U),Ae.error(U.message||"Failed to remove assistant")}},F=async(U,V,W)=>{M(U);try{const G=t.find(oe=>oe.id===U);if(!G)return;const ee={...G.permissions,[V]:W},{error:ae}=await Y.from("agent_assistant_assignments").update({permissions:ee}).eq("id",U);if(ae)throw ae;n(oe=>oe.map(pe=>pe.id===U?{...pe,permissions:ee}:pe))}catch(G){console.error("Error updating permissions:",G),Ae.error("Failed to update permissions")}finally{M(null)}};return s?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"My Assistant"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"My Assistant"]}),r.jsx(jn,{children:"Add an assistant to help manage your Agent OS"})]}),t.length===0&&r.jsxs(Q,{size:"sm",onClick:()=>l(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Assistant"]})]})}),r.jsx(et,{children:t.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No assistant assigned. Add one to help manage your contacts, deals, and more."}):r.jsx("div",{className:"space-y-4",children:t.map(U=>{var V,W,G,ee;return r.jsxs("div",{className:"border rounded-lg p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ea,{className:"h-10 w-10",children:r.jsx(ta,{children:((W=(V=U.assistant_profile)==null?void 0:V.name)==null?void 0:W.split(" ").map(ae=>ae[0]).join("").toUpperCase())||"A"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((G=U.assistant_profile)==null?void 0:G.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((ee=U.assistant_profile)==null?void 0:ee.email)||""})]}),r.jsxs(At,{variant:"secondary",className:"ml-2",children:[r.jsx(vm,{className:"h-3 w-3 mr-1"}),"Assistant"]})]}),r.jsx(Q,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{x(U),u(!0)},children:r.jsx(Bn,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Permissions"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Oxt.map(ae=>{const oe=ae.icon;return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md border",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oe,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:ae.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ae.description})]})]}),r.jsx(As,{checked:U.permissions[ae.key]||!1,onCheckedChange:pe=>F(U.id,ae.key,pe),disabled:k===U.id})]},ae.key)})})]})]},U.id)})})})]}),r.jsx(Rr,{open:o,onOpenChange:l,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Add Assistant"}),r.jsx(Yn,{children:"Create an account for your assistant. They'll be able to manage the features you enable below."})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"assistant-name",children:"Name"}),r.jsx(lt,{id:"assistant-name",value:y.name,onChange:U=>v({...y,name:U.target.value}),placeholder:"Assistant's full name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"assistant-email",children:"Email"}),r.jsx(lt,{id:"assistant-email",type:"email",value:y.email,onChange:U=>v({...y,email:U.target.value}),placeholder:"assistant@email.com"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"assistant-password",children:"Temporary Password"}),r.jsx(lt,{id:"assistant-password",type:"password",value:y.password,onChange:U=>v({...y,password:U.target.value}),placeholder:"Min 6 characters"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your assistant can change this after their first login."})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(Q,{onClick:T,disabled:b,children:[b&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),r.jsx(Pd,{open:i,onOpenChange:u,children:r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Remove Assistant?"}),r.jsxs(hd,{children:["This will remove ",(D=m==null?void 0:m.assistant_profile)==null?void 0:D.name,"'s access to your Agent OS. Their account will remain active but they won't be able to manage your data."]})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}function eu(e){this.content=e}eu.prototype={constructor:eu,find:function(e){for(var t=0;t>1}};eu.from=function(e){if(e instanceof eu)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new eu(t)};function xFe(e,t,n){for(let s=0;;s++){if(s==e.childCount||s==t.childCount)return e.childCount==t.childCount?null:n;let a=e.child(s),o=t.child(s);if(a==o){n+=a.nodeSize;continue}if(!a.sameMarkup(o))return n;if(a.isText&&a.text!=o.text){for(let l=0;a.text[l]==o.text[l];l++)n++;return n}if(a.content.size||o.content.size){let l=xFe(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function yFe(e,t,n,s){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:n,b:s};let l=e.child(--a),i=t.child(--o),u=l.nodeSize;if(l==i){n-=u,s-=u;continue}if(!l.sameMarkup(i))return{a:n,b:s};if(l.isText&&l.text!=i.text){let m=0,x=Math.min(l.text.length,i.text.length);for(;mt&&s(u,a+i,o||null,l)!==!1&&u.content.size){let x=i+1;u.nodesBetween(Math.max(0,t-x),Math.min(u.content.size,n-x),s,a+x)}i=m}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,s,a){let o="",l=!0;return this.nodesBetween(t,n,(i,u)=>{let m=i.isText?i.text.slice(Math.max(t,u)-u,n-u):i.isLeaf?a?typeof a=="function"?a(i):a:i.type.spec.leafText?i.type.spec.leafText(i):"":"";i.isBlock&&(i.isLeaf&&m||i.isTextblock)&&s&&(l?l=!1:o+=s),o+=m},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,s=t.firstChild,a=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(a[a.length-1]=n.withText(n.text+s.text),o=1);ot)for(let o=0,l=0;lt&&((ln)&&(i.isText?i=i.cut(Math.max(0,t-l),Math.min(i.text.length,n-l)):i=i.cut(Math.max(0,t-l-1),Math.min(i.content.size,n-l-1))),s.push(i),a+=i.nodeSize),l=u}return new pn(s,a)}cutByIndex(t,n){return t==n?pn.empty:t==0&&n==this.content.length?this:new pn(this.content.slice(t,n))}replaceChild(t,n){let s=this.content[t];if(s==n)return this;let a=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return a[t]=n,new pn(a,o)}addToStart(t){return new pn([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new pn(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 a=this.child(n),o=s+a.nodeSize;if(o>=t)return o==t?oO(n+1,o):oO(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 pn.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new pn(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return pn.empty;let n,s=0;for(let a=0;athis.type.rank&&(n||(n=t.slice(0,a)),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-a.type.rank),n}};Ko.none=[];class ire extends Error{}class Kn{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=_Fe(this.content,t+this.openStart,n);return s&&new Kn(s,this.openStart,this.openEnd)}removeBetween(t,n){return new Kn(vFe(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 Kn.empty;let s=n.openStart||0,a=n.openEnd||0;if(typeof s!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Kn(pn.fromJSON(t,n.content),s,a)}static maxOpen(t,n=!0){let s=0,a=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)a++;return new Kn(t,s,a)}}Kn.empty=new Kn(pn.empty,0,0);function vFe(e,t,n){let{index:s,offset:a}=e.findIndex(t),o=e.maybeChild(s),{index:l,offset:i}=e.findIndex(n);if(a==t||o.isText){if(i!=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(vFe(o.content,t-a-1,n-a-1)))}function _Fe(e,t,n,s){let{index:a,offset:o}=e.findIndex(t),l=e.maybeChild(a);if(o==t||l.isText)return s&&!s.canReplace(a,a,n)?null:e.cut(0,t).append(n).append(e.cut(t));let i=_Fe(l.content,t-o-1,n,l);return i&&e.replaceChild(a,l.copy(i))}function Rxt(e,t,n){if(n.openStart>e.depth)throw new ire("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ire("Inconsistent open depths");return bFe(e,t,n,0)}function bFe(e,t,n,s){let a=e.index(s),o=e.node(s);if(a==t.index(s)&&s=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function zA(e,t,n,s){let a=(t||e).node(n),o=0,l=t?t.index(n):a.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(Hj(e.nodeAfter,s),o++));for(let i=o;ia&&Ame(e,t,a+1),l=s.depth>a&&Ame(n,s,a+1),i=[];return zA(null,e,a,i),o&&l&&t.index(a)==n.index(a)?(wFe(o,l),Hj(Wj(o,jFe(e,t,n,s,a+1)),i)):(o&&Hj(Wj(o,ore(e,t,a+1)),i),zA(t,n,a,i),l&&Hj(Wj(l,ore(n,s,a+1)),i)),zA(s,null,a,i),new pn(i)}function ore(e,t,n){let s=[];if(zA(null,e,n,s),e.depth>n){let a=Ame(e,t,n+1);Hj(Wj(a,ore(e,t,n+1)),s)}return zA(t,null,n,s),new pn(s)}function Fxt(e,t){let n=t.depth-e.openStart,a=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)a=t.node(o).copy(pn.from(a));return{start:a.resolveNoCache(e.openStart+n),end:a.resolveNoCache(a.content.size-e.openEnd-n)}}class FE{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],a=t.child(n);return s?t.child(n).cut(s):a}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],a=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 lre(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=[],a=0,o=n;for(let l=t;;){let{index:i,offset:u}=l.content.findIndex(o),m=o-u;if(s.push(l,i,a+u),!m||(l=l.child(i),l.isText))break;o=m-1,a+=u+1}return new FE(n,s,o)}static resolveCached(t,n){let s=JNe.get(t);if(s)for(let o=0;ot&&this.nodesBetween(t,n,o=>(s.isInSet(o.marks)&&(a=!0),!a)),a}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()+")"),kFe(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=pn.empty,a=0,o=s.childCount){let l=this.contentMatchAt(t).matchFragment(s,a,o),i=l&&l.matchFragment(this.content,n);if(!i||!i.validEnd)return!1;for(let u=a;un.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 a=pn.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,a,s);return o.type.checkAttrs(o.attrs),o}};nv.prototype.text=void 0;class cre extends nv{constructor(t,n,s,a){if(super(t,n,null,a),!s)throw new RangeError("Empty text nodes are not allowed");this.text=s}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kFe(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 cre(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new cre(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 kFe(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class hk{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let s=new Uxt(t,n);if(s.next==null)return hk.empty;let a=NFe(s);s.next&&s.err("Unexpected trailing text");let o=Zxt(Kxt(a));return Yxt(o,s),o}matchType(t){for(let n=0;nm.createAndFill()));for(let m=0;m=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 a=0;a{let o=a+(s.validEnd?"*":" ")+" ";for(let l=0;l"+t.indexOf(s.next[l].next);return o}).join(` `)}}hk.empty=new hk(!0);class Uxt{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 NFe(e){let t=[];do t.push(qxt(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function qxt(e){let t=[];do t.push(Vxt(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Vxt(e){let t=Gxt(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=Hxt(e,t);else break;return t}function eSe(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Hxt(e,t){let n=eSe(e),s=n;return e.eat(",")&&(e.next!="}"?s=eSe(e):s=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:t}}function Wxt(e,t){let n=e.nodeTypes,s=n[t];if(s)return[s];let a=[];for(let o in n){let l=n[o];l.isInGroup(t)&&a.push(l)}return a.length==0&&e.err("No node type or group '"+t+"' found"),a}function Gxt(e){if(e.eat("(")){let t=NFe(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=Wxt(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 Kxt(e){let t=[[]];return a(o(e,0),n()),t;function n(){return t.push([])-1}function s(l,i,u){let m={term:u,to:i};return t[l].push(m),m}function a(l,i){l.forEach(u=>u.to=i)}function o(l,i){if(l.type=="choice")return l.exprs.reduce((u,m)=>u.concat(o(m,i)),[]);if(l.type=="seq")for(let u=0;;u++){let m=o(l.exprs[u],i);if(u==l.exprs.length-1)return m;a(m,i=n())}else if(l.type=="star"){let u=n();return s(i,u),a(o(l.expr,u),u),[s(u)]}else if(l.type=="plus"){let u=n();return a(o(l.expr,i),u),a(o(l.expr,u),u),[s(u)]}else{if(l.type=="opt")return[s(i)].concat(o(l.expr,i));if(l.type=="range"){let u=i;for(let m=0;m{e[l].forEach(({term:i,to:u})=>{if(!i)return;let m;for(let x=0;x{m||a.push([i,m=[]]),m.indexOf(x)==-1&&m.push(x)})})});let o=t[s.join(",")]=new hk(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:MFe(this.attrs,t)}create(t=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new nv(this,this.computeAttrs(t),pn.from(n),Ko.setFrom(s))}createChecked(t=null,n,s){return n=pn.from(n),this.checkContent(n),new nv(this,this.computeAttrs(t),n,Ko.setFrom(s))}createAndFill(t=null,n,s){if(t=this.computeAttrs(t),n=pn.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let a=this.contentMatch.matchFragment(n),o=a&&a.fillBefore(pn.empty,!0);return o?new nv(this,t,n.append(o),Ko.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 EFe(o,n,l));let a=n.spec.topNode||"doc";if(!s[a])throw new RangeError("Schema is missing its top node type ('"+a+"')");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 Xxt(e,t,n){let s=n.split("|");return a=>{let o=a===null?"null":typeof a;if(s.indexOf(o)<0)throw new RangeError(`Expected value of type ${s} for attribute ${t} on type ${e}, got ${o}`)}}class Qxt{constructor(t,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Xxt(t,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class fae{constructor(t,n,s,a){this.name=t,this.rank=n,this.schema=s,this.spec=a,this.attrs=AFe(t,a.attrs),this.excluded=null;let o=CFe(this.attrs);this.instance=o?new Ko(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Ko(this,MFe(this.attrs,t))}static compile(t,n){let s=Object.create(null),a=0;return t.forEach((o,l)=>s[o]=new fae(o,a++,n,l)),s}removeFromSet(t){for(var n=0;n-1}}class IFe{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in t)n[a]=t[a];n.nodes=eu.from(t.nodes),n.marks=eu.from(t.marks||{}),this.nodes=rSe.compile(this.spec.nodes,this),this.marks=fae.compile(this.spec.marks,this);let s=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let o=this.nodes[a],l=o.spec.content||"",i=o.spec.marks;if(o.contentMatch=s[l]||(s[l]=hk.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=i=="_"?null:i?nSe(this,i.split(" ")):i==""||!o.inlineContent?[]:null}for(let a in this.marks){let o=this.marks[a],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:nSe(this,l.split(" "))}this.nodeFromJSON=a=>nv.fromJSON(this,a),this.markFromJSON=a=>Ko.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,s,a){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof rSe){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,a)}text(t,n){let s=this.nodes.text;return new cre(s,s.defaultAttrs,t,Ko.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 nSe(e,t){let n=[];for(let s=0;s-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[s]+"'")}return n}function Jxt(e){return e.tag!=null}function eyt(e){return e.style!=null}let BA=class Ime{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(Jxt(a))this.tags.push(a);else if(eyt(a)){let o=/[^=]*/.exec(a.style)[0];s.indexOf(o)<0&&s.push(o),this.styles.push(a)}}),this.normalizeLists=!this.tags.some(a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let o=t.nodes[a.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let s=new aSe(this,n,!1);return s.addAll(t,Ko.none,n.from,n.to),s.finish()}parseSlice(t,n={}){let s=new aSe(this,n,!0);return s.addAll(t,Ko.none,n.from,n.to),Kn.maxOpen(s.finish())}matchTag(t,n,s){for(let a=s?this.tags.indexOf(s)+1:0;at.length&&(i.charCodeAt(t.length)!=61||i.slice(t.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(t){let n=[];function s(a){let o=a.priority==null?50:a.priority,l=0;for(;l{s(l=iSe(l)),l.mark||l.ignore||l.clearMark||(l.mark=a)})}for(let a in t.nodes){let o=t.nodes[a].spec.parseDOM;o&&o.forEach(l=>{s(l=iSe(l)),l.node||l.ignore||l.mark||(l.node=a)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Ime(t,Ime.schemaRules(t)))}};const PFe={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},tyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},LFe={ol:!0,ul:!0},zE=1,Pme=2,$A=4;function sSe(e,t,n){return t!=null?(t?zE:0)|(t==="full"?Pme:0):e&&e.whitespace=="pre"?zE|Pme:n&~$A}class lO{constructor(t,n,s,a,o,l){this.type=t,this.attrs=n,this.marks=s,this.solid=a,this.options=l,this.content=[],this.activeMarks=Ko.none,this.match=o||(l&$A?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(pn.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,a;return(a=s.findWrapping(t.type))?(this.match=s,a):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&zE)){let s=this.content[this.content.length-1],a;if(s&&s.isText&&(a=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-a[0].length))}}let n=pn.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(pn.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&&!PFe.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class aSe{constructor(t,n,s){this.parser=t,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let a=n.topNode,o,l=sSe(null,n.preserveWhitespace,0)|(s?$A:0);a?o=new lO(a.type,a.attrs,Ko.none,!0,n.topMatch||a.type.contentMatch,l):s?o=new lO(null,null,Ko.none,!0,null,l):o=new lO(t.schema.topNodeType,null,Ko.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,a=this.top,o=a.options&Pme?"full":this.localPreserveWS||(a.options&zE)>0,{schema:l}=this.parser;if(o==="full"||a.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 i=s.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(m)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)i=u;else break}}return n}addElementByRule(t,n,s,a){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 u=this.enter(l,n.attrs||null,s,n.preserveWhitespace);u&&(o=!0,s=u)}else{let u=this.parser.schema.marks[n.mark];s=s.concat(u.create(n.attrs))}let i=this.top;if(l&&l.isLeaf)this.findInside(t);else if(a)this.addElement(t,s,a);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(u=>this.insertNode(u,s,!1));else{let u=t;typeof n.contentElement=="string"?u=t.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(t):n.contentElement&&(u=n.contentElement),this.findAround(t,u,!0),this.addAll(u,s),this.findAround(t,u,!1)}o&&this.sync(i)&&this.open--}addAll(t,n,s,a){let o=s||0;for(let l=s?t.childNodes[s]:t.firstChild,i=a==null?null:t.childNodes[a];l!=i;l=l.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(l,n);this.findAtPoint(t,o)}findPlace(t,n,s){let a,o;for(let l=this.open,i=0;l>=0;l--){let u=this.nodes[l],m=u.findWrapping(t);if(m&&(!a||a.length>m.length+i)&&(a=m,o=u,!m.length))break;if(u.solid){if(s)break;i+=2}}if(!a)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(m.type):oSe(m.type,t))?(u=m.addToSet(u),!1):!0),this.nodes.push(new lO(t,n,u,a,null,i)),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|=zE)}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 a=s.length-1;a>=0;a--)t+=s[a].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,a=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(a?0:1),l=(i,u)=>{for(;i>=0;i--){let m=n[i];if(m==""){if(i==n.length-1||i==0)continue;for(;u>=o;u--)if(l(i-1,u))return!0;return!1}else{let x=u>0||u==0&&a?this.nodes[u].type:s&&u>=o?s.node(u-o).type:null;if(!x||x.name!=m&&!x.isInGroup(m))return!1;u--}}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 ryt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let s=t.nodeType==1?t.nodeName.toLowerCase():null;s&&LFe.hasOwnProperty(s)&&n?(n.appendChild(t),t=n):s=="li"?n=t:s&&(n=null)}}function nyt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function iSe(e){let t={};for(let n in e)t[n]=e[n];return t}function oSe(e,t){let n=t.schema.nodes;for(let s in n){let a=n[s];if(!a.allowsMarkType(e))continue;let o=[],l=i=>{o.push(i);for(let u=0;u{if(o.length||l.marks.length){let i=0,u=0;for(;i=0;a--){let o=this.serializeMark(t.marks[a],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(t,n,s={}){let a=this.marks[t.type.name];return a&&Hee(Zce(s),a(t,n),null,t.attrs)}static renderSpec(t,n,s=null,a){return Hee(t,n,s,a)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Ek(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=lSe(t.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(t){return lSe(t.marks)}}function lSe(e){let t={};for(let n in e){let s=e[n].spec.toDOM;s&&(t[n]=s)}return t}function Zce(e){return e.document||window.document}const cSe=new WeakMap;function syt(e){let t=cSe.get(e);return t===void 0&&cSe.set(e,t=ayt(e)),t}function ayt(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 a=0;a-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=a.indexOf(" ");l>0&&(n=a.slice(0,l),a=a.slice(l+1));let i,u=n?e.createElementNS(n,a):e.createElement(a),m=t[1],x=1;if(m&&typeof m=="object"&&m.nodeType==null&&!Array.isArray(m)){x=2;for(let y in m)if(m[y]!=null){let v=y.indexOf(" ");v>0?u.setAttributeNS(y.slice(0,v),y.slice(v+1),m[y]):y=="style"&&u.style?u.style.cssText=m[y]:u.setAttribute(y,m[y])}}for(let y=x;yx)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:N}=Hee(e,v,n,s);if(u.appendChild(b),N){if(i)throw new RangeError("Multiple content holes");i=N}}}return{dom:u,contentDOM:i}}const OFe=65535,DFe=Math.pow(2,16);function iyt(e,t){return e+t*DFe}function dSe(e){return e&OFe}function oyt(e){return(e-(e&OFe))/DFe}const RFe=1,FFe=2,Wee=4,zFe=8;class Lme{constructor(t,n,s){this.pos=t,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&zFe)>0}get deletedBefore(){return(this.delInfo&(RFe|Wee))>0}get deletedAfter(){return(this.delInfo&(FFe|Wee))>0}get deletedAcross(){return(this.delInfo&Wee)>0}}class lm{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&lm.empty)return lm.empty}recover(t){let n=0,s=dSe(t);if(!this.inverted)for(let a=0;at)break;let m=this.ranges[i+o],x=this.ranges[i+l],y=u+m;if(t<=y){let v=m?t==u?-1:t==y?1:n:n,b=u+a+(v<0?0:x);if(s)return b;let N=t==(n<0?u:y)?null:iyt(i/3,t-u),k=t==u?FFe:t==y?RFe:Wee;return(n<0?t!=u:t!=y)&&(k|=zFe),new Lme(b,k,N)}a+=x-m}return s?t+a:new Lme(t+a,0,null)}touches(t,n){let s=0,a=dSe(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let i=0;it)break;let m=this.ranges[i+o],x=u+m;if(t<=x&&i==a*3)return!0;s+=this.ranges[i+l]-m}return!1}forEach(t){let n=this.inverted?2:1,s=this.inverted?1:2;for(let a=0,o=0;a=0;n--){let a=t.getMirror(n);this.appendMap(t._maps[n].invert(),a!=null&&a>n?s-a-1:void 0)}}invert(){let t=new BE;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let s=this.from;so&&u!l.isAtom||!i.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),n.openStart,n.openEnd);return qc.fromReplace(t,this.from,this.to,o)}invert(){return new Ag(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 M1(n.pos,s.pos,this.mark)}merge(t){return t instanceof M1&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new M1(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 M1(n.from,n.to,t.markFromJSON(n.mark))}}Su.jsonID("addMark",M1);class Ag extends Su{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 Kn(zye(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),t),n.openStart,n.openEnd);return qc.fromReplace(t,this.from,this.to,s)}invert(){return new M1(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 Ag(n.pos,s.pos,this.mark)}merge(t){return t instanceof Ag&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Ag(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 Ag(n.from,n.to,t.markFromJSON(n.mark))}}Su.jsonID("removeMark",Ag);class T1 extends Su{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return qc.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return qc.fromReplace(t,this.pos,this.pos+1,new Kn(pn.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 a=0;as.pos?null:new $d(n.pos,s.pos,a,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 $d(n.from,n.to,n.gapFrom,n.gapTo,Kn.fromJSON(t,n.slice),n.insert,!!n.structure)}}Su.jsonID("replaceAround",$d);function Ome(e,t,n){let s=e.resolve(t),a=n-t,o=s.depth;for(;a>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,a--;if(a>0){let l=s.node(o).maybeChild(s.indexAfter(o));for(;a>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,a--}}return!1}function lyt(e,t,n,s){let a=[],o=[],l,i;e.doc.nodesBetween(t,n,(u,m,x)=>{if(!u.isInline)return;let y=u.marks;if(!s.isInSet(y)&&x.type.allowsMarkType(s.type)){let v=Math.max(m,t),b=Math.min(m+u.nodeSize,n),N=s.addToSet(y);for(let k=0;ke.step(u)),o.forEach(u=>e.step(u))}function cyt(e,t,n,s){let a=[],o=0;e.doc.nodesBetween(t,n,(l,i)=>{if(!l.isInline)return;o++;let u=null;if(s instanceof fae){let m=l.marks,x;for(;x=s.isInSet(m);)(u||(u=[])).push(x),m=x.removeFromSet(m)}else s?s.isInSet(l.marks)&&(u=[s]):u=l.marks;if(u&&u.length){let m=Math.min(i+l.nodeSize,n);for(let x=0;xe.step(new Ag(l.from,l.to,l.style)))}function Bye(e,t,n,s=n.contentMatch,a=!0){let o=e.doc.nodeAt(t),l=[],i=t+1;for(let u=0;u=0;u--)e.step(l[u])}function dyt(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function P3(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let s=e.depth,a=0,o=0;;--s){let l=e.$from.node(s),i=e.$from.index(s)+a,u=e.$to.indexAfter(s)-o;if(sn;N--)k||s.index(N)>0?(k=!0,x=pn.from(s.node(N).copy(x)),y++):u--;let v=pn.empty,b=0;for(let N=o,k=!1;N>n;N--)k||a.after(N+1)=0;l--){if(s.size){let i=n[l].type.contentMatch.matchFragment(s);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=pn.from(n[l].type.create(n[l].attrs,s))}let a=t.start,o=t.end;e.step(new $d(a,o,a,o,new Kn(s,0,0),n.length,!0))}function pyt(e,t,n,s,a){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,i)=>{let u=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(s,u)&&gyt(e.doc,e.mapping.slice(o).map(i),s)){let m=null;if(s.schema.linebreakReplacement){let b=s.whitespace=="pre",N=!!s.contentMatch.matchType(s.schema.linebreakReplacement);b&&!N?m=!1:!b&&N&&(m=!0)}m===!1&&$Fe(e,l,i,o),Bye(e,e.mapping.slice(o).map(i,1),s,void 0,m===null);let x=e.mapping.slice(o),y=x.map(i,1),v=x.map(i+l.nodeSize,1);return e.step(new $d(y,v,y+1,v-1,new Kn(pn.from(s.create(u,null,l.marks)),0,0),1,!0)),m===!0&&BFe(e,l,i,o),!1}})}function BFe(e,t,n,s){t.forEach((a,o)=>{if(a.isText){let l,i=/\r?\n|\r/g;for(;l=i.exec(a.text);){let u=e.mapping.slice(s).map(n+1+o+l.index);e.replaceWith(u,u+1,t.type.schema.linebreakReplacement.create())}}})}function $Fe(e,t,n,s){t.forEach((a,o)=>{if(a.type==a.type.schema.linebreakReplacement){let l=e.mapping.slice(s).map(n+1+o);e.replaceWith(l,l+1,t.type.schema.text(` `))}})}function gyt(e,t,n){let s=e.resolve(t),a=s.index();return s.parent.canReplaceWith(a,a+1,n)}function xyt(e,t,n,s,a){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,a||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 $d(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Kn(pn.from(l),0,0),1,!0))}function vy(e,t,n=1,s){let a=e.resolve(t),o=a.depth-n,l=s&&s[s.length-1]||a.parent;if(o<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!l.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let m=a.depth-1,x=n-2;m>o;m--,x--){let y=a.node(m),v=a.index(m);if(y.type.spec.isolating)return!1;let b=y.content.cutByIndex(v,y.childCount),N=s&&s[x+1];N&&(b=b.replaceChild(0,N.type.create(N.attrs)));let k=s&&s[x]||y;if(!y.canReplace(v+1,y.childCount)||!k.type.validContent(b))return!1}let i=a.indexAfter(o),u=s&&s[0];return a.node(o).canReplaceWith(i,i,u?u.type:a.node(o+1).type)}function yyt(e,t,n=1,s){let a=e.doc.resolve(t),o=pn.empty,l=pn.empty;for(let i=a.depth,u=a.depth-n,m=n-1;i>u;i--,m--){o=pn.from(a.node(i).copy(o));let x=s&&s[m];l=pn.from(x?x.type.create(x.attrs,l):a.node(i).copy(l))}e.step(new Ed(t,t,new Kn(o.append(l),n,n),!0))}function Tv(e,t){let n=e.resolve(t),s=n.index();return UFe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function vyt(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:s}=e.type.schema;for(let a=0;a0?(o=s.node(a+1),i++,l=s.node(a).maybeChild(i)):(o=s.node(a).maybeChild(i-1),l=s.node(a+1)),o&&!o.isTextblock&&UFe(o,l)&&s.node(a).canReplace(i,i+1))return t;if(a==0)break;t=n<0?s.before(a):s.after(a)}}function _yt(e,t,n){let s=null,{linebreakReplacement:a}=e.doc.type.schema,o=e.doc.resolve(t-n),l=o.node().type;if(a&&l.inlineContent){let x=l.whitespace=="pre",y=!!l.contentMatch.matchType(a);x&&!y?s=!1:!x&&y&&(s=!0)}let i=e.steps.length;if(s===!1){let x=e.doc.resolve(t+n);$Fe(e,x.node(),x.before(),i)}l.inlineContent&&Bye(e,t+n-1,l,o.node().contentMatchAt(o.index()),s==null);let u=e.mapping.slice(i),m=u.map(t-n);if(e.step(new Ed(m,u.map(t+n,-1),Kn.empty,!0)),s===!0){let x=e.doc.resolve(m);BFe(e,x.node(),x.before(),e.steps.length)}return e}function byt(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 a=s.depth-1;a>=0;a--){let o=s.index(a);if(s.node(a).canReplaceWith(o,o,n))return s.before(a+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let a=s.depth-1;a>=0;a--){let o=s.indexAfter(a);if(s.node(a).canReplaceWith(o,o,n))return s.after(a+1);if(o=0;l--){let i=l==s.depth?0:s.pos<=(s.start(l+1)+s.end(l+1))/2?-1:1,u=s.index(l)+(i>0?1:0),m=s.node(l),x=!1;if(o==1)x=m.canReplace(u,u,a);else{let y=m.contentMatchAt(u).findWrapping(a.firstChild.type);x=y&&m.canReplaceWith(u,u,y[0])}if(x)return i==0?s.pos:i<0?s.before(l+1):s.after(l+1)}return null}function gae(e,t,n=t,s=Kn.empty){if(t==n&&!s.size)return null;let a=e.resolve(t),o=e.resolve(n);return VFe(a,o,s)?new Ed(t,n,s):new wyt(a,o,s).fit()}function VFe(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class wyt{constructor(t,n,s){this.$from=t,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=pn.empty;for(let a=0;a<=t.depth;a++){let o=t.node(a);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(a))})}for(let a=t.depth;a>0;a--)this.placed=pn.from(t.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let m=this.findFittable();m?this.placeNodes(m):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,a=this.close(t<0?this.$to:s.doc.resolve(t));if(!a)return null;let o=this.placed,l=s.depth,i=a.depth;for(;l&&i&&o.childCount==1;)o=o.firstChild.content,l--,i--;let u=new Kn(o,l,i);return t>-1?new $d(s.pos,t,this.$to.pos,this.$to.end(),u,n):u.size||s.pos!=this.$to.pos?new Ed(s.pos,a.pos,u):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,a=this.unplaced.openEnd;s1&&(a=0),o.type.spec.isolating&&a<=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 a,o=null;s?(o=Xce(this.unplaced.content,s-1).firstChild,a=o.content):a=this.unplaced.content;let l=a.firstChild;for(let i=this.depth;i>=0;i--){let{type:u,match:m}=this.frontier[i],x,y=null;if(n==1&&(l?m.matchType(l.type)||(y=m.fillBefore(pn.from(l),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:i,parent:o,inject:y};if(n==2&&l&&(x=m.findWrapping(l.type)))return{sliceDepth:s,frontierDepth:i,parent:o,wrap:x};if(o&&m.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:s}=this.unplaced,a=Xce(t,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Kn(t,n+1,Math.max(s,a.size+n>=t.size-s?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:s}=this.unplaced,a=Xce(t,n);if(a.childCount<=1&&n>0){let o=t.size-n<=n+a.size;this.unplaced=new Kn(DT(t,n-1,1),n-1,o?n-1:s)}else this.unplaced=new Kn(DT(t,n,1),n,s)}placeNodes({sliceDepth:t,frontierDepth:n,parent:s,inject:a,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let k=0;k1||u==0||k.content.size)&&(y=M,x.push(HFe(k.mark(v.allowedMarks(k.marks)),m==1?u:0,m==i.childCount?b:-1)))}let N=m==i.childCount;N||(b=-1),this.placed=RT(this.placed,n,pn.from(x)),this.frontier[n].match=y,N&&b<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,M=i;k1&&a==this.$to.end(--s);)++a;return a}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:s,type:a}=this.frontier[n],o=n=0;i--){let{match:u,type:m}=this.frontier[i],x=Qce(t,i,m,u,!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=RT(this.placed,n.depth,n.fit)),t=n.move;for(let s=n.depth+1;s<=t.depth;s++){let a=t.node(s),o=a.type.contentMatch.fillBefore(a.content,!0,t.index(s));this.openFrontierNode(a.type,a.attrs,o)}return t}openFrontierNode(t,n=null,s){let a=this.frontier[this.depth];a.match=a.match.matchType(t),this.placed=RT(this.placed,this.depth,pn.from(t.create(n,s))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(pn.empty,!0);n.childCount&&(this.placed=RT(this.placed,this.frontier.length,n))}}function DT(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(DT(e.firstChild.content,t-1,n)))}function RT(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(RT(e.lastChild.content,t-1,n)))}function Xce(e,t){for(let n=0;n1&&(s=s.replaceChild(0,HFe(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(pn.empty,!0)))),e.copy(s)}function Qce(e,t,n,s,a){let o=e.node(t),l=a?e.indexAfter(t):e.index(t);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let i=s.fillBefore(o.content,!0,l);return i&&!jyt(n,o.content,l)?i:null}function jyt(e,t,n){for(let s=n;s0;v--,b--){let N=a.node(v).type.spec;if(N.defining||N.definingAsContext||N.isolating)break;l.indexOf(v)>-1?i=v:a.before(v)==b&&l.splice(1,0,-v)}let u=l.indexOf(i),m=[],x=s.openStart;for(let v=s.content,b=0;;b++){let N=v.firstChild;if(m.push(N),b==s.openStart)break;v=N.content}for(let v=x-1;v>=0;v--){let b=m[v],N=kyt(b.type);if(N&&!b.sameMarkup(a.node(Math.abs(i)-1)))x=v;else if(N||!b.type.isTextblock)break}for(let v=s.openStart;v>=0;v--){let b=(v+x+1)%(s.openStart+1),N=m[b];if(N)for(let k=0;k=0&&(e.replace(t,n,s),!(e.steps.length>y));v--){let b=l[v];b<0||(t=a.before(b),n=o.after(b))}}function WFe(e,t,n,s,a){if(ts){let o=a.contentMatchAt(0),l=o.fillBefore(e).append(e);e=l.append(o.matchFragment(l).fillBefore(pn.empty,!0))}return e}function Syt(e,t,n,s){if(!s.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let a=byt(e.doc,t,s.type);a!=null&&(t=n=a)}e.replaceRange(t,n,new Kn(pn.from(s),0,0))}function Cyt(e,t,n){let s=e.doc.resolve(t),a=e.doc.resolve(n),o=GFe(s,a);for(let l=0;l0&&(u||s.node(i-1).canReplace(s.index(i-1),a.indexAfter(i-1))))return e.delete(s.before(i),a.after(i))}for(let l=1;l<=s.depth&&l<=a.depth;l++)if(t-s.start(l)==s.depth-l&&n>s.end(l)&&a.end(l)-n!=a.depth-l&&s.start(l-1)==a.start(l-1)&&s.node(l-1).canReplace(s.index(l-1),a.index(l-1)))return e.delete(s.before(l),n);e.delete(t,n)}function GFe(e,t){let n=[],s=Math.min(e.depth,t.depth);for(let a=s;a>=0;a--){let o=e.start(a);if(ot.pos+(t.depth-a)||e.node(a).type.spec.isolating||t.node(a).type.spec.isolating)break;(o==t.start(a)||a==e.depth&&a==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&a&&t.start(a-1)==o-1)&&n.push(a)}return n}class Q4 extends Su{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 qc.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 a=n.type.create(s,null,n.marks);return qc.fromReplace(t,this.pos,this.pos+1,new Kn(pn.from(a),0,n.isLeaf?0:1))}getMap(){return lm.empty}invert(t){return new Q4(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 Q4(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 Q4(n.pos,n.attr,n.value)}}Su.jsonID("attr",Q4);class $E extends Su{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let a in t.attrs)n[a]=t.attrs[a];n[this.attr]=this.value;let s=t.type.create(n,t.content,t.marks);return qc.ok(s)}getMap(){return lm.empty}invert(t){return new $E(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 $E(n.attr,n.value)}}Su.jsonID("docAttr",$E);let RC=class extends Error{};RC=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};RC.prototype=Object.create(Error.prototype);RC.prototype.constructor=RC;RC.prototype.name="TransformError";class Uye{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new BE}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new RC(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=Kn.empty){let a=gae(this.doc,t,n,s);return a&&this.step(a),this}replaceWith(t,n,s){return this.replace(t,n,new Kn(pn.from(s),0,0))}delete(t,n){return this.replace(t,n,Kn.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,s){return Nyt(this,t,n,s),this}replaceRangeWith(t,n,s){return Syt(this,t,n,s),this}deleteRange(t,n){return Cyt(this,t,n),this}lift(t,n){return uyt(this,t,n),this}join(t,n=1){return _yt(this,t,n),this}wrap(t,n){return fyt(this,t,n),this}setBlockType(t,n=t,s,a=null){return pyt(this,t,n,s,a),this}setNodeMarkup(t,n,s=null,a){return xyt(this,t,n,s,a),this}setNodeAttribute(t,n,s){return this.step(new Q4(t,n,s)),this}setDocAttribute(t,n){return this.step(new $E(t,n)),this}addNodeMark(t,n){return this.step(new T1(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 Ko)n.isInSet(s.marks)&&this.step(new mk(t,n));else{let a=s.marks,o,l=[];for(;o=n.isInSet(a);)l.push(new mk(t,o)),a=o.removeFromSet(a);for(let i=l.length-1;i>=0;i--)this.step(l[i])}return this}split(t,n=1,s){return yyt(this,t,n,s),this}addMark(t,n,s){return lyt(this,t,n,s),this}removeMark(t,n,s){return cyt(this,t,n,s),this}clearIncompatible(t,n,s){return Bye(this,t,n,s),this}}const Jce=Object.create(null);class Oa{constructor(t,n,s){this.$anchor=t,this.$head=n,this.ranges=s||[new KFe(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?qS(t.node(0),t.node(o),t.before(o+1),t.index(o),n,s):qS(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 bm(t.node(0))}static atStart(t){return qS(t,t,0,0,1)||new bm(t)}static atEnd(t){return qS(t,t,t.content.size,t.childCount,-1)||new bm(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=Jce[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 Jce)throw new RangeError("Duplicate use of selection JSON ID "+t);return Jce[t]=n,n.prototype.jsonID=t,n}getBookmark(){return va.between(this.$anchor,this.$head).getBookmark()}}Oa.prototype.visible=!0;class KFe{constructor(t,n){this.$from=t,this.$to=n}}let hSe=!1;function mSe(e){!hSe&&!e.parent.inlineContent&&(hSe=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class va extends Oa{constructor(t,n=t){mSe(t),mSe(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 Oa.near(s);let a=t.resolve(n.map(this.anchor));return new va(a.parent.inlineContent?a:s,s)}replace(t,n=Kn.empty){if(super.replace(t,n),n==Kn.empty){let s=this.$from.marksAcross(this.$to);s&&t.ensureMarks(s)}}eq(t){return t instanceof va&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new xae(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 va(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,s=n){let a=t.resolve(n);return new this(a,s==n?a:t.resolve(s))}static between(t,n,s){let a=t.pos-n.pos;if((!s||a)&&(s=a>=0?1:-1),!n.parent.inlineContent){let o=Oa.findFrom(n,s,!0)||Oa.findFrom(n,-s,!0);if(o)n=o.$head;else return Oa.near(n,s)}return t.parent.inlineContent||(a==0?t=n:(t=(Oa.findFrom(t,-s,!0)||Oa.findFrom(t,s,!0)).$anchor,t.pos0?0:1);a>0?l=0;l+=a){let i=t.child(l);if(i.isAtom){if(!o&&ua.isSelectable(i))return ua.create(e,n-(a<0?i.nodeSize:0))}else{let u=qS(e,i,n+a,a<0?i.childCount:0,a,o);if(u)return u}n+=i.nodeSize*a}return null}function fSe(e,t,n){let s=e.steps.length-1;if(s{l==null&&(l=x)}),e.setSelection(Oa.near(e.doc.resolve(l),n))}const pSe=1,cO=2,gSe=4;class Tyt extends Uye{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|=cO,this}ensureMarks(t){return Ko.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&cO)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~cO,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)||Ko.none))),s.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,s){let a=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(a.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,a.text(t,o)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(Oa.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|=gSe,this}get scrolledIntoView(){return(this.updated&gSe)>0}}function xSe(e,t){return!t||!e?e:e.bind(t)}class FT{constructor(t,n,s){this.name=t,this.init=xSe(n.init,s),this.apply=xSe(n.apply,s)}}const Ayt=[new FT("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new FT("selection",{init(e,t){return e.selection||Oa.atStart(t.doc)},apply(e){return e.selection}}),new FT("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,s){return s.selection.$cursor?e.storedMarks:null}}),new FT("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class ede{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ayt.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 FT(s.key,s.spec.state,s))})}}class s4{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 a=t[s],o=a.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(a,this[a.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 a=new ede(t.schema,t.plugins),o=new s4(a);return a.fields.forEach(l=>{if(l.name=="doc")o.doc=nv.fromJSON(t.schema,n.doc);else if(l.name=="selection")o.selection=Oa.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 i in s){let u=s[i],m=u.spec.state;if(u.key==l.name&&m&&m.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){o[l.name]=m.fromJSON.call(u,t,n[i],o);return}}o[l.name]=l.init(t,o)}}),o}}function ZFe(e,t,n){for(let s in e){let a=e[s];a instanceof Function?a=a.bind(t):s=="handleDOMEvents"&&(a=ZFe(a,t,{})),n[s]=a}return n}class gd{constructor(t){this.spec=t,this.props={},t.props&&ZFe(t.props,this,this.props),this.key=t.key?t.key.key:YFe("plugin")}getState(t){return t[this.key]}}const tde=Object.create(null);function YFe(e){return e in tde?e+"$"+ ++tde[e]:(tde[e]=0,e+"$")}class Cu{constructor(t="key"){this.key=YFe(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const ru=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},FC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Dme=null;const Hx=function(e,t,n){let s=Dme||(Dme=document.createRange());return s.setEnd(e,n??e.nodeValue.length),s.setStart(e,t||0),s},Eyt=function(){Dme=null},fk=function(e,t,n,s){return n&&(ySe(e,t,n,s,-1)||ySe(e,t,n,s,1))},Iyt=/^(img|br|input|textarea|hr)$/i;function ySe(e,t,n,s,a){for(var o;;){if(e==n&&t==s)return!0;if(t==(a<0?0:sf(e))){let l=e.parentNode;if(!l||l.nodeType!=1||uP(e)||Iyt.test(e.nodeName)||e.contentEditable=="false")return!1;t=ru(e)+(a<0?0:1),e=l}else if(e.nodeType==1){let l=e.childNodes[t+(a<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)t+=a;else return!1;else e=l,t=a<0?sf(e):0}else return!1}}function sf(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Pyt(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=sf(e)}else if(e.parentNode&&!uP(e))t=ru(e),e=e.parentNode;else return null}}function Lyt(e,t){for(;;){if(e.nodeType==3&&t2),Qm=zC||(Jg?/Mac/.test(Jg.platform):!1),JFe=Jg?/Win/.test(Jg.platform):!1,ry=/Android \d/.test(Av),hP=!!vSe&&"webkitFontSmoothing"in vSe.documentElement.style,Fyt=hP?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function zyt(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 Ox(e,t){return typeof e=="number"?e:e[t]}function Byt(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 _Se(e,t,n){let s=e.someProp("scrollThreshold")||0,a=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(l.nodeType!=1){l=FC(l);continue}let i=l,u=i==o.body,m=u?zyt(o):Byt(i),x=0,y=0;if(t.topm.bottom-Ox(s,"bottom")&&(y=t.bottom-t.top>m.bottom-m.top?t.top+Ox(a,"top")-m.top:t.bottom-m.bottom+Ox(a,"bottom")),t.leftm.right-Ox(s,"right")&&(x=t.right-m.right+Ox(a,"right")),x||y)if(u)o.defaultView.scrollBy(x,y);else{let b=i.scrollLeft,N=i.scrollTop;y&&(i.scrollTop+=y),x&&(i.scrollLeft+=x);let k=i.scrollLeft-b,M=i.scrollTop-N;t={left:t.left-k,top:t.top-M,right:t.right-k,bottom:t.bottom-M}}let v=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(v))break;l=v=="absolute"?l.offsetParent:FC(l)}}function $yt(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),s,a;for(let o=(t.left+t.right)/2,l=n+1;l=n-20){s=i,a=u.top;break}}return{refDOM:s,refTop:a,stack:eze(e.dom)}}function eze(e){let t=[],n=e.ownerDocument;for(let s=e;s&&(t.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),e!=n);s=FC(s));return t}function Uyt({refDOM:e,refTop:t,stack:n}){let s=e?e.getBoundingClientRect().top:0;tze(n,s==0?0:s-t)}function tze(e,t){for(let n=0;n=i){l=Math.max(N.bottom,l),i=Math.min(N.top,i);let k=N.left>t.left?N.left-t.left:N.right=(N.left+N.right)/2?1:0));continue}}else N.top>t.top&&!u&&N.left<=t.left&&N.right>=t.left&&(u=x,m={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&&u&&(n=u,a=m,s=0),n&&n.nodeType==3?Vyt(n,a):!n||s&&n.nodeType==1?{node:e,offset:o}:rze(n,a)}function Vyt(e,t){let n=e.nodeValue.length,s=document.createRange(),a;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return s.detach(),a||{node:e,offset:0}}function Vye(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Hyt(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,a,o)}function Gyt(e,t,n,s){let a=-1;for(let o=t,l=!1;o!=e.dom;){let i=e.docView.nearestDesc(o,!0),u;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((u=i.dom.getBoundingClientRect()).width||u.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!l&&u.left>s.left||u.top>s.top?a=i.posBefore:(!l&&u.right-1?a:e.docView.posFromDOM(t,n,-1)}function nze(e,t,n){let s=e.childNodes.length;if(s&&n.topt.top&&a++}let m;hP&&a&&s.nodeType==1&&(m=s.childNodes[a-1]).nodeType==1&&m.contentEditable=="false"&&m.getBoundingClientRect().top>=t.top&&a--,s==e.dom&&a==s.childNodes.length-1&&s.lastChild.nodeType==1&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(a==0||s.nodeType!=1||s.childNodes[a-1].nodeName!="BR")&&(i=Gyt(e,s,a,t))}i==null&&(i=Wyt(e,l,t));let u=e.docView.nearestDesc(l,!0);return{pos:i,inside:u?u.posAtStart-u.border:-1}}function bSe(e){return e.top=0&&a==s.nodeValue.length?(u--,x=1):n<0?u--:m++,hT(q0(Hx(s,u,m),x),x<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&a&&(n<0||a==sf(s))){let u=s.childNodes[a-1];if(u.nodeType==1)return rde(u.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(n<0||a==sf(s))){let u=s.childNodes[a-1],m=u.nodeType==3?Hx(u,sf(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(m)return hT(q0(m,1),!1)}if(o==null&&a=0)}function hT(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 rde(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 aze(e,t,n){let s=e.state,a=e.root.activeElement;s!=t&&e.updateState(t),a!=e.dom&&e.focus();try{return n()}finally{s!=t&&e.updateState(s),a!=e.dom&&a&&a.focus()}}function Yyt(e,t,n){let s=t.selection,a=n=="up"?s.$from:s.$to;return aze(e,t,()=>{let{node:o}=e.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let i=e.docView.nearestDesc(o,!0);if(!i)break;if(i.node.isBlock){o=i.contentDOM||i.dom;break}o=i.dom.parentNode}let l=sze(e,a.pos,1);for(let i=o.firstChild;i;i=i.nextSibling){let u;if(i.nodeType==1)u=i.getClientRects();else if(i.nodeType==3)u=Hx(i,0,i.nodeValue.length).getClientRects();else continue;for(let m=0;mx.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 Xyt=/[\u0590-\u08ac]/;function Qyt(e,t,n){let{$head:s}=t.selection;if(!s.parent.isTextblock)return!1;let a=s.parentOffset,o=!a,l=a==s.parent.content.size,i=e.domSelection();return i?!Xyt.test(s.parent.textContent)||!i.modify?n=="left"||n=="backward"?o:l:aze(e,t,()=>{let{focusNode:u,focusOffset:m,anchorNode:x,anchorOffset:y}=e.domSelectionRange(),v=i.caretBidiLevel;i.modify("move",n,"character");let b=s.depth?e.docView.domAfterPos(s.before()):e.dom,{focusNode:N,focusOffset:k}=e.domSelectionRange(),M=N&&!b.contains(N.nodeType==1?N:N.parentNode)||u==N&&m==k;try{i.collapse(x,y),u&&(u!=x||m!=y)&&i.extend&&i.extend(u,m)}catch{}return v!=null&&(i.caretBidiLevel=v),M}):s.pos==s.start()||s.pos==s.end()}let wSe=null,jSe=null,kSe=!1;function Jyt(e,t,n){return wSe==t&&jSe==n?kSe:(wSe=t,jSe=n,kSe=n=="up"||n=="down"?Yyt(e,t,n):Qyt(e,t,n))}const xf=0,NSe=1,lj=2,ex=3;class mP{constructor(t,n,s,a){this.parent=t,this.children=n,this.dom=s,this.contentDOM=a,this.dirty=xf,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;nru(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){a=!1;break}if(o.previousSibling)break}if(a==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){a=!0;break}if(o.nextSibling)break}}return a??s>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let s=!0,a=t;a;a=a.parentNode){let o=this.getDesc(a),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 a=t;a;a=a.parentNode){let o=this.getDesc(a);if(o)return o.localPosFromDOM(t,n,s)}return-1}descAt(t){for(let n=0,s=0;nt||l instanceof oze){a=t-o;break}o=i}if(a)return this.children[s].domFromPos(a-this.children[s].border,n);for(let o;s&&!(o=this.children[s-1]).size&&o instanceof ize&&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?ru(o.dom)+1:0}}else{let o,l=!0;for(;o=s=x&&n<=m-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(t,n,x);t=l;for(let y=i;y>0;y--){let v=this.children[y-1];if(v.size&&v.dom.parentNode==this.contentDOM&&!v.emptyChildAt(1)){a=ru(v.dom)+1;break}t-=v.size}a==-1&&(a=0)}if(a>-1&&(m>n||i==this.children.length-1)){n=m;for(let x=i+1;xN&&ln){let N=i;i=u,u=N}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(i.node,i.offset),m.removeAllRanges(),m.addRange(b)}}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,a=0;a=s:ts){let i=s+o.border,u=l-o.border;if(t>=i&&n<=u){this.dirty=t==s||n==l?lj:NSe,t==i&&n==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=ex:o.markDirty(t-i,n-i);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?lj:ex}s=l}this.dirty=lj}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let s=t==1?lj:NSe;n.dirty{if(!o)return a;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(l.nodeType!=1){let i=document.createElement("span");i.appendChild(l),l=i}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==xf&&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 e0t extends mP{constructor(t,n,s,a){super(t,[],n,null),this.textDOM=s,this.text=a}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 pk extends mP{constructor(t,n,s,a,o){super(t,[],s,a),this.mark=n,this.spec=o}static create(t,n,s,a){let o=a.nodeViews[n.type.name],l=o&&o(n,a,s);return(!l||!l.dom)&&(l=Ek.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new pk(t,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&ex||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=ex&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=xf){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=$me(o,0,t,s));for(let i=0;i{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},s,a),x=m&&m.dom,y=m&&m.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}=Ek.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 v=x;return x=dze(x,s,n),m?u=new t0t(t,n,s,a,x,y||null,v,m,o,l+1):n.isText?new vae(t,n,s,a,x,v,o):new av(t,n,s,a,x,y||null,v,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=()=>pn.empty)}return t}matchesNode(t,n,s){return this.dirty==xf&&t.eq(this.node)&&dre(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,a=n,o=t.composing?this.localCompositionInfo(t,n):null,l=o&&o.pos>-1?o:null,i=o&&o.pos<0,u=new n0t(this,l&&l.node,t);i0t(this.node,this.innerDeco,(m,x,y)=>{m.spec.marks?u.syncToMarks(m.spec.marks,s,t):m.type.side>=0&&!y&&u.syncToMarks(x==this.node.childCount?Ko.none:this.node.child(x).marks,s,t),u.placeWidget(m,t,a)},(m,x,y,v)=>{u.syncToMarks(m.marks,s,t);let b;u.findNodeMatch(m,x,y,v)||i&&t.state.selection.from>a&&t.state.selection.to-1&&u.updateNodeAt(m,x,y,b,t)||u.updateNextNode(m,x,y,t,v,a)||u.addNode(m,x,y,t,a),a+=m.nodeSize}),u.syncToMarks([],s,t),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==lj)&&(l&&this.protectLocalComposition(t,l),lze(this.contentDOM,this.children,t),zC&&o0t(this.dom))}localCompositionInfo(t,n){let{from:s,to:a}=t.state.selection;if(!(t.state.selection instanceof va)||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,i=l0t(this.node.content,l,s-n,a-n);return i<0?null:{node:o,pos:i,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:s,text:a}){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 e0t(this,o,n,a);t.input.compositionNodes.push(l),this.children=$me(this.children,s,s+a.length,t,l)}update(t,n,s,a){return this.dirty==ex||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,s,a),!0)}updateInner(t,n,s,a){this.updateOuterDeco(n),this.node=t,this.innerDeco=s,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=xf}updateOuterDeco(t){if(dre(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=cze(this.dom,this.nodeDOM,Bme(this.outerDeco,this.node,n),Bme(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 SSe(e,t,n,s,a){dze(s,t,e);let o=new av(void 0,e,t,n,s,s,s,a,0);return o.contentDOM&&o.updateChildren(a,0),o}class vae extends av{constructor(t,n,s,a,o,l,i){super(t,n,s,a,o,null,l,i,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,a){return this.dirty==ex||this.dirty!=xf&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=xf||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=t,this.dirty=xf,!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 a=this.node.cut(t,n),o=document.createTextNode(a.text);return new vae(this.parent,a,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=ex)}get domAtom(){return!1}isText(t){return this.node.text==t}}class oze extends mP{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==xf&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class t0t extends av{constructor(t,n,s,a,o,l,i,u,m,x){super(t,n,s,a,o,l,i,m,x),this.spec=u}update(t,n,s,a){if(this.dirty==ex)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,a),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,s,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,s,a){this.spec.setSelection?this.spec.setSelection(t,n,s.root):super.setSelection(t,n,s,a)}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 lze(e,t,n){let s=e.firstChild,a=!1;for(let o=0;o>1,l=Math.min(o,t.length);for(;a-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let u=pk.create(this.top,t[o],n,s);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,s,a){let o=-1,l;if(a>=this.preMatch.index&&(l=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&l.matchesNode(t,n,s))o=this.top.children.indexOf(l,this.index);else for(let i=this.index,u=Math.min(this.top.children.length,i+5);i0;){let i;for(;;)if(s){let m=n.children[s-1];if(m instanceof pk)n=m,s=m.children.length;else{i=m,s--;break}}else{if(n==t)break e;s=n.parent.children.indexOf(n),n=n.parent}let u=i.node;if(u){if(u!=e.child(a-1))break;--a,o.set(i,a),l.push(i)}}return{index:a,matched:o,matches:l.reverse()}}function a0t(e,t){return e.type.side-t.type.side}function i0t(e,t,n,s){let a=t.locals(e),o=0;if(a.length==0){for(let m=0;mo;)i.push(a[l++]);let N=o+v.nodeSize;if(v.isText){let M=N;l!M.inline):i.slice();s(v,k,t.forChild(o,v),b),o=N}}function o0t(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 l0t(e,t,n,s){for(let a=0,o=0;a=n){if(o>=s&&u.slice(s-t.length-i,s-i)==t)return s-t.length;let m=i=0&&m+t.length+i>=n)return i+m;if(n==s&&u.length>=s+t.length-i&&u.slice(s-i,s-i+t.length)==t)return s}}return-1}function $me(e,t,n,s,a){let o=[];for(let l=0,i=0;l=n||x<=t?o.push(u):(mn&&o.push(u.slice(n-m,u.size,s)))}return o}function Hye(e,t=null){let n=e.domSelectionRange(),s=e.state.doc;if(!n.focusNode)return null;let a=e.docView.nearestDesc(n.focusNode),o=a&&a.size==0,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let i=s.resolve(l),u,m;if(yae(n)){for(u=l;a&&!a.node;)a=a.parent;let y=a.node;if(a&&y.isAtom&&ua.isSelectable(y)&&a.parent&&!(y.isInline&&Oyt(n.focusNode,n.focusOffset,a.dom))){let v=a.posBefore;m=new ua(l==v?i:s.resolve(v))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let y=l,v=l;for(let b=0;b{(n.anchorNode!=s||n.anchorOffset!=a)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!uze(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function d0t(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,s=n.nodeName=="IMG";s?t.collapse(n.parentNode,ru(n)+1):t.collapse(n,0),!s&&!e.state.selection.visible&&Rh&&sv<=11&&(n.disabled=!0,n.disabled=!1)}function hze(e,t){if(t instanceof ua){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(ESe(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else ESe(e)}function ESe(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Wye(e,t,n,s){return e.someProp("createSelectionBetween",a=>a(e,t,n))||va.between(t,n,s)}function ISe(e){return e.editable&&!e.hasFocus()?!1:mze(e)}function mze(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 u0t(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return fk(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ume(e,t){let{$anchor:n,$head:s}=e.selection,a=t>0?n.max(s):n.min(s),o=a.parent.inlineContent?a.depth?e.doc.resolve(t>0?a.after():a.before()):null:a;return o&&Oa.findFrom(o,t)}function J0(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function PSe(e,t,n){let s=e.state.selection;if(s instanceof va)if(n.indexOf("s")>-1){let{$head:a}=s,o=a.textOffset?null:t<0?a.nodeBefore:a.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=e.state.doc.resolve(a.pos+o.nodeSize*(t<0?-1:1));return J0(e,new va(s.$anchor,l))}else if(s.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let a=Ume(e.state,t);return a&&a instanceof ua?J0(e,a):!1}else if(!(Qm&&n.indexOf("m")>-1)){let a=s.$head,o=a.textOffset?null:t<0?a.nodeBefore:a.nodeAfter,l;if(!o||o.isText)return!1;let i=t<0?a.pos-o.nodeSize:a.pos;return o.isAtom||(l=e.docView.descAt(i))&&!l.contentDOM?ua.isSelectable(o)?J0(e,new ua(t<0?e.state.doc.resolve(a.pos-o.nodeSize):a)):hP?J0(e,new va(e.state.doc.resolve(t<0?i:i+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof ua&&s.node.isInline)return J0(e,new va(t>0?s.$to:s.$from));{let a=Ume(e.state,t);return a?J0(e,a):!1}}}function ure(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function qA(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function ES(e,t){return t<0?h0t(e):m0t(e)}function h0t(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let a,o,l=!1;for(gf&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let i=n.childNodes[s-1];if(qA(i,-1))a=n,o=--s;else if(i.nodeType==3)n=i,s=n.nodeValue.length;else break}}else{if(fze(n))break;{let i=n.previousSibling;for(;i&&qA(i,-1);)a=n.parentNode,o=ru(i),i=i.previousSibling;if(i)n=i,s=ure(n);else{if(n=n.parentNode,n==e.dom)break;s=0}}}l?qme(e,n,s):a&&qme(e,a,o)}function m0t(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let a=ure(n),o,l;for(;;)if(s{e.state==a&&_y(e)},50)}function LSe(e,t){let n=e.state.doc.resolve(t);if(!(Ld||JFe)&&n.parent.inlineContent){let a=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),l=(o.top+o.bottom)/2;if(l>a.top&&l1)return o.lefta.top&&l1)return o.left>a.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function OSe(e,t,n){let s=e.state.selection;if(s instanceof va&&!s.empty||n.indexOf("s")>-1||Qm&&n.indexOf("m")>-1)return!1;let{$from:a,$to:o}=s;if(!a.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=Ume(e.state,t);if(l&&l instanceof ua)return J0(e,l)}if(!a.parent.inlineContent){let l=t<0?a:o,i=s instanceof bm?Oa.near(l,t):Oa.findFrom(l,t);return i?J0(e,i):!1}return!1}function DSe(e,t){if(!(e.state.selection instanceof va))return!0;let{$head:n,$anchor:s,empty:a}=e.state.selection;if(!n.sameParent(s))return!0;if(!a)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 RSe(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function g0t(e){if(!ju||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;RSe(e,s,"true"),setTimeout(()=>RSe(e,s,"false"),20)}return!1}function x0t(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function y0t(e,t){let n=t.keyCode,s=x0t(t);if(n==8||Qm&&n==72&&s=="c")return DSe(e,-1)||ES(e,-1);if(n==46&&!t.shiftKey||Qm&&n==68&&s=="c")return DSe(e,1)||ES(e,1);if(n==13||n==27)return!0;if(n==37||Qm&&n==66&&s=="c"){let a=n==37?LSe(e,e.state.selection.from)=="ltr"?-1:1:-1;return PSe(e,a,s)||ES(e,a)}else if(n==39||Qm&&n==70&&s=="c"){let a=n==39?LSe(e,e.state.selection.from)=="ltr"?1:-1:1;return PSe(e,a,s)||ES(e,a)}else{if(n==38||Qm&&n==80&&s=="c")return OSe(e,-1,s)||ES(e,-1);if(n==40||Qm&&n==78&&s=="c")return g0t(e)||OSe(e,1,s)||ES(e,1);if(s==(Qm?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Gye(e,t){e.someProp("transformCopied",b=>{t=b(t,e)});let n=[],{content:s,openStart:a,openEnd:o}=t;for(;a>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){a--,o--;let b=s.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),s=b.content}let l=e.someProp("clipboardSerializer")||Ek.fromSchema(e.state.schema),i=_ze(),u=i.createElement("div");u.appendChild(l.serializeFragment(s,{document:i}));let m=u.firstChild,x,y=0;for(;m&&m.nodeType==1&&(x=vze[m.nodeName.toLowerCase()]);){for(let b=x.length-1;b>=0;b--){let N=i.createElement(x[b]);for(;u.firstChild;)N.appendChild(u.firstChild);u.appendChild(N),y++}m=u.firstChild}m&&m.nodeType==1&&m.setAttribute("data-pm-slice",`${a} ${o}${y?` -${y}`:""} ${JSON.stringify(n)}`);let v=e.someProp("clipboardTextSerializer",b=>b(t,e))||t.content.textBetween(0,t.content.size,` `);return{dom:u,text:v,slice:t}}function pze(e,t,n,s,a){let o=a.parent.type.spec.code,l,i;if(!n&&!t)return null;let u=!!t&&(s||o||!n);if(u){if(e.someProp("transformPastedText",v=>{t=v(t,o||s,e)}),o)return i=new Kn(pn.from(e.state.schema.text(t.replace(/\r\n?/g,` `))),0,0),e.someProp("transformPasted",v=>{i=v(i,e,!0)}),i;let y=e.someProp("clipboardTextParser",v=>v(t,a,s,e));if(y)i=y;else{let v=a.marks(),{schema:b}=e.state,N=Ek.fromSchema(b);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(k=>{let M=l.appendChild(document.createElement("p"));k&&M.appendChild(N.serializeNode(b.text(k,v)))})}}else e.someProp("transformPastedHTML",y=>{n=y(n,e)}),l=w0t(n),hP&&j0t(l);let m=l&&l.querySelector("[data-pm-slice]"),x=m&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(m.getAttribute("data-pm-slice")||"");if(x&&x[3])for(let y=+x[3];y>0;y--){let v=l.firstChild;for(;v&&v.nodeType!=1;)v=v.nextSibling;if(!v)break;l=v}if(i||(i=(e.someProp("clipboardParser")||e.someProp("domParser")||BA.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||x),context:a,ruleFromNode(v){return v.nodeName=="BR"&&!v.nextSibling&&v.parentNode&&!v0t.test(v.parentNode.nodeName)?{ignore:!0}:null}})),x)i=k0t(FSe(i,+x[1],+x[2]),x[4]);else if(i=Kn.maxOpen(_0t(i.content,a),!0),i.openStart||i.openEnd){let y=0,v=0;for(let b=i.content.firstChild;y{i=y(i,e,u)}),i}const v0t=/^(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 _0t(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let a=t.node(n).contentMatchAt(t.index(n)),o,l=[];if(e.forEach(i=>{if(!l)return;let u=a.findWrapping(i.type),m;if(!u)return l=null;if(m=l.length&&o.length&&xze(u,o,i,l[l.length-1],0))l[l.length-1]=m;else{l.length&&(l[l.length-1]=yze(l[l.length-1],o.length));let x=gze(i,u);l.push(x),a=a.matchType(x.type),o=u}}),l)return pn.from(l)}return e}function gze(e,t,n=0){for(let s=t.length-1;s>=n;s--)e=t[s].create(null,pn.from(e));return e}function xze(e,t,n,s,a){if(a1&&(o=0),a=n&&(i=t<0?l.contentMatchAt(0).fillBefore(i,o<=a).append(i):i.append(l.contentMatchAt(l.childCount).fillBefore(pn.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(i))}function FSe(e,t,n){return tn})),sde.createHTML(e)):e}function w0t(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=_ze().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),a;if((a=s&&vze[s[1].toLowerCase()])&&(e=a.map(o=>"<"+o+">").join("")+e+a.map(o=>"").reverse().join("")),n.innerHTML=b0t(e),a)for(let o=0;o=0;i-=2){let u=n.nodes[s[i]];if(!u||u.hasRequiredAttrs())break;a=pn.from(u.create(s[i+1],a)),o++,l++}return new Kn(a,o,l)}const nh={},sh={},N0t={touchstart:!0,touchmove:!0};class S0t{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 C0t(e){for(let t in nh){let n=nh[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=s=>{T0t(e,s)&&!Kye(e,s)&&(e.editable||!(s.type in sh))&&n(e,s)},N0t[t]?{passive:!0}:void 0)}ju&&e.dom.addEventListener("input",()=>null),Hme(e)}function A1(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function M0t(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 Hme(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=s=>Kye(e,s))})}function Kye(e,t){return e.someProp("handleDOMEvents",n=>{let s=n[t.type];return s?s(e,t)||t.defaultPrevented:!1})}function T0t(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 A0t(e,t){!Kye(e,t)&&nh[t.type]&&(e.editable||!(t.type in sh))&&nh[t.type](e,t)}sh.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!wze(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ry&&Ld&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),zC&&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",a=>a(e,Jw(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",s=>s(e,n))||y0t(e,n)?n.preventDefault():A1(e,"key")};sh.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};sh.keypress=(e,t)=>{let n=t;if(wze(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Qm&&n.metaKey)return;if(e.someProp("handleKeyPress",a=>a(e,n))){n.preventDefault();return}let s=e.state.selection;if(!(s instanceof va)||!s.$from.sameParent(s.$to)){let a=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!e.someProp("handleTextInput",l=>l(e,s.$from.pos,s.$to.pos,a,o))&&e.dispatch(o()),n.preventDefault()}};function _ae(e){return{left:e.clientX,top:e.clientY}}function E0t(e,t){let n=t.x-e.clientX,s=t.y-e.clientY;return n*n+s*s<100}function Zye(e,t,n,s,a){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,i=>l>o.depth?i(e,n,o.nodeAfter,o.before(l),a,!0):i(e,n,o.node(l),o.before(l),a,!1)))return!0;return!1}function J4(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 I0t(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),s=n.nodeAfter;return s&&s.isAtom&&ua.isSelectable(s)?(J4(e,new ua(n)),!0):!1}function P0t(e,t){if(t==-1)return!1;let n=e.state.selection,s,a;n instanceof ua&&(s=n.node);let o=e.state.doc.resolve(t);for(let l=o.depth+1;l>0;l--){let i=l>o.depth?o.nodeAfter:o.node(l);if(ua.isSelectable(i)){s&&n.$from.depth>0&&l>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?a=o.before(n.$from.depth):a=o.before(l);break}}return a!=null?(J4(e,ua.create(e.state.doc,a)),!0):!1}function L0t(e,t,n,s,a){return Zye(e,"handleClickOn",t,n,s)||e.someProp("handleClick",o=>o(e,t,s))||(a?P0t(e,n):I0t(e,n))}function O0t(e,t,n,s){return Zye(e,"handleDoubleClickOn",t,n,s)||e.someProp("handleDoubleClick",a=>a(e,t,s))}function D0t(e,t,n,s){return Zye(e,"handleTripleClickOn",t,n,s)||e.someProp("handleTripleClick",a=>a(e,t,s))||R0t(e,n,s)}function R0t(e,t,n){if(n.button!=0)return!1;let s=e.state.doc;if(t==-1)return s.inlineContent?(J4(e,va.create(s,0,s.content.size)),!0):!1;let a=s.resolve(t);for(let o=a.depth+1;o>0;o--){let l=o>a.depth?a.nodeAfter:a.node(o),i=a.before(o);if(l.inlineContent)J4(e,va.create(s,i+1,i+1+l.content.size));else if(ua.isSelectable(l))J4(e,ua.create(s,i));else continue;return!0}}function Yye(e){return hre(e)}const bze=Qm?"metaKey":"ctrlKey";nh.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let s=Yye(e),a=Date.now(),o="singleClick";a-e.input.lastClick.time<500&&E0t(n,e.input.lastClick)&&!n[bze]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:o,button:n.button};let l=e.posAtCoords(_ae(n));l&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new F0t(e,l,n,!!s)):(o=="doubleClick"?O0t:D0t)(e,l.pos,l.inside,n)?n.preventDefault():A1(e,"pointer"))};class F0t{constructor(t,n,s,a){this.view=t,this.pos=n,this.event=s,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!s[bze],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 i=a?null:s.target,u=i?t.docView.nearestDesc(i,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:m}=t.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||m instanceof ua&&m.from<=l&&m.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&gf&&!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)),A1(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(()=>_y(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(_ae(t))),this.updateAllowDefault(t),this.allowDefault||!n?A1(this.view,"pointer"):L0t(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||ju&&this.mightDrag&&!this.mightDrag.node.isAtom||Ld&&!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)?(J4(this.view,Oa.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):A1(this.view,"pointer")}move(t){this.updateAllowDefault(t),A1(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)}}nh.touchstart=e=>{e.input.lastTouch=Date.now(),Yye(e),A1(e,"pointer")};nh.touchmove=e=>{e.input.lastTouch=Date.now(),A1(e,"pointer")};nh.contextmenu=e=>Yye(e);function wze(e,t){return e.composing?!0:ju&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const z0t=ry?5e3:-1;sh.compositionstart=sh.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof va&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||Ld&&JFe&&B0t(e)))e.markCursor=e.state.storedMarks||n.marks(),hre(e,!0),e.markCursor=null;else if(hre(e,!t.selection.empty),gf&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=e.domSelectionRange();for(let a=s.focusNode,o=s.focusOffset;a&&a.nodeType==1&&o!=0;){let l=o<0?a.lastChild:a.childNodes[o-1];if(!l)break;if(l.nodeType==3){let i=e.domSelection();i&&i.collapse(l,l.nodeValue.length);break}else a=l,o=-1}}e.input.composing=!0}jze(e,z0t)};function B0t(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"}sh.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++,jze(e,20))};function jze(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>hre(e),t))}function kze(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=U0t());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function $0t(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=Pyt(t.focusNode,t.focusOffset),s=Lyt(t.focusNode,t.focusOffset);if(n&&s&&n!=s){let a=s.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||s==o)return o;if(!a||!a.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 U0t(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function hre(e,t=!1){if(!(ry&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),kze(e),t||e.docView&&e.docView.dirty){let n=Hye(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 q0t(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(),a=document.createRange();a.selectNodeContents(t),e.dom.blur(),s.removeAllRanges(),s.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const UE=Rh&&sv<15||zC&&Fyt<604;nh.copy=sh.cut=(e,t)=>{let n=t,s=e.state.selection,a=n.type=="cut";if(s.empty)return;let o=UE?null:n.clipboardData,l=s.content(),{dom:i,text:u}=Gye(e,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",i.innerHTML),o.setData("text/plain",u)):q0t(e,i),a&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function V0t(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function H0t(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 a=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),s.parentNode&&s.parentNode.removeChild(s),n?qE(e,s.value,null,a,t):qE(e,s.textContent,s.innerHTML,a,t)},50)}function qE(e,t,n,s,a){let o=pze(e,t,n,s,e.state.selection.$from);if(e.someProp("handlePaste",u=>u(e,a,o||Kn.empty)))return!0;if(!o)return!1;let l=V0t(o),i=l?e.state.tr.replaceSelectionWith(l,s):e.state.tr.replaceSelection(o);return e.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Nze(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," "):""}sh.paste=(e,t)=>{let n=t;if(e.composing&&!ry)return;let s=UE?null:n.clipboardData,a=e.input.shiftKey&&e.input.lastKeyCode!=45;s&&qE(e,Nze(s),s.getData("text/html"),a,n)?n.preventDefault():H0t(e,n)};class Sze{constructor(t,n,s){this.slice=t,this.move=n,this.node=s}}const W0t=Qm?"altKey":"ctrlKey";function Cze(e,t){let n=e.someProp("dragCopies",s=>!s(t));return n??!t[W0t]}nh.dragstart=(e,t)=>{let n=t,s=e.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let a=e.state.selection,o=a.empty?null:e.posAtCoords(_ae(n)),l;if(!(o&&o.pos>=a.from&&o.pos<=(a instanceof ua?a.to-1:a.to))){if(s&&s.mightDrag)l=ua.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=ua.create(e.state.doc,y.posBefore))}}let i=(l||e.state.selection).content(),{dom:u,text:m,slice:x}=Gye(e,i);(!n.dataTransfer.files.length||!Ld||QFe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(UE?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",UE||n.dataTransfer.setData("text/plain",m),e.dragging=new Sze(x,Cze(e,n),l)};nh.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};sh.dragover=sh.dragenter=(e,t)=>t.preventDefault();sh.drop=(e,t)=>{try{G0t(e,t,e.dragging)}finally{e.dragging=null}};function G0t(e,t,n){if(!t.dataTransfer)return;let s=e.posAtCoords(_ae(t));if(!s)return;let a=e.state.doc.resolve(s.pos),o=n&&n.slice;o?e.someProp("transformPasted",b=>{o=b(o,e,!1)}):o=pze(e,Nze(t.dataTransfer),UE?null:t.dataTransfer.getData("text/html"),!1,a);let l=!!(n&&Cze(e,t));if(e.someProp("handleDrop",b=>b(e,t,o||Kn.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let i=o?qFe(e.state.doc,a.pos,o):a.pos;i==null&&(i=a.pos);let u=e.state.tr;if(l){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let m=u.mapping.map(i),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=u.doc;if(x?u.replaceRangeWith(m,m,o.content.firstChild):u.replaceRange(m,m,o),u.doc.eq(y))return;let v=u.doc.resolve(m);if(x&&ua.isSelectable(o.content.firstChild)&&v.nodeAfter&&v.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new ua(v));else{let b=u.mapping.map(i);u.mapping.maps[u.mapping.maps.length-1].forEach((N,k,M,I)=>b=I),u.setSelection(Wye(e,v,u.doc.resolve(b)))}e.focus(),e.dispatch(u.setMeta("uiEvent","drop"))}nh.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())&&_y(e)},20))};nh.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)};nh.beforeinput=(e,t)=>{if(Ld&&ry&&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,Jw(8,"Backspace")))))return;let{$cursor:a}=e.state.selection;a&&a.pos>0&&e.dispatch(e.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let e in sh)nh[e]=sh[e];function VE(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 mre{constructor(t,n){this.toDOM=t,this.spec=n||Gj,this.side=this.spec.side||0}map(t,n,s,a){let{pos:o,deleted:l}=t.mapResult(n.from+a,this.side<0?-1:1);return l?null:new Ku(o-s,o-s,this)}valid(){return!0}eq(t){return this==t||t instanceof mre&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&VE(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class iv{constructor(t,n){this.attrs=t,this.spec=n||Gj}map(t,n,s,a){let o=t.map(n.from+a,this.spec.inclusiveStart?-1:1)-s,l=t.map(n.to+a,this.spec.inclusiveEnd?1:-1)-s;return o>=l?null:new Ku(o,l,this)}valid(t,n){return n.from=t&&(!o||o(i.spec))&&s.push(i.copy(i.from+a,i.to+a))}for(let l=0;lt){let i=this.children[l]+1;this.children[l+2].findInner(t-i,n-i,s,a+i,o)}}map(t,n,s){return this==pu||t.maps.length==0?this:this.mapInner(t,n,0,0,s||Gj)}mapInner(t,n,s,a,o){let l;for(let i=0;i{let m=u+s,x;if(x=Tze(n,i,m)){for(a||(a=this.children.slice());oi&&y.to=t){this.children[i]==t&&(s=this.children[i+2]);break}let o=t+1,l=o+n.content.size;for(let i=0;io&&u.type instanceof iv){let m=Math.max(o,u.from)-o,x=Math.min(l,u.to)-o;ma.map(t,n,Gj));return c1.from(s)}forChild(t,n){if(n.isLeaf)return ec.empty;let s=[];for(let a=0;an instanceof ec)?t:t.reduce((n,s)=>n.concat(s instanceof ec?s:s.members),[]))}}forEachSet(t){for(let n=0;n{let M=k-N-(b-v);for(let I=0;IT+x-y)continue;let P=i[I]+x-y;b>=P?i[I+1]=v<=P?-2:-1:v>=x&&M&&(i[I]+=M,i[I+1]+=M)}y+=M}),x=n.maps[m].map(x,-1)}let u=!1;for(let m=0;m=s.content.size){u=!0;continue}let v=n.map(e[m+1]+o,-1),b=v-a,{index:N,offset:k}=s.content.findIndex(y),M=s.maybeChild(N);if(M&&k==y&&k+M.nodeSize==b){let I=i[m+2].mapInner(n,M,x+1,e[m]+o+1,l);I!=pu?(i[m]=y,i[m+1]=b,i[m+2]=I):(i[m+1]=-2,u=!0)}else u=!0}if(u){let m=Z0t(i,e,t,n,a,o,l),x=fre(m,s,0,l);t=x.local;for(let y=0;yn&&l.to{let m=Tze(e,i,u+n);if(m){o=!0;let x=fre(m,i,n+u+1,s);x!=pu&&a.push(u,u+i.nodeSize,x)}});let l=Mze(o?Aze(e):e,-n).sort(Kj);for(let i=0;i0;)t++;e.splice(t,0,n)}function ade(e){let t=[];return e.someProp("decorations",n=>{let s=n(e.state);s&&s!=pu&&t.push(s)}),e.cursorWrapper&&t.push(ec.create(e.state.doc,[e.cursorWrapper.deco])),c1.from(t)}const Y0t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},X0t=Rh&&sv<=11;class Q0t{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 J0t{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Q0t,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(s=>{for(let a=0;aa.type=="childList"&&a.removedNodes.length||a.type=="characterData"&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():this.flush()}),X0t&&(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,Y0t)),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(ISe(this.view)){if(this.suppressingSelectionUpdates)return _y(this.view);if(Rh&&sv<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&fk(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=FC(o))n.add(o);for(let o=t.anchorNode;o;o=FC(o))if(n.has(o)){s=o;break}let a=s&&this.view.docView.nearestDesc(s);if(a&&a.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(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&ISe(t)&&!this.ignoreSelectionChange(s),o=-1,l=-1,i=!1,u=[];if(t.editable)for(let x=0;xy.nodeName=="BR");if(x.length==2){let[y,v]=x;y.parentNode&&y.parentNode.parentNode==v.parentNode?v.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let v of x){let b=v.parentNode;b&&b.nodeName=="LI"&&(!y||r1t(t,y)!=b)&&v.remove()}}}else if((Ld||ju)&&u.some(x=>x.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let x of u)if(x.nodeName=="BR"&&x.parentNode){let y=x.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&x.parentNode.removeChild(x)}}let m=null;o<0&&a&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||a)&&(o>-1&&(t.docView.markDirty(o,l),e1t(t)),this.handleDOMChange(o,l,i,u),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(s)||_y(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;xa;M--){let I=s.childNodes[M-1],T=I.pmViewDesc;if(I.nodeName=="BR"&&!T){o=M;break}if(!T||T.size)break}let y=e.state.doc,v=e.someProp("domParser")||BA.fromSchema(e.state.schema),b=y.resolve(l),N=null,k=v.parse(s,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:o,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:m,ruleFromNode:s1t,context:b});if(m&&m[0].pos!=null){let M=m[0].pos,I=m[1]&&m[1].pos;I==null&&(I=M),N={anchor:M+l,head:I+l}}return{doc:k,sel:N,from:l,to:i}}function s1t(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(ju&&/^(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||ju&&/^(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 a1t=/^(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 i1t(e,t,n,s,a){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let V=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,W=Hye(e,V);if(W&&!e.state.selection.eq(W)){if(Ld&&ry&&e.input.lastKeyCode===13&&Date.now()-100ee(e,Jw(13,"Enter"))))return;let G=e.state.tr.setSelection(W);V=="pointer"?G.setMeta("pointer",!0):V=="key"&&G.scrollIntoView(),o&&G.setMeta("composition",o),e.dispatch(G)}return}let l=e.state.doc.resolve(t),i=l.sharedDepth(n);t=l.before(i+1),n=e.state.doc.resolve(n).after(i+1);let u=e.state.selection,m=n1t(e,t,n),x=e.state.doc,y=x.slice(m.from,m.to),v,b;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ry)&&a.some(V=>V.nodeType==1&&!a1t.test(V.nodeName))&&(!N||N.endA>=N.endB)&&e.someProp("handleKeyDown",V=>V(e,Jw(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!N)if(s&&u instanceof va&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(m.sel&&m.sel.anchor!=m.sel.head))N={start:u.from,endA:u.to,endB:u.to};else{if(m.sel){let V=VSe(e,e.state.doc,m.sel);if(V&&!V.eq(e.state.selection)){let W=e.state.tr.setSelection(V);o&&W.setMeta("composition",o),e.dispatch(W)}}return}e.state.selection.frome.state.selection.from&&N.start<=e.state.selection.from+2&&e.state.selection.from>=m.from?N.start=e.state.selection.from:N.endA=e.state.selection.to-2&&e.state.selection.to<=m.to&&(N.endB+=e.state.selection.to-N.endA,N.endA=e.state.selection.to)),Rh&&sv<=11&&N.endB==N.start+1&&N.endA==N.start&&N.start>m.from&&m.doc.textBetween(N.start-m.from-1,N.start-m.from+1)=="  "&&(N.start--,N.endA--,N.endB--);let k=m.doc.resolveNoCache(N.start-m.from),M=m.doc.resolveNoCache(N.endB-m.from),I=x.resolve(N.start),T=k.sameParent(M)&&k.parent.inlineContent&&I.end()>=N.endA;if((zC&&e.input.lastIOSEnter>Date.now()-225&&(!T||a.some(V=>V.nodeName=="DIV"||V.nodeName=="P"))||!T&&k.posV(e,Jw(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>N.start&&l1t(x,N.start,N.endA,k,M)&&e.someProp("handleKeyDown",V=>V(e,Jw(8,"Backspace")))){ry&&Ld&&e.domObserver.suppressSelectionUpdates();return}Ld&&N.endB==N.start&&(e.input.lastChromeDelete=Date.now()),ry&&!T&&k.start()!=M.start()&&M.parentOffset==0&&k.depth==M.depth&&m.sel&&m.sel.anchor==m.sel.head&&m.sel.head==N.endA&&(N.endB-=2,M=m.doc.resolveNoCache(N.endB-m.from),setTimeout(()=>{e.someProp("handleKeyDown",function(V){return V(e,Jw(13,"Enter"))})},20));let P=N.start,F=N.endA,D=V=>{let W=V||e.state.tr.replace(P,F,m.doc.slice(N.start-m.from,N.endB-m.from));if(m.sel){let G=VSe(e,W.doc,m.sel);G&&!(Ld&&e.composing&&G.empty&&(N.start!=N.endB||e.input.lastChromeDelete_y(e),20));let V=D(e.state.tr.delete(P,F)),W=x.resolve(N.start).marksAcross(x.resolve(N.endA));W&&V.ensureMarks(W),e.dispatch(V)}else if(N.endA==N.endB&&(U=o1t(k.parent.content.cut(k.parentOffset,M.parentOffset),I.parent.content.cut(I.parentOffset,N.endA-I.start())))){let V=D(e.state.tr);U.type=="add"?V.addMark(P,F,U.mark):V.removeMark(P,F,U.mark),e.dispatch(V)}else if(k.parent.child(k.index()).isText&&k.index()==M.index()-(M.textOffset?0:1)){let V=k.parent.textBetween(k.parentOffset,M.parentOffset),W=()=>D(e.state.tr.insertText(V,P,F));e.someProp("handleTextInput",G=>G(e,P,F,V,W))||e.dispatch(W())}else e.dispatch(D());else e.dispatch(D())}function VSe(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Wye(e,t.resolve(n.anchor),t.resolve(n.head))}function o1t(e,t){let n=e.firstChild.marks,s=t.firstChild.marks,a=n,o=s,l,i,u;for(let x=0;xx.mark(i.addToSet(x.marks));else if(a.length==0&&o.length==1)i=o[0],l="remove",u=x=>x.mark(i.removeFromSet(x.marks));else return null;let m=[];for(let x=0;xn||ide(l,!0,!1)0&&(t||e.indexAfter(s)==e.node(s).childCount);)s--,a++,t=!1;if(n){let o=e.node(s).maybeChild(e.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,a++}return a}function c1t(e,t,n,s,a){let o=e.findDiffStart(t,n);if(o==null)return null;let{a:l,b:i}=e.findDiffEnd(t,n+e.size,n+t.size);if(a=="end"){let u=Math.max(0,o-Math.min(l,i));s-=l+u-o}if(l=l?o-s:0;o-=u,o&&o=i?o-s:0;o-=u,o&&o=56320&&t<=57343&&n>=55296&&n<=56319}class Eze{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 S0t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(YSe),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=KSe(this),GSe(this),this.nodeViews=ZSe(this),this.docView=SSe(this.state.doc,WSe(this),ade(this),this.dom,this),this.domObserver=new J0t(this,(s,a,o,l)=>i1t(this,s,a,o,l)),this.domObserver.start(),C0t(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&&Hme(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(YSe),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 a=this.state,o=!1,l=!1;t.storedMarks&&this.composing&&(kze(this),l=!0),this.state=t;let i=a.plugins!=t.plugins||this._props.plugins!=n.plugins;if(i||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=ZSe(this);u1t(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(i||n.handleDOMEvents!=this._props.handleDOMEvents)&&Hme(this),this.editable=KSe(this),GSe(this);let u=ade(this),m=WSe(this),x=a.plugins!=t.plugins&&!a.doc.eq(t.doc)?"reset":t.scrollToSelection>a.scrollToSelection?"to selection":"preserve",y=o||!this.docView.matchesNode(t.doc,m,u);(y||!t.selection.eq(a.selection))&&(l=!0);let v=x=="preserve"&&l&&this.dom.style.overflowAnchor==null&&$yt(this);if(l){this.domObserver.stop();let b=y&&(Rh||Ld)&&!this.composing&&!a.selection.empty&&!t.selection.empty&&d1t(a.selection,t.selection);if(y){let N=Ld?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=$0t(this)),(o||!this.docView.update(t.doc,m,u,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=SSe(t.doc,m,u,this.dom,this)),N&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&u0t(this))?_y(this,b):(hze(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((s=this.dragging)===null||s===void 0)&&s.node&&!a.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,a),x=="reset"?this.dom.scrollTop=0:x=="to selection"?this.scrollToSelection():v&&Uyt(v)}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 ua){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&_Se(this,n.getBoundingClientRect(),t)}else _Se(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&&(a=o)}this.dragging=new Sze(t.slice,t.move,a<0?void 0:ua.create(this.state.doc,a))}someProp(t,n){let s=this._props&&this._props[t],a;if(s!=null&&(a=n?n(s):s))return a;for(let l=0;ln.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return Kyt(this,t)}coordsAtPos(t,n=1){return sze(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 a=this.docView.posFromDOM(t,n,s);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(t,n){return Jyt(this,n||this.state,t)}pasteHTML(t,n){return qE(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return qE(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Gye(this,t)}destroy(){this.docView&&(M0t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ade(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Eyt())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return A0t(this,t)}domSelectionRange(){let t=this.domSelection();return t?ju&&this.root.nodeType===11&&Dyt(this.dom.ownerDocument)==this.dom&&t1t(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Eze.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function WSe(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"),[Ku.node(0,e.state.doc.content.size,t)]}function GSe(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:Ku.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function KSe(e){return!e.someProp("editable",t=>t(e.state)===!1)}function d1t(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 ZSe(e){let t=Object.create(null);function n(s){for(let a in s)Object.prototype.hasOwnProperty.call(t,a)||(t[a]=s[a])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function u1t(e,t){let n=0,s=0;for(let a in e){if(e[a]!=t[a])return!0;n++}for(let a in t)s++;return n!=s}function YSe(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 yv={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:"'"},pre={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},h1t=typeof navigator<"u"&&/Mac/.test(navigator.platform),m1t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var nu=0;nu<10;nu++)yv[48+nu]=yv[96+nu]=String(nu);for(var nu=1;nu<=24;nu++)yv[nu+111]="F"+nu;for(var nu=65;nu<=90;nu++)yv[nu]=String.fromCharCode(nu+32),pre[nu]=String.fromCharCode(nu);for(var ode in yv)pre.hasOwnProperty(ode)||(pre[ode]=yv[ode]);function f1t(e){var t=h1t&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||m1t&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?pre:yv)[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 p1t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),g1t=typeof navigator<"u"&&/Win/.test(navigator.platform);function x1t(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let s,a,o,l;for(let i=0;ie.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Ize(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Pze=(e,t,n)=>{let s=Ize(e,n);if(!s)return!1;let a=t0e(s);if(!a){let l=s.blockRange(),i=l&&P3(l);return i==null?!1:(t&&t(e.tr.lift(l,i).scrollIntoView()),!0)}let o=a.nodeBefore;if(Uze(e,a,t,-1))return!0;if(s.parent.content.size==0&&(BC(o,"end")||ua.isSelectable(o)))for(let l=s.depth;;l--){let i=gae(e.doc,s.before(l),s.after(l),Kn.empty);if(i&&i.slice.size1)break}return o.isAtom&&a.depth==s.depth-1?(t&&t(e.tr.delete(a.pos-o.nodeSize,a.pos).scrollIntoView()),!0):!1},_1t=(e,t,n)=>{let s=Ize(e,n);if(!s)return!1;let a=t0e(s);return a?Lze(e,a,t):!1},b1t=(e,t,n)=>{let s=Dze(e,n);if(!s)return!1;let a=r0e(s);return a?Lze(e,a,t):!1};function Lze(e,t,n){let s=t.nodeBefore,a=s,o=t.pos-1;for(;!a.isTextblock;o--){if(a.type.spec.isolating)return!1;let x=a.lastChild;if(!x)return!1;a=x}let l=t.nodeAfter,i=l,u=t.pos+1;for(;!i.isTextblock;u++){if(i.type.spec.isolating)return!1;let x=i.firstChild;if(!x)return!1;i=x}let m=gae(e.doc,o,u,Kn.empty);if(!m||m.from!=o||m instanceof Ed&&m.slice.size>=u-o)return!1;if(n){let x=e.tr.step(m);x.setSelection(va.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 Oze=(e,t,n)=>{let{$head:s,empty:a}=e.selection,o=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):s.parentOffset>0)return!1;o=t0e(s)}let l=o&&o.nodeBefore;return!l||!ua.isSelectable(l)?!1:(t&&t(e.tr.setSelection(ua.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function t0e(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 Dze(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset{let s=Dze(e,n);if(!s)return!1;let a=r0e(s);if(!a)return!1;let o=a.nodeAfter;if(Uze(e,a,t,1))return!0;if(s.parent.content.size==0&&(BC(o,"start")||ua.isSelectable(o))){let l=gae(e.doc,s.before(),s.after(),Kn.empty);if(l&&l.slice.size{let{$head:s,empty:a}=e.selection,o=s;if(!a)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 ua,a;if(s){if(n.node.isTextblock||!Tv(e.doc,n.from))return!1;a=n.from}else if(a=pae(e.doc,n.from,-1),a==null)return!1;if(t){let o=e.tr.join(a);s&&o.setSelection(ua.create(o.doc,a-e.doc.resolve(a).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},j1t=(e,t)=>{let n=e.selection,s;if(n instanceof ua){if(n.node.isTextblock||!Tv(e.doc,n.to))return!1;s=n.to}else if(s=pae(e.doc,n.to,1),s==null)return!1;return t&&t(e.tr.join(s).scrollIntoView()),!0},k1t=(e,t)=>{let{$from:n,$to:s}=e.selection,a=n.blockRange(s),o=a&&P3(a);return o==null?!1:(t&&t(e.tr.lift(a,o).scrollIntoView()),!0)},zze=(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 n0e(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 a=n.node(-1),o=n.indexAfter(-1),l=n0e(a.contentMatchAt(o));if(!l||!a.canReplaceWith(o,o,l))return!1;if(t){let i=n.after(),u=e.tr.replaceWith(i,i,l.createAndFill());u.setSelection(Oa.near(u.doc.resolve(i),1)),t(u.scrollIntoView())}return!0},Bze=(e,t)=>{let n=e.selection,{$from:s,$to:a}=n;if(n instanceof bm||s.parent.inlineContent||a.parent.inlineContent)return!1;let o=n0e(a.parent.contentMatchAt(a.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let l=(!s.parentOffset&&a.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(vy(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),a=s&&P3(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)};function S1t(e){return(t,n)=>{let{$from:s,$to:a}=t.selection;if(t.selection instanceof ua&&t.selection.node.isBlock)return!s.parentOffset||!vy(t.doc,s.pos)?!1:(n&&n(t.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],l,i,u=!1,m=!1;for(let b=s.depth;;b--)if(s.node(b).isBlock){u=s.end(b)==s.pos+(s.depth-b),m=s.start(b)==s.pos-(s.depth-b),i=n0e(s.node(b-1).contentMatchAt(s.indexAfter(b-1))),o.unshift(u&&i?{type:i}:null),l=b;break}else{if(b==1)return!1;o.unshift(null)}let x=t.tr;(t.selection instanceof va||t.selection instanceof bm)&&x.deleteSelection();let y=x.mapping.map(s.pos),v=vy(x.doc,y,o.length,o);if(v||(o[0]=i?{type:i}:null,v=vy(x.doc,y,o.length,o)),!v)return!1;if(x.split(y,o.length,o),!u&&m&&s.node(l).type!=i){let b=x.mapping.map(s.before(l)),N=x.doc.resolve(b);i&&s.node(l-1).canReplaceWith(N.index(),N.index()+1,i)&&x.setNodeMarkup(x.mapping.map(s.before(l)),i)}return n&&n(x.scrollIntoView()),!0}}const C1t=S1t(),M1t=(e,t)=>{let{$from:n,to:s}=e.selection,a,o=n.sharedDepth(s);return o==0?!1:(a=n.before(o),t&&t(e.tr.setSelection(ua.create(e.doc,a))),!0)};function T1t(e,t,n){let s=t.nodeBefore,a=t.nodeAfter,o=t.index();return!s||!a||!s.type.compatibleContent(a.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)||!(a.isTextblock||Tv(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Uze(e,t,n,s){let a=t.nodeBefore,o=t.nodeAfter,l,i,u=a.type.spec.isolating||o.type.spec.isolating;if(!u&&T1t(e,t,n))return!0;let m=!u&&t.parent.canReplace(t.index(),t.index()+1);if(m&&(l=(i=a.contentMatchAt(a.childCount)).findWrapping(o.type))&&i.matchType(l[0]||o.type).validEnd){if(n){let b=t.pos+o.nodeSize,N=pn.empty;for(let I=l.length-1;I>=0;I--)N=pn.from(l[I].create(null,N));N=pn.from(a.copy(N));let k=e.tr.step(new $d(t.pos-1,b,t.pos,b,new Kn(N,1,0),l.length,!0)),M=k.doc.resolve(b+2*l.length);M.nodeAfter&&M.nodeAfter.type==a.type&&Tv(k.doc,M.pos)&&k.join(M.pos),n(k.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&u?null:Oa.findFrom(t,1),y=x&&x.$from.blockRange(x.$to),v=y&&P3(y);if(v!=null&&v>=t.depth)return n&&n(e.tr.lift(y,v).scrollIntoView()),!0;if(m&&BC(o,"start",!0)&&BC(a,"end")){let b=a,N=[];for(;N.push(b),!b.isTextblock;)b=b.lastChild;let k=o,M=1;for(;!k.isTextblock;k=k.firstChild)M++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(n){let I=pn.empty;for(let P=N.length-1;P>=0;P--)I=pn.from(N[P].copy(I));let T=e.tr.step(new $d(t.pos-N.length,t.pos+o.nodeSize,t.pos+M,t.pos+o.nodeSize-M,new Kn(I,N.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function qze(e){return function(t,n){let s=t.selection,a=e<0?s.$from:s.$to,o=a.depth;for(;a.node(o).isInline;){if(!o)return!1;o--}return a.node(o).isTextblock?(n&&n(t.tr.setSelection(va.create(t.doc,e<0?a.start(o):a.end(o)))),!0):!1}}const A1t=qze(-1),E1t=qze(1);function I1t(e,t=null){return function(n,s){let{$from:a,$to:o}=n.selection,l=a.blockRange(o),i=l&&$ye(l,e,t);return i?(s&&s(n.tr.wrap(l,i).scrollIntoView()),!0):!1}}function XSe(e,t=null){return function(n,s){let a=!1;for(let o=0;o{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(e,t)))if(u.type==e)a=!0;else{let x=n.doc.resolve(m),y=x.index();a=x.parent.canReplaceWith(y,y+1,e)}})}if(!a)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 u=l.resolve(t.start-2);o=new lre(u,u,t.depth),t.endIndex=0;x--)o=pn.from(n[x].type.create(n[x].attrs,o));e.step(new $d(t.start-(s?2:0),t.end,t.start,t.end,new Kn(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?R1t(t,n,e,o):F1t(t,n,o):!0:!1}}function R1t(e,t,n,s){let a=e.tr,o=s.end,l=s.$to.end(s.depth);ok;N--)b-=a.child(N).nodeSize,s.delete(b-1,b+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 i=n.startIndex==0,u=n.endIndex==a.childCount,m=o.node(-1),x=o.index(-1);if(!m.canReplace(x+(i?0:1),x+1,l.content.append(u?pn.empty:pn.from(a))))return!1;let y=o.pos,v=y+l.nodeSize;return s.step(new $d(y-(i?1:0),v+(u?1:0),y+1,v-1,new Kn((i?pn.empty:pn.from(a.copy(pn.empty))).append(u?pn.empty:pn.from(a.copy(pn.empty))),i?0:1,u?0:1),i?0:1)),t(s.scrollIntoView()),!0}function z1t(e){return function(t,n){let{$from:s,$to:a}=t.selection,o=s.blockRange(a,m=>m.childCount>0&&m.firstChild.type==e);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let i=o.parent,u=i.child(l-1);if(u.type!=e)return!1;if(n){let m=u.lastChild&&u.lastChild.type==i.type,x=pn.from(m?e.create():null),y=new Kn(pn.from(e.create(null,pn.from(i.type.create(null,x)))),m?3:1,0),v=o.start,b=o.end;n(t.tr.step(new $d(v-(m?3:1),b,v,b,y,1,!0)).scrollIntoView())}return!0}}function bae(e){const{state:t,transaction:n}=e;let{selection:s}=n,{doc:a}=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 a},get tr(){return s=n.selection,a=n.doc,o=n.storedMarks,n}}}class wae{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:a}=n,{tr:o}=s,l=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([i,u])=>[i,(...x)=>{const y=u(...x)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(o),y}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i=[],u=!!t,m=t||o.tr,x=()=>(!u&&n&&!m.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(m),i.every(v=>v===!0)),y={...Object.fromEntries(Object.entries(s).map(([v,b])=>[v,(...k)=>{const M=this.buildProps(m,n),I=b(...k)(M);return i.push(I),y}])),run:x};return y}createCan(t){const{rawCommands:n,state:s}=this,a=!1,o=t||s.tr,l=this.buildProps(o,a);return{...Object.fromEntries(Object.entries(n).map(([u,m])=>[u,(...x)=>m(...x)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,a)}}buildProps(t,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i={tr:t,editor:a,view:l,state:bae({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(([u,m])=>[u,(...x)=>m(...x)(i)]))}};return i}}let B1t=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(a=>a.apply(this,n)),this}off(t,n){const s=this.callbacks[t];return s&&(n?this.callbacks[t]=s.filter(a=>a!==n):delete this.callbacks[t]),this}once(t,n){const s=(...a)=>{this.off(t,s),n.apply(this,a)};return this.on(t,s)}removeAllListeners(){this.callbacks={}}};function Ms(e,t,n){return e.config[t]===void 0&&e.parent?Ms(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?Ms(e.parent,t,n):null}):e.config[t]}function jae(e){const t=e.filter(a=>a.type==="extension"),n=e.filter(a=>a.type==="node"),s=e.filter(a=>a.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:s}}function Vze(e){const t=[],{nodeExtensions:n,markExtensions:s}=jae(e),a=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage,extensions:a},u=Ms(l,"addGlobalAttributes",i);if(!u)return;u().forEach(x=>{x.types.forEach(y=>{Object.entries(x.attributes).forEach(([v,b])=>{t.push({type:y,name:v,attribute:{...o,...b}})})})})}),a.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage},u=Ms(l,"addAttributes",i);if(!u)return;const m=u();Object.entries(m).forEach(([x,y])=>{const v={...o,...y};typeof(v==null?void 0:v.default)=="function"&&(v.default=v.default()),v!=null&&v.isRequired&&(v==null?void 0:v.default)===void 0&&delete v.default,t.push({type:l.name,name:x,attribute:v})})}),t}function qd(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 Wl(...e){return e.filter(t=>!!t).reduce((t,n)=>{const s={...t};return Object.entries(n).forEach(([a,o])=>{if(!s[a]){s[a]=o;return}if(a==="class"){const i=o?String(o).split(" "):[],u=s[a]?s[a].split(" "):[],m=i.filter(x=>!u.includes(x));s[a]=[...u,...m].join(" ")}else if(a==="style"){const i=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],u=s[a]?s[a].split(";").map(x=>x.trim()).filter(Boolean):[],m=new Map;u.forEach(x=>{const[y,v]=x.split(":").map(b=>b.trim());m.set(y,v)}),i.forEach(x=>{const[y,v]=x.split(":").map(b=>b.trim());m.set(y,v)}),s[a]=Array.from(m.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else s[a]=o}),s},{})}function Wme(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)=>Wl(n,s),{})}function Hze(e){return typeof e=="function"}function yi(e,t=void 0,...n){return Hze(e)?t?e.bind(t)(...n):e(...n):e}function $1t(e={}){return Object.keys(e).length===0&&e.constructor===Object}function U1t(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function QSe(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 a=t.reduce((o,l)=>{const i=l.attribute.parseHTML?l.attribute.parseHTML(n):U1t(n.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...s,...a}}}}function JSe(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&$1t(n)?!1:n!=null))}function q1t(e,t){var n;const s=Vze(e),{nodeExtensions:a,markExtensions:o}=jae(e),l=(n=a.find(m=>Ms(m,"topNode")))===null||n===void 0?void 0:n.name,i=Object.fromEntries(a.map(m=>{const x=s.filter(I=>I.type===m.name),y={name:m.name,options:m.options,storage:m.storage,editor:t},v=e.reduce((I,T)=>{const P=Ms(T,"extendNodeSchema",y);return{...I,...P?P(m):{}}},{}),b=JSe({...v,content:yi(Ms(m,"content",y)),marks:yi(Ms(m,"marks",y)),group:yi(Ms(m,"group",y)),inline:yi(Ms(m,"inline",y)),atom:yi(Ms(m,"atom",y)),selectable:yi(Ms(m,"selectable",y)),draggable:yi(Ms(m,"draggable",y)),code:yi(Ms(m,"code",y)),whitespace:yi(Ms(m,"whitespace",y)),linebreakReplacement:yi(Ms(m,"linebreakReplacement",y)),defining:yi(Ms(m,"defining",y)),isolating:yi(Ms(m,"isolating",y)),attrs:Object.fromEntries(x.map(I=>{var T;return[I.name,{default:(T=I==null?void 0:I.attribute)===null||T===void 0?void 0:T.default}]}))}),N=yi(Ms(m,"parseHTML",y));N&&(b.parseDOM=N.map(I=>QSe(I,x)));const k=Ms(m,"renderHTML",y);k&&(b.toDOM=I=>k({node:I,HTMLAttributes:Wme(I,x)}));const M=Ms(m,"renderText",y);return M&&(b.toText=M),[m.name,b]})),u=Object.fromEntries(o.map(m=>{const x=s.filter(M=>M.type===m.name),y={name:m.name,options:m.options,storage:m.storage,editor:t},v=e.reduce((M,I)=>{const T=Ms(I,"extendMarkSchema",y);return{...M,...T?T(m):{}}},{}),b=JSe({...v,inclusive:yi(Ms(m,"inclusive",y)),excludes:yi(Ms(m,"excludes",y)),group:yi(Ms(m,"group",y)),spanning:yi(Ms(m,"spanning",y)),code:yi(Ms(m,"code",y)),attrs:Object.fromEntries(x.map(M=>{var I;return[M.name,{default:(I=M==null?void 0:M.attribute)===null||I===void 0?void 0:I.default}]}))}),N=yi(Ms(m,"parseHTML",y));N&&(b.parseDOM=N.map(M=>QSe(M,x)));const k=Ms(m,"renderHTML",y);return k&&(b.toDOM=M=>k({mark:M,HTMLAttributes:Wme(M,x)})),[m.name,b]}));return new IFe({topNode:l,nodes:i,marks:u})}function cde(e,t){return t.nodes[e]||t.marks[e]||null}function e4e(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function a0e(e,t){const n=Ek.fromSchema(t).serializeFragment(e),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}const V1t=(e,t=500)=>{let n="";const s=e.parentOffset;return e.parent.nodesBetween(Math.max(0,s-t),s,(a,o,l,i)=>{var u,m;const x=((m=(u=a.type.spec).toText)===null||m===void 0?void 0:m.call(u,{node:a,pos:o,parent:l,index:i}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?x:x.slice(0,Math.max(0,s-o))}),n};function i0e(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class kae{constructor(t){this.find=t.find,this.handler=t.handler}}const H1t=(e,t)=>{if(i0e(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 dO(e){var t;const{editor:n,from:s,to:a,text:o,rules:l,plugin:i}=e,{view:u}=n;if(u.composing)return!1;const m=u.state.doc.resolve(s);if(m.parent.type.spec.code||!((t=m.nodeBefore||m.nodeAfter)===null||t===void 0)&&t.marks.find(v=>v.type.spec.code))return!1;let x=!1;const y=V1t(m)+o;return l.forEach(v=>{if(x)return;const b=H1t(y,v.find);if(!b)return;const N=u.state.tr,k=bae({state:u.state,transaction:N}),M={from:s-(b[0].length-o.length),to:a},{commands:I,chain:T,can:P}=new wae({editor:n,state:k});v.handler({state:k,range:M,match:b,commands:I,chain:T,can:P})===null||!N.steps.length||(N.setMeta(i,{transform:N,from:s,to:a,text:o}),u.dispatch(N),x=!0)}),x}function W1t(e){const{editor:t,rules:n}=e,s=new gd({state:{init(){return null},apply(a,o,l){const i=a.getMeta(s);if(i)return i;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:x}=u;typeof x=="string"?x=x:x=a0e(pn.from(x),l.schema);const{from:y}=u,v=y+x.length;dO({editor:t,from:y,to:v,text:x,rules:n,plugin:s})}),a.selectionSet||a.docChanged?null:o}},props:{handleTextInput(a,o,l,i){return dO({editor:t,from:o,to:l,text:i,rules:n,plugin:s})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&dO({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:s})}),!1)},handleKeyDown(a,o){if(o.key!=="Enter")return!1;const{$cursor:l}=a.state.selection;return l?dO({editor:t,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function G1t(e){return Object.prototype.toString.call(e).slice(8,-1)}function uO(e){return G1t(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Nae(e,t){const n={...e};return uO(e)&&uO(t)&&Object.keys(t).forEach(s=>{uO(t[s])&&uO(e[s])?n[s]=Nae(e[s],t[s]):n[s]=t[s]}),n}class tx{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=yi(Ms(this,"addOptions",{name:this.name}))),this.storage=yi(Ms(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new tx(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Nae(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new tx(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=yi(Ms(n,"addOptions",{name:n.name})),n.storage=yi(Ms(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:s}=t.state,a=t.state.selection.$from;if(a.pos===a.end()){const l=a.marks();if(!!!l.find(m=>(m==null?void 0:m.type.name)===n.name))return!1;const u=l.find(m=>(m==null?void 0:m.type.name)===n.name);return u&&s.removeStoredMark(u),s.insertText(" ",a.pos),t.view.dispatch(s),!0}return!1}}function K1t(e){return typeof e=="number"}class Z1t{constructor(t){this.find=t.find,this.handler=t.handler}}const Y1t=(e,t,n)=>{if(i0e(t))return[...e.matchAll(t)];const s=t(e,n);return s?s.map(a=>{const o=[a.text];return o.index=a.index,o.input=e,o.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(a.replaceWith)),o}):[]};function X1t(e){const{editor:t,state:n,from:s,to:a,rule:o,pasteEvent:l,dropEvent:i}=e,{commands:u,chain:m,can:x}=new wae({editor:t,state:n}),y=[];return n.doc.nodesBetween(s,a,(b,N)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(s,N),M=Math.min(a,N+b.content.size),I=b.textBetween(k-N,M-N,void 0,"");Y1t(I,o.find,l).forEach(P=>{if(P.index===void 0)return;const F=k+P.index+1,D=F+P[0].length,U={from:n.tr.mapping.map(F),to:n.tr.mapping.map(D)},V=o.handler({state:n,range:U,match:P,commands:u,chain:m,can:x,pasteEvent:l,dropEvent:i});y.push(V)})}),y.every(b=>b!==null)}let hO=null;const Q1t=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 J1t(e){const{editor:t,rules:n}=e;let s=null,a=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,i;try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}const u=({state:x,from:y,to:v,rule:b,pasteEvt:N})=>{const k=x.tr,M=bae({state:x,transaction:k});if(!(!X1t({editor:t,state:M,from:Math.max(y-1,0),to:v.b-1,rule:b,pasteEvent:N,dropEvent:i})||!k.steps.length)){try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return n.map(x=>new gd({view(y){const v=N=>{var k;s=!((k=y.dom.parentElement)===null||k===void 0)&&k.contains(N.target)?y.dom.parentElement:null,s&&(hO=t)},b=()=>{hO&&(hO=null)};return window.addEventListener("dragstart",v),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",v),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(y,v)=>{if(o=s===y.dom.parentElement,i=v,!o){const b=hO;b!=null&&b.isEditable&&setTimeout(()=>{const N=b.state.selection;N&&b.commands.deleteRange({from:N.from,to:N.to})},10)}return!1},paste:(y,v)=>{var b;const N=(b=v.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=v,a=!!(N!=null&&N.includes("data-pm-slice")),!1}}},appendTransaction:(y,v,b)=>{const N=y[0],k=N.getMeta("uiEvent")==="paste"&&!a,M=N.getMeta("uiEvent")==="drop"&&!o,I=N.getMeta("applyPasteRules"),T=!!I;if(!k&&!M&&!T)return;if(T){let{text:D}=I;typeof D=="string"?D=D:D=a0e(pn.from(D),b.schema);const{from:U}=I,V=U+D.length,W=Q1t(D);return u({rule:x,state:b,from:U,to:{b:V},pasteEvt:W})}const P=v.doc.content.findDiffStart(b.doc.content),F=v.doc.content.findDiffEnd(b.doc.content);if(!(!K1t(P)||!F||P===F.b))return u({rule:x,state:b,from:P,to:F,pasteEvt:l})}}))}function evt(e){const t=e.filter((n,s)=>e.indexOf(n)!==s);return Array.from(new Set(t))}class a4{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=a4.resolve(t),this.schema=q1t(this.extensions,n),this.setupExtensions()}static resolve(t){const n=a4.sort(a4.flatten(t)),s=evt(n.map(a=>a.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(a=>`'${a}'`).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},a=Ms(n,"addExtensions",s);return a?[n,...this.flatten(a())]:n}).flat(10)}static sort(t){return t.sort((s,a)=>{const o=Ms(s,"priority")||100,l=Ms(a,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:cde(n.name,this.schema)},a=Ms(n,"addCommands",s);return a?{...t,...a()}:t},{})}get plugins(){const{editor:t}=this,n=a4.sort([...this.extensions].reverse()),s=[],a=[],o=n.map(l=>{const i={name:l.name,options:l.options,storage:l.storage,editor:t,type:cde(l.name,this.schema)},u=[],m=Ms(l,"addKeyboardShortcuts",i);let x={};if(l.type==="mark"&&Ms(l,"exitable",i)&&(x.ArrowRight=()=>tx.handleExit({editor:t,mark:l})),m){const k=Object.fromEntries(Object.entries(m()).map(([M,I])=>[M,()=>I({editor:t})]));x={...x,...k}}const y=v1t(x);u.push(y);const v=Ms(l,"addInputRules",i);e4e(l,t.options.enableInputRules)&&v&&s.push(...v());const b=Ms(l,"addPasteRules",i);e4e(l,t.options.enablePasteRules)&&b&&a.push(...b());const N=Ms(l,"addProseMirrorPlugins",i);if(N){const k=N();u.push(...k)}return u}).flat();return[W1t({editor:t,rules:s}),...J1t({editor:t,rules:a}),...o]}get attributes(){return Vze(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=jae(this.extensions);return Object.fromEntries(n.filter(s=>!!Ms(s,"addNodeView")).map(s=>{const a=this.attributes.filter(u=>u.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:t,type:qd(s.name,this.schema)},l=Ms(s,"addNodeView",o);if(!l)return[];const i=(u,m,x,y,v)=>{const b=Wme(u,a);return l()({node:u,view:m,getPos:x,decorations:y,innerDecorations:v,editor:t,extension:s,HTMLAttributes:b})};return[s.name,i]}))}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:cde(t.name,this.schema)};t.type==="mark"&&(!((n=yi(Ms(t,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const a=Ms(t,"onBeforeCreate",s),o=Ms(t,"onCreate",s),l=Ms(t,"onUpdate",s),i=Ms(t,"onSelectionUpdate",s),u=Ms(t,"onTransaction",s),m=Ms(t,"onFocus",s),x=Ms(t,"onBlur",s),y=Ms(t,"onDestroy",s);a&&this.editor.on("beforeCreate",a),o&&this.editor.on("create",o),l&&this.editor.on("update",l),i&&this.editor.on("selectionUpdate",i),u&&this.editor.on("transaction",u),m&&this.editor.on("focus",m),x&&this.editor.on("blur",x),y&&this.editor.on("destroy",y)})}}class ou{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=yi(Ms(this,"addOptions",{name:this.name}))),this.storage=yi(Ms(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ou(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Nae(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new ou({...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=yi(Ms(n,"addOptions",{name:n.name})),n.storage=yi(Ms(n,"addStorage",{name:n.name,options:n.options})),n}}function Wze(e,t,n){const{from:s,to:a}=t,{blockSeparator:o=` `,textSerializers:l={}}=n||{};let i="";return e.nodesBetween(s,a,(u,m,x,y)=>{var v;u.isBlock&&m>s&&(i+=o);const b=l==null?void 0:l[u.type.name];if(b)return x&&(i+=b({node:u,pos:m,parent:x,index:y,range:t})),!1;u.isText&&(i+=(v=u==null?void 0:u.text)===null||v===void 0?void 0:v.slice(Math.max(s,m)-m,a-m))}),i}function Gze(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const tvt=ou.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new gd({key:new Cu("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:s,selection:a}=t,{ranges:o}=a,l=Math.min(...o.map(x=>x.$from.pos)),i=Math.max(...o.map(x=>x.$to.pos)),u=Gze(n);return Wze(s,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),rvt=()=>({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),nvt=(e=!1)=>({commands:t})=>t.setContent("",e),svt=()=>({state:e,tr:t,dispatch:n})=>{const{selection:s}=t,{ranges:a}=s;return n&&a.forEach(({$from:o,$to:l})=>{e.doc.nodesBetween(o.pos,l.pos,(i,u)=>{if(i.type.isText)return;const{doc:m,mapping:x}=t,y=m.resolve(x.map(u)),v=m.resolve(x.map(u+i.nodeSize)),b=y.blockRange(v);if(!b)return;const N=P3(b);if(i.type.isTextblock){const{defaultType:k}=y.parent.contentMatchAt(y.index());t.setNodeMarkup(b.start,k)}(N||N===0)&&t.lift(b,N)})}),!0},avt=e=>t=>e(t),ivt=()=>({state:e,dispatch:t})=>Bze(e,t),ovt=(e,t)=>({editor:n,tr:s})=>{const{state:a}=n,o=a.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 va(s.doc.resolve(Math.max(l-1,0)))),!0},lvt=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,s=n.$anchor.node();if(s.content.size>0)return!1;const a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s.type){if(t){const i=a.before(o),u=a.after(o);e.delete(i,u).scrollIntoView()}return!0}return!1},cvt=e=>({tr:t,state:n,dispatch:s})=>{const a=qd(e,n.schema),o=t.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===a){if(s){const u=o.before(l),m=o.after(l);t.delete(u,m).scrollIntoView()}return!0}return!1},dvt=e=>({tr:t,dispatch:n})=>{const{from:s,to:a}=e;return n&&t.delete(s,a),!0},uvt=()=>({state:e,dispatch:t})=>e0e(e,t),hvt=()=>({commands:e})=>e.keyboardShortcut("Enter"),mvt=()=>({state:e,dispatch:t})=>N1t(e,t);function gre(e,t,n={strict:!0}){const s=Object.keys(t);return s.length?s.every(a=>n.strict?t[a]===e[a]:i0e(t[a])?t[a].test(e[a]):t[a]===e[a]):!0}function Kze(e,t,n={}){return e.find(s=>s.type===t&&gre(Object.fromEntries(Object.keys(n).map(a=>[a,s.attrs[a]])),n))}function t4e(e,t,n={}){return!!Kze(e,t,n)}function o0e(e,t,n){var s;if(!e||!t)return;let a=e.parent.childAfter(e.parentOffset);if((!a.node||!a.node.marks.some(x=>x.type===t))&&(a=e.parent.childBefore(e.parentOffset)),!a.node||!a.node.marks.some(x=>x.type===t)||(n=n||((s=a.node.marks[0])===null||s===void 0?void 0:s.attrs),!Kze([...a.node.marks],t,n)))return;let l=a.index,i=e.start()+a.offset,u=l+1,m=i+a.node.nodeSize;for(;l>0&&t4e([...e.parent.child(l-1).marks],t,n);)l-=1,i-=e.parent.child(l).nodeSize;for(;u({tr:n,state:s,dispatch:a})=>{const o=Ev(e,s.schema),{doc:l,selection:i}=n,{$from:u,from:m,to:x}=i;if(a){const y=o0e(u,o,t);if(y&&y.from<=m&&y.to>=x){const v=va.create(l,y.from,y.to);n.setSelection(v)}}return!0},pvt=e=>t=>{const n=typeof e=="function"?e(t):e;for(let s=0;s({editor:n,view:s,tr:a,dispatch:o})=>{t={scrollIntoView:!0,...t};const l=()=>{(l0e()||gvt())&&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&&!Zze(n.state.selection))return l(),!0;const i=Yze(a.doc,e)||n.state.selection,u=n.state.selection.eq(i);return o&&(u||a.setSelection(i),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),l()),!0},yvt=(e,t)=>n=>e.every((s,a)=>t(s,{...n,index:a})),vvt=(e,t)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Xze=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&&Xze(s)}return e};function mO(e){const t=`${e}`,n=new window.DOMParser().parseFromString(t,"text/html").body;return Xze(n)}function HE(e,t,n){if(e instanceof nv||e instanceof pn)return e;n={slice:!0,parseOptions:{},...n};const s=typeof e=="object"&&e!==null,a=typeof e=="string";if(s)try{if(Array.isArray(e)&&e.length>0)return pn.fromArray(e.map(i=>t.nodeFromJSON(i)));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),HE("",t,n)}if(a){if(n.errorOnInvalidContent){let l=!1,i="";const u=new IFe({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:m=>(l=!0,i=typeof m=="string"?m:m.outerHTML,null)}]}})});if(n.slice?BA.fromSchema(u).parseSlice(mO(e),n.parseOptions):BA.fromSchema(u).parse(mO(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=BA.fromSchema(t);return n.slice?o.parseSlice(mO(e),n.parseOptions).content:o.parse(mO(e),n.parseOptions)}return HE("",t,n)}function _vt(e,t,n){const s=e.steps.length-1;if(s{l===0&&(l=x)}),e.setSelection(Oa.near(e.doc.resolve(l),n))}const bvt=e=>!("type"in e),wvt=(e,t,n)=>({tr:s,dispatch:a,editor:o})=>{var l;if(a){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i;const u=M=>{o.emit("contentError",{editor:o,error:M,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},m={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{HE(t,o.schema,{parseOptions:m,errorOnInvalidContent:!0})}catch(M){u(M)}try{i=HE(t,o.schema,{parseOptions:m,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(M){return u(M),!1}let{from:x,to:y}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},v=!0,b=!0;if((bvt(i)?i:[i]).forEach(M=>{M.check(),v=v?M.isText&&M.marks.length===0:!1,b=b?M.isBlock:!1}),x===y&&b){const{parent:M}=s.doc.resolve(x);M.isTextblock&&!M.type.spec.code&&!M.childCount&&(x-=1,y+=1)}let k;if(v){if(Array.isArray(t))k=t.map(M=>M.text||"").join("");else if(t instanceof pn){let M="";t.forEach(I=>{I.text&&(M+=I.text)}),k=M}else typeof t=="object"&&t&&t.text?k=t.text:k=t;s.insertText(k,x,y)}else k=i,s.replaceWith(x,y,k);n.updateSelection&&_vt(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:x,text:k}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:x,text:k})}return!0},jvt=()=>({state:e,dispatch:t})=>w1t(e,t),kvt=()=>({state:e,dispatch:t})=>j1t(e,t),Nvt=()=>({state:e,dispatch:t})=>Pze(e,t),Svt=()=>({state:e,dispatch:t})=>Rze(e,t),Cvt=()=>({state:e,dispatch:t,tr:n})=>{try{const s=pae(e.doc,e.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},Mvt=()=>({state:e,dispatch:t,tr:n})=>{try{const s=pae(e.doc,e.selection.$from.pos,1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},Tvt=()=>({state:e,dispatch:t})=>_1t(e,t),Avt=()=>({state:e,dispatch:t})=>b1t(e,t);function Qze(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Evt(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let s,a,o,l;for(let i=0;i({editor:t,view:n,tr:s,dispatch:a})=>{const o=Evt(e).split(/-(?!$)/),l=o.find(m=>!["Alt","Ctrl","Meta","Shift"].includes(m)),i=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}),u=t.captureTransaction(()=>{n.someProp("handleKeyDown",m=>m(n,i))});return u==null||u.steps.forEach(m=>{const x=m.map(s.mapping);x&&a&&s.maybeStep(x)}),!0};function WE(e,t,n={}){const{from:s,to:a,empty:o}=e.selection,l=t?qd(t,e.schema):null,i=[];e.doc.nodesBetween(s,a,(y,v)=>{if(y.isText)return;const b=Math.max(s,v),N=Math.min(a,v+y.nodeSize);i.push({node:y,from:b,to:N})});const u=a-s,m=i.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>gre(y.node.attrs,n,{strict:!1}));return o?!!m.length:m.reduce((y,v)=>y+v.to-v.from,0)>=u}const Pvt=(e,t={})=>({state:n,dispatch:s})=>{const a=qd(e,n.schema);return WE(n,a,t)?k1t(n,s):!1},Lvt=()=>({state:e,dispatch:t})=>$ze(e,t),Ovt=e=>({state:t,dispatch:n})=>{const s=qd(e,t.schema);return D1t(s)(t,n)},Dvt=()=>({state:e,dispatch:t})=>zze(e,t);function Sae(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function r4e(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((s,a)=>(n.includes(a)||(s[a]=e[a]),s),{})}const Rvt=(e,t)=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Sae(typeof e=="string"?e:e.name,s.schema);return i?(i==="node"&&(o=qd(e,s.schema)),i==="mark"&&(l=Ev(e,s.schema)),a&&n.selection.ranges.forEach(u=>{s.doc.nodesBetween(u.$from.pos,u.$to.pos,(m,x)=>{o&&o===m.type&&n.setNodeMarkup(x,void 0,r4e(m.attrs,t)),l&&m.marks.length&&m.marks.forEach(y=>{l===y.type&&n.addMark(x,x+m.nodeSize,l.create(r4e(y.attrs,t)))})})}),!0):!1},Fvt=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),zvt=()=>({tr:e,dispatch:t})=>{if(t){const n=new bm(e.doc);e.setSelection(n)}return!0},Bvt=()=>({state:e,dispatch:t})=>Oze(e,t),$vt=()=>({state:e,dispatch:t})=>Fze(e,t),Uvt=()=>({state:e,dispatch:t})=>M1t(e,t),qvt=()=>({state:e,dispatch:t})=>E1t(e,t),Vvt=()=>({state:e,dispatch:t})=>A1t(e,t);function Gme(e,t,n={},s={}){return HE(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const Hvt=(e,t=!1,n={},s={})=>({editor:a,tr:o,dispatch:l,commands:i})=>{var u,m;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const y=Gme(e,a.schema,n,{errorOnInvalidContent:(u=s.errorOnInvalidContent)!==null&&u!==void 0?u:a.options.enableContentCheck});return l&&o.replaceWith(0,x.content.size,y).setMeta("preventUpdate",!t),!0}return l&&o.setMeta("preventUpdate",!t),i.insertContentAt({from:0,to:x.content.size},e,{parseOptions:n,errorOnInvalidContent:(m=s.errorOnInvalidContent)!==null&&m!==void 0?m:a.options.enableContentCheck})};function Jze(e,t){const n=Ev(t,e.schema),{from:s,to:a,empty:o}=e.selection,l=[];o?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(s,a,u=>{l.push(...u.marks)});const i=l.find(u=>u.type.name===n.name);return i?{...i.attrs}:{}}function Wvt(e,t){const n=new Uye(e);return t.forEach(s=>{s.steps.forEach(a=>{n.step(a)})}),n}function Gvt(e){for(let t=0;t{n(a)&&s.push({node:a,pos:o})}),s}function e7e(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 c0e(e){return t=>e7e(t.$from,e)}function Zvt(e,t){const n={from:0,to:e.content.size};return Wze(e,n,t)}function Yvt(e,t){const n=qd(t,e.schema),{from:s,to:a}=e.selection,o=[];e.doc.nodesBetween(s,a,i=>{o.push(i)});const l=o.reverse().find(i=>i.type.name===n.name);return l?{...l.attrs}:{}}function t7e(e,t){const n=Sae(typeof t=="string"?t:t.name,e.schema);return n==="node"?Yvt(e,t):n==="mark"?Jze(e,t):{}}function Xvt(e,t=JSON.stringify){const n={};return e.filter(s=>{const a=t(s);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function Qvt(e){const t=Xvt(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 Jvt(e){const{mapping:t,steps:n}=e,s=[];return t.maps.forEach((a,o)=>{const l=[];if(a.ranges.length)a.forEach((i,u)=>{l.push({from:i,to:u})});else{const{from:i,to:u}=n[o];if(i===void 0||u===void 0)return;l.push({from:i,to:u})}l.forEach(({from:i,to:u})=>{const m=t.slice(o).map(i,-1),x=t.slice(o).map(u),y=t.invert().map(m,-1),v=t.invert().map(x);s.push({oldRange:{from:y,to:v},newRange:{from:m,to:x}})})}),Qvt(s)}function d0e(e,t,n){const s=[];return e===t?n.resolve(e).marks().forEach(a=>{const o=n.resolve(e),l=o0e(o,a.type);l&&s.push({mark:a,...l})}):n.nodesBetween(e,t,(a,o)=>{!a||(a==null?void 0:a.nodeSize)===void 0||s.push(...a.marks.map(l=>({from:o,to:o+a.nodeSize,mark:l})))}),s}function Gee(e,t,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const a=e.find(o=>o.type===t&&o.name===s);return a?a.attribute.keepOnSplit:!1}))}function Kme(e,t,n={}){const{empty:s,ranges:a}=e.selection,o=t?Ev(t,e.schema):null;if(s)return!!(e.storedMarks||e.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>gre(y.attrs,n,{strict:!1}));let l=0;const i=[];if(a.forEach(({$from:y,$to:v})=>{const b=y.pos,N=v.pos;e.doc.nodesBetween(b,N,(k,M)=>{if(!k.isText&&!k.marks.length)return;const I=Math.max(b,M),T=Math.min(N,M+k.nodeSize),P=T-I;l+=P,i.push(...k.marks.map(F=>({mark:F,from:I,to:T})))})}),l===0)return!1;const u=i.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>gre(y.mark.attrs,n,{strict:!1})).reduce((y,v)=>y+v.to-v.from,0),m=i.filter(y=>o?y.mark.type!==o&&y.mark.type.excludes(o):!0).reduce((y,v)=>y+v.to-v.from,0);return(u>0?u+m:u)>=l}function e_t(e,t,n={}){if(!t)return WE(e,null,n)||Kme(e,null,n);const s=Sae(t,e.schema);return s==="node"?WE(e,t,n):s==="mark"?Kme(e,t,n):!1}function n4e(e,t){const{nodeExtensions:n}=jae(t),s=n.find(l=>l.name===e);if(!s)return!1;const a={name:s.name,options:s.options,storage:s.storage},o=yi(Ms(s,"group",a));return typeof o!="string"?!1:o.split(" ").includes("list")}function u0e(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 a=!0;return e.content.forEach(o=>{a!==!1&&(u0e(o,{ignoreWhitespace:n,checkChildren:t})||(a=!1))}),a}return!1}function t_t(e){return e instanceof ua}function r_t(e,t,n){var s;const{selection:a}=t;let o=null;if(Zze(a)&&(o=a.$cursor),o){const i=(s=e.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(i)||!i.some(u=>u.type.excludes(n))}const{ranges:l}=a;return l.some(({$from:i,$to:u})=>{let m=i.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(i.pos,u.pos,(x,y,v)=>{if(m)return!1;if(x.isInline){const b=!v||v.type.allowsMarkType(n),N=!!n.isInSet(x.marks)||!x.marks.some(k=>k.type.excludes(n));m=b&&N}return!m}),m})}const n_t=(e,t={})=>({tr:n,state:s,dispatch:a})=>{const{selection:o}=n,{empty:l,ranges:i}=o,u=Ev(e,s.schema);if(a)if(l){const m=Jze(s,u);n.addStoredMark(u.create({...m,...t}))}else i.forEach(m=>{const x=m.$from.pos,y=m.$to.pos;s.doc.nodesBetween(x,y,(v,b)=>{const N=Math.max(b,x),k=Math.min(b+v.nodeSize,y);v.marks.find(I=>I.type===u)?v.marks.forEach(I=>{u===I.type&&n.addMark(N,k,u.create({...I.attrs,...t}))}):n.addMark(N,k,u.create(t))})});return r_t(s,n,u)},s_t=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),a_t=(e,t={})=>({state:n,dispatch:s,chain:a})=>{const o=qd(e,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),o.isTextblock?a().command(({commands:i})=>XSe(o,{...l,...t})(n)?!0:i.clearNodes()).command(({state:i})=>XSe(o,{...l,...t})(i,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},i_t=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,a=dj(e,0,s.content.size),o=ua.create(s,a);t.setSelection(o)}return!0},o_t=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,{from:a,to:o}=typeof e=="number"?{from:e,to:e}:e,l=va.atStart(s).from,i=va.atEnd(s).to,u=dj(a,l,i),m=dj(o,l,i),x=va.create(s,u,m);t.setSelection(x)}return!0},l_t=e=>({state:t,dispatch:n})=>{const s=qd(e,t.schema);return z1t(s)(t,n)};function s4e(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const s=n.filter(a=>t==null?void 0:t.includes(a.type.name));e.tr.ensureMarks(s)}}const c_t=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:s,editor:a})=>{const{selection:o,doc:l}=t,{$from:i,$to:u}=o,m=a.extensionManager.attributes,x=Gee(m,i.node().type.name,i.node().attrs);if(o instanceof ua&&o.node.isBlock)return!i.parentOffset||!vy(l,i.pos)?!1:(s&&(e&&s4e(n,a.extensionManager.splittableMarks),t.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const y=u.parentOffset===u.parent.content.size,v=i.depth===0?void 0:Gvt(i.node(-1).contentMatchAt(i.indexAfter(-1)));let b=y&&v?[{type:v,attrs:x}]:void 0,N=vy(t.doc,t.mapping.map(i.pos),1,b);if(!b&&!N&&vy(t.doc,t.mapping.map(i.pos),1,v?[{type:v}]:void 0)&&(N=!0,b=v?[{type:v,attrs:x}]:void 0),s){if(N&&(o instanceof va&&t.deleteSelection(),t.split(t.mapping.map(i.pos),1,b),v&&!y&&!i.parentOffset&&i.parent.type!==v)){const k=t.mapping.map(i.before()),M=t.doc.resolve(k);i.node(-1).canReplaceWith(M.index(),M.index()+1,v)&&t.setNodeMarkup(t.mapping.map(i.before()),v)}e&&s4e(n,a.extensionManager.splittableMarks),t.scrollIntoView()}return N},d_t=(e,t={})=>({tr:n,state:s,dispatch:a,editor:o})=>{var l;const i=qd(e,s.schema),{$from:u,$to:m}=s.selection,x=s.selection.node;if(x&&x.isBlock||u.depth<2||!u.sameParent(m))return!1;const y=u.node(-1);if(y.type!==i)return!1;const v=o.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==i||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let I=pn.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let W=u.depth-T;W>=u.depth-3;W-=1)I=pn.from(u.node(W).copy(I));const P=u.indexAfter(-1){if(V>-1)return!1;W.isTextblock&&W.content.size===0&&(V=G+1)}),V>-1&&n.setSelection(va.near(n.doc.resolve(V))),n.scrollIntoView()}return!0}const b=m.pos===u.end()?y.contentMatchAt(0).defaultType:null,N={...Gee(v,y.type.name,y.attrs),...t},k={...Gee(v,u.node().type.name,u.node().attrs),...t};n.delete(u.pos,m.pos);const M=b?[{type:i,attrs:N},{type:b,attrs:k}]:[{type:i,attrs:N}];if(!vy(n.doc,u.pos,2))return!1;if(a){const{selection:I,storedMarks:T}=s,{splittableMarks:P}=o.extensionManager,F=T||I.$to.parentOffset&&I.$from.marks();if(n.split(u.pos,2,M).scrollIntoView(),!F||!a)return!0;const D=F.filter(U=>P.includes(U.type.name));n.ensureMarks(D)}return!0},dde=(e,t)=>{const n=c0e(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 a=e.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&Tv(e.doc,n.pos)&&e.join(n.pos),!0},ude=(e,t)=>{const n=c0e(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 a=e.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&Tv(e.doc,s)&&e.join(s),!0},u_t=(e,t,n,s={})=>({editor:a,tr:o,state:l,dispatch:i,chain:u,commands:m,can:x})=>{const{extensions:y,splittableMarks:v}=a.extensionManager,b=qd(e,l.schema),N=qd(t,l.schema),{selection:k,storedMarks:M}=l,{$from:I,$to:T}=k,P=I.blockRange(T),F=M||k.$to.parentOffset&&k.$from.marks();if(!P)return!1;const D=c0e(U=>n4e(U.type.name,y))(k);if(P.depth>=1&&D&&P.depth-D.depth<=1){if(D.node.type===b)return m.liftListItem(N);if(n4e(D.node.type.name,y)&&b.validContent(D.node.content)&&i)return u().command(()=>(o.setNodeMarkup(D.pos,b),!0)).command(()=>dde(o,b)).command(()=>ude(o,b)).run()}return!n||!F||!i?u().command(()=>x().wrapInList(b,s)?!0:m.clearNodes()).wrapInList(b,s).command(()=>dde(o,b)).command(()=>ude(o,b)).run():u().command(()=>{const U=x().wrapInList(b,s),V=F.filter(W=>v.includes(W.type.name));return o.ensureMarks(V),U?!0:m.clearNodes()}).wrapInList(b,s).command(()=>dde(o,b)).command(()=>ude(o,b)).run()},h_t=(e,t={},n={})=>({state:s,commands:a})=>{const{extendEmptyMarkRange:o=!1}=n,l=Ev(e,s.schema);return Kme(s,l,t)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,t)},m_t=(e,t,n={})=>({state:s,commands:a})=>{const o=qd(e,s.schema),l=qd(t,s.schema),i=WE(s,o,n);let u;return s.selection.$anchor.sameParent(s.selection.$head)&&(u=s.selection.$anchor.parent.attrs),i?a.setNode(l,u):a.setNode(o,{...u,...n})},f_t=(e,t={})=>({state:n,commands:s})=>{const a=qd(e,n.schema);return WE(n,a,t)?s.lift(a):s.wrapIn(a,t)},p_t=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let s=0;s=0;u-=1)l.step(i.steps[u].invert(i.docs[u]));if(o.text){const u=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,e.schema.text(o.text,u))}else l.delete(o.from,o.to)}return!0}}return!1},g_t=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:s,ranges:a}=n;return s||t&&a.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},x_t=(e,t={})=>({tr:n,state:s,dispatch:a})=>{var o;const{extendEmptyMarkRange:l=!1}=t,{selection:i}=n,u=Ev(e,s.schema),{$from:m,empty:x,ranges:y}=i;if(!a)return!0;if(x&&l){let{from:v,to:b}=i;const N=(o=m.marks().find(M=>M.type===u))===null||o===void 0?void 0:o.attrs,k=o0e(m,u,N);k&&(v=k.from,b=k.to),n.removeMark(v,b,u)}else y.forEach(v=>{n.removeMark(v.$from.pos,v.$to.pos,u)});return n.removeStoredMark(u),!0},y_t=(e,t={})=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Sae(typeof e=="string"?e:e.name,s.schema);return i?(i==="node"&&(o=qd(e,s.schema)),i==="mark"&&(l=Ev(e,s.schema)),a&&n.selection.ranges.forEach(u=>{const m=u.$from.pos,x=u.$to.pos;let y,v,b,N;n.selection.empty?s.doc.nodesBetween(m,x,(k,M)=>{o&&o===k.type&&(b=Math.max(M,m),N=Math.min(M+k.nodeSize,x),y=M,v=k)}):s.doc.nodesBetween(m,x,(k,M)=>{M=m&&M<=x&&(o&&o===k.type&&n.setNodeMarkup(M,void 0,{...k.attrs,...t}),l&&k.marks.length&&k.marks.forEach(I=>{if(l===I.type){const T=Math.max(M,m),P=Math.min(M+k.nodeSize,x);n.addMark(T,P,l.create({...I.attrs,...t}))}}))}),v&&(y!==void 0&&n.setNodeMarkup(y,void 0,{...v.attrs,...t}),l&&v.marks.length&&v.marks.forEach(k=>{l===k.type&&n.addMark(b,N,l.create({...k.attrs,...t}))}))}),!0):!1},v_t=(e,t={})=>({state:n,dispatch:s})=>{const a=qd(e,n.schema);return I1t(a,t)(n,s)},__t=(e,t={})=>({state:n,dispatch:s})=>{const a=qd(e,n.schema);return P1t(a,t)(n,s)};var b_t=Object.freeze({__proto__:null,blur:rvt,clearContent:nvt,clearNodes:svt,command:avt,createParagraphNear:ivt,cut:ovt,deleteCurrentNode:lvt,deleteNode:cvt,deleteRange:dvt,deleteSelection:uvt,enter:hvt,exitCode:mvt,extendMarkRange:fvt,first:pvt,focus:xvt,forEach:yvt,insertContent:vvt,insertContentAt:wvt,joinBackward:Nvt,joinDown:kvt,joinForward:Svt,joinItemBackward:Cvt,joinItemForward:Mvt,joinTextblockBackward:Tvt,joinTextblockForward:Avt,joinUp:jvt,keyboardShortcut:Ivt,lift:Pvt,liftEmptyBlock:Lvt,liftListItem:Ovt,newlineInCode:Dvt,resetAttributes:Rvt,scrollIntoView:Fvt,selectAll:zvt,selectNodeBackward:Bvt,selectNodeForward:$vt,selectParentNode:Uvt,selectTextblockEnd:qvt,selectTextblockStart:Vvt,setContent:Hvt,setMark:n_t,setMeta:s_t,setNode:a_t,setNodeSelection:i_t,setTextSelection:o_t,sinkListItem:l_t,splitBlock:c_t,splitListItem:d_t,toggleList:u_t,toggleMark:h_t,toggleNode:m_t,toggleWrap:f_t,undoInputRule:p_t,unsetAllMarks:g_t,unsetMark:x_t,updateAttributes:y_t,wrapIn:v_t,wrapInList:__t});const w_t=ou.create({name:"commands",addCommands(){return{...b_t}}}),j_t=ou.create({name:"drop",addProseMirrorPlugins(){return[new gd({key:new Cu("tiptapDrop"),props:{handleDrop:(e,t,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:s})}}})]}}),k_t=ou.create({name:"editable",addProseMirrorPlugins(){return[new gd({key:new Cu("editable"),props:{editable:()=>this.editor.options.editable}})]}}),N_t=new Cu("focusEvents"),S_t=ou.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new gd({key:N_t,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}}}})]}}),C_t=ou.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:i})=>{const{selection:u,doc:m}=i,{empty:x,$anchor:y}=u,{pos:v,parent:b}=y,N=y.parent.isTextblock&&v>0?i.doc.resolve(v-1):y,k=N.parent.type.spec.isolating,M=y.pos-y.parentOffset,I=k&&N.parent.childCount===1?M===y.pos:Oa.atStart(m).from===v;return!x||!b.type.isTextblock||b.textContent.length||!I||I&&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()},a={...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 l0e()||Qze()?o:a},addProseMirrorPlugins(){return[new gd({key:new Cu("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(k=>k.getMeta("composition")))return;const s=e.some(k=>k.docChanged)&&!t.doc.eq(n.doc),a=e.some(k=>k.getMeta("preventClearDocument"));if(!s||a)return;const{empty:o,from:l,to:i}=t.selection,u=Oa.atStart(t.doc).from,m=Oa.atEnd(t.doc).to;if(o||!(l===u&&i===m)||!u0e(n.doc))return;const v=n.tr,b=bae({state:n,transaction:v}),{commands:N}=new wae({editor:this.editor,state:b});if(N.clearNodes(),!!v.steps.length)return v}})]}}),M_t=ou.create({name:"paste",addProseMirrorPlugins(){return[new gd({key:new Cu("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),T_t=ou.create({name:"tabindex",addProseMirrorPlugins(){return[new gd({key:new Cu("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class ej{get name(){return this.node.type.name}constructor(t,n,s=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=t,this.editor=n,this.currentNode=a}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 ej(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 ej(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 ej(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,s)=>{const a=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 i=this.resolvedPos.doc.resolve(l);if(!a&&i.depth<=this.depth)return;const u=new ej(i,this.editor,a,a?n:null);a&&(u.actualDepth=this.depth+1),t.push(new ej(i,this.editor,a,a?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,a=this.parent;for(;a&&!s;){if(a.node.type.name===t)if(Object.keys(n).length>0){const o=a.node.attrs,l=Object.keys(n);for(let i=0;i{s&&a.length>0||(l.node.type.name===t&&o.every(u=>n[u]===l.node.attrs[u])&&a.push(l),!(s&&a.length>0)&&(a=a.concat(l.querySelectorAll(t,n,s))))}),a}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}}const A_t=`.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 E_t(e,t,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const a=document.createElement("style");return t&&a.setAttribute("nonce",t),a.setAttribute("data-tiptap-style",""),a.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(a),a}class I_t extends B1t{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:a})=>this.options.onDrop(n,s,a)),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=E_t(A_t,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=Hze(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],a=this.state.reconfigure({plugins:s});return this.view.updateState(a),a}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(i=>!i.key.startsWith(l))}),n.length===s.length)return;const a=this.state.reconfigure({plugins:s});return this.view.updateState(a),a}createExtensionManager(){var t,n;const a=[...this.options.enableCoreExtensions?[k_t,tvt.configure({blockSeparator:(n=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),w_t,S_t,C_t,T_t,j_t,M_t].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 a4(a,this)}createCommandManager(){this.commandManager=new wae({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let n;try{n=Gme(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(i=>i.name!=="collaboration"),this.createExtensionManager()}}),n=Gme(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=Yze(n,this.options.autofocus);this.view=new Eze(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:s4.create({doc:n,selection:s||void 0})});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),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 i;return(i=this.capturedTransaction)===null||i===void 0?void 0:i.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 a=t.getMeta("focus"),o=t.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.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 t7e(this.state,t)}isActive(t,n){const s=typeof t=="string"?t:null,a=typeof t=="string"?n:t;return e_t(this.state,s,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return a0e(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=` `,textSerializers:s={}}=t||{};return Zvt(this.state.doc,{blockSeparator:n,textSerializers:{...Gze(this.schema),...s}})}get isEmpty(){return u0e(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 ej(n,this)}get $doc(){return this.$pos(0)}}function $C(e){return new kae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=yi(e.getAttributes,void 0,s);if(a===!1||a===null)return null;const{tr:o}=t,l=s[s.length-1],i=s[0];if(l){const u=i.search(/\S/),m=n.from+i.indexOf(l),x=m+l.length;if(d0e(n.from,n.to,t.doc).filter(b=>b.mark.type.excluded.find(k=>k===e.type&&k!==b.mark.type)).filter(b=>b.to>m).length)return null;xn.from&&o.delete(n.from+u,m);const v=n.from+u+l.length;o.addMark(n.from+u,v,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}function r7e(e){return new kae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=yi(e.getAttributes,void 0,s)||{},{tr:o}=t,l=n.from;let i=n.to;const u=e.type.create(a);if(s[1]){const m=s[0].lastIndexOf(s[1]);let x=l+m;x>i?x=i:i=x+s[1].length;const y=s[0][s[0].length-1];o.insertText(y,l+s[0].length-1),o.replaceWith(x,i,u)}else if(s[0]){const m=e.type.isInline?l:l-1;o.insert(m,e.type.create(a)).delete(o.mapping.map(l),o.mapping.map(i))}o.scrollIntoView()}})}function Zme(e){return new kae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=t.doc.resolve(n.from),o=yi(e.getAttributes,void 0,s)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function GE(e){return new kae({find:e.find,handler:({state:t,range:n,match:s,chain:a})=>{const o=yi(e.getAttributes,void 0,s)||{},l=t.tr.delete(n.from,n.to),u=l.doc.resolve(n.from).blockRange(),m=u&&$ye(u,e.type,o);if(!m)return null;if(l.wrap(u,m),e.keepMarks&&e.editor){const{selection:y,storedMarks:v}=t,{splittableMarks:b}=e.editor.extensionManager,N=v||y.$to.parentOffset&&y.$from.marks();if(N){const k=N.filter(M=>b.includes(M.type.name));l.ensureMarks(k)}}if(e.keepAttributes){const y=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(y,o).run()}const x=l.doc.resolve(n.from-1).nodeBefore;x&&x.type===e.type&&Tv(l.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(s,x))&&l.join(n.from-1)}})}let Mu=class Yme{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=yi(Ms(this,"addOptions",{name:this.name}))),this.storage=yi(Ms(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Yme(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Nae(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Yme(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=yi(Ms(n,"addOptions",{name:n.name})),n.storage=yi(Ms(n,"addStorage",{name:n.name,options:n.options})),n}};function gk(e){return new Z1t({find:e.find,handler:({state:t,range:n,match:s,pasteEvent:a})=>{const o=yi(e.getAttributes,void 0,s,a);if(o===!1||o===null)return null;const{tr:l}=t,i=s[s.length-1],u=s[0];let m=n.to;if(i){const x=u.search(/\S/),y=n.from+u.indexOf(i),v=y+i.length;if(d0e(n.from,n.to,t.doc).filter(N=>N.mark.type.excluded.find(M=>M===e.type&&M!==N.mark.type)).filter(N=>N.to>y).length)return null;vn.from&&l.delete(n.from+x,y),m=n.from+x+i.length,l.addMark(n.from+x,m,e.type.create(o||{})),l.removeStoredMark(e.type)}}})}function P_t(e,t){const{selection:n}=e,{$from:s}=n;if(n instanceof ua){const o=s.index();return s.parent.canReplaceWith(o,o+1,t)}let a=s.depth;for(;a>=0;){const o=s.index(a);if(s.node(a).contentMatchAt(o).matchType(t))return!0;a-=1}return!1}function L_t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var n7e={exports:{}},hde={};/** * @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 a4e;function O_t(){if(a4e)return hde;a4e=1;var e=dt;function t(y,v){return y===v&&(y!==0||1/y===1/v)||y!==y&&v!==v}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function i(y,v){var b=v(),N=s({inst:{value:b,getSnapshot:v}}),k=N[0].inst,M=N[1];return o(function(){k.value=b,k.getSnapshot=v,u(k)&&M({inst:k})},[y,b,v]),a(function(){return u(k)&&M({inst:k}),y(function(){u(k)&&M({inst:k})})},[y]),l(b),b}function u(y){var v=y.getSnapshot;y=y.value;try{var b=v();return!n(y,b)}catch{return!0}}function m(y,v){return v()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:i;return hde.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,hde}n7e.exports=O_t();var h0e=n7e.exports;const D_t=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},R_t=({contentComponent:e})=>{const t=h0e.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return dt.createElement(dt.Fragment,null,Object.values(t))};function F_t(){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]:Xge.createPortal(s.reactElement,s.element,n)},e.forEach(a=>a())},removeRenderer(n){const s={...t};delete s[n],t=s,e.forEach(a=>a())}}}class z_t extends dt.Component{constructor(t){var n;super(t),this.editorContentRef=dt.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=F_t(),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 dt.createElement(dt.Fragment,null,dt.createElement("div",{ref:D_t(n,this.editorContentRef),...s}),(t==null?void 0:t.contentComponent)&&dt.createElement(R_t,{contentComponent:t.contentComponent}))}}const B_t=A.forwardRef((e,t)=>{const n=dt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return dt.createElement(z_t,{key:n,innerRef:t,...e})}),s7e=dt.memo(B_t);var $_t=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,a,o;if(Array.isArray(t)){if(s=t.length,s!=n.length)return!1;for(a=s;a--!==0;)if(!e(t[a],n[a]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a of t.entries())if(!n.has(a[0]))return!1;for(a of t.entries())if(!e(a[1],n.get(a[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a of t.entries())if(!n.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(s=t.length,s!=n.length)return!1;for(a=s;a--!==0;)if(t[a]!==n[a])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(a=s;a--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[a]))return!1;for(a=s;a--!==0;){var l=o[a];if(!(l==="_owner"&&t.$$typeof)&&!e(t[l],n[l]))return!1}return!0}return t!==t&&n!==n},U_t=L_t($_t),a7e={exports:{}},mde={};/** * @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 i4e;function q_t(){if(i4e)return mde;i4e=1;var e=dt,t=h0e;function n(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}var s=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,i=e.useMemo,u=e.useDebugValue;return mde.useSyncExternalStoreWithSelector=function(m,x,y,v,b){var N=o(null);if(N.current===null){var k={hasValue:!1,value:null};N.current=k}else k=N.current;N=i(function(){function I(U){if(!T){if(T=!0,P=U,U=v(U),b!==void 0&&k.hasValue){var V=k.value;if(b(V,U))return F=V}return F=U}if(V=F,s(P,U))return V;var W=v(U);return b!==void 0&&b(V,W)?V:(P=U,F=W)}var T=!1,P,F,D=y===void 0?null:y;return[function(){return I(x())},D===null?void 0:function(){return I(D())}]},[x,y,v,b]);var M=a(m,N[0],N[1]);return l(function(){k.hasValue=!0,k.value=M},[M]),u(M),M},mde}a7e.exports=q_t();var V_t=a7e.exports;const H_t=typeof window<"u"?A.useLayoutEffect:A.useEffect;class W_t{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(a=>a())},s=this.editor;return s.on("transaction",n),()=>{s.off("transaction",n)}}}}function G_t(e){var t;const[n]=A.useState(()=>new W_t(e.editor)),s=V_t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:U_t);return H_t(()=>n.watch(e.editor),[e.editor,n]),A.useDebugValue(s),s}const K_t=!1,Xme=typeof window>"u",Z_t=Xme||!!(typeof window<"u"&&window.next);class m0e{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?Xme||Z_t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...s)=>{var a,o;return(o=(a=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(a,...s)},onBlur:(...s)=>{var a,o;return(o=(a=this.options.current).onBlur)===null||o===void 0?void 0:o.call(a,...s)},onCreate:(...s)=>{var a,o;return(o=(a=this.options.current).onCreate)===null||o===void 0?void 0:o.call(a,...s)},onDestroy:(...s)=>{var a,o;return(o=(a=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(a,...s)},onFocus:(...s)=>{var a,o;return(o=(a=this.options.current).onFocus)===null||o===void 0?void 0:o.call(a,...s)},onSelectionUpdate:(...s)=>{var a,o;return(o=(a=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(a,...s)},onTransaction:(...s)=>{var a,o;return(o=(a=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(a,...s)},onUpdate:(...s)=>{var a,o;return(o=(a=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(a,...s)},onContentError:(...s)=>{var a,o;return(o=(a=this.options.current).onContentError)===null||o===void 0?void 0:o.call(a,...s)},onDrop:(...s)=>{var a,o;return(o=(a=this.options.current).onDrop)===null||o===void 0?void 0:o.call(a,...s)},onPaste:(...s)=>{var a,o;return(o=(a=this.options.current).onPaste)===null||o===void 0?void 0:o.call(a,...s)}};return new I_t(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((a,o)=>{var l;return a===((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?m0e.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,a)=>s===t[a]))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 i7e(e={},t=[]){const n=A.useRef(e);n.current=e;const[s]=A.useState(()=>new m0e(n)),a=h0e.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return A.useDebugValue(a),A.useEffect(s.onRender(t)),G_t({editor:a,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),a}const Y_t=A.createContext({editor:null});Y_t.Consumer;const X_t=A.createContext({onDragStart:void 0}),Q_t=()=>A.useContext(X_t);dt.forwardRef((e,t)=>{const{onDragStart:n}=Q_t(),s=e.as||"div";return dt.createElement(s,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});const J_t=/^\s*>\s$/,ebt=Mu.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",Wl(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[GE({find:J_t,type:this.type})]}}),tbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,rbt=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,nbt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,sbt=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,abt=tx.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",Wl(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[$C({find:tbt,type:this.type}),$C({find:nbt,type:this.type})]},addPasteRules(){return[gk({find:rbt,type:this.type}),gk({find:sbt,type:this.type})]}}),ibt="listItem",o4e="textStyle",l4e=/^\s*([-+*])\s$/,obt=Mu.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",Wl(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(ibt,this.editor.getAttributes(o4e)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=GE({find:l4e,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=GE({find:l4e,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(o4e),editor:this.editor})),[e]}}),lbt=/(^|[^`])`([^`]+)`(?!`)/,cbt=/(^|[^`])`([^`]+)`(?!`)/g,dbt=tx.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Wl(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[$C({find:lbt,type:this.type})]},addPasteRules(){return[gk({find:cbt,type:this.type})]}}),ubt=/^```([a-z]+)?[\s\n]$/,hbt=/^~~~([a-z]+)?[\s\n]$/,mbt=Mu.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",Wl(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:a}=n;if(!a||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:i})=>(i.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:a,empty:o}=n;if(!o||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const i=a.after();return i===void 0?!1:s.nodeAt(i)?e.commands.command(({tr:m})=>(m.setSelection(Oa.near(s.resolve(i))),!0)):e.commands.exitCode()}}},addInputRules(){return[Zme({find:ubt,type:this.type,getAttributes:e=>({language:e[1]})}),Zme({find:hbt,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new gd({key:new Cu("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"),a=s?JSON.parse(s):void 0,o=a==null?void 0:a.mode;if(!n||!o)return!1;const{tr:l,schema:i}=e.state,u=i.text(n.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(va.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),e.dispatch(l),!0}}})]}}),fbt=Mu.create({name:"doc",topNode:!0,content:"block+"});function pbt(e={}){return new gd({view(t){return new gbt(t,e)}})}class gbt{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(a=>{let o=l=>{this[a](l)};return t.dom.addEventListener(a,o),{name:a,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,a=this.editorView.dom,o=a.getBoundingClientRect(),l=o.width/a.offsetWidth,i=o.height/a.offsetHeight;if(n){let y=t.nodeBefore,v=t.nodeAfter;if(y||v){let b=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(b){let N=b.getBoundingClientRect(),k=y?N.bottom:N.top;y&&v&&(k=(k+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let M=this.width/2*i;s={left:N.left,right:N.right,top:k-M,bottom:k+M}}}}if(!s){let y=this.editorView.coordsAtPos(this.cursorPos),v=this.width/2*l;s={left:y.left-v,right:y.left+v,top:y.top,bottom:y.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.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 m,x;if(!u||u==document.body&&getComputedStyle(u).position=="static")m=-pageXOffset,x=-pageYOffset;else{let y=u.getBoundingClientRect(),v=y.width/u.offsetWidth,b=y.height/u.offsetHeight;m=y.left-u.scrollLeft*v,x=y.top-u.scrollTop*b}this.element.style.left=(s.left-m)/l+"px",this.element.style.top=(s.top-x)/i+"px",this.element.style.width=(s.right-s.left)/l+"px",this.element.style.height=(s.bottom-s.top)/i+"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),a=s&&s.type.spec.disableDropCursor,o=typeof a=="function"?a(this.editorView,n,t):a;if(n&&!o){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=qFe(this.editorView.state.doc,l,this.editorView.dragging.slice);i!=null&&(l=i)}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 xbt=ou.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[pbt(this.options)]}});class tc extends Oa{constructor(t){super(t,t)}map(t,n){let s=t.resolve(n.map(this.head));return tc.valid(s)?new tc(s):Oa.near(s)}content(){return Kn.empty}eq(t){return t instanceof tc&&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 tc(t.resolve(n.pos))}getBookmark(){return new f0e(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!ybt(t)||!vbt(t))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let a=n.contentMatchAt(t.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(t,n,s=!1){e:for(;;){if(!s&&tc.valid(t))return t;let a=t.pos,o=null;for(let l=t.depth;;l--){let i=t.node(l);if(n>0?t.indexAfter(l)0){o=i.child(n>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;a+=n;let u=t.doc.resolve(a);if(tc.valid(u))return u}for(;;){let l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!ua.isSelectable(o)){t=t.doc.resolve(a+o.nodeSize*n),s=!1;continue e}break}o=l,a+=n;let i=t.doc.resolve(a);if(tc.valid(i))return i}return null}}}tc.prototype.visible=!1;tc.findFrom=tc.findGapCursorFrom;Oa.jsonID("gapcursor",tc);class f0e{constructor(t){this.pos=t}map(t){return new f0e(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return tc.valid(n)?new tc(n):Oa.near(n)}}function o7e(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function ybt(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 a=s.child(n-1);;a=a.lastChild){if(a.childCount==0&&!a.inlineContent||o7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function vbt(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 a=s.child(n);;a=a.firstChild){if(a.childCount==0&&!a.inlineContent||o7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function _bt(){return new gd({props:{decorations:kbt,createSelectionBetween(e,t,n){return t.pos==n.pos&&tc.valid(n)?new tc(n):null},handleClick:wbt,handleKeyDown:bbt,handleDOMEvents:{beforeinput:jbt}}})}const bbt=Jye({ArrowLeft:fO("horiz",-1),ArrowRight:fO("horiz",1),ArrowUp:fO("vert",-1),ArrowDown:fO("vert",1)});function fO(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(s,a,o){let l=s.selection,i=t>0?l.$to:l.$from,u=l.empty;if(l instanceof va){if(!o.endOfTextblock(n)||i.depth==0)return!1;u=!1,i=s.doc.resolve(t>0?i.after():i.before())}let m=tc.findGapCursorFrom(i,t,u);return m?(a&&a(s.tr.setSelection(new tc(m))),!0):!1}}function wbt(e,t,n){if(!e||!e.editable)return!1;let s=e.state.doc.resolve(t);if(!tc.valid(s))return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&ua.isSelectable(e.state.doc.nodeAt(a.inside))?!1:(e.dispatch(e.state.tr.setSelection(new tc(s))),!0)}function jbt(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof tc))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 a=pn.empty;for(let l=s.length-1;l>=0;l--)a=pn.from(s[l].createAndFill(null,a));let o=e.state.tr.replace(n.pos,n.pos,new Kn(a,0,0));return o.setSelection(va.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function kbt(e){if(!(e.selection instanceof tc))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ec.create(e.doc,[Ku.widget(e.selection.head,t,{key:"gapcursor"})])}const Nbt=ou.create({name:"gapCursor",addProseMirrorPlugins(){return[_bt()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=yi(Ms(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),Sbt=Mu.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",Wl(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:a,storedMarks:o}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:i}=s.extensionManager,u=o||a.$to.parentOffset&&a.$from.marks();return t().insertContent({type:this.name}).command(({tr:m,dispatch:x})=>{if(x&&u&&l){const y=u.filter(v=>i.includes(v.type.name));m.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Cbt=Mu.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]}`,Wl(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=>Zme({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var xre=200,Ud=function(){};Ud.prototype.append=function(t){return t.length?(t=Ud.from(t),!this.length&&t||t.length=n?Ud.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};Ud.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Ud.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)};Ud.prototype.map=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var a=[];return this.forEach(function(o,l){return a.push(t(o,l))},n,s),a};Ud.from=function(t){return t instanceof Ud?t:t&&t.length?new l7e(t):Ud.empty};var l7e=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(a,o){return a==0&&o==this.length?this:new t(this.values.slice(a,o))},t.prototype.getInner=function(a){return this.values[a]},t.prototype.forEachInner=function(a,o,l,i){for(var u=o;u=l;u--)if(a(this.values[u],i+u)===!1)return!1},t.prototype.leafAppend=function(a){if(this.length+a.length<=xre)return new t(this.values.concat(a.flatten()))},t.prototype.leafPrepend=function(a){if(this.length+a.length<=xre)return new t(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Ud);Ud.empty=new l7e([]);var Mbt=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 si&&this.right.forEachInner(s,Math.max(a-i,0),Math.min(this.length,o)-i,l+i)===!1)return!1},t.prototype.forEachInvertedInner=function(s,a,o,l){var i=this.left.length;if(a>i&&this.right.forEachInvertedInner(s,a-i,Math.max(o,i)-i,l+i)===!1||o=o?this.right.slice(s-o,a-o):this.left.slice(s,o).append(this.right.slice(0,a-o))},t.prototype.leafAppend=function(s){var a=this.right.leafAppend(s);if(a)return new t(this.left,a)},t.prototype.leafPrepend=function(s){var a=this.left.leafPrepend(s);if(a)return new t(a,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}(Ud);const Tbt=500;class vp{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 a,o;n&&(a=this.remapping(s,this.items.length),o=a.maps.length);let l=t.tr,i,u,m=[],x=[];return this.items.forEach((y,v)=>{if(!y.step){a||(a=this.remapping(s,v+1),o=a.maps.length),o--,x.push(y);return}if(a){x.push(new xg(y.map));let b=y.step.map(a.slice(o)),N;b&&l.maybeStep(b).doc&&(N=l.mapping.maps[l.mapping.maps.length-1],m.push(new xg(N,void 0,void 0,m.length+x.length))),o--,N&&a.appendMap(N,o)}else l.maybeStep(y.step);if(y.selection)return i=a?y.selection.map(a.slice(o)):y.selection,u=new vp(this.items.slice(0,s).append(x.reverse().concat(m)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:i}}addTransform(t,n,s,a){let o=[],l=this.eventCount,i=this.items,u=!a&&i.length?i.get(i.length-1):null;for(let x=0;xEbt&&(i=Abt(i,m),l-=m),new vp(i.append(o),l)}remapping(t,n){let s=new BE;return this.items.forEach((a,o)=>{let l=a.mirrorOffset!=null&&o-a.mirrorOffset>=t?s.maps.length-a.mirrorOffset:void 0;s.appendMap(a.map,l)},t,n),s}addMaps(t){return this.eventCount==0?this:new vp(this.items.append(t.map(n=>new xg(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let s=[],a=Math.max(0,this.items.length-n),o=t.mapping,l=t.steps.length,i=this.eventCount;this.items.forEach(v=>{v.selection&&i--},a);let u=n;this.items.forEach(v=>{let b=o.getMirror(--u);if(b==null)return;l=Math.min(l,b);let N=o.maps[b];if(v.step){let k=t.steps[b].invert(t.docs[b]),M=v.selection&&v.selection.map(o.slice(u+1,b));M&&i++,s.push(new xg(N,k,M))}else s.push(new xg(N))},a);let m=[];for(let v=n;vTbt&&(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,a=[],o=0;return this.items.forEach((l,i)=>{if(i>=t)a.push(l),l.selection&&o++;else if(l.step){let u=l.step.map(n.slice(s)),m=u&&u.getMap();if(s--,m&&n.appendMap(m,s),u){let x=l.selection&&l.selection.map(n.slice(s));x&&o++;let y=new xg(m.invert(),u,x),v,b=a.length-1;(v=a.length&&a[b].merge(y))?a[b]=v:a.push(y)}}else l.map&&s--},this.items.length,0),new vp(Ud.from(a.reverse()),o)}}vp.empty=new vp(Ud.empty,0);function Abt(e,t){let n;return e.forEach((s,a)=>{if(s.selection&&t--==0)return n=a,!1}),e.slice(n)}class xg{constructor(t,n,s,a){this.map=t,this.step=n,this.selection=s,this.mirrorOffset=a}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new xg(n.getMap().invert(),n,this.selection)}}}class e1{constructor(t,n,s,a,o){this.done=t,this.undone=n,this.prevRanges=s,this.prevTime=a,this.prevComposition=o}}const Ebt=20;function Ibt(e,t,n,s){let a=n.getMeta(Zj),o;if(a)return a.historyState;n.getMeta(Obt)&&(e=new e1(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(l&&l.getMeta(Zj))return l.getMeta(Zj).redo?new e1(e.done.addTransform(n,void 0,s,Kee(t)),e.undone,c4e(n.mapping.maps),e.prevTime,e.prevComposition):new e1(e.done,e.undone.addTransform(n,void 0,s,Kee(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let i=n.getMeta("composition"),u=e.prevTime==0||!l&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-s.newGroupDelay||!Pbt(n,e.prevRanges)),m=l?fde(e.prevRanges,n.mapping):c4e(n.mapping.maps);return new e1(e.done.addTransform(n,u?t.selection.getBookmark():void 0,s,Kee(t)),vp.empty,m,n.time,i??e.prevComposition)}else return(o=n.getMeta("rebased"))?new e1(e.done.rebased(n,o),e.undone.rebased(n,o),fde(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new e1(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),fde(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Pbt(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((s,a)=>{for(let o=0;o=t[o]&&(n=!0)}),n}function c4e(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((s,a,o,l)=>t.push(o,l));return t}function fde(e,t){if(!e)return null;let n=[];for(let s=0;s{let a=Zj.getState(n);if(!a||(e?a.undone:a.done).eventCount==0)return!1;if(s){let o=Lbt(a,n,e);o&&s(t?o.scrollIntoView():o)}return!0}}const d7e=c7e(!1,!0),u7e=c7e(!0,!0),Rbt=ou.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>d7e(e,t),redo:()=>({state:e,dispatch:t})=>u7e(e,t)}},addProseMirrorPlugins(){return[Dbt(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()}}}),Fbt=Mu.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Wl(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!P_t(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$from:s,$to:a}=n,o=e();return s.parentOffset===0?o.insertContentAt({from:Math.max(s.pos-1,0),to:a.pos},{type:this.name}):t_t(n)?o.insertContentAt(a.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:i})=>{var u;if(i){const{$to:m}=l.selection,x=m.end();if(m.nodeAfter)m.nodeAfter.isTextblock?l.setSelection(va.create(l.doc,m.pos+1)):m.nodeAfter.isBlock?l.setSelection(ua.create(l.doc,m.pos)):l.setSelection(va.create(l.doc,m.pos));else{const y=(u=m.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();y&&(l.insert(x,y),l.setSelection(va.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[r7e({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),zbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Bbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,$bt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ubt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,qbt=tx.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",Wl(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[$C({find:zbt,type:this.type}),$C({find:$bt,type:this.type})]},addPasteRules(){return[gk({find:Bbt,type:this.type}),gk({find:Ubt,type:this.type})]}}),Vbt=Mu.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Wl(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)}}}),Hbt="listItem",u4e="textStyle",h4e=/^(\d+)\.\s$/,Wbt=Mu.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",Wl(this.options.HTMLAttributes,n),0]:["ol",Wl(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(Hbt,this.editor.getAttributes(u4e)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=GE({find:h4e,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=GE({find:h4e,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(u4e)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Gbt=Mu.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Kbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Zbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Ybt=tx.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",Wl(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[$C({find:Kbt,type:this.type})]},addPasteRules(){return[gk({find:Zbt,type:this.type})]}}),Xbt=Mu.create({name:"text",group:"inline"}),h7e=ou.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(abt.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(ebt.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(obt.configure(this.options.bulletList)),this.options.code!==!1&&e.push(dbt.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(mbt.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(fbt.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(xbt.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(Nbt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(Sbt.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(Cbt.configure(this.options.heading)),this.options.history!==!1&&e.push(Rbt.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(Fbt.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(qbt.configure(this.options.italic)),this.options.listItem!==!1&&e.push(Vbt.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(Wbt.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Gbt.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Ybt.configure(this.options.strike)),this.options.text!==!1&&e.push(Xbt.configure(this.options.text)),e}}),Qbt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Jbt="ελ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",Qme="numeric",Jme="ascii",efe="alpha",VA="asciinumeric",zT="alphanumeric",tfe="domain",m7e="emoji",e2t="scheme",t2t="slashscheme",gde="whitespace";function r2t(e,t){return e in t||(t[e]=[]),t[e]}function uj(e,t,n){t[Qme]&&(t[VA]=!0,t[zT]=!0),t[Jme]&&(t[VA]=!0,t[efe]=!0),t[VA]&&(t[zT]=!0),t[efe]&&(t[zT]=!0),t[zT]&&(t[tfe]=!0),t[m7e]&&(t[tfe]=!0);for(const s in t){const a=r2t(s,n);a.indexOf(e)<0&&a.push(e)}}function n2t(e,t){const n={};for(const s in t)t[s].indexOf(e)>=0&&(n[s]=!0);return n}function Ch(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Ch.groups={};Ch.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,a),Kl=(e,t,n,s,a)=>e.tr(t,n,s,a),m4e=(e,t,n,s,a)=>e.ts(t,n,s,a),Tn=(e,t,n,s,a)=>e.tt(t,n,s,a),$x="WORD",rfe="UWORD",f7e="ASCIINUMERICAL",p7e="ALPHANUMERICAL",KE="LOCALHOST",nfe="TLD",sfe="UTLD",Zee="SCHEME",HS="SLASH_SCHEME",p0e="NUM",afe="WS",g0e="NL",HA="OPENBRACE",WA="CLOSEBRACE",yre="OPENBRACKET",vre="CLOSEBRACKET",_re="OPENPAREN",bre="CLOSEPAREN",wre="OPENANGLEBRACKET",jre="CLOSEANGLEBRACKET",kre="FULLWIDTHLEFTPAREN",Nre="FULLWIDTHRIGHTPAREN",Sre="LEFTCORNERBRACKET",Cre="RIGHTCORNERBRACKET",Mre="LEFTWHITECORNERBRACKET",Tre="RIGHTWHITECORNERBRACKET",Are="FULLWIDTHLESSTHAN",Ere="FULLWIDTHGREATERTHAN",Ire="AMPERSAND",Pre="APOSTROPHE",Lre="ASTERISK",t1="AT",Ore="BACKSLASH",Dre="BACKTICK",Rre="CARET",d1="COLON",x0e="COMMA",Fre="DOLLAR",yg="DOT",zre="EQUALS",y0e="EXCLAMATION",Km="HYPHEN",GA="PERCENT",Bre="PIPE",$re="PLUS",Ure="POUND",KA="QUERY",v0e="QUOTE",g7e="FULLWIDTHMIDDLEDOT",_0e="SEMI",vg="SLASH",ZA="TILDE",qre="UNDERSCORE",x7e="EMOJI",Vre="SYM";var y7e=Object.freeze({__proto__:null,ALPHANUMERICAL:p7e,AMPERSAND:Ire,APOSTROPHE:Pre,ASCIINUMERICAL:f7e,ASTERISK:Lre,AT:t1,BACKSLASH:Ore,BACKTICK:Dre,CARET:Rre,CLOSEANGLEBRACKET:jre,CLOSEBRACE:WA,CLOSEBRACKET:vre,CLOSEPAREN:bre,COLON:d1,COMMA:x0e,DOLLAR:Fre,DOT:yg,EMOJI:x7e,EQUALS:zre,EXCLAMATION:y0e,FULLWIDTHGREATERTHAN:Ere,FULLWIDTHLEFTPAREN:kre,FULLWIDTHLESSTHAN:Are,FULLWIDTHMIDDLEDOT:g7e,FULLWIDTHRIGHTPAREN:Nre,HYPHEN:Km,LEFTCORNERBRACKET:Sre,LEFTWHITECORNERBRACKET:Mre,LOCALHOST:KE,NL:g0e,NUM:p0e,OPENANGLEBRACKET:wre,OPENBRACE:HA,OPENBRACKET:yre,OPENPAREN:_re,PERCENT:GA,PIPE:Bre,PLUS:$re,POUND:Ure,QUERY:KA,QUOTE:v0e,RIGHTCORNERBRACKET:Cre,RIGHTWHITECORNERBRACKET:Tre,SCHEME:Zee,SEMI:_0e,SLASH:vg,SLASH_SCHEME:HS,SYM:Vre,TILDE:ZA,TLD:nfe,UNDERSCORE:qre,UTLD:sfe,UWORD:rfe,WORD:$x,WS:afe});const Dx=/[a-z]/,mT=new RegExp("\\p{L}","u"),xde=new RegExp("\\p{Emoji}","u"),Rx=/\d/,yde=/\s/,f4e="\r",vde=` `,s2t="️",a2t="‍",_de="";let pO=null,gO=null;function i2t(e=[]){const t={};Ch.groups=t;const n=new Ch;pO==null&&(pO=p4e(Qbt)),gO==null&&(gO=p4e(Jbt)),Tn(n,"'",Pre),Tn(n,"{",HA),Tn(n,"}",WA),Tn(n,"[",yre),Tn(n,"]",vre),Tn(n,"(",_re),Tn(n,")",bre),Tn(n,"<",wre),Tn(n,">",jre),Tn(n,"(",kre),Tn(n,")",Nre),Tn(n,"「",Sre),Tn(n,"」",Cre),Tn(n,"『",Mre),Tn(n,"』",Tre),Tn(n,"<",Are),Tn(n,">",Ere),Tn(n,"&",Ire),Tn(n,"*",Lre),Tn(n,"@",t1),Tn(n,"`",Dre),Tn(n,"^",Rre),Tn(n,":",d1),Tn(n,",",x0e),Tn(n,"$",Fre),Tn(n,".",yg),Tn(n,"=",zre),Tn(n,"!",y0e),Tn(n,"-",Km),Tn(n,"%",GA),Tn(n,"|",Bre),Tn(n,"+",$re),Tn(n,"#",Ure),Tn(n,"?",KA),Tn(n,'"',v0e),Tn(n,"/",vg),Tn(n,";",_0e),Tn(n,"~",ZA),Tn(n,"_",qre),Tn(n,"\\",Ore),Tn(n,"・",g7e);const s=Kl(n,Rx,p0e,{[Qme]:!0});Kl(s,Rx,s);const a=Kl(s,Dx,f7e,{[VA]:!0}),o=Kl(s,mT,p7e,{[zT]:!0}),l=Kl(n,Dx,$x,{[Jme]:!0});Kl(l,Rx,a),Kl(l,Dx,l),Kl(a,Rx,a),Kl(a,Dx,a);const i=Kl(n,mT,rfe,{[efe]:!0});Kl(i,Dx),Kl(i,Rx,o),Kl(i,mT,i),Kl(o,Rx,o),Kl(o,Dx),Kl(o,mT,o);const u=Tn(n,vde,g0e,{[gde]:!0}),m=Tn(n,f4e,afe,{[gde]:!0}),x=Kl(n,yde,afe,{[gde]:!0});Tn(n,_de,x),Tn(m,vde,u),Tn(m,_de,x),Kl(m,yde,x),Tn(x,f4e),Tn(x,vde),Kl(x,yde,x),Tn(x,_de,x);const y=Kl(n,xde,x7e,{[m7e]:!0});Tn(y,"#"),Kl(y,xde,y),Tn(y,s2t,y);const v=Tn(y,a2t);Tn(v,"#"),Kl(v,xde,y);const b=[[Dx,l],[Rx,a]],N=[[Dx,null],[mT,i],[Rx,o]];for(let k=0;kk[0]>M[0]?1:-1);for(let k=0;k=0?T[tfe]=!0:Dx.test(M)?Rx.test(M)?T[VA]=!0:T[Jme]=!0:T[Qme]=!0,m4e(n,M,M,T)}return m4e(n,"localhost",KE,{ascii:!0}),n.jd=new Ch(Vre),{start:n,tokens:Object.assign({groups:t},y7e)}}function v7e(e,t){const n=o2t(t.replace(/[A-Z]/g,i=>i.toLowerCase())),s=n.length,a=[];let o=0,l=0;for(;l=0&&(y+=n[l].length,v++),m+=n[l].length,o+=n[l].length,l++;o-=y,l-=v,m-=y,a.push({t:x.t,v:t.slice(o-m,o),s:o-m,e:o})}return a}function o2t(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 B0(e,t,n,s,a){let o;const l=t.length;for(let i=0;i=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 ZE={defaultProtocol:"http",events:null,format:g4e,formatHref:g4e,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function b0e(e,t=null){let n=Object.assign({},ZE);e&&(n=Object.assign(n,e instanceof b0e?e.o:e));const s=n.ignoreTags,a=[];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=ZE.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),a=e.get("tagName",n,t),o=this.toFormattedString(e),l={},i=e.get("className",n,t),u=e.get("target",n,t),m=e.get("rel",n,t),x=e.getObj("attributes",n,t),y=e.getObj("events",n,t);return l.href=s,i&&(l.class=i),u&&(l.target=u),m&&(l.rel=m),x&&Object.assign(l,x),{tagName:a,attributes:l,content:o,eventListeners:y}}};function Cae(e,t){class n extends _7e{constructor(a,o){super(a,o),this.t=e}}for(const s in t)n.prototype[s]=t[s];return n.t=e,n}const x4e=Cae("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),y4e=Cae("text"),l2t=Cae("nl"),xO=Cae("url",{isLink:!0,toHref(e=ZE.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==KE&&e[1].t===d1}}),Vm=e=>new Ch(e);function c2t({groups:e}){const t=e.domain.concat([Ire,Lre,t1,Ore,Dre,Rre,Fre,zre,Km,p0e,GA,Bre,$re,Ure,vg,Vre,ZA,qre]),n=[Pre,d1,x0e,yg,y0e,GA,KA,v0e,_0e,wre,jre,HA,WA,vre,yre,_re,bre,kre,Nre,Sre,Cre,Mre,Tre,Are,Ere],s=[Ire,Pre,Lre,Ore,Dre,Rre,Fre,zre,Km,HA,WA,GA,Bre,$re,Ure,KA,vg,Vre,ZA,qre],a=Vm(),o=Tn(a,ZA);xi(o,s,o),xi(o,e.domain,o);const l=Vm(),i=Vm(),u=Vm();xi(a,e.domain,l),xi(a,e.scheme,i),xi(a,e.slashscheme,u),xi(l,s,o),xi(l,e.domain,l);const m=Tn(l,t1);Tn(o,t1,m),Tn(i,t1,m),Tn(u,t1,m);const x=Tn(o,yg);xi(x,s,o),xi(x,e.domain,o);const y=Vm();xi(m,e.domain,y),xi(y,e.domain,y);const v=Tn(y,yg);xi(v,e.domain,y);const b=Vm(x4e);xi(v,e.tld,b),xi(v,e.utld,b),Tn(m,KE,b);const N=Tn(y,Km);Tn(N,Km,N),xi(N,e.domain,y),xi(b,e.domain,y),Tn(b,yg,v),Tn(b,Km,N);const k=Tn(b,d1);xi(k,e.numeric,x4e);const M=Tn(l,Km),I=Tn(l,yg);Tn(M,Km,M),xi(M,e.domain,l),xi(I,s,o),xi(I,e.domain,l);const T=Vm(xO);xi(I,e.tld,T),xi(I,e.utld,T),xi(T,e.domain,l),xi(T,s,o),Tn(T,yg,I),Tn(T,Km,M),Tn(T,t1,m);const P=Tn(T,d1),F=Vm(xO);xi(P,e.numeric,F);const D=Vm(xO),U=Vm();xi(D,t,D),xi(D,n,U),xi(U,t,D),xi(U,n,U),Tn(T,vg,D),Tn(F,vg,D);const V=Tn(i,d1),W=Tn(u,d1),G=Tn(W,vg),ee=Tn(G,vg);xi(i,e.domain,l),Tn(i,yg,I),Tn(i,Km,M),xi(u,e.domain,l),Tn(u,yg,I),Tn(u,Km,M),xi(V,e.domain,D),Tn(V,vg,D),Tn(V,KA,D),xi(ee,e.domain,D),xi(ee,t,D),Tn(ee,vg,D);const ae=[[HA,WA],[yre,vre],[_re,bre],[wre,jre],[kre,Nre],[Sre,Cre],[Mre,Tre],[Are,Ere]];for(let oe=0;oe=0&&v++,a++,x++;if(v<0)a-=x,a0&&(o.push(bde(y4e,t,l)),l=[]),a-=v,x-=v;const b=y.t,N=n.slice(a-x,a);o.push(bde(b,t,N))}}return l.length>0&&o.push(bde(y4e,t,l)),o}function bde(e,t,n){const s=n[0].s,a=n[n.length-1].e,o=t.slice(s,a);return new e(o,n)}const u2t=typeof console<"u"&&console&&console.warn||(()=>{}),h2t="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",gl={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function m2t(){return Ch.groups={},gl.scanner=null,gl.parser=null,gl.tokenQueue=[],gl.pluginQueue=[],gl.customSchemes=[],gl.initialized=!1,gl}function v4e(e,t=!1){if(gl.initialized&&u2t(`linkifyjs: already initialized - will not register custom scheme "${e}" ${h2t}`),!/^[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`);gl.customSchemes.push([e,t])}function f2t(){gl.scanner=i2t(gl.customSchemes);for(let e=0;e{const a=t.some(m=>m.docChanged)&&!n.doc.eq(s.doc),o=t.some(m=>m.getMeta("preventAutolink"));if(!a||o)return;const{tr:l}=s,i=Wvt(n.doc,[...t]);if(Jvt(i).forEach(({newRange:m})=>{const x=Kvt(s.doc,m,b=>b.isTextblock);let y,v;if(x.length>1)y=x[0],v=s.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(x.length){const b=s.doc.textBetween(m.from,m.to," "," ");if(!g2t.test(b))return;y=x[0],v=s.doc.textBetween(y.pos,m.to,void 0," ")}if(y&&v){const b=v.split(p2t).filter(Boolean);if(b.length<=0)return!1;const N=b[b.length-1],k=y.pos+v.lastIndexOf(N);if(!N)return!1;const M=w0e(N).map(I=>I.toObject(e.defaultProtocol));if(!y2t(M))return!1;M.filter(I=>I.isLink).map(I=>({...I,from:k+I.start+1,to:k+I.end+1})).filter(I=>s.schema.marks.code?!s.doc.rangeHasMark(I.from,I.to,s.schema.marks.code):!0).filter(I=>e.validate(I.value)).filter(I=>e.shouldAutoLink(I.value)).forEach(I=>{d0e(I.from,I.to,s.doc).some(T=>T.mark.type===e.type)||l.addMark(I.from,I.to,e.type.create({href:I.href}))})}}),!!l.steps.length)return l}})}function _2t(e){return new gd({key:new Cu("handleClickLink"),props:{handleClick:(t,n,s)=>{var a,o;if(s.button!==0||!t.editable)return!1;let l=s.target;const i=[];for(;l.nodeName!=="DIV";)i.push(l),l=l.parentNode;if(!i.find(v=>v.nodeName==="A"))return!1;const u=t7e(t.state,e.type.name),m=s.target,x=(a=m==null?void 0:m.href)!==null&&a!==void 0?a:u.href,y=(o=m==null?void 0:m.target)!==null&&o!==void 0?o:u.target;return m&&x?(window.open(x,y),!0):!1}}})}function b2t(e){return new gd({key:new Cu("handlePasteLink"),props:{handlePaste:(t,n,s)=>{const{state:a}=t,{selection:o}=a,{empty:l}=o;if(l)return!1;let i="";s.content.forEach(m=>{i+=m.textContent});const u=b7e(i,{defaultProtocol:e.defaultProtocol}).find(m=>m.isLink&&m.value===i);return!i||!u?!1:e.editor.commands.setMark(e.type,{href:u.href})}}})}function M_(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(s=>{const a=typeof s=="string"?s:s.scheme;a&&n.push(a)}),!e||e.replace(x2t,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const w7e=tx.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"){v4e(e);return}v4e(e.scheme,e.optionalSlashes)})},onDestroy(){m2t()},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)=>!!M_(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=>!!M_(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=>!!M_(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Wl(this.options.HTMLAttributes,e),0]:["a",Wl(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!M_(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=>!!M_(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[gk({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:s}=this.options,a=b7e(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!M_(l,n),protocols:n,defaultProtocol:s}));a.length&&a.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(v2t({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:a=>!!M_(a,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(_2t({type:this.type})),this.options.linkOnPaste&&e.push(b2t({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),j7e=ou.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")}}}),w2t=e=>{if(!e.children.length)return;const t=e.querySelectorAll("span");t&&t.forEach(n=>{var s,a;const o=n.getAttribute("style"),l=(a=(s=n.parentElement)===null||s===void 0?void 0:s.closest("span"))===null||a===void 0?void 0:a.getAttribute("style");n.setAttribute("style",`${l};${o}`)})},k7e=tx.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&w2t(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",Wl(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(a=>a.type===this.type).some(a=>Object.values(a.attrs).some(o=>!!o))||e.removeMark(s,s+n.nodeSize,this.type)}),!0}}}}),j2t=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,k2t=Mu.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",Wl(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[r7e({find:j2t,type:this.type,getAttributes:e=>{const[,,t,n,s]=e;return{src:n,alt:t,title:s}}})]}});let ife,ofe;if(typeof WeakMap<"u"){let e=new WeakMap;ife=t=>e.get(t),ofe=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;ife=s=>{for(let a=0;a(n==10&&(n=0),e[n++]=s,e[n++]=a)}var nc=class{constructor(e,t,n,s){this.width=e,this.height=t,this.map=n,this.problems=s}findCell(e){for(let t=0;t=n){(o||(o=[])).push({type:"overlong_rowspan",pos:x,n:I-P});break}const F=a+P*t;for(let D=0;Ds&&(o+=m.attrs.colspan)}}for(let l=0;l1&&(n=!0)}t==-1?t=o:t!=o&&(t=Math.max(t,o))}return t}function C2t(e,t,n){e.problems||(e.problems=[]);const s={};for(let a=0;a0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function T2t(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function Vp(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Mae(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=L3(t.$head)||A2t(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function A2t(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const s=t.type.spec.tableRole;if(s=="cell"||s=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const s=t.type.spec.tableRole;if(s=="cell"||s=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function lfe(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function E2t(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function k0e(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function N7e(e,t,n){const s=e.node(-1),a=nc.get(s),o=e.start(-1),l=a.nextCell(e.pos-o,t,n);return l==null?null:e.node(0).resolve(o+l)}function xk(e,t,n=1){const s={...e,colspan:e.colspan-n};return s.colwidth&&(s.colwidth=s.colwidth.slice(),s.colwidth.splice(t,n),s.colwidth.some(a=>a>0)||(s.colwidth=null)),s}function S7e(e,t,n=1){const s={...e,colspan:e.colspan+n};if(s.colwidth){s.colwidth=s.colwidth.slice();for(let a=0;ax!=n.pos-o);u.unshift(n.pos-o);const m=u.map(x=>{const y=s.nodeAt(x);if(!y)throw new RangeError(`No cell with offset ${x} found`);const v=o+x+1;return new KFe(i.resolve(v),i.resolve(v+y.content.size))});super(m[0].$from,m[0].$to,m),this.$anchorCell=t,this.$headCell=n}map(t,n){const s=t.resolve(n.map(this.$anchorCell.pos)),a=t.resolve(n.map(this.$headCell.pos));if(lfe(s)&&lfe(a)&&k0e(s,a)){const o=this.$anchorCell.node(-1)!=s.node(-1);return o&&this.isRowSelection()?Ux.rowSelection(s,a):o&&this.isColSelection()?Ux.colSelection(s,a):new Ux(s,a)}return va.between(s,a)}content(){const t=this.$anchorCell.node(-1),n=nc.get(t),s=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s),o={},l=[];for(let u=a.top;u0||M>0){let I=N.attrs;if(k>0&&(I=xk(I,0,k)),M>0&&(I=xk(I,I.colspan-M,M)),b.lefta.bottom){const I={...N.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const s=t+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(s,a)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const s=t.node(-1),a=nc.get(s),o=t.start(-1),l=a.findCell(t.pos-o),i=a.findCell(n.pos-o),u=t.node(0);return l.top<=i.top?(l.top>0&&(t=u.resolve(o+a.map[l.left])),i.bottom0&&(n=u.resolve(o+a.map[i.left])),l.bottom0)return!1;const l=a+this.$anchorCell.nodeAfter.attrs.colspan,i=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,i)==n.width}eq(t){return t instanceof Ux&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const s=t.node(-1),a=nc.get(s),o=t.start(-1),l=a.findCell(t.pos-o),i=a.findCell(n.pos-o),u=t.node(0);return l.left<=i.left?(l.left>0&&(t=u.resolve(o+a.map[l.top*a.width])),i.right0&&(n=u.resolve(o+a.map[i.top*a.width])),l.right{t.push(Ku.node(s,s+n.nodeSize,{class:"selectedCell"}))}),ec.create(e.doc,t)}function O2t({$from:e,$to:t}){if(e.pos==t.pos||e.pos=0&&!(e.after(a+1)=0&&!(t.before(o+1)>t.start(o));o--,s--);return n==s&&/row|table/.test(e.node(a).type.spec.tableRole)}function D2t({$from:e,$to:t}){let n,s;for(let a=e.depth;a>0;a--){const o=e.node(a);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let a=t.depth;a>0;a--){const o=t.node(a);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){s=o;break}}return n!==s&&t.parentOffset===0}function R2t(e,t,n){const s=(t||e).selection,a=(t||e).doc;let o,l;if(s instanceof ua&&(l=s.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")o=ll.create(a,s.from);else if(l=="row"){const i=a.resolve(s.from+1);o=ll.rowSelection(i,i)}else if(!n){const i=nc.get(s.node),u=s.from+1,m=u+i.map[i.width*i.height-1];o=ll.create(a,u+1,m)}}else s instanceof va&&O2t(s)?o=va.create(a,s.from):s instanceof va&&D2t(s)&&(o=va.create(a,s.$from.start(),s.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}const F2t=new Cu("fix-tables");function M7e(e,t,n,s){const a=e.childCount,o=t.childCount;e:for(let l=0,i=0;l{a.type.spec.tableRole=="table"&&(n=z2t(e,a,o,n))};return t?t.doc!=e.doc&&M7e(t.doc,e.doc,0,s):e.doc.descendants(s),n}function z2t(e,t,n,s){const a=nc.get(t);if(!a.problems)return s;s||(s=e.tr);const o=[];for(let u=0;u0){let b="cell";x.firstChild&&(b=x.firstChild.type.spec.tableRole);const N=[];for(let M=0;M0?-1:0;I2t(t,s,a+o)&&(o=a==0||a==t.width?null:0);for(let l=0;l0&&a0&&t.map[i-1]==u||a0?-1:0;V2t(t,s,a+i)&&(i=a==0||a==t.height?null:0);for(let m=0,x=t.width*a;m0&&a0&&y==t.map[x-t.width]){const v=n.nodeAt(y).attrs;e.setNodeMarkup(e.mapping.slice(i).map(y+s),null,{...v,rowspan:v.rowspan-1}),m+=v.colspan-1}else if(a0&&n[o]==n[o-1]||s.right0&&n[a]==n[a-e]||s.bottom0){const x=u+1+m.content.size,y=_4e(m)?u+1:x;o.replaceWith(y+s.tableStart,x+s.tableStart,i)}o.setSelection(new ll(o.doc.resolve(u+s.tableStart))),t(o)}return!0}function w4e(e,t){const n=ku(e.schema);return Y2t(({node:s})=>n[s.type.spec.tableRole])(e,t)}function Y2t(e){return(t,n)=>{const s=t.selection;let a,o;if(s instanceof ll){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;a=s.$anchorCell.nodeAfter,o=s.$anchorCell.pos}else{var l;if(a=T2t(s.$from),!a)return!1;o=(l=L3(s.$from))===null||l===void 0?void 0:l.pos}if(a==null||o==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let i=a.attrs;const u=[],m=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const x=lx(t),y=t.tr;for(let b=0;b{l.attrs[e]!==t&&o.setNodeMarkup(i,null,{...l.attrs,[e]:t})}):o.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[e]:t}),s(o)}return!0}}function Q2t(e){return function(t,n){if(!Vp(t))return!1;if(n){const s=ku(t.schema),a=lx(t),o=t.tr,l=a.map.cellsInRect(e=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:e=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),i=l.map(u=>a.table.nodeAt(u));for(let u=0;u{const b=v+o.tableStart,N=l.doc.nodeAt(b);N&&l.setNodeMarkup(b,y,N.attrs)}),s(l)}return!0}}YE("row",{useDeprecatedLogic:!0});YE("column",{useDeprecatedLogic:!0});const J2t=YE("cell",{useDeprecatedLogic:!0});function ewt(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let s=e.index(-1)-1,a=e.before();s>=0;s--){const o=e.node(-1).child(s),l=o.lastChild;if(l)return a-1-l.nodeSize;a-=o.nodeSize}}else{if(e.index()0;s--)if(n.node(s).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(s),n.after(s)).scrollIntoView()),!0;return!1}function yO(e,t){const n=e.selection;if(!(n instanceof ll))return!1;if(t){const s=e.tr,a=ku(e.schema).cell.createAndFill().content;n.forEachCell((o,l)=>{o.content.eq(a)||s.replace(s.mapping.map(l+1),s.mapping.map(l+o.nodeSize-1),new Kn(a,0,0))}),s.docChanged&&t(s)}return!0}function rwt(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:s}=e;for(;t.childCount==1&&(n>0&&s>0||t.child(0).type.spec.tableRole=="table");)n--,s--,t=t.child(0).content;const a=t.child(0),o=a.type.spec.tableRole,l=a.type.schema,i=[];if(o=="row")for(let u=0;u=0;l--){const{rowspan:i,colspan:u}=o.child(l).attrs;for(let m=a;m=t.length&&t.push(pn.empty),n[a]s&&(v=v.type.createChecked(xk(v.attrs,v.attrs.colspan,x+v.attrs.colspan-s),v.content)),m.push(v),x+=v.attrs.colspan;for(let b=1;ba&&(y=y.type.create({...y.attrs,rowspan:Math.max(1,a-y.attrs.rowspan)},y.content)),u.push(y)}o.push(pn.from(u))}n=o,t=a}return{width:e,height:t,rows:n}}function awt(e,t,n,s,a,o,l){const i=e.doc.type.schema,u=ku(i);let m,x;if(a>t.width)for(let y=0,v=0;yt.height){const y=[];for(let N=0,k=(t.height-1)*t.width;N=t.width?!1:n.nodeAt(t.map[k+N]).type==u.header_cell;y.push(M?x||(x=u.header_cell.createAndFill()):m||(m=u.cell.createAndFill()))}const v=u.row.create(null,pn.from(y)),b=[];for(let N=t.height;N{if(!a)return!1;const o=n.selection;if(o instanceof ll)return Yee(n,s,Oa.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;const l=I7e(a,e,t);if(l==null)return!1;if(e=="horiz")return Yee(n,s,Oa.near(n.doc.resolve(o.head+t),t));{const i=n.doc.resolve(l),u=N7e(i,e,t);let m;return u?m=Oa.near(u,1):t<0?m=Oa.near(n.doc.resolve(i.before(-1)),-1):m=Oa.near(n.doc.resolve(i.after(-1)),1),Yee(n,s,m)}}}function _O(e,t){return(n,s,a)=>{if(!a)return!1;const o=n.selection;let l;if(o instanceof ll)l=o;else{const u=I7e(a,e,t);if(u==null)return!1;l=new ll(n.doc.resolve(u))}const i=N7e(l.$headCell,e,t);return i?Yee(n,s,new ll(l.$anchorCell,i)):!1}}function owt(e,t){const n=e.state.doc,s=L3(n.resolve(t));return s?(e.dispatch(e.state.tr.setSelection(new ll(s))),!0):!1}function lwt(e,t,n){if(!Vp(e.state))return!1;let s=rwt(n);const a=e.state.selection;if(a instanceof ll){s||(s={width:1,height:1,rows:[pn.from(cfe(ku(e.state.schema).cell,n))]});const o=a.$anchorCell.node(-1),l=a.$anchorCell.start(-1),i=nc.get(o).rectBetween(a.$anchorCell.pos-l,a.$headCell.pos-l);return s=swt(s,i.right-i.left,i.bottom-i.top),C4e(e.state,e.dispatch,l,i,s),!0}else if(s){const o=Mae(e.state),l=o.start(-1);return C4e(e.state,e.dispatch,l,nc.get(o.node(-1)).findCell(o.pos-l),s),!0}else return!1}function cwt(e,t){var n;if(t.ctrlKey||t.metaKey)return;const s=M4e(e,t.target);let a;if(t.shiftKey&&e.state.selection instanceof ll)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&s&&(a=L3(e.state.selection.$anchor))!=null&&((n=wde(e,t))===null||n===void 0?void 0:n.pos)!=a.pos)o(a,t),t.preventDefault();else if(!s)return;function o(u,m){let x=wde(e,m);const y=u1.getState(e.state)==null;if(!x||!k0e(u,x))if(y)x=u;else return;const v=new ll(u,x);if(y||!e.state.selection.eq(v)){const b=e.state.tr.setSelection(v);y&&b.setMeta(u1,u.pos),e.dispatch(b)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",i),u1.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(u1,-1))}function i(u){const m=u,x=u1.getState(e.state);let y;if(x!=null)y=e.state.doc.resolve(x);else if(M4e(e,m.target)!=s&&(y=wde(e,t),!y))return l();y&&o(y,m)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",i)}function I7e(e,t,n){if(!(e.state.selection instanceof va))return null;const{$head:s}=e.state.selection;for(let a=s.depth-1;a>=0;a--){const o=s.node(a);if((n<0?s.index(a):s.indexAfter(a))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=s.before(a),i=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(i)?l:null}}return null}function M4e(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function wde(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;const s=n.inside>=0?n.inside:n.pos;return L3(e.state.doc.resolve(s))}var dwt=class{constructor(t,n){this.node=t,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),dfe(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,dfe(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function dfe(e,t,n,s,a,o){let l=0,i=!0,u=t.firstChild;const m=e.firstChild;if(m){for(let y=0,v=0;ynew s(y,n,v)),new hwt(-1,!1)},apply(l,i){return i.apply(l)}},props:{attributes:l=>{const i=cm.getState(l);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,i)=>{mwt(l,i,e,a)},mouseleave:l=>{fwt(l)},mousedown:(l,i)=>{pwt(l,i,t,n)}},decorations:l=>{const i=cm.getState(l);if(i&&i.activeHandle>-1)return _wt(l,i.activeHandle)},nodeViews:{}}});return o}var hwt=class Xee{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,s=t.getMeta(cm);if(s&&s.setHandle!=null)return new Xee(s.setHandle,!1);if(s&&s.setDragging!==void 0)return new Xee(n.activeHandle,s.setDragging);if(n.activeHandle>-1&&t.docChanged){let a=t.mapping.map(n.activeHandle,-1);return lfe(t.doc.resolve(a))||(a=-1),new Xee(a,n.dragging)}return n}};function mwt(e,t,n,s){if(!e.editable)return;const a=cm.getState(e.state);if(a&&!a.dragging){const o=xwt(t.target);let l=-1;if(o){const{left:i,right:u}=o.getBoundingClientRect();t.clientX-i<=n?l=T4e(e,t,"left",n):u-t.clientX<=n&&(l=T4e(e,t,"right",n))}if(l!=a.activeHandle){if(!s&&l!==-1){const i=e.state.doc.resolve(l),u=i.node(-1),m=nc.get(u),x=i.start(-1);if(m.colCount(i.pos-x)+i.nodeAfter.attrs.colspan-1==m.width-1)return}P7e(e,l)}}}function fwt(e){if(!e.editable)return;const t=cm.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&P7e(e,-1)}function pwt(e,t,n,s){var a;if(!e.editable)return!1;const o=(a=e.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,l=cm.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const i=e.state.doc.nodeAt(l.activeHandle),u=gwt(e,l.activeHandle,i.attrs);e.dispatch(e.state.tr.setMeta(cm,{setDragging:{startX:t.clientX,startWidth:u}}));function m(y){o.removeEventListener("mouseup",m),o.removeEventListener("mousemove",x);const v=cm.getState(e.state);v!=null&&v.dragging&&(ywt(e,v.activeHandle,A4e(v.dragging,y,n)),e.dispatch(e.state.tr.setMeta(cm,{setDragging:null})))}function x(y){if(!y.which)return m(y);const v=cm.getState(e.state);if(v&&v.dragging){const b=A4e(v.dragging,y,n);E4e(e,v.activeHandle,b,s)}}return E4e(e,l.activeHandle,u,s),o.addEventListener("mouseup",m),o.addEventListener("mousemove",x),t.preventDefault(),!0}function gwt(e,t,{colspan:n,colwidth:s}){const a=s&&s[s.length-1];if(a)return a;const o=e.domAtPos(t);let l=o.node.childNodes[o.offset].offsetWidth,i=n;if(s)for(let u=0;u{const s=e.nodes[n];s.spec.tableRole&&(t[s.spec.tableRole]=s)}),e.cached.tableNodeTypes=t,t}function Nwt(e,t,n,s,a){const o=kwt(e),l=[],i=[];for(let m=0;m{const{selection:t}=e.state;if(!Swt(t))return!1;let n=0;const s=e7e(t.ranges[0].$from,o=>o.type.name==="table");return s==null||s.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},Cwt=Mu.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:wwt,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:s,tableMinWidth:a}=jwt(e,this.options.cellMinWidth),o=["table",Wl(this.options.HTMLAttributes,t,{style:s?`width: ${s}`:`min-width: ${a}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:s,dispatch:a,editor:o})=>{const l=Nwt(o.schema,e,t,n);if(a){const i=s.selection.from+1;s.replaceSelectionWith(l).scrollIntoView().setSelection(va.near(s.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>B2t(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>$2t(e,t),deleteColumn:()=>({state:e,dispatch:t})=>q2t(e,t),addRowBefore:()=>({state:e,dispatch:t})=>H2t(e,t),addRowAfter:()=>({state:e,dispatch:t})=>W2t(e,t),deleteRow:()=>({state:e,dispatch:t})=>K2t(e,t),deleteTable:()=>({state:e,dispatch:t})=>twt(e,t),mergeCells:()=>({state:e,dispatch:t})=>b4e(e,t),splitCell:()=>({state:e,dispatch:t})=>w4e(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>YE("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>YE("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>J2t(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>b4e(e,t)?!0:w4e(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:s})=>X2t(e,t)(n,s),goToNextCell:()=>({state:e,dispatch:t})=>k4e(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>k4e(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&T7e(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const s=ll.create(t.doc,e.anchorCell,e.headCell);t.setSelection(s)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:bO,"Mod-Backspace":bO,Delete:bO,"Mod-Delete":bO}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[uwt({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],bwt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:yi(Ms(e,"tableRole",t))}}}),Mwt=Mu.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Wl(this.options.HTMLAttributes,e),0]}}),Twt=Mu.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(s=>parseInt(s,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",Wl(this.options.HTMLAttributes,e),0]}}),Awt=Mu.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(s=>parseInt(s,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",Wl(this.options.HTMLAttributes,e),0]}});function Hp({content:e,onChange:t,placeholder:n="Enter content...",minHeight:s="150px",compact:a=!1}){const[o,l]=A.useState(!1),[i,u]=A.useState(""),[m,x]=A.useState(!0),y=i7e({extensions:[h7e,w7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),j7e.configure({types:["heading","paragraph"]}),k7e,k2t.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),width:{default:null},height:{default:null},style:{default:null}}}}).configure({inline:!0,allowBase64:!0}),Cwt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null},width:{default:null},cellpadding:{default:null},cellspacing:{default:null},border:{default:null}}}}).configure({resizable:!1}),Mwt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null}}}}),Twt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1},valign:{default:null}}}}),Awt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1}}}})],content:e,onUpdate:({editor:k})=>{t(k.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n},handlePaste:(k,M)=>{var T;const I=(T=M.clipboardData)==null?void 0:T.items;if(!I)return!1;for(const P of Array.from(I))if(P.type.startsWith("image/")){M.preventDefault();const F=P.getAsFile();if(!F)continue;const D=new FileReader;return D.onload=U=>{var W;const V=(W=U.target)==null?void 0:W.result;k.dispatch(k.state.tr.replaceSelectionWith(k.state.schema.nodes.image.create({src:V})))},D.readAsDataURL(F),!0}return!1}}});A.useEffect(()=>{y&&e!==y.getHTML()&&y.commands.setContent(e)},[e,y]);const v=()=>{if(!y)return;const k=y.getAttributes("link").href||"",M=y.getAttributes("link").target;u(k),x(M==="_blank"),l(!0)},b=()=>{y&&(i===""?y.chain().focus().extendMarkRange("link").unsetLink().run():y.chain().focus().extendMarkRange("link").setLink({href:i,target:m?"_blank":null,rel:m?"noopener noreferrer nofollow":null}).run(),l(!1),u(""))},N=()=>{y&&y.chain().focus().extendMarkRange("link").unsetLink().run()};return y?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(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:1}).run(),className:y.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(oA,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:2}).run(),className:y.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(lA,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBold().run(),className:y.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(b4,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleItalic().run(),className:y.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(S4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleBulletList().run(),className:y.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(mf,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleOrderedList().run(),className:y.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(T4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("left").run(),className:y.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(v4,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("center").run(),className:y.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(y4,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("right").run(),className:y.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(_4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:v,className:y.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(Oo,{className:"h-4 w-4"})}),y.isActive("link")&&r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:N,title:"Remove Link",children:r.jsx(Oo,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().undo().run(),disabled:!y.can().undo(),title:"Undo",children:r.jsx(R4,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo(),title:"Redo",children:r.jsx(L4,{className:"h-4 w-4"})})]}),r.jsx(s7e,{editor:y,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror_img]:max-w-none [&_.ProseMirror_table]:border-none [&_.ProseMirror_table]:border-collapse [&_.ProseMirror_td]:border-none [&_.ProseMirror_td]:p-0 [&_.ProseMirror_td]:align-top [&_.ProseMirror_th]:border-none [&_.ProseMirror_th]:p-0 [&_.ProseMirror_tr]:border-none",style:{minHeight:s}})]}),r.jsx(Rr,{open:o,onOpenChange:l,children:r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsx($r,{children:r.jsx(Br,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"link-url",children:"URL"}),r.jsx(lt,{id:"link-url",value:i,onChange:k=>u(k.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(As,{id:"link-new-tab",checked:m,onCheckedChange:x}),r.jsx(ze,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(Q,{type:"button",onClick:b,children:i?"Apply Link":"Remove Link"})]})]})})]}):null}var Ewt=Object.defineProperty,Iwt=(e,t,n)=>t in e?Ewt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nl=(e,t,n)=>Iwt(e,typeof t!="symbol"?t+"":t,n);const Hre={x:0,y:0,width:0,height:0,unit:"px"},IS=(e,t,n)=>Math.min(Math.max(e,t),n),Pwt=(...e)=>e.filter(t=>t&&typeof t=="string").join(" "),L4e=(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 Lwt(e,t,n,s){const a=_g(e,n,s);return e.width&&(a.height=a.width/t),e.height&&(a.width=a.height*t),a.y+a.height>s&&(a.height=s-a.y,a.width=a.height*t),a.x+a.width>n&&(a.width=n-a.x,a.height=a.width/t),e.unit==="%"?r1(a,n,s):a}function Owt(e,t,n){const s=_g(e,t,n);return s.x=(t-s.width)/2,s.y=(n-s.height)/2,e.unit==="%"?r1(s,t,n):s}function r1(e,t,n){return e.unit==="%"?{...Hre,...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 _g(e,t,n){return e.unit?e.unit==="px"?{...Hre,...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}:{...Hre,...e,unit:"px"}}function O4e(e,t,n,s,a,o=0,l=0,i=s,u=a){const m={...e};let x=Math.min(o,s),y=Math.min(l,a),v=Math.min(i,s),b=Math.min(u,a);t&&(t>1?(x=l?l*t:x,y=x/t,v=i*t):(y=o?o/t:y,x=y*t,b=u/t)),m.y<0&&(m.height=Math.max(m.height+m.y,y),m.y=0),m.x<0&&(m.width=Math.max(m.width+m.x,x),m.x=0);const N=s-(m.x+m.width);N<0&&(m.x=Math.min(m.x,s-x),m.width+=N);const k=a-(m.y+m.height);if(k<0&&(m.y=Math.min(m.y,a-y),m.height+=k),m.widthv&&((n==="sw"||n=="nw")&&(m.x-=v-m.width),m.width=v),m.height>b&&((n==="nw"||n=="ne")&&(m.y-=b-m.height),m.height=b),t){const M=m.width/m.height;if(Mt){const I=Math.max(m.height*t,x);(n==="sw"||n=="nw")&&(m.x-=I-m.width),m.width=I}}return m}function Dwt(e,t,n,s){const a={...e};return t==="ArrowLeft"?s==="nw"?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):s==="w"?(a.x-=n,a.width+=n):s==="sw"?(a.x-=n,a.width+=n,a.height+=n):s==="ne"?(a.y+=n,a.width-=n,a.height-=n):s==="e"?a.width-=n:s==="se"&&(a.width-=n,a.height-=n):t==="ArrowRight"&&(s==="nw"?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):s==="w"?(a.x+=n,a.width-=n):s==="sw"?(a.x+=n,a.width-=n,a.height-=n):s==="ne"?(a.y-=n,a.width+=n,a.height+=n):s==="e"?a.width+=n:s==="se"&&(a.width+=n,a.height+=n)),t==="ArrowUp"?s==="nw"?(a.x-=n,a.y-=n,a.width+=n,a.height+=n):s==="n"?(a.y-=n,a.height+=n):s==="ne"?(a.y-=n,a.width+=n,a.height+=n):s==="sw"?(a.x+=n,a.width-=n,a.height-=n):s==="s"?a.height-=n:s==="se"&&(a.width-=n,a.height-=n):t==="ArrowDown"&&(s==="nw"?(a.x+=n,a.y+=n,a.width-=n,a.height-=n):s==="n"?(a.y+=n,a.height-=n):s==="ne"?(a.y+=n,a.width-=n,a.height-=n):s==="sw"?(a.x-=n,a.width+=n,a.height+=n):s==="s"?a.height+=n:s==="se"&&(a.width+=n,a.height+=n)),a}const PS={capture:!0,passive:!1};let Rwt=0;const V0=class ap extends A.PureComponent{constructor(){super(...arguments),Nl(this,"docMoveBound",!1),Nl(this,"mouseDownOnCrop",!1),Nl(this,"dragStarted",!1),Nl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),Nl(this,"componentRef",A.createRef()),Nl(this,"mediaRef",A.createRef()),Nl(this,"resizeObserver"),Nl(this,"initChangeCalled",!1),Nl(this,"instanceId",`rc-${Rwt++}`),Nl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),Nl(this,"onCropPointerDown",t=>{const{crop:n,disabled:s}=this.props,a=this.getBox();if(!n)return;const o=_g(n,a.width,a.height);if(s)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=t.target.dataset.ord,i=!!l;let u=t.clientX,m=t.clientY,x=o.x,y=o.y;if(l){const v=t.clientX-a.x,b=t.clientY-a.y;let N=0,k=0;l==="ne"||l=="e"?(N=v-(o.x+o.width),k=b-o.y,x=o.x,y=o.y+o.height):l==="se"||l==="s"?(N=v-(o.x+o.width),k=b-(o.y+o.height),x=o.x,y=o.y):l==="sw"||l=="w"?(N=v-o.x,k=b-(o.y+o.height),x=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(N=v-o.x,k=b-o.y,x=o.x+o.width,y=o.y+o.height),u=x+a.x+N,m=y+a.y+k}this.evData={startClientX:u,startClientY:m,startCropX:x,startCropY:y,clientX:t.clientX,clientY:t.clientY,isResize:i,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),Nl(this,"onComponentPointerDown",t=>{const{crop:n,disabled:s,locked:a,keepSelection:o,onChange:l}=this.props,i=this.getBox();if(s||a||o&&n)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const u=t.clientX-i.x,m=t.clientY-i.y,x={unit:"px",x:u,y:m,width:0,height:0};this.evData={startClientX:t.clientX,startClientY:t.clientY,startCropX:u,startCropY:m,clientX:t.clientX,clientY:t.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(_g(x,i.width,i.height),r1(x,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),Nl(this,"onDocPointerMove",t=>{const{crop:n,disabled:s,onChange:a,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:i}=this;i.clientX=t.clientX,i.clientY=t.clientY;let u;i.isResize?u=this.resizeCrop():u=this.dragCrop(),L4e(n,u)||a(_g(u,l.width,l.height),r1(u,l.width,l.height))}),Nl(this,"onComponentKeyDown",t=>{const{crop:n,disabled:s,onChange:a,onComplete:o}=this.props;if(s)return;const l=t.key;let i=!1;if(!n)return;const u=this.getBox(),m=this.makePixelCrop(u),x=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?ap.nudgeStepLarge:t.shiftKey?ap.nudgeStepMedium:ap.nudgeStep;if(l==="ArrowLeft"?(m.x-=x,i=!0):l==="ArrowRight"?(m.x+=x,i=!0):l==="ArrowUp"?(m.y-=x,i=!0):l==="ArrowDown"&&(m.y+=x,i=!0),i){t.cancelable&&t.preventDefault(),m.x=IS(m.x,0,u.width-m.width),m.y=IS(m.y,0,u.height-m.height);const y=_g(m,u.width,u.height),v=r1(m,u.width,u.height);a(y,v),o&&o(y,v)}}),Nl(this,"onHandlerKeyDown",(t,n)=>{const{aspect:s=0,crop:a,disabled:o,minWidth:l=0,minHeight:i=0,maxWidth:u,maxHeight:m,onChange:x,onComplete:y}=this.props,v=this.getBox();if(o||!a)return;if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")t.stopPropagation(),t.preventDefault();else return;const b=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?ap.nudgeStepLarge:t.shiftKey?ap.nudgeStepMedium:ap.nudgeStep,N=_g(a,v.width,v.height),k=Dwt(N,t.key,b,n),M=O4e(k,s,n,v.width,v.height,l,i,u,m);if(!L4e(a,M)){const I=r1(M,v.width,v.height);x(M,I),y&&y(M,I)}}),Nl(this,"onDocPointerDone",t=>{const{crop:n,disabled:s,onComplete:a,onDragEnd:o}=this.props,l=this.getBox();this.unbindDocMove(),!(s||!n)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,o&&o(t),a&&a(_g(n,l.width,l.height),r1(n,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),Nl(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:a,height:o}=t.getBoundingClientRect();return{x:n,y:s,width:a,height:o}}componentDidUpdate(t){const{crop:n,onComplete:s}=this.props;if(s&&!t.crop&&n){const{width:a,height:o}=this.getBox();a&&o&&s(_g(n,a,o),r1(n,a,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,PS),this.document.addEventListener("pointerup",this.onDocPointerDone,PS),this.document.addEventListener("pointercancel",this.onDocPointerDone,PS),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,PS),this.document.removeEventListener("pointerup",this.onDocPointerDone,PS),this.document.removeEventListener("pointercancel",this.onDocPointerDone,PS),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),a=t.clientX-t.startClientX,o=t.clientY-t.startClientY;return s.x=IS(t.startCropX+a,0,n.width-s.width),s.y=IS(t.startCropY+o,0,n.height-s.height),s}getPointRegion(t,n,s,a){const{evData:o}=this,l=o.clientX-t.x,i=o.clientY-t.y;let u;a&&n?u=n==="nw"||n==="n"||n==="ne":u=i1?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:a}=this.props,o=this.getBox(),[l,i]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let u=this.makePixelCrop(o);const m=this.getPointRegion(o,t.ord,l,i),x=t.ord||m;let y=t.clientX-t.startClientX,v=t.clientY-t.startClientY;(l&&x==="nw"||x==="w"||x==="sw")&&(y=Math.min(y,-l)),(i&&x==="nw"||x==="n"||x==="ne")&&(v=Math.min(v,-i));const b={unit:"px",x:0,y:0,width:0,height:0};m==="ne"?(b.x=t.startCropX,b.width=y,n?(b.height=b.width/n,b.y=t.startCropY-b.height):(b.height=Math.abs(v),b.y=t.startCropY-b.height)):m==="se"?(b.x=t.startCropX,b.y=t.startCropY,b.width=y,n?b.height=b.width/n:b.height=v):m==="sw"?(b.x=t.startCropX+y,b.y=t.startCropY,b.width=Math.abs(y),n?b.height=b.width/n:b.height=v):m==="nw"&&(b.x=t.startCropX+y,b.width=Math.abs(y),n?(b.height=b.width/n,b.y=t.startCropY-b.height):(b.height=Math.abs(v),b.y=t.startCropY+v));const N=O4e(b,n,m,o.width,o.height,l,i,s,a);return n||ap.xyOrds.indexOf(x)>-1?u=N:ap.xOrds.indexOf(x)>-1?(u.x=N.x,u.width=N.width):ap.yOrds.indexOf(x)>-1&&(u.y=N.y,u.height=N.height),u.x=IS(u.x,0,o.width-u.width),u.y=IS(u.y,0,o.height-u.height),u}renderCropSelection(){const{ariaLabels:t=ap.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,i=this.getCropStyle();if(l)return dt.createElement("div",{style:i,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&&dt.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},dt.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),dt.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),dt.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),dt.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"nw"),role:"button"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"n"),role:"button"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"ne"),role:"button"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"e"),role:"button"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"se"),role:"button"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"s"),role:"button"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"sw"),role:"button"}),dt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"w"),role:"button"})),a&&dt.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:u=>u.stopPropagation()},a(this.state)),o&&dt.createElement(dt.Fragment,null,dt.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),dt.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(t){const n={...Hre,...this.props.crop||{}};return _g(n,t.width,t.height)}render(){const{aspect:t,children:n,circularCrop:s,className:a,crop:o,disabled:l,locked:i,style:u,ruleOfThirds:m}=this.props,{cropIsActive:x,newCropIsBeingDrawn:y}=this.state,v=o?this.renderCropSelection():null,b=Pwt("ReactCrop",a,x&&"ReactCrop--active",l&&"ReactCrop--disabled",i&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&t&&"ReactCrop--fixed-aspect",o&&s&&"ReactCrop--circular-crop",o&&m&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",s&&"ReactCrop--no-animate");return dt.createElement("div",{ref:this.componentRef,className:b,style:u},dt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?dt.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},dt.createElement("defs",null,dt.createElement("mask",{id:`hole-${this.instanceId}`},dt.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?dt.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"}):dt.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),dt.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,v)}};Nl(V0,"xOrds",["e","w"]),Nl(V0,"yOrds",["n","s"]),Nl(V0,"xyOrds",["nw","ne","se","sw"]),Nl(V0,"nudgeStep",1),Nl(V0,"nudgeStepMedium",10),Nl(V0,"nudgeStepLarge",100),Nl(V0,"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 Fwt=V0;var L7e=["PageUp","PageDown"],O7e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],D7e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},O3="Slider",[hfe,zwt,Bwt]=HI(O3),[R7e]=cc(O3,[Bwt]),[$wt,Tae]=R7e(O3),F7e=A.forwardRef((e,t)=>{const{name:n,min:s=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:u=0,defaultValue:m=[s],value:x,onValueChange:y=()=>{},onValueCommit:v=()=>{},inverted:b=!1,form:N,...k}=e,M=A.useRef(new Set),I=A.useRef(0),P=l==="horizontal"?Uwt:qwt,[F=[],D]=rh({prop:x,defaultProp:m,onChange:ae=>{var pe;(pe=[...M.current][I.current])==null||pe.focus(),y(ae)}}),U=A.useRef(F);function V(ae){const oe=Kwt(F,ae);ee(ae,oe)}function W(ae){ee(ae,I.current)}function G(){const ae=U.current[I.current];F[I.current]!==ae&&v(F)}function ee(ae,oe,{commit:pe}={commit:!1}){const ne=Qwt(o),fe=Jwt(Math.round((ae-s)/o)*o+s,ne),se=LE(fe,[s,a]);D((me=[])=>{const ue=Wwt(me,se,oe);if(Xwt(ue,u*o)){I.current=ue.indexOf(se);const xe=String(ue)!==String(me);return xe&&pe&&v(ue),xe?ue:me}else return me})}return r.jsx($wt,{scope:e.__scopeSlider,name:n,disabled:i,min:s,max:a,valueIndexToChangeRef:I,thumbs:M.current,values:F,orientation:l,form:N,children:r.jsx(hfe.Provider,{scope:e.__scopeSlider,children:r.jsx(hfe.Slot,{scope:e.__scopeSlider,children:r.jsx(P,{"aria-disabled":i,"data-disabled":i?"":void 0,...k,ref:t,onPointerDown:gn(k.onPointerDown,()=>{i||(U.current=F)}),min:s,max:a,inverted:b,onSlideStart:i?void 0:V,onSlideMove:i?void 0:W,onSlideEnd:i?void 0:G,onHomeKeyDown:()=>!i&&ee(s,0,{commit:!0}),onEndKeyDown:()=>!i&&ee(a,F.length-1,{commit:!0}),onStepKeyDown:({event:ae,direction:oe})=>{if(!i){const fe=L7e.includes(ae.key)||ae.shiftKey&&O7e.includes(ae.key)?10:1,se=I.current,me=F[se],ue=o*fe*oe;ee(me+ue,se,{commit:!0})}}})})})})});F7e.displayName=O3;var[z7e,B7e]=R7e(O3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Uwt=A.forwardRef((e,t)=>{const{min:n,max:s,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:u,onStepKeyDown:m,...x}=e,[y,v]=A.useState(null),b=ca(t,P=>v(P)),N=A.useRef(void 0),k=Mk(a),M=k==="ltr",I=M&&!o||!M&&o;function T(P){const F=N.current||y.getBoundingClientRect(),D=[0,F.width],V=N0e(D,I?[n,s]:[s,n]);return N.current=F,V(P-F.left)}return r.jsx(z7e,{scope:e.__scopeSlider,startEdge:I?"left":"right",endEdge:I?"right":"left",direction:I?1:-1,size:"width",children:r.jsx($7e,{dir:k,"data-orientation":"horizontal",...x,ref:b,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:P=>{const F=T(P.clientX);l==null||l(F)},onSlideMove:P=>{const F=T(P.clientX);i==null||i(F)},onSlideEnd:()=>{N.current=void 0,u==null||u()},onStepKeyDown:P=>{const D=D7e[I?"from-left":"from-right"].includes(P.key);m==null||m({event:P,direction:D?-1:1})}})})}),qwt=A.forwardRef((e,t)=>{const{min:n,max:s,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:u,...m}=e,x=A.useRef(null),y=ca(t,x),v=A.useRef(void 0),b=!a;function N(k){const M=v.current||x.current.getBoundingClientRect(),I=[0,M.height],P=N0e(I,b?[s,n]:[n,s]);return v.current=M,P(k-M.top)}return r.jsx(z7e,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:r.jsx($7e,{"data-orientation":"vertical",...m,ref:y,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const M=N(k.clientY);o==null||o(M)},onSlideMove:k=>{const M=N(k.clientY);l==null||l(M)},onSlideEnd:()=>{v.current=void 0,i==null||i()},onStepKeyDown:k=>{const I=D7e[b?"from-bottom":"from-top"].includes(k.key);u==null||u({event:k,direction:I?-1:1})}})})}),$7e=A.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:u,...m}=e,x=Tae(O3,n);return r.jsx(Fn.span,{...m,ref:t,onKeyDown:gn(e.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):L7e.concat(O7e).includes(y.key)&&(u(y),y.preventDefault())}),onPointerDown:gn(e.onPointerDown,y=>{const v=y.target;v.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(v)?v.focus():s(y)}),onPointerMove:gn(e.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:gn(e.onPointerUp,y=>{const v=y.target;v.hasPointerCapture(y.pointerId)&&(v.releasePointerCapture(y.pointerId),o(y))})})}),U7e="SliderTrack",q7e=A.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Tae(U7e,n);return r.jsx(Fn.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:t})});q7e.displayName=U7e;var mfe="SliderRange",V7e=A.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Tae(mfe,n),o=B7e(mfe,n),l=A.useRef(null),i=ca(t,l),u=a.values.length,m=a.values.map(v=>G7e(v,a.min,a.max)),x=u>1?Math.min(...m):0,y=100-Math.max(...m);return r.jsx(Fn.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:i,style:{...e.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});V7e.displayName=mfe;var ffe="SliderThumb",H7e=A.forwardRef((e,t)=>{const n=zwt(e.__scopeSlider),[s,a]=A.useState(null),o=ca(t,i=>a(i)),l=A.useMemo(()=>s?n().findIndex(i=>i.ref.current===s):-1,[n,s]);return r.jsx(Vwt,{...e,ref:o,index:l})}),Vwt=A.forwardRef((e,t)=>{const{__scopeSlider:n,index:s,name:a,...o}=e,l=Tae(ffe,n),i=B7e(ffe,n),[u,m]=A.useState(null),x=ca(t,T=>m(T)),y=u?l.form||!!u.closest("form"):!0,v=KI(u),b=l.values[s],N=b===void 0?0:G7e(b,l.min,l.max),k=Gwt(s,l.values.length),M=v==null?void 0:v[i.size],I=M?Zwt(M,N,i.direction):0;return A.useEffect(()=>{if(u)return l.thumbs.add(u),()=>{l.thumbs.delete(u)}},[u,l.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${N}% + ${I}px)`},children:[r.jsx(hfe.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Fn.span,{role:"slider","aria-label":e["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":b,"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:b===void 0?{display:"none"}:e.style,onFocus:gn(e.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(W7e,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:b},s)]})});H7e.displayName=ffe;var Hwt="RadioBubbleInput",W7e=A.forwardRef(({__scopeSlider:e,value:t,...n},s)=>{const a=A.useRef(null),o=ca(a,s),l=oP(t);return A.useEffect(()=>{const i=a.current;if(!i)return;const u=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&x){const y=new Event("input",{bubbles:!0});x.call(i,t),i.dispatchEvent(y)}},[l,t]),r.jsx(Fn.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});W7e.displayName=Hwt;function Wwt(e=[],t,n){const s=[...e];return s[n]=t,s.sort((a,o)=>a-o)}function G7e(e,t,n){const o=100/(n-t)*(e-t);return LE(o,[0,100])}function Gwt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Kwt(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),s=Math.min(...n);return n.indexOf(s)}function Zwt(e,t,n){const s=e/2,o=N0e([0,50],[0,s]);return(s-o(t)*n)*n}function Ywt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Xwt(e,t){if(t>0){const n=Ywt(e);return Math.min(...n)>=t}return!0}function N0e(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 Qwt(e){return(String(e).split(".")[1]||"").length}function Jwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var K7e=F7e,ejt=q7e,tjt=V7e,rjt=H7e;const Np=A.forwardRef(({className:e,...t},n)=>r.jsxs(K7e,{ref:n,className:Ut("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(ejt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(tjt,{className:"absolute h-full bg-primary"})}),r.jsx(rjt,{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"})]}));Np.displayName=K7e.displayName;function njt(e,t,n){return Owt(Lwt({unit:"%",width:90},n,e,t),e,t)}const S0e=({open:e,onClose:t,imageSrc:n,onCropComplete:s,aspectRatio:a=1})=>{const o=A.useRef(null),[l,i]=A.useState(),[u,m]=A.useState(),[x,y]=A.useState(1),[v,b]=A.useState(0),N=A.useCallback(I=>{const{width:T,height:P}=I.currentTarget;i(njt(T,P,a))},[a]),k=A.useCallback(async()=>{const I=o.current;if(!I||!u)return;const T=document.createElement("canvas"),P=T.getContext("2d");if(!P)return;const F=I.naturalWidth/I.width,D=I.naturalHeight/I.height,U=400;T.width=U,T.height=U,P.imageSmoothingQuality="high";const V=u.x*F,W=u.y*D,G=u.width*F,ee=u.height*D,ae=v*Math.PI/180,oe=T.width/2,pe=T.height/2;return P.save(),P.translate(oe,pe),P.rotate(ae),P.scale(x,x),P.translate(-oe,-pe),P.drawImage(I,V,W,G,ee,0,0,U,U),P.restore(),new Promise((ne,fe)=>{T.toBlob(se=>{se?ne(se):fe(new Error("Canvas is empty"))},"image/jpeg",.95)})},[u,x,v]),M=async()=>{try{const I=await k();I&&(s(I),t())}catch(I){console.error("Error cropping image:",I)}};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Br,{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(Fwt,{crop:l,onChange:(I,T)=>i(T),onComplete:I=>m(I),aspect:a,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${x}) rotate(${v}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(z4,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Np,{value:[x],min:.5,max:3,step:.1,onValueChange:([I])=>y(I),className:"flex-1"}),r.jsx(F4,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(wA,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Np,{value:[v],min:-180,max:180,step:1,onValueChange:([I])=>b(I),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[v,"°"]})]})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(Q,{onClick:M,children:"Save Photo"})]})]})})},sjt=()=>{const{user:e}=tn(),{toast:t}=fi(),[n,s]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(null);A.useEffect(()=>{e&&u()},[e]);const u=async()=>{s(!0);try{const{data:y}=await Y.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",e==null?void 0:e.id).single();y&&i({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)}},m=async()=>{o(!0);try{const{data:{session:y}}=await Y.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:v,error:b}=await Y.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(b)throw b;v!=null&&v.url&&window.open(v.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(At,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(At,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(At,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(At,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(At,{variant:"secondary",children:"Canceled"});default:return r.jsx(At,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(uf,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(uf,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(jn,{children:"Manage your subscription and billing"})]}),r.jsxs(et,{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(Q,{onClick:m,variant:"outline",disabled:a,children:[a?r.jsx(Gr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ss,{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."})]})]})},ajt=()=>{const{user:e}=tn(),t=Vn(),{toast:n}=fi(),[s]=Zc(),a=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:u,subscribe:m,unsubscribe:x}=mRe(),[y,v]=A.useState(!1),[b,N]=A.useState(""),[k,M]=A.useState(!1),[I,T]=A.useState(!1),[P,F]=A.useState(""),[D,U]=A.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}),[V,W]=A.useState(!1),[G,ee]=A.useState(!1),[ae,oe]=A.useState({newPassword:"",confirmPassword:""});A.useEffect(()=>{e&&pe()},[e]),A.useEffect(()=>{o&&e&&setTimeout(()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,e]);const pe=async()=>{var ue,xe,Te;if(!(e!=null&&e.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",e.id);const{data:_e,error:we}=await Y.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url, email_signature, use_email_signature").eq("id",e.id).maybeSingle();if(we)throw console.error("Profile query error:",we),we;_e?(console.log("Profile loaded successfully:",_e),U({name:_e.name||"",email:_e.email||"",title:_e.title||"",bio:_e.bio||"",areas_served:_e.areas_served||"",years_experience:((ue=_e.years_experience)==null?void 0:ue.toString())||"",instagram_url:_e.instagram_url||"",facebook_url:_e.facebook_url||"",linkedin_url:_e.linkedin_url||"",email_signature:_e.email_signature||"",use_email_signature:_e.use_email_signature||!1}),W(_e.digest_opt_out||!1)):(console.warn("No profile found for user"),U({name:((xe=e.user_metadata)==null?void 0:xe.name)||((Te=e.email)==null?void 0:Te.split("@")[0])||"",email:e.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}));const{data:ve}=await Y.storage.from("avatars").list(`${e.id}`);if(ve&&ve.length>0){const{data:Xe}=Y.storage.from("avatars").getPublicUrl(`${e.id}/${ve[0].name}`);N(Xe.publicUrl)}}catch(_e){console.error("Error loading profile:",_e),n({title:"Error",description:_e.message||"Failed to load profile",variant:"destructive"})}},ne=ue=>{var _e;const xe=(_e=ue.target.files)==null?void 0:_e[0];if(!xe)return;const Te=new FileReader;Te.onloadend=()=>{F(Te.result),T(!0)},Te.readAsDataURL(xe),ue.target.value=""},fe=async ue=>{if(e){M(!0);try{const{data:xe}=await Y.storage.from("avatars").list(`${e.id}`);xe&&xe.length>0&&await Y.storage.from("avatars").remove(xe.map(Xe=>`${e.id}/${Xe.name}`));const _e=`${e.id}/avatar.jpg`,{error:we}=await Y.storage.from("avatars").upload(_e,ue,{upsert:!0,contentType:"image/jpeg"});if(we)throw we;const{data:ve}=Y.storage.from("avatars").getPublicUrl(_e);N(`${ve.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(xe){console.error("Error uploading avatar:",xe),n({title:"Error",description:xe.message||"Failed to upload photo",variant:"destructive"})}finally{M(!1)}}},se=async()=>{if(!D.name.trim()||!D.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}v(!0);try{const{error:ue}=await Y.from("profiles").update({name:D.name.trim(),email:D.email.trim(),title:D.title.trim()||null,bio:D.bio.trim()||null,areas_served:D.areas_served.trim()||null,years_experience:D.years_experience?parseInt(D.years_experience):null,instagram_url:D.instagram_url.trim()||null,facebook_url:D.facebook_url.trim()||null,linkedin_url:D.linkedin_url.trim()||null,email_signature:D.email_signature||"",use_email_signature:D.use_email_signature}).eq("id",e==null?void 0:e.id);if(ue)throw ue;n({title:"Success",description:"Profile updated successfully"})}catch(ue){console.error("Error updating profile:",ue),n({title:"Error",description:ue.message||"Failed to update profile",variant:"destructive"})}finally{v(!1)}},me=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}v(!0);try{const{error:ue}=await Y.auth.updateUser({password:ae.newPassword});if(ue)throw ue;n({title:"Success",description:"Password updated successfully"}),oe({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>t("/dashboard"),1e3)}catch(ue){console.error("Error updating password:",ue),n({title:"Error",description:ue.message||"Failed to update password",variant:"destructive"})}finally{v(!1)}};return r.jsx(Fr,{title:a?"Complete Your Profile":o?"Reset Your Password":"Profile Settings",description:a?"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:[!a&&!o&&r.jsx("div",{className:"mb-6",children:r.jsxs(Q,{variant:"outline",onClick:()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(Rj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Profile Photo"}),r.jsx(jn,{children:"Upload a professional photo for your profile"})]}),r.jsxs(et,{className:"flex items-center gap-6",children:[r.jsxs(ea,{className:"h-24 w-24",children:[r.jsx(Ci,{src:b}),r.jsx(ta,{className:"text-2xl",children:D.name.split(" ").map(ue=>ue[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:k}),r.jsxs(Q,{variant:"outline",onClick:()=>{var ue;return(ue=document.getElementById("avatar-upload"))==null?void 0:ue.click()},disabled:k,children:[r.jsx(bo,{className:"mr-2 h-4 w-4"}),k?"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(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Personal Information"}),r.jsx(jn,{children:"Update your profile details"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",value:D.name,onChange:ue=>U({...D,name:ue.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(lt,{id:"email",type:"email",value:D.email,onChange:ue=>U({...D,email:ue.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Job Title"}),r.jsx(lt,{id:"title",value:D.title,onChange:ue=>U({...D,title:ue.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"bio",children:"Bio"}),r.jsx(Zn,{id:"bio",value:D.bio,onChange:ue=>U({...D,bio:ue.target.value}),placeholder:"A short description about yourself",maxLength:500,className:"min-h-[120px] resize-y"})]}),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(ze,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(lt,{id:"areas_served",value:D.areas_served,onChange:ue=>U({...D,areas_served:ue.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(lt,{id:"years_experience",type:"number",min:"0",value:D.years_experience,onChange:ue=>U({...D,years_experience:ue.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(lt,{value:D.linkedin_url,onChange:ue=>U({...D,linkedin_url:ue.target.value}),placeholder:"LinkedIn URL"}),r.jsx(lt,{value:D.instagram_url,onChange:ue=>U({...D,instagram_url:ue.target.value}),placeholder:"Instagram URL"}),r.jsx(lt,{value:D.facebook_url,onChange:ue=>U({...D,facebook_url:ue.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(Q,{onClick:se,disabled:y,children:[r.jsx(Ip,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(K0,{className:"h-5 w-5"}),"Email Signature"]}),r.jsx(jn,{children:"Add a signature that will be appended to emails sent via Gmail"})]}),r.jsxs(et,{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:"Use email signature in all emails"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:D.use_email_signature?"Your signature will be added to every email sent via Gmail":"Signature is currently disabled"})]}),r.jsx(As,{checked:D.use_email_signature,onCheckedChange:ue=>U({...D,use_email_signature:ue})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Signature"}),r.jsx(Hp,{content:D.email_signature,onChange:ue=>U({...D,email_signature:ue}),placeholder:"Paste your Gmail signature here or create one...",minHeight:"120px",compact:!0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Tip: Copy your signature from Gmail Settings and paste it here — images and formatting will be preserved."})]}),r.jsxs(Q,{onClick:se,disabled:y,children:[r.jsx(Ip,{className:"mr-2 h-4 w-4"}),"Save Signature"]})]})]}),r.jsxs(He,{id:"change-password-section",children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:a?"Set Your Password":"Change Password"}),r.jsx(jn,{children:a?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"newPassword",children:"New Password"}),r.jsx(lt,{id:"newPassword",type:"password",value:ae.newPassword,onChange:ue=>oe({...ae,newPassword:ue.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(lt,{id:"confirmPassword",type:"password",value:ae.confirmPassword,onChange:ue=>oe({...ae,confirmPassword:ue.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(Q,{onClick:me,disabled:y,children:[r.jsx(Ip,{className:"mr-2 h-4 w-4"}),a?"Complete Setup":"Update Password"]}),a&&r.jsx(Q,{variant:"outline",onClick:()=>t("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[i?r.jsx(Dg,{className:"h-5 w-5"}):r.jsx(Mj,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(jn,{children:"Receive browser notifications when new content is added"})]}),r.jsx(et,{children:l?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:i?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:i?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx(As,{checked:i,onCheckedChange:ue=>{ue?m():x()},disabled:u})]}):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(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[V?r.jsx(dA,{className:"h-5 w-5"}):r.jsx(ws,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(jn,{children:"Manage your email subscription settings"})]}),r.jsx(et,{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:V?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(As,{checked:!V,onCheckedChange:async ue=>{ee(!0);try{const{error:xe}=await Y.from("profiles").update({digest_opt_out:!ue}).eq("id",e==null?void 0:e.id);if(xe)throw xe;W(!ue),n({title:ue?"Subscribed":"Unsubscribed",description:ue?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(xe){n({title:"Error",description:xe.message||"Failed to update preference",variant:"destructive"})}finally{ee(!1)}},disabled:G})]})})]}),r.jsx(Dxt,{}),r.jsx(sjt,{})]}),r.jsx(S0e,{open:I,onClose:()=>T(!1),imageSrc:P,onCropComplete:fe,aspectRatio:1})]})})};var ijt="AspectRatio",Z7e=A.forwardRef((e,t)=>{const{ratio:n=1/1,style:s,...a}=e;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx(Fn.div,{...a,ref:t,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});Z7e.displayName=ijt;var ojt=Z7e;const ljt=ojt;function cjt(){const{user:e}=tn(),t=Vr(),[n,s]=A.useState(!1),[a,o]=A.useState(!1),{data:l,isLoading:i}=Zt({queryKey:["calendar-token",e==null?void 0:e.id],queryFn:async()=>{const{data:N,error:k}=await Y.from("profiles").select("calendar_token").eq("id",e==null?void 0:e.id).single();if(k)throw k;return N},enabled:!!e&&a}),u=ar({mutationFn:async()=>{const N=new Uint8Array(12);crypto.getRandomValues(N);const k=btoa(String.fromCharCode(...N)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:M}=await Y.from("profiles").update({calendar_token:k}).eq("id",e==null?void 0:e.id);if(M)throw M;return k},onSuccess:()=>{t.invalidateQueries({queryKey:["calendar-token",e==null?void 0:e.id]}),Ae.success("Calendar subscription URL generated!")},onError:N=>{Ae.error("Failed to generate calendar URL: "+N.message)}}),m=l!=null&&l.calendar_token?`https://dashboard.relevelup.com/api/calendar/${l.calendar_token}.ics`:null,x=async()=>{m&&(await navigator.clipboard.writeText(m),s(!0),Ae.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},y=()=>{m&&(window.location.href=m.replace("https://","webcal://"))},v=()=>{if(m){const N=m.replace("https://","webcal://"),k=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(N)}`;window.open(k,"_blank")}},b=()=>{if(m){const N=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(m)}&name=Level%20Up%20Events`;window.open(N,"_blank")}};return r.jsxs(Rr,{open:a,onOpenChange:o,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:"gap-2",children:[r.jsx(Cs,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(Cs,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(Yn,{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:i?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):m?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(lt,{value:m,readOnly:!0,className:"text-xs font-mono"}),r.jsx(Q,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx(mi,{className:"h-4 w-4 text-green-500"}):r.jsx(Po,{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(Q,{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(Ss,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(Q,{variant:"outline",className:"w-full justify-start gap-2",onClick:v,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(Ss,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(Q,{variant:"outline",className:"w-full justify-start gap-2",onClick:b,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(Ss,{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(Q,{onClick:()=>u.mutate(),disabled:u.isPending,className:"w-full",children:u.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Cs,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var Aae="Tabs",[djt]=cc(Aae,[M3]),Y7e=M3(),[ujt,C0e]=djt(Aae),X7e=A.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:u="automatic",...m}=e,x=Mk(i),[y,v]=rh({prop:s,onChange:a,defaultProp:o??"",caller:Aae});return r.jsx(ujt,{scope:n,baseId:pd(),value:y,onValueChange:v,orientation:l,dir:x,activationMode:u,children:r.jsx(Fn.div,{dir:x,"data-orientation":l,...m,ref:t})})});X7e.displayName=Aae;var Q7e="TabsList",J7e=A.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,o=C0e(Q7e,n),l=Y7e(n);return r.jsx(Dxe,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Fn.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});J7e.displayName=Q7e;var e9e="TabsTrigger",t9e=A.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...o}=e,l=C0e(e9e,n),i=Y7e(n),u=s9e(l.baseId,s),m=a9e(l.baseId,s),x=s===l.value;return r.jsx(Rxe,{asChild:!0,...i,focusable:!a,active:x,children:r.jsx(Fn.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":m,"data-state":x?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...o,ref:t,onMouseDown:gn(e.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:gn(e.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:gn(e.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!a&&y&&l.onValueChange(s)})})})});t9e.displayName=e9e;var r9e="TabsContent",n9e=A.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:o,...l}=e,i=C0e(r9e,n),u=s9e(i.baseId,s),m=a9e(i.baseId,s),x=s===i.value,y=A.useRef(x);return A.useEffect(()=>{const v=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(v)},[]),r.jsx(Ac,{present:a||x,children:({present:v})=>r.jsx(Fn.div,{"data-state":x?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":u,hidden:!v,id:m,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:y.current?"0s":void 0},children:v&&o})})});n9e.displayName=r9e;function s9e(e,t){return`${e}-trigger-${t}`}function a9e(e,t){return`${e}-content-${t}`}var hjt=X7e,i9e=J7e,o9e=t9e,l9e=n9e;const wi=hjt,_i=A.forwardRef(({className:e,...t},n)=>r.jsx(i9e,{ref:n,className:Ut("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));_i.displayName=i9e.displayName;const sn=A.forwardRef(({className:e,...t},n)=>r.jsx(o9e,{ref:n,className:Ut("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}));sn.displayName=o9e.displayName;const Sn=A.forwardRef(({className:e,...t},n)=>r.jsx(l9e,{ref:n,className:Ut("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Sn.displayName=l9e.displayName;const mjt={first_timer:ks,regular:my,dedicated:Bl,veteran:io,streak_master:fm,century:io},fjt={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 D4e(e){return e===1?r.jsx(io,{className:"h-5 w-5 text-yellow-500"}):e===2?r.jsx(my,{className:"h-5 w-5 text-gray-400"}):e===3?r.jsx(Bl,{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 c9e({showUserStats:e=!0,compact:t=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:a}=tn(),{data:o,isLoading:l}=RRe(t?5:10,n),{data:i}=FRe(a==null?void 0:a.id),{data:u}=BRe(a==null?void 0:a.id),{data:m}=zRe(a==null?void 0:a.id);return l?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Er,{className:"h-12 w-full"},y))})})]}):r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(et,{children:[e&&i&&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"}),u&&r.jsxs(At,{variant:"secondary",className:"text-xs",children:["Rank #",u]})]}),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:i.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:i.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(fm,{className:"h-4 w-4 text-orange-500"}),r.jsx("div",{className:"text-lg font-bold",children:i.current_streak}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Streak"})]})]}),m&&m.length>0&&r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[m.slice(0,4).map(x=>{const y=mjt[x.badge_type]||ks;return r.jsxs(At,{variant:"outline",className:`text-xs ${fjt[x.badge_type]||""}`,title:x.badge_description||"",children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),x.badge_name]},x.id)}),m.length>4&&r.jsxs(At,{variant:"outline",className:"text-xs",children:["+",m.length-4," more"]})]})]}),r.jsxs(wi,{defaultValue:"points",className:"w-full",children:[r.jsxs(_i,{className:"w-full mb-3",children:[r.jsx(sn,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(sn,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(Sn,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((x,y)=>{var v,b,N;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.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:D4e(y+1)}),r.jsx(ea,{className:"h-8 w-8",children:r.jsx(ta,{className:"text-xs",children:((b=(v=x.profile)==null?void 0:v.name)==null?void 0:b.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===(a==null?void 0:a.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(Sn,{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 v,b,N;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.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:D4e(y+1)}),r.jsx(ea,{className:"h-8 w-8",children:r.jsx(ta,{className:"text-xs",children:((b=(v=x.profile)==null?void 0:v.name)==null?void 0:b.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===(a==null?void 0:a.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 pjt(){const e=Vn(),{user:t,isAdmin:n}=tn(),s=Vr(),{data:a,isLoading:o}=Zt({queryKey:["public-events"],queryFn:async()=>{const{data:k,error:M}=await Y.from("events").select("*").order("event_date",{ascending:!0});if(M)throw M;return k}}),{data:l}=Zt({queryKey:["my-registrations"],queryFn:async()=>{if(!t)return[];const{data:k,error:M}=await Y.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t.id);if(M)throw M;return k},enabled:!!t}),{data:i}=Zt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:k,error:M}=await Y.from("event_registrations").select("event_id");if(M)throw M;const I={};return k.forEach(T=>{I[T.event_id]=(I[T.event_id]||0)+1}),I}}),u=ar({mutationFn:async k=>{const{data:M,error:I}=await Y.functions.invoke("zoom-register",{body:{event_id:k}});if(I)throw I;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:k=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),k!=null&&k.join_url?Ae.success("Successfully registered! You'll receive a Zoom confirmation email."):Ae.success("Successfully registered for the event!")},onError:k=>{Ae.error("Failed to register: "+k.message)}}),m=ar({mutationFn:async k=>{const{data:M,error:I}=await Y.functions.invoke("zoom-unregister",{body:{event_id:k}});if(I)throw I;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),Ae.success("Registration cancelled and removed from Zoom")},onError:k=>{Ae.error("Failed to cancel: "+k.message)}}),x=k=>l==null?void 0:l.some(M=>M.event_id===k),y=k=>{const M=l==null?void 0:l.find(I=>I.event_id===k);return M==null?void 0:M.zoom_join_url},v=k=>k.capacity?((i==null?void 0:i[k.id])||0)>=k.capacity:!1,b=(a==null?void 0:a.filter(k=>Y4(k.event_date)!=="ended"))||[],N=(a==null?void 0:a.filter(k=>Y4(k.event_date)==="ended"))||[];return r.jsx(Fr,{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(cjt,{}),n&&r.jsx(Q,{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..."}):b.length===0?r.jsx(He,{className:"text-center py-12",children:r.jsx(et,{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:b.map(k=>{const M=Y4(k.event_date),I=Eye(k.event_date),T=M==="live",P=M==="starting_soon";return r.jsxs(He,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${T?"border-red-500 ring-2 ring-red-500/20":P?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>e(`/events/${k.id}`),children:[I&&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(Uj,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Xa,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),k.image_url&&r.jsx(ljt,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:k.image_url,alt:k.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Ht,{children:[r.jsx(Gt,{className:"line-clamp-2",children:k.title}),k.description&&r.jsx(jn,{className:"line-clamp-2",children:k.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(et,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Cs,{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(k.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Xa,{className:"h-4 w-4"}),RE(new Date(k.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx($n,{className:"h-4 w-4"}),(i==null?void 0:i[k.id])||0," registered",k.capacity&&` / ${k.capacity} spots`]})]}),r.jsx(OA,{className:"flex gap-2",onClick:F=>F.stopPropagation(),children:x(k.id)?r.jsxs(r.Fragment,{children:[r.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>m.mutate(k.id),disabled:m.isPending,children:[r.jsx(ds,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(Q,{className:"flex-1",onClick:()=>window.open(y(k.id)||k.zoom_link,"_blank"),children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(Q,{className:"w-full",onClick:()=>u.mutate(k.id),disabled:u.isPending||v(k),children:v(k)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(mi,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},k.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(k=>r.jsx(He,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>e(`/events/${k.id}`),children:r.jsxs(Ht,{children:[r.jsx(Gt,{className:"text-base line-clamp-1",children:k.title}),r.jsx(jn,{children:new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(k.event_date))})]})},k.id))})]})]}),n&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(c9e,{showUserStats:!0})})]})]})})}const jde=[{value:"all",label:"All Roles",icon:$n},{value:"brokerage_manager",label:"Brokerage Managers",icon:AA},{value:"admin",label:"Admins",icon:vm}];function gjt({open:e,onOpenChange:t,resourceType:n,resourceId:s,resourceTitle:a}){var ot,Tt;const{user:o,isAdmin:l,isBrokerageManager:i}=tn(),[u,m]=A.useState([]),[x,y]=A.useState([]),[v,b]=A.useState([]),[N,k]=A.useState([]),[M,I]=A.useState(""),[T,P]=A.useState(""),[F,D]=A.useState(""),[U,V]=A.useState(!1),[W,G]=A.useState(!1),[ee,ae]=A.useState("agents"),[oe,pe]=A.useState("all"),[ne,fe]=A.useState({}),se=l||i;A.useEffect(()=>{e&&o&&(l?me():ue())},[e,o,l]),A.useEffect(()=>{e||(b([]),k([]),I(""),P(""),D(""),ae("agents"),pe("all"))},[e]);const me=async()=>{if(o){V(!0);try{const{data:Oe,error:at}=await Y.from("brokerages").select("id, name").order("name");if(at)throw at;const le=1e3,qe={};let Je=0,st=!0;for(;st;){const{data:Ce,error:Ee}=await Y.from("profiles").select("brokerage_id").range(Je*le,(Je+1)*le-1);if(Ee)throw Ee;Ce==null||Ce.forEach(Ze=>{Ze.brokerage_id&&(qe[Ze.brokerage_id]=(qe[Ze.brokerage_id]||0)+1)}),st=(Ce==null?void 0:Ce.length)===le,Je++}y((Oe==null?void 0:Oe.map(Ce=>({...Ce,agent_count:qe[Ce.id]||0})))||[]);const je=[];for(Je=0,st=!0;st;){const{data:Ce,error:Ee}=await Y.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(Je*le,(Je+1)*le-1);if(Ee)throw Ee;Ce&&je.push(...Ce),st=(Ce==null?void 0:Ce.length)===le,Je++}const ut={};for(Je=0,st=!0;st;){const{data:Ce,error:Ee}=await Y.from("user_roles").select("user_id, role").range(Je*le,(Je+1)*le-1);if(Ee)throw Ee;Ce==null||Ce.forEach(Ze=>{ut[Ze.user_id]||(ut[Ze.user_id]=[]),ut[Ze.user_id].push(Ze.role)}),st=(Ce==null?void 0:Ce.length)===le,Je++}fe(ut),m(je.map(Ce=>{var Ee;return{id:Ce.id,name:Ce.name,email:Ce.email,brokerage_name:((Ee=Ce.brokerages)==null?void 0:Ee.name)||"No Brokerage",roles:ut[Ce.id]||[]}}))}catch(Oe){console.error("Error loading data:",Oe),Ae.error("Failed to load agents and brokerages")}finally{V(!1)}}},ue=async()=>{if(o){V(!0);try{const{data:Oe}=await Y.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Oe!=null&&Oe.brokerage_id)){Ae.error("You must be part of a brokerage to share resources"),t(!1);return}const{data:at,error:le}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",Oe.brokerage_id).neq("id",o.id).order("name");if(le)throw le;m(at||[])}catch(Oe){console.error("Error loading agents:",Oe),Ae.error("Failed to load agents")}finally{V(!1)}}},xe=u.filter(Oe=>{var le;const at=Oe.name.toLowerCase().includes(M.toLowerCase())||Oe.email.toLowerCase().includes(M.toLowerCase())||((le=Oe.brokerage_name)==null?void 0:le.toLowerCase().includes(M.toLowerCase()));if(l&&oe!=="all"){const qe=ne[Oe.id]||[];return at&&qe.includes(oe)}return at}),Te=x.filter(Oe=>Oe.name.toLowerCase().includes(T.toLowerCase())),_e=()=>{v.length===xe.length?b([]):b(xe.map(Oe=>Oe.id))},we=()=>{N.length===Te.length?k([]):k(Te.map(Oe=>Oe.id))},ve=Oe=>{if(!se){b([Oe]);return}b(at=>at.includes(Oe)?at.filter(le=>le!==Oe):[...at,Oe])},Xe=Oe=>{k(at=>at.includes(Oe)?at.filter(le=>le!==Oe):[...at,Oe])},Me=async()=>{if(!(v.length>0||N.length>0)){Ae.error("Please select at least one agent or brokerage to share with");return}G(!0);try{const{data:at,error:le}=await Y.functions.invoke("send-share-notification",{body:{recipientIds:v,brokerageIds:N,resourceType:n,resourceId:s,resourceTitle:a,message:F.trim()||void 0}});if(le)throw le;const qe=(at==null?void 0:at.sharesCreated)||v.length;Ae.success(`Shared with ${qe} agent${qe!==1?"s":""}`),t(!1)}catch(at){console.error("Error sharing resource:",at),Ae.error("Failed to share resource")}finally{G(!1)}},Ie=Oe=>Oe.split(" ").map(at=>at[0]).join("").toUpperCase().slice(0,2),$e=Oe=>{const at=ne[Oe]||[];return at.includes("admin")?r.jsx(At,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):at.includes("brokerage_manager")?r.jsx(At,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Be=v.length+N.length,Ve=oe!=="all"?xe.length:null;return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{className:"flex-shrink-0",children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(Ji,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(Yn,{className:"line-clamp-2",children:['Share "',a,'" 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(wi,{value:ee,onValueChange:ae,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(_i,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(sn,{value:"agents",className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),v.length>0&&r.jsx(At,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:v.length})]}),r.jsxs(sn,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),N.length>0&&r.jsx(At,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:N.length})]})]}),r.jsxs(Sn,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name, email, or brokerage...",value:M,onChange:Oe=>I(Oe.target.value),className:"pl-9"})]}),r.jsxs(un,{value:oe,onValueChange:pe,children:[r.jsxs(ln,{className:"w-[180px]",children:[r.jsx(H1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(mn,{placeholder:"Filter by role"})]}),r.jsx(cn,{children:jde.map(Oe=>r.jsx($t,{value:Oe.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Oe.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Oe.label})]})},Oe.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(Q,{variant:"ghost",size:"sm",onClick:_e,className:"text-xs h-8",disabled:xe.length===0,children:[r.jsx($n,{className:"h-3.5 w-3.5 mr-1.5"}),v.length===xe.length&&xe.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Ve!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Ve," ",(ot=jde.find(Oe=>Oe.value===oe))==null?void 0:ot.label]}),r.jsxs("span",{className:"font-medium",children:[v.length," selected"]})]})]}),r.jsx(Vo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):xe.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx($n,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:oe!=="all"?`No ${(Tt=jde.find(Oe=>Oe.value===oe))==null?void 0:Tt.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:xe.map(Oe=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${v.includes(Oe.id)?"bg-accent":""}`,onClick:()=>ve(Oe.id),children:[r.jsx(_l,{checked:v.includes(Oe.id),onCheckedChange:()=>ve(Oe.id),className:"flex-shrink-0"}),r.jsx(ea,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(ta,{className:"text-xs bg-primary/10 text-primary",children:Ie(Oe.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:Oe.name}),$e(Oe.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Oe.email,Oe.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Oe.brokerage_name]})]})]})]},Oe.id))})})]}),r.jsxs(Sn,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search brokerages...",value:T,onChange:Oe=>P(Oe.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(Q,{variant:"ghost",size:"sm",onClick:we,className:"text-xs h-8",disabled:Te.length===0,children:[r.jsx(hi,{className:"h-3.5 w-3.5 mr-1.5"}),N.length===Te.length&&Te.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(Vo,{className:"h-[250px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Te.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(hi,{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:Te.map(Oe=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${N.includes(Oe.id)?"bg-accent":""}`,onClick:()=>Xe(Oe.id),children:[r.jsx(_l,{checked:N.includes(Oe.id),onCheckedChange:()=>Xe(Oe.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(hi,{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:Oe.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Oe.agent_count," agent",Oe.agent_count!==1?"s":""]})]})]},Oe.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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search agents...",value:M,onChange:Oe=>I(Oe.target.value),className:"pl-9"})]}),se&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(Q,{variant:"ghost",size:"sm",onClick:_e,className:"text-xs h-8",disabled:xe.length===0,children:[r.jsx($n,{className:"h-3.5 w-3.5 mr-1.5"}),v.length===xe.length&&xe.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[v.length," selected"]})]}),r.jsx(Vo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):xe.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx($n,{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:xe.map(Oe=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${v.includes(Oe.id)?"bg-accent":""}`,onClick:()=>ve(Oe.id),children:[r.jsx(_l,{checked:v.includes(Oe.id),onCheckedChange:()=>ve(Oe.id),className:"flex-shrink-0"}),r.jsx(ea,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(ta,{className:"text-xs bg-primary/10 text-primary",children:Ie(Oe.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Oe.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Oe.email})]})]},Oe.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(ze,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(Zn,{id:"message",placeholder:"I thought you might find this useful...",value:F,onChange:Oe=>D(Oe.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(Q,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(Q,{onClick:Me,disabled:Be===0||W,children:W?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function D3({resourceType:e,resourceId:t,resourceTitle:n,variant:s="outline",size:a="sm",className:o=""}){const[l,i]=A.useState(!1),{user:u}=tn();return u?r.jsxs(r.Fragment,{children:[r.jsxs(Q,{variant:s,size:a,onClick:()=>i(!0),className:o,children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(gjt,{open:l,onOpenChange:i,resourceType:e,resourceId:t,resourceTitle:n})]}):null}function xjt(){const{eventId:e}=Ec(),t=Vn(),{user:n}=tn(),[s,a]=A.useState(null),[o,l]=A.useState(null),[i,u]=A.useState(0),[m,x]=A.useState(!0),[y,v]=A.useState(!1);A.useEffect(()=>{e&&b()},[e,n]);const b=async()=>{try{const{data:P,error:F}=await Y.from("events").select("*").eq("id",e).single();if(F)throw F;a(P);const{count:D}=await Y.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",e);if(u(D||0),n){const{data:U}=await Y.from("event_registrations").select("id, zoom_join_url").eq("event_id",e).eq("user_id",n.id).maybeSingle();l(U)}}catch(P){console.error("Error loading event:",P),Ae.error("Failed to load event"),t("/events")}finally{x(!1)}},N=async()=>{if(!(!n||!s)){v(!0);try{if(o){const{error:P}=await Y.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(P)throw P;Ae.success("Successfully cancelled registration"),l(null),u(F=>F-1)}else{const{data:P,error:F}=await Y.functions.invoke("zoom-register",{body:{event_id:s.id}});if(F)throw F;Ae.success("Successfully registered for event!"),l({id:P.registration_id,zoom_join_url:P.zoom_join_url}),u(D=>D+1)}}catch(P){console.error("Registration error:",P),Ae.error(o?"Failed to cancel registration":"Failed to register for event")}finally{v(!1)}}},k=P=>{var F,D,U;if(P.includes("iframe.mediadelivery.net")||P.includes("video.bunnycdn.com")){const V=P.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(V)return`https://iframe.mediadelivery.net/embed/${V[1]}/${V[2]}?autoplay=false&preload=true`}if(P.includes("youtube.com")||P.includes("youtu.be")){const V=P.includes("youtu.be")?(F=P.split("youtu.be/")[1])==null?void 0:F.split("?")[0]:(D=P.split("v=")[1])==null?void 0:D.split("&")[0];if(V)return`https://www.youtube.com/embed/${V}`}if(P.includes("vimeo.com")){const V=(U=P.split("vimeo.com/")[1])==null?void 0:U.split("?")[0];if(V)return`https://player.vimeo.com/video/${V}`}return P};if(m)return r.jsx(Fr,{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(Fr,{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(Q,{onClick:()=>t("/events"),className:"mt-4",children:"Back to Events"})]})});const M=oft(new Date(s.event_date)),I=s.capacity&&i>=s.capacity,T=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Fr,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(Q,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>t("/events"),children:[r.jsx(Wi,{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"}),M&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(At,{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(D3,{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(rf,{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:k(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(He,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Cs,{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:RE(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx($n,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[i," / ",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(oi,{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:[!M&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(Q,{className:"w-full gap-2",onClick:()=>window.open(T,"_blank"),children:[r.jsx(Ss,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(Q,{variant:"outline",className:"w-full",onClick:N,disabled:y,children:[y?r.jsx(Gr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(Q,{className:"w-full gap-2",onClick:N,disabled:y||(I??!1),children:y?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):I?"Event Full":"Register Now"})}),M&&o&&r.jsxs(Q,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Ss,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const yjt=()=>{const{user:e,isAdmin:t}=tn(),n=Vn(),[s,a]=A.useState([]),[o,l]=A.useState(!0),[i,u]=A.useState(""),[m,x]=A.useState("all"),[y,v]=A.useState(new Set);A.useEffect(()=>{b()},[e]);const b=async()=>{try{const{data:T}=await Y.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),P=(T==null?void 0:T.map(ee=>ee.tag))||[],{data:F,error:D}=await Y.from("app_tiles").select("*").order("name");if(D)throw D;const{data:U}=await Y.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),V=new Set((U==null?void 0:U.map(ee=>ee.app_id))||[]);v(V);const G=((F==null?void 0:F.filter(ee=>!ee.required_tags||ee.required_tags.length===0?!0:ee.required_tags.some(ae=>P.includes(ae))))||[]).sort((ee,ae)=>ee.name==="LevelUp Members Portal"?-1:ae.name==="LevelUp Members Portal"?1:0);a(G)}catch(T){console.error("Error loading apps:",T),Ae.error("Failed to load apps")}finally{l(!1)}},N=async T=>{var F;const P=window.open("about:blank","_blank");try{const{data:D,error:U}=await Y.auth.getSession();if(U||!D.session){P==null||P.close(),Ae.error("Session expired. Please refresh the page and try again.");return}const V=D.session.access_token;await Y.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:W,error:G}=await Y.functions.invoke("sso-launch",{body:{app_id:T.app_id},headers:{Authorization:`Bearer ${V}`}});if(G)throw G;W!=null&&W.redirect_url?P&&!P.closed?(P.location.href=W.redirect_url,(F=P.focus)==null||F.call(P)):window.location.assign(W.redirect_url):(P==null||P.close(),Ae.error("Launch link unavailable"))}catch(D){P==null||P.close(),console.error("Error launching app:",D),Ae.error("Failed to launch app. Please try again.")}},k=async(T,P)=>{T.stopPropagation();const F=y.has(P);try{if(F){const{error:D}=await Y.from("user_favorites").delete().eq("user_id",e==null?void 0:e.id).eq("app_id",P);if(D)throw D;v(U=>{const V=new Set(U);return V.delete(P),V}),Ae.success("Removed from favorites")}else{const{error:D}=await Y.from("user_favorites").insert({user_id:e==null?void 0:e.id,app_id:P});if(D)throw D;v(U=>new Set(U).add(P)),Ae.success("Added to favorites")}}catch(D){console.error("Error toggling favorite:",D),Ae.error("Failed to update favorites")}},M=s.filter(T=>{var F;const P=T.name.toLowerCase().includes(i.toLowerCase())||((F=T.description)==null?void 0:F.toLowerCase().includes(i.toLowerCase()));return m==="favorites"?P&&y.has(T.id):P}),I=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Fr,{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(Fr,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:i,onChange:T=>u(T.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:I.map(T=>r.jsxs("button",{onClick:()=>x(T.id),className:Ut("pb-3 text-sm font-medium transition-colors relative",m===T.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[T.label,m===T.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},T.id))}),M.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:m==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(Mp,{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(ff,{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(Q,{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:M.map(T=>{const P=y.has(T.id),F=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:Ut("flex-shrink-0 p-1 transition-colors",P?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:D=>k(D,T.id),children:r.jsx(Mp,{className:Ut("h-5 w-5",P&&"fill-current")})})]}),F&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:D=>D.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},T.id)})})]})},vjt=()=>{const e=Vn(),[t,n]=A.useState(""),[s,a]=A.useState("all"),[o,l]=A.useState("all"),[i,u]=A.useState("grid"),{data:m=[]}=Zt({queryKey:["template-categories"],queryFn:async()=>{const{data:I,error:T}=await Y.from("template_categories").select("*").order("name");if(T)throw T;return I}}),{data:x=[]}=Zt({queryKey:["template-types"],queryFn:async()=>{const{data:I,error:T}=await Y.from("template_types").select("*").order("name");if(T)throw T;return I}}),{data:y=[],isLoading:v}=Zt({queryKey:["canva-templates"],queryFn:async()=>{const{data:I,error:T}=await Y.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:P,error:F}=await Y.from("template_links").select("*").order("sort_order");if(F)throw F;const{data:D}=await Y.from("template_likes").select("template_id"),{data:U}=await Y.from("template_comments").select("template_id"),V=new Map;D==null||D.forEach(ee=>{V.set(ee.template_id,(V.get(ee.template_id)||0)+1)});const W=new Map;return U==null||U.forEach(ee=>{W.set(ee.template_id,(W.get(ee.template_id)||0)+1)}),(I||[]).map(ee=>({...ee,links:(P||[]).filter(ae=>ae.template_id===ee.id)||[],likesCount:V.get(ee.id)||0,commentsCount:W.get(ee.id)||0}))}}),b=y.filter(I=>{var D;const T=I.name.toLowerCase().includes(t.toLowerCase())||((D=I.description)==null?void 0:D.toLowerCase().includes(t.toLowerCase())),P=s==="all"||I.category_id===s,F=o==="all"||I.type_id===o;return T&&P&&F}),N=()=>{n(""),a("all"),l("all")},k=t||s!=="all"||o!=="all",M=I=>{e(`/templates/${I}`)};return r.jsx(Fr,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search templates...",value:t,onChange:I=>n(I.target.value),className:"pl-9"})]}),r.jsxs(un,{value:s,onValueChange:a,children:[r.jsx(ln,{className:"w-full sm:w-48",children:r.jsx(mn,{placeholder:"All Categories"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Categories"}),m.map(I=>r.jsx($t,{value:I.id,children:I.name},I.id))]})]}),r.jsxs(un,{value:o,onValueChange:l,children:[r.jsx(ln,{className:"w-full sm:w-48",children:r.jsx(mn,{placeholder:"All Types"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Types"}),x.map(I=>r.jsx($t,{value:I.id,children:I.name},I.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[k&&r.jsx(Q,{variant:"outline",size:"sm",onClick:N,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>u("grid"),className:"rounded-full",children:r.jsx(hf,{className:"h-4 w-4"})}),r.jsx(Q,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>u("list"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[b.length," template",b.length!==1?"s":""," found"]}),v&&r.jsx("div",{className:i==="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((I,T)=>r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Er,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Er,{className:"h-5 w-3/4 mb-2"}),r.jsx(Er,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Er,{className:"h-5 w-16"}),r.jsx(Er,{className:"h-5 w-20"})]})]})},T))}),!v&&b.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:k?"No templates match your filters":"No templates available yet"}),k&&r.jsx(Q,{variant:"outline",onClick:N,children:"Clear Filters"})]}),!v&&b.length>0&&r.jsx("div",{className:i==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:b.map(I=>r.jsxs(He,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${i==="list"?"flex flex-row":""}`,onClick:()=>M(I.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${i==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[I.preview_image_url?r.jsx("img",{src:I.preview_image_url,alt:I.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"}),I.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(At,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(Oo,{className:"h-3 w-3"}),I.links.length]})})]}),r.jsxs(et,{className:`p-4 flex flex-col ${i==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:I.name}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:xse(I.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[I.category&&r.jsx(At,{variant:"secondary",className:"text-xs",children:I.category.name}),I.type&&r.jsx(At,{variant:"outline",className:"text-xs",children:I.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(Bd,{className:"h-3.5 w-3.5"}),I.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),I.commentsCount]})]}),r.jsxs(Q,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),M(I.id)},children:[r.jsx(Ss,{className:"h-4 w-4"}),"View Template"]})]})]},I.id))})]})})};var _jt="Separator",R4e="horizontal",bjt=["horizontal","vertical"],d9e=A.forwardRef((e,t)=>{const{decorative:n,orientation:s=R4e,...a}=e,o=wjt(s)?s:R4e,i=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(Fn.div,{"data-orientation":o,...i,...a,ref:t})});d9e.displayName=_jt;function wjt(e){return bjt.includes(e)}var u9e=d9e;const Od=A.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...s},a)=>r.jsx(u9e,{ref:a,decorative:n,orientation:t,className:Ut("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Od.displayName=u9e.displayName;const fP=()=>({trackEngagement:A.useCallback(async(t,n,s,a="view")=>{try{const{data:{user:o}}=await Y.auth.getUser();if(!o)return;await Y.from("content_engagement_logs").insert({user_id:o.id,resource_type:t,resource_id:n,resource_title:s,action_type:a})}catch(o){console.error("Error tracking engagement:",o)}},[])}),jjt=()=>{const{templateId:e}=Ec(),{user:t,isAdmin:n}=tn(),{toast:s}=fi(),a=Vr(),{trackEngagement:o}=fP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Zt({queryKey:["template-detail",e],queryFn:async()=>{const{data:T,error:P}=await Y.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",e).single();if(P)throw P;const{data:F}=await Y.from("template_links").select("*").eq("template_id",e).order("sort_order"),{data:D}=await Y.from("template_guides").select("*").eq("template_id",e).order("sort_order");return{...T,links:F||[],guides:D||[]}},enabled:!!e});A.useEffect(()=>{u&&o("template",u.id,u.name,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Zt({queryKey:["template-likes",e],queryFn:async()=>{const{data:T,error:P}=await Y.from("template_likes").select("*").eq("template_id",e);if(P)throw P;return T},enabled:!!e}),{data:y=[]}=Zt({queryKey:["template-comments",e],queryFn:async()=>{const{data:T,error:P}=await Y.from("template_comments").select("*").eq("template_id",e).order("created_at",{ascending:!1});if(P)throw P;const F=[...new Set(T.map(V=>V.user_id))],{data:D}=await Y.from("profiles").select("id, name").in("id",F),U=new Map((D==null?void 0:D.map(V=>[V.id,V.name]))||[]);return T.map(V=>({...V,user_name:U.get(V.user_id)||"Unknown User"}))},enabled:!!e}),v=ar({mutationFn:async T=>{const{error:P}=await Y.from("template_comments").insert({template_id:e,user_id:t.id,content:T});if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",e]}),i(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error adding comment",description:T.message,variant:"destructive"})}}),b=ar({mutationFn:async T=>{const{error:P}=await Y.from("template_comments").delete().eq("id",T);if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",e]}),s({title:"Comment deleted"})}}),N=ar({mutationFn:async()=>{const T=x.find(P=>P.user_id===(t==null?void 0:t.id));if(T){const{error:P}=await Y.from("template_likes").delete().eq("id",T.id);if(P)throw P}else{const{error:P}=await Y.from("template_likes").insert({template_id:e,user_id:t.id});if(P)throw P}},onSuccess:()=>{a.invalidateQueries({queryKey:["template-likes",e]})}}),k=x.some(T=>T.user_id===(t==null?void 0:t.id)),M=T=>T.split(" ").map(P=>P[0]).join("").toUpperCase().slice(0,2),I=T=>{T.preventDefault(),!(!l.trim()||!t)&&v.mutate(l.trim())};return m?r.jsx(Fr,{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"})})}):u?r.jsx(Fr,{title:u.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/templates",children:[r.jsx(Wi,{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:u.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.category&&r.jsx(At,{variant:"secondary",children:u.category.name}),u.type&&r.jsx(At,{variant:"outline",children:u.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(Q,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/templates?edit=${u.id}`,children:[r.jsx(Qa,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(D3,{resourceType:"template",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(Q,{variant:k?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(Bd,{className:`h-4 w-4 ${k?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.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:u.description}})]}),r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Oo,{className:"h-4 w-4"}),u.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:u.links.map(T=>r.jsxs(Q,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",u.id,u.name,"click_canva"),window.open(T.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:T.title}),r.jsx(Ss,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),u.video_url&&r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:u.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),u.guides&&u.guides.length>0&&r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(_a,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:u.guides.map(T=>r.jsxs(Q,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",u.id,u.name,"click_pdf"),window.open(T.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_a,{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(so,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(Od,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:I,className:"flex gap-2",children:[r.jsx(Zn,{placeholder:"Add a comment...",value:l,onChange:T=>i(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||v.isPending,children:r.jsx(Ji,{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(He,{children:r.jsx(et,{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(He,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ea,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(ta,{className:"text-sm",children:M(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:bu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(t==null?void 0:t.id)&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(T.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Fr,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Oo,{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(Q,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/templates",children:"Back to Templates"})})]})})},kjt=()=>{const{user:e}=tn(),[t,n]=A.useState(""),[s,a]=A.useState("all"),{data:o=[]}=Zt({queryKey:["academy-categories"],queryFn:async()=>{const{data:v,error:b}=await Y.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(b)throw b;return v}}),{data:l=[],isLoading:i}=Zt({queryKey:["academy-videos"],queryFn:async()=>{const{data:v,error:b}=await Y.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(b)throw b;const{data:N,error:k}=await Y.from("academy_resources").select("*").order("sort_order");if(k)throw k;return v.map(I=>({...I,resources:(N==null?void 0:N.filter(T=>T.video_id===I.id))||[]}))}}),{data:u=[]}=Zt({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:v,error:b}=await Y.from("academy_video_likes").select("video_id, user_id");if(b)throw b;return v}}),m=l.filter(v=>{var k;const b=t===""||v.title.toLowerCase().includes(t.toLowerCase())||((k=v.description)==null?void 0:k.toLowerCase().includes(t.toLowerCase())),N=s==="all"||v.category_id===s;return b&&N}),x=v=>u.filter(b=>b.video_id===v).length,y=v=>u.some(b=>b.video_id===v&&b.user_id===(e==null?void 0:e.id));return r.jsx(Fr,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search videos...",value:t,onChange:v=>n(v.target.value),className:"pl-10"})]})}),r.jsx(wi,{value:s,onValueChange:a,children:r.jsxs(_i,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(sn,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(v=>r.jsx(sn,{value:v.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:v.name},v.id))]})}),i?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"})}):m.length===0?r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Ia,{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:m.map(v=>r.jsx(co,{to:`/academy/${v.id}`,children:r.jsxs(He,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[r.jsxs("div",{className:"relative aspect-video bg-muted",children:[v.thumbnail_url?r.jsx("img",{src:v.thumbnail_url,alt:v.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Ia,{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(Vl,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),v.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(Xa,{className:"h-3 w-3"}),v.duration]})]}),r.jsxs(Ht,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Gt,{className:"text-lg line-clamp-2",children:v.title})}),v.category&&r.jsx(At,{variant:"secondary",className:"w-fit",children:v.category.name})]}),r.jsxs(et,{className:"pt-0",children:[v.description&&r.jsx(jn,{className:"line-clamp-2",children:v.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(Bd,{className:`h-4 w-4 ${y(v.id)?"fill-primary text-primary":""}`}),x(v.id)]}),v.resources&&v.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(_a,{className:"h-4 w-4"}),v.resources.length]})]})]})]})},v.id))})]})})};function h9e({resourceType:e,resourceId:t}){const{data:n=[]}=Zt({queryKey:["linked-templates",e,t],queryFn:async()=>{if(e==="academy_video"){const{data:s,error:a}=await Y.from("academy_video_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("video_id",t);if(a)throw a;return(s||[]).map(o=>o.canva_templates).filter(Boolean)}else{const{data:s,error:a}=await Y.from("resource_kit_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("kit_id",t);if(a)throw a;return(s||[]).map(o=>o.canva_templates).filter(Boolean)}},enabled:!!t});return n.length===0?null:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-sm",children:[r.jsx(Vc,{className:"h-4 w-4"}),"Related Templates"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(s=>r.jsx(co,{to:`/templates/${s.id}`,children:r.jsxs(At,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 transition-colors gap-1.5 px-3 py-1.5 text-xs font-medium rounded-full",children:[r.jsx(Vc,{className:"h-3 w-3"}),s.name]})},s.id))})]})}const Njt=(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},Sjt=()=>{const{videoId:e}=Ec();Vn();const{user:t,isAdmin:n}=tn(),{toast:s}=fi(),a=Vr(),{trackEngagement:o}=fP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Zt({queryKey:["academy-video",e],queryFn:async()=>{const{data:P,error:F}=await Y.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",e).eq("is_published",!0).single();if(F)throw F;const{data:D}=await Y.from("academy_resources").select("*").eq("video_id",e).order("sort_order");return{...P,resources:D||[]}},enabled:!!e});A.useEffect(()=>{u&&o("academy_video",u.id,u.title,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Zt({queryKey:["academy-video-likes",e],queryFn:async()=>{const{data:P,error:F}=await Y.from("academy_video_likes").select("*").eq("video_id",e);if(F)throw F;return P},enabled:!!e}),{data:y=[]}=Zt({queryKey:["academy-video-comments",e],queryFn:async()=>{const{data:P,error:F}=await Y.from("academy_video_comments").select("*").eq("video_id",e).order("created_at",{ascending:!1});if(F)throw F;const D=[...new Set(P.map(W=>W.user_id))],{data:U}=await Y.from("profiles").select("id, name").in("id",D),V=new Map((U==null?void 0:U.map(W=>[W.id,W.name]))||[]);return P.map(W=>({...W,user_name:V.get(W.user_id)||"Unknown User"}))},enabled:!!e}),v=ar({mutationFn:async P=>{const{error:F}=await Y.from("academy_video_comments").insert({video_id:e,user_id:t.id,content:P});if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",e]}),i(""),s({title:"Comment added!"})},onError:P=>{s({title:"Error adding comment",description:P.message,variant:"destructive"})}}),b=ar({mutationFn:async P=>{const{error:F}=await Y.from("academy_video_comments").delete().eq("id",P);if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",e]}),s({title:"Comment deleted"})}}),N=ar({mutationFn:async()=>{const P=x.find(F=>F.user_id===(t==null?void 0:t.id));if(P){const{error:F}=await Y.from("academy_video_likes").delete().eq("id",P.id);if(F)throw F}else{const{error:F}=await Y.from("academy_video_likes").insert({video_id:e,user_id:t.id});if(F)throw F}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-likes",e]})}}),k=x.some(P=>P.user_id===(t==null?void 0:t.id)),M=P=>{switch(P==null?void 0:P.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},I=P=>P.split(" ").map(F=>F[0]).join("").toUpperCase().slice(0,2),T=P=>{P.preventDefault(),!(!l.trim()||!t)&&v.mutate(l.trim())};return m?r.jsx(Fr,{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"})})}):u?r.jsx(Fr,{title:u.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/academy",children:[r.jsx(Wi,{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(u.video_type)?r.jsx("iframe",{src:Njt(u.video_url,u.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(Ia,{className:"h-16 w-16 opacity-50"}),r.jsx(Q,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:u.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Ss,{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:u.title}),u.category&&r.jsx(At,{variant:"secondary",children:u.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsx(Q,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/academy?edit=${u.id}`,children:[r.jsx(Qa,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(D3,{resourceType:"academy_video",resourceId:u.id,resourceTitle:u.title}),r.jsxs(Q,{variant:k?"default":"outline",className:"gap-2 w-fit",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(Bd,{className:`h-4 w-4 ${k?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:u.description}})]}),u.resources&&u.resources.length>0&&r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(_a,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:u.resources.map(P=>r.jsxs("a",{href:P.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:M(P.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:P.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:P.file_type})]}),r.jsx(so,{className:"h-4 w-4 text-muted-foreground"})]},P.id))})]})}),r.jsx(h9e,{resourceType:"academy_video",resourceId:u.id}),r.jsx(Od,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(Zn,{placeholder:"Add a comment...",value:l,onChange:P=>i(P.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||v.isPending,children:r.jsx(Ji,{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(He,{children:r.jsx(et,{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(P=>r.jsx(He,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ea,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(ta,{className:"text-sm",children:I(P.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:P.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:bu(new Date(P.created_at),{addSuffix:!0})}),P.user_id===(t==null?void 0:t.id)&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(P.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:P.content})]})]})})},P.id))})]})]})}):r.jsx(Fr,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Ia,{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(Q,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/academy",children:"Back to Academy"})})]})})};function Cjt(){const e=Vn(),[t,n]=A.useState(""),{data:s,isLoading:a}=Zt({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:b,error:N}=await Y.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(N)throw N;return b}}),{data:o}=Zt({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:b,error:N}=await Y.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(N)throw N;return b}}),{data:l}=Zt({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:b,error:N}=await Y.from("resource_kit_likes").select("kit_id");if(N)throw N;return b}}),{data:i}=Zt({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:b,error:N}=await Y.from("resource_kit_comments").select("kit_id");if(N)throw N;return b}}),u=s==null?void 0:s.filter(b=>{var N;return b.name.toLowerCase().includes(t.toLowerCase())||((N=b.description)==null?void 0:N.toLowerCase().includes(t.toLowerCase()))}),m=b=>(o==null?void 0:o.filter(N=>N.kit_id===b))||[],x=b=>(l==null?void 0:l.filter(N=>N.kit_id===b).length)||0,y=b=>(i==null?void 0:i.filter(N=>N.kit_id===b).length)||0,v=b=>{e(`/toolbox/${b}`)};return r.jsx(Fr,{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(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search resource kits...",value:t,onChange:b=>n(b.target.value),className:"pl-10"})]}),!a&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(u==null?void 0:u.length)||0," resource kit",(u==null?void 0:u.length)!==1?"s":""," available"]}),a?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((b,N)=>r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Er,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Er,{className:"h-5 w-3/4 mb-2"}),r.jsx(Er,{className:"h-4 w-full mb-4"}),r.jsx(Er,{className:"h-4 w-2/3"})]})},N))}):(u==null?void 0:u.length)===0?r.jsxs(He,{className:"p-12 text-center",children:[r.jsx(ql,{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:u==null?void 0:u.map(b=>{const N=m(b.id).length,k=x(b.id),M=y(b.id);return r.jsxs(He,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>v(b.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:b.featured_image_url?r.jsx("img",{src:b.featured_image_url,alt:b.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(ql,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:b.name}),b.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:xse(b.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(_a,{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(Bd,{className:"h-3.5 w-3.5"}),k]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),M]})]})]})]})]},b.id)})})]})})}const Mjt=()=>{const{kitId:e}=Ec(),{user:t,isAdmin:n}=tn(),{toast:s}=fi(),a=Vr(),{trackEngagement:o}=fP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Zt({queryKey:["resource-kit-detail",e],queryFn:async()=>{const{data:P,error:F}=await Y.from("resource_kits").select("*").eq("id",e).eq("is_published",!0).single();if(F)throw F;const{data:D}=await Y.from("resource_kit_files").select("*").eq("kit_id",e).order("sort_order"),{data:U}=await Y.from("resource_kit_links").select("*").eq("kit_id",e).order("sort_order");return{...P,files:D||[],links:U||[]}},enabled:!!e});A.useEffect(()=>{u&&o("toolbox",u.id,u.name,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Zt({queryKey:["resource-kit-likes",e],queryFn:async()=>{const{data:P,error:F}=await Y.from("resource_kit_likes").select("*").eq("kit_id",e);if(F)throw F;return P},enabled:!!e}),{data:y=[]}=Zt({queryKey:["resource-kit-comments",e],queryFn:async()=>{const{data:P,error:F}=await Y.from("resource_kit_comments").select("*").eq("kit_id",e).order("created_at",{ascending:!1});if(F)throw F;const D=[...new Set(P.map(W=>W.user_id))],{data:U}=await Y.from("profiles").select("id, name").in("id",D),V=new Map((U==null?void 0:U.map(W=>[W.id,W.name]))||[]);return P.map(W=>({...W,user_name:V.get(W.user_id)||"Unknown User"}))},enabled:!!e}),v=ar({mutationFn:async P=>{const{error:F}=await Y.from("resource_kit_comments").insert({kit_id:e,user_id:t.id,content:P});if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",e]}),i(""),s({title:"Comment added!"})},onError:P=>{s({title:"Error adding comment",description:P.message,variant:"destructive"})}}),b=ar({mutationFn:async P=>{const{error:F}=await Y.from("resource_kit_comments").delete().eq("id",P);if(F)throw F},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",e]}),s({title:"Comment deleted"})}}),N=ar({mutationFn:async()=>{const P=x.find(F=>F.user_id===(t==null?void 0:t.id));if(P){const{error:F}=await Y.from("resource_kit_likes").delete().eq("id",P.id);if(F)throw F}else{const{error:F}=await Y.from("resource_kit_likes").insert({kit_id:e,user_id:t.id});if(F)throw F}},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-likes",e]})}}),k=x.some(P=>P.user_id===(t==null?void 0:t.id)),M=P=>P.split(" ").map(F=>F[0]).join("").toUpperCase().slice(0,2),I=P=>P?P<1024?P+" B":P<1024*1024?(P/1024).toFixed(1)+" KB":(P/(1024*1024)).toFixed(1)+" MB":"",T=P=>{P.preventDefault(),!(!l.trim()||!t)&&v.mutate(l.trim())};return m?r.jsx(Fr,{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"})})}):u?r.jsx(Fr,{title:u.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/toolbox",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Back to Toolbox"]})}),u.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:u.featured_image_url,alt:u.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:u.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(Q,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/toolbox?edit=${u.id}`,children:[r.jsx(Qa,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(D3,{resourceType:"resource_kit",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(Q,{variant:k?"default":"outline",className:"gap-2 rounded-full",onClick:()=>N.mutate(),disabled:!t||N.isPending,children:[r.jsx(Bd,{className:`h-4 w-4 ${k?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:u.description}})]}),u.files&&u.files.length>0&&r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(_a,{className:"h-4 w-4"}),"Included Resources (",u.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:u.files.map(P=>r.jsxs("a",{href:P.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",u.id,u.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(_a,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:P.name}),P.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:I(P.file_size)})]})]}),r.jsx(so,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},P.id))})]})}),u.links&&u.links.length>0&&r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ss,{className:"h-4 w-4"}),"Canva Templates (",u.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:u.links.map(P=>r.jsxs("a",{href:P.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",u.id,u.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(Ss,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:P.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},P.id))})]})}),r.jsx(h9e,{resourceType:"resource_kit",resourceId:u.id}),r.jsx(Od,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(Zn,{placeholder:"Add a comment...",value:l,onChange:P=>i(P.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||v.isPending,children:r.jsx(Ji,{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(He,{children:r.jsx(et,{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(P=>r.jsx(He,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ea,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(ta,{className:"text-sm",children:M(P.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:P.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:bu(new Date(P.created_at),{addSuffix:!0})}),P.user_id===(t==null?void 0:t.id)&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(P.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:P.content})]})]})})},P.id))})]})]})}):r.jsx(Fr,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ql,{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(Q,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Tjt=()=>{const e=Vn(),[t,n]=A.useState(""),[s,a]=A.useState("grid"),{data:o=[],isLoading:l}=Zt({queryKey:["social-swag"],queryFn:async()=>{const{data:m,error:x}=await Y.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:y,error:v}=await Y.from("social_swag_links").select("*").order("sort_order");if(v)throw v;const{data:b}=await Y.from("social_swag_likes").select("swag_id"),{data:N}=await Y.from("social_swag_comments").select("swag_id"),k=new Map;b==null||b.forEach(T=>{k.set(T.swag_id,(k.get(T.swag_id)||0)+1)});const M=new Map;return N==null||N.forEach(T=>{M.set(T.swag_id,(M.get(T.swag_id)||0)+1)}),(m||[]).map(T=>({...T,links:(y||[]).filter(P=>P.swag_id===T.id)||[],likesCount:k.get(T.id)||0,commentsCount:M.get(T.id)||0}))}}),i=o.filter(m=>{var y;return m.title.toLowerCase().includes(t.toLowerCase())||((y=m.description)==null?void 0:y.toLowerCase().includes(t.toLowerCase()))}),u=m=>{e(`/social-swag/${m}`)};return r.jsx(Fr,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search social swag...",value:t,onChange:m=>n(m.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(hf,{className:"h-4 w-4"})}),r.jsx(Q,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," item",i.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((m,x)=>r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Er,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Er,{className:"h-5 w-3/4 mb-2"}),r.jsx(Er,{className:"h-4 w-full mb-4"})]})},x))}),!l&&i.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(Q,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&i.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:i.map(m=>r.jsxs(He,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>u(m.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[m.preview_image_url?r.jsx("img",{src:m.preview_image_url,alt:m.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"}),m.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(At,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(Oo,{className:"h-3 w-3"}),m.links.length]})})]}),r.jsxs(et,{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:m.title}),m.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:m.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(Bd,{className:"h-3.5 w-3.5"}),m.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),m.commentsCount]})]}),r.jsxs(Q,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),u(m.id)},children:[r.jsx(Ss,{className:"h-4 w-4"}),"View Details"]})]})]},m.id))})]})})};var Ba=function(){return Ba=Object.assign||function(t){for(var n,s=1,a=arguments.length;s1&&(u||!m),y=t>1&&(m||!u),v=function(){s&&o(s)},b=function(){a&&o(a)};return r.jsx(lkt,{displayMonth:e.displayMonth,hideNext:x,hidePrevious:y,nextMonth:a,previousMonth:s,onPreviousClick:v,onNextClick:b})}function ckt(e){var t,n=cl(),s=n.classNames,a=n.disableNavigation,o=n.styles,l=n.captionLayout,i=n.components,u=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:p9e,m;return a?m=r.jsx(u,{id:e.id,displayMonth:e.displayMonth}):l==="dropdown"?m=r.jsx(F4e,{displayMonth:e.displayMonth,id:e.id}):l==="dropdown-buttons"?m=r.jsxs(r.Fragment,{children:[r.jsx(F4e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),r.jsx(z4e,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):m=r.jsxs(r.Fragment,{children:[r.jsx(u,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(z4e,{displayMonth:e.displayMonth,id:e.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:m})}function dkt(e){var t=cl(),n=t.footer,s=t.styles,a=t.classNames.tfoot;return n?r.jsx("tfoot",{className:a,style:s.tfoot,children:r.jsx("tr",{children:r.jsx("td",{colSpan:8,children:n})})}):r.jsx(r.Fragment,{})}function ukt(e,t,n){for(var s=n?Ey(new Date):Nm(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var l=Ql(s,o);a.push(l)}return a}function hkt(){var e=cl(),t=e.classNames,n=e.styles,s=e.showWeekNumber,a=e.locale,o=e.weekStartsOn,l=e.ISOWeek,i=e.formatters.formatWeekdayName,u=e.labels.labelWeekday,m=ukt(a,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}),m.map(function(x,y){return r.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":u(x,{locale:a}),children:i(x,{locale:a})},y)})]})}function mkt(){var e,t=cl(),n=t.classNames,s=t.styles,a=t.components,o=(e=a==null?void 0:a.HeadRow)!==null&&e!==void 0?e:hkt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function fkt(e){var t=cl(),n=t.locale,s=t.formatters.formatDay;return r.jsx(r.Fragment,{children:s(e.date,{locale:n})})}var M0e=A.createContext(void 0);function pkt(e){if(!pP(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return r.jsx(M0e.Provider,{value:t,children:e.children})}return r.jsx(gkt,{initialProps:e.initialProps,children:e.children})}function gkt(e){var t=e.initialProps,n=e.children,s=t.selected,a=t.min,o=t.max,l=function(m,x,y){var v,b;(v=t.onDayClick)===null||v===void 0||v.call(t,m,x,y);var N=!!(x.selected&&a&&(s==null?void 0:s.length)===a);if(!N){var k=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!k){var M=s?m9e([],s):[];if(x.selected){var I=M.findIndex(function(T){return ac(m,T)});M.splice(I,1)}else M.push(m);(b=t.onSelect)===null||b===void 0||b.call(t,M,m,x,y)}}},i={disabled:[]};s&&i.disabled.push(function(m){var x=o&&s.length>o-1,y=s.some(function(v){return ac(v,m)});return!!(x&&!y)});var u={selected:s,onDayClick:l,modifiers:i};return r.jsx(M0e.Provider,{value:u,children:n})}function T0e(){var e=A.useContext(M0e);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function xkt(e,t){var n=t||{},s=n.from,a=n.to;return s&&a?ac(a,e)&&ac(s,e)?void 0:ac(a,e)?{from:a,to:void 0}:ac(s,e)?void 0:tre(s,e)?{from:e,to:a}:{from:s,to:e}:a?tre(e,a)?{from:a,to:e}:{from:e,to:a}:s?sae(e,s)?{from:e,to:s}:{from:s,to:e}:{from:e,to:void 0}}var A0e=A.createContext(void 0);function ykt(e){if(!gP(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(A0e.Provider,{value:t,children:e.children})}return r.jsx(vkt,{initialProps:e.initialProps,children:e.children})}function vkt(e){var t=e.initialProps,n=e.children,s=t.selected,a=s||{},o=a.from,l=a.to,i=t.min,u=t.max,m=function(b,N,k){var M,I;(M=t.onDayClick)===null||M===void 0||M.call(t,b,N,k);var T=xkt(b,s);(I=t.onSelect)===null||I===void 0||I.call(t,T,b,N,k)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],l?(x.range_end=[l],ac(o,l)||(x.range_middle=[{after:o,before:l}])):x.range_end=[o]):l&&(x.range_start=[l],x.range_end=[l]),i&&(o&&!l&&x.disabled.push({after:qce(o,i-1),before:Ql(o,i-1)}),o&&l&&x.disabled.push({after:o,before:Ql(o,i-1)}),!o&&l&&x.disabled.push({after:qce(l,i-1),before:Ql(l,i-1)})),u){if(o&&!l&&(x.disabled.push({before:Ql(o,-u+1)}),x.disabled.push({after:Ql(o,u-1)})),o&&l){var y=jp(l,o)+1,v=u-y;x.disabled.push({before:qce(o,v)}),x.disabled.push({after:Ql(l,v)})}!o&&l&&(x.disabled.push({before:Ql(l,-u+1)}),x.disabled.push({after:Ql(l,u-1)}))}return r.jsx(A0e.Provider,{value:{selected:s,onDayClick:m,modifiers:x},children:n})}function E0e(){var e=A.useContext(A0e);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Qee(e){return Array.isArray(e)?m9e([],e):e!==void 0?[e]:[]}function _kt(e){var t={};return Object.entries(e).forEach(function(n){var s=n[0],a=n[1];t[s]=Qee(a)}),t}var zp;(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"})(zp||(zp={}));var bkt=zp.Selected,Fx=zp.Disabled,wkt=zp.Hidden,jkt=zp.Today,kde=zp.RangeEnd,Nde=zp.RangeMiddle,Sde=zp.RangeStart,kkt=zp.Outside;function Nkt(e,t,n){var s,a=(s={},s[bkt]=Qee(e.selected),s[Fx]=Qee(e.disabled),s[wkt]=Qee(e.hidden),s[jkt]=[e.today],s[kde]=[],s[Nde]=[],s[Sde]=[],s[kkt]=[],s);return e.fromDate&&a[Fx].push({before:e.fromDate}),e.toDate&&a[Fx].push({after:e.toDate}),pP(e)?a[Fx]=a[Fx].concat(t.modifiers[Fx]):gP(e)&&(a[Fx]=a[Fx].concat(n.modifiers[Fx]),a[Sde]=n.modifiers[Sde],a[Nde]=n.modifiers[Nde],a[kde]=n.modifiers[kde]),a}var y9e=A.createContext(void 0);function Skt(e){var t=cl(),n=T0e(),s=E0e(),a=Nkt(t,n,s),o=_kt(t.modifiers),l=Ba(Ba({},a),o);return r.jsx(y9e.Provider,{value:l,children:e.children})}function v9e(){var e=A.useContext(y9e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Ckt(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function Mkt(e){return!!(e&&typeof e=="object"&&"from"in e)}function Tkt(e){return!!(e&&typeof e=="object"&&"after"in e)}function Akt(e){return!!(e&&typeof e=="object"&&"before"in e)}function Ekt(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Ikt(e,t){var n,s=t.from,a=t.to;if(s&&a){var o=jp(a,s)<0;o&&(n=[a,s],s=n[0],a=n[1]);var l=jp(e,s)>=0&&jp(a,e)>=0;return l}return a?ac(a,e):s?ac(s,e):!1}function Pkt(e){return yye(e)}function Lkt(e){return Array.isArray(e)&&e.every(yye)}function Okt(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(Pkt(n))return ac(e,n);if(Lkt(n))return n.includes(e);if(Mkt(n))return Ikt(e,n);if(Ekt(n))return n.dayOfWeek.includes(e.getDay());if(Ckt(n)){var s=jp(n.before,e),a=jp(n.after,e),o=s>0,l=a<0,i=tre(n.before,n.after);return i?l&&o:o||l}return Tkt(n)?jp(e,n.after)>0:Akt(n)?jp(n.before,e)>0:typeof n=="function"?n(e):!1})}function I0e(e,t,n){var s=Object.keys(t).reduce(function(o,l){var i=t[l];return Okt(e,i)&&o.push(l),o},[]),a={};return s.forEach(function(o){return a[o]=!0}),n&&!Sye(e,n)&&(a.outside=!0),a}function Dkt(e,t){for(var n=Dh(e[0]),s=rae(e[e.length-1]),a,o,l=n;l<=s;){var i=I0e(l,t),u=!i.disabled&&!i.hidden;if(!u){l=Ql(l,1);continue}if(i.selected)return l;i.today&&!o&&(o=l),a||(a=l),l=Ql(l,1)}return o||a}var Rkt=365;function _9e(e,t){var n=t.moveBy,s=t.direction,a=t.context,o=t.modifiers,l=t.retry,i=l===void 0?{count:0,lastFocused:e}:l,u=a.weekStartsOn,m=a.fromDate,x=a.toDate,y=a.locale,v={day:Ql,week:oj,month:Fh,year:nht,startOfWeek:function(M){return a.ISOWeek?Ey(M):Nm(M,{locale:y,weekStartsOn:u})},endOfWeek:function(M){return a.ISOWeek?NDe(M):vye(M,{locale:y,weekStartsOn:u})}},b=v[n](e,s==="after"?1:-1);s==="before"&&m?b=sht([m,b]):s==="after"&&x&&(b=aht([x,b]));var N=!0;if(o){var k=I0e(b,o);N=!k.disabled&&!k.hidden}return N?b:i.count>Rkt?i.lastFocused:_9e(b,{moveBy:n,direction:s,context:a,modifiers:o,retry:Ba(Ba({},i),{count:i.count+1})})}var b9e=A.createContext(void 0);function Fkt(e){var t=xP(),n=v9e(),s=A.useState(),a=s[0],o=s[1],l=A.useState(),i=l[0],u=l[1],m=Dkt(t.displayMonths,n),x=a??(i&&t.isDateDisplayed(i))?i:m,y=function(){u(a),o(void 0)},v=function(M){o(M)},b=cl(),N=function(M,I){if(a){var T=_9e(a,{moveBy:M,direction:I,context:b,modifiers:n});ac(a,T)||(t.goToDate(T,a),v(T))}},k={focusedDay:a,focusTarget:x,blur:y,focus:v,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(b9e.Provider,{value:k,children:e.children})}function P0e(){var e=A.useContext(b9e);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function zkt(e,t){var n=v9e(),s=I0e(e,n,t);return s}var L0e=A.createContext(void 0);function Bkt(e){if(!Eae(e.initialProps)){var t={selected:void 0};return r.jsx(L0e.Provider,{value:t,children:e.children})}return r.jsx($kt,{initialProps:e.initialProps,children:e.children})}function $kt(e){var t=e.initialProps,n=e.children,s=function(o,l,i){var u,m,x;if((u=t.onDayClick)===null||u===void 0||u.call(t,o,l,i),l.selected&&!t.required){(m=t.onSelect)===null||m===void 0||m.call(t,void 0,o,l,i);return}(x=t.onSelect)===null||x===void 0||x.call(t,o,o,l,i)},a={selected:t.selected,onDayClick:s};return r.jsx(L0e.Provider,{value:a,children:n})}function w9e(){var e=A.useContext(L0e);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Ukt(e,t){var n=cl(),s=w9e(),a=T0e(),o=E0e(),l=P0e(),i=l.focusDayAfter,u=l.focusDayBefore,m=l.focusWeekAfter,x=l.focusWeekBefore,y=l.blur,v=l.focus,b=l.focusMonthBefore,N=l.focusMonthAfter,k=l.focusYearBefore,M=l.focusYearAfter,I=l.focusStartOfWeek,T=l.focusEndOfWeek,P=function(me){var ue,xe,Te,_e;Eae(n)?(ue=s.onDayClick)===null||ue===void 0||ue.call(s,e,t,me):pP(n)?(xe=a.onDayClick)===null||xe===void 0||xe.call(a,e,t,me):gP(n)?(Te=o.onDayClick)===null||Te===void 0||Te.call(o,e,t,me):(_e=n.onDayClick)===null||_e===void 0||_e.call(n,e,t,me)},F=function(me){var ue;v(e),(ue=n.onDayFocus)===null||ue===void 0||ue.call(n,e,t,me)},D=function(me){var ue;y(),(ue=n.onDayBlur)===null||ue===void 0||ue.call(n,e,t,me)},U=function(me){var ue;(ue=n.onDayMouseEnter)===null||ue===void 0||ue.call(n,e,t,me)},V=function(me){var ue;(ue=n.onDayMouseLeave)===null||ue===void 0||ue.call(n,e,t,me)},W=function(me){var ue;(ue=n.onDayPointerEnter)===null||ue===void 0||ue.call(n,e,t,me)},G=function(me){var ue;(ue=n.onDayPointerLeave)===null||ue===void 0||ue.call(n,e,t,me)},ee=function(me){var ue;(ue=n.onDayTouchCancel)===null||ue===void 0||ue.call(n,e,t,me)},ae=function(me){var ue;(ue=n.onDayTouchEnd)===null||ue===void 0||ue.call(n,e,t,me)},oe=function(me){var ue;(ue=n.onDayTouchMove)===null||ue===void 0||ue.call(n,e,t,me)},pe=function(me){var ue;(ue=n.onDayTouchStart)===null||ue===void 0||ue.call(n,e,t,me)},ne=function(me){var ue;(ue=n.onDayKeyUp)===null||ue===void 0||ue.call(n,e,t,me)},fe=function(me){var ue;switch(me.key){case"ArrowLeft":me.preventDefault(),me.stopPropagation(),n.dir==="rtl"?i():u();break;case"ArrowRight":me.preventDefault(),me.stopPropagation(),n.dir==="rtl"?u():i();break;case"ArrowDown":me.preventDefault(),me.stopPropagation(),m();break;case"ArrowUp":me.preventDefault(),me.stopPropagation(),x();break;case"PageUp":me.preventDefault(),me.stopPropagation(),me.shiftKey?k():b();break;case"PageDown":me.preventDefault(),me.stopPropagation(),me.shiftKey?M():N();break;case"Home":me.preventDefault(),me.stopPropagation(),I();break;case"End":me.preventDefault(),me.stopPropagation(),T();break}(ue=n.onDayKeyDown)===null||ue===void 0||ue.call(n,e,t,me)},se={onClick:P,onFocus:F,onBlur:D,onKeyDown:fe,onKeyUp:ne,onMouseEnter:U,onMouseLeave:V,onPointerEnter:W,onPointerLeave:G,onTouchCancel:ee,onTouchEnd:ae,onTouchMove:oe,onTouchStart:pe};return se}function qkt(){var e=cl(),t=w9e(),n=T0e(),s=E0e(),a=Eae(e)?t.selected:pP(e)?n.selected:gP(e)?s.selected:void 0;return a}function Vkt(e){return Object.values(zp).includes(e)}function Hkt(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(s){var a=e.modifiersClassNames[s];if(a)n.push(a);else if(Vkt(s)){var o=e.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Wkt(e,t){var n=Ba({},e.styles.day);return Object.keys(t).forEach(function(s){var a;n=Ba(Ba({},n),(a=e.modifiersStyles)===null||a===void 0?void 0:a[s])}),n}function Gkt(e,t,n){var s,a,o,l=cl(),i=P0e(),u=zkt(e,t),m=Ukt(e,u),x=qkt(),y=!!(l.onDayClick||l.mode!=="default");A.useEffect(function(){var U;u.outside||i.focusedDay&&y&&ac(i.focusedDay,e)&&((U=n.current)===null||U===void 0||U.focus())},[i.focusedDay,e,n,y,u.outside]);var v=Hkt(l,u).join(" "),b=Wkt(l,u),N=!!(u.outside&&!l.showOutsideDays||u.hidden),k=(o=(a=l.components)===null||a===void 0?void 0:a.DayContent)!==null&&o!==void 0?o:fkt,M=r.jsx(k,{date:e,displayMonth:t,activeModifiers:u}),I={style:b,className:v,children:M,role:"gridcell"},T=i.focusTarget&&ac(i.focusTarget,e)&&!u.outside,P=i.focusedDay&&ac(i.focusedDay,e),F=Ba(Ba(Ba({},I),(s={disabled:u.disabled,role:"gridcell"},s["aria-selected"]=u.selected,s.tabIndex=P||T?0:-1,s)),m),D={isButton:y,isHidden:N,activeModifiers:u,selectedDays:x,buttonProps:F,divProps:I};return D}function Kkt(e){var t=A.useRef(null),n=Gkt(e.date,e.displayMonth,t);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(Wre,Ba({name:"day",ref:t},n.buttonProps)):r.jsx("div",Ba({},n.divProps))}function Zkt(e){var t=e.number,n=e.dates,s=cl(),a=s.onWeekNumberClick,o=s.styles,l=s.classNames,i=s.locale,u=s.labels.labelWeekNumber,m=s.formatters.formatWeekNumber,x=m(Number(t),{locale:i});if(!a)return r.jsx("span",{className:l.weeknumber,style:o.weeknumber,children:x});var y=u(Number(t),{locale:i}),v=function(b){a(t,n,b)};return r.jsx(Wre,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:v,children:x})}function Ykt(e){var t,n,s=cl(),a=s.styles,o=s.classNames,l=s.showWeekNumber,i=s.components,u=(t=i==null?void 0:i.Day)!==null&&t!==void 0?t:Kkt,m=(n=i==null?void 0:i.WeekNumber)!==null&&n!==void 0?n:Zkt,x;return l&&(x=r.jsx("td",{className:o.cell,style:a.cell,children:r.jsx(m,{number:e.weekNumber,dates:e.dates})})),r.jsxs("tr",{className:o.row,style:a.row,children:[x,e.dates.map(function(y){return r.jsx("td",{className:o.cell,style:a.cell,role:"presentation",children:r.jsx(u,{displayMonth:e.displayMonth,date:y})},cmt(y))})]})}function B4e(e,t,n){for(var s=n!=null&&n.ISOWeek?NDe(t):vye(t,n),a=n!=null&&n.ISOWeek?Ey(e):Nm(e,n),o=jp(s,a),l=[],i=0;i<=o;i++)l.push(Ql(a,i));var u=l.reduce(function(m,x){var y=n!=null&&n.ISOWeek?_ye(x):wye(x,n),v=m.find(function(b){return b.weekNumber===y});return v?(v.dates.push(x),m):(m.push({weekNumber:y,dates:[x]}),m)},[]);return u}function Xkt(e,t){var n=B4e(Dh(e),rae(e),t);if(t!=null&&t.useFixedWeeks){var s=umt(e,t);if(s<6){var a=n[n.length-1],o=a.dates[a.dates.length-1],l=oj(o,6-s),i=B4e(oj(o,1),l,t);n.push.apply(n,i)}}return n}function Qkt(e){var t,n,s,a=cl(),o=a.locale,l=a.classNames,i=a.styles,u=a.hideHead,m=a.fixedWeeks,x=a.components,y=a.weekStartsOn,v=a.firstWeekContainsDate,b=a.ISOWeek,N=Xkt(e.displayMonth,{useFixedWeeks:!!m,ISOWeek:b,locale:o,weekStartsOn:y,firstWeekContainsDate:v}),k=(t=x==null?void 0:x.Head)!==null&&t!==void 0?t:mkt,M=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Ykt,I=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:dkt;return r.jsxs("table",{id:e.id,className:l.table,style:i.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!u&&r.jsx(k,{}),r.jsx("tbody",{className:l.tbody,style:i.tbody,children:N.map(function(T){return r.jsx(M,{displayMonth:e.displayMonth,dates:T.dates,weekNumber:T.weekNumber},T.weekNumber)})}),r.jsx(I,{displayMonth:e.displayMonth})]})}function Jkt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var eNt=Jkt()?A.useLayoutEffect:A.useEffect,Cde=!1,tNt=0;function $4e(){return"react-day-picker-".concat(++tNt)}function rNt(e){var t,n=e??(Cde?$4e():null),s=A.useState(n),a=s[0],o=s[1];return eNt(function(){a===null&&o($4e())},[]),A.useEffect(function(){Cde===!1&&(Cde=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function nNt(e){var t,n,s=cl(),a=s.dir,o=s.classNames,l=s.styles,i=s.components,u=xP().displayMonths,m=rNt(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],v=l.month,b=e.displayIndex===0,N=e.displayIndex===u.length-1,k=!b&&!N;a==="rtl"&&(t=[b,N],N=t[0],b=t[1]),b&&(y.push(o.caption_start),v=Ba(Ba({},v),l.caption_start)),N&&(y.push(o.caption_end),v=Ba(Ba({},v),l.caption_end)),k&&(y.push(o.caption_between),v=Ba(Ba({},v),l.caption_between));var M=(n=i==null?void 0:i.Caption)!==null&&n!==void 0?n:ckt;return r.jsxs("div",{className:y.join(" "),style:v,children:[r.jsx(M,{id:m,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(Qkt,{id:x,"aria-labelledby":m,displayMonth:e.displayMonth})]},e.displayIndex)}function sNt(e){var t=cl(),n=t.classNames,s=t.styles;return r.jsx("div",{className:n.months,style:s.months,children:e.children})}function aNt(e){var t,n,s=e.initialProps,a=cl(),o=P0e(),l=xP(),i=A.useState(!1),u=i[0],m=i[1];A.useEffect(function(){a.initialFocus&&o.focusTarget&&(u||(o.focus(o.focusTarget),m(!0)))},[a.initialFocus,u,o.focus,o.focusTarget,o]);var x=[a.classNames.root,a.className];a.numberOfMonths>1&&x.push(a.classNames.multiple_months),a.showWeekNumber&&x.push(a.classNames.with_weeknumber);var y=Ba(Ba({},a.styles.root),a.style),v=Object.keys(s).filter(function(N){return N.startsWith("data-")}).reduce(function(N,k){var M;return Ba(Ba({},N),(M={},M[k]=s[k],M))},{}),b=(n=(t=s.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:sNt;return r.jsx("div",Ba({className:x.join(" "),style:y,dir:a.dir,id:a.id,nonce:s.nonce,title:s.title,lang:s.lang},v,{children:r.jsx(b,{children:l.displayMonths.map(function(N,k){return r.jsx(nNt,{displayIndex:k,displayMonth:N},k)})})}))}function iNt(e){var t=e.children,n=Ajt(e,["children"]);return r.jsx(Zjt,{initialProps:n,children:r.jsx(akt,{children:r.jsx(Bkt,{initialProps:n,children:r.jsx(pkt,{initialProps:n,children:r.jsx(ykt,{initialProps:n,children:r.jsx(Skt,{children:r.jsx(Fkt,{children:t})})})})})})})}function oNt(e){return r.jsx(iNt,Ba({},e,{children:r.jsx(aNt,{initialProps:e})}))}function Lp({className:e,classNames:t,showOutsideDays:n=!0,...s}){return r.jsx(oNt,{showOutsideDays:n,className:Ut("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:Ut(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:Ut(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:({...a})=>r.jsx(kc,{className:"h-4 w-4"}),IconRight:({...a})=>r.jsx(Gi,{className:"h-4 w-4"})},...s})}Lp.displayName="Calendar";var Iae="Popover",[j9e]=cc(Iae,[ax]),yP=ax(),[lNt,Iv]=j9e(Iae),k9e=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!1}=e,i=yP(t),u=A.useRef(null),[m,x]=A.useState(!1),[y,v]=rh({prop:s,defaultProp:a??!1,onChange:o,caller:Iae});return r.jsx(ZI,{...i,children:r.jsx(lNt,{scope:t,contentId:pd(),triggerRef:u,open:y,onOpenChange:v,onOpenToggle:A.useCallback(()=>v(b=>!b),[v]),hasCustomAnchor:m,onCustomAnchorAdd:A.useCallback(()=>x(!0),[]),onCustomAnchorRemove:A.useCallback(()=>x(!1),[]),modal:l,children:n})})};k9e.displayName=Iae;var N9e="PopoverAnchor",cNt=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Iv(N9e,n),o=yP(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return A.useEffect(()=>(l(),()=>i()),[l,i]),r.jsx(b3,{...o,...s,ref:t})});cNt.displayName=N9e;var S9e="PopoverTrigger",C9e=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Iv(S9e,n),o=yP(n),l=ca(t,a.triggerRef),i=r.jsx(Fn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":I9e(a.open),...s,ref:l,onClick:gn(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:r.jsx(b3,{asChild:!0,...o,children:i})});C9e.displayName=S9e;var O0e="PopoverPortal",[dNt,uNt]=j9e(O0e,{forceMount:void 0}),M9e=e=>{const{__scopePopover:t,forceMount:n,children:s,container:a}=e,o=Iv(O0e,t);return r.jsx(dNt,{scope:t,forceMount:n,children:r.jsx(Ac,{present:n||o.open,children:r.jsx(g3,{asChild:!0,container:a,children:s})})})};M9e.displayName=O0e;var UC="PopoverContent",T9e=A.forwardRef((e,t)=>{const n=uNt(UC,e.__scopePopover),{forceMount:s=n.forceMount,...a}=e,o=Iv(UC,e.__scopePopover);return r.jsx(Ac,{present:s||o.open,children:o.modal?r.jsx(mNt,{...a,ref:t}):r.jsx(fNt,{...a,ref:t})})});T9e.displayName=UC;var hNt=uv("PopoverContent.RemoveScroll"),mNt=A.forwardRef((e,t)=>{const n=Iv(UC,e.__scopePopover),s=A.useRef(null),a=ca(t,s),o=A.useRef(!1);return A.useEffect(()=>{const l=s.current;if(l)return Mse(l)},[]),r.jsx(rP,{as:hNt,allowPinchZoom:!0,children:r.jsx(A9e,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gn(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:gn(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,u=i.button===0&&i.ctrlKey===!0,m=i.button===2||u;o.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:gn(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),fNt=A.forwardRef((e,t)=>{const n=Iv(UC,e.__scopePopover),s=A.useRef(!1),a=A.useRef(!1);return r.jsx(A9e,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var u,m;(u=e.onInteractOutside)==null||u.call(e,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((m=n.triggerRef.current)==null?void 0:m.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),A9e=A.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:m,onInteractOutside:x,...y}=e,v=Iv(UC,n),b=yP(n);return Cse(),r.jsx(eP,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(wv,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:m,onDismiss:()=>v.onOpenChange(!1),children:r.jsx(YI,{"data-state":I9e(v.open),role:"dialog",id:v.contentId,...b,...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)"}})})})}),E9e="PopoverClose",pNt=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Iv(E9e,n);return r.jsx(Fn.button,{type:"button",...s,ref:t,onClick:gn(e.onClick,()=>a.onOpenChange(!1))})});pNt.displayName=E9e;var gNt="PopoverArrow",xNt=A.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=yP(n);return r.jsx(XI,{...a,...s,ref:t})});xNt.displayName=gNt;function I9e(e){return e?"open":"closed"}var yNt=k9e,vNt=C9e,_Nt=M9e,P9e=T9e;const Wc=yNt,Gc=vNt,Tc=A.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(_Nt,{children:r.jsx(P9e,{ref:a,align:t,sideOffset:n,className:Ut("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})}));Tc.displayName=P9e.displayName;const bNt=x3("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"}}),D0e=A.forwardRef(({className:e,variant:t,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:Ut(bNt({variant:t}),e),...n}));D0e.displayName="Alert";const wNt=A.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:Ut("mb-1 font-medium leading-none tracking-tight",e),...t}));wNt.displayName="AlertTitle";const R0e=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Ut("text-sm [&_p]:leading-relaxed",e),...t}));R0e.displayName="AlertDescription";function jNt({open:e,onOpenChange:t,imageUrl:n,imageId:s,defaultCaption:a="",swagItemId:o,reelId:l}){const i=Vr(),[u,m]=A.useState(a),[x,y]=A.useState([]),[v,b]=A.useState(null),[N,k]=A.useState("now"),[M,I]=A.useState(MNe(ONe(new Date),1)),[T,P]=A.useState("12"),[F,D]=A.useState("00"),[U,V]=A.useState("PM");A.useEffect(()=>{if(e){m(a),k("now"),y([]);const ve=MNe(ONe(new Date),1);I(ve);const Xe=ve.getHours();P(String(Xe>12?Xe-12:Xe===0?12:Xe)),D("00"),V(Xe>=12?"PM":"AM")}},[e,a]);const W=()=>{if(!M)return null;let ve=parseInt(T);const Xe=parseInt(F);return U==="PM"&&ve!==12&&(ve+=12),U==="AM"&&ve===12&&(ve=0),LDe(PDe(M,ve),Xe)},{data:G,isLoading:ee}=Zt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:ve}}=await Y.auth.getUser();if(!ve)return[];const{data:Xe,error:Me}=await Y.from("social_accounts").select("*").eq("user_id",ve.id).eq("is_active",!0).order("platform",{ascending:!0});if(Me)throw Me;return console.log("Fetched social accounts for posting:",Xe),Xe},enabled:e,staleTime:0}),ae=ar({mutationFn:async({accountId:ve,platform:Xe})=>{b(ve);const{data:Me,error:Ie}=await Y.functions.invoke("social-post",{body:{platform:Xe,accountId:ve,imageUrl:n,caption:u}});if(Ie)throw Ie;if(Me!=null&&Me.error)throw new Error(Me.error);return Me},onSuccess:ve=>{const Xe=ve.platform==="facebook"?"Facebook":ve.platform==="instagram"?"Instagram":ve.platform==="linkedin"?"LinkedIn":"Google Business";Ae.success(`Posted to ${Xe}!`)},onError:ve=>{Ae.error(`Failed to post: ${ve.message}`)},onSettled:()=>{b(null)}}),oe=ar({mutationFn:async({accountId:ve,platform:Xe,scheduledFor:Me})=>{const{data:{user:Ie}}=await Y.auth.getUser();if(!Ie)throw new Error("Not authenticated");const{error:$e}=await Y.from("scheduled_posts").insert({user_id:Ie.id,social_account_id:ve,platform:Xe,image_url:n,caption:u,swag_item_id:o||null,reel_id:l||null,scheduled_for:Me.toISOString(),status:"scheduled"});if($e)throw $e;return{platform:Xe}},onSuccess:ve=>{const Xe=ve.platform==="facebook"?"Facebook":ve.platform==="instagram"?"Instagram":"LinkedIn";Ae.success(`Post scheduled for ${Xe}!`)},onError:ve=>{Ae.error(`Failed to schedule: ${ve.message}`)}}),pe=async()=>{if(x.length===0){Ae.error("Please select at least one account");return}if(N==="schedule"){const ve=W();if(!ve||ve<=new Date){Ae.error("Please select a future date and time");return}for(const Xe of x){const Me=G==null?void 0:G.find(Ie=>Ie.id===Xe);Me&&await oe.mutateAsync({accountId:Xe,platform:Me.platform,scheduledFor:ve})}i.invalidateQueries({queryKey:["scheduled-posts"]}),Ae.success(`${x.length} post(s) scheduled for ${on(ve,"PPp")}`)}else for(const ve of x){const Xe=G==null?void 0:G.find(Me=>Me.id===ve);Xe&&await ae.mutateAsync({accountId:ve,platform:Xe.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),m(""),y([]),t(!1)},ne=ve=>{y(Xe=>Xe.includes(ve)?Xe.filter(Me=>Me!==ve):[...Xe,ve])},fe=(G==null?void 0:G.filter(ve=>ve.platform==="facebook"))||[],se=(G==null?void 0:G.filter(ve=>ve.platform==="instagram"))||[],me=(G==null?void 0:G.filter(ve=>ve.platform==="linkedin"))||[],ue=(G==null?void 0:G.filter(ve=>ve.platform==="google_business"))||[],xe=((G==null?void 0:G.length)||0)>0,Te=ae.isPending||oe.isPending,_e=Array.from({length:12},(ve,Xe)=>String(Xe+1)),we=["00","15","30","45"];return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Create Social Post"}),r.jsx(Yn,{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(ze,{htmlFor:"caption",children:"Caption"}),r.jsx(Zn,{id:"caption",placeholder:"Write a caption for your post...",value:u,onChange:ve=>m(ve.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[u.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{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:()=>k("now"),className:Ut("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:()=>k("schedule"),className:Ut("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(Xa,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("justify-start text-left font-normal flex-1",!M&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"mr-2 h-4 w-4"}),M?on(M,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:M,onSelect:I,disabled:ve=>ver.jsx($t,{value:ve,children:ve},ve))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(un,{value:F,onValueChange:D,children:[r.jsx(ln,{className:"w-[70px]",children:r.jsx(mn,{})}),r.jsx(cn,{children:we.map(ve=>r.jsx($t,{value:ve,children:ve},ve))})]}),r.jsxs(un,{value:U,onValueChange:ve=>V(ve),children:[r.jsx(ln,{className:"w-[70px]",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"AM",children:"AM"}),r.jsx($t,{value:"PM",children:"PM"})]})]})]})]}),M&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",on(W()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{children:"Post to"}),ee&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin"})}),!ee&&!xe&&r.jsxs(D0e,{children:[r.jsx(yl,{className:"h-4 w-4"}),r.jsxs(R0e,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(co,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(zd,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),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(au,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),fe.map(ve=>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(_l,{checked:x.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:ve.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(au,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ve.page_name||ve.platform_username}),v===ve.id&&r.jsx(Gr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),se.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(_u,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),se.map(ve=>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(_l,{checked:x.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:ve.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(_u,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",ve.platform_username]}),v===ve.id&&r.jsx(Gr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),me.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(xm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),me.map(ve=>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(_l,{checked:x.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:ve.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(xm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ve.platform_username}),v===ve.id&&r.jsx(Gr,{className:"h-4 w-4 animate-spin"})]},ve.id))]}),ue.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(Do,{className:"h-4 w-4 text-red-600"})," Google Business"]}),ue.map(ve=>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(_l,{checked:x.includes(ve.id),onCheckedChange:()=>ne(ve.id),disabled:v===ve.id}),r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:ve.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(Do,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:ve.page_name||ve.platform_username}),v===ve.id&&r.jsx(Gr,{className:"h-4 w-4 animate-spin"})]},ve.id))]})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(Q,{onClick:pe,disabled:x.length===0||Te,className:"gap-2",children:[Te?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):N==="schedule"?r.jsx(Cs,{className:"h-4 w-4"}):r.jsx(Ji,{className:"h-4 w-4"}),N==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}function kNt(){const e=Vr(),[t,n]=A.useState(void 0),[s,a]=A.useState("all"),[o,l]=A.useState(null),[i,u]=A.useState(""),[m,x]=A.useState(void 0),[y,v]=A.useState("12"),[b,N]=A.useState("00"),[k,M]=A.useState("PM"),{data:I=[],isLoading:T}=Zt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:ue,error:xe}=await Y.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(xe)throw xe;return ue}}),P=I.filter(ue=>{if(s!=="all"&&ue.status!==s)return!1;if(t&&ue.scheduled_for){const xe=new Date(ue.scheduled_for);if(!ac(xe,t))return!1}return!0}),F=I.filter(ue=>ue.scheduled_for).map(ue=>Sm(new Date(ue.scheduled_for))),D=ar({mutationFn:async ue=>{const{error:xe}=await Y.from("scheduled_posts").update({caption:ue.caption,scheduled_for:ue.scheduled_for}).eq("id",ue.id);if(xe)throw xe},onSuccess:()=>{Ae.success("Post updated!"),e.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:ue=>{Ae.error(`Failed to update: ${ue.message}`)}}),U=ar({mutationFn:async ue=>{const{error:xe}=await Y.from("scheduled_posts").update({status:"cancelled"}).eq("id",ue);if(xe)throw xe},onSuccess:()=>{Ae.success("Post cancelled"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{Ae.error(`Failed to cancel: ${ue.message}`)}}),V=ar({mutationFn:async ue=>{const{error:xe}=await Y.from("scheduled_posts").delete().eq("id",ue);if(xe)throw xe},onSuccess:()=>{Ae.success("Post deleted"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{Ae.error(`Failed to delete: ${ue.message}`)}}),W=ar({mutationFn:async ue=>{const{data:xe,error:Te}=await Y.functions.invoke("social-post",{body:{platform:ue.platform,accountId:ue.social_account_id,imageUrl:ue.image_url,caption:ue.caption}});if(Te)throw Te;if(xe!=null&&xe.error)throw new Error(xe.error);return await Y.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:xe.postId}).eq("id",ue.id),xe},onSuccess:ue=>{const xe=ue.platform==="facebook"?"Facebook":ue.platform==="instagram"?"Instagram":"LinkedIn";Ae.success(`Posted to ${xe}!`),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{Ae.error(`Failed to post: ${ue.message}`)}}),G=ue=>{if(l(ue),u(ue.caption||""),ue.scheduled_for){const xe=new Date(ue.scheduled_for);x(xe);const Te=xe.getHours();v(String(Te>12?Te-12:Te===0?12:Te)),N(String(xe.getMinutes()).padStart(2,"0")),M(Te>=12?"PM":"AM")}},ee=()=>{if(!o||!m)return;let ue=parseInt(y);const xe=parseInt(b);k==="PM"&&ue!==12&&(ue+=12),k==="AM"&&ue===12&&(ue=0);const Te=LDe(PDe(m,ue),xe);D.mutate({id:o.id,caption:i,scheduled_for:Te.toISOString()})},ae=ue=>{switch(ue){case"facebook":return r.jsx(au,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(_u,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(xm,{className:"h-4 w-4 text-blue-700"});default:return null}},oe=ue=>{switch(ue){case"scheduled":return r.jsxs(At,{variant:"secondary",className:"gap-1",children:[r.jsx(Xa,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(At,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(oi,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(At,{variant:"destructive",className:"gap-1",children:[r.jsx(bc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(At,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(yl,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(At,{variant:"outline",children:ue})}},pe=Array.from({length:12},(ue,xe)=>String(xe+1)),ne=["00","15","30","45"],fe=I.filter(ue=>ue.status==="scheduled").length,se=I.filter(ue=>ue.status==="posted").length,me=I.filter(ue=>ue.status==="scheduled"&&ue.scheduled_for&&hmt(new Date(ue.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(He,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:fe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(He,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:me}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(He,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:se}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),r.jsxs(He,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:I.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(He,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Tp,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Lp,{mode:"single",selected:t,onSelect:n,className:Ut("pointer-events-auto"),modifiers:{hasPost:F},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),t&&r.jsx(Q,{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(H1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(ue=>r.jsx(Q,{variant:s===ue?"default":"outline",size:"sm",onClick:()=>a(ue),className:"capitalize",children:ue},ue))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!T&&P.length===0&&r.jsxs(He,{className:"p-8 text-center",children:[r.jsx(Cs,{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 ${on(t,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:P.map(ue=>{var xe,Te;return r.jsx(He,{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:ue.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(et,{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(ue.platform),r.jsx("span",{className:"font-medium",children:((xe=ue.social_accounts)==null?void 0:xe.page_name)||((Te=ue.social_accounts)==null?void 0:Te.platform_username)||"Unknown"}),oe(ue.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[ue.status==="scheduled"&&r.jsxs(QI,{children:[r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>G(ue),children:r.jsx(Qa,{className:"h-4 w-4"})})}),r.jsx(Pp,{children:"Edit post"})]}),r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>W.mutate(ue),disabled:W.isPending,children:W.isPending?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ji,{className:"h-4 w-4"})})}),r.jsx(Pp,{children:"Post now"})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Cancel this scheduled post?"}),r.jsx(hd,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Keep"}),r.jsx(Uc,{onClick:()=>U.mutate(ue.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Uc,{onClick:()=>V.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(ue.status==="posted"||ue.status==="cancelled"||ue.status==="failed")&&r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Delete this post?"}),r.jsx(hd,{children:"This will permanently remove this post from your history."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>V.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),ue.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:ue.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Xa,{className:"h-3 w-3"}),ue.status==="posted"&&ue.posted_at?`Posted ${on(new Date(ue.posted_at),"PPp")}`:ue.scheduled_for?`Scheduled for ${on(new Date(ue.scheduled_for),"PPp")}`:"Not scheduled"]}),ue.status==="failed"&&ue.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",ue.error_message]})]})]})},ue.id)})})]})]}),r.jsx(Rr,{open:!!o,onOpenChange:ue=>!ue&&l(null),children:r.jsxs(Dr,{className:"max-w-lg",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Edit Scheduled Post"}),r.jsx(Yn,{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(ze,{children:"Caption"}),r.jsx(Zn,{value:i,onChange:ue=>u(ue.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(ze,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("justify-start text-left font-normal flex-1",!m&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"mr-2 h-4 w-4"}),m?on(m,"PPP"):"Pick a date"]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:m,onSelect:x,disabled:ue=>uer.jsx($t,{value:ue,children:ue},ue))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(un,{value:b,onValueChange:N,children:[r.jsx(ln,{className:"w-[70px]",children:r.jsx(mn,{})}),r.jsx(cn,{children:ne.map(ue=>r.jsx($t,{value:ue,children:ue},ue))})]}),r.jsxs(un,{value:k,onValueChange:ue=>M(ue),children:[r.jsx(ln,{className:"w-[70px]",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"AM",children:"AM"}),r.jsx($t,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(Q,{onClick:ee,disabled:D.isPending,children:[D.isPending?r.jsx(Gr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function wO(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 L9e={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,a,o){function l(m,x){if(!a[m]){if(!s[m]){var y=typeof wO=="function"&&wO;if(!x&&y)return y(m,!0);if(i)return i(m,!0);var v=new Error("Cannot find module '"+m+"'");throw v.code="MODULE_NOT_FOUND",v}var b=a[m]={exports:{}};s[m][0].call(b.exports,function(N){var k=s[m][1][N];return l(k||N)},b,b.exports,n,s,a,o)}return a[m].exports}for(var i=typeof wO=="function"&&wO,u=0;u>2,b=(3&m)<<4|x>>4,N=1>6:64,k=2>4,x=(15&v)<<4|(b=i.indexOf(u.charAt(k++)))>>2,y=(3&b)<<6|(N=i.indexOf(u.charAt(k++))),T[M++]=m,b!==64&&(T[M++]=x),N!==64&&(T[M++]=y);return T}},{"./support":30,"./utils":32}],2:[function(n,s,a){var o=n("./external"),l=n("./stream/DataWorker"),i=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function m(x,y,v,b,N){this.compressedSize=x,this.uncompressedSize=y,this.crc32=v,this.compression=b,this.compressedContent=N}m.prototype={getContentWorker:function(){var x=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("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)}},m.createWorkerFrom=function(x,y,v){return x.pipe(new i).pipe(new u("uncompressedSize")).pipe(y.compressWorker(v)).pipe(new u("compressedSize")).withStreamInfo("compression",y)},s.exports=m},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,a){var o=n("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},a.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,a){var o=n("./utils"),l=function(){for(var i,u=[],m=0;m<256;m++){i=m;for(var x=0;x<8;x++)i=1&i?3988292384^i>>>1:i>>>1;u[m]=i}return u}();s.exports=function(i,u){return i!==void 0&&i.length?o.getTypeOf(i)!=="string"?function(m,x,y,v){var b=l,N=v+y;m^=-1;for(var k=v;k>>8^b[255&(m^x[k])];return-1^m}(0|u,i,i.length,0):function(m,x,y,v){var b=l,N=v+y;m^=-1;for(var k=v;k>>8^b[255&(m^x.charCodeAt(k))];return-1^m}(0|u,i,i.length,0):0}},{"./utils":32}],5:[function(n,s,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(n,s,a){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,a){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),i=n("./utils"),u=n("./stream/GenericWorker"),m=o?"uint8array":"array";function x(y,v){u.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=v,this.meta={}}a.magic="\b\0",i.inherits(x,u),x.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(m,y.data),!1)},x.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){u.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(v){y.push({data:v,meta:y.meta})}},a.compressWorker=function(y){return new x("Deflate",y)},a.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,a){function o(b,N){var k,M="";for(k=0;k>>=8;return M}function l(b,N,k,M,I,T){var P,F,D=b.file,U=b.compression,V=T!==m.utf8encode,W=i.transformTo("string",T(D.name)),G=i.transformTo("string",m.utf8encode(D.name)),ee=D.comment,ae=i.transformTo("string",T(ee)),oe=i.transformTo("string",m.utf8encode(ee)),pe=G.length!==D.name.length,ne=oe.length!==ee.length,fe="",se="",me="",ue=D.dir,xe=D.date,Te={crc32:0,compressedSize:0,uncompressedSize:0};N&&!k||(Te.crc32=b.crc32,Te.compressedSize=b.compressedSize,Te.uncompressedSize=b.uncompressedSize);var _e=0;N&&(_e|=8),V||!pe&&!ne||(_e|=2048);var we=0,ve=0;ue&&(we|=16),I==="UNIX"?(ve=798,we|=function(Me,Ie){var $e=Me;return Me||($e=Ie?16893:33204),(65535&$e)<<16}(D.unixPermissions,ue)):(ve=20,we|=function(Me){return 63&(Me||0)}(D.dosPermissions)),P=xe.getUTCHours(),P<<=6,P|=xe.getUTCMinutes(),P<<=5,P|=xe.getUTCSeconds()/2,F=xe.getUTCFullYear()-1980,F<<=4,F|=xe.getUTCMonth()+1,F<<=5,F|=xe.getUTCDate(),pe&&(se=o(1,1)+o(x(W),4)+G,fe+="up"+o(se.length,2)+se),ne&&(me=o(1,1)+o(x(ae),4)+oe,fe+="uc"+o(me.length,2)+me);var Xe="";return Xe+=` \0`,Xe+=o(_e,2),Xe+=U.magic,Xe+=o(P,2),Xe+=o(F,2),Xe+=o(Te.crc32,4),Xe+=o(Te.compressedSize,4),Xe+=o(Te.uncompressedSize,4),Xe+=o(W.length,2),Xe+=o(fe.length,2),{fileRecord:y.LOCAL_FILE_HEADER+Xe+W+fe,dirRecord:y.CENTRAL_FILE_HEADER+o(ve,2)+Xe+o(ae.length,2)+"\0\0\0\0"+o(we,4)+o(M,4)+W+fe+ae}}var i=n("../utils"),u=n("../stream/GenericWorker"),m=n("../utf8"),x=n("../crc32"),y=n("../signature");function v(b,N,k,M){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=N,this.zipPlatform=k,this.encodeFileName=M,this.streamFiles=b,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(v,u),v.prototype.push=function(b){var N=b.meta.percent||0,k=this.entriesCount,M=this._sources.length;this.accumulate?this.contentBuffer.push(b):(this.bytesWritten+=b.data.length,u.prototype.push.call(this,{data:b.data,meta:{currentFile:this.currentFile,percent:k?(N+100*(k-M-1))/k:100}}))},v.prototype.openedSource=function(b){this.currentSourceOffset=this.bytesWritten,this.currentFile=b.file.name;var N=this.streamFiles&&!b.file.dir;if(N){var k=l(b,N,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:k.fileRecord,meta:{percent:0}})}else this.accumulate=!0},v.prototype.closedSource=function(b){this.accumulate=!1;var N=this.streamFiles&&!b.file.dir,k=l(b,N,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(k.dirRecord),N)this.push({data:function(M){return y.DATA_DESCRIPTOR+o(M.crc32,4)+o(M.compressedSize,4)+o(M.uncompressedSize,4)}(b),meta:{percent:100}});else for(this.push({data:k.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},v.prototype.flush=function(){for(var b=this.bytesWritten,N=0;N=this.index;u--)m=(m<<8)+this.byteAt(u);return this.index+=i,m},readString:function(i){return o.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},s.exports=l},{"../utils":32}],19:[function(n,s,a){var o=n("./Uint8ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){this.checkOffset(i);var u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},s.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,a){var o=n("./DataReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},l.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},l.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},l.prototype.readData=function(i){this.checkOffset(i);var u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},s.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,s,a){var o=n("./ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},s.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,a){var o=n("../utils"),l=n("../support"),i=n("./ArrayReader"),u=n("./StringReader"),m=n("./NodeBufferReader"),x=n("./Uint8ArrayReader");s.exports=function(y){var v=o.getTypeOf(y);return o.checkSupport(v),v!=="string"||l.uint8array?v==="nodebuffer"?new m(y):l.uint8array?new x(o.transformTo("uint8array",y)):new i(o.transformTo("array",y)):new u(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,a){var o=n("./GenericWorker"),l=n("../utils");function i(u){o.call(this,"ConvertWorker to "+u),this.destType=u}l.inherits(i,o),i.prototype.processChunk=function(u){this.push({data:l.transformTo(this.destType,u.data),meta:u.meta})},s.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,a){var o=n("./GenericWorker"),l=n("../crc32");function i(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(i,o),i.prototype.processChunk=function(u){this.streamInfo.crc32=l(u.data,this.streamInfo.crc32||0),this.push(u)},s.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(u){l.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}o.inherits(i,l),i.prototype.processChunk=function(u){if(u){var m=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=m+u.data.length}l.prototype.processChunk.call(this,u)},s.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(u){l.call(this,"DataWorker");var m=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(x){m.dataIsReady=!0,m.data=x,m.max=x&&x.length||0,m.type=o.getTypeOf(x),m.isPaused||m._tickAndRepeat()},function(x){m.error(x)})}o.inherits(i,l),i.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,m=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,m);break;case"uint8array":u=this.data.subarray(this.index,m);break;case"array":case"nodebuffer":u=this.data.slice(this.index,m)}return this.index=m,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,a){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,i){return this._listeners[l].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,i){if(this._listeners[l])for(var u=0;u "+l:l}},s.exports=o},{}],29:[function(n,s,a){var o=n("../utils"),l=n("./ConvertWorker"),i=n("./GenericWorker"),u=n("../base64"),m=n("../support"),x=n("../external"),y=null;if(m.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function v(N,k){return new x.Promise(function(M,I){var T=[],P=N._internalType,F=N._outputType,D=N._mimeType;N.on("data",function(U,V){T.push(U),k&&k(V)}).on("error",function(U){T=[],I(U)}).on("end",function(){try{var U=function(V,W,G){switch(V){case"blob":return o.newBlob(o.transformTo("arraybuffer",W),G);case"base64":return u.encode(W);default:return o.transformTo(V,W)}}(F,function(V,W){var G,ee=0,ae=null,oe=0;for(G=0;G"u")a.blob=!1;else{var o=new ArrayBuffer(0);try{a.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),a.blob=l.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!n("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,a){for(var o=n("./utils"),l=n("./support"),i=n("./nodejsUtils"),u=n("./stream/GenericWorker"),m=new Array(256),x=0;x<256;x++)m[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;m[254]=m[254]=1;function y(){u.call(this,"utf-8 decode"),this.leftOver=null}function v(){u.call(this,"utf-8 encode")}a.utf8encode=function(b){return l.nodebuffer?i.newBufferFrom(b,"utf-8"):function(N){var k,M,I,T,P,F=N.length,D=0;for(T=0;T>>6:(M<65536?k[P++]=224|M>>>12:(k[P++]=240|M>>>18,k[P++]=128|M>>>12&63),k[P++]=128|M>>>6&63),k[P++]=128|63&M);return k}(b)},a.utf8decode=function(b){return l.nodebuffer?o.transformTo("nodebuffer",b).toString("utf-8"):function(N){var k,M,I,T,P=N.length,F=new Array(2*P);for(k=M=0;k>10&1023,F[M++]=56320|1023&I)}return F.length!==M&&(F.subarray?F=F.subarray(0,M):F.length=M),o.applyFromCharCode(F)}(b=o.transformTo(l.uint8array?"uint8array":"array",b))},o.inherits(y,u),y.prototype.processChunk=function(b){var N=o.transformTo(l.uint8array?"uint8array":"array",b.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var k=N;(N=new Uint8Array(k.length+this.leftOver.length)).set(this.leftOver,0),N.set(k,this.leftOver.length)}else N=this.leftOver.concat(N);this.leftOver=null}var M=function(T,P){var F;for((P=P||T.length)>T.length&&(P=T.length),F=P-1;0<=F&&(192&T[F])==128;)F--;return F<0||F===0?P:F+m[T[F]]>P?F:P}(N),I=N;M!==N.length&&(l.uint8array?(I=N.subarray(0,M),this.leftOver=N.subarray(M,N.length)):(I=N.slice(0,M),this.leftOver=N.slice(M,N.length))),this.push({data:a.utf8decode(I),meta:b.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=y,o.inherits(v,u),v.prototype.processChunk=function(b){this.push({data:a.utf8encode(b.data),meta:b.meta})},a.Utf8EncodeWorker=v},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,a){var o=n("./support"),l=n("./base64"),i=n("./nodejsUtils"),u=n("./external");function m(k){return k}function x(k,M){for(var I=0;I>8;this.dir=!!(16&this.externalFileAttributes),b==0&&(this.dosPermissions=63&this.externalFileAttributes),b==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var b=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=b.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=b.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=b.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=b.readInt(4))}},readExtraFields:function(b){var N,k,M,I=b.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});b.index+4>>6:(b<65536?v[M++]=224|b>>>12:(v[M++]=240|b>>>18,v[M++]=128|b>>>12&63),v[M++]=128|b>>>6&63),v[M++]=128|63&b);return v},a.buf2binstring=function(y){return x(y,y.length)},a.binstring2buf=function(y){for(var v=new o.Buf8(y.length),b=0,N=v.length;b>10&1023,T[N++]=56320|1023&k)}return x(T,N)},a.utf8border=function(y,v){var b;for((v=v||y.length)>y.length&&(v=y.length),b=v-1;0<=b&&(192&y[b])==128;)b--;return b<0||b===0?v:b+u[y[b]]>v?b:v}},{"./common":41}],43:[function(n,s,a){s.exports=function(o,l,i,u){for(var m=65535&o|0,x=o>>>16&65535|0,y=0;i!==0;){for(i-=y=2e3>>1:l>>>1;i[u]=l}return i}();s.exports=function(l,i,u,m){var x=o,y=m+u;l^=-1;for(var v=m;v>>8^x[255&(l^i[v])];return-1^l}},{}],46:[function(n,s,a){var o,l=n("../utils/common"),i=n("./trees"),u=n("./adler32"),m=n("./crc32"),x=n("./messages"),y=0,v=4,b=0,N=-2,k=-1,M=4,I=2,T=8,P=9,F=286,D=30,U=19,V=2*F+1,W=15,G=3,ee=258,ae=ee+G+1,oe=42,pe=113,ne=1,fe=2,se=3,me=4;function ue(le,qe){return le.msg=x[qe],qe}function xe(le){return(le<<1)-(4le.avail_out&&(Je=le.avail_out),Je!==0&&(l.arraySet(le.output,qe.pending_buf,qe.pending_out,Je,le.next_out),le.next_out+=Je,qe.pending_out+=Je,le.total_out+=Je,le.avail_out-=Je,qe.pending-=Je,qe.pending===0&&(qe.pending_out=0))}function we(le,qe){i._tr_flush_block(le,0<=le.block_start?le.block_start:-1,le.strstart-le.block_start,qe),le.block_start=le.strstart,_e(le.strm)}function ve(le,qe){le.pending_buf[le.pending++]=qe}function Xe(le,qe){le.pending_buf[le.pending++]=qe>>>8&255,le.pending_buf[le.pending++]=255&qe}function Me(le,qe){var Je,st,je=le.max_chain_length,ut=le.strstart,Ce=le.prev_length,Ee=le.nice_match,Ze=le.strstart>le.w_size-ae?le.strstart-(le.w_size-ae):0,Le=le.window,Ke=le.w_mask,tt=le.prev,ct=le.strstart+ee,it=Le[ut+Ce-1],zt=Le[ut+Ce];le.prev_length>=le.good_match&&(je>>=2),Ee>le.lookahead&&(Ee=le.lookahead);do if(Le[(Je=qe)+Ce]===zt&&Le[Je+Ce-1]===it&&Le[Je]===Le[ut]&&Le[++Je]===Le[ut+1]){ut+=2,Je++;do;while(Le[++ut]===Le[++Je]&&Le[++ut]===Le[++Je]&&Le[++ut]===Le[++Je]&&Le[++ut]===Le[++Je]&&Le[++ut]===Le[++Je]&&Le[++ut]===Le[++Je]&&Le[++ut]===Le[++Je]&&Le[++ut]===Le[++Je]&&utZe&&--je!=0);return Ce<=le.lookahead?Ce:le.lookahead}function Ie(le){var qe,Je,st,je,ut,Ce,Ee,Ze,Le,Ke,tt=le.w_size;do{if(je=le.window_size-le.lookahead-le.strstart,le.strstart>=tt+(tt-ae)){for(l.arraySet(le.window,le.window,tt,tt,0),le.match_start-=tt,le.strstart-=tt,le.block_start-=tt,qe=Je=le.hash_size;st=le.head[--qe],le.head[qe]=tt<=st?st-tt:0,--Je;);for(qe=Je=tt;st=le.prev[--qe],le.prev[qe]=tt<=st?st-tt:0,--Je;);je+=tt}if(le.strm.avail_in===0)break;if(Ce=le.strm,Ee=le.window,Ze=le.strstart+le.lookahead,Le=je,Ke=void 0,Ke=Ce.avail_in,Le=G)for(ut=le.strstart-le.insert,le.ins_h=le.window[ut],le.ins_h=(le.ins_h<=G&&(le.ins_h=(le.ins_h<=G)if(st=i._tr_tally(le,le.strstart-le.match_start,le.match_length-G),le.lookahead-=le.match_length,le.match_length<=le.max_lazy_match&&le.lookahead>=G){for(le.match_length--;le.strstart++,le.ins_h=(le.ins_h<=G&&(le.ins_h=(le.ins_h<=G&&le.match_length<=le.prev_length){for(je=le.strstart+le.lookahead-G,st=i._tr_tally(le,le.strstart-1-le.prev_match,le.prev_length-G),le.lookahead-=le.prev_length-1,le.prev_length-=2;++le.strstart<=je&&(le.ins_h=(le.ins_h<le.pending_buf_size-5&&(Je=le.pending_buf_size-5);;){if(le.lookahead<=1){if(Ie(le),le.lookahead===0&&qe===y)return ne;if(le.lookahead===0)break}le.strstart+=le.lookahead,le.lookahead=0;var st=le.block_start+Je;if((le.strstart===0||le.strstart>=st)&&(le.lookahead=le.strstart-st,le.strstart=st,we(le,!1),le.strm.avail_out===0)||le.strstart-le.block_start>=le.w_size-ae&&(we(le,!1),le.strm.avail_out===0))return ne}return le.insert=0,qe===v?(we(le,!0),le.strm.avail_out===0?se:me):(le.strstart>le.block_start&&(we(le,!1),le.strm.avail_out),ne)}),new Ve(4,4,8,4,$e),new Ve(4,5,16,8,$e),new Ve(4,6,32,32,$e),new Ve(4,4,16,16,Be),new Ve(8,16,32,32,Be),new Ve(8,16,128,128,Be),new Ve(8,32,128,256,Be),new Ve(32,128,258,1024,Be),new Ve(32,258,258,4096,Be)],a.deflateInit=function(le,qe){return at(le,qe,T,15,8,0)},a.deflateInit2=at,a.deflateReset=Oe,a.deflateResetKeep=Tt,a.deflateSetHeader=function(le,qe){return le&&le.state?le.state.wrap!==2?N:(le.state.gzhead=qe,b):N},a.deflate=function(le,qe){var Je,st,je,ut;if(!le||!le.state||5>8&255),ve(st,st.gzhead.time>>16&255),ve(st,st.gzhead.time>>24&255),ve(st,st.level===9?2:2<=st.strategy||st.level<2?4:0),ve(st,255&st.gzhead.os),st.gzhead.extra&&st.gzhead.extra.length&&(ve(st,255&st.gzhead.extra.length),ve(st,st.gzhead.extra.length>>8&255)),st.gzhead.hcrc&&(le.adler=m(le.adler,st.pending_buf,st.pending,0)),st.gzindex=0,st.status=69):(ve(st,0),ve(st,0),ve(st,0),ve(st,0),ve(st,0),ve(st,st.level===9?2:2<=st.strategy||st.level<2?4:0),ve(st,3),st.status=pe);else{var Ce=T+(st.w_bits-8<<4)<<8;Ce|=(2<=st.strategy||st.level<2?0:st.level<6?1:st.level===6?2:3)<<6,st.strstart!==0&&(Ce|=32),Ce+=31-Ce%31,st.status=pe,Xe(st,Ce),st.strstart!==0&&(Xe(st,le.adler>>>16),Xe(st,65535&le.adler)),le.adler=1}if(st.status===69)if(st.gzhead.extra){for(je=st.pending;st.gzindex<(65535&st.gzhead.extra.length)&&(st.pending!==st.pending_buf_size||(st.gzhead.hcrc&&st.pending>je&&(le.adler=m(le.adler,st.pending_buf,st.pending-je,je)),_e(le),je=st.pending,st.pending!==st.pending_buf_size));)ve(st,255&st.gzhead.extra[st.gzindex]),st.gzindex++;st.gzhead.hcrc&&st.pending>je&&(le.adler=m(le.adler,st.pending_buf,st.pending-je,je)),st.gzindex===st.gzhead.extra.length&&(st.gzindex=0,st.status=73)}else st.status=73;if(st.status===73)if(st.gzhead.name){je=st.pending;do{if(st.pending===st.pending_buf_size&&(st.gzhead.hcrc&&st.pending>je&&(le.adler=m(le.adler,st.pending_buf,st.pending-je,je)),_e(le),je=st.pending,st.pending===st.pending_buf_size)){ut=1;break}ut=st.gzindexje&&(le.adler=m(le.adler,st.pending_buf,st.pending-je,je)),ut===0&&(st.gzindex=0,st.status=91)}else st.status=91;if(st.status===91)if(st.gzhead.comment){je=st.pending;do{if(st.pending===st.pending_buf_size&&(st.gzhead.hcrc&&st.pending>je&&(le.adler=m(le.adler,st.pending_buf,st.pending-je,je)),_e(le),je=st.pending,st.pending===st.pending_buf_size)){ut=1;break}ut=st.gzindexje&&(le.adler=m(le.adler,st.pending_buf,st.pending-je,je)),ut===0&&(st.status=103)}else st.status=103;if(st.status===103&&(st.gzhead.hcrc?(st.pending+2>st.pending_buf_size&&_e(le),st.pending+2<=st.pending_buf_size&&(ve(st,255&le.adler),ve(st,le.adler>>8&255),le.adler=0,st.status=pe)):st.status=pe),st.pending!==0){if(_e(le),le.avail_out===0)return st.last_flush=-1,b}else if(le.avail_in===0&&xe(qe)<=xe(Je)&&qe!==v)return ue(le,-5);if(st.status===666&&le.avail_in!==0)return ue(le,-5);if(le.avail_in!==0||st.lookahead!==0||qe!==y&&st.status!==666){var Ee=st.strategy===2?function(Ze,Le){for(var Ke;;){if(Ze.lookahead===0&&(Ie(Ze),Ze.lookahead===0)){if(Le===y)return ne;break}if(Ze.match_length=0,Ke=i._tr_tally(Ze,0,Ze.window[Ze.strstart]),Ze.lookahead--,Ze.strstart++,Ke&&(we(Ze,!1),Ze.strm.avail_out===0))return ne}return Ze.insert=0,Le===v?(we(Ze,!0),Ze.strm.avail_out===0?se:me):Ze.last_lit&&(we(Ze,!1),Ze.strm.avail_out===0)?ne:fe}(st,qe):st.strategy===3?function(Ze,Le){for(var Ke,tt,ct,it,zt=Ze.window;;){if(Ze.lookahead<=ee){if(Ie(Ze),Ze.lookahead<=ee&&Le===y)return ne;if(Ze.lookahead===0)break}if(Ze.match_length=0,Ze.lookahead>=G&&0Ze.lookahead&&(Ze.match_length=Ze.lookahead)}if(Ze.match_length>=G?(Ke=i._tr_tally(Ze,1,Ze.match_length-G),Ze.lookahead-=Ze.match_length,Ze.strstart+=Ze.match_length,Ze.match_length=0):(Ke=i._tr_tally(Ze,0,Ze.window[Ze.strstart]),Ze.lookahead--,Ze.strstart++),Ke&&(we(Ze,!1),Ze.strm.avail_out===0))return ne}return Ze.insert=0,Le===v?(we(Ze,!0),Ze.strm.avail_out===0?se:me):Ze.last_lit&&(we(Ze,!1),Ze.strm.avail_out===0)?ne:fe}(st,qe):o[st.level].func(st,qe);if(Ee!==se&&Ee!==me||(st.status=666),Ee===ne||Ee===se)return le.avail_out===0&&(st.last_flush=-1),b;if(Ee===fe&&(qe===1?i._tr_align(st):qe!==5&&(i._tr_stored_block(st,0,0,!1),qe===3&&(Te(st.head),st.lookahead===0&&(st.strstart=0,st.block_start=0,st.insert=0))),_e(le),le.avail_out===0))return st.last_flush=-1,b}return qe!==v?b:st.wrap<=0?1:(st.wrap===2?(ve(st,255&le.adler),ve(st,le.adler>>8&255),ve(st,le.adler>>16&255),ve(st,le.adler>>24&255),ve(st,255&le.total_in),ve(st,le.total_in>>8&255),ve(st,le.total_in>>16&255),ve(st,le.total_in>>24&255)):(Xe(st,le.adler>>>16),Xe(st,65535&le.adler)),_e(le),0=Je.w_size&&(ut===0&&(Te(Je.head),Je.strstart=0,Je.block_start=0,Je.insert=0),Le=new l.Buf8(Je.w_size),l.arraySet(Le,qe,Ke-Je.w_size,Je.w_size,0),qe=Le,Ke=Je.w_size),Ce=le.avail_in,Ee=le.next_in,Ze=le.input,le.avail_in=Ke,le.next_in=0,le.input=qe,Ie(Je);Je.lookahead>=G;){for(st=Je.strstart,je=Je.lookahead-(G-1);Je.ins_h=(Je.ins_h<>>=G=W>>>24,P-=G,(G=W>>>16&255)===0)fe[x++]=65535&W;else{if(!(16&G)){if(!(64&G)){W=F[(65535&W)+(T&(1<>>=G,P-=G),P<15&&(T+=ne[u++]<>>=G=W>>>24,P-=G,!(16&(G=W>>>16&255))){if(!(64&G)){W=D[(65535&W)+(T&(1<>>=G,P-=G,(G=x-y)>3,T&=(1<<(P-=ee<<3))-1,o.next_in=u,o.next_out=x,o.avail_in=u>>24&255)+(oe>>>8&65280)+((65280&oe)<<8)+((255&oe)<<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 P(oe){var pe;return oe&&oe.state?(pe=oe.state,oe.total_in=oe.total_out=pe.total=0,oe.msg="",pe.wrap&&(oe.adler=1&pe.wrap),pe.mode=N,pe.last=0,pe.havedict=0,pe.dmax=32768,pe.head=null,pe.hold=0,pe.bits=0,pe.lencode=pe.lendyn=new o.Buf32(k),pe.distcode=pe.distdyn=new o.Buf32(M),pe.sane=1,pe.back=-1,v):b}function F(oe){var pe;return oe&&oe.state?((pe=oe.state).wsize=0,pe.whave=0,pe.wnext=0,P(oe)):b}function D(oe,pe){var ne,fe;return oe&&oe.state?(fe=oe.state,pe<0?(ne=0,pe=-pe):(ne=1+(pe>>4),pe<48&&(pe&=15)),pe&&(pe<8||15=me.wsize?(o.arraySet(me.window,pe,ne-me.wsize,me.wsize,0),me.wnext=0,me.whave=me.wsize):(fe<(se=me.wsize-me.wnext)&&(se=fe),o.arraySet(me.window,pe,ne-fe,se,me.wnext),(fe-=se)?(o.arraySet(me.window,pe,ne-fe,fe,0),me.wnext=fe,me.whave=me.wsize):(me.wnext+=se,me.wnext===me.wsize&&(me.wnext=0),me.whave>>8&255,ne.check=i(ne.check,ut,2,0),we=_e=0,ne.mode=2;break}if(ne.flags=0,ne.head&&(ne.head.done=!1),!(1&ne.wrap)||(((255&_e)<<8)+(_e>>8))%31){oe.msg="incorrect header check",ne.mode=30;break}if((15&_e)!=8){oe.msg="unknown compression method",ne.mode=30;break}if(we-=4,le=8+(15&(_e>>>=4)),ne.wbits===0)ne.wbits=le;else if(le>ne.wbits){oe.msg="invalid window size",ne.mode=30;break}ne.dmax=1<>8&1),512&ne.flags&&(ut[0]=255&_e,ut[1]=_e>>>8&255,ne.check=i(ne.check,ut,2,0)),we=_e=0,ne.mode=3;case 3:for(;we<32;){if(xe===0)break e;xe--,_e+=fe[me++]<>>8&255,ut[2]=_e>>>16&255,ut[3]=_e>>>24&255,ne.check=i(ne.check,ut,4,0)),we=_e=0,ne.mode=4;case 4:for(;we<16;){if(xe===0)break e;xe--,_e+=fe[me++]<>8),512&ne.flags&&(ut[0]=255&_e,ut[1]=_e>>>8&255,ne.check=i(ne.check,ut,2,0)),we=_e=0,ne.mode=5;case 5:if(1024&ne.flags){for(;we<16;){if(xe===0)break e;xe--,_e+=fe[me++]<>>8&255,ne.check=i(ne.check,ut,2,0)),we=_e=0}else ne.head&&(ne.head.extra=null);ne.mode=6;case 6:if(1024&ne.flags&&(xe<(Me=ne.length)&&(Me=xe),Me&&(ne.head&&(le=ne.head.extra_len-ne.length,ne.head.extra||(ne.head.extra=new Array(ne.head.extra_len)),o.arraySet(ne.head.extra,fe,me,Me,le)),512&ne.flags&&(ne.check=i(ne.check,fe,Me,me)),xe-=Me,me+=Me,ne.length-=Me),ne.length))break e;ne.length=0,ne.mode=7;case 7:if(2048&ne.flags){if(xe===0)break e;for(Me=0;le=fe[me+Me++],ne.head&&le&&ne.length<65536&&(ne.head.name+=String.fromCharCode(le)),le&&Me>9&1,ne.head.done=!0),oe.adler=ne.check=0,ne.mode=12;break;case 10:for(;we<32;){if(xe===0)break e;xe--,_e+=fe[me++]<>>=7&we,we-=7&we,ne.mode=27;break}for(;we<3;){if(xe===0)break e;xe--,_e+=fe[me++]<>>=1)){case 0:ne.mode=14;break;case 1:if(ee(ne),ne.mode=20,pe!==6)break;_e>>>=2,we-=2;break e;case 2:ne.mode=17;break;case 3:oe.msg="invalid block type",ne.mode=30}_e>>>=2,we-=2;break;case 14:for(_e>>>=7&we,we-=7&we;we<32;){if(xe===0)break e;xe--,_e+=fe[me++]<>>16^65535)){oe.msg="invalid stored block lengths",ne.mode=30;break}if(ne.length=65535&_e,we=_e=0,ne.mode=15,pe===6)break e;case 15:ne.mode=16;case 16:if(Me=ne.length){if(xe>>=5,we-=5,ne.ndist=1+(31&_e),_e>>>=5,we-=5,ne.ncode=4+(15&_e),_e>>>=4,we-=4,286>>=3,we-=3}for(;ne.have<19;)ne.lens[Ce[ne.have++]]=0;if(ne.lencode=ne.lendyn,ne.lenbits=7,Je={bits:ne.lenbits},qe=m(0,ne.lens,0,19,ne.lencode,0,ne.work,Je),ne.lenbits=Je.bits,qe){oe.msg="invalid code lengths set",ne.mode=30;break}ne.have=0,ne.mode=19;case 19:for(;ne.have>>16&255,ot=65535&je,!((Be=je>>>24)<=we);){if(xe===0)break e;xe--,_e+=fe[me++]<>>=Be,we-=Be,ne.lens[ne.have++]=ot;else{if(ot===16){for(st=Be+2;we>>=Be,we-=Be,ne.have===0){oe.msg="invalid bit length repeat",ne.mode=30;break}le=ne.lens[ne.have-1],Me=3+(3&_e),_e>>>=2,we-=2}else if(ot===17){for(st=Be+3;we>>=Be)),_e>>>=3,we-=3}else{for(st=Be+7;we>>=Be)),_e>>>=7,we-=7}if(ne.have+Me>ne.nlen+ne.ndist){oe.msg="invalid bit length repeat",ne.mode=30;break}for(;Me--;)ne.lens[ne.have++]=le}}if(ne.mode===30)break;if(ne.lens[256]===0){oe.msg="invalid code -- missing end-of-block",ne.mode=30;break}if(ne.lenbits=9,Je={bits:ne.lenbits},qe=m(x,ne.lens,0,ne.nlen,ne.lencode,0,ne.work,Je),ne.lenbits=Je.bits,qe){oe.msg="invalid literal/lengths set",ne.mode=30;break}if(ne.distbits=6,ne.distcode=ne.distdyn,Je={bits:ne.distbits},qe=m(y,ne.lens,ne.nlen,ne.ndist,ne.distcode,0,ne.work,Je),ne.distbits=Je.bits,qe){oe.msg="invalid distances set",ne.mode=30;break}if(ne.mode=20,pe===6)break e;case 20:ne.mode=21;case 21:if(6<=xe&&258<=Te){oe.next_out=ue,oe.avail_out=Te,oe.next_in=me,oe.avail_in=xe,ne.hold=_e,ne.bits=we,u(oe,Xe),ue=oe.next_out,se=oe.output,Te=oe.avail_out,me=oe.next_in,fe=oe.input,xe=oe.avail_in,_e=ne.hold,we=ne.bits,ne.mode===12&&(ne.back=-1);break}for(ne.back=0;Ve=(je=ne.lencode[_e&(1<>>16&255,ot=65535&je,!((Be=je>>>24)<=we);){if(xe===0)break e;xe--,_e+=fe[me++]<>Tt)])>>>16&255,ot=65535&je,!(Tt+(Be=je>>>24)<=we);){if(xe===0)break e;xe--,_e+=fe[me++]<>>=Tt,we-=Tt,ne.back+=Tt}if(_e>>>=Be,we-=Be,ne.back+=Be,ne.length=ot,Ve===0){ne.mode=26;break}if(32&Ve){ne.back=-1,ne.mode=12;break}if(64&Ve){oe.msg="invalid literal/length code",ne.mode=30;break}ne.extra=15&Ve,ne.mode=22;case 22:if(ne.extra){for(st=ne.extra;we>>=ne.extra,we-=ne.extra,ne.back+=ne.extra}ne.was=ne.length,ne.mode=23;case 23:for(;Ve=(je=ne.distcode[_e&(1<>>16&255,ot=65535&je,!((Be=je>>>24)<=we);){if(xe===0)break e;xe--,_e+=fe[me++]<>Tt)])>>>16&255,ot=65535&je,!(Tt+(Be=je>>>24)<=we);){if(xe===0)break e;xe--,_e+=fe[me++]<>>=Tt,we-=Tt,ne.back+=Tt}if(_e>>>=Be,we-=Be,ne.back+=Be,64&Ve){oe.msg="invalid distance code",ne.mode=30;break}ne.offset=ot,ne.extra=15&Ve,ne.mode=24;case 24:if(ne.extra){for(st=ne.extra;we>>=ne.extra,we-=ne.extra,ne.back+=ne.extra}if(ne.offset>ne.dmax){oe.msg="invalid distance too far back",ne.mode=30;break}ne.mode=25;case 25:if(Te===0)break e;if(Me=Xe-Te,ne.offset>Me){if((Me=ne.offset-Me)>ne.whave&&ne.sane){oe.msg="invalid distance too far back",ne.mode=30;break}Ie=Me>ne.wnext?(Me-=ne.wnext,ne.wsize-Me):ne.wnext-Me,Me>ne.length&&(Me=ne.length),$e=ne.window}else $e=se,Ie=ue-ne.offset,Me=ne.length;for(TeV?(G=Ie[$e+M[pe]],we[ve+M[pe]]):(G=96,0),T=1<>ue)+(P-=T)]=W<<24|G<<16|ee|0,P!==0;);for(T=1<>=1;if(T!==0?(_e&=T-1,_e+=T):_e=0,pe++,--Xe[oe]==0){if(oe===fe)break;oe=y[v+M[pe]]}if(se>>7)]}function ve(je,ut){je.pending_buf[je.pending++]=255&ut,je.pending_buf[je.pending++]=ut>>>8&255}function Xe(je,ut,Ce){je.bi_valid>I-Ce?(je.bi_buf|=ut<>I-je.bi_valid,je.bi_valid+=Ce-I):(je.bi_buf|=ut<>>=1,Ce<<=1,0<--ut;);return Ce>>>1}function $e(je,ut,Ce){var Ee,Ze,Le=new Array(M+1),Ke=0;for(Ee=1;Ee<=M;Ee++)Le[Ee]=Ke=Ke+Ce[Ee-1]<<1;for(Ze=0;Ze<=ut;Ze++){var tt=je[2*Ze+1];tt!==0&&(je[2*Ze]=Ie(Le[tt]++,tt))}}function Be(je){var ut;for(ut=0;ut>1;1<=Ce;Ce--)Tt(je,Le,Ce);for(Ze=ct;Ce=je.heap[1],je.heap[1]=je.heap[je.heap_len--],Tt(je,Le,1),Ee=je.heap[1],je.heap[--je.heap_max]=Ce,je.heap[--je.heap_max]=Ee,Le[2*Ze]=Le[2*Ce]+Le[2*Ee],je.depth[Ze]=(je.depth[Ce]>=je.depth[Ee]?je.depth[Ce]:je.depth[Ee])+1,Le[2*Ce+1]=Le[2*Ee+1]=Ze,je.heap[1]=Ze++,Tt(je,Le,1),2<=je.heap_len;);je.heap[--je.heap_max]=je.heap[1],function(zt,Lt){var lr,Ar,Mr,Zr,Xn,dr,En=Lt.dyn_tree,Es=Lt.max_code,Hs=Lt.stat_desc.static_tree,Ei=Lt.stat_desc.has_stree,Ii=Lt.stat_desc.extra_bits,Ho=Lt.stat_desc.extra_base,Ha=Lt.stat_desc.max_length,us=0;for(Zr=0;Zr<=M;Zr++)zt.bl_count[Zr]=0;for(En[2*zt.heap[zt.heap_max]+1]=0,lr=zt.heap_max+1;lr>=7;Ze>>=1)if(1&it&&tt.dyn_ltree[2*ct]!==0)return l;if(tt.dyn_ltree[18]!==0||tt.dyn_ltree[20]!==0||tt.dyn_ltree[26]!==0)return i;for(ct=32;ct>>3,(Le=je.static_len+3+7>>>3)<=Ze&&(Ze=Le)):Ze=Le=Ce+5,Ce+4<=Ze&&ut!==-1?st(je,ut,Ce,Ee):je.strategy===4||Le===Ze?(Xe(je,2+(Ee?1:0),3),Oe(je,ae,oe)):(Xe(je,4+(Ee?1:0),3),function(tt,ct,it,zt){var Lt;for(Xe(tt,ct-257,5),Xe(tt,it-1,5),Xe(tt,zt-4,4),Lt=0;Lt>>8&255,je.pending_buf[je.d_buf+2*je.last_lit+1]=255&ut,je.pending_buf[je.l_buf+je.last_lit]=255&Ce,je.last_lit++,ut===0?je.dyn_ltree[2*Ce]++:(je.matches++,ut--,je.dyn_ltree[2*(ne[Ce]+y+1)]++,je.dyn_dtree[2*we(ut)]++),je.last_lit===je.lit_bufsize-1},a._tr_align=function(je){Xe(je,2,3),Me(je,P,ae),function(ut){ut.bi_valid===16?(ve(ut,ut.bi_buf),ut.bi_buf=0,ut.bi_valid=0):8<=ut.bi_valid&&(ut.pending_buf[ut.pending++]=255&ut.bi_buf,ut.bi_buf>>=8,ut.bi_valid-=8)}(je)}},{"../utils/common":41}],53:[function(n,s,a){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,a){(function(o){(function(l,i){if(!l.setImmediate){var u,m,x,y,v=1,b={},N=!1,k=l.document,M=Object.getPrototypeOf&&Object.getPrototypeOf(l);M=M&&M.setTimeout?M:l,u={}.toString.call(l.process)==="[object process]"?function(F){process.nextTick(function(){T(F)})}:function(){if(l.postMessage&&!l.importScripts){var F=!0,D=l.onmessage;return l.onmessage=function(){F=!1},l.postMessage("","*"),l.onmessage=D,F}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",P,!1):l.attachEvent("onmessage",P),function(F){l.postMessage(y+F,"*")}):l.MessageChannel?((x=new MessageChannel).port1.onmessage=function(F){T(F.data)},function(F){x.port2.postMessage(F)}):k&&"onreadystatechange"in k.createElement("script")?(m=k.documentElement,function(F){var D=k.createElement("script");D.onreadystatechange=function(){T(F),D.onreadystatechange=null,m.removeChild(D),D=null},m.appendChild(D)}):function(F){setTimeout(T,0,F)},M.setImmediate=function(F){typeof F!="function"&&(F=new Function(""+F));for(var D=new Array(arguments.length-1),U=0;U"u"?o===void 0?this:o:self)}).call(this,typeof Qx<"u"?Qx:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(L9e);var NNt=L9e.exports;const SNt=eo(NNt);function Mde(e,t=400,n=75){return e&&`${e.replace("/storage/v1/object/public/","/storage/v1/render/image/public/")}?width=${t}&quality=${n}&resize=contain`}const CNt=()=>{const{isAdmin:e}=tn(),[t,n]=A.useState(null),[s,a]=A.useState(null),[o,l]=A.useState("all"),[i,u]=A.useState(new Set),[m,x]=A.useState(!1),[y,v]=A.useState(!1),[b,N]=A.useState("images"),[k,M]=A.useState(null),{data:I=[],isLoading:T}=Zt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:xe,error:Te}=await Y.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Te)throw Te;return xe}}),{data:P=[]}=Zt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:xe,error:Te}=await Y.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Te)throw Te;return xe}}),{data:F=[]}=Zt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:xe,error:Te}=await Y.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Te)throw Te;return xe}}),{data:D=[]}=Zt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:xe,error:Te}=await Y.from("social_accounts").select("id, platform").eq("is_active",!0);if(Te)throw Te;return xe||[]}}),U=D.length>0,V=A.useMemo(()=>o==="all"?null:F.find(xe=>xe.month===o)||null,[o,F]),W=A.useMemo(()=>[...new Set(I.map(Te=>Te.month))].sort((Te,_e)=>_e.localeCompare(Te)),[I]);A.useEffect(()=>{W.length>0&&o==="all"&&l(W[0])},[W,o]);const G=xe=>{try{const Te=Nye(xe,"yyyy-MM",new Date);return on(Te,"MMMM yyyy")}catch{return xe}},ee=A.useMemo(()=>o==="all"?I:I.filter(xe=>xe.month===o),[o,I]),ae=A.useMemo(()=>{var xe;return o==="all"?null:((xe=P.find(Te=>Te.month===o))==null?void 0:xe.canva_link)||null},[o,P]),oe=async xe=>{try{await navigator.clipboard.writeText(xe),Ae.success("Caption copied to clipboard!")}catch{Ae.error("Failed to copy caption")}},pe=async(xe,Te)=>{try{const we=await(await fetch(xe)).blob(),ve=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),Xe=navigator.canShare&&navigator.canShare({files:[new File([we],"test.jpg",{type:"image/jpeg"})]});if(ve&&Xe){const Me=new File([we],`social-swag-${Te}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Me],title:"Social Swag Image"}),Ae.success("Image ready to save!")}else{const Me=window.URL.createObjectURL(we),Ie=document.createElement("a");Ie.href=Me,Ie.download=`social-swag-${Te}.jpg`,document.body.appendChild(Ie),Ie.click(),document.body.removeChild(Ie),window.URL.revokeObjectURL(Me),Ae.success("Image downloaded!")}}catch(_e){_e.name!=="AbortError"&&Ae.error("Failed to download image")}},ne=xe=>{u(Te=>{const _e=new Set(Te);return _e.has(xe)?_e.delete(xe):_e.add(xe),_e})},fe=()=>{u(new Set(ee.map(xe=>xe.id)))},se=()=>{u(new Set),x(!1)},me=async()=>{const xe=ee.filter(Te=>i.has(Te.id));if(xe.length===0){Ae.error("No images selected");return}v(!0),Ae.info(`Preparing ${xe.length} images for download...`);try{const Te=new SNt,_e=[...xe].sort((Ie,$e)=>Ie.sort_order-$e.sort_order);for(let Ie=0;Ie<_e.length;Ie++){const $e=_e[Ie];try{const Be=await fetch($e.image_url),Ve=await Be.blob(),ot=Be.headers.get("content-type")||"image/jpeg",Tt=ot.includes("png")?"png":ot.includes("webp")?"webp":"jpg",Oe=`${Ie+1}.${Tt}`;Te.file(Oe,Ve)}catch{console.error("Failed to fetch image:",$e.id)}}const we=o!=="all"?G(o):"Social Swag",ve=await Te.generateAsync({type:"blob"}),Xe=window.URL.createObjectURL(ve),Me=document.createElement("a");Me.href=Xe,Me.download=`${we}.zip`,document.body.appendChild(Me),Me.click(),document.body.removeChild(Me),window.URL.revokeObjectURL(Xe),Ae.success(`Downloaded ${_e.length} images as "${we}.zip"!`)}catch(Te){console.error("Failed to create ZIP:",Te),Ae.error("Failed to create download package")}v(!1),se()},ue=xe=>{m?ne(xe.id):n(xe)};return r.jsx(Fr,{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(At,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Os,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(At,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Fl,{className:"h-3 w-3 mr-1"}),I.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(wi,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(_i,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(sn,{value:"gallery",className:"gap-2",children:[r.jsx(Fl,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(sn,{value:"scheduled",className:"gap-2",children:[r.jsx(Tp,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(Sn,{value:"gallery",className:"space-y-6",children:[e?U?r.jsx(He,{className:"border rounded-xl",children:r.jsx(et,{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(Q,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(co,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(He,{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(et,{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(au,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(_u,{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(Q,{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(co,{to:"/social-connections",children:[r.jsx(gm,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(He,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{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(Xa,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(au,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(_u,{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(At,{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:W.map(xe=>r.jsx("button",{onClick:()=>l(xe),className:Ut("px-4 py-2 rounded-full text-sm font-medium transition-all",o===xe?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(xe)},xe))}),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 ",G(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 ",G(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"),se()},className:Ut("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Fl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{N("reels"),se()},className:Ut("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Td,{className:"h-4 w-4"}),"Reels"]})]}),b==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?r.jsxs(r.Fragment,{children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:fe,className:"gap-2",children:["Select All (",ee.length,")"]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(ds,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Q,{size:"sm",onClick:me,disabled:y,className:"gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.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(Q,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(mi,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&b==="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:ee.map(xe=>{const Te=i.has(xe.id);return r.jsx(He,{className:Ut("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Te&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(xe),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:Mde(xe.image_url,400,75),alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",decoding:"async"}),xe.post_date&&!m&&r.jsx("div",{className:"absolute top-0 left-0 w-24 h-24 overflow-hidden pointer-events-none",children:r.jsx("div",{className:"absolute flex items-center justify-center text-white font-bold text-[10px] tracking-wider uppercase",style:{top:"20px",left:"-34px",width:"136px",transform:"rotate(-45deg)",backgroundColor:"#2d5052",padding:"5px 0",boxShadow:"0 2px 4px rgba(0,0,0,0.25)"},children:on(new Date(xe.post_date+"T00:00:00"),"MMM d")})}),m&&r.jsx("div",{className:Ut("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Te?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Te&&r.jsx(mi,{className:"h-4 w-4"})}),!m&&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"})})]})},xe.id)})}),ee.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Fl,{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&&b==="reels"&&r.jsx(r.Fragment,{children:V?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(He,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a(V),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:Mde(V.image_url,400,75),alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105",loading:"lazy",decoding:"async"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(At,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Td,{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(Td,{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(Rr,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Dr,{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:Mde(t.image_url,900,85),alt:"Social swag",className:"w-full h-full object-cover",decoding:"async"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground mb-4",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Cs,{className:"h-4 w-4"}),on(new Date(t.created_at),"MMMM d, yyyy")]}),t.post_date&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium rounded-full px-3 py-1 text-xs text-white",style:{background:"#406E71"},children:[r.jsx(Cs,{className:"h-3.5 w-3.5"}),"Post on ",on(new Date(t.post_date+"T00:00:00"),"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(Q,{onClick:()=>{M({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(Ji,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Q,{variant:"outline",onClick:()=>oe(t.caption),className:"flex-1 gap-2",children:[r.jsx(Po,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(Q,{variant:"outline",onClick:()=>pe(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Rr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Dr,{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(Td,{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(Q,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Po,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(Q,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(jNt,{open:!!k,onOpenChange:xe=>!xe&&M(null),imageUrl:(k==null?void 0:k.imageUrl)||"",imageId:(k==null?void 0:k.imageId)||"",defaultCaption:(k==null?void 0:k.caption)||"",swagItemId:k==null?void 0:k.imageId})]}),r.jsx(Sn,{value:"scheduled",children:r.jsx(kNt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(He,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{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(Xa,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(au,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(_u,{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(At,{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:W.map(xe=>r.jsx("button",{onClick:()=>l(xe),className:Ut("px-4 py-2 rounded-full text-sm font-medium transition-all",o===xe?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(xe)},xe))}),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 ",G(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 ",G(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"),se()},className:Ut("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Fl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{N("reels"),se()},className:Ut("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Td,{className:"h-4 w-4"}),"Reels"]})]}),b==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:m?r.jsxs(r.Fragment,{children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:fe,className:"gap-2",children:["Select All (",ee.length,")"]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(ds,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs(Q,{size:"sm",onClick:me,disabled:y,className:"gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.size} Selected`]})]}):r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(mi,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&b==="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:ee.map(xe=>{const Te=i.has(xe.id);return r.jsx(He,{className:Ut("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",m&&Te&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(xe),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:xe.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),m&&r.jsx("div",{className:Ut("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Te?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Te&&r.jsx(mi,{className:"h-4 w-4"})}),!m&&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"})})]})},xe.id)})}),ee.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Fl,{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&&b==="reels"&&r.jsx(r.Fragment,{children:V?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(He,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a(V),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:V.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(At,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Td,{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(Td,{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(Rr,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Dr,{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(Cs,{className:"h-4 w-4"}),on(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(Q,{variant:"outline",onClick:()=>oe(t.caption),className:"flex-1 gap-2",children:[r.jsx(Po,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(Q,{variant:"outline",onClick:()=>pe(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Rr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Dr,{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(Td,{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(Q,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Po,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(Q,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},MNt=()=>{const{swagId:e}=Ec(),{user:t}=tn(),{toast:n}=fi(),s=Vr(),{trackEngagement:a}=fP(),[o,l]=A.useState(""),{data:i,isLoading:u}=Zt({queryKey:["social-swag-detail",e],queryFn:async()=>{const{data:I,error:T}=await Y.from("social_swag").select("*").eq("id",e).single();if(T)throw T;const{data:P}=await Y.from("social_swag_links").select("*").eq("swag_id",e).order("sort_order");return{...I,links:P||[]}},enabled:!!e});A.useEffect(()=>{i&&a("social_swag",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:m=[]}=Zt({queryKey:["social-swag-likes",e],queryFn:async()=>{const{data:I,error:T}=await Y.from("social_swag_likes").select("*").eq("swag_id",e);if(T)throw T;return I},enabled:!!e}),{data:x=[]}=Zt({queryKey:["social-swag-comments",e],queryFn:async()=>{const{data:I,error:T}=await Y.from("social_swag_comments").select("*").eq("swag_id",e).order("created_at",{ascending:!1});if(T)throw T;const P=[...new Set(I.map(U=>U.user_id))],{data:F}=await Y.from("profiles").select("id, name").in("id",P),D=new Map((F==null?void 0:F.map(U=>[U.id,U.name]))||[]);return I.map(U=>({...U,user_name:D.get(U.user_id)||"Unknown User"}))},enabled:!!e}),y=ar({mutationFn:async I=>{const{error:T}=await Y.from("social_swag_comments").insert({swag_id:e,user_id:t.id,content:I});if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),l(""),n({title:"Comment added!"})},onError:I=>{n({title:"Error adding comment",description:I.message,variant:"destructive"})}}),v=ar({mutationFn:async I=>{const{error:T}=await Y.from("social_swag_comments").delete().eq("id",I);if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),n({title:"Comment deleted"})}}),b=ar({mutationFn:async()=>{const I=m.find(T=>T.user_id===(t==null?void 0:t.id));if(I){const{error:T}=await Y.from("social_swag_likes").delete().eq("id",I.id);if(T)throw T}else{const{error:T}=await Y.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=m.some(I=>I.user_id===(t==null?void 0:t.id)),k=I=>I.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),M=I=>{I.preventDefault(),!(!o.trim()||!t)&&y.mutate(o.trim())};return u?r.jsx(Fr,{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"})})}):i?r.jsx(Fr,{title:i.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/social-swag",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Back to Social Swag"]})}),i.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:i.preview_image_url,alt:i.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:i.title})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(D3,{resourceType:"social_swag",resourceId:i.id,resourceTitle:i.title}),r.jsxs(Q,{variant:N?"default":"outline",className:"gap-2 w-fit",onClick:()=>b.mutate(),disabled:!t||b.isPending,children:[r.jsx(Bd,{className:`h-4 w-4 ${N?"fill-current":""}`}),m.length," ",m.length===1?"Like":"Likes"]})]})]}),i.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:i.description}})]}),i.links.length>0&&r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Oo,{className:"h-4 w-4"}),i.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:i.links.map(I=>r.jsxs(Q,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{a("social_swag",i.id,i.title,"click_canva"),window.open(I.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:I.title}),r.jsx(Ss,{className:"h-4 w-4 text-muted-foreground"})]},I.id))})]})}),r.jsx(Od,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),t?r.jsxs("form",{onSubmit:M,className:"flex gap-2",children:[r.jsx(Zn,{placeholder:"Add a comment...",value:o,onChange:I=>l(I.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(Q,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Ji,{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(He,{children:r.jsx(et,{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(I=>r.jsx(He,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ea,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(ta,{className:"text-sm",children:k(I.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:I.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:bu(new Date(I.created_at),{addSuffix:!0})}),I.user_id===(t==null?void 0:t.id)&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>v.mutate(I.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):r.jsx(Fr,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Oo,{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(Q,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/social-swag",children:"Back to Social Swag"})})]})})},TNt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=A.useState(!0),[i,u]=A.useState(!0),[m,x]=A.useState(!0),y=v=>v.split(" ").map(b=>b[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(Q,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(k4,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(W4,{open:o,onOpenChange:l,children:[r.jsx(G4,{asChild:!0,children:r.jsxs(Q,{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(Rd,{className:"h-4 w-4"}):r.jsx(Gi,{className:"h-4 w-4"})]})}),r.jsx(K4,{className:"space-y-1 pl-2",children:e.map(v=>r.jsxs(Q,{variant:n===v.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(v.id),children:[r.jsx("span",{className:"mr-2",children:v.icon||"📂"}),r.jsx("span",{className:"truncate",children:v.name})]},v.id))})]}),t.length>0&&r.jsxs(W4,{open:i,onOpenChange:u,children:[r.jsx(G4,{asChild:!0,children:r.jsxs(Q,{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(ff,{className:"h-3 w-3"}),"Your Groups"]}),i?r.jsx(Rd,{className:"h-4 w-4"}):r.jsx(Gi,{className:"h-4 w-4"})]})}),r.jsx(K4,{className:"space-y-1 pl-2",children:t.map(v=>r.jsxs(Q,{variant:n===`group:${v.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${v.id}`),children:[r.jsx("span",{className:"mr-2",children:v.icon||"🔒"}),r.jsx("span",{className:"truncate",children:v.name})]},v.id))})]}),r.jsxs(W4,{open:m,onOpenChange:x,children:[r.jsx(G4,{asChild:!0,children:r.jsxs(Q,{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($n,{className:"h-3 w-3"}),"Online Now",a.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:a.length})]}),m?r.jsx(Rd,{className:"h-4 w-4"}):r.jsx(Gi,{className:"h-4 w-4"})]})}),r.jsx(K4,{className:"pl-2 space-y-1",children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):a.map(v=>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(ea,{className:"h-7 w-7",children:[r.jsx(Ci,{src:v.avatarUrl}),r.jsx(ta,{className:"text-xs",children:y(v.name)})]}),r.jsx(Ju,{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:v.name})]},v.id))})]})]})})})},ANt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=A.useState(!1),i=m=>m.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),u=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const x=n.replace("group:",""),y=t.find(v=>v.id===x);return y?`🔒 ${y.name}`:"Private Group"}const m=e.find(x=>x.id===n);return m?`${m.icon||"📂"} ${m.name}`:"Category"};return r.jsxs("div",{className:"lg:hidden flex items-center gap-2 mb-4",children:[r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:u()}),r.jsx(Rd,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(Nu,{className:"w-56 bg-background border",children:[r.jsxs(Va,{onClick:()=>s("all"),children:[r.jsx(k4,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(ik,{}),r.jsx(ame,{className:"text-xs text-muted-foreground",children:"Categories"}),e.map(m=>r.jsxs(Va,{onClick:()=>s(m.id),children:[r.jsx("span",{className:"mr-2",children:m.icon||"📂"}),m.name]},m.id)),t.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(ik,{}),r.jsxs(ame,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(ff,{className:"h-3 w-3"}),"Your Groups"]}),t.map(m=>r.jsxs(Va,{onClick:()=>s(`group:${m.id}`),children:[r.jsx("span",{className:"mr-2",children:m.icon||"🔒"}),m.name]},m.id))]})]})]}),r.jsxs(Vse,{open:o,onOpenChange:l,children:[r.jsx(tye,{asChild:!0,children:r.jsxs(Q,{variant:"outline",size:"icon",className:"relative",children:[r.jsx($n,{className:"h-4 w-4"}),a.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:a.length})]})}),r.jsxs(lP,{children:[r.jsx(Hse,{children:r.jsxs(Wse,{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),r.jsx(Vo,{className:"h-[calc(100vh-8rem)] mt-4",children:a.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:a.map(m=>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(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:m.avatarUrl}),r.jsx(ta,{children:i(m.name)})]}),r.jsx(Ju,{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:m.name})]},m.id))})})]})]})]})};var Tde,Pae="HoverCard",[O9e]=cc(Pae,[ax]),Lae=ax(),[ENt,F0e]=O9e(Pae),D9e=e=>{const{__scopeHoverCard:t,children:n,open:s,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=e,u=Lae(t),m=A.useRef(0),x=A.useRef(0),y=A.useRef(!1),v=A.useRef(!1),[b,N]=rh({prop:s,defaultProp:a??!1,onChange:o,caller:Pae}),k=A.useCallback(()=>{clearTimeout(x.current),m.current=window.setTimeout(()=>N(!0),l)},[l,N]),M=A.useCallback(()=>{clearTimeout(m.current),!y.current&&!v.current&&(x.current=window.setTimeout(()=>N(!1),i))},[i,N]),I=A.useCallback(()=>N(!1),[N]);return A.useEffect(()=>()=>{clearTimeout(m.current),clearTimeout(x.current)},[]),r.jsx(ENt,{scope:t,open:b,onOpenChange:N,onOpen:k,onClose:M,onDismiss:I,hasSelectionRef:y,isPointerDownOnContentRef:v,children:r.jsx(ZI,{...u,children:n})})};D9e.displayName=Pae;var R9e="HoverCardTrigger",F9e=A.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,a=F0e(R9e,n),o=Lae(n);return r.jsx(b3,{asChild:!0,...o,children:r.jsx(Fn.a,{"data-state":a.open?"open":"closed",...s,ref:t,onPointerEnter:gn(e.onPointerEnter,Kre(a.onOpen)),onPointerLeave:gn(e.onPointerLeave,Kre(a.onClose)),onFocus:gn(e.onFocus,a.onOpen),onBlur:gn(e.onBlur,a.onClose),onTouchStart:gn(e.onTouchStart,l=>l.preventDefault())})})});F9e.displayName=R9e;var INt="HoverCardPortal",[rtr,PNt]=O9e(INt,{forceMount:void 0}),Gre="HoverCardContent",z9e=A.forwardRef((e,t)=>{const n=PNt(Gre,e.__scopeHoverCard),{forceMount:s=n.forceMount,...a}=e,o=F0e(Gre,e.__scopeHoverCard);return r.jsx(Ac,{present:s||o.open,children:r.jsx(LNt,{"data-state":o.open?"open":"closed",...a,onPointerEnter:gn(e.onPointerEnter,Kre(o.onOpen)),onPointerLeave:gn(e.onPointerLeave,Kre(o.onClose)),ref:t})})});z9e.displayName=Gre;var LNt=A.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=e,u=F0e(Gre,n),m=Lae(n),x=A.useRef(null),y=ca(t,x),[v,b]=A.useState(!1);return A.useEffect(()=>{if(v){const N=document.body;return Tde=N.style.userSelect||N.style.webkitUserSelect,N.style.userSelect="none",N.style.webkitUserSelect="none",()=>{N.style.userSelect=Tde,N.style.webkitUserSelect=Tde}}},[v]),A.useEffect(()=>{if(x.current){const N=()=>{b(!1),u.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var M;((M=document.getSelection())==null?void 0:M.toString())!==""&&(u.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",N),()=>{document.removeEventListener("pointerup",N),u.hasSelectionRef.current=!1,u.isPointerDownOnContentRef.current=!1}}},[u.isPointerDownOnContentRef,u.hasSelectionRef]),A.useEffect(()=>{x.current&&RNt(x.current).forEach(k=>k.setAttribute("tabindex","-1"))}),r.jsx(wv,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:gn(o,N=>{N.preventDefault()}),onDismiss:u.onDismiss,children:r.jsx(YI,{...m,...i,onPointerDown:gn(i.onPointerDown,N=>{N.currentTarget.contains(N.target)&&b(!0),u.hasSelectionRef.current=!1,u.isPointerDownOnContentRef.current=!0}),ref:y,style:{...i.style,userSelect:v?"text":void 0,WebkitUserSelect:v?"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)"}})})}),ONt="HoverCardArrow",DNt=A.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,a=Lae(n);return r.jsx(XI,{...a,...s,ref:t})});DNt.displayName=ONt;function Kre(e){return t=>t.pointerType==="touch"?void 0:e()}function RNt(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 FNt=D9e,zNt=F9e,B9e=z9e;const BNt=FNt,$Nt=zNt,$9e=A.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(B9e,{ref:a,align:t,sideOffset:n,className:Ut("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}));$9e.displayName=B9e.displayName;const UNt=[{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"}],qNt=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),U9e=({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(BNt,{openDelay:200,closeDelay:100,children:[r.jsx($Nt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:t})}),r.jsx($9e,{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,a])=>{const o=UNt.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," (",a.length,")"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[a.slice(0,10).map(l=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ea,{className:"h-6 w-6",children:[r.jsx(Ci,{src:l.user_avatar||void 0}),r.jsx(ta,{className:"text-[10px]",children:qNt(l.user_name||"U")})]}),r.jsx("span",{className:"text-sm text-foreground truncate",children:l.user_name||"Unknown User"})]},l.id)),a.length>10&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",a.length-10," more"]})]})]},s)})})})]})};function VNt({images:e,initialIndex:t=0,open:n,onOpenChange:s}){const[a,o]=A.useState(t),[l,i]=A.useState(!1);A.useEffect(()=>{n&&(o(t),i(!1))},[n,t]);const u=()=>{o(v=>v>0?v-1:e.length-1),i(!1)},m=()=>{o(v=>v{n&&(v.key==="ArrowLeft"&&u(),v.key==="ArrowRight"&&m(),v.key==="Escape"&&s(!1))},[n,e.length]);A.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const y=e[a];return r.jsx(Rr,{open:n,onOpenChange:s,children:r.jsxs(Dr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(Q,{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(ds,{className:"h-6 w-6"})}),e.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(Q,{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:u,children:r.jsx(kc,{className:"h-8 w-8"})}),r.jsx(Q,{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:m,children:r.jsx(Gi,{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:[a+1," / ",e.length]}),(y==null?void 0:y.type)==="image"&&r.jsx(Q,{variant:"ghost",size:"icon",className:"absolute top-2 left-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>i(!l),children:l?r.jsx(z4,{className:"h-5 w-5"}):r.jsx(F4,{className:"h-5 w-5"})}),r.jsx("div",{className:Ut("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"&&i(!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:v=>v.stopPropagation()}):r.jsx("img",{src:y==null?void 0:y.url,alt:"",className:Ut("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((v,b)=>r.jsx("button",{onClick:()=>{o(b),i(!1)},className:Ut("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",a===b?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:v.type==="video"?r.jsx("video",{src:v.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:v.url,alt:"",className:"w-full h-full object-cover"})},b))})]})})}const jO=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],HNt=({commentId:e,reactions:t,currentUserId:n})=>{var m,x;const s=Vr(),[a,o]=A.useState(!1),l=t.find(y=>y.user_id===n),i=ar({mutationFn:async y=>{l?l.reaction_type===y?await Y.from("community_comment_reactions").delete().eq("id",l.id):await Y.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await Y.from("community_comment_reactions").insert({comment_id:e,user_id:n,reaction_type:y})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),u={};return t.forEach(y=>{u[y.reaction_type]=(u[y.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>0&&r.jsx(U9e,{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(u).slice(0,2).map(y=>{var v;return r.jsx("span",{className:"text-sm",children:(v=jO.find(b=>b.type===y))==null?void 0:v.emoji},y)})}),r.jsx("span",{children:t.length})]})}),n&&r.jsxs(Wc,{open:a,onOpenChange:o,children:[r.jsx(Gc,{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:[(m=jO.find(y=>y.type===l.reaction_type))==null?void 0:m.emoji," ",(x=jO.find(y=>y.type===l.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(vi,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(Tc,{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:jO.map(y=>r.jsx("button",{onClick:()=>i.mutate(y.type),className:"text-xl hover:scale-125 transition-transform p-1",title:y.label,children:y.emoji},y.type))})})]})]})};function z0e({content:e,className:t}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,s=[];let a=0,o,l=0;for(;(o=n.exec(e))!==null;){if(o.index>a&&s.push(e.substring(a,o.index)),o[1]){const i=o[1],u=o[2],m=o[3],x=i==="#";s.push(r.jsx(co,{to:x?`/templates/${m}`:`/profile?user=${m}`,className:Ut("font-medium hover:underline",x?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:y=>y.stopPropagation(),children:x?u:`@${u}`},`mention-${l++}`))}else if(o[4]){const i=o[4],u=i.replace(/[.,;:!?)]+$/,""),m=i.slice(u.length);let x;try{const y=new URL(u);x=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{x=u.length>40?u.slice(0,40)+"...":u}s.push(r.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:y=>y.stopPropagation(),children:x},`url-${l++}`)),m&&s.push(m)}a=o.index+o[0].length}return ar.jsx(A.Fragment,{children:i},u))})}function Zre({value:e,onChange:t,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:a="80px",onMentionsChange:o,onTemplatesChange:l,onKeyDown:i,mentionFormat:u="encoded",enableTemplateMentions:m=!1}){const x=A.useRef(null),y=A.useRef(null),[v,b]=A.useState(!1),[N,k]=A.useState("user"),[M,I]=A.useState(""),[T,P]=A.useState(null),[F,D]=A.useState(0),[U,V]=A.useState({top:0,left:0,width:0}),W=A.useRef(new Map),G=A.useRef(new Map),ee=we=>{if(u==="plain"){const Ie=[];return W.current.forEach((Be,Ve)=>{we.includes(`@${Ve}`)&&Ie.push(Be)}),[...new Set(Ie)]}const ve=/@\[([^\]]+)\]\(([^)]+)\)/g,Xe=[];let Me;for(;(Me=ve.exec(we))!==null;)Xe.push(Me[2]);return[...new Set(Xe)]},ae=we=>{if(u==="plain"){const Ie=[];return G.current.forEach((Be,Ve)=>{we.includes(`#${Ve}`)&&Ie.push(Be)}),[...new Set(Ie)]}const ve=/#\[([^\]]+)\]\(([^)]+)\)/g,Xe=[];let Me;for(;(Me=ve.exec(we))!==null;)Xe.push(Me[2]);return[...new Set(Xe)]};A.useEffect(()=>{if(o){const we=ee(e);o(we)}if(l){const we=ae(e);l(we)}},[e,o,l,u]);const{data:oe=[],isLoading:pe}=Zt({queryKey:["mention-users",M],queryFn:async()=>{const we=Y.from("profiles").select("id, name").limit(8),ve=M.length>=1?we.ilike("name",`%${M}%`):we.order("name"),{data:Xe,error:Me}=await ve;if(Me)throw Me;const Ie=Xe.map(Be=>Be.id),$e=await z8e(Ie);return Xe.map(Be=>({id:Be.id,name:Be.name||"Unknown",avatar_url:$e.get(Be.id)}))},enabled:v&&N==="user",staleTime:3e4}),{data:ne=[],isLoading:fe}=Zt({queryKey:["mention-templates",M],queryFn:async()=>{let we=Y.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);M.length>=1&&(we=we.ilike("name",`%${M}%`));const{data:ve,error:Xe}=await we;if(Xe)throw Xe;return ve||[]},enabled:v&&N==="template"&&m,staleTime:3e4}),se=N==="user"?pe:fe,me=N==="user"?oe:ne,ue=we=>we.split(" ").map(ve=>ve[0]).join("").toUpperCase().slice(0,2),xe=we=>{const ve=we.target.value,Xe=we.target.selectionStart;t(ve);const Me=ve.substring(0,Xe),Ie=Me.lastIndexOf("@"),$e=m?Me.lastIndexOf("#"):-1;let Be=-1,Ve="user";if(Ie>$e?(Be=Ie,Ve="user"):$e>Ie&&m&&(Be=$e,Ve="template"),Be!==-1){const ot=Me.substring(Be+1),Tt=ot.includes(" "),Oe=ot.includes(` `);if(!Tt&&!Oe&&ot.length<=30){P(Be),I(ot),k(Ve),b(!0),D(0);return}}b(!1),P(null)},Te=we=>{if(T===null)return;const ve=e.substring(0,T),Xe=e.substring(T+M.length+1),Me=N==="user"?"@":"#",Ie=u==="plain"?`${Me}${we.name} `:`${Me}[${we.name}](${we.id}) `;u==="plain"&&(N==="user"?W.current.set(we.name,we.id):G.current.set(we.name,we.id));const $e=ve+Ie+Xe;t($e),b(!1),P(null),I(""),setTimeout(()=>{if(x.current){const Be=ve.length+Ie.length;x.current.focus(),x.current.setSelectionRange(Be,Be)}},0)},_e=we=>{if(!(!v||me.length===0))switch(we.key){case"ArrowDown":we.preventDefault(),D(ve=>(ve+1)%me.length);break;case"ArrowUp":we.preventDefault(),D(ve=>(ve-1+me.length)%me.length);break;case"Enter":me[F]&&(we.preventDefault(),Te(me[F]));break;case"Escape":we.preventDefault(),b(!1);break;case"Tab":me[F]&&(we.preventDefault(),Te(me[F]));break}};return A.useEffect(()=>{const we=ve=>{y.current&&!y.current.contains(ve.target)&&x.current&&!x.current.contains(ve.target)&&b(!1)};return document.addEventListener("mousedown",we),()=>document.removeEventListener("mousedown",we)},[]),A.useEffect(()=>{if(!v)return;const we=()=>{const ve=x.current;if(!ve)return;const Xe=ve.getBoundingClientRect();V({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)}},[v,e]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Zn,{ref:x,value:e,onChange:xe,onKeyDown:we=>{_e(we),we.defaultPrevented||i==null||i(we)},placeholder:n,className:Ut("resize-none",s),style:{minHeight:a}}),v&&Th.createPortal(r.jsxs("div",{ref:y,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:U.top,left:U.left,width:U.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"}),se?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):me.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:M.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:me.map((we,ve)=>r.jsx("li",{className:Ut("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",ve===F?"bg-accent":"hover:bg-accent/50"),onClick:()=>Te(we),onMouseEnter:()=>D(ve),children:N==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(ea,{className:"h-6 w-6",children:[r.jsx(Ci,{src:we.avatar_url}),r.jsx(ta,{className:"text-xs",children:ue(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(Vc,{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 WNt(e){const t=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=t.exec(e))!==null;)n.push(s[2]);return[...new Set(n)]}const U4e=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);function q9e({comment:e,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l=0}){const i=Vr(),[u,m]=A.useState(!1),[x,y]=A.useState(""),[v,b]=A.useState([]),N=ar({mutationFn:async({content:T,parentCommentId:P})=>{const{data:F,error:D}=await Y.from("community_comments").insert({post_id:t,user_id:n,content:T,parent_comment_id:P}).select("id").single();if(D)throw D;const U=v;if(U.length>0&&F){const V=U.filter(W=>W!==n).map(W=>({comment_id:F.id,mentioned_user_id:W,mentioned_by_user_id:n}));V.length>0&&await Y.from("community_comment_mentions").insert(V)}},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),y(""),b([]),m(!1)}}),k=ar({mutationFn:async T=>{const{error:P}=await Y.from("community_comments").delete().eq("id",T);if(P)throw P},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),M=()=>{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(ea,{className:"h-8 w-8 shrink-0",children:[r.jsx(Ci,{src:e.user_avatar||void 0}),r.jsx(ta,{className:"text-xs",children:U4e(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(z0e,{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:bu(new Date(e.created_at),{addSuffix:!0})}),r.jsx(HNt,{commentId:e.id,reactions:e.reactions,currentUserId:n}),n&&l<2&&r.jsxs("button",{onClick:()=>m(!u),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(bA,{className:"h-3 w-3"}),"Reply"]}),(e.user_id===n||o)&&r.jsx("button",{onClick:()=>k.mutate(e.id),className:"hover:text-destructive",children:e.user_id!==n?"Remove":"Delete"})]}),u&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(ea,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Ci,{src:s||void 0}),r.jsx(ta,{className:"text-xs",children:U4e((a==null?void 0:a.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(Zre,{placeholder:`Reply to ${e.user_name}...`,value:x,onChange:y,onMentionsChange:b,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:M,disabled:!x.trim()||N.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(Ji,{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(q9e,{comment:T,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l+1},T.id))})]})}const kO=[{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"}],GNt=()=>{const{user:e,isBrokerageManager:t,managedBrokerages:n,isAdmin:s}=tn(),{avatarUrl:a}=F8e(e==null?void 0:e.id),{onlineUsers:o}=pRe(),{toast:l}=fi(),i=Vr(),u=A.useRef(null),[m,x]=A.useState("all"),[y,v]=A.useState(""),[b,N]=A.useState(""),[k,M]=A.useState(""),[I,T]=A.useState([]),[P,F]=A.useState([]),[D,U]=A.useState(""),[V,W]=A.useState(!1),[G,ee]=A.useState(null),[ae,oe]=A.useState(""),[pe,ne]=A.useState(new Set),[fe,se]=A.useState({}),[me,ue]=A.useState({}),[xe,Te]=A.useState([]),[_e,we]=A.useState([]),[ve,Xe]=A.useState({open:!1,images:[],index:0});A.useEffect(()=>{if(m.startsWith("group:")){const it=m.replace("group:","");M(it),N("")}else m!=="all"?(N(m),M("")):(N(""),M(""))},[m]);const{data:Me=[]}=Zt({queryKey:["community-categories"],queryFn:async()=>{const{data:it,error:zt}=await Y.from("community_categories").select("*").order("sort_order");if(zt)throw zt;return it}}),{data:Ie=[]}=Zt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:it,error:zt}=await Y.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(zt)throw zt;return it}}),$e=20,{data:Be,isLoading:Ve,hasNextPage:ot,fetchNextPage:Tt,isFetchingNextPage:Oe}=Utt({queryKey:["community-posts",m],initialPageParam:0,queryFn:async({pageParam:it})=>{var Pe;const zt=it*$e,Lt=zt+$e;let lr=Y.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(zt,Lt);if(m.startsWith("group:")){const Ye=m.replace("group:","");lr=lr.eq("private_group_id",Ye)}else m==="all"||(lr=lr.eq("category_id",m).is("private_group_id",null));const{data:Ar,error:Mr}=await lr;if(Mr)throw Mr;const Zr=((Ar==null?void 0:Ar.length)||0)>$e,Xn=(Ar||[]).slice(0,$e);if(Xn.length===0)return{posts:[],hasMore:!1,nextPage:it+1};const dr=Xn.map(Ye=>Ye.id),En=[...new Set(Xn.filter(Ye=>Ye.category_id).map(Ye=>Ye.category_id))].filter(Boolean),[Es,Hs,Ei,Ii,Ho]=await Promise.all([En.length?Y.from("community_categories").select("*").in("id",En):Promise.resolve({data:[]}),Y.from("community_post_media").select("*").in("post_id",dr).order("sort_order"),Y.from("community_reactions").select("*").in("post_id",dr),Y.from("community_comments").select("*").in("post_id",dr).order("created_at",{ascending:!0}),Y.from("community_post_resources").select("*").in("post_id",dr)]),Ha=Es==null?void 0:Es.data,us=Hs==null?void 0:Hs.data,ra=Ei==null?void 0:Ei.data,hs=Ii==null?void 0:Ii.data,Ys=Ho==null?void 0:Ho.data,zs=(hs||[]).map(Ye=>Ye.id),[ji,ir]=await Promise.all([zs.length?Y.from("community_comment_reactions").select("*").in("comment_id",zs):Promise.resolve({data:[]}),(()=>{const Ye=(Ys||[]).filter(Nt=>Nt.resource_type==="template").map(Nt=>Nt.resource_id);return Ye.length===0?Promise.resolve({data:[]}):Y.from("canva_templates").select("id, name, preview_image_url").in("id",Ye)})()]),Pa=(ji==null?void 0:ji.data)||[],oo=(ir==null?void 0:ir.data)||[],bi=new Map(oo.map(Ye=>[Ye.id,{name:Ye.name,preview_image_url:Ye.preview_image_url}])),qn=Array.from(new Set([...Xn.map(Ye=>Ye.user_id),...(ra||[]).map(Ye=>Ye.user_id),...(hs||[]).map(Ye=>Ye.user_id),...Pa.map(Ye=>Ye.user_id)])),[Ki,dc]=await Promise.all([qn.length?Y.from("profiles").select("id, name").in("id",qn):Promise.resolve({data:[]}),z8e(qn)]),go=new Map(((Pe=Ki==null?void 0:Ki.data)==null?void 0:Pe.map(Ye=>[Ye.id,Ye.name]))||[]),uc=new Map((Ha||[]).map(Ye=>[Ye.id,Ye])),rt=Ye=>{const Nt=new Map,bt=[];return Ye.forEach(It=>{Nt.set(It.id,{...It,user_name:go.get(It.user_id)||"Unknown User",user_avatar:dc.get(It.user_id),reactions:Pa.filter(qt=>qt.comment_id===It.id).map(qt=>({...qt,user_name:go.get(qt.user_id)||"Unknown User",user_avatar:dc.get(qt.user_id)})),replies:[]})}),Ye.forEach(It=>{const qt=Nt.get(It.id);if(It.parent_comment_id&&Nt.has(It.parent_comment_id)){const Ot=Nt.get(It.parent_comment_id);Ot.replies=Ot.replies||[],Ot.replies.push(qt)}else bt.push(qt)}),bt};return{posts:Xn.map(Ye=>{const Nt=(Ys||[]).filter(bt=>bt.post_id===Ye.id).map(bt=>{let It="",qt=null;if(bt.resource_type==="template"){const Ot=bi.get(bt.resource_id);It=(Ot==null?void 0:Ot.name)||"Unknown Template",qt=(Ot==null?void 0:Ot.preview_image_url)||null}return{id:bt.id,resource_type:bt.resource_type,resource_id:bt.resource_id,resource_name:It,resource_preview_url:qt}});return{...Ye,user_name:go.get(Ye.user_id)||"Unknown User",user_avatar:dc.get(Ye.user_id),category:Ye.category_id?uc.get(Ye.category_id):null,media:(us||[]).filter(bt=>bt.post_id===Ye.id),reactions:((ra||[]).filter(bt=>bt.post_id===Ye.id)||[]).map(bt=>({...bt,user_name:go.get(bt.user_id)||"Unknown User",user_avatar:dc.get(bt.user_id)})),comments:rt((hs||[]).filter(bt=>bt.post_id===Ye.id)),resources:Nt}}),hasMore:Zr,nextPage:it+1}},getNextPageParam:it=>it.hasMore?it.nextPage:void 0}),at=A.useMemo(()=>(Be==null?void 0:Be.pages.flatMap(it=>it.posts))??[],[Be]),le=ar({mutationFn:async()=>{W(!0);const{data:it,error:zt}=await Y.from("community_posts").insert({user_id:e.id,category_id:k?null:b||null,private_group_id:k||null,content:y,link_url:D||null}).select().single();if(zt)throw zt;for(let lr=0;lr0){const lr=xe.filter(Ar=>Ar!==e.id).map(Ar=>({post_id:it.id,mentioned_user_id:Ar,mentioned_by_user_id:e.id}));lr.length>0&&await Y.from("community_post_mentions").insert(lr)}const Lt=WNt(y);if(Lt.length>0){const lr=Lt.map(Ar=>({post_id:it.id,resource_type:"template",resource_id:Ar}));await Y.from("community_post_resources").insert(lr)}return it},onSuccess:async it=>{var zt;i.invalidateQueries({queryKey:["community-posts"]}),v(""),Te([]),we([]),N(""),M(""),T([]),F([]),U(""),l({title:"Post created!"});try{const Lt=((zt=e==null?void 0:e.user_metadata)==null?void 0:zt.name)||"Someone",lr=y.length>50?y.substring(0,50)+"...":y;await Y.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Lt}: ${lr}`,url:"/community"}})}catch(Lt){console.error("Failed to send push notification:",Lt)}},onError:it=>{l({title:"Error creating post",description:it.message,variant:"destructive"})},onSettled:()=>W(!1)}),qe=ar({mutationFn:async({postId:it,content:zt})=>{const{error:Lt}=await Y.from("community_posts").update({content:zt}).eq("id",it);if(Lt)throw Lt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),ee(null),oe(""),l({title:"Post updated!"})}}),Je=ar({mutationFn:async it=>{const{error:zt}=await Y.from("community_posts").delete().eq("id",it);if(zt)throw zt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),st=ar({mutationFn:async({postId:it,isPinned:zt})=>{const{error:Lt}=await Y.from("community_posts").update({is_pinned:!zt,pinned_at:zt?null:new Date().toISOString(),pinned_by:zt?null:e==null?void 0:e.id}).eq("id",it);if(Lt)throw Lt},onSuccess:(it,{isPinned:zt})=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:zt?"Post unpinned":"Post pinned to top"})}}),je=ar({mutationFn:async({postId:it,reactionType:zt})=>{var lr;const Lt=(lr=at.find(Ar=>Ar.id===it))==null?void 0:lr.reactions.find(Ar=>Ar.user_id===(e==null?void 0:e.id));Lt?Lt.reaction_type===zt?await Y.from("community_reactions").delete().eq("id",Lt.id):await Y.from("community_reactions").update({reaction_type:zt}).eq("id",Lt.id):await Y.from("community_reactions").insert({post_id:it,user_id:e.id,reaction_type:zt})},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),ut=ar({mutationFn:async({postId:it,content:zt})=>{const{data:Lt,error:lr}=await Y.from("community_comments").insert({post_id:it,user_id:e.id,content:zt}).select("id").single();if(lr)throw lr;const Ar=me[it]||[];if(Ar.length>0&&Lt){const Mr=Ar.filter(Zr=>Zr!==e.id).map(Zr=>({comment_id:Lt.id,mentioned_user_id:Zr,mentioned_by_user_id:e.id}));Mr.length>0&&await Y.from("community_comment_mentions").insert(Mr)}},onSuccess:(it,{postId:zt})=>{i.invalidateQueries({queryKey:["community-posts"]}),se(Lt=>({...Lt,[zt]:""})),ue(Lt=>({...Lt,[zt]:[]}))}});ar({mutationFn:async it=>{const{error:zt}=await Y.from("community_comments").delete().eq("id",it);if(zt)throw zt},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})});const Ce=it=>{const zt=Array.from(it.target.files||[]);if(zt.length+I.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}T(Lt=>[...Lt,...zt]),zt.forEach(Lt=>{const lr=new FileReader;lr.onloadend=()=>{F(Ar=>[...Ar,lr.result])},lr.readAsDataURL(Lt)})},Ee=it=>{T(zt=>zt.filter((Lt,lr)=>lr!==it)),F(zt=>zt.filter((Lt,lr)=>lr!==it))},Ze=it=>it.split(" ").map(zt=>zt[0]).join("").toUpperCase().slice(0,2),Le=it=>{const zt={};return it.forEach(Lt=>{zt[Lt.reaction_type]=(zt[Lt.reaction_type]||0)+1}),zt},Ke=it=>{var zt;return(zt=it.find(Lt=>Lt.user_id===(e==null?void 0:e.id)))==null?void 0:zt.reaction_type},tt=it=>it.reduce((zt,Lt)=>zt+1+(Lt.replies?tt(Lt.replies):0),0),ct=it=>{if(s)return!0;if(!t||!it.private_group_id)return!1;const zt=Ie.find(Lt=>Lt.id===it.private_group_id);return zt!=null&&zt.brokerage_id?n.some(Lt=>Lt.id===zt.brokerage_id):!1};return r.jsx(Fr,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(TNt,{categories:Me,privateGroups:Ie,selectedFilter:m,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(ANt,{categories:Me,privateGroups:Ie,selectedFilter:m,onFilterChange:x,onlineUsers:o}),r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:a||void 0}),r.jsx(ta,{children:e!=null&&e.email?Ze(e.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(Zre,{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:v,onMentionsChange:Te,onTemplatesChange:we,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),P.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:P.map((it,zt)=>{var Lt;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Lt=I[zt])!=null&&Lt.type.startsWith("video/")?r.jsx("video",{src:it,className:"w-full h-full object-cover"}):r.jsx("img",{src:it,alt:"",className:"w-full h-full object-cover"}),r.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Ee(zt),children:r.jsx(ds,{className:"h-3 w-3"})})]},zt)})}),D&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(lt,{value:D,onChange:it=>U(it.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>U(""),children:r.jsx(ds,{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:u,onChange:Ce,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>{var it;return(it=u.current)==null?void 0:it.click()},children:[r.jsx(Fl,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>{var it;return(it=u.current)==null?void 0:it.click()},children:[r.jsx(Ia,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>U("https://"),children:[r.jsx(Oo,{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:[Ie.length>0?r.jsxs(un,{value:k||b||"none",onValueChange:it=>{it==="none"?(N(""),M("")):it.startsWith("group:")?(M(it.replace("group:","")),N("")):(N(it),M(""))},children:[r.jsx(ln,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(mn,{placeholder:"Select..."})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"No category"}),Me.map(it=>r.jsxs($t,{value:it.id,children:[it.icon," ",it.name]},it.id)),Ie.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"}),Ie.map(it=>r.jsxs($t,{value:`group:${it.id}`,children:[it.icon||"🔒"," ",it.name]},it.id))]})]})]}):r.jsxs(un,{value:b,onValueChange:N,children:[r.jsx(ln,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(mn,{placeholder:"Category"})}),r.jsx(cn,{children:Me.map(it=>r.jsxs($t,{value:it.id,children:[it.icon," ",it.name]},it.id))})]}),r.jsxs(Q,{size:"sm",onClick:()=>le.mutate(),disabled:!y.trim()||V,children:[r.jsx(Ji,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Ve?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((it,zt)=>r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Er,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Er,{className:"h-4 w-32"}),r.jsx(Er,{className:"h-4 w-full"}),r.jsx(Er,{className:"h-4 w-3/4"})]})]})})},zt))}):at.length===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Ul,{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:[at.map(it=>{var zt,Lt,lr,Ar;return r.jsx(He,{children:r.jsxs(et,{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(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:it.user_avatar||void 0}),r.jsx(ta,{children:Ze(it.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:it.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:bu(new Date(it.created_at),{addSuffix:!0})}),it.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(At,{variant:"secondary",className:"text-xs",children:[it.category.icon," ",it.category.name]})]})]})]})]}),(it.user_id===(e==null?void 0:e.id)||ct(it))&&r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(gp,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",children:[ct(it)&&it.private_group_id&&r.jsx(Va,{onClick:()=>st.mutate({postId:it.id,isPinned:it.is_pinned}),children:it.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(gA,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(Y1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),it.user_id===(e==null?void 0:e.id)&&r.jsxs(Va,{onClick:()=>{ee(it),oe(it.content)},children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Va,{className:"text-destructive",onClick:()=>Je.mutate(it.id),children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),it.user_id!==(e==null?void 0:e.id)?"Remove (Moderate)":"Delete"]})]})]})]}),it.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(Y1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(z0e,{content:it.content})}),it.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${it.media.length===1?"grid-cols-1":it.media.length===2?"grid-cols-2":it.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:it.media.slice(0,4).map((Mr,Zr)=>{const Xn=Zr===3&&it.media.length>4,dr=it.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${it.media.length===1?"max-h-[500px]":it.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>Xe({open:!0,images:it.media.map(En=>({url:En.media_url,type:En.media_type==="video"?"video":"image"})),index:Zr}),children:[Mr.media_type==="video"?r.jsx("video",{src:Mr.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:Mr.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"})})})}),Xn&&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:["+",dr]})})]},Mr.id)})}),it.link_url&&r.jsxs("a",{href:it.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[it.link_image&&r.jsx("div",{className:"aspect-video bg-muted",children:r.jsx("img",{src:it.link_image,alt:it.link_title||"Link preview",className:"w-full h-full object-cover",onError:Mr=>{Mr.currentTarget.style.display="none"}})}),r.jsx("div",{className:"p-3",children:it.link_title?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:it.link_title}),it.link_description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:it.link_description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(it.link_url).hostname})]}):r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(Oo,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:it.link_url})]})})]}),it.reactions.length>0&&r.jsx(U9e,{reactions:it.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(Le(it.reactions)).slice(0,3).map(([Mr])=>{var Zr;return r.jsx("span",{className:"text-base",children:(Zr=kO.find(Xn=>Xn.type===Mr))==null?void 0:Zr.emoji},Mr)})}),r.jsx("span",{children:it.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"ghost",size:"sm",className:"flex-1",children:[Ke(it.reactions)?r.jsx("span",{className:"mr-1",children:(zt=kO.find(Mr=>Mr.type===Ke(it.reactions)))==null?void 0:zt.emoji}):r.jsx(Bd,{className:"h-4 w-4 mr-1"}),Ke(it.reactions)?(Lt=kO.find(Mr=>Mr.type===Ke(it.reactions)))==null?void 0:Lt.label:"Like"]})}),r.jsx(Tc,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:kO.map(Mr=>r.jsx("button",{onClick:()=>je.mutate({postId:it.id,reactionType:Mr.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:Mr.label,children:Mr.emoji},Mr.type))})})]}),r.jsxs(Q,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ne(Mr=>{const Zr=new Set(Mr);return Zr.has(it.id)?Zr.delete(it.id):Zr.add(it.id),Zr}),children:[r.jsx(Ul,{className:"h-4 w-4 mr-1"}),(()=>{const Mr=tt(it.comments);return Mr>0?`Comment (${Mr})`:"Comment"})()]})]}),pe.has(it.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[it.comments.map(Mr=>r.jsx(q9e,{comment:Mr,postId:it.id,currentUserId:e==null?void 0:e.id,currentUserAvatar:a,currentUserEmail:e==null?void 0:e.email,canModerate:ct(it)},Mr.id)),e&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:a||void 0}),r.jsx(ta,{className:"text-xs",children:Ze(((lr=e.email)==null?void 0:lr.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(Zre,{placeholder:"Write a comment... (use @ to mention)",value:fe[it.id]||"",onChange:Mr=>se(Zr=>({...Zr,[it.id]:Mr})),onMentionsChange:Mr=>ue(Zr=>({...Zr,[it.id]:Mr})),mentionFormat:"plain",onKeyDown:Mr=>{var Zr;Mr.defaultPrevented||Mr.key==="Enter"&&!Mr.shiftKey&&((Zr=fe[it.id])!=null&&Zr.trim())&&(Mr.preventDefault(),ut.mutate({postId:it.id,content:fe[it.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>{var Mr;(Mr=fe[it.id])!=null&&Mr.trim()&&ut.mutate({postId:it.id,content:fe[it.id]})},disabled:!((Ar=fe[it.id])!=null&&Ar.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(Ji,{className:"h-4 w-4"})})]})]})]})]})},it.id)}),ot&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(Q,{variant:"outline",onClick:()=>Tt(),disabled:Oe,children:Oe?"Loading…":"Load more posts"})})]}),r.jsx(Rr,{open:!!G,onOpenChange:()=>ee(null),children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:"Edit Post"})}),r.jsx(Zn,{value:ae,onChange:it=>oe(it.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>ee(null),children:"Cancel"}),r.jsx(Q,{onClick:()=>{G&&qe.mutate({postId:G.id,content:ae})},disabled:!ae.trim(),children:"Save Changes"})]})]})}),r.jsx(VNt,{images:ve.images,initialIndex:ve.index,open:ve.open,onOpenChange:it=>Xe(zt=>({...zt,open:it}))})]})]})})},LS={open:{label:"Open",icon:Xa,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ul,color:"bg-blue-500"},resolved:{label:"Resolved",icon:oi,color:"bg-green-500"},closed:{label:"Closed",icon:bc,color:"bg-muted-foreground"}},q4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function KNt(){const{user:e}=tn(),t=Vr(),[n,s]=A.useState(null),[a,o]=A.useState(""),{data:l=[],isLoading:i}=Zt({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:v}=await Y.from("support_tickets").select("*").eq("user_id",e==null?void 0:e.id).order("created_at",{ascending:!1});if(v)throw v;return y},enabled:!!e}),{data:u=[]}=Zt({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:y,error:v}=await Y.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(v)throw v;return y},enabled:!!n}),m=ar({mutationFn:async y=>{if(!n||!e)throw new Error("Missing data");const{error:v}=await Y.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:y,is_admin_reply:!1});if(v)throw v},onSuccess:()=>{t.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),Ae.success("Reply sent!")},onError:()=>{Ae.error("Failed to send reply")}}),x=()=>{a.trim()&&m.mutate(a)};if(n){const y=LS[n.status].icon;return r.jsx(Fr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Wi,{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(At,{variant:"secondary",children:q4e[n.category]}),r.jsxs(At,{className:LS[n.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),LS[n.status].label]})]})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(jn,{children:["Created on ",on(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(Vo,{className:"h-[300px] pr-4",children:u.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:u.map(v=>{var b;return r.jsxs("div",{className:`p-4 rounded-lg ${v.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:v.is_admin_reply?"Support Team":((b=v.profiles)==null?void 0:b.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(v.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:v.content})]},v.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(Od,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Zn,{placeholder:"Type your reply...",value:a,onChange:v=>o(v.target.value),className:"min-h-[80px]"}),r.jsx(Q,{onClick:x,disabled:!a.trim()||m.isPending,className:"self-end",children:r.jsx(Ji,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Fr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(He,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(et,{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(Kx,{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(bme,{trigger:r.jsxs(Q,{size:"lg",className:"gap-2",children:[r.jsx(_n,{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(Ai,{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(bme,{trigger:r.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"New Ticket"]})})]}),i?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):l.length===0?r.jsx(He,{className:"border-dashed",children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Ul,{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 v=LS[y.status].icon;return r.jsx(He,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(y),children:r.jsx(et,{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(At,{variant:"outline",className:"text-xs",children:q4e[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(At,{className:LS[y.status].color,children:[r.jsx(v,{className:"h-3 w-3 mr-1"}),LS[y.status].label]})]})})},y.id)})})]})})}function ZNt({open:e,onOpenChange:t}){return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx($r,{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(Cs,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Br,{children:"Schedule Agent Onboarding"}),r.jsx(Yn,{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 YNt({open:e,onOpenChange:t}){const{brokerageId:n}=tn(),[s,a]=A.useState(""),[o,l]=A.useState([]),[i,u]=A.useState(!1),{data:m,isLoading:x}=Zt({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:k,error:M}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(M)throw M;return k},enabled:e&&!!n}),y=m==null?void 0:m.filter(k=>k.name.toLowerCase().includes(s.toLowerCase())||k.email.toLowerCase().includes(s.toLowerCase())),v=k=>{l(M=>M.includes(k)?M.filter(I=>I!==k):[...M,k])},b=async()=>{if(o.length===0){Ae.error("Please select at least one agent");return}u(!0);try{const{data:k,error:M}=await Y.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(M)throw M;Ae.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),t(!1)}catch(k){console.error("Error sending onboarding link:",k),Ae.error(k.message||"Failed to send onboarding link")}finally{u(!1)}},N=k=>{k||(l([]),a("")),t(k)};return r.jsx(Rr,{open:e,onOpenChange:N,children:r.jsxs(Dr,{className:"max-w-md",children:[r.jsx($r,{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(Ji,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Br,{children:"Send Onboarding Link"}),r.jsx(Yn,{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(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search agents...",value:s,onChange:k=>a(k.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gr,{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($n,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(Vo,{className:"h-[300px] border rounded-lg",children:r.jsx("div",{className:"p-2 space-y-1",children:y==null?void 0:y.map(k=>r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>v(k.id),children:[r.jsx(_l,{checked:o.includes(k.id),onCheckedChange:()=>v(k.id)}),r.jsx(ea,{className:"h-8 w-8",children:r.jsx(ta,{className:"text-xs",children:k.name.split(" ").map(M=>M[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:k.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.email})]})]},k.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),r.jsx(Q,{onClick:b,disabled:o.length===0||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function XNt(){const[e,t]=A.useState(!1),[n,s]=A.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(He,{className:"mb-8",children:[r.jsx(Ht,{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($n,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{children:"Agent Onboarding"}),r.jsx(jn,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(Q,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(Cs,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(Q,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(Ji,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(ZNt,{open:e,onOpenChange:t}),r.jsx(YNt,{open:n,onOpenChange:s})]})}function QNt({open:e,onOpenChange:t}){return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx($r,{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(Bg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Br,{children:"Schedule Launch Meeting"}),r.jsx(Yn,{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 JNt(){const[e,t]=A.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(He,{className:"mb-8",children:[r.jsx(Ht,{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(Bg,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{children:"Launch or ReLaunch Meeting"}),r.jsx(jn,{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(et,{children:r.jsxs(Q,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(Bg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(QNt,{open:e,onOpenChange:t})]})}function eSt(){const e=Vn(),[t,n]=A.useState(""),[s,a]=A.useState(null),{data:o,isLoading:l}=Zt({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:k,error:M}=await Y.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(M)throw M;return k}}),{data:i}=Zt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:k,error:M}=await Y.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(M)throw M;return k}}),{data:u}=Zt({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:k,error:M}=await Y.from("brokerage_resource_pdfs").select("resource_id");if(M)throw M;return k}}),{data:m}=Zt({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:k,error:M}=await Y.from("brokerage_resource_videos").select("resource_id");if(M)throw M;return k}}),{data:x}=Zt({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:k,error:M}=await Y.from("brokerage_resource_links").select("resource_id");if(M)throw M;return k}}),y=o==null?void 0:o.filter(k=>{var T;const M=k.title.toLowerCase().includes(t.toLowerCase())||((T=k.description)==null?void 0:T.toLowerCase().includes(t.toLowerCase())),I=!s||k.category_id===s;return M&&I}),v=i==null?void 0:i.filter(k=>o==null?void 0:o.some(M=>M.category_id===k.id)),b=k=>{const M=(u==null?void 0:u.filter(P=>P.resource_id===k).length)||0,I=(m==null?void 0:m.filter(P=>P.resource_id===k).length)||0,T=(x==null?void 0:x.filter(P=>P.resource_id===k).length)||0;return{pdfCount:M,videoCount:I,linkCount:T}},N=k=>{e(`/brokerage-resources/${k}`)};return r.jsx(Fr,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(XNt,{}),r.jsx(JNt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search resources...",value:t,onChange:k=>n(k.target.value),className:"pl-10"})]}),v&&v.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(At,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),v.map(k=>r.jsx(At,{variant:s===k.id?"default":"outline",className:"cursor-pointer",onClick:()=>a(k.id),children:k.name},k.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((k,M)=>r.jsxs(He,{children:[r.jsx(Er,{className:"h-40 w-full"}),r.jsx(Ht,{children:r.jsx(Er,{className:"h-5 w-3/4"})}),r.jsxs(et,{children:[r.jsx(Er,{className:"h-4 w-full mb-2"}),r.jsx(Er,{className:"h-4 w-2/3"})]})]},M))}):(y==null?void 0:y.length)===0?r.jsxs(He,{className:"p-12 text-center",children:[r.jsx(Oh,{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(k=>{const{pdfCount:M,videoCount:I,linkCount:T}=b(k.id),P=i==null?void 0:i.find(F=>F.id===k.category_id);return r.jsxs(He,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>N(k.id),children:[k.preview_image_url?r.jsx("img",{src:k.preview_image_url,alt:k.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(Oh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Gt,{className:"text-lg line-clamp-1",children:k.title}),P&&r.jsx(At,{variant:"secondary",className:"shrink-0 text-xs",children:P.name})]})}),r.jsxs(et,{children:[k.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:k.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[M>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(_a,{className:"h-4 w-4"}),M]}),I>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ia,{className:"h-4 w-4"}),I]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Oo,{className:"h-4 w-4"}),T]})]})]})]},k.id)})})]})})}const tSt=()=>{const{resourceId:e}=Ec(),{data:t,isLoading:n}=Zt({queryKey:["brokerage-resource-detail",e],queryFn:async()=>{const{data:a,error:o}=await Y.from("brokerage_resources").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;const{data:l}=await Y.from("brokerage_resource_pdfs").select("*").eq("resource_id",e).order("sort_order"),{data:i}=await Y.from("brokerage_resource_videos").select("*").eq("resource_id",e).order("sort_order"),{data:u}=await Y.from("brokerage_resource_links").select("*").eq("resource_id",e).order("sort_order");return{...a,pdfs:l||[],videos:i||[],links:u||[]}},enabled:!!e}),s=a=>a?a<1024?a+" B":a<1024*1024?(a/1024).toFixed(1)+" KB":(a/(1024*1024)).toFixed(1)+" MB":"";return n?r.jsx(Fr,{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(Fr,{title:t.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/brokerage-resources",children:[r.jsx(Wi,{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(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ia,{className:"h-4 w-4"}),"Videos (",t.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:t.videos.map(a=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:a.title}),r.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:a.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})})]},a.id))})]})}),t.pdfs&&t.pdfs.length>0&&r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(_a,{className:"h-4 w-4"}),"Documents (",t.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.pdfs.map(a=>r.jsxs("a",{href:a.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(_a,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:a.name}),a.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:s(a.file_size)})]})]}),r.jsx(so,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})}),t.links&&t.links.length>0&&r.jsx(He,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ss,{className:"h-4 w-4"}),"Canva Templates (",t.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.links.map(a=>r.jsxs("a",{href:a.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(Ss,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:a.title})]}),r.jsx(Ss,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})})]})}):r.jsx(Fr,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Oh,{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(Q,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function rSt(){const{onlineUsers:e,totalOnline:t}=pRe();return r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx($n,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(At,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Ju,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),t," online"]})]})}),r.jsx(et,{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(Vo,{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(ea,{className:"h-9 w-9",children:[r.jsx(Ci,{src:n.avatarUrl,alt:n.name}),r.jsx(ta,{className:"text-xs",children:(s=n.name)==null?void 0:s.split(" ").map(a=>a[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 ",bu(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const V4e={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:$n,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:CA,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:uf,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:qg,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:Nc,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:Vc,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:W1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:yy,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Os,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Os,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:fy,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:Tp,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:Oh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:Oh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"},{title:"Agent Email Templates",description:"Manage curated email templates for agents",icon:ws,path:"/admin/agent-email-templates",color:"bg-rose-500/10 text-rose-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:Fj,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:tm,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:ws,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:Ep,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:sA,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:$g,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:ao,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:io,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Canva, Facebook & Instagram for platform-level features",icon:gm,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Agent Cards",description:"Manage digital business cards for agents",icon:$n,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:Ep,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:Ro,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:M4,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:ks,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:ws,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:_c,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:vi,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:ya,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"},{title:"Presentation Analytics",description:"Track agent presentation usage, views, and leads",icon:py,path:"/admin/presentation-analytics",color:"bg-gradient-to-br from-violet-500/20 to-indigo-500/10 text-violet-600"}]}};function nSt(){const e=Vn();return r.jsx(Fr,{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(rSt,{})})]}),r.jsxs(wi,{defaultValue:"users",className:"w-full",children:[r.jsx(_i,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(V4e).map(([t,n])=>r.jsx(sn,{value:t,className:"data-[state=active]:bg-background",children:n.label},t))}),Object.entries(V4e).map(([t,n])=>r.jsx(Sn,{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(He,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>e(s.path),children:[r.jsxs(Ht,{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(Gt,{className:"text-base",children:s.title})]}),r.jsx(et,{className:"pt-0",children:r.jsx(jn,{className:"text-sm",children:s.description})})]},s.path))})},t))]})]})})}const Ds=A.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:Ut("w-full caption-bottom text-sm",e),...t})}));Ds.displayName="Table";const Rs=A.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:Ut("[&_tr]:border-b",e),...t}));Rs.displayName="TableHeader";const Fs=A.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:Ut("[&_tr:last-child]:border-0",e),...t}));Fs.displayName="TableBody";const sSt=A.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:Ut("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));sSt.displayName="TableFooter";const Sr=A.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:Ut("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Sr.displayName="TableRow";const Mt=A.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:Ut("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Mt.displayName="TableHead";const yt=A.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:Ut("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));yt.displayName="TableCell";const aSt=A.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:Ut("mt-4 text-sm text-muted-foreground",e),...t}));aSt.displayName="TableCaption";const iSt=()=>{const{isAdmin:e}=tn(),t=Vn(),[n,s]=A.useState([]),[a,o]=A.useState(!0),[l,i]=A.useState(!1),[u,m]=A.useState(null);A.useEffect(()=>{if(!e){t("/dashboard");return}x()},[e]);const x=async()=>{try{const{data:k,error:M}=await Y.from("app_tiles").select("*").order("name");if(M)throw M;s(k||[])}catch(k){console.error("Error loading apps:",k),Ae.error("Failed to load apps")}finally{o(!1)}},y=async k=>{k.preventDefault();const M=new FormData(k.currentTarget),I={name:M.get("name"),description:M.get("description"),icon:M.get("icon"),app_id:M.get("app_id"),target_url:M.get("target_url"),required_tags:M.get("required_tags").split(",").map(T=>T.trim()).filter(Boolean)};try{if(u){const{error:T}=await Y.from("app_tiles").update(I).eq("id",u.id);if(T)throw T;Ae.success("App updated successfully")}else{const{error:T}=await Y.from("app_tiles").insert([I]);if(T)throw T;Ae.success("App created successfully")}i(!1),m(null),x()}catch(T){console.error("Error saving app:",T),Ae.error("Failed to save app")}},v=async k=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:M}=await Y.from("app_tiles").delete().eq("id",k);if(M)throw M;Ae.success("App deleted successfully"),x()}catch(M){console.error("Error deleting app:",M),Ae.error("Failed to delete app")}},b=k=>{m(k),i(!0)},N=()=>{m(null),i(!0)};return a?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(Q,{variant:"ghost",size:"sm",onClick:()=>t("/dashboard"),children:[r.jsx(Wi,{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(Rr,{open:l,onOpenChange:i,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{onClick:N,children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsx(Br,{children:u?"Edit App":"Create New App"}),r.jsx(Yn,{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(ze,{htmlFor:"name",children:"App Name"}),r.jsx(lt,{id:"name",name:"name",defaultValue:u==null?void 0:u.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"app_id",children:"App ID"}),r.jsx(lt,{id:"app_id",name:"app_id",defaultValue:u==null?void 0:u.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",name:"description",defaultValue:u==null?void 0:u.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(lt,{id:"icon",name:"icon",defaultValue:u==null?void 0:u.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"target_url",children:"Target URL"}),r.jsx(lt,{id:"target_url",name:"target_url",type:"url",defaultValue:u==null?void 0:u.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(lt,{id:"required_tags",name:"required_tags",defaultValue:u==null?void 0:u.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(Q,{type:"submit",children:u?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Application Tiles"}),r.jsx(jn,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(et,{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(Q,{onClick:N,children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Icon"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"App ID"}),r.jsx(Mt,{children:"Target URL"}),r.jsx(Mt,{children:"Tags"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:n.map(k=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"text-2xl",children:k.icon}),r.jsx(yt,{className:"font-medium",children:k.name}),r.jsx(yt,{className:"font-mono text-sm",children:k.app_id}),r.jsx(yt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:k.target_url}),r.jsx(yt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:k.required_tags.map(M=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:M},M))})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>b(k),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>v(k.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},k.id))})]})})]})})]})};function Tu({title:e,description:t,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(co,{to:"/admin",children:r.jsxs(Q,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(Wi,{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 H4e=({expiresAt:e,className:t})=>{const n=new Date().getTime(),s=new Date(e).getTime(),a=Math.ceil((s-n)/(1e3*60*60*24));return a<=0?r.jsxs(At,{variant:"destructive",className:Ut("gap-1",t),children:[r.jsx(Nh,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?r.jsxs(At,{variant:"destructive",className:Ut("gap-1",t),children:[r.jsx(Xa,{className:"h-3 w-3"}),"Trial: <1 day left"]}):a<=3?r.jsxs(At,{className:Ut("gap-1 bg-amber-500 hover:bg-amber-600",t),children:[r.jsx(Xa,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):r.jsxs(At,{variant:"secondary",className:Ut("gap-1",t),children:[r.jsx(Xa,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},V9e=({open:e,onOpenChange:t,brokerages:n,fixedBrokerageId:s,onSuccess:a})=>{const{toast:o}=fi(),l=A.useRef(null),[i,u]=A.useState([]),[m,x]=A.useState(""),[y,v]=A.useState(!1),[b,N]=A.useState("upload"),[k,M]=A.useState(null),I=()=>{u([]),x(""),N("upload"),M(null),l.current&&(l.current.value="")},T=()=>{I(),t(!1)},P=W=>{const G=W.split(` `).map(ne=>ne.trim()).filter(ne=>ne);if(G.length===0)return[];const ee=G[0].toLowerCase(),oe=ee.includes("first")||ee.includes("last")||ee.includes("email")||ee.includes("name")||ee.includes("phone")||ee.includes("sms")||ee.includes("consent")?G.slice(1):G,pe=[];for(const ne of oe){const se=(ne.includes(" ")?ne.split(" "):ne.split(",")).map(me=>me.trim().replace(/^["']|["']$/g,""));if(se.length>=2){let me="",ue="",xe="",Te="",_e;if(se.length===2){const Xe=se[0].split(" ");me=Xe[0]||"",ue=Xe.slice(1).join(" ")||"",xe=se[1]}else if(se.length===3)me=se[0],ue=se[1],xe=se[2];else if(se.length===4)me=se[0],ue=se[1],xe=se[2],Te=se[3];else if(se.length>=5){me=se[0],ue=se[1],xe=se[2],Te=se[3];const Xe=se[4].toLowerCase();_e=Xe==="true"||Xe==="yes"||Xe==="1"||Xe==="y"}const ve=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(xe);pe.push({firstName:me.trim(),lastName:ue.trim(),email:xe.trim().toLowerCase(),phone:Te.trim()||void 0,smsConsent:_e,isValid:ve&&me.trim().length>0,error:ve?me.trim()?void 0:"Missing name":"Invalid email"})}}return pe},F=W=>{var ae;const G=(ae=W.target.files)==null?void 0:ae[0];if(!G)return;const ee=new FileReader;ee.onload=oe=>{var fe;const pe=(fe=oe.target)==null?void 0:fe.result,ne=P(pe);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}u(ne),N("preview")},ee.readAsText(G)},D=async()=>{const W=i.filter(ee=>ee.isValid);if(W.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const G=s||m||null;v(!0);try{const{data:{session:ee}}=await Y.auth.getSession(),ae=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ee==null?void 0:ee.access_token}`},body:JSON.stringify({users:W.map(pe=>({firstName:pe.firstName,lastName:pe.lastName,email:pe.email,phone:pe.phone,smsConsent:pe.smsConsent})),brokerageId:G})}),oe=await ae.json();if(!ae.ok)throw new Error(oe.error||"Failed to import users");M(oe),N("result"),oe.created>0&&a(),o({title:"Import Complete",description:`${oe.created} user(s) created successfully.${oe.failed>0?` ${oe.failed} failed.`:""}`})}catch(ee){console.error("Import error:",ee),o({title:"Import Failed",description:ee.message||"Failed to import users",variant:"destructive"})}finally{v(!1)}},U=i.filter(W=>W.isValid).length,V=i.filter(W=>!W.isValid).length;return r.jsx(Rr,{open:e,onOpenChange:T,children:r.jsxs(Dr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(V1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(Yn,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),b==="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:F,className:"hidden"}),r.jsx(bo,{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(Q,{onClick:()=>{var W;return(W=l.current)==null?void 0:W.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."})]})]}),b==="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(ze,{children:"Assign to Brokerage (optional)"}),r.jsxs(un,{value:m||"none",onValueChange:W=>x(W==="none"?"":W),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select a brokerage..."})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"No brokerage"}),n.map(W=>r.jsx($t,{value:W.id,children:W.name},W.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(no,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[U," valid"]})]}),V>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(yl,{className:"h-4 w-4"}),r.jsxs("span",{children:[V," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/30",children:[r.jsx(Mt,{children:"First Name"}),r.jsx(Mt,{children:"Last Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Phone"}),r.jsx(Mt,{children:"SMS"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Fs,{children:i.slice(0,100).map((W,G)=>r.jsxs(Sr,{children:[r.jsx(yt,{children:W.firstName}),r.jsx(yt,{children:W.lastName}),r.jsx(yt,{children:W.email}),r.jsx(yt,{className:"text-muted-foreground",children:W.phone||"-"}),r.jsx(yt,{className:"text-muted-foreground",children:W.smsConsent===!0?"✓":W.smsConsent===!1?"✗":"-"}),r.jsx(yt,{children:W.isValid?r.jsx(At,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(At,{variant:"destructive",children:W.error||"Invalid"})})]},G))})]}),i.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",i.length," users"]})]})]}),b==="result"&&k&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(no,{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:[k.created," agent(s) created and invited"]}),k.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[k.failed," failed to create"]})]}),k.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:[k.errors.slice(0,10).map((W,G)=>r.jsxs("li",{children:["• ",W]},G)),k.errors.length>10&&r.jsxs("li",{children:["...and ",k.errors.length-10," more"]})]})]})]}),r.jsxs(Vs,{children:[b==="upload"&&r.jsx(Q,{variant:"outline",onClick:T,children:"Cancel"}),b==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(Q,{variant:"outline",onClick:I,children:"Back"}),r.jsx(Q,{onClick:D,disabled:y||U===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${U} Agent${U!==1?"s":""}`})]}),b==="result"&&r.jsx(Q,{onClick:T,children:"Done"})]})]})})},oSt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:ks},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:io},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:Hc}];function H9e({open:e,onOpenChange:t,userId:n,userName:s}){const[a,o]=A.useState("custom"),[l,i]=A.useState(""),[u,m]=A.useState(""),x=Plt(),y=b=>{o(b.type),i(b.title),m(b.message)},v=async b=>{if(b.preventDefault(),!l.trim()){Sa({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:n,celebration_type:a,title:l.trim(),message:u.trim()||void 0}),Sa({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),t(!1),i(""),m(""),o("custom")}catch{Sa({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(Hc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(Yn,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(ze,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:oSt.map((b,N)=>r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>y(b),className:"text-xs",children:[r.jsx(b.icon,{className:"h-3 w-3 mr-1"}),b.title]},N))})]}),r.jsxs("form",{onSubmit:v,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(un,{value:a,onValueChange:b=>o(b),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ks,{className:"h-4 w-4"})," Custom"]})}),r.jsx($t,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx($t,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ya,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx($t,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Fd,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(lt,{id:"title",value:l,onChange:b=>i(b.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"message",children:"Message (optional)"}),r.jsx(Zn,{id:"message",value:u,onChange:b=>m(b.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:x.isPending,children:[r.jsx(Hc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Ade={points_earned:{label:"Points Earned",icon:io,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:ya,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:Fd,color:"bg-green-500"},custom:{label:"Custom",icon:Os,color:"bg-purple-500"}};function lSt(){const[e,t]=A.useState(""),[n,s]=A.useState("all"),[a,o]=A.useState("all"),{data:l=[],isLoading:i}=Zt({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:y}=await Y.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(y)throw y;const v=[...new Set([...x.map(k=>k.user_id),...x.map(k=>k.created_by).filter(Boolean)])],{data:b}=await Y.from("profiles").select("id, name, email").in("id",v),N=new Map((b==null?void 0:b.map(k=>[k.id,k]))||[]);return x.map(k=>{var M,I,T;return{...k,user_name:((M=N.get(k.user_id))==null?void 0:M.name)||"Unknown",user_email:((I=N.get(k.user_id))==null?void 0:I.email)||"",creator_name:k.created_by?((T=N.get(k.created_by))==null?void 0:T.name)||"System":"Auto-triggered"}})}}),u=l.filter(x=>{var N,k;const y=((N=x.user_name)==null?void 0:N.toLowerCase().includes(e.toLowerCase()))||((k=x.user_email)==null?void 0:k.toLowerCase().includes(e.toLowerCase()))||x.title.toLowerCase().includes(e.toLowerCase()),v=n==="all"||x.celebration_type===n,b=a==="all"||a==="seen"&&x.seen_at||a==="unseen"&&!x.seen_at;return y&&v&&b}),m={total:l.length,seen:l.filter(x=>x.seen_at).length,unseen:l.filter(x=>!x.seen_at).length,byType:Object.keys(Ade).reduce((x,y)=>(x[y]=l.filter(v=>v.celebration_type===y).length,x),{})};return i?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Gr,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:m.total})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:m.seen})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:m.unseen})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:m.byType.custom||0})})]})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Hc,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(jn,{children:"View all celebrations awarded to agents"})]}),r.jsxs(et,{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(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by agent name, email, or title...",value:e,onChange:x=>t(x.target.value),className:"pl-9"})]}),r.jsxs(un,{value:n,onValueChange:s,children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{placeholder:"Filter by type"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Types"}),Object.entries(Ade).map(([x,y])=>r.jsx($t,{value:x,children:y.label},x))]})]}),r.jsxs(un,{value:a,onValueChange:o,children:[r.jsx(ln,{className:"w-[140px]",children:r.jsx(mn,{placeholder:"Status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Status"}),r.jsx($t,{value:"seen",children:"Seen"}),r.jsx($t,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Points"}),r.jsx(Mt,{children:"Created By"}),r.jsx(Mt,{children:"Created"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Fs,{children:u.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):u.map(x=>{const y=Ade[x.celebration_type],v=y.icon;return r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs(At,{variant:"outline",className:"gap-1",children:[r.jsx(v,{className:"h-3 w-3"}),y.label]})}),r.jsx(yt,{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(yt,{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(yt,{children:x.points_amount?r.jsxs(At,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:on(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(yt,{children:x.seen_at?r.jsx(At,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(At,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),u.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",u.length," of ",l.length," celebrations"]})]})]})]})}const cSt=()=>{const{user:e}=tn(),{toast:t}=fi(),[n,s]=A.useState([]),[a,o]=A.useState(!0),[l,i]=A.useState(!1),[u,m]=A.useState("all"),[x,y]=A.useState("all"),[v,b]=A.useState("new"),[N,k]=A.useState(new Set),M=A.useCallback(async()=>{try{o(!0);const{data:pe,error:ne}=await Y.from("profiles").select("id, name, email, phone, is_trial, trial_started_at, trial_expires_at, subscription_status, subscription_end_date, converted_from_trial_at, created_at").or("is_trial.eq.true,subscription_status.eq.trialing,converted_from_trial_at.not.is.null");if(ne)throw ne;const{data:fe,error:se}=await Y.from("trial_email_exports").select("user_id");if(se)throw se;const me=new Set((fe||[]).map(xe=>xe.user_id)),ue=(pe||[]).map(xe=>({...xe,converted_from_trial_at:xe.converted_from_trial_at??null,already_exported:me.has(xe.id)}));ue.sort((xe,Te)=>new Date(Te.created_at).getTime()-new Date(xe.created_at).getTime()),s(ue)}catch(pe){console.error("Error loading trial users:",pe),t({title:"Error",description:"Failed to load trial users",variant:"destructive"})}finally{o(!1)}},[t]);A.useEffect(()=>{M()},[M]);const I=pe=>pe.trial_started_at?"ghl":"stripe",T=pe=>pe.trial_expires_at?pe.trial_expires_at:pe.subscription_end_date?pe.subscription_end_date:null,P=pe=>pe.converted_from_trial_at!==null,F=pe=>{if(P(pe))return!1;const ne=T(pe);return ne?new Date(ne).getTime()<=Date.now():!1},D=n.filter(pe=>!(u!=="all"&&I(pe)!==u||x==="active"&&(F(pe)||P(pe))||x==="expired"&&!F(pe)||x==="converted"&&!P(pe)||v==="new"&&pe.already_exported||v==="exported"&&!pe.already_exported)),U=()=>{N.size===D.length?k(new Set):k(new Set(D.map(pe=>pe.id)))},V=pe=>{const ne=new Set(N);ne.has(pe)?ne.delete(pe):ne.add(pe),k(ne)},W=async()=>{if(N.size===0){t({title:"No users selected",description:"Select users to export",variant:"destructive"});return}i(!0);try{const pe=n.filter(_e=>N.has(_e.id)),ne="First Name,Last Name,Email,Phone,Trial Type,Status,Signup Date,Expiry Date",fe=pe.map(_e=>{const we=(_e.name||"").split(" "),ve=we[0]||"",Xe=we.slice(1).join(" ")||"",Me=I(_e)==="stripe"?"Credit Card Trial":"Free Trial (No CC)",Ie=P(_e)?"Converted":F(_e)?"Expired":"Active",$e=_e.created_at?new Date(_e.created_at).toLocaleDateString():"",Be=T(_e)?new Date(T(_e)).toLocaleDateString():"";return`"${ve}","${Xe}","${_e.email}","${_e.phone||""}","${Me}","${Ie}","${$e}","${Be}"`}),se=[ne,...fe].join(` `),me=new Blob([se],{type:"text/csv"}),ue=URL.createObjectURL(me),xe=document.createElement("a");xe.href=ue,xe.download=`trial-users-${new Date().toISOString().split("T")[0]}.csv`,xe.click(),URL.revokeObjectURL(ue);const Te=pe.filter(_e=>!_e.already_exported).map(_e=>({user_id:_e.id,exported_by:e.id}));if(Te.length>0){const{error:_e}=await Y.from("trial_email_exports").upsert(Te,{onConflict:"user_id"});_e&&console.error("Error marking exports:",_e)}t({title:"Export complete",description:`Downloaded ${pe.length} trial user(s). ${Te.length} newly marked as exported.`}),k(new Set),M()}catch(pe){console.error("Export error:",pe),t({title:"Error",description:"Failed to export",variant:"destructive"})}finally{i(!1)}},G=n.filter(pe=>!pe.already_exported).length,ee=n.filter(pe=>pe.already_exported).length,ae=n.filter(pe=>P(pe)).length,oe=n.filter(pe=>!F(pe)&&!P(pe)).length;return a?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-5 gap-4",children:[r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"Total"}),r.jsx(Gt,{className:"text-2xl",children:n.length})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"New (Not Exported)"}),r.jsx(Gt,{className:"text-2xl text-green-600",children:G})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"Active Trials"}),r.jsx(Gt,{className:"text-2xl",children:oe})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"Converted 🎉"}),r.jsx(Gt,{className:"text-2xl text-primary",children:ae})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"Already Exported"}),r.jsx(Gt,{className:"text-2xl text-muted-foreground",children:ee})]})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(un,{value:v,onValueChange:pe=>b(pe),children:[r.jsx(ln,{className:"w-[160px]",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Users"}),r.jsx($t,{value:"new",children:"New Only"}),r.jsx($t,{value:"exported",children:"Already Exported"})]})]}),r.jsxs(un,{value:u,onValueChange:pe=>m(pe),children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Trial Types"}),r.jsx($t,{value:"stripe",children:"Credit Card Trial"}),r.jsx($t,{value:"ghl",children:"Free Trial (No CC)"})]})]}),r.jsxs(un,{value:x,onValueChange:pe=>y(pe),children:[r.jsx(ln,{className:"w-[160px]",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),r.jsx($t,{value:"active",children:"Active Trial"}),r.jsx($t,{value:"expired",children:"Expired"}),r.jsx($t,{value:"converted",children:"Converted ✓"})]})]}),r.jsx("div",{className:"ml-auto",children:r.jsxs(Q,{onClick:W,disabled:l||N.size===0,children:[l?r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(so,{className:"h-4 w-4 mr-2"}),"Export Selected (",N.size,")"]})})]}),r.jsx("div",{className:"border rounded-lg",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(_l,{checked:D.length>0&&N.size===D.length,onCheckedChange:U})}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Trial Type"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Signup Date"}),r.jsx(Mt,{children:"Expires / Renews"}),r.jsx(Mt,{children:"Exported"})]})}),r.jsx(Fs,{children:D.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No trial users match the current filters"})}):D.map(pe=>{const ne=I(pe),fe=P(pe),se=F(pe),me=T(pe);return r.jsxs(Sr,{className:`hover:bg-muted/30 ${fe?"bg-primary/5":""}`,children:[r.jsx(yt,{children:r.jsx(_l,{checked:N.has(pe.id),onCheckedChange:()=>V(pe.id)})}),r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[pe.name,fe&&r.jsx(eh,{className:"h-3.5 w-3.5 text-primary"})]})}),r.jsx(yt,{className:"text-muted-foreground",children:pe.email}),r.jsx(yt,{children:ne==="stripe"?r.jsxs(At,{variant:"outline",className:"gap-1",children:[r.jsx(uf,{className:"h-3 w-3"}),"Credit Card"]}):r.jsxs(At,{variant:"secondary",className:"gap-1",children:[r.jsx(ws,{className:"h-3 w-3"}),"Free (No CC)"]})}),r.jsx(yt,{children:fe?r.jsxs(At,{className:"bg-primary/10 text-primary hover:bg-primary/20 gap-1",children:[r.jsx(eh,{className:"h-3 w-3"}),"Converted"]}):se?r.jsx(At,{variant:"destructive",children:"Expired"}):r.jsx(At,{className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active Trial"})}),r.jsx(yt,{className:"text-sm",children:pe.created_at?new Date(pe.created_at).toLocaleDateString():"—"}),r.jsx(yt,{className:"text-sm",children:fe&&me?r.jsxs("span",{className:"text-muted-foreground",children:["Renews ",new Date(me).toLocaleDateString()]}):me?new Date(me).toLocaleDateString():"—"}),r.jsx(yt,{children:pe.already_exported?r.jsx(no,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(At,{variant:"outline",className:"text-green-600 border-green-300",children:"New"})})]},pe.id)})})]})}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",D.length," of ",n.length," trial users · ",ae," converted to paid"]})]})},dSt=()=>{const[e,t]=A.useState([]),[n,s]=A.useState(!0);return A.useEffect(()=>{(async()=>{const{data:o,error:l}=await Y.from("user_deletion_log").select("*").order("created_at",{ascending:!1});!l&&o&&t(o),s(!1)})()},[]),n?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.length===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Bn,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),r.jsx("p",{children:"No deletion records yet"})]})}):r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"User Deletion History"})}),r.jsx(et,{children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Date"}),r.jsx(Mt,{children:"User"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Deleted By"})]})}),r.jsx(Fs,{children:e.map(a=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"whitespace-nowrap text-sm",children:on(new Date(a.created_at),"MMM d, yyyy h:mm a")}),r.jsx(yt,{className:"font-medium",children:a.deleted_user_name||"—"}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:a.deleted_user_email||"—"}),r.jsx(yt,{children:a.brokerage_name||"—"}),r.jsx(yt,{children:r.jsx(At,{variant:a.deletion_type==="deleted"?"destructive":"secondary",children:a.deletion_type==="deleted"?"Account Deleted":"Removed"})}),r.jsx(yt,{className:"text-sm",children:a.deleted_by_name||a.deleted_by_email||"—"})]},a.id))})]})})]})},uSt=()=>{const e=Vn(),{user:t,isAdmin:n}=tn(),{startImpersonation:s,isLoading:a}=Pxe(),{toast:o}=fi(),[l,i]=A.useState([]),[u,m]=A.useState([]),[x,y]=A.useState([]),[v,b]=A.useState({}),[N,k]=A.useState(!0),[M,I]=A.useState({}),[T,P]=A.useState(!1),[F,D]=A.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[U,V]=A.useState(!1),[W,G]=A.useState(""),[ee,ae]=A.useState(1),[oe,pe]=A.useState(50),[ne,fe]=A.useState("all"),[se,me]=A.useState("all"),[ue,xe]=A.useState("all"),[Te,_e]=A.useState("all"),[we,ve]=A.useState(!1),[Xe,Me]=A.useState(!1),[Ie,$e]=A.useState(null),[Be,Ve]=A.useState(null),[ot,Tt]=A.useState(!1),[Oe,at]=A.useState({name:"",email:"",brokerage_id:"",phone:""}),[le,qe]=A.useState(null),[Je,st]=A.useState(!1),[je,ut]=A.useState(""),[Ce,Ee]=A.useState(!1),[Ze,Le]=A.useState(!1),[Ke,tt]=A.useState(null),[ct,it]=A.useState(""),[zt,Lt]=A.useState(!1),[lr,Ar]=A.useState(!1),[Mr,Zr]=A.useState(null),[Xn,dr]=A.useState(!1),[En,Es]=A.useState(!1),[Hs,Ei]=A.useState(null),[Ii,Ho]=A.useState(""),[Ha,us]=A.useState(!1),[ra,hs]=A.useState({email:"",name:"",password:"",phone:""}),[Ys,zs]=A.useState(!1),[ji,ir]=A.useState(!1),[Pa,oo]=A.useState(""),[bi,qn]=A.useState(!1),[Ki,dc]=A.useState(!1),[go,uc]=A.useState(""),[rt,ye]=A.useState(new Set),[Pe,Ye]=A.useState(!1),[Nt,bt]=A.useState(!1),[It,qt]=A.useState(null),[Ot,Wt]=A.useState(!1),[pr,cr]=A.useState(null),[Xr,Cn]=A.useState([]),[Kr,is]=A.useState([]),[ls,ts]=A.useState(!1),[Ws,$i]=A.useState({});A.useEffect(()=>{!t||!n||(ba(),Co())},[t,n]);const jo=async()=>{try{const{data:kt,error:gr}=await Y.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(gr)throw gr;const Or={};for(const ns of kt??[])Or[ns.brokerage_id]||(Or[ns.brokerage_id]=[]),Or[ns.brokerage_id].push(ns.user_id);b(Or)}catch(kt){console.error("Error loading brokerage manager assignments:",kt)}},ba=async()=>{try{k(!0);const{data:kt,error:gr}=await Y.functions.invoke("get-user-details");if(gr)throw gr;const Or=kt.users||[];i(Or),y(kt.brokerages||[]),await jo();const ns=Or.filter(ss=>ss.roles.includes("assistant"));if(ns.length>0){const ss=ns.map(Ps=>Ps.id),{data:sa}=await Y.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",ss);if(sa&&sa.length>0){const Ps=[...new Set(sa.map(cu=>cu.agent_id))],{data:wa}=await Y.from("profiles").select("id, name, email").in("id",Ps),Vh={};for(const cu of sa){const Il=wa==null?void 0:wa.find(ja=>ja.id===cu.agent_id);Il&&(Vh[cu.assistant_id]={agent_name:Il.name||"",agent_email:Il.email||""})}$i(Vh)}}}catch(kt){console.error("Error loading members:",kt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{k(!1)}},Co=async()=>{try{const{data:kt,error:gr}=await Y.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(gr)throw gr;m(kt||[])}catch(kt){console.error("Error loading apps:",kt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},Pi=async kt=>{if(!Oe.name.trim()||!Oe.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Oe.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:Or}=await Y.from("profiles").update({name:Oe.name.trim(),email:Oe.email.trim(),brokerage_id:Oe.brokerage_id||null,phone:Oe.phone.trim()||null}).eq("id",kt);if(Or)throw Or;o({title:"Success",description:"Member details updated successfully"}),$e(null),ba()}catch(Or){console.error("Error updating member:",Or),o({title:"Error",description:Or.message||"Failed to update member",variant:"destructive"})}},na=async kt=>{try{const{data:{session:gr}}=await Y.auth.getSession(),Or=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${gr==null?void 0:gr.access_token}`},body:JSON.stringify({userId:kt})}),ns=await Or.json();if(!Or.ok)throw new Error(ns.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(gr){console.error("Error resending welcome email:",gr),o({title:"Error",description:gr.message||"Failed to resend welcome email",variant:"destructive"})}},Li=async(kt,gr)=>{try{const{error:Or}=await Y.functions.invoke("send-password-reset",{body:{email:kt,redirectTo:window.location.origin}});if(Or)throw Or;o({title:"Password Reset Sent",description:`Password reset email sent to ${gr}`})}catch(Or){console.error("Error sending password reset:",Or),o({title:"Error",description:Or.message||"Failed to send password reset email",variant:"destructive"})}},Wa=async(kt,gr)=>{if(confirm(`Are you sure you want to delete ${gr}? This action cannot be undone.`))try{const{data:{session:Or}}=await Y.auth.getSession(),ns=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Or==null?void 0:Or.access_token}`},body:JSON.stringify({userId:kt})}),ss=await ns.json();if(!ns.ok)throw new Error(ss.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),ba()}catch(Or){console.error("Error deleting user:",Or),o({title:"Error",description:Or.message||"Failed to delete user",variant:"destructive"})}},Is=async()=>{if(!F.email||!F.name||!F.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if(F.role==="brokerage_manager"&&!F.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}P(!0);try{const{data:{session:kt}}=await Y.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.access_token}`},body:JSON.stringify(F)}),Or=await gr.json();if(!gr.ok)throw new Error(Or.error||"Failed to create user");if(F.role&&F.role!=="user"&&Or.userId){const ns=F.role==="brokerage_manager"?F.brokerage_id:void 0;await Oi(Or.userId,F.role,"add",ns)}o({title:"Success",description:`User ${F.email} created successfully`}),D({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),V(!1),ba()}catch(kt){console.error("Error creating user:",kt),o({title:"Error",description:kt.message||"Failed to create user",variant:"destructive"})}finally{P(!1)}},Oi=async(kt,gr,Or,ns)=>{try{const{data:{session:ss}}=await Y.auth.getSession(),sa={userId:kt,role:gr,action:Or};if(gr==="brokerage_manager"){if(!ns){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}sa.brokerageId=ns}const Ps=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ss==null?void 0:ss.access_token}`},body:JSON.stringify(sa)}),wa=await Ps.json();if(!Ps.ok)throw new Error(wa.error||"Failed to manage user role");o({title:"Success",description:`Role ${Or==="add"?"added":"removed"} successfully`}),ba()}catch(ss){console.error("Error managing user role:",ss),o({title:"Error",description:ss.message||"Failed to manage user role",variant:"destructive"})}},bl=(kt,gr)=>gr.length===0?!0:gr.some(Or=>kt.includes(Or)),El=async(kt,gr,Or)=>{const ns=`${kt}-${gr.id}`;qe(ns);try{if(Or){const ss=l.find(Ps=>Ps.id===kt),sa=gr.required_tags.filter(Ps=>ss==null?void 0:ss.tags.includes(Ps));for(const Ps of sa){const{error:wa}=await Y.from("user_tags").delete().eq("user_id",kt).eq("tag",Ps);if(wa)throw wa}o({title:"Access Removed",description:`Removed access to ${gr.name}`})}else if(gr.required_tags.length>0){const{error:ss}=await Y.from("user_tags").insert({user_id:kt,tag:gr.required_tags[0]});if(ss)throw ss;o({title:"Access Granted",description:`Granted access to ${gr.name}`})}await ba()}catch(ss){console.error("Error toggling access:",ss),o({title:"Error",description:ss.message||"Failed to update access",variant:"destructive"})}finally{qe(null)}},Xc=async()=>{const kt=je.trim();if(!kt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(kt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(x.find(Or=>Or.name.toLowerCase()===kt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Ee(!0);try{const{error:Or}=await Y.from("brokerages").insert({name:kt});if(Or)throw Or;o({title:"Success",description:`Brokerage "${kt}" created successfully`}),ut(""),st(!1),ba()}catch(Or){console.error("Error creating brokerage:",Or),o({title:"Error",description:Or.message||"Failed to create brokerage",variant:"destructive"})}finally{Ee(!1)}},Tm=kt=>{tt(kt),it(kt.name),Le(!0)},Yo=()=>{tt(null),it(""),Le(!1)},Hd=async()=>{if(!Ke)return;const kt=ct.trim();if(!kt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(kt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}Lt(!0);try{const{error:gr}=await Y.from("brokerages").update({name:kt}).eq("id",Ke.id);if(gr)throw gr;o({title:"Success",description:"Brokerage updated successfully"}),Yo(),ba()}catch(gr){console.error("Error updating brokerage:",gr),o({title:"Error",description:gr.message||"Failed to update brokerage",variant:"destructive"})}finally{Lt(!1)}},hc=async(kt,gr)=>{var Or;if(!gr||typeof gr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const ns={userId:kt,role:"brokerage_manager",action:"add",brokerageId:gr};console.debug("[assignManagerToBrokerage] payload",ns);const{data:{session:ss}}=await Y.auth.getSession(),sa=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ss==null?void 0:ss.access_token}`},body:JSON.stringify(ns)}),Ps=await sa.json();if(!sa.ok&&!((Or=Ps.error)!=null&&Or.includes("duplicate")))throw new Error(Ps.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await ba()}catch(ns){console.error("Error assigning manager:",ns),o({title:"Error",description:ns.message||"Failed to assign manager",variant:"destructive"})}},dh=kt=>{Zr(kt),Ar(!0)},Xo=async()=>{if(Mr){dr(!0);try{const kt=l.filter(ns=>ns.brokerage_id===Mr.id),{data:{session:gr}}=await Y.auth.getSession();for(const ns of kt){const ss=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${gr==null?void 0:gr.access_token}`},body:JSON.stringify({userId:ns.id})});if(!ss.ok){const sa=await ss.json();console.error(`Failed to delete user ${ns.email}:`,sa.error)}}const{error:Or}=await Y.from("brokerages").delete().eq("id",Mr.id);if(Or)throw Or;o({title:"Success",description:`Brokerage "${Mr.name}" and ${kt.length} member(s) deleted`}),Ar(!1),Zr(null),ba()}catch(kt){console.error("Error deleting brokerage:",kt),o({title:"Error",description:kt.message||"Failed to delete brokerage",variant:"destructive"})}finally{dr(!1)}}},Mf=kt=>{Ei(kt),Ho(""),Es(!0)},Gp=()=>{Ei(null),Ho(""),Es(!1)},Zy=async kt=>{try{const{error:gr}=await Y.from("profiles").update({brokerage_id:null}).eq("id",kt);if(gr)throw gr;o({title:"Success",description:"User removed from brokerage"}),ba()}catch(gr){console.error("Error removing user from brokerage:",gr),o({title:"Error",description:gr.message||"Failed to remove user",variant:"destructive"})}},Yy=async(kt,gr)=>{try{const{error:Or}=await Y.from("profiles").update({brokerage_id:gr}).eq("id",kt);if(Or)throw Or;o({title:"Success",description:"User added to brokerage"}),ba()}catch(Or){console.error("Error adding user to brokerage:",Or),o({title:"Error",description:Or.message||"Failed to add user",variant:"destructive"})}},Xy=async()=>{if(!Hs||!ra.email||!ra.name||!ra.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}zs(!0);try{const{data:{session:kt}}=await Y.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.access_token}`},body:JSON.stringify({...ra,brokerage_id:Hs.id,role:"user"})}),Or=await gr.json();if(!gr.ok)throw new Error(Or.error||"Failed to create agent");o({title:"Success",description:`Agent ${ra.email} created successfully`}),hs({email:"",name:"",password:"",phone:""}),us(!1),ba()}catch(kt){console.error("Error creating agent:",kt),o({title:"Error",description:kt.message||"Failed to create agent",variant:"destructive"})}finally{zs(!1)}},Uh=kt=>l.filter(gr=>gr.brokerage_id===kt),Au=kt=>{const gr=Uh(kt);if(!Ii)return gr;const Or=Ii.toLowerCase();return gr.filter(ns=>ns.name.toLowerCase().includes(Or)||ns.email.toLowerCase().includes(Or))},Qc=kt=>l.filter(gr=>gr.brokerage_id!==kt),lu=l.filter(kt=>{var gr;if(W){const Or=W.toLowerCase();if(!(kt.name.toLowerCase().includes(Or)||kt.email.toLowerCase().includes(Or)||((gr=kt.brokerage_name)==null?void 0:gr.toLowerCase().includes(Or))))return!1}return!(ne==="claimed"&&!kt.claimed||ne==="unclaimed"&&kt.claimed||se!=="all"&&!kt.roles.includes(se)||ue==="trial"&&!kt.is_trial||ue==="non-trial"&&kt.is_trial||Te==="none"&&kt.brokerage_id||Te!=="all"&&Te!=="none"&&kt.brokerage_id!==Te)}),mc=lu.length,Jc=oe===0,Wo=Jc?1:Math.ceil(mc/oe),Eu=Jc?0:(ee-1)*oe,qh=Jc?mc:Eu+oe,Wd=lu.slice(Eu,qh),Tf=kt=>{G(kt),ae(1)},Qy=kt=>{pe(kt),ae(1)},ux=(kt,gr)=>{kt(gr),ae(1)},Af=async(kt,gr)=>{ve(!0);try{const Or=l.find(Ps=>Ps.id===kt);if(!Or)return;const ns=Or.trial_expires_at?new Date(Or.trial_expires_at):new Date,ss=new Date(ns.getTime()+gr*24*60*60*1e3),{error:sa}=await Y.from("profiles").update({trial_expires_at:ss.toISOString()}).eq("id",kt);if(sa)throw sa;o({title:"Trial Extended",description:`Trial extended by ${gr} days`}),ba()}catch(Or){console.error("Error extending trial:",Or),o({title:"Error",description:Or.message||"Failed to extend trial",variant:"destructive"})}finally{ve(!1)}},yd=async kt=>{Me(!0);try{const{error:gr}=await Y.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",kt);if(gr)throw gr;o({title:"Account Converted",description:"User has been converted to a full account"}),ba(),Iu()}catch(gr){console.error("Error converting trial:",gr),o({title:"Error",description:gr.message||"Failed to convert account",variant:"destructive"})}finally{Me(!1)}},Jy=async kt=>{ts(!0);try{const{data:gr}=await Y.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",kt);if(gr&&gr.length>0){const ns=gr.map(sa=>sa.assistant_id),{data:ss}=await Y.from("profiles").select("id, name, email").in("id",ns);Cn(gr.map(sa=>{const Ps=ss==null?void 0:ss.find(wa=>wa.id===sa.assistant_id);return{id:sa.id,assistant_id:sa.assistant_id,assistant_name:(Ps==null?void 0:Ps.name)||"Unknown",assistant_email:(Ps==null?void 0:Ps.email)||"",permissions:sa.permissions||{}}}))}else Cn([]);const{data:Or}=await Y.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",kt);if(Or&&Or.length>0){const ns=Or.map(sa=>sa.agent_id),{data:ss}=await Y.from("profiles").select("id, name, email").in("id",ns);is(Or.map(sa=>{const Ps=ss==null?void 0:ss.find(wa=>wa.id===sa.agent_id);return{id:sa.id,agent_id:sa.agent_id,agent_name:(Ps==null?void 0:Ps.name)||"Unknown",agent_email:(Ps==null?void 0:Ps.email)||"",permissions:sa.permissions||{}}}))}else is([])}catch(gr){console.error("Error loading assistant data:",gr)}finally{ts(!1)}},Am=kt=>{Ve(kt),at({name:kt.name,email:kt.email,brokerage_id:kt.brokerage_id||"",phone:kt.phone||""}),Tt(!0),Jy(kt.id)},Iu=()=>{Ve(null),Tt(!1),at({name:"",email:"",brokerage_id:"",phone:""})},e5=async()=>{Be&&(await Pi(Be.id),Iu())},Rk=kt=>{ye(gr=>{const Or=new Set(gr);return Or.has(kt)?Or.delete(kt):Or.add(kt),Or})},hx=()=>{if(rt.size===Wd.length&&Wd.every(kt=>rt.has(kt.id))){const kt=new Set(rt);Wd.forEach(gr=>kt.delete(gr.id)),ye(kt)}else{const kt=new Set(rt);Wd.forEach(gr=>kt.add(gr.id)),ye(kt)}},Xs=()=>{ye(new Set)},e0=async()=>{if(rt.size===0)return;Ye(!0);let kt=0,gr=0;try{const{data:{session:Or}}=await Y.auth.getSession();for(const ns of rt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Or==null?void 0:Or.access_token}`},body:JSON.stringify({userId:ns})})).ok?kt++:gr++}catch{gr++}o({title:"Bulk Email Complete",description:`Sent ${kt} emails${gr>0?`, ${gr} failed`:""}`}),Xs()}catch(Or){o({title:"Error",description:Or.message||"Failed to send emails",variant:"destructive"})}finally{Ye(!1)}},Rv=async()=>{if(rt.size===0)return;Ye(!0);let kt=0,gr=0;try{const{data:{session:Or}}=await Y.auth.getSession();for(const ns of rt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Or==null?void 0:Or.access_token}`},body:JSON.stringify({userId:ns})})).ok?kt++:gr++}catch{gr++}o({title:"Bulk Password Reset Complete",description:`Sent ${kt} reset emails${gr>0?`, ${gr} failed`:""}`}),Xs()}catch(Or){o({title:"Error",description:Or.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ye(!1)}},Fk=async()=>{if(rt.size===0)return;const kt=l.filter(ss=>rt.has(ss.id)).map(ss=>ss.name).slice(0,5).join(", "),gr=rt.size>5?` and ${rt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${rt.size} users (${kt}${gr})? This action cannot be undone.`))return;Ye(!0);let Or=0,ns=0;try{const{data:{session:ss}}=await Y.auth.getSession();for(const sa of rt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ss==null?void 0:ss.access_token}`},body:JSON.stringify({userId:sa})})).ok?Or++:ns++}catch{ns++}o({title:"Bulk Delete Complete",description:`Deleted ${Or} users${ns>0?`, ${ns} failed`:""}`}),Xs(),ba()}catch(ss){o({title:"Error",description:ss.message||"Failed to delete users",variant:"destructive"})}finally{Ye(!1)}},zk=async()=>{bt(!0);try{const{data:{session:kt}}=await Y.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${kt==null?void 0:kt.access_token}`}});if(!gr.ok){const ns=await gr.json();throw new Error(ns.error||"Failed to sync phones")}const Or=await gr.json();o({title:"Phone Sync Complete",description:`Pulled ${Or.summary.pulledFromGHL} from GHL, pushed ${Or.summary.pushedToGHL} to GHL, ${Or.summary.alreadySynced} already synced`}),ba()}catch(kt){o({title:"Error",description:kt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{bt(!1)}},Em=async(kt,gr)=>{qt(kt);try{const{data:{session:Or}}=await Y.auth.getSession(),{data:ns}=await Y.from("profiles").select("phone").eq("id",kt).single(),ss=(ns==null?void 0:ns.phone)||"",sa=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Or==null?void 0:Or.access_token}`},body:JSON.stringify({email:gr,action:"update",phone:ss||void 0})});if(!sa.ok){const wa=await sa.json();throw new Error(wa.error||"Failed to sync with GHL")}const Ps=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(gr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:ss?`Phone ${ss} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),ba()}catch(Or){o({title:"Error",description:Or.message||"Failed to sync phone",variant:"destructive"})}finally{qt(null)}},Kp=async kt=>{await s(kt)},mx=()=>{if(rt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const kt=l.filter(wa=>rt.has(wa.id)),gr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Or=kt.map(wa=>[wa.name,wa.email,wa.phone||"",wa.brokerage_name||"",wa.roles.join("; "),wa.claimed?"Claimed":"Unclaimed",new Date(wa.created_at).toLocaleDateString()]),ns=[gr.join(","),...Or.map(wa=>wa.map(Vh=>`"${(Vh||"").replace(/"/g,'""')}"`).join(","))].join(` `),ss=new Blob([ns],{type:"text/csv"}),sa=URL.createObjectURL(ss),Ps=document.createElement("a");Ps.href=sa,Ps.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,Ps.click(),URL.revokeObjectURL(sa),o({title:"Export complete",description:`Exported ${kt.length} member(s)`})};return N?r.jsx(Fr,{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(Fr,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{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(Q,{size:"sm",variant:"outline",onClick:zk,disabled:Nt,children:[Nt?r.jsx(Gr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ai,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:Nt?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:Nt?"Syncing...":"Sync GHL"})]}),r.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>ir(!0),children:[r.jsx(V1,{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(Rr,{open:U,onOpenChange:V,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{size:"sm",children:[r.jsx(th,{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(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Create New User"}),r.jsx(Yn,{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(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",placeholder:"John Doe",value:F.name,onChange:kt=>D({...F,name:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(lt,{id:"email",type:"email",placeholder:"john@example.com",value:F.email,onChange:kt=>D({...F,email:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"password",children:"Password"}),r.jsx(lt,{id:"password",type:"password",placeholder:"Min 6 characters",value:F.password,onChange:kt=>D({...F,password:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(lt,{id:"phone",type:"tel",placeholder:"555-123-4567",value:F.phone,onChange:kt=>D({...F,phone:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{htmlFor:"brokerage",children:["Brokerage",F.role==="brokerage_manager"?" (required)":""]}),r.jsxs(un,{value:F.brokerage_id||"none",onValueChange:kt=>D({...F,brokerage_id:kt==="none"?"":kt}),children:[r.jsx(ln,{id:"brokerage",children:r.jsx(mn,{placeholder:F.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"None"}),x.map(kt=>r.jsx($t,{value:kt.id,children:kt.name},kt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"role",children:"Role"}),r.jsxs(un,{value:F.role,onValueChange:kt=>D({...F,role:kt}),children:[r.jsx(ln,{id:"role",children:r.jsx(mn,{placeholder:"Select role"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"user",children:"User"}),r.jsx($t,{value:"moderator",children:"Moderator"}),r.jsx($t,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx($t,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(un,{value:F.trial_days||"none",onValueChange:kt=>D({...F,trial_days:kt==="none"?"":kt}),children:[r.jsx(ln,{id:"trial_days",children:r.jsx(mn,{placeholder:"No trial (full access)"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"No trial (full access)"}),r.jsx($t,{value:"7",children:"7-day trial"}),r.jsx($t,{value:"30",children:"30-day trial"}),r.jsx($t,{value:"60",children:"60-day trial"}),r.jsx($t,{value:"90",children:"90-day trial"}),r.jsx($t,{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(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(Q,{onClick:Is,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(wi,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"members",children:"Members"}),r.jsx(sn,{value:"brokerages",children:"Brokerages"}),r.jsx(sn,{value:"trials",children:"Trial Users"}),r.jsx(sn,{value:"access",children:"Access Matrix"}),r.jsx(sn,{value:"celebrations",children:"Celebrations"}),r.jsx(sn,{value:"deletions",children:"Deletion Log"})]}),r.jsxs(Sn,{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(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search members...",value:W,onChange:kt=>Tf(kt.target.value),className:"pl-10 h-9"})]}),r.jsxs(un,{value:ne,onValueChange:kt=>ux(fe,kt),children:[r.jsx(ln,{className:"w-[130px] h-9",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Status"}),r.jsx($t,{value:"claimed",children:"Active"}),r.jsx($t,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(un,{value:se,onValueChange:kt=>ux(me,kt),children:[r.jsx(ln,{className:"w-[130px] h-9",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Roles"}),r.jsx($t,{value:"admin",children:"Admin"}),r.jsx($t,{value:"brokerage_manager",children:"Manager"}),r.jsx($t,{value:"assistant",children:"Assistant"}),r.jsx($t,{value:"user",children:"User"})]})]}),r.jsxs(un,{value:ue,onValueChange:kt=>ux(xe,kt),children:[r.jsx(ln,{className:"w-[130px] h-9",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Users"}),r.jsx($t,{value:"trial",children:"Trial Only"}),r.jsx($t,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(un,{value:Te,onValueChange:kt=>ux(_e,kt),children:[r.jsx(ln,{className:"w-[150px] h-9",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Brokerages"}),r.jsx($t,{value:"none",children:"No Brokerage"}),x.map(kt=>r.jsx($t,{value:kt.id,children:kt.name},kt.id))]})]}),(W||ne!=="all"||se!=="all"||ue!=="all"||Te!=="all")&&r.jsxs(Q,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{G(""),fe("all"),me("all"),xe("all"),_e("all"),ae(1)},children:[r.jsx(ds,{className:"h-4 w-4 mr-1"}),"Clear"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:Jc?`Showing all ${mc} members`:`Showing ${Eu+1}-${Math.min(qh,mc)} of ${mc} members`}),r.jsxs(un,{value:oe.toString(),onValueChange:kt=>Qy(Number(kt)),children:[r.jsx(ln,{className:"h-9 w-[110px]",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"50",children:"50 / page"}),r.jsx($t,{value:"100",children:"100 / page"}),r.jsx($t,{value:"250",children:"250 / page"}),r.jsx($t,{value:"0",children:"All"})]})]})]})]}),rt.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(Y0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[rt.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(Q,{size:"sm",variant:"outline",onClick:e0,disabled:Pe,children:[Pe?r.jsx(Gr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(ws,{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(Q,{size:"sm",variant:"outline",onClick:Rv,disabled:Pe,children:[Pe?r.jsx(Gr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(pm,{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(Q,{size:"sm",variant:"outline",onClick:mx,children:[r.jsx(so,{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(Q,{size:"sm",variant:"destructive",onClick:Fk,disabled:Pe,children:[Pe?r.jsx(Gr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Bn,{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(Q,{size:"sm",variant:"ghost",onClick:Xs,disabled:Pe,children:r.jsx(ds,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"w-[50px]",children:r.jsx(_l,{checked:Wd.length>0&&Wd.every(kt=>rt.has(kt.id)),onCheckedChange:hx,"aria-label":"Select all on page"})}),r.jsx(Mt,{className:"font-semibold",children:"Name"}),r.jsx(Mt,{className:"font-semibold",children:"Brokerage"}),r.jsx(Mt,{className:"font-semibold",children:"Status"}),r.jsx(Mt,{className:"font-semibold",children:"Role"}),r.jsx(Mt,{className:"font-semibold",children:"Last Login"}),r.jsx(Mt,{className:"w-[100px]"})]})}),r.jsx(Fs,{children:Wd.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Wd.map(kt=>r.jsxs(Sr,{className:`hover:bg-muted/30 ${rt.has(kt.id)?"bg-primary/5":""}`,children:[r.jsx(yt,{children:r.jsx(_l,{checked:rt.has(kt.id),onCheckedChange:()=>Rk(kt.id),"aria-label":`Select ${kt.name}`})}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>Am(kt),className:"text-primary hover:underline font-medium text-left",children:kt.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:kt.email})]})}),r.jsx(yt,{className:"text-muted-foreground",children:kt.brokerage_name||"—"}),r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(At,{variant:kt.claimed?"default":"secondary",className:kt.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:kt.claimed?"Active":"Pending"}),kt.is_trial&&kt.trial_expires_at&&r.jsx(H4e,{expiresAt:kt.trial_expires_at,className:"w-fit"})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[kt.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:kt.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"}),kt.roles.includes("assistant")&&r.jsxs(At,{variant:"outline",className:"text-[10px] ml-1",children:["Asst",Ws[kt.id]?` → ${Ws[kt.id].agent_name||Ws[kt.id].agent_email}`:""]})]})}),r.jsx(yt,{className:"text-muted-foreground",children:kt.last_sign_in_at?new Date(kt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{cr(kt),Wt(!0)},title:"Send celebration",children:r.jsx(Hc,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Am(kt),title:"Edit member",children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Em(kt.id,kt.email),disabled:It===kt.id,title:"Sync phone with GHL",children:It===kt.id?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ai,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>na(kt.id),title:"Resend welcome email",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Li(kt.email,kt.name),title:"Send password reset",children:r.jsx(Rj,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Kp(kt.id),disabled:a||kt.id===(t==null?void 0:t.id),title:kt.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${kt.name}`,children:a?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(A4,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Wa(kt.id,kt.name),title:"Delete user",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},kt.id))})]})}),Wo>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 ",ee," of ",Wo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>ae(1),disabled:ee===1,children:"First"}),r.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.max(1,kt-1)),disabled:ee===1,children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Wo)},(kt,gr)=>{let Or;return Wo<=5||ee<=3?Or=gr+1:ee>=Wo-2?Or=Wo-4+gr:Or=ee-2+gr,r.jsx(Q,{variant:ee===Or?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ae(Or),children:Or},Or)})}),r.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.min(Wo,kt+1)),disabled:ee===Wo,children:r.jsx(Gi,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>ae(Wo),disabled:ee===Wo,children:"Last"})]})]})]}),r.jsx(Rr,{open:ot,onOpenChange:Tt,children:r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Edit Member"}),r.jsx(Yn,{children:"Update member details, roles, and app access"})]}),Be&&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(ze,{htmlFor:"edit-name",children:"Name"}),r.jsx(lt,{id:"edit-name",value:Oe.name,onChange:kt=>at({...Oe,name:kt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"edit-email",children:"Email"}),r.jsx(lt,{id:"edit-email",type:"email",value:Oe.email,onChange:kt=>at({...Oe,email:kt.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(ze,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(lt,{id:"edit-phone",type:"tel",value:Oe.phone,onChange:kt=>at({...Oe,phone:kt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(un,{value:Oe.brokerage_id||"none",onValueChange:kt=>at({...Oe,brokerage_id:kt==="none"?"":kt}),children:[r.jsx(ln,{id:"edit-brokerage",children:r.jsx(mn,{placeholder:"Select brokerage"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"None"}),x.map(kt=>r.jsx($t,{value:kt.id,children:kt.name},kt.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:[Be.roles.map(kt=>r.jsxs(At,{variant:"default",className:"gap-1",children:[r.jsx(vm,{className:"h-3 w-3"}),kt,kt==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>Oi(Be.id,kt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(ds,{className:"h-3 w-3"})})]},kt)),Be.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(un,{onValueChange:kt=>Oi(Be.id,kt,"add"),children:[r.jsx(ln,{className:"w-[200px]",children:r.jsx(mn,{placeholder:"Add role..."})}),r.jsxs(cn,{children:[!Be.roles.includes("admin")&&r.jsx($t,{value:"admin",children:"Admin"}),!Be.roles.includes("user")&&r.jsx($t,{value:"user",children:"User"})]})]}),!Be.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"})]}),(Xr.length>0||Kr.length>0||Be.roles.includes("assistant"))&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx($n,{className:"h-4 w-4"}),"Assistant Relationships"]}),ls?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Gr,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):r.jsxs("div",{className:"space-y-3",children:[Xr.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Has assistants:"}),Xr.map(kt=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:kt.assistant_name}),r.jsx(At,{variant:"outline",className:"text-xs",children:"Assistant"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:kt.assistant_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(kt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(At,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},kt.id))]}),Kr.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Assists agents:"}),Kr.map(kt=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:kt.agent_name}),r.jsx(At,{variant:"outline",className:"text-xs",children:"Agent"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:kt.agent_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(kt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(At,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},kt.id))]})]})]}),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:u.map(kt=>{const gr=bl(Be.tags,kt.required_tags),Or=`${Be.id}-${kt.id}`,ns=le===Or,ss=kt.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:kt.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:kt.name}),ss&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:ns?r.jsx(Gr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):ss?r.jsx(At,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(As,{checked:gr,onCheckedChange:()=>El(Be.id,kt,gr)})})]},kt.id)})})]}),Be.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(Xa,{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:Be.trial_expires_at&&r.jsx(H4e,{expiresAt:Be.trial_expires_at})}),Be.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Be.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>Af(Be.id,7),disabled:we,children:[r.jsx(Aj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>Af(Be.id,14),disabled:we,children:[r.jsx(Aj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>Af(Be.id,30),disabled:we,children:[r.jsx(Aj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(Q,{size:"sm",variant:"default",onClick:()=>yd(Be.id),disabled:Xe,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Vj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Be.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Be.trial_started_at).toLocaleDateString(),Be.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Be.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:[Be.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Be.email_confirmed_at).toLocaleString()]}),Be.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Be.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Be.created_at).toLocaleString()]})]})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:Iu,children:"Cancel"}),r.jsx(Q,{onClick:e5,children:"Save Changes"})]})]})}),r.jsxs(Sn,{value:"access",children:[u.length===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(Q,{onClick:()=>e("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Member Access Matrix"}),r.jsx(jn,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(et,{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"}),u.map(kt=>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:kt.icon}),r.jsx("span",{className:"text-sm",children:kt.name})]})},kt.id))]})}),r.jsxs("tbody",{children:[Wd.map(kt=>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:kt.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:kt.email})]})}),u.map(gr=>{const Or=bl(kt.tags,gr.required_tags),ns=`${kt.id}-${gr.id}`,ss=le===ns;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:ss?r.jsx(Gr,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(As,{checked:Or,onCheckedChange:()=>El(kt.id,gr,Or),disabled:gr.required_tags.length===0})})},gr.id)})]},kt.id)),Wd.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:u.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Wo>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 ",Eu+1,"-",Math.min(qh,mc)," of ",mc," • Page ",ee," of ",Wo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.max(1,kt-1)),disabled:ee===1,children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ae(kt=>Math.min(Wo,kt+1)),disabled:ee===Wo,children:r.jsx(Gi,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(Q,{variant:"outline",onClick:()=>e("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(Sn,{value:"brokerages",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search brokerages...",value:Pa,onChange:kt=>oo(kt.target.value),className:"pl-10"})]}),r.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[x.filter(kt=>kt.name.toLowerCase().includes(Pa.toLowerCase())).length," of ",x.length," brokerages"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>{const kt=[];for(const Ps of x){const wa=v[Ps.id]??[];for(const Vh of wa){const cu=l.find(Il=>Il.id===Vh);if(cu){const Il=(cu.name||"").trim().split(/\s+/),ja=Il[0]||"",Bk=Il.slice(1).join(" ")||"";kt.push({firstName:ja,lastName:Bk,email:cu.email,brokerageName:Ps.name})}}}if(kt.length===0){o({title:"No managers found to export"});return}const Or=[["First Name","Last Name","Email","Brokerage Name"].join(","),...kt.map(Ps=>[Ps.firstName,Ps.lastName,Ps.email,Ps.brokerageName].map(wa=>`"${(wa||"").replace(/"/g,'""')}"`).join(","))].join(` `),ns=new Blob([Or],{type:"text/csv"}),ss=URL.createObjectURL(ns),sa=document.createElement("a");sa.href=ss,sa.download=`brokerage-managers-${new Date().toISOString().slice(0,10)}.csv`,sa.click(),URL.revokeObjectURL(ss),o({title:`Exported ${kt.length} managers`})},children:[r.jsx(so,{className:"mr-2 h-4 w-4"}),"Export Managers"]}),r.jsxs(Rr,{open:Je,onOpenChange:st,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{size:"sm",children:[r.jsx(hi,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Create New Brokerage"}),r.jsx(Yn,{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(ze,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(lt,{id:"brokerage-name",placeholder:"Enter brokerage name",value:je,onChange:kt=>ut(kt.target.value),maxLength:100})]})}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>st(!1),children:"Cancel"}),r.jsx(Q,{onClick:Xc,disabled:Ce,children:Ce?"Creating...":"Create Brokerage"})]})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(Mt,{className:"font-semibold",children:"Manager(s)"}),r.jsx(Mt,{className:"font-semibold",children:"Agents"}),r.jsx(Mt,{className:"w-[150px]"})]})}),r.jsx(Fs,{children:(()=>{const kt=x.filter(gr=>gr.name.toLowerCase().includes(Pa.toLowerCase()));return kt.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:Pa?"No brokerages match your search":"No brokerages found"})}):kt.map(gr=>{const Or=l.filter(Ps=>Ps.brokerage_id===gr.id),ss=(v[gr.id]??[]).map(Ps=>l.find(wa=>wa.id===Ps)).filter(Boolean),sa=Or.length;return r.jsxs(Sr,{className:"hover:bg-muted/30",children:[r.jsx(yt,{children:r.jsx("button",{onClick:()=>Tm(gr),className:"text-primary hover:underline font-medium",children:gr.name})}),r.jsx(yt,{children:ss.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:ss.map(Ps=>r.jsx(At,{variant:"secondary",className:"text-xs",children:Ps.name},Ps.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(yt,{children:[sa," member",sa!==1?"s":""]}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(Q,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Mf(gr),children:[r.jsx($n,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Tm(gr),title:"Edit brokerage",children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>dh(gr),title:"Delete brokerage",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},gr.id)})})()})]})}),r.jsx(Rr,{open:Ze,onOpenChange:Le,children:r.jsxs(Dr,{className:"max-w-lg",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Edit Brokerage"}),r.jsx(Yn,{children:"Update brokerage details and manage managers"})]}),Ke&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(lt,{id:"edit-brokerage-name",value:ct,onChange:kt=>it(kt.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{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 gr=(v[Ke.id]??[]).map(Or=>l.find(ns=>ns.id===Or)).filter(Boolean);return gr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):gr.map(Or=>r.jsxs(At,{variant:"default",className:"gap-1",children:[r.jsx(vm,{className:"h-3 w-3"}),Or.name,r.jsx("button",{onClick:()=>Oi(Or.id,"brokerage_manager","remove",Ke.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(ds,{className:"h-3 w-3"})})]},Or.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(Wc,{open:bi,onOpenChange:qn,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":bi,className:"w-full justify-between",children:["Search for a member...",r.jsx(ma,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Tc,{className:"w-full p-0",align:"start",children:r.jsxs(Py,{children:[r.jsx(Ly,{placeholder:"Search by name or email..."}),r.jsxs(Oy,{className:"max-h-[200px]",children:[r.jsx(Dy,{children:"No members found."}),r.jsx(Ry,{children:(()=>{const kt=new Set(v[Ke.id]??[]);return l.filter(gr=>!kt.has(gr.id)&&(n||gr.brokerage_id===Ke.id)).map(gr=>r.jsxs(Fy,{value:`${gr.name} ${gr.email}`,onSelect:()=>{hc(gr.id,Ke.id),qn(!1)},children:[gr.name," (",gr.email,")"]},gr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:l.filter(kt=>kt.brokerage_id===Ke.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(kt=>kt.brokerage_id===Ke.id).map(kt=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:kt.name}),kt.roles.includes("brokerage_manager")&&r.jsx(At,{variant:"outline",className:"text-xs",children:"Manager"})]},kt.id))})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:Yo,children:"Cancel"}),r.jsx(Q,{onClick:Hd,disabled:zt,children:zt?"Saving...":"Save Changes"})]})]})}),r.jsx(Rr,{open:lr,onOpenChange:Ar,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(Yn,{children:['Are you sure you want to delete "',Mr==null?void 0:Mr.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 "',Mr==null?void 0:Mr.name,'"']}),r.jsxs("li",{children:["All ",l.filter(kt=>kt.brokerage_id===(Mr==null?void 0:Mr.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>Ar(!1),children:"Cancel"}),r.jsx(Q,{variant:"destructive",onClick:Xo,disabled:Xn,children:Xn?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Rr,{open:En,onOpenChange:Es,children:r.jsxs(Dr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(hi,{className:"h-5 w-5"}),"Manage ",Hs==null?void 0:Hs.name]}),r.jsx(Yn,{children:"Add, remove, or manage users in this brokerage"})]}),Hs&&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(ma,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search members...",value:Ii,onChange:kt=>Ho(kt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Rr,{open:Ha,onOpenChange:us,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{size:"sm",children:[r.jsx(th,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Add New Agent"}),r.jsxs(Yn,{children:["Create a new agent for ",Hs.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"agent-name",children:"Name"}),r.jsx(lt,{id:"agent-name",placeholder:"John Doe",value:ra.name,onChange:kt=>hs({...ra,name:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"agent-email",children:"Email"}),r.jsx(lt,{id:"agent-email",type:"email",placeholder:"john@example.com",value:ra.email,onChange:kt=>hs({...ra,email:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"agent-password",children:"Password"}),r.jsx(lt,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:ra.password,onChange:kt=>hs({...ra,password:kt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(lt,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:ra.phone,onChange:kt=>hs({...ra,phone:kt.target.value})})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>us(!1),children:"Cancel"}),r.jsx(Q,{onClick:Xy,disabled:Ys,children:Ys?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ze,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(Wc,{open:Ki,onOpenChange:dc,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":Ki,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(ma,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Tc,{className:"w-[300px] p-0",align:"start",children:r.jsxs(Py,{children:[r.jsx(Ly,{placeholder:"Search users...",value:go,onValueChange:uc}),r.jsxs(Oy,{children:[r.jsx(Dy,{children:"No users found."}),r.jsx(Ry,{children:Qc(Hs.id).filter(kt=>go===""||kt.name.toLowerCase().includes(go.toLowerCase())||kt.email.toLowerCase().includes(go.toLowerCase())).map(kt=>r.jsxs(Fy,{value:`${kt.name} ${kt.email}`,onSelect:()=>{Yy(kt.id,Hs.id),dc(!1),uc("")},children:[kt.name," (",kt.email,")"]},kt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(Mt,{className:"font-semibold",children:"Name"}),r.jsx(Mt,{className:"font-semibold",children:"Email"}),r.jsx(Mt,{className:"font-semibold",children:"Status"}),r.jsx(Mt,{className:"font-semibold",children:"Role"}),r.jsx(Mt,{className:"w-[120px]"})]})}),r.jsx(Fs,{children:Au(Hs.id).length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:Ii?"No matching members found":"No members in this brokerage"})}):Au(Hs.id).map(kt=>r.jsxs(Sr,{className:"hover:bg-muted/30",children:[r.jsx(yt,{className:"font-medium",children:kt.name}),r.jsx(yt,{className:"text-muted-foreground",children:kt.email}),r.jsx(yt,{children:kt.claimed?r.jsx(At,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(At,{variant:"secondary",children:"Pending"})}),r.jsx(yt,{children:kt.roles.includes("brokerage_manager")?r.jsxs(At,{variant:"outline",className:"gap-1",children:[r.jsx(vm,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!kt.claimed&&r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>na(kt.id),title:"Resend welcome email",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Zy(kt.id),title:"Remove from brokerage",children:r.jsx(ds,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Kp(kt.id),disabled:a||kt.id===(t==null?void 0:t.id),title:kt.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${kt.name}`,children:a?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(A4,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Wa(kt.id,kt.name),title:"Delete user",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},kt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Uh(Hs.id).length," total member",Uh(Hs.id).length!==1?"s":""," •",Uh(Hs.id).filter(kt=>kt.roles.includes("brokerage_manager")).length," manager",Uh(Hs.id).filter(kt=>kt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(Vs,{children:r.jsx(Q,{variant:"outline",onClick:Gp,children:"Close"})})]})})]}),r.jsx(Sn,{value:"trials",children:r.jsx(cSt,{})}),r.jsx(Sn,{value:"celebrations",children:r.jsx(lSt,{})}),r.jsx(Sn,{value:"deletions",children:r.jsx(dSt,{})})]})]}),r.jsx(V9e,{open:ji,onOpenChange:ir,brokerages:x,onSuccess:ba}),pr&&r.jsx(H9e,{open:Ot,onOpenChange:kt=>{Wt(kt),kt||cr(null)},userId:pr.id,userName:pr.name})]})},hSt=()=>{const[e,t]=A.useState([]),[n,s]=A.useState(!0),[a,o]=A.useState(!1),[l,i]=A.useState(""),[u,m]=A.useState(""),[x,y]=A.useState(""),[v,b]=A.useState("");A.useEffect(()=>{N()},[]);const N=async()=>{const{data:D,error:U}=await Y.from("invite_codes").select("*").order("created_at",{ascending:!1});U?(Ae.error("Failed to load invite codes"),console.error(U)):t(D||[]),s(!1)},k=async D=>{if(D.preventDefault(),!l.trim()){Ae.error("Please enter a code");return}o(!0);const{error:U}=await Y.from("invite_codes").insert({code:l.trim().toUpperCase(),description:u.trim()||null,max_uses:x?parseInt(x):null,trial_days:v?parseInt(v):null});U?U.code==="23505"?Ae.error("This code already exists"):(Ae.error("Failed to create invite code"),console.error(U)):(Ae.success("Invite code created"),i(""),m(""),y(""),b(""),N()),o(!1)},M=async(D,U)=>{const{error:V}=await Y.from("invite_codes").update({is_active:!U}).eq("id",D);V?Ae.error("Failed to update code"):t(e.map(W=>W.id===D?{...W,is_active:!U}:W))},I=async D=>{const{error:U}=await Y.from("invite_codes").delete().eq("id",D);U?Ae.error("Failed to delete code"):(Ae.success("Code deleted"),t(e.filter(V=>V.id!==D)))},T="https://dashboard.relevelup.com",P=D=>{const U=`${T}/join?code=${D}`;navigator.clipboard.writeText(U),Ae.success("Link copied to clipboard")},F=`${T}/join`;return r.jsx(Fr,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Create New Code"}),r.jsxs(jn,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:F})]})]}),r.jsx(et,{children:r.jsxs("form",{onSubmit:k,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"code",children:"Code"}),r.jsx(lt,{id:"code",placeholder:"WELCOME2024",value:l,onChange:D=>i(D.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(ze,{htmlFor:"description",children:"Description (optional)"}),r.jsx(lt,{id:"description",placeholder:"For marketing campaign",value:u,onChange:D=>m(D.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(lt,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:D=>y(D.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(lt,{id:"trialDays",type:"number",placeholder:"None",value:v,onChange:D=>b(D.target.value),className:"w-28"})]}),r.jsxs(Q,{type:"submit",disabled:a,children:[a?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Active Codes"})}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Gr,{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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Code"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Uses"}),r.jsx(Mt,{children:"Trial"}),r.jsx(Mt,{children:"Created"}),r.jsx(Mt,{children:"Active"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Fs,{children:e.map(D=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-mono font-medium",children:D.code}),r.jsx(yt,{className:"text-muted-foreground",children:D.description||"—"}),r.jsxs(yt,{children:[D.uses_count,D.max_uses&&` / ${D.max_uses}`]}),r.jsx(yt,{children:D.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[D.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-muted-foreground",children:on(new Date(D.created_at),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx(As,{checked:D.is_active,onCheckedChange:()=>M(D.id,D.is_active)})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>P(D.code),title:"Copy invite link",children:r.jsx(Po,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>I(D.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},D.id))})]})})]})]})})},Oae=async e=>{try{const{data:t,error:n}=await Y.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}},vP=async e=>{try{const{data:t,error:n}=await Y.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}}},mSt=async(e,t)=>await Oae("new_templates")?vP({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}),fSt=async(e,t)=>vP({title:"New Academy Video",body:`New video added: ${e}`,url:`/academy/${t}`}),pSt=async(e,t)=>await Oae("new_events")?vP({title:"New Event",body:`New event: ${e}`,url:`/events/${t}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),gSt=async(e,t)=>await Oae("new_toolbox")?vP({title:"New Resource Kit",body:`New resource kit available: ${e}`,url:`/toolbox/${t}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),pfe=async(e,t)=>await Oae("new_social_swag")?vP({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}),NO={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 xSt(){const e=Vn(),t=Vr(),[n,s]=A.useState(!1),[a,o]=A.useState(null),[l,i]=A.useState(NO),[u,m]=A.useState(null),[x,y]=A.useState(null),[v,b]=A.useState(!1),N=A.useRef(null),[k,M]=A.useState(!1),[I,T]=A.useState(null),[P,F]=A.useState(!1),[D,U]=A.useState(null),[V,W]=A.useState(null),[G,ee]=A.useState(!0),[ae,oe]=A.useState(""),{data:pe,isLoading:ne}=Zt({queryKey:["admin-events"],queryFn:async()=>{const{data:je,error:ut}=await Y.from("events").select("*").order("event_date",{ascending:!0});if(ut)throw ut;return je}}),{data:fe}=Zt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:je,error:ut}=await Y.from("event_registrations").select("event_id");if(ut)throw ut;const Ce={};return je.forEach(Ee=>{Ce[Ee.event_id]=(Ce[Ee.event_id]||0)+1}),Ce}}),{data:se,isLoading:me}=Zt({queryKey:["event-registrations-details",I==null?void 0:I.id],queryFn:async()=>{if(!I)return[];const{data:je,error:ut}=await Y.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",I.id).order("registered_at",{ascending:!1});if(ut)throw ut;if(!je||je.length===0)return[];const Ce=je.map(Le=>Le.user_id).filter(Boolean);let Ee=[];if(Ce.length>0){const{data:Le,error:Ke}=await Y.from("profiles").select("id, name, email").in("id",Ce);if(Ke)throw Ke;Ee=Le||[]}const Ze=new Map((Ee==null?void 0:Ee.map(Le=>[Le.id,Le]))||[]);return je.map(Le=>({...Le,profiles:Le.user_id&&Ze.get(Le.user_id)||null}))},enabled:!!I}),{data:ue,isLoading:xe}=Zt({queryKey:["event-attendees-details",I==null?void 0:I.id],queryFn:async()=>{if(!I)return[];const{data:je,error:ut}=await Y.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",I.id).order("created_at",{ascending:!1});if(ut)throw ut;if(!je||je.length===0)return[];const Ce=je.map(tt=>tt.user_id).filter(Boolean);let Ee=[];if(Ce.length>0){const{data:tt,error:ct}=await Y.from("profiles").select("id, name, email").in("id",Ce);if(ct)throw ct;Ee=tt||[]}const{data:Ze}=await Y.from("agent_points").select("user_id").eq("event_id",I.id),Le=new Set((Ze==null?void 0:Ze.map(tt=>tt.user_id))||[]),Ke=new Map((Ee==null?void 0:Ee.map(tt=>[tt.id,tt]))||[]);return je.map(tt=>({...tt,profiles:tt.user_id&&Ke.get(tt.user_id)||null,points_awarded:tt.user_id?Le.has(tt.user_id):!1}))},enabled:!!I}),Te=je=>{T(je),M(!0)},_e=ar({mutationFn:async je=>{const{data:{session:ut}}=await Y.auth.getSession();if(!ut)throw new Error("Not authenticated");const Ce=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ut.access_token}`},body:JSON.stringify({event_id:je})}),Ee=await Ce.json();if(!Ce.ok)throw new Error(Ee.error||"Failed to sync");return Ee},onSuccess:je=>{t.invalidateQueries({queryKey:["event-registrations-details",I==null?void 0:I.id]}),t.invalidateQueries({queryKey:["event-registrations-count"]}),Ae.success(je.message)},onError:je=>{Ae.error("Failed to sync: "+je.message)}}),we=ar({mutationFn:async je=>{const{data:{session:ut}}=await Y.auth.getSession();if(!ut)throw new Error("Not authenticated");const Ce=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ut.access_token}`},body:JSON.stringify({event_id:je})}),Ee=await Ce.json();if(!Ce.ok)throw new Error(Ee.error||"Failed to sync attendees");return Ee},onSuccess:je=>{t.invalidateQueries({queryKey:["event-attendees-details",I==null?void 0:I.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]}),je!=null&&je.message?Ae.success(je.message):Ae.success(`Synced ${je.synced||0} attendees. ${je.points_awarded||0} points awarded!`)},onError:je=>{Ae.error("Failed to sync attendees: "+je.message)}}),ve=ar({mutationFn:async({eventId:je,testMode:ut})=>{const{data:{session:Ce}}=await Y.auth.getSession();if(!Ce)throw new Error("Not authenticated");const Ee=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ce.access_token}`},body:JSON.stringify({event_id:je,test_mode:ut})}),Ze=await Ee.json();if(!Ee.ok)throw new Error(Ze.error||"Failed to send reminders");return Ze},onSuccess:je=>{je.test?Ae.success(je.message||"Test email sent!"):Ae.success(je.message||`Reminder emails sent to ${je.sent} registrants!`)},onError:je=>{Ae.error("Failed to send reminders: "+je.message)}}),{data:Xe}=Zt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let je=[],ut=0;const Ce=1e3;for(;;){const{data:Ee,error:Ze}=await Y.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(ut,ut+Ce-1);if(Ze)throw Ze;if(!Ee||Ee.length===0||(je=[...je,...Ee],Ee.length{const{error:Ze}=await Y.from("event_attendees").update({user_id:ut}).eq("id",je);if(Ze)throw Ze;if(Ee&&Ce){const{error:Ke}=await Y.from("zoom_email_aliases").upsert({user_id:ut,zoom_email:Ce.toLowerCase()},{onConflict:"zoom_email"});Ke&&console.error("Failed to save alias:",Ke)}const Le=I==null?void 0:I.id;if(Le){const{data:Ke}=await Y.from("user_roles").select("id").eq("user_id",ut).eq("role","admin").single();if(!Ke){const{data:tt}=await Y.from("agent_points").select("id").eq("user_id",ut).eq("event_id",Le).single();tt||(await Y.rpc("award_attendance_points",{p_user_id:ut,p_event_id:Le,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await Y.rpc("check_and_award_badges",{p_user_id:ut}))}}return{userId:ut,zoomEmail:Ce,shouldSaveAlias:Ee}},onSuccess:je=>{t.invalidateQueries({queryKey:["event-attendees-details",I==null?void 0:I.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]});let ut="Attendee linked and points awarded!";je.shouldSaveAlias&&je.zoomEmail&&(ut+=` Email "${je.zoomEmail}" will be auto-matched in the future.`),Ae.success(ut),F(!1),U(null),W(null),oe("")},onError:je=>{Ae.error("Failed to link attendee: "+je.message)}}),Ie=je=>{U(je),W(null),ee(!0),oe(""),F(!0)},$e=()=>{!D||!V||Me.mutate({attendeeId:D.id,userId:V,zoomEmail:D.zoom_email,shouldSaveAlias:G})},Be=(Xe==null?void 0:Xe.filter(je=>{var Ce,Ee;if(!ae)return!0;const ut=ae.toLowerCase();return((Ce=je.name)==null?void 0:Ce.toLowerCase().includes(ut))||((Ee=je.email)==null?void 0:Ee.toLowerCase().includes(ut))}))||[],Ve=async je=>{const ut=je.name.split(".").pop(),Ee=`${`${crypto.randomUUID()}.${ut}`}`,{error:Ze}=await Y.storage.from("event-images").upload(Ee,je);if(Ze)throw Ze;const{data:{publicUrl:Le}}=Y.storage.from("event-images").getPublicUrl(Ee);return Le},ot=je=>{var Ce;const ut=(Ce=je.target.files)==null?void 0:Ce[0];if(ut){if(ut.size>5*1024*1024){Ae.error("Image must be less than 5MB");return}m(ut),y(URL.createObjectURL(ut))}},Tt=()=>{m(null),y(null),i({...l,image_url:""}),N.current&&(N.current.value="")},Oe=ar({mutationFn:async je=>{b(!0);let ut=je.image_url;u&&(ut=await Ve(u)||"");const Ce=new Date(je.event_date),[Ee,Ze]=je.event_time.split(":");Ce.setHours(parseInt(Ee),parseInt(Ze));const Le=[new Date(Ce)];if(je.is_recurring&&je.recurrence_end_date){let it=new Date(Ce);for(;je.recurrence_pattern==="weekly"?it=oj(it,1):je.recurrence_pattern==="biweekly"?it=oj(it,2):it=Fh(it,1),!(it>je.recurrence_end_date);)Le.push(new Date(it))}const Ke=Le.map(it=>({title:je.title,description:je.description||null,image_url:ut||null,video_url:je.video_url||null,event_date:it.toISOString(),zoom_link:je.zoom_link,zoom_meeting_id:je.zoom_meeting_id||null,capacity:je.capacity?parseInt(je.capacity):null,is_published:je.is_published})),{data:tt,error:ct}=await Y.from("events").insert(Ke).select();if(ct)throw ct;return tt&&tt.length>0&&pSt(je.title,tt[0].id),Le.length},onSuccess:je=>{t.invalidateQueries({queryKey:["admin-events"]}),Ae.success(je>1?`${je} recurring events created successfully`:"Event created successfully"),s(!1),i(NO),m(null),y(null),b(!1)},onError:je=>{Ae.error("Failed to create event: "+je.message),b(!1)}}),at=ar({mutationFn:async({id:je,data:ut})=>{b(!0);let Ce=ut.image_url;u&&(Ce=await Ve(u)||"");const Ee=new Date(ut.event_date),[Ze,Le]=ut.event_time.split(":");Ee.setHours(parseInt(Ze),parseInt(Le));const{error:Ke}=await Y.from("events").update({title:ut.title,description:ut.description||null,image_url:Ce||null,video_url:ut.video_url||null,event_date:Ee.toISOString(),zoom_link:ut.zoom_link,zoom_meeting_id:ut.zoom_meeting_id||null,capacity:ut.capacity?parseInt(ut.capacity):null,is_published:ut.is_published}).eq("id",je);if(Ke)throw Ke},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),Ae.success("Event updated successfully"),s(!1),o(null),i(NO),m(null),y(null),b(!1)},onError:je=>{Ae.error("Failed to update event: "+je.message),b(!1)}}),le=ar({mutationFn:async je=>{const{error:ut}=await Y.from("events").delete().eq("id",je);if(ut)throw ut},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),Ae.success("Event deleted successfully")},onError:je=>{Ae.error("Failed to delete event: "+je.message)}}),qe=je=>{var Ce;const ut=new Date(je.event_date);o(je),i({title:je.title,description:je.description||"",image_url:je.image_url||"",video_url:je.video_url||"",event_date:ut,event_time:on(ut,"HH:mm"),zoom_link:je.zoom_link,zoom_meeting_id:je.zoom_meeting_id||"",capacity:((Ce=je.capacity)==null?void 0:Ce.toString())||"",is_published:je.is_published,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0}),y(je.image_url||null),m(null),s(!0)},Je=je=>{if(je.preventDefault(),!l.event_date){Ae.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){Ae.error("Please select an end date for recurring events");return}a?at.mutate({id:a.id,data:l}):Oe.mutate(l)},st=()=>{s(!1),o(null),i(NO),m(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(Q,{variant:"ghost",size:"icon",onClick:()=>e("/dashboard"),children:r.jsx(Wi,{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(He,{className:"mb-6",children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Gt,{children:"All Events"}),r.jsxs(Rr,{open:n,onOpenChange:je=>!je&&st(),children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Dr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:a?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:Je,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(lt,{id:"title",value:l.title,onChange:je=>i({...l,title:je.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:l.description,onChange:je=>i({...l,description:je}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Event Image"}),r.jsx("input",{type:"file",ref:N,accept:"image/*",onChange:ot,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(Q,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:Tt,children:r.jsx(ds,{className:"h-4 w-4"})})]}):r.jsxs(Q,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var je;return(je=N.current)==null?void 0:je.click()},children:[r.jsx(bo,{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(ze,{children:"Date *"}),r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"mr-2 h-4 w-4"}),l.event_date?on(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:l.event_date,onSelect:je=>i({...l,event_date:je}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"time",children:"Time *"}),r.jsx(lt,{id:"time",type:"time",value:l.event_time,onChange:je=>i({...l,event_time:je.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(lt,{id:"zoom_link",value:l.zoom_link,onChange:je=>i({...l,zoom_link:je.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(lt,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:je=>i({...l,zoom_meeting_id:je.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(ze,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(lt,{id:"video_url",value:l.video_url,onChange:je=>i({...l,video_url:je.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(ze,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(lt,{id:"capacity",type:"number",value:l.capacity,onChange:je=>i({...l,capacity:je.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),!a&&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(_A,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(As,{id:"is_recurring",checked:l.is_recurring,onCheckedChange:je=>i({...l,is_recurring:je})})]}),l.is_recurring&&r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Frequency"}),r.jsxs(un,{value:l.recurrence_pattern,onValueChange:je=>i({...l,recurrence_pattern:je}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"weekly",children:"Weekly"}),r.jsx($t,{value:"biweekly",children:"Every 2 Weeks"}),r.jsx($t,{value:"monthly",children:"Monthly"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Repeat Until"}),r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?on(l.recurrence_end_date,"PPP"):"Pick end date"]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:l.recurrence_end_date,onSelect:je=>i({...l,recurrence_end_date:je}),disabled:je=>je<(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 je=1,ut=new Date(l.event_date);for(;ut=l.recurrence_pattern==="weekly"?oj(ut,1):l.recurrence_pattern==="biweekly"?oj(ut,2):Fh(ut,1),!(ut>l.recurrence_end_date);)je++;return je})()," events with the same Zoom link"]})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{htmlFor:"is_published",children:"Published"}),r.jsx(As,{id:"is_published",checked:l.is_published,onCheckedChange:je=>i({...l,is_published:je})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:st,className:"flex-1",children:"Cancel"}),r.jsx(Q,{type:"submit",className:"flex-1",disabled:Oe.isPending||at.isPending||v,children:v?"Uploading...":a?"Update Event":l.is_recurring&&l.event_date&&l.recurrence_end_date?"Create Recurring Events":"Create Event"})]})]})]})]})]}),r.jsx(et,{children:ne?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(pe==null?void 0:pe.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Date & Time"}),r.jsx(Mt,{children:"Registrations"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:pe==null?void 0:pe.map(je=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:je.title}),r.jsx(yt,{children:on(new Date(je.event_date),"PPP p")}),r.jsx(yt,{children:r.jsxs(Q,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Te(je),children:[r.jsx($n,{className:"h-4 w-4"}),(fe==null?void 0:fe[je.id])||0,je.capacity&&` / ${je.capacity}`]})}),r.jsx(yt,{children:r.jsx("span",{className:Ut("px-2 py-1 rounded-full text-xs font-medium",je.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:je.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>window.open(je.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Ss,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>qe(je),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&le.mutate(je.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},je.id))})]})})]}),r.jsx(Rr,{open:k,onOpenChange:M,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),I==null?void 0:I.title]}),r.jsx(Yn,{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(Q,{variant:"ghost",size:"sm",onClick:()=>ve.mutate({eventId:I.id,testMode:!0}),disabled:ve.isPending,children:[r.jsx(ws,{className:Ut("h-4 w-4 mr-2",ve.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>ve.mutate({eventId:I.id}),disabled:ve.isPending||!(se!=null&&se.length),children:[r.jsx(ws,{className:Ut("h-4 w-4 mr-2",ve.isPending&&"animate-spin")}),ve.isPending?"Sending...":"Send Reminder to All"]}),(I==null?void 0:I.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>_e.mutate(I.id),disabled:_e.isPending,children:[r.jsx(Go,{className:Ut("h-4 w-4 mr-2",_e.isPending&&"animate-spin")}),_e.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(Q,{variant:"default",size:"sm",onClick:()=>we.mutate(I.id),disabled:we.isPending,children:[r.jsx(io,{className:Ut("h-4 w-4 mr-2",we.isPending&&"animate-spin")}),we.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(wi,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(_i,{className:"grid w-full grid-cols-2",children:[r.jsxs(sn,{value:"registrations",className:"gap-2",children:[r.jsx($n,{className:"h-4 w-4"}),"Registrations (",(se==null?void 0:se.length)||0,")"]}),r.jsxs(sn,{value:"attendees",className:"gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),"Attendees (",(ue==null?void 0:ue.length)||0,")"]})]}),r.jsx(Sn,{value:"registrations",className:"mt-4",children:me?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(se==null?void 0:se.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(I==null?void 0:I.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Registered"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Fs,{children:se==null?void 0:se.map(je=>{var Ze,Le;const ut=((Ze=je.profiles)==null?void 0:Ze.name)||je.zoom_name||"Unknown",Ce=((Le=je.profiles)==null?void 0:Le.email)||je.zoom_email||null,Ee=!je.user_id;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ut,Ee&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(yt,{children:Ce?r.jsxs("a",{href:`mailto:${Ce}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(ws,{className:"h-3 w-3"}),Ce]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(yt,{className:"text-muted-foreground text-sm",children:on(new Date(je.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(yt,{children:je.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"})})]},je.id)})})]})}),r.jsx(Sn,{value:"attendees",className:"mt-4",children:xe?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(ue==null?void 0:ue.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(I==null?void 0:I.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:[(ue==null?void 0:ue.filter(je=>!je.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(yl,{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 (",ue==null?void 0:ue.filter(je=>!je.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:ue==null?void 0:ue.filter(je=>!je.user_id).map(je=>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:je.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:je.zoom_email||"No email"})]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>Ie(je),className:"gap-1",children:[r.jsx(gm,{className:"h-3 w-3"}),"Link to Profile"]})]},je.id))})]}),r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Points"})]})}),r.jsx(Fs,{children:ue==null?void 0:ue.filter(je=>je.user_id).map(je=>{var Ee,Ze;const ut=((Ee=je.profiles)==null?void 0:Ee.name)||je.zoom_name||"Unknown",Ce=((Ze=je.profiles)==null?void 0:Ze.email)||je.zoom_email||null;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ut,je.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(yt,{children:Ce?r.jsxs("a",{href:`mailto:${Ce}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(ws,{className:"h-3 w-3"}),Ce]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(yt,{children:je.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Xa,{className:"h-3 w-3"}),je.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{children:je.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(io,{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"})})]},je.id)})})]})]})})]})]})}),r.jsx(Rr,{open:P,onOpenChange:F,children:r.jsxs(Dr,{className:"max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(Yn,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),D&&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:D.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:D.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name or email...",value:ae,onChange:je=>oe(je.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Be.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:Be.slice(0,20).map(je=>r.jsxs("button",{type:"button",onClick:()=>W(je.id),className:Ut("w-full p-3 text-left hover:bg-muted/50 transition-colors",V===je.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:je.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:je.email})]},je.id))})}),D.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(_l,{id:"save-alias",checked:G,onCheckedChange:je=>ee(je)}),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(Q,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),r.jsx(Q,{onClick:$e,disabled:!V||Me.isPending,children:Me.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const ySt=()=>{const{user:e}=tn(),{toast:t}=fi(),n=Vr(),[s,a]=Zc(),[o,l]=A.useState(!1),[i,u]=A.useState(null),[m,x]=A.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,v]=A.useState(null),[b,N]=A.useState(0),[k,M]=A.useState(!1),[I,T]=A.useState(null),[P,F]=A.useState(""),[D,U]=A.useState(""),[V,W]=A.useState(""),[G,ee]=A.useState(!1),[ae,oe]=A.useState(!1),{data:pe=[]}=Zt({queryKey:["template-categories"],queryFn:async()=>{const{data:at,error:le}=await Y.from("template_categories").select("*").order("name");if(le)throw le;return at}}),{data:ne=[]}=Zt({queryKey:["template-types"],queryFn:async()=>{const{data:at,error:le}=await Y.from("template_types").select("*").order("name");if(le)throw le;return at}}),{data:fe=[],isLoading:se}=Zt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:at,error:le}=await Y.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(le)throw le;const{data:qe,error:Je}=await Y.from("template_links").select("*").order("sort_order");if(Je)throw Je;const{data:st,error:je}=await Y.from("template_guides").select("*").order("sort_order");if(je)throw je;return at.map(Ce=>({...Ce,links:(qe==null?void 0:qe.filter(Ee=>Ee.template_id===Ce.id))||[],guides:(st==null?void 0:st.filter(Ee=>Ee.template_id===Ce.id))||[]}))}});A.useEffect(()=>{const at=s.get("edit");if(at&&fe.length>0){const le=fe.find(qe=>qe.id===at);le&&(we(le),a({},{replace:!0}))}},[fe,s]);const me=ar({mutationFn:async at=>{const{data:le,error:qe}=await Y.from("template_categories").insert({name:at}).select().single();if(qe)throw qe;return le},onSuccess:at=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...m,category_id:at.id}),U(""),ee(!1),t({title:"Category added"})},onError:at=>{t({title:"Error adding category",description:at.message,variant:"destructive"})}}),ue=ar({mutationFn:async at=>{const{data:le,error:qe}=await Y.from("template_types").insert({name:at}).select().single();if(qe)throw qe;return le},onSuccess:at=>{n.invalidateQueries({queryKey:["template-types"]}),x({...m,type_id:at.id}),W(""),oe(!1),t({title:"Type added"})},onError:at=>{t({title:"Error adding type",description:at.message,variant:"destructive"})}}),xe=ar({mutationFn:async at=>{var je;let le=at.existingImageUrl;if(at.image){const ut=at.image.name.split(".").pop(),Ce=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ut}`,{error:Ee}=await Y.storage.from("template-previews").upload(Ce,at.image);if(Ee)throw Ee;const{data:Ze}=Y.storage.from("template-previews").getPublicUrl(Ce);le=Ze.publicUrl}const qe={name:at.template.name,description:at.template.description||null,category_id:at.template.category_id||null,type_id:at.template.type_id||null,preview_image_url:le,video_url:at.videoUrl||null,publish_date:at.template.publish_date?new Date(at.template.publish_date).toISOString():new Date().toISOString(),created_by:e==null?void 0:e.id};let Je=at.templateId;if(Je){const{error:ut}=await Y.from("canva_templates").update(qe).eq("id",Je);if(ut)throw ut;const{error:Ce}=await Y.from("template_links").delete().eq("template_id",Je);if(Ce)throw Ce;const Ee=((je=at.existingGuides)==null?void 0:je.map(Ke=>Ke.id).filter(Boolean))||[],Ze=at.template.guides.map(Ke=>Ke.id).filter(Boolean),Le=Ee.filter(Ke=>!Ze.includes(Ke));Le.length>0&&await Y.from("template_guides").delete().in("id",Le)}else{const{data:ut,error:Ce}=await Y.from("canva_templates").insert(qe).select().single();if(Ce)throw Ce;Je=ut.id,mSt(at.template.name,ut.id)}const st=at.template.links.filter(ut=>ut.title.trim()&&ut.canva_share_link.trim());if(st.length>0){const ut=st.map((Ee,Ze)=>({template_id:Je,title:Ee.title.trim(),canva_share_link:Ee.canva_share_link.trim(),sort_order:Ze})),{error:Ce}=await Y.from("template_links").insert(ut);if(Ce)throw Ce}for(let ut=0;ut{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),_e(),l(!1),t({title:i?"Template updated":"Template created"})},onError:at=>{t({title:"Error saving template",description:at.message,variant:"destructive"})}}),Te=ar({mutationFn:async at=>{const{error:le}=await Y.from("canva_templates").delete().eq("id",at);if(le)throw le},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),t({title:"Template deleted"})},onError:at=>{t({title:"Error deleting template",description:at.message,variant:"destructive"})}}),_e=()=>{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),F(""),u(null),ee(!1),oe(!1),U(""),W(""),v(null),N(0),M(!1)},we=at=>{var le;u(at),x({name:at.name,description:at.description||"",category_id:at.category_id||"",type_id:at.type_id||"",publish_date:at.publish_date?new Date(at.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:at.links&&at.links.length>0?at.links.map(qe=>({id:qe.id,title:qe.title,canva_share_link:qe.canva_share_link,sort_order:qe.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((le=at.guides)==null?void 0:le.map(qe=>({id:qe.id,name:qe.name,file_url:qe.file_url,file_type:qe.file_type,file_size:qe.file_size,sort_order:qe.sort_order})))||[],video_url:at.video_url||""}),F(at.preview_image_url||""),v(null),l(!0)},ve=at=>{var qe;const le=(qe=at.target.files)==null?void 0:qe[0];le&&(T(le),F(URL.createObjectURL(le)))},Xe=()=>{x({...m,links:[...m.links,{title:"",canva_share_link:"",sort_order:m.links.length}]})},Me=at=>{if(m.links.length<=1)return;const le=m.links.filter((qe,Je)=>Je!==at);x({...m,links:le})},Ie=(at,le,qe)=>{const Je=[...m.links];Je[at]={...Je[at],[le]:qe},x({...m,links:Je})},$e=at=>{const le=at.target.files;if(!le)return;const qe=Array.from(le).map((Je,st)=>({name:Je.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:Je.type,file_size:Je.size,sort_order:m.guides.length+st,file:Je}));x({...m,guides:[...m.guides,...qe]}),at.target.value=""},Be=at=>{const le=m.guides.filter((qe,Je)=>Je!==at);x({...m,guides:le})},Ve=(at,le)=>{const qe=[...m.guides];qe[at]={...qe[at],name:le},x({...m,guides:qe})},ot=async()=>{if(!y)return null;M(!0),N(0);try{const{data:at,error:le}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:m.name||y.name}});if(le)throw new Error(le.message);const{videoId:qe,libraryId:Je}=at,{data:st,error:je}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:qe}});if(je)throw new Error(je.message);const ut=new XMLHttpRequest;return await new Promise((Ee,Ze)=>{ut.upload.addEventListener("progress",Le=>{if(Le.lengthComputable){const Ke=Math.round(Le.loaded/Le.total*100);N(Ke)}}),ut.addEventListener("load",()=>{ut.status>=200&&ut.status<300?Ee():Ze(new Error(`Upload failed with status ${ut.status}`))}),ut.addEventListener("error",()=>Ze(new Error("Upload failed"))),ut.open("PUT",st.uploadUrl),ut.setRequestHeader("AccessKey",st.apiKey),ut.send(y)}),`https://player.mediadelivery.net/embed/${Je}/${qe}`}catch(at){return console.error("Bunny upload error:",at),t({title:"Video upload failed",description:at instanceof Error?at.message:"Unknown error",variant:"destructive"}),null}finally{M(!1)}},Tt=at=>{var qe;const le=(qe=at.target.files)==null?void 0:qe[0];le&&v(le),at.target.value=""},Oe=async at=>{if(at.preventDefault(),!m.name.trim()){t({title:"Please enter a template name",variant:"destructive"});return}if(m.links.filter(Je=>Je.title.trim()&&Je.canva_share_link.trim()).length===0){t({title:"Please add at least one Canva link",variant:"destructive"});return}let qe=m.video_url;if(y){const Je=await ot();if(!Je)return;qe=Je}xe.mutate({template:m,image:I,existingImageUrl:(i==null?void 0:i.preview_image_url)||null,templateId:i==null?void 0:i.id,existingGuides:i==null?void 0:i.guides,videoUrl:qe})};return r.jsx(Fr,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:fe.length})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:pe.length})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ne.length})})]})]}),r.jsxs(Rr,{open:o,onOpenChange:at=>{l(at),at||_e()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:i?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Oe,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name *"}),r.jsx(lt,{id:"name",value:m.name,onChange:at=>x({...m,name:at.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:m.description,onChange:at=>x({...m,description:at}),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(ze,{children:"Canva Links *"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:Xe,className:"gap-1",children:[r.jsx(_n,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:m.links.map((at,le)=>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(lt,{value:at.title,onChange:qe=>Ie(le,"title",qe.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(lt,{value:at.canva_share_link,onChange:qe=>Ie(le,"canva_share_link",qe.target.value),placeholder:"https://www.canva.com/design/..."})]}),m.links.length>1&&r.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Me(le),children:r.jsx(ds,{className:"h-4 w-4"})})]},le))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Category"}),G?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:D,onChange:at=>U(at.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(Q,{type:"button",size:"sm",onClick:()=>D.trim()&&me.mutate(D.trim()),disabled:me.isPending,children:"Add"}),r.jsx(Q,{type:"button",size:"sm",variant:"ghost",onClick:()=>{ee(!1),U("")},children:r.jsx(ds,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(un,{value:m.category_id,onValueChange:at=>x({...m,category_id:at}),children:[r.jsx(ln,{className:"flex-1",children:r.jsx(mn,{placeholder:"Select category"})}),r.jsx(cn,{children:pe.map(at=>r.jsx($t,{value:at.id,children:at.name},at.id))})]}),r.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>ee(!0),children:r.jsx(_n,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Template Type"}),ae?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:V,onChange:at=>W(at.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(Q,{type:"button",size:"sm",onClick:()=>V.trim()&&ue.mutate(V.trim()),disabled:ue.isPending,children:"Add"}),r.jsx(Q,{type:"button",size:"sm",variant:"ghost",onClick:()=>{oe(!1),W("")},children:r.jsx(ds,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(un,{value:m.type_id,onValueChange:at=>x({...m,type_id:at}),children:[r.jsx(ln,{className:"flex-1",children:r.jsx(mn,{placeholder:"Select type"})}),r.jsx(cn,{children:ne.map(at=>r.jsx($t,{value:at.id,children:at.name},at.id))})]}),r.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>oe(!0),children:r.jsx(_n,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(lt,{id:"publish_date",type:"date",value:m.publish_date,onChange:at=>x({...m,publish_date:at.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(ze,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[P?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:P,alt:"Preview",className:"w-full h-full object-cover"}),r.jsx(Q,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{T(null),F("")},children:r.jsx(ds,{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(Fl,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(lt,{type:"file",accept:"image/*",onChange:ve,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(ze,{children:"Video (Optional)"}),m.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(Ia,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>x({...m,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:m.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):k?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(Gr,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",b,"%"]})]}),r.jsx(Mc,{value:b,className:"h-2"})]}):y?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Ia,{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(Q,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>v(null),children:r.jsx(ds,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(lt,{type:"file",accept:"video/*",onChange:Tt,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(Ia,{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(ze,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(lt,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:$e,className:"hidden"}),r.jsx(Q,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(bo,{className:"h-3 w-3"}),"Add Files"]})})]})]}),m.guides.length>0?r.jsx("div",{className:"space-y-2",children:m.guides.map((at,le)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(_a,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(lt,{value:at.name,onChange:qe=>Ve(le,qe.target.value),placeholder:"Guide name",className:"flex-1"}),at.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(at.file_size/1024).toFixed(0)," KB"]}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Be(le),children:r.jsx(ds,{className:"h-4 w-4"})})]},at.id||le))}):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(Q,{type:"button",variant:"outline",onClick:()=>{l(!1),_e()},children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:xe.isPending,children:xe.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:se?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):fe.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Preview"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Links"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:fe.map(at=>{var le,qe,Je,st,je;return r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:at.preview_image_url?r.jsx("img",{src:at.preview_image_url,alt:at.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Fl,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(yt,{className:"font-medium",children:at.name}),r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(At,{variant:"secondary",children:[((le=at.links)==null?void 0:le.length)||0," link",(((qe=at.links)==null?void 0:qe.length)||0)!==1?"s":""]}),(((Je=at.guides)==null?void 0:Je.length)||0)>0&&r.jsxs(At,{variant:"outline",className:"gap-1",children:[r.jsx(_a,{className:"h-3 w-3"}),(st=at.guides)==null?void 0:st.length," guide",(((je=at.guides)==null?void 0:je.length)||0)!==1?"s":""]})]})}),r.jsx(yt,{children:at.category?r.jsx(At,{variant:"secondary",children:at.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(yt,{children:at.type?r.jsx(At,{variant:"outline",children:at.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(yt,{className:"text-muted-foreground",children:new Date(at.publish_date).toLocaleDateString()}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{size:"icon",variant:"ghost",onClick:()=>we(at),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Te.mutate(at.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},at.id)})})]})})})]})})};function W9e({selectedTemplateIds:e,onChange:t}){const[n,s]=A.useState(""),[a,o]=A.useState(!1),{data:l=[]}=Zt({queryKey:["all-canva-templates-picker"],queryFn:async()=>{const{data:y,error:v}=await Y.from("canva_templates").select("id, name, preview_image_url").order("name");if(v)throw v;return y}}),i=l.filter(y=>e.includes(y.id)),u=l.filter(y=>!e.includes(y.id)&&y.name.toLowerCase().includes(n.toLowerCase())),m=y=>{t([...e,y])},x=y=>{t(e.filter(v=>v!==y))};return r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(zj,{className:"h-4 w-4"}),"Linked Templates"]}),i.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(y=>r.jsxs(At,{variant:"secondary",className:"gap-1 pr-1",children:[y.name,r.jsx("button",{type:"button",onClick:()=>x(y.id),className:"ml-1 rounded-full hover:bg-muted-foreground/20 p-0.5",children:r.jsx(ds,{className:"h-3 w-3"})})]},y.id))}),r.jsxs(Wc,{open:a,onOpenChange:o,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"gap-1",children:[r.jsx(zj,{className:"h-3.5 w-3.5"}),"Add Template"]})}),r.jsxs(Tc,{className:"w-80 p-2",align:"start",children:[r.jsxs("div",{className:"relative mb-2",children:[r.jsx(ma,{className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search templates...",value:n,onChange:y=>s(y.target.value),className:"pl-7 h-8 text-sm"})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto space-y-0.5",children:u.length===0?r.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:n?"No templates found":"All templates selected"}):u.map(y=>r.jsxs("button",{type:"button",onClick:()=>{m(y.id),s("")},className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[y.preview_image_url?r.jsx("img",{src:y.preview_image_url,alt:"",className:"w-8 h-8 rounded object-cover flex-shrink-0"}):r.jsx("div",{className:"w-8 h-8 rounded bg-muted flex items-center justify-center flex-shrink-0",children:r.jsx(zj,{className:"h-3.5 w-3.5 text-muted-foreground"})}),r.jsx("span",{className:"truncate",children:y.name})]},y.id))})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Link templates that agents can use alongside this content."})]})}const vSt=[{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"}],_St=()=>{const{user:e}=tn(),[t,n]=Zc(),{toast:s}=fi(),a=Vr(),[o,l]=A.useState(!1),[i,u]=A.useState(null),[m,x]=A.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[y,v]=A.useState(null),[b,N]=A.useState(""),[k,M]=A.useState([]),[I,T]=A.useState([]),[P,F]=A.useState([]),[D,U]=A.useState([]),[V,W]=A.useState(""),[G,ee]=A.useState(!1),[ae,oe]=A.useState(null),[pe,ne]=A.useState(0),[fe,se]=A.useState(!1),[me,ue]=A.useState(null),{data:xe=[]}=Zt({queryKey:["academy-categories"],queryFn:async()=>{const{data:le,error:qe}=await Y.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(qe)throw qe;return le}}),{data:Te=[],isLoading:_e}=Zt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:le,error:qe}=await Y.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(qe)throw qe;const{data:Je,error:st}=await Y.from("academy_resources").select("*").order("sort_order");if(st)throw st;return le.map(ut=>({...ut,resources:(Je==null?void 0:Je.filter(Ce=>Ce.video_id===ut.id))||[]}))}});A.useEffect(()=>{const le=t.get("edit");if(le&&Te.length>0){const qe=Te.find(Je=>Je.id===le);qe&&($e(qe),n({},{replace:!0}))}},[Te,t]);const we=ar({mutationFn:async le=>{const{data:qe,error:Je}=await Y.from("academy_categories").insert({name:le,sort_order:xe.length}).select().single();if(Je)throw Je;return qe},onSuccess:le=>{a.invalidateQueries({queryKey:["academy-categories"]}),x({...m,category_id:le.id}),W(""),ee(!1),s({title:"Category added"})},onError:le=>{s({title:"Error adding category",description:le.message,variant:"destructive"})}}),ve=ar({mutationFn:async le=>{let qe=le.existingThumbnailUrl;if(le.thumbnail){const je=le.thumbnail.name.split(".").pop(),ut=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${je}`,{error:Ce}=await Y.storage.from("academy-resources").upload(ut,le.thumbnail);if(Ce)throw Ce;const{data:Ee}=Y.storage.from("academy-resources").getPublicUrl(ut);qe=Ee.publicUrl}const Je={title:le.video.title,description:le.video.description||null,video_url:le.video.video_url,video_type:le.video.video_type,duration:le.video.duration||null,thumbnail_url:qe,category_id:le.video.category_id||null,publish_date:le.video.publish_date?new Date(le.video.publish_date).toISOString():new Date().toISOString(),is_published:le.video.is_published,created_by:e==null?void 0:e.id};let st=le.videoId;if(st){const{error:je}=await Y.from("academy_videos").update(Je).eq("id",st);if(je)throw je}else{const{data:je,error:ut}=await Y.from("academy_videos").insert(Je).select().single();if(ut)throw ut;st=je.id,fSt(le.video.title,je.id)}if(le.resourcesToDelete.length>0){const{error:je}=await Y.from("academy_resources").delete().in("id",le.resourcesToDelete);if(je)throw je}for(let je=0;je0){const{error:je}=await Y.from("academy_video_templates").insert(D.map(ut=>({video_id:st,template_id:ut})));if(je)throw je}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),Ie(),l(!1),s({title:i?"Video updated":"Video created"})},onError:le=>{s({title:"Error saving video",description:le.message,variant:"destructive"})}}),Xe=ar({mutationFn:async le=>{const{error:qe}=await Y.from("academy_videos").delete().eq("id",le);if(qe)throw qe},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),s({title:"Video deleted"})},onError:le=>{s({title:"Error deleting video",description:le.message,variant:"destructive"})}}),Me=ar({mutationFn:async({id:le,is_published:qe})=>{const{error:Je}=await Y.from("academy_videos").update({is_published:qe}).eq("id",le);if(Je)throw Je},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]})},onError:le=>{s({title:"Error updating video",description:le.message,variant:"destructive"})}}),Ie=()=>{x({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),v(null),N(""),M([]),T([]),F([]),u(null),U([]),W(""),oe(null),ne(0),se(!1),ue(null)},$e=async le=>{u(le),x({title:le.title,description:le.description||"",video_url:le.video_url,video_type:le.video_type,duration:le.duration||"",category_id:le.category_id||"",publish_date:le.publish_date?new Date(le.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:le.is_published}),N(le.thumbnail_url||""),T(le.resources||[]),M([]),F([]);const{data:qe}=await Y.from("academy_video_templates").select("template_id").eq("video_id",le.id);U((qe||[]).map(Je=>Je.template_id)),l(!0)},Be=le=>{var Je;const qe=(Je=le.target.files)==null?void 0:Je[0];qe&&(v(qe),N(URL.createObjectURL(qe)))},Ve=le=>{const qe=le.target.files;if(qe){const Je=Array.from(qe).map(st=>({file:st,title:st.name.replace(/\.[^/.]+$/,"")}));M([...k,...Je])}le.target.value=""},ot=le=>{M(k.filter((qe,Je)=>Je!==le))},Tt=le=>{F([...P,le]),T(I.filter(qe=>qe.id!==le))},Oe=async()=>{if(!ae)return null;se(!0),ne(0);try{const{data:le,error:qe}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:m.title||ae.name}});if(qe)throw new Error(qe.message);const{videoId:Je,libraryId:st}=le;ue(Je);const{data:je,error:ut}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Je}});if(ut)throw new Error(ut.message);const Ce=new XMLHttpRequest;return await new Promise((Ze,Le)=>{Ce.upload.addEventListener("progress",Ke=>{if(Ke.lengthComputable){const tt=Math.round(Ke.loaded/Ke.total*100);ne(tt)}}),Ce.addEventListener("load",()=>{Ce.status>=200&&Ce.status<300?Ze():Le(new Error(`Upload failed with status ${Ce.status}`))}),Ce.addEventListener("error",()=>Le(new Error("Upload failed"))),Ce.open("PUT",je.uploadUrl),Ce.setRequestHeader("AccessKey",je.apiKey),Ce.send(ae)}),`https://player.mediadelivery.net/embed/${st}/${Je}`}catch(le){return console.error("Bunny upload error:",le),s({title:"Video upload failed",description:le instanceof Error?le.message:"Unknown error",variant:"destructive"}),null}finally{se(!1)}},at=async le=>{if(le.preventDefault(),!m.title.trim()){s({title:"Please enter a video title",variant:"destructive"});return}let qe=m.video_url;if(m.video_type==="bunny_stream"&&ae&&!i){const Je=await Oe();if(!Je)return;qe=Je}else if(!m.video_url.trim()&&m.video_type!=="bunny_stream"){s({title:"Please enter a video URL",variant:"destructive"});return}else if(m.video_type==="bunny_stream"&&!ae&&!m.video_url&&!i){s({title:"Please select a video file to upload",variant:"destructive"});return}ve.mutate({video:{...m,video_url:qe},thumbnail:y,existingThumbnailUrl:(i==null?void 0:i.thumbnail_url)||null,videoId:i==null?void 0:i.id,newResources:k,resourcesToDelete:P})};return r.jsx(Fr,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:Te.length})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:Te.filter(le=>le.is_published).length})})]})]}),r.jsxs(Rr,{open:o,onOpenChange:le=>{l(le),le||Ie()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:i?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:at,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(lt,{id:"title",value:m.title,onChange:le=>x({...m,title:le.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:m.description,onChange:le=>x({...m,description:le}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Video Type"}),r.jsxs(un,{value:m.video_type,onValueChange:le=>{x({...m,video_type:le,video_url:""}),oe(null)},disabled:fe,children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:vSt.map(le=>r.jsx($t,{value:le.value,children:le.label},le.value))})]})]}),m.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(ze,{children:["Upload Video File ",!i&&"*"]}),i&&m.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:m.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!i&&r.jsxs(r.Fragment,{children:[r.jsx(lt,{type:"file",accept:"video/*",onChange:le=>{var Je;const qe=(Je=le.target.files)==null?void 0:Je[0];qe&&oe(qe)},disabled:fe}),ae&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ia,{className:"h-4 w-4"}),ae.name," (",(ae.size/(1024*1024)).toFixed(1)," MB)"]}),fe&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Gr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Mc,{value:pe,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[pe,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(lt,{id:"video_url",value:m.video_url,onChange:le=>x({...m,video_url:le.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(ze,{htmlFor:"duration",children:"Duration"}),r.jsx(lt,{id:"duration",value:m.duration,onChange:le=>x({...m,duration:le.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(lt,{id:"publish_date",type:"date",value:m.publish_date,onChange:le=>x({...m,publish_date:le.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Category"}),G?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:V,onChange:le=>W(le.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(Q,{type:"button",size:"sm",onClick:()=>V.trim()&&we.mutate(V.trim()),disabled:we.isPending,children:"Add"}),r.jsx(Q,{type:"button",size:"sm",variant:"ghost",onClick:()=>{ee(!1),W("")},children:r.jsx(ds,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(un,{value:m.category_id,onValueChange:le=>x({...m,category_id:le}),children:[r.jsx(ln,{className:"flex-1",children:r.jsx(mn,{placeholder:"Select category"})}),r.jsx(cn,{children:xe.map(le=>r.jsx($t,{value:le.id,children:le.name},le.id))})]}),r.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:()=>ee(!0),children:r.jsx(_n,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[b&&r.jsx("img",{src:b,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(lt,{type:"file",accept:"image/*",onChange:Be,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(ze,{children:"Resource Files"}),r.jsx(Q,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(bo,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:Ve,className:"hidden"})]})})]}),(I.length>0||k.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[I.map(le=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:le.title}),r.jsx(At,{variant:"outline",className:"text-xs",children:le.file_type}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>Tt(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(ds,{className:"h-4 w-4"})})]},le.id)),k.map((le,qe)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(lt,{value:le.title,onChange:Je=>{const st=[...k];st[qe].title=Je.target.value,M(st)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(At,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>ot(qe),className:"text-destructive hover:text-destructive",children:r.jsx(ds,{className:"h-4 w-4"})})]},qe))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsx(W9e,{selectedTemplateIds:D,onChange:U}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{id:"is_published",checked:m.is_published,onCheckedChange:le=>x({...m,is_published:le})}),r.jsx(ze,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(Vs,{children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>l(!1),disabled:fe,children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:ve.isPending||fe,children:fe?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):ve.isPending?"Saving...":i?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:_e?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"})}):Te.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ia,{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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Resources"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(Fs,{children:Te.map(le=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[le.thumbnail_url?r.jsx("img",{src:le.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(Ia,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:le.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:le.video_type.replace("_"," ")})]})]})}),r.jsx(yt,{children:le.category?r.jsx(At,{variant:"outline",children:le.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(yt,{children:le.duration||"-"}),r.jsx(yt,{children:le.resources&&le.resources.length>0?r.jsxs(At,{variant:"secondary",children:[le.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(yt,{children:new Date(le.publish_date).toLocaleDateString()}),r.jsx(yt,{children:r.jsx(As,{checked:le.is_published,onCheckedChange:qe=>Me.mutate({id:le.id,is_published:qe})})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>$e(le),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>Xe.mutate(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},le.id))})]})})})]})})};function bSt(){var ve,Xe,Me;const e=Vr(),[t,n]=Zc(),[s,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,x]=A.useState(null),[y,v]=A.useState(""),[b,N]=A.useState([]),[k,M]=A.useState([]),[I,T]=A.useState([]),[P,F]=A.useState(null),{data:D,isLoading:U}=Zt({queryKey:["resource-kits"],queryFn:async()=>{const{data:Ie,error:$e}=await Y.from("resource_kits").select("*").order("publish_date",{ascending:!1});if($e)throw $e;return Ie}}),{data:V}=Zt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:Ie,error:$e}=await Y.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if($e)throw $e;return Ie}}),{data:W}=Zt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:Ie,error:$e}=await Y.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if($e)throw $e;return Ie}});A.useEffect(()=>{const Ie=t.get("edit");if(Ie&&D&&D.length>0&&V&&W){const $e=D.find(Be=>Be.id===Ie);$e&&(ee($e),n({},{replace:!0}))}},[D,V,W,t]);const G=()=>{u({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),v(""),N([]),M([]),T([]),l(null)},ee=async Ie=>{l(Ie),u({name:Ie.name,description:Ie.description||"",publish_date:Ie.publish_date.split("T")[0],is_published:Ie.is_published}),v(Ie.featured_image_url||"");const $e=(V==null?void 0:V.filter(ot=>ot.kit_id===Ie.id))||[];N($e.map(ot=>({id:ot.id,name:ot.name,file_url:ot.file_url,file_type:ot.file_type,file_size:ot.file_size,sort_order:ot.sort_order})));const Be=(W==null?void 0:W.filter(ot=>ot.kit_id===Ie.id))||[];M(Be.map(ot=>({id:ot.id,title:ot.title,canva_share_link:ot.canva_share_link,sort_order:ot.sort_order})));const{data:Ve}=await Y.from("resource_kit_templates").select("template_id").eq("kit_id",Ie.id);T((Ve||[]).map(ot=>ot.template_id)),a(!0)},ae=Ie=>{var Be;const $e=(Be=Ie.target.files)==null?void 0:Be[0];$e&&(x($e),v(URL.createObjectURL($e)))},oe=()=>{N([...b,{name:"",file_url:"",sort_order:b.length}])},pe=Ie=>{N(b.filter(($e,Be)=>Be!==Ie))},ne=(Ie,$e,Be)=>{const Ve=[...b];Ve[Ie]={...Ve[Ie],[$e]:Be},N(Ve)},fe=()=>{M([...k,{title:"",canva_share_link:"",sort_order:k.length}])},se=Ie=>{M(k.filter(($e,Be)=>Be!==Ie))},me=(Ie,$e,Be)=>{const Ve=[...k];Ve[Ie]={...Ve[Ie],[$e]:Be},M(Ve)},ue=(Ie,$e)=>{var Ve;const Be=(Ve=$e.target.files)==null?void 0:Ve[0];if(Be){const ot=[...b],Tt=Be.name.replace(/\.[^/.]+$/,"");ot[Ie]={...ot[Ie],file:Be,file_type:Be.type,file_size:Be.size,name:ot[Ie].name||Tt},N(ot)}},xe=ar({mutationFn:async()=>{let Ie=(o==null?void 0:o.featured_image_url)||null;if(m){const Tt=m.name.split(".").pop(),Oe=`${Date.now()}.${Tt}`,{error:at}=await Y.storage.from("resource-kits").upload(`featured/${Oe}`,m);if(at)throw at;const{data:le}=Y.storage.from("resource-kits").getPublicUrl(`featured/${Oe}`);Ie=le.publicUrl}const $e={name:i.name,description:i.description||null,featured_image_url:Ie,publish_date:i.publish_date,is_published:i.is_published};let Be;const Ve=!o,ot=(o==null?void 0:o.is_published)||!1;if(o){const{error:Tt}=await Y.from("resource_kits").update($e).eq("id",o.id);if(Tt)throw Tt;Be=o.id;const Oe=(V==null?void 0:V.filter(je=>je.kit_id===o.id).map(je=>je.id))||[],at=b.filter(je=>je.id).map(je=>je.id),le=Oe.filter(je=>!at.includes(je));le.length>0&&await Y.from("resource_kit_files").delete().in("id",le);const qe=(W==null?void 0:W.filter(je=>je.kit_id===o.id).map(je=>je.id))||[],Je=k.filter(je=>je.id).map(je=>je.id),st=qe.filter(je=>!Je.includes(je));st.length>0&&await Y.from("resource_kit_links").delete().in("id",st)}else{const{data:Tt,error:Oe}=await Y.from("resource_kits").insert($e).select().single();if(Oe)throw Oe;Be=Tt.id}for(let Tt=0;Tt0){const{error:Tt}=await Y.from("resource_kit_templates").insert(I.map(Oe=>({kit_id:Be,template_id:Oe})));if(Tt)throw Tt}return{kitId:Be,kitName:i.name,isNewKit:Ve,wasPublished:ot,isPublished:i.is_published}},onSuccess:Ie=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),e.invalidateQueries({queryKey:["resource-kit-links"]}),Ae.success(o?"Resource kit updated":"Resource kit created"),Ie.isPublished&&(Ie.isNewKit||!Ie.wasPublished)&&gSt(Ie.kitName,Ie.kitId),a(!1),G()},onError:Ie=>{Ae.error("Failed to save resource kit: "+Ie.message)}}),Te=ar({mutationFn:async Ie=>{const{error:$e}=await Y.from("resource_kits").delete().eq("id",Ie);if($e)throw $e},onSuccess:()=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),Ae.success("Resource kit deleted")},onError:Ie=>{Ae.error("Failed to delete: "+Ie.message)}}),_e=Ie=>{if(Ie.preventDefault(),!i.name){Ae.error("Please enter a name");return}xe.mutate()},we=Ie=>(V==null?void 0:V.filter($e=>$e.kit_id===Ie).length)||0;return r.jsx(Fr,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.length)||0})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.filter(Ie=>Ie.is_published).length)||0})})]})]}),r.jsxs(Q,{onClick:()=>{G(),a(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Files"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:U?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(D==null?void 0:D.length)===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):D==null?void 0:D.map(Ie=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ie.featured_image_url?r.jsx("img",{src:Ie.featured_image_url,alt:Ie.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(ql,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ie.name}),Ie.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ie.description})]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}),we(Ie.id)]})}),r.jsx(yt,{children:on(new Date(Ie.publish_date),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Ie.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Ie.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{const $e=(V==null?void 0:V.filter(Ve=>Ve.kit_id===Ie.id))||[],Be=(W==null?void 0:W.filter(Ve=>Ve.kit_id===Ie.id))||[];F({...Ie,files:$e,links:Be})},children:r.jsx(_o,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>ee(Ie),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&Te.mutate(Ie.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},Ie.id))})]})})}),r.jsx(Rr,{open:s,onOpenChange:a,children:r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{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(ql,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(lt,{type:"file",accept:"image/*",onChange:ae})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name *"}),r.jsx(lt,{id:"name",value:i.name,onChange:Ie=>u({...i,name:Ie.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:i.description,onChange:Ie=>u({...i,description:Ie}),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(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(lt,{id:"publish_date",type:"date",value:i.publish_date,onChange:Ie=>u({...i,publish_date:Ie.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(As,{checked:i.is_published,onCheckedChange:Ie=>u({...i,is_published:Ie})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:i.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(ze,{children:"Resource Files"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:oe,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),b.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:b.map((Ie,$e)=>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 ",$e+1]}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>pe($e),children:r.jsx(ds,{className:"h-4 w-4"})})]}),r.jsx(lt,{placeholder:"File name (e.g., Getting Started Guide)",value:Ie.name,onChange:Be=>ne($e,"name",Be.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lt,{type:"file",onChange:Be=>ue($e,Be),className:"flex-1"}),Ie.file_url&&!Ie.file&&r.jsx("a",{href:Ie.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),Ie.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},$e))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ze,{children:"Canva Links"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),k.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:k.map((Ie,$e)=>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 ",$e+1]}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>se($e),children:r.jsx(ds,{className:"h-4 w-4"})})]}),r.jsx(lt,{placeholder:"Link title (e.g., Social Media Post Template)",value:Ie.title,onChange:Be=>me($e,"title",Be.target.value)}),r.jsx(lt,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:Ie.canva_share_link,onChange:Be=>me($e,"canva_share_link",Be.target.value)})]},$e))})]}),r.jsx(W9e,{selectedTemplateIds:I,onChange:T}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:xe.isPending,children:xe.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Rr,{open:!!P,onOpenChange:()=>F(null),children:r.jsxs(Dr,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Br,{children:P==null?void 0:P.name})}),r.jsxs("div",{className:"space-y-4",children:[(P==null?void 0:P.featured_image_url)&&r.jsx("img",{src:P.featured_image_url,alt:P.name,className:"w-full h-48 object-cover rounded-lg"}),(P==null?void 0:P.description)&&r.jsx("p",{className:"text-muted-foreground",children:P.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((ve=P==null?void 0:P.files)==null?void 0:ve.length)||0,")"]}),((Xe=P==null?void 0:P.files)==null?void 0:Xe.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:(Me=P==null?void 0:P.files)==null?void 0:Me.map(Ie=>r.jsxs("a",{href:Ie.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(_a,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Ie.name})]},Ie.id))})]}),(P==null?void 0:P.links)&&P.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",P.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:P.links.map(Ie=>r.jsxs("a",{href:Ie.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(Oo,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Ie.title})]},Ie.id))})]})]})]})})]})})}const wSt=()=>{const{user:e}=tn(),{toast:t}=fi(),n=Vr(),[s,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[m,x]=A.useState(null),[y,v]=A.useState(""),{data:b=[],isLoading:N}=Zt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:W,error:G}=await Y.from("social_swag").select("*").order("publish_date",{ascending:!1});if(G)throw G;const{data:ee,error:ae}=await Y.from("social_swag_links").select("*").order("sort_order");if(ae)throw ae;return W.map(pe=>({...pe,links:(ee==null?void 0:ee.filter(ne=>ne.swag_id===pe.id))||[]}))}}),k=ar({mutationFn:async W=>{let G=W.existingImageUrl;if(W.image){const fe=W.image.name.split(".").pop(),se=`${Date.now()}-${Math.random().toString(36).substring(7)}.${fe}`,{error:me}=await Y.storage.from("template-previews").upload(se,W.image);if(me)throw me;const{data:ue}=Y.storage.from("template-previews").getPublicUrl(se);G=ue.publicUrl}const ee={title:W.item.title,description:W.item.description||null,preview_image_url:G,publish_date:W.item.publish_date?new Date(W.item.publish_date).toISOString():new Date().toISOString(),is_published:W.item.is_published,created_by:e==null?void 0:e.id};let ae=W.itemId;const oe=!ae,pe=(o==null?void 0:o.is_published)||!1;if(ae){const{error:fe}=await Y.from("social_swag").update(ee).eq("id",ae);if(fe)throw fe;await Y.from("social_swag_links").delete().eq("swag_id",ae)}else{const{data:fe,error:se}=await Y.from("social_swag").insert(ee).select().single();if(se)throw se;ae=fe.id}const ne=W.item.links.filter(fe=>fe.title.trim()&&fe.canva_share_link.trim());if(ne.length>0){const fe=ne.map((me,ue)=>({swag_id:ae,title:me.title.trim(),canva_share_link:me.canva_share_link.trim(),sort_order:ue})),{error:se}=await Y.from("social_swag_links").insert(fe);if(se)throw se}return{itemId:ae,itemTitle:W.item.title,isNewItem:oe,wasPublished:pe,isPublished:W.item.is_published}},onSuccess:W=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:o?"Item updated":"Item created"}),W.isPublished&&(W.isNewItem||!W.wasPublished)&&pfe(W.itemTitle,W.itemId),a(!1),I()},onError:W=>{t({title:"Error saving item",description:W.message,variant:"destructive"})}}),M=ar({mutationFn:async W=>{const{error:G}=await Y.from("social_swag").delete().eq("id",W);if(G)throw G},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:"Item deleted"})},onError:W=>{t({title:"Error deleting item",description:W.message,variant:"destructive"})}}),I=()=>{u({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),x(null),v(""),l(null)},T=W=>{l(W),u({title:W.title,description:W.description||"",publish_date:W.publish_date?new Date(W.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:W.is_published,links:W.links&&W.links.length>0?W.links.map(G=>({id:G.id,title:G.title,canva_share_link:G.canva_share_link,sort_order:G.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),v(W.preview_image_url||""),a(!0)},P=W=>{var ee;const G=(ee=W.target.files)==null?void 0:ee[0];G&&(x(G),v(URL.createObjectURL(G)))},F=()=>{u({...i,links:[...i.links,{title:"",canva_share_link:"",sort_order:i.links.length}]})},D=W=>{if(i.links.length<=1)return;const G=i.links.filter((ee,ae)=>ae!==W);u({...i,links:G})},U=(W,G,ee)=>{const ae=[...i.links];ae[W]={...ae[W],[G]:ee},u({...i,links:ae})},V=W=>{if(W.preventDefault(),!i.title.trim()){t({title:"Title is required",variant:"destructive"});return}k.mutate({item:i,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Fr,{title:"Manage Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(W=>W.is_published).length})})]})]}),r.jsxs(Rr,{open:s,onOpenChange:W=>{a(W),W||I()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:V,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(lt,{id:"title",value:i.title,onChange:W=>u({...i,title:W.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:i.description,onChange:W=>u({...i,description:W}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(lt,{id:"publish_date",type:"date",value:i.publish_date,onChange:W=>u({...i,publish_date:W.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(As,{id:"is_published",checked:i.is_published,onCheckedChange:W=>u({...i,is_published:W})}),r.jsx(ze,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{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(Q,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),v("")},children:r.jsx(ds,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Fl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(lt,{type:"file",accept:"image/*",onChange:P,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{children:"Canva Links"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:F,children:[r.jsx(_n,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),i.links.map((W,G)=>r.jsx(He,{children:r.jsxs(et,{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 ",G+1]}),i.links.length>1&&r.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>D(G),children:r.jsx(ds,{className:"h-3 w-3"})})]}),r.jsx(lt,{placeholder:"Link title (e.g., Instagram Post)",value:W.title,onChange:ee=>U(G,"title",ee.target.value)}),r.jsx(lt,{placeholder:"Canva share link",value:W.canva_share_link,onChange:ee=>U(G,"canva_share_link",ee.target.value)})]})},G))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:k.isPending,children:k.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(et,{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"})}):b.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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-16",children:"Preview"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Links"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:b.map(W=>{var G;return r.jsxs(Sr,{children:[r.jsx(yt,{children:W.preview_image_url?r.jsx("img",{src:W.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(Fl,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(yt,{className:"font-medium",children:W.title}),r.jsxs(yt,{children:[((G=W.links)==null?void 0:G.length)||0," links"]}),r.jsx(yt,{children:new Date(W.publish_date).toLocaleDateString()}),r.jsx(yt,{children:r.jsx(At,{variant:W.is_published?"default":"secondary",children:W.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${W.id}`,"_blank"),children:r.jsx(_o,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>T(W),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&M.mutate(W.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},W.id)})})]})})})]})})};function jSt(){for(var e=arguments.length,t=new Array(e),n=0;ns=>{t.forEach(a=>a(s))},t)}const Dae=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function R3(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function B0e(e){return"nodeType"in e}function Bh(e){var t,n;return e?R3(e)?e:B0e(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function $0e(e){const{Document:t}=Bh(e);return e instanceof t}function _P(e){return R3(e)?!1:e instanceof Bh(e).HTMLElement}function G9e(e){return e instanceof Bh(e).SVGElement}function F3(e){return e?R3(e)?e.document:B0e(e)?$0e(e)?e:_P(e)||G9e(e)?e.ownerDocument:document:document:document}const rx=Dae?A.useLayoutEffect:A.useEffect;function U0e(e){const t=A.useRef(e);return rx(()=>{t.current=e}),A.useCallback(function(){for(var n=arguments.length,s=new Array(n),a=0;a{e.current=setInterval(s,a)},[]),n=A.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function XE(e,t){t===void 0&&(t=[e]);const n=A.useRef(e);return rx(()=>{n.current!==e&&(n.current=e)},t),n}function bP(e,t){const n=A.useRef();return A.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Yre(e){const t=U0e(e),n=A.useRef(null),s=A.useCallback(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,s]}function gfe(e){const t=A.useRef();return A.useEffect(()=>{t.current=e},[e]),t.current}let Ede={};function wP(e,t){return A.useMemo(()=>{if(t)return t;const n=Ede[e]==null?0:Ede[e]+1;return Ede[e]=n,e+"-"+n},[e,t])}function K9e(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a{const i=Object.entries(l);for(const[u,m]of i){const x=o[u];x!=null&&(o[u]=x+e*m)}return o},{...t})}}const eC=K9e(1),QE=K9e(-1);function NSt(e){return"clientX"in e&&"clientY"in e}function q0e(e){if(!e)return!1;const{KeyboardEvent:t}=Bh(e.target);return t&&e instanceof t}function SSt(e){if(!e)return!1;const{TouchEvent:t}=Bh(e.target);return t&&e instanceof t}function xfe(e){if(SSt(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return NSt(e)?{x:e.clientX,y:e.clientY}:null}const JE=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[JE.Translate.toString(e),JE.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),W4e="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function CSt(e){return e.matches(W4e)?e:e.querySelector(W4e)}const MSt={display:"none"};function TSt(e){let{id:t,value:n}=e;return dt.createElement("div",{id:t,style:MSt},n)}function ASt(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return dt.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},n)}function ESt(){const[e,t]=A.useState("");return{announce:A.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const Z9e=A.createContext(null);function ISt(e){const t=A.useContext(Z9e);A.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function PSt(){const[e]=A.useState(()=>new Set),t=A.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[A.useCallback(s=>{let{type:a,event:o}=s;e.forEach(l=>{var i;return(i=l[a])==null?void 0:i.call(l,o)})},[e]),t]}const LSt={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},OSt={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function DSt(e){let{announcements:t=OSt,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=LSt}=e;const{announce:o,announcement:l}=ESt(),i=wP("DndLiveRegion"),[u,m]=A.useState(!1);if(A.useEffect(()=>{m(!0)},[]),ISt(A.useMemo(()=>({onDragStart(y){let{active:v}=y;o(t.onDragStart({active:v}))},onDragMove(y){let{active:v,over:b}=y;t.onDragMove&&o(t.onDragMove({active:v,over:b}))},onDragOver(y){let{active:v,over:b}=y;o(t.onDragOver({active:v,over:b}))},onDragEnd(y){let{active:v,over:b}=y;o(t.onDragEnd({active:v,over:b}))},onDragCancel(y){let{active:v,over:b}=y;o(t.onDragCancel({active:v,over:b}))}}),[o,t])),!u)return null;const x=dt.createElement(dt.Fragment,null,dt.createElement(TSt,{id:s,value:a.draggable}),dt.createElement(ASt,{id:i,announcement:l}));return n?Th.createPortal(x,n):x}var ad;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ad||(ad={}));function Xre(){}function G4e(e,t){return A.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function RSt(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(s=>s!=null),[...t])}const Bp=Object.freeze({x:0,y:0});function Y9e(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function X9e(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function FSt(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function K4e(e){let{left:t,top:n,height:s,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+s},{x:t+a,y:n+s}]}function Q9e(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Z4e(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const zSt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=Z4e(t,t.left,t.top),o=[];for(const l of s){const{id:i}=l,u=n.get(i);if(u){const m=Y9e(Z4e(u),a);o.push({id:i,data:{droppableContainer:l,value:m}})}}return o.sort(X9e)},BSt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=K4e(t),o=[];for(const l of s){const{id:i}=l,u=n.get(i);if(u){const m=K4e(u),x=a.reduce((v,b,N)=>v+Y9e(m[N],b),0),y=Number((x/4).toFixed(4));o.push({id:i,data:{droppableContainer:l,value:y}})}}return o.sort(X9e)};function $St(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=a-s,i=o-n;if(s{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=[];for(const o of s){const{id:l}=o,i=n.get(l);if(i){const u=$St(i,t);u>0&&a.push({id:l,data:{droppableContainer:o,value:u}})}}return a.sort(FSt)};function qSt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function J9e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Bp}function VSt(e){return function(n){for(var s=arguments.length,a=new Array(s>1?s-1:0),o=1;o({...l,top:l.top+e*i.y,bottom:l.bottom+e*i.y,left:l.left+e*i.x,right:l.right+e*i.x}),{...n})}}const HSt=VSt(1);function WSt(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function GSt(e,t,n){const s=WSt(t);if(!s)return e;const{scaleX:a,scaleY:o,x:l,y:i}=s,u=e.left-l-(1-a)*parseFloat(n),m=e.top-i-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),x=a?e.width/a:e.width,y=o?e.height/o:e.height;return{width:x,height:y,top:m,right:u+x,bottom:m+y,left:u}}const KSt={ignoreTransform:!1};function z3(e,t){t===void 0&&(t=KSt);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:x}=Bh(e).getComputedStyle(e);m&&(n=GSt(n,m,x))}const{top:s,left:a,width:o,height:l,bottom:i,right:u}=n;return{top:s,left:a,width:o,height:l,bottom:i,right:u}}function Y4e(e){return z3(e,{ignoreTransform:!0})}function ZSt(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function YSt(e,t){return t===void 0&&(t=Bh(e).getComputedStyle(e)),t.position==="fixed"}function XSt(e,t){t===void 0&&(t=Bh(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=t[a];return typeof o=="string"?n.test(o):!1})}function Rae(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if($0e(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!_P(a)||G9e(a)||n.includes(a))return n;const o=Bh(e).getComputedStyle(a);return a!==e&&XSt(a,o)&&n.push(a),YSt(a,o)?n:s(a.parentNode)}return e?s(e):n}function eBe(e){const[t]=Rae(e,1);return t??null}function Ide(e){return!Dae||!e?null:R3(e)?e:B0e(e)?$0e(e)||e===F3(e).scrollingElement?window:_P(e)?e:null:null}function tBe(e){return R3(e)?e.scrollX:e.scrollLeft}function rBe(e){return R3(e)?e.scrollY:e.scrollTop}function yfe(e){return{x:tBe(e),y:rBe(e)}}var Ad;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ad||(Ad={}));function nBe(e){return!Dae||!e?!1:e===document.scrollingElement}function sBe(e){const t={x:0,y:0},n=nBe(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,l=e.scrollTop>=s.y,i=e.scrollLeft>=s.x;return{isTop:a,isLeft:o,isBottom:l,isRight:i,maxScroll:s,minScroll:t}}const QSt={x:.2,y:.2};function JSt(e,t,n,s,a){let{top:o,left:l,right:i,bottom:u}=n;s===void 0&&(s=10),a===void 0&&(a=QSt);const{isTop:m,isBottom:x,isLeft:y,isRight:v}=sBe(e),b={x:0,y:0},N={x:0,y:0},k={height:t.height*a.y,width:t.width*a.x};return!m&&o<=t.top+k.height?(b.y=Ad.Backward,N.y=s*Math.abs((t.top+k.height-o)/k.height)):!x&&u>=t.bottom-k.height&&(b.y=Ad.Forward,N.y=s*Math.abs((t.bottom-k.height-u)/k.height)),!v&&i>=t.right-k.width?(b.x=Ad.Forward,N.x=s*Math.abs((t.right-k.width-i)/k.width)):!y&&l<=t.left+k.width&&(b.x=Ad.Backward,N.x=s*Math.abs((t.left+k.width-l)/k.width)),{direction:b,speed:N}}function e4t(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:l}=window;return{top:0,left:0,right:o,bottom:l,width:o,height:l}}const{top:t,left:n,right:s,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:a,width:e.clientWidth,height:e.clientHeight}}function aBe(e){return e.reduce((t,n)=>eC(t,yfe(n)),Bp)}function t4t(e){return e.reduce((t,n)=>t+tBe(n),0)}function r4t(e){return e.reduce((t,n)=>t+rBe(n),0)}function n4t(e,t){if(t===void 0&&(t=z3),!e)return;const{top:n,left:s,bottom:a,right:o}=t(e);eBe(e)&&(a<=0||o<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const s4t=[["x",["left","right"],t4t],["y",["top","bottom"],r4t]];class V0e{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Rae(n),a=aBe(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,i]of s4t)for(const u of l)Object.defineProperty(this,u,{get:()=>{const m=i(s),x=a[o]-m;return this.rect[u]+x},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class YA{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var a;(a=this.target)==null||a.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function a4t(e){const{EventTarget:t}=Bh(e);return e instanceof t?e:F3(e)}function Pde(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Jm;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Jm||(Jm={}));function X4e(e){e.preventDefault()}function i4t(e){e.stopPropagation()}var Qi;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Qi||(Qi={}));const iBe={start:[Qi.Space,Qi.Enter],cancel:[Qi.Esc],end:[Qi.Space,Qi.Enter,Qi.Tab]},o4t=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Qi.Right:return{...n,x:n.x+25};case Qi.Left:return{...n,x:n.x-25};case Qi.Down:return{...n,y:n.y+25};case Qi.Up:return{...n,y:n.y-25}}};class H0e{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new YA(F3(n)),this.windowListeners=new YA(Bh(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Jm.Resize,this.handleCancel),this.windowListeners.add(Jm.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Jm.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&n4t(s),n(Bp)}handleKeyDown(t){if(q0e(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:o=iBe,coordinateGetter:l=o4t,scrollBehavior:i="smooth"}=a,{code:u}=t;if(o.end.includes(u)){this.handleEnd(t);return}if(o.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:m}=s.current,x=m?{x:m.left,y:m.top}:Bp;this.referenceCoordinates||(this.referenceCoordinates=x);const y=l(t,{active:n,context:s.current,currentCoordinates:x});if(y){const v=QE(y,x),b={x:0,y:0},{scrollableAncestors:N}=s.current;for(const k of N){const M=t.code,{isTop:I,isRight:T,isLeft:P,isBottom:F,maxScroll:D,minScroll:U}=sBe(k),V=e4t(k),W={x:Math.min(M===Qi.Right?V.right-V.width/2:V.right,Math.max(M===Qi.Right?V.left:V.left+V.width/2,y.x)),y:Math.min(M===Qi.Down?V.bottom-V.height/2:V.bottom,Math.max(M===Qi.Down?V.top:V.top+V.height/2,y.y))},G=M===Qi.Right&&!T||M===Qi.Left&&!P,ee=M===Qi.Down&&!F||M===Qi.Up&&!I;if(G&&W.x!==y.x){const ae=k.scrollLeft+v.x,oe=M===Qi.Right&&ae<=D.x||M===Qi.Left&&ae>=U.x;if(oe&&!v.y){k.scrollTo({left:ae,behavior:i});return}oe?b.x=k.scrollLeft-ae:b.x=M===Qi.Right?k.scrollLeft-D.x:k.scrollLeft-U.x,b.x&&k.scrollBy({left:-b.x,behavior:i});break}else if(ee&&W.y!==y.y){const ae=k.scrollTop+v.y,oe=M===Qi.Down&&ae<=D.y||M===Qi.Up&&ae>=U.y;if(oe&&!v.x){k.scrollTo({top:ae,behavior:i});return}oe?b.y=k.scrollTop-ae:b.y=M===Qi.Down?k.scrollTop-D.y:k.scrollTop-U.y,b.y&&k.scrollBy({top:-b.y,behavior:i});break}}this.handleMove(t,eC(QE(y,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}H0e.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=iBe,onActivation:a}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(s.start.includes(l)){const i=o.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function Q4e(e){return!!(e&&"distance"in e)}function J4e(e){return!!(e&&"delay"in e)}class W0e{constructor(t,n,s){var a;s===void 0&&(s=a4t(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:l}=o;this.props=t,this.events=n,this.document=F3(l),this.documentListeners=new YA(this.document),this.listeners=new YA(s),this.windowListeners=new YA(Bh(l)),this.initialCoordinates=(a=xfe(o))!=null?a:Bp,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Jm.Resize,this.handleCancel),this.windowListeners.add(Jm.DragStart,X4e),this.windowListeners.add(Jm.VisibilityChange,this.handleCancel),this.windowListeners.add(Jm.ContextMenu,X4e),this.documentListeners.add(Jm.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(J4e(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Q4e(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:a}=this.props;a(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Jm.Click,i4t,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Jm.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:a,props:o}=this,{onMove:l,options:{activationConstraint:i}}=o;if(!a)return;const u=(n=xfe(t))!=null?n:Bp,m=QE(a,u);if(!s&&i){if(Q4e(i)){if(i.tolerance!=null&&Pde(m,i.tolerance))return this.handleCancel();if(Pde(m,i.distance))return this.handleStart()}if(J4e(i)&&Pde(m,i.tolerance))return this.handleCancel();this.handlePending(i,m);return}t.cancelable&&t.preventDefault(),l(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Qi.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const l4t={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class G0e extends W0e{constructor(t){const{event:n}=t,s=F3(n.target);super(t,l4t,s)}}G0e.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const c4t={move:{name:"mousemove"},end:{name:"mouseup"}};var vfe;(function(e){e[e.RightClick=2]="RightClick"})(vfe||(vfe={}));class d4t extends W0e{constructor(t){super(t,c4t,F3(t.event.target))}}d4t.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===vfe.RightClick?!1:(s==null||s({event:n}),!0)}}];const Lde={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class u4t extends W0e{constructor(t){super(t,Lde)}static setup(){return window.addEventListener(Lde.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lde.move.name,t)};function t(){}}}u4t.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:a}=n;return a.length>1?!1:(s==null||s({event:n}),!0)}}];var XA;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(XA||(XA={}));var Qre;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Qre||(Qre={}));function h4t(e){let{acceleration:t,activator:n=XA.Pointer,canScroll:s,draggingRect:a,enabled:o,interval:l=5,order:i=Qre.TreeOrder,pointerCoordinates:u,scrollableAncestors:m,scrollableAncestorRects:x,delta:y,threshold:v}=e;const b=f4t({delta:y,disabled:!o}),[N,k]=kSt(),M=A.useRef({x:0,y:0}),I=A.useRef({x:0,y:0}),T=A.useMemo(()=>{switch(n){case XA.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case XA.DraggableRect:return a}},[n,a,u]),P=A.useRef(null),F=A.useCallback(()=>{const U=P.current;if(!U)return;const V=M.current.x*I.current.x,W=M.current.y*I.current.y;U.scrollBy(V,W)},[]),D=A.useMemo(()=>i===Qre.TreeOrder?[...m].reverse():m,[i,m]);A.useEffect(()=>{if(!o||!m.length||!T){k();return}for(const U of D){if((s==null?void 0:s(U))===!1)continue;const V=m.indexOf(U),W=x[V];if(!W)continue;const{direction:G,speed:ee}=JSt(U,W,T,t,v);for(const ae of["x","y"])b[ae][G[ae]]||(ee[ae]=0,G[ae]=0);if(ee.x>0||ee.y>0){k(),P.current=U,N(F,l),M.current=ee,I.current=G;return}}M.current={x:0,y:0},I.current={x:0,y:0},k()},[t,F,s,k,o,l,JSON.stringify(T),JSON.stringify(b),N,m,D,x,JSON.stringify(v)])}const m4t={x:{[Ad.Backward]:!1,[Ad.Forward]:!1},y:{[Ad.Backward]:!1,[Ad.Forward]:!1}};function f4t(e){let{delta:t,disabled:n}=e;const s=gfe(t);return bP(a=>{if(n||!s||!a)return m4t;const o={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Ad.Backward]:a.x[Ad.Backward]||o.x===-1,[Ad.Forward]:a.x[Ad.Forward]||o.x===1},y:{[Ad.Backward]:a.y[Ad.Backward]||o.y===-1,[Ad.Forward]:a.y[Ad.Forward]||o.y===1}}},[n,t,s])}function p4t(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return bP(a=>{var o;return t==null?null:(o=s??a)!=null?o:null},[s,t])}function g4t(e,t){return A.useMemo(()=>e.reduce((n,s)=>{const{sensor:a}=s,o=a.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,s)}));return[...n,...o]},[]),[e,t])}var eI;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(eI||(eI={}));var _fe;(function(e){e.Optimized="optimized"})(_fe||(_fe={}));const eCe=new Map;function x4t(e,t){let{dragging:n,dependencies:s,config:a}=t;const[o,l]=A.useState(null),{frequency:i,measure:u,strategy:m}=a,x=A.useRef(e),y=M(),v=XE(y),b=A.useCallback(function(I){I===void 0&&(I=[]),!v.current&&l(T=>T===null?I:T.concat(I.filter(P=>!T.includes(P))))},[v]),N=A.useRef(null),k=bP(I=>{if(y&&!n)return eCe;if(!I||I===eCe||x.current!==e||o!=null){const T=new Map;for(let P of e){if(!P)continue;if(o&&o.length>0&&!o.includes(P.id)&&P.rect.current){T.set(P.id,P.rect.current);continue}const F=P.node.current,D=F?new V0e(u(F),F):null;P.rect.current=D,D&&T.set(P.id,D)}return T}return I},[e,o,n,y,u]);return A.useEffect(()=>{x.current=e},[e]),A.useEffect(()=>{y||b()},[n,y]),A.useEffect(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),A.useEffect(()=>{y||typeof i!="number"||N.current!==null||(N.current=setTimeout(()=>{b(),N.current=null},i))},[i,y,b,...s]),{droppableRects:k,measureDroppableContainers:b,measuringScheduled:o!=null};function M(){switch(m){case eI.Always:return!1;case eI.BeforeDragging:return n;default:return!n}}}function oBe(e,t){return bP(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function y4t(e,t){return oBe(e,t)}function v4t(e){let{callback:t,disabled:n}=e;const s=U0e(t),a=A.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(s)},[s,n]);return A.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Fae(e){let{callback:t,disabled:n}=e;const s=U0e(t),a=A.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(s)},[n]);return A.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function _4t(e){return new V0e(z3(e),e)}function tCe(e,t,n){t===void 0&&(t=_4t);const[s,a]=A.useState(null);function o(){a(u=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=u??n)!=null?m:null}const x=t(e);return JSON.stringify(u)===JSON.stringify(x)?u:x})}const l=v4t({callback(u){if(e)for(const m of u){const{type:x,target:y}=m;if(x==="childList"&&y instanceof HTMLElement&&y.contains(e)){o();break}}}}),i=Fae({callback:o});return rx(()=>{o(),e?(i==null||i.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),l==null||l.disconnect())},[e]),s}function b4t(e){const t=oBe(e);return J9e(e,t)}const rCe=[];function w4t(e){const t=A.useRef(e),n=bP(s=>e?s&&s!==rCe&&e&&t.current&&e.parentNode===t.current.parentNode?s:Rae(e):rCe,[e]);return A.useEffect(()=>{t.current=e},[e]),n}function j4t(e){const[t,n]=A.useState(null),s=A.useRef(e),a=A.useCallback(o=>{const l=Ide(o.target);l&&n(i=>i?(i.set(l,yfe(l)),new Map(i)):null)},[]);return A.useEffect(()=>{const o=s.current;if(e!==o){l(o);const i=e.map(u=>{const m=Ide(u);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,yfe(m)]):null}).filter(u=>u!=null);n(i.length?new Map(i):null),s.current=e}return()=>{l(e),l(o)};function l(i){i.forEach(u=>{const m=Ide(u);m==null||m.removeEventListener("scroll",a)})}},[a,e]),A.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>eC(o,l),Bp):aBe(e):Bp,[e,t])}function nCe(e,t){t===void 0&&(t=[]);const n=A.useRef(null);return A.useEffect(()=>{n.current=null},t),A.useEffect(()=>{const s=e!==Bp;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?QE(e,n.current):Bp}function k4t(e){A.useEffect(()=>{if(!Dae)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function N4t(e,t){return A.useMemo(()=>e.reduce((n,s)=>{let{eventName:a,handler:o}=s;return n[a]=l=>{o(l,t)},n},{}),[e,t])}function lBe(e){return A.useMemo(()=>e?ZSt(e):null,[e])}const sCe=[];function S4t(e,t){t===void 0&&(t=z3);const[n]=e,s=lBe(n?Bh(n):null),[a,o]=A.useState(sCe);function l(){o(()=>e.length?e.map(u=>nBe(u)?s:new V0e(t(u),u)):sCe)}const i=Fae({callback:l});return rx(()=>{i==null||i.disconnect(),l(),e.forEach(u=>i==null?void 0:i.observe(u))},[e]),a}function C4t(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return _P(t)?t:e}function M4t(e){let{measure:t}=e;const[n,s]=A.useState(null),a=A.useCallback(m=>{for(const{target:x}of m)if(_P(x)){s(y=>{const v=t(x);return y?{...y,width:v.width,height:v.height}:v});break}},[t]),o=Fae({callback:a}),l=A.useCallback(m=>{const x=C4t(m);o==null||o.disconnect(),x&&(o==null||o.observe(x)),s(x?t(x):null)},[t,o]),[i,u]=Yre(l);return A.useMemo(()=>({nodeRef:i,rect:n,setRef:u}),[n,i,u])}const T4t=[{sensor:G0e,options:{}},{sensor:H0e,options:{}}],A4t={current:{}},Jee={draggable:{measure:Y4e},droppable:{measure:Y4e,strategy:eI.WhileDragging,frequency:_fe.Optimized},dragOverlay:{measure:z3}};class QA extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const E4t={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new QA,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Xre},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Jee,measureDroppableContainers:Xre,windowRect:null,measuringScheduled:!1},I4t={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Xre,draggableNodes:new Map,over:null,measureDroppableContainers:Xre},zae=A.createContext(I4t),cBe=A.createContext(E4t);function P4t(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new QA}}}function L4t(e,t){switch(t.type){case ad.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ad.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ad.DragEnd:case ad.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ad.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new QA(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case ad.SetDroppableDisabled:{const{id:n,key:s,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const l=new QA(e.droppable.containers);return l.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case ad.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const o=new QA(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function O4t(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=A.useContext(zae),o=gfe(s),l=gfe(n==null?void 0:n.id);return A.useEffect(()=>{if(!t&&!s&&o&&l!=null){if(!q0e(o)||document.activeElement===o.target)return;const i=a.get(l);if(!i)return;const{activatorNode:u,node:m}=i;if(!u.current&&!m.current)return;requestAnimationFrame(()=>{for(const x of[u.current,m.current]){if(!x)continue;const y=CSt(x);if(y){y.focus();break}}})}},[s,t,a,l,o]),null}function D4t(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...s}),n):n}function R4t(e){return A.useMemo(()=>({draggable:{...Jee.draggable,...e==null?void 0:e.draggable},droppable:{...Jee.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Jee.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function F4t(e){let{activeNode:t,measure:n,initialRect:s,config:a=!0}=e;const o=A.useRef(!1),{x:l,y:i}=typeof a=="boolean"?{x:a,y:a}:a;rx(()=>{if(!l&&!i||!t){o.current=!1;return}if(o.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const x=n(m),y=J9e(x,s);if(l||(y.x=0),i||(y.y=0),o.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const v=eBe(m);v&&v.scrollBy({top:y.y,left:y.x})}},[t,l,i,s,n])}const dBe=A.createContext({...Bp,scaleX:1,scaleY:1});var n1;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(n1||(n1={}));const z4t=A.memo(function(t){var n,s,a,o;let{id:l,accessibility:i,autoScroll:u=!0,children:m,sensors:x=T4t,collisionDetection:y=USt,measuring:v,modifiers:b,...N}=t;const k=A.useReducer(L4t,void 0,P4t),[M,I]=k,[T,P]=PSt(),[F,D]=A.useState(n1.Uninitialized),U=F===n1.Initialized,{draggable:{active:V,nodes:W,translate:G},droppable:{containers:ee}}=M,ae=V!=null?W.get(V):null,oe=A.useRef({initial:null,translated:null}),pe=A.useMemo(()=>{var Ha;return V!=null?{id:V,data:(Ha=ae==null?void 0:ae.data)!=null?Ha:A4t,rect:oe}:null},[V,ae]),ne=A.useRef(null),[fe,se]=A.useState(null),[me,ue]=A.useState(null),xe=XE(N,Object.values(N)),Te=wP("DndDescribedBy",l),_e=A.useMemo(()=>ee.getEnabled(),[ee]),we=R4t(v),{droppableRects:ve,measureDroppableContainers:Xe,measuringScheduled:Me}=x4t(_e,{dragging:U,dependencies:[G.x,G.y],config:we.droppable}),Ie=p4t(W,V),$e=A.useMemo(()=>me?xfe(me):null,[me]),Be=Ho(),Ve=y4t(Ie,we.draggable.measure);F4t({activeNode:V!=null?W.get(V):null,config:Be.layoutShiftCompensation,initialRect:Ve,measure:we.draggable.measure});const ot=tCe(Ie,we.draggable.measure,Ve),Tt=tCe(Ie?Ie.parentElement:null),Oe=A.useRef({activatorEvent:null,active:null,activeNode:Ie,collisionRect:null,collisions:null,droppableRects:ve,draggableNodes:W,draggingNode:null,draggingNodeRect:null,droppableContainers:ee,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),at=ee.getNodeFor((n=Oe.current.over)==null?void 0:n.id),le=M4t({measure:we.dragOverlay.measure}),qe=(s=le.nodeRef.current)!=null?s:Ie,Je=U?(a=le.rect)!=null?a:ot:null,st=!!(le.nodeRef.current&&le.rect),je=b4t(st?null:ot),ut=lBe(qe?Bh(qe):null),Ce=w4t(U?at??Ie:null),Ee=S4t(Ce),Ze=D4t(b,{transform:{x:G.x-je.x,y:G.y-je.y,scaleX:1,scaleY:1},activatorEvent:me,active:pe,activeNodeRect:ot,containerNodeRect:Tt,draggingNodeRect:Je,over:Oe.current.over,overlayNodeRect:le.rect,scrollableAncestors:Ce,scrollableAncestorRects:Ee,windowRect:ut}),Le=$e?eC($e,G):null,Ke=j4t(Ce),tt=nCe(Ke),ct=nCe(Ke,[ot]),it=eC(Ze,tt),zt=Je?HSt(Je,Ze):null,Lt=pe&&zt?y({active:pe,collisionRect:zt,droppableRects:ve,droppableContainers:_e,pointerCoordinates:Le}):null,lr=Q9e(Lt,"id"),[Ar,Mr]=A.useState(null),Zr=st?Ze:eC(Ze,ct),Xn=qSt(Zr,(o=Ar==null?void 0:Ar.rect)!=null?o:null,ot),dr=A.useRef(null),En=A.useCallback((Ha,us)=>{let{sensor:ra,options:hs}=us;if(ne.current==null)return;const Ys=W.get(ne.current);if(!Ys)return;const zs=Ha.nativeEvent,ji=new ra({active:ne.current,activeNode:Ys,event:zs,options:hs,context:Oe,onAbort(Pa){if(!W.get(Pa))return;const{onDragAbort:bi}=xe.current,qn={id:Pa};bi==null||bi(qn),T({type:"onDragAbort",event:qn})},onPending(Pa,oo,bi,qn){if(!W.get(Pa))return;const{onDragPending:dc}=xe.current,go={id:Pa,constraint:oo,initialCoordinates:bi,offset:qn};dc==null||dc(go),T({type:"onDragPending",event:go})},onStart(Pa){const oo=ne.current;if(oo==null)return;const bi=W.get(oo);if(!bi)return;const{onDragStart:qn}=xe.current,Ki={activatorEvent:zs,active:{id:oo,data:bi.data,rect:oe}};Th.unstable_batchedUpdates(()=>{qn==null||qn(Ki),D(n1.Initializing),I({type:ad.DragStart,initialCoordinates:Pa,active:oo}),T({type:"onDragStart",event:Ki}),se(dr.current),ue(zs)})},onMove(Pa){I({type:ad.DragMove,coordinates:Pa})},onEnd:ir(ad.DragEnd),onCancel:ir(ad.DragCancel)});dr.current=ji;function ir(Pa){return async function(){const{active:bi,collisions:qn,over:Ki,scrollAdjustedTranslate:dc}=Oe.current;let go=null;if(bi&&dc){const{cancelDrop:uc}=xe.current;go={activatorEvent:zs,active:bi,collisions:qn,delta:dc,over:Ki},Pa===ad.DragEnd&&typeof uc=="function"&&await Promise.resolve(uc(go))&&(Pa=ad.DragCancel)}ne.current=null,Th.unstable_batchedUpdates(()=>{I({type:Pa}),D(n1.Uninitialized),Mr(null),se(null),ue(null),dr.current=null;const uc=Pa===ad.DragEnd?"onDragEnd":"onDragCancel";if(go){const rt=xe.current[uc];rt==null||rt(go),T({type:uc,event:go})}})}}},[W]),Es=A.useCallback((Ha,us)=>(ra,hs)=>{const Ys=ra.nativeEvent,zs=W.get(hs);if(ne.current!==null||!zs||Ys.dndKit||Ys.defaultPrevented)return;const ji={active:zs};Ha(ra,us.options,ji)===!0&&(Ys.dndKit={capturedBy:us.sensor},ne.current=hs,En(ra,us))},[W,En]),Hs=g4t(x,Es);k4t(x),rx(()=>{ot&&F===n1.Initializing&&D(n1.Initialized)},[ot,F]),A.useEffect(()=>{const{onDragMove:Ha}=xe.current,{active:us,activatorEvent:ra,collisions:hs,over:Ys}=Oe.current;if(!us||!ra)return;const zs={active:us,activatorEvent:ra,collisions:hs,delta:{x:it.x,y:it.y},over:Ys};Th.unstable_batchedUpdates(()=>{Ha==null||Ha(zs),T({type:"onDragMove",event:zs})})},[it.x,it.y]),A.useEffect(()=>{const{active:Ha,activatorEvent:us,collisions:ra,droppableContainers:hs,scrollAdjustedTranslate:Ys}=Oe.current;if(!Ha||ne.current==null||!us||!Ys)return;const{onDragOver:zs}=xe.current,ji=hs.get(lr),ir=ji&&ji.rect.current?{id:ji.id,rect:ji.rect.current,data:ji.data,disabled:ji.disabled}:null,Pa={active:Ha,activatorEvent:us,collisions:ra,delta:{x:Ys.x,y:Ys.y},over:ir};Th.unstable_batchedUpdates(()=>{Mr(ir),zs==null||zs(Pa),T({type:"onDragOver",event:Pa})})},[lr]),rx(()=>{Oe.current={activatorEvent:me,active:pe,activeNode:Ie,collisionRect:zt,collisions:Lt,droppableRects:ve,draggableNodes:W,draggingNode:qe,draggingNodeRect:Je,droppableContainers:ee,over:Ar,scrollableAncestors:Ce,scrollAdjustedTranslate:it},oe.current={initial:Je,translated:zt}},[pe,Ie,Lt,zt,W,qe,Je,ve,ee,Ar,Ce,it]),h4t({...Be,delta:G,draggingRect:zt,pointerCoordinates:Le,scrollableAncestors:Ce,scrollableAncestorRects:Ee});const Ei=A.useMemo(()=>({active:pe,activeNode:Ie,activeNodeRect:ot,activatorEvent:me,collisions:Lt,containerNodeRect:Tt,dragOverlay:le,draggableNodes:W,droppableContainers:ee,droppableRects:ve,over:Ar,measureDroppableContainers:Xe,scrollableAncestors:Ce,scrollableAncestorRects:Ee,measuringConfiguration:we,measuringScheduled:Me,windowRect:ut}),[pe,Ie,ot,me,Lt,Tt,le,W,ee,ve,Ar,Xe,Ce,Ee,we,Me,ut]),Ii=A.useMemo(()=>({activatorEvent:me,activators:Hs,active:pe,activeNodeRect:ot,ariaDescribedById:{draggable:Te},dispatch:I,draggableNodes:W,over:Ar,measureDroppableContainers:Xe}),[me,Hs,pe,ot,I,Te,W,Ar,Xe]);return dt.createElement(Z9e.Provider,{value:P},dt.createElement(zae.Provider,{value:Ii},dt.createElement(cBe.Provider,{value:Ei},dt.createElement(dBe.Provider,{value:Xn},m)),dt.createElement(O4t,{disabled:(i==null?void 0:i.restoreFocus)===!1})),dt.createElement(DSt,{...i,hiddenTextDescribedById:Te}));function Ho(){const Ha=(fe==null?void 0:fe.autoScrollEnabled)===!1,us=typeof u=="object"?u.enabled===!1:u===!1,ra=U&&!Ha&&!us;return typeof u=="object"?{...u,enabled:ra}:{enabled:ra}}}),B4t=A.createContext(null),aCe="button",$4t="Draggable";function U4t(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const o=wP($4t),{activators:l,activatorEvent:i,active:u,activeNodeRect:m,ariaDescribedById:x,draggableNodes:y,over:v}=A.useContext(zae),{role:b=aCe,roleDescription:N="draggable",tabIndex:k=0}=a??{},M=(u==null?void 0:u.id)===t,I=A.useContext(M?dBe:B4t),[T,P]=Yre(),[F,D]=Yre(),U=N4t(l,t),V=XE(n);rx(()=>(y.set(t,{id:t,key:o,node:T,activatorNode:F,data:V}),()=>{const G=y.get(t);G&&G.key===o&&y.delete(t)}),[y,t]);const W=A.useMemo(()=>({role:b,tabIndex:k,"aria-disabled":s,"aria-pressed":M&&b===aCe?!0:void 0,"aria-roledescription":N,"aria-describedby":x.draggable}),[s,b,k,M,N,x.draggable]);return{active:u,activatorEvent:i,activeNodeRect:m,attributes:W,isDragging:M,listeners:s?void 0:U,node:T,over:v,setNodeRef:P,setActivatorNodeRef:D,transform:I}}function q4t(){return A.useContext(cBe)}const V4t="Droppable",H4t={timeout:25};function W4t(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const o=wP(V4t),{active:l,dispatch:i,over:u,measureDroppableContainers:m}=A.useContext(zae),x=A.useRef({disabled:n}),y=A.useRef(!1),v=A.useRef(null),b=A.useRef(null),{disabled:N,updateMeasurementsFor:k,timeout:M}={...H4t,...a},I=XE(k??s),T=A.useCallback(()=>{if(!y.current){y.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(I.current)?I.current:[I.current]),b.current=null},M)},[M]),P=Fae({callback:T,disabled:N||!l}),F=A.useCallback((W,G)=>{P&&(G&&(P.unobserve(G),y.current=!1),W&&P.observe(W))},[P]),[D,U]=Yre(F),V=XE(t);return A.useEffect(()=>{!P||!D.current||(P.disconnect(),y.current=!1,P.observe(D.current))},[D,P]),A.useEffect(()=>(i({type:ad.RegisterDroppable,element:{id:s,key:o,disabled:n,node:D,rect:v,data:V}}),()=>i({type:ad.UnregisterDroppable,key:o,id:s})),[s]),A.useEffect(()=>{n!==x.current.disabled&&(i({type:ad.SetDroppableDisabled,id:s,key:o,disabled:n}),x.current.disabled=n)},[s,o,n,i]),{active:l,rect:v,isOver:(u==null?void 0:u.id)===s,node:D,over:u,setNodeRef:U}}function K0e(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function G4t(e,t){return e.reduce((n,s,a)=>{const o=t.get(s);return o&&(n[a]=o),n},Array(e.length))}function SO(e){return e!==null&&e>=0}function K4t(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const o=K0e(t,s,n),l=t[a],i=o[a];return!i||!l?null:{x:i.left-l.left,y:i.top-l.top,scaleX:i.width/l.width,scaleY:i.height/l.height}},uBe="Sortable",hBe=dt.createContext({activeIndex:-1,containerId:uBe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Z0e,disabled:{draggable:!1,droppable:!1}});function Y4t(e){let{children:t,id:n,items:s,strategy:a=Z0e,disabled:o=!1}=e;const{active:l,dragOverlay:i,droppableRects:u,over:m,measureDroppableContainers:x}=q4t(),y=wP(uBe,n),v=i.rect!==null,b=A.useMemo(()=>s.map(U=>typeof U=="object"&&"id"in U?U.id:U),[s]),N=l!=null,k=l?b.indexOf(l.id):-1,M=m?b.indexOf(m.id):-1,I=A.useRef(b),T=!K4t(b,I.current),P=M!==-1&&k===-1||T,F=Z4t(o);rx(()=>{T&&N&&x(b)},[T,b,N,x]),A.useEffect(()=>{I.current=b},[b]);const D=A.useMemo(()=>({activeIndex:k,containerId:y,disabled:F,disableTransforms:P,items:b,overIndex:M,useDragOverlay:v,sortedRects:G4t(b,u),strategy:a}),[k,y,F.draggable,F.droppable,P,b,M,u,v,a]);return dt.createElement(hBe.Provider,{value:D},t)}const X4t=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return K0e(n,s,a).indexOf(t)},Q4t=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:a,items:o,newIndex:l,previousItems:i,previousContainerId:u,transition:m}=e;return!m||!s||i!==o&&a===l?!1:n?!0:l!==a&&t===u},J4t={duration:200,easing:"ease"},mBe="transform",eCt=JE.Transition.toString({property:mBe,duration:0,easing:"linear"}),tCt={roleDescription:"sortable"};function rCt(e){let{disabled:t,index:n,node:s,rect:a}=e;const[o,l]=A.useState(null),i=A.useRef(n);return rx(()=>{if(!t&&n!==i.current&&s.current){const u=a.current;if(u){const m=z3(s.current,{ignoreTransform:!0}),x={x:u.left-m.left,y:u.top-m.top,scaleX:u.width/m.width,scaleY:u.height/m.height};(x.x||x.y)&&l(x)}}n!==i.current&&(i.current=n)},[t,n,s,a]),A.useEffect(()=>{o&&l(null)},[o]),o}function nCt(e){let{animateLayoutChanges:t=Q4t,attributes:n,disabled:s,data:a,getNewIndex:o=X4t,id:l,strategy:i,resizeObserverConfig:u,transition:m=J4t}=e;const{items:x,containerId:y,activeIndex:v,disabled:b,disableTransforms:N,sortedRects:k,overIndex:M,useDragOverlay:I,strategy:T}=A.useContext(hBe),P=sCt(s,b),F=x.indexOf(l),D=A.useMemo(()=>({sortable:{containerId:y,index:F,items:x},...a}),[y,a,F,x]),U=A.useMemo(()=>x.slice(x.indexOf(l)),[x,l]),{rect:V,node:W,isOver:G,setNodeRef:ee}=W4t({id:l,data:D,disabled:P.droppable,resizeObserverConfig:{updateMeasurementsFor:U,...u}}),{active:ae,activatorEvent:oe,activeNodeRect:pe,attributes:ne,setNodeRef:fe,listeners:se,isDragging:me,over:ue,setActivatorNodeRef:xe,transform:Te}=U4t({id:l,data:D,attributes:{...tCt,...n},disabled:P.draggable}),_e=jSt(ee,fe),we=!!ae,ve=we&&!N&&SO(v)&&SO(M),Xe=!I&&me,Me=Xe&&ve?Te:null,$e=ve?Me??(i??T)({rects:k,activeNodeRect:pe,activeIndex:v,overIndex:M,index:F}):null,Be=SO(v)&&SO(M)?o({id:l,items:x,activeIndex:v,overIndex:M}):F,Ve=ae==null?void 0:ae.id,ot=A.useRef({activeId:Ve,items:x,newIndex:Be,containerId:y}),Tt=x!==ot.current.items,Oe=t({active:ae,containerId:y,isDragging:me,isSorting:we,id:l,index:F,items:x,newIndex:ot.current.newIndex,previousItems:ot.current.items,previousContainerId:ot.current.containerId,transition:m,wasDragging:ot.current.activeId!=null}),at=rCt({disabled:!Oe,index:F,node:W,rect:V});return A.useEffect(()=>{we&&ot.current.newIndex!==Be&&(ot.current.newIndex=Be),y!==ot.current.containerId&&(ot.current.containerId=y),x!==ot.current.items&&(ot.current.items=x)},[we,Be,y,x]),A.useEffect(()=>{if(Ve===ot.current.activeId)return;if(Ve!=null&&ot.current.activeId==null){ot.current.activeId=Ve;return}const qe=setTimeout(()=>{ot.current.activeId=Ve},50);return()=>clearTimeout(qe)},[Ve]),{active:ae,activeIndex:v,attributes:ne,data:D,rect:V,index:F,newIndex:Be,items:x,isOver:G,isSorting:we,isDragging:me,listeners:se,node:W,overIndex:M,over:ue,setNodeRef:_e,setActivatorNodeRef:xe,setDroppableNodeRef:ee,setDraggableNodeRef:fe,transform:at??$e,transition:le()};function le(){if(at||Tt&&ot.current.newIndex===F)return eCt;if(!(Xe&&!q0e(oe)||!m)&&(we||Oe))return JE.Transition.toString({...m,property:mBe})}}function sCt(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function Jre(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const aCt=[Qi.Down,Qi.Right,Qi.Up,Qi.Left],iCt=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:o,over:l,scrollableAncestors:i}}=t;if(aCt.includes(e.code)){if(e.preventDefault(),!n||!s)return;const u=[];o.getEnabled().forEach(y=>{if(!y||y!=null&&y.disabled)return;const v=a.get(y.id);if(v)switch(e.code){case Qi.Down:s.topv.top&&u.push(y);break;case Qi.Left:s.left>v.left&&u.push(y);break;case Qi.Right:s.left1&&(x=m[1].id),x!=null){const y=o.get(n.id),v=o.get(x),b=v?a.get(v.id):null,N=v==null?void 0:v.node.current;if(N&&b&&y&&v){const M=Rae(N).some((U,V)=>i[V]!==U),I=fBe(y,v),T=oCt(y,v),P=M||!I?{x:0,y:0}:{x:T?s.width-b.width:0,y:T?s.height-b.height:0},F={x:b.left,y:b.top};return P.x&&P.y?F:QE(F,P)}}}};function fBe(e,t){return!Jre(e)||!Jre(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function oCt(e,t){return!Jre(e)||!Jre(t)||!fBe(e,t)?!1:e.data.current.sortable.indext(e),children:r.jsx(Qa,{className:"h-3.5 w-3.5"})}),r.jsx(Q,{variant:"destructive",size:"icon",className:"h-7 w-7",onClick:()=>n(e),children:r.jsx(Bn,{className:"h-3.5 w-3.5"})})]}),e.post_date&&r.jsx("div",{className:"absolute bottom-2 left-2",children:r.jsxs(At,{className:"bg-primary/90 text-primary-foreground text-[10px] gap-1 backdrop-blur-sm px-1.5 py-0.5",children:[r.jsx(Cs,{className:"h-2.5 w-2.5"}),on(new Date(e.post_date+"T00:00:00"),"MMM d")]})})]}),r.jsxs(et,{className:"p-3 space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:e.caption}),r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",size:"sm",className:Ut("w-full h-7 text-[11px] gap-1 justify-start font-normal",!e.post_date&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"h-3 w-3"}),e.post_date?on(new Date(e.post_date+"T00:00:00"),"MMM d, yyyy"):"Set post date"]})}),r.jsxs(Tc,{className:"w-auto p-0",align:"start",children:[r.jsx(Lp,{mode:"single",selected:e.post_date?new Date(e.post_date+"T00:00:00"):void 0,onSelect:y=>s(e.id,y?on(y,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"}),e.post_date&&r.jsx("div",{className:"p-2 border-t",children:r.jsx(Q,{variant:"ghost",size:"sm",className:"w-full text-xs text-muted-foreground",onClick:()=>s(e.id,null),children:"Clear date"})})]})]})]})]})})}const cCt=()=>{const e=Vr(),[t,n]=A.useState("all"),[s,a]=A.useState(!1),[o,l]=A.useState(on(new Date,"yyyy-MM")),[i,u]=A.useState([]),[m,x]=A.useState(!1),[y,v]=A.useState(null),[b,N]=A.useState(null),[k,M]=A.useState(""),[I,T]=A.useState(null),[P,F]=A.useState(!1),[D,U]=A.useState(!1),[V,W]=A.useState(on(new Date,"yyyy-MM")),[G,ee]=A.useState(null),[ae,oe]=A.useState(""),[pe,ne]=A.useState(""),[fe,se]=A.useState(""),[me,ue]=A.useState(!1),xe=RSt(G4e(G0e,{activationConstraint:{distance:5}}),G4e(H0e,{coordinateGetter:iCt})),{data:Te=[],isLoading:_e}=Zt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Le,error:Ke}=await Y.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ke)throw Ke;return Le}}),{data:we=[]}=Zt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Le,error:Ke}=await Y.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ke)throw Ke;return Le}}),{data:ve=[]}=Zt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Le,error:Ke}=await Y.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ke)throw Ke;return Le}}),Xe=[...new Set(Te.map(Le=>Le.month))].sort((Le,Ke)=>Ke.localeCompare(Le)),Me=t==="all"?Te:Te.filter(Le=>Le.month===t),Ie=Le=>{const Ke=Nye(Le,"yyyy-MM",new Date);return on(Ke,"MMMM yyyy")},$e=Le=>{N(Le),M(Le.caption),T(Le.post_date)},Be=async()=>{if(b){F(!0);try{const{error:Le}=await Y.from("social_swag_2").update({caption:k,post_date:I}).eq("id",b.id);if(Le)throw Le;Ae.success("Image updated"),N(null),e.invalidateQueries({queryKey:["admin-social-swag-2"]}),e.invalidateQueries({queryKey:["social-swag-2"]})}catch{Ae.error("Failed to update image")}finally{F(!1)}}},Ve=async Le=>{const{active:Ke,over:tt}=Le;if(!tt||Ke.id===tt.id)return;const ct=Me,it=ct.findIndex(lr=>lr.id===Ke.id),zt=ct.findIndex(lr=>lr.id===tt.id);if(it===-1||zt===-1)return;const Lt=K0e(ct,it,zt);e.setQueryData(["admin-social-swag-2"],lr=>{if(!lr)return lr;const Ar={};return Lt.forEach((Mr,Zr)=>{Ar[Mr.id]=Zr}),lr.map(Mr=>Ar[Mr.id]!==void 0?{...Mr,sort_order:Ar[Mr.id]}:Mr).sort((Mr,Zr)=>Mr.month!==Zr.month?Zr.month.localeCompare(Mr.month):Mr.sort_order-Zr.sort_order)});try{await Promise.all(Lt.map((lr,Ar)=>Y.from("social_swag_2").update({sort_order:Ar}).eq("id",lr.id)))}catch{Ae.error("Failed to save order"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})}},ot=Le=>{const tt=Array.from(Le.target.files||[]).slice(0,16-i.length).map(ct=>({file:ct,preview:URL.createObjectURL(ct),caption:""}));u(ct=>[...ct,...tt].slice(0,16))},Tt=Le=>{u(Ke=>{const tt=[...Ke];return URL.revokeObjectURL(tt[Le].preview),tt.splice(Le,1),tt})},Oe=(Le,Ke)=>{u(tt=>{const ct=[...tt];return ct[Le]={...ct[Le],caption:Ke},ct})},at=async()=>{if(i.length===0){Ae.error("Please add at least one image");return}if(i.filter(Ke=>!Ke.caption.trim()).length>0){Ae.error("Please add captions to all images");return}x(!0);try{for(let Ke=0;Ke{const Ke=Le.image_url.split("/social-swag-2/");Ke[1]&&await Y.storage.from("social-swag-2").remove([Ke[1]]);const{error:tt}=await Y.from("social_swag_2").delete().eq("id",Le.id);if(tt)throw tt},onSuccess:()=>{Ae.success("Image deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>Ae.error("Failed to delete image")}),qe=ar({mutationFn:async({id:Le,postDate:Ke})=>{const{error:tt}=await Y.from("social_swag_2").update({post_date:Ke}).eq("id",Le);if(tt)throw tt},onSuccess:()=>{Ae.success("Post date updated"),e.invalidateQueries({queryKey:["admin-social-swag-2"]}),e.invalidateQueries({queryKey:["social-swag-2"]})},onError:()=>Ae.error("Failed to update post date")}),Je=ar({mutationFn:async({month:Le,link:Ke})=>{const{error:tt}=await Y.from("social_swag_2_months").upsert({month:Le,canva_link:Ke||null},{onConflict:"month"});if(tt)throw tt},onSuccess:()=>{Ae.success("Canva link updated"),v(null),e.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>Ae.error("Failed to update Canva link")}),st=Le=>{var Ke;return((Ke=we.find(tt=>tt.month===Le))==null?void 0:Ke.canva_link)||""},je=Le=>ve.find(Ke=>Ke.month===Le)||null,ut=Le=>{var tt;const Ke=(tt=Le.target.files)==null?void 0:tt[0];Ke&&(ee(Ke),oe(URL.createObjectURL(Ke)))},Ce=()=>{ae&&URL.revokeObjectURL(ae),ee(null),oe(""),ne(""),se("")},Ee=async()=>{if(!G){Ae.error("Please select an image");return}ue(!0);try{const Le=G.name.split(".").pop(),Ke=`reels/${V}-${Date.now()}.${Le}`,{error:tt}=await Y.storage.from("social-swag-2").upload(Ke,G);if(tt)throw tt;const{data:{publicUrl:ct}}=Y.storage.from("social-swag-2").getPublicUrl(Ke),{error:it}=await Y.from("social_swag_2_reels").upsert({month:V,image_url:ct,canva_link:fe||null,caption:pe||null},{onConflict:"month"});if(it)throw it;Ae.success("Reel uploaded successfully!"),pfe(`${Ie(V)} Reel`,"social-swag-2"),Ce(),U(!1),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Le){console.error("Reel upload error:",Le),Ae.error("Failed to upload reel")}finally{ue(!1)}},Ze=ar({mutationFn:async Le=>{const Ke=Le.image_url.split("/social-swag-2/");Ke[1]&&await Y.storage.from("social-swag-2").remove([Ke[1]]);const{error:tt}=await Y.from("social_swag_2_reels").delete().eq("id",Le.id);if(tt)throw tt},onSuccess:()=>{Ae.success("Reel deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>Ae.error("Failed to delete reel")});return r.jsxs(Fr,{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("div",{className:"flex gap-2",children:[r.jsxs(Rr,{open:s,onOpenChange:a,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Dr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Month"}),r.jsx(lt,{type:"month",value:o,onChange:Le=>l(Le.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{children:["Images (",i.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:ot,className:"hidden",id:"swag-upload",disabled:i.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(bo,{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)"})]})]})]}),i.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:i.map((Le,Ke)=>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:Le.preview,alt:`Upload ${Ke+1}`,className:"w-full h-full object-cover"}),r.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Tt(Ke),children:r.jsx(ds,{className:"h-3 w-3"})})]}),r.jsx(Zn,{placeholder:"Caption...",value:Le.caption,onChange:tt=>Oe(Ke,tt.target.value),className:"text-xs h-20"})]},Ke))}),r.jsx(Q,{onClick:at,disabled:m||i.length===0,className:"w-full gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(bo,{className:"h-4 w-4"}),"Upload ",i.length," Images"]})})]})]})]}),r.jsxs(Rr,{open:D,onOpenChange:Le=>{U(Le),Le||Ce()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:"gap-2",children:[r.jsx(Td,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Dr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Month"}),r.jsx(lt,{type:"month",value:V,onChange:Le=>W(Le.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Reel Preview Image"}),ae?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ae,alt:"Reel preview",className:"w-full h-full object-cover"}),r.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(ae),ee(null),oe("")},children:r.jsx(ds,{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:ut,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(Td,{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(ze,{children:"Canva Download Link"}),r.jsx(lt,{value:fe,onChange:Le=>se(Le.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Caption"}),r.jsx(Zn,{value:pe,onChange:Le=>ne(Le.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(Q,{onClick:Ee,disabled:me||!G,className:"w-full gap-2",children:me?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(bo,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:Te.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:Xe.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(wi,{value:t,onValueChange:n,children:r.jsxs(_i,{children:[r.jsx(sn,{value:"all",children:"All"}),Xe.map(Le=>r.jsx(sn,{value:Le,children:Ie(Le)},Le))]})}),t!=="all"&&r.jsx(He,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Oo,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(ze,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",Ie(t)]}),(y==null?void 0:y.month)===t?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(lt,{value:y.link,onChange:Le=>v({...y,link:Le.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(Q,{size:"sm",onClick:()=>Je.mutate(y),children:"Save"}),r.jsx(Q,{size:"sm",variant:"outline",onClick:()=>v(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:st(t)||"No link set"}),r.jsx(Q,{size:"sm",variant:"outline",onClick:()=>v({month:t,link:st(t)}),children:"Edit"})]})]})]})})}),t!=="all"&&r.jsx(He,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(Td,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(ze,{className:"text-sm text-muted-foreground",children:["Reel for ",Ie(t)]}),(()=>{const Le=je(t);return Le?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:Le.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:Le.caption||"No caption"}),Le.canva_link&&r.jsx("a",{href:Le.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(Q,{variant:"destructive",size:"sm",onClick:()=>Ze.mutate(Le),children:r.jsx(Bn,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),_e?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):Me.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Fl,{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(z4t,{sensors:xe,collisionDetection:zSt,onDragEnd:Ve,children:r.jsx(Y4t,{items:Me.map(Le=>Le.id),strategy:Z0e,children:r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:Me.map(Le=>r.jsx(lCt,{item:Le,onEdit:$e,onDelete:Ke=>le.mutate(Ke),onDateChange:(Ke,tt)=>qe.mutate({id:Ke,postDate:tt})},Le.id))})})})]}),r.jsx(Rr,{open:!!b,onOpenChange:Le=>{Le||N(null)},children:r.jsxs(Dr,{className:"max-w-md",children:[r.jsx($r,{children:r.jsx(Br,{children:"Edit Image"})}),b&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"aspect-[4/5] max-h-48 w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:b.image_url,alt:"Preview",className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Caption"}),r.jsx(Zn,{value:k,onChange:Le=>M(Le.target.value),placeholder:"Enter caption...",className:"h-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Post Date"}),r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("flex-1 justify-start gap-2 font-normal",!I&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"h-4 w-4"}),I?on(new Date(I+"T00:00:00"),"MMM d, yyyy"):"Pick a date"]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:I?new Date(I+"T00:00:00"):void 0,onSelect:Le=>T(Le?on(Le,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"})})]}),I&&r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>T(null),children:r.jsx(ds,{className:"h-4 w-4"})})]})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>N(null),children:"Cancel"}),r.jsx(Q,{onClick:Be,disabled:P,className:"gap-2",children:P?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})]})},dCt=()=>{const{toast:e}=fi(),t=Vr(),[n,s]=A.useState("categories"),[a,o]=A.useState(!1),[l,i]=A.useState(null),[u,m]=A.useState({name:"",description:"",icon:""}),[x,y]=A.useState(!1),[v,b]=A.useState(null),[N,k]=A.useState({name:"",description:"",icon:""}),[M,I]=A.useState(!1),[T,P]=A.useState(null),[F,D]=A.useState(""),{data:U=[],isLoading:V}=Zt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Ve,error:ot}=await Y.from("community_categories").select("*").order("sort_order");if(ot)throw ot;return Ve}}),{data:W=[],isLoading:G}=Zt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Ve,error:ot}=await Y.from("community_private_groups").select("*").order("sort_order");if(ot)throw ot;return Ve}}),{data:ee=[]}=Zt({queryKey:["admin-group-members",T==null?void 0:T.id],queryFn:async()=>{if(!T)return[];const{data:Ve,error:ot}=await Y.from("community_private_group_members").select("*").eq("group_id",T.id);if(ot)throw ot;return Ve},enabled:!!T}),{data:ae=[]}=Zt({queryKey:["admin-all-profiles"],queryFn:async()=>{let ot=[],Tt=0,Oe=!0;for(;Oe;){const{data:at,error:le}=await Y.from("profiles").select("id, name, email, brokerage_id").order("name").range(Tt,Tt+1e3-1);if(le)throw le;at&&at.length>0?(ot=[...ot,...at],Tt+=1e3,Oe=at.length===1e3):Oe=!1}return ot}}),{data:oe=[]}=Zt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Ve,error:ot}=await Y.from("brokerages").select("*").order("name");if(ot)throw ot;return Ve}}),pe=ar({mutationFn:async Ve=>{if(Ve.id){const{error:ot}=await Y.from("community_categories").update({name:Ve.name,description:Ve.description||null,icon:Ve.icon||null}).eq("id",Ve.id);if(ot)throw ot}else{const ot=Math.max(...U.map(Oe=>Oe.sort_order),0),{error:Tt}=await Y.from("community_categories").insert({name:Ve.name,description:Ve.description||null,icon:Ve.icon||null,sort_order:ot+1});if(Tt)throw Tt}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),i(null),m({name:"",description:"",icon:""}),e({title:l?"Category updated!":"Category created!"})},onError:Ve=>{e({title:"Error",description:Ve.message,variant:"destructive"})}}),ne=ar({mutationFn:async Ve=>{const{error:ot}=await Y.from("community_categories").delete().eq("id",Ve);if(ot)throw ot},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),e({title:"Category deleted"})}}),fe=ar({mutationFn:async({id:Ve,direction:ot})=>{const Tt=U.findIndex(Oe=>Oe.id===Ve);if(ot==="up"&&Tt>0){const Oe=U[Tt-1],at=U[Tt];await Y.from("community_categories").update({sort_order:at.sort_order}).eq("id",Oe.id),await Y.from("community_categories").update({sort_order:Oe.sort_order}).eq("id",at.id)}else if(ot==="down"&&Ttt.invalidateQueries({queryKey:["admin-community-categories"]})}),se=ar({mutationFn:async Ve=>{if(Ve.id){const{error:ot}=await Y.from("community_private_groups").update({name:Ve.name,description:Ve.description||null,icon:Ve.icon||null}).eq("id",Ve.id);if(ot)throw ot}else{const ot=Math.max(...W.map(Oe=>Oe.sort_order),0),{error:Tt}=await Y.from("community_private_groups").insert({name:Ve.name,description:Ve.description||null,icon:Ve.icon||null,sort_order:ot+1});if(Tt)throw Tt}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),b(null),k({name:"",description:"",icon:""}),e({title:v?"Private group updated!":"Private group created!"})},onError:Ve=>{e({title:"Error",description:Ve.message,variant:"destructive"})}}),me=ar({mutationFn:async Ve=>{const{error:ot}=await Y.from("community_private_groups").delete().eq("id",Ve);if(ot)throw ot},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),e({title:"Private group deleted"})}}),ue=ar({mutationFn:async({id:Ve,direction:ot})=>{const Tt=W.findIndex(Oe=>Oe.id===Ve);if(ot==="up"&&Tt>0){const Oe=W[Tt-1],at=W[Tt];await Y.from("community_private_groups").update({sort_order:at.sort_order}).eq("id",Oe.id),await Y.from("community_private_groups").update({sort_order:Oe.sort_order}).eq("id",at.id)}else if(ot==="down"&&Ttt.invalidateQueries({queryKey:["admin-private-groups"]})}),xe=ar({mutationFn:async({groupId:Ve,userId:ot,isMember:Tt})=>{if(Tt){const{error:Oe}=await Y.from("community_private_group_members").delete().eq("group_id",Ve).eq("user_id",ot);if(Oe)throw Oe}else{const{error:Oe}=await Y.from("community_private_group_members").insert({group_id:Ve,user_id:ot});if(Oe)throw Oe}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Te=ar({mutationFn:async({groupId:Ve,brokerageId:ot,isMember:Tt})=>{if(Tt){const{error:Oe}=await Y.from("community_private_group_members").delete().eq("group_id",Ve).eq("brokerage_id",ot);if(Oe)throw Oe}else{const{error:Oe}=await Y.from("community_private_group_members").insert({group_id:Ve,brokerage_id:ot});if(Oe)throw Oe}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),_e=Ve=>{i(Ve),m({name:Ve.name,description:Ve.description||"",icon:Ve.icon||""}),o(!0)},we=()=>{i(null),m({name:"",description:"",icon:""}),o(!0)},ve=Ve=>{b(Ve),k({name:Ve.name,description:Ve.description||"",icon:Ve.icon||""}),y(!0)},Xe=()=>{b(null),k({name:"",description:"",icon:""}),y(!0)},Me=Ve=>{P(Ve),D(""),I(!0)},Ie=Ve=>ee.some(ot=>ot.user_id===Ve),$e=Ve=>ee.some(ot=>ot.brokerage_id===Ve),Be=ae.filter(Ve=>Ve.name.toLowerCase().includes(F.toLowerCase())||Ve.email.toLowerCase().includes(F.toLowerCase()));return r.jsx(Fr,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(wi,{value:n,onValueChange:s,children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"categories",children:"Public Categories"}),r.jsxs(sn,{value:"private-groups",children:[r.jsx(ff,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(Sn,{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(Q,{onClick:we,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-[50px]",children:"Order"}),r.jsx(Mt,{className:"w-[80px]",children:"Icon"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Fs,{children:V?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):U.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):U.map((Ve,ot)=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===0,onClick:()=>fe.mutate({id:Ve.id,direction:"up"}),children:"↑"}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===U.length-1,onClick:()=>fe.mutate({id:Ve.id,direction:"down"}),children:"↓"})]})}),r.jsx(yt,{className:"text-2xl",children:Ve.icon||"📁"}),r.jsx(yt,{className:"font-medium",children:Ve.name}),r.jsx(yt,{className:"text-muted-foreground",children:Ve.description||"—"}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>_e(Ve),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ne.mutate(Ve.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},Ve.id))})]})})})]}),r.jsxs(Sn,{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(hi,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(Q,{onClick:Xe,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-[50px]",children:"Order"}),r.jsx(Mt,{className:"w-[80px]",children:"Icon"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"w-[120px]",children:"Members"}),r.jsx(Mt,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(Fs,{children:G?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):W.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):W.map((Ve,ot)=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===0,onClick:()=>ue.mutate({id:Ve.id,direction:"up"}),children:"↑"}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===W.length-1,onClick:()=>ue.mutate({id:Ve.id,direction:"down"}),children:"↓"})]})}),r.jsx(yt,{className:"text-2xl",children:Ve.icon||"🔒"}),r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Ve.name,Ve.brokerage_id?r.jsxs(At,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(At,{variant:"secondary",className:"text-xs",children:[r.jsx(ff,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(yt,{className:"text-muted-foreground",children:Ve.description||"—"}),r.jsx(yt,{children:r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>Me(Ve),children:[r.jsx($n,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[!Ve.brokerage_id&&r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>ve(Ve),children:r.jsx(Qa,{className:"h-4 w-4"})}),!Ve.brokerage_id&&r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&me.mutate(Ve.id)},children:r.jsx(Bn,{className:"h-4 w-4"})}),Ve.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Ve.id))})]})})})]})]}),r.jsx(Rr,{open:a,onOpenChange:o,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{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(lt,{value:u.icon,onChange:Ve=>m(ot=>({...ot,icon:Ve.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(lt,{value:u.name,onChange:Ve=>m(ot=>({...ot,name:Ve.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(Zn,{value:u.description,onChange:Ve=>m(ot=>({...ot,description:Ve.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(Q,{onClick:()=>pe.mutate({...u,id:l==null?void 0:l.id}),disabled:!u.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Rr,{open:x,onOpenChange:y,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:v?"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(lt,{value:N.icon,onChange:Ve=>k(ot=>({...ot,icon:Ve.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(lt,{value:N.name,onChange:Ve=>k(ot=>({...ot,name:Ve.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(Zn,{value:N.description,onChange:Ve=>k(ot=>({...ot,description:Ve.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(Q,{onClick:()=>se.mutate({...N,id:v==null?void 0:v.id}),disabled:!N.name.trim(),children:v?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Rr,{open:M,onOpenChange:I,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Br,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(wi,{defaultValue:"brokerages",children:[r.jsxs(_i,{className:"w-full",children:[r.jsx(sn,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(sn,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(Sn,{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(Vo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[oe.map(Ve=>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(_l,{checked:$e(Ve.id),onCheckedChange:()=>{T&&Te.mutate({groupId:T.id,brokerageId:Ve.id,isMember:$e(Ve.id)})}}),r.jsx("span",{className:"font-medium",children:Ve.name})]}),r.jsxs(At,{variant:"secondary",children:[ae.filter(ot=>ot.brokerage_id===Ve.id).length," agents"]})]},Ve.id)),oe.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(Sn,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search users...",value:F,onChange:Ve=>D(Ve.target.value),className:"pl-9"})]}),r.jsx(Vo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Be.map(Ve=>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(_l,{checked:Ie(Ve.id),onCheckedChange:()=>{T&&xe.mutate({groupId:T.id,userId:Ve.id,isMember:Ie(Ve.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ve.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Ve.email})]})]})},Ve.id)),Be.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(Q,{onClick:()=>I(!1),children:"Done"})})]})]})})]})})},iCe=e=>{switch(e){case"academy_video":return r.jsx(Vl,{className:"h-3 w-3"});case"template":return r.jsx(_a,{className:"h-3 w-3"});case"toolbox":return r.jsx(ql,{className:"h-3 w-3"});case"newsletter":return r.jsx(fy,{className:"h-3 w-3"});case"social_swag":return r.jsx(Os,{className:"h-3 w-3"});default:return r.jsx(Ss,{className:"h-3 w-3"})}},uCt=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}},hCt=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}},mCt=()=>{const{toast:e}=fi(),[t,n]=A.useState([]),[s,a]=A.useState([]),[o,l]=A.useState([]),[i,u]=A.useState(!0),[m,x]=A.useState(""),[y,v]=A.useState(null),[b,N]=A.useState([]),[k,M]=A.useState([]);A.useEffect(()=>{I()},[]);const I=async()=>{try{u(!0);const{data:D,error:U}=await Y.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(U)throw U;const{data:V,error:W}=await Y.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(W)throw W;const G=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:ee}=await Y.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",G),ae=new Map((ee==null?void 0:ee.map(se=>[se.id,se]))||[]),oe=(D==null?void 0:D.map(se=>{var me,ue,xe,Te;return{id:se.id,user_id:se.user_id,app_name:se.app_name,launched_at:se.launched_at,user_name:((me=se.profiles)==null?void 0:me.name)||"Unknown",user_email:((ue=se.profiles)==null?void 0:ue.email)||"Unknown",brokerage_name:((Te=(xe=se.profiles)==null?void 0:xe.brokerages)==null?void 0:Te.name)||null}}))||[],pe=(V==null?void 0:V.map(se=>{var ue;const me=ae.get(se.user_id);return{id:se.id,user_id:se.user_id,resource_type:se.resource_type,resource_id:se.resource_id,resource_title:se.resource_title,action_type:se.action_type,created_at:se.created_at,user_name:(me==null?void 0:me.name)||"Unknown",user_email:(me==null?void 0:me.email)||"Unknown",brokerage_name:((ue=me==null?void 0:me.brokerages)==null?void 0:ue.name)||null}}))||[];n(oe),a(pe);const ne=new Map;oe.forEach(se=>{if(!ne.has(se.user_id))ne.set(se.user_id,{user_id:se.user_id,user_name:se.user_name,user_email:se.user_email,brokerage_name:se.brokerage_name,last_activity_type:"app",last_activity_name:se.app_name,last_activity_at:se.launched_at,total_app_launches:1,total_content_views:0});else{const me=ne.get(se.user_id);me.total_app_launches++,new Date(se.launched_at)>new Date(me.last_activity_at)&&(me.last_activity_type="app",me.last_activity_name=se.app_name,me.last_activity_at=se.launched_at)}}),pe.forEach(se=>{if(!ne.has(se.user_id))ne.set(se.user_id,{user_id:se.user_id,user_name:se.user_name,user_email:se.user_email,brokerage_name:se.brokerage_name,last_activity_type:se.resource_type,last_activity_name:se.resource_title,last_activity_at:se.created_at,total_app_launches:0,total_content_views:1});else{const me=ne.get(se.user_id);me.total_content_views++,new Date(se.created_at)>new Date(me.last_activity_at)&&(me.last_activity_type=se.resource_type,me.last_activity_name=se.resource_title,me.last_activity_at=se.created_at)}});const fe=Array.from(ne.values()).sort((se,me)=>new Date(me.last_activity_at).getTime()-new Date(se.last_activity_at).getTime());l(fe)}catch(D){console.error("Error loading activity:",D),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{u(!1)}},T=D=>{v({id:D.user_id,name:D.user_name,email:D.user_email});const U=t.filter(W=>W.user_id===D.user_id),V=s.filter(W=>W.user_id===D.user_id);N(U),M(V)},P=()=>{v(null),N([]),M([])},F=o.filter(D=>{var V;if(!m)return!0;const U=m.toLowerCase();return D.user_name.toLowerCase().includes(U)||D.user_email.toLowerCase().includes(U)||((V=D.brokerage_name)==null?void 0:V.toLowerCase().includes(U))});return i?r.jsx(He,{children:r.jsx(et,{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(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"User Activity"}),r.jsx(jn,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name, email, or brokerage...",value:m,onChange:D=>x(D.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"User"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(Mt,{children:"Last Activity"}),r.jsx(Mt,{children:"Last Active"}),r.jsx(Mt,{className:"text-right",children:"Apps"}),r.jsx(Mt,{className:"text-right",children:"Content"})]})}),r.jsx(Fs,{children:F.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):F.map(D=>r.jsxs(Sr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>T(D),children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:D.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:D.user_email})]})}),r.jsx(yt,{children:D.brokerage_name?r.jsx(At,{variant:"outline",children:D.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(yt,{children:r.jsx("div",{className:"flex items-center gap-2",children:D.last_activity_type==="app"?r.jsxs(At,{variant:"secondary",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),D.last_activity_name]}):r.jsxs(At,{variant:"outline",className:"flex items-center gap-1",children:[iCe(D.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:D.last_activity_name})]})})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:bu(new Date(D.last_activity_at),{addSuffix:!0})}),r.jsx(yt,{className:"text-right",children:r.jsx(At,{variant:"outline",children:D.total_app_launches})}),r.jsx(yt,{className:"text-right",children:r.jsx(At,{variant:"outline",children:D.total_content_views})})]},D.user_id))})]})})]})]}),r.jsx(Rr,{open:!!y,onOpenChange:D=>!D&&P(),children:r.jsxs(Dr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Br,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(Yn,{children:y==null?void 0:y.email})]}),r.jsxs(wi,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(_i,{className:"grid w-full grid-cols-2",children:[r.jsxs(sn,{value:"content",children:["Content (",k.length,")"]}),r.jsxs(sn,{value:"apps",children:["App Launches (",b.length,")"]})]}),r.jsx(Sn,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Fs,{children:k.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):k.map(D=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs(At,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[iCe(D.resource_type),uCt(D.resource_type)]})}),r.jsx(yt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:D.resource_title})}),r.jsx(yt,{children:r.jsx(At,{variant:"secondary",children:hCt(D.action_type)})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:bu(new Date(D.created_at),{addSuffix:!0})})]},D.id))})]})})}),r.jsx(Sn,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Fs,{children:b.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):b.map(D=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsx(At,{variant:"secondary",children:D.app_name})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:bu(new Date(D.launched_at),{addSuffix:!0})})]},D.id))})]})})})]})]})})]})},fCt=()=>{const{toast:e}=fi(),[t,n]=A.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,a]=A.useState(!0);A.useEffect(()=>{o()},[]);const o=async()=>{try{a(!0);const{count:l}=await Y.from("profiles").select("*",{count:"exact",head:!0}),{count:i}=await Y.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),u=(l||0)-(i||0),{count:m}=await Y.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:v}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),b=new Date;b.setMonth(b.getMonth()-1);const{count:N}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",b.toISOString()),{data:k}=await Y.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),M=new Set(k==null?void 0:k.map(I=>I.user_id)).size;n({totalUsers:l||0,activeUsers:i||0,pendingUsers:u,totalBrokerages:m||0,totalLaunches:x||0,launchesThisWeek:v||0,launchesThisMonth:N||0,uniqueActiveThisWeek:M})}catch(l){console.error("Error loading analytics:",l),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{a(!1)}};return s?r.jsx(He,{children:r.jsx(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(oi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(hi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(Lg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(Lg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(Lg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(eh,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},oCe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},lCe={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 pBe({brokerageOnly:e=!1,brokerageId:t}){const[n,s]=A.useState([]),[a,o]=A.useState(!0),[l,i]=A.useState(""),[u,m]=A.useState("all");A.useEffect(()=>{x()},[t]);const x=async()=>{o(!0);try{let I=[];if(e&&t){const{data:G}=await Y.from("profiles").select("id").eq("brokerage_id",t);if(I=(G==null?void 0:G.map(ee=>ee.id))||[],I.length===0){s([]),o(!1);return}}let T=Y.from("resource_shares").select("*").order("created_at",{ascending:!1});e&&I.length>0&&(T=T.or(`sender_id.in.(${I.join(",")}),recipient_id.in.(${I.join(",")})`));const{data:P,error:F}=await T;if(F)throw F;const D=new Set;P==null||P.forEach(G=>{D.add(G.sender_id),D.add(G.recipient_id)});const{data:U}=await Y.from("profiles").select("id, name, email").in("id",Array.from(D)),V=new Map((U==null?void 0:U.map(G=>[G.id,G]))||[]),W=(P==null?void 0:P.map(G=>({...G,sender:V.get(G.sender_id),recipient:V.get(G.recipient_id)})))||[];s(W)}catch(I){console.error("Error loading shares:",I)}finally{o(!1)}},y=n.filter(I=>{var F,D;const T=l===""||I.resource_title.toLowerCase().includes(l.toLowerCase())||((F=I.sender)==null?void 0:F.name.toLowerCase().includes(l.toLowerCase()))||((D=I.recipient)==null?void 0:D.name.toLowerCase().includes(l.toLowerCase())),P=u==="all"||I.resource_type===u;return T&&P}),v=n.length,b=new Set(n.map(I=>I.sender_id)).size,N=new Set(n.map(I=>I.recipient_id)).size,k=n.length>0?Math.round(n.filter(I=>I.is_read).length/n.length*100):0,M=n.reduce((I,T)=>(I[T.resource_type]=(I[T.resource_type]||0)+1,I),{});return a?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((I,T)=>r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Er,{className:"h-4 w-20"})}),r.jsx(et,{children:r.jsx(Er,{className:"h-8 w-16"})})]},T))}),r.jsx(He,{children:r.jsx(et,{className:"p-6",children:r.jsx(Er,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(Nc,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:v})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(eh,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:N})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[k,"%"]})})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(M).map(([I,T])=>r.jsxs(At,{variant:"secondary",className:lCe[I],children:[oCe[I],": ",T]},I)),Object.keys(M).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Share History"}),r.jsxs(jn,{children:["All resource shares ",e?"in your brokerage":"across the platform"]})]}),r.jsxs(et,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:I=>i(I.target.value),className:"pl-9"})]}),r.jsxs(un,{value:u,onValueChange:m,children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{placeholder:"Resource type"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Types"}),r.jsx($t,{value:"event",children:"Events"}),r.jsx($t,{value:"template",children:"Templates"}),r.jsx($t,{value:"academy_video",children:"Academy Videos"}),r.jsx($t,{value:"resource_kit",children:"Resource Kits"}),r.jsx($t,{value:"newsletter",children:"Newsletters"}),r.jsx($t,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(Vo,{className:"h-[400px]",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Sender"}),r.jsx(Mt,{children:"Recipient"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Date"})]})}),r.jsx(Fs,{children:y.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(I=>{var T,P;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium max-w-[200px] truncate",children:I.resource_title}),r.jsx(yt,{children:r.jsx(At,{variant:"secondary",className:lCe[I.resource_type],children:oCe[I.resource_type]})}),r.jsx(yt,{children:((T=I.sender)==null?void 0:T.name)||"Unknown"}),r.jsx(yt,{children:((P=I.recipient)==null?void 0:P.name)||"Unknown"}),r.jsx(yt,{children:r.jsx(At,{variant:I.is_read?"default":"outline",children:I.is_read?"Read":"Unread"})}),r.jsx(yt,{className:"text-muted-foreground",children:on(new Date(I.created_at),"MMM d, yyyy")})]},I.id)})})]})})]})]})]})}const pCt=()=>r.jsx(Fr,{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(wi,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"analytics",children:"Analytics"}),r.jsx(sn,{value:"activity",children:"Activity"}),r.jsx(sn,{value:"shares",children:"Shares"})]}),r.jsx(Sn,{value:"analytics",className:"space-y-4",children:r.jsx(fCt,{})}),r.jsx(Sn,{value:"activity",className:"space-y-4",children:r.jsx(mCt,{})}),r.jsx(Sn,{value:"shares",className:"space-y-4",children:r.jsx(pBe,{})})]})]})});function gCt(){const e=Vr(),[t,n]=A.useState(!1),[s,a]=A.useState(null),[o,l]=A.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[i,u]=A.useState(null),[m,x]=A.useState(""),[y,v]=A.useState([]),[b,N]=A.useState([]),[k,M]=A.useState([]),[I,T]=A.useState(!1),[P,F]=A.useState(null),[D,U]=A.useState(""),{data:V,isLoading:W}=Zt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Oe,error:at}=await Y.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(at)throw at;return Oe}}),{data:G}=Zt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Oe,error:at}=await Y.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),{data:ee}=Zt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Oe,error:at}=await Y.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),{data:ae}=Zt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Oe,error:at}=await Y.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),{data:oe,isLoading:pe}=Zt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Oe,error:at}=await Y.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),ne=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),u(null),x(""),v([]),N([]),M([]),a(null),U("")},fe=Oe=>{a(Oe),l({title:Oe.title,description:Oe.description||"",publish_date:Oe.publish_date.split("T")[0],is_published:Oe.is_published,category_id:Oe.category_id||""}),x(Oe.preview_image_url||""),U("");const at=(G==null?void 0:G.filter(Je=>Je.resource_id===Oe.id))||[];v(at.map(Je=>({id:Je.id,name:Je.name,file_url:Je.file_url,file_size:Je.file_size,sort_order:Je.sort_order})));const le=(ee==null?void 0:ee.filter(Je=>Je.resource_id===Oe.id))||[];N(le.map(Je=>({id:Je.id,title:Je.title,video_url:Je.video_url,sort_order:Je.sort_order})));const qe=(ae==null?void 0:ae.filter(Je=>Je.resource_id===Oe.id))||[];M(qe.map(Je=>({id:Je.id,title:Je.title,canva_share_link:Je.canva_share_link,sort_order:Je.sort_order}))),n(!0)},se=Oe=>{var le;const at=(le=Oe.target.files)==null?void 0:le[0];at&&(u(at),x(URL.createObjectURL(at)))},me=()=>{v([...y,{name:"",file_url:"",sort_order:y.length}])},ue=Oe=>{v(y.filter((at,le)=>le!==Oe))},xe=(Oe,at,le)=>{const qe=[...y];if(at==="file"&&le instanceof File){const Je=le.name.replace(/\.[^/.]+$/,"");qe[Oe]={...qe[Oe],file:le,file_size:le.size,name:qe[Oe].name||Je}}else qe[Oe]={...qe[Oe],[at]:le};v(qe)},Te=()=>{N([...b,{title:"",video_url:"",sort_order:b.length}])},_e=Oe=>{N(b.filter((at,le)=>le!==Oe))},we=(Oe,at,le)=>{const qe=[...b];at==="file"&&le instanceof File?qe[Oe]={...qe[Oe],file:le}:qe[Oe]={...qe[Oe],[at]:le},N(qe)},ve=()=>{M([...k,{title:"",canva_share_link:"",sort_order:k.length}])},Xe=Oe=>{M(k.filter((at,le)=>le!==Oe))},Me=(Oe,at,le)=>{const qe=[...k];qe[Oe]={...qe[Oe],[at]:le},M(qe)},Ie=async(Oe,at)=>{try{const le=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:Oe.name}});if(le.error)throw le.error;const{videoId:qe,uploadUrl:Je,libraryId:st}=le.data,je=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:qe,libraryId:st}});if(je.error)throw je.error;const{uploadUrl:ut,apiKey:Ce}=je.data,Ee=new XMLHttpRequest;return Ee.open("PUT",ut,!0),Ee.setRequestHeader("AccessKey",Ce),Ee.upload.onprogress=Ze=>{if(Ze.lengthComputable){const Le=Math.round(Ze.loaded/Ze.total*100),Ke=[...b];Ke[at]={...Ke[at],uploadProgress:Le},N(Ke)}},await new Promise((Ze,Le)=>{Ee.onload=()=>Ee.status>=200&&Ee.status<300?Ze():Le(new Error("Upload failed")),Ee.onerror=()=>Le(new Error("Upload failed")),Ee.send(Oe)}),`https://iframe.mediadelivery.net/embed/${st}/${qe}`}catch(le){throw console.error("Bunny upload error:",le),le}},$e=ar({mutationFn:async Oe=>{const{data:at,error:le}=await Y.from("brokerage_resource_categories").insert({name:Oe,sort_order:(oe==null?void 0:oe.length)||0}).select().single();if(le)throw le;return at},onSuccess:Oe=>{e.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Oe.id}),U(""),Ae.success("Category created")},onError:Oe=>{Ae.error("Failed to create category: "+Oe.message)}}),Be=ar({mutationFn:async()=>{T(!0);let Oe=(s==null?void 0:s.preview_image_url)||null;if(i){const qe=i.name.split(".").pop(),Je=`${Date.now()}.${qe}`,{error:st}=await Y.storage.from("brokerage-resources").upload(`previews/${Je}`,i);if(st)throw st;const{data:je}=Y.storage.from("brokerage-resources").getPublicUrl(`previews/${Je}`);Oe=je.publicUrl}const at={title:o.title,description:o.description||null,preview_image_url:Oe,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let le;if(s){const{error:qe}=await Y.from("brokerage_resources").update(at).eq("id",s.id);if(qe)throw qe;le=s.id;const Je=(G==null?void 0:G.filter(tt=>tt.resource_id===s.id).map(tt=>tt.id))||[],st=y.filter(tt=>tt.id).map(tt=>tt.id),je=Je.filter(tt=>!st.includes(tt));je.length>0&&await Y.from("brokerage_resource_pdfs").delete().in("id",je);const ut=(ee==null?void 0:ee.filter(tt=>tt.resource_id===s.id).map(tt=>tt.id))||[],Ce=b.filter(tt=>tt.id).map(tt=>tt.id),Ee=ut.filter(tt=>!Ce.includes(tt));Ee.length>0&&await Y.from("brokerage_resource_videos").delete().in("id",Ee);const Ze=(ae==null?void 0:ae.filter(tt=>tt.resource_id===s.id).map(tt=>tt.id))||[],Le=k.filter(tt=>tt.id).map(tt=>tt.id),Ke=Ze.filter(tt=>!Le.includes(tt));Ke.length>0&&await Y.from("brokerage_resource_links").delete().in("id",Ke)}else{const{data:qe,error:Je}=await Y.from("brokerage_resources").insert(at).select().single();if(Je)throw Je;le=qe.id}for(let qe=0;qe{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),Ae.success(s?"Resource updated":"Resource created"),n(!1),ne(),T(!1)},onError:Oe=>{Ae.error("Failed to save resource: "+Oe.message),T(!1)}}),Ve=ar({mutationFn:async Oe=>{const{error:at}=await Y.from("brokerage_resources").delete().eq("id",Oe);if(at)throw at},onSuccess:()=>{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),Ae.success("Resource deleted")},onError:Oe=>{Ae.error("Failed to delete: "+Oe.message)}}),ot=Oe=>{if(Oe.preventDefault(),!o.title){Ae.error("Please enter a title");return}Be.mutate()},Tt=Oe=>{const at=(G==null?void 0:G.filter(Je=>Je.resource_id===Oe).length)||0,le=(ee==null?void 0:ee.filter(Je=>Je.resource_id===Oe).length)||0,qe=(ae==null?void 0:ae.filter(Je=>Je.resource_id===Oe).length)||0;return{pdfCount:at,videoCount:le,linkCount:qe}};return r.jsx(Fr,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.length)||0})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.filter(Oe=>Oe.is_published).length)||0})})]})]}),r.jsxs(Q,{onClick:()=>{ne(),n(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Content"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:W?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(V==null?void 0:V.length)===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):V==null?void 0:V.map(Oe=>{const{pdfCount:at,videoCount:le,linkCount:qe}=Tt(Oe.id),Je=oe==null?void 0:oe.find(st=>st.id===Oe.category_id);return r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Oe.preview_image_url?r.jsx("img",{src:Oe.preview_image_url,alt:Oe.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(Oh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Oe.title}),Oe.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Oe.description})]})]})}),r.jsx(yt,{children:Je?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:Je.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{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(_a,{className:"h-3.5 w-3.5"}),at]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ia,{className:"h-3.5 w-3.5"}),le]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Oo,{className:"h-3.5 w-3.5"}),qe]})]})}),r.jsx(yt,{children:on(new Date(Oe.publish_date),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Oe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Oe.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{const st=(G==null?void 0:G.filter(Ce=>Ce.resource_id===Oe.id))||[],je=(ee==null?void 0:ee.filter(Ce=>Ce.resource_id===Oe.id))||[],ut=(ae==null?void 0:ae.filter(Ce=>Ce.resource_id===Oe.id))||[];F({...Oe,pdfs:st,videos:je,links:ut})},children:r.jsx(_o,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>fe(Oe),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Ve.mutate(Oe.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},Oe.id)})})]})})}),r.jsx(Rr,{open:t,onOpenChange:n,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:ot,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[m?r.jsx("img",{src:m,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(Oh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(lt,{type:"file",accept:"image/*",onChange:se})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(lt,{id:"title",value:o.title,onChange:Oe=>l({...o,title:Oe.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(qg,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(un,{value:o.category_id,onValueChange:Oe=>l({...o,category_id:Oe}),children:[r.jsx(ln,{className:"flex-1",children:r.jsx(mn,{placeholder:"Select a category"})}),r.jsx(cn,{children:oe==null?void 0:oe.map(Oe=>r.jsx($t,{value:Oe.id,children:Oe.name},Oe.id))})]}),o.category_id&&r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(ds,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{placeholder:"Or create new category...",value:D,onChange:Oe=>U(Oe.target.value),className:"flex-1"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",disabled:!D.trim()||$e.isPending,onClick:()=>$e.mutate(D.trim()),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:o.description,onChange:Oe=>l({...o,description:Oe}),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(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(lt,{id:"publish_date",type:"date",value:o.publish_date,onChange:Oe=>l({...o,publish_date:Oe.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(As,{checked:o.is_published,onCheckedChange:Oe=>l({...o,is_published:Oe})}),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(ze,{className:"flex items-center gap-2",children:[r.jsx(_a,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:me,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Oe,at)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(lt,{placeholder:"PDF Name",value:Oe.name,onChange:le=>xe(at,"name",le.target.value),className:"flex-1"}),r.jsx(lt,{type:"file",accept:".pdf",onChange:le=>{var Je;const qe=(Je=le.target.files)==null?void 0:Je[0];qe&&xe(at,"file",qe)},className:"flex-1"}),Oe.file_url&&!Oe.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>ue(at),children:r.jsx(ds,{className:"h-4 w-4"})})]},at))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(Ia,{className:"h-4 w-4"}),"Videos (",b.length,")"]}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:Te,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),b.map((Oe,at)=>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(lt,{placeholder:"Video Title",value:Oe.title,onChange:le=>we(at,"title",le.target.value),className:"flex-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>_e(at),children:r.jsx(ds,{className:"h-4 w-4"})})]}),r.jsx(lt,{type:"file",accept:"video/*",onChange:le=>{var Je;const qe=(Je=le.target.files)==null?void 0:Je[0];qe&&we(at,"file",qe)}}),Oe.uploadProgress!==void 0&&Oe.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:`${Oe.uploadProgress}%`}})}),Oe.video_url&&!Oe.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},at))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Canva Links (",k.length,")"]}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),k.map((Oe,at)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(lt,{placeholder:"Link Title",value:Oe.title,onChange:le=>Me(at,"title",le.target.value),className:"flex-1"}),r.jsx(lt,{placeholder:"Canva Share Link",value:Oe.canva_share_link,onChange:le=>Me(at,"canva_share_link",le.target.value),className:"flex-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>Xe(at),children:r.jsx(ds,{className:"h-4 w-4"})})]},at))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:Be.isPending||I,children:Be.isPending||I?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Rr,{open:!!P,onOpenChange:()=>F(null),children:r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:P==null?void 0:P.title})}),P&&r.jsxs("div",{className:"space-y-4",children:[P.preview_image_url&&r.jsx("img",{src:P.preview_image_url,alt:P.title,className:"w-full h-48 object-cover rounded-lg"}),P.description&&r.jsx("p",{className:"text-muted-foreground",children:P.description}),P.pdfs&&P.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(_a,{className:"h-4 w-4"}),"PDF Documents (",P.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.pdfs.map(Oe=>r.jsx("a",{href:Oe.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Oe.name},Oe.id))})]}),P.videos&&P.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ia,{className:"h-4 w-4"}),"Videos (",P.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:P.videos.map(Oe=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Oe.title})},Oe.id))})]}),P.links&&P.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Canva Links (",P.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:P.links.map(Oe=>r.jsx("a",{href:Oe.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Oe.title},Oe.id))})]})]})]})})]})})}const gBe=[{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 xCt(){const[e,t]=A.useState([]),[n,s]=A.useState(!0),[a,o]=A.useState(!1),[l,i]=A.useState(!1),[u,m]=A.useState(null),[x,y]=A.useState(!1),[v,b]=A.useState(!1),[N,k]=A.useState(""),[M,I]=A.useState(""),[T,P]=A.useState(""),[F,D]=A.useState(""),[U,V]=A.useState("Learn More"),[W,G]=A.useState("top"),[ee,ae]=A.useState(""),[oe,pe]=A.useState(!0),[ne,fe]=A.useState(""),[se,me]=A.useState("");A.useEffect(()=>{ue()},[]);const ue=async()=>{try{const{data:$e,error:Be}=await Y.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Be)throw Be;t($e||[])}catch($e){Ae.error("Failed to load banners: "+$e.message)}finally{s(!1)}},xe=()=>{k(""),I(""),P(""),D(""),V("Learn More"),G("top"),ae(""),pe(!0),fe(""),me(""),m(null)},Te=$e=>{m($e),k($e.title),I($e.description||""),P($e.image_url),D($e.link_url||""),V($e.link_text||"Learn More"),G($e.placement),ae($e.section_after||""),pe($e.is_active),fe($e.start_date?on(new Date($e.start_date),"yyyy-MM-dd'T'HH:mm"):""),me($e.end_date?on(new Date($e.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},_e=async $e=>{var Ve;const Be=(Ve=$e.target.files)==null?void 0:Ve[0];if(Be){y(!0);try{const ot=Be.name.split(".").pop(),Tt=`${Date.now()}.${ot}`,{error:Oe}=await Y.storage.from("banner-images").upload(Tt,Be);if(Oe)throw Oe;const{data:{publicUrl:at}}=Y.storage.from("banner-images").getPublicUrl(Tt);P(at),Ae.success("Image uploaded successfully")}catch(ot){Ae.error("Failed to upload image: "+ot.message)}finally{y(!1)}}},we=async()=>{if(!N.trim()||!T){Ae.error("Please fill in required fields (title and image)");return}b(!0);try{const $e={title:N.trim(),description:M.trim()||null,image_url:T,link_url:F.trim()||null,link_text:U.trim()||"Learn More",placement:W,section_after:W==="between"?ee:null,is_active:oe,start_date:ne?new Date(ne).toISOString():null,end_date:se?new Date(se).toISOString():null};if(u){const{error:Be}=await Y.from("dashboard_banners").update($e).eq("id",u.id);if(Be)throw Be;Ae.success("Banner updated successfully")}else{const Be=e.filter(ot=>ot.placement===W).length,{error:Ve}=await Y.from("dashboard_banners").insert({...$e,sort_order:Be});if(Ve)throw Ve;Ae.success("Banner created successfully")}o(!1),xe(),ue()}catch($e){Ae.error("Failed to save banner: "+$e.message)}finally{b(!1)}},ve=async()=>{if(u)try{const{error:$e}=await Y.from("dashboard_banners").delete().eq("id",u.id);if($e)throw $e;Ae.success("Banner deleted successfully"),i(!1),m(null),ue()}catch($e){Ae.error("Failed to delete banner: "+$e.message)}},Xe=async $e=>{try{const{error:Be}=await Y.from("dashboard_banners").update({is_active:!$e.is_active}).eq("id",$e.id);if(Be)throw Be;Ae.success($e.is_active?"Banner deactivated":"Banner activated"),ue()}catch(Be){Ae.error("Failed to update banner: "+Be.message)}},Me=e.filter($e=>$e.placement==="top"),Ie=e.filter($e=>$e.placement==="between");return n?r.jsx(Fr,{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(Fr,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(jn,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Rr,{open:a&&W==="top",onOpenChange:$e=>{$e||xe(),o($e),$e&&G("top")},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{onClick:()=>{xe(),G("top")},children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Br,{children:[u?"Edit":"Create"," Banner"]}),r.jsx(Yn,{children:"Configure the banner's content and display settings"})]}),r.jsx(cCe,{title:N,setTitle:k,description:M,setDescription:I,imageUrl:T,linkUrl:F,setLinkUrl:D,linkText:U,setLinkText:V,placement:W,setPlacement:G,sectionAfter:ee,setSectionAfter:ae,isActive:oe,setIsActive:pe,startDate:ne,setStartDate:fe,endDate:se,setEndDate:me,handleImageUpload:_e,uploading:x,showPlacementOptions:!1}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),r.jsx(Q,{onClick:we,disabled:v,children:v?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:Me.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:Me.map($e=>r.jsx(dCe,{banner:$e,onEdit:()=>Te($e),onDelete:()=>{m($e),i(!0)},onToggleActive:()=>Xe($e)},$e.id))})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(jn,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Rr,{open:a&&W==="between",onOpenChange:$e=>{$e||xe(),o($e),$e&&G("between")},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{onClick:()=>{xe(),G("between")},children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Br,{children:[u?"Edit":"Create"," Section Banner"]}),r.jsx(Yn,{children:"Configure where this banner appears between sections"})]}),r.jsx(cCe,{title:N,setTitle:k,description:M,setDescription:I,imageUrl:T,linkUrl:F,setLinkUrl:D,linkText:U,setLinkText:V,placement:W,setPlacement:G,sectionAfter:ee,setSectionAfter:ae,isActive:oe,setIsActive:pe,startDate:ne,setStartDate:fe,endDate:se,setEndDate:me,handleImageUpload:_e,uploading:x,showPlacementOptions:!0}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>{o(!1),xe()},children:"Cancel"}),r.jsx(Q,{onClick:we,disabled:v,children:v?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:Ie.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:Ie.map($e=>r.jsx(dCe,{banner:$e,onEdit:()=>Te($e),onDelete:()=>{m($e),i(!0)},onToggleActive:()=>Xe($e),showSection:!0},$e.id))})})]})]}),r.jsx(Rr,{open:l,onOpenChange:i,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Delete Banner"}),r.jsxs(Yn,{children:['Are you sure you want to delete "',u==null?void 0:u.title,'"? This action cannot be undone.']})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(Q,{variant:"destructive",onClick:ve,children:"Delete"})]})]})})]})}function cCe({title:e,setTitle:t,description:n,setDescription:s,imageUrl:a,linkUrl:o,setLinkUrl:l,linkText:i,setLinkText:u,placement:m,setPlacement:x,sectionAfter:y,setSectionAfter:v,isActive:b,setIsActive:N,startDate:k,setStartDate:M,endDate:I,setEndDate:T,handleImageUpload:P,uploading:F,showPlacementOptions:D}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title *"}),r.jsx(lt,{id:"title",placeholder:"Banner headline...",value:e,onChange:U=>t(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",placeholder:"Optional banner description...",value:n,onChange:U=>s(U.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(lt,{type:"file",accept:"image/*",onChange:P,disabled:F,className:"flex-1"}),F&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),a&&r.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:r.jsx("img",{src:a,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(ze,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(lt,{id:"linkUrl",placeholder:"https://...",value:o,onChange:U=>l(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"linkText",children:"Button Text"}),r.jsx(lt,{id:"linkText",placeholder:"Learn More",value:i,onChange:U=>u(U.target.value)})]})]}),D&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Placement"}),r.jsxs(un,{value:y,onValueChange:v,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select section placement..."})}),r.jsx(cn,{children:gBe.map(U=>r.jsx($t,{value:U.value,children:U.label},U.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(Cs,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(lt,{id:"startDate",type:"datetime-local",value:k,onChange:U=>M(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(Cs,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(lt,{id:"endDate",type:"datetime-local",value:I,onChange:U=>T(U.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(As,{id:"isActive",checked:b,onCheckedChange:N}),r.jsx(ze,{htmlFor:"isActive",children:"Active"})]})})]})}function dCe({banner:e,onEdit:t,onDelete:n,onToggleActive:s,showSection:a=!1}){var l;const o=(l=gBe.find(i=>i.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(zg,{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(At,{variant:"secondary",children:"Inactive"}),e.start_date&&new Date(e.start_date)>new Date&&r.jsx(At,{variant:"outline",children:"Scheduled"})]}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:e.description}),a&&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(Q,{variant:"ghost",size:"icon",children:r.jsx(Ss,{className:"h-4 w-4"})})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:s,children:e.is_active?r.jsx(_o,{className:"h-4 w-4"}):r.jsx(Fg,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:t,children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})]})}const CO={open:{label:"Open",icon:Xa,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ul,color:"bg-blue-500"},resolved:{label:"Resolved",icon:oi,color:"bg-green-500"},closed:{label:"Closed",icon:bc,color:"bg-muted-foreground"}},uCe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function yCt(){var U,V;const{user:e}=tn(),t=Vr(),[n,s]=A.useState(null),[a,o]=A.useState(""),[l,i]=A.useState("all"),[u,m]=A.useState("all"),[x,y]=A.useState(!1),{data:v=[],isLoading:b}=Zt({queryKey:["admin-support-tickets",l,u],queryFn:async()=>{let W=Y.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(W=W.eq("status",l)),u!=="all"&&(W=W.eq("category",u));const{data:G,error:ee}=await W;if(ee)throw ee;return G}}),{data:N=[]}=Zt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:W,error:G}=await Y.from("user_roles").select("user_id").eq("role","admin");if(G)throw G;const ee=W.map(se=>se.user_id),{data:ae,error:oe}=await Y.from("profiles").select("id, name, email").in("id",ee);if(oe)throw oe;const{data:pe,error:ne}=await Y.from("support_notification_settings").select("user_id, receive_notifications");if(ne)throw ne;const fe=new Map((pe==null?void 0:pe.map(se=>[se.user_id,se.receive_notifications]))||[]);return ae.map(se=>({...se,receives_notifications:fe.get(se.id)||!1}))}}),{data:k=[]}=Zt({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:W,error:G}=await Y.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(G)throw G;return W},enabled:!!n}),M=ar({mutationFn:async({userId:W,enabled:G})=>{const{data:ee}=await Y.from("support_notification_settings").select("id").eq("user_id",W).maybeSingle();if(ee){const{error:ae}=await Y.from("support_notification_settings").update({receive_notifications:G}).eq("user_id",W);if(ae)throw ae}else{const{error:ae}=await Y.from("support_notification_settings").insert({user_id:W,receive_notifications:G});if(ae)throw ae}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-users-notifications"]}),Ae.success("Notification settings updated")},onError:()=>{Ae.error("Failed to update settings")}}),I=ar({mutationFn:async({ticketId:W,status:G})=>{const{error:ee}=await Y.from("support_tickets").update({status:G}).eq("id",W);if(ee)throw ee},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),Ae.success("Status updated")},onError:()=>{Ae.error("Failed to update status")}}),T=ar({mutationFn:async({ticketId:W,assignedTo:G})=>{const{error:ee}=await Y.from("support_tickets").update({assigned_to:G}).eq("id",W);if(ee)throw ee},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),Ae.success("Ticket assigned")},onError:()=>{Ae.error("Failed to assign ticket")}}),P=ar({mutationFn:async W=>{var ee,ae;if(!n||!e)throw new Error("Missing data");const{error:G}=await Y.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:W,is_admin_reply:!0});if(G)throw G;try{await Y.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:W,userEmail:(ee=n.profiles)==null?void 0:ee.email,userName:(ae=n.profiles)==null?void 0:ae.name}})}catch(oe){console.error("Failed to send reply notification:",oe)}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),Ae.success("Reply sent!")},onError:()=>{Ae.error("Failed to send reply")}}),F=()=>{a.trim()&&P.mutate(a)};A.useEffect(()=>{const W=Y.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{Y.removeChannel(W)}},[t]);const D=v.filter(W=>W.status==="open").length;return n?(CO[n.status].icon,r.jsx(Fr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(Wi,{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(At,{variant:"secondary",children:uCe[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((U=n.profiles)==null?void 0:U.name)||"Unknown"," (",(V=n.profiles)==null?void 0:V.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm",children:"Status"})}),r.jsx(et,{children:r.jsxs(un,{value:n.status,onValueChange:W=>{I.mutate({ticketId:n.id,status:W}),s({...n,status:W})},children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"open",children:"Open"}),r.jsx($t,{value:"in_progress",children:"In Progress"}),r.jsx($t,{value:"resolved",children:"Resolved"}),r.jsx($t,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm",children:"Assigned To"})}),r.jsx(et,{children:r.jsxs(un,{value:n.assigned_to||"unassigned",onValueChange:W=>{const G=W==="unassigned"?null:W;T.mutate({ticketId:n.id,assignedTo:G}),s({...n,assigned_to:G})},children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Unassigned"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"unassigned",children:"Unassigned"}),N.map(W=>r.jsx($t,{value:W.id,children:W.name},W.id))]})]})})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(jn,{children:["Created on ",on(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(Vo,{className:"h-[300px] pr-4",children:k.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:k.map(W=>{var G,ee;return r.jsxs("div",{className:`p-4 rounded-lg ${W.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:W.is_admin_reply?`${((G=W.profiles)==null?void 0:G.name)||"Admin"} (Support)`:((ee=W.profiles)==null?void 0:ee.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(W.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content})]},W.id)})})}),r.jsx(Od,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Zn,{placeholder:"Type your reply...",value:a,onChange:W=>o(W.target.value),className:"min-h-[80px]"}),r.jsx(Q,{onClick:F,disabled:!a.trim()||P.isPending,className:"self-end",children:r.jsx(Ji,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Fr,{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",D>0&&r.jsxs(At,{variant:"destructive",className:"ml-2",children:[D," open"]})]})]}),r.jsxs(Rr,{open:x,onOpenChange:y,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{variant:"outline",children:[r.jsx(zd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Email Notification Settings"}),r.jsx(Yn,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:N.map(W=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:W.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:W.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[W.receives_notifications?r.jsx(Dg,{className:"h-4 w-4 text-primary"}):r.jsx(Mj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(As,{checked:W.receives_notifications,onCheckedChange:G=>M.mutate({userId:W.id,enabled:G})})]})]},W.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(wi,{value:l,onValueChange:i,className:"w-auto",children:r.jsxs(_i,{children:[r.jsx(sn,{value:"all",children:"All"}),r.jsx(sn,{value:"open",children:"Open"}),r.jsx(sn,{value:"in_progress",children:"In Progress"}),r.jsx(sn,{value:"resolved",children:"Resolved"}),r.jsx(sn,{value:"closed",children:"Closed"})]})}),r.jsxs(un,{value:u,onValueChange:m,children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{placeholder:"All Categories"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Categories"}),r.jsx($t,{value:"general",children:"General Support"}),r.jsx($t,{value:"technology",children:"Technology Support"}),r.jsx($t,{value:"crm",children:"CRM Support"}),r.jsx($t,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:b?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):v.length===0?r.jsx(He,{children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Ul,{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:v.map(W=>{var ee,ae;const G=CO[W.status].icon;return r.jsx(He,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(W),children:r.jsx(et,{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:W.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(At,{variant:"outline",className:"text-xs",children:uCe[W.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(ee=W.profiles)==null?void 0:ee.name," • ",on(new Date(W.created_at),"MMM d, yyyy")]}),W.assigned_to&&r.jsxs(At,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(ic,{className:"h-3 w-3"}),((ae=N.find(oe=>oe.id===W.assigned_to))==null?void 0:ae.name)||"Assigned"]})]})]}),r.jsxs(At,{className:CO[W.status].color,children:[r.jsx(G,{className:"h-3 w-3 mr-1"}),CO[W.status].label]})]})})},W.id)})})})]})]})})}const vCt=ou.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 _Ct({content:e,onChange:t,variables:n}){const s=i7e({extensions:[h7e,w7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),j7e.configure({types:["heading","paragraph"]}),k7e,vCt],content:e,onUpdate:({editor:l})=>{t(l.getHTML())}});A.useEffect(()=>{s&&e!==s.getHTML()&&s.commands.setContent(e)},[e,s]);const a=l=>{s&&s.chain().focus().insertContent(`{{${l.key}}}`).run()},o=()=>{if(!s)return;const l=s.getAttributes("link").href,i=window.prompt("URL",l);if(i!==null){if(i===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:i}).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(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(b4,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(S4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(mf,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(T4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(v4,{className:"h-4 w-4"})}),r.jsx(Q,{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(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(_4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(Oo,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(Ej,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(R4,{className:"h-4 w-4"})}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(L4,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(EA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(Nu,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(Va,{onClick:()=>a(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(s7e,{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(At,{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 bCt(){const e=Vr(),[t,n]=A.useState(null),[s,a]=A.useState(null),[o,l]=A.useState(""),[i,u]=A.useState(""),[m,x]=A.useState(""),[y,v]=A.useState(!0),[b,N]=A.useState("visual"),{data:k,isLoading:M}=Zt({queryKey:["email-templates"],queryFn:async()=>{const{data:D,error:U}=await Y.from("email_templates").select("*").order("name");if(U)throw U;return D.map(V=>({...V,available_variables:V.available_variables||[]}))}}),I=ar({mutationFn:async D=>{const{error:U}=await Y.from("email_templates").update({subject:D.subject,body_html:D.body_html,description:D.description,is_active:D.is_active}).eq("id",D.id);if(U)throw U},onSuccess:()=>{e.invalidateQueries({queryKey:["email-templates"]}),Ae.success("Email template updated successfully"),n(null)},onError:D=>{Ae.error("Failed to update template: "+D.message)}}),T=D=>{n(D),l(D.subject),u(D.body_html),x(D.description||""),v(D.is_active),N("visual")},P=()=>{t&&I.mutate({id:t.id,subject:o,body_html:i,description:m,is_active:y})},F=(D,U)=>{let V=D;return U.forEach(W=>{const G=`{{${W.key}}}`,ee=`[${W.label}]`;V=V.replace(new RegExp(G.replace(/[{}]/g,"\\$&"),"g"),ee)}),V};return t?r.jsxs(Fr,{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(Q,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(Q,{variant:"outline",onClick:()=>a(t),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(Q,{onClick:P,disabled:I.isPending,children:[r.jsx(Ip,{className:"h-4 w-4 mr-2"}),I.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5"}),t.name]}),r.jsxs(jn,{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(ze,{htmlFor:"active-toggle",children:"Active"}),r.jsx(As,{id:"active-toggle",checked:y,onCheckedChange:v})]})]})}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",value:m,onChange:D=>x(D.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"subject",children:"Email Subject"}),r.jsx(lt,{id:"subject",value:o,onChange:D=>l(D.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(ze,{children:"Email Body"}),r.jsx(wi,{value:b,onValueChange:D=>N(D),children:r.jsxs(_i,{className:"h-8",children:[r.jsxs(sn,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(Bj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(sn,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(Ej,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),b==="visual"?r.jsx(_Ct,{content:i,onChange:u,variables:t.available_variables}):r.jsx(Zn,{value:i,onChange:D=>u(D.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Rr,{open:!!s,onOpenChange:()=>a(null),children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Email Preview"}),r.jsxs(Yn,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:F(i,t.available_variables)}})})]})})]}):r.jsx(Fr,{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"})]}),M?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((D,U)=>r.jsx(He,{children:r.jsxs(Ht,{children:[r.jsx(Er,{className:"h-5 w-48"}),r.jsx(Er,{className:"h-4 w-96"})]})},U))}):r.jsx("div",{className:"grid gap-4",children:k==null?void 0:k.map(D=>r.jsxs(He,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Gt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(ws,{className:"h-5 w-5 text-muted-foreground"}),D.name,!D.is_active&&r.jsx(At,{variant:"secondary",children:"Inactive"})]}),r.jsx(jn,{children:D.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>a(D),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(Q,{size:"sm",onClick:()=>T(D),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(et,{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:D.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:D.available_variables.map(U=>r.jsx(At,{variant:"outline",className:"font-mono text-xs",children:`{{${U.key}}}`},U.key))})]})]})})]},D.id))}),r.jsx(Rr,{open:!!s&&!t,onOpenChange:()=>a(null),children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs($r,{children:[r.jsxs(Br,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(Yn,{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:F(s.body_html,s.available_variables)}})})]})})]})})}function wCt(){const e=Vr(),[t,n]=A.useState("templates"),[s,a]=A.useState(null),[o,l]=A.useState(null),[i,u]=A.useState(!1),[m,x]=A.useState(!1),[y,v]=A.useState({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),[b,N]=A.useState({name:"",description:"",icon:"📧"}),{data:k=[]}=Zt({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:ee,error:ae}=await Y.from("email_template_categories").select("*").order("sort_order");if(ae)throw ae;return ee}}),{data:M=[],isLoading:I}=Zt({queryKey:["agent-email-templates-admin"],queryFn:async()=>{const{data:ee,error:ae}=await Y.from("agent_email_templates").select("*, category:email_template_categories(*)").order("sort_order");if(ae)throw ae;return ee}}),T=ar({mutationFn:async ee=>{const ae={title:ee.title,subject:ee.subject,body:ee.body,description:ee.description||null,tone:ee.tone||null,category_id:ee.category_id||null,is_active:ee.is_active};if(ee.id){const{error:oe}=await Y.from("agent_email_templates").update(ae).eq("id",ee.id);if(oe)throw oe}else{const{error:oe}=await Y.from("agent_email_templates").insert(ae);if(oe)throw oe}},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-templates-admin"]}),u(!1),Ae.success(s?"Template updated":"Template created")},onError:()=>Ae.error("Failed to save template")}),P=ar({mutationFn:async ee=>{const{error:ae}=await Y.from("agent_email_templates").delete().eq("id",ee);if(ae)throw ae},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-templates-admin"]}),Ae.success("Template deleted")}}),F=ar({mutationFn:async ee=>{const ae={name:ee.name,description:ee.description||null,icon:ee.icon};if(ee.id){const{error:oe}=await Y.from("email_template_categories").update(ae).eq("id",ee.id);if(oe)throw oe}else{const oe=k.length>0?Math.max(...k.map(ne=>ne.sort_order))+1:0,{error:pe}=await Y.from("email_template_categories").insert({...ae,sort_order:oe});if(pe)throw pe}},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-template-categories"]}),x(!1),Ae.success(o?"Category updated":"Category created")},onError:()=>Ae.error("Failed to save category")}),D=ar({mutationFn:async ee=>{const{error:ae}=await Y.from("email_template_categories").delete().eq("id",ee);if(ae)throw ae},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-template-categories"]}),Ae.success("Category deleted")}}),U=()=>{a(null),v({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),u(!0)},V=ee=>{a(ee),v({title:ee.title,subject:ee.subject,body:ee.body,description:ee.description||"",tone:ee.tone||"",category_id:ee.category_id||"",is_active:ee.is_active}),u(!0)},W=()=>{l(null),N({name:"",description:"",icon:"📧"}),x(!0)},G=ee=>{l(ee),N({name:ee.name,description:ee.description||"",icon:ee.icon}),x(!0)};return r.jsx(Fr,{children:r.jsxs("div",{className:"space-y-6 animate-fade-in",children:[r.jsx(Tu,{title:"Agent Email Templates",description:"Manage email templates that agents use when composing emails from Mission Control."}),r.jsxs(wi,{value:t,onValueChange:n,children:[r.jsxs(_i,{children:[r.jsxs(sn,{value:"templates",className:"gap-2",children:[r.jsx(ws,{className:"h-4 w-4"})," Templates"]}),r.jsxs(sn,{value:"categories",className:"gap-2",children:[r.jsx(Ap,{className:"h-4 w-4"})," Categories"]})]}),r.jsxs(Sn,{value:"templates",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(Q,{onClick:U,className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"})," Add Template"]})}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Template"}),r.jsx(Mt,{className:"hidden md:table-cell",children:"Category"}),r.jsx(Mt,{className:"hidden md:table-cell",children:"Tone"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:I?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin mx-auto"})})}):M.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No templates yet. Create your first one!"})}):M.map(ee=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:ee.title}),r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:ee.subject})]})}),r.jsx(yt,{className:"hidden md:table-cell",children:ee.category?r.jsxs(At,{variant:"outline",className:"gap-1",children:[ee.category.icon," ",ee.category.name]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{className:"hidden md:table-cell",children:ee.tone?r.jsx(At,{variant:"secondary",children:ee.tone}):"—"}),r.jsx(yt,{children:r.jsx(At,{variant:ee.is_active?"default":"secondary",children:ee.is_active?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>V(ee),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&P.mutate(ee.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},ee.id))})]})})})]}),r.jsxs(Sn,{value:"categories",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(Q,{onClick:W,className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"})," Add Category"]})}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:k.map(ee=>r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx("span",{className:"text-lg",children:ee.icon})," ",ee.name]}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>G(ee),children:r.jsx(Qa,{className:"h-3.5 w-3.5"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete this category?")&&D.mutate(ee.id)},children:r.jsx(Bn,{className:"h-3.5 w-3.5"})})]})]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:ee.description||"No description"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[M.filter(ae=>ae.category_id===ee.id).length," templates"]})]})]},ee.id))})]})]}),r.jsx(Rr,{open:i,onOpenChange:u,children:r.jsxs(Dr,{className:"sm:max-w-[700px] max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:s?"Edit Template":"New Template"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Title"}),r.jsx(lt,{value:y.title,onChange:ee=>v(ae=>({...ae,title:ee.target.value})),placeholder:"e.g. Quick Check-in"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Category"}),r.jsxs(un,{value:y.category_id,onValueChange:ee=>v(ae=>({...ae,category_id:ee})),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select category"})}),r.jsx(cn,{children:k.map(ee=>r.jsxs($t,{value:ee.id,children:[ee.icon," ",ee.name]},ee.id))})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Subject Line"}),r.jsx(lt,{value:y.subject,onChange:ee=>v(ae=>({...ae,subject:ee.target.value})),placeholder:"e.g. Hey {{first_name}}, just checking in!"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ","{{first_name}}",", ","{{last_name}}",", ","{{full_name}}"," for merge variables"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Email Body"}),r.jsx(Zn,{value:y.body,onChange:ee=>v(ae=>({...ae,body:ee.target.value})),rows:12,placeholder:"Write your email template...",className:"resize-y"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Description (internal)"}),r.jsx(lt,{value:y.description,onChange:ee=>v(ae=>({...ae,description:ee.target.value})),placeholder:"Short description for admin reference"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Tone"}),r.jsx(lt,{value:y.tone,onChange:ee=>v(ae=>({...ae,tone:ee.target.value})),placeholder:"e.g. Warm & Casual"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{checked:y.is_active,onCheckedChange:ee=>v(ae=>({...ae,is_active:ee}))}),r.jsx(ze,{children:"Active"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(Q,{onClick:()=>T.mutate({...y,id:s==null?void 0:s.id}),disabled:T.isPending||!y.title||!y.subject||!y.body,children:[T.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),s?"Save Changes":"Create Template"]})]})]})}),r.jsx(Rr,{open:m,onOpenChange:x,children:r.jsxs(Dr,{className:"sm:max-w-[450px]",children:[r.jsx($r,{children:r.jsx(Br,{children:o?"Edit Category":"New Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-[60px_1fr] gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Icon"}),r.jsx(lt,{value:b.icon,onChange:ee=>N(ae=>({...ae,icon:ee.target.value})),className:"text-center text-lg"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Name"}),r.jsx(lt,{value:b.name,onChange:ee=>N(ae=>({...ae,name:ee.target.value})),placeholder:"e.g. Check-in & Stay in Touch"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Description"}),r.jsx(lt,{value:b.description,onChange:ee=>N(ae=>({...ae,description:ee.target.value})),placeholder:"Brief description of this category"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),r.jsxs(Q,{onClick:()=>F.mutate({...b,id:o==null?void 0:o.id}),disabled:F.isPending||!b.name,children:[F.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),o?"Save Changes":"Create Category"]})]})]})})]})})}const jCt=({brokerageId:e})=>{var go,uc;const{toast:t}=fi(),[n,s]=A.useState([]),[a,o]=A.useState(!0),[l,i]=A.useState(""),[u,m]=A.useState("all"),[x,y]=A.useState(new Set),[v,b]=A.useState(!1),[N,k]=A.useState({}),[M,I]=A.useState(!1),[T,P]=A.useState(!1),[F,D]=A.useState({email:"",name:"",password:"",phone:""}),[U,V]=A.useState(!1),[W,G]=A.useState(null),[ee,ae]=A.useState(!1),[oe,pe]=A.useState(!1),[ne,fe]=A.useState(!1),[se,me]=A.useState(""),[ue,xe]=A.useState(!1),[Te,_e]=A.useState([]),[we,ve]=A.useState(!1),[Xe,Me]=A.useState(!1),[Ie,$e]=A.useState(null),[Be,Ve]=A.useState({name:"",phone:"",email:""}),[ot,Tt]=A.useState(!1),[Oe,at]=A.useState(!1),[le,qe]=A.useState(null),[Je,st]=A.useState("asc"),[je,ut]=A.useState(!1),[Ce,Ee]=A.useState(null),[Ze,Le]=A.useState(!1),[Ke,tt]=A.useState(null),[ct,it]=A.useState(""),[zt,Lt]=A.useState(!1),[lr,Ar]=A.useState(null);A.useEffect(()=>{Zr(),Mr()},[e]);const Mr=async()=>{try{const{data:rt,error:ye}=await Y.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",e);if(ye)throw ye;_e((rt==null?void 0:rt.map(Pe=>Pe.user_id))||[])}catch(rt){console.error("Error loading brokerage managers:",rt)}},Zr=async()=>{try{o(!0);const{data:rt,error:ye}=await Y.functions.invoke("get-brokerage-agents",{body:{brokerageId:e}});if(ye)throw ye;const Pe=rt.agents||[];if(s(Pe),Pe.length>0){const Ye=Pe.map(bt=>bt.id),{data:Nt}=await Y.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ye);if(Nt&&Nt.length>0){const bt=Nt.map(Ot=>Ot.assistant_id),{data:It}=await Y.from("profiles").select("id, name, email").in("id",bt),qt={};for(const Ot of Nt){const Wt=It==null?void 0:It.find(pr=>pr.id===Ot.assistant_id);Wt&&(qt[Ot.agent_id]={name:Wt.name||"",email:Wt.email||""})}k(qt)}else k({})}}catch(rt){console.error("Error loading agents:",rt),t({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},Xn=async()=>{if(!F.email||!F.name||!F.password){t({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}P(!0);try{const{data:{session:rt}}=await Y.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rt==null?void 0:rt.access_token}`},body:JSON.stringify({...F,brokerageId:e})}),Pe=await ye.json();if(!ye.ok)throw new Error(Pe.error||"Failed to create agent");t({title:"Success",description:`Agent ${F.email} created successfully`}),D({email:"",name:"",password:"",phone:""}),I(!1),Zr()}catch(rt){console.error("Error creating agent:",rt),t({title:"Error",description:rt.message||"Failed to create agent",variant:"destructive"})}finally{P(!1)}},dr=async rt=>{try{const{data:{session:ye}}=await Y.auth.getSession(),Pe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ye==null?void 0:ye.access_token}`},body:JSON.stringify({userId:rt})}),Ye=await Pe.json();if(!Pe.ok)throw new Error(Ye.error||"Failed to resend welcome email");t({title:"Success",description:"Welcome email sent successfully"})}catch(ye){console.error("Error resending welcome email:",ye),t({title:"Error",description:ye.message||"Failed to resend welcome email",variant:"destructive"})}},En=async(rt,ye)=>{try{const{error:Pe}=await Y.functions.invoke("send-password-reset",{body:{email:rt,redirectTo:window.location.origin}});if(Pe)throw Pe;t({title:"Password Reset Sent",description:`Password reset email sent to ${ye}`})}catch(Pe){console.error("Error sending password reset:",Pe),t({title:"Error",description:Pe.message||"Failed to send password reset email",variant:"destructive"})}},Es=rt=>{G(rt),V(!0)},Hs=rt=>{$e(rt),Ve({name:rt.name,phone:rt.phone||"",email:rt.email}),Me(!0)},Ei=async()=>{if(!Ie)return;if(!Be.name.trim()){t({title:"Error",description:"Name is required",variant:"destructive"});return}const rt=Be.email.trim().toLowerCase()!==Ie.email.toLowerCase();Tt(!0);try{if(rt){if(!Be.email.trim())throw new Error("Email is required");at(!0);const{data:{session:Pe}}=await Y.auth.getSession(),Ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pe==null?void 0:Pe.access_token}`},body:JSON.stringify({agentId:Ie.id,newEmail:Be.email.trim(),brokerageId:e})}),Nt=await Ye.json();if(at(!1),!Ye.ok)throw new Error(Nt.error||"Failed to update email")}const{error:ye}=await Y.from("profiles").update({name:Be.name.trim(),phone:Be.phone.trim()||null}).eq("id",Ie.id);if(ye)throw ye;t({title:"Success",description:"Agent profile updated successfully"}),Me(!1),$e(null),Zr()}catch(ye){console.error("Error updating agent:",ye),t({title:"Error",description:ye.message||"Failed to update agent",variant:"destructive"})}finally{Tt(!1),at(!1)}},Ii=async()=>{if(!se){t({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}xe(!0);try{const{data:{session:rt}}=await Y.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rt==null?void 0:rt.access_token}`},body:JSON.stringify({userId:se,role:"brokerage_manager",action:"add",brokerageId:e})}),Pe=await ye.json();if(!ye.ok)throw new Error(Pe.error||"Failed to add brokerage manager");t({title:"Success",description:"Brokerage manager added successfully"}),fe(!1),me(""),Mr()}catch(rt){console.error("Error adding brokerage manager:",rt),t({title:"Error",description:rt.message||"Failed to add brokerage manager",variant:"destructive"})}finally{xe(!1)}},Ho=async rt=>{try{const{data:{session:ye}}=await Y.auth.getSession(),Pe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ye==null?void 0:ye.access_token}`},body:JSON.stringify({userId:rt,role:"brokerage_manager",action:"remove",brokerageId:e})}),Ye=await Pe.json();if(!Pe.ok)throw new Error(Ye.error||"Failed to remove brokerage manager");t({title:"Success",description:"Brokerage manager role removed"}),Mr()}catch(ye){console.error("Error removing brokerage manager:",ye),t({title:"Error",description:ye.message||"Failed to remove brokerage manager",variant:"destructive"})}},Ha=rt=>Te.includes(rt),us=rt=>{tt(rt),it(""),Le(!0)},ra=async()=>{if(!(!Ke||!ct)){if(ct.length<6){t({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}Lt(!0);try{const{data:{session:rt}}=await Y.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rt==null?void 0:rt.access_token}`},body:JSON.stringify({agentId:Ke.id,brokerageId:e,action:"set_password",newPassword:ct})}),Pe=await ye.json();if(!ye.ok)throw new Error(Pe.error||"Failed to set password");t({title:"Success",description:`Password set for ${Ke.name}`}),Le(!1),tt(null),it("")}catch(rt){console.error("Error setting password:",rt),t({title:"Error",description:rt.message||"Failed to set password",variant:"destructive"})}finally{Lt(!1)}}},hs=async rt=>{Ar(rt.id);try{const{data:{session:ye}}=await Y.auth.getSession(),Pe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ye==null?void 0:ye.access_token}`},body:JSON.stringify({agentId:rt.id,brokerageId:e,action:"claim_account"})}),Ye=await Pe.json();if(!Pe.ok)throw new Error(Ye.error||"Failed to claim account");t({title:"Success",description:`Account claimed for ${rt.name}`}),Zr()}catch(ye){console.error("Error claiming account:",ye),t({title:"Error",description:ye.message||"Failed to claim account",variant:"destructive"})}finally{Ar(null)}},Ys=async()=>{if(W){ae(!0);try{const{data:{session:rt}}=await Y.auth.getSession(),ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${rt==null?void 0:rt.access_token}`},body:JSON.stringify({userId:W.id,brokerageId:e})}),Pe=await ye.json();if(!ye.ok)throw new Error(Pe.error||"Failed to remove agent");t({title:"Success",description:`${W.name} has been removed from your brokerage`}),V(!1),G(null),Zr()}catch(rt){console.error("Error removing agent:",rt),t({title:"Error",description:rt.message||"Failed to remove agent",variant:"destructive"})}finally{ae(!1)}}},zs=rt=>{const ye=rt.trim().split(" ");return ye.length>1?ye[ye.length-1].toLowerCase():rt.toLowerCase()},ji=rt=>{le===rt?st(Je==="asc"?"desc":"asc"):(qe(rt),st("asc"))},ir=rt=>le!==rt?r.jsx(Og,{className:"ml-1 h-4 w-4"}):Je==="asc"?r.jsx(df,{className:"ml-1 h-4 w-4"}):r.jsx(oy,{className:"ml-1 h-4 w-4"}),Pa=n.filter(rt=>{if(u==="active"&&!rt.claimed||u==="pending"&&rt.claimed)return!1;if(!l)return!0;const ye=l.toLowerCase();return rt.name.toLowerCase().includes(ye)||rt.email.toLowerCase().includes(ye)}),oo=[...Pa].sort((rt,ye)=>{if(!le)return 0;let Pe=0;return le==="name"?Pe=zs(rt.name).localeCompare(zs(ye.name)):le==="status"&&(Pe=rt.claimed===ye.claimed?0:rt.claimed?-1:1),Je==="asc"?Pe:-Pe});Pa.filter(rt=>rt.claimed&&!Ha(rt.id));const bi=rt=>{y(ye=>{const Pe=new Set(ye);return Pe.has(rt)?Pe.delete(rt):Pe.add(rt),Pe})},qn=()=>{x.size===oo.length?y(new Set):y(new Set(oo.map(rt=>rt.id)))},Ki=()=>{y(new Set)},dc=async()=>{const rt=Array.from(x);if(rt.length===0)return;b(!0);let ye=0,Pe=0;try{const{data:{session:Ye}}=await Y.auth.getSession();for(const Nt of rt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ye==null?void 0:Ye.access_token}`},body:JSON.stringify({userId:Nt})})).ok?ye++:Pe++}catch{Pe++}ye>0?t({title:"Success",description:`Welcome emails sent to ${ye} agent${ye>1?"s":""}${Pe>0?` (${Pe} failed)`:""}`}):t({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),Ki()}catch(Ye){console.error("Error bulk sending welcome emails:",Ye),t({title:"Error",description:Ye.message||"Failed to send welcome emails",variant:"destructive"})}finally{b(!1)}};return a?r.jsx(He,{children:r.jsx(et,{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(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Agents"}),r.jsx(jn,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Q,{variant:"outline",onClick:()=>fe(!0),children:[r.jsx(vm,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(Q,{variant:"outline",onClick:()=>pe(!0),children:[r.jsx(V1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(Q,{onClick:()=>I(!0),children:[r.jsx(th,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(et,{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(ma,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search agents...",value:l,onChange:rt=>i(rt.target.value),className:"pl-9"})]}),r.jsxs(un,{value:u,onValueChange:rt=>m(rt),children:[r.jsx(ln,{className:"w-[160px]",children:r.jsx(mn,{placeholder:"Filter by status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Agents"}),r.jsx($t,{value:"active",children:"Active"}),r.jsx($t,{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(Q,{size:"sm",variant:"outline",onClick:dc,disabled:v,children:[r.jsx(ws,{className:"mr-2 h-4 w-4"}),v?"Sending...":"Resend Welcome Email"]}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:Ki,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(_l,{checked:oo.length>0&&x.size===oo.length,onCheckedChange:qn,"aria-label":"Select all"})}),r.jsx(Mt,{children:r.jsxs(Q,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>ji("name"),children:["Name (Last)",ir("name")]})}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:r.jsxs(Q,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>ji("status"),children:["Status",ir("status")]})}),r.jsx(Mt,{children:"Actions"})]})}),r.jsx(Fs,{children:oo.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):oo.map(rt=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsx(_l,{checked:x.has(rt.id),onCheckedChange:()=>bi(rt.id),"aria-label":`Select ${rt.name}`})}),r.jsx(yt,{className:"font-medium",children:rt.name}),r.jsx(yt,{children:rt.email}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[rt.claimed?r.jsx(At,{variant:"default",children:"Active"}):r.jsx(At,{variant:"secondary",children:"Pending"}),Ha(rt.id)&&r.jsxs(At,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(kA,{className:"mr-1 h-3 w-3"}),"Manager"]}),N[rt.id]&&r.jsxs(At,{variant:"outline",className:"text-xs",children:[r.jsx($n,{className:"mr-1 h-3 w-3"}),"Asst: ",N[rt.id].name||N[rt.id].email]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>{Ee(rt),ut(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(Hc,{className:"h-4 w-4"})}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>Hs(rt),title:"Edit agent",children:r.jsx(Qa,{className:"h-4 w-4"})}),!rt.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>dr(rt.id),title:"Resend welcome email",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>hs(rt),title:"Claim account for agent",disabled:lr===rt.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(Vj,{className:"h-4 w-4"})})]}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>us(rt),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(ff,{className:"h-4 w-4"})}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>En(rt.email,rt.name),title:"Send password reset email",children:r.jsx(Rj,{className:"h-4 w-4"})}),Ha(rt.id)&&r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>Ho(rt.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(vm,{className:"h-4 w-4"})}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>Es(rt),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},rt.id))})]})})]})]}),r.jsx(Rr,{open:M,onOpenChange:I,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Add New Agent"}),r.jsx(Yn,{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(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",value:F.name,onChange:rt=>D({...F,name:rt.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(lt,{id:"email",type:"email",value:F.email,onChange:rt=>D({...F,email:rt.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(lt,{id:"phone",type:"tel",value:F.phone,onChange:rt=>D({...F,phone:rt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"password",children:"Temporary Password"}),r.jsx(lt,{id:"password",type:"password",value:F.password,onChange:rt=>D({...F,password:rt.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),r.jsx(Q,{onClick:Xn,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx(Rr,{open:U,onOpenChange:V,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Remove Agent"}),r.jsxs(Yn,{children:["Are you sure you want to remove ",r.jsx("strong",{children:W==null?void 0:W.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(Q,{variant:"destructive",onClick:Ys,disabled:ee,children:ee?"Removing...":"Remove Agent"})]})]})}),r.jsx(V9e,{open:oe,onOpenChange:pe,fixedBrokerageId:e,onSuccess:Zr}),r.jsx(Rr,{open:ne,onOpenChange:fe,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Add Brokerage Manager"}),r.jsx(Yn,{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(ze,{children:"Select Agent"}),r.jsxs(Wc,{open:we,onOpenChange:ve,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":we,className:"w-full justify-between",children:[se?((go=n.find(rt=>rt.id===se))==null?void 0:go.name)+" ("+((uc=n.find(rt=>rt.id===se))==null?void 0:uc.email)+")":"Select an agent to promote...",r.jsx(cy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Tc,{className:"w-full p-0",align:"start",children:r.jsxs(Py,{children:[r.jsx(Ly,{placeholder:"Search by name or email..."}),r.jsxs(Oy,{className:"max-h-[200px]",children:[r.jsx(Dy,{children:"No eligible agents found."}),r.jsx(Ry,{children:n.filter(rt=>!Ha(rt.id)).map(rt=>r.jsxs(Fy,{value:`${rt.name} ${rt.email}`,onSelect:()=>{me(rt.id),ve(!1)},children:[r.jsx(mi,{className:`mr-2 h-4 w-4 ${se===rt.id?"opacity-100":"opacity-0"}`}),rt.name," (",rt.email,")"]},rt.id))})]})]})})]}),n.filter(rt=>!Ha(rt.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>fe(!1),children:"Cancel"}),r.jsx(Q,{onClick:Ii,disabled:ue||!se,children:ue?"Adding...":"Add as Manager"})]})]})}),r.jsx(Rr,{open:Xe,onOpenChange:Me,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Edit Agent"}),r.jsxs(Yn,{children:["Update profile information for ",Ie==null?void 0:Ie.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"edit-name",children:"Name"}),r.jsx(lt,{id:"edit-name",value:Be.name,onChange:rt=>Ve({...Be,name:rt.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"edit-email",children:"Email"}),r.jsx(lt,{id:"edit-email",type:"email",value:Be.email,onChange:rt=>Ve({...Be,email:rt.target.value}),placeholder:"agent@example.com"}),Be.email.trim().toLowerCase()!==(Ie==null?void 0:Ie.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(ze,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(lt,{id:"edit-phone",type:"tel",value:Be.phone,onChange:rt=>Ve({...Be,phone:rt.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>Me(!1),children:"Cancel"}),r.jsx(Q,{onClick:Ei,disabled:ot||Oe,children:Oe?"Updating email...":ot?"Saving...":"Save Changes"})]})]})}),Ce&&r.jsx(H9e,{open:je,onOpenChange:rt=>{ut(rt),rt||Ee(null)},userId:Ce.id,userName:Ce.name}),r.jsx(Rr,{open:Ze,onOpenChange:Le,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Set Password"}),r.jsxs(Yn,{children:["Set a new password for ",Ke==null?void 0:Ke.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(ze,{htmlFor:"new-password",children:"New Password"}),r.jsx(lt,{id:"new-password",type:"password",value:ct,onChange:rt=>it(rt.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(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>Le(!1),children:"Cancel"}),r.jsx(Q,{onClick:ra,disabled:zt||!ct||ct.length<6,children:zt?"Setting...":"Set Password"})]})]})})]})},kCt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},NCt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},SCt=e=>{switch(e){case"academy_video":return r.jsx(Ia,{className:"h-4 w-4"});case"template":return r.jsx(_a,{className:"h-4 w-4"});case"toolbox":return r.jsx(_a,{className:"h-4 w-4"});case"newsletter":return r.jsx(fy,{className:"h-4 w-4"});case"social_swag":return r.jsx(Os,{className:"h-4 w-4"});case"event":return r.jsx(Cs,{className:"h-4 w-4"});default:return r.jsx(Ss,{className:"h-4 w-4"})}},CCt=({brokerageId:e})=>{const{toast:t}=fi(),[n,s]=A.useState([]),[a,o]=A.useState([]),[l,i]=A.useState([]),[u,m]=A.useState(!0),[x,y]=A.useState(null);A.useEffect(()=>{v()},[e]);const v=async()=>{try{m(!0);const{data:k,error:M}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",e);if(M)throw M;const I=k.map(ae=>ae.id),T=new Map(k.map(ae=>[ae.id,ae]));if(I.length===0){s([]),o([]),i([]);return}const{data:P,error:F}=await Y.from("activity_logs").select("*").in("user_id",I).order("launched_at",{ascending:!1});if(F)throw F;const D=P.map(ae=>{var oe,pe;return{id:ae.id,user_id:ae.user_id,app_name:ae.app_name,launched_at:ae.launched_at,user_name:((oe=T.get(ae.user_id))==null?void 0:oe.name)||"Unknown",user_email:((pe=T.get(ae.user_id))==null?void 0:pe.email)||"Unknown"}});s(D);const{data:U,error:V}=await Y.from("content_engagement_logs").select("*").in("user_id",I).order("created_at",{ascending:!1});if(V)throw V;const W=(U||[]).map(ae=>{var oe,pe;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:((oe=T.get(ae.user_id))==null?void 0:oe.name)||"Unknown",user_email:((pe=T.get(ae.user_id))==null?void 0:pe.email)||"Unknown"}});o(W);const G=new Map;k.forEach(ae=>{G.set(ae.id,{user_id:ae.id,user_name:ae.name,user_email:ae.email,app_launches:0,content_views:0,last_activity:""})}),D.forEach(ae=>{const oe=G.get(ae.user_id);oe&&(oe.app_launches++,(!oe.last_activity||new Date(ae.launched_at)>new Date(oe.last_activity))&&(oe.last_activity=ae.launched_at))}),W.forEach(ae=>{const oe=G.get(ae.user_id);oe&&(oe.content_views++,(!oe.last_activity||new Date(ae.created_at)>new Date(oe.last_activity))&&(oe.last_activity=ae.created_at))});const ee=Array.from(G.values()).filter(ae=>ae.app_launches>0||ae.content_views>0).sort((ae,oe)=>new Date(oe.last_activity).getTime()-new Date(ae.last_activity).getTime());i(ee)}catch(k){console.error("Error loading activity:",k),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{m(!1)}},b=k=>n.filter(M=>M.user_id===k),N=k=>a.filter(M=>M.user_id===k);return u?r.jsx(He,{children:r.jsx(et,{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(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Agent Activity"}),r.jsx(jn,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(et,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{className:"text-center",children:"App Launches"}),r.jsx(Mt,{className:"text-center",children:"Content Views"}),r.jsx(Mt,{children:"Last Active"})]})}),r.jsx(Fs,{children:l.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(k=>r.jsxs(Sr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>y({id:k.user_id,name:k.user_name,email:k.user_email}),children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:k.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:k.user_email})]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(At,{variant:"outline",className:"gap-1",children:[r.jsx(Vl,{className:"h-3 w-3"}),k.app_launches]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(At,{variant:"secondary",className:"gap-1",children:[r.jsx(_a,{className:"h-3 w-3"}),k.content_views]})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:k.last_activity&&bu(new Date(k.last_activity),{addSuffix:!0})})]},k.user_id))})]})})})]}),r.jsx(Rr,{open:!!x,onOpenChange:k=>!k&&y(null),children:r.jsxs(Dr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Br,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(Yn,{children:x==null?void 0:x.email})]}),r.jsxs(wi,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(_i,{className:"grid w-full grid-cols-2",children:[r.jsx(sn,{value:"content",children:"Content Engagement"}),r.jsx(sn,{value:"apps",children:"App Launches"})]}),r.jsx(Sn,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Resource"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Fs,{children:x&&N(x.id).length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&N(x.id).map(k=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"max-w-[200px] truncate font-medium",children:k.resource_title}),r.jsx(yt,{children:r.jsxs(At,{variant:"outline",className:"gap-1",children:[SCt(k.resource_type),kCt[k.resource_type]||k.resource_type]})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:NCt[k.action_type]||k.action_type})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:bu(new Date(k.created_at),{addSuffix:!0})})]},k.id))})]})})}),r.jsx(Sn,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"App"}),r.jsx(Mt,{children:"Time"})]})}),r.jsx(Fs,{children:x&&b(x.id).length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&b(x.id).map(k=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsx(At,{variant:"outline",children:k.app_name})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:bu(new Date(k.launched_at),{addSuffix:!0})})]},k.id))})]})})})]})]})})]})},MCt=({brokerageId:e})=>{const{toast:t}=fi(),[n,s]=A.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[a,o]=A.useState(!0);A.useEffect(()=>{l()},[e]);const l=async()=>{try{o(!0);const{data:i,error:u}=await Y.from("profiles").select("id").eq("brokerage_id",e);if(u)throw u;const m=i.map(D=>D.id),x=m.length;if(m.length===0){o(!1);return}const{data:y,error:v}=await Y.from("profiles").select("id, email").in("id",m);if(v)throw v;const{count:b}=await Y.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",e).not("last_login","is",null),N=b||0,k=x-N,{count:M}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m),I=new Date;I.setDate(I.getDate()-7);const{count:T}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",I.toISOString()),P=new Date;P.setMonth(P.getMonth()-1);const{count:F}=await Y.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",m).gte("launched_at",P.toISOString());s({totalAgents:x,activeAgents:N,pendingAgents:k,totalLaunches:M||0,launchesThisWeek:T||0,launchesThisMonth:F||0})}catch(i){console.error("Error loading analytics:",i),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return a?r.jsx(He,{children:r.jsx(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx($n,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(oi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Xa,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(Lg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(Lg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(Lg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{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"})]})]})]})},TCt=({brokerageId:e})=>{const[t,n]=A.useState([]),[s,a]=A.useState(!0),[o,l]=A.useState(!1),[i,u]=A.useState(!1),[m,x]=A.useState({description:"",maxUses:""});A.useEffect(()=>{y()},[e]);const y=async()=>{try{const{data:I,error:T}=await Y.from("invite_codes").select("*").eq("brokerage_id",e).order("created_at",{ascending:!1});if(T)throw T;n(I||[])}catch(I){console.error("Error loading invite codes:",I),Ae.error("Failed to load invite links")}finally{a(!1)}},v=()=>Math.random().toString(36).substring(2,8).toUpperCase(),b=async()=>{l(!0);try{const I=v(),{error:T}=await Y.from("invite_codes").insert({code:I,description:m.description||null,max_uses:m.maxUses?parseInt(m.maxUses):null,brokerage_id:e,is_active:!0});if(T)throw T;Ae.success("Invite link created!"),u(!1),x({description:"",maxUses:""}),y()}catch(I){console.error("Error creating invite code:",I),Ae.error("Failed to create invite link")}finally{l(!1)}},N=async I=>{try{const{error:T}=await Y.from("invite_codes").delete().eq("id",I);if(T)throw T;Ae.success("Invite link deleted"),n(t.filter(P=>P.id!==I))}catch(T){console.error("Error deleting invite code:",T),Ae.error("Failed to delete invite link")}},k=async(I,T)=>{try{const{error:P}=await Y.from("invite_codes").update({is_active:!T}).eq("id",I);if(P)throw P;n(t.map(F=>F.id===I?{...F,is_active:!T}:F)),Ae.success(`Invite link ${T?"deactivated":"activated"}`)}catch(P){console.error("Error toggling invite code:",P),Ae.error("Failed to update invite link")}},M=I=>{const T=`${window.location.origin}/join?code=${I}`;navigator.clipboard.writeText(T),Ae.success("Link copied to clipboard!")};return s?r.jsx(He,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(jn,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Rr,{open:i,onOpenChange:u,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{size:"sm",children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Create Invite Link"}),r.jsx(Yn,{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(ze,{htmlFor:"description",children:"Description (optional)"}),r.jsx(lt,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:m.description,onChange:I=>x({...m,description:I.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(lt,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:m.maxUses,onChange:I=>x({...m,maxUses:I.target.value})})]}),r.jsx(Q,{onClick:b,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(et,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Oo,{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(I=>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:I.code}),r.jsx(At,{variant:I.is_active?"default":"secondary",children:I.is_active?"Active":"Inactive"})]}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:I.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[I.uses_count," uses",I.max_uses&&` / ${I.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>M(I.code),title:"Copy link",children:r.jsx(Po,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>k(I.id,I.is_active),title:I.is_active?"Deactivate":"Activate",children:I.is_active?"Disable":"Enable"}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>N(I.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Bn,{className:"h-4 w-4"})})]})]},I.id))})})]})},ACt=({open:e,onOpenChange:t,referralCode:n,brokerageId:s,senderName:a,brokerageName:o,onInvitesSent:l})=>{const[i,u]=A.useState(""),[m,x]=A.useState([]),[y,v]=A.useState(""),[b,N]=A.useState(!1),k=F=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(F),M=()=>{const F=i.trim().toLowerCase();if(F&&k(F)&&!m.includes(F)){if(m.length>=10){Ae.error("Maximum 10 emails per invite");return}x([...m,F]),u("")}else F&&!k(F)?Ae.error("Please enter a valid email address"):m.includes(F)&&Ae.error("Email already added")},I=F=>{x(m.filter(D=>D!==F))},T=F=>{(F.key==="Enter"||F.key===",")&&(F.preventDefault(),M())},P=async()=>{if(m.length===0){Ae.error("Please add at least one email address");return}N(!0);try{const{data:F,error:D}=await Y.functions.invoke("send-referral-invite",{body:{emails:m,personalMessage:y.trim()||void 0,referralCode:n,brokerageId:s,senderName:a,brokerageName:o}});if(D)throw D;F.successCount===F.totalCount?Ae.success(`${F.successCount} invite${F.successCount>1?"s":""} sent successfully!`):Ae.warning(`${F.successCount} of ${F.totalCount} invites sent. Some failed.`),x([]),v(""),t(!1),l==null||l()}catch(F){console.error("Error sending invites:",F),Ae.error("Failed to send invites. Please try again.")}finally{N(!1)}};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-[550px]",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(Yn,{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(ao,{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(ze,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:i,onChange:F=>u(F.target.value),onKeyDown:T,onBlur:M}),r.jsx(Q,{type:"button",variant:"secondary",onClick:M,children:"Add"})]}),m.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:m.map(F=>r.jsxs(At,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[F,r.jsx("button",{type:"button",onClick:()=>I(F),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(ds,{className:"h-3 w-3"})})]},F))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(Zn,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:y,onChange:F=>v(F.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(Os,{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(Q,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(Q,{onClick:P,disabled:m.length===0||b,children:b?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(Ji,{className:"h-4 w-4 mr-2"}),"Send ",m.length>0&&`(${m.length})`," Invite",m.length!==1?"s":""]})})]})]})})},ECt=({brokerageId:e,refreshTrigger:t})=>{const[n,s]=A.useState([]),[a,o]=A.useState(!0);A.useEffect(()=>{l()},[e,t]);const l=async()=>{try{const{data:u,error:m}=await Y.from("referral_invites").select("*").eq("referrer_brokerage_id",e).order("sent_at",{ascending:!1}).limit(20);if(m)throw m;s(u||[])}catch(u){console.error("Error fetching invites:",u)}finally{o(!1)}},i=u=>{switch(u){case"signed_up":return r.jsxs(At,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(oi,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(At,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(bc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(At,{variant:"secondary",className:"gap-1",children:[r.jsx(Xa,{className:"h-3 w-3"}),"Pending"]})}};return a?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(ws,{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(u=>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:u.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",on(new Date(u.sent_at),"MMM d, yyyy")]})]}),i(u.status)]},u.id))]})},ICt=()=>{const{brokerageId:e,user:t}=tn(),[n,s]=A.useState(null),[a,o]=A.useState(""),[l,i]=A.useState(""),[u,m]=A.useState([]),[x,y]=A.useState(!0),[v,b]=A.useState(!1),[N,k]=A.useState(0);A.useEffect(()=>{e&&M()},[e]);const M=async()=>{try{const[U,V]=await Promise.all([Y.from("brokerages").select("name").eq("id",e).single(),t?Y.from("profiles").select("name").eq("id",t.id).single():Promise.resolve({data:null})]);U.data&&o(U.data.name),V.data&&i(V.data.name||"A LevelUp Member");const{data:W}=await Y.from("referral_codes").select("code").eq("brokerage_id",e).single();if(W)s(W.code);else{const ee=`REF${e==null?void 0:e.slice(0,8).toUpperCase()}`;await Y.from("referral_codes").insert({brokerage_id:e,code:ee}),s(ee)}const{data:G}=await Y.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});m(G||[])}catch(U){console.error("Error fetching referral data:",U)}finally{y(!1)}},I=()=>{const U=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(U),Ae.success("Referral link copied to clipboard!")},T=u.filter(U=>U.status==="qualified").length,P=u.filter(U=>U.status==="pending").length,F=T*25,D=Math.max(0,Math.ceil((299-F)/25));return x?null:r.jsxs(r.Fragment,{children:[r.jsxs(He,{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(ao,{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:["$",F]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),F>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(oi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),D>0&&F<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",D," 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"})]}),F>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Os,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(et,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(Q,{onClick:()=>b(!0),className:"w-full",size:"lg",children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(Q,{onClick:I,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(Po,{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(Fd,{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:["$",F]}),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($n,{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(Xa,{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:P}),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(ECt,{brokerageId:e,refreshTrigger:N}),u.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),u.slice(0,5).map(U=>{var V,W;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:((V=U.referred_brokerage)==null?void 0:V.name)||((W=U.referred_user)==null?void 0:W.email)||"Pending setup"}),r.jsxs(At,{variant:U.status==="qualified"?"default":U.status==="pending"?"secondary":"destructive",className:U.status==="qualified"?"bg-green-600":"",children:[U.status==="qualified"&&r.jsx(oi,{className:"h-3 w-3 mr-1"}),U.status]})]},U.id)})]})]})]}),r.jsx(ACt,{open:v,onOpenChange:b,referralCode:n||"",brokerageId:e||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>k(U=>U+1)})]})},PCt=()=>{const{user:e,isBrokerageManager:t,brokerageId:n,isAdmin:s,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=tn(),i=Vn(),{toast:u}=fi(),[m,x]=A.useState(""),[y,v]=A.useState(!0),b=o||(a.length>0?a[0].id:n);A.useEffect(()=>{if(!e||!t&&!s){i("/dashboard");return}!o&&a.length>0&&l(a[0].id),b?N():a.length===0&&!n&&v(!1)},[e,t,s,b,i,a,o]);const N=async()=>{if(!b){v(!1);return}try{const{data:k,error:M}=await Y.from("brokerages").select("name").eq("id",b).single();if(M)throw M;x(k.name)}catch(k){console.error("Error loading brokerage info:",k),u({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{v(!1)}};return y?r.jsx(Fr,{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"})})}):b?r.jsx(Fr,{title:m||"Manage Brokerages",description:"Brokerage Management Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[a.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(un,{value:o||"",onValueChange:l,children:[r.jsxs(ln,{className:"w-[280px]",children:[r.jsx(hi,{className:"mr-2 h-4 w-4"}),r.jsx(mn,{placeholder:"Select brokerage"})]}),r.jsx(cn,{children:a.map(k=>r.jsx($t,{value:k.id,children:k.name},k.id))})]})]}),r.jsxs(wi,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(_i,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(sn,{value:"agents",children:"Agents"}),r.jsx(sn,{value:"invite",children:"Invite Links"}),r.jsx(sn,{value:"referrals",children:"Referrals"}),r.jsx(sn,{value:"leaderboard",children:"Leaderboard"}),r.jsx(sn,{value:"activity",children:"Activity"}),r.jsx(sn,{value:"analytics",children:"Analytics"}),r.jsx(sn,{value:"shares",children:"Shares"})]}),r.jsx(Sn,{value:"agents",className:"space-y-4",children:r.jsx(jCt,{brokerageId:b})}),r.jsx(Sn,{value:"invite",className:"space-y-4",children:r.jsx(TCt,{brokerageId:b})}),r.jsx(Sn,{value:"referrals",className:"space-y-4",children:r.jsx(ICt,{})}),r.jsx(Sn,{value:"leaderboard",className:"space-y-4",children:r.jsx(c9e,{brokerageId:b,title:`${m} Event Leaderboard`,showUserStats:!1})}),r.jsx(Sn,{value:"activity",className:"space-y-4",children:r.jsx(CCt,{brokerageId:b})}),r.jsx(Sn,{value:"analytics",className:"space-y-4",children:r.jsx(MCt,{brokerageId:b})}),r.jsx(Sn,{value:"shares",className:"space-y-4",children:r.jsx(pBe,{brokerageOnly:!0,brokerageId:b})})]})]})}):r.jsx(Fr,{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(hi,{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 LCt({brokerageId:e,canManage:t}){const{user:n}=tn(),[s,a]=A.useState([]),[o,l]=A.useState(!0),[i,u]=A.useState(!1),[m,x]=A.useState(null),[y,v]=A.useState(null),[b,N]=A.useState(!1),[k,M]=A.useState(""),[I,T]=A.useState(""),[P,F]=A.useState(!1),D=async()=>{try{const{data:ee,error:ae}=await Y.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 oe=ee;if(oe&&oe.length>0){const pe=[...new Set(oe.map(me=>me.created_by))],{data:ne}=await Y.from("profiles").select("id, name, avatar_url").in("id",pe),fe=new Map((ne==null?void 0:ne.map(me=>[me.id,me]))||[]),se=oe.map(me=>({...me,author:fe.get(me.created_by)||{name:"Unknown",avatar_url:null}}));a(se)}else a([])}catch(ee){console.error("Error fetching announcements:",ee)}finally{l(!1)}};A.useEffect(()=>{D()},[e]);const U=()=>{M(""),T(""),F(!1),x(null)},V=ee=>{ee?(x(ee),M(ee.title),T(ee.content),F(ee.is_pinned)):U(),u(!0)},W=async()=>{if(!k.trim()||!I.trim()){Ae.error("Please fill in all fields");return}N(!0);try{if(m){const{error:ee}=await Y.from("brokerage_announcements").update({title:k.trim(),content:I.trim(),is_pinned:P,pinned_at:P?new Date().toISOString():null}).eq("id",m.id);if(ee)throw ee;Ae.success("Announcement updated")}else{const{error:ee}=await Y.from("brokerage_announcements").insert({brokerage_id:e,created_by:n==null?void 0:n.id,title:k.trim(),content:I.trim(),is_pinned:P,pinned_at:P?new Date().toISOString():null});if(ee)throw ee;Ae.success("Announcement created")}u(!1),U(),D()}catch(ee){console.error("Error saving announcement:",ee),Ae.error("Failed to save announcement")}finally{N(!1)}},G=async()=>{if(y)try{const{error:ee}=await Y.from("brokerage_announcements").delete().eq("id",y);if(ee)throw ee;Ae.success("Announcement deleted"),D()}catch(ee){console.error("Error deleting announcement:",ee),Ae.error("Failed to delete announcement")}finally{v(null)}};return o?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ep,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(et,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ep,{className:"h-5 w-5 text-primary"}),"Announcements"]}),t&&r.jsxs(Q,{size:"sm",onClick:()=>V(),className:"gap-1",children:[r.jsx(_n,{className:"h-4 w-4"}),"New"]})]}),r.jsx(et,{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(ee=>{var ae,oe,pe,ne;return r.jsx("div",{className:`p-4 rounded-lg border ${ee.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:[ee.is_pinned&&r.jsx(Y1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:ee.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:ee.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(ea,{className:"h-5 w-5",children:[r.jsx(Ci,{src:((ae=ee.author)==null?void 0:ae.avatar_url)||void 0}),r.jsx(ta,{className:"text-[10px]",children:((pe=(oe=ee.author)==null?void 0:oe.name)==null?void 0:pe.charAt(0))||"?"})]}),r.jsx("span",{children:(ne=ee.author)==null?void 0:ne.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:on(new Date(ee.created_at),"MMM d, yyyy")})]})]}),t&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>V(ee),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>v(ee.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]})]})},ee.id)})})})]}),r.jsx(Rr,{open:i,onOpenChange:u,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:m?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title"}),r.jsx(lt,{id:"title",value:k,onChange:ee=>M(ee.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"content",children:"Content"}),r.jsx(Zn,{id:"content",value:I,onChange:ee=>T(ee.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(As,{id:"pinned",checked:P,onCheckedChange:F}),r.jsxs(ze,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(Y1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(Q,{onClick:W,disabled:b,children:b?"Saving...":m?"Update":"Create"})]})]})]})}),r.jsx(Pd,{open:!!y,onOpenChange:()=>v(null),children:r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Delete Announcement"}),r.jsx(hd,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:G,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function OCt({brokerageId:e}){const[t,n]=A.useState([]),[s,a]=A.useState(!0),[o,l]=A.useState(""),[i,u]=A.useState(new Set);A.useEffect(()=>{(async()=>{try{const{data:y,error:v}=await Y.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(v)throw v;if(n(y||[]),y&&y.length>0){const b=y.map(k=>k.id),{data:N}=await Y.from("agent_assistant_assignments").select("agent_id").in("agent_id",b);N&&u(new Set(N.map(k=>k.agent_id)))}}catch(y){console.error("Error fetching agents:",y)}finally{a(!1)}})()},[e]);const m=t.filter(x=>{var y,v;return x.name.toLowerCase().includes(o.toLowerCase())||x.email.toLowerCase().includes(o.toLowerCase())||((y=x.title)==null?void 0:y.toLowerCase().includes(o.toLowerCase()))||((v=x.areas_served)==null?void 0:v.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(et,{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(x=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},x))})})]}):r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx($n,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search agents...",value:o,onChange:x=>l(x.target.value),className:"pl-9"})]})]}),r.jsx(et,{children:m.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:m.map(x=>r.jsx(DCt,{agent:x,hasAssistant:i.has(x.id)},x.id))})})]})}function DCt({agent:e,hasAssistant:t}){const n=e.name.split(" ").map(s=>s[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(ea,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Ci,{src:e.avatar_url||void 0,alt:e.name}),r.jsx(ta,{className:"text-lg bg-primary/10 text-primary",children:n})]}),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}),t&&r.jsx(At,{variant:"outline",className:"text-[10px] mt-1",children:"Has Assistant"})]}),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(Do,{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(Q,{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(Ai,{className:"h-4 w-4"})})}),r.jsx(Q,{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(ws,{className:"h-4 w-4"})})}),e.linkedin_url&&r.jsx(Q,{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(xm,{className:"h-4 w-4"})})}),e.instagram_url&&r.jsx(Q,{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(_u,{className:"h-4 w-4"})})})]})]})}function RCt({brokerageId:e}){const[t,n]=A.useState([]),[s,a]=A.useState(!0);if(A.useEffect(()=>{(async()=>{try{const{data:u,error:m}=await Y.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(m)throw m;if(!u||u.length===0){n([]),a(!1);return}const x=u.map(k=>k.id),{data:y,error:v}=await Y.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(v)throw v;const b=new Map(u.map(k=>[k.id,k])),N=(y||[]).filter(k=>k.total_points>0).map(k=>{const M=b.get(k.user_id);return{user_id:k.user_id,total_points:k.total_points,name:(M==null?void 0:M.name)||"Unknown",avatar_url:(M==null?void 0:M.avatar_url)||null}});n(N)}catch(u){console.error("Error fetching leaderboard:",u)}finally{a(!1)}})()},[e]),s)return r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(et,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(i=>r.jsx("div",{className:"h-12 bg-muted rounded"},i))})})]});const o=i=>i===1?"text-yellow-500":i===2?"text-gray-400":i===3?"text-amber-600":"text-muted-foreground",l=i=>i<=3?r.jsx(my,{className:Ut("h-5 w-5",o(i))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:i});return r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(et,{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((i,u)=>{const m=i.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),x=u+1;return r.jsxs("div",{className:Ut("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(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:i.avatar_url||void 0}),r.jsx(ta,{className:"text-xs",children:m})]}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:i.name}),r.jsxs("span",{className:"text-sm font-semibold text-primary",children:[i.total_points.toLocaleString()," pts"]})]},i.user_id)})})})]})}function FCt({brokerageId:e}){const t=Vn(),[n,s]=A.useState([]),[a,o]=A.useState(!0);A.useEffect(()=>{(async()=>{try{const{data:u,error:m}=await Y.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(m)throw m;if(!u||u.length===0){s([]),o(!1);return}const x=u.map(k=>k.id),y=new Map(u.map(k=>[k.id,k])),{data:v,error:b}=await Y.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(b)throw b;const N=(v||[]).map(k=>({id:k.id,slug:k.slug,property_address:k.property_address,city:k.city,price:k.price,property_type:k.property_type,agent_id:k.agent_id,agent:y.get(k.agent_id)||null,photos:k.listing_photos||[]}));s(N)}catch(u){console.error("Error fetching listings:",u)}finally{o(!1)}})()},[e]);const l=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(i);return a?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(ya,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(et,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(i=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},i))})})]}):r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(ya,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>t("/mission-control/listings"),className:"gap-1",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(et,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(ya,{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(Q,{size:"sm",onClick:()=>t("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(_n,{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(i=>r.jsxs("div",{onClick:()=>window.open(`https://listings.relevelup.com/${i.slug||i.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:[i.photos&&i.photos.length>0?r.jsx("img",{src:i.photos[0].photo_url,alt:i.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(ya,{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:i.property_type.replace("_"," ")})})]}),r.jsxs("div",{className:"p-2.5",children:[r.jsx("p",{className:"font-semibold text-sm text-primary",children:l(i.price)}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:i.property_address||"Address not available"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.city}),i.agent&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",i.agent.name]})]})]},i.id))}),n.length>0&&r.jsxs(Q,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>t("/mission-control/listings"),children:["View All Listings",r.jsx(Ss,{className:"h-3 w-3 ml-1"})]})]})]})}function zCt(){const{user:e,isAdmin:t,isBrokerageManager:n}=tn(),s=Vn(),[a,o]=A.useState(!0),[l,i]=A.useState(null),[u,m]=A.useState(""),[x,y]=A.useState(0),[v,b]=A.useState(!1),[N,k]=A.useState(!1);return A.useEffect(()=>{(async()=>{if(e)try{const{data:I}=await Y.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle();if(!(I!=null&&I.brokerage_id)){o(!1);return}i(I.brokerage_id);const{data:T}=await Y.from("brokerages").select("name").eq("id",I.brokerage_id).maybeSingle();T&&m(T.name);const{count:P}=await Y.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",I.brokerage_id);if(y(P||0),t)b(!0),k(!0);else if(n){const{data:F}=await Y.from("brokerage_manager_assignments").select("id").eq("user_id",e.id).eq("brokerage_id",I.brokerage_id).maybeSingle();b(!!F),k(!!F)}}catch(I){console.error("Error fetching brokerage info:",I)}finally{o(!1)}})()},[e,t,n]),a?r.jsx(Fr,{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(Fr,{title:u||"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($n,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),N&&r.jsxs(Q,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(LCt,{brokerageId:l,canManage:v}),r.jsx(OCt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(RCt,{brokerageId:l}),r.jsx(FCt,{brokerageId:l})]})]})}):r.jsx(Fr,{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(hi,{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 BCt(){const e=Vn(),[t,n]=A.useState(""),[s,a]=A.useState("grid"),{data:o,isLoading:l}=Zt({queryKey:["newsletters"],queryFn:async()=>{const{data:P,error:F}=await Y.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(F)throw F;return P}}),{data:i}=Zt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:P}=await Y.from("newsletter_likes").select("newsletter_id");return P||[]}}),{data:u}=Zt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:P}=await Y.from("newsletter_comments").select("newsletter_id");return P||[]}}),{data:m}=Zt({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[P,F,D,U]=await Promise.all([Y.from("newsletter_canva_links").select("newsletter_id"),Y.from("newsletter_pdfs").select("newsletter_id"),Y.from("newsletter_videos").select("newsletter_id"),Y.from("newsletter_drive_links").select("newsletter_id")]);return{canva:P.data||[],pdfs:F.data||[],videos:D.data||[],drives:U.data||[]}}}),x=P=>(i==null?void 0:i.filter(F=>F.newsletter_id===P).length)||0,y=P=>(u==null?void 0:u.filter(F=>F.newsletter_id===P).length)||0,v=P=>{var F;return((F=m==null?void 0:m.canva)==null?void 0:F.filter(D=>D.newsletter_id===P).length)||0},b=P=>{var F;return((F=m==null?void 0:m.pdfs)==null?void 0:F.filter(D=>D.newsletter_id===P).length)||0},N=P=>{var F;return((F=m==null?void 0:m.videos)==null?void 0:F.filter(D=>D.newsletter_id===P).length)||0},k=P=>{var F;return((F=m==null?void 0:m.drives)==null?void 0:F.filter(D=>D.newsletter_id===P).length)||0},M=P=>v(P)+b(P)+N(P)+k(P),I=o==null?void 0:o.filter(P=>{var F;return P.title.toLowerCase().includes(t.toLowerCase())||((F=P.description)==null?void 0:F.toLowerCase().includes(t.toLowerCase()))}),T=P=>{e(`/newsletters/${P}`)};return r.jsx(Fr,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search newsletters...",value:t,onChange:P=>n(P.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(hf,{className:"h-4 w-4"})}),r.jsx(Q,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(I==null?void 0:I.length)||0," item",(I==null?void 0:I.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((P,F)=>r.jsx(He,{children:r.jsxs(et,{className:"p-0",children:[r.jsx(Er,{className:"aspect-[3/2] w-full"}),r.jsxs("div",{className:"p-4 space-y-2",children:[r.jsx(Er,{className:"h-5 w-3/4"}),r.jsx(Er,{className:"h-4 w-full"})]})]})},F))}),!l&&(I==null?void 0:I.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(_a,{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(Q,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&I&&I.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:I.map(P=>{const F=M(P.id),D=v(P.id),U=b(P.id),V=N(P.id);return s==="grid"?r.jsxs(He,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(P.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted 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-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(_a,{className:"h-16 w-16"})})}),r.jsxs(et,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:P.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-1 text-xs text-muted-foreground",children:[r.jsx(Cs,{className:"h-3 w-3"}),on(new Date(P.publish_date),"MMM d, yyyy")]})]}),P.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:P.description.replace(/<[^>]*>/g,"")}),F>0&&r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[D>0&&r.jsxs(At,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Vc,{className:"h-3 w-3"})," ",D," Template",D>1?"s":""]}),U>0&&r.jsxs(At,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(so,{className:"h-3 w-3"})," ",U," PDF",U>1?"s":""]}),V>0&&r.jsxs(At,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Vl,{className:"h-3 w-3"})," ",V," Video",V>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(Bd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3 w-3"})," ",y(P.id)]})]})]})]},P.id):r.jsx(He,{className:"group overflow-hidden hover:shadow-md transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(P.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:P.preview_image_url?r.jsx("img",{src:P.preview_image_url,alt:P.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(_a,{className:"h-10 w-10"})})}),r.jsxs(et,{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:P.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground",children:[r.jsx(Cs,{className:"h-3 w-3"}),on(new Date(P.publish_date),"MMM d, yyyy")]})]}),P.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:P.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[F>0&&r.jsxs("span",{children:[F," resource",F>1?"s":""]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bd,{className:"h-3 w-3"})," ",x(P.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3 w-3"})," ",y(P.id)]})]})]})]})},P.id)})})]})})}function $Ct({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 a=n.columns.filter(o=>o.title||o.description||o.image_url);return a.length===0?null:r.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`},children:a.map((o,l)=>r.jsxs(He,{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(et,{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 UCt(){const{id:e}=Ec(),t=Vn(),{user:n}=tn(),{toast:s}=fi(),a=Vr(),{trackEngagement:o}=fP(),[l,i]=A.useState(""),{data:u,isLoading:m}=Zt({queryKey:["newsletter",e],queryFn:async()=>{const{data:D,error:U}=await Y.from("newsletter_content").select("*").eq("id",e).single();if(U)throw U;return D},enabled:!!e});A.useEffect(()=>{u&&o("newsletter",u.id,u.title,"view")},[u==null?void 0:u.id]);const{data:x}=Zt({queryKey:["newsletter-drives",e],queryFn:async()=>{const{data:D}=await Y.from("newsletter_drive_links").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:y}=Zt({queryKey:["newsletter-pdfs",e],queryFn:async()=>{const{data:D}=await Y.from("newsletter_pdfs").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:v}=Zt({queryKey:["newsletter-videos",e],queryFn:async()=>{const{data:D}=await Y.from("newsletter_videos").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:b}=Zt({queryKey:["newsletter-canva-links",e],queryFn:async()=>{const{data:D}=await Y.from("newsletter_canva_links").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:N}=Zt({queryKey:["newsletter-likes",e],queryFn:async()=>{const{data:D}=await Y.from("newsletter_likes").select("*").eq("newsletter_id",e);return D||[]},enabled:!!e}),{data:k}=Zt({queryKey:["newsletter-comments",e],queryFn:async()=>{const{data:D}=await Y.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",e).order("created_at",{ascending:!1});return D||[]},enabled:!!e}),M=N==null?void 0:N.some(D=>D.user_id===(n==null?void 0:n.id)),I=ar({mutationFn:async()=>{M?await Y.from("newsletter_likes").delete().eq("newsletter_id",e).eq("user_id",n==null?void 0:n.id):await Y.from("newsletter_likes").insert({newsletter_id:e,user_id:n==null?void 0:n.id})},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-likes",e]})}}),T=ar({mutationFn:async D=>{const{error:U}=await Y.from("newsletter_comments").insert({newsletter_id:e,user_id:n==null?void 0:n.id,content:D});if(U)throw U},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",e]}),i(""),s({title:"Comment added"})}}),P=ar({mutationFn:async D=>{const{error:U}=await Y.from("newsletter_comments").delete().eq("id",D);if(U)throw U},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",e]}),s({title:"Comment deleted"})}}),F=D=>{if(D.includes("player.mediadelivery.net")||D.includes("iframe.mediadelivery.net")){const U=D.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(U)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${U[1]}/${U[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(D.includes("youtube.com")||D.includes("youtu.be")){const U=D.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(U)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${U[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:D,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(Vl,{className:"h-4 w-4"})," Watch Video"]})};return m?r.jsx(Fr,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{className:"h-8 w-32"}),r.jsx(Er,{className:"h-64 w-full"}),r.jsx(Er,{className:"h-32 w-full"})]})}):u?r.jsx(Fr,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(Q,{variant:"ghost",onClick:()=>t("/newsletters"),className:"mb-4",children:[r.jsx(Wi,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),u.preview_image_url&&r.jsx("img",{src:u.preview_image_url,alt:u.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:u.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:on(new Date(u.publish_date),"MMMM d, yyyy")})]}),u.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:u.description}}),r.jsx($Ct,{rows:u.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(D3,{resourceType:"newsletter",resourceId:u.id,resourceTitle:u.title}),r.jsxs(Q,{variant:M?"default":"outline",size:"sm",onClick:()=>I.mutate(),children:[r.jsx(vi,{className:`h-4 w-4 mr-1 ${M?"fill-current":""}`}),(N==null?void 0:N.length)||0," ",(N==null?void 0:N.length)===1?"Like":"Likes"]})]}),b&&b.length>0&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(et,{className:"space-y-2",children:b.map(D=>r.jsxs("a",{href:D.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Vc,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:D.title}),r.jsx(Ss,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},D.id))})]}),x&&x.length>0&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(et,{className:"space-y-2",children:x.map(D=>r.jsxs("a",{href:D.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Ss,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:D.title})]},D.id))})]}),y&&y.length>0&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(et,{className:"space-y-2",children:y.map(D=>r.jsxs("a",{href:D.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(_a,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:D.name}),r.jsx(so,{className:"h-4 w-4 text-muted-foreground"})]},D.id))})]}),v&&v.length>0&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Videos"})}),r.jsx(et,{className:"space-y-6",children:v.map(D=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:D.title}),F(D.video_url)]},D.id))})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"text-lg",children:["Comments (",(k==null?void 0:k.length)||0,")"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Zn,{placeholder:"Write a comment...",value:l,onChange:D=>i(D.target.value),className:"flex-1"}),r.jsx(Q,{onClick:()=>l.trim()&&T.mutate(l),disabled:!l.trim()||T.isPending,children:r.jsx(Ji,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:k==null?void 0:k.map(D=>{var U,V,W;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ea,{className:"h-8 w-8",children:r.jsx(ta,{children:((V=(U=D.profiles)==null?void 0:U.name)==null?void 0:V[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:((W=D.profiles)==null?void 0:W.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(D.created_at),"MMM d, yyyy")}),D.user_id===(n==null?void 0:n.id)&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>P.mutate(D.id),children:r.jsx(Bn,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:D.content})]})]},D.id)})})]})]})]})}):r.jsx(Fr,{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(Q,{variant:"link",onClick:()=>t("/newsletters"),children:"Back to Newsletters"})]})})}function qCt({rows:e,onChange:t}){const[n,s]=A.useState(null),a=()=>{t([...e,{columns:[{title:"",description:""},{title:"",description:""},{title:"",description:""}]}])},o=m=>{t(e.filter((x,y)=>y!==m))},l=(m,x,y,v)=>{const b=[...e];b[m]={...b[m],columns:b[m].columns.map((N,k)=>k===x?{...N,[y]:v}:N)},t(b)},i=async(m,x,y)=>{var N;const v=(N=y.target.files)==null?void 0:N[0];if(!v)return;const b=`${m}-${x}`;s(b);try{const k=`content-blocks/${Date.now()}-${v.name}`,{error:M}=await Y.storage.from("newsletter-content").upload(k,v);if(!M){const{data:I}=Y.storage.from("newsletter-content").getPublicUrl(k);l(m,x,"image_url",I.publicUrl)}}finally{s(null)}},u=(m,x)=>{l(m,x,"image_url","")};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-base font-medium",children:"Content Blocks (3-Column Rows)"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:a,children:[r.jsx(_n,{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((m,x)=>r.jsxs(He,{className:"relative",children:[r.jsx(Q,{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(ds,{className:"h-4 w-4"})}),r.jsxs(et,{className:"p-4 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(zg,{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:m.columns.map((y,v)=>{const b=`${x}-${v}`;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 ",v+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(Q,{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:()=>u(x,v),children:r.jsx(ds,{className:"h-3 w-3"})})]}):r.jsxs("div",{children:[r.jsx(lt,{type:"file",accept:"image/*",className:"hidden",id:`block-img-${b}`,onChange:N=>i(x,v,N)}),r.jsx(Q,{type:"button",variant:"outline",size:"sm",className:"w-full text-xs h-8",disabled:n===b,asChild:!0,children:r.jsx("label",{htmlFor:`block-img-${b}`,className:"cursor-pointer",children:n===b?"Uploading...":r.jsxs(r.Fragment,{children:[r.jsx(Fl,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),r.jsx(lt,{placeholder:"Title",value:y.title,onChange:N=>l(x,v,"title",N.target.value),className:"h-8 text-sm"}),r.jsx(Zn,{placeholder:"Description",value:y.description,onChange:N=>l(x,v,"description",N.target.value),className:"text-sm min-h-[60px] resize-none"})]},v)})})]})]},x))]})}function VCt(){const{toast:e}=fi(),t=Vr(),[n,s]=A.useState(!1),[a,o]=A.useState(null),[l,i]=A.useState({title:"",description:"",publish_date:on(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[u,m]=A.useState(null),[x,y]=A.useState(null),[v,b]=A.useState([]),[N,k]=A.useState([]),[M,I]=A.useState([]),[T,P]=A.useState([]),[F,D]=A.useState([]),[U,V]=A.useState([]),[W,G]=A.useState(!1),{data:ee,isLoading:ae}=Zt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:Me,error:Ie}=await Y.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(Ie)throw Ie;return Me}}),oe=ar({mutationFn:async Me=>{const{data:Ie,error:$e}=await Y.from("newsletter_content").insert({title:Me.title,description:Me.description||null,preview_image_url:Me.preview_image_url,publish_date:Me.publish_date,is_published:Me.is_published,content_blocks:Me.content_blocks}).select().single();if($e)throw $e;return Ie},onSuccess:async Me=>{await fe(Me.id),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter created successfully"}),ue()},onError:Me=>{e({title:"Error creating newsletter",description:Me.message,variant:"destructive"})}}),pe=ar({mutationFn:async Me=>{const{error:Ie}=await Y.from("newsletter_content").update({title:Me.title,description:Me.description||null,preview_image_url:Me.preview_image_url,publish_date:Me.publish_date,is_published:Me.is_published,content_blocks:Me.content_blocks}).eq("id",Me.id);if(Ie)throw Ie;return Me.id},onSuccess:async Me=>{await fe(Me),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter updated successfully"}),ue()},onError:Me=>{e({title:"Error updating newsletter",description:Me.message,variant:"destructive"})}}),ne=ar({mutationFn:async Me=>{const{error:Ie}=await Y.from("newsletter_content").delete().eq("id",Me);if(Ie)throw Ie},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter deleted successfully"})},onError:Me=>{e({title:"Error deleting newsletter",description:Me.message,variant:"destructive"})}}),fe=async Me=>{await Y.from("newsletter_drive_links").delete().eq("newsletter_id",Me),await Y.from("newsletter_pdfs").delete().eq("newsletter_id",Me),await Y.from("newsletter_videos").delete().eq("newsletter_id",Me),await Y.from("newsletter_canva_links").delete().eq("newsletter_id",Me);for(const Ie of U){const $e=`${Me}/${Date.now()}-${Ie.file.name}`,{error:Be}=await Y.storage.from("newsletter-content").upload($e,Ie.file);if(!Be){const{data:Ve}=Y.storage.from("newsletter-content").getPublicUrl($e);N.push({name:Ie.name,file_url:Ve.publicUrl,file_size:Ie.file.size,sort_order:N.length})}}v.length>0&&await Y.from("newsletter_drive_links").insert(v.map((Ie,$e)=>({newsletter_id:Me,title:Ie.title,drive_url:Ie.drive_url,sort_order:$e}))),N.length>0&&await Y.from("newsletter_pdfs").insert(N.map((Ie,$e)=>({newsletter_id:Me,name:Ie.name,file_url:Ie.file_url,file_size:Ie.file_size||null,sort_order:$e}))),M.length>0&&await Y.from("newsletter_videos").insert(M.map((Ie,$e)=>({newsletter_id:Me,title:Ie.title,video_url:Ie.video_url,sort_order:$e}))),T.length>0&&await Y.from("newsletter_canva_links").insert(T.map((Ie,$e)=>({newsletter_id:Me,title:Ie.title,canva_share_link:Ie.canva_share_link,sort_order:$e})))},se=async Me=>{o(Me),i({title:Me.title,description:Me.description||"",publish_date:on(new Date(Me.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:Me.is_published}),y(Me.preview_image_url),D(Me.content_blocks||[]);const[Ie,$e,Be,Ve]=await Promise.all([Y.from("newsletter_drive_links").select("*").eq("newsletter_id",Me.id).order("sort_order"),Y.from("newsletter_pdfs").select("*").eq("newsletter_id",Me.id).order("sort_order"),Y.from("newsletter_videos").select("*").eq("newsletter_id",Me.id).order("sort_order"),Y.from("newsletter_canva_links").select("*").eq("newsletter_id",Me.id).order("sort_order")]);b(Ie.data||[]),k($e.data||[]),I(Be.data||[]),P(Ve.data||[]),V([]),s(!0)},me=async Me=>{const[Ie,$e,Be,Ve]=await Promise.all([Y.from("newsletter_drive_links").select("*").eq("newsletter_id",Me.id).order("sort_order"),Y.from("newsletter_pdfs").select("*").eq("newsletter_id",Me.id).order("sort_order"),Y.from("newsletter_videos").select("*").eq("newsletter_id",Me.id).order("sort_order"),Y.from("newsletter_canva_links").select("*").eq("newsletter_id",Me.id).order("sort_order")]);o(null),i({title:`${Me.title} (Copy)`,description:Me.description||"",publish_date:on(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(Me.preview_image_url),D(Me.content_blocks||[]),b((Ie.data||[]).map(({id:ot,...Tt})=>Tt)),k(($e.data||[]).map(({id:ot,...Tt})=>Tt)),I((Be.data||[]).map(({id:ot,...Tt})=>Tt)),P((Ve.data||[]).map(({id:ot,...Tt})=>Tt)),V([]),s(!0)},ue=()=>{s(!1),o(null),i({title:"",description:"",publish_date:on(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),m(null),y(null),b([]),k([]),I([]),P([]),D([]),V([])},xe=async Me=>{var $e;const Ie=($e=Me.target.files)==null?void 0:$e[0];Ie&&(m(Ie),y(URL.createObjectURL(Ie)))},Te=async()=>{if(!l.title){e({title:"Title is required",variant:"destructive"});return}G(!0);let Me=x;if(u){const Ie=`previews/${Date.now()}-${u.name}`,{error:$e}=await Y.storage.from("newsletter-content").upload(Ie,u);if(!$e){const{data:Be}=Y.storage.from("newsletter-content").getPublicUrl(Ie);Me=Be.publicUrl}}a?pe.mutate({id:a.id,...l,preview_image_url:Me,content_blocks:F}):oe.mutate({...l,preview_image_url:Me,content_blocks:F}),G(!1)},_e=()=>b([...v,{title:"",drive_url:"",sort_order:v.length}]),we=()=>I([...M,{title:"",video_url:"",sort_order:M.length}]),ve=()=>P([...T,{title:"",canva_share_link:"",sort_order:T.length}]),Xe=Me=>{const Ie=Me.target.files;if(!Ie)return;const $e=Array.from(Ie).map(Be=>({file:Be,name:Be.name.replace(/\.[^/.]+$/,"")}));V([...U,...$e])};return r.jsx(Fr,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(ee==null?void 0:ee.length)||0})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(ee==null?void 0:ee.filter(Me=>Me.is_published).length)||0})})]})]}),r.jsxs(Rr,{open:n,onOpenChange:Me=>!Me&&ue(),children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Dr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:a?"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(ze,{children:"Title *"}),r.jsx(lt,{value:l.title,onChange:Me=>i({...l,title:Me.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Publish Date"}),r.jsx(lt,{type:"datetime-local",value:l.publish_date,onChange:Me=>i({...l,publish_date:Me.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:l.description,onChange:Me=>i({...l,description:Me}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{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(Q,{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:()=>{m(null),y(null)},children:r.jsx(ds,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx(lt,{type:"file",accept:"image/*",onChange:xe,className:"hidden",id:"preview-upload"}),r.jsx(Q,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(bo,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{checked:l.is_published,onCheckedChange:Me=>i({...l,is_published:Me})}),r.jsx(ze,{children:"Published"})]}),r.jsx(qCt,{rows:F,onChange:D}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:ve,children:[r.jsx(_n,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),T.map((Me,Ie)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(lt,{placeholder:"Link title",value:Me.title,onChange:$e=>{const Be=[...T];Be[Ie].title=$e.target.value,P(Be)},className:"w-1/3"}),r.jsx(lt,{placeholder:"Canva share link",value:Me.canva_share_link,onChange:$e=>{const Be=[...T];Be[Ie].canva_share_link=$e.target.value,P(Be)},className:"flex-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>P(T.filter(($e,Be)=>Be!==Ie)),children:r.jsx(ds,{className:"h-4 w-4"})})]},Ie))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:_e,children:[r.jsx(_n,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),v.map((Me,Ie)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(lt,{placeholder:"Link title",value:Me.title,onChange:$e=>{const Be=[...v];Be[Ie].title=$e.target.value,b(Be)},className:"w-1/3"}),r.jsx(lt,{placeholder:"Google Drive URL",value:Me.drive_url,onChange:$e=>{const Be=[...v];Be[Ie].drive_url=$e.target.value,b(Be)},className:"flex-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(v.filter(($e,Be)=>Be!==Ie)),children:r.jsx(ds,{className:"h-4 w-4"})})]},Ie))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(lt,{type:"file",accept:".pdf",multiple:!0,onChange:Xe,className:"hidden",id:"pdf-upload"}),r.jsx(Q,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(bo,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),N.map((Me,Ie)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:Me.name}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>k(N.filter(($e,Be)=>Be!==Ie)),children:r.jsx(ds,{className:"h-4 w-4"})})]},`existing-${Ie}`)),U.map((Me,Ie)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(lt,{value:Me.name,onChange:$e=>{const Be=[...U];Be[Ie].name=$e.target.value,V(Be)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>V(U.filter(($e,Be)=>Be!==Ie)),children:r.jsx(ds,{className:"h-4 w-4"})})]},`pending-${Ie}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(Q,{type:"button",variant:"outline",size:"sm",onClick:we,children:[r.jsx(_n,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),M.map((Me,Ie)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(lt,{placeholder:"Video title",value:Me.title,onChange:$e=>{const Be=[...M];Be[Ie].title=$e.target.value,I(Be)},className:"w-1/3"}),r.jsx(lt,{placeholder:"Video URL",value:Me.video_url,onChange:$e=>{const Be=[...M];Be[Ie].video_url=$e.target.value,I(Be)},className:"flex-1"}),r.jsx(Q,{type:"button",variant:"ghost",size:"icon",onClick:()=>I(M.filter(($e,Be)=>Be!==Ie)),children:r.jsx(ds,{className:"h-4 w-4"})})]},Ie))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(Q,{variant:"outline",onClick:ue,children:"Cancel"}),r.jsx(Q,{onClick:Te,disabled:W||oe.isPending||pe.isPending,children:W?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:ae?r.jsx(Sr,{children:r.jsx(yt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(ee==null?void 0:ee.length)===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):ee==null?void 0:ee.map(Me=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Me.preview_image_url?r.jsx("img",{src:Me.preview_image_url,alt:Me.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(_a,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Me.title}),Me.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Me.description.replace(/<[^>]*>/g,"")})]})]})}),r.jsx(yt,{children:on(new Date(Me.publish_date),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Me.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:Me.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>se(Me),title:"Edit",children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>me(Me),title:"Duplicate",children:r.jsx(Po,{className:"h-4 w-4"})}),r.jsx(Q,{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(Me.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},Me.id))})]})})})]})})}const hCe={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 HCt(){const{user:e}=tn(),{toast:t}=fi(),n=Vn(),s=Vr(),[a,o]=A.useState(""),[l,i]=A.useState("popular"),[u,m]=A.useState(!1),[x,y]=A.useState(""),[v,b]=A.useState(""),[N,k]=A.useState(!1),{data:M=[],isLoading:I}=Zt({queryKey:["wishlist-items",l,N],queryFn:async()=>{let U=Y.from("wishlist_items").select("*");N&&e&&(U=U.eq("user_id",e.id)),l==="latest"?U=U.order("created_at",{ascending:!1}):l==="popular"?U=U.order("vote_count",{ascending:!1}):l==="trending"&&(U=U.order("vote_count",{ascending:!1}));const{data:V,error:W}=await U;if(W)throw W;const G=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:ee}=await Y.from("profiles").select("id, name").in("id",G),ae=new Map((ee==null?void 0:ee.map(se=>[se.id,se]))||[]);let oe=[];if(e){const{data:se}=await Y.from("wishlist_votes").select("item_id").eq("user_id",e.id);oe=(se==null?void 0:se.map(me=>me.item_id))||[]}const pe=(V==null?void 0:V.map(se=>se.id))||[],{data:ne}=await Y.from("wishlist_comments").select("item_id").in("item_id",pe),fe=new Map;return ne==null||ne.forEach(se=>{fe.set(se.item_id,(fe.get(se.item_id)||0)+1)}),V==null?void 0:V.map(se=>{const me=ae.get(se.user_id),ue=(me==null?void 0:me.name)||"Unknown";return{...se,user_name:ue,user_initials:ue.split(" ").map(xe=>xe[0]).join("").toUpperCase().slice(0,2),has_voted:oe.includes(se.id),comment_count:fe.get(se.id)||0}})}}),T=ar({mutationFn:async({title:U,description:V})=>{const{error:W}=await Y.from("wishlist_items").insert({user_id:e.id,title:U,description:V});if(W)throw W},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),m(!1),y(""),b(""),t({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:U=>{t({title:"Error",description:U.message,variant:"destructive"})}}),P=ar({mutationFn:async({itemId:U,hasVoted:V})=>{if(V){const{error:W}=await Y.from("wishlist_votes").delete().eq("item_id",U).eq("user_id",e.id);if(W)throw W;return{itemId:U,wasAdded:!1}}else{const{error:W}=await Y.from("wishlist_votes").insert({item_id:U,user_id:e.id});if(W)throw W;return{itemId:U,wasAdded:!0}}},onSuccess:async U=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),U!=null&&U.wasAdded){const V=M.find(G=>G.id===U.itemId),W=((V==null?void 0:V.vote_count)||0)+1;Y.functions.invoke("wishlist-notify",{body:{itemId:U.itemId,voteCount:W}}).catch(console.error)}},onError:U=>{t({title:"Error",description:U.message,variant:"destructive"})}}),F=M.filter(U=>U.title.toLowerCase().includes(a.toLowerCase())||U.description.toLowerCase().includes(a.toLowerCase())),D=()=>{if(!x.trim()||!v.trim()){t({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}T.mutate({title:x.trim(),description:v.trim()})};return r.jsx(Fr,{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(Rr,{open:u,onOpenChange:m,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{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(ze,{htmlFor:"title",children:"Title"}),r.jsx(lt,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:U=>y(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:v,onChange:U=>b(U.target.value),rows:4})]}),r.jsx(Q,{onClick:D,className:"w-full",disabled:T.isPending,children:T.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search ideas...",value:a,onChange:U=>o(U.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(wi,{value:l,onValueChange:U=>i(U),children:r.jsxs(_i,{children:[r.jsx(sn,{value:"popular",children:"Most Popular"}),r.jsx(sn,{value:"latest",children:"Latest"}),r.jsx(sn,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(Q,{variant:N?"default":"outline",size:"sm",onClick:()=>k(!N),children:N?"Show All Ideas":"My Ideas"})}),I?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):F.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(Q,{onClick:()=>m(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:F.map(U=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${U.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:V=>{V.stopPropagation(),P.mutate({itemId:U.id,hasVoted:U.has_voted||!1})},className:Ut("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",U.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(df,{className:Ut("h-4 w-4",U.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:U.vote_count})]}),r.jsx(ea,{className:"h-10 w-10 bg-primary/20",children:r.jsx(ta,{className:"bg-primary/20 text-primary text-sm font-medium",children:U.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:U.title}),r.jsx(At,{className:Ut("text-xs",hCe[U.status].color),children:hCe[U.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:U.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:U.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(U.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ro,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:U.comment_count})]})]})},U.id))})]})})}const mCe={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 WCt(){const{itemId:e}=Ec(),t=Vn(),{user:n}=tn(),{toast:s}=fi(),a=Vr(),[o,l]=A.useState(""),{data:i=!1}=Zt({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:M,error:I}=await Y.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!I&&!!M},enabled:!!n}),{data:u,isLoading:m}=Zt({queryKey:["wishlist-item",e],queryFn:async()=>{const{data:M,error:I}=await Y.from("wishlist_items").select("*").eq("id",e).single();if(I)throw I;const{data:T}=await Y.from("profiles").select("name").eq("id",M.user_id).single();let P=!1;if(n){const{data:F}=await Y.from("wishlist_votes").select("id").eq("item_id",e).eq("user_id",n.id).maybeSingle();P=!!F}return{...M,user_name:(T==null?void 0:T.name)||"Unknown",user_initials:((T==null?void 0:T.name)||"U").split(" ").map(F=>F[0]).join("").toUpperCase().slice(0,2),has_voted:P}}}),{data:x=[],isLoading:y}=Zt({queryKey:["wishlist-comments",e],queryFn:async()=>{const{data:M,error:I}=await Y.from("wishlist_comments").select("*").eq("item_id",e).order("created_at",{ascending:!0});if(I)throw I;const T=[...new Set((M==null?void 0:M.map(D=>D.user_id))||[])],{data:P}=await Y.from("profiles").select("id, name").in("id",T),F=new Map((P==null?void 0:P.map(D=>[D.id,D]))||[]);return M==null?void 0:M.map(D=>{const U=F.get(D.user_id),V=(U==null?void 0:U.name)||"Unknown";return{...D,user_name:V,user_initials:V.split(" ").map(W=>W[0]).join("").toUpperCase().slice(0,2)}})}}),v=ar({mutationFn:async M=>{if(M){const{error:I}=await Y.from("wishlist_votes").delete().eq("item_id",e).eq("user_id",n.id);if(I)throw I;return{wasAdded:!1}}else{const{error:I}=await Y.from("wishlist_votes").insert({item_id:e,user_id:n.id});if(I)throw I;return{wasAdded:!0}}},onSuccess:async M=>{if(a.invalidateQueries({queryKey:["wishlist-item",e]}),a.invalidateQueries({queryKey:["wishlist-items"]}),M!=null&&M.wasAdded&&u){const I=(u.vote_count||0)+1;Y.functions.invoke("wishlist-notify",{body:{itemId:e,voteCount:I}}).catch(console.error)}},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),b=ar({mutationFn:async M=>{const{error:I}=await Y.from("wishlist_comments").insert({item_id:e,user_id:n.id,content:M});if(I)throw I},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",e]}),l(""),s({title:"Comment added!"})},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),N=ar({mutationFn:async M=>{const{error:I}=await Y.from("wishlist_comments").delete().eq("id",M);if(I)throw I},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",e]}),s({title:"Comment deleted"})},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),k=()=>{o.trim()&&b.mutate(o.trim())};return m?r.jsx(Fr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Er,{className:"h-8 w-32 mb-6"}),r.jsx(Er,{className:"h-48 w-full mb-6"}),r.jsx(Er,{className:"h-32 w-full"})]})}):u?r.jsx(Fr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>t("/wishlist"),className:"mb-4",children:[r.jsx(Wi,{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:()=>v.mutate(u.has_voted),className:Ut("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",u.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(df,{className:Ut("h-5 w-5",u.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:u.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:u.title}),r.jsx(At,{className:Ut("text-xs",mCe[u.status].color),children:mCe[u.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:u.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(ea,{className:"h-6 w-6",children:r.jsx(ta,{className:"bg-primary/20 text-primary text-xs",children:u.user_initials})}),r.jsx("span",{children:u.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(u.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(Zre,{placeholder:i?"Share your thoughts... Use # to link templates":"Share your thoughts on this idea...",value:o,onChange:l,minHeight:"60px",mentionFormat:"encoded",enableTemplateMentions:i}),r.jsx(Q,{onClick:k,disabled:!o.trim()||b.isPending,size:"icon",className:"h-auto",children:b.isPending?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ji,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(M=>r.jsx(Er,{className:"h-20 w-full"},M))}):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(M=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(ea,{className:"h-8 w-8",children:r.jsx(ta,{className:"bg-primary/20 text-primary text-xs",children:M.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:M.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(M.created_at).toLocaleDateString()})]}),r.jsx(z0e,{content:M.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===M.user_id&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>N.mutate(M.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]},M.id))})]})]})}):r.jsx(Fr,{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(Q,{variant:"link",onClick:()=>t("/wishlist"),children:"Go back to Wishlist"})]})})}const fCe={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"}},pCe=["open","under_review","planned","in_progress","launched","declined"];function GCt(){const{toast:e}=fi(),t=Vn(),n=Vr(),[s,a]=A.useState(""),[o,l]=A.useState("all"),[i,u]=A.useState(!1),[m,x]=A.useState(null),{data:y=[],isLoading:v}=Zt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:I,error:T}=await Y.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(T)throw T;const P=[...new Set((I==null?void 0:I.map(G=>G.user_id))||[])],{data:F}=await Y.from("profiles").select("id, name, email").in("id",P),D=new Map((F==null?void 0:F.map(G=>[G.id,G]))||[]),U=(I==null?void 0:I.map(G=>G.id))||[],{data:V}=await Y.from("wishlist_comments").select("item_id").in("item_id",U),W=new Map;return V==null||V.forEach(G=>{W.set(G.item_id,(W.get(G.item_id)||0)+1)}),I==null?void 0:I.map(G=>{const ee=D.get(G.user_id);return{...G,user_name:(ee==null?void 0:ee.name)||"Unknown",user_email:(ee==null?void 0:ee.email)||"",comment_count:W.get(G.id)||0}})}}),b=ar({mutationFn:async({itemId:I,status:T})=>{const{error:P}=await Y.from("wishlist_items").update({status:T}).eq("id",I);if(P)throw P},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),e({title:"Status updated!"})},onError:I=>{e({title:"Error",description:I.message,variant:"destructive"})}}),N=ar({mutationFn:async I=>{const{error:T}=await Y.from("wishlist_items").delete().eq("id",I);if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),u(!1),x(null),e({title:"Item deleted!"})},onError:I=>{e({title:"Error",description:I.message,variant:"destructive"})}}),k=y.filter(I=>{const T=I.title.toLowerCase().includes(s.toLowerCase())||I.description.toLowerCase().includes(s.toLowerCase())||I.user_name.toLowerCase().includes(s.toLowerCase()),P=o==="all"||I.status===o;return T&&P}),M={total:y.length,open:y.filter(I=>I.status==="open").length,inProgress:y.filter(I=>I.status==="in_progress").length,launched:y.filter(I=>I.status==="launched").length,highVotes:y.filter(I=>I.vote_count>=10).length};return r.jsx(Fr,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>t("/admin"),children:r.jsx(Wi,{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:M.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:M.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:M.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:M.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:M.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search ideas, users...",value:s,onChange:I=>a(I.target.value),className:"pl-10"})]}),r.jsxs(un,{value:o,onValueChange:I=>l(I),children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{placeholder:"Filter by status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),pCe.map(I=>r.jsx($t,{value:I,children:fCe[I].label},I))]})]})]}),v?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(I=>r.jsx(Er,{className:"h-16 w-full"},I))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-[60px]",children:"Votes"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(Mt,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Fs,{children:k.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):k.map(I=>r.jsxs(Sr,{className:Ut(I.vote_count>=10&&"bg-primary/5"),children:[r.jsx(yt,{children:r.jsx(At,{variant:I.vote_count>=10?"default":"secondary",children:I.vote_count})}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:I.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:I.description})]})}),r.jsx(yt,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:I.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:I.user_email})]})}),r.jsx(yt,{className:"hidden sm:table-cell",children:I.comment_count}),r.jsx(yt,{children:r.jsxs(un,{value:I.status,onValueChange:T=>b.mutate({itemId:I.id,status:T}),children:[r.jsx(ln,{className:"w-[140px] h-8",children:r.jsx(mn,{})}),r.jsx(cn,{children:pCe.map(T=>r.jsx($t,{value:T,children:fCe[T].label},T))})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${I.id}`,"_blank"),children:r.jsx(Ss,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(I.id),u(!0)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},I.id))})]})}),r.jsx(Rr,{open:i,onOpenChange:u,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{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(Q,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(Q,{variant:"destructive",onClick:()=>m&&N.mutate(m),disabled:N.isPending,children:N.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function KCt(){const{user:e}=tn(),[t,n]=A.useState([]),[s,a]=A.useState(!0),[o,l]=A.useState(!1),[i,u]=A.useState(null),[m,x]=A.useState(!1),[y,v]=A.useState(null),[b,N]=A.useState(""),[k,M]=A.useState(""),[I,T]=A.useState(""),[P,F]=A.useState(""),[D,U]=A.useState(""),[V,W]=A.useState(!1),[G,ee]=A.useState(""),[ae,oe]=A.useState("once"),[pe,ne]=A.useState([]),[fe,se]=A.useState([]),[me,ue]=A.useState(!1),[xe,Te]=A.useState(!1),[_e,we]=A.useState([]),[ve,Xe]=A.useState({total:0,dismissed:0});A.useEffect(()=>{Me()},[]);const Me=async()=>{const{data:Le,error:Ke}=await Y.from("levelup_briefs").select("*").order("created_at",{ascending:!1});Ke?(Ae.error("Failed to fetch briefs"),console.error(Ke)):n(Le||[]),a(!1)},Ie=()=>{N(""),M(""),T(""),F(""),U(""),W(!1),ee(new Date().toISOString().slice(0,16)),oe("once"),ne([]),se([]),u(null)},$e=()=>{Ie(),l(!0)},Be=async Le=>{u(Le),N(Le.title),M(Le.description||""),T(Le.video_url||""),F(Le.graphic_url||""),U(Le.graphic_link_url||""),W(Le.is_published),ee(Le.publish_date.slice(0,16)),oe(Le.show_frequency);const{data:Ke}=await Y.from("levelup_brief_links").select("*").eq("brief_id",Le.id).order("sort_order");ne((Ke==null?void 0:Ke.map(ct=>({title:ct.title,url:ct.url})))||[]);const{data:tt}=await Y.from("levelup_brief_polls").select("*").eq("brief_id",Le.id).order("sort_order");if(tt){const ct=[];for(const it of tt){const{data:zt}=await Y.from("levelup_brief_poll_options").select("*").eq("poll_id",it.id).order("sort_order");ct.push({question:it.question,poll_type:it.poll_type,options:(zt==null?void 0:zt.map(Lt=>Lt.option_text))||[]})}se(ct)}l(!0)},Ve=async Le=>{var tt;const Ke=(tt=Le.target.files)==null?void 0:tt[0];if(Ke){ue(!0);try{const ct=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:Ke.name.replace(/\.[^/.]+$/,"")}});if(ct.error)throw ct.error;const{videoId:it,libraryId:zt}=ct.data,Lt=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:it}});if(Lt.error)throw Lt.error;const{uploadUrl:lr,apiKey:Ar}=Lt.data,Mr=new XMLHttpRequest;await new Promise((Xn,dr)=>{Mr.upload.addEventListener("progress",En=>{if(En.lengthComputable){const Es=Math.round(En.loaded/En.total*100);console.log("Upload progress:",Es)}}),Mr.addEventListener("load",()=>{Mr.status>=200&&Mr.status<300?Xn():dr(new Error(`Upload failed with status ${Mr.status}`))}),Mr.addEventListener("error",()=>dr(new Error("Upload failed"))),Mr.open("PUT",lr),Mr.setRequestHeader("AccessKey",Ar),Mr.send(Ke)});const Zr=`https://player.mediadelivery.net/embed/${zt}/${it}`;T(Zr),Ae.success("Video uploaded successfully! It may take a few minutes to process.")}catch(ct){console.error("Upload error:",ct),Ae.error("Failed to upload video")}finally{ue(!1)}}},ot=async()=>{if(!b.trim()){Ae.error("Title is required");return}try{let Le;if(i){const{error:Ke}=await Y.from("levelup_briefs").update({title:b,description:k||null,video_url:I||null,graphic_url:P||null,graphic_link_url:D||null,is_published:V,publish_date:G,show_frequency:ae}).eq("id",i.id);if(Ke)throw Ke;Le=i.id,await Y.from("levelup_brief_links").delete().eq("brief_id",Le);const{data:tt}=await Y.from("levelup_brief_polls").select("id").eq("brief_id",Le);if(tt)for(const ct of tt)await Y.from("levelup_brief_poll_options").delete().eq("poll_id",ct.id);await Y.from("levelup_brief_polls").delete().eq("brief_id",Le)}else{const{data:Ke,error:tt}=await Y.from("levelup_briefs").insert({title:b,description:k||null,video_url:I||null,graphic_url:P||null,graphic_link_url:D||null,is_published:V,publish_date:G,show_frequency:ae,created_by:e==null?void 0:e.id}).select().single();if(tt)throw tt;Le=Ke.id}if(pe.length>0){const Ke=pe.map((tt,ct)=>({brief_id:Le,title:tt.title,url:tt.url,sort_order:ct}));await Y.from("levelup_brief_links").insert(Ke)}for(let Ke=0;Ke0){const zt=tt.options.map((Lt,lr)=>({poll_id:ct.id,option_text:Lt,sort_order:lr}));await Y.from("levelup_brief_poll_options").insert(zt)}}Ae.success(i?"Brief updated":"Brief created"),l(!1),Ie(),Me()}catch(Le){console.error("Error saving brief:",Le),Ae.error("Failed to save brief")}},Tt=async Le=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:Ke}=await Y.from("levelup_briefs").delete().eq("id",Le);if(Ke)throw Ke;Ae.success("Brief deleted"),Me()}catch(Ke){console.error("Error deleting brief:",Ke),Ae.error("Failed to delete brief")}},Oe=async Le=>{v(Le);const{count:Ke}=await Y.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Le.id),{count:tt}=await Y.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Le.id).not("dismissed_at","is",null);Xe({total:Ke||0,dismissed:tt||0});const{data:ct}=await Y.from("levelup_brief_polls").select("*").eq("brief_id",Le.id).order("sort_order");if(ct){const it=[];for(const zt of ct){const{data:Lt}=await Y.from("levelup_brief_poll_options").select("*").eq("poll_id",zt.id).order("sort_order"),{data:lr}=await Y.from("levelup_brief_poll_responses").select("option_id, user_id").eq("poll_id",zt.id),Ar=[...new Set((lr==null?void 0:lr.map(En=>En.user_id))||[])];let Mr={};if(Ar.length>0){const{data:En}=await Y.from("profiles").select("id, name, email").in("id",Ar);En&&En.forEach(Es=>{Mr[Es.id]=Es.name||Es.email||"Unknown"})}const Zr=(lr||[]).map(En=>({optionId:En.option_id,userName:Mr[En.user_id]||"Unknown",userId:En.user_id})),Xn={};let dr=0;Lt&&Lt.forEach(En=>{const Es=(lr==null?void 0:lr.filter(Hs=>Hs.option_id===En.id).length)||0;Xn[En.id]=Es,dr+=Es}),it.push({...zt,options:Lt||[],results:Xn,respondents:Zr,totalResponses:zt.poll_type==="single"?new Set(lr==null?void 0:lr.map(En=>En.user_id)).size:dr})}we(it)}x(!0)},at=()=>{ne([...pe,{title:"",url:""}])},le=(Le,Ke,tt)=>{const ct=[...pe];ct[Le][Ke]=tt,ne(ct)},qe=Le=>{ne(pe.filter((Ke,tt)=>tt!==Le))},Je=()=>{se([...fe,{question:"",poll_type:"single",options:["",""]}])},st=(Le,Ke)=>{const tt=[...fe];tt[Le].question=Ke,se(tt)},je=(Le,Ke)=>{const tt=[...fe];tt[Le].poll_type=Ke,se(tt)},ut=Le=>{const Ke=[...fe];Ke[Le].options.push(""),se(Ke)},Ce=(Le,Ke,tt)=>{const ct=[...fe];ct[Le].options[Ke]=tt,se(ct)},Ee=(Le,Ke)=>{const tt=[...fe];tt[Le].options=tt[Le].options.filter((ct,it)=>it!==Ke),se(tt)},Ze=Le=>{se(fe.filter((Ke,tt)=>tt!==Le))};return r.jsxs(Fr,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(Q,{onClick:$e,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Frequency"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:s?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):t.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):t.map(Le=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:Le.title}),r.jsx(yt,{children:r.jsx(At,{variant:Le.is_published?"default":"secondary",children:Le.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"capitalize",children:Le.show_frequency.replace("_"," ")}),r.jsx(yt,{children:on(new Date(Le.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Oe(Le),children:r.jsx(_c,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Be(Le),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Tt(Le.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},Le.id))})]})})})]}),r.jsx(Rr,{open:o,onOpenChange:l,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:i?"Edit Brief":"Create New Brief"})}),r.jsxs(wi,{defaultValue:"content",className:"w-full",children:[r.jsxs(_i,{className:"grid w-full grid-cols-4",children:[r.jsx(sn,{value:"content",children:"Content"}),r.jsx(sn,{value:"media",children:"Media"}),r.jsx(sn,{value:"links",children:"Links"}),r.jsx(sn,{value:"polls",children:"Polls"})]}),r.jsxs(Sn,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Title *"}),r.jsx(lt,{value:b,onChange:Le=>N(Le.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:k,onChange:Le=>M(Le),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(ze,{children:"Publish Date"}),r.jsx(lt,{type:"datetime-local",value:G,onChange:Le=>ee(Le.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Show Frequency"}),r.jsxs(un,{value:ae,onValueChange:oe,children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"once",children:"Once (until dismissed)"}),r.jsx($t,{value:"every_login",children:"Every login"}),r.jsx($t,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(As,{checked:V,onCheckedChange:W}),r.jsx(ze,{children:"Publish immediately"})]})]}),r.jsxs(Sn,{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(ze,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(lt,{type:"file",accept:"video/*",onChange:Ve,disabled:me})}),me&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Or paste embed URL"}),r.jsx(lt,{value:I,onChange:Le=>T(Le.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),I&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:I,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(ze,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(lt,{type:"file",accept:"image/*",onChange:async Le=>{var tt;const Ke=(tt=Le.target.files)==null?void 0:tt[0];if(Ke){Te(!0);try{const ct=Ke.name.split(".").pop(),it=`brief-graphics/${Date.now()}.${ct}`,{error:zt}=await Y.storage.from("banner-images").upload(it,Ke,{upsert:!0});if(zt)throw zt;const{data:Lt}=Y.storage.from("banner-images").getPublicUrl(it);F(Lt.publicUrl),Ae.success("Image uploaded!")}catch(ct){console.error(ct),Ae.error("Failed to upload image")}finally{Te(!1)}}},disabled:xe})}),xe&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Or paste Image URL"}),r.jsx(lt,{value:P,onChange:Le=>F(Le.target.value),placeholder:"https://example.com/image.png"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Click-through Link (optional)"}),r.jsx(lt,{value:D,onChange:Le=>U(Le.target.value),placeholder:"https://example.com/landing-page"})]}),P&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted border",children:r.jsx("img",{src:P,alt:"Brief graphic preview",className:"w-full object-contain max-h-64"})})]})]}),r.jsxs(Sn,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ze,{children:"Quick Links"}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:at,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),pe.map((Le,Ke)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(lt,{value:Le.title,onChange:tt=>le(Ke,"title",tt.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(lt,{value:Le.url,onChange:tt=>le(Ke,"url",tt.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>qe(Ke),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]},Ke)),pe.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(Sn,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(ze,{children:"Polls"}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:Je,children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),fe.map((Le,Ke)=>r.jsx(He,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(lt,{value:Le.question,onChange:tt=>st(Ke,tt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(un,{value:Le.poll_type,onValueChange:tt=>je(Ke,tt),children:[r.jsx(ln,{className:"w-32",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"single",children:"Single"}),r.jsx($t,{value:"multi",children:"Multi-select"})]})]}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Ze(Ke),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[Le.options.map((tt,ct)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:tt,onChange:it=>Ce(Ke,ct,it.target.value),placeholder:`Option ${ct+1}`}),Le.options.length>2&&r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Ee(Ke,ct),children:r.jsx(Bn,{className:"h-4 w-4 text-muted-foreground"})})]},ct)),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>ut(Ke),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},Ke)),fe.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(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(Q,{onClick:ot,children:i?"Update Brief":"Create Brief"})]})]})}),r.jsx(Rr,{open:m,onOpenChange:x,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Br,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:ve.total})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:ve.dismissed})})]})]}),_e.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),_e.map(Le=>r.jsxs(He,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:Le.question}),r.jsx("div",{className:"space-y-2",children:Le.options.map(Ke=>{const tt=Le.results[Ke.id]||0,ct=Le.totalResponses>0?Math.round(tt/Le.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:Ke.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[tt," (",ct,"%)"]})]}),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:`${ct}%`}})}),tt>0&&r.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:(Le.respondents||[]).filter(it=>it.optionId===Ke.id).map((it,zt)=>r.jsx(At,{variant:"secondary",className:"text-xs font-normal",children:it.userName},zt))})]},Ke.id)})})]},Le.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const ZCt=()=>{const{user:e}=tn(),{toast:t}=fi(),n=Vr(),[s,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[m,x]=A.useState(null),[y,v]=A.useState(""),{data:b=[],isLoading:N}=Zt({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:D,error:U}=await Y.from("additional_services").select("*").order("publish_date",{ascending:!1});if(U)throw U;return D}}),k=ar({mutationFn:async D=>{let U=D.existingImageUrl;if(D.image){const W=D.image.name.split(".").pop(),G=`${Date.now()}-${Math.random().toString(36).substring(7)}.${W}`,{error:ee}=await Y.storage.from("service-images").upload(G,D.image);if(ee)throw ee;const{data:ae}=Y.storage.from("service-images").getPublicUrl(G);U=ae.publicUrl}const V={name:D.item.name,description:D.item.description||null,preview_image_url:U,signup_link_url:D.item.signup_link_url,publish_date:D.item.publish_date?new Date(D.item.publish_date).toISOString():new Date().toISOString(),is_published:D.item.is_published,created_by:e==null?void 0:e.id};if(D.itemId){const{error:W}=await Y.from("additional_services").update(V).eq("id",D.itemId);if(W)throw W}else{const{error:W}=await Y.from("additional_services").insert(V);if(W)throw W}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:o?"Service updated":"Service created"}),a(!1),I()},onError:D=>{t({title:"Error saving service",description:D.message,variant:"destructive"})}}),M=ar({mutationFn:async D=>{const{error:U}=await Y.from("additional_services").delete().eq("id",D);if(U)throw U},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:"Service deleted"})},onError:D=>{t({title:"Error deleting service",description:D.message,variant:"destructive"})}}),I=()=>{u({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),v(""),l(null)},T=D=>{l(D),u({name:D.name,description:D.description||"",signup_link_url:D.signup_link_url,publish_date:D.publish_date?new Date(D.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:D.is_published}),v(D.preview_image_url||""),a(!0)},P=D=>{var V;const U=(V=D.target.files)==null?void 0:V[0];U&&(x(U),v(URL.createObjectURL(U)))},F=D=>{if(D.preventDefault(),!i.name.trim()){t({title:"Name is required",variant:"destructive"});return}if(!i.signup_link_url.trim()){t({title:"Signup link URL is required",variant:"destructive"});return}k.mutate({item:i,image:m,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Fr,{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(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(D=>D.is_published).length})})]})]}),r.jsxs(Rr,{open:s,onOpenChange:D=>{a(D),D||I()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:F,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name *"}),r.jsx(lt,{id:"name",value:i.name,onChange:D=>u({...i,name:D.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Hp,{content:i.description,onChange:D=>u({...i,description:D}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(lt,{id:"signup_link_url",type:"url",value:i.signup_link_url,onChange:D=>u({...i,signup_link_url:D.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(lt,{id:"publish_date",type:"date",value:i.publish_date,onChange:D=>u({...i,publish_date:D.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(As,{id:"is_published",checked:i.is_published,onCheckedChange:D=>u({...i,is_published:D})}),r.jsx(ze,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{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(Q,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),v("")},children:r.jsx(ds,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Fl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(lt,{type:"file",accept:"image/*",onChange:P,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:k.isPending,children:k.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(He,{children:r.jsx(et,{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"})}):b.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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-16",children:"Preview"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Signup Link"}),r.jsx(Mt,{children:"Publish Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:b.map(D=>r.jsxs(Sr,{children:[r.jsx(yt,{children:D.preview_image_url?r.jsx("img",{src:D.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(Fl,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(yt,{className:"font-medium",children:D.name}),r.jsx(yt,{children:r.jsxs("a",{href:D.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Ss,{className:"h-3 w-3"}),"Link"]})}),r.jsx(yt,{children:new Date(D.publish_date).toLocaleDateString()}),r.jsx(yt,{children:r.jsx(At,{variant:D.is_published?"default":"secondary",children:D.is_published?"Published":"Draft"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>T(D),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&M.mutate(D.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},D.id))})]})})})]})})};function YCt(){const{toast:e}=fi(),[t,n]=A.useState([]),[s,a]=A.useState(!0),[o,l]=A.useState(!1),[i,u]=A.useState(!1),[m,x]=A.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});A.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:M,error:I}=await Y.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(I)throw I;n(M.coupons||[])}catch(M){console.error("Error fetching coupons:",M),e({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{a(!1)}},v=async()=>{if(!m.name){e({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(m.discountType==="percent"&&!m.percentOff){e({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(m.discountType==="amount"&&!m.amountOff){e({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(m.duration==="repeating"&&!m.durationInMonths){e({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}l(!0);try{const M={action:"create",name:m.name,duration:m.duration,promotion_code:m.promotionCode.trim()||void 0};m.discountType==="percent"?M.percent_off=parseFloat(m.percentOff):(M.amount_off=Math.round(parseFloat(m.amountOff)*100),M.currency="usd"),m.duration==="repeating"&&(M.duration_in_months=parseInt(m.durationInMonths));const{data:I,error:T}=await Y.functions.invoke("stripe-manage-coupons",{body:M});if(T)throw T;e({title:"Success",description:"Coupon created successfully"}),u(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(M){console.error("Error creating coupon:",M),e({title:"Error",description:M.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},b=async M=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:I}=await Y.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:M}});if(I)throw I;e({title:"Success",description:"Coupon deleted successfully"}),y()}catch(I){console.error("Error deleting coupon:",I),e({title:"Error",description:I.message||"Failed to delete coupon",variant:"destructive"})}},N=M=>M.percent_off?`${M.percent_off}% off`:M.amount_off?`$${(M.amount_off/100).toFixed(2)} off`:"N/A",k=M=>{switch(M.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${M.duration_in_months} months`;default:return M.duration}};return r.jsx(Fr,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Rr,{open:i,onOpenChange:u,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{children:[r.jsx(_n,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Create New Coupon"}),r.jsx(Yn,{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(ze,{children:"Promotion Code (what users will type)"}),r.jsx(lt,{placeholder:"e.g., BROKERAGE50",value:m.promotionCode,onChange:M=>x({...m,promotionCode:M.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(ze,{children:"Coupon Name (internal label)"}),r.jsx(lt,{placeholder:"e.g., 50% Off Brokerage Launch",value:m.name,onChange:M=>x({...m,name:M.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Discount Type"}),r.jsxs(un,{value:m.discountType,onValueChange:M=>{const I=M==="amount"&&m.duration==="forever"?"once":m.duration;x({...m,discountType:M,duration:I})},children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(P4,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx($t,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(Fd,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),m.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(lt,{type:"number",min:"1",max:"100",placeholder:"20",value:m.percentOff,onChange:M=>x({...m,percentOff:M.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(ze,{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(lt,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:m.amountOff,onChange:M=>x({...m,amountOff:M.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Duration"}),r.jsxs(un,{value:m.duration,onValueChange:M=>x({...m,duration:M}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"once",children:"Once (first payment only)"}),r.jsx($t,{value:"repeating",children:"Multiple months"}),r.jsxs($t,{value:"forever",disabled:m.discountType==="amount",children:["Forever ",m.discountType==="amount"&&"(% discounts only)"]})]})]}),m.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),m.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Number of Months"}),r.jsx(lt,{type:"number",min:"1",placeholder:"3",value:m.durationInMonths,onChange:M=>x({...m,durationInMonths:M.target.value})})]}),r.jsx(Q,{onClick:v,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Active Coupons"}),r.jsx(jn,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(et,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gr,{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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Promo Code"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Discount"}),r.jsx(Mt,{children:"Duration"}),r.jsx(Mt,{children:"Redemptions"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:t.map(M=>{var I;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-mono font-medium",children:((I=M.promotion_codes)==null?void 0:I.length)>0?M.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(yt,{children:M.name||"-"}),r.jsx(yt,{children:N(M)}),r.jsx(yt,{children:k(M)}),r.jsx(yt,{children:M.times_redeemed}),r.jsx(yt,{children:r.jsx(At,{variant:M.valid?"default":"secondary",children:M.valid?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>b(M.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})})]},M.id)})})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"How to Use Coupons"})}),r.jsxs(et,{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 Ode={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 XCt(){const[e,t]=A.useState(""),[n,s]=A.useState("all"),[a,o]=A.useState(null),{data:l,isLoading:i,refetch:u}=Zt({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:N,error:k}=await Y.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(k)throw k;return N}}),{data:m}=Zt({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:N,error:k}=await Y.from("brokerages").select("*").order("name");if(k)throw k;return await Promise.all((N||[]).map(async I=>{const{data:T}=await Y.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",I.id),{data:P}=await Y.from("user_roles").select("user_id").eq("role","brokerage_manager"),F=(P==null?void 0:P.map(V=>V.user_id))||[],D=(T==null?void 0:T.filter(V=>F.includes(V.id)))||[],U=(T==null?void 0:T.length)||0;return{...I,managers:D,agentCount:U}}))}}),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 k=Ode[N.subscription_product_id];return{status:(k==null?void 0:k.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 M,I;if(!(((M=N.name)==null?void 0:M.toLowerCase().includes(e.toLowerCase()))||((I=N.email)==null?void 0:I.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}}),v={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},b=N=>{window.open(`https://dashboard.stripe.com/customers/${N}`,"_blank")};return r.jsx(Fr,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(Q,{onClick:()=>u(),variant:"outline",size:"sm",children:[r.jsx(Go,{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(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($n,{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:v.totalUsers})]})}),r.jsx(He,{className:"border-green-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(uf,{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:v.activeSubscriptions})]})}),r.jsx(He,{className:"border-blue-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xa,{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:v.trials})]})}),r.jsx(He,{className:"border-purple-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(U1,{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:v.grandfathered})]})}),r.jsx(He,{className:"border-orange-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{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:v.brokerageMembers})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Vj,{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:v.individualSubscribers})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{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:v.brokerageSubscribers})]})})]}),r.jsxs(wi,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"users",children:"All Users"}),r.jsx(sn,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(Sn,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name or email...",value:e,onChange:N=>t(N.target.value),className:"pl-9"})]}),r.jsxs(un,{value:n,onValueChange:N=>s(N),children:[r.jsx(ln,{className:"w-[200px]",children:r.jsx(mn,{placeholder:"Filter by status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Users"}),r.jsx($t,{value:"active",children:"Active Subscriptions"}),r.jsx($t,{value:"trialing",children:"Trials"}),r.jsx($t,{value:"grandfathered",children:"Grandfathered"}),r.jsx($t,{value:"brokerage",children:"Brokerage Members"}),r.jsx($t,{value:"expired",children:"Expired/Canceled"}),r.jsx($t,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"User"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Plan"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(Mt,{children:"End Date"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:i?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(N=>{var I,T;const k=x(N),M=Ode[N.subscription_product_id];return r.jsxs(Sr,{children:[r.jsx(yt,{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(yt,{children:r.jsx(At,{variant:k.variant,children:k.badge})}),r.jsx(yt,{children:r.jsx("span",{className:"text-sm",children:N.is_grandfathered?"Legacy Access":N.brokerage_id&&!N.subscription_product_id?"Brokerage Subscription":(M==null?void 0:M.name)||k.status})}),r.jsx(yt,{children:(I=N.brokerages)!=null&&I.name?r.jsx("span",{className:"text-sm",children:N.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(yt,{children:N.subscription_end_date?r.jsx("span",{className:"text-sm",children:on(new Date(N.subscription_end_date),"MMM d, yyyy")}):N.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",on(new Date(N.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[N.stripe_customer_id&&r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>b(N.stripe_customer_id),children:r.jsx(Ss,{className:"h-4 w-4"})}),r.jsxs(Rr,{children:[r.jsx(Fo,{asChild:!0,children:r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>o(N),children:"Details"})}),r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Subscription Details"}),r.jsxs(Yn,{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(At,{variant:k.variant,className:"mt-1",children:k.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":(M==null?void 0:M.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:on(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:on(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(Q,{className:"w-full",onClick:()=>b(N.stripe_customer_id),children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},N.id)})})]})})})]}),r.jsx(Sn,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:m==null?void 0:m.map(N=>{var M,I;const k=(M=N.managers)==null?void 0:M.some(T=>T.subscription_status==="active"&&(T.subscription_product_id==="prod_Tc08MupgoVySDG"||T.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(He,{children:[r.jsx(Ht,{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(hi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:N.name}),r.jsxs(jn,{children:[N.agentCount," agents"]})]})]}),r.jsx(At,{variant:k?"default":"outline",children:k?"Active Subscription":"No Active Subscription"})]})}),r.jsx(et,{children:((I=N.managers)==null?void 0:I.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 P=Ode[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:P?r.jsxs("div",{children:[r.jsx(At,{variant:"default",children:P.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:P.price})]}):r.jsx(At,{variant:"outline",children:"No Subscription"})})]},T.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},N.id)})})})]})]})})}function QCt(){const[e,t]=A.useState([]),[n,s]=A.useState(!0),[a,o]=A.useState(""),[l,i]=A.useState("all"),[u,m]=A.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});A.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:N,error:k}=await Y.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(k)throw k;t(N||[]);const M=(N==null?void 0:N.filter(P=>P.status==="qualified").length)||0,I=(N==null?void 0:N.filter(P=>P.status==="pending").length)||0,T=(N==null?void 0:N.filter(P=>P.status==="cancelled").length)||0;m({total:(N==null?void 0:N.length)||0,qualified:M,pending:I,cancelled:T,totalDiscounts:M*25})}catch(N){console.error("Error fetching referrals:",N),Ae.error("Failed to load referrals")}finally{s(!1)}},y=async()=>{try{Ae.loading("Processing qualifications...");const{error:N}=await Y.functions.invoke("process-referral-qualifications");if(N)throw N;Ae.dismiss(),Ae.success("Qualifications processed successfully"),x()}catch(N){Ae.dismiss(),console.error("Error processing qualifications:",N),Ae.error("Failed to process qualifications")}},v=e.filter(N=>{var I,T,P,F,D,U;const k=((T=(I=N.referrer_brokerage)==null?void 0:I.name)==null?void 0:T.toLowerCase().includes(a.toLowerCase()))||((F=(P=N.referred_brokerage)==null?void 0:P.name)==null?void 0:F.toLowerCase().includes(a.toLowerCase()))||((U=(D=N.referred_user)==null?void 0:D.email)==null?void 0:U.toLowerCase().includes(a.toLowerCase())),M=l==="all"||N.status===l;return k&&M}),b=N=>{switch(N){case"qualified":return r.jsxs(At,{className:"bg-green-100 text-green-800",children:[r.jsx(oi,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(At,{variant:"secondary",children:[r.jsx(Xa,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(At,{variant:"destructive",children:[r.jsx(bc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(At,{children:N})}};return r.jsx(Fr,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(Q,{onClick:y,variant:"outline",children:[r.jsx(Go,{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(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oi,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xa,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(He,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Fd,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",u.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"All Referrals"}),r.jsx(jn,{children:"View and manage all referral relationships"})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by brokerage or email...",value:a,onChange:N=>o(N.target.value),className:"pl-10"})]}),r.jsxs(un,{value:l,onValueChange:i,children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{placeholder:"Filter by status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),r.jsx($t,{value:"pending",children:"Pending"}),r.jsx($t,{value:"qualified",children:"Qualified"}),r.jsx($t,{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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Referrer"}),r.jsx(Mt,{children:"Referred"}),r.jsx(Mt,{children:"Signup Date"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Qualified Date"}),r.jsx(Mt,{children:"Discount"})]})}),r.jsx(Fs,{children:v.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):v.map(N=>{var k,M,I,T;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:((k=N.referrer_brokerage)==null?void 0:k.name)||"Unknown"}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((M=N.referred_brokerage)==null?void 0:M.name)||((I=N.referred_user)==null?void 0:I.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(T=N.referred_user)==null?void 0:T.email})]})}),r.jsx(yt,{children:on(new Date(N.signup_date),"MMM d, yyyy")}),r.jsx(yt,{children:b(N.status)}),r.jsx(yt,{children:N.qualified_date?on(new Date(N.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(yt,{children:N.discount_applied?r.jsx(At,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},N.id)})})]})]})]})]})})}const Dde=[{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"}],JCt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function e3t(){const[e,t]=A.useState([]),[n,s]=A.useState(!0),[a,o]=A.useState(!1),[l,i]=A.useState(null),[u,m]=A.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});A.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:T,error:P}=await Y.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(P)throw P;t(T||[])}catch(T){console.error("Error fetching checklist items:",T),Ae.error("Failed to load checklist items")}finally{s(!1)}},y=()=>{i(null),m({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},v=T=>{i(T),m({title:T.title,description:T.description||"",action_type:T.action_type,target_role:T.target_role,is_active:T.is_active}),o(!0)},b=async()=>{if(!u.title.trim()){Ae.error("Title is required");return}try{if(l){const{error:T}=await Y.from("onboarding_checklist_items").update({title:u.title,description:u.description||null,action_type:u.action_type,target_role:u.target_role,is_active:u.is_active}).eq("id",l.id);if(T)throw T;Ae.success("Checklist item updated")}else{const T=e.filter(F=>F.target_role===u.target_role).reduce((F,D)=>Math.max(F,D.sort_order),-1),{error:P}=await Y.from("onboarding_checklist_items").insert({title:u.title,description:u.description||null,action_type:u.action_type,target_role:u.target_role,is_active:u.is_active,sort_order:T+1});if(P)throw P;Ae.success("Checklist item created")}o(!1),x()}catch(T){console.error("Error saving checklist item:",T),Ae.error("Failed to save checklist item")}},N=async T=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:P}=await Y.from("onboarding_checklist_items").delete().eq("id",T);if(P)throw P;Ae.success("Checklist item deleted"),x()}catch(P){console.error("Error deleting checklist item:",P),Ae.error("Failed to delete checklist item")}},k=async T=>{try{const{error:P}=await Y.from("onboarding_checklist_items").update({is_active:!T.is_active}).eq("id",T.id);if(P)throw P;Ae.success(T.is_active?"Item deactivated":"Item activated"),x()}catch(P){console.error("Error toggling item:",P),Ae.error("Failed to update item")}},M=e.filter(T=>T.target_role==="brokerage_manager"),I=e.filter(T=>T.target_role==="agent");return r.jsxs(Fr,{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(Q,{onClick:y,className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(At,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(et,{children:M.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-12",children:"#"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Action Type"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:M.map((T,P)=>{var F;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"text-muted-foreground",children:P+1}),r.jsx(yt,{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(yt,{children:r.jsx(At,{variant:"outline",children:((F=Dde.find(D=>D.value===T.action_type))==null?void 0:F.label)||T.action_type})}),r.jsx(yt,{children:r.jsx(As,{checked:T.is_active,onCheckedChange:()=>k(T)})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(T),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>N(T.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(At,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(et,{children:I.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-12",children:"#"}),r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Action Type"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:I.map((T,P)=>{var F;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"text-muted-foreground",children:P+1}),r.jsx(yt,{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(yt,{children:r.jsx(At,{variant:"outline",children:((F=Dde.find(D=>D.value===T.action_type))==null?void 0:F.label)||T.action_type})}),r.jsx(yt,{children:r.jsx(As,{checked:T.is_active,onCheckedChange:()=>k(T)})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(T),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>N(T.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Rr,{open:a,onOpenChange:o,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{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(ze,{htmlFor:"title",children:"Title *"}),r.jsx(lt,{id:"title",value:u.title,onChange:T=>m({...u,title:T.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",value:u.description,onChange:T=>m({...u,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(ze,{children:"Target Role"}),r.jsxs(un,{value:u.target_role,onValueChange:T=>m({...u,target_role:T}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:JCt.map(T=>r.jsx($t,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Action Type"}),r.jsxs(un,{value:u.action_type,onValueChange:T=>m({...u,action_type:T}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:Dde.map(T=>r.jsx($t,{value:T.value,children:T.label},T.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{id:"is_active",checked:u.is_active,onCheckedChange:T=>m({...u,is_active:T})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(Q,{onClick:b,children:l?"Save Changes":"Create Item"})]})]})})]})}function t3t(){const[e,t]=A.useState(""),[n,s]=A.useState("all"),[a,o]=A.useState("name"),[l,i]=A.useState("asc"),[u,m]=A.useState(""),[x,y]=A.useState(""),[v,b]=A.useState(""),[N,k]=A.useState(""),{data:M}=Zt({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:G,error:ee}=await Y.from("brokerages").select("id, name").order("name");if(ee)throw ee;return G}}),I=async G=>{let ae=[],oe=0,pe=!0;for(;pe;){const{data:ne,error:fe}=await G(oe,oe+1e3-1);if(fe)throw fe;ne&&ne.length>0?(ae=[...ae,...ne],oe+=1e3,pe=ne.length===1e3):pe=!1}return ae},{data:T,isLoading:P}=Zt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const G=await I((ve,Xe)=>Y.from("profiles").select("id, name, email, brokerage_id, created_at").range(ve,Xe)),{data:ee}=await Y.from("brokerages").select("id, name"),ae=new Map((ee==null?void 0:ee.map(ve=>[ve.id,ve.name]))||[]),{data:oe}=await Y.rpc("get_admin_contact_counts"),pe=new Map;oe==null||oe.forEach(ve=>{pe.set(ve.owner_user_id,ve.contact_count)});const{data:ne}=await Y.rpc("get_admin_video_counts"),fe=new Map;ne==null||ne.forEach(ve=>{fe.set(ve.owner_user_id,ve.video_count)});const{data:se}=await Y.rpc("get_admin_popby_counts"),me=new Map;se==null||se.forEach(ve=>{me.set(ve.owner_user_id,ve.popby_count)});const{data:ue}=await Y.rpc("get_admin_listing_counts"),xe=new Map;ue==null||ue.forEach(ve=>{xe.set(ve.agent_id,ve.listing_count)});const{data:Te}=await Y.rpc("get_admin_deal_counts"),_e=new Map;return Te==null||Te.forEach(ve=>{_e.set(ve.owner_user_id,ve.deal_count)}),G.map(ve=>({id:ve.id,name:ve.name||"Unknown",email:ve.email||"",brokerage_id:ve.brokerage_id,brokerage_name:ve.brokerage_id&&ae.get(ve.brokerage_id)||null,contact_count:pe.get(ve.id)||0,video_count:fe.get(ve.id)||0,popby_count:me.get(ve.id)||0,listing_count:xe.get(ve.id)||0,deal_count:_e.get(ve.id)||0,created_at:ve.created_at}))}}),F=A.useMemo(()=>{if(!T)return[];let G=T.filter(ee=>{const ae=e.toLowerCase(),oe=!e||ee.name.toLowerCase().includes(ae)||ee.email.toLowerCase().includes(ae),pe=n==="all"||n==="none"&&!ee.brokerage_id||ee.brokerage_id===n,ne=parseInt(u)||0,fe=parseInt(x)||0,se=parseInt(v)||0,me=parseInt(N)||0,ue=ee.contact_count>=ne&&ee.video_count>=fe&&ee.popby_count>=se&&ee.listing_count>=me;return oe&&pe&&ue});return G.sort((ee,ae)=>{let oe=0;return a==="name"?oe=ee.name.localeCompare(ae.name):oe=ee[a]-ae[a],l==="asc"?oe:-oe}),G},[T,e,n,a,l,u,x,v,N]),D=G=>{a===G?i(l==="asc"?"desc":"asc"):(o(G),i("desc"))},U=()=>{const G=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings","Deals"],ee=F.map(fe=>[fe.name,fe.email,fe.brokerage_name||"None",fe.contact_count,fe.video_count,fe.popby_count,fe.listing_count,fe.deal_count]),ae=[G.join(","),...ee.map(fe=>fe.map(se=>`"${se}"`).join(","))].join(` `),oe=new Blob([ae],{type:"text/csv"}),pe=URL.createObjectURL(oe),ne=document.createElement("a");ne.href=pe,ne.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ne.click(),URL.revokeObjectURL(pe)},V=A.useMemo(()=>F.length?F.reduce((G,ee)=>({contacts:G.contacts+ee.contact_count,videos:G.videos+ee.video_count,popbys:G.popbys+ee.popby_count,listings:G.listings+ee.listing_count,deals:G.deals+ee.deal_count}),{contacts:0,videos:0,popbys:0,listings:0,deals:0}):{contacts:0,videos:0,popbys:0,listings:0,deals:0},[F]),W=({field:G,children:ee})=>r.jsx(Mt,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>D(G),children:r.jsxs("div",{className:"flex items-center gap-1",children:[ee,r.jsx(Og,{className:`h-3 w-3 ${a===G?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(jn,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:U,children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(et,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name or email...",value:e,onChange:G=>t(G.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(un,{value:n,onValueChange:s,children:[r.jsxs(ln,{children:[r.jsx(hi,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(mn,{placeholder:"Brokerage"})]}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Brokerages"}),r.jsx($t,{value:"none",children:"No Brokerage"}),M==null?void 0:M.map(G=>r.jsx($t,{value:G.id,children:G.name},G.id))]})]})}),r.jsx("div",{children:r.jsx(lt,{type:"number",placeholder:"Min contacts",value:u,onChange:G=>m(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(lt,{type:"number",placeholder:"Min videos",value:x,onChange:G=>y(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(lt,{type:"number",placeholder:"Min popbys",value:v,onChange:G=>b(G.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-6 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:F.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:V.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:V.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:V.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:V.listings.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:V.deals.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Deals"})]})]}),P?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(W,{field:"name",children:"Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Brokerage"}),r.jsx(W,{field:"contact_count",children:"Contacts"}),r.jsx(W,{field:"video_count",children:"Videos"}),r.jsx(W,{field:"popby_count",children:"Popbys"}),r.jsx(W,{field:"listing_count",children:"Listings"}),r.jsx(W,{field:"deal_count",children:"Deals"})]})}),r.jsx(Fs,{children:F.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):F.map(G=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:G.name}),r.jsx(yt,{className:"text-muted-foreground",children:G.email}),r.jsx(yt,{children:G.brokerage_name?r.jsx(At,{variant:"secondary",children:G.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{children:r.jsx(At,{variant:G.contact_count>0?"default":"outline",children:G.contact_count})}),r.jsx(yt,{children:r.jsx(At,{variant:G.video_count>0?"default":"outline",children:G.video_count})}),r.jsx(yt,{children:r.jsx(At,{variant:G.popby_count>0?"default":"outline",children:G.popby_count})}),r.jsx(yt,{children:r.jsx(At,{variant:G.listing_count>0?"default":"outline",children:G.listing_count})}),r.jsx(yt,{children:r.jsx(At,{variant:G.deal_count>0?"default":"outline",children:G.deal_count})})]},G.id))})]})})]})]})}function r3t(){fi(),Vr();const[e,t]=A.useState("user-analytics"),{data:n}=Zt({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:b,error:N}=await Y.from("feature_flags").select("*").order("key");if(N)throw N;return b}}),{data:s,isLoading:a}=Zt({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:b,error:N}=await Y.from("relationship_types").select("*").order("sort_order");if(N)throw N;return b}}),{data:o,isLoading:l}=Zt({queryKey:["admin-action-types"],queryFn:async()=>{const{data:b,error:N}=await Y.from("action_types").select("*").order("sort_order");if(N)throw N;return b}}),{data:i,isLoading:u}=Zt({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:b,error:N}=await Y.from("action_scripts").select("*, action_type:action_types(*)");if(N)throw N;return b}}),{data:m,isLoading:x}=Zt({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:b,error:N}=await Y.from("touchpoint_plans").select("*").order("name");if(N)throw N;return b}}),{data:y,isLoading:v}=Zt({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:b,error:N}=await Y.from("popby_items").select("*").is("owner_user_id",null).order("name");if(N)throw N;return b}});return r.jsx(Fr,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(wi,{value:e,onValueChange:t,children:[r.jsxs(_i,{className:"grid w-full grid-cols-9",children:[r.jsxs(sn,{value:"user-analytics",className:"gap-2",children:[r.jsx(_c,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(sn,{value:"relationship-types",className:"gap-2",children:[r.jsx($n,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(sn,{value:"action-types",className:"gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(sn,{value:"scripts",className:"gap-2",children:[r.jsx(_a,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(sn,{value:"video-scripts",className:"gap-2",children:[r.jsx(Td,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(sn,{value:"plans",className:"gap-2",children:[r.jsx(Cs,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(sn,{value:"popbys",className:"gap-2",children:[r.jsx(ao,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(sn,{value:"settings",className:"gap-2",children:[r.jsx(zd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(sn,{value:"feature-flags",className:"gap-2",children:[r.jsx(dy,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx(Sn,{value:"user-analytics",className:"mt-6",children:r.jsx(t3t,{})}),r.jsx(Sn,{value:"relationship-types",className:"mt-6",children:r.jsx(n3t,{types:s||[],isLoading:a})}),r.jsx(Sn,{value:"action-types",className:"mt-6",children:r.jsx(s3t,{types:o||[],isLoading:l})}),r.jsx(Sn,{value:"scripts",className:"mt-6",children:r.jsx(a3t,{scripts:i||[],actionTypes:o||[],isLoading:u})}),r.jsx(Sn,{value:"video-scripts",className:"mt-6",children:r.jsx(c3t,{})}),r.jsx(Sn,{value:"plans",className:"mt-6",children:r.jsx(i3t,{plans:m||[],actionTypes:o||[],scripts:i||[],isLoading:x})}),r.jsx(Sn,{value:"popbys",className:"mt-6",children:r.jsx(l3t,{items:y||[],isLoading:v})}),r.jsx(Sn,{value:"settings",className:"mt-6",children:r.jsx(d3t,{})}),r.jsx(Sn,{value:"feature-flags",className:"mt-6",children:r.jsx(o3t,{flags:n||[]})})]})]})})}function n3t({types:e,isLoading:t}){const{toast:n}=fi(),s=Vr(),[a,o]=A.useState(null),[l,i]=A.useState(!1),u=ar({mutationFn:async x=>{if(x.id){const{error:y}=await Y.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 Y.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"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),m=async x=>{await Y.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Relationship Types"}),r.jsx(jn,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(Q,{onClick:()=>{o(null),i(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(et,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-12"}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Fs,{children:e.map(x=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsx(zg,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(yt,{className:"font-medium",children:x.name}),r.jsx(yt,{className:"text-muted-foreground",children:x.description}),r.jsx(yt,{children:r.jsx(As,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(yt,{children:r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(Qa,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Rr,{open:l,onOpenChange:i,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsxs(Br,{children:[a?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);u.mutate({id:a==null?void 0:a.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(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"icon",children:"Icon"}),r.jsx(lt,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(Vs,{className:"mt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function s3t({types:e,isLoading:t}){const{toast:n}=fi(),s=Vr(),[a,o]=A.useState(null),[l,i]=A.useState(!1),u=ar({mutationFn:async x=>{if(x.id){const{error:y}=await Y.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 Y.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"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),m=async x=>{await Y.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Action Types"}),r.jsx(jn,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(Q,{onClick:()=>{o(null),i(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(et,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Color"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Fs,{children:e.map(x=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:x.name}),r.jsx(yt,{className:"text-muted-foreground",children:x.description}),r.jsx(yt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(yt,{children:r.jsx(As,{checked:x.active,onCheckedChange:()=>m(x)})}),r.jsx(yt,{children:r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(Qa,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Rr,{open:l,onOpenChange:i,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsxs(Br,{children:[a?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);u.mutate({id:a==null?void 0:a.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(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"icon",children:"Icon"}),r.jsx(lt,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"color",children:"Color"}),r.jsx(lt,{id:"color",name:"color",type:"color",defaultValue:(a==null?void 0:a.color)||"#6366f1"})]})]}),r.jsxs(Vs,{className:"mt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function a3t({scripts:e,actionTypes:t,isLoading:n}){const{toast:s}=fi(),a=Vr(),[o,l]=A.useState(null),[i,u]=A.useState(!1),m=ar({mutationFn:async y=>{if(y.id){const{error:v}=await Y.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(v)throw v}else{const{error:v}=await Y.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(v)throw v}},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),u(!1),l(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),x=ar({mutationFn:async y=>{const{error:v}=await Y.from("action_scripts").delete().eq("id",y);if(v)throw v},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Script Library"}),r.jsx(jn,{children:"Create and manage scripts for each action type"})]}),r.jsxs(Q,{onClick:()=>{l(null),u(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Action Type"}),r.jsx(Mt,{children:"Tone"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Fs,{children:e.map(y=>{var v;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:y.title}),r.jsx(yt,{children:r.jsx(At,{variant:"outline",children:((v=y.action_type)==null?void 0:v.name)||"Unknown"})}),r.jsx(yt,{className:"text-muted-foreground",children:y.tone}),r.jsx(yt,{children:r.jsx(At,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(yt,{className:"flex gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{l(y),u(!0)},children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Rr,{open:i,onOpenChange:u,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Br,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);m.mutate({id:o==null?void 0:o.id,title:v.get("title"),action_type_id:v.get("action_type_id"),tone:v.get("tone"),script_body:v.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(ze,{htmlFor:"title",children:"Title"}),r.jsx(lt,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(un,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select action type"})}),r.jsx(cn,{children:t.map(y=>r.jsx($t,{value:y.id,children:y.name},y.id))})]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(lt,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script_body",children:"Script Body"}),r.jsx(Zn,{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(Vs,{className:"mt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:m.isPending,children:[m.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function i3t({plans:e,actionTypes:t,scripts:n,isLoading:s}){const{toast:a}=fi(),o=Vr(),[l,i]=A.useState(null),[u,m]=A.useState(!1),[x,y]=A.useState(null),[v,b]=A.useState(!1),[N,k]=A.useState(null),[M,I]=A.useState(null),{data:T}=Zt({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:G,error:ee}=await Y.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(ee)throw ee;return G},enabled:!!x}),P=ar({mutationFn:async G=>{if(G.id){const{error:ee}=await Y.from("touchpoint_plans").update({name:G.name,description:G.description,active:G.active}).eq("id",G.id);if(ee)throw ee}else{const{error:ee}=await Y.from("touchpoint_plans").insert([{name:G.name,description:G.description,active:!0}]);if(ee)throw ee}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),m(!1),i(null),a({title:"Saved successfully"})},onError:G=>{a({title:"Error",description:G.message,variant:"destructive"})}}),F=ar({mutationFn:async G=>{if(G.id){const{error:ee}=await Y.from("touchpoint_plan_items").update({action_type_id:G.action_type_id,default_script_id:G.default_script_id,notes:G.notes}).eq("id",G.id);if(ee)throw ee}else{const{error:ee}=await Y.from("touchpoint_plan_items").insert([{plan_id:G.plan_id,month_number:G.month_number,action_type_id:G.action_type_id,default_script_id:G.default_script_id,notes:G.notes}]);if(ee)throw ee}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),a({title:"Item saved"})}}),D=ar({mutationFn:async G=>{const{error:ee}=await Y.from("touchpoint_plan_items").delete().eq("id",G);if(ee)throw ee},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),U=ar({mutationFn:async G=>{const{data:ee,error:ae}=await Y.from("action_scripts").insert([{...G,active:!0}]).select().single();if(ae)throw ae;return ee},onSuccess:async G=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),N&&await F.mutateAsync({id:N.itemId,plan_id:x,month_number:N.month,action_type_id:N.actionTypeId,default_script_id:G.id}),b(!1),k(null),a({title:"Script created and assigned"})},onError:G=>{a({title:"Error",description:G.message,variant:"destructive"})}}),V=(G,ee,ae)=>{k({month:G,actionTypeId:ee,itemId:ae}),b(!0)},W=G=>n.find(ee=>ee.id===G);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Touchpoint Plans"}),r.jsx(jn,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(Q,{onClick:()=>{i(null),m(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(et,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Gr,{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(G=>r.jsxs(He,{className:`cursor-pointer transition-colors ${x===G.id?"border-primary":""}`,onClick:()=>y(G.id),children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Gt,{className:"text-base",children:G.name}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:ee=>{ee.stopPropagation(),i(G),m(!0)},children:r.jsx(Qa,{className:"h-4 w-4"})})]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:G.description}),r.jsx(At,{variant:G.active?"default":"secondary",className:"mt-2",children:G.active?"Active":"Inactive"})]})]},G.id))})})]}),x&&r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Plan Schedule"}),r.jsx(jn,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(G,ee)=>ee+1).map(G=>{const ee=T==null?void 0:T.find(pe=>pe.month_number===G),ae=ee!=null&&ee.default_script_id?W(ee.default_script_id):null,oe=n.filter(pe=>pe.action_type_id===(ee==null?void 0:ee.action_type_id)&&pe.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 ",G]}),r.jsxs(un,{value:(ee==null?void 0:ee.action_type_id)||"none",onValueChange:pe=>{pe==="none"&&ee?D.mutate(ee.id):pe!=="none"&&F.mutate({id:ee==null?void 0:ee.id,plan_id:x,month_number:G,action_type_id:pe,default_script_id:null})},children:[r.jsx(ln,{className:"w-40",children:r.jsx(mn,{placeholder:"No action"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"No action"}),t.filter(pe=>pe.active).map(pe=>r.jsx($t,{value:pe.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[pe.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pe.color}}),pe.name]})},pe.id))]})]}),ee&&r.jsxs(r.Fragment,{children:[r.jsxs(un,{value:ee.default_script_id||"none",onValueChange:pe=>{I(null),F.mutate({id:ee.id,default_script_id:pe==="none"?null:pe})},children:[r.jsx(ln,{className:"w-56",children:r.jsx(mn,{placeholder:"Select script"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"No default script"}),oe.map(pe=>r.jsxs($t,{value:pe.id,children:[pe.title," ",pe.tone&&`(${pe.tone})`]},pe.id))]})]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>V(G,ee.action_type_id,ee.id),children:[r.jsx(_n,{className:"h-3 w-3 mr-1"}),"New Script"]}),ae&&r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>I((M==null?void 0:M.id)===ae.id?null:ae),children:(M==null?void 0:M.id)===ae.id?"Hide":"Preview"})]})]}),M&&(ee==null?void 0:ee.default_script_id)===M.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(At,{variant:"outline",children:M.title}),M.tone&&r.jsx(At,{variant:"secondary",children:M.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:M.script_body})]})]},G)})})})]}),r.jsx(Rr,{open:u,onOpenChange:m,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsxs(Br,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const ee=new FormData(G.currentTarget);P.mutate({id:l==null?void 0:l.id,name:ee.get("name"),description:ee.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",name:"name",defaultValue:l==null?void 0:l.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(Vs,{className:"mt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>m(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:P.isPending,children:[P.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Rr,{open:v,onOpenChange:b,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Create New Script"}),r.jsxs(Yn,{children:["Create a script for Month ",N==null?void 0:N.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const ee=new FormData(G.currentTarget);U.mutate({title:ee.get("title"),action_type_id:N.actionTypeId,tone:ee.get("tone"),script_body:ee.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(ze,{htmlFor:"script_title",children:"Title"}),r.jsx(lt,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script_tone",children:"Tone"}),r.jsx(lt,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script_body",children:"Script Body"}),r.jsx(Zn,{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(Vs,{className:"mt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:U.isPending,children:[U.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function o3t({flags:e}){const{toast:t}=fi(),n=Vr(),s=async(a,o)=>{const{error:l}=await Y.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",a.id);l?t({title:"Error",description:l.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),t({title:"Flag updated"}))};return r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Feature Flags"}),r.jsx(jn,{children:"Control which features are enabled for members"})]}),r.jsx(et,{children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Flag"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Notes"}),r.jsx(Mt,{children:"Last Updated"})]})}),r.jsx(Fs,{children:e.map(a=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-mono text-sm",children:a.key}),r.jsx(yt,{children:r.jsx(As,{checked:a.enabled,onCheckedChange:o=>s(a,{enabled:o})})}),r.jsx(yt,{children:r.jsx(lt,{defaultValue:a.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==a.notes&&s(a,{notes:o.target.value})}})}),r.jsx(yt,{className:"text-muted-foreground text-sm",children:new Date(a.updated_at).toLocaleDateString()})]},a.id))})]})})]})}function l3t({items:e,isLoading:t}){const{toast:n}=fi(),s=Vr(),[a,o]=A.useState(null),[l,i]=A.useState(!1),u=ar({mutationFn:async y=>{if(y.id){const{error:v}=await Y.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(v)throw v}else{const{error:v}=await Y.from("popby_items").insert([{name:y.name,description:y.description,owner_user_id:null}]);if(v)throw v}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),m=async y=>{await Y.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 Y.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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Popby Ideas"}),r.jsx(jn,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(Q,{onClick:()=>{o(null),i(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(et,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Gr,{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(ao,{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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Fs,{children:e.map(y=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:y.name}),r.jsx(yt,{className:"text-muted-foreground",children:y.description}),r.jsx(yt,{children:r.jsx(As,{checked:y.is_active,onCheckedChange:()=>m(y)})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{o(y),i(!0)},children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Rr,{open:l,onOpenChange:i,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsxs(Br,{children:[a?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const v=new FormData(y.currentTarget);u.mutate({id:a==null?void 0:a.id,name:v.get("name"),description:v.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(Vs,{className:"mt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function c3t(){var b;const{toast:e}=fi(),t=Vr(),[n,s]=A.useState(null),[a,o]=A.useState(!1),{data:l,isLoading:i}=Zt({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:N,error:k}=await Y.from("video_script_categories").select("*").order("sort_order");if(k)throw k;return N}}),{data:u,isLoading:m}=Zt({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:N,error:k}=await Y.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(k)throw k;return N}}),x=ar({mutationFn:async N=>{var k,M;if(N.id){const{error:I}=await Y.from("video_scripts").update({title:N.title,script_text:N.script_text,category_id:N.category_id,tags:((k=N.tags)==null?void 0:k.split(",").map(T=>T.trim()).filter(Boolean))||[]}).eq("id",N.id);if(I)throw I}else{const{error:I}=await Y.from("video_scripts").insert([{title:N.title,script_text:N.script_text,category_id:N.category_id||null,tags:((M=N.tags)==null?void 0:M.split(",").map(T=>T.trim()).filter(Boolean))||[]}]);if(I)throw I}},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 Y.from("video_scripts").update({is_active:!N.is_active}).eq("id",N.id),t.invalidateQueries({queryKey:["admin-video-scripts"]})},v=async N=>{confirm("Delete this video script?")&&(await Y.from("video_scripts").delete().eq("id",N),t.invalidateQueries({queryKey:["admin-video-scripts"]}),e({title:"Script deleted"}))};return r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Video Scripts"}),r.jsx(jn,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(Q,{onClick:()=>{s(null),o(!0)},children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(et,{children:m?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Title"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"w-24",children:"Actions"})]})}),r.jsx(Fs,{children:u==null?void 0:u.map(N=>{var k;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:N.title}),r.jsx(yt,{className:"text-muted-foreground",children:((k=N.category)==null?void 0:k.name)||"Uncategorized"}),r.jsx(yt,{children:r.jsx(As,{checked:N.is_active,onCheckedChange:()=>y(N)})}),r.jsxs(yt,{className:"flex gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>{s(N),o(!0)},children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(N.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]})]},N.id)})})]})}),r.jsx(Rr,{open:a,onOpenChange:o,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Br,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:N=>{N.preventDefault();const k=new FormData(N.currentTarget);x.mutate({id:n==null?void 0:n.id,title:k.get("title"),script_text:k.get("script_text"),category_id:k.get("category_id")||null,tags:k.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"title",children:"Title"}),r.jsx(lt,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"category_id",children:"Category"}),r.jsxs(un,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select category"})}),r.jsx(cn,{children:l==null?void 0:l.map(N=>r.jsx($t,{value:N.id,children:N.name},N.id))})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script_text",children:"Script Text"}),r.jsx(Zn,{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(ze,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(lt,{id:"tags",name:"tags",defaultValue:((b=n==null?void 0:n.tags)==null?void 0:b.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(Vs,{className:"mt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function d3t(){const{toast:e}=fi(),[t,n]=A.useState(""),[s,a]=A.useState(!0),[o,l]=A.useState(!1);A.useEffect(()=>{(async()=>{a(!0);try{const{data:m}=await Y.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();m!=null&&m.value&&n(m.value)}catch(m){console.error("Error fetching settings:",m)}a(!1)})()},[]);const i=async()=>{l(!0);try{await Y.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(He,{children:r.jsx(et,{className:"flex justify-center py-8",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Do,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(jn,{children:"Configure the map feature for popbys"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(lt,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:t,onChange:u=>n(u.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(Q,{onClick:i,disabled:o,children:[o&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),t&&r.jsx(At,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const u3t=()=>{const[e,t]=A.useState(""),[n,s]=A.useState("grid"),a=Vn(),{data:o=[],isLoading:l}=Zt({queryKey:["additional-services"],queryFn:async()=>{const{data:u,error:m}=await Y.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(m)throw m;return u}}),i=o.filter(u=>{var x;return u.name.toLowerCase().includes(e.toLowerCase())||((x=u.description)==null?void 0:x.toLowerCase().includes(e.toLowerCase()))});return r.jsx(Fr,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search services...",value:e,onChange:u=>t(u.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>t(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(hf,{className:"h-4 w-4"})}),r.jsx(Q,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(mf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," service",i.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((u,m)=>r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Er,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Er,{className:"h-5 w-3/4 mb-2"}),r.jsx(Er,{className:"h-4 w-full mb-4"})]})},m))}),!l&&i.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(Q,{variant:"outline",onClick:()=>t(""),children:"Clear Search"})]}),!l&&i.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:i.map(u=>r.jsxs(He,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>a(`/additional-services/${u.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:u.preview_image_url?r.jsx("img",{src:u.preview_image_url,alt:u.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(Os,{className:"h-8 w-8"})})}),r.jsxs(et,{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:u.name}),u.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:xse(u.description)})]})]},u.id))})]})})},h3t=()=>{const{serviceId:e}=Ec(),t=Vn(),{data:n,isLoading:s}=Zt({queryKey:["additional-service",e],queryFn:async()=>{const{data:a,error:o}=await Y.from("additional_services").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;return a},enabled:!!e});return s?r.jsx(Fr,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Er,{className:"h-8 w-48"}),r.jsx(Er,{className:"h-64 w-full rounded-lg"}),r.jsx(Er,{className:"h-24 w-full"})]})}):n?r.jsx(Fr,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(Q,{variant:"ghost",onClick:()=>t("/additional-services"),className:"gap-2",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(He,{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(Os,{className:"h-16 w-16"})})})}),r.jsx(He,{children:r.jsxs(et,{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(Cs,{className:"h-4 w-4 mr-1"}),"Published ",on(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(Q,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Ss,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Fr,{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(Q,{onClick:()=>t("/additional-services"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},fT=[{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 m3t(){const[e,t]=A.useState(fT[0].id),n=fT.find(s=>s.id===e)||fT[0];return r.jsx(Fr,{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(w4,{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(un,{value:e,onValueChange:t,children:[r.jsx(ln,{className:"w-full",children:r.jsx(mn,{placeholder:"Select a tool"})}),r.jsx(cn,{children:fT.map(s=>r.jsx($t,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(wi,{value:e,onValueChange:t,className:"w-full",children:r.jsx(_i,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:fT.map(s=>r.jsx(sn,{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 gCe="agent-os-onboarding-completed",MO=[{icon:Bg,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:Vg,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:$n,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:Tp,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:ao,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:_c,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"]}],f3t=()=>{const[e,t]=A.useState(!1),[n,s]=A.useState(0),[a,o]=A.useState(!1);A.useEffect(()=>{if(!localStorage.getItem(gCe)){const N=setTimeout(()=>t(!0),500);return()=>clearTimeout(N)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):u()},i=()=>{u()},u=()=>{localStorage.setItem(gCe,"true"),t(!1)},m=MO[n],x=m.icon,y=n===MO.length-1,v=b=>{b||u(),t(b)};return r.jsx(Rr,{open:e,onOpenChange:v,children:r.jsxs(Dr,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[r.jsxs("div",{className:`relative bg-gradient-to-br ${m.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 ${a?"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 ${m.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(Os,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs($r,{className:"text-center sm:text-center pb-2",children:[r.jsx(Br,{className:`text-2xl font-bold transition-all duration-300 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.title}),r.jsx(Yn,{className:`text-base pt-2 transition-all duration-300 delay-75 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.description})]}),m.highlights&&r.jsx("div",{className:`space-y-2.5 py-4 transition-all duration-300 delay-100 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:m.highlights.map((b,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 ${m.bgGradient} shadow-sm`,children:r.jsx(mi,{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:b})]},N))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:MO.map((b,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 "+m.bgGradient:N{const{user:e}=tn();return Zt({queryKey:["contact-snoozes",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return t},enabled:!!e})},g3t=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async({contactId:n,days:s})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const a=Ql(new Date,s);await Y.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await Y.from("contact_snoozes").insert({contact_id:n,owner_user_id:t.id,snoozed_until:a.toISOString()});if(o)throw o},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),e.invalidateQueries({queryKey:["today-actions"]}),e.invalidateQueries({queryKey:["popby-logs"]}),Sa({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{Sa({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},x3t=()=>{const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("contact_snoozes").delete().eq("contact_id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),Sa({title:"Snooze cancelled"})},onError:t=>{Sa({title:"Error cancelling snooze",description:t.message,variant:"destructive"})}})},y3t=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function Bae({open:e,onOpenChange:t,contactId:n,contactName:s}){const[a,o]=A.useState(null),l=g3t(),i=async()=>{a&&(await l.mutateAsync({contactId:n,days:a}),o(null),t(!1))},u=m=>on(Ql(new Date,m),"MMM d, yyyy");return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(Xa,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(Yn,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:y3t.map(m=>r.jsxs("button",{type:"button",onClick:()=>o(m.days),className:Ut("w-full flex items-center justify-between p-3 rounded-lg border transition-colors",a===m.days?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50"),children:[r.jsx("span",{className:"font-medium",children:m.label}),r.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Cs,{className:"h-3.5 w-3.5"}),"Until ",u(m.days)]})]},m.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(Q,{onClick:i,disabled:!a||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const v3t={Crown:U1,FileText:_a,Users:$n,Globe:uy,Star:ks,Phone:Ai,MessageSquare:Ro,PenTool:$j,Video:Ia,Gift:ao};function _3t({actions:e,onMarkComplete:t,onViewScript:n,isLoading:s,buildSmsLink:a,buildEmailLink:o,onGmailCompose:l}){const i=Vn(),[u,m]=A.useState("name"),[x,y]=A.useState("asc"),[v,b]=A.useState(null),[N,k]=A.useState(""),M=D=>{u===D?y(U=>U==="asc"?"desc":"asc"):(m(D),y("asc"))},I=A.useMemo(()=>[...e].sort((D,U)=>{var W,G;let V=0;switch(u){case"name":{const ee=`${D.contact.first_name} ${D.contact.last_name||""}`.toLowerCase(),ae=`${U.contact.first_name} ${U.contact.last_name||""}`.toLowerCase();V=ee.localeCompare(ae);break}case"relationship_type":V=(D.relationshipTypeName||"").localeCompare(U.relationshipTypeName||"");break;case"action_type":V=(((W=D.actionType)==null?void 0:W.name)||"").localeCompare(((G=U.actionType)==null?void 0:G.name)||"");break;case"last_touch":V=(D.monthNumber||0)-(U.monthNumber||0);break}return x==="asc"?V:-V}),[e,u,x]),T=D=>v3t[D||"Phone"]||Ai,P=({field:D,children:U})=>r.jsxs(Q,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>M(D),children:[U,u===D?x==="asc"?r.jsx(df,{className:"ml-2 h-4 w-4"}):r.jsx(oy,{className:"ml-2 h-4 w-4"}):r.jsx(Og,{className:"ml-2 h-4 w-4 opacity-50"})]}),F=(D,U,V)=>{b(D),k(`${U} ${V||""}`.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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/50",children:[r.jsx(Mt,{className:"w-[180px]",children:r.jsx(P,{field:"name",children:"Contact"})}),r.jsx(Mt,{className:"w-[130px]",children:r.jsx(P,{field:"relationship_type",children:"Type"})}),r.jsx(Mt,{className:"w-[120px]",children:r.jsx(P,{field:"action_type",children:"Action"})}),r.jsx(Mt,{className:"w-[130px]",children:"Phone"}),r.jsx(Mt,{className:"w-[200px]",children:"Quick Actions"})]})}),r.jsx(Fs,{children:I.map((D,U)=>{var oe,pe,ne,fe,se,me;const V=D.isSpecialDate,W=D.specialDateType,G=V?W==="birthday"?mm:ya:T(((oe=D.actionType)==null?void 0:oe.icon)||null),ee=D.contact.phone,ae=D.contact.email;return r.jsxs(Sr,{className:Ut("hover:bg-muted/50 transition-colors",V&&W==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",V&&W==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(yt,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>i(`/mission-control/contacts/${D.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[D.contact.first_name," ",D.contact.last_name]})})}),r.jsx(yt,{children:D.relationshipTypeName?r.jsx(At,{variant:"secondary",className:"text-xs",children:D.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:V?r.jsx(At,{className:Ut("gap-1",W==="birthday"&&"bg-pink-500 hover:bg-pink-600",W==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:W==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(mm,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(ya,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(At,{variant:"outline",className:"gap-1",children:[r.jsx(G,{className:"h-3 w-3"}),(pe=D.actionType)==null?void 0:pe.name]})})}),r.jsx(yt,{children:ee?r.jsx("span",{className:"text-sm font-mono",children:D.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[ee&&r.jsx("a",{href:`tel:${D.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(Ai,{className:"h-3.5 w-3.5"})}),ee&&r.jsx("a",{href:a(D.contact.phone,(ne=D.script)==null?void 0:ne.script_body,D.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(Ro,{className:"h-3.5 w-3.5"})}),ae&&(l?r.jsx("button",{onClick:()=>l({id:D.contact.id,first_name:D.contact.first_name,last_name:D.contact.last_name,email:D.contact.email}),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Compose Email",children:r.jsx(ws,{className:"h-3.5 w-3.5"})}):r.jsx("a",{href:o(D.contact.email,(fe=D.script)==null?void 0:fe.script_body,(se=D.script)==null?void 0:se.email_subject,(me=D.actionType)==null?void 0:me.name,D.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(ws,{className:"h-3.5 w-3.5"})})),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>F(D.contact.id,D.contact.first_name,D.contact.last_name),title:"Snooze",children:r.jsx(ym,{className:"h-3.5 w-3.5"})}),r.jsxs(Q,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var ue;return t(D.contact.id,D.actionType.id,(ue=D.script)==null?void 0:ue.id)},disabled:s,children:[r.jsx(no,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${D.contact.id}-${U}`)})})]})}),r.jsx(Bae,{open:!!v,onOpenChange:D=>!D&&b(null),contactId:v||"",contactName:N})]})}function $ae(){const{isAdmin:e}=tn(),{data:t,isLoading:n}=Zt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:o,error:l}=await Y.from("gmail_integrations").select("*").maybeSingle();if(l)throw l;return o},enabled:e}),s=e&&!!(t!=null&&t.is_active),a=(t==null?void 0:t.gmail_email)||null;return{isGmailConnected:s,gmailEmail:a,isLoading:n}}function b3t({onSelect:e}){const[t,n]=A.useState(null),{data:s=[],isLoading:a}=Zt({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:u,error:m}=await Y.from("email_template_categories").select("*").order("sort_order");if(m)throw m;return u}}),{data:o=[],isLoading:l}=Zt({queryKey:["agent-email-templates",t],queryFn:async()=>{let u=Y.from("agent_email_templates").select("*").eq("is_active",!0).order("sort_order");t&&(u=u.eq("category_id",t));const{data:m,error:x}=await u;if(x)throw x;return m}}),i=s.find(u=>u.id===t);return a?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Gr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("button",{onClick:()=>n(null),className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx(kc,{className:"h-3.5 w-3.5"}),"Back to categories"]}),r.jsxs("p",{className:"text-xs font-medium flex items-center gap-1.5",children:[r.jsx("span",{children:i==null?void 0:i.icon})," ",i==null?void 0:i.name]}),l?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Gr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):o.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No templates in this category"}):r.jsx(Vo,{className:"max-h-[280px]",children:r.jsx("div",{className:"space-y-1",children:o.map(u=>r.jsxs("button",{onClick:()=>e(u),className:"w-full p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"font-medium text-sm",children:u.title}),u.tone&&r.jsx(At,{variant:"secondary",className:"text-[10px] shrink-0",children:u.tone})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:u.subject})]},u.id))})})]}):r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground px-1 mb-2",children:"Select a category"}),r.jsx(Vo,{className:"max-h-[280px]",children:r.jsx("div",{className:"space-y-1",children:s.map(u=>r.jsxs("button",{onClick:()=>n(u.id),className:"w-full flex items-center justify-between p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("span",{className:"text-lg",children:u.icon}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:u.name}),u.description&&r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:u.description})]})]}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},u.id))})})]})}function pT(e,t){return e.replace(/\{\{first_name\}\}/gi,t.first_name).replace(/\{\{last_name\}\}/gi,t.last_name||"").replace(/\{\{full_name\}\}/gi,`${t.first_name} ${t.last_name||""}`.trim())}function Y0e({open:e,onOpenChange:t,contact:n,bulkContacts:s,defaultSubject:a="",defaultBody:o="",gmailEmail:l,onSendComplete:i}){const u=!!s&&s.length>0,m=u?s:n?[n]:[],x=m[0],[y,v]=A.useState((x==null?void 0:x.email)||""),[b,N]=A.useState(a),[k,M]=A.useState(o),[I,T]=A.useState(!1),[P,F]=A.useState(!1);A.useEffect(()=>{e&&(v((x==null?void 0:x.email)||""),N(pT(a,x||{first_name:""})),M(pT(o,x||{first_name:""})),F(!a&&!o))},[e,x,a,o]);const D=G=>{N(pT(G.subject,x||{first_name:""})),M(pT(G.body,x||{first_name:""})),F(!1)},U=G=>G.split(/\n\n+/).map(ee=>`

${ee.replace(/\n/g,"
")}

`).join(""),V=async G=>{if(!b||!k)return Ae.error("Please fill in subject and message"),!1;const ee=pT(k,G),ae=U(ee);try{const{data:oe,error:pe}=await Y.functions.invoke("gmail-send",{body:{to:G.email,subject:b,body:ae,contactId:G.id}});if(pe)throw pe;if(!(oe!=null&&oe.success))throw new Error((oe==null?void 0:oe.error)||"Failed to send");return!0}catch(oe){return console.error("Gmail send error:",oe),Ae.error("Failed to send to "+G.first_name+": "+(oe instanceof Error?oe.message:"Unknown error")),!1}},W=async()=>{if(!b||!k){Ae.error("Please fill in subject and message");return}if(u&&m.length>50){Ae.error("Maximum 50 recipients per bulk send");return}T(!0);try{if(u){let G=0;for(const ee of m)await V(ee)&&G++,await new Promise(oe=>setTimeout(oe,100));Ae.success(`Sent ${G} of ${m.length} emails`)}else await V(x)&&Ae.success("Email sent successfully!");t(!1),i==null||i()}catch(G){console.error("Bulk send error:",G),Ae.error("Error sending emails")}finally{T(!1)}};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5 text-red-500"}),u?`Send to ${m.length} Contacts`:"Compose Email"]}),l&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",r.jsx("span",{className:"font-medium",children:l})]})]}),r.jsxs("div",{className:"space-y-4",children:[P?r.jsxs("div",{className:"border rounded-lg p-3 bg-muted/30",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("p",{className:"text-sm font-medium flex items-center gap-1.5",children:[r.jsx(_a,{className:"h-4 w-4"})," Choose a Template"]}),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>F(!1),className:"h-7 px-2 text-xs",children:[r.jsx(ds,{className:"h-3 w-3 mr-1"})," Write from scratch"]})]}),r.jsx(b3t,{onSelect:D})]}):r.jsxs(Q,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>F(!0),children:[r.jsx(_a,{className:"h-4 w-4"}),"Browse Templates"]}),r.jsx(Od,{}),r.jsx("div",{className:"space-y-1.5",children:u?r.jsxs(r.Fragment,{children:[r.jsx(ze,{children:"Recipients"}),r.jsx("div",{className:"bg-muted p-3 rounded-md space-y-1 max-h-24 overflow-y-auto text-muted-foreground",children:m.map(G=>r.jsxs("div",{className:"text-sm",children:[G.first_name," ",G.last_name," — ",G.email]},G.id))})]}):r.jsxs(r.Fragment,{children:[r.jsx(ze,{htmlFor:"gmail-to",children:"To"}),r.jsx(lt,{id:"gmail-to",value:y,onChange:G=>v(G.target.value),placeholder:"recipient@example.com"})]})}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"gmail-subject",children:"Subject"}),r.jsx(lt,{id:"gmail-subject",value:b,onChange:G=>N(G.target.value),placeholder:"Enter subject..."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{htmlFor:"gmail-body",children:"Message"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(At,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(G=>G+"{{first_name}}"),children:"{{first_name}}"}),r.jsx(At,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(G=>G+"{{last_name}}"),children:"{{last_name}}"})]})]}),r.jsx(Zn,{id:"gmail-body",value:k,onChange:G=>M(G.target.value),placeholder:"Write your message...",rows:10,className:"resize-y"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>t(!1),disabled:I,children:"Cancel"}),r.jsxs(Q,{onClick:W,disabled:I||!b||!k,className:"gap-2",children:[I?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ji,{className:"h-4 w-4"}),I?"Sending...":u?`Send to ${m.length}`:"Send Email"]})]})]})]})})}const xCe={Crown:U1,FileText:_a,Users:$n,Globe:uy,Star:ks,Phone:Ai,MessageSquare:Ro,PenTool:$j,Video:Ia,Gift:ao},w3t={"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 j3t(){const e=Vn(),{user:t}=tn(),{data:n}=qp(),{data:s}=bRe(),{data:a}=Nf(),{data:o}=Dye(),{data:l}=MRe(),i=zgt(),u=CRe(),m=Rgt(90),x=kRe(),[y,v]=A.useState(null),[b,N]=A.useState(null),[k,M]=A.useState(!1),[I,T]=A.useState(""),[P,F]=A.useState(!1),[D,U]=A.useState(""),[V,W]=A.useState(sre()),[G,ee]=A.useState("cards"),[ae,oe]=A.useState(!1),[pe,ne]=A.useState(null),[fe,se]=A.useState(null),[me,ue]=A.useState(""),{isGmailConnected:xe,gmailEmail:Te}=$ae(),_e=()=>{const Ce=parseInt(D,10);if(isNaN(Ce)||Ce<1){Sa({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}W(Ce),SRe(Ce),F(!1),Sa({title:"Goal updated",description:`Weekly touch goal set to ${Ce}`})},we=()=>{U(V.toString()),F(!0)};A.useEffect(()=>{(async()=>{if(!(t!=null&&t.id))return;const{data:Ee}=await Y.from("profiles").select("name").eq("id",t.id).single();Ee!=null&&Ee.name&&T(Ee.name.split(" ")[0])})()},[t==null?void 0:t.id]),A.useEffect(()=>{i.mutate()},[]);const ve=Sm(new Date),Xe=Ql(ve,7),Me=Ce=>{if(!Ce)return null;const Ee=new Date(Ce);return new Date(ve.getFullYear(),Ee.getMonth(),Ee.getDate())},Ie=(a==null?void 0:a.filter(Ce=>{const Ee=Me(Ce.birthday),Ze=Me(Ce.home_anniversary);return Ee&&ac(Ee,ve)||Ze&&ac(Ze,ve)}))||[],$e=(a==null?void 0:a.filter(Ce=>{if(!Ce.birthday&&!Ce.home_anniversary)return!1;const Ee=Ze=>{if(!Ze)return!1;const Le=Me(Ze);return Le?tre(Le,ve)&&sae(Le,Xe):!1};return Ee(Ce.birthday)||Ee(Ce.home_anniversary)}).slice(0,5))||[],Be=Ie.map(Ce=>{var Ke,tt,ct;const Ee=Me(Ce.birthday),Ze=Ee&&ac(Ee,ve),Le=(o==null?void 0:o.find(it=>it.name==="Call"))||(o==null?void 0:o[0]);return{contact:Ce,actionType:Le||{id:"special-date",name:Ze?"Birthday Call":"Anniversary Call",icon:Ze?"Cake":"Home",color:Ze?"#EC4899":"#8B5CF6",description:Ze?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Ze?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((ct=(tt=(Ke=Ce.tags)==null?void 0:Ke[0])==null?void 0:tt.relationship_type)==null?void 0:ct.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Ze?"birthday":"anniversary"}}),ot=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((Ce,Ee)=>{var Le,Ke,tt;const Ze=o==null?void 0:o[Ee%((o==null?void 0:o.length)||1)];return Ze?{contact:Ce,actionType:Ze,planName:"Quick Touch",relationshipTypeName:((tt=(Ke=(Le=Ce.tags)==null?void 0:Le[0])==null?void 0:Ke.relationship_type)==null?void 0:tt.name)||"",monthNumber:0}:null}).filter(Boolean))||[],Tt=[...Be,...ot],Oe=async(Ce,Ee,Ze)=>{await x.mutateAsync({contactId:Ce,actionTypeId:Ee,scriptUsedId:Ze}),M(!1),N(null)},at=Ce=>{Ce.script?(N(Ce),M(!0)):Oe(Ce.contact.id,Ce.actionType.id)},le=Ce=>xCe[Ce||"Phone"]||Ai,qe=Ce=>xCe[Ce||"Users"]||$n,Je=(Ce,Ee)=>Ce.replace(/\{\{FirstName\}\}/g,Ee.first_name).replace(/\{\{LastName\}\}/g,Ee.last_name||"").replace(/\{\{AgentName\}\}/g,I||"there"),st=(Ce,Ee)=>({Call:`Thinking of you, ${Ee}!`,Text:`Quick hello, ${Ee}`,Email:`Checking in, ${Ee}`,"Handwritten Note":`A note for ${Ee}`,Video:`Video message for ${Ee}`,Gift:`Something special for you, ${Ee}`})[Ce]||`Hello ${Ee}!`,je=(Ce,Ee,Ze)=>{const Le=`sms:${Ce}`;if(Ee&&Ze){const Ke=Je(Ee,Ze);return`${Le}?body=${encodeURIComponent(Ke)}`}return Le},ut=(Ce,Ee,Ze,Le,Ke)=>{const tt=`mailto:${Ce}`,ct=[];if(Ke){const it=Ze||st(Le||"Email",Ke.first_name);if(ct.push(`subject=${encodeURIComponent(it)}`),Ee){const zt=Je(Ee,Ke);ct.push(`body=${encodeURIComponent(zt)}`)}}return ct.length>0?`${tt}?${ct.join("&")}`:tt};return r.jsxs(r.Fragment,{children:[r.jsxs(Fr,{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(Ce=>Ce.active).map(Ce=>{const Ee=qe(Ce.icon),Ze=(s==null?void 0:s[Ce.id])||0,Le=y===Ce.id,Ke=w3t[Ce.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{Le?(v(null),e("/mission-control/contacts")):(v(Ce.id),e(`/mission-control/contacts?type=${Ce.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Le?Ke:"bg-card hover:bg-accent"} `,children:[r.jsx(Ee,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:Ce.name}),r.jsxs("div",{className:`text-sm ${Le?"opacity-90":"text-muted-foreground"}`,children:[Ze," Contacts"]})]})]},Ce.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(Q,{onClick:()=>e("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Td,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(Q,{onClick:()=>e("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Gi,{className:"h-4 w-4 ml-1"})]}),r.jsx(Q,{variant:"outline",onClick:()=>e("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(Q,{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(At,{variant:"outline",className:"gap-1",children:[r.jsx(Os,{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(Q,{variant:G==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>ee("cards"),title:"Card view",children:r.jsx(hf,{className:"h-4 w-4"})}),r.jsx(Q,{variant:G==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>ee("table"),title:"Table view",children:r.jsx(mf,{className:"h-4 w-4"})})]})]}),r.jsx(He,{children:r.jsx(et,{className:"p-4",children:Tt.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(Q,{variant:"outline",className:"mt-4",onClick:()=>e("/mission-control/plans"),children:"Manage Plans"})]}):G==="table"?r.jsx(_3t,{actions:Tt,onMarkComplete:Oe,onViewScript:at,isLoading:x.isPending,buildSmsLink:je,buildEmailLink:ut,onGmailCompose:xe?Ce=>{ne(Ce),oe(!0)}:void 0}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[Tt.map((Ce,Ee)=>{var Lt,lr,Ar,Mr,Zr,Xn,dr;const Ze=Ce.isSpecialDate,Le=Ce.specialDateType,Ke=Ze?Le==="birthday"?mm:ya:le(((Lt=Ce.actionType)==null?void 0:Lt.icon)||null),tt=Ce.contact.phone,ct=Ce.contact.email,it=Ze?Le==="birthday"?"#EC4899":"#8B5CF6":((lr=Ce.actionType)==null?void 0:lr.color)||"#3B82F6",zt=Ze?Le==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Ar=Ce.actionType)==null?void 0:Ar.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Ze?"ring-2 ring-offset-2":""}`,style:Ze?{"--tw-ring-color":it}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:it},children:[r.jsx(Ke,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:zt})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>e(`/mission-control/contacts/${Ce.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[Ce.contact.first_name," ",Ce.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[tt&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${Ce.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(Ai,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:je(Ce.contact.phone,(Mr=Ce.script)==null?void 0:Mr.script_body,Ce.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(Ro,{className:"h-3 w-3"}),"Text"]})]}),ct&&(xe?r.jsxs("button",{onClick:()=>{ne({id:Ce.contact.id,first_name:Ce.contact.first_name,last_name:Ce.contact.last_name,email:Ce.contact.email}),oe(!0)},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:"Compose Email",children:[r.jsx(ws,{className:"h-3 w-3"}),"Email"]}):r.jsxs("a",{href:ut(Ce.contact.email,(Zr=Ce.script)==null?void 0:Zr.script_body,(Xn=Ce.script)==null?void 0:Xn.email_subject,(dr=Ce.actionType)==null?void 0:dr.name,Ce.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(ws,{className:"h-3 w-3"}),"Email"]}))]}),!tt&&!ct&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Ce.relationshipTypeName&&r.jsx(At,{variant:"secondary",className:"text-xs",children:Ce.relationshipTypeName}),Ce.monthNumber>0&&r.jsxs(At,{variant:"outline",className:"text-xs",children:["Month ",Ce.monthNumber]})]}),Ce.script&&r.jsx(Q,{size:"sm",variant:"outline",className:"w-full",onClick:()=>at(Ce),children:"View Script"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1 gap-1",onClick:()=>{se(Ce.contact.id),ue(`${Ce.contact.first_name} ${Ce.contact.last_name||""}`.trim())},children:[r.jsx(ym,{className:"h-3.5 w-3.5"}),"Snooze"]}),r.jsx(Q,{size:"sm",className:"flex-1",onClick:()=>{var En;return Oe(Ce.contact.id,Ce.actionType.id,(En=Ce.script)==null?void 0:En.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]},Ce.contact.id+Ee)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{variant:"ghost",className:"h-full w-full",children:[r.jsx(gp,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(Nu,{children:r.jsx(Va,{onClick:()=>e("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(He,{className:"md:col-span-2",children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Gt,{className:"text-lg",children:"Momentum"}),r.jsxs(Rr,{open:P,onOpenChange:F,children:[r.jsx(Fo,{asChild:!0,children:r.jsx("button",{onClick:we,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(zd,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Dr,{className:"sm:max-w-[360px]",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Set Weekly Goal"}),r.jsx(Yn,{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(ze,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(lt,{id:"weekly-goal-ic",type:"number",min:"1",value:D,onChange:Ce=>U(Ce.target.value),placeholder:"20",onKeyDown:Ce=>{Ce.key==="Enter"&&_e()}})]}),r.jsx(Q,{onClick:_e,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Mc,{value:Math.min(u.actionsThisWeek/V*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(fm,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[u.actionsThisWeek," / ",V]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),u.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! (",u.streak," days)"]})]})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(et,{className:"space-y-3",children:[$e.length>0?$e.map(Ce=>{const Ee=Ce.birthday,Ze=Ce.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Ee?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:[Ce.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",Ee?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Ee&&Ce.birthday&&(()=>{const Le=Ce.birthday.split(/[-/T]/);return on(new Date(new Date().getFullYear(),parseInt(Le[1],10)-1,parseInt(Le[2],10)),"MMM d")})(),Ee&&Ze&&" · ",Ze&&Ce.home_anniversary&&(()=>{const Le=Ce.home_anniversary.split(/[-/T]/);return on(new Date(new Date().getFullYear(),parseInt(Le[1],10)-1,parseInt(Le[2],10)),"MMM d")})()]})]})]},Ce.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),m.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(Xa,{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:[m.count," Contact",m.count!==1?"s":""]}),r.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(VRe,{})]})]}),r.jsx(Rr,{open:k,onOpenChange:M,children:r.jsxs(Dr,{className:"max-w-md",children:[r.jsx($r,{children:r.jsx(Br,{className:"flex items-center gap-2",children:b&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:b.actionType.color||"#3B82F6"}}),b.actionType.name," Script"]})})}),b&&b.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:[b.contact.first_name," ",b.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Je(b.script.script_body,b.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{variant:"outline",className:"flex-1",onClick:()=>M(!1),children:"Close"}),r.jsx(Q,{className:"flex-1",onClick:()=>{var Ce;return Oe(b.contact.id,b.actionType.id,(Ce=b.script)==null?void 0:Ce.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(f3t,{})]}),xe&&pe&&r.jsx(Y0e,{open:ae,onOpenChange:oe,contact:pe,gmailEmail:Te}),r.jsx(Bae,{open:!!fe,onOpenChange:Ce=>!Ce&&se(null),contactId:fe||"",contactName:me})]})}const xBe=()=>{const{user:e}=tn();return Zt({queryKey:["popby-items",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.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})},Uae=e=>{const{user:t}=tn();return Zt({queryKey:["popby-logs",t==null?void 0:t.id,e],queryFn:async()=>{let n=Y.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:a}=await n;if(a)throw a;return s},enabled:!!t})},X0e=()=>{const{user:e}=tn();return Zt({queryKey:["relationship-type-popby-defaults",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.from("relationship_type_popby_defaults").select("*");if(n)throw n;return t},enabled:!!e})},yBe=()=>{const{user:e}=tn();return Zt({queryKey:["contact-popby-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.from("contact_popby_settings").select("*");if(n)throw n;return t},enabled:!!e})},vBe=()=>{const{data:e}=Nf(),{data:t}=qp(),{data:n}=Uae(),{data:s}=yBe(),{data:a}=X0e(),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;a==null||a.forEach(x=>l.set(x.relationship_type_id,x.frequency_days));const i=new Map;s==null||s.filter(x=>x.is_active).forEach(x=>{i.set(x.contact_id,x.frequency_days)});const u=Sm(new Date);return(e||[]).map(x=>{let y=90;if(i.has(x.id))y=i.get(x.id);else if(x.tags&&x.tags.length>0){const M=x.tags.map(I=>l.get(I.relationship_type_id)).filter(I=>I!==void 0);M.length>0&&(y=Math.min(...M))}const v=o.get(x.id)||null,b=v?Iy(u,Sm(new Date(v))):null,N=b===null||b>=y,k=N&&b!==null?b-y:0;return{...x,lastPopby:v,daysSinceLastPopby:b,frequencyDays:y,isDue:N,daysOverdue:k}}).sort((x,y)=>y.daysOverdue-x.daysOverdue)},_Be=()=>vBe().filter(t=>t.isDue),k3t=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{error:s}=await Y.from("popby_items").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-items"]}),Sa({title:"Popby item created!"})},onError:n=>{Sa({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},bBe=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{error:s}=await Y.from("popby_logs").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-logs"]}),Sa({title:"Popby logged!"})},onError:n=>{Sa({title:"Error logging popby",description:n.message,variant:"destructive"})}})},N3t=()=>{const e=Vr(),{user:t}=tn();return ar({mutationFn:async n=>{const{error:s}=await Y.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"]}),Sa({title:"Frequency updated!"})},onError:n=>{Sa({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},S3t=()=>{const{data:e}=Uae(30),t=_Be(),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,a=(e==null?void 0:e.length)||0;return{thisWeekCount:s,thisMonthCount:a,dueCount:t.length}};function C3t(){const{user:e}=tn();return Zt({queryKey:["contact-touch-logs",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function wBe(e){const{data:t}=C3t(),{data:n}=yBe(),{data:s}=X0e(),{data:a}=p3t();return A.useMemo(()=>{const o=a==null?void 0:a.find(M=>M.contact_id===e.id),l=o?new Date(o.snoozed_until):null,i=Sm(new Date);if(l&&!sae(l,i))return{nextTouchDate:l,daysUntil:Iy(l,i),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const m=((t==null?void 0:t.filter(M=>M.contact_id===e.id))||[]).sort((M,I)=>new Date(I.completed_at).getTime()-new Date(M.completed_at).getTime())[0],x=m?new Date(m.completed_at):null;let y=90;const v=n==null?void 0:n.find(M=>M.contact_id===e.id&&M.is_active);if(v)y=v.frequency_days;else if(e.tags&&e.tags.length>0){const M=e.tags.map(I=>{const T=s==null?void 0:s.find(P=>P.relationship_type_id===I.relationship_type_id);return T==null?void 0:T.frequency_days}).filter(I=>I!==void 0);M.length>0&&(y=Math.min(...M))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const b=Ql(Sm(x),y),N=Iy(b,i);let k;return N<0?k="overdue":N<=7?k="due-soon":k="on-track",{nextTouchDate:b,daysUntil:N,status:k,frequencyDays:y,lastTouchDate:x,snoozedUntil:null}},[e,t,n,s,a])}function bfe({contact:e}){const t=wBe(e),s=(()=>{switch(t.status){case"overdue":return{variant:"destructive",icon:yl,text:`${Math.abs(t.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Xa,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:no,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:ym,text:`Snoozed until ${on(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:Cs,text:"Never touched",className:"border-dashed"}}})(),a=s.icon;return r.jsxs(At,{variant:s.variant,className:Ut("gap-1",s.className),children:[r.jsx(a,{className:"h-3 w-3"}),s.text]})}function M3t({contact:e,onLogTouch:t,onSnooze:n}){const s=wBe(e),a=x3t(),[o,l]=A.useState(!1),i=()=>{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"}},u=()=>{switch(s.status){case"overdue":return r.jsx(yl,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Xa,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(no,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(ym,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(Cs,{className:"h-5 w-5 text-muted-foreground"})}},m=()=>{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 a.mutateAsync(e.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Gt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(Cs,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[u(),r.jsx("span",{className:Ut("font-medium",i()),children:m()})]}),s.status==="snoozed"&&s.snoozedUntil&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Snoozed until:"})," ",on(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:"})," ",on(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:"})," ",on(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(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:a.isPending,children:[r.jsx(ds,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),t&&r.jsx(Q,{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(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[r.jsx(ym,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&t&&r.jsx(Q,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:t,children:"Log Touch"})]})]})]}),r.jsx(Bae,{open:o,onOpenChange:l,contactId:e.id,contactName:`${e.first_name} ${e.last_name||""}`.trim()})]})}const Rde=768;function B3(){const[e,t]=A.useState(void 0);return A.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Rde-1}px)`),s=()=>{t(window.innerWidthn.removeEventListener("change",s)},[]),!!e}const T3t={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"}},A3t={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 Fde({score:e,showScore:t=!1,showTooltip:n=!0,size:s="sm",className:a}){const o=T3t[e.status],l=A3t[s],i=r.jsxs("div",{className:Ut("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,l.badge,l.text,a),children:[r.jsx("span",{className:Ut("rounded-full",o.bgClass,l.dot)}),t?r.jsx("span",{children:e.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(QI,{children:r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:i}),r.jsx(Pp,{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:Ut("font-bold",o.textClass),children:[e.score,"/100"]})]}),r.jsx(Mc,{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"})]})})]})}):i}const E3t=[{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}],I3t=({open:e,onOpenChange:t,relationshipTypes:n,onSuccess:s})=>{const{user:a}=tn(),{toast:o}=fi(),l=A.useRef(null),[i,u]=A.useState("upload"),[m,x]=A.useState([]),[y,v]=A.useState([]),[b,N]=A.useState({}),[k,M]=A.useState([]),[I,T]=A.useState([]),[P,F]=A.useState(!1),[D,U]=A.useState(null),V=()=>{u("upload"),x([]),v([]),N({}),M([]),T([]),U(null),l.current&&(l.current.value="")},W=()=>{V(),t(!1)},G=me=>{const ue=me.split(` `).map(we=>we.trim()).filter(we=>we);if(ue.length===0)return{headers:[],data:[]};const xe=we=>{const ve=[];let Xe="",Me=!1;for(let Ie=0;Ie{var Te;const ue=(Te=me.target.files)==null?void 0:Te[0];if(!ue)return;const xe=new FileReader;xe.onload=_e=>{var Ie;const we=(Ie=_e.target)==null?void 0:Ie.result,{headers:ve,data:Xe}=G(we);if(ve.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(ve),v(Xe);const Me={};ve.forEach($e=>{const Be=$e.toLowerCase().replace(/[_\s-]/g,"");Be.includes("firstname")||Be==="first"?Me.first_name=$e:Be.includes("lastname")||Be==="last"?Me.last_name=$e:Be.includes("email")?Me.email=$e:Be.includes("phone")||Be.includes("mobile")||Be.includes("cell")?Me.phone=$e:Be.includes("address")||Be.includes("street")?Me.address=$e:Be==="city"?Me.city=$e:Be==="state"||Be==="province"?Me.state=$e:Be==="zip"||Be==="zipcode"||Be==="postalcode"?Me.zip=$e:Be.includes("spouse")&&Be.includes("email")?Me.spouse_email=$e:Be.includes("spouse")||Be.includes("partner")?Me.spouse_name=$e:Be.includes("company")||Be.includes("organization")||Be.includes("business")?Me.company_name=$e:Be.includes("jobtitle")||Be.includes("title")||Be.includes("position")?Me.job_title=$e:Be.includes("birthday")||Be.includes("dob")||Be.includes("birthdate")?Me.birthday=$e:Be.includes("anniversary")||Be.includes("homeanniversary")?Me.home_anniversary=$e:(Be.includes("notes")||Be.includes("comment"))&&(Me.notes=$e)}),N(Me),u("mapping")},xe.readAsText(ue)},ae=(me,ue)=>{N(xe=>{if(ue==="none"){const{[me]:Te,..._e}=xe;return _e}return{...xe,[me]:ue}})},oe=me=>{M(ue=>ue.includes(me)?ue.filter(xe=>xe!==me):[...ue,me])},pe=()=>{const me=y.map(ue=>{const xe=we=>{const ve=b[we];if(!ve)return"";const Xe=m.indexOf(ve);return Xe>=0?(ue[Xe]||"").trim():""},Te=xe("first_name"),_e=Te.length>0;return{first_name:Te,last_name:xe("last_name"),email:xe("email"),phone:xe("phone"),address:xe("address"),city:xe("city"),state:xe("state"),zip:xe("zip"),spouse_name:xe("spouse_name"),spouse_email:xe("spouse_email"),company_name:xe("company_name"),job_title:xe("job_title"),birthday:xe("birthday"),home_anniversary:xe("home_anniversary"),notes:xe("notes"),isValid:_e,error:_e?void 0:"First name is required"}});T(me),u("preview")},ne=async()=>{if(!(a!=null&&a.id))return;const me=I.filter(_e=>_e.isValid);if(me.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}F(!0);let ue=0,xe=0,Te=0;try{for(const _e of me)try{let we=null;if(_e.email){const{data:Xe}=await Y.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",_e.email).maybeSingle();we=Xe}if(!we&&_e.phone){const{data:Xe}=await Y.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",_e.phone).maybeSingle();we=Xe}const ve={owner_user_id:a.id,first_name:_e.first_name,last_name:_e.last_name||null,email:_e.email||null,phone:_e.phone||null,address:_e.address||null,city:_e.city||null,state:_e.state||null,zip:_e.zip||null,spouse_name:_e.spouse_name||null,spouse_email:_e.spouse_email||null,company_name:_e.company_name||null,job_title:_e.job_title||null,birthday:_e.birthday||null,home_anniversary:_e.home_anniversary||null,notes:_e.notes||null};if(we)await Y.from("innercircle_contacts").update(ve).eq("id",we.id),xe++;else{const{data:Xe}=await Y.from("innercircle_contacts").insert(ve).select("id").single();Xe&&k.length>0&&await Y.from("innercircle_contact_tags").insert(k.map(Me=>({contact_id:Xe.id,relationship_type_id:Me}))),ue++}}catch(we){console.error("Error importing contact:",we),Te++}U({created:ue,updated:xe,failed:Te}),u("result"),(ue>0||xe>0)&&s(),o({title:"Import Complete",description:`${ue} created, ${xe} updated${Te>0?`, ${Te} failed`:""}.`})}catch(_e){console.error("Import error:",_e),o({title:"Import Failed",description:_e.message||"Failed to import contacts",variant:"destructive"})}finally{F(!1)}},fe=I.filter(me=>me.isValid).length,se=I.filter(me=>!me.isValid).length;return r.jsx(Rr,{open:e,onOpenChange:W,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(V1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(Yn,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),i==="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:ee,className:"hidden"}),r.jsx(bo,{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(Q,{onClick:()=>{var me;return(me=l.current)==null?void 0:me.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(Q,{variant:"outline",size:"sm",onClick:()=>{const me=`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`,ue=new Blob([me],{type:"text/csv"}),xe=URL.createObjectURL(ue),Te=document.createElement("a");Te.href=xe,Te.download="contact_import_template.csv",Te.click(),URL.revokeObjectURL(xe)},children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),i==="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(ze,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:E3t.map(me=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(ze,{className:"w-40 text-sm",children:[me.label,me.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(un,{value:b[me.key]||"none",onValueChange:ue=>ae(me.key,ue),children:[r.jsx(ln,{className:"w-48",children:r.jsx(mn,{placeholder:"Select column..."})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"-- Not mapped --"}),m.map(ue=>r.jsx($t,{value:ue,children:ue},ue))]})]})]},me.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(me=>r.jsx(At,{variant:k.includes(me.id)?"default":"outline",className:"cursor-pointer",onClick:()=>oe(me.id),children:me.name},me.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"]})})]}),i==="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(no,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[fe," valid"]})]}),se>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(yl,{className:"h-4 w-4"}),r.jsxs("span",{children:[se," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/30",children:[r.jsx(Mt,{children:"First Name"}),r.jsx(Mt,{children:"Last Name"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Phone"}),r.jsx(Mt,{children:"Status"})]})}),r.jsx(Fs,{children:I.slice(0,100).map((me,ue)=>r.jsxs(Sr,{children:[r.jsx(yt,{children:me.first_name}),r.jsx(yt,{children:me.last_name}),r.jsx(yt,{children:me.email}),r.jsx(yt,{children:me.phone}),r.jsx(yt,{children:me.isValid?r.jsx(At,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(At,{variant:"destructive",children:me.error||"Invalid"})})]},ue))})]}),I.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",I.length," contacts"]})]})]}),i==="result"&&D&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(no,{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:[D.created," contact(s) created, ",D.updated," updated"]}),D.failed>0&&r.jsxs("p",{className:"text-destructive",children:[D.failed," failed to import"]})]}),r.jsxs(Vs,{children:[i==="upload"&&r.jsx(Q,{variant:"outline",onClick:W,children:"Cancel"}),i==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(Q,{variant:"outline",onClick:V,children:"Back"}),r.jsx(Q,{onClick:pe,disabled:!b.first_name,children:"Continue"})]}),i==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(Q,{variant:"outline",onClick:()=>u("mapping"),children:"Back"}),r.jsx(Q,{onClick:ne,disabled:P||fe===0,children:P?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${fe} Contact${fe!==1?"s":""}`})]}),i==="result"&&r.jsx(Q,{onClick:W,children:"Done"})]})]})})};function P3t(){return"contacts"in navigator&&"ContactsManager"in window}function L3t(e){const t=[],n=e.split("BEGIN:VCARD").filter(s=>s.trim());for(const s of n){const a=s.split(/\r?\n/);let o="",l="",i="",u="",m="";for(const x of a){const y=x.replace(/^\s+/,"");if(y.startsWith("N:")||y.startsWith("N;")){const b=y.substring(y.indexOf(":")+1).split(";");l=(b[0]||"").trim(),o=(b[1]||"").trim()}if((y.startsWith("FN:")||y.startsWith("FN;"))&&!o){const b=y.substring(y.indexOf(":")+1).trim().split(" ");o=b[0]||"",l=b.slice(1).join(" ")}(y.startsWith("EMAIL")||y.match(/^item\d+\.EMAIL/i))&&!i&&(i=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("TEL")||y.match(/^item\d+\.TEL/i))&&!u&&(u=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!m&&(m=y.substring(y.indexOf(":")+1).split(";").map(N=>N.trim()).filter(Boolean).join(", "))}(o||l)&&t.push({first_name:o,last_name:l,email:i,phone:u,address:m})}return t}function O3t({open:e,onOpenChange:t,onComplete:n}){const{user:s}=tn(),{data:a}=Nf(),o=Lye(),l=A.useRef(null),[i,u]=A.useState("choose"),[m,x]=A.useState([]),[y,v]=A.useState(new Set),[b,N]=A.useState(0),[k,M]=A.useState(0),I=P3t(),T=A.useCallback(ae=>{if(!a)return ae;const oe=new Set(a.filter(ne=>ne.email).map(ne=>ne.email.toLowerCase())),pe=new Set(a.filter(ne=>ne.phone).map(ne=>ne.phone.replace(/\D/g,"")));return ae.map(ne=>{var me,ue;const fe=(me=ne.email)==null?void 0:me.toLowerCase(),se=(ue=ne.phone)==null?void 0:ue.replace(/\D/g,"");return fe&&oe.has(fe)?{...ne,isDuplicate:!0,duplicateField:"email"}:se&&se.length>=7&&pe.has(se)?{...ne,isDuplicate:!0,duplicateField:"phone"}:ne})},[a]),P=async()=>{try{const ae=["name","email","tel","address"],oe=await navigator.contacts.select(ae,{multiple:!0});if(!oe||oe.length===0)return;const pe=oe.map(se=>{var xe,Te,_e,we;const ue=(((xe=se.name)==null?void 0:xe[0])||"").split(" ");return{first_name:ue[0]||"",last_name:ue.slice(1).join(" "),email:((Te=se.email)==null?void 0:Te[0])||"",phone:((_e=se.tel)==null?void 0:_e[0])||"",address:(we=se.address)!=null&&we[0]?[se.address[0].streetAddress,se.address[0].city,se.address[0].region,se.address[0].postalCode].filter(Boolean).join(", "):""}}),ne=T(pe);x(ne);const fe=new Set;ne.forEach((se,me)=>{se.isDuplicate||fe.add(me)}),v(fe),u("preview")}catch(ae){console.error("Contact Picker error:",ae),Sa({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},F=ae=>{var ne;const oe=(ne=ae.target.files)==null?void 0:ne[0];if(!oe)return;const pe=new FileReader;pe.onload=fe=>{var Te;const se=(Te=fe.target)==null?void 0:Te.result,me=L3t(se);if(me.length===0){Sa({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const ue=T(me);x(ue);const xe=new Set;ue.forEach((_e,we)=>{_e.isDuplicate||xe.add(we)}),v(xe),u("preview")},pe.readAsText(oe),l.current&&(l.current.value="")},D=async()=>{const ae=m.filter((pe,ne)=>y.has(ne));if(ae.length===0)return;u("importing");let oe=0;for(const pe of ae)try{await o.mutateAsync({first_name:pe.first_name,last_name:pe.last_name||void 0,email:pe.email||void 0,phone:pe.phone||void 0,address:pe.address||void 0}),oe++,M(Math.round(oe/ae.length*100))}catch(ne){console.error(`Failed to import ${pe.first_name} ${pe.last_name}:`,ne)}N(oe),u("done")},U=ae=>{v(oe=>{const pe=new Set(oe);return pe.has(ae)?pe.delete(ae):pe.add(ae),pe})},V=()=>{y.size===m.length?v(new Set):v(new Set(m.map((ae,oe)=>oe)))},W=ae=>{ae||(u("choose"),x([]),v(new Set),N(0),M(0),i==="done"&&n()),t(ae)},G=m.filter(ae=>ae.isDuplicate).length,ee=y.size;return r.jsx(Rr,{open:e,onOpenChange:W,children:r.jsxs(Dr,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(gy,{className:"h-5 w-5 text-primary"}),i==="choose"&&"Import Phone Contacts",i==="preview"&&"Select Contacts to Import",i==="importing"&&"Importing Contacts...",i==="done"&&"Import Complete"]}),i==="choose"&&r.jsx(Yn,{children:"Add contacts from your phone directly into Agent OS."})]}),i==="choose"&&r.jsxs("div",{className:"space-y-4 pt-2",children:[I&&r.jsxs(Q,{onClick:P,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(gy,{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:[I&&r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),I&&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(Q,{variant:I?"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(bo,{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:I?"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:F,className:"hidden"}),!I&&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"})]})]})]}),i==="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:[m.length," contact",m.length!==1?"s":""," found",G>0&&r.jsxs("span",{className:"text-amber-600 ml-1",children:["(",G," already exist)"]})]}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:V,children:y.size===m.length?"Deselect All":"Select All"})]}),r.jsx(Vo,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:m.map((ae,oe)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ae.isDuplicate?"opacity-60":""}`,onClick:()=>U(oe),children:[r.jsx(_l,{checked:y.has(oe),onCheckedChange:()=>U(oe),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(At,{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})]})]})]},oe))})}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>u("choose"),children:"Back"}),r.jsxs(Q,{onClick:D,disabled:ee===0,children:["Import ",ee," Contact",ee!==1?"s":""]})]})]}),i==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(Gr,{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:[k,"% 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:`${k}%`}})})]}),i==="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(mi,{className:"h-6 w-6 text-emerald-600"})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"font-semibold text-lg",children:[b," contact",b!==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(Q,{onClick:()=>W(!1),className:"mt-2",children:"Done"})]})]})})}function D3t({selectedIds:e,contacts:t,onClearSelection:n}){const{data:s}=qp(),a=Oye(),o=Vr(),{isGmailConnected:l}=$ae(),[i,u]=A.useState(!1),[m,x]=A.useState(!1),y=e.size;if(y===0)return null;const v=async k=>{u(!0);try{const I=Array.from(e).map(P=>({contact_id:P,relationship_type_id:k})),{error:T}=await Y.from("innercircle_contact_tags").upsert(I,{onConflict:"contact_id,relationship_type_id",ignoreDuplicates:!0});if(T)throw T;o.invalidateQueries({queryKey:["innercircle-contacts"]}),o.invalidateQueries({queryKey:["innercircle-contact-counts"]}),Sa({title:`Assigned type to ${y} contacts`}),n()}catch(M){Sa({title:"Error assigning type",description:M.message,variant:"destructive"})}finally{u(!1)}},b=()=>{const k=t.filter(U=>e.has(U.id)),M=["First Name","Last Name","Email","Phone","Address","Birthday","Home Anniversary","Notes","Relationship Types"],I=k.map(U=>{var V;return[U.first_name,U.last_name||"",U.email||"",U.phone||"",U.address||"",U.birthday||"",U.home_anniversary||"",U.notes||"",((V=U.tags)==null?void 0:V.map(W=>{var G;return(G=W.relationship_type)==null?void 0:G.name}).join("; "))||""]}),T=[M.join(","),...I.map(U=>U.map(V=>`"${(V||"").replace(/"/g,'""')}"`).join(","))].join(` `),P=new Blob([T],{type:"text/csv"}),F=URL.createObjectURL(P),D=document.createElement("a");D.href=F,D.download=`contacts-export-${new Date().toISOString().slice(0,10)}.csv`,D.click(),URL.revokeObjectURL(F),Sa({title:`Exported ${y} contacts`})},N=async()=>{if(confirm(`Are you sure you want to delete ${y} contacts? This cannot be undone.`)){u(!0);try{const k=Array.from(e);for(const M of k)await a.mutateAsync(M);n()}catch(k){Sa({title:"Error deleting contacts",description:k.message,variant:"destructive"})}finally{u(!1)}}};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 border border-primary/20 rounded-lg",children:[r.jsxs(At,{variant:"secondary",className:"font-semibold",children:[y," selected"]}),r.jsxs(un,{onValueChange:v,disabled:i,children:[r.jsx(ln,{className:"w-[180px] h-8",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(qg,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"text-sm",children:"Assign Type"})]})}),r.jsx(cn,{children:s==null?void 0:s.filter(k=>k.active).map(k=>r.jsx($t,{value:k.id,children:k.name},k.id))})]}),l&&r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>x(!0),disabled:i,children:[r.jsx(ws,{className:"h-3.5 w-3.5 mr-1"}),"Email"]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:b,disabled:i,children:[r.jsx(so,{className:"h-3.5 w-3.5 mr-1"}),"Export"]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:N,disabled:i,className:"text-destructive hover:text-destructive",children:[r.jsx(Bn,{className:"h-3.5 w-3.5 mr-1"}),"Delete"]}),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:n,className:"ml-auto",children:[r.jsx(ds,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]}),r.jsx(Y0e,{open:m,onOpenChange:x,bulkContacts:Array.from(e).map(k=>{const M=t.find(I=>I.id===k);return M?{id:M.id,first_name:M.first_name,last_name:M.last_name,email:M.email||""}:null}).filter(k=>k!==null&&k.email!==""),onSendComplete:()=>{x(!1),n()}})]})}function yCe({contact:e,onEdit:t,onDelete:n,onSnooze:s}){const a=Vn(),o=`${e.first_name} ${e.last_name||""}`.trim();return r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:l=>l.stopPropagation(),children:r.jsx(gp,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",onClick:l=>l.stopPropagation(),children:[r.jsxs(Va,{onClick:()=>a(`/mission-control/contacts/${e.id}?tab=activity&action=log`),children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),r.jsxs(Va,{onClick:()=>a(`/mission-control/video?contactId=${e.id}`),children:[r.jsx(Ia,{className:"h-4 w-4 mr-2"}),"Send Video"]}),r.jsxs(Va,{onClick:()=>a(`/mission-control/popbys?contactId=${e.id}`),children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),r.jsxs(Va,{onClick:()=>s(e.id,o),children:[r.jsx(ym,{className:"h-4 w-4 mr-2"}),"Snooze"]}),r.jsxs(Va,{onClick:()=>t(e),children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Va,{onClick:()=>n(e.id),className:"text-destructive focus:text-destructive",children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function R3t(){const{user:e}=tn();return Zt({queryKey:["contact-smart-lists",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.from("contact_smart_lists").select("*").order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function F3t(){const e=Vr(),{user:t}=tn();return ar({mutationFn:async({name:n,filters:s,sort_by:a})=>{const{data:o,error:l}=await Y.from("contact_smart_lists").insert({owner_user_id:t.id,name:n,filters:s,sort_by:a}).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-smart-lists"]}),Sa({title:"Smart list saved"})},onError:n=>{Sa({title:"Error saving smart list",description:n.message,variant:"destructive"})}})}function z3t(){const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("contact_smart_lists").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-smart-lists"]}),Sa({title:"Smart list deleted"})}})}function B3t({currentFilters:e,currentSortBy:t,onApplySmartList:n}){const{data:s}=R3t(),a=F3t(),o=z3t(),[l,i]=A.useState(!1),[u,m]=A.useState(""),x=e.search||e.type&&e.type!=="all"||e.status&&e.status!=="all",y=async()=>{u.trim()&&(await a.mutateAsync({name:u.trim(),filters:e,sort_by:t}),m(""),i(!1))};return r.jsxs(r.Fragment,{children:[r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(H1,{className:"h-3.5 w-3.5"}),"Smart Lists",s&&s.length>0&&r.jsx(At,{variant:"secondary",className:"h-5 px-1.5 text-[10px]",children:s.length}),r.jsx(Rd,{className:"h-3.5 w-3.5"})]})}),r.jsxs(Nu,{align:"start",className:"w-56",children:[s&&s.length>0?r.jsxs(r.Fragment,{children:[s.map(v=>r.jsxs(Va,{className:"flex items-center justify-between group",children:[r.jsx("span",{className:"flex-1 cursor-pointer",onClick:()=>n(v.filters,v.sort_by),children:v.name}),r.jsx(Q,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100",onClick:b=>{b.stopPropagation(),o.mutate(v.id)},children:r.jsx(Bn,{className:"h-3 w-3 text-destructive"})})]},v.id)),r.jsx(ik,{})]}):r.jsx(Va,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved lists yet"}),x&&r.jsxs(Va,{onClick:()=>i(!0),children:[r.jsx(tA,{className:"h-4 w-4 mr-2"}),"Save Current Filters"]})]})]}),r.jsx(Rr,{open:l,onOpenChange:i,children:r.jsxs(Dr,{className:"max-w-sm",children:[r.jsx($r,{children:r.jsx(Br,{children:"Save Smart List"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(lt,{placeholder:"e.g. Buyers in 40205",value:u,onChange:v=>m(v.target.value),onKeyDown:v=>v.key==="Enter"&&y(),autoFocus:!0}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(Q,{onClick:y,disabled:!u.trim()||a.isPending,children:"Save"})]})]})]})})]})}function BT(e){if(!e)return null;try{const t=e.split(/[-/T]/);if(t.length<3)return null;const n=parseInt(t[1],10)-1,s=parseInt(t[2],10);if(isNaN(n)||isNaN(s))return null;const a=new Date;a.setHours(0,0,0,0);let o=new Date(a.getFullYear(),n,s);return o.setHours(0,0,0,0),on)return null;const a=t==="birthday"?"🎂":"🏡",o=s===0?t==="birthday"?"Birthday today!":"Anniversary today!":s===1?t==="birthday"?"Birthday tomorrow":"Anniversary tomorrow":`${a} in ${s}d`;return{emoji:a,label:o,daysUntil:s}}function _Ce({birthday:e,homeAnniversary:t,className:n}){const s=vCe(e,"birthday",7),a=vCe(t,"anniversary",7);return!s&&!a?null:r.jsxs("div",{className:Ut("flex flex-wrap gap-1",n),children:[s&&r.jsx(At,{variant:"secondary",className:Ut("text-[10px] gap-0.5 font-medium",s.daysUntil===0?"bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400 animate-pulse":"bg-pink-50 text-pink-600 dark:bg-pink-900/20 dark:text-pink-400"),children:s.label}),a&&r.jsx(At,{variant:"secondary",className:Ut("text-[10px] gap-0.5 font-medium",a.daysUntil===0?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 animate-pulse":"bg-blue-50 text-blue-600 dark:bg-blue-900/20 dark:text-blue-400"),children:a.label})]})}function bCe({deal:e}){if(!e||!e.stage)return null;const{stage:t}=e;return r.jsxs(At,{variant:"outline",className:"text-[10px] gap-1 font-medium whitespace-nowrap",style:{borderColor:t.color,color:t.color,backgroundColor:`${t.color}10`},children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block",style:{backgroundColor:t.color}}),t.name]})}function $3t(){const e=Yc();return Zt({queryKey:["contact-deals-map",e],queryFn:async()=>{const{data:t,error:n}=await Y.from("deal_pipeline").select(` id, deal_name, contact_id, stage:deal_pipeline_stages(id, name, color, icon, is_won_stage, is_lost_stage) `).not("contact_id","is",null);if(n)throw n;const s={};return(t||[]).forEach(a=>{a.contact_id&&!s[a.contact_id]&&(s[a.contact_id]=a)}),s},enabled:!!e})}function U3t(){const e=Vn(),[t]=Zc(),{user:n}=tn(),s=B3(),a=Vr(),o=t.get("type"),l=t.get("filter")??t.get("status"),i=t.get("new")==="true",{contactsWithScores:u,isLoading:m}=Fye(),{data:x}=qp(),{data:y}=$3t(),v=Lye(),b=wRe(),N=Oye(),[k,M]=A.useState(""),[I,T]=A.useState(o||"all"),[P,F]=A.useState(l||"all"),[D,U]=A.useState("date-added"),[V,W]=A.useState(i),[G,ee]=A.useState(null),[ae,oe]=A.useState(!1),[pe,ne]=A.useState(!1),[fe,se]=A.useState(null),[me,ue]=A.useState(""),[xe,Te]=A.useState(new Set),[_e,we]=A.useState(!1),[ve,Xe]=A.useState(1),[Me,Ie]=A.useState(50),$e=A.useCallback(Ee=>{we(!1),Te(Ze=>{const Le=new Set(Ze);return Le.has(Ee)?Le.delete(Ee):Le.add(Ee),Le})},[]);A.useEffect(()=>{if(!(n!=null&&n.id))return;const Ee=Y.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{a.invalidateQueries({queryKey:["innercircle-contacts"]}),a.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{Y.removeChannel(Ee)}},[a,n==null?void 0:n.id]),A.useEffect(()=>{l&&F(l)},[l]);const[Be,Ve]=A.useState({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]});A.useEffect(()=>{i&&W(!0)},[i]),A.useEffect(()=>{var Ee;G&&Ve({first_name:G.first_name||"",last_name:G.last_name||"",email:G.email||"",phone:G.phone||"",address:G.address||"",city:G.city||"",state:G.state||"",zip_code:G.zip_code||"",birthday:G.birthday||"",home_anniversary:G.home_anniversary||"",spouse_name:G.spouse_name||"",spouse_email:G.spouse_email||"",notes:G.notes||"",tagIds:((Ee=G.tags)==null?void 0:Ee.map(Ze=>Ze.relationship_type_id))||[]})},[G]);const ot=A.useMemo(()=>{if(!u)return[];let Ee=u.filter(Ze=>{var tt,ct,it;const Le=k===""||`${Ze.first_name} ${Ze.last_name}`.toLowerCase().includes(k.toLowerCase())||((tt=Ze.email)==null?void 0:tt.toLowerCase().includes(k.toLowerCase()))||((ct=Ze.phone)==null?void 0:ct.includes(k)),Ke=I==="all"||((it=Ze.tags)==null?void 0:it.some(zt=>zt.relationship_type_id===I));return Le&&Ke});return P==="not-touched-90"?Ee=Ee.filter(Ze=>{const Le=Ze.relationshipScore.daysSinceTouch;return Le===null||Le>90}):P==="at-risk"?Ee=Ee.filter(Ze=>Ze.relationshipScore.status==="at-risk"):P==="cooling"?Ee=Ee.filter(Ze=>Ze.relationshipScore.status==="cooling"):P==="warm"&&(Ee=Ee.filter(Ze=>Ze.relationshipScore.status==="warm")),Ee=[...Ee].sort((Ze,Le)=>{switch(D){case"important-dates":{const Ke=BT(Ze.birthday),tt=BT(Le.birthday),ct=BT(Ze.home_anniversary),it=BT(Le.home_anniversary),zt=[Ke,ct].filter(lr=>lr!==null).sort((lr,Ar)=>(lr??1/0)-(Ar??1/0))[0]??1/0,Lt=[tt,it].filter(lr=>lr!==null).sort((lr,Ar)=>(lr??1/0)-(Ar??1/0))[0]??1/0;return zt-Lt}case"last-touched":{const Ke=Ze.relationshipScore.lastTouchDate,tt=Le.relationshipScore.lastTouchDate;return!Ke&&!tt?0:Ke?tt?new Date(Ke).getTime()-new Date(tt).getTime():1:-1}case"next-touch":{const Ke=Ze.relationshipScore.daysSinceTouch,tt=Le.relationshipScore.daysSinceTouch;return Ke===null&&tt===null?0:Ke===null?-1:tt===null?1:tt-Ke}case"score":return Ze.relationshipScore.score-Le.relationshipScore.score;case"date-added":{const Ke=Ze.created_at,tt=Le.created_at;return!Ke&&!tt?0:Ke?tt?new Date(tt).getTime()-new Date(Ke).getTime():-1:1}case"name":default:{const Ke=`${Ze.first_name||""} ${Ze.last_name||""}`.toLowerCase(),tt=`${Le.first_name||""} ${Le.last_name||""}`.toLowerCase();return Ke.localeCompare(tt)}}}),Ee},[u,k,I,P,D]),Tt=ot.length,Oe=Math.max(1,Math.ceil(Tt/Me)),at=Math.min(ve,Oe),le=A.useMemo(()=>{const Ee=(at-1)*Me;return ot.slice(Ee,Ee+Me)},[ot,at,Me]);A.useEffect(()=>{Xe(1)},[k,I,P,D]);const qe=A.useCallback(()=>{we(!1),Te(Ee=>Ee.size>0?new Set:new Set(le.map(Ze=>Ze.id)))},[le]),Je=A.useCallback(()=>{we(!0),Te(new Set(ot.map(Ee=>Ee.id)))},[ot]),st=A.useCallback((Ee,Ze)=>{M(Ee.search||""),T(Ee.type||"all"),F(Ee.status||"all"),U(Ze||"name")},[]),je=()=>{Ve({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},ut=async Ee=>{Ee.preventDefault(),G?(await b.mutateAsync({id:G.id,...Be}),ee(null)):(await v.mutateAsync(Be),W(!1)),je()},Ce=async Ee=>{confirm("Are you sure you want to delete this contact?")&&await N.mutateAsync(Ee)};return r.jsx(Fr,{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(Q,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control"),children:[r.jsx(kc,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(He,{children:r.jsx(et,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name, email, or phone...",value:k,onChange:Ee=>M(Ee.target.value),className:"pl-9"})]}),r.jsxs(un,{value:I,onValueChange:T,children:[r.jsx(ln,{className:"w-[160px]",children:r.jsx(mn,{placeholder:"Filter by type"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Types"}),x==null?void 0:x.filter(Ee=>Ee.active).map(Ee=>r.jsx($t,{value:Ee.id,children:Ee.name},Ee.id))]})]}),r.jsxs(un,{value:P,onValueChange:F,children:[r.jsx(ln,{className:"w-[160px]",children:r.jsx(mn,{placeholder:"Filter by status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Status"}),r.jsx($t,{value:"warm",children:"🟢 Warm"}),r.jsx($t,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx($t,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(un,{value:D,onValueChange:U,children:[r.jsx(ln,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Og,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(mn,{placeholder:"Sort by"})]})}),r.jsxs(cn,{children:[r.jsx($t,{value:"name",children:"Name (A-Z)"}),r.jsx($t,{value:"important-dates",children:"Important Dates"}),r.jsx($t,{value:"last-touched",children:"Last Touched"}),r.jsx($t,{value:"next-touch",children:"Next Touch Due"}),r.jsx($t,{value:"score",children:"Relationship Score"}),r.jsx($t,{value:"date-added",children:"Date Added"})]})]}),r.jsx(B3t,{currentFilters:{search:k,type:I,status:P},currentSortBy:D,onApplySmartList:st}),r.jsxs(Q,{onClick:()=>W(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(Q,{variant:"outline",onClick:()=>oe(!0),children:[r.jsx(bo,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(Q,{variant:"outline",onClick:()=>ne(!0),children:[r.jsx(gy,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),r.jsx(D3t,{selectedIds:xe,contacts:ot,onClearSelection:()=>{Te(new Set),we(!1)}}),xe.size>0&&xe.size===le.length&&!_e&&Tt>Me&&r.jsxs("div",{className:"flex items-center justify-center gap-2 p-2 bg-primary/5 border border-primary/20 rounded-lg text-sm",children:[r.jsxs("span",{children:["All ",le.length," contacts on this page are selected."]}),r.jsxs(Q,{variant:"link",size:"sm",className:"h-auto p-0 font-semibold",onClick:Je,children:["Select all ",Tt.toLocaleString()," matching contacts"]})]}),_e&&r.jsxs("div",{className:"flex items-center justify-center gap-2 p-2 bg-primary/10 border border-primary/30 rounded-lg text-sm font-medium",children:["All ",Tt.toLocaleString()," matching contacts are selected.",r.jsx(Q,{variant:"link",size:"sm",className:"h-auto p-0",onClick:()=>{Te(new Set),we(!1)},children:"Clear selection"})]}),s?r.jsx("div",{className:"space-y-3",children:m?r.jsx(He,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):ot.length===0?r.jsx(He,{className:"p-6 text-center text-muted-foreground",children:k||I!=="all"||P!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):le.map(Ee=>{var Le;const{relationshipScore:Ze}=Ee;return r.jsx(He,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const Ke=new URLSearchParams;k&&Ke.set("search",k),I!=="all"&&Ke.set("type",I),P!=="all"&&Ke.set("filter",P);const tt=Ke.toString();e(`/mission-control/contacts/${Ee.id}${tt?`?${tt}`:""}`)},children:r.jsx(et,{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:[Ee.first_name," ",Ee.last_name]}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[Ee.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(ws,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:Ee.email})]}),Ee.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Ai,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:Ee.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(Fde,{score:Ze,size:"sm"}),r.jsx(bfe,{contact:Ee}),(Le=Ee.tags)==null?void 0:Le.map(Ke=>{var tt;return r.jsx(At,{variant:"secondary",className:"text-xs",children:(tt=Ke.relationship_type)==null?void 0:tt.name},Ke.id)}),r.jsx(bCe,{deal:y==null?void 0:y[Ee.id]})]}),r.jsx(_Ce,{birthday:Ee.birthday,homeAnniversary:Ee.home_anniversary,className:"mb-2"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Ze.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Xa,{className:"h-3 w-3"}),on(new Date(Ze.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),Ee.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cs,{className:"h-3 w-3"}),on(new Date(Ee.birthday),"MMM d")]}),Ee.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ya,{className:"h-3 w-3"}),on(new Date(Ee.home_anniversary),"MMM d")]})]})]}),r.jsx("div",{className:"ml-2",onClick:Ke=>Ke.stopPropagation(),children:r.jsx(yCe,{contact:Ee,onEdit:ee,onDelete:Ce,onSnooze:(Ke,tt)=>{se(Ke),ue(tt)}})})]})})},Ee.id)})}):r.jsx(He,{children:r.jsx(et,{className:"p-0 overflow-x-auto",children:r.jsxs(Ds,{className:"min-w-[800px]",children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-[40px]",children:r.jsx(_l,{checked:le.length>0&&le.every(Ee=>xe.has(Ee.id)),onCheckedChange:()=>qe()})}),r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Score"}),r.jsx(Mt,{children:"Contact Info"}),r.jsx(Mt,{children:"Types / Pipeline"}),r.jsx(Mt,{children:"Last Contact"}),r.jsx(Mt,{children:"Important Dates"}),r.jsx(Mt,{className:"w-[50px]",children:"Actions"})]})}),r.jsx(Fs,{children:m?r.jsx(Sr,{children:r.jsx(yt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):ot.length===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:9,className:"text-center py-8 text-muted-foreground",children:k||I!=="all"||P!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):le.map(Ee=>{var Ke;const{relationshipScore:Ze}=Ee,Le=y==null?void 0:y[Ee.id];return r.jsxs(Sr,{className:`cursor-pointer hover:bg-accent/50 ${xe.has(Ee.id)?"bg-accent/30":""}`,onClick:()=>{const tt=new URLSearchParams;k&&tt.set("search",k),I!=="all"&&tt.set("type",I),P!=="all"&&tt.set("status",P);const ct=tt.toString();e(`/mission-control/contacts/${Ee.id}${ct?`?${ct}`:""}`)},children:[r.jsx(yt,{onClick:tt=>tt.stopPropagation(),children:r.jsx(_l,{checked:xe.has(Ee.id),onCheckedChange:()=>$e(Ee.id)})}),r.jsxs(yt,{className:"font-medium",children:[Ee.first_name," ",Ee.last_name]}),r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Fde,{score:Ze,size:"sm"}),r.jsx(bfe,{contact:Ee})]})}),r.jsx(yt,{children:r.jsx(Fde,{score:Ze,size:"sm",showScore:!0})}),r.jsx(yt,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[Ee.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(ws,{className:"h-3 w-3"}),Ee.email]}),Ee.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ai,{className:"h-3 w-3"}),Ee.phone]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[(Ke=Ee.tags)==null?void 0:Ke.map(tt=>{var ct;return r.jsx(At,{variant:"secondary",className:"text-xs",children:(ct=tt.relationship_type)==null?void 0:ct.name},tt.id)}),r.jsx(bCe,{deal:Le})]})}),r.jsx(yt,{children:r.jsx("div",{className:"text-sm",children:Ze.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Xa,{className:"h-3 w-3"}),on(new Date(Ze.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(yt,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsx(_Ce,{birthday:Ee.birthday,homeAnniversary:Ee.home_anniversary}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Ee.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Cs,{className:"h-3 w-3"}),on(new Date(Ee.birthday),"MMM d")]}),Ee.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ya,{className:"h-3 w-3"}),on(new Date(Ee.home_anniversary),"MMM d")]})]})]})}),r.jsx(yt,{children:r.jsx(yCe,{contact:Ee,onEdit:ee,onDelete:Ce,onSnooze:(tt,ct)=>{se(tt),ue(ct)}})})]},Ee.id)})})]})})}),Tt>0&&r.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsxs("span",{children:["Showing ",(at-1)*Me+1,"–",Math.min(at*Me,Tt)," of ",Tt.toLocaleString()," contacts"]}),r.jsxs(un,{value:String(Me),onValueChange:Ee=>{Ie(Number(Ee)),Xe(1)},children:[r.jsx(ln,{className:"w-[80px] h-8",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"50",children:"50"}),r.jsx($t,{value:"100",children:"100"}),r.jsx($t,{value:"250",children:"250"})]})]}),r.jsx("span",{className:"text-xs",children:"per page"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Q,{variant:"outline",size:"sm",disabled:at<=1,onClick:()=>Xe(1),children:"First"}),r.jsx(Q,{variant:"outline",size:"sm",disabled:at<=1,onClick:()=>Xe(Ee=>Ee-1),children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsxs("span",{className:"px-3 text-sm font-medium",children:["Page ",at," of ",Oe]}),r.jsx(Q,{variant:"outline",size:"sm",disabled:at>=Oe,onClick:()=>Xe(Ee=>Ee+1),children:r.jsx(Gi,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"outline",size:"sm",disabled:at>=Oe,onClick:()=>Xe(Oe),children:"Last"})]})]}),r.jsx(Rr,{open:V||!!G,onOpenChange:Ee=>{Ee||(W(!1),ee(null),je())},children:r.jsxs(Dr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:G?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:ut,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"first_name",children:"First Name *"}),r.jsx(lt,{id:"first_name",value:Be.first_name,onChange:Ee=>Ve({...Be,first_name:Ee.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"last_name",children:"Last Name"}),r.jsx(lt,{id:"last_name",value:Be.last_name,onChange:Ee=>Ve({...Be,last_name:Ee.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(lt,{id:"email",type:"email",value:Be.email,onChange:Ee=>Ve({...Be,email:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(lt,{id:"phone",value:Be.phone,onChange:Ee=>Ve({...Be,phone:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"address",children:"Address"}),r.jsx(lt,{id:"address",value:Be.address,onChange:Ee=>Ve({...Be,address:Ee.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"city",children:"City"}),r.jsx(lt,{id:"city",value:Be.city,onChange:Ee=>Ve({...Be,city:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"state",children:"State"}),r.jsx(lt,{id:"state",value:Be.state,onChange:Ee=>Ve({...Be,state:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"zip_code",children:"Zip"}),r.jsx(lt,{id:"zip_code",value:Be.zip_code,onChange:Ee=>Ve({...Be,zip_code:Ee.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"birthday",children:"Birthday"}),r.jsx(lt,{id:"birthday",type:"date",value:Be.birthday,onChange:Ee=>Ve({...Be,birthday:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(lt,{id:"home_anniversary",type:"date",value:Be.home_anniversary,onChange:Ee=>Ve({...Be,home_anniversary:Ee.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(lt,{id:"spouse_name",value:Be.spouse_name,onChange:Ee=>Ve({...Be,spouse_name:Ee.target.value}),placeholder:"Spouse/partner name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(lt,{id:"spouse_email",type:"email",value:Be.spouse_email,onChange:Ee=>Ve({...Be,spouse_email:Ee.target.value}),placeholder:"Spouse/partner email"})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(Ee=>Ee.active).map(Ee=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(_l,{checked:Be.tagIds.includes(Ee.id),onCheckedChange:Ze=>{Ve(Ze?{...Be,tagIds:[...Be.tagIds,Ee.id]}:{...Be,tagIds:Be.tagIds.filter(Le=>Le!==Ee.id)})}}),r.jsx("span",{className:"text-sm",children:Ee.name})]},Ee.id))})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"notes",children:"Notes"}),r.jsx(Zn,{id:"notes",value:Be.notes,onChange:Ee=>Ve({...Be,notes:Ee.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>{W(!1),ee(null),je()},children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:v.isPending||b.isPending,children:[G?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(I3t,{open:ae,onOpenChange:oe,relationshipTypes:(x==null?void 0:x.filter(Ee=>Ee.active))||[],onSuccess:()=>{oe(!1)}}),r.jsx(O3t,{open:pe,onOpenChange:ne,onComplete:()=>ne(!1)}),r.jsx(Bae,{open:!!fe,onOpenChange:Ee=>{Ee||se(null)},contactId:fe||"",contactName:me})]})})}function q3t(){return Zt({queryKey:["video-script-categories"],queryFn:async()=>{const{data:e,error:t}=await Y.from("video_script_categories").select("*").order("sort_order");if(t)throw t;return e}})}function V3t(e){return Zt({queryKey:["video-scripts",e],queryFn:async()=>{let t=Y.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 H3t(){const{user:e}=tn();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 Y.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 W3t(){const{user:e}=tn(),t=Vr();return ar({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:a}=await Y.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(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["user-video-scripts"]})}})}function G3t(e){const{user:t}=tn();return Zt({queryKey:["agent-videos",t==null?void 0:t.id,e],queryFn:async()=>{if(!(t!=null&&t.id))return[];let n=Y.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:a}=await n;if(a)throw a;return s},enabled:!!(t!=null&&t.id)})}function K3t(e){return Zt({queryKey:["agent-video",e],queryFn:async()=>{const{data:t,error:n}=await Y.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 Q0e(){const{user:e}=tn(),t=Vr();return ar({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:a}=await Y.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(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function Z3t(){const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("agent_videos").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["agent-video",t.id]})}})}function Y3t(){const e=Vr();return ar({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:a,error:o}=await Y.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:",a)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",t);const{error:a}=await Y.from("agent_videos").delete().eq("id",t);if(a)throw a}else{console.log("Soft deleting from database:",t);const{error:a}=await Y.from("agent_videos").update({is_deleted:!0}).eq("id",t);if(a)throw a}console.log("Video deletion complete")},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function J0e(){const{user:e}=tn();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 Y.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 jBe(){const{data:e,isLoading:t}=J0e(),n=e?e.total_storage_mb0?e.total_storage_mb/e.max_storage_mb*100:0,o=a>=80;return{canRecord:n,remainingMb:s,usagePercent:a,isNearLimit:o,storage:e,isLoading:t}}async function kBe(e){const{data:t,error:n}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:e,isAgentVideo:!0}});if(n)throw n;return t}async function NBe(e){const{data:t,error:n}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}async function SBe(e){const{data:t,error:n}=await Y.functions.invoke("bunny-upload",{body:{action:"status",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}function X3t(){const{user:e}=tn(),t=Vr();return ar({mutationFn:async({contactId:n,videoId:s,notes:a})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:o}=await Y.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:l,error:i}=await Y.from("contact_touch_logs").insert([{owner_user_id:e.id,contact_id:n,action_type_id:o.id,notes:a||`Quick Video Touch - Video ID: ${s}`}]).select().single();if(i)throw i;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts"]})}})}function Q3t(e){return Zt({queryKey:["contact-video-replies",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.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 J3t({videoId:e}){var l;const{data:t,isLoading:n,error:s}=K3t(e);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Er,{className:"w-full aspect-video rounded-lg"}),r.jsx(Er,{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(Nh,{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 a=i=>{let u=i;return u.includes("iframe.mediadelivery.net/play/")&&(u=u.replace("/play/","/embed/"),u+=(u.includes("?")?"&":"?")+"autoplay=true&responsive=true"),u},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:a(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 e5t(){var at,le;const{contactId:e}=Ec(),t=Vn(),[n]=Zc(),s=n.get("search")||"",a=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:i}=Sgt(e||""),{data:u}=qp(),{data:m}=Dye(),{data:x}=cae(365),{data:y}=Uae(365),{data:v}=Q3t(e),{contactsWithScores:b}=Fye(),N=wRe(),k=Oye(),M=kRe(),[I,T]=A.useState(!1),[P,F]=A.useState({}),[D,U]=A.useState(!1),[V,W]=A.useState(null),[G,ee]=A.useState(""),[ae,oe]=A.useState(null),[pe,ne]=A.useState(!1),[fe,se]=A.useState(null),{isGmailConnected:me,gmailEmail:ue}=$ae(),{data:xe}=Zt({queryKey:["gmail-sent-emails",e],queryFn:async()=>{const{data:qe,error:Je}=await Y.from("gmail_sent_emails").select("*").eq("contact_id",e).order("sent_at",{ascending:!1});if(Je)throw Je;return qe},enabled:!!e}),Te=qe=>{if(!qe)return null;const Je=qe.match(/Video ID:\s*([a-f0-9-]+)/i);return Je?Je[1]:null},_e=A.useMemo(()=>{if(!b)return[];let qe=b.filter(Je=>{var ut,Ce,Ee;const st=s===""||`${Je.first_name} ${Je.last_name}`.toLowerCase().includes(s.toLowerCase())||((ut=Je.email)==null?void 0:ut.toLowerCase().includes(s.toLowerCase()))||((Ce=Je.phone)==null?void 0:Ce.includes(s)),je=a==="all"||((Ee=Je.tags)==null?void 0:Ee.some(Ze=>Ze.relationship_type_id===a));return st&&je});return o==="not-touched-90"?qe=qe.filter(Je=>{const st=Je.relationshipScore.daysSinceTouch;return st===null||st>90}):o==="at-risk"?qe=qe.filter(Je=>Je.relationshipScore.status==="at-risk"):o==="cooling"?qe=qe.filter(Je=>Je.relationshipScore.status==="cooling"):o==="warm"&&(qe=qe.filter(Je=>Je.relationshipScore.status==="warm")),qe.map(Je=>Je.id)},[b,s,a,o]),we=_e.indexOf(e||""),ve=we>0?_e[we-1]:null,Xe=we<_e.length-1?_e[we+1]:null,Me=_e.length>1&&we!==-1,Ie=qe=>{const Je=new URLSearchParams;s&&Je.set("search",s),a!=="all"&&Je.set("type",a),o!=="all"&&Je.set("status",o);const st=Je.toString();return`/mission-control/contacts/${qe}${st?`?${st}`:""}`},$e=A.useMemo(()=>{const qe=((x==null?void 0:x.filter(st=>st.contact_id===e))||[]).map(st=>{var ut,Ce;const je=Te(st.notes);return{id:st.id,type:"touch",completed_at:st.completed_at,name:((ut=st.action_type)==null?void 0:ut.name)||"Touch",color:((Ce=st.action_type)==null?void 0:Ce.color)||"#3B82F6",notes:st.notes,videoId:je}}),Je=((y==null?void 0:y.filter(st=>st.contact_id===e))||[]).map(st=>({id:st.id,type:"popby",completed_at:st.completed_at,name:"Pop-by",color:"#F97316",notes:st.notes,videoId:null}));return[...qe,...Je].sort((st,je)=>new Date(je.completed_at).getTime()-new Date(st.completed_at).getTime())},[x,y,e]),Be=()=>{var qe;l&&(F({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:((qe=l.tags)==null?void 0:qe.map(Je=>Je.relationship_type_id))||[]}),T(!0))},Ve=async()=>{await N.mutateAsync({id:e,...P}),T(!1)},ot=async()=>{confirm("Are you sure you want to delete this contact?")&&(await k.mutateAsync(e),t("/mission-control/contacts"))},Tt=async()=>{V&&(await M.mutateAsync({contactId:e,actionTypeId:V,notes:G}),U(!1),W(null),ee(""))},Oe=(qe,Je)=>{me&&l?(se({email:qe,name:Je||`${l.first_name} ${l.last_name||""}`.trim()}),ne(!0)):window.location.href=`mailto:${qe}`};return i?r.jsx(Fr,{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.jsxs(r.Fragment,{children:[r.jsx(Fr,{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(Q,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/contacts"),children:[r.jsx(kc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),Me&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>ve&&t(Ie(ve)),disabled:!ve,className:"px-2",children:[r.jsx(kc,{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:[we+1," of ",_e.length]}),r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>Xe&&t(Ie(Xe)),disabled:!Xe,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Gi,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[l.email&&r.jsxs(Q,{variant:"outline",onClick:()=>Oe(l.email,`${l.first_name} ${l.last_name||""}`.trim()),children:[r.jsx(ws,{className:"h-4 w-4 mr-1"}),"Email"]}),r.jsxs(Q,{variant:"default",onClick:()=>t(`/mission-control/video/record?contact_id=${e}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Ia,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Rr,{open:D,onOpenChange:U,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{variant:"outline",children:[r.jsx(_n,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:m==null?void 0:m.filter(qe=>qe.active).map(qe=>r.jsxs("button",{onClick:()=>W(qe.id),className:` p-3 rounded-lg border text-left transition-all ${V===qe.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:qe.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:qe.description})]},qe.id))})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(Zn,{id:"action-notes",value:G,onChange:qe=>ee(qe.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(Q,{onClick:Tt,disabled:!V||M.isPending,className:"w-full",children:[r.jsx(mi,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(Q,{variant:"outline",onClick:Be,children:[r.jsx(gc,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(Q,{variant:"destructive",size:"icon",onClick:ot,children:r.jsx(Bn,{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("button",{onClick:()=>Oe(l.email),className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(ws,{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(Ai,{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(bfe,{contact:l}),(at=l.tags)==null?void 0:at.map(qe=>{const Je=u==null?void 0:u.find(st=>st.id===qe.relationship_type_id);return Je?r.jsx(At,{variant:"secondary",className:"text-xs",children:Je.name},qe.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(He,{className:"md:col-span-2",children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Contact Information"})}),r.jsx(et,{children:I?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(ze,{htmlFor:"first_name",children:"First Name"}),r.jsx(lt,{id:"first_name",value:P.first_name,onChange:qe=>F({...P,first_name:qe.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"last_name",children:"Last Name"}),r.jsx(lt,{id:"last_name",value:P.last_name,onChange:qe=>F({...P,last_name:qe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"email",children:"Email"}),r.jsx(lt,{id:"email",type:"email",value:P.email,onChange:qe=>F({...P,email:qe.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"phone",children:"Phone"}),r.jsx(lt,{id:"phone",value:P.phone,onChange:qe=>F({...P,phone:qe.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"address",children:"Street Address"}),r.jsx(lt,{id:"address",value:P.address,onChange:qe=>F({...P,address:qe.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(ze,{htmlFor:"city",children:"City"}),r.jsx(lt,{id:"city",value:P.city,onChange:qe=>F({...P,city:qe.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"state",children:"State"}),r.jsx(lt,{id:"state",value:P.state,onChange:qe=>F({...P,state:qe.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(lt,{id:"zip_code",value:P.zip_code,onChange:qe=>F({...P,zip_code:qe.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(ze,{htmlFor:"birthday",children:"Birthday"}),r.jsx(lt,{id:"birthday",type:"date",value:P.birthday,onChange:qe=>F({...P,birthday:qe.target.value})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(lt,{id:"home_anniversary",type:"date",value:P.home_anniversary,onChange:qe=>F({...P,home_anniversary:qe.target.value})})]})]}),r.jsx(Od,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(lt,{id:"spouse_name",value:P.spouse_name,onChange:qe=>F({...P,spouse_name:qe.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(lt,{id:"spouse_email",type:"email",value:P.spouse_email,onChange:qe=>F({...P,spouse_email:qe.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(ze,{htmlFor:"company_name",children:"Company"}),r.jsx(lt,{id:"company_name",value:P.company_name,onChange:qe=>F({...P,company_name:qe.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"job_title",children:"Job Title"}),r.jsx(lt,{id:"job_title",value:P.job_title,onChange:qe=>F({...P,job_title:qe.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:u==null?void 0:u.filter(qe=>qe.active).map(qe=>{var Je;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(_l,{checked:(Je=P.tagIds)==null?void 0:Je.includes(qe.id),onCheckedChange:st=>{var je;F(st?{...P,tagIds:[...P.tagIds||[],qe.id]}:{...P,tagIds:(je=P.tagIds)==null?void 0:je.filter(ut=>ut!==qe.id)})}}),r.jsx("span",{className:"text-sm",children:qe.name})]},qe.id)})})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"notes",children:"Notes"}),r.jsx(Zn,{id:"notes",value:P.notes,onChange:qe=>F({...P,notes:qe.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{onClick:Ve,disabled:N.isPending,children:"Save Changes"}),r.jsx(Q,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[$e.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(Cs,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",on(new Date($e[0].completed_at),"MMM d, yyyy")," ","(",$e[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(ws,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("button",{onClick:()=>Oe(l.email),className:"text-primary hover:underline truncate text-left",children:l.email})]}),l.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ai,{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(Do,{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(Cs,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",on(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ya,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",on(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(Od,{}),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(ic,{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(ws,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("button",{onClick:()=>Oe(l.spouse_email,l.spouse_name||void 0),className:"text-primary hover:underline text-left",children:l.spouse_email})]})]}),(l.company_name||l.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{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(Od,{}),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:(le=l.tags)!=null&&le.length?l.tags.map(qe=>{var Je;return r.jsx(At,{variant:"secondary",children:(Je=qe.relationship_type)==null?void 0:Je.name},qe.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Od,{}),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(M3t,{contact:l,onLogTouch:()=>U(!0)}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Activity Log"})}),r.jsx(et,{children:$e.length>0?r.jsx("div",{className:"space-y-4",children:$e.map(qe=>{var Je;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:qe.color},children:qe.type==="popby"?r.jsx(ao,{className:"h-4 w-4"}):(Je=qe.name)==null?void 0:Je.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:qe.name}),qe.videoId&&r.jsxs(Q,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>oe(qe.videoId),children:[r.jsx(Vl,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:on(new Date(qe.completed_at),"MMM d, yyyy h:mm a")}),qe.notes&&!qe.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:qe.notes})]})]},qe.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),v&&v.length>0&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ro,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:v.map(qe=>{var Je,st;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Je=qe.video)!=null&&Je.thumbnail_url?r.jsx("img",{src:qe.video.thumbnail_url,alt:qe.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>oe(qe.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:()=>oe(qe.video_id),children:r.jsx(Ia,{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: ",((st=qe.video)==null?void 0:st.title)||"Untitled Video"]}),r.jsxs(Q,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>oe(qe.video_id),children:[r.jsx(Vl,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:on(new Date(qe.created_at),"MMM d, yyyy h:mm a")}),qe.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',qe.message,'"']})]})]},qe.id)})})})]}),xe&&xe.length>0&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ji,{className:"h-5 w-5 text-sky-500"}),"Sent Emails"]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:xe.map(qe=>r.jsxs("details",{className:"group pb-3 border-b last:border-0",children:[r.jsxs("summary",{className:"flex items-start gap-3 cursor-pointer list-none",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-sky-500/10 flex items-center justify-center text-sky-600 flex-shrink-0",children:r.jsx(ws,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:qe.subject}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["To: ",qe.to_email," · ",on(new Date(qe.sent_at),"MMM d, yyyy h:mm a")]})]})]}),r.jsx("div",{className:"mt-2 ml-11 p-3 bg-muted/30 rounded-lg text-sm whitespace-pre-wrap",children:qe.body})]},qe.id))})})]})]}),r.jsx(Rr,{open:!!ae,onOpenChange:qe=>!qe&&oe(null),children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsx(Br,{children:"Video Preview"})}),ae&&r.jsx(J3t,{videoId:ae})]})})]})]})}),me&&l&&fe&&r.jsx(Y0e,{open:pe,onOpenChange:ne,contact:{id:l.id,first_name:l.first_name,last_name:l.last_name,email:fe.email},gmailEmail:ue})]}):r.jsx(Fr,{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(Q,{onClick:()=>t("/mission-control/contacts"),children:"Back to Contacts"})]})})}const wCe={Crown:U1,FileText:_a,Users:$n,Globe:uy,Star:ks,Phone:Ai,MessageSquare:Ro,PenTool:$j,Video:Ia,Gift:ao},zde=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function t5t(){var Ke,tt;const e=Vn(),{user:t}=tn(),{data:n}=qp(),{data:s}=Mgt(),{data:a}=Ogt(),{data:o}=bRe(),{data:l}=Dye(),{data:i}=Cgt(),u=Dgt(),m=Tgt(),x=Egt(),y=Igt(),v=Pgt(),b=Lgt(),N=Agt(),[k,M]=A.useState(null),[I,T]=A.useState(!1),[P,F]=A.useState(null),[D,U]=A.useState(""),[V,W]=A.useState(""),[G,ee]=A.useState([]),[ae,oe]=A.useState(null),[pe,ne]=A.useState(null),[fe,se]=A.useState(!1),[me,ue]=A.useState(""),[xe,Te]=A.useState(""),[_e,we]=A.useState(""),[ve,Xe]=A.useState(""),Me=(ct,it)=>a==null?void 0:a.some(zt=>zt.plan_id===ct&&zt.relationship_type_id===it&&zt.active),Ie=ct=>a==null?void 0:a.find(it=>it.relationship_type_id===ct&&it.active),$e=async(ct,it)=>{const zt=Me(ct,it);await u.mutateAsync({planId:ct,relationshipTypeId:it,active:!zt})},Be=(s==null?void 0:s.filter(ct=>ct.active&&!ct.owner_user_id))||[],Ve=(s==null?void 0:s.filter(ct=>ct.owner_user_id===(t==null?void 0:t.id)))||[],ot=n==null?void 0:n.find(ct=>ct.id===k),Tt=k?Ie(k):null,Oe=s==null?void 0:s.find(ct=>ct.id===(Tt==null?void 0:Tt.plan_id)),at=async()=>{if(!D.trim())return;const ct=await m.mutateAsync({name:D,description:V});ct&&G.length>0&&await v.mutateAsync({planId:ct.id,items:G}),Je()},le=async()=>{!D.trim()||!P||(await x.mutateAsync({id:P,name:D,description:V}),await v.mutateAsync({planId:P,items:G}),Je())},qe=ct=>{var it;F(ct.id),U(ct.name),W(ct.description||""),ee(((it=ct.items)==null?void 0:it.map(zt=>({month_number:zt.month_number,action_type_id:zt.action_type_id,default_script_id:zt.default_script_id||void 0,notes:zt.notes||void 0})))||[]),T(!0)},Je=()=>{T(!1),F(null),U(""),W(""),ee([])},st=(ct,it)=>{ne(it)},je=(ct,it,zt)=>{ee(Lt=>[...Lt.filter(Ar=>Ar.month_number!==ct),{month_number:ct,action_type_id:it,default_script_id:zt}]),oe(null),ne(null)},ut=ct=>{ee(it=>it.filter(zt=>zt.month_number!==ct))},Ce=async()=>{if(!me.trim()||!xe.trim()||!pe)return;const ct=await b.mutateAsync({actionTypeId:pe,title:me,scriptBody:xe,emailSubject:_e||void 0,tone:ve||void 0});ct&&ae!==null&&je(ae,pe,ct.id),se(!1),ue(""),Te(""),we(""),Xe("")},Ee=pe?i==null?void 0:i.filter(ct=>ct.action_type_id===pe&&ct.active):[],Ze=ct=>wCe[ct||"Phone"]||Ai,Le=ct=>wCe[ct||"Users"]||$n;return r.jsxs(Fr,{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(Q,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control"),children:[r.jsx(kc,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(Q,{onClick:()=>T(!0),className:"w-full sm:w-auto",children:[r.jsx(_n,{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(ct=>ct.active).map(ct=>{const it=Le(ct.icon),zt=(o==null?void 0:o[ct.id])||0,Lt=Ie(ct.id),lr=s==null?void 0:s.find(Mr=>Mr.id===(Lt==null?void 0:Lt.plan_id)),Ar=k===ct.id;return r.jsxs("button",{onClick:()=>M(ct.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${Ar?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(it,{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:ct.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[zt," contacts"]})]}),lr?r.jsxs(At,{variant:"secondary",className:"text-xs",children:[r.jsx(oi,{className:"h-3 w-3 mr-1"}),lr.name.split(" ")[0]]}):r.jsx(At,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},ct.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:k&&ot?r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[(()=>{const ct=Le(ot.icon);return r.jsx(ct,{className:"h-5 w-5"})})(),ot.name," Touchpoint Plan"]}),r.jsxs(jn,{children:["Choose a plan for your ",ot.name," contacts"]})]}),r.jsxs(et,{className:"space-y-6",children:[Oe&&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(oi,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Oe.name]}),Oe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Oe.description})]}),r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>$e(Oe.id,k),children:"Disable"})]}),Oe.items&&Oe.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(Cs,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:zde.map((ct,it)=>{var Ar,Mr;const zt=((Ar=Oe.items)==null?void 0:Ar.filter(Zr=>Zr.month_number===it+1))||[],Lt=(Mr=zt[0])==null?void 0:Mr.action_type,lr=Lt?Ze(Lt.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${zt.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:ct}),lr&&r.jsx(lr,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Lt==null?void 0:Lt.color)||"#3B82F6"}})]},it)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Oe?"Switch to a Different Plan":"Choose a Plan"}),Be.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"}),Be.map(ct=>{var zt;const it=(Oe==null?void 0:Oe.id)===ct.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${it?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:ct.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((zt=ct.items)==null?void 0:zt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:N.isPending,onClick:()=>{const Lt=`${ct.name} (Copy)`;N.mutate({sourcePlanId:ct.id,newName:Lt})},children:r.jsx(Po,{className:"h-4 w-4"})}),r.jsx(Q,{size:"sm",variant:it?"outline":"default",disabled:it||u.isPending,onClick:()=>$e(ct.id,k),children:it?"Active":"Use This"})]})]},ct.id)})]}),Ve.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Ve.map(ct=>{var zt;const it=(Oe==null?void 0:Oe.id)===ct.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${it?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:ct.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((zt=ct.items)==null?void 0:zt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>qe(ct),children:r.jsx(Z0,{className:"h-4 w-4"})}),r.jsx(Q,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(ct.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})}),r.jsx(Q,{size:"sm",variant:it?"outline":"default",disabled:it||u.isPending,onClick:()=>$e(ct.id,k),children:it?"Active":"Use This"})]})]},ct.id)})]}),Be.length===0&&Ve.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(He,{children:r.jsxs(et,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Cs,{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(He,{className:"bg-muted/50",children:r.jsx(et,{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(Rr,{open:I,onOpenChange:ct=>{ct?T(!0):Je()},children:r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:P?"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(ze,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(lt,{id:"plan-name",value:D,onChange:ct=>U(ct.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(Zn,{id:"plan-description",value:V,onChange:ct=>W(ct.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(ze,{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:zde.map((ct,it)=>{const zt=it+1,Lt=G.find(Mr=>Mr.month_number===zt),lr=Lt?l==null?void 0:l.find(Mr=>Mr.id===Lt.action_type_id):null,Ar=lr?Ze(lr.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>oe(ae===zt?null:zt),className:` w-full p-3 rounded-lg border text-center transition-all ${Lt?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${ae===zt?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:ct}),Ar?r.jsx(Ar,{className:"h-5 w-5 mx-auto mt-1",style:{color:(lr==null?void 0:lr.color)||"#3B82F6"}}):r.jsx(_n,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Lt&&r.jsx("button",{type:"button",onClick:Mr=>{Mr.stopPropagation(),ut(zt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(ds,{className:"h-3 w-3"})})]},it)})}),ae!==null&&!pe&&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 ",zde[ae-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(ct=>ct.active).map(ct=>{const it=Ze(ct.icon);return r.jsxs("button",{type:"button",onClick:()=>st(ae,ct.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(it,{className:"h-4 w-4",style:{color:ct.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:ct.name})]},ct.id)})})]}),ae!==null&&pe&&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(Q,{variant:"ghost",size:"sm",onClick:()=>ne(null),children:[r.jsx(kc,{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:()=>je(ae,pe),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"})]})}),Ee==null?void 0:Ee.map(ct=>r.jsx("button",{type:"button",onClick:()=>je(ae,pe,ct.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:ct.title}),ct.tone&&r.jsx(At,{variant:"secondary",className:"text-xs mt-1",children:ct.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[ct.script_body.substring(0,100),"..."]})]})},ct.id)),r.jsxs("button",{type:"button",onClick:()=>se(!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(_n,{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"})]})]})]})]})]}),G.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.length," touchpoint",G.length!==1?"s":""," per year"]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:Je,children:"Cancel"}),r.jsxs(Q,{onClick:P?le:at,disabled:!D.trim()||m.isPending||x.isPending,children:[r.jsx(Ip,{className:"h-4 w-4 mr-2"}),P?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Rr,{open:fe,onOpenChange:se,children:r.jsxs(Dr,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Br,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script-title",children:"Script Title"}),r.jsx(lt,{id:"script-title",value:me,onChange:ct=>ue(ct.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(un,{value:ve,onValueChange:Xe,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select tone..."})}),r.jsxs(cn,{children:[r.jsx($t,{value:"friendly",children:"Friendly"}),r.jsx($t,{value:"professional",children:"Professional"}),r.jsx($t,{value:"casual",children:"Casual"}),r.jsx($t,{value:"formal",children:"Formal"})]})]})]}),((tt=(Ke=l==null?void 0:l.find(ct=>ct.id===pe))==null?void 0:Ke.name)==null?void 0:tt.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(lt,{id:"script-email-subject",value:_e,onChange:ct=>we(ct.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(ze,{htmlFor:"script-body",children:"Script Content"}),r.jsx(Zn,{id:"script-body",value:xe,onChange:ct=>Te(ct.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(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>se(!1),children:"Cancel"}),r.jsxs(Q,{onClick:Ce,disabled:!me.trim()||!xe.trim()||b.isPending,children:[r.jsx(Ip,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const r5t="0dde5abb-0005-4c8c-a471-30d0cbc9e280",n5t=[{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 s5t(){const e=Vn(),t=_Be(),{data:n}=xBe(),{data:s}=qp(),{data:a}=X0e(),{data:o}=Uae(90),{data:l}=Nf(),i=S3t(),u=bBe(),m=k3t(),x=N3t(),{data:y=[],isLoading:v}=Zt({queryKey:["popby-templates"],queryFn:async()=>{const{data:fe,error:se}=await Y.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",r5t).order("publish_date",{ascending:!1});if(se)throw se;const{data:me}=await Y.from("template_likes").select("template_id"),{data:ue}=await Y.from("template_comments").select("template_id"),xe=new Map;me==null||me.forEach(_e=>{xe.set(_e.template_id,(xe.get(_e.template_id)||0)+1)});const Te=new Map;return ue==null||ue.forEach(_e=>{Te.set(_e.template_id,(Te.get(_e.template_id)||0)+1)}),(fe||[]).map(_e=>({..._e,likesCount:xe.get(_e.id)||0,commentsCount:Te.get(_e.id)||0}))}}),b=fe=>{const se=l==null?void 0:l.find(me=>me.id===fe);return se?`${se.first_name} ${se.last_name||""}`.trim():"Unknown"},N=fe=>{if(!fe)return null;const se=n==null?void 0:n.find(me=>me.id===fe);return(se==null?void 0:se.name)||null},[k,M]=A.useState(null),[I,T]=A.useState(!1),[P,F]=A.useState(!1),[D,U]=A.useState(!1),[V,W]=A.useState({popby_item_id:"",notes:""}),[G,ee]=A.useState({name:"",description:""}),ae=async()=>{k&&(await u.mutateAsync({contact_id:k.id,popby_item_id:V.popby_item_id||void 0,notes:V.notes||void 0}),T(!1),M(null),W({popby_item_id:"",notes:""}))},oe=async()=>{G.name.trim()&&(await m.mutateAsync({name:G.name.trim(),description:G.description.trim()||void 0}),U(!1),ee({name:"",description:""}))},pe=async(fe,se)=>{await x.mutateAsync({relationship_type_id:fe,frequency_days:parseInt(se)})},ne=fe=>{var me;const se=a==null?void 0:a.find(ue=>ue.relationship_type_id===fe);return((me=se==null?void 0:se.frequency_days)==null?void 0:me.toString())||"90"};return r.jsx(Fr,{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(He,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:i.thisWeekCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:i.thisMonthCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-amber-500",children:i.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(Q,{onClick:()=>e("/mission-control/popbys/map"),children:[r.jsx(Do,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(Q,{variant:"outline",onClick:()=>F(!0),children:[r.jsx(zd,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(Q,{variant:"outline",onClick:()=>U(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(wi,{defaultValue:"due",children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"due",children:"Due for Popby"}),r.jsx(sn,{value:"activity",children:"Recent Activity"}),r.jsx(sn,{value:"library",children:"Popby Library"}),r.jsx(sn,{value:"templates",children:"Popby Templates"})]}),r.jsx(Sn,{value:"due",className:"space-y-4 mt-4",children:!t||t.length===0?r.jsx(He,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(ao,{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(fe=>r.jsx(He,{className:"hover:shadow-md transition-shadow",children:r.jsx(et,{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:[fe.first_name," ",fe.last_name]}),fe.daysOverdue>0&&r.jsxs(At,{variant:"destructive",className:"text-xs",children:[fe.daysOverdue,"+ days overdue"]}),fe.daysSinceLastPopby===null&&r.jsx(At,{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:[fe.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Do,{className:"h-3 w-3"}),fe.city||fe.address]}),fe.tags&&fe.tags.length>0&&r.jsx("span",{children:fe.tags.map(se=>{var me;return(me=se.relationship_type)==null?void 0:me.name}).join(", ")})]}),fe.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",on(new Date(fe.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[fe.phone&&r.jsx(Q,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${fe.phone}`,children:r.jsx(Ai,{className:"h-4 w-4"})})}),r.jsxs(Q,{size:"sm",onClick:()=>{M(fe),T(!0)},children:[r.jsx(oi,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},fe.id))})}),r.jsx(Sn,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(He,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Xa,{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(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(et,{className:"space-y-3",children:o.map(fe=>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(ao,{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:b(fe.contact_id)}),N(fe.popby_item_id)&&r.jsx(At,{variant:"secondary",className:"text-xs",children:N(fe.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:on(new Date(fe.completed_at),"MMM d, yyyy h:mm a")}),fe.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:fe.notes})]})]},fe.id))})]})}),r.jsx(Sn,{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(fe=>r.jsx(He,{children:r.jsx(et,{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(ao,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:fe.name}),fe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:fe.description}),!fe.owner_user_id&&r.jsx(At,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},fe.id)),r.jsx(He,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>U(!0),children:r.jsx(et,{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(_n,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(Sn,{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"]}),v&&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((fe,se)=>r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Er,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Er,{className:"h-5 w-3/4 mb-2"}),r.jsx(Er,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Er,{className:"h-5 w-16"}),r.jsx(Er,{className:"h-5 w-20"})]})]})},se))}),!v&&y.length===0&&r.jsx(He,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(ql,{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."})]})}),!v&&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(fe=>r.jsxs(He,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>e(`/templates/${fe.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:fe.preview_image_url?r.jsx("img",{src:fe.preview_image_url,alt:fe.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(et,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:fe.name}),fe.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:xse(fe.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(At,{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(Bd,{className:"h-3.5 w-3.5"}),fe.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),fe.commentsCount]})]}),r.jsxs(Q,{size:"sm",className:"w-full gap-2",onClick:se=>{se.stopPropagation(),e(`/templates/${fe.id}`)},children:[r.jsx(Ss,{className:"h-4 w-4"}),"View Template"]})]})]},fe.id))})]})]}),r.jsx(Rr,{open:I,onOpenChange:T,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsxs(Br,{children:["Log Popby for ",k==null?void 0:k.first_name," ",k==null?void 0:k.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Popby Item (optional)"}),r.jsxs(un,{value:V.popby_item_id,onValueChange:fe=>W(se=>({...se,popby_item_id:fe})),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select a popby item..."})}),r.jsx(cn,{children:n==null?void 0:n.map(fe=>r.jsx($t,{value:fe.id,children:fe.name},fe.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Notes (optional)"}),r.jsx(Zn,{placeholder:"Any notes about this popby...",value:V.notes,onChange:fe=>W(se=>({...se,notes:fe.target.value}))})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(Q,{onClick:ae,disabled:u.isPending,children:"Log Popby"})]})]})}),r.jsx(Rr,{open:P,onOpenChange:F,children:r.jsxs(Dr,{className:"max-w-md",children:[r.jsx($r,{children:r.jsx(Br,{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(fe=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(ze,{className:"font-medium",children:fe.name}),r.jsxs(un,{value:ne(fe.id),onValueChange:se=>pe(fe.id,se),children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{})}),r.jsx(cn,{children:n5t.map(se=>r.jsx($t,{value:se.value,children:se.label},se.value))})]})]},fe.id))]}),r.jsx(Vs,{children:r.jsx(Q,{onClick:()=>F(!1),children:"Done"})})]})}),r.jsx(Rr,{open:D,onOpenChange:U,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Name *"}),r.jsx(lt,{placeholder:"e.g., Homemade cookies",value:G.name,onChange:fe=>ee(se=>({...se,name:fe.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Zn,{placeholder:"Optional description...",value:G.description,onChange:fe=>ee(se=>({...se,description:fe.target.value}))})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),r.jsx(Q,{onClick:oe,disabled:!G.name.trim()||m.isPending,children:"Add Item"})]})]})})]})})}function a5t(){const e=Vn(),{isAdmin:t}=tn(),n=A.useRef(null),s=A.useRef(null),a=A.useRef([]),o=vBe(),{data:l}=xBe(),i=bBe(),[u,m]=A.useState(""),[x,y]=A.useState(""),[v,b]=A.useState(!0),[N,k]=A.useState(null),[M,I]=A.useState(null),[T,P]=A.useState(!1),[F,D]=A.useState({popby_item_id:"",notes:""}),U=o.filter(ee=>ee.address||ee.city&&ee.state);A.useEffect(()=>{(async()=>{b(!0);try{const{data:ae}=await Y.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ae!=null&&ae.value&&m(ae.value)}catch(ae){console.error("Error fetching mapbox token:",ae)}b(!1)})()},[]),A.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(ee=>{k([ee.coords.longitude,ee.coords.latitude])},ee=>{console.log("Could not get location:",ee)})},[]),A.useEffect(()=>{if(!(!n.current||!u||s.current))return rc.accessToken=u,s.current=new rc.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:N?12:4,center:N||[-98.5795,39.8283]}),s.current.addControl(new rc.NavigationControl,"top-right"),()=>{var ee;(ee=s.current)==null||ee.remove(),s.current=null}},[u,N]),A.useEffect(()=>{!s.current||!u||(a.current.forEach(ee=>ee.remove()),a.current=[],U.forEach(async ee=>{var oe;const ae=[ee.address,ee.city,ee.state,ee.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=${u}`)).json();if(ne.features&&ne.features.length>0){const[fe,se]=ne.features[0].center,me=document.createElement("div");me.className="cursor-pointer",me.innerHTML=`
${ee.first_name[0]}${((oe=ee.last_name)==null?void 0:oe[0])||""}
${ee.isDue?'
':""}
`;const ue=new rc.Marker(me).setLngLat([fe,se]).addTo(s.current);me.addEventListener("click",()=>{I(ee)}),a.current.push(ue)}}catch(pe){console.error("Geocoding error for",ee.first_name,pe)}}))},[U,u]);const V=()=>{N&&s.current?s.current.flyTo({center:N,zoom:13}):Sa({title:"Location not available",description:"Please enable location services",variant:"destructive"})},W=async()=>{M&&(await i.mutateAsync({contact_id:M.id,popby_item_id:F.popby_item_id||void 0,notes:F.notes||void 0,latitude:N==null?void 0:N[1],longitude:N==null?void 0:N[0]}),P(!1),I(null),D({popby_item_id:"",notes:""}))},G=async()=>{if(x.trim())try{await Y.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),m(x.trim()),Sa({title:"Mapbox token saved!"})}catch{Sa({title:"Error saving token",variant:"destructive"})}};return v?r.jsx(Fr,{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"})})}):u?r.jsx(Fr,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Q,{variant:"ghost",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(Q,{onClick:V,children:[r.jsx(cA,{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"}),U.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(yl,{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."})]})})]}),M&&r.jsx(He,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(et,{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:[M.first_name," ",M.last_name]}),M.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[M.city,", ",M.state]})]}),r.jsx(Q,{size:"sm",variant:"ghost",onClick:()=>I(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[M.isDue?r.jsxs(At,{variant:"destructive",children:[M.daysOverdue,"+ days overdue"]}):r.jsx(At,{variant:"secondary",children:"Up to date"}),M.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",on(new Date(M.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[M.phone&&r.jsx(Q,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${M.phone}`,children:[r.jsx(Ai,{className:"h-4 w-4 mr-1"}),"Call"]})}),M.address&&r.jsxs(Q,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const ee=[M.address,M.city,M.state,M.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(ee)}`,"_blank")},children:[r.jsx(pA,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(Q,{size:"sm",className:"flex-1",onClick:()=>P(!0),children:[r.jsx(ao,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Rr,{open:T,onOpenChange:P,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsxs(Br,{children:["Log Popby for ",M==null?void 0:M.first_name," ",M==null?void 0:M.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Popby Item (optional)"}),r.jsxs(un,{value:F.popby_item_id,onValueChange:ee=>D(ae=>({...ae,popby_item_id:ee})),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select a popby item..."})}),r.jsx(cn,{children:l==null?void 0:l.map(ee=>r.jsx($t,{value:ee.id,children:ee.name},ee.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Notes (optional)"}),r.jsx(Zn,{placeholder:"Any notes about this popby...",value:F.notes,onChange:ee=>D(ae=>({...ae,notes:ee.target.value}))})]}),N&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Do,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),r.jsxs(Q,{onClick:W,disabled:i.isPending,children:[r.jsx(oi,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):t?r.jsx(Fr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(He,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(Do,{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(ze,{children:"Mapbox Public Token"}),r.jsx(lt,{placeholder:"pk.eyJ1I...",value:x,onChange:ee=>y(ee.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(Q,{onClick:G,className:"w-full",children:"Save Token"}),r.jsxs(Q,{variant:"outline",className:"w-full",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Fr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(He,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(yl,{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(Q,{variant:"outline",className:"w-full",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const i5t=I3({property_address:xc().min(1,"Property address is required"),city:xc().optional(),state:xc().optional(),zip:xc().optional(),transaction_type:R8e(["buyer","seller"]),close_date:xc().min(1,"Close date is required"),sale_price:DA().min(0,"Sale price must be positive"),commission_amount:DA().optional(),lead_source_id:xc().optional(),client_type_id:xc().optional(),contact_id:xc().optional(),notes:xc().optional(),is_win:eut()});function CBe({open:e,onOpenChange:t,transaction:n}){const[s,a]=A.useState(!1),[o,l]=A.useState(""),[i,u]=A.useState(!1),[m,x]=A.useState(""),y=uae(),v=ixt(),{data:b}=dae(),{data:N}=qp(),{data:k}=Nf(),M=Lye(),I=axt(),{data:T}=hae(),P=(T==null?void 0:T.show_commission)??!0,F=Qse({resolver:Jse(i5t),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}});A.useEffect(()=>{n?F.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}):F.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,F]);const D=async G=>{const ee={property_address:G.property_address,transaction_type:G.transaction_type,close_date:G.close_date,sale_price:G.sale_price,is_win:G.is_win,commission_amount:G.commission_amount||null,lead_source_id:G.lead_source_id||null,client_type_id:G.client_type_id||null,contact_id:G.contact_id||null,city:G.city||null,state:G.state||null,zip:G.zip||null,notes:G.notes||null};n?await v.mutateAsync({id:n.id,...ee}):await y.mutateAsync(ee),t(!1)},U=async()=>{if(!o.trim())return;const[G,...ee]=o.trim().split(" "),ae=ee.join(" ")||null,oe=await M.mutateAsync({first_name:G,last_name:ae,tagIds:[]});oe&&(F.setValue("contact_id",oe.id),l(""),u(!1),a(!1))},V=async()=>{if(!m.trim())return;const G=await I.mutateAsync(m.trim());G&&(F.setValue("lead_source_id",G.id),x(""))},W=k==null?void 0:k.find(G=>G.id===F.watch("contact_id"));return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx($r,{children:r.jsx(Br,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(Vo,{className:"max-h-[70vh] pr-4",children:r.jsx(eae,{...F,children:r.jsxs("form",{onSubmit:F.handleSubmit(D),className:"space-y-4",children:[r.jsx(Ol,{control:F.control,name:"property_address",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Property Address *"}),r.jsx(Ml,{children:r.jsx(lt,{placeholder:"123 Main St",...G})}),r.jsx(Gu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Ol,{control:F.control,name:"city",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"City"}),r.jsx(Ml,{children:r.jsx(lt,{placeholder:"City",...G})})]})}),r.jsx(Ol,{control:F.control,name:"state",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"State"}),r.jsx(Ml,{children:r.jsx(lt,{placeholder:"TX",...G})})]})}),r.jsx(Ol,{control:F.control,name:"zip",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Zip"}),r.jsx(Ml,{children:r.jsx(lt,{placeholder:"75001",...G})})]})})]}),r.jsx(Ol,{control:F.control,name:"transaction_type",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Transaction Type *"}),r.jsxs(un,{onValueChange:G.onChange,value:G.value,children:[r.jsx(Ml,{children:r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select type"})})}),r.jsxs(cn,{children:[r.jsx($t,{value:"buyer",children:"Buyer"}),r.jsx($t,{value:"seller",children:"Seller"})]})]}),r.jsx(Gu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Ol,{control:F.control,name:"close_date",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Close Date *"}),r.jsx(Ml,{children:r.jsx(lt,{type:"date",...G})}),r.jsx(Gu,{})]})}),r.jsx(Ol,{control:F.control,name:"sale_price",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Sale Price *"}),r.jsx(Ml,{children:r.jsx(lt,{type:"number",placeholder:"0",...G,onChange:ee=>G.onChange(Number(ee.target.value))})}),r.jsx(Gu,{})]})})]}),P&&r.jsx(Ol,{control:F.control,name:"commission_amount",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Commission"}),r.jsx(Ml,{children:r.jsx(lt,{type:"number",placeholder:"0",...G,value:G.value??"",onChange:ee=>G.onChange(ee.target.value?Number(ee.target.value):void 0)})})]})}),r.jsx(Ol,{control:F.control,name:"lead_source_id",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Lead Source"}),r.jsxs(un,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Ml,{children:r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select source"})})}),r.jsx(cn,{children:b==null?void 0:b.map(ee=>r.jsx($t,{value:ee.id,children:ee.name},ee.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{placeholder:"Add custom source...",value:m,onChange:G=>x(G.target.value),className:"flex-1"}),r.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:V,disabled:!m.trim(),children:r.jsx(_n,{className:"h-4 w-4"})})]}),r.jsx(Ol,{control:F.control,name:"client_type_id",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Client Type"}),r.jsxs(un,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Ml,{children:r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select client type"})})}),r.jsx(cn,{children:N==null?void 0:N.map(ee=>r.jsx($t,{value:ee.id,children:ee.name},ee.id))})]})]})}),r.jsx(Ol,{control:F.control,name:"contact_id",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Client Contact"}),r.jsxs(Wc,{open:s,onOpenChange:a,children:[r.jsx(Gc,{asChild:!0,children:r.jsx(Ml,{children:r.jsxs(Q,{variant:"outline",role:"combobox",className:Ut("w-full justify-between",!G.value&&"text-muted-foreground"),children:[W?`${W.first_name} ${W.last_name||""}`.trim():"Select contact",r.jsx(cy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(Tc,{className:"w-full p-0",align:"start",children:[r.jsxs(Py,{children:[r.jsx(Ly,{placeholder:"Search contacts..."}),r.jsxs(Oy,{children:[r.jsx(Dy,{children:r.jsxs("div",{className:"p-2 space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!i&&r.jsxs(Q,{variant:"outline",size:"sm",className:"w-full",onClick:()=>u(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(Ry,{children:k==null?void 0:k.map(ee=>r.jsxs(Fy,{value:`${ee.first_name} ${ee.last_name||""}`,onSelect:()=>{G.onChange(ee.id),a(!1)},children:[r.jsx(mi,{className:Ut("mr-2 h-4 w-4",ee.id===G.value?"opacity-100":"opacity-0")}),ee.first_name," ",ee.last_name||""]},ee.id))})]})]}),i&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(lt,{placeholder:"Enter contact name...",value:o,onChange:ee=>l(ee.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{size:"sm",onClick:U,disabled:!o.trim()||M.isPending,children:"Add Contact"}),r.jsx(Q,{size:"sm",variant:"outline",onClick:()=>{u(!1),l("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(Ol,{control:F.control,name:"notes",render:({field:G})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Notes"}),r.jsx(Ml,{children:r.jsx(Zn,{placeholder:"Any notes about this transaction...",...G})})]})}),r.jsx(Ol,{control:F.control,name:"is_win",render:({field:G})=>r.jsxs(Sl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Cl,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(Ml,{children:r.jsx(As,{checked:G.value,onCheckedChange:G.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:y.isPending||v.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function MBe({transactions:e,showCommission:t,isLoading:n}){const[s,a]=A.useState(null),[o,l]=A.useState(null),[i,u]=A.useState(""),[m,x]=A.useState("all"),[y,v]=A.useState("all"),[b,N]=A.useState("all"),[k,M]=A.useState(!1),I=oxt(),T=uae(),{data:P}=dae(),{data:F}=qp(),D=B3(),U=G=>{const{id:ee,created_at:ae,updated_at:oe,lead_source:pe,client_type:ne,contact:fe,...se}=G;T.mutate(se)},V=()=>{o&&(I.mutate(o),l(null))},W=e.filter(G=>{var fe,se,me,ue;const ee=i===""||G.property_address.toLowerCase().includes(i.toLowerCase())||((se=(fe=G.contact)==null?void 0:fe.first_name)==null?void 0:se.toLowerCase().includes(i.toLowerCase()))||((ue=(me=G.contact)==null?void 0:me.last_name)==null?void 0:ue.toLowerCase().includes(i.toLowerCase())),ae=m==="all"||G.transaction_type===m,oe=y==="all"||G.lead_source_id===y,pe=b==="all"||G.client_type_id===b,ne=!k||G.is_win;return ee&&ae&&oe&&pe&&ne});return n?r.jsx(He,{children:r.jsx(et,{className:"p-6 space-y-4",children:[1,2,3].map(G=>r.jsx(Er,{className:"h-16 w-full"},G))})}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Ht,{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(Gt,{children:["Transactions (",W.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search...",value:i,onChange:G=>u(G.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(un,{value:m,onValueChange:x,children:[r.jsx(ln,{className:"w-[100px]",children:r.jsx(mn,{placeholder:"Type"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Types"}),r.jsx($t,{value:"buyer",children:"Buyer"}),r.jsx($t,{value:"seller",children:"Seller"})]})]}),r.jsxs(un,{value:y,onValueChange:v,children:[r.jsx(ln,{className:"w-[130px]",children:r.jsx(mn,{placeholder:"Lead Source"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Sources"}),P==null?void 0:P.map(G=>r.jsx($t,{value:G.id,children:G.name},G.id))]})]}),r.jsxs(Q,{variant:k?"default":"outline",size:"sm",onClick:()=>M(!k),children:[r.jsx(Bl,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(et,{children:W.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):D?r.jsx("div",{className:"space-y-3",children:W.map(G=>r.jsxs(He,{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:G.property_address}),G.is_win&&r.jsx(Bl,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.city,G.state?`, ${G.state}`:""]})]}),r.jsx(At,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.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: "}),Nje(G.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),tu(G.sale_price)]}),t&&G.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),tu(G.commission_amount)]}),G.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),G.lead_source.name]}),G.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),G.contact.first_name," ",G.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>a(G),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>U(G),children:r.jsx(Po,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>l(G.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})]},G.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Property"}),r.jsx(Mt,{children:"Type"}),r.jsx(Mt,{children:"Close Date"}),r.jsx(Mt,{children:"Sale Price"}),t&&r.jsx(Mt,{children:"Commission"}),r.jsx(Mt,{children:"Lead Source"}),r.jsx(Mt,{children:"Client"}),r.jsx(Mt,{className:"w-[50px]"})]})}),r.jsx(Fs,{children:W.map(G=>{var ee;return r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[G.is_win&&r.jsx(Bl,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:G.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.city,G.state?`, ${G.state}`:""]})]})]})}),r.jsx(yt,{children:r.jsx(At,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.transaction_type})}),r.jsx(yt,{children:Nje(G.close_date)}),r.jsx(yt,{children:tu(G.sale_price)}),t&&r.jsx(yt,{children:G.commission_amount?tu(G.commission_amount):"-"}),r.jsx(yt,{children:((ee=G.lead_source)==null?void 0:ee.name)||"-"}),r.jsx(yt,{children:G.contact?`${G.contact.first_name} ${G.contact.last_name||""}`.trim():"-"}),r.jsx(yt,{children:r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",children:r.jsx(kg,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",children:[r.jsxs(Va,{onClick:()=>a(G),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(Va,{onClick:()=>U(G),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(Va,{onClick:()=>l(G.id),className:"text-destructive",children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},G.id)})})]})})})]}),r.jsx(CBe,{open:!!s,onOpenChange:G=>!G&&a(null),transaction:s||void 0}),r.jsx(Pd,{open:!!o,onOpenChange:G=>!G&&l(null),children:r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Delete Transaction?"}),r.jsx(hd,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:V,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function TBe({goals:e,stats:t,year:n,showCommission:s}){const a=new Date().getMonth()+1,o=new Date().getFullYear()===n?a:12,l=12-o,i=(v,b)=>{if(!b||b===0)return null;const N=Math.min(v/b*100,100),k=Math.max(b-v,0),M=l>0?k/l:0,I=o/12*100,T=N>=I?"ahead":N>=I*.8?"on-track":"behind";return{percent:N,remaining:k,pace:M,status:T}},u=i(t.totalTransactions,e.transactions_goal),m=i(t.totalVolume,e.volume_goal),x=s?i(t.totalCommission,e.gci_goal):null,y=v=>{switch(v){case"ahead":return r.jsxs(At,{className:"bg-green-500 text-white",children:[r.jsx(eh,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(At,{variant:"secondary",children:[r.jsx(K1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(At,{variant:"destructive",children:[r.jsx(qj,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!e.transactions_goal&&!e.volume_goal&&!e.gci_goal?null:r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xy,{className:"h-5 w-5 text-primary"}),r.jsxs(Gt,{children:[n," Goals Progress"]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.transactions_goal&&u&&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(u.status)]}),r.jsx(Mc,{value:u.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(u.percent),"%"]})]}),u.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(u.pace),"/month to hit goal"]})]}),e.volume_goal&&m&&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(m.status)]}),r.jsx(Mc,{value:m.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[tu(t.totalVolume,!0)," of ",tu(e.volume_goal,!0)]}),r.jsxs("span",{children:[Math.round(m.percent),"%"]})]}),m.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",tu(m.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(Mc,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[tu(t.totalCommission,!0)," of ",tu(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 ",tu(x.pace,!0),"/month"]})]})]})})]})}var o5t=Array.isArray,$h=o5t,l5t=typeof Qx=="object"&&Qx&&Qx.Object===Object&&Qx,ABe=l5t,c5t=ABe,d5t=typeof self=="object"&&self&&self.Object===Object&&self,u5t=c5t||d5t||Function("return this")(),cx=u5t,h5t=cx,m5t=h5t.Symbol,jP=m5t,jCe=jP,EBe=Object.prototype,f5t=EBe.hasOwnProperty,p5t=EBe.toString,gT=jCe?jCe.toStringTag:void 0;function g5t(e){var t=f5t.call(e,gT),n=e[gT];try{e[gT]=void 0;var s=!0}catch{}var a=p5t.call(e);return s&&(t?e[gT]=n:delete e[gT]),a}var x5t=g5t,y5t=Object.prototype,v5t=y5t.toString;function _5t(e){return v5t.call(e)}var b5t=_5t,kCe=jP,w5t=x5t,j5t=b5t,k5t="[object Null]",N5t="[object Undefined]",NCe=kCe?kCe.toStringTag:void 0;function S5t(e){return e==null?e===void 0?N5t:k5t:NCe&&NCe in Object(e)?w5t(e):j5t(e)}var Hy=S5t;function C5t(e){return e!=null&&typeof e=="object"}var Wy=C5t,M5t=Hy,T5t=Wy,A5t="[object Symbol]";function E5t(e){return typeof e=="symbol"||T5t(e)&&M5t(e)==A5t}var $3=E5t,I5t=$h,P5t=$3,L5t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,O5t=/^\w*$/;function D5t(e,t){if(I5t(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||P5t(e)?!0:O5t.test(e)||!L5t.test(e)||t!=null&&e in Object(t)}var e1e=D5t;function R5t(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Pv=R5t;const U3=eo(Pv);var F5t=Hy,z5t=Pv,B5t="[object AsyncFunction]",$5t="[object Function]",U5t="[object GeneratorFunction]",q5t="[object Proxy]";function V5t(e){if(!z5t(e))return!1;var t=F5t(e);return t==$5t||t==U5t||t==B5t||t==q5t}var t1e=V5t;const Za=eo(t1e);var H5t=cx,W5t=H5t["__core-js_shared__"],G5t=W5t,Bde=G5t,SCe=function(){var e=/[^.]+$/.exec(Bde&&Bde.keys&&Bde.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function K5t(e){return!!SCe&&SCe in e}var Z5t=K5t,Y5t=Function.prototype,X5t=Y5t.toString;function Q5t(e){if(e!=null){try{return X5t.call(e)}catch{}try{return e+""}catch{}}return""}var IBe=Q5t,J5t=t1e,eMt=Z5t,tMt=Pv,rMt=IBe,nMt=/[\\^$.*+?()[\]{}|]/g,sMt=/^\[object .+?Constructor\]$/,aMt=Function.prototype,iMt=Object.prototype,oMt=aMt.toString,lMt=iMt.hasOwnProperty,cMt=RegExp("^"+oMt.call(lMt).replace(nMt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dMt(e){if(!tMt(e)||eMt(e))return!1;var t=J5t(e)?cMt:sMt;return t.test(rMt(e))}var uMt=dMt;function hMt(e,t){return e==null?void 0:e[t]}var mMt=hMt,fMt=uMt,pMt=mMt;function gMt(e,t){var n=pMt(e,t);return fMt(n)?n:void 0}var Ik=gMt,xMt=Ik,yMt=xMt(Object,"create"),qae=yMt,CCe=qae;function vMt(){this.__data__=CCe?CCe(null):{},this.size=0}var _Mt=vMt;function bMt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var wMt=bMt,jMt=qae,kMt="__lodash_hash_undefined__",NMt=Object.prototype,SMt=NMt.hasOwnProperty;function CMt(e){var t=this.__data__;if(jMt){var n=t[e];return n===kMt?void 0:n}return SMt.call(t,e)?t[e]:void 0}var MMt=CMt,TMt=qae,AMt=Object.prototype,EMt=AMt.hasOwnProperty;function IMt(e){var t=this.__data__;return TMt?t[e]!==void 0:EMt.call(t,e)}var PMt=IMt,LMt=qae,OMt="__lodash_hash_undefined__";function DMt(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=LMt&&t===void 0?OMt:t,this}var RMt=DMt,FMt=_Mt,zMt=wMt,BMt=MMt,$Mt=PMt,UMt=RMt;function q3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var aTt=sTt,iTt=Vae;function oTt(e,t){var n=this.__data__,s=iTt(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}var lTt=oTt,cTt=HMt,dTt=JMt,uTt=rTt,hTt=aTt,mTt=lTt;function V3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},hj=function(t){return yk(t)&&t.indexOf("%")===t.length-1},Rn=function(t){return PAt(t)&&!kP(t)},RAt=function(t){return Ti(t)},fd=function(t){return Rn(t)||yk(t)},FAt=0,NP=function(t){var n=++FAt;return"".concat(t||"").concat(n)},Yu=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Rn(t)&&!yk(t))return s;var o;if(hj(t)){var l=t.indexOf("%");o=n*parseFloat(t.slice(0,l))/100}else o=+t;return kP(o)&&(o=s),a&&o>n&&(o=n),o},h1=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},zAt=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,s={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function WAt(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 LCe={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"},by=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},OCe=null,Ude=null,u1e=function e(t){if(t===OCe&&Array.isArray(Ude))return Ude;var n=[];return A.Children.forEach(t,function(s){Ti(s)||(MAt.isFragment(s)?n=n.concat(e(s.props.children)):n.push(s))}),Ude=n,OCe=t,n};function yf(e,t){var n=[],s=[];return Array.isArray(t)?s=t.map(function(a){return by(a)}):s=[by(t)],u1e(e).forEach(function(a){var o=wm(a,"type.displayName")||wm(a,"type.name");s.indexOf(o)!==-1&&n.push(a)}),n}function nm(e,t){var n=yf(e,t);return n&&n[0]}var DCe=function(t){if(!t||!t.props)return!1;var n=t.props,s=n.width,a=n.height;return!(!Rn(s)||s<=0||!Rn(a)||a<=0)},GAt=["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"],KAt=function(t){return t&&t.type&&yk(t.type)&&GAt.indexOf(t.type)>=0},ZAt=function(t,n,s,a){var o,l=(o=$de==null?void 0:$de[a])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Za(t)&&(a&&l.includes(n)||UAt.includes(n))||s&&d1e.includes(n)},$a=function(t,n,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(A.isValidElement(t)&&(a=t.props),!U3(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;ZAt((i=a)===null||i===void 0?void 0:i[l],l,n,s)&&(o[l]=a[l])}),o},kfe=function e(t,n){if(t===n)return!0;var s=A.Children.count(t);if(s!==A.Children.count(n))return!1;if(s===0)return!0;if(s===1)return RCe(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function eEt(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 Sfe(e){var t=e.children,n=e.width,s=e.height,a=e.viewBox,o=e.className,l=e.style,i=e.title,u=e.desc,m=JAt(e,QAt),x=a||{width:n,height:s,x:0,y:0},y=ui("recharts-surface",o);return dt.createElement("svg",Nfe({},$a(m,!0,"svg"),{className:y,width:n,height:s,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),dt.createElement("title",null,i),dt.createElement("desc",null,u),t)}var tEt=["children","className"];function Cfe(){return Cfe=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 nEt(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 Io=dt.forwardRef(function(e,t){var n=e.children,s=e.className,a=rEt(e,tEt),o=ui("recharts-layer",s);return dt.createElement("g",Cfe({className:o},$a(a,!0),{ref:t}),n)}),Op=function(t,n){for(var s=arguments.length,a=new Array(s>2?s-2:0),o=2;oa?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(a);++s=s?e:iEt(e,t,n)}var lEt=oEt,cEt="\\ud800-\\udfff",dEt="\\u0300-\\u036f",uEt="\\ufe20-\\ufe2f",hEt="\\u20d0-\\u20ff",mEt=dEt+uEt+hEt,fEt="\\ufe0e\\ufe0f",pEt="\\u200d",gEt=RegExp("["+pEt+cEt+mEt+fEt+"]");function xEt(e){return gEt.test(e)}var UBe=xEt;function yEt(e){return e.split("")}var vEt=yEt,qBe="\\ud800-\\udfff",_Et="\\u0300-\\u036f",bEt="\\ufe20-\\ufe2f",wEt="\\u20d0-\\u20ff",jEt=_Et+bEt+wEt,kEt="\\ufe0e\\ufe0f",NEt="["+qBe+"]",Mfe="["+jEt+"]",Tfe="\\ud83c[\\udffb-\\udfff]",SEt="(?:"+Mfe+"|"+Tfe+")",VBe="[^"+qBe+"]",HBe="(?:\\ud83c[\\udde6-\\uddff]){2}",WBe="[\\ud800-\\udbff][\\udc00-\\udfff]",CEt="\\u200d",GBe=SEt+"?",KBe="["+kEt+"]?",MEt="(?:"+CEt+"(?:"+[VBe,HBe,WBe].join("|")+")"+KBe+GBe+")*",TEt=KBe+GBe+MEt,AEt="(?:"+[VBe+Mfe+"?",Mfe,HBe,WBe,NEt].join("|")+")",EEt=RegExp(Tfe+"(?="+Tfe+")|"+AEt+TEt,"g");function IEt(e){return e.match(EEt)||[]}var PEt=IEt,LEt=vEt,OEt=UBe,DEt=PEt;function REt(e){return OEt(e)?DEt(e):LEt(e)}var FEt=REt,zEt=lEt,BEt=UBe,$Et=FEt,UEt=DBe;function qEt(e){return function(t){t=UEt(t);var n=BEt(t)?$Et(t):void 0,s=n?n[0]:t.charAt(0),a=n?zEt(n,1).join(""):t.slice(1);return s[e]()+a}}var VEt=qEt,HEt=VEt,WEt=HEt("toUpperCase"),GEt=WEt;const sie=eo(GEt);function al(e){return function(){return e}}const ZBe=Math.cos,tne=Math.sin,Wp=Math.sqrt,rne=Math.PI,aie=2*rne,Afe=Math.PI,Efe=2*Afe,Kw=1e-6,KEt=Efe-Kw;function YBe(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return YBe;const n=10**t;return function(s){this._+=s[0];for(let a=1,o=s.length;aKw)if(!(Math.abs(y*u-m*x)>Kw)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let b=s-l,N=a-i,k=u*u+m*m,M=b*b+N*N,I=Math.sqrt(k),T=Math.sqrt(v),P=o*Math.tan((Afe-Math.acos((k+v-M)/(2*I*T)))/2),F=P/T,D=P/I;Math.abs(F-1)>Kw&&this._append`L${t+F*x},${n+F*y}`,this._append`A${o},${o},0,0,${+(y*b>x*N)},${this._x1=t+D*u},${this._y1=n+D*m}`}}arc(t,n,s,a,o,l){if(t=+t,n=+n,s=+s,l=!!l,s<0)throw new Error(`negative radius: ${s}`);let i=s*Math.cos(a),u=s*Math.sin(a),m=t+i,x=n+u,y=1^l,v=l?a-o:o-a;this._x1===null?this._append`M${m},${x}`:(Math.abs(this._x1-m)>Kw||Math.abs(this._y1-x)>Kw)&&this._append`L${m},${x}`,s&&(v<0&&(v=v%Efe+Efe),v>KEt?this._append`A${s},${s},0,1,${y},${t-i},${n-u}A${s},${s},0,1,${y},${this._x1=m},${this._y1=x}`:v>Kw&&this._append`A${s},${s},0,${+(v>=Afe)},${y},${this._x1=t+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(t,n,s,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${s=+s}v${+a}h${-s}Z`}toString(){return this._}}function h1e(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 YEt(t)}function m1e(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function XBe(e){this._context=e}XBe.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 iie(e){return new XBe(e)}function QBe(e){return e[0]}function JBe(e){return e[1]}function e$e(e,t){var n=al(!0),s=null,a=iie,o=null,l=h1e(i);e=typeof e=="function"?e:e===void 0?QBe:al(e),t=typeof t=="function"?t:t===void 0?JBe:al(t);function i(u){var m,x=(u=m1e(u)).length,y,v=!1,b;for(s==null&&(o=a(b=l())),m=0;m<=x;++m)!(m=b;--N)i.point(P[N],F[N]);i.lineEnd(),i.areaEnd()}I&&(P[v]=+e(M,v,y),F[v]=+t(M,v,y),i.point(s?+s(M,v,y):P[v],n?+n(M,v,y):F[v]))}if(T)return i=null,T+""||null}function x(){return e$e().defined(a).curve(l).context(o)}return m.x=function(y){return arguments.length?(e=typeof y=="function"?y:al(+y),s=null,m):e},m.x0=function(y){return arguments.length?(e=typeof y=="function"?y:al(+y),m):e},m.x1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:al(+y),m):s},m.y=function(y){return arguments.length?(t=typeof y=="function"?y:al(+y),n=null,m):t},m.y0=function(y){return arguments.length?(t=typeof y=="function"?y:al(+y),m):t},m.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:al(+y),m):n},m.lineX0=m.lineY0=function(){return x().x(e).y(t)},m.lineY1=function(){return x().x(e).y(n)},m.lineX1=function(){return x().x(s).y(t)},m.defined=function(y){return arguments.length?(a=typeof y=="function"?y:al(!!y),m):a},m.curve=function(y){return arguments.length?(l=y,o!=null&&(i=l(o)),m):l},m.context=function(y){return arguments.length?(y==null?o=i=null:i=l(o=y),m):o},m}class t$e{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 XEt(e){return new t$e(e,!0)}function QEt(e){return new t$e(e,!1)}const f1e={draw(e,t){const n=Wp(t/rne);e.moveTo(n,0),e.arc(0,0,n,0,aie)}},JEt={draw(e,t){const n=Wp(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()}},r$e=Wp(1/3),eIt=r$e*2,tIt={draw(e,t){const n=Wp(t/eIt),s=n*r$e;e.moveTo(0,-n),e.lineTo(s,0),e.lineTo(0,n),e.lineTo(-s,0),e.closePath()}},rIt={draw(e,t){const n=Wp(t),s=-n/2;e.rect(s,s,n,n)}},nIt=.8908130915292852,n$e=tne(rne/10)/tne(7*rne/10),sIt=tne(aie/10)*n$e,aIt=-ZBe(aie/10)*n$e,iIt={draw(e,t){const n=Wp(t*nIt),s=sIt*n,a=aIt*n;e.moveTo(0,-n),e.lineTo(s,a);for(let o=1;o<5;++o){const l=aie*o/5,i=ZBe(l),u=tne(l);e.lineTo(u*n,-i*n),e.lineTo(i*s-u*a,u*s+i*a)}e.closePath()}},qde=Wp(3),oIt={draw(e,t){const n=-Wp(t/(qde*3));e.moveTo(0,n*2),e.lineTo(-qde*n,-n),e.lineTo(qde*n,-n),e.closePath()}},Hm=-.5,Wm=Wp(3)/2,Ife=1/Wp(12),lIt=(Ife/2+1)*3,cIt={draw(e,t){const n=Wp(t/lIt),s=n/2,a=n*Ife,o=s,l=n*Ife+n,i=-o,u=l;e.moveTo(s,a),e.lineTo(o,l),e.lineTo(i,u),e.lineTo(Hm*s-Wm*a,Wm*s+Hm*a),e.lineTo(Hm*o-Wm*l,Wm*o+Hm*l),e.lineTo(Hm*i-Wm*u,Wm*i+Hm*u),e.lineTo(Hm*s+Wm*a,Hm*a-Wm*s),e.lineTo(Hm*o+Wm*l,Hm*l-Wm*o),e.lineTo(Hm*i+Wm*u,Hm*u-Wm*i),e.closePath()}};function dIt(e,t){let n=null,s=h1e(a);e=typeof e=="function"?e:al(e||f1e),t=typeof t=="function"?t:al(t===void 0?64:+t);function a(){let o;if(n||(n=o=s()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return a.type=function(o){return arguments.length?(e=typeof o=="function"?o:al(o),a):e},a.size=function(o){return arguments.length?(t=typeof o=="function"?o:al(+o),a):t},a.context=function(o){return arguments.length?(n=o??null,a):n},a}function nne(){}function sne(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 s$e(e){this._context=e}s$e.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:sne(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:sne(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function uIt(e){return new s$e(e)}function a$e(e){this._context=e}a$e.prototype={areaStart:nne,areaEnd:nne,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:sne(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function hIt(e){return new a$e(e)}function i$e(e){this._context=e}i$e.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:sne(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function mIt(e){return new i$e(e)}function o$e(e){this._context=e}o$e.prototype={areaStart:nne,areaEnd:nne,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 fIt(e){return new o$e(e)}function zCe(e){return e<0?-1:1}function BCe(e,t,n){var s=e._x1-e._x0,a=t-e._x1,o=(e._y1-e._y0)/(s||a<0&&-0),l=(n-e._y1)/(a||s<0&&-0),i=(o*a+l*s)/(s+a);return(zCe(o)+zCe(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function $Ce(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Vde(e,t,n){var s=e._x0,a=e._y0,o=e._x1,l=e._y1,i=(o-s)/3;e._context.bezierCurveTo(s+i,a+i*t,o-i,l-i*n,o,l)}function ane(e){this._context=e}ane.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:Vde(this,this._t0,$Ce(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,Vde(this,$Ce(this,n=BCe(this,e,t)),n);break;default:Vde(this,this._t0,n=BCe(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function l$e(e){this._context=new c$e(e)}(l$e.prototype=Object.create(ane.prototype)).point=function(e,t){ane.prototype.point.call(this,t,e)};function c$e(e){this._context=e}c$e.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,a,o){this._context.bezierCurveTo(t,e,s,n,o,a)}};function pIt(e){return new ane(e)}function gIt(e){return new l$e(e)}function d$e(e){this._context=e}d$e.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=UCe(e),a=UCe(t),o=0,l=1;l=0;--t)a[t]=(l[t]-a[t+1])/o[t];for(o[n-1]=(e[n]+a[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 yIt(e){return new oie(e,.5)}function vIt(e){return new oie(e,0)}function _It(e){return new oie(e,1)}function qC(e,t){if((l=e.length)>1)for(var n=1,s,a,o=e[t[0]],l,i=o.length;n=0;)n[t]=t;return n}function bIt(e,t){return e[t]}function wIt(e){const t=[];return t.key=e,t}function jIt(){var e=al([]),t=Pfe,n=qC,s=bIt;function a(o){var l=Array.from(e.apply(this,arguments),wIt),i,u=l.length,m=-1,x;for(const y of o)for(i=0,++m;i0){for(var n,s,a=0,o=e[0].length,l;a0){for(var n=0,s=e[t[0]],a,o=s.length;n0)||!((o=(a=e[t[0]]).length)>0))){for(var n=0,s=1,a,o,l;s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function IIt(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 u$e={symbolCircle:f1e,symbolCross:JEt,symbolDiamond:tIt,symbolSquare:rIt,symbolStar:iIt,symbolTriangle:oIt,symbolWye:cIt},PIt=Math.PI/180,LIt=function(t){var n="symbol".concat(sie(t));return u$e[n]||f1e},OIt=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 a=18*PIt;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),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}},DIt=function(t,n){u$e["symbol".concat(sie(t))]=n},p1e=function(t){var n=t.type,s=n===void 0?"circle":n,a=t.size,o=a===void 0?64:a,l=t.sizeType,i=l===void 0?"area":l,u=EIt(t,CIt),m=VCe(VCe({},u),{},{type:s,size:o,sizeType:i}),x=function(){var M=LIt(s),I=dIt().type(M).size(OIt(o,i,s));return I()},y=m.className,v=m.cx,b=m.cy,N=$a(m,!0);return v===+v&&b===+b&&o===+o?dt.createElement("path",Lfe({},N,{className:ui("recharts-symbols",y),transform:"translate(".concat(v,", ").concat(b,")"),d:x()})):null};p1e.registerSymbol=DIt;function VC(e){"@babel/helpers - typeof";return VC=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},VC(e)}function Ofe(){return Ofe=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var T=b.inactive?m:b.color;return dt.createElement("li",Ofe({className:M,style:y,key:"legend-item-".concat(N)},vk(s.props,b,N)),dt.createElement(Sfe,{width:l,height:l,viewBox:x,style:v},s.renderIcon(b)),dt.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},k?k(I,b,N):I))})}},{key:"render",value:function(){var s=this.props,a=s.payload,o=s.layout,l=s.align;if(!a||!a.length)return null;var i={padding:0,margin:0,textAlign:o==="horizontal"?l:"left"};return dt.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}])}(A.PureComponent);rI(g1e,"displayName","Legend");rI(g1e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var WIt=Hae;function GIt(){this.__data__=new WIt,this.size=0}var KIt=GIt;function ZIt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var YIt=ZIt;function XIt(e){return this.__data__.get(e)}var QIt=XIt;function JIt(e){return this.__data__.has(e)}var ePt=JIt,tPt=Hae,rPt=n1e,nPt=s1e,sPt=200;function aPt(e,t){var n=this.__data__;if(n instanceof tPt){var s=n.__data__;if(!rPt||s.lengthi))return!1;var m=o.get(e),x=o.get(t);if(m&&x)return m==t&&x==e;var y=-1,v=!0,b=n&CPt?new jPt:void 0;for(o.set(e,t),o.set(t,e);++y-1&&e%1==0&&e-1&&e%1==0&&e<=E6t}var _1e=I6t,P6t=Hy,L6t=_1e,O6t=Wy,D6t="[object Arguments]",R6t="[object Array]",F6t="[object Boolean]",z6t="[object Date]",B6t="[object Error]",$6t="[object Function]",U6t="[object Map]",q6t="[object Number]",V6t="[object Object]",H6t="[object RegExp]",W6t="[object Set]",G6t="[object String]",K6t="[object WeakMap]",Z6t="[object ArrayBuffer]",Y6t="[object DataView]",X6t="[object Float32Array]",Q6t="[object Float64Array]",J6t="[object Int8Array]",eLt="[object Int16Array]",tLt="[object Int32Array]",rLt="[object Uint8Array]",nLt="[object Uint8ClampedArray]",sLt="[object Uint16Array]",aLt="[object Uint32Array]",pl={};pl[X6t]=pl[Q6t]=pl[J6t]=pl[eLt]=pl[tLt]=pl[rLt]=pl[nLt]=pl[sLt]=pl[aLt]=!0;pl[D6t]=pl[R6t]=pl[Z6t]=pl[F6t]=pl[Y6t]=pl[z6t]=pl[B6t]=pl[$6t]=pl[U6t]=pl[q6t]=pl[V6t]=pl[H6t]=pl[W6t]=pl[G6t]=pl[K6t]=!1;function iLt(e){return O6t(e)&&L6t(e.length)&&!!pl[P6t(e)]}var oLt=iLt;function lLt(e){return function(t){return e(t)}}var w$e=lLt,cne={exports:{}};cne.exports;(function(e,t){var n=ABe,s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===s,l=o&&n.process,i=function(){try{var u=a&&a.require&&a.require("util").types;return u||l&&l.binding&&l.binding("util")}catch{}}();e.exports=i})(cne,cne.exports);var cLt=cne.exports,dLt=oLt,uLt=w$e,XCe=cLt,QCe=XCe&&XCe.isTypedArray,hLt=QCe?uLt(QCe):dLt,j$e=hLt,mLt=g6t,fLt=y1e,pLt=$h,gLt=b$e,xLt=v1e,yLt=j$e,vLt=Object.prototype,_Lt=vLt.hasOwnProperty;function bLt(e,t){var n=pLt(e),s=!n&&fLt(e),a=!n&&!s&&gLt(e),o=!n&&!s&&!a&&yLt(e),l=n||s||a||o,i=l?mLt(e.length,String):[],u=i.length;for(var m in e)(t||_Lt.call(e,m))&&!(l&&(m=="length"||a&&(m=="offset"||m=="parent")||o&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||xLt(m,u)))&&i.push(m);return i}var wLt=bLt,jLt=Object.prototype;function kLt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||jLt;return e===n}var NLt=kLt;function SLt(e,t){return function(n){return e(t(n))}}var k$e=SLt,CLt=k$e,MLt=CLt(Object.keys,Object),TLt=MLt,ALt=NLt,ELt=TLt,ILt=Object.prototype,PLt=ILt.hasOwnProperty;function LLt(e){if(!ALt(e))return ELt(e);var t=[];for(var n in Object(e))PLt.call(e,n)&&n!="constructor"&&t.push(n);return t}var OLt=LLt,DLt=t1e,RLt=_1e;function FLt(e){return e!=null&&RLt(e.length)&&!DLt(e)}var SP=FLt,zLt=wLt,BLt=OLt,$Lt=SP;function ULt(e){return $Lt(e)?zLt(e):BLt(e)}var lie=ULt,qLt=s6t,VLt=f6t,HLt=lie;function WLt(e){return qLt(e,HLt,VLt)}var GLt=WLt,JCe=GLt,KLt=1,ZLt=Object.prototype,YLt=ZLt.hasOwnProperty;function XLt(e,t,n,s,a,o){var l=n&KLt,i=JCe(e),u=i.length,m=JCe(t),x=m.length;if(u!=x&&!l)return!1;for(var y=u;y--;){var v=i[y];if(!(l?v in t:YLt.call(t,v)))return!1}var b=o.get(e),N=o.get(t);if(b&&N)return b==t&&N==e;var k=!0;o.set(e,t),o.set(t,e);for(var M=l;++y-1}var Z8t=K8t;function Y8t(e,t,n){for(var s=-1,a=e==null?0:e.length;++s=uDt){var m=t?null:cDt(e);if(m)return dDt(m);l=!1,a=lDt,u=new aDt}else u=t?[]:i;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function CDt(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 MDt(e){return e.value}function TDt(e,t){if(dt.isValidElement(e))return dt.cloneElement(e,t);if(typeof e=="function")return dt.createElement(e,t);t.ref;var n=SDt(t,yDt);return dt.createElement(g1e,n)}var p3e=1,rC=function(e){function t(){var n;vDt(this,t);for(var s=arguments.length,a=new Array(s),o=0;op3e||Math.abs(a.height-this.lastBoundingBox.height)>p3e)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,s&&s(a)):(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?zx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,o=a.layout,l=a.align,i=a.verticalAlign,u=a.margin,m=a.chartWidth,x=a.chartHeight,y,v;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(l==="center"&&o==="vertical"){var b=this.getBBoxSnapshot();y={left:((m||0)-b.width)/2}}else y=l==="right"?{right:u&&u.right||0}:{left:u&&u.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(i==="middle"){var N=this.getBBoxSnapshot();v={top:((x||0)-N.height)/2}}else v=i==="bottom"?{bottom:u&&u.bottom||0}:{top:u&&u.top||0};return zx(zx({},y),v)}},{key:"render",value:function(){var s=this,a=this.props,o=a.content,l=a.width,i=a.height,u=a.wrapperStyle,m=a.payloadUniqBy,x=a.payload,y=zx(zx({position:"absolute",width:l||"auto",height:i||"auto"},this.getDefaultPosition(u)),u);return dt.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(b){s.wrapperNode=b}},TDt(o,zx(zx({},this.props),{},{payload:E$e(x,m,MDt)})))}}],[{key:"getWithHeight",value:function(s,a){var o=zx(zx({},this.defaultProps),s.props),l=o.layout;return l==="vertical"&&Rn(s.props.height)?{height:s.props.height}:l==="horizontal"?{width:s.props.width||a}:null}}])}(A.PureComponent);cie(rC,"displayName","Legend");cie(rC,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var g3e=jP,ADt=y1e,EDt=$h,x3e=g3e?g3e.isConcatSpreadable:void 0;function IDt(e){return EDt(e)||ADt(e)||!!(x3e&&e&&e[x3e])}var PDt=IDt,LDt=v$e,ODt=PDt;function L$e(e,t,n,s,a){var o=-1,l=e.length;for(n||(n=ODt),a||(a=[]);++o0&&n(i)?t>1?L$e(i,t-1,n,s,a):LDt(a,i):s||(a[a.length]=i)}return a}var O$e=L$e;function DDt(e){return function(t,n,s){for(var a=-1,o=Object(t),l=s(t),i=l.length;i--;){var u=l[e?i:++a];if(n(o[u],u,o)===!1)break}return t}}var RDt=DDt,FDt=RDt,zDt=FDt(),BDt=zDt,$Dt=BDt,UDt=lie;function qDt(e,t){return e&&$Dt(e,t,UDt)}var D$e=qDt,VDt=SP;function HDt(e,t){return function(n,s){if(n==null)return n;if(!VDt(n))return e(n,s);for(var a=n.length,o=t?a:-1,l=Object(n);(t?o--:++ot||o&&l&&u&&!i&&!m||s&&l&&u||!n&&u||!a)return 1;if(!s&&!o&&!m&&e=i)return u;var m=n[s];return u*(m=="desc"?-1:1)}}return e.index-t.index}var aRt=sRt,Kde=i1e,iRt=o1e,oRt=dx,lRt=R$e,cRt=eRt,dRt=w$e,uRt=aRt,hRt=K3,mRt=$h;function fRt(e,t,n){t.length?t=Kde(t,function(o){return mRt(o)?function(l){return iRt(l,o.length===1?o[0]:o)}:o}):t=[hRt];var s=-1;t=Kde(t,dRt(oRt));var a=lRt(e,function(o,l,i){var u=Kde(t,function(m){return m(o)});return{criteria:u,index:++s,value:o}});return cRt(a,function(o,l){return uRt(o,l,n)})}var pRt=fRt;function gRt(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 xRt=gRt,yRt=xRt,v3e=Math.max;function vRt(e,t,n){return t=v3e(t===void 0?e.length-1:t,0),function(){for(var s=arguments,a=-1,o=v3e(s.length-t,0),l=Array(o);++a0){if(++t>=TRt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var PRt=IRt,LRt=MRt,ORt=PRt,DRt=ORt(LRt),RRt=DRt,FRt=K3,zRt=_Rt,BRt=RRt;function $Rt(e,t){return BRt(zRt(e,t,FRt),e+"")}var URt=$Rt,qRt=r1e,VRt=SP,HRt=v1e,WRt=Pv;function GRt(e,t,n){if(!WRt(n))return!1;var s=typeof t;return(s=="number"?VRt(n)&&HRt(t,n.length):s=="string"&&t in n)?qRt(n[t],e):!1}var die=GRt,KRt=O$e,ZRt=pRt,YRt=URt,b3e=die,XRt=YRt(function(e,t){if(e==null)return[];var n=t.length;return n>1&&b3e(e,t[0],t[1])?t=[]:n>2&&b3e(t[0],t[1],t[2])&&(t=[t[0]]),ZRt(e,KRt(t,1),[])}),QRt=XRt;const j1e=eo(QRt);function nI(e){"@babel/helpers - typeof";return nI=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},nI(e)}function qfe(){return qfe=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(xT,"-left"),Rn(n)&&t&&Rn(t.x)&&n=t.y),"".concat(xT,"-top"),Rn(s)&&t&&Rn(t.y)&&sk?Math.max(x,u[s]):Math.max(y,u[s])}function mFt(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 fFt(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.offsetTopLeft,a=e.position,o=e.reverseDirection,l=e.tooltipBox,i=e.useTranslate3d,u=e.viewBox,m,x,y;return l.height>0&&l.width>0&&n?(x=k3e({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),y=k3e({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),m=mFt({translateX:x,translateY:y,useTranslate3d:i})):m=uFt,{cssProperties:m,cssClasses:hFt({translateX:x,translateY:y,coordinate:n})}}function WC(e){"@babel/helpers - typeof";return WC=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},WC(e)}function N3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function S3e(e){for(var t=1;tC3e||Math.abs(s.height-this.state.lastBoundingBox.height)>C3e)&&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,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,a=this.props,o=a.active,l=a.allowEscapeViewBox,i=a.animationDuration,u=a.animationEasing,m=a.children,x=a.coordinate,y=a.hasPayload,v=a.isAnimationActive,b=a.offset,N=a.position,k=a.reverseDirection,M=a.useTranslate3d,I=a.viewBox,T=a.wrapperStyle,P=fFt({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:b,position:N,reverseDirection:k,tooltipBox:this.state.lastBoundingBox,useTranslate3d:M,viewBox:I}),F=P.cssClasses,D=P.cssProperties,U=S3e(S3e({transition:v&&o?"transform ".concat(i,"ms ").concat(u):void 0},D),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},T);return dt.createElement("div",{tabIndex:-1,className:F,style:U,ref:function(W){s.wrapperNode=W}},m)}}])}(A.PureComponent),kFt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Z3={isSsr:kFt()};function GC(e){"@babel/helpers - typeof";return GC=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},GC(e)}function M3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function T3e(e){for(var t=1;t0;return dt.createElement(jFt,{allowEscapeViewBox:l,animationDuration:i,animationEasing:u,isAnimationActive:v,active:o,coordinate:x,hasPayload:U,offset:b,position:M,reverseDirection:I,useTranslate3d:T,viewBox:P,wrapperStyle:F},LFt(m,T3e(T3e({},this.props),{},{payload:D})))}}])}(A.PureComponent);k1e(mp,"displayName","Tooltip");k1e(mp,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Z3.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 OFt=cx,DFt=function(){return OFt.Date.now()},RFt=DFt,FFt=/\s/;function zFt(e){for(var t=e.length;t--&&FFt.test(e.charAt(t)););return t}var BFt=zFt,$Ft=BFt,UFt=/^\s+/;function qFt(e){return e&&e.slice(0,$Ft(e)+1).replace(UFt,"")}var VFt=qFt,HFt=VFt,A3e=Pv,WFt=$3,E3e=NaN,GFt=/^[-+]0x[0-9a-f]+$/i,KFt=/^0b[01]+$/i,ZFt=/^0o[0-7]+$/i,YFt=parseInt;function XFt(e){if(typeof e=="number")return e;if(WFt(e))return E3e;if(A3e(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=A3e(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=HFt(e);var n=KFt.test(e);return n||ZFt.test(e)?YFt(e.slice(2),n?2:8):GFt.test(e)?E3e:+e}var q$e=XFt,QFt=Pv,Yde=RFt,I3e=q$e,JFt="Expected a function",ezt=Math.max,tzt=Math.min;function rzt(e,t,n){var s,a,o,l,i,u,m=0,x=!1,y=!1,v=!0;if(typeof e!="function")throw new TypeError(JFt);t=I3e(t)||0,QFt(n)&&(x=!!n.leading,y="maxWait"in n,o=y?ezt(I3e(n.maxWait)||0,t):o,v="trailing"in n?!!n.trailing:v);function b(U){var V=s,W=a;return s=a=void 0,m=U,l=e.apply(W,V),l}function N(U){return m=U,i=setTimeout(I,t),x?b(U):l}function k(U){var V=U-u,W=U-m,G=t-V;return y?tzt(G,o-W):G}function M(U){var V=U-u,W=U-m;return u===void 0||V>=t||V<0||y&&W>=o}function I(){var U=Yde();if(M(U))return T(U);i=setTimeout(I,k(U))}function T(U){return i=void 0,v&&s?b(U):(s=a=void 0,l)}function P(){i!==void 0&&clearTimeout(i),m=0,s=u=a=i=void 0}function F(){return i===void 0?l:T(Yde())}function D(){var U=Yde(),V=M(U);if(s=arguments,a=this,u=U,V){if(i===void 0)return N(u);if(y)return clearTimeout(i),i=setTimeout(I,t),b(u)}return i===void 0&&(i=setTimeout(I,t)),l}return D.cancel=P,D.flush=F,D}var nzt=rzt,szt=nzt,azt=Pv,izt="Expected a function";function ozt(e,t,n){var s=!0,a=!0;if(typeof e!="function")throw new TypeError(izt);return azt(n)&&(s="leading"in n?!!n.leading:s,a="trailing"in n?!!n.trailing:a),szt(e,t,{leading:s,maxWait:t,trailing:a})}var lzt=ozt;const V$e=eo(lzt);function aI(e){"@babel/helpers - typeof";return aI=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},aI(e)}function P3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function IO(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&(pe=V$e(pe,k,{trailing:!0,leading:!1}));var ne=new ResizeObserver(pe),fe=D.current.getBoundingClientRect(),se=fe.width,me=fe.height;return ae(se,me),ne.observe(D.current),function(){ne.disconnect()}},[ae,k]);var oe=A.useMemo(function(){var pe=G.containerWidth,ne=G.containerHeight;if(pe<0||ne<0)return null;Op(hj(l)||hj(u),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,u),Op(!n||n>0,"The aspect(%s) must be greater than zero.",n);var fe=hj(l)?pe:l,se=hj(u)?ne:u;n&&n>0&&(fe?se=fe/n:se&&(fe=se*n),v&&se>v&&(se=v)),Op(fe>0||se>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.`,fe,se,l,u,x,y,n);var me=!Array.isArray(b)&&by(b.type).endsWith("Chart");return dt.Children.map(b,function(ue){return dt.isValidElement(ue)?A.cloneElement(ue,IO({width:fe,height:se},me?{style:IO({height:"100%",width:"100%",maxHeight:se,maxWidth:fe},ue.props.style)}:{})):ue})},[n,b,u,v,y,x,G,l]);return dt.createElement("div",{id:M?"".concat(M):void 0,className:ui("recharts-responsive-container",I),style:IO(IO({},F),{},{width:l,height:u,minWidth:x,minHeight:y,maxHeight:v}),ref:D},oe)}),uie=function(t){return null};uie.displayName="Cell";function iI(e){"@babel/helpers - typeof";return iI=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},iI(e)}function O3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Kfe(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Z3.isSsr)return{width:0,height:0};var s=wzt(n),a=JSON.stringify({text:t,copyStyle:s});if(OS.widthCache[a])return OS.widthCache[a];try{var o=document.getElementById(D3e);o||(o=document.createElement("span"),o.setAttribute("id",D3e),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Kfe(Kfe({},bzt),s);Object.assign(o.style,l),o.textContent="".concat(t);var i=o.getBoundingClientRect(),u={width:i.width,height:i.height};return OS.widthCache[a]=u,++OS.cacheCount>_zt&&(OS.cacheCount=0,OS.widthCache={}),u}catch{return{width:0,height:0}}},jzt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function oI(e){"@babel/helpers - typeof";return oI=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},oI(e)}function mne(e,t){return Czt(e)||Szt(e,t)||Nzt(e,t)||kzt()}function kzt(){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 Nzt(e,t){if(e){if(typeof e=="string")return R3e(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 R3e(e,t)}}function R3e(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 $zt(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 q3e(e,t){return Hzt(e)||Vzt(e,t)||qzt(e,t)||Uzt()}function Uzt(){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 qzt(e,t){if(e){if(typeof e=="string")return V3e(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 V3e(e,t)}}function V3e(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 fe.reduce(function(se,me){var ue=me.word,xe=me.width,Te=se[se.length-1];if(Te&&(a==null||o||Te.width+xe+sme.width?se:me})};if(!x)return b;for(var k="…",M=function(fe){var se=y.slice(0,fe),me=K$e({breakAll:m,style:u,children:se+k}).wordsWithComputedWidth,ue=v(me),xe=ue.length>l||N(ue).width>Number(a);return[xe,ue]},I=0,T=y.length-1,P=0,F;I<=T&&P<=y.length-1;){var D=Math.floor((I+T)/2),U=D-1,V=M(U),W=q3e(V,2),G=W[0],ee=W[1],ae=M(D),oe=q3e(ae,1),pe=oe[0];if(!G&&!pe&&(I=D+1),G&&pe&&(T=D-1),!G&&pe){F=ee;break}P++}return F||b},H3e=function(t){var n=Ti(t)?[]:t.toString().split(G$e);return[{words:n}]},Gzt=function(t){var n=t.width,s=t.scaleToFit,a=t.children,o=t.style,l=t.breakAll,i=t.maxLines;if((n||s)&&!Z3.isSsr){var u,m,x=K$e({breakAll:l,children:a,style:o});if(x){var y=x.wordsWithComputedWidth,v=x.spaceWidth;u=y,m=v}else return H3e(a);return Wzt({breakAll:l,children:a,maxLines:i,style:o},u,m,n,s)}return H3e(a)},W3e="#808080",_k=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,o=a===void 0?0:a,l=t.lineHeight,i=l===void 0?"1em":l,u=t.capHeight,m=u===void 0?"0.71em":u,x=t.scaleToFit,y=x===void 0?!1:x,v=t.textAnchor,b=v===void 0?"start":v,N=t.verticalAnchor,k=N===void 0?"end":N,M=t.fill,I=M===void 0?W3e:M,T=U3e(t,zzt),P=A.useMemo(function(){return Gzt({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]),F=T.dx,D=T.dy,U=T.angle,V=T.className,W=T.breakAll,G=U3e(T,Bzt);if(!fd(s)||!fd(o))return null;var ee=s+(Rn(F)?F:0),ae=o+(Rn(D)?D:0),oe;switch(k){case"start":oe=Xde("calc(".concat(m,")"));break;case"middle":oe=Xde("calc(".concat((P.length-1)/2," * -").concat(i," + (").concat(m," / 2))"));break;default:oe=Xde("calc(".concat(P.length-1," * -").concat(i,")"));break}var pe=[];if(y){var ne=P[0].width,fe=T.width;pe.push("scale(".concat((Rn(fe)?fe/ne:1)/ne,")"))}return U&&pe.push("rotate(".concat(U,", ").concat(ee,", ").concat(ae,")")),pe.length&&(G.transform=pe.join(" ")),dt.createElement("text",Zfe({},$a(G,!0),{x:ee,y:ae,className:ui("recharts-text",V),textAnchor:b,fill:I.includes("url")?W3e:I}),P.map(function(se,me){var ue=se.words.join(W?"":" ");return dt.createElement("tspan",{x:ee,dy:me===0?oe:i,key:"".concat(ue,"-").concat(me)},ue)}))};function ov(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Kzt(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function N1e(e){let t,n,s;e.length!==2?(t=ov,n=(i,u)=>ov(e(i),u),s=(i,u)=>e(i)-u):(t=e===ov||e===Kzt?e:Zzt,n=e,s=e);function a(i,u,m=0,x=i.length){if(m>>1;n(i[y],u)<0?m=y+1:x=y}while(m>>1;n(i[y],u)<=0?m=y+1:x=y}while(mm&&s(i[y-1],u)>-s(i[y],u)?y-1:y}return{left:a,center:l,right:o}}function Zzt(){return 0}function Z$e(e){return e===null?NaN:+e}function*Yzt(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const Xzt=N1e(ov),CP=Xzt.right;N1e(Z$e).center;class G3e extends Map{constructor(t,n=e7t){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[s,a]of t)this.set(s,a)}get(t){return super.get(K3e(this,t))}has(t){return super.has(K3e(this,t))}set(t,n){return super.set(Qzt(this,t),n)}delete(t){return super.delete(Jzt(this,t))}}function K3e({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function Qzt({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function Jzt({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function e7t(e){return e!==null&&typeof e=="object"?e.valueOf():e}function t7t(e=ov){if(e===ov)return Y$e;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 Y$e(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const r7t=Math.sqrt(50),n7t=Math.sqrt(10),s7t=Math.sqrt(2);function fne(e,t,n){const s=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(s)),o=s/Math.pow(10,a),l=o>=r7t?10:o>=n7t?5:o>=s7t?2:1;let i,u,m;return a<0?(m=Math.pow(10,-a)/l,i=Math.round(e*m),u=Math.round(t*m),i/mt&&--u,m=-m):(m=Math.pow(10,a)*l,i=Math.round(e/m),u=Math.round(t/m),i*mt&&--u),u0))return[];if(e===t)return[e];const s=t=a))return[];const i=o-a+1,u=new Array(i);if(s)if(l<0)for(let m=0;m=s)&&(n=s);return n}function Y3e(e,t){let n;for(const s of e)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function X$e(e,t,n=0,s=1/0,a){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(a=a===void 0?Y$e:t7t(a);s>n;){if(s-n>600){const u=s-n+1,m=t-n+1,x=Math.log(u),y=.5*Math.exp(2*x/3),v=.5*Math.sqrt(x*y*(u-y)/u)*(m-u/2<0?-1:1),b=Math.max(n,Math.floor(t-m*y/u+v)),N=Math.min(s,Math.floor(t+(u-m)*y/u+v));X$e(e,t,b,N,a)}const o=e[t];let l=n,i=s;for(yT(e,n,t),a(e[s],o)>0&&yT(e,n,s);l0;)--i}a(e[n],o)===0?yT(e,n,i):(++i,yT(e,i,s)),i<=t&&(n=i+1),t<=i&&(s=i-1)}return e}function yT(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function a7t(e,t,n){if(e=Float64Array.from(Yzt(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return Y3e(e);if(t>=1)return Z3e(e);var s,a=(s-1)*t,o=Math.floor(a),l=Z3e(X$e(e,o).subarray(0,o+1)),i=Y3e(e.subarray(o+1));return l+(i-l)*(a-o)}}function i7t(e,t,n=Z$e){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,a=(s-1)*t,o=Math.floor(a),l=+n(e[o],o,e),i=+n(e[o+1],o+1,e);return l+(i-l)*(a-o)}}function o7t(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var s=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(a);++s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?LO(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?LO(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=c7t.exec(e))?new Eh(t[1],t[2],t[3],1):(t=d7t.exec(e))?new Eh(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=u7t.exec(e))?LO(t[1],t[2],t[3],t[4]):(t=h7t.exec(e))?LO(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=m7t.exec(e))?n5e(t[1],t[2]/100,t[3]/100,1):(t=f7t.exec(e))?n5e(t[1],t[2]/100,t[3]/100,t[4]):X3e.hasOwnProperty(e)?e5e(X3e[e]):e==="transparent"?new Eh(NaN,NaN,NaN,0):null}function e5e(e){return new Eh(e>>16&255,e>>8&255,e&255,1)}function LO(e,t,n,s){return s<=0&&(e=t=n=NaN),new Eh(e,t,n,s)}function x7t(e){return e instanceof MP||(e=uI(e)),e?(e=e.rgb(),new Eh(e.r,e.g,e.b,e.opacity)):new Eh}function epe(e,t,n,s){return arguments.length===1?x7t(e):new Eh(e,t,n,s??1)}function Eh(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}C1e(Eh,epe,J$e(MP,{brighter(e){return e=e==null?pne:Math.pow(pne,e),new Eh(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cI:Math.pow(cI,e),new Eh(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Eh(Yj(this.r),Yj(this.g),Yj(this.b),gne(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:t5e,formatHex:t5e,formatHex8:y7t,formatRgb:r5e,toString:r5e}));function t5e(){return`#${mj(this.r)}${mj(this.g)}${mj(this.b)}`}function y7t(){return`#${mj(this.r)}${mj(this.g)}${mj(this.b)}${mj((isNaN(this.opacity)?1:this.opacity)*255)}`}function r5e(){const e=gne(this.opacity);return`${e===1?"rgb(":"rgba("}${Yj(this.r)}, ${Yj(this.g)}, ${Yj(this.b)}${e===1?")":`, ${e})`}`}function gne(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Yj(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mj(e){return e=Yj(e),(e<16?"0":"")+e.toString(16)}function n5e(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new _p(e,t,n,s)}function eUe(e){if(e instanceof _p)return new _p(e.h,e.s,e.l,e.opacity);if(e instanceof MP||(e=uI(e)),!e)return new _p;if(e instanceof _p)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),o=Math.max(t,n,s),l=NaN,i=o-a,u=(o+a)/2;return i?(t===o?l=(n-s)/i+(n0&&u<1?0:l,new _p(l,i,u,e.opacity)}function v7t(e,t,n,s){return arguments.length===1?eUe(e):new _p(e,t,n,s??1)}function _p(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}C1e(_p,v7t,J$e(MP,{brighter(e){return e=e==null?pne:Math.pow(pne,e),new _p(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cI:Math.pow(cI,e),new _p(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,a=2*n-s;return new Eh(Qde(e>=240?e-240:e+120,a,s),Qde(e,a,s),Qde(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new _p(s5e(this.h),OO(this.s),OO(this.l),gne(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=gne(this.opacity);return`${e===1?"hsl(":"hsla("}${s5e(this.h)}, ${OO(this.s)*100}%, ${OO(this.l)*100}%${e===1?")":`, ${e})`}`}}));function s5e(e){return e=(e||0)%360,e<0?e+360:e}function OO(e){return Math.max(0,Math.min(1,e||0))}function Qde(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 M1e=e=>()=>e;function _7t(e,t){return function(n){return e+n*t}}function b7t(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 w7t(e){return(e=+e)==1?tUe:function(t,n){return n-t?b7t(t,n,e):M1e(isNaN(t)?n:t)}}function tUe(e,t){var n=t-e;return n?_7t(e,n):M1e(isNaN(e)?t:e)}const a5e=function e(t){var n=w7t(t);function s(a,o){var l=n((a=epe(a)).r,(o=epe(o)).r),i=n(a.g,o.g),u=n(a.b,o.b),m=tUe(a.opacity,o.opacity);return function(x){return a.r=l(x),a.g=i(x),a.b=u(x),a.opacity=m(x),a+""}}return s.gamma=e,s}(1);function j7t(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),a;return function(o){for(a=0;an&&(o=t.slice(n,o),i[l]?i[l]+=o:i[++l]=o),(s=s[0])===(a=a[0])?i[l]?i[l]+=a:i[++l]=a:(i[++l]=null,u.push({i:l,x:xne(s,a)})),n=Jde.lastIndex;return nt&&(n=e,e=t,t=n),function(s){return Math.max(e,Math.min(t,s))}}function L7t(e,t,n){var s=e[0],a=e[1],o=t[0],l=t[1];return a2?O7t:L7t,u=m=null,y}function y(v){return v==null||isNaN(v=+v)?o:(u||(u=i(e.map(s),t,n)))(s(l(v)))}return y.invert=function(v){return l(a((m||(m=i(t,e.map(s),xne)))(v)))},y.domain=function(v){return arguments.length?(e=Array.from(v,yne),x()):e.slice()},y.range=function(v){return arguments.length?(t=Array.from(v),x()):t.slice()},y.rangeRound=function(v){return t=Array.from(v),n=T1e,x()},y.clamp=function(v){return arguments.length?(l=v?!0:Xu,x()):l!==Xu},y.interpolate=function(v){return arguments.length?(n=v,x()):n},y.unknown=function(v){return arguments.length?(o=v,y):o},function(v,b){return s=v,a=b,x()}}function A1e(){return hie()(Xu,Xu)}function D7t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function vne(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 KC(e){return e=vne(Math.abs(e)),e?e[1]:NaN}function R7t(e,t){return function(n,s){for(var a=n.length,o=[],l=0,i=e[0],u=0;a>0&&i>0&&(u+i+1>s&&(i=Math.max(1,s-u)),o.push(n.substring(a-=i,a+i)),!((u+=i+1)>s));)i=e[l=(l+1)%e.length];return o.reverse().join(t)}}function F7t(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var z7t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function hI(e){if(!(t=z7t.exec(e)))throw new Error("invalid format: "+e);var t;return new E1e({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]})}hI.prototype=E1e.prototype;function E1e(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+""}E1e.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 B7t(e){e:for(var t=e.length,n=1,s=-1,a;n0&&(s=0);break}return s>0?e.slice(0,s)+e.slice(a+1):e}var rUe;function $7t(e,t){var n=vne(e,t);if(!n)return e+"";var s=n[0],a=n[1],o=a-(rUe=Math.max(-8,Math.min(8,Math.floor(a/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")+vne(e,Math.max(0,t+o-1))[0]}function o5e(e,t){var n=vne(e,t);if(!n)return e+"";var s=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+s:s.length>a+1?s.slice(0,a+1)+"."+s.slice(a+1):s+new Array(a-s.length+2).join("0")}const l5e={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:D7t,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)=>o5e(e*100,t),r:o5e,s:$7t,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function c5e(e){return e}var d5e=Array.prototype.map,u5e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function U7t(e){var t=e.grouping===void 0||e.thousands===void 0?c5e:R7t(d5e.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",s=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?c5e:F7t(d5e.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",i=e.minus===void 0?"−":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function m(y){y=hI(y);var v=y.fill,b=y.align,N=y.sign,k=y.symbol,M=y.zero,I=y.width,T=y.comma,P=y.precision,F=y.trim,D=y.type;D==="n"?(T=!0,D="g"):l5e[D]||(P===void 0&&(P=12),F=!0,D="g"),(M||v==="0"&&b==="=")&&(M=!0,v="0",b="=");var U=k==="$"?n:k==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():"",V=k==="$"?s:/[%p]/.test(D)?l:"",W=l5e[D],G=/[defgprs%]/.test(D);P=P===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function ee(ae){var oe=U,pe=V,ne,fe,se;if(D==="c")pe=W(ae)+pe,ae="";else{ae=+ae;var me=ae<0||1/ae<0;if(ae=isNaN(ae)?u:W(Math.abs(ae),P),F&&(ae=B7t(ae)),me&&+ae==0&&N!=="+"&&(me=!1),oe=(me?N==="("?N:i:N==="-"||N==="("?"":N)+oe,pe=(D==="s"?u5e[8+rUe/3]:"")+pe+(me&&N==="("?")":""),G){for(ne=-1,fe=ae.length;++nese||se>57){pe=(se===46?a+ae.slice(ne+1):ae.slice(ne))+pe,ae=ae.slice(0,ne);break}}}T&&!M&&(ae=t(ae,1/0));var ue=oe.length+ae.length+pe.length,xe=ue>1)+oe+ae+pe+xe.slice(ue);break;default:ae=xe+oe+ae+pe;break}return o(ae)}return ee.toString=function(){return y+""},ee}function x(y,v){var b=m((y=hI(y),y.type="f",y)),N=Math.max(-8,Math.min(8,Math.floor(KC(v)/3)))*3,k=Math.pow(10,-N),M=u5e[8+N/3];return function(I){return b(k*I)+M}}return{format:m,formatPrefix:x}}var DO,I1e,nUe;q7t({thousands:",",grouping:[3],currency:["$",""]});function q7t(e){return DO=U7t(e),I1e=DO.format,nUe=DO.formatPrefix,DO}function V7t(e){return Math.max(0,-KC(Math.abs(e)))}function H7t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(KC(t)/3)))*3-KC(Math.abs(e)))}function W7t(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,KC(t)-KC(e))+1}function sUe(e,t,n,s){var a=Qfe(e,t,n),o;switch(s=hI(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(o=H7t(a,l))&&(s.precision=o),nUe(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=W7t(a,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=V7t(a))&&(s.precision=o-(s.type==="%")*2);break}}return I1e(s)}function Lv(e){var t=e.domain;return e.ticks=function(n){var s=t();return Yfe(s[0],s[s.length-1],n??10)},e.tickFormat=function(n,s){var a=t();return sUe(a[0],a[a.length-1],n??10,s)},e.nice=function(n){n==null&&(n=10);var s=t(),a=0,o=s.length-1,l=s[a],i=s[o],u,m,x=10;for(i0;){if(m=Xfe(l,i,n),m===u)return s[a]=l,s[o]=i,t(s);if(m>0)l=Math.floor(l/m)*m,i=Math.ceil(i/m)*m;else if(m<0)l=Math.ceil(l*m)/m,i=Math.floor(i*m)/m;else break;u=m}return e},e}function _ne(){var e=A1e();return e.copy=function(){return TP(e,_ne())},Cf.apply(e,arguments),Lv(e)}function aUe(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,yne),n):e.slice()},n.unknown=function(s){return arguments.length?(t=s,n):t},n.copy=function(){return aUe(e).unknown(t)},e=arguments.length?Array.from(e,yne):[0,1],Lv(n)}function iUe(e,t){e=e.slice();var n=0,s=e.length-1,a=e[n],o=e[s],l;return oMath.pow(e,t)}function X7t(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 f5e(e){return(t,n)=>-e(-t,n)}function P1e(e){const t=e(h5e,m5e),n=t.domain;let s=10,a,o;function l(){return a=X7t(s),o=Y7t(s),n()[0]<0?(a=f5e(a),o=f5e(o),e(G7t,K7t)):e(h5e,m5e),t}return t.base=function(i){return arguments.length?(s=+i,l()):s},t.domain=function(i){return arguments.length?(n(i),l()):n()},t.ticks=i=>{const u=n();let m=u[0],x=u[u.length-1];const y=x0){for(;v<=b;++v)for(N=1;Nx)break;I.push(k)}}else for(;v<=b;++v)for(N=s-1;N>=1;--N)if(k=v>0?N/o(-v):N*o(v),!(kx)break;I.push(k)}I.length*2{if(i==null&&(i=10),u==null&&(u=s===10?"s":","),typeof u!="function"&&(!(s%1)&&(u=hI(u)).precision==null&&(u.trim=!0),u=I1e(u)),i===1/0)return u;const m=Math.max(1,s*i/t.ticks().length);return x=>{let y=x/o(Math.round(a(x)));return y*sn(iUe(n(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),t}function oUe(){const e=P1e(hie()).domain([1,10]);return e.copy=()=>TP(e,oUe()).base(e.base()),Cf.apply(e,arguments),e}function p5e(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function g5e(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function L1e(e){var t=1,n=e(p5e(t),g5e(t));return n.constant=function(s){return arguments.length?e(p5e(t=+s),g5e(t)):t},Lv(n)}function lUe(){var e=L1e(hie());return e.copy=function(){return TP(e,lUe()).constant(e.constant())},Cf.apply(e,arguments)}function x5e(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Q7t(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function J7t(e){return e<0?-e*e:e*e}function O1e(e){var t=e(Xu,Xu),n=1;function s(){return n===1?e(Xu,Xu):n===.5?e(Q7t,J7t):e(x5e(n),x5e(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,s()):n},Lv(t)}function D1e(){var e=O1e(hie());return e.copy=function(){return TP(e,D1e()).exponent(e.exponent())},Cf.apply(e,arguments),e}function e9t(){return D1e.apply(null,arguments).exponent(.5)}function y5e(e){return Math.sign(e)*e*e}function t9t(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function cUe(){var e=A1e(),t=[0,1],n=!1,s;function a(o){var l=t9t(e(o));return isNaN(l)?s:n?Math.round(l):l}return a.invert=function(o){return e.invert(y5e(o))},a.domain=function(o){return arguments.length?(e.domain(o),a):e.domain()},a.range=function(o){return arguments.length?(e.range((t=Array.from(o,yne)).map(y5e)),a):t.slice()},a.rangeRound=function(o){return a.range(o).round(!0)},a.round=function(o){return arguments.length?(n=!!o,a):n},a.clamp=function(o){return arguments.length?(e.clamp(o),a):e.clamp()},a.unknown=function(o){return arguments.length?(s=o,a):s},a.copy=function(){return cUe(e.domain(),t).round(n).clamp(e.clamp()).unknown(s)},Cf.apply(a,arguments),Lv(a)}function dUe(){var e=[],t=[],n=[],s;function a(){var l=0,i=Math.max(1,t.length);for(n=new Array(i-1);++l0?n[i-1]:e[0],i=n?[s[n-1],t]:[s[m-1],s[m]]},l.unknown=function(u){return arguments.length&&(o=u),l},l.thresholds=function(){return s.slice()},l.copy=function(){return uUe().domain([e,t]).range(a).unknown(o)},Cf.apply(Lv(l),arguments)}function hUe(){var e=[.5],t=[0,1],n,s=1;function a(o){return o!=null&&o<=o?t[CP(e,o,0,s)]:n}return a.domain=function(o){return arguments.length?(e=Array.from(o),s=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(o){return arguments.length?(t=Array.from(o),s=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(o){var l=t.indexOf(o);return[e[l-1],e[l]]},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return hUe().domain(e).range(t).unknown(n)},Cf.apply(a,arguments)}const eue=new Date,tue=new Date;function xd(e,t,n,s){function a(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(e(o=new Date(+o)),o),a.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),a.round=o=>{const l=a(o),i=a.ceil(o);return o-l(t(o=new Date(+o),l==null?1:Math.floor(l)),o),a.range=(o,l,i)=>{const u=[];if(o=a.ceil(o),i=i==null?1:Math.floor(i),!(o0))return u;let m;do u.push(m=new Date(+o)),t(o,i),e(o);while(mxd(l=>{if(l>=l)for(;e(l),!o(l);)l.setTime(l-1)},(l,i)=>{if(l>=l)if(i<0)for(;++i<=0;)for(;t(l,-1),!o(l););else for(;--i>=0;)for(;t(l,1),!o(l););}),n&&(a.count=(o,l)=>(eue.setTime(+o),tue.setTime(+l),e(eue),e(tue),Math.floor(n(eue,tue))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(s?l=>s(l)%o===0:l=>a.count(0,l)%o===0):a)),a}const bne=xd(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);bne.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xd(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):bne);bne.range;const ny=1e3,lf=ny*60,sy=lf*60,zy=sy*24,R1e=zy*7,v5e=zy*30,rue=zy*365,fj=xd(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ny)},(e,t)=>(t-e)/ny,e=>e.getUTCSeconds());fj.range;const F1e=xd(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ny)},(e,t)=>{e.setTime(+e+t*lf)},(e,t)=>(t-e)/lf,e=>e.getMinutes());F1e.range;const z1e=xd(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*lf)},(e,t)=>(t-e)/lf,e=>e.getUTCMinutes());z1e.range;const B1e=xd(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ny-e.getMinutes()*lf)},(e,t)=>{e.setTime(+e+t*sy)},(e,t)=>(t-e)/sy,e=>e.getHours());B1e.range;const $1e=xd(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*sy)},(e,t)=>(t-e)/sy,e=>e.getUTCHours());$1e.range;const AP=xd(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*lf)/zy,e=>e.getDate()-1);AP.range;const mie=xd(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/zy,e=>e.getUTCDate()-1);mie.range;const mUe=xd(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/zy,e=>Math.floor(e/zy));mUe.range;function Pk(e){return xd(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())*lf)/R1e)}const fie=Pk(0),wne=Pk(1),r9t=Pk(2),n9t=Pk(3),ZC=Pk(4),s9t=Pk(5),a9t=Pk(6);fie.range;wne.range;r9t.range;n9t.range;ZC.range;s9t.range;a9t.range;function Lk(e){return xd(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)/R1e)}const pie=Lk(0),jne=Lk(1),i9t=Lk(2),o9t=Lk(3),YC=Lk(4),l9t=Lk(5),c9t=Lk(6);pie.range;jne.range;i9t.range;o9t.range;YC.range;l9t.range;c9t.range;const U1e=xd(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());U1e.range;const q1e=xd(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());q1e.range;const By=xd(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());By.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xd(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)});By.range;const $y=xd(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());$y.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xd(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)});$y.range;function fUe(e,t,n,s,a,o){const l=[[fj,1,ny],[fj,5,5*ny],[fj,15,15*ny],[fj,30,30*ny],[o,1,lf],[o,5,5*lf],[o,15,15*lf],[o,30,30*lf],[a,1,sy],[a,3,3*sy],[a,6,6*sy],[a,12,12*sy],[s,1,zy],[s,2,2*zy],[n,1,R1e],[t,1,v5e],[t,3,3*v5e],[e,1,rue]];function i(m,x,y){const v=xM).right(l,v);if(b===l.length)return e.every(Qfe(m/rue,x/rue,y));if(b===0)return bne.every(Math.max(Qfe(m,x,y),1));const[N,k]=l[v/l[b-1][2]53)return null;"w"in Oe||(Oe.w=1),"Z"in Oe?(le=sue(vT(Oe.y,0,1)),qe=le.getUTCDay(),le=qe>4||qe===0?jne.ceil(le):jne(le),le=mie.offset(le,(Oe.V-1)*7),Oe.y=le.getUTCFullYear(),Oe.m=le.getUTCMonth(),Oe.d=le.getUTCDate()+(Oe.w+6)%7):(le=nue(vT(Oe.y,0,1)),qe=le.getDay(),le=qe>4||qe===0?wne.ceil(le):wne(le),le=AP.offset(le,(Oe.V-1)*7),Oe.y=le.getFullYear(),Oe.m=le.getMonth(),Oe.d=le.getDate()+(Oe.w+6)%7)}else("W"in Oe||"U"in Oe)&&("w"in Oe||(Oe.w="u"in Oe?Oe.u%7:"W"in Oe?1:0),qe="Z"in Oe?sue(vT(Oe.y,0,1)).getUTCDay():nue(vT(Oe.y,0,1)).getDay(),Oe.m=0,Oe.d="W"in Oe?(Oe.w+6)%7+Oe.W*7-(qe+5)%7:Oe.w+Oe.U*7-(qe+6)%7);return"Z"in Oe?(Oe.H+=Oe.Z/100|0,Oe.M+=Oe.Z%100,sue(Oe)):nue(Oe)}}function W(Ve,ot,Tt,Oe){for(var at=0,le=ot.length,qe=Tt.length,Je,st;at=qe)return-1;if(Je=ot.charCodeAt(at++),Je===37){if(Je=ot.charAt(at++),st=D[Je in _5e?ot.charAt(at++):Je],!st||(Oe=st(Ve,Tt,Oe))<0)return-1}else if(Je!=Tt.charCodeAt(Oe++))return-1}return Oe}function G(Ve,ot,Tt){var Oe=m.exec(ot.slice(Tt));return Oe?(Ve.p=x.get(Oe[0].toLowerCase()),Tt+Oe[0].length):-1}function ee(Ve,ot,Tt){var Oe=b.exec(ot.slice(Tt));return Oe?(Ve.w=N.get(Oe[0].toLowerCase()),Tt+Oe[0].length):-1}function ae(Ve,ot,Tt){var Oe=y.exec(ot.slice(Tt));return Oe?(Ve.w=v.get(Oe[0].toLowerCase()),Tt+Oe[0].length):-1}function oe(Ve,ot,Tt){var Oe=I.exec(ot.slice(Tt));return Oe?(Ve.m=T.get(Oe[0].toLowerCase()),Tt+Oe[0].length):-1}function pe(Ve,ot,Tt){var Oe=k.exec(ot.slice(Tt));return Oe?(Ve.m=M.get(Oe[0].toLowerCase()),Tt+Oe[0].length):-1}function ne(Ve,ot,Tt){return W(Ve,t,ot,Tt)}function fe(Ve,ot,Tt){return W(Ve,n,ot,Tt)}function se(Ve,ot,Tt){return W(Ve,s,ot,Tt)}function me(Ve){return l[Ve.getDay()]}function ue(Ve){return o[Ve.getDay()]}function xe(Ve){return u[Ve.getMonth()]}function Te(Ve){return i[Ve.getMonth()]}function _e(Ve){return a[+(Ve.getHours()>=12)]}function we(Ve){return 1+~~(Ve.getMonth()/3)}function ve(Ve){return l[Ve.getUTCDay()]}function Xe(Ve){return o[Ve.getUTCDay()]}function Me(Ve){return u[Ve.getUTCMonth()]}function Ie(Ve){return i[Ve.getUTCMonth()]}function $e(Ve){return a[+(Ve.getUTCHours()>=12)]}function Be(Ve){return 1+~~(Ve.getUTCMonth()/3)}return{format:function(Ve){var ot=U(Ve+="",P);return ot.toString=function(){return Ve},ot},parse:function(Ve){var ot=V(Ve+="",!1);return ot.toString=function(){return Ve},ot},utcFormat:function(Ve){var ot=U(Ve+="",F);return ot.toString=function(){return Ve},ot},utcParse:function(Ve){var ot=V(Ve+="",!0);return ot.toString=function(){return Ve},ot}}}var _5e={"-":"",_:" ",0:"0"},Vd=/^\s*\d+/,p9t=/^%/,g9t=/[\\^$*+?|[\]().{}]/g;function po(e,t,n){var s=e<0?"-":"",a=(s?-e:e)+"",o=a.length;return s+(o[t.toLowerCase(),n]))}function y9t(e,t,n){var s=Vd.exec(t.slice(n,n+1));return s?(e.w=+s[0],n+s[0].length):-1}function v9t(e,t,n){var s=Vd.exec(t.slice(n,n+1));return s?(e.u=+s[0],n+s[0].length):-1}function _9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.U=+s[0],n+s[0].length):-1}function b9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.V=+s[0],n+s[0].length):-1}function w9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.W=+s[0],n+s[0].length):-1}function b5e(e,t,n){var s=Vd.exec(t.slice(n,n+4));return s?(e.y=+s[0],n+s[0].length):-1}function w5e(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 j9t(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 k9t(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 N9t(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 j5e(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.d=+s[0],n+s[0].length):-1}function S9t(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 k5e(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.H=+s[0],n+s[0].length):-1}function C9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.M=+s[0],n+s[0].length):-1}function M9t(e,t,n){var s=Vd.exec(t.slice(n,n+2));return s?(e.S=+s[0],n+s[0].length):-1}function T9t(e,t,n){var s=Vd.exec(t.slice(n,n+3));return s?(e.L=+s[0],n+s[0].length):-1}function A9t(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 E9t(e,t,n){var s=p9t.exec(t.slice(n,n+1));return s?n+s[0].length:-1}function I9t(e,t,n){var s=Vd.exec(t.slice(n));return s?(e.Q=+s[0],n+s[0].length):-1}function P9t(e,t,n){var s=Vd.exec(t.slice(n));return s?(e.s=+s[0],n+s[0].length):-1}function N5e(e,t){return po(e.getDate(),t,2)}function L9t(e,t){return po(e.getHours(),t,2)}function O9t(e,t){return po(e.getHours()%12||12,t,2)}function D9t(e,t){return po(1+AP.count(By(e),e),t,3)}function pUe(e,t){return po(e.getMilliseconds(),t,3)}function R9t(e,t){return pUe(e,t)+"000"}function F9t(e,t){return po(e.getMonth()+1,t,2)}function z9t(e,t){return po(e.getMinutes(),t,2)}function B9t(e,t){return po(e.getSeconds(),t,2)}function $9t(e){var t=e.getDay();return t===0?7:t}function U9t(e,t){return po(fie.count(By(e)-1,e),t,2)}function gUe(e){var t=e.getDay();return t>=4||t===0?ZC(e):ZC.ceil(e)}function q9t(e,t){return e=gUe(e),po(ZC.count(By(e),e)+(By(e).getDay()===4),t,2)}function V9t(e){return e.getDay()}function H9t(e,t){return po(wne.count(By(e)-1,e),t,2)}function W9t(e,t){return po(e.getFullYear()%100,t,2)}function G9t(e,t){return e=gUe(e),po(e.getFullYear()%100,t,2)}function K9t(e,t){return po(e.getFullYear()%1e4,t,4)}function Z9t(e,t){var n=e.getDay();return e=n>=4||n===0?ZC(e):ZC.ceil(e),po(e.getFullYear()%1e4,t,4)}function Y9t(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+po(t/60|0,"0",2)+po(t%60,"0",2)}function S5e(e,t){return po(e.getUTCDate(),t,2)}function X9t(e,t){return po(e.getUTCHours(),t,2)}function Q9t(e,t){return po(e.getUTCHours()%12||12,t,2)}function J9t(e,t){return po(1+mie.count($y(e),e),t,3)}function xUe(e,t){return po(e.getUTCMilliseconds(),t,3)}function eBt(e,t){return xUe(e,t)+"000"}function tBt(e,t){return po(e.getUTCMonth()+1,t,2)}function rBt(e,t){return po(e.getUTCMinutes(),t,2)}function nBt(e,t){return po(e.getUTCSeconds(),t,2)}function sBt(e){var t=e.getUTCDay();return t===0?7:t}function aBt(e,t){return po(pie.count($y(e)-1,e),t,2)}function yUe(e){var t=e.getUTCDay();return t>=4||t===0?YC(e):YC.ceil(e)}function iBt(e,t){return e=yUe(e),po(YC.count($y(e),e)+($y(e).getUTCDay()===4),t,2)}function oBt(e){return e.getUTCDay()}function lBt(e,t){return po(jne.count($y(e)-1,e),t,2)}function cBt(e,t){return po(e.getUTCFullYear()%100,t,2)}function dBt(e,t){return e=yUe(e),po(e.getUTCFullYear()%100,t,2)}function uBt(e,t){return po(e.getUTCFullYear()%1e4,t,4)}function hBt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?YC(e):YC.ceil(e),po(e.getUTCFullYear()%1e4,t,4)}function mBt(){return"+0000"}function C5e(){return"%"}function M5e(e){return+e}function T5e(e){return Math.floor(+e/1e3)}var DS,vUe,_Ue;fBt({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 fBt(e){return DS=f9t(e),vUe=DS.format,DS.parse,_Ue=DS.utcFormat,DS.utcParse,DS}function pBt(e){return new Date(e)}function gBt(e){return e instanceof Date?+e:+new Date(+e)}function V1e(e,t,n,s,a,o,l,i,u,m){var x=A1e(),y=x.invert,v=x.domain,b=m(".%L"),N=m(":%S"),k=m("%I:%M"),M=m("%I %p"),I=m("%a %d"),T=m("%b %d"),P=m("%B"),F=m("%Y");function D(U){return(u(U)t(a/(e.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(a,o)=>a7t(e,o/s))},n.copy=function(){return kUe(t).domain(e)},Gy.apply(n,arguments)}function xie(){var e=0,t=.5,n=1,s=1,a,o,l,i,u,m=Xu,x,y=!1,v;function b(k){return isNaN(k=+k)?v:(k=.5+((k=+x(k))-o)*(s*kt}var MUe=jBt,kBt=yie,NBt=MUe,SBt=K3;function CBt(e){return e&&e.length?kBt(e,SBt,NBt):void 0}var MBt=CBt;const vie=eo(MBt);function TBt(e,t){return ee.e^o.s<0?1:-1;for(s=o.d.length,a=e.d.length,t=0,n=se.d[t]^o.s<0?1:-1;return s===a?0:s>a^o.s<0?1:-1};Ns.decimalPlaces=Ns.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*xl;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ns.dividedBy=Ns.div=function(e){return wy(this,new this.constructor(e))};Ns.dividedToIntegerBy=Ns.idiv=function(e){var t=this,n=t.constructor;return Zo(wy(t,new n(e),0,1),n.precision)};Ns.equals=Ns.eq=function(e){return!this.cmp(e)};Ns.exponent=function(){return Kc(this)};Ns.greaterThan=Ns.gt=function(e){return this.cmp(e)>0};Ns.greaterThanOrEqualTo=Ns.gte=function(e){return this.cmp(e)>=0};Ns.isInteger=Ns.isint=function(){return this.e>this.d.length-2};Ns.isNegative=Ns.isneg=function(){return this.s<0};Ns.isPositive=Ns.ispos=function(){return this.s>0};Ns.isZero=function(){return this.s===0};Ns.lessThan=Ns.lt=function(e){return this.cmp(e)<0};Ns.lessThanOrEqualTo=Ns.lte=function(e){return this.cmp(e)<1};Ns.logarithm=Ns.log=function(e){var t,n=this,s=n.constructor,a=s.precision,o=a+5;if(e===void 0)e=new s(10);else if(e=new s(e),e.s<1||e.eq(dm))throw Error(bf+"NaN");if(n.s<1)throw Error(bf+(n.s?"NaN":"-Infinity"));return n.eq(dm)?new s(0):(Al=!1,t=wy(mI(n,o),mI(e,o),o),Al=!0,Zo(t,a))};Ns.minus=Ns.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?PUe(t,e):EUe(t,(e.s=-e.s,e))};Ns.modulo=Ns.mod=function(e){var t,n=this,s=n.constructor,a=s.precision;if(e=new s(e),!e.s)throw Error(bf+"NaN");return n.s?(Al=!1,t=wy(n,e,0,1).times(e),Al=!0,n.minus(t)):Zo(new s(n),a)};Ns.naturalExponential=Ns.exp=function(){return IUe(this)};Ns.naturalLogarithm=Ns.ln=function(){return mI(this)};Ns.negated=Ns.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ns.plus=Ns.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?EUe(t,e):PUe(t,(e.s=-e.s,e))};Ns.precision=Ns.sd=function(e){var t,n,s,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Xj+e);if(t=Kc(a)+1,s=a.d.length-1,n=s*xl+1,s=a.d[s],s){for(;s%10==0;s/=10)n--;for(s=a.d[0];s>=10;s/=10)n++}return e&&t>n?t:n};Ns.squareRoot=Ns.sqrt=function(){var e,t,n,s,a,o,l,i=this,u=i.constructor;if(i.s<1){if(!i.s)return new u(0);throw Error(bf+"NaN")}for(e=Kc(i),Al=!1,a=Math.sqrt(+i),a==0||a==1/0?(t=Eg(i.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Q3((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),s=new u(t)):s=new u(a.toString()),n=u.precision,a=l=n+3;;)if(o=s,s=o.plus(wy(i,o,l+2)).times(.5),Eg(o.d).slice(0,l)===(t=Eg(s.d)).slice(0,l)){if(t=t.slice(l-3,l+1),a==l&&t=="4999"){if(Zo(o,n+1,0),o.times(o).eq(i)){s=o;break}}else if(t!="9999")break;l+=4}return Al=!0,Zo(s,n)};Ns.times=Ns.mul=function(e){var t,n,s,a,o,l,i,u,m,x=this,y=x.constructor,v=x.d,b=(e=new y(e)).d;if(!x.s||!e.s)return new y(0);for(e.s*=x.s,n=x.e+e.e,u=v.length,m=b.length,u=0;){for(t=0,a=u+s;a>s;)i=o[a]+b[s]*v[a-s-1]+t,o[a--]=i%Cd|0,t=i/Cd|0;o[a]=(o[a]+t)%Cd|0}for(;!o[--l];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,Al?Zo(e,y.precision):e};Ns.toDecimalPlaces=Ns.todp=function(e,t){var n=this,s=n.constructor;return n=new s(n),e===void 0?n:(nx(e,0,X3),t===void 0?t=s.rounding:nx(t,0,8),Zo(n,e+Kc(n)+1,t))};Ns.toExponential=function(e,t){var n,s=this,a=s.constructor;return e===void 0?n=bk(s,!0):(nx(e,0,X3),t===void 0?t=a.rounding:nx(t,0,8),s=Zo(new a(s),e+1,t),n=bk(s,!0,e+1)),n};Ns.toFixed=function(e,t){var n,s,a=this,o=a.constructor;return e===void 0?bk(a):(nx(e,0,X3),t===void 0?t=o.rounding:nx(t,0,8),s=Zo(new o(a),e+Kc(a)+1,t),n=bk(s.abs(),!1,e+Kc(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};Ns.toInteger=Ns.toint=function(){var e=this,t=e.constructor;return Zo(new t(e),Kc(e)+1,t.rounding)};Ns.toNumber=function(){return+this};Ns.toPower=Ns.pow=function(e){var t,n,s,a,o,l,i=this,u=i.constructor,m=12,x=+(e=new u(e));if(!e.s)return new u(dm);if(i=new u(i),!i.s){if(e.s<1)throw Error(bf+"Infinity");return i}if(i.eq(dm))return i;if(s=u.precision,e.eq(dm))return Zo(i,s);if(t=e.e,n=e.d.length-1,l=t>=n,o=i.s,l){if((n=x<0?-x:x)<=AUe){for(a=new u(dm),t=Math.ceil(s/xl+4),Al=!1;n%2&&(a=a.times(i),I5e(a.d,t)),n=Q3(n/2),n!==0;)i=i.times(i),I5e(i.d,t);return Al=!0,e.s<0?new u(dm).div(a):Zo(a,s)}}else if(o<0)throw Error(bf+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,i.s=1,Al=!1,a=e.times(mI(i,s+m)),Al=!0,a=IUe(a),a.s=o,a};Ns.toPrecision=function(e,t){var n,s,a=this,o=a.constructor;return e===void 0?(n=Kc(a),s=bk(a,n<=o.toExpNeg||n>=o.toExpPos)):(nx(e,1,X3),t===void 0?t=o.rounding:nx(t,0,8),a=Zo(new o(a),e,t),n=Kc(a),s=bk(a,e<=n||n<=o.toExpNeg,e)),s};Ns.toSignificantDigits=Ns.tosd=function(e,t){var n=this,s=n.constructor;return e===void 0?(e=s.precision,t=s.rounding):(nx(e,1,X3),t===void 0?t=s.rounding:nx(t,0,8)),Zo(new s(n),e,t)};Ns.toString=Ns.valueOf=Ns.val=Ns.toJSON=Ns[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Kc(e),n=e.constructor;return bk(e,t<=n.toExpNeg||t>=n.toExpPos)};function EUe(e,t){var n,s,a,o,l,i,u,m,x=e.constructor,y=x.precision;if(!e.s||!t.s)return t.s||(t=new x(e)),Al?Zo(t,y):t;if(u=e.d,m=t.d,l=e.e,a=t.e,u=u.slice(),o=l-a,o){for(o<0?(s=u,o=-o,i=m.length):(s=m,a=l,i=u.length),l=Math.ceil(y/xl),i=l>i?l+1:i+1,o>i&&(o=i,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(i=u.length,o=m.length,i-o<0&&(o=i,s=m,m=u,u=s),n=0;o;)n=(u[--o]=u[o]+m[o]+n)/Cd|0,u[o]%=Cd;for(n&&(u.unshift(n),++a),i=u.length;u[--i]==0;)u.pop();return t.d=u,t.e=a,Al?Zo(t,y):t}function nx(e,t,n){if(e!==~~e||en)throw Error(Xj+e)}function Eg(e){var t,n,s,a=e.length-1,o="",l=e[0];if(a>0){for(o+=l,t=1;tl?1:-1;else for(i=u=0;ia[i]?1:-1;break}return u}function n(s,a,o){for(var l=0;o--;)s[o]-=l,l=s[o]1;)s.shift()}return function(s,a,o,l){var i,u,m,x,y,v,b,N,k,M,I,T,P,F,D,U,V,W,G=s.constructor,ee=s.s==a.s?1:-1,ae=s.d,oe=a.d;if(!s.s)return new G(s);if(!a.s)throw Error(bf+"Division by zero");for(u=s.e-a.e,V=oe.length,D=ae.length,b=new G(ee),N=b.d=[],m=0;oe[m]==(ae[m]||0);)++m;if(oe[m]>(ae[m]||0)&&--u,o==null?T=o=G.precision:l?T=o+(Kc(s)-Kc(a))+1:T=o,T<0)return new G(0);if(T=T/xl+2|0,m=0,V==1)for(x=0,oe=oe[0],T++;(m1&&(oe=e(oe,x),ae=e(ae,x),V=oe.length,D=ae.length),F=V,k=ae.slice(0,V),M=k.length;M=Cd/2&&++U;do x=0,i=t(oe,k,V,M),i<0?(I=k[0],V!=M&&(I=I*Cd+(k[1]||0)),x=I/U|0,x>1?(x>=Cd&&(x=Cd-1),y=e(oe,x),v=y.length,M=k.length,i=t(y,k,v,M),i==1&&(x--,n(y,V16)throw Error(G1e+Kc(e));if(!e.s)return new x(dm);for(Al=!1,i=y,l=new x(.03125);e.abs().gte(.1);)e=e.times(l),m+=5;for(s=Math.log(Yw(2,m))/Math.LN10*2+5|0,i+=s,n=a=o=new x(dm),x.precision=i;;){if(a=Zo(a.times(e),i),n=n.times(++u),l=o.plus(wy(a,n,i)),Eg(l.d).slice(0,i)===Eg(o.d).slice(0,i)){for(;m--;)o=Zo(o.times(o),i);return x.precision=y,t==null?(Al=!0,Zo(o,y)):o}o=l}}function Kc(e){for(var t=e.e*xl,n=e.d[0];n>=10;n/=10)t++;return t}function aue(e,t,n){if(t>e.LN10.sd())throw Al=!0,n&&(e.precision=n),Error(bf+"LN10 precision limit exceeded");return Zo(new e(e.LN10),t)}function a1(e){for(var t="";e--;)t+="0";return t}function mI(e,t){var n,s,a,o,l,i,u,m,x,y=1,v=10,b=e,N=b.d,k=b.constructor,M=k.precision;if(b.s<1)throw Error(bf+(b.s?"NaN":"-Infinity"));if(b.eq(dm))return new k(0);if(t==null?(Al=!1,m=M):m=t,b.eq(10))return t==null&&(Al=!0),aue(k,m);if(m+=v,k.precision=m,n=Eg(N),s=n.charAt(0),o=Kc(b),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)b=b.times(e),n=Eg(b.d),s=n.charAt(0),y++;o=Kc(b),s>1?(b=new k("0."+n),o++):b=new k(s+"."+n.slice(1))}else return u=aue(k,m+2,M).times(o+""),b=mI(new k(s+"."+n.slice(1)),m-v).plus(u),k.precision=M,t==null?(Al=!0,Zo(b,M)):b;for(i=l=b=wy(b.minus(dm),b.plus(dm),m),x=Zo(b.times(b),m),a=3;;){if(l=Zo(l.times(x),m),u=i.plus(wy(l,new k(a),m)),Eg(u.d).slice(0,m)===Eg(i.d).slice(0,m))return i=i.times(2),o!==0&&(i=i.plus(aue(k,m+2,M).times(o+""))),i=wy(i,new k(y),m),k.precision=M,t==null?(Al=!0,Zo(i,M)):i;i=u,a+=2}}function E5e(e,t){var n,s,a;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(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(s,a),t){if(a-=s,n=n-s-1,e.e=Q3(n/xl),e.d=[],s=(n+1)%xl,n<0&&(s+=xl),skne||e.e<-kne))throw Error(G1e+n)}else e.s=0,e.e=0,e.d=[0];return e}function Zo(e,t,n){var s,a,o,l,i,u,m,x,y=e.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(s=t-l,s<0)s+=xl,a=t,m=y[x=0];else{if(x=Math.ceil((s+1)/xl),o=y.length,x>=o)return e;for(m=o=y[x],l=1;o>=10;o/=10)l++;s%=xl,a=s-xl+l}if(n!==void 0&&(o=Yw(10,l-a-1),i=m/o%10|0,u=t<0||y[x+1]!==void 0||m%o,u=n<4?(i||u)&&(n==0||n==(e.s<0?3:2)):i>5||i==5&&(n==4||u||n==6&&(s>0?a>0?m/Yw(10,l-a):0:y[x-1])%10&1||n==(e.s<0?8:7))),t<1||!y[0])return u?(o=Kc(e),y.length=1,t=t-o-1,y[0]=Yw(10,(xl-t%xl)%xl),e.e=Q3(-t/xl)||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=Yw(10,xl-s),y[x]=a>0?(m/Yw(10,l-a)%Yw(10,a)|0)*o:0),u)for(;;)if(x==0){(y[0]+=o)==Cd&&(y[0]=1,++e.e);break}else{if(y[x]+=o,y[x]!=Cd)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(Al&&(e.e>kne||e.e<-kne))throw Error(G1e+Kc(e));return e}function PUe(e,t){var n,s,a,o,l,i,u,m,x,y,v=e.constructor,b=v.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new v(e),Al?Zo(t,b):t;if(u=e.d,y=t.d,s=t.e,m=e.e,u=u.slice(),l=m-s,l){for(x=l<0,x?(n=u,l=-l,i=y.length):(n=y,s=m,i=u.length),a=Math.max(Math.ceil(b/xl),i)+2,l>a&&(l=a,n.length=1),n.reverse(),a=l;a--;)n.push(0);n.reverse()}else{for(a=u.length,i=y.length,x=a0;--a)u[i++]=0;for(a=y.length;a>l;){if(u[--a]0?o=o.charAt(0)+"."+o.slice(1)+a1(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+a1(-a-1)+o,n&&(s=n-l)>0&&(o+=a1(s))):a>=l?(o+=a1(a+1-l),n&&(s=n-a-1)>0&&(o=o+"."+a1(s))):((s=a+1)0&&(a+1===l&&(o+="."),o+=a1(s))),e.s<0?"-"+o:o}function I5e(e,t){if(e.length>t)return e.length=t,!0}function LUe(e){var t,n,s;function a(o){var l=this;if(!(l instanceof a))return new a(o);if(l.constructor=a,o instanceof a){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(Xj+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 E5e(l,o.toString())}else if(typeof o!="string")throw Error(Xj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,YBt.test(o))E5e(l,o);else throw Error(Xj+o)}if(a.prototype=Ns,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=LUe,a.config=a.set=XBt,e===void 0&&(e={}),e)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&s<=a[t+2])this[n]=s;else throw Error(Xj+n+": "+s);if((s=e[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(Xj+n+": "+s);return this}var K1e=LUe(ZBt);dm=new K1e(1);const qo=K1e;function QBt(e){return r$t(e)||t$t(e)||e$t(e)||JBt()}function JBt(){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 e$t(e,t){if(e){if(typeof e=="string")return npe(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 npe(e,t)}}function t$t(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function r$t(e){if(Array.isArray(e))return npe(e)}function npe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=t?n.apply(void 0,a):e(t-l,P5e(function(){for(var i=arguments.length,u=new Array(i),m=0;me.length)&&(t=e.length);for(var n=0,s=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,a=!1,o=void 0;try{for(var l=e[Symbol.iterator](),i;!(s=(i=l.next()).done)&&(n.push(i.value),!(t&&n.length===t));s=!0);}catch(u){a=!0,o=u}finally{try{!s&&l.return!=null&&l.return()}finally{if(a)throw o}}return n}}function x$t(e){if(Array.isArray(e))return e}function zUe(e){var t=fI(e,2),n=t[0],s=t[1],a=n,o=s;return n>s&&(a=s,o=n),[a,o]}function BUe(e,t,n){if(e.lte(0))return new qo(0);var s=jie.getDigitCount(e.toNumber()),a=new qo(10).pow(s),o=e.div(a),l=s!==1?.05:.1,i=new qo(Math.ceil(o.div(l).toNumber())).add(n).mul(l),u=i.mul(a);return t?u:new qo(Math.ceil(u))}function y$t(e,t,n){var s=1,a=new qo(e);if(!a.isint()&&n){var o=Math.abs(e);o<1?(s=new qo(10).pow(jie.getDigitCount(e)-1),a=new qo(Math.floor(a.div(s).toNumber())).mul(s)):o>1&&(a=new qo(Math.floor(e)))}else e===0?a=new qo(Math.floor((t-1)/2)):n||(a=new qo(Math.floor(e)));var l=Math.floor((t-1)/2),i=i$t(a$t(function(u){return a.add(new qo(u-l).mul(s)).toNumber()}),spe);return i(0,t)}function $Ue(e,t,n,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new qo(0),tickMin:new qo(0),tickMax:new qo(0)};var o=BUe(new qo(t).sub(e).div(n-1),s,a),l;e<=0&&t>=0?l=new qo(0):(l=new qo(e).add(t).div(2),l=l.sub(new qo(l).mod(o)));var i=Math.ceil(l.sub(e).div(o).toNumber()),u=Math.ceil(new qo(t).sub(l).div(o).toNumber()),m=i+u+1;return m>n?$Ue(e,t,n,s,a+1):(m0?u+(n-m):u,i=t>0?i:i+(n-m)),{step:o,tickMin:l.sub(new qo(i).mul(o)),tickMax:l.add(new qo(u).mul(o))})}function v$t(e){var t=fI(e,2),n=t[0],s=t[1],a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=Math.max(a,2),i=zUe([n,s]),u=fI(i,2),m=u[0],x=u[1];if(m===-1/0||x===1/0){var y=x===1/0?[m].concat(ipe(spe(0,a-1).map(function(){return 1/0}))):[].concat(ipe(spe(0,a-1).map(function(){return-1/0})),[x]);return n>s?ape(y):y}if(m===x)return y$t(m,a,o);var v=$Ue(m,x,l,o),b=v.step,N=v.tickMin,k=v.tickMax,M=jie.rangeStep(N,k.add(new qo(.1).mul(b)),b);return n>s?ape(M):M}function _$t(e,t){var n=fI(e,2),s=n[0],a=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=zUe([s,a]),i=fI(l,2),u=i[0],m=i[1];if(u===-1/0||m===1/0)return[s,a];if(u===m)return[u];var x=Math.max(t,2),y=BUe(new qo(m).sub(u).div(x-1),o,0),v=[].concat(ipe(jie.rangeStep(new qo(u),new qo(m).sub(new qo(.99).mul(y)),y)),[m]);return s>a?ape(v):v}var b$t=RUe(v$t),w$t=RUe(_$t),j$t="Invariant failed";function wk(e,t){throw new Error(j$t)}var k$t=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function XC(e){"@babel/helpers - typeof";return XC=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},XC(e)}function Nne(){return Nne=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 E$t(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 I$t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P$t(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]:[],a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=-1,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(i<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var u=o.range,m=0;m0?a[m-1].coordinate:a[i-1].coordinate,y=a[m].coordinate,v=m>=i-1?a[0].coordinate:a[m+1].coordinate,b=void 0;if(Zu(y-x)!==Zu(v-y)){var N=[];if(Zu(v-y)===Zu(u[1]-u[0])){b=v;var k=y+u[1]-u[0];N[0]=Math.min(k,(k+x)/2),N[1]=Math.max(k,(k+x)/2)}else{b=x;var M=v+u[1]-u[0];N[0]=Math.min(y,(M+y)/2),N[1]=Math.max(y,(M+y)/2)}var I=[Math.min(y,(b+y)/2),Math.max(y,(b+y)/2)];if(t>I[0]&&t<=I[1]||t>=N[0]&&t<=N[1]){l=a[m].index;break}}else{var T=Math.min(x,v),P=Math.max(x,v);if(t>(T+y)/2&&t<=(P+y)/2){l=a[m].index;break}}}else for(var F=0;F0&&F(s[F].coordinate+s[F-1].coordinate)/2&&t<=(s[F].coordinate+s[F+1].coordinate)/2||F===i-1&&t>(s[F].coordinate+s[F-1].coordinate)/2){l=s[F].index;break}return l},Z1e=function(t){var n,s=t,a=s.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Jl(Jl({},t.type.defaultProps),t.props):t.props,l=o.stroke,i=o.fill,u;switch(a){case"Line":u=l;break;case"Area":case"Radar":u=l&&l!=="none"?l:i;break;default:u=i;break}return u},Y$t=function(t){var n=t.barSize,s=t.totalSize,a=t.stackGroups,o=a===void 0?{}:a;if(!o)return{};for(var l={},i=Object.keys(o),u=0,m=i.length;u=0});if(I&&I.length){var T=I[0].type.defaultProps,P=T!==void 0?Jl(Jl({},T),I[0].props):I[0].props,F=P.barSize,D=P[M];l[D]||(l[D]=[]);var U=Ti(F)?n:F;l[D].push({item:I[0],stackList:I.slice(1),barSize:Ti(U)?void 0:Yu(U,s,0)})}}return l},X$t=function(t){var n=t.barGap,s=t.barCategoryGap,a=t.bandSize,o=t.sizeList,l=o===void 0?[]:o,i=t.maxBarSize,u=l.length;if(u<1)return null;var m=Yu(n,a,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var v=!1,b=a/u,N=l.reduce(function(F,D){return F+D.barSize||0},0);N+=(u-1)*m,N>=a&&(N-=(u-1)*m,m=0),N>=a&&b>0&&(v=!0,b*=.9,N=u*b);var k=(a-N)/2>>0,M={offset:k-m,size:0};x=l.reduce(function(F,D){var U={item:D.item,position:{offset:M.offset+M.size+m,size:v?b:D.barSize}},V=[].concat(D5e(F),[U]);return M=V[V.length-1].position,D.stackList&&D.stackList.length&&D.stackList.forEach(function(W){V.push({item:W,position:M})}),V},y)}else{var I=Yu(s,a,0,!0);a-2*I-(u-1)*m<=0&&(m=0);var T=(a-2*I-(u-1)*m)/u;T>1&&(T>>=0);var P=i===+i?Math.min(T,i):T;x=l.reduce(function(F,D,U){var V=[].concat(D5e(F),[{item:D.item,position:{offset:I+(T+m)*U+(T-P)/2,size:P}}]);return D.stackList&&D.stackList.length&&D.stackList.forEach(function(W){V.push({item:W,position:V[V.length-1].position})}),V},y)}return x},Q$t=function(t,n,s,a){var o=s.children,l=s.width,i=s.margin,u=l-(i.left||0)-(i.right||0),m=HUe({children:o,legendWidth:u});if(m){var x=a||{},y=x.width,v=x.height,b=m.align,N=m.verticalAlign,k=m.layout;if((k==="vertical"||k==="horizontal"&&N==="middle")&&b!=="center"&&Rn(t[b]))return Jl(Jl({},t),{},sC({},b,t[b]+(y||0)));if((k==="horizontal"||k==="vertical"&&b==="center")&&N!=="middle"&&Rn(t[N]))return Jl(Jl({},t),{},sC({},N,t[N]+(v||0)))}return t},J$t=function(t,n,s){return Ti(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},WUe=function(t,n,s,a,o){var l=n.props.children,i=yf(l,kie).filter(function(m){return J$t(a,o,m.props.direction)});if(i&&i.length){var u=i.map(function(m){return m.props.dataKey});return t.reduce(function(m,x){var y=vu(x,s);if(Ti(y))return m;var v=Array.isArray(y)?[_ie(y),vie(y)]:[y,y],b=u.reduce(function(N,k){var M=vu(x,k,0),I=v[0]-Math.abs(Array.isArray(M)?M[0]:M),T=v[1]+Math.abs(Array.isArray(M)?M[1]:M);return[Math.min(I,N[0]),Math.max(T,N[1])]},[1/0,-1/0]);return[Math.min(b[0],m[0]),Math.max(b[1],m[1])]},[1/0,-1/0])}return null},eUt=function(t,n,s,a,o){var l=n.map(function(i){return WUe(t,i,s,o,a)}).filter(function(i){return!Ti(i)});return l&&l.length?l.reduce(function(i,u){return[Math.min(i[0],u[0]),Math.max(i[1],u[1])]},[1/0,-1/0]):null},GUe=function(t,n,s,a,o){var l=n.map(function(u){var m=u.props.dataKey;return s==="number"&&m&&WUe(t,u,m,a)||tE(t,m,s,o)});if(s==="number")return l.reduce(function(u,m){return[Math.min(u[0],m[0]),Math.max(u[1],m[1])]},[1/0,-1/0]);var i={};return l.reduce(function(u,m){for(var x=0,y=m.length;x=2?Zu(i[0]-i[1])*2*m:m,n&&(t.ticks||t.niceTicks)){var x=(t.ticks||t.niceTicks).map(function(y){var v=o?o.indexOf(y):y;return{coordinate:a(v)+m,value:y,offset:m}});return x.filter(function(y){return!kP(y.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(y,v){return{coordinate:a(y)+m,value:y,index:v,offset:m}}):a.ticks&&!s?a.ticks(t.tickCount).map(function(y){return{coordinate:a(y)+m,value:y,offset:m}}):a.domain().map(function(y,v){return{coordinate:a(y)+m,value:o?o[y]:y,index:v,offset:m}})},iue=new WeakMap,RO=function(t,n){if(typeof n!="function")return t;iue.has(t)||iue.set(t,new WeakMap);var s=iue.get(t);if(s.has(n))return s.get(n);var a=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,a),a},YUe=function(t,n,s){var a=t.scale,o=t.type,l=t.layout,i=t.axisType;if(a==="auto")return l==="radial"&&i==="radiusAxis"?{scale:lI(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:_ne(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:eE(),realScaleType:"point"}:o==="category"?{scale:lI(),realScaleType:"band"}:{scale:_ne(),realScaleType:"linear"};if(yk(a)){var u="scale".concat(sie(a));return{scale:(A5e[u]||eE)(),realScaleType:A5e[u]?u:"point"}}return Za(a)?{scale:a}:{scale:eE(),realScaleType:"point"}},F5e=1e-4,XUe=function(t){var n=t.domain();if(!(!n||n.length<=2)){var s=n.length,a=t.range(),o=Math.min(a[0],a[1])-F5e,l=Math.max(a[0],a[1])+F5e,i=t(n[0]),u=t(n[s-1]);(il||ul)&&t.domain([n[0],n[s-1]])}},tUt=function(t,n){if(!t)return null;for(var s=0,a=t.length;sa)&&(o[1]=a),o[0]>a&&(o[0]=a),o[1]=0?(t[i][s][0]=o,t[i][s][1]=o+u,o=t[i][s][1]):(t[i][s][0]=l,t[i][s][1]=l+u,l=t[i][s][1])}},sUt=function(t){var n=t.length;if(!(n<=0))for(var s=0,a=t[0].length;s=0?(t[l][s][0]=o,t[l][s][1]=o+i,o=t[l][s][1]):(t[l][s][0]=0,t[l][s][1]=0)}},aUt={sign:nUt,expand:kIt,none:qC,silhouette:NIt,wiggle:SIt,positive:sUt},iUt=function(t,n,s){var a=n.map(function(i){return i.props.dataKey}),o=aUt[s],l=jIt().keys(a).value(function(i,u){return+vu(i,u,0)}).order(Pfe).offset(o);return l(t)},oUt=function(t,n,s,a,o,l){if(!t)return null;var i=l?n.reverse():n,u={},m=i.reduce(function(y,v){var b,N=(b=v.type)!==null&&b!==void 0&&b.defaultProps?Jl(Jl({},v.type.defaultProps),v.props):v.props,k=N.stackId,M=N.hide;if(M)return y;var I=N[s],T=y[I]||{hasStack:!1,stackGroups:{}};if(fd(k)){var P=T.stackGroups[k]||{numericAxisId:s,cateAxisId:a,items:[]};P.items.push(v),T.hasStack=!0,T.stackGroups[k]=P}else T.stackGroups[NP("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[v]};return Jl(Jl({},y),{},sC({},I,T))},u),x={};return Object.keys(m).reduce(function(y,v){var b=m[v];if(b.hasStack){var N={};b.stackGroups=Object.keys(b.stackGroups).reduce(function(k,M){var I=b.stackGroups[M];return Jl(Jl({},k),{},sC({},M,{numericAxisId:s,cateAxisId:a,items:I.items,stackedData:iUt(t,I.items,o)}))},N)}return Jl(Jl({},y),{},sC({},v,b))},x)},QUe=function(t,n){var s=n.realScaleType,a=n.type,o=n.tickCount,l=n.originalDomain,i=n.allowDecimals,u=s||n.scale;if(u!=="auto"&&u!=="linear")return null;if(o&&a==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var m=t.domain();if(!m.length)return null;var x=b$t(m,o,i);return t.domain([_ie(x),vie(x)]),{niceTicks:x}}if(o&&a==="number"){var y=t.domain(),v=w$t(y,o,i);return{niceTicks:v}}return null},z5e=function(t){var n=t.axis,s=t.ticks,a=t.offset,o=t.bandSize,l=t.entry,i=t.index;if(n.type==="category")return s[i]?s[i].coordinate+a:null;var u=vu(l,n.dataKey,n.domain[i]);return Ti(u)?null:n.scale(u)-o/2+a},lUt=function(t){var n=t.numericAxis,s=n.scale.domain();if(n.type==="number"){var a=Math.min(s[0],s[1]),o=Math.max(s[0],s[1]);return a<=0&&o>=0?0:o<0?o:a}return s[0]},cUt=function(t,n){var s,a=(s=t.type)!==null&&s!==void 0&&s.defaultProps?Jl(Jl({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(fd(o)){var l=n[o];if(l){var i=l.items.indexOf(t);return i>=0?l.stackedData[i]:null}}return null},dUt=function(t){return t.reduce(function(n,s){return[_ie(s.concat([n[0]]).filter(Rn)),vie(s.concat([n[1]]).filter(Rn))]},[1/0,-1/0])},JUe=function(t,n,s){return Object.keys(t).reduce(function(a,o){var l=t[o],i=l.stackedData,u=i.reduce(function(m,x){var y=dUt(x.slice(n,s+1));return[Math.min(m[0],y[0]),Math.max(m[1],y[1])]},[1/0,-1/0]);return[Math.min(u[0],a[0]),Math.max(u[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},B5e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$5e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,dpe=function(t,n,s){if(Za(t))return t(n,s);if(!Array.isArray(t))return n;var a=[];if(Rn(t[0]))a[0]=s?t[0]:Math.min(t[0],n[0]);else if(B5e.test(t[0])){var o=+B5e.exec(t[0])[1];a[0]=n[0]-o}else Za(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(Rn(t[1]))a[1]=s?t[1]:Math.max(t[1],n[1]);else if($5e.test(t[1])){var l=+$5e.exec(t[1])[1];a[1]=n[1]+l}else Za(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},Cne=function(t,n,s){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!s||a>0)return a}if(t&&n&&n.length>=2){for(var o=j1e(n,function(y){return y.coordinate}),l=1/0,i=1,u=o.length;ie.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},vUt=function(t,n,s,a,o){var l=t.width,i=t.height,u=t.startAngle,m=t.endAngle,x=Yu(t.cx,l,l/2),y=Yu(t.cy,i,i/2),v=rqe(l,i,s),b=Yu(t.innerRadius,v,0),N=Yu(t.outerRadius,v,v*.8),k=Object.keys(n);return k.reduce(function(M,I){var T=n[I],P=T.domain,F=T.reversed,D;if(Ti(T.range))a==="angleAxis"?D=[u,m]:a==="radiusAxis"&&(D=[b,N]),F&&(D=[D[1],D[0]]);else{D=T.range;var U=D,V=mUt(U,2);u=V[0],m=V[1]}var W=YUe(T,o),G=W.realScaleType,ee=W.scale;ee.domain(P).range(D),XUe(ee);var ae=QUe(ee,Wx(Wx({},T),{},{realScaleType:G})),oe=Wx(Wx(Wx({},T),ae),{},{range:D,radius:N,realScaleType:G,scale:ee,cx:x,cy:y,innerRadius:b,outerRadius:N,startAngle:u,endAngle:m});return Wx(Wx({},M),{},tqe({},I,oe))},{})},_Ut=function(t,n){var s=t.x,a=t.y,o=n.x,l=n.y;return Math.sqrt(Math.pow(s-o,2)+Math.pow(a-l,2))},bUt=function(t,n){var s=t.x,a=t.y,o=n.cx,l=n.cy,i=_Ut({x:s,y:a},{x:o,y:l});if(i<=0)return{radius:i};var u=(s-o)/i,m=Math.acos(u);return a>l&&(m=2*Math.PI-m),{radius:i,angle:yUt(m),angleInRadian:m}},wUt=function(t){var n=t.startAngle,s=t.endAngle,a=Math.floor(n/360),o=Math.floor(s/360),l=Math.min(a,o);return{startAngle:n-l*360,endAngle:s-l*360}},jUt=function(t,n){var s=n.startAngle,a=n.endAngle,o=Math.floor(s/360),l=Math.floor(a/360),i=Math.min(o,l);return t+i*360},H5e=function(t,n){var s=t.x,a=t.y,o=bUt({x:s,y:a},n),l=o.radius,i=o.angle,u=n.innerRadius,m=n.outerRadius;if(lm)return!1;if(l===0)return!0;var x=wUt(n),y=x.startAngle,v=x.endAngle,b=i,N;if(y<=v){for(;b>v;)b-=360;for(;b=y&&b<=v}else{for(;b>y;)b-=360;for(;b=v&&b<=y}return N?Wx(Wx({},n),{},{radius:l,angle:jUt(b,n)}):null},nqe=function(t){return!A.isValidElement(t)&&!Za(t)&&typeof t!="boolean"?t.className:""};function yI(e){"@babel/helpers - typeof";return yI=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},yI(e)}var kUt=["offset"];function NUt(e){return TUt(e)||MUt(e)||CUt(e)||SUt()}function SUt(){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 CUt(e,t){if(e){if(typeof e=="string")return upe(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 upe(e,t)}}function MUt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function TUt(e){if(Array.isArray(e))return upe(e)}function upe(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 EUt(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 W5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function td(e){for(var t=1;t=0?1:-1,P,F;a==="insideStart"?(P=b+T*l,F=k):a==="insideEnd"?(P=N-T*l,F=!k):a==="end"&&(P=N+T*l,F=k),F=I<=0?F:!F;var D=ol(m,x,M,P),U=ol(m,x,M,P+(F?1:-1)*359),V="M".concat(D.x,",").concat(D.y,` A`).concat(M,",").concat(M,",0,1,").concat(F?0:1,`, `).concat(U.x,",").concat(U.y),W=Ti(t.id)?NP("recharts-radial-line-"):t.id;return dt.createElement("text",vI({},s,{dominantBaseline:"central",className:ui("recharts-radial-bar-label",i)}),dt.createElement("defs",null,dt.createElement("path",{id:W,d:V})),dt.createElement("textPath",{xlinkHref:"#".concat(W)},n))},FUt=function(t){var n=t.viewBox,s=t.offset,a=t.position,o=n,l=o.cx,i=o.cy,u=o.innerRadius,m=o.outerRadius,x=o.startAngle,y=o.endAngle,v=(x+y)/2;if(a==="outside"){var b=ol(l,i,m+s,v),N=b.x,k=b.y;return{x:N,y:k,textAnchor:N>=l?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"end"};var M=(u+m)/2,I=ol(l,i,M,v),T=I.x,P=I.y;return{x:T,y:P,textAnchor:"middle",verticalAnchor:"middle"}},zUt=function(t){var n=t.viewBox,s=t.parentViewBox,a=t.offset,o=t.position,l=n,i=l.x,u=l.y,m=l.width,x=l.height,y=x>=0?1:-1,v=y*a,b=y>0?"end":"start",N=y>0?"start":"end",k=m>=0?1:-1,M=k*a,I=k>0?"end":"start",T=k>0?"start":"end";if(o==="top"){var P={x:i+m/2,y:u-y*a,textAnchor:"middle",verticalAnchor:b};return td(td({},P),s?{height:Math.max(u-s.y,0),width:m}:{})}if(o==="bottom"){var F={x:i+m/2,y:u+x+v,textAnchor:"middle",verticalAnchor:N};return td(td({},F),s?{height:Math.max(s.y+s.height-(u+x),0),width:m}:{})}if(o==="left"){var D={x:i-M,y:u+x/2,textAnchor:I,verticalAnchor:"middle"};return td(td({},D),s?{width:Math.max(D.x-s.x,0),height:x}:{})}if(o==="right"){var U={x:i+m+M,y:u+x/2,textAnchor:T,verticalAnchor:"middle"};return td(td({},U),s?{width:Math.max(s.x+s.width-U.x,0),height:x}:{})}var V=s?{width:m,height:x}:{};return o==="insideLeft"?td({x:i+M,y:u+x/2,textAnchor:T,verticalAnchor:"middle"},V):o==="insideRight"?td({x:i+m-M,y:u+x/2,textAnchor:I,verticalAnchor:"middle"},V):o==="insideTop"?td({x:i+m/2,y:u+v,textAnchor:"middle",verticalAnchor:N},V):o==="insideBottom"?td({x:i+m/2,y:u+x-v,textAnchor:"middle",verticalAnchor:b},V):o==="insideTopLeft"?td({x:i+M,y:u+v,textAnchor:T,verticalAnchor:N},V):o==="insideTopRight"?td({x:i+m-M,y:u+v,textAnchor:I,verticalAnchor:N},V):o==="insideBottomLeft"?td({x:i+M,y:u+x-v,textAnchor:T,verticalAnchor:b},V):o==="insideBottomRight"?td({x:i+m-M,y:u+x-v,textAnchor:I,verticalAnchor:b},V):U3(o)&&(Rn(o.x)||hj(o.x))&&(Rn(o.y)||hj(o.y))?td({x:i+Yu(o.x,m),y:u+Yu(o.y,x),textAnchor:"end",verticalAnchor:"end"},V):td({x:i+m/2,y:u+x/2,textAnchor:"middle",verticalAnchor:"middle"},V)},BUt=function(t){return"cx"in t&&Rn(t.cx)};function Id(e){var t=e.offset,n=t===void 0?5:t,s=AUt(e,kUt),a=td({offset:n},s),o=a.viewBox,l=a.position,i=a.value,u=a.children,m=a.content,x=a.className,y=x===void 0?"":x,v=a.textBreakAll;if(!o||Ti(i)&&Ti(u)&&!A.isValidElement(m)&&!Za(m))return null;if(A.isValidElement(m))return A.cloneElement(m,a);var b;if(Za(m)){if(b=A.createElement(m,a),A.isValidElement(b))return b}else b=OUt(a);var N=BUt(o),k=$a(a,!0);if(N&&(l==="insideStart"||l==="insideEnd"||l==="end"))return RUt(a,b,k);var M=N?FUt(a):zUt(a);return dt.createElement(_k,vI({className:ui("recharts-label",y)},k,M,{breakAll:v}),b)}Id.displayName="Label";var sqe=function(t){var n=t.cx,s=t.cy,a=t.angle,o=t.startAngle,l=t.endAngle,i=t.r,u=t.radius,m=t.innerRadius,x=t.outerRadius,y=t.x,v=t.y,b=t.top,N=t.left,k=t.width,M=t.height,I=t.clockWise,T=t.labelViewBox;if(T)return T;if(Rn(k)&&Rn(M)){if(Rn(y)&&Rn(v))return{x:y,y:v,width:k,height:M};if(Rn(b)&&Rn(N))return{x:b,y:N,width:k,height:M}}return Rn(y)&&Rn(v)?{x:y,y:v,width:0,height:0}:Rn(n)&&Rn(s)?{cx:n,cy:s,startAngle:o||a||0,endAngle:l||a||0,innerRadius:m||0,outerRadius:x||u||i||0,clockWise:I}:t.viewBox?t.viewBox:{}},$Ut=function(t,n){return t?t===!0?dt.createElement(Id,{key:"label-implicit",viewBox:n}):fd(t)?dt.createElement(Id,{key:"label-implicit",viewBox:n,value:t}):A.isValidElement(t)?t.type===Id?A.cloneElement(t,{key:"label-implicit",viewBox:n}):dt.createElement(Id,{key:"label-implicit",content:t,viewBox:n}):Za(t)?dt.createElement(Id,{key:"label-implicit",content:t,viewBox:n}):U3(t)?dt.createElement(Id,vI({viewBox:n},t,{key:"label-implicit"})):null:null},UUt=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 a=t.children,o=sqe(t),l=yf(a,Id).map(function(u,m){return A.cloneElement(u,{viewBox:n||o,key:"label-".concat(m)})});if(!s)return l;var i=$Ut(t.label,n||o);return[i].concat(NUt(l))};Id.parseViewBox=sqe;Id.renderCallByParent=UUt;function qUt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var VUt=qUt;const HUt=eo(VUt);function _I(e){"@babel/helpers - typeof";return _I=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},_I(e)}var WUt=["valueAccessor"],GUt=["data","dataKey","clockWise","id","textBreakAll"];function KUt(e){return QUt(e)||XUt(e)||YUt(e)||ZUt()}function ZUt(){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 YUt(e,t){if(e){if(typeof e=="string")return hpe(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 hpe(e,t)}}function XUt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function QUt(e){if(Array.isArray(e))return hpe(e)}function hpe(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 rqt(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 nqt=function(t){return Array.isArray(t.value)?HUt(t.value):t.value};function lv(e){var t=e.valueAccessor,n=t===void 0?nqt:t,s=Z5e(e,WUt),a=s.data,o=s.dataKey,l=s.clockWise,i=s.id,u=s.textBreakAll,m=Z5e(s,GUt);return!a||!a.length?null:dt.createElement(Io,{className:"recharts-label-list"},a.map(function(x,y){var v=Ti(o)?n(x,y):vu(x&&x.payload,o),b=Ti(i)?{}:{id:"".concat(i,"-").concat(y)};return dt.createElement(Id,Tne({},$a(x,!0),m,b,{parentViewBox:x.parentViewBox,value:v,textBreakAll:u,viewBox:Id.parseViewBox(Ti(l)?x:K5e(K5e({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}lv.displayName="LabelList";function sqt(e,t){return e?e===!0?dt.createElement(lv,{key:"labelList-implicit",data:t}):dt.isValidElement(e)||Za(e)?dt.createElement(lv,{key:"labelList-implicit",data:t,content:e}):U3(e)?dt.createElement(lv,Tne({data:t},e,{key:"labelList-implicit"})):null:null}function aqt(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,a=yf(s,lv).map(function(l,i){return A.cloneElement(l,{data:t,key:"labelList-".concat(i)})});if(!n)return a;var o=sqt(e.label,t);return[o].concat(KUt(a))}lv.renderCallByParent=aqt;function bI(e){"@babel/helpers - typeof";return bI=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},bI(e)}function mpe(){return mpe=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(l>m),`, `).concat(y.x,",").concat(y.y,` `);if(a>0){var b=ol(n,s,a,l),N=ol(n,s,a,m);v+="L ".concat(N.x,",").concat(N.y,` A `).concat(a,",").concat(a,`,0, `).concat(+(Math.abs(u)>180),",").concat(+(l<=m),`, `).concat(b.x,",").concat(b.y," Z")}else v+="L ".concat(n,",").concat(s," Z");return v},dqt=function(t){var n=t.cx,s=t.cy,a=t.innerRadius,o=t.outerRadius,l=t.cornerRadius,i=t.forceCornerRadius,u=t.cornerIsExternal,m=t.startAngle,x=t.endAngle,y=Zu(x-m),v=FO({cx:n,cy:s,radius:o,angle:m,sign:y,cornerRadius:l,cornerIsExternal:u}),b=v.circleTangency,N=v.lineTangency,k=v.theta,M=FO({cx:n,cy:s,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:u}),I=M.circleTangency,T=M.lineTangency,P=M.theta,F=u?Math.abs(m-x):Math.abs(m-x)-k-P;if(F<0)return i?"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 `):aqe({cx:n,cy:s,innerRadius:a,outerRadius:o,startAngle:m,endAngle:x});var D="M ".concat(N.x,",").concat(N.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(b.x,",").concat(b.y,` A`).concat(o,",").concat(o,",0,").concat(+(F>180),",").concat(+(y<0),",").concat(I.x,",").concat(I.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(T.x,",").concat(T.y,` `);if(a>0){var U=FO({cx:n,cy:s,radius:a,angle:m,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),V=U.circleTangency,W=U.lineTangency,G=U.theta,ee=FO({cx:n,cy:s,radius:a,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),ae=ee.circleTangency,oe=ee.lineTangency,pe=ee.theta,ne=u?Math.abs(m-x):Math.abs(m-x)-G-pe;if(ne<0&&l===0)return"".concat(D,"L").concat(n,",").concat(s,"Z");D+="L".concat(oe.x,",").concat(oe.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ae.x,",").concat(ae.y,` A`).concat(a,",").concat(a,",0,").concat(+(ne>180),",").concat(+(y>0),",").concat(V.x,",").concat(V.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(W.x,",").concat(W.y,"Z")}else D+="L".concat(n,",").concat(s,"Z");return D},uqt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},iqe=function(t){var n=X5e(X5e({},uqt),t),s=n.cx,a=n.cy,o=n.innerRadius,l=n.outerRadius,i=n.cornerRadius,u=n.forceCornerRadius,m=n.cornerIsExternal,x=n.startAngle,y=n.endAngle,v=n.className;if(l0&&Math.abs(x-y)<360?M=dqt({cx:s,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(k,N/2),forceCornerRadius:u,cornerIsExternal:m,startAngle:x,endAngle:y}):M=aqe({cx:s,cy:a,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),dt.createElement("path",mpe({},$a(n,!0),{className:b,d:M,role:"img"}))};function wI(e){"@babel/helpers - typeof";return wI=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},wI(e)}function fpe(){return fpe=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 Aqt(e,t){return Ok(e.getTime(),t.getTime())}function Eqt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Iqt(e,t){return e===t}function aMe(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var a=new Array(s),o=e.entries(),l,i,u=0;(l=o.next())&&!l.done;){for(var m=t.entries(),x=!1,y=0;(i=m.next())&&!i.done;){if(a[y]){y++;continue}var v=l.value,b=i.value;if(n.equals(v[0],b[0],u,y,e,t,n)&&n.equals(v[1],b[1],v[0],b[0],e,t,n)){x=a[y]=!0;break}y++}if(!x)return!1;u++}return!0}var Pqt=Ok;function Lqt(e,t,n){var s=sMe(e),a=s.length;if(sMe(t).length!==a)return!1;for(;a-- >0;)if(!dqe(e,t,n,s[a]))return!1;return!0}function kT(e,t,n){var s=rMe(e),a=s.length;if(rMe(t).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=s[a],!dqe(e,t,n,o)||(l=nMe(e,o),i=nMe(t,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function Oqt(e,t){return Ok(e.valueOf(),t.valueOf())}function Dqt(e,t){return e.source===t.source&&e.flags===t.flags}function iMe(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var a=new Array(s),o=e.values(),l,i;(l=o.next())&&!l.done;){for(var u=t.values(),m=!1,x=0;(i=u.next())&&!i.done;){if(!a[x]&&n.equals(l.value,i.value,l.value,i.value,e,t,n)){m=a[x]=!0;break}x++}if(!m)return!1}return!0}function Rqt(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 Fqt(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 dqe(e,t,n,s){return(s===Mqt||s===Cqt||s===Sqt)&&(e.$$typeof||t.$$typeof)?!0:Nqt(t,s)&&n.equals(e[s],t[s],s,s,e,t,n)}var zqt="[object Arguments]",Bqt="[object Boolean]",$qt="[object Date]",Uqt="[object Error]",qqt="[object Map]",Vqt="[object Number]",Hqt="[object Object]",Wqt="[object RegExp]",Gqt="[object Set]",Kqt="[object String]",Zqt="[object URL]",Yqt=Array.isArray,oMe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,lMe=Object.assign,Xqt=Object.prototype.toString.call.bind(Object.prototype.toString);function Qqt(e){var t=e.areArraysEqual,n=e.areDatesEqual,s=e.areErrorsEqual,a=e.areFunctionsEqual,o=e.areMapsEqual,l=e.areNumbersEqual,i=e.areObjectsEqual,u=e.arePrimitiveWrappersEqual,m=e.areRegExpsEqual,x=e.areSetsEqual,y=e.areTypedArraysEqual,v=e.areUrlsEqual;return function(N,k,M){if(N===k)return!0;if(N==null||k==null)return!1;var I=typeof N;if(I!==typeof k)return!1;if(I!=="object")return I==="number"?l(N,k,M):I==="function"?a(N,k,M):!1;var T=N.constructor;if(T!==k.constructor)return!1;if(T===Object)return i(N,k,M);if(Yqt(N))return t(N,k,M);if(oMe!=null&&oMe(N))return y(N,k,M);if(T===Date)return n(N,k,M);if(T===RegExp)return m(N,k,M);if(T===Map)return o(N,k,M);if(T===Set)return x(N,k,M);var P=Xqt(N);return P===$qt?n(N,k,M):P===Wqt?m(N,k,M):P===qqt?o(N,k,M):P===Gqt?x(N,k,M):P===Hqt?typeof N.then!="function"&&typeof k.then!="function"&&i(N,k,M):P===Zqt?v(N,k,M):P===Uqt?s(N,k,M):P===zqt?i(N,k,M):P===Bqt||P===Vqt||P===Kqt?u(N,k,M):!1}}function Jqt(e){var t=e.circular,n=e.createCustomConfig,s=e.strict,a={areArraysEqual:s?kT:Tqt,areDatesEqual:Aqt,areErrorsEqual:Eqt,areFunctionsEqual:Iqt,areMapsEqual:s?tMe(aMe,kT):aMe,areNumbersEqual:Pqt,areObjectsEqual:s?kT:Lqt,arePrimitiveWrappersEqual:Oqt,areRegExpsEqual:Dqt,areSetsEqual:s?tMe(iMe,kT):iMe,areTypedArraysEqual:s?kT:Rqt,areUrlsEqual:Fqt};if(n&&(a=lMe({},a,n(a))),t){var o=BO(a.areArraysEqual),l=BO(a.areMapsEqual),i=BO(a.areObjectsEqual),u=BO(a.areSetsEqual);a=lMe({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:u})}return a}function eVt(e){return function(t,n,s,a,o,l,i){return e(t,n,i)}}function tVt(e){var t=e.circular,n=e.comparator,s=e.createState,a=e.equals,o=e.strict;if(s)return function(u,m){var x=s(),y=x.cache,v=y===void 0?t?new WeakMap:void 0:y,b=x.meta;return n(u,m,{cache:v,equals:a,meta:b,strict:o})};if(t)return function(u,m){return n(u,m,{cache:new WeakMap,equals:a,meta:void 0,strict:o})};var l={cache:void 0,equals:a,meta:void 0,strict:o};return function(u,m){return n(u,m,l)}}var rVt=Dv();Dv({strict:!0});Dv({circular:!0});Dv({circular:!0,strict:!0});Dv({createInternalComparator:function(){return Ok}});Dv({strict:!0,createInternalComparator:function(){return Ok}});Dv({circular:!0,createInternalComparator:function(){return Ok}});Dv({circular:!0,createInternalComparator:function(){return Ok},strict:!0});function Dv(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,s=e.createInternalComparator,a=e.createState,o=e.strict,l=o===void 0?!1:o,i=Jqt(e),u=Qqt(i),m=s?s(u):eVt(u);return tVt({circular:n,comparator:u,createState:a,equals:m,strict:l})}function nVt(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function cMe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function a(o){n<0&&(n=o),o-n>t?(e(o),n=-1):nVt(a)};requestAnimationFrame(s)}function gpe(e){"@babel/helpers - typeof";return gpe=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},gpe(e)}function sVt(e){return lVt(e)||oVt(e)||iVt(e)||aVt()}function aVt(){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 iVt(e,t){if(e){if(typeof e=="string")return dMe(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 dMe(e,t)}}function dMe(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:I<0?0:I},k=function(I){for(var T=I>1?1:I,P=T,F=0;F<8;++F){var D=y(P)-T,U=b(P);if(Math.abs(D-T)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,s=n===void 0?100:n,a=t.damping,o=a===void 0?8:a,l=t.dt,i=l===void 0?17:l,u=function(x,y,v){var b=-(x-y)*s,N=v*o,k=v+(b-N)*i/1e3,M=v*i/1e3+x;return Math.abs(M-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 zVt(e,t){if(e==null)return{};var n={},s=Object.keys(e),a,o;for(o=0;o=0)&&(n[a]=e[a]);return n}function oue(e){return qVt(e)||UVt(e)||$Vt(e)||BVt()}function BVt(){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 $Vt(e,t){if(e){if(typeof e=="string")return bpe(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 bpe(e,t)}}function UVt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qVt(e){if(Array.isArray(e))return bpe(e)}function bpe(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 Ine(e){return Ine=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ine(e)}var Uy=function(e){KVt(n,e);var t=ZVt(n);function n(s,a){var o;VVt(this,n),o=t.call(this,s,a);var l=o.props,i=l.isActive,u=l.attributeName,m=l.from,x=l.to,y=l.steps,v=l.children,b=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(kpe(o)),o.changeStyle=o.changeStyle.bind(kpe(o)),!i||b<=0)return o.state={style:{}},typeof v=="function"&&(o.state={style:x}),jpe(o);if(y&&y.length)o.state={style:y[0].style};else if(m){if(typeof v=="function")return o.state={style:m},jpe(o);o.state={style:u?$T({},u,m):m}}else o.state={style:{}};return o}return WVt(n,[{key:"componentDidMount",value:function(){var a=this.props,o=a.isActive,l=a.canBegin;this.mounted=!0,!(!o||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var o=this.props,l=o.isActive,i=o.canBegin,u=o.attributeName,m=o.shouldReAnimate,x=o.to,y=o.from,v=this.state.style;if(i){if(!l){var b={style:u?$T({},u,x):x};this.state&&v&&(u&&v[u]!==x||!u&&v!==x)&&this.setState(b);return}if(!(rVt(a.to,x)&&a.canBegin&&a.isActive)){var N=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var k=N||m?y:a.to;if(this.state&&v){var M={style:u?$T({},u,k):k};(u&&v[u]!==k||!u&&v!==k)&&this.setState(M)}this.runAnimation(rp(rp({},this.props),{},{from:k,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var o=this,l=a.from,i=a.to,u=a.duration,m=a.easing,x=a.begin,y=a.onAnimationEnd,v=a.onAnimationStart,b=DVt(l,i,NVt(m),u,this.changeStyle),N=function(){o.stopJSAnimation=b()};this.manager.start([v,x,N,u,y])}},{key:"runStepAnimation",value:function(a){var o=this,l=a.steps,i=a.begin,u=a.onAnimationStart,m=l[0],x=m.style,y=m.duration,v=y===void 0?0:y,b=function(k,M,I){if(I===0)return k;var T=M.duration,P=M.easing,F=P===void 0?"ease":P,D=M.style,U=M.properties,V=M.onAnimationEnd,W=I>0?l[I-1]:M,G=U||Object.keys(D);if(typeof F=="function"||F==="spring")return[].concat(oue(k),[o.runJSAnimation.bind(o,{from:W.style,to:D,duration:T,easing:F}),T]);var ee=mMe(G,T,F),ae=rp(rp(rp({},W.style),D),{},{transition:ee});return[].concat(oue(k),[ae,T,V]).filter(mVt)};return this.manager.start([u].concat(oue(l.reduce(b,[x,Math.max(v,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=cVt());var o=a.begin,l=a.duration,i=a.attributeName,u=a.to,m=a.easing,x=a.onAnimationStart,y=a.onAnimationEnd,v=a.steps,b=a.children,N=this.manager;if(this.unSubscribe=N.subscribe(this.handleStyleChange),typeof m=="function"||typeof b=="function"||m==="spring"){this.runJSAnimation(a);return}if(v.length>1){this.runStepAnimation(a);return}var k=i?$T({},i,u):u,M=mMe(Object.keys(k),l,m);N.start([x,o,rp(rp({},k),{},{transition:M}),l,y])}},{key:"render",value:function(){var a=this.props,o=a.children;a.begin;var l=a.duration;a.attributeName,a.easing;var i=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var u=FVt(a,RVt),m=A.Children.count(o),x=this.state.style;if(typeof o=="function")return o(x);if(!i||m===0||l<=0)return o;var y=function(b){var N=b.props,k=N.style,M=k===void 0?{}:k,I=N.className,T=A.cloneElement(b,rp(rp({},u),{},{style:rp(rp({},M),x),className:I}));return T};return m===1?y(A.Children.only(o)):dt.createElement("div",null,A.Children.map(o,function(v){return y(v)}))}}]),n}(A.PureComponent);Uy.displayName="Animate";Uy.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Uy.propTypes={from:ko.oneOfType([ko.object,ko.string]),to:ko.oneOfType([ko.object,ko.string]),attributeName:ko.string,duration:ko.number,begin:ko.number,easing:ko.oneOfType([ko.string,ko.func]),steps:ko.arrayOf(ko.shape({duration:ko.number.isRequired,style:ko.object.isRequired,easing:ko.oneOfType([ko.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ko.func]),properties:ko.arrayOf("string"),onAnimationEnd:ko.func})),children:ko.oneOfType([ko.node,ko.func]),isActive:ko.bool,canBegin:ko.bool,onAnimationEnd:ko.func,shouldReAnimate:ko.bool,onAnimationStart:ko.func,onAnimationReStart:ko.func};function NI(e){"@babel/helpers - typeof";return NI=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},NI(e)}function Pne(){return Pne=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,u=s>=0?1:-1,m=a>=0&&s>=0||a<0&&s<0?1:0,x;if(l>0&&o instanceof Array){for(var y=[0,0,0,0],v=0,b=4;vl?l:o[v];x="M".concat(t,",").concat(n+i*y[0]),y[0]>0&&(x+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(m,",").concat(t+u*y[0],",").concat(n)),x+="L ".concat(t+s-u*y[1],",").concat(n),y[1]>0&&(x+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(m,`, `).concat(t+s,",").concat(n+i*y[1])),x+="L ".concat(t+s,",").concat(n+a-i*y[2]),y[2]>0&&(x+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(m,`, `).concat(t+s-u*y[2],",").concat(n+a)),x+="L ".concat(t+u*y[3],",").concat(n+a),y[3]>0&&(x+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(m,`, `).concat(t,",").concat(n+a-i*y[3])),x+="Z"}else if(l>0&&o===+o&&o>0){var N=Math.min(l,o);x="M ".concat(t,",").concat(n+i*N,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t+u*N,",").concat(n,` L `).concat(t+s-u*N,",").concat(n,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t+s,",").concat(n+i*N,` L `).concat(t+s,",").concat(n+a-i*N,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t+s-u*N,",").concat(n+a,` L `).concat(t+u*N,",").concat(n+a,` A `).concat(N,",").concat(N,",0,0,").concat(m,",").concat(t,",").concat(n+a-i*N," Z")}else x="M ".concat(t,",").concat(n," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return x},aHt=function(t,n){if(!t||!n)return!1;var s=t.x,a=t.y,o=n.x,l=n.y,i=n.width,u=n.height;if(Math.abs(i)>0&&Math.abs(u)>0){var m=Math.min(o,o+i),x=Math.max(o,o+i),y=Math.min(l,l+u),v=Math.max(l,l+u);return s>=m&&s<=x&&a>=y&&a<=v}return!1},iHt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Y1e=function(t){var n=bMe(bMe({},iHt),t),s=A.useRef(),a=A.useState(-1),o=XVt(a,2),l=o[0],i=o[1];A.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var F=s.current.getTotalLength();F&&i(F)}catch{}},[]);var u=n.x,m=n.y,x=n.width,y=n.height,v=n.radius,b=n.className,N=n.animationEasing,k=n.animationDuration,M=n.animationBegin,I=n.isAnimationActive,T=n.isUpdateAnimationActive;if(u!==+u||m!==+m||x!==+x||y!==+y||x===0||y===0)return null;var P=ui("recharts-rectangle",b);return T?dt.createElement(Uy,{canBegin:l>0,from:{width:x,height:y,x:u,y:m},to:{width:x,height:y,x:u,y:m},duration:k,animationEasing:N,isActive:T},function(F){var D=F.width,U=F.height,V=F.x,W=F.y;return dt.createElement(Uy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:M,duration:k,isActive:I,easing:N},dt.createElement("path",Pne({},$a(n,!0),{className:P,d:wMe(V,W,D,U,v),ref:s})))}):dt.createElement("path",Pne({},$a(n,!0),{className:P,d:wMe(u,m,x,y,v)}))},oHt=["points","className","baseLinePoints","connectNulls"];function o4(){return o4=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 cHt(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 jMe(e){return mHt(e)||hHt(e)||uHt(e)||dHt()}function dHt(){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 uHt(e,t){if(e){if(typeof e=="string")return Npe(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 Npe(e,t)}}function hHt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function mHt(e){if(Array.isArray(e))return Npe(e)}function Npe(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){kMe(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),kMe(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},nE=function(t,n){var s=fHt(t);n&&(s=[s.reduce(function(o,l){return[].concat(jMe(o),jMe(l))},[])]);var a=s.map(function(o){return o.reduce(function(l,i,u){return"".concat(l).concat(u===0?"M":"L").concat(i.x,",").concat(i.y)},"")}).join("");return s.length===1?"".concat(a,"Z"):a},pHt=function(t,n,s){var a=nE(t,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(nE(n.reverse(),s).slice(1))},gHt=function(t){var n=t.points,s=t.className,a=t.baseLinePoints,o=t.connectNulls,l=lHt(t,oHt);if(!n||!n.length)return null;var i=ui("recharts-polygon",s);if(a&&a.length){var u=l.stroke&&l.stroke!=="none",m=pHt(n,a,o);return dt.createElement("g",{className:i},dt.createElement("path",o4({},$a(l,!0),{fill:m.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:m})),u?dt.createElement("path",o4({},$a(l,!0),{fill:"none",d:nE(n,o)})):null,u?dt.createElement("path",o4({},$a(l,!0),{fill:"none",d:nE(a,o)})):null)}var x=nE(n,o);return dt.createElement("path",o4({},$a(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:i,d:x}))};function Spe(){return Spe=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 jHt(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 kHt=function(t,n,s,a,o,l){return"M".concat(t,",").concat(o,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(s)},NHt=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,o=a===void 0?0:a,l=t.top,i=l===void 0?0:l,u=t.left,m=u===void 0?0:u,x=t.width,y=x===void 0?0:x,v=t.height,b=v===void 0?0:v,N=t.className,k=wHt(t,xHt),M=yHt({x:s,y:o,top:i,left:m,width:y,height:b},k);return!Rn(s)||!Rn(o)||!Rn(y)||!Rn(b)||!Rn(i)||!Rn(m)?null:dt.createElement("path",Cpe({},$a(M,!0),{className:ui("recharts-cross",N),d:kHt(s,o,y,b,i,m)}))},SHt=yie,CHt=MUe,MHt=dx;function THt(e,t){return e&&e.length?SHt(e,MHt(t),CHt):void 0}var AHt=THt;const EHt=eo(AHt);var IHt=yie,PHt=dx,LHt=TUe;function OHt(e,t){return e&&e.length?IHt(e,PHt(t),LHt):void 0}var DHt=OHt;const RHt=eo(DHt);var FHt=["cx","cy","angle","ticks","axisLine"],zHt=["ticks","tick","angle","tickFormatter","stroke"];function JC(e){"@babel/helpers - typeof";return JC=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},JC(e)}function sE(){return sE=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 BHt(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 $Ht(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function MMe(e,t){for(var n=0;nEMe?l=a==="outer"?"start":"end":o<-EMe?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,o=s.cy,l=s.radius,i=s.axisLine,u=s.axisLineType,m=E_(E_({},$a(this.props,!1)),{},{fill:"none"},$a(i,!1));if(u==="circle")return dt.createElement(X1e,tj({className:"recharts-polar-angle-axis-line"},m,{cx:a,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(v){return ol(a,o,l,v.coordinate)});return dt.createElement(gHt,tj({className:"recharts-polar-angle-axis-line"},m,{points:y}))}},{key:"renderTicks",value:function(){var s=this,a=this.props,o=a.ticks,l=a.tick,i=a.tickLine,u=a.tickFormatter,m=a.stroke,x=$a(this.props,!1),y=$a(l,!1),v=E_(E_({},x),{},{fill:"none"},$a(i,!1)),b=o.map(function(N,k){var M=s.getTickLineCoord(N),I=s.getTickTextAnchor(N),T=E_(E_(E_({textAnchor:I},x),{},{stroke:"none",fill:m},y),{},{index:k,payload:N,x:M.x2,y:M.y2});return dt.createElement(Io,tj({className:ui("recharts-polar-angle-axis-tick",nqe(l)),key:"tick-".concat(N.coordinate)},vk(s.props,N,k)),i&&dt.createElement("line",tj({className:"recharts-polar-angle-axis-tick-line"},v,M)),l&&t.renderTickItem(l,T,u?u(N.value,k):N.value))});return dt.createElement(Io,{className:"recharts-polar-angle-axis-ticks"},b)}},{key:"render",value:function(){var s=this.props,a=s.ticks,o=s.radius,l=s.axisLine;return o<=0||!a||!a.length?null:dt.createElement(Io,{className:ui("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,a,o){var l;return dt.isValidElement(s)?l=dt.cloneElement(s,a):Za(s)?l=s(a):l=dt.createElement(_k,tj({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(A.PureComponent);Cie(Mie,"displayName","PolarAngleAxis");Cie(Mie,"axisType","angleAxis");Cie(Mie,"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 rWt=k$e,nWt=rWt(Object.getPrototypeOf,Object),sWt=nWt,aWt=Hy,iWt=sWt,oWt=Wy,lWt="[object Object]",cWt=Function.prototype,dWt=Object.prototype,bqe=cWt.toString,uWt=dWt.hasOwnProperty,hWt=bqe.call(Object);function mWt(e){if(!oWt(e)||aWt(e)!=lWt)return!1;var t=iWt(e);if(t===null)return!0;var n=uWt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&bqe.call(n)==hWt}var fWt=mWt;const pWt=eo(fWt);var gWt=Hy,xWt=Wy,yWt="[object Boolean]";function vWt(e){return e===!0||e===!1||xWt(e)&&gWt(e)==yWt}var _Wt=vWt;const bWt=eo(_Wt);function CI(e){"@babel/helpers - typeof";return CI=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},CI(e)}function Dne(){return Dne=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:v,x:u,y:m},to:{upperWidth:x,lowerWidth:y,height:v,x:u,y:m},duration:k,animationEasing:N,isActive:I},function(P){var F=P.upperWidth,D=P.lowerWidth,U=P.height,V=P.x,W=P.y;return dt.createElement(Uy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:M,duration:k,easing:N},dt.createElement("path",Dne({},$a(n,!0),{className:T,d:OMe(V,W,F,D,U),ref:s})))}):dt.createElement("g",null,dt.createElement("path",Dne({},$a(n,!0),{className:T,d:OMe(u,m,x,y,v)})))},IWt=["option","shapeType","propTransformer","activeClassName","isActive"];function MI(e){"@babel/helpers - typeof";return MI=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},MI(e)}function PWt(e,t){if(e==null)return{};var n=LWt(e,t),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function LWt(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 DMe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Rne(e){for(var t=1;t0?wm(P,"paddingAngle",0):0;if(D){var V=s1(D.endAngle-D.startAngle,P.endAngle-P.startAngle),W=sl(sl({},P),{},{startAngle:T+U,endAngle:T+V(k)+U});M.push(W),T=W.endAngle}else{var G=P.endAngle,ee=P.startAngle,ae=s1(0,G-ee),oe=ae(k),pe=sl(sl({},P),{},{startAngle:T+U,endAngle:T+oe+U});M.push(pe),T=pe.endAngle}}),dt.createElement(Io,null,s.renderSectorsStatically(M))})}},{key:"attachKeyboardHandlers",value:function(s){var a=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var l=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"ArrowRight":{var i=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[i].focus(),a.setState({sectorToFocus:i});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,a=s.sectors,o=s.isAnimationActive,l=this.state.prevSectors;return o&&a&&a.length&&(!l||!bie(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,a=this.props,o=a.hide,l=a.sectors,i=a.className,u=a.label,m=a.cx,x=a.cy,y=a.innerRadius,v=a.outerRadius,b=a.isAnimationActive,N=this.state.isAnimationFinished;if(o||!l||!l.length||!Rn(m)||!Rn(x)||!Rn(y)||!Rn(v))return null;var k=ui("recharts-pie",i);return dt.createElement(Io,{tabIndex:this.props.rootTabIndex,className:k,ref:function(I){s.pieRef=I}},this.renderSectors(),u&&this.renderLabels(l),Id.renderCallByParent(this.props,null,!1),(!b||N)&&lv.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return a.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:s.sectors!==a.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,a){return s>a?"start":s=360?T:T-1)*u,F=M-T*b-P,D=a.reduce(function(W,G){var ee=vu(G,I,0);return W+(Rn(ee)?ee:0)},0),U;if(D>0){var V;U=a.map(function(W,G){var ee=vu(W,I,0),ae=vu(W,x,G),oe=(Rn(ee)?ee:0)/D,pe;G?pe=V.endAngle+Zu(k)*u*(ee!==0?1:0):pe=l;var ne=pe+Zu(k)*((ee!==0?b:0)+oe*F),fe=(pe+ne)/2,se=(N.innerRadius+N.outerRadius)/2,me=[{name:ae,value:ee,payload:W,dataKey:I,type:v}],ue=ol(N.cx,N.cy,se,fe);return V=sl(sl(sl({percent:oe,cornerRadius:o,name:ae,tooltipPayload:me,midAngle:fe,middleRadius:se,tooltipPosition:ue},W),N),{},{value:vu(W,I),startAngle:pe,endAngle:ne,payload:W,paddingAngle:Zu(k)*u}),V})}return sl(sl({},N),{},{sectors:U,data:a})});var tGt=Math.ceil,rGt=Math.max;function nGt(e,t,n,s){for(var a=-1,o=rGt(tGt((t-e)/(n||1)),0),l=Array(o);o--;)l[s?o:++a]=e,e+=n;return l}var sGt=nGt,aGt=q$e,BMe=1/0,iGt=17976931348623157e292;function oGt(e){if(!e)return e===0?e:0;if(e=aGt(e),e===BMe||e===-BMe){var t=e<0?-1:1;return t*iGt}return e===e?e:0}var Nqe=oGt,lGt=sGt,cGt=die,lue=Nqe;function dGt(e){return function(t,n,s){return s&&typeof s!="number"&&cGt(t,n,s)&&(n=s=void 0),t=lue(t),n===void 0?(n=t,t=0):n=lue(n),s=s===void 0?t0&&s.handleDrag(a.changedTouches[0])}),em(s,"handleDragEnd",function(){s.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var a=s.props,o=a.endIndex,l=a.onDragEnd,i=a.startIndex;l==null||l({endIndex:o,startIndex:i})}),s.detachDragEndListener()}),em(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),em(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),em(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),em(s,"handleSlideDragStart",function(a){var o=HMe(a)?a.changedTouches[0]:a;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 kGt(t,e),_Gt(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var a=s.startX,o=s.endX,l=this.state.scaleValues,i=this.props,u=i.gap,m=i.data,x=m.length-1,y=Math.min(a,o),v=Math.max(a,o),b=t.getIndexInRange(l,y),N=t.getIndexInRange(l,v);return{startIndex:b-b%u,endIndex:N===x?x:N-N%u}}},{key:"getTextOfTick",value:function(s){var a=this.props,o=a.data,l=a.tickFormatter,i=a.dataKey,u=vu(o[s],i,s);return Za(l)?l(u,s):u}},{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 a=this.state,o=a.slideMoveStartX,l=a.startX,i=a.endX,u=this.props,m=u.x,x=u.width,y=u.travellerWidth,v=u.startIndex,b=u.endIndex,N=u.onChange,k=s.pageX-o;k>0?k=Math.min(k,m+x-y-i,m+x-y-l):k<0&&(k=Math.max(k,m-l,m-i));var M=this.getIndex({startX:l+k,endX:i+k});(M.startIndex!==v||M.endIndex!==b)&&N&&N(M),this.setState({startX:l+k,endX:i+k,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var o=HMe(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var a=this.state,o=a.brushMoveStartX,l=a.movingTravellerId,i=a.endX,u=a.startX,m=this.state[l],x=this.props,y=x.x,v=x.width,b=x.travellerWidth,N=x.onChange,k=x.gap,M=x.data,I={startX:this.state.startX,endX:this.state.endX},T=s.pageX-o;T>0?T=Math.min(T,y+v-b-m):T<0&&(T=Math.max(T,y-m)),I[l]=m+T;var P=this.getIndex(I),F=P.startIndex,D=P.endIndex,U=function(){var W=M.length-1;return l==="startX"&&(i>u?F%k===0:D%k===0)||iu?D%k===0:F%k===0)||i>u&&D===W};this.setState(em(em({},l,m+T),"brushMoveStartX",s.pageX),function(){N&&U()&&N(P)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var o=this,l=this.state,i=l.scaleValues,u=l.startX,m=l.endX,x=this.state[a],y=i.indexOf(x);if(y!==-1){var v=y+s;if(!(v===-1||v>=i.length)){var b=i[v];a==="startX"&&b>=m||a==="endX"&&b<=u||this.setState(em({},a,b),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,u=s.fill,m=s.stroke;return dt.createElement("rect",{stroke:m,fill:u,x:a,y:o,width:l,height:i})}},{key:"renderPanorama",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,u=s.data,m=s.children,x=s.padding,y=A.Children.only(m);return y?dt.cloneElement(y,{x:a,y:o,width:l,height:i,margin:x,compact:!0,data:u}):null}},{key:"renderTravellerLayer",value:function(s,a){var o,l,i=this,u=this.props,m=u.y,x=u.travellerWidth,y=u.height,v=u.traveller,b=u.ariaLabel,N=u.data,k=u.startIndex,M=u.endIndex,I=Math.max(s,this.props.x),T=cue(cue({},$a(this.props,!1)),{},{x:I,y:m,width:x,height:y}),P=b||"Min value: ".concat((o=N[k])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=N[M])===null||l===void 0?void 0:l.name);return dt.createElement(Io,{tabIndex:0,role:"slider","aria-label":P,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(D){["ArrowLeft","ArrowRight"].includes(D.key)&&(D.preventDefault(),D.stopPropagation(),i.handleTravellerMoveKeyboard(D.key==="ArrowRight"?1:-1,a))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(v,T))}},{key:"renderSlide",value:function(s,a){var o=this.props,l=o.y,i=o.height,u=o.stroke,m=o.travellerWidth,x=Math.min(s,a)+m,y=Math.max(Math.abs(a-s)-m,0);return dt.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:u,fillOpacity:.2,x,y:l,width:y,height:i})}},{key:"renderText",value:function(){var s=this.props,a=s.startIndex,o=s.endIndex,l=s.y,i=s.height,u=s.travellerWidth,m=s.stroke,x=this.state,y=x.startX,v=x.endX,b=5,N={pointerEvents:"none",fill:m};return dt.createElement(Io,{className:"recharts-brush-texts"},dt.createElement(_k,Bne({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,v)-b,y:l+i/2},N),this.getTextOfTick(a)),dt.createElement(_k,Bne({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,v)+u+b,y:l+i/2},N),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,a=s.data,o=s.className,l=s.children,i=s.x,u=s.y,m=s.width,x=s.height,y=s.alwaysShowText,v=this.state,b=v.startX,N=v.endX,k=v.isTextActive,M=v.isSlideMoving,I=v.isTravellerMoving,T=v.isTravellerFocused;if(!a||!a.length||!Rn(i)||!Rn(u)||!Rn(m)||!Rn(x)||m<=0||x<=0)return null;var P=ui("recharts-brush",o),F=dt.Children.count(l)===1,D=yGt("userSelect","none");return dt.createElement(Io,{className:P,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:D},this.renderBackground(),F&&this.renderPanorama(),this.renderSlide(b,N),this.renderTravellerLayer(b,"startX"),this.renderTravellerLayer(N,"endX"),(k||M||I||T||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,o=s.y,l=s.width,i=s.height,u=s.stroke,m=Math.floor(o+i/2)-1;return dt.createElement(dt.Fragment,null,dt.createElement("rect",{x:a,y:o,width:l,height:i,fill:u,stroke:"none"}),dt.createElement("line",{x1:a+1,y1:m,x2:a+l-1,y2:m,fill:"none",stroke:"#fff"}),dt.createElement("line",{x1:a+1,y1:m+2,x2:a+l-1,y2:m+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,a){var o;return dt.isValidElement(s)?o=dt.cloneElement(s,a):Za(s)?o=s(a):o=t.renderDefaultTraveller(a),o}},{key:"getDerivedStateFromProps",value:function(s,a){var o=s.data,l=s.width,i=s.x,u=s.travellerWidth,m=s.updateId,x=s.startIndex,y=s.endIndex;if(o!==a.prevData||m!==a.prevUpdateId)return cue({prevData:o,prevTravellerWidth:u,prevUpdateId:m,prevX:i,prevWidth:l},o&&o.length?SGt({data:o,width:l,x:i,travellerWidth:u,startIndex:x,endIndex:y}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||i!==a.prevX||u!==a.prevTravellerWidth)){a.scale.range([i,i+l-u]);var v=a.scale.domain().map(function(b){return a.scale(b)});return{prevData:o,prevTravellerWidth:u,prevUpdateId:m,prevX:i,prevWidth:l,startX:a.scale(s.startIndex),endX:a.scale(s.endIndex),scaleValues:v}}return null}},{key:"getIndexInRange",value:function(s,a){for(var o=s.length,l=0,i=o-1;i-l>1;){var u=Math.floor((l+i)/2);s[u]>a?i=u:l=u}return a>=s[i]?i:l}}])}(A.PureComponent);em(n3,"displayName","Brush");em(n3,"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 CGt=w1e;function MGt(e,t){var n;return CGt(e,function(s,a,o){return n=t(s,a,o),!n}),!!n}var TGt=MGt,AGt=g$e,EGt=dx,IGt=TGt,PGt=$h,LGt=die;function OGt(e,t,n){var s=PGt(e)?AGt:IGt;return n&&LGt(e,t,n)&&(t=void 0),s(e,EGt(t))}var DGt=OGt;const RGt=eo(DGt);var Yg=function(t,n){var s=t.alwaysShow,a=t.ifOverflow;return s&&(a="extendDomain"),a===n},WMe=F$e;function FGt(e,t,n){t=="__proto__"&&WMe?WMe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var zGt=FGt,BGt=zGt,$Gt=D$e,UGt=dx;function qGt(e,t){var n={};return t=UGt(t),$Gt(e,function(s,a,o){BGt(n,a,t(s,a,o))}),n}var VGt=qGt;const HGt=eo(VGt);function WGt(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 cKt(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 dKt(e,t){var n=e.x,s=e.y,a=lKt(e,sKt),o="".concat(n),l=parseInt(o,10),i="".concat(s),u=parseInt(i,10),m="".concat(t.height||a.height),x=parseInt(m,10),y="".concat(t.width||a.width),v=parseInt(y,10);return NT(NT(NT(NT(NT({},t),a),l?{x:l}:{}),u?{y:u}:{}),{},{height:x,width:v,name:t.name,radius:t.radius})}function KMe(e){return dt.createElement(wqe,Ipe({shapeType:"rectangle",propTransformer:dKt,activeClassName:"recharts-active-bar"},e))}var uKt=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,a){if(typeof t=="number")return t;var o=Rn(s)||RAt(s);return o?t(s,a):(o||wk(),n)}},hKt=["value","background"],Aqe;function s3(e){"@babel/helpers - typeof";return s3=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},s3(e)}function mKt(e,t){if(e==null)return{};var n=fKt(e,t),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function fKt(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 Une(){return Une=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(fe)0&&Math.abs(ne)0&&(pe=Math.min((Xe||0)-(ne[Me-1]||0),pe))}),Number.isFinite(pe)){var fe=pe/oe,se=k.layout==="vertical"?s.height:s.width;if(k.padding==="gap"&&(V=fe*se/2),k.padding==="no-gap"){var me=Yu(t.barCategoryGap,fe*se),ue=fe*se/2;V=ue-me-(ue-me)/se*me}}}a==="xAxis"?W=[s.left+(P.left||0)+(V||0),s.left+s.width-(P.right||0)-(V||0)]:a==="yAxis"?W=u==="horizontal"?[s.top+s.height-(P.bottom||0),s.top+(P.top||0)]:[s.top+(P.top||0)+(V||0),s.top+s.height-(P.bottom||0)-(V||0)]:W=k.range,D&&(W=[W[1],W[0]]);var xe=YUe(k,o,v),Te=xe.scale,_e=xe.realScaleType;Te.domain(I).range(W),XUe(Te);var we=QUe(Te,fp(fp({},k),{},{realScaleType:_e}));a==="xAxis"?(ae=M==="top"&&!F||M==="bottom"&&F,G=s.left,ee=y[U]-ae*k.height):a==="yAxis"&&(ae=M==="left"&&!F||M==="right"&&F,G=y[U]-ae*k.width,ee=s.top);var ve=fp(fp(fp({},k),we),{},{realScaleType:_e,x:G,y:ee,scale:Te,width:a==="xAxis"?s.width:k.width,height:a==="yAxis"?s.height:k.height});return ve.bandSize=Cne(ve,we),!k.hide&&a==="xAxis"?y[U]+=(ae?-1:1)*ve.height:k.hide||(y[U]+=(ae?-1:1)*ve.width),fp(fp({},b),{},Eie({},N,ve))},{})},Lqe=function(t,n){var s=t.x,a=t.y,o=n.x,l=n.y;return{x:Math.min(s,o),y:Math.min(a,l),width:Math.abs(o-s),height:Math.abs(l-a)}},SKt=function(t){var n=t.x1,s=t.y1,a=t.x2,o=t.y2;return Lqe({x:n,y:s},{x:a,y:o})},Oqe=function(){function e(t){wKt(this,e),this.scale=t}return jKt(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]:{},a=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 i=this.bandwidth?this.bandwidth():0;return this.scale(n)+i}default:return this.scale(n)}if(a){var u=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+u}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),a=s[0],o=s[s.length-1];return a<=o?n>=a&&n<=o:n>=o&&n<=a}}],[{key:"create",value:function(n){return new e(n)}}])}();Eie(Oqe,"EPS",1e-4);var Q1e=function(t){var n=Object.keys(t).reduce(function(s,a){return fp(fp({},s),{},Eie({},a,Oqe.create(t[a])))},{});return fp(fp({},n),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,i=o.position;return HGt(a,function(u,m){return n[m].apply(u,{bandAware:l,position:i})})},isInRange:function(a){return Tqe(a,function(o,l){return n[l].isInRange(o)})}})};function CKt(e){return(e%180+180)%180}var MKt=function(t){var n=t.width,s=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=CKt(a),l=o*Math.PI/180,i=Math.atan(s/n),u=l>i&&l-1?a[o?t[l]:l]:void 0}}var PKt=IKt,LKt=Nqe;function OKt(e){var t=LKt(e),n=t%1;return t===t?n?t-n:t:0}var DKt=OKt,RKt=A$e,FKt=dx,zKt=DKt,BKt=Math.max;function $Kt(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var a=n==null?0:zKt(n);return a<0&&(a=BKt(s+a,0)),RKt(e,FKt(t),a)}var UKt=$Kt,qKt=PKt,VKt=UKt,HKt=qKt(VKt),WKt=HKt;const GKt=eo(WKt);var KKt=qTt(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("")}),J1e=A.createContext(void 0),eve=A.createContext(void 0),Dqe=A.createContext(void 0),Rqe=A.createContext({}),Fqe=A.createContext(void 0),zqe=A.createContext(0),Bqe=A.createContext(0),JMe=function(t){var n=t.state,s=n.xAxisMap,a=n.yAxisMap,o=n.offset,l=t.clipPathId,i=t.children,u=t.width,m=t.height,x=KKt(o);return dt.createElement(J1e.Provider,{value:s},dt.createElement(eve.Provider,{value:a},dt.createElement(Rqe.Provider,{value:o},dt.createElement(Dqe.Provider,{value:x},dt.createElement(Fqe.Provider,{value:l},dt.createElement(zqe.Provider,{value:m},dt.createElement(Bqe.Provider,{value:u},i)))))))},ZKt=function(){return A.useContext(Fqe)},$qe=function(t){var n=A.useContext(J1e);n==null&&wk();var s=n[t];return s==null&&wk(),s},YKt=function(){var t=A.useContext(J1e);return h1(t)},XKt=function(){var t=A.useContext(eve),n=GKt(t,function(s){return Tqe(s.domain,Number.isFinite)});return n||h1(t)},Uqe=function(t){var n=A.useContext(eve);n==null&&wk();var s=n[t];return s==null&&wk(),s},QKt=function(){var t=A.useContext(Dqe);return t},JKt=function(){return A.useContext(Rqe)},tve=function(){return A.useContext(Bqe)},rve=function(){return A.useContext(zqe)};function a3(e){"@babel/helpers - typeof";return a3=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},a3(e)}function eZt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tZt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);ne*a)return!1;var o=n();return e*(t-e*o/2-s)>=0&&e*(t+e*o/2-a)<=0}function DZt(e,t){return Zqe(e,t+1)}function RZt(e,t,n,s,a){for(var o=(s||[]).slice(),l=t.start,i=t.end,u=0,m=1,x=l,y=function(){var N=s==null?void 0:s[u];if(N===void 0)return{v:Zqe(s,m)};var k=u,M,I=function(){return M===void 0&&(M=n(N,k)),M},T=N.coordinate,P=u===0||Gne(e,T,I,x,i);P||(u=0,x=l,m+=1),P&&(x=T+e*(I()/2+a),u+=m)},v;m<=o.length;)if(v=y(),v)return v.v;return[]}function PI(e){"@babel/helpers - typeof";return PI=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},PI(e)}function oTe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function gu(e){for(var t=1;t0?b.coordinate-M*e:b.coordinate})}else o[v]=b=gu(gu({},b),{},{tickCoord:b.coordinate});var I=Gne(e,b.tickCoord,k,i,u);I&&(u=b.tickCoord-e*(k()/2+a),o[v]=gu(gu({},b),{},{isShow:!0}))},x=l-1;x>=0;x--)m(x);return o}function UZt(e,t,n,s,a,o){var l=(s||[]).slice(),i=l.length,u=t.start,m=t.end;if(o){var x=s[i-1],y=n(x,i-1),v=e*(x.coordinate+e*y/2-m);l[i-1]=x=gu(gu({},x),{},{tickCoord:v>0?x.coordinate-v*e:x.coordinate});var b=Gne(e,x.tickCoord,function(){return y},u,m);b&&(m=x.tickCoord-e*(y/2+a),l[i-1]=gu(gu({},x),{},{isShow:!0}))}for(var N=o?i-1:i,k=function(T){var P=l[T],F,D=function(){return F===void 0&&(F=n(P,T)),F};if(T===0){var U=e*(P.coordinate-e*D()/2-u);l[T]=P=gu(gu({},P),{},{tickCoord:U<0?P.coordinate-U*e:P.coordinate})}else l[T]=P=gu(gu({},P),{},{tickCoord:P.coordinate});var V=Gne(e,P.tickCoord,D,u,m);V&&(u=P.tickCoord+e*(D()/2+a),l[T]=gu(gu({},P),{},{isShow:!0}))},M=0;M=2?Zu(a[1].coordinate-a[0].coordinate):1,I=OZt(o,M,b);return u==="equidistantPreserveStart"?RZt(M,I,k,a,l):(u==="preserveStart"||u==="preserveStartEnd"?v=UZt(M,I,k,a,l,u==="preserveStartEnd"):v=$Zt(M,I,k,a,l),v.filter(function(T){return T.isShow}))}var qZt=["viewBox"],VZt=["viewBox"],HZt=["ticks"];function l3(e){"@babel/helpers - typeof";return l3=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},l3(e)}function c4(){return c4=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 WZt(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 GZt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cTe(e,t){for(var n=0;n0?u(this.props):u(b)),l<=0||i<=0||!N||!N.length?null:dt.createElement(Io,{className:ui("recharts-cartesian-axis",m),ref:function(M){s.layerReference=M}},o&&this.renderAxisLine(),this.renderTicks(N,this.state.fontSize,this.state.letterSpacing),Id.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,o){var l,i=ui(a.className,"recharts-cartesian-axis-tick-value");return dt.isValidElement(s)?l=dt.cloneElement(s,ed(ed({},a),{},{className:i})):Za(s)?l=s(ed(ed({},a),{},{className:i})):l=dt.createElement(_k,c4({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(A.Component);ive(J3,"displayName","CartesianAxis");ive(J3,"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 eYt=["x1","y1","x2","y2","key"],tYt=["offset"];function jk(e){"@babel/helpers - typeof";return jk=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},jk(e)}function dTe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function yu(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function aYt(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 iYt=function(t){var n=t.fill;if(!n||n==="none")return null;var s=t.fillOpacity,a=t.x,o=t.y,l=t.width,i=t.height,u=t.ry;return dt.createElement("rect",{x:a,y:o,ry:u,width:l,height:i,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function Qqe(e,t){var n;if(dt.isValidElement(e))n=dt.cloneElement(e,t);else if(Za(e))n=e(t);else{var s=t.x1,a=t.y1,o=t.x2,l=t.y2,i=t.key,u=uTe(t,eYt),m=$a(u,!1);m.offset;var x=uTe(m,tYt);n=dt.createElement("line",pj({},x,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:i}))}return n}function oYt(e){var t=e.x,n=e.width,s=e.horizontal,a=s===void 0?!0:s,o=e.horizontalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,u){var m=yu(yu({},e),{},{x1:t,y1:i,x2:t+n,y2:i,key:"line-".concat(u),index:u});return Qqe(a,m)});return dt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function lYt(e){var t=e.y,n=e.height,s=e.vertical,a=s===void 0?!0:s,o=e.verticalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,u){var m=yu(yu({},e),{},{x1:i,y1:t,x2:i,y2:t+n,key:"line-".concat(u),index:u});return Qqe(a,m)});return dt.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function cYt(e){var t=e.horizontalFill,n=e.fillOpacity,s=e.x,a=e.y,o=e.width,l=e.height,i=e.horizontalPoints,u=e.horizontal,m=u===void 0?!0:u;if(!m||!t||!t.length)return null;var x=i.map(function(v){return Math.round(v+a-a)}).sort(function(v,b){return v-b});a!==x[0]&&x.unshift(0);var y=x.map(function(v,b){var N=!x[b+1],k=N?a+l-v:x[b+1]-v;if(k<=0)return null;var M=b%t.length;return dt.createElement("rect",{key:"react-".concat(b),y:v,x:s,height:k,width:o,stroke:"none",fill:t[M],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return dt.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function dYt(e){var t=e.vertical,n=t===void 0?!0:t,s=e.verticalFill,a=e.fillOpacity,o=e.x,l=e.y,i=e.width,u=e.height,m=e.verticalPoints;if(!n||!s||!s.length)return null;var x=m.map(function(v){return Math.round(v+o-o)}).sort(function(v,b){return v-b});o!==x[0]&&x.unshift(0);var y=x.map(function(v,b){var N=!x[b+1],k=N?o+i-v:x[b+1]-v;if(k<=0)return null;var M=b%s.length;return dt.createElement("rect",{key:"react-".concat(b),x:v,y:l,width:k,height:u,stroke:"none",fill:s[M],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return dt.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var uYt=function(t,n){var s=t.xAxis,a=t.width,o=t.height,l=t.offset;return ZUe(ave(yu(yu(yu({},J3.defaultProps),s),{},{ticks:ay(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,n)},hYt=function(t,n){var s=t.yAxis,a=t.width,o=t.height,l=t.offset;return ZUe(ave(yu(yu(yu({},J3.defaultProps),s),{},{ticks:ay(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,n)},RS={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Jqe(e){var t,n,s,a,o,l,i=tve(),u=rve(),m=JKt(),x=yu(yu({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:RS.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:RS.fill,horizontal:(s=e.horizontal)!==null&&s!==void 0?s:RS.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:RS.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:RS.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:RS.verticalFill,x:Rn(e.x)?e.x:m.left,y:Rn(e.y)?e.y:m.top,width:Rn(e.width)?e.width:m.width,height:Rn(e.height)?e.height:m.height}),y=x.x,v=x.y,b=x.width,N=x.height,k=x.syncWithTicks,M=x.horizontalValues,I=x.verticalValues,T=YKt(),P=XKt();if(!Rn(b)||b<=0||!Rn(N)||N<=0||!Rn(y)||y!==+y||!Rn(v)||v!==+v)return null;var F=x.verticalCoordinatesGenerator||uYt,D=x.horizontalCoordinatesGenerator||hYt,U=x.horizontalPoints,V=x.verticalPoints;if((!U||!U.length)&&Za(D)){var W=M&&M.length,G=D({yAxis:P?yu(yu({},P),{},{ticks:W?M:P.ticks}):void 0,width:i,height:u,offset:m},W?!0:k);Op(Array.isArray(G),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(jk(G),"]")),Array.isArray(G)&&(U=G)}if((!V||!V.length)&&Za(F)){var ee=I&&I.length,ae=F({xAxis:T?yu(yu({},T),{},{ticks:ee?I:T.ticks}):void 0,width:i,height:u,offset:m},ee?!0:k);Op(Array.isArray(ae),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(jk(ae),"]")),Array.isArray(ae)&&(V=ae)}return dt.createElement("g",{className:"recharts-cartesian-grid"},dt.createElement(iYt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),dt.createElement(oYt,pj({},x,{offset:m,horizontalPoints:U,xAxis:T,yAxis:P})),dt.createElement(lYt,pj({},x,{offset:m,verticalPoints:V,xAxis:T,yAxis:P})),dt.createElement(cYt,pj({},x,{horizontalPoints:U})),dt.createElement(dYt,pj({},x,{verticalPoints:V})))}Jqe.displayName="CartesianGrid";function c3(e){"@babel/helpers - typeof";return c3=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},c3(e)}function mYt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fYt(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 eXt(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 tXt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rXt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n0?l:t&&t.length&&Rn(a)&&Rn(o)?t.slice(a,o+1):[]};function mVe(e){return e==="number"?[0,"auto"]:void 0}var Zpe=function(t,n,s,a){var o=t.graphicalItems,l=t.tooltipAxis,i=Fie(n,t);return s<0||!o||!o.length||s>=i.length?null:o.reduce(function(u,m){var x,y=(x=m.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 v;if(l.dataKey&&!l.allowDuplicatedCategory){var b=y===void 0?i:y;v=wfe(b,l.dataKey,a)}else v=y&&y[s]||i[s];return v?[].concat(h3(u),[eqe(m,v)]):u},[])},xTe=function(t,n,s,a){var o=a||{x:t.chartX,y:t.chartY},l=fXt(o,s),i=t.orderedTooltipTicks,u=t.tooltipAxis,m=t.tooltipTicks,x=Z$t(l,i,m,u);if(x>=0&&m){var y=m[x]&&m[x].value,v=Zpe(t,n,x,y),b=pXt(s,i,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:v,activeCoordinate:b}}return null},gXt=function(t,n){var s=n.axes,a=n.graphicalItems,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,u=n.dataStartIndex,m=n.dataEndIndex,x=t.layout,y=t.children,v=t.stackOffset,b=KUe(x,o);return s.reduce(function(N,k){var M,I=k.type.defaultProps!==void 0?en(en({},k.type.defaultProps),k.props):k.props,T=I.type,P=I.dataKey,F=I.allowDataOverflow,D=I.allowDuplicatedCategory,U=I.scale,V=I.ticks,W=I.includeHidden,G=I[l];if(N[G])return N;var ee=Fie(t.data,{graphicalItems:a.filter(function(we){var ve,Xe=l in we.props?we.props[l]:(ve=we.type.defaultProps)===null||ve===void 0?void 0:ve[l];return Xe===G}),dataStartIndex:u,dataEndIndex:m}),ae=ee.length,oe,pe,ne;UYt(I.domain,F,T)&&(oe=dpe(I.domain,null,F),b&&(T==="number"||U!=="auto")&&(ne=tE(ee,P,"category")));var fe=mVe(T);if(!oe||oe.length===0){var se,me=(se=I.domain)!==null&&se!==void 0?se:fe;if(P){if(oe=tE(ee,P,T),T==="category"&&b){var ue=zAt(oe);D&&ue?(pe=oe,oe=zne(0,ae)):D||(oe=U5e(me,oe,k).reduce(function(we,ve){return we.indexOf(ve)>=0?we:[].concat(h3(we),[ve])},[]))}else if(T==="category")D?oe=oe.filter(function(we){return we!==""&&!Ti(we)}):oe=U5e(me,oe,k).reduce(function(we,ve){return we.indexOf(ve)>=0||ve===""||Ti(ve)?we:[].concat(h3(we),[ve])},[]);else if(T==="number"){var xe=eUt(ee,a.filter(function(we){var ve,Xe,Me=l in we.props?we.props[l]:(ve=we.type.defaultProps)===null||ve===void 0?void 0:ve[l],Ie="hide"in we.props?we.props.hide:(Xe=we.type.defaultProps)===null||Xe===void 0?void 0:Xe.hide;return Me===G&&(W||!Ie)}),P,o,x);xe&&(oe=xe)}b&&(T==="number"||U!=="auto")&&(ne=tE(ee,P,"category"))}else b?oe=zne(0,ae):i&&i[G]&&i[G].hasStack&&T==="number"?oe=v==="expand"?[0,1]:JUe(i[G].stackGroups,u,m):oe=GUe(ee,a.filter(function(we){var ve=l in we.props?we.props[l]:we.type.defaultProps[l],Xe="hide"in we.props?we.props.hide:we.type.defaultProps.hide;return ve===G&&(W||!Xe)}),T,x,!0);if(T==="number")oe=Wpe(y,oe,G,o,V),me&&(oe=dpe(me,oe,F));else if(T==="category"&&me){var Te=me,_e=oe.every(function(we){return Te.indexOf(we)>=0});_e&&(oe=Te)}}return en(en({},N),{},Ea({},G,en(en({},I),{},{axisType:o,domain:oe,categoricalDomain:ne,duplicateDomain:pe,originalDomain:(M=I.domain)!==null&&M!==void 0?M:fe,isCategorical:b,layout:x})))},{})},xXt=function(t,n){var s=n.graphicalItems,a=n.Axis,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,u=n.dataStartIndex,m=n.dataEndIndex,x=t.layout,y=t.children,v=Fie(t.data,{graphicalItems:s,dataStartIndex:u,dataEndIndex:m}),b=v.length,N=KUe(x,o),k=-1;return s.reduce(function(M,I){var T=I.type.defaultProps!==void 0?en(en({},I.type.defaultProps),I.props):I.props,P=T[l],F=mVe("number");if(!M[P]){k++;var D;return N?D=zne(0,b):i&&i[P]&&i[P].hasStack?(D=JUe(i[P].stackGroups,u,m),D=Wpe(y,D,P,o)):(D=dpe(F,GUe(v,s.filter(function(U){var V,W,G=l in U.props?U.props[l]:(V=U.type.defaultProps)===null||V===void 0?void 0:V[l],ee="hide"in U.props?U.props.hide:(W=U.type.defaultProps)===null||W===void 0?void 0:W.hide;return G===P&&!ee}),"number",x),a.defaultProps.allowDataOverflow),D=Wpe(y,D,P,o)),en(en({},M),{},Ea({},P,en(en({axisType:o},a.defaultProps),{},{hide:!0,orientation:wm(hXt,"".concat(o,".").concat(k%2),null),domain:D,originalDomain:F,isCategorical:N,layout:x})))}return M},{})},yXt=function(t,n){var s=n.axisType,a=s===void 0?"xAxis":s,o=n.AxisComp,l=n.graphicalItems,i=n.stackGroups,u=n.dataStartIndex,m=n.dataEndIndex,x=t.children,y="".concat(a,"Id"),v=yf(x,o),b={};return v&&v.length?b=gXt(t,{axes:v,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:m}):l&&l.length&&(b=xXt(t,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:m})),b},vXt=function(t){var n=h1(t),s=ay(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:j1e(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Cne(n,s)}},yTe=function(t){var n=t.children,s=t.defaultShowTooltip,a=nm(n,n3),o=0,l=0;return t.data&&t.data.length!==0&&(l=t.data.length-1),a&&a.props&&(a.props.startIndex>=0&&(o=a.props.startIndex),a.props.endIndex>=0&&(l=a.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:l,activeTooltipIndex:-1,isTooltipActive:!!s}},_Xt=function(t){return!t||!t.length?!1:t.some(function(n){var s=by(n&&n.type);return s&&s.indexOf("Bar")>=0})},vTe=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"}},bXt=function(t,n){var s=t.props,a=t.graphicalItems,o=t.xAxisMap,l=o===void 0?{}:o,i=t.yAxisMap,u=i===void 0?{}:i,m=s.width,x=s.height,y=s.children,v=s.margin||{},b=nm(y,n3),N=nm(y,rC),k=Object.keys(u).reduce(function(D,U){var V=u[U],W=V.orientation;return!V.mirror&&!V.hide?en(en({},D),{},Ea({},W,D[W]+V.width)):D},{left:v.left||0,right:v.right||0}),M=Object.keys(l).reduce(function(D,U){var V=l[U],W=V.orientation;return!V.mirror&&!V.hide?en(en({},D),{},Ea({},W,wm(D,"".concat(W))+V.height)):D},{top:v.top||0,bottom:v.bottom||0}),I=en(en({},M),k),T=I.bottom;b&&(I.bottom+=b.props.height||n3.defaultProps.height),N&&n&&(I=Q$t(I,a,s,n));var P=m-I.left-I.right,F=x-I.top-I.bottom;return en(en({brushBottom:T},I),{},{width:Math.max(P,0),height:Math.max(F,0)})},wXt=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},fVe=function(t){var n=t.chartName,s=t.GraphicalChild,a=t.defaultTooltipEventType,o=a===void 0?"axis":a,l=t.validateTooltipEventTypes,i=l===void 0?["axis"]:l,u=t.axisComponents,m=t.legendContent,x=t.formatAxisMap,y=t.defaultProps,v=function(I,T){var P=T.graphicalItems,F=T.stackGroups,D=T.offset,U=T.updateId,V=T.dataStartIndex,W=T.dataEndIndex,G=I.barSize,ee=I.layout,ae=I.barGap,oe=I.barCategoryGap,pe=I.maxBarSize,ne=vTe(ee),fe=ne.numericAxisName,se=ne.cateAxisName,me=_Xt(P),ue=[];return P.forEach(function(xe,Te){var _e=Fie(I.data,{graphicalItems:[xe],dataStartIndex:V,dataEndIndex:W}),we=xe.type.defaultProps!==void 0?en(en({},xe.type.defaultProps),xe.props):xe.props,ve=we.dataKey,Xe=we.maxBarSize,Me=we["".concat(fe,"Id")],Ie=we["".concat(se,"Id")],$e={},Be=u.reduce(function(Ee,Ze){var Le=T["".concat(Ze.axisType,"Map")],Ke=we["".concat(Ze.axisType,"Id")];Le&&Le[Ke]||Ze.axisType==="zAxis"||wk();var tt=Le[Ke];return en(en({},Ee),{},Ea(Ea({},Ze.axisType,tt),"".concat(Ze.axisType,"Ticks"),ay(tt)))},$e),Ve=Be[se],ot=Be["".concat(se,"Ticks")],Tt=F&&F[Me]&&F[Me].hasStack&&cUt(xe,F[Me].stackGroups),Oe=by(xe.type).indexOf("Bar")>=0,at=Cne(Ve,ot),le=[],qe=me&&Y$t({barSize:G,stackGroups:F,totalSize:wXt(Be,se)});if(Oe){var Je,st,je=Ti(Xe)?pe:Xe,ut=(Je=(st=Cne(Ve,ot,!0))!==null&&st!==void 0?st:je)!==null&&Je!==void 0?Je:0;le=X$t({barGap:ae,barCategoryGap:oe,bandSize:ut!==at?ut:at,sizeList:qe[Ie],maxBarSize:je}),ut!==at&&(le=le.map(function(Ee){return en(en({},Ee),{},{position:en(en({},Ee.position),{},{offset:Ee.position.offset-ut/2})})}))}var Ce=xe&&xe.type&&xe.type.getComposedData;Ce&&ue.push({props:en(en({},Ce(en(en({},Be),{},{displayedData:_e,props:I,dataKey:ve,item:xe,bandSize:at,barPosition:le,offset:D,stackedData:Tt,layout:ee,dataStartIndex:V,dataEndIndex:W}))),{},Ea(Ea(Ea({key:xe.key||"item-".concat(Te)},fe,Be[fe]),se,Be[se]),"animationId",U)),childIndex:XAt(xe,I.children),item:xe})}),ue},b=function(I,T){var P=I.props,F=I.dataStartIndex,D=I.dataEndIndex,U=I.updateId;if(!DCe({props:P}))return null;var V=P.children,W=P.layout,G=P.stackOffset,ee=P.data,ae=P.reverseStackOrder,oe=vTe(W),pe=oe.numericAxisName,ne=oe.cateAxisName,fe=yf(V,s),se=oUt(ee,fe,"".concat(pe,"Id"),"".concat(ne,"Id"),G,ae),me=u.reduce(function(we,ve){var Xe="".concat(ve.axisType,"Map");return en(en({},we),{},Ea({},Xe,yXt(P,en(en({},ve),{},{graphicalItems:fe,stackGroups:ve.axisType===pe&&se,dataStartIndex:F,dataEndIndex:D}))))},{}),ue=bXt(en(en({},me),{},{props:P,graphicalItems:fe}),T==null?void 0:T.legendBBox);Object.keys(me).forEach(function(we){me[we]=x(P,me[we],ue,we.replace("Map",""),n)});var xe=me["".concat(ne,"Map")],Te=vXt(xe),_e=v(P,en(en({},me),{},{dataStartIndex:F,dataEndIndex:D,updateId:U,graphicalItems:fe,stackGroups:se,offset:ue}));return en(en({formattedGraphicalItems:_e,graphicalItems:fe,offset:ue,stackGroups:se},Te),me)},N=function(M){function I(T){var P,F,D;return tXt(this,I),D=sXt(this,I,[T]),Ea(D,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Ea(D,"accessibilityManager",new $Yt),Ea(D,"handleLegendBBoxUpdate",function(U){if(U){var V=D.state,W=V.dataStartIndex,G=V.dataEndIndex,ee=V.updateId;D.setState(en({legendBBox:U},b({props:D.props,dataStartIndex:W,dataEndIndex:G,updateId:ee},en(en({},D.state),{},{legendBBox:U}))))}}),Ea(D,"handleReceiveSyncEvent",function(U,V,W){if(D.props.syncId===U){if(W===D.eventEmitterSymbol&&typeof D.props.syncMethod!="function")return;D.applySyncEvent(V)}}),Ea(D,"handleBrushChange",function(U){var V=U.startIndex,W=U.endIndex;if(V!==D.state.dataStartIndex||W!==D.state.dataEndIndex){var G=D.state.updateId;D.setState(function(){return en({dataStartIndex:V,dataEndIndex:W},b({props:D.props,dataStartIndex:V,dataEndIndex:W,updateId:G},D.state))}),D.triggerSyncEvent({dataStartIndex:V,dataEndIndex:W})}}),Ea(D,"handleMouseEnter",function(U){var V=D.getMouseInfo(U);if(V){var W=en(en({},V),{},{isTooltipActive:!0});D.setState(W),D.triggerSyncEvent(W);var G=D.props.onMouseEnter;Za(G)&&G(W,U)}}),Ea(D,"triggeredAfterMouseMove",function(U){var V=D.getMouseInfo(U),W=V?en(en({},V),{},{isTooltipActive:!0}):{isTooltipActive:!1};D.setState(W),D.triggerSyncEvent(W);var G=D.props.onMouseMove;Za(G)&&G(W,U)}),Ea(D,"handleItemMouseEnter",function(U){D.setState(function(){return{isTooltipActive:!0,activeItem:U,activePayload:U.tooltipPayload,activeCoordinate:U.tooltipPosition||{x:U.cx,y:U.cy}}})}),Ea(D,"handleItemMouseLeave",function(){D.setState(function(){return{isTooltipActive:!1}})}),Ea(D,"handleMouseMove",function(U){U.persist(),D.throttleTriggeredAfterMouseMove(U)}),Ea(D,"handleMouseLeave",function(U){D.throttleTriggeredAfterMouseMove.cancel();var V={isTooltipActive:!1};D.setState(V),D.triggerSyncEvent(V);var W=D.props.onMouseLeave;Za(W)&&W(V,U)}),Ea(D,"handleOuterEvent",function(U){var V=YAt(U),W=wm(D.props,"".concat(V));if(V&&Za(W)){var G,ee;/.*touch.*/i.test(V)?ee=D.getMouseInfo(U.changedTouches[0]):ee=D.getMouseInfo(U),W((G=ee)!==null&&G!==void 0?G:{},U)}}),Ea(D,"handleClick",function(U){var V=D.getMouseInfo(U);if(V){var W=en(en({},V),{},{isTooltipActive:!0});D.setState(W),D.triggerSyncEvent(W);var G=D.props.onClick;Za(G)&&G(W,U)}}),Ea(D,"handleMouseDown",function(U){var V=D.props.onMouseDown;if(Za(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ea(D,"handleMouseUp",function(U){var V=D.props.onMouseUp;if(Za(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ea(D,"handleTouchMove",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.throttleTriggeredAfterMouseMove(U.changedTouches[0])}),Ea(D,"handleTouchStart",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseDown(U.changedTouches[0])}),Ea(D,"handleTouchEnd",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseUp(U.changedTouches[0])}),Ea(D,"handleDoubleClick",function(U){var V=D.props.onDoubleClick;if(Za(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ea(D,"handleContextMenu",function(U){var V=D.props.onContextMenu;if(Za(V)){var W=D.getMouseInfo(U);V(W,U)}}),Ea(D,"triggerSyncEvent",function(U){D.props.syncId!==void 0&&uue.emit(hue,D.props.syncId,U,D.eventEmitterSymbol)}),Ea(D,"applySyncEvent",function(U){var V=D.props,W=V.layout,G=V.syncMethod,ee=D.state.updateId,ae=U.dataStartIndex,oe=U.dataEndIndex;if(U.dataStartIndex!==void 0||U.dataEndIndex!==void 0)D.setState(en({dataStartIndex:ae,dataEndIndex:oe},b({props:D.props,dataStartIndex:ae,dataEndIndex:oe,updateId:ee},D.state)));else if(U.activeTooltipIndex!==void 0){var pe=U.chartX,ne=U.chartY,fe=U.activeTooltipIndex,se=D.state,me=se.offset,ue=se.tooltipTicks;if(!me)return;if(typeof G=="function")fe=G(ue,U);else if(G==="value"){fe=-1;for(var xe=0;xe=0){var Tt,Oe;if(pe.dataKey&&!pe.allowDuplicatedCategory){var at=typeof pe.dataKey=="function"?ot:"payload.".concat(pe.dataKey.toString());Tt=wfe(xe,at,fe),Oe=Te&&_e&&wfe(_e,at,fe)}else Tt=xe==null?void 0:xe[ne],Oe=Te&&_e&&_e[ne];if(Ie||Me){var le=U.props.activeIndex!==void 0?U.props.activeIndex:ne;return[A.cloneElement(U,en(en(en({},G.props),Be),{},{activeIndex:le})),null,null]}if(!Ti(Tt))return[Ve].concat(h3(D.renderActivePoints({item:G,activePoint:Tt,basePoint:Oe,childIndex:ne,isRange:Te})))}else{var qe,Je=(qe=D.getItemByXY(D.state.activeCoordinate))!==null&&qe!==void 0?qe:{graphicalItem:Ve},st=Je.graphicalItem,je=st.item,ut=je===void 0?U:je,Ce=st.childIndex,Ee=en(en(en({},G.props),Be),{},{activeIndex:Ce});return[A.cloneElement(ut,Ee),null,null]}return Te?[Ve,null,null]:[Ve,null]}),Ea(D,"renderCustomized",function(U,V,W){return A.cloneElement(U,en(en({key:"recharts-customized-".concat(W)},D.props),D.state))}),Ea(D,"renderMap",{CartesianGrid:{handler:UO,once:!0},ReferenceArea:{handler:D.renderReferenceElement},ReferenceLine:{handler:UO},ReferenceDot:{handler:D.renderReferenceElement},XAxis:{handler:UO},YAxis:{handler:UO},Brush:{handler:D.renderBrush,once:!0},Bar:{handler:D.renderGraphicChild},Line:{handler:D.renderGraphicChild},Area:{handler:D.renderGraphicChild},Radar:{handler:D.renderGraphicChild},RadialBar:{handler:D.renderGraphicChild},Scatter:{handler:D.renderGraphicChild},Pie:{handler:D.renderGraphicChild},Funnel:{handler:D.renderGraphicChild},Tooltip:{handler:D.renderCursor,once:!0},PolarGrid:{handler:D.renderPolarGrid,once:!0},PolarAngleAxis:{handler:D.renderPolarAxis},PolarRadiusAxis:{handler:D.renderPolarAxis},Customized:{handler:D.renderCustomized}}),D.clipPathId="".concat((P=T.id)!==null&&P!==void 0?P:NP("recharts"),"-clip"),D.throttleTriggeredAfterMouseMove=V$e(D.triggeredAfterMouseMove,(F=T.throttleDelay)!==null&&F!==void 0?F:1e3/60),D.state={},D}return oXt(I,M),nXt(I,[{key:"componentDidMount",value:function(){var P,F;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(P=this.props.margin.left)!==null&&P!==void 0?P:0,top:(F=this.props.margin.top)!==null&&F!==void 0?F:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var P=this.props,F=P.children,D=P.data,U=P.height,V=P.layout,W=nm(F,mp);if(W){var G=W.props.defaultIndex;if(!(typeof G!="number"||G<0||G>this.state.tooltipTicks.length-1)){var ee=this.state.tooltipTicks[G]&&this.state.tooltipTicks[G].value,ae=Zpe(this.state,D,G,ee),oe=this.state.tooltipTicks[G].coordinate,pe=(this.state.offset.top+U)/2,ne=V==="horizontal",fe=ne?{x:oe,y:pe}:{y:oe,x:pe},se=this.state.formattedGraphicalItems.find(function(ue){var xe=ue.item;return xe.type.name==="Scatter"});se&&(fe=en(en({},fe),se.props.points[G].tooltipPosition),ae=se.props.points[G].tooltipPayload);var me={activeTooltipIndex:G,isTooltipActive:!0,activeLabel:ee,activePayload:ae,activeCoordinate:fe};this.setState(me),this.renderCursor(W),this.accessibilityManager.setIndex(G)}}}},{key:"getSnapshotBeforeUpdate",value:function(P,F){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==F.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==P.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==P.margin){var D,U;this.accessibilityManager.setDetails({offset:{left:(D=this.props.margin.left)!==null&&D!==void 0?D:0,top:(U=this.props.margin.top)!==null&&U!==void 0?U:0}})}return null}},{key:"componentDidUpdate",value:function(P){kfe([nm(P.children,mp)],[nm(this.props.children,mp)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var P=nm(this.props.children,mp);if(P&&typeof P.props.shared=="boolean"){var F=P.props.shared?"axis":"item";return i.indexOf(F)>=0?F:o}return o}},{key:"getMouseInfo",value:function(P){if(!this.container)return null;var F=this.container,D=F.getBoundingClientRect(),U=jzt(D),V={chartX:Math.round(P.pageX-U.left),chartY:Math.round(P.pageY-U.top)},W=D.width/F.offsetWidth||1,G=this.inRange(V.chartX,V.chartY,W);if(!G)return null;var ee=this.state,ae=ee.xAxisMap,oe=ee.yAxisMap,pe=this.getTooltipEventType(),ne=xTe(this.state,this.props.data,this.props.layout,G);if(pe!=="axis"&&ae&&oe){var fe=h1(ae).scale,se=h1(oe).scale,me=fe&&fe.invert?fe.invert(V.chartX):null,ue=se&&se.invert?se.invert(V.chartY):null;return en(en({},V),{},{xValue:me,yValue:ue},ne)}return ne?en(en({},V),ne):null}},{key:"inRange",value:function(P,F){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,U=this.props.layout,V=P/D,W=F/D;if(U==="horizontal"||U==="vertical"){var G=this.state.offset,ee=V>=G.left&&V<=G.left+G.width&&W>=G.top&&W<=G.top+G.height;return ee?{x:V,y:W}:null}var ae=this.state,oe=ae.angleAxisMap,pe=ae.radiusAxisMap;if(oe&&pe){var ne=h1(oe);return H5e({x:V,y:W},ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var P=this.props.children,F=this.getTooltipEventType(),D=nm(P,mp),U={};D&&F==="axis"&&(D.props.trigger==="click"?U={onClick:this.handleClick}:U={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 V=ene(this.props,this.handleOuterEvent);return en(en({},V),U)}},{key:"addListener",value:function(){uue.on(hue,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){uue.removeListener(hue,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(P,F,D){for(var U=this.state.formattedGraphicalItems,V=0,W=U.length;V");return e}const xVe=A.forwardRef(({id:e,className:t,children:n,config:s,...a},o)=>{const l=A.useId(),i=`chart-${e||l.replace(/:/g,"")}`;return r.jsx(pVe.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":i,ref:o,className:Ut("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),...a,children:[r.jsx(SXt,{id:i,config:s}),r.jsx(Gfe,{children:n})]})})});xVe.displayName="Chart";const SXt=({id:e,config:t})=>{const n=Object.entries(t).filter(([s,a])=>a.theme||a.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(NXt).map(([s,a])=>` ${a} [data-chart=${e}] { ${n.map(([o,l])=>{var u;const i=((u=l.theme)==null?void 0:u[s])||l.color;return i?` --color-${o}: ${i};`:null}).join(` `)} } `).join(` `)}}):null},yVe=A.forwardRef(({active:e,payload:t,className:n,indicator:s="dot",hideLabel:a=!1,hideIndicator:o=!1,label:l,labelFormatter:i,labelClassName:u,formatter:m,color:x,nameKey:y,labelKey:v},b)=>{const{config:N}=gVe(),k=A.useMemo(()=>{var D;if(a||!(t!=null&&t.length))return null;const[I]=t,T=`${v||I.dataKey||I.name||"value"}`,P=Ype(N,I,T),F=!v&&typeof l=="string"?((D=N[l])==null?void 0:D.label)||l:P==null?void 0:P.label;return i?r.jsx("div",{className:Ut("font-medium",u),children:i(F,t)}):F?r.jsx("div",{className:Ut("font-medium",u),children:F}):null},[l,i,t,a,u,N,v]);if(!e||!(t!=null&&t.length))return null;const M=t.length===1&&s!=="dot";return r.jsxs("div",{ref:b,className:Ut("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:[M?null:k,r.jsx("div",{className:"grid gap-1.5",children:t.map((I,T)=>{const P=`${y||I.name||I.dataKey||"value"}`,F=Ype(N,I,P),D=x||I.payload.fill||I.color;return r.jsx("div",{className:Ut("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:m&&(I==null?void 0:I.value)!==void 0&&I.name?m(I.value,I.name,I,T,I.payload):r.jsxs(r.Fragment,{children:[F!=null&&F.icon?r.jsx(F.icon,{}):!o&&r.jsx("div",{className:Ut("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":M&&s==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),r.jsxs("div",{className:Ut("flex flex-1 justify-between leading-none",M?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[M?k:null,r.jsx("span",{className:"text-muted-foreground",children:(F==null?void 0:F.label)||I.name})]}),I.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:I.value.toLocaleString()})]})]})},I.dataKey)})})]})});yVe.displayName="ChartTooltip";const CXt=A.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:s="bottom",nameKey:a},o)=>{const{config:l}=gVe();return n!=null&&n.length?r.jsx("div",{ref:o,className:Ut("flex items-center justify-center gap-4",s==="top"?"pb-3":"pt-3",e),children:n.map(i=>{const u=`${a||i.dataKey||"value"}`,m=Ype(l,i,u);return r.jsxs("div",{className:Ut("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[m!=null&&m.icon&&!t?r.jsx(m.icon,{}):r.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:i.color}}),m==null?void 0:m.label]},i.value)})}):null});CXt.displayName="ChartLegend";function Ype(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 a=n;return n in t&&typeof t[n]=="string"?a=t[n]:s&&n in s&&typeof s[n]=="string"&&(a=s[n]),a in e?e[a]:e[n]}const qO=["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 vVe({stats:e,year:t}){const n=e.transactionsByMonth.some(a=>a.count>0),s=e.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(He,{children:r.jsx(et,{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(He,{className:"overflow-hidden",children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(et,{className:"overflow-hidden",children:r.jsx(xVe,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Gfe,{width:"100%",height:"100%",children:r.jsxs(jXt,{data:e.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(Jqe,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Die,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(Rie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(mp,{content:r.jsx(yVe,{})}),r.jsx(Dk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(et,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Gfe,{width:"100%",height:"100%",children:r.jsxs(kXt,{children:[r.jsx(Ky,{data:e.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:a,percent:o})=>o>.05?`${a} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:e.leadSourceBreakdown.map((a,o)=>r.jsx(uie,{fill:qO[o%qO.length]},`cell-${o}`))}),r.jsx(mp,{formatter:(a,o)=>[`${a} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:e.leadSourceBreakdown.slice(0,6).map((a,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:qO[o%qO.length]}}),r.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function MXt(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 a=Nye(t,s,new Date);if(wme(a))return on(a,"yyyy-MM-dd")}catch{}try{const s=new Date(t);if(wme(s))return on(s,"yyyy-MM-dd")}catch{}return null}const TXt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function AXt({open:e,onOpenChange:t}){const[n,s]=A.useState([]),[a,o]=A.useState(!1),[l,i]=A.useState(0),{data:u}=dae(),{data:m}=qp(),x=uae(),y=()=>{const I=TXt.join(","),T=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),P=`${I} ${T}`,F=new Blob([P],{type:"text/csv"}),D=URL.createObjectURL(F),U=document.createElement("a");U.href=D,U.download="transaction-import-template.csv",U.click(),URL.revokeObjectURL(D)},v=I=>{const T=I.split(` `).filter(F=>F.trim());if(T.length<2)return[];const P=T[0].split(",").map(F=>F.trim().toLowerCase().replace(/['"]/g,""));return T.slice(1).map((F,D)=>{var me,ue,xe,Te;const U=[];let V="",W=!1;for(const _e of F)_e==='"'?W=!W:_e===","&&!W?(U.push(V.trim()),V=""):V+=_e;U.push(V.trim());const G=_e=>{var ve;const we=P.indexOf(_e);return we>=0?(ve=U[we])==null?void 0:ve.replace(/^["']|["']$/g,"").trim():""},ee=(me=G("transaction_type"))==null?void 0:me.toLowerCase(),ae=(ue=G("sale_price"))==null?void 0:ue.replace(/[$,]/g,""),oe=(xe=G("commission_amount"))==null?void 0:xe.replace(/[$,]/g,""),pe=(Te=G("is_win"))==null?void 0:Te.toLowerCase(),ne=G("close_date"),fe=MXt(ne);let se;return G("property_address")?["buyer","seller"].includes(ee)?fe?(!ae||isNaN(Number(ae)))&&(se="Invalid sale price"):se=`Invalid date format: "${ne}" - use MM/DD/YYYY or YYYY-MM-DD`:se='Transaction type must be "buyer" or "seller"':se="Missing property address",{property_address:G("property_address"),city:G("city"),state:G("state"),zip:G("zip"),transaction_type:ee==="seller"?"seller":"buyer",close_date:fe||"",sale_price:Number(ae)||0,commission_amount:oe?Number(oe):null,lead_source_name:G("lead_source"),client_type_name:G("client_type"),is_win:["yes","true","1"].includes(pe),notes:G("notes"),error:se}})},b=I=>{var F;const T=(F=I.target.files)==null?void 0:F[0];if(!T)return;const P=new FileReader;P.onload=D=>{var W;const U=(W=D.target)==null?void 0:W.result,V=v(U);s(V)},P.readAsText(T)},N=async()=>{const I=n.filter(F=>!F.error);if(I.length===0){Ae.error("No valid transactions to import");return}o(!0),i(0);let T=0,P=0;for(let F=0;FW.name.toLowerCase()===D.lead_source_name.toLowerCase()),V=m==null?void 0:m.find(W=>W.name.toLowerCase()===D.client_type_name.toLowerCase());await x.mutateAsync({property_address:D.property_address,city:D.city||null,state:D.state||null,zip:D.zip||null,transaction_type:D.transaction_type,close_date:D.close_date,sale_price:D.sale_price,commission_amount:D.commission_amount,lead_source_id:(U==null?void 0:U.id)||null,client_type_id:(V==null?void 0:V.id)||null,contact_id:null,notes:D.notes||null,is_win:D.is_win}),T++}catch(U){P++,console.error("Failed to import transaction:",U)}i(Math.round((F+1)/I.length*100))}o(!1),T>0&&Ae.success(`Imported ${T} transaction${T>1?"s":""}`),P>0&&Ae.error(`Failed to import ${P} transaction${P>1?"s":""}`),s([]),t(!1)},k=n.filter(I=>!I.error).length,M=n.filter(I=>I.error).length;return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Import Transactions"}),r.jsx(Yn,{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(Q,{variant:"outline",onClick:y,children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(lt,{id:"csv-file",type:"file",accept:".csv",onChange:b})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(At,{variant:"outline",children:[n.length," rows found"]}),k>0&&r.jsxs(At,{className:"bg-green-500 text-white",children:[r.jsx(mi,{className:"h-3 w-3 mr-1"}),k," valid"]}),M>0&&r.jsxs(At,{variant:"destructive",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),M," errors"]})]}),r.jsx(Vo,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((I,T)=>r.jsxs("div",{className:`p-2 rounded text-sm ${I.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:I.property_address||"(no address)"}),r.jsx(At,{variant:I.transaction_type==="buyer"?"default":"secondary",children:I.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[I.close_date," • $",I.sale_price.toLocaleString()]}),I.error&&r.jsx(D0e,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(R0e,{className:"text-xs",children:I.error})})]},T)),n.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",n.length-10," more"]})]})}),a&&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(Q,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(Q,{onClick:N,disabled:k===0||a,children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Import ",k," Transaction",k!==1?"s":""]})]})]})]})})}const EXt=I3({transactions_goal:DA().min(0).optional(),volume_goal:DA().min(0).optional(),gci_goal:DA().min(0).optional()});function IXt({open:e,onOpenChange:t,year:n,existingGoals:s}){const a=lxt(),{data:o}=hae(),l=(o==null?void 0:o.show_commission)??!0,i=Qse({resolver:Jse(EXt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});A.useEffect(()=>{s?i.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}):i.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[s,i,e]);const u=async m=>{await a.mutateAsync({year:n,transactions_goal:m.transactions_goal??null,volume_goal:m.volume_goal??null,gci_goal:l?m.gci_goal??null:null}),t(!1)};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Br,{children:[n," Goals"]}),r.jsx(Yn,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(eae,{...i,children:r.jsxs("form",{onSubmit:i.handleSubmit(u),className:"space-y-4",children:[r.jsx(Ol,{control:i.control,name:"transactions_goal",render:({field:m})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Transactions Goal"}),r.jsx(Ml,{children:r.jsx(lt,{type:"number",placeholder:"e.g., 24",...m,value:m.value??"",onChange:x=>m.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(qee,{children:"Total number of deals you want to close"}),r.jsx(Gu,{})]})}),r.jsx(Ol,{control:i.control,name:"volume_goal",render:({field:m})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"Volume Goal ($)"}),r.jsx(Ml,{children:r.jsx(lt,{type:"number",placeholder:"e.g., 5000000",...m,value:m.value??"",onChange:x=>m.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(qee,{children:"Total sales volume you want to achieve"}),r.jsx(Gu,{})]})}),l&&r.jsx(Ol,{control:i.control,name:"gci_goal",render:({field:m})=>r.jsxs(Sl,{children:[r.jsx(Cl,{children:"GCI Goal ($)"}),r.jsx(Ml,{children:r.jsx(lt,{type:"number",placeholder:"e.g., 150000",...m,value:m.value??"",onChange:x=>m.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(qee,{children:"Gross commission income target"}),r.jsx(Gu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(Q,{type:"submit",disabled:a.isPending,children:"Save Goals"})]})]})})]})})}function _Ve({transactions:e,isLoading:t}){const n=A.useRef(null),s=A.useRef(null),a=A.useRef([]),o=A.useRef(null),{isAdmin:l}=tn(),[i,u]=A.useState(""),[m,x]=A.useState(!0),[y,v]=A.useState(0),[b,N]=A.useState(!1),k=e.filter(I=>I.latitude!=null&&I.longitude!=null),M=e.filter(I=>I.latitude==null||I.longitude==null);return A.useEffect(()=>{(async()=>{x(!0);try{const{data:T}=await Y.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();T!=null&&T.value&&u(T.value)}catch(T){console.error("Error fetching mapbox token:",T)}x(!1)})()},[]),A.useEffect(()=>{if(!i||M.length===0||b)return;(async()=>{var P;N(!0);let T=0;for(const F of M){const D=[F.property_address,F.city,F.state,F.zip].filter(Boolean).join(", ");if(D)try{const V=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(D)}.json?access_token=${i}&limit=1`)).json();if((P=V.features)!=null&&P[0]){const[W,G]=V.features[0].center;await Y.from("scorecard_transactions").update({latitude:G,longitude:W}).eq("id",F.id),F.latitude=G,F.longitude=W,T++}}catch(U){console.error("Geocode error:",U)}}v(T),N(!1)})()},[i,e]),A.useEffect(()=>{if(!n.current||!i||s.current)return;rc.accessToken=i;const I=e.filter(F=>F.latitude!=null&&F.longitude!=null);let T=[-98.5795,39.8283],P=4;if(I.length>0){const F=I.reduce((U,V)=>U+V.longitude,0)/I.length,D=I.reduce((U,V)=>U+V.latitude,0)/I.length;T=[F,D],P=I.length===1?12:10}return s.current=new rc.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:P,center:T}),s.current.addControl(new rc.NavigationControl,"top-right"),()=>{var F;(F=s.current)==null||F.remove(),s.current=null}},[i]),A.useEffect(()=>{var T;if(!s.current||!i)return;a.current.forEach(P=>P.remove()),a.current=[],(T=o.current)==null||T.remove();const I=e.filter(P=>P.latitude!=null&&P.longitude!=null);if(I.forEach(P=>{var G;const F=P.transaction_type==="buyer",D=F?"#3B82F6":"#10B981",U=document.createElement("div");U.className="cursor-pointer",U.innerHTML=`
${F?'':''}
`;const V=new rc.Popup({offset:25,closeButton:!0}).setHTML(`
${P.property_address}
${P.city?`
${P.city}${P.state?", "+P.state:""} ${P.zip||""}
`:""}
${F?"Buyer":"Seller"} $${Number(P.sale_price).toLocaleString()}
Closed: ${new Date(P.close_date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} ${(G=P.lead_source)!=null&&G.name?" · "+P.lead_source.name:""}
${P.contact?`
Client: ${P.contact.first_name} ${P.contact.last_name||""}
`:""}
`),W=new rc.Marker(U).setLngLat([P.longitude,P.latitude]).setPopup(V).addTo(s.current);a.current.push(W)}),I.length>1){const P=new rc.LngLatBounds;I.forEach(F=>P.extend([F.longitude,F.latitude])),s.current.fitBounds(P,{padding:60,maxZoom:13})}else I.length===1&&s.current.flyTo({center:[I[0].longitude,I[0].latitude],zoom:12})},[e,i,b]),m||t?r.jsx(He,{children:r.jsx(et,{className:"flex items-center justify-center h-[50vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):i?e.length===0?r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(Do,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"No Transactions Yet"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add transactions to see them plotted on the map."})]})]})}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center 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 border-2 border-white shadow",style:{background:"#3B82F6"}}),r.jsx("span",{children:"Buyer"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{background:"#10B981"}}),r.jsx("span",{children:"Seller"})]}),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[k.length," of ",e.length," mapped",b&&" · Geocoding..."]})]}),r.jsx("div",{ref:n,className:"w-full h-[55vh] rounded-lg shadow-lg border"})]}):r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(yl,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Set up your Mapbox token in the Popby Map to enable maps across the platform.":"The map feature has not been configured yet. Please contact your administrator."})]})]})})}const bVe=new Date().getFullYear(),PXt=Array.from({length:10},(e,t)=>bVe-t);function LXt(){var D;const[e,t]=A.useState(bVe),[n,s]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(!1),[u,m]=A.useState(!1),{data:x,isLoading:y}=Rye(e),{yearStats:v,lifetimeStats:b,showCommission:N}=qRe(e),{data:k,isLoading:M}=URe(e),{data:I}=hae(),T=cxt(),P=()=>{if(!x||x.length===0)return;const U=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...N?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],V=x.map(oe=>{var pe,ne;return[oe.property_address,oe.city||"",oe.state||"",oe.zip||"",oe.transaction_type,oe.close_date,oe.sale_price,...N?[oe.commission_amount||""]:[],((pe=oe.lead_source)==null?void 0:pe.name)||"",((ne=oe.client_type)==null?void 0:ne.name)||"",oe.contact?`${oe.contact.first_name} ${oe.contact.last_name||""}`.trim():"",oe.is_win?"Yes":"No",oe.notes||""]}),W=[U,...V].map(oe=>oe.map(pe=>`"${String(pe).replace(/"/g,'""')}"`).join(",")).join(` `),G=new Blob([W],{type:"text/csv"}),ee=URL.createObjectURL(G),ae=document.createElement("a");ae.href=ee,ae.download=`transactions-${e}.csv`,ae.click(),URL.revokeObjectURL(ee)},F=!x||x.length===0;return r.jsxs(Fr,{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(un,{value:String(e),onValueChange:U=>t(Number(U)),children:[r.jsx(ln,{className:"w-[120px]",children:r.jsx(mn,{})}),r.jsx(cn,{children:PXt.map(U=>r.jsx($t,{value:String(U),children:U},U))})]}),r.jsx(Q,{variant:"outline",size:"icon",onClick:()=>m(!u),children:r.jsx(zd,{className:"h-4 w-4"})})]})]}),u&&r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsx(Gt,{className:"text-lg",children:"Settings"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(ze,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(As,{checked:(I==null?void 0:I.show_commission)??!0,onCheckedChange:U=>T.mutate({show_commission:U})})]})})]}),F&&!y?r.jsx(He,{className:"py-12",children:r.jsxs(et,{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(_c,{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(Q,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(Q,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(bo,{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(Q,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(so,{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(Q,{onClick:()=>s(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(Q,{variant:"outline",onClick:()=>i(!0),children:[r.jsx(xy,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(Q,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(Q,{variant:"outline",onClick:P,disabled:F,children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(Q,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(so,{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(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ya,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:v.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.totalTransactions," lifetime"]})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($n,{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:[v.buyerCount,"/",v.sellerCount]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Fd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:tu(v.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[tu(b.totalVolume,!0)," lifetime"]})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(eh,{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:tu(v.averagePrice,!0)})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bl,{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:((D=v.topLeadSource)==null?void 0:D.name)||"-"}),v.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[v.topLeadSource.count," deals"]})]})}),N&&r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Fd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:tu(v.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[tu(b.totalCommission,!0)," lifetime"]})]})})]}),k&&r.jsx(TBe,{goals:k,stats:v,year:e,showCommission:N}),r.jsxs(wi,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"transactions",children:"Transactions"}),r.jsx(sn,{value:"charts",children:"Charts"}),r.jsxs(sn,{value:"map",children:[r.jsx(Do,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Sn,{value:"transactions",children:r.jsx(MBe,{transactions:x||[],showCommission:N,isLoading:y})}),r.jsx(Sn,{value:"charts",children:r.jsx(vVe,{stats:v,year:e})}),r.jsx(Sn,{value:"map",children:r.jsx(_Ve,{transactions:x||[],isLoading:y})})]})]})]}),r.jsx(CBe,{open:n,onOpenChange:s}),r.jsx(AXt,{open:a,onOpenChange:o}),r.jsx(IXt,{open:l,onOpenChange:i,year:e,existingGoals:k})]})}function wVe({open:e,onOpenChange:t,listingId:n,listingSlug:s,listingTitle:a}){const{user:o}=tn(),[l,i]=A.useState(null),[u,m]=A.useState(!1),[x,y]=A.useState(!1);A.useEffect(()=>{(async()=>{if(!(!e||!o)){m(!0);try{const{data:M,error:I}=await Y.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(I)throw I;if(M&&M.share_token)i(M);else if(M&&!M.share_token){const{data:T,error:P}=await Y.from("listing_shares").update({share_type:"referral_link"}).eq("id",M.id).select("id, share_token, click_count, lead_count").single();if(P)throw P;i(T)}else{const{data:T,error:P}=await Y.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(P)throw P;i(T)}}catch(M){console.error("Error creating share link:",M),Ae.error("Failed to generate share link")}finally{m(!1)}}})()},[e,o,n]);const v=l!=null&&l.share_token?`https://listings.relevelup.com/${s||n}?ref=${l.share_token}`:"",b=async()=>{try{await navigator.clipboard.writeText(v),y(!0),Ae.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{Ae.error("Failed to copy link")}},N=k=>{const M=encodeURIComponent(v),I=encodeURIComponent(`Check out this listing: ${a}`);switch(k){case"email":window.open(`mailto:?subject=${I}&body=${M}`);break;case"text":window.open(`sms:?body=${I}%20${M}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${M}`,"_blank");break}};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(Os,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(Yn,{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(ze,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:u?"Generating...":v,readOnly:!0,className:"font-mono text-sm"}),r.jsx(Q,{onClick:b,disabled:u||!v,variant:x?"default":"outline",children:x?r.jsx(mi,{className:"h-4 w-4"}):r.jsx(Po,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>N("email"),disabled:u,children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>N("text"),disabled:u,children:[r.jsx(Ro,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(Q,{variant:"outline",className:"flex-1",onClick:()=>N("facebook"),disabled:u,children:[r.jsx(au,{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(ze,{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(_o,{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($n,{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 OXt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},DXt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},RXt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function VO({listing:e,onClick:t,onEdit:n,onDelete:s,showActions:a}){var k,M;const{user:o}=tn(),{data:l}=ORe(e.id),i=LRe(),[u,m]=A.useState(!1),x=I=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(I),y=((k=e.photos)==null?void 0:k.find(I=>I.is_primary))||((M=e.photos)==null?void 0:M[0]),v=(o==null?void 0:o.id)===e.agent_id,b=async I=>{I.stopPropagation();try{const T=await i.mutateAsync(e.id);Ae.success(T.saved?"Listing saved!":"Listing removed from saved")}catch{Ae.error("Failed to save listing")}},N=I=>{if(I.stopPropagation(),o)m(!0);else{const T=`https://listings.relevelup.com/${e.slug||e.id}`;navigator.clipboard.writeText(T),Ae.success("Link copied to clipboard!")}};return r.jsxs(He,{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(Ug,{className:"h-12 w-12"})}),r.jsx(At,{className:`absolute top-2 left-2 ${OXt[e.status]} text-white border-0`,children:DXt[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(ks,{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(Q,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:b,children:r.jsx(vi,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),r.jsx(Q,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:N,title:v?"Copy link":"Share & earn leads",children:v?r.jsx(Nc,{className:"h-4 w-4"}):r.jsx(Os,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(wVe,{open:u,onOpenChange:m,listingId:e.id,listingSlug:e.slug||null,listingTitle:e.property_address||`${e.city}, ${e.state}`}),r.jsxs(et,{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(At,{variant:"outline",className:"text-xs",children:[r.jsx($n,{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(Do,{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($1,{className:"h-4 w-4"}),e.bedrooms," bd"]}),e.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(B1,{className:"h-4 w-4"}),e.bathrooms," ba"]}),e.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ug,{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(At,{variant:"secondary",className:"text-xs",children:RXt[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(_o,{className:"h-3 w-3"}),e.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Nc,{className:"h-3 w-3"}),e.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(vi,{className:"h-3 w-3"}),e.save_count]})]}),a&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(Q,{variant:"outline",size:"sm",className:"flex-1",onClick:I=>{I.stopPropagation(),n()},children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(Q,{variant:"destructive",size:"sm",onClick:I=>{I.stopPropagation(),s()},children:r.jsx(Bn,{className:"h-4 w-4"})})]})]})]})}const FXt=[{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"}],zXt=[{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 BXt({filters:e,onFiltersChange:t,onClose:n}){const s=()=>{t({sortBy:"newest"})};return r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Gt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(ds,{className:"h-4 w-4"})})]})]}),r.jsxs(et,{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(ze,{children:"Status"}),r.jsxs(un,{value:e.status||"all",onValueChange:a=>t({...e,status:a==="all"?void 0:a}),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"All statuses"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Statuses"}),FXt.map(a=>r.jsx($t,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Property Type"}),r.jsxs(un,{value:e.propertyType||"all",onValueChange:a=>t({...e,propertyType:a==="all"?void 0:a}),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"All types"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Types"}),zXt.map(a=>r.jsx($t,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Min Price"}),r.jsx(lt,{type:"number",placeholder:"No minimum",value:e.minPrice||"",onChange:a=>t({...e,minPrice:a.target.value?Number(a.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Max Price"}),r.jsx(lt,{type:"number",placeholder:"No maximum",value:e.maxPrice||"",onChange:a=>t({...e,maxPrice:a.target.value?Number(a.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(ze,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(As,{checked:e.openToReferrals||!1,onCheckedChange:a=>t({...e,openToReferrals:a||void 0})})]})]})]})}function $Xt({leaderboard:e}){const t=s=>{switch(s){case 0:return r.jsx(io,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(my,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Bl,{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,a)=>!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(At,{variant:l===0?"default":"secondary",children:[o.count," ",a]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(io,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(et,{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(Nc,{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(ya,{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(my,{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(io,{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(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Community Leaderboard"})}),r.jsx(et,{children:r.jsxs(wi,{defaultValue:"sharers",children:[r.jsxs(_i,{className:"w-full",children:[r.jsxs(sn,{value:"sharers",className:"flex-1",children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(sn,{value:"listers",className:"flex-1",children:[r.jsx(ya,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(Sn,{value:"sharers",className:"mt-4",children:n(e==null?void 0:e.topSharers,"shares")}),r.jsx(Sn,{value:"listers",className:"mt-4",children:n(e==null?void 0:e.topListers,"listings")})]})})]})]})}const _Te={coming_soon:"#F59E0B",active:"#10B981",price_improvement:"#8B5CF6",under_contract:"#3B82F6",sold:"#A855F7"},bTe={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function UXt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function qXt({listings:e,isLoading:t}){const n=Vn(),s=A.useRef(null),a=A.useRef(null),o=A.useRef([]),{isAdmin:l}=tn(),[i,u]=A.useState(""),[m,x]=A.useState(!0),[y,v]=A.useState(!1),b=e.filter(k=>k.latitude!=null&&k.longitude!=null),N=e.filter(k=>(k.latitude==null||k.longitude==null)&&(k.property_address||k.city));return A.useEffect(()=>{(async()=>{x(!0);try{const{data:M}=await Y.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();M!=null&&M.value&&u(M.value)}catch(M){console.error("Error fetching mapbox token:",M)}x(!1)})()},[]),A.useEffect(()=>{if(!i||N.length===0||y)return;(async()=>{var M;v(!0);for(const I of N){const T=[I.property_address,I.city,I.state].filter(Boolean).join(", ");if(T)try{const F=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(T)}.json?access_token=${i}&limit=1`)).json();if((M=F.features)!=null&&M[0]){const[D,U]=F.features[0].center;await Y.from("listings").update({latitude:U,longitude:D}).eq("id",I.id),I.latitude=U,I.longitude=D}}catch(P){console.error("Geocode error:",P)}}v(!1)})()},[i,e]),A.useEffect(()=>{if(!s.current||!i||a.current)return;rc.accessToken=i;const k=e.filter(T=>T.latitude!=null&&T.longitude!=null);let M=[-98.5795,39.8283],I=4;if(k.length>0){const T=k.reduce((F,D)=>F+D.longitude,0)/k.length,P=k.reduce((F,D)=>F+D.latitude,0)/k.length;M=[T,P],I=k.length===1?12:10}return a.current=new rc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:I,center:M}),a.current.addControl(new rc.NavigationControl,"top-right"),()=>{var T;(T=a.current)==null||T.remove(),a.current=null}},[i]),A.useEffect(()=>{if(!a.current||!i)return;o.current.forEach(M=>M.remove()),o.current=[];const k=e.filter(M=>M.latitude!=null&&M.longitude!=null);if(k.forEach(M=>{var U,V,W;const I=_Te[M.status]||"#10B981",T=((U=M.photos)==null?void 0:U.find(G=>G.is_primary))||((V=M.photos)==null?void 0:V[0]),P=document.createElement("div");P.className="cursor-pointer",P.innerHTML=`
`;const F=new rc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${T!=null&&T.photo_url?``:""}
${UXt(M.price)}
${M.property_address||""}
${M.city}, ${M.state}
${bTe[M.status]||M.status} ${M.bedrooms?`${M.bedrooms} bed`:""} ${M.bathrooms?`${M.bathrooms} bath`:""}
${(W=M.agent)!=null&&W.name?`
Listed by ${M.agent.name}
`:""}
Click to view details →
`),D=new rc.Marker(P).setLngLat([M.longitude,M.latitude]).setPopup(F).addTo(a.current);o.current.push(D)}),k.length>1){const M=new rc.LngLatBounds;k.forEach(I=>M.extend([I.longitude,I.latitude])),a.current.fitBounds(M,{padding:60,maxZoom:13})}else k.length===1&&a.current.flyTo({center:[k[0].longitude,k[0].latitude],zoom:12})},[e,i,y]),A.useEffect(()=>(window.__navigateToListing__=k=>{n(`/mission-control/listings/${k}`)},()=>{delete window.__navigateToListing__}),[n]),m||t?r.jsx(He,{children:r.jsx(et,{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"})})}):i?e.length===0?r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(Do,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"No Listings Yet"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add listings to see them on the map."})]})]})}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[Object.entries(_Te).map(([k,M])=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:M}}),r.jsx("span",{className:"text-xs",children:bTe[k]})]},k)),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[b.length," of ",e.length," mapped",y&&" · Geocoding..."]})]}),r.jsx("div",{ref:s,className:"w-full h-[60vh] rounded-lg shadow-lg border"})]}):r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(yl,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Set up your Mapbox token in Settings to enable maps.":"The map feature has not been configured yet. Please contact your administrator."})]})]})})}function VXt(){var G,ee,ae,oe,pe,ne,fe,se;const e=Vn(),{brokerageId:t}=tn(),{data:n,isLoading:s}=TRe(),[a,o]=A.useState("feed"),[l,i]=A.useState(!1),[u,m]=A.useState(""),[x,y]=A.useState({sortBy:"newest"}),{data:v,isLoading:b}=ARe({...x,city:u||x.city}),{data:N,isLoading:k}=Wgt(),{data:M,isLoading:I}=ERe(),{data:T,isLoading:P}=Ygt(),{data:F,isLoading:D}=Jgt(),{data:U}=Qgt(),V=PRe(),W=async me=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await V.mutateAsync(me),Ae.success("Listing deleted successfully")}catch{Ae.error("Failed to delete listing")}};return s?r.jsx(Fr,{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(Fr,{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(Q,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(_n,{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(He,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(ya,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(v==null?void 0:v.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(vi,{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(He,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(Tj,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(M==null?void 0:M.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx($n,{className:"h-5 w-5 text-sky-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(((G=T==null?void 0:T.sent)==null?void 0:G.length)||0)+(((ee=T==null?void 0:T.received)==null?void 0:ee.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(wi,{value:a,onValueChange:o,children:[r.jsxs(_i,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(sn,{value:"feed",children:"Community Feed"}),t&&r.jsx(sn,{value:"brokerage",children:"Brokerage"}),r.jsx(sn,{value:"my-listings",children:"My Listings"}),r.jsx(sn,{value:"saved",children:"Saved"}),r.jsx(sn,{value:"referrals",children:"Referrals"}),r.jsx(sn,{value:"map",children:"Map"}),r.jsx(sn,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(Sn,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by city or neighborhood...",value:u,onChange:me=>m(me.target.value),className:"pl-9"})]}),r.jsxs(un,{value:x.sortBy,onValueChange:me=>y({...x,sortBy:me}),children:[r.jsx(ln,{className:"w-[180px]",children:r.jsx(mn,{placeholder:"Sort by"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"newest",children:"Newest First"}),r.jsx($t,{value:"updated",children:"Recently Updated"}),r.jsx($t,{value:"price_asc",children:"Price: Low to High"}),r.jsx($t,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(Q,{variant:"outline",onClick:()=>i(!l),children:[r.jsx(H1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(BXt,{filters:x,onFiltersChange:y,onClose:()=>i(!1)}),b?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((me,ue)=>r.jsxs(He,{children:[r.jsx(Er,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Er,{className:"h-5 w-3/4"}),r.jsx(Er,{className:"h-4 w-1/2"}),r.jsx(Er,{className:"h-4 w-1/4"})]})]},ue))}):(v==null?void 0:v.length)===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(ya,{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(Q,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(_n,{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:v==null?void 0:v.map(me=>r.jsx(VO,{listing:me,onClick:()=>e(`/mission-control/listings/${me.id}`)},me.id))})]}),r.jsx(Sn,{value:"my-listings",className:"space-y-4",children:I?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((me,ue)=>r.jsxs(He,{children:[r.jsx(Er,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Er,{className:"h-5 w-3/4"}),r.jsx(Er,{className:"h-4 w-1/2"})]})]},ue))}):(M==null?void 0:M.length)===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Tj,{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(Q,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(_n,{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:M==null?void 0:M.map(me=>r.jsx(VO,{listing:me,showActions:!0,onClick:()=>e(`/mission-control/listings/${me.id}`),onEdit:()=>e(`/mission-control/listings/${me.id}/edit`),onDelete:()=>W(me.id)},me.id))})}),r.jsx(Sn,{value:"saved",className:"space-y-4",children:k?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((me,ue)=>r.jsxs(He,{children:[r.jsx(Er,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Er,{className:"h-5 w-3/4"}),r.jsx(Er,{className:"h-4 w-1/2"})]})]},ue))}):(N==null?void 0:N.length)===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(vi,{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(me=>r.jsx(VO,{listing:me.listing,onClick:()=>e(`/mission-control/listings/${me.listing.id}`)},me.id))})}),r.jsx(Sn,{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(Nc,{className:"h-4 w-4"}),"Referrals Sent (",((ae=T==null?void 0:T.sent)==null?void 0:ae.length)||0,")"]}),((oe=T==null?void 0:T.sent)==null?void 0:oe.length)===0?r.jsx(He,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(pe=T==null?void 0:T.sent)==null?void 0:pe.map(me=>{var ue,xe;return r.jsx(He,{children:r.jsx(et,{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:me.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((ue=me.listing)==null?void 0:ue.property_address)||((xe=me.listing)==null?void 0:xe.city)})]}),r.jsx(At,{variant:me.status==="closed"?"default":"secondary",children:me.status.replace("_"," ")})]})})},me.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx($n,{className:"h-4 w-4"}),"Referrals Received (",((ne=T==null?void 0:T.received)==null?void 0:ne.length)||0,")"]}),((fe=T==null?void 0:T.received)==null?void 0:fe.length)===0?r.jsx(He,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(se=T==null?void 0:T.received)==null?void 0:se.map(me=>{var ue;return r.jsx(He,{children:r.jsxs(et,{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:me.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(ue=me.sender)==null?void 0:ue.name]})]}),r.jsx(At,{variant:me.status==="closed"?"default":"secondary",children:me.status.replace("_"," ")})]}),r.jsx(Q,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>e(`/mission-control/listings/${me.listing_id}`),children:"View Listing"})]})},me.id)})})]})]})}),t&&r.jsx(Sn,{value:"brokerage",className:"space-y-4",children:D?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((me,ue)=>r.jsxs(He,{children:[r.jsx(Er,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Er,{className:"h-5 w-3/4"}),r.jsx(Er,{className:"h-4 w-1/2"})]})]},ue))}):(F==null?void 0:F.length)===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Tj,{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(Q,{onClick:()=>e("/mission-control/listings/new"),children:[r.jsx(_n,{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:F==null?void 0:F.map(me=>r.jsx(VO,{listing:me,onClick:()=>e(`/mission-control/listings/${me.id}`)},me.id))})}),r.jsx(Sn,{value:"map",children:r.jsx(qXt,{listings:v||[],isLoading:b})}),r.jsx(Sn,{value:"leaderboard",children:r.jsx($Xt,{leaderboard:U})})]})]})}):r.jsx(Fr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(ya,{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 ove(){const e=Yc();return Zt({queryKey:["deal-pipeline-stages",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.from("deal_pipeline_stages").select("*").eq("owner_user_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function jVe(){const e=Yc(),t=Vr();return ar({mutationFn:async()=>{if(!e)throw new Error("Not authenticated");const{error:n}=await Y.rpc("initialize_deal_pipeline_stages",{p_user_id:e});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function kVe(){const e=Yc();return Zt({queryKey:["deal-pipeline-deals",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status, created_at) `).eq("owner_user_id",e).order("updated_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function NVe(){const e=Yc(),t=Vr();return ar({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s,error:a}=await Y.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,listing_date:n.listing_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:e}).select().single();if(a)throw a;return await Y.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 SVe(){const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("deal_pipeline").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function HXt(){const e=Vr();return ar({mutationFn:async({dealId:t,stageId:n,stageName:s})=>{const{data:a,error:o}=await Y.from("deal_pipeline").update({stage_id:n}).eq("id",t).select().single();if(o)throw o;return await Y.from("deal_activities").insert({deal_id:t,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),a},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-activities"]})}})}function WXt(){const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.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 GXt(e){return Zt({queryKey:["deal-activities",e],queryFn:async()=>{const{data:t,error:n}=await Y.from("deal_activities").select("*").eq("deal_id",e).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function KXt(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.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 ZXt(e){return Zt({queryKey:["deal-checklist",e],queryFn:async()=>{const{data:t,error:n}=await Y.from("deal_checklist_items").select("*").eq("deal_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function YXt(){const e=Vr();return ar({mutationFn:async({id:t,is_completed:n,deal_id:s})=>{const{data:a,error:o}=await Y.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 a},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function XXt(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.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 QXt(){const e=Yc();return Zt({queryKey:["deal-pipeline-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Y.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",e);if(n)throw n;const s=(t==null?void 0:t.filter(o=>{var l,i;return!((l=o.deal_pipeline_stages)!=null&&l.is_won_stage)&&!((i=o.deal_pipeline_stages)!=null&&i.is_lost_stage)}))||[],a=(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:a.length,pipelineValue:s.reduce((o,l)=>o+(l.expected_price||0),0),expectedCommission:s.reduce((o,l)=>o+(l.expected_commission||0),0),wonValue:a.reduce((o,l)=>o+(l.expected_price||0),0)}},enabled:!!e})}function JXt(e){const t=Yc();return Zt({queryKey:["deal-by-listing",e,t],queryFn:async()=>{if(!t||!e)return null;const{data:n,error:s}=await Y.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",t).eq("listing_id",e).maybeSingle();if(s)throw s;return n},enabled:!!t&&!!e})}function eQt(){const e=Vr();return ar({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:a}=await Y.from("deal_pipeline").update({listing_id:n}).eq("id",t).select().single();if(a)throw a;return await Y.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 tQt(){const e=Vr();return ar({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:a}=await Y.from("deal_pipeline").update({listing_id:null}).eq("id",t).select().single();if(a)throw a;return{data:s,listingId:n}},onSuccess:t=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",t.listingId]})}})}function rQt({listing:e}){const t=Vn(),[n,s]=A.useState(""),[a,o]=A.useState(!1),{data:l,isLoading:i}=JXt(e.id),{data:u,isLoading:m}=ove(),{data:x,isLoading:y}=kVe(),v=jVe(),b=eQt(),N=tQt(),k=NVe(),M=(x==null?void 0:x.filter(D=>!D.listing_id))||[],I=D=>{if(!(u!=null&&u.length))return null;switch(D){case"coming_soon":case"active":case"price_improvement":return u.find(U=>U.name==="Active");case"under_contract":return u.find(U=>U.name==="Under Contract");case"sold":return u.find(U=>U.is_won_stage);default:return u.find(U=>U.name==="Active")}},T=async()=>{o(!0);try{u!=null&&u.length||await v.mutateAsync();const D=I(e.status);await k.mutateAsync({deal_name:e.property_address?`${e.property_address}, ${e.city}`:`${e.city}, ${e.state}`,deal_type:"seller",stage_id:(D==null?void 0:D.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}),Ae.success("Deal created and linked to listing!")}catch(D){console.error("Failed to create deal:",D),Ae.error("Failed to create deal")}finally{o(!1)}},P=async()=>{if(!n){Ae.error("Please select a deal");return}try{await b.mutateAsync({dealId:n,listingId:e.id}),Ae.success("Listing linked to deal!"),s("")}catch{Ae.error("Failed to link listing")}},F=async()=>{if(l)try{await N.mutateAsync({dealId:l.id,listingId:e.id}),Ae.success("Listing unlinked from deal")}catch{Ae.error("Failed to unlink listing")}};return i||m?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2 text-base",children:[r.jsx(hy,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Gr,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(He,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Gt,{className:"flex items-center gap-2 text-base",children:[r.jsx(gm,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(et,{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(At,{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(Q,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>t("/mission-control/pipeline"),children:["View Pipeline",r.jsx(No,{className:"h-3 w-3 ml-1"})]}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:F,disabled:N.isPending,children:N.isPending?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(TA,{className:"h-4 w-4"})})]})]})]}):r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-2",children:r.jsxs(Gt,{className:"flex items-center gap-2 text-base",children:[r.jsx(hy,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(et,{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(Q,{onClick:T,disabled:a||k.isPending,className:"w-full",size:"sm",children:[a||k.isPending?r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),M.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(un,{value:n,onValueChange:s,children:[r.jsx(ln,{className:"flex-1 text-sm",children:r.jsx(mn,{placeholder:"Link to existing deal..."})}),r.jsx(cn,{children:M.map(D=>r.jsx($t,{value:D.id,children:D.deal_name},D.id))})]}),r.jsx(Q,{variant:"secondary",size:"icon",onClick:P,disabled:!n||b.isPending,children:b.isPending?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(gm,{className:"h-4 w-4"})})]})]})]})]})}const nQt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},sQt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},wTe={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function aQt(){var pe,ne,fe,se,me,ue,xe,Te,_e;const{listingId:e}=Ec(),t=Vn(),{user:n}=tn(),{data:s,isLoading:a}=IRe(e||""),{data:o}=ORe(e||""),{data:l}=Kgt(e||""),i=LRe(),u=Ggt(),m=Zgt(),x=PRe(),y=Xgt(),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,I]=A.useState(!1),[T,P]=A.useState(null),[F,D]=A.useState({buyerName:"",buyerType:"",notes:""}),U=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),V=we=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(we),W=async we=>{const ve=`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)}`;m.mutate({listingId:s.id,shareType:we});try{switch(we){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(ve)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(ve),Ae.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${Xe} ${ve}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(Xe)}&body=${encodeURIComponent(`Check out this listing: ${ve}`)}`);break}}catch(Me){console.error("Share error:",Me),Ae.error("Failed to share")}},G=async()=>{try{await x.mutateAsync(s.id),Ae.success("Listing deleted"),t("/mission-control/listings")}catch{Ae.error("Failed to delete listing")}},ee=async()=>{if(!F.buyerName.trim()){Ae.error("Please enter buyer name");return}try{await y.mutateAsync({listingId:s.id,listingAgentId:s.agent_id,buyerName:F.buyerName,buyerType:F.buyerType||void 0,notes:F.notes||void 0}),Ae.success("Referral sent successfully!"),k(!1),D({buyerName:"",buyerType:"",notes:""})}catch{Ae.error("Failed to send referral")}},ae=we=>{var Ve,ot;const ve=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,Xe=V((s==null?void 0:s.price)||0),Me=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Ie=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",$e=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Be=[Me,Ie,$e].filter(Boolean).join(" | ");switch(we){case"just_listed":return`🏡 JUST LISTED! ${ve} ${Xe} ${Be} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Ve=s==null?void 0:s.city)==null?void 0:Ve.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${ve} Now ${Xe}! ${Be} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${wTe[(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! ${Be} DM me for details! 📩 #ComingSoon #RealEstate #${(ot=s==null?void 0:s.city)==null?void 0:ot.replace(/\s/g,"")}`;default:return""}};if(a)return r.jsx(Fr,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{className:"h-10 w-32"}),r.jsx(Er,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Er,{className:"h-48"}),r.jsx(Er,{className:"h-48"}),r.jsx(Er,{className:"h-48"})]})]})});if(!s)return r.jsx(Fr,{title:"Listing Not Found",description:"",children:r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(Q,{onClick:()=>t("/mission-control/listings"),children:"Back to Listings"})]})})});const oe=((pe=s.photos)==null?void 0:pe.find(we=>we.is_primary))||((ne=s.photos)==null?void 0:ne[0]);return r.jsxs(Fr,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Q,{variant:"ghost",onClick:()=>t("/mission-control/listings"),children:[r.jsx(Wi,{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:()=>oe&&P(oe.photo_url),children:oe?r.jsx("img",{src:oe.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:(fe=s.photos)==null?void 0:fe.slice(1,5).map((we,ve)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>P(we.photo_url),children:r.jsx("img",{src:we.photo_url,alt:`Photo ${ve+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(He,{children:r.jsxs(et,{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(At,{className:`${nQt[s.status]} text-white border-0`,children:sQt[s.status]}),s.is_featured&&r.jsxs(At,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(ks,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(At,{variant:"outline",children:[r.jsx($n,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:V(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(Do,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{variant:"outline",size:"icon",onClick:()=>i.mutate(s.id),children:r.jsx(vi,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(Q,{variant:"outline",size:"icon",onClick:()=>u.mutate(s.id),children:l?r.jsx(Mj,{className:"h-4 w-4"}):r.jsx(Dg,{className:"h-4 w-4"})}),!U&&r.jsxs(Q,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>I(!0),children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{variant:"outline",children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(Nu,{children:[r.jsxs(Va,{onClick:()=>W("copy"),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(Va,{onClick:()=>W("facebook"),children:[r.jsx(au,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(Va,{onClick:()=>W("text"),children:[r.jsx(Ro,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(Va,{onClick:()=>W("email"),children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),U&&r.jsxs(r.Fragment,{children:[r.jsxs(Q,{variant:"outline",onClick:()=>t(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(Q,{variant:"destructive",size:"icon",onClick:()=>b(!0),children:r.jsx(Bn,{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($1,{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(B1,{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(Ug,{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(Cs,{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(At,{variant:"secondary",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),wTe[s.property_type]]}),s.lot_size&&r.jsxs(At,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(At,{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(Q,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ss,{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(_o,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Nc,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(vi,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Share Content"})}),r.jsx(et,{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(Q,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ae(we)),Ae.success("Caption copied!")},children:r.jsx(Po,{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(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(et,{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:((me=(se=s.agent)==null?void 0:se.name)==null?void 0:me.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((ue=s.agent)==null?void 0:ue.name)||"Unknown"}),((Te=(xe=s.agent)==null?void 0:xe.brokerage)==null?void 0:Te.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!U&&r.jsx("div",{className:"space-y-2",children:((_e=s.agent)==null?void 0:_e.email)&&r.jsx(Q,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),U&&r.jsx(rQt,{listing:s}),!U&&s.open_to_referrals&&r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(et,{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(Q,{className:"w-full",onClick:()=>k(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Rr,{open:!!T,onOpenChange:()=>P(null),children:r.jsx(Dr,{className:"max-w-4xl",children:r.jsx("img",{src:T||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Rr,{open:v,onOpenChange:b,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Delete Listing"}),r.jsx(Yn,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsx(Q,{variant:"destructive",onClick:G,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Rr,{open:N,onOpenChange:k,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Send Buyer Referral"}),r.jsx(Yn,{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(ze,{children:"Buyer Name *"}),r.jsx(lt,{value:F.buyerName,onChange:we=>D({...F,buyerName:we.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Buyer Type"}),r.jsxs(un,{value:F.buyerType,onValueChange:we=>D({...F,buyerType:we}),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select type"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"first_time",children:"First-Time Buyer"}),r.jsx($t,{value:"investor",children:"Investor"}),r.jsx($t,{value:"relocating",children:"Relocating"}),r.jsx($t,{value:"upgrade",children:"Upgrading"}),r.jsx($t,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Notes"}),r.jsx(Zn,{value:F.notes,onChange:we=>D({...F,notes:we.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsx(Q,{onClick:ee,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(wVe,{open:M,onOpenChange:I,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 iQt({selectedVideoId:e,onVideoSelect:t,listingId:n}){const s=Vn(),{user:a}=tn(),[o,l]=A.useState(!1),[i,u]=A.useState([]),[m,x]=A.useState(!1),[y,v]=A.useState(null),[b,N]=A.useState({});A.useEffect(()=>{e&&a?k():v(null)},[e,a]);const k=async()=>{if(!e)return;const{data:G,error:ee}=await Y.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();!ee&&G&&(v(G),M(G))},M=async G=>{try{const{data:ee,error:ae}=await Y.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:G.bunny_video_id,isAgentVideo:!0}});!ae&&(ee!=null&&ee.thumbnailUrl)&&N(oe=>({...oe,[G.id]:{thumbnailUrl:ee.thumbnailUrl}}))}catch(ee){console.warn("Failed to get signed URL",ee)}},I=async()=>{if(a){x(!0);try{const{data:G,error:ee}=await Y.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",a.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(ee)throw ee;u(G||[]),G!=null&&G.length&&T(G)}catch(G){console.error("Error fetching videos:",G),Ae.error("Failed to load videos")}finally{x(!1)}}},T=async G=>{var ee;try{const ae=G.map(se=>se.bunny_video_id),{data:oe,error:pe}=await Y.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:ae,isAgentVideo:!0}});if(pe)throw pe;const ne=(oe==null?void 0:oe.assets)||{},fe={};for(const se of G)(ee=ne[se.bunny_video_id])!=null&&ee.thumbnailUrl&&(fe[se.id]={thumbnailUrl:ne[se.bunny_video_id].thumbnailUrl});N(se=>({...se,...fe}))}catch(ae){console.warn("Failed to bulk-fetch signed URLs",ae)}},P=()=>{l(!0),I()},F=G=>{t(G.id),v(G),l(!1),Ae.success("Video selected")},D=()=>{t(null),v(null)},U=()=>{const G=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(G)}`)},V=G=>{if(!G)return"0:00";const ee=Math.floor(G/60),ae=G%60;return`${ee}:${ae.toString().padStart(2,"0")}`},W=G=>{var ee;return((ee=b[G.id])==null?void 0:ee.thumbnailUrl)||G.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?r.jsx(He,{className:"overflow-hidden",children:r.jsx(et,{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:[W(y)?r.jsx("img",{src:W(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(Ia,{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(Vl,{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:V(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(Q,{type:"button",variant:"outline",size:"sm",onClick:P,children:"Change"}),r.jsx(Q,{type:"button",variant:"ghost",size:"sm",onClick:D,className:"text-destructive hover:text-destructive",children:r.jsx(ds,{className:"h-4 w-4"})})]})]})})}):r.jsx(He,{className:"border-dashed",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ia,{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(Q,{type:"button",variant:"outline",onClick:P,className:"gap-2",children:[r.jsx(C4,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(Q,{type:"button",variant:"outline",onClick:U,className:"gap-2",children:[r.jsx(Rg,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Rr,{open:o,onOpenChange:l,children:r.jsxs(Dr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx($r,{children:r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(C4,{className:"h-5 w-5"}),"Select a Video"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:m?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ia,{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(Q,{onClick:U,className:"gap-2",children:[r.jsx(Rg,{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:i.map(G=>r.jsxs("button",{type:"button",onClick:()=>F(G),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${e===G.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:[W(G)?r.jsx("img",{src:W(G),alt:G.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(Ia,{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(Vl,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),G.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:V(G.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:G.title||"Untitled Video"})})]},G.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(Q,{type:"button",variant:"ghost",onClick:U,className:"gap-2",children:[r.jsx(Rg,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(Q,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const oQt=[{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"}],lQt=[{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 jTe(){var fe;const{listingId:e}=Ec(),[t]=Zc(),n=t.get("brokerage"),s=Vn(),{user:a}=tn(),o=!!e&&e!=="new",l=!!n&&!o,{data:i,isLoading:u}=IRe(o?e:""),m=$gt(),x=Ugt(),y=qgt(),v=Vgt(),b=Hgt(),{data:N=[]}=Zt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:se,error:me}=await Y.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(me)throw me;return se||[]},enabled:l}),[k,M]=A.useState(""),[I,T]=A.useState(!1),[P,F]=A.useState([]),[D,U]=A.useState([]),[V,W]=A.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});A.useEffect(()=>{var se,me,ue,xe,Te;i&&o&&W({property_address:i.property_address||"",city:i.city||"",state:i.state||"",neighborhood:i.neighborhood||"",price:((se=i.price)==null?void 0:se.toString())||"",property_type:i.property_type,status:i.status,bedrooms:((me=i.bedrooms)==null?void 0:me.toString())||"",bathrooms:((ue=i.bathrooms)==null?void 0:ue.toString())||"",square_footage:((xe=i.square_footage)==null?void 0:xe.toString())||"",lot_size:i.lot_size||"",year_built:((Te=i.year_built)==null?void 0:Te.toString())||"",has_hoa:i.has_hoa,description:i.description||"",agent_notes:i.agent_notes||"",agent_notes_public:i.agent_notes_public,mls_link:i.mls_link||"",video_link:i.video_link||"",video_id:i.video_id||null,allow_sharing:i.allow_sharing,open_to_referrals:i.open_to_referrals,open_to_social_promotion:i.open_to_social_promotion,share_with_brokerage:i.share_with_brokerage??!1,is_public:i.is_public})},[i,o]);const G=se=>{if(!se)return;const me=Array.from(se);F(xe=>[...xe,...me]);const ue=me.map(xe=>URL.createObjectURL(xe));U(xe=>[...xe,...ue])},ee=se=>{URL.revokeObjectURL(D[se]),F(me=>me.filter((ue,xe)=>xe!==se)),U(me=>me.filter((ue,xe)=>xe!==se))},ae=async se=>{var me;if(!(!se||!i)){T(!0);try{for(const ue of Array.from(se)){const xe=ue.name.split(".").pop(),Te=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${xe}`,{error:_e}=await Y.storage.from("listing-photos").upload(Te,ue);if(_e)throw _e;const{data:{publicUrl:we}}=Y.storage.from("listing-photos").getPublicUrl(Te);await v.mutateAsync({listingId:i.id,photoUrl:we,isPrimary:!((me=i.photos)!=null&&me.length)})}Ae.success("Photos uploaded!")}catch(ue){console.error("Upload error:",ue),Ae.error("Failed to upload photos")}finally{T(!1)}}},oe=async se=>{for(let me=0;me{if(i)try{await b.mutateAsync({photoId:se,listingId:i.id}),Ae.success("Photo removed")}catch{Ae.error("Failed to remove photo")}},ne=async se=>{if(se.preventDefault(),!V.city.trim()||!V.state.trim()||!V.price){Ae.error("Please fill in required fields (City, State, Price)");return}if(l&&!k){Ae.error("Please select an agent to assign this listing to");return}try{const me={property_address:V.property_address||null,city:V.city,state:V.state,neighborhood:V.neighborhood||null,price:Number(V.price),property_type:V.property_type,status:V.status,bedrooms:V.bedrooms?Number(V.bedrooms):null,bathrooms:V.bathrooms?Number(V.bathrooms):null,square_footage:V.square_footage?Number(V.square_footage):null,lot_size:V.lot_size||null,year_built:V.year_built?Number(V.year_built):null,has_hoa:V.has_hoa,description:V.description||null,agent_notes:V.agent_notes||null,agent_notes_public:V.agent_notes_public,mls_link:V.mls_link||null,video_link:V.video_link||null,video_id:V.video_id||null,allow_sharing:V.allow_sharing,open_to_referrals:V.open_to_referrals,open_to_social_promotion:V.open_to_social_promotion,share_with_brokerage:V.share_with_brokerage,is_public:V.is_public};if(o)await y.mutateAsync({id:e,...me}),Ae.success("Listing updated!"),s(`/mission-control/listings/${e}`);else{T(!0);let ue;if(l&&k?ue=await x.mutateAsync({agentId:k,...me}):ue=await m.mutateAsync(me),P.length>0)try{await oe(ue.id),D.forEach(xe=>URL.revokeObjectURL(xe)),F([]),U([])}catch(xe){console.error("Photo upload error:",xe),Ae.error("Listing created but some photos failed to upload")}T(!1),Ae.success("Listing created!"),s(l?"/my-brokerage":`/mission-control/listings/${ue.id}`)}}catch(me){console.error("Save error:",me),Ae.error("Failed to save listing"),T(!1)}};return o&&u?r.jsx(Fr,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{className:"h-10 w-32"}),r.jsx(Er,{className:"h-[600px] w-full"})]})}):r.jsx(Fr,{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(Q,{type:"button",variant:"ghost",onClick:()=>s(l?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(Wi,{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(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Assign to Agent *"})}),r.jsxs(et,{children:[r.jsxs(un,{value:k,onValueChange:M,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select an agent..."})}),r.jsx(cn,{children:N.map(se=>r.jsx($t,{value:se.id,children:se.name||se.email},se.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(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Property Details"})}),r.jsx(et,{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(ze,{children:"Property Address"}),r.jsx(lt,{value:V.property_address,onChange:se=>W({...V,property_address:se.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"City *"}),r.jsx(lt,{value:V.city,onChange:se=>W({...V,city:se.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"State *"}),r.jsx(lt,{value:V.state,onChange:se=>W({...V,state:se.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Neighborhood"}),r.jsx(lt,{value:V.neighborhood,onChange:se=>W({...V,neighborhood:se.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Price *"}),r.jsx(lt,{type:"number",value:V.price,onChange:se=>W({...V,price:se.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Property Type"}),r.jsxs(un,{value:V.property_type,onValueChange:se=>W({...V,property_type:se}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:lQt.map(se=>r.jsx($t,{value:se.value,children:se.label},se.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Status"}),r.jsxs(un,{value:V.status,onValueChange:se=>W({...V,status:se}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:oQt.map(se=>r.jsx($t,{value:se.value,children:se.label},se.value))})]})]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Property Specs (Optional)"})}),r.jsx(et,{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(ze,{children:"Bedrooms"}),r.jsx(lt,{type:"number",value:V.bedrooms,onChange:se=>W({...V,bedrooms:se.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Bathrooms"}),r.jsx(lt,{type:"number",step:"0.5",value:V.bathrooms,onChange:se=>W({...V,bathrooms:se.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Sq Ft"}),r.jsx(lt,{type:"number",value:V.square_footage,onChange:se=>W({...V,square_footage:se.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Lot Size"}),r.jsx(lt,{value:V.lot_size,onChange:se=>W({...V,lot_size:se.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Year Built"}),r.jsx(lt,{type:"number",value:V.year_built,onChange:se=>W({...V,year_built:se.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(As,{checked:V.has_hoa,onCheckedChange:se=>W({...V,has_hoa:se})}),r.jsx(ze,{children:"Has HOA"})]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Description & Links"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Description"}),r.jsx(Zn,{value:V.description,onChange:se=>W({...V,description:se.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Agent Notes"}),r.jsx(Zn,{value:V.agent_notes,onChange:se=>W({...V,agent_notes:se.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{checked:V.agent_notes_public,onCheckedChange:se=>W({...V,agent_notes_public:se})}),r.jsx(ze,{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(ze,{children:"MLS Link"}),r.jsx(lt,{value:V.mls_link,onChange:se=>W({...V,mls_link:se.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Video Link"}),r.jsx(lt,{value:V.video_link,onChange:se=>W({...V,video_link:se.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ia,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(et,{children:r.jsx(iQt,{selectedVideoId:V.video_id,onVideoSelect:se=>W({...V,video_id:se}),listingId:o?e:void 0})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Photos"})}),r.jsxs(et,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((fe=i==null?void 0:i.photos)==null?void 0:fe.map(se=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:se.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>pe(se.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(ds,{className:"h-3 w-3"})}),se.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"})]},se.id))),!o&&D.map((se,me)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:se,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>ee(me),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(ds,{className:"h-3 w-3"})}),me===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"})]},me)),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:[I?r.jsx(Gr,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(bo,{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:se=>o?ae(se.target.files):G(se.target.files),disabled:I})]})]}),!o&&P.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[P.length," photo",P.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Sharing & Collaboration"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(As,{checked:V.allow_sharing,onCheckedChange:se=>W({...V,allow_sharing:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(As,{checked:V.open_to_referrals,onCheckedChange:se=>W({...V,open_to_referrals:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(As,{checked:V.open_to_social_promotion,onCheckedChange:se=>W({...V,open_to_social_promotion:se})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(As,{checked:V.share_with_brokerage,onCheckedChange:se=>W({...V,share_with_brokerage:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(As,{checked:V.is_public,onCheckedChange:se=>W({...V,is_public:se})})]})]})]}),r.jsx(Q,{type:"submit",className:"w-full",size:"lg",disabled:m.isPending||y.isPending,children:m.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function CVe({maxDurationSeconds:e=30,onRecordingComplete:t,onError:n,onRecordingStateChange:s,className:a,teleprompterContent:o}){const l=A.useRef(null),i=A.useRef(null),u=A.useRef(null),m=A.useRef([]),x=A.useRef(null),y=A.useRef(null),v=A.useRef(null),b=A.useRef(null),N=B3(),[k,M]=A.useState(!0),[I,T]=A.useState(!0),[P,F]=A.useState(null),[D,U]=A.useState(!1),[V,W]=A.useState(!1),[G,ee]=A.useState(null),[ae,oe]=A.useState(null),[pe,ne]=A.useState(0),[fe,se]=A.useState("user"),[me,ue]=A.useState(0),[xe,Te]=A.useState(!1),[_e,we]=A.useState(!0),[ve,Xe]=A.useState(null),[Me,Ie]=A.useState(!1),[$e,Be]=A.useState(null),Ve=A.useRef(null),ot=A.useRef(n);ot.current=n;const Tt=A.useCallback(ct=>{M(ct)},[]),Oe=A.useRef(k),at=A.useCallback(async()=>{var it,zt;T(!0),Xe(null);const ct=N&&k;console.log("[VideoRecorder] initCamera start",{isMobile:N,usePortraitMode:k,shouldBePortrait:ct,facingMode:fe});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");u.current&&(console.log("[VideoRecorder] stopping existing stream"),u.current.getTracks().forEach(Zr=>Zr.stop()));const Lt=N&&ct?{facingMode:{ideal:fe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:fe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",Lt);const lr=await navigator.mediaDevices.getUserMedia({video:Lt,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),lr.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");u.current=lr,F(!0);const Mr=lr.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",Mr.width,"x",Mr.height),l.current){const Zr=l.current;Zr.srcObject=lr,Zr.muted=!0,Zr.playsInline=!0,Zr.autoplay=!0,Zr.setAttribute("muted",""),Zr.setAttribute("playsinline",""),Zr.setAttribute("autoplay","");try{(it=Zr.load)==null||it.call(Zr)}catch(dr){console.warn("[VideoRecorder] videoEl.load failed",dr)}const Xn=async()=>{try{return await Zr.play(),console.log("[VideoRecorder] preview play ok"),Ie(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:Zr.readyState,videoWidth:Zr.videoWidth,videoHeight:Zr.videoHeight})},300),!0}catch(dr){return console.warn("[VideoRecorder] preview play blocked",dr),Ie(!0),!1}};await new Promise(dr=>{let En=!1;const Es=()=>{En||(En=!0,dr())},Hs=()=>{Xn().finally(Es)};Zr.onloadedmetadata=Hs,Zr.onloadeddata=Hs,setTimeout(Es,1500)})}try{y.current=new AudioContext;const Zr=y.current.createMediaStreamSource(lr);v.current=y.current.createAnalyser(),v.current.fftSize=256,Zr.connect(v.current);const Xn=()=>{if(v.current){const dr=new Uint8Array(v.current.frequencyBinCount);v.current.getByteFrequencyData(dr);const En=dr.reduce((Es,Hs)=>Es+Hs)/dr.length;ue(Math.min(100,En/128*100))}b.current=requestAnimationFrame(Xn)};Xn()}catch(Zr){console.warn("Audio context not available:",Zr)}}catch(Lt){console.error("Camera initialization error:",Lt),F(!1);let lr="Failed to access camera or microphone.";Lt.name==="NotAllowedError"?lr="Camera permission denied. Please allow camera access in your browser settings.":Lt.name==="NotFoundError"?lr="No camera found. Please connect a camera and try again.":Lt.name==="NotReadableError"?lr="Camera is in use by another application. Please close other apps using the camera.":Lt.message&&(lr=Lt.message),Xe(lr),(zt=ot.current)==null||zt.call(ot,lr)}finally{T(!1)}},[fe,N,k]);A.useEffect(()=>{Oe.current!==k&&P&&!D&&!ae&&(Oe.current=k,at())},[k,P,D,ae,at]),A.useEffect(()=>(at(),()=>{u.current&&u.current.getTracks().forEach(ct=>ct.stop()),x.current&&clearInterval(x.current),b.current&&cancelAnimationFrame(b.current),y.current&&y.current.close(),Ve.current&&clearInterval(Ve.current),ae&&URL.revokeObjectURL(ae)}),[at,ae]),A.useEffect(()=>{if(I||P!==!0||ae)return;const ct=u.current,it=l.current;!ct||!it||(it.srcObject!==ct&&(it.srcObject=ct,it.muted=!0,it.playsInline=!0,it.autoplay=!0,it.setAttribute("muted",""),it.setAttribute("playsinline",""),it.setAttribute("autoplay","")),it.play().then(()=>Ie(!1)).catch(zt=>{Ie(!0),console.warn("Live preview play blocked on mount:",zt)}))},[P,I,ae]),A.useEffect(()=>{s==null||s(D)},[D,s]);const le=A.useCallback(async()=>{if(ae)return;const ct=l.current;if(ct)try{await ct.play(),Ie(!1)}catch(it){Ie(!0),console.warn("Live preview still blocked (needs user gesture):",it)}},[ae]),qe=A.useCallback(()=>{i.current&&i.current.state!=="inactive"&&i.current.stop(),x.current&&(clearInterval(x.current),x.current=null),U(!1),W(!1)},[]),Je=A.useCallback(()=>{if(!u.current)return;le(),m.current=[],ne(0);const it=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(Lt=>MediaRecorder.isTypeSupported(Lt)),zt=new MediaRecorder(u.current,it?{mimeType:it,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});zt.ondataavailable=Lt=>{Lt.data.size>0&&m.current.push(Lt.data)},zt.onstop=()=>{var Mr;const Lt=zt.mimeType||it||((Mr=m.current[0])==null?void 0:Mr.type)||"video/webm",lr=new Blob(m.current,{type:Lt});ee(lr);const Ar=URL.createObjectURL(lr);oe(Ar)},i.current=zt,zt.start(100),U(!0),x.current=setInterval(()=>{ne(Lt=>Lt>=e-1?(qe(),e):Lt+1)},1e3)},[le,e,qe]),st=A.useCallback(()=>{if($e!==null)return;Be(3);let ct=3;Ve.current=setInterval(()=>{ct-=1,ct<=0?(Ve.current&&clearInterval(Ve.current),Ve.current=null,Be(null),Je()):Be(ct)},1e3)},[$e,Je]),je=A.useCallback(()=>{i.current&&i.current.state==="recording"&&(i.current.pause(),W(!0),x.current&&clearInterval(x.current))},[]),ut=A.useCallback(()=>{i.current&&i.current.state==="paused"&&(i.current.resume(),W(!1),x.current=setInterval(()=>{ne(ct=>ct>=e-1?(qe(),e):ct+1)},1e3))},[e,qe]),Ce=A.useCallback(()=>{ae&&URL.revokeObjectURL(ae),ee(null),oe(null),ne(0),Te(!1),we(!0),l.current&&u.current&&(l.current.srcObject=u.current,l.current.muted=!0,le())},[le,ae]),Ee=A.useCallback(()=>{se(ct=>ct==="user"?"environment":"user")},[]),Ze=A.useCallback(()=>{G&&t(G,pe)},[G,pe,t]),Le=A.useCallback(()=>{l.current&&ae&&(xe?l.current.pause():(we(!1),l.current.muted=!1,l.current.play()),Te(!xe))},[ae,xe]);A.useEffect(()=>{if(!ae)return;const ct=l.current;if(!ct)return;we(!1),ct.pause(),ct.removeAttribute("src"),ct.srcObject=null,ct.load(),ct.src=ae,ct.currentTime=0,ct.playsInline=!0,ct.muted=!1,ct.onended=()=>Te(!1);const it=()=>{var lr;const zt=ct.error,Lt=zt?`Recorded video failed to play (code ${zt.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",zt),(lr=ot.current)==null||lr.call(ot,Lt)};return ct.addEventListener("error",it),ct.load(),()=>{ct.removeEventListener("error",it)}},[ae]);const Ke=ct=>{const it=Math.floor(ct/60),zt=ct%60;return`${it}:${zt.toString().padStart(2,"0")}`},tt=N&&k?"aspect-[9/16]":"aspect-video";return I?r.jsx("div",{className:Ut("flex items-center justify-center bg-black rounded-lg",tt,a),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(Gr,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):P===!1?r.jsx("div",{className:Ut("flex items-center justify-center bg-black rounded-lg",tt,a),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(yl,{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:ve||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(Q,{onClick:()=>at(),variant:"secondary",className:"w-full",children:[r.jsx(Go,{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:Ut("flex flex-col gap-2",a),children:[N&&!D&&!ae&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(Bj,{className:Ut("h-4 w-4",k?"text-muted-foreground":"text-primary")}),r.jsx(ze,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(As,{id:"orientation-toggle",checked:k,onCheckedChange:Tt}),r.jsx(ze,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(gy,{className:Ut("h-4 w-4",k?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:Ut("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{le()},children:[r.jsx("video",{ref:l,src:ae??void 0,className:Ut("w-full bg-black",k&&!ae?"object-contain":"object-cover",tt,fe==="user"&&!ae&&"scale-x-[-1]"),playsInline:!0,controls:!!ae,muted:ae?_e:!0,autoPlay:!ae},ae??"live"),!ae&&Me&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(Q,{type:"button",variant:"secondary",onClick:()=>void le(),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}),$e!==null&&!ae&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-30 pointer-events-none",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"text-white font-bold drop-shadow-lg animate-scale-in",style:{fontSize:"96px",lineHeight:1,textShadow:"0 4px 16px rgba(0,0,0,0.8)"},children:$e},$e),r.jsx("p",{className:"text-white/80 text-lg font-medium drop-shadow-md",children:"Get ready…"})]})}),D&&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:Ut("w-3 h-3 rounded-full",V?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[Ke(pe)," / ",Ke(e)]})]}),D&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Mc,{value:pe/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(fA,{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:`${me}%`}})})]}),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(Q,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:Ce,children:[r.jsx(Go,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(Q,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Le,children:xe?r.jsx(ym,{className:"h-5 w-5"}):r.jsx(Vl,{className:"h-5 w-5"})}),r.jsxs(Q,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:Ze,children:[r.jsx(mi,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(Q,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Ee,disabled:D||$e!==null,children:r.jsx(O4,{className:"h-5 w-5"})}),!D&&$e===null?r.jsx(Q,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:st,children:r.jsx(Ia,{className:"h-6 w-6"})}):r.jsxs(r.Fragment,{children:[r.jsx(Q,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:V?ut:je,children:V?r.jsx(Vl,{className:"h-5 w-5"}):r.jsx(ym,{className:"h-5 w-5"})}),r.jsx(Q,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:qe,children:r.jsx(Ug,{className:"h-6 w-6 fill-current"})})]}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}const MVe="teleprompter_settings",fue={scrollSpeed:30,fontSize:24,lineHeight:1.6,opacity:.85,position:"top",isMirrored:!1};function cQt(){try{const e=localStorage.getItem(MVe);return e?{...fue,...JSON.parse(e)}:fue}catch{return fue}}function dQt(e){try{localStorage.setItem(MVe,JSON.stringify(e))}catch{}}function TVe({text:e,isVisible:t,onToggleVisibility:n,isRecording:s=!1,startCountdown:a=!1,onCountdownComplete:o,className:l}){const i=A.useRef(null),u=A.useRef(null),m=A.useRef(0),x=A.useRef(0),[y,v]=A.useState(cQt),{scrollSpeed:b,fontSize:N,lineHeight:k,opacity:M,position:I,isMirrored:T}=y,P=A.useCallback((oe,pe)=>{v(ne=>{const fe={...ne,[oe]:pe};return dQt(fe),fe})},[]),[F,D]=A.useState(!1),[U,V]=A.useState(null),W=A.useCallback(oe=>{if(!i.current)return;m.current===0&&(m.current=oe);const pe=oe-m.current;m.current=oe,x.current+=b*pe/1e3;const ne=Math.floor(x.current);ne>0&&(i.current.scrollTop+=ne,x.current-=ne);const{scrollTop:fe,scrollHeight:se,clientHeight:me}=i.current;if(fe+me>=se){D(!1);return}u.current=requestAnimationFrame(W)},[b]);A.useEffect(()=>(F?(m.current=0,x.current=0,u.current=requestAnimationFrame(W)):u.current&&cancelAnimationFrame(u.current),()=>{u.current&&cancelAnimationFrame(u.current)}),[F,W]),A.useEffect(()=>{if(s&&t)if(i.current&&(i.current.scrollTop=0),a){V(3);let oe=3;const pe=setInterval(()=>{oe-=1,oe<=0?(clearInterval(pe),V(null),o==null||o(),D(!0)):V(oe)},1e3);return()=>clearInterval(pe)}else setTimeout(()=>D(!0),100);else s||(D(!1),V(null))},[s,t,a,o]);const G=A.useCallback(()=>{i.current&&(i.current.scrollTop=0),D(!1)},[]),ee=A.useCallback(()=>{D(oe=>!oe)},[]);if(!t)return r.jsx("div",{className:Ut("absolute top-4 right-4 pointer-events-auto z-10",l),children:r.jsxs(Q,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const ae={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return r.jsxs("div",{className:Ut("absolute inset-0 pointer-events-none",l),children:[U!==null&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-20 pointer-events-none",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"text-white font-bold drop-shadow-lg animate-scale-in",style:{fontSize:"96px",lineHeight:1,textShadow:"0 4px 16px rgba(0,0,0,0.8)"},children:U},U),r.jsx("p",{className:"text-white/80 text-lg font-medium drop-shadow-md",children:"Get ready…"})]})}),r.jsx("div",{className:Ut("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",ae[I],U!==null&&"opacity-30"),style:{opacity:U!==null?.3:M},children:r.jsxs("div",{ref:i,className:Ut("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",T&&"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("div",{className:"h-full",style:{minHeight:"100%"}}),r.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${N}px`,lineHeight:k,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:e}),r.jsx("div",{className:"h-full"})]})}),r.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsx(Q,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(zd,{className:"h-4 w-4"})})}),r.jsx(Tc,{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.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-xs",children:"Scroll Speed"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:b})]}),r.jsx(Np,{value:[b],onValueChange:([oe])=>P("scrollSpeed",oe),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-xs",children:"Font Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[N,"px"]})]}),r.jsx(Np,{value:[N],onValueChange:([oe])=>P("fontSize",oe),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-xs",children:"Line Spacing"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:k.toFixed(1)})]}),r.jsx(Np,{value:[k*10],onValueChange:([oe])=>P("lineHeight",oe/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-xs",children:"Opacity"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[Math.round(M*100),"%"]})]}),r.jsx(Np,{value:[M*100],onValueChange:([oe])=>P("opacity",oe/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Q,{variant:I==="top"?"default":"outline",size:"sm",onClick:()=>P("position","top"),children:r.jsx(ly,{className:"h-4 w-4"})}),r.jsx(Q,{variant:I==="center"?"default":"outline",size:"sm",onClick:()=>P("position","center"),children:r.jsx(K1,{className:"h-4 w-4"})}),r.jsx(Q,{variant:I==="bottom"?"default":"outline",size:"sm",onClick:()=>P("position","bottom"),children:r.jsx(Rd,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{className:"text-xs",children:"Mirror Mode"}),r.jsx(As,{checked:T,onCheckedChange:oe=>P("isMirrored",oe)})]})]})})]}),r.jsx(Q,{variant:"secondary",size:"icon",onClick:ee,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:F?r.jsx(ym,{className:"h-4 w-4"}):r.jsx(Vl,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"secondary",size:"icon",onClick:G,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(O4,{className:"h-4 w-4"})}),r.jsxs(Q,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Fg,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function uQt({onSelectScript:e,onCreateNew:t,selectedScriptId:n,className:s}){const{toast:a}=fi(),[o,l]=A.useState(""),[i,u]=A.useState(null),[m,x]=A.useState("levelup"),{data:y,isLoading:v}=q3t(),{data:b,isLoading:N}=V3t(),{data:k,isLoading:M}=H3t(),I=W3t(),T=A.useMemo(()=>b?b.filter(V=>{const W=!o||V.title.toLowerCase().includes(o.toLowerCase())||V.script_text.toLowerCase().includes(o.toLowerCase())||V.tags.some(ee=>ee.toLowerCase().includes(o.toLowerCase())),G=!i||V.category_id===i;return W&&G}):[],[b,o,i]),P=A.useMemo(()=>k?k.filter(V=>!o||V.title.toLowerCase().includes(o.toLowerCase())||V.script_text.toLowerCase().includes(o.toLowerCase())):[],[k,o]),F=V=>{e({title:V.title,text:V.script_text})},D=async V=>{try{await I.mutateAsync(V),a({title:"Script saved to My Scripts"})}catch{a({title:"Failed to save script",variant:"destructive"})}},U=v||N||M;return r.jsxs("div",{className:Ut("flex flex-col h-full",s),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search scripts...",value:o,onChange:V=>l(V.target.value),className:"pl-9"})]})}),r.jsxs(wi,{value:m,onValueChange:V=>x(V),className:"flex-1 flex flex-col",children:[r.jsxs(_i,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(sn,{value:"levelup",children:[r.jsx(_a,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(sn,{value:"my-scripts",children:[r.jsx(Mp,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(Sn,{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(At,{variant:i?"outline":"default",className:"cursor-pointer",onClick:()=>u(null),children:"All"}),y==null?void 0:y.map(V=>r.jsx(At,{variant:i===V.id?"default":"outline",className:"cursor-pointer",onClick:()=>u(V.id),children:V.name},V.id))]}),r.jsx(Vo,{className:"flex-1 max-h-[50vh]",children:U?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gr,{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(_a,{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(V=>r.jsxs(He,{className:Ut("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>F(V),children:[r.jsx(Ht,{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(Gt,{className:"text-sm font-medium truncate",children:V.title}),V.category&&r.jsx(At,{variant:"secondary",className:"mt-1 text-xs",children:V.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:W=>{W.stopPropagation(),D(V)},children:r.jsx(Mp,{className:"h-4 w-4"})}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(et,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:V.script_text})})]},V.id))})})]}),r.jsxs(Sn,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[t&&r.jsxs(Q,{variant:"outline",className:"mb-4",onClick:t,children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Vo,{className:"flex-1 max-h-[50vh]",children:M?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):P.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Mp,{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:P.map(V=>r.jsxs(He,{className:Ut("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>F(V),children:[r.jsx(Ht,{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(Gt,{className:"text-sm font-medium truncate",children:V.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:V.is_custom?r.jsx(At,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(At,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Gi,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(et,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:V.script_text})})]},V.id))})})]})]})]})}function hQt({selectedTemplate:e,onSelect:t,contactName:n,saving:s=!1}){const[a,o]=A.useState(()=>{const i=Z4(e);return new Set([i.category])}),l=i=>{o(u=>{const m=new Set(u);return m.has(i)?m.delete(i):m.add(i),m})};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ze,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(Gr,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:sgt.map(i=>{const u=agt(i.id),m=a.has(i.id),x=u.some(y=>y.id===e);return r.jsxs(W4,{open:m,onOpenChange:()=>l(i.id),children:[r.jsxs(G4,{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:i.name}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.length,")"]}),x&&!m&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),r.jsx(Rd,{className:Ut("h-4 w-4 text-muted-foreground transition-transform",m&&"rotate-180")})]}),r.jsx(K4,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:u.map(y=>{const v=e===y.id;return r.jsxs("button",{type:"button",onClick:()=>t(y.id),disabled:s,className:Ut("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",v?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[v&&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(mi,{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)})})})]},i.id)})}),n&&e!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',Z4(e).headerText(n),'"']})]})}function AVe({open:e,onOpenChange:t,video:n,contactName:s,onTemplateUpdated:a}){const[o,l]=A.useState(n.page_template||"default"),[i,u]=A.useState(!1),[m,x]=A.useState(!1),[y,v]=A.useState(n.page_template||"default"),[b,N]=A.useState([]),[k,M]=A.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[I,T]=A.useState(!1),[P,F]=A.useState(!1),D=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";A.useEffect(()=>{e&&b.length===0&&U()},[e]);const U=async()=>{F(!0);try{const{data:fe,error:se}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(se)throw se;const me=(fe||[]).map(ue=>({id:ue.id,name:[ue.first_name,ue.last_name].filter(Boolean).join(" ")||"Unnamed",email:ue.email||null}));N(me)}catch(fe){console.error("Failed to fetch contacts:",fe)}finally{F(!1)}},V=async fe=>{M(fe),T(!1),u(!0);try{const{error:se}=await Y.from("agent_videos").update({contact_id:(fe==null?void 0:fe.id)||null,recipient_name:(fe==null?void 0:fe.name)||null}).eq("id",n.id);if(se)throw se;Ae.success(fe?`Assigned to ${fe.name}`:"Contact removed"),a==null||a()}catch(se){console.error("Failed to update contact:",se),Ae.error("Failed to update contact")}finally{u(!1)}},W=async fe=>{l(fe),u(!0);try{const{error:se}=await Y.from("agent_videos").update({page_template:fe}).eq("id",n.id);if(se)throw se;v(fe),Ae.success("Template saved!"),a==null||a()}catch(se){console.error("Failed to save template:",se),Ae.error("Failed to save template"),l(y)}finally{u(!1)}},G=(k==null?void 0:k.name)||null,ee=()=>{const fe=n.title||"Video Message",se=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},ae=async()=>{if(!n.thumbnail_url){Ae.error("Video thumbnail not available yet");return}const fe=ee(),se=`Watch: ${n.title||"Video Message"} ${D}`;try{const me=new Blob([fe],{type:"text/html"}),ue=new Blob([se],{type:"text/plain"}),xe=new ClipboardItem({"text/html":me,"text/plain":ue});await navigator.clipboard.write([xe]),Ae.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(se+` `+fe),Ae.success("Copied! Paste into your email.")}},oe=async()=>{await navigator.clipboard.writeText(D),x(!0),Ae.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},pe=()=>{const se=Z4(o).headerText(G),me=o==="default"?`Check out this video: ${D}`:`${se} Check out this special video: ${D}`;window.open(`sms:?body=${encodeURIComponent(me)}`,"_self")},ne=()=>{const fe=Z4(o),se=fe.headerText(G),me=o==="default"?n.title||"Video Message":se,ue=`${fe.subText} Watch the video: ${D}`,xe=k!=null&&k.email?encodeURIComponent(k.email):"";window.open(`mailto:${xe}?subject=${encodeURIComponent(me)}&body=${encodeURIComponent(ue)}`,"_self")};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(Yn,{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(ze,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Wc,{open:I,onOpenChange:T,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":I,className:"flex-1 justify-between",disabled:i,children:[k?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),k.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(cy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Tc,{className:"w-[300px] p-0",align:"start",children:r.jsxs(Py,{children:[r.jsx(Ly,{placeholder:"Search contacts..."}),r.jsxs(Oy,{children:[r.jsx(Dy,{children:P?"Loading...":"No contacts found."}),r.jsx(Ry,{children:b.map(fe=>r.jsxs(Fy,{value:fe.name,onSelect:()=>V(fe),children:[r.jsx(mi,{className:Ut("mr-2 h-4 w-4",(k==null?void 0:k.id)===fe.id?"opacity-100":"opacity-0")}),fe.name]},fe.id))})]})]})})]}),k&&r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>V(null),disabled:i,className:"shrink-0",children:r.jsx(ds,{className:"h-4 w-4"})})]}),k&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',Z4(o).headerText(k.name),'"']})]}),r.jsx(hQt,{selectedTemplate:o,onSelect:W,contactName:G,saving:i}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:D,readOnly:!0,className:"font-mono text-sm"}),r.jsx(Q,{onClick:oe,variant:m?"default":"outline",className:"shrink-0 gap-2",children:m?r.jsxs(r.Fragment,{children:[r.jsx(mi,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Po,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Share for Email"}),r.jsxs(Q,{variant:"outline",className:"w-full gap-2",onClick:ae,children:[r.jsx(Fl,{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(ze,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Q,{variant:"outline",className:"flex-1 gap-2",onClick:pe,children:[r.jsx(Ro,{className:"h-4 w-4"}),"Text"]}),r.jsxs(Q,{variant:"outline",className:"flex-1 gap-2",onClick:ne,children:[r.jsx(ws,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(Vs,{children:r.jsx(Q,{variant:"outline",onClick:()=>t(!1),children:"Done"})})]})})}function mQt(){var st;const e=Vn(),[t]=Zc(),{toast:n}=fi(),s=t.get("contact_id"),a=t.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:u}=jBe(),{data:m}=Nf(),x=Q0e(),y=X3t(),[v,b]=A.useState("record"),[N,k]=A.useState(""),[M,I]=A.useState(!1),[T,P]=A.useState(!1),[F,D]=A.useState(!1),[U,V]=A.useState(null),[W,G]=A.useState(0),[ee,ae]=A.useState(0),[oe,pe]=A.useState(null),[ne,fe]=A.useState(null),[se,me]=A.useState(s||""),[ue,xe]=A.useState(""),[Te,_e]=A.useState(""),[we,ve]=A.useState(null),[Xe,Me]=A.useState(null),[Ie,$e]=A.useState(null),[Be,Ve]=A.useState(!1),ot=A.useCallback(async(je,ut)=>{V(je),b("uploading");try{const{videoId:Ce,uploadUrl:Ee}=await kBe(ue||"Quick Video Touch");pe(Ce);const{apiKey:Ze}=await NBe(Ce),Le=new XMLHttpRequest;Le.upload.onprogress=it=>{it.lengthComputable&&G(it.loaded/it.total*100)},await new Promise((it,zt)=>{Le.onload=()=>{Le.status>=200&&Le.status<300?it():zt(new Error(`Upload failed: ${Le.status}`))},Le.onerror=()=>zt(new Error("Upload failed")),Le.open("PUT",Ee),Le.setRequestHeader("AccessKey",Ze),Le.send(je)}),b("processing");let Ke=0;const tt=Date.now(),ct=90*1e3;for(;Ke<4;){if(await new Promise(zt=>setTimeout(zt,3e3)),Date.now()-tt>ct){const zt=je.size/1048576,Lt=`https://iframe.mediadelivery.net/play/${Ce}/${Ce}`;await x.mutateAsync({bunny_video_id:Ce,playback_url:Lt,file_size_mb:zt,title:ue||"Quick Video Touch",notes:Te||void 0,contact_id:se&&se!=="none"?se:void 0,status:"processing",touch_type:"video_touch"}),n({title:"Video saved — still processing",description:'Your video has been saved and will appear in your library with a "processing" badge. It will be ready to share once encoding completes (usually within a few minutes).',duration:8e3}),e("/mission-control/video-library");return}const it=await SBe(Ce);if(Ke=it.status,ae(it.encodeProgress||0),Ke===4)fe({playbackUrl:it.directPlayUrl,thumbnailUrl:it.thumbnailUrl,previewUrl:it.previewUrl||null,duration:it.length||ut,fileSizeMb:(it.storageSize||je.size)/(1024*1024)});else if(Ke===5||Ke===6)throw new Error("Video processing failed")}b("details")}catch(Ce){console.error("Upload error:",Ce),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),b("record")}},[ue,n]),Tt=async()=>{if(!(!oe||!ne))try{const je=se&&se!=="none"?se:null,ut=await x.mutateAsync({bunny_video_id:oe,contact_id:je,playback_url:ne.playbackUrl,thumbnail_url:ne.thumbnailUrl,preview_url:ne.previewUrl,duration_seconds:ne.duration,file_size_mb:ne.fileSizeMb,title:ue||"Quick Video Touch",notes:Te,task_id:a||null,status:"ready"});ve(ut.id),Me(ut.share_token||null),je&&await y.mutateAsync({contactId:je,videoId:ut.id,notes:Te}),n({title:"Video saved successfully!"}),b("share")}catch(je){console.error("Save video error:",je),n({title:"Failed to save video",description:(je==null?void 0:je.message)||"Please try again.",variant:"destructive"})}},Oe=(je,ut)=>{navigator.clipboard.writeText(ut),$e(je),setTimeout(()=>$e(null),2e3),n({title:"Copied to clipboard!"})},at=()=>Xe?`https://video.relevelup.com/${Xe}`:(ne==null?void 0:ne.playbackUrl)||"",le=()=>{const je=m==null?void 0:m.find(Le=>Le.id===se),ut=je?`${je.first_name}`:"",Ce=(je==null?void 0:je.phone)||"",Ee=(je==null?void 0:je.email)||"",Ze=at();return{text:`Hey${ut?` ${ut}`:""}! I recorded a quick video for you: ${Ze}`,link:Ze,contactPhone:Ce,contactEmail:Ee}},qe=()=>{const{text:je,contactPhone:ut}=le(),Ce=ut?`sms:${ut}?body=${encodeURIComponent(je)}`:`sms:?body=${encodeURIComponent(je)}`;window.open(Ce,"_self")},Je=()=>{const{link:je,contactEmail:ut}=le(),Ce="Check out this video",Ee=`I recorded a quick video for you: ${je}`,Ze=ut?`mailto:${ut}?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Ee)}`:`mailto:?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Ee)}`;window.open(Ze,"_self")};return o?r.jsx(Fr,{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(Q,{variant:"ghost",size:"icon",onClick:()=>e(-1),children:r.jsx(Wi,{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"})]})]}),u&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",i.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(0)," MB remaining"]})]})]}),v==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(CVe,{maxDurationSeconds:60,onRecordingComplete:ot,onRecordingStateChange:D,className:"w-full",teleprompterContent:M&&N&&r.jsx(TVe,{text:N,isVisible:M,onToggleVisibility:()=>I(!1),isRecording:F,startCountdown:!0})}),!M&&N&&r.jsxs(Q,{variant:"outline",className:"mt-4",onClick:()=>I(!0),children:[r.jsx(_a,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(He,{className:"lg:col-span-1",children:[r.jsx(Ht,{className:"pb-2",children:r.jsx(Gt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Zn,{placeholder:"Type or paste your script here...",value:N,onChange:je=>k(je.target.value),rows:6}),r.jsxs(Vse,{open:T,onOpenChange:P,children:[r.jsx(tye,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:"w-full",children:[r.jsx(_a,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(lP,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(Hse,{className:"p-4 border-b",children:r.jsx(Wse,{children:"Select a Script"})}),r.jsx(uQt,{onSelectScript:je=>{k(je.text),P(!1),I(!0)},className:"h-[calc(100vh-80px)]"})]})]}),N&&r.jsx(Q,{className:"w-full",onClick:()=>I(!0),children:"Use Script"})]})]})]}),v==="uploading"&&r.jsx(He,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center",children:[r.jsx(bo,{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(Mc,{value:W,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[W.toFixed(0),"%"]})]})}),v==="processing"&&r.jsx(He,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center space-y-4",children:[r.jsx(Gr,{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(Mc,{value:ee,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[ee.toFixed(0),"%"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:`This usually takes 30-60 seconds. If it takes longer, we'll auto-save your video and you can find it in your Video Library — look for the "processing" badge.`})]})}),v==="details"&&r.jsxs(He,{className:"max-w-lg mx-auto",children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Video Details"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Title"}),r.jsx(lt,{value:ue,onChange:je=>xe(je.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Attach to Contact (Optional)"}),r.jsxs(un,{value:se,onValueChange:me,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"No contact - use anywhere"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Oo,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),m==null?void 0:m.map(je=>r.jsx($t,{value:je.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ic,{className:"h-4 w-4"}),je.first_name," ",je.last_name]})},je.id))]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Notes"}),r.jsx(Zn,{value:Te,onChange:je=>_e(je.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(Q,{className:"w-full",onClick:Tt,disabled:x.isPending,children:[x.isPending&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),v==="share"&&r.jsxs(He,{className:"max-w-lg mx-auto",children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(mi,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(et,{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(Q,{variant:"outline",className:"justify-start",onClick:qe,children:[r.jsx(Ro,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(Q,{variant:"outline",className:"justify-start",onClick:Je,children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(Q,{variant:"outline",className:"justify-start",onClick:()=>Oe("link",le().link),children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Ie==="link"&&r.jsx(mi,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(Q,{variant:"outline",className:"justify-start",onClick:()=>Ve(!0),children:[r.jsx(Vc,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(Q,{variant:"outline",onClick:()=>e("/mission-control/video-library"),children:"View Library"}),r.jsx(Q,{onClick:()=>{b("record"),V(null),pe(null),fe(null)},children:"Record Another"})]})]})]}),we&&Xe&&r.jsx(AVe,{open:Be,onOpenChange:Ve,video:{id:we,share_token:Xe,title:ue||null,contact_id:se||null,thumbnail_url:(ne==null?void 0:ne.thumbnailUrl)||null},contactName:((st=m==null?void 0:m.find(je=>je.id===se))==null?void 0:st.first_name)||null})]})}):r.jsx(Fr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(Nh,{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(Q,{onClick:()=>e("/mission-control/video-library"),children:"Open Video Library"})]})})}function fQt({open:e,onOpenChange:t}){const{data:n}=Nf(),{data:s}=J0e(),a=Q0e(),o=A.useRef(null),[l,i]=A.useState(null),[u,m]=A.useState(""),[x,y]=A.useState(""),[v,b]=A.useState(""),[N,k]=A.useState(!1),[M,I]=A.useState(0),[T,P]=A.useState("idle"),F=(s==null?void 0:s.total_storage_mb)||0,U=((s==null?void 0:s.max_storage_mb)||1024)-F,V=ae=>{var ne;const oe=(ne=ae.target.files)==null?void 0:ne[0];if(!oe)return;if(!oe.type.startsWith("video/")){Ae.error("Please select a video file");return}const pe=oe.size/(1024*1024);if(pe>500){Ae.error("Video file must be less than 500MB");return}if(pe>U){Ae.error(`Not enough storage. You have ${U.toFixed(1)} MB remaining.`);return}i(oe),u||m(oe.name.replace(/\.[^/.]+$/,""))},W=async()=>{if(!l){Ae.error("Please select a video file");return}k(!0),I(0),P("creating");try{const{data:ae,error:oe}=await Y.functions.invoke("bunny-upload",{body:{action:"create",title:u||l.name,isAgentVideo:!0}});if(oe)throw new Error(oe.message);const{videoId:pe,libraryId:ne}=ae;P("uploading");const{data:fe,error:se}=await Y.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:pe,isAgentVideo:!0}});if(se)throw new Error(se.message);await new Promise((xe,Te)=>{const _e=new XMLHttpRequest;_e.upload.addEventListener("progress",we=>{if(we.lengthComputable){const ve=Math.round(we.loaded/we.total*100);I(ve)}}),_e.addEventListener("load",()=>{_e.status>=200&&_e.status<300?xe():Te(new Error(`Upload failed with status ${_e.status}`))}),_e.addEventListener("error",()=>Te(new Error("Upload failed"))),_e.open("PUT",fe.uploadUrl),_e.setRequestHeader("AccessKey",fe.apiKey),_e.send(l)}),P("processing");const me=l.size/(1024*1024),ue=`https://iframe.mediadelivery.net/embed/${ne}/${pe}`;await a.mutateAsync({bunny_video_id:pe,playback_url:ue,file_size_mb:me,title:u||l.name,notes:x||void 0,contact_id:v||void 0,status:"processing",touch_type:"video_upload"}),Ae.success("Video uploaded successfully! Processing may take a few minutes."),G()}catch(ae){console.error("Upload error:",ae),Ae.error(ae instanceof Error?ae.message:"Failed to upload video")}finally{k(!1),P("idle")}},G=()=>{N||(i(null),m(""),y(""),b(""),I(0),P("idle"),t(!1))},ee=()=>{switch(T){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${M}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Rr,{open:e,onOpenChange:G,children:r.jsxs(Dr,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Upload Video"}),r.jsx(Yn,{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(ze,{children:"Video File"}),l?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Ia,{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(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ae=>{ae.stopPropagation(),i(null)},children:r.jsx(ds,{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(bo,{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:V,disabled:N})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"title",children:"Title"}),r.jsx(lt,{id:"title",value:u,onChange:ae=>m(ae.target.value),placeholder:"Enter video title",disabled:N})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Associate with Contact (optional)"}),r.jsxs(un,{value:v||"__none__",onValueChange:ae=>b(ae==="__none__"?"":ae),disabled:N,children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select a contact"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(ae=>r.jsxs($t,{value:ae.id,children:[ae.first_name," ",ae.last_name||""]},ae.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(Zn,{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(Gr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:ee()})]}),r.jsx(Mc,{value:T==="uploading"?M:T==="processing"?100:10})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:G,disabled:N,children:"Cancel"}),r.jsx(Q,{onClick:W,disabled:!l||N,children:N?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function pQt({open:e,onOpenChange:t,video:n,gmailEmail:s,signedThumbnailUrl:a,onSendComplete:o}){const[l,i]=A.useState([]),[u,m]=A.useState(null),[x,y]=A.useState(!1),[v,b]=A.useState(!1),[N,k]=A.useState(""),[M,I]=A.useState(""),[T,P]=A.useState(""),[F,D]=A.useState(!1),U=n.share_token?`https://video.relevelup.com/${n.share_token}`:"",V=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:a||n.thumbnail_url||"",W=n.title||"Video Message";A.useEffect(()=>{e&&l.length===0&&G()},[e]),A.useEffect(()=>{if(e&&(I(`I recorded a video for you — ${W}`),P("Hey! I recorded a quick video just for you. Click below to watch it:"),m(null),k(""),n.contact_id)){const fe=l.find(se=>se.id===n.contact_id);fe&&(m(fe),k(fe.email||""))}},[e,n.contact_id,l]);const G=async()=>{b(!0);try{const{data:fe,error:se}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(se)throw se;i(fe||[])}catch{console.error("Failed to fetch contacts")}finally{b(!1)}},ee=fe=>{m(fe),y(!1),k(fe.email||""),P(`Hey ${fe.first_name}! I recorded a quick video just for you. Click below to watch it:`),I(`I recorded a video for you — ${W}`)},ae=()=>{m(null),k(""),P("Hey! I recorded a quick video just for you. Click below to watch it:")},oe=fe=>`${fe.first_name} ${fe.last_name||""}`.trim(),pe=()=>`
${T.split(/\n\n+/).map(se=>`

${se.replace(/\n/g,"
")}

`).join("")}

▶ Watch Video

`,ne=async()=>{if(!N){Ae.error("Please enter a recipient email");return}if(!U){Ae.error("Video does not have a share link");return}D(!0);try{const fe=pe(),{data:se,error:me}=await Y.functions.invoke("gmail-send",{body:{to:N,subject:M,body:fe,contactId:(u==null?void 0:u.id)||null}});if(me)throw me;if(!(se!=null&&se.success))throw new Error((se==null?void 0:se.error)||"Failed to send");Ae.success("Video email sent!"),t(!1),o==null||o()}catch(fe){console.error("Gmail send error:",fe),Ae.error("Failed to send: "+(fe instanceof Error?fe.message:"Unknown error"))}finally{D(!1)}};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-[560px] max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5 text-red-500"}),"Send Video via Gmail"]}),s&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",r.jsx("span",{className:"font-medium",children:s})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Send to Contact"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Wc,{open:x,onOpenChange:y,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",role:"combobox",className:"flex-1 justify-between",children:[u?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),oe(u),u.email&&r.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",u.email,")"]})]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(cy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Tc,{className:"w-[350px] p-0",align:"start",children:r.jsxs(Py,{children:[r.jsx(Ly,{placeholder:"Search contacts..."}),r.jsxs(Oy,{children:[r.jsx(Dy,{children:v?"Loading...":"No contacts found."}),r.jsx(Ry,{children:l.filter(fe=>fe.email).map(fe=>r.jsxs(Fy,{value:`${fe.first_name} ${fe.last_name||""} ${fe.email||""}`,onSelect:()=>ee(fe),children:[r.jsx(mi,{className:Ut("mr-2 h-4 w-4",(u==null?void 0:u.id)===fe.id?"opacity-100":"opacity-0")}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:oe(fe)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:fe.email})]})]},fe.id))})]})]})})]}),u&&r.jsx(Q,{variant:"ghost",size:"icon",onClick:ae,className:"shrink-0",children:r.jsx(ds,{className:"h-4 w-4"})})]})]}),!u&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"video-to",children:"Or type email address"}),r.jsx(lt,{id:"video-to",value:N,onChange:fe=>k(fe.target.value),placeholder:"recipient@example.com",type:"email"})]}),r.jsx(Od,{}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"video-subject",children:"Subject"}),r.jsx(lt,{id:"video-subject",value:M,onChange:fe=>I(fe.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{htmlFor:"video-message",children:"Personal Message"}),r.jsx(Zn,{id:"video-message",value:T,onChange:fe=>P(fe.target.value),rows:4,className:"resize-y"})]}),r.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3 space-y-2",children:[r.jsx(ze,{className:"text-xs text-muted-foreground",children:"Video Preview (embedded in email)"}),r.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{maxWidth:320},children:[V?r.jsx("img",{src:V,alt:W,className:"w-full aspect-video object-cover"}):r.jsx("div",{className:"w-full aspect-video flex items-center justify-center bg-muted",children:r.jsx(Vl,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-10 h-10 rounded-full bg-white/80 flex items-center justify-center shadow",children:r.jsx(Vl,{className:"h-5 w-5 text-primary ml-0.5"})})})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Recipients will see the thumbnail with a play button. Clicking opens the video page."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(Q,{variant:"outline",onClick:()=>t(!1),disabled:F,children:"Cancel"}),r.jsxs(Q,{onClick:ne,disabled:F||!N||!M,className:"gap-2",children:[F?r.jsx(Gr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ji,{className:"h-4 w-4"}),F?"Sending...":"Send Video Email"]})]})]})]})})}function gQt({previewSrc:e,thumbnailSrc:t,alt:n,isHovered:s}){const[a,o]=A.useState(!1),[l,i]=A.useState(!1),u=s&&e&&!a,m=t&&!l;return!m&&!u?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Ia,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[m&&r.jsx("img",{src:t,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${u?"opacity-0":"opacity-100"}`,onError:()=>i(!0)}),u&&r.jsx("img",{src:e,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function xQt({video:e,previewSrc:t,thumbnailSrc:n,onOpen:s,onDelete:a,onRename:o,onNavigateToContact:l,onGetEmbedCode:i,onCopyEmailHtml:u,onEmbedToCrm:m,onShareWithTemplate:x,onSendViaGmail:y,isGmailConnected:v,getContactName:b,getShareUrl:N,copyToClipboard:k,formatDuration:M}){const[I,T]=A.useState(!1);return r.jsxs(He,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(gQt,{previewSrc:t,thumbnailSrc:n,alt:e.title||"Video preview",isHovered:I}),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(Vl,{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:M(e.duration_seconds)}),e.status!=="ready"&&r.jsx(At,{variant:e.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:e.status})]}),r.jsx(et,{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(ic,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:b(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(Xa,{className:"h-3 w-3"}),r.jsx("span",{children:on(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(_o,{className:"h-3 w-3"}),r.jsxs("span",{children:[e.view_count," ",e.view_count===1?"view":"views"]})]})]}),v&&e.share_token&&r.jsxs(Q,{variant:"outline",size:"sm",className:"mt-2 gap-1.5 text-xs h-7",onClick:P=>{P.stopPropagation(),y==null||y()},children:[r.jsx(ws,{className:"h-3 w-3"}),"Send via Gmail"]}),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(ic,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:b(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(Xa,{className:"h-3 w-3"}),r.jsx("span",{children:on(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(_o,{className:"h-3 w-3"}),r.jsxs("span",{children:[e.view_count," ",e.view_count===1?"view":"views"]})]})]})]}),r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:P=>P.stopPropagation(),children:r.jsx(kg,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",className:"bg-popover",children:[r.jsxs(Va,{onClick:P=>{P.stopPropagation(),s()},children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(ik,{}),r.jsxs(Va,{onClick:P=>{P.stopPropagation(),x()},children:[r.jsx(Vc,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(Va,{onClick:P=>{P.stopPropagation(),k(N(e),"Share link")},children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(Va,{onClick:P=>{P.stopPropagation(),i()},children:[r.jsx(Ej,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(Va,{onClick:P=>{P.stopPropagation(),u()},children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(Va,{onClick:P=>{P.stopPropagation(),m()},children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),v&&e.share_token&&r.jsxs(Va,{onClick:P=>{P.stopPropagation(),y==null||y()},children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]}),r.jsxs(Va,{onClick:P=>{P.stopPropagation(),o()},children:[r.jsx(Qa,{className:"h-4 w-4 mr-2"}),"Rename"]}),r.jsx(ik,{}),e.contact_id&&r.jsxs(Va,{onClick:P=>{P.stopPropagation(),l()},children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(Va,{onClick:P=>{P.stopPropagation(),a()},className:"text-destructive",children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function yQt(){var Ze;const e=Vn(),{data:t,isLoading:n,refetch:s}=G3t(),{data:a}=J0e(),{data:o}=Nf(),l=Y3t(),i=Z3t(),{isGmailConnected:u,gmailEmail:m}=$ae(),[x,y]=A.useState(""),[v,b]=A.useState(null),[N,k]=A.useState(!1),[M,I]=A.useState(!1),[T,P]=A.useState(!1),[F,D]=A.useState(!1),[U,V]=A.useState(!1),[W,G]=A.useState(""),[ee,ae]=A.useState(!1),[oe,pe]=A.useState(!1),[ne,fe]=A.useState(!1),[se,me]=A.useState(!1),[ue,xe]=A.useState(""),[Te,_e]=A.useState({}),we=Le=>{if(!Le)return"Unassigned";const Ke=o==null?void 0:o.find(tt=>tt.id===Le);return Ke?`${Ke.first_name} ${Ke.last_name||""}`.trim():"Unknown"},ve=Le=>{if(!Le)return"0:00";const Ke=Math.floor(Le/60),tt=Le%60;return`${Ke}:${tt.toString().padStart(2,"0")}`},Xe=t==null?void 0:t.filter(Le=>{if(!x)return!0;const Ke=we(Le.contact_id).toLowerCase(),tt=(Le.title||"").toLowerCase(),ct=(Le.notes||"").toLowerCase();return Ke.includes(x.toLowerCase())||tt.includes(x.toLowerCase())||ct.includes(x.toLowerCase())}),[Me,Ie]=A.useState(!1);A.useEffect(()=>{if(Me)return;(async()=>{if(!(t!=null&&t.length))return;const Ke=t.filter(ct=>ct.status==="processing"&&ct.bunny_video_id);if(!Ke.length)return;let tt=!1;for(const ct of Ke)try{const{data:it,error:zt}=await Y.functions.invoke("bunny-upload",{body:{action:"status",videoId:ct.bunny_video_id,isAgentVideo:!0}});if(zt||!it)continue;it.status===4&&(await Y.from("agent_videos").update({status:"ready",playback_url:it.directPlayUrl,thumbnail_url:it.thumbnailUrl,preview_url:it.previewUrl,duration_seconds:it.length||ct.duration_seconds,updated_at:new Date().toISOString()}).eq("id",ct.id),tt=!0)}catch(it){console.warn("Reconcile check failed for video",ct.id,it)}Ie(!0),tt&&s()})()},[t,Me,s]),A.useEffect(()=>{(async()=>{if(!(t!=null&&t.length))return;const Ke=t.filter(Lt=>(Lt==null?void 0:Lt.bunny_video_id)&&!Te[Lt.id]);if(!Ke.length)return;const tt=Ke.map(Lt=>Lt.bunny_video_id),{data:ct,error:it}=await Y.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:tt,isAgentVideo:!0}});if(it)throw it;const zt=(ct==null?void 0:ct.assets)||{};_e(Lt=>{const lr={...Lt};for(const Ar of Ke)zt[Ar.bunny_video_id]&&(lr[Ar.id]={previewUrl:zt[Ar.bunny_video_id].previewUrl,thumbnailUrl:zt[Ar.bunny_video_id].thumbnailUrl});return lr})})().catch(Ke=>console.warn("Failed to load signed Bunny asset URLs",Ke))},[t,Te]);const $e=(a==null?void 0:a.total_storage_mb)||0,Be=(a==null?void 0:a.max_storage_mb)||1024,Ve=$e/Be*100,ot=Ve>=80,Tt=Ve>=100,Oe=async(Le,Ke)=>{await navigator.clipboard.writeText(Le),Ae.success(`${Ke} copied to clipboard`)},at=Le=>Le.share_token?`https://video.relevelup.com/${Le.share_token}`:Le.playback_url||"",le=Le=>{const Ke=at(Le),tt=o==null?void 0:o.find(Ar=>Ar.id===Le.contact_id),ct=we(Le.contact_id),it=ct!=="Unassigned"?ct.split(" ")[0]:"",zt=(tt==null?void 0:tt.phone)||"",Lt=`Hey${it?` ${it}`:""}! I recorded a quick video message for you. Check it out: ${Ke}`,lr=zt?`sms:${zt}?body=${encodeURIComponent(Lt)}`:`sms:?body=${encodeURIComponent(Lt)}`;window.open(lr,"_self")},qe=Le=>{const Ke=o==null?void 0:o.find(lr=>lr.id===Le.contact_id),tt=(Ke==null?void 0:Ke.email)||"",ct=at(Le),it="Check out this video",zt=`I recorded a quick video for you: ${ct}`,Lt=tt?`mailto:${tt}?subject=${encodeURIComponent(it)}&body=${encodeURIComponent(zt)}`:`mailto:?subject=${encodeURIComponent(it)}&body=${encodeURIComponent(zt)}`;window.open(Lt,"_self")},Je=Le=>{var it;const Ke=at(Le),tt=Le.title||"Video Message",ct=Le.share_token?`https://video.relevelup.com/thumb/${Le.share_token}`:((it=Te[Le.id])==null?void 0:it.thumbnailUrl)||Le.thumbnail_url||"";return``},st=async Le=>{if(!Le.thumbnail_url&&!Le.share_token){Ae.error("Video thumbnail not available yet");return}const Ke=Je(Le),tt=at(Le),ct=`Watch: ${Le.title||"Video Message"} ${tt}`;try{const it=new Blob([Ke],{type:"text/html"}),zt=new Blob([ct],{type:"text/plain"}),Lt=new ClipboardItem({"text/html":it,"text/plain":zt});await navigator.clipboard.write([Lt]),Ae.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ct+` `+Ke),Ae.success("Copied! Paste into your email.")}},je=async Le=>{try{Ae.loading("Preparing download...",{id:"download"});const{data:Ke,error:tt}=await Y.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:Le.bunny_video_id,isAgentVideo:!0}});if(tt||!(Ke!=null&&Ke.downloadUrl))throw new Error((tt==null?void 0:tt.message)||"Failed to get download URL");const it=`${((Le.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,zt=await fetch(Ke.downloadUrl);if(!zt.ok)throw new Error("Failed to fetch video file");const Lt=await zt.blob(),lr=URL.createObjectURL(Lt),Ar=document.createElement("a");Ar.href=lr,Ar.download=it,Ar.rel="noreferrer",document.body.appendChild(Ar),Ar.click(),Ar.remove(),URL.revokeObjectURL(lr),Ae.success("Download started",{id:"download"})}catch(Ke){console.error("Download error:",Ke),Ae.error("Could not force download (your browser may block it).",{id:"download"})}},ut=async Le=>{b(Le),ae(!0),G(""),V(!0);try{const{data:Ke,error:tt}=await Y.functions.invoke("bunny-upload",{body:{action:"crm-embed",videoId:Le.bunny_video_id,title:Le.title,isAgentVideo:!0,shareToken:Le.share_token}});if(tt||!(Ke!=null&&Ke.html))throw new Error("Failed to generate CRM embed code");G(Ke.html)}catch(Ke){console.error("CRM embed error:",Ke),Ae.error("Failed to generate CRM embed code"),V(!1)}finally{ae(!1)}},Ce=Le=>{b(Le),k(!0)},Ee=async()=>{if(v)try{await l.mutateAsync({id:v.id,bunnyVideoId:v.bunny_video_id,hardDelete:!0}),I(!1),b(null),Ae.success("Video deleted successfully")}catch{Ae.error("Failed to delete video")}};return r.jsx(Fr,{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(Q,{variant:"outline",onClick:()=>P(!0),children:[r.jsx(bo,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(Q,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(He,{className:ot?"border-amber-500":Tt?"border-destructive":"",children:r.jsxs(et,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(iA,{className:`h-5 w-5 ${Tt?"text-destructive":ot?"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:[$e.toFixed(1)," MB / ",Be>=1024?`${(Be/1024).toFixed(0)} GB`:`${Be} MB`]})]}),r.jsx(Mc,{value:Math.min(Ve,100),className:`h-2 ${Tt?"[&>div]:bg-destructive":ot?"[&>div]:bg-amber-500":""}`})]}),ot&&!Tt&&r.jsxs(At,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),Tt&&r.jsxs(At,{variant:"destructive",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),Tt&&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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search videos by contact, title, or notes...",value:x,onChange:Le=>y(Le.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"})}):(Xe==null?void 0:Xe.length)===0?r.jsx(He,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Ia,{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(Q,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(_n,{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:Xe==null?void 0:Xe.map(Le=>{var Ke,tt;return r.jsx(xQt,{video:Le,previewSrc:(Ke=Te[Le.id])==null?void 0:Ke.previewUrl,thumbnailSrc:(tt=Te[Le.id])==null?void 0:tt.thumbnailUrl,onOpen:()=>Ce(Le),onDelete:()=>{b(Le),I(!0)},onRename:()=>{b(Le),xe(Le.title||""),me(!0)},onNavigateToContact:()=>e(`/mission-control/contacts/${Le.contact_id}`),onGetEmbedCode:()=>{b(Le),D(!0)},onCopyEmailHtml:()=>st(Le),onEmbedToCrm:()=>ut(Le),onShareWithTemplate:()=>{b(Le),pe(!0)},onSendViaGmail:()=>{b(Le),fe(!0)},isGmailConnected:u,getContactName:we,getShareUrl:at,copyToClipboard:Oe,formatDuration:ve},Le.id)})}),r.jsx(Rr,{open:N,onOpenChange:k,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsx(Br,{children:(v==null?void 0:v.title)||"Video Preview"}),r.jsx(Yn,{children:(v==null?void 0:v.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ic,{className:"h-3 w-3"}),we(v.contact_id)]})})]}),v&&r.jsxs("div",{className:"space-y-4",children:[v.status==="processing"?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 bg-muted/50 rounded-lg border border-dashed border-border text-center space-y-4",children:[r.jsx("div",{className:"relative",children:r.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Gr,{className:"h-8 w-8 text-primary animate-spin"})})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Video is still processing"}),r.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:"Your video is being encoded and will be ready shortly. This usually takes 1–3 minutes. Check back soon!"})]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{k(!1),s()},children:[r.jsx(Go,{className:"h-4 w-4 mr-2"}),"Refresh Library"]})]}):r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:v.playback_url?(()=>{let Le=v.playback_url;return Le.includes("iframe.mediadelivery.net/play/")&&(Le=Le.replace("/play/","/embed/"),Le+=(Le.includes("?")?"&":"?")+"autoplay=false&responsive=true"),Le.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:Le,title:v.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:v.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:v.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>Ae.error("Video preview failed to load")},v.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Ia,{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(Q,{variant:"outline",onClick:()=>le(v),children:[r.jsx(Ro,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),!u&&r.jsxs(Q,{variant:"outline",onClick:()=>qe(v),children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(Q,{variant:"outline",onClick:()=>Oe(at(v),"Share link"),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(Q,{variant:"outline",onClick:()=>st(v),children:[r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(Q,{variant:"outline",onClick:()=>je(v),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(Q,{variant:"outline",onClick:()=>{k(!1),ut(v)},children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),r.jsxs(Q,{variant:"outline",onClick:()=>{k(!1),pe(!0)},children:[r.jsx(Vc,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]}),u&&(v==null?void 0:v.share_token)&&r.jsxs(Q,{variant:"outline",onClick:()=>{k(!1),fe(!0)},children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(Q,{variant:"destructive",onClick:()=>{k(!1),I(!0)},children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Rr,{open:M,onOpenChange:I,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Delete Video"}),r.jsx(Yn,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),r.jsx(Q,{variant:"destructive",onClick:Ee,disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(fQt,{open:T,onOpenChange:P}),r.jsx(Rr,{open:F,onOpenChange:D,children:r.jsxs(Dr,{className:"sm:max-w-lg",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Embed Video"}),r.jsx(Yn,{children:"Copy this code to embed the video on your website."})]}),v&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Embed Code"}),r.jsx(Zn,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(Q,{className:"flex-1",onClick:()=>{const Le=``;Oe(Le,"Embed code")},children:[r.jsx(Po,{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."})]})]})}),v&&r.jsx(AVe,{open:oe,onOpenChange:pe,video:v,contactName:we(v.contact_id)}),v&&r.jsx(pQt,{open:ne,onOpenChange:fe,video:v,gmailEmail:m,signedThumbnailUrl:(Ze=Te[v.id])==null?void 0:Ze.thumbnailUrl}),r.jsx(Rr,{open:se,onOpenChange:me,children:r.jsxs(Dr,{className:"max-w-sm",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Rename Video"}),r.jsx(Yn,{children:"Enter a new title for this video."})]}),r.jsx(lt,{value:ue,onChange:Le=>xe(Le.target.value),placeholder:"Video title",autoFocus:!0,onKeyDown:Le=>{Le.key==="Enter"&&ue.trim()&&i.mutate({id:v.id,title:ue.trim()},{onSuccess:()=>{Ae.success("Video renamed"),me(!1)}})}}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>me(!1),children:"Cancel"}),r.jsx(Q,{disabled:!ue.trim()||i.isPending,onClick:()=>{i.mutate({id:v.id,title:ue.trim()},{onSuccess:()=>{Ae.success("Video renamed"),me(!1)}})},children:i.isPending?"Saving...":"Save"})]})]})}),r.jsx(Rr,{open:U,onOpenChange:V,children:r.jsxs(Dr,{className:"sm:max-w-lg",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(Ss,{className:"h-5 w-5"}),"Embed to CRM"]}),r.jsx(Yn,{children:"Copy this HTML code and paste it into your CRM's email editor. It uses a simple image + link format that works in all CRM email programs."})]}),ee?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):W?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"CRM Email HTML"}),r.jsx(Zn,{readOnly:!0,rows:12,value:W,className:"font-mono text-xs"})]}),r.jsxs(Q,{className:"w-full",onClick:()=>{Oe(W,"CRM embed code")},children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Copy CRM Embed Code"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this into your CRM's email HTML editor. The recipient will see the video thumbnail and can click to watch. Works with Follow Up Boss, KvCORE, BoomTown, Sierra, and more."})]}):null]})})]})})}function EVe({stages:e,currentStageId:t,onStageSelect:n,disabled:s}){const[a,o]=A.useState(!1),l=e.find(u=>u.id===t),i=u=>{u.id!==t&&n(u.id,u.name),o(!1)};return r.jsxs(lh,{open:a,onOpenChange:o,children:[r.jsx(ch,{asChild:!0,children:r.jsxs(Q,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:u=>u.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(Gi,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(Nu,{align:"end",className:"w-48 z-50 bg-popover",onClick:u=>u.stopPropagation(),children:e.map(u=>{const m=u.icon&&IIe[u.icon]||Ju,x=u.id===t;return r.jsxs(Va,{onClick:()=>i(u),className:Ut("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:`${u.color}20`},children:r.jsx(m,{className:"h-3 w-3",style:{color:u.color}})}),r.jsx("span",{className:"flex-1",children:u.name}),x&&r.jsx(mi,{className:"h-4 w-4 text-primary"})]},u.id)})})]})}const vQt={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"}},_Qt={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 IVe({deal:e,onClick:t,isDragging:n,stages:s,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1}){var I,T;const i=B3(),u=vQt[e.deal_type],m=_Qt[e.priority],x=A.useMemo(()=>e.target_close_date?Iy(new Date(e.target_close_date),new Date):null,[e.target_close_date]),y=x!==null&&x<0,v=x!==null&&x<=7&&x>=0,b=A.useMemo(()=>{var D;if(e.deal_type!=="seller"&&e.deal_type!=="dual")return null;const P=((D=e.listing)==null?void 0:D.created_at)||e.listing_date;if(!P)return null;const F=e.contract_date?new Date(e.contract_date):new Date;return Iy(F,new Date(P))},[e]),N=l&&!e.scorecard_transaction_id,k=!!e.scorecard_transaction_id,M=P=>P?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(P):null;return r.jsx(He,{className:Ut("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",N&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:t,children:r.jsxs(et,{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(At,{variant:"outline",className:Ut("text-[10px] px-1.5 py-0 shrink-0",u.color),children:u.label})]}),e.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ea,{className:"h-5 w-5",children:r.jsxs(ta,{className:"text-[10px] bg-primary/10 text-primary",children:[(I=e.contact.first_name)==null?void 0:I[0],(T=e.contact.last_name)==null?void 0:T[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(gm,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),N&&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(io,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),k&&l&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[r.jsx(no,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:"Synced to Scorecard"})]}),b!==null&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(nA,{className:"h-3 w-3 text-muted-foreground shrink-0"}),r.jsxs("span",{className:Ut("font-medium",b>90?"text-red-600":b>60?"text-amber-600":"text-muted-foreground"),children:[b," DOM"]}),e.contract_date&&r.jsx("span",{className:"text-muted-foreground",children:"(final)"})]}),!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(ya,{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(Fd,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:M(e.expected_price)}),e.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",M(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:Ut("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",m.color),children:[r.jsx("div",{className:Ut("w-1.5 h-1.5 rounded-full",m.dot)}),r.jsx("span",{className:"capitalize",children:e.priority})]}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.probability,"%"]})]}),o&&i&&s&&a?r.jsx(EVe,{stages:s,currentStageId:e.stage_id||"",onStageSelect:(P,F)=>a(e.id,P,F)}):e.target_close_date?r.jsxs("div",{className:Ut("flex items-center gap-1 text-[10px]",y&&"text-red-600",v&&!y&&"text-amber-600",!y&&!v&&"text-muted-foreground"),children:[y?r.jsx(yl,{className:"h-3 w-3"}):r.jsx(Cs,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:v?`${x}d left`:on(new Date(e.target_close_date),"MMM d")})]}):null]})]})})}function bQt({stage:e,deals:t,onDealClick:n,onAddDeal:s,onDragStart:a,onDragOver:o,onDrop:l,isDragOver:i,isWonStage:u=!1}){const m=A.useRef(null),x=t.reduce((N,k)=>N+(k.expected_price||0),0),y=t.reduce((N,k)=>N+(k.expected_commission||0),0),v=N=>N>=1e6?`$${(N/1e6).toFixed(1)}M`:N>=1e3?`$${(N/1e3).toFixed(0)}K`:`$${N.toFixed(0)}`,b=e.icon&&IIe[e.icon]||Ju;return r.jsxs("div",{ref:m,className:Ut("flex flex-col h-full min-w-[280px] max-w-[320px] bg-muted/30 rounded-xl border border-border/50 transition-all duration-200",i&&"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(b,{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(At,{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:v(x)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[v(y)," GCI"]})]})]}),r.jsx(Vo,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[t.map(N=>r.jsx("div",{draggable:!0,onDragStart:k=>{k.dataTransfer.effectAllowed="move",a(N.id,e.id)},children:r.jsx(IVe,{deal:N,onClick:()=>n(N),isWonStage:u})},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(Q,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(e.id),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function wQt({stats:e,isLoading:t}){const n=a=>a>=1e6?`$${(a/1e6).toFixed(1)}M`:a>=1e3?`$${(a/1e3).toFixed(0)}K`:`$${a.toLocaleString()}`,s=[{label:"Active Deals",value:(e==null?void 0:e.activeDeals)||0,icon:xy,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((e==null?void 0:e.pipelineValue)||0),icon:_c,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((e==null?void 0:e.expectedCommission)||0),icon:Fd,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(e==null?void 0:e.wonDeals)||0,icon:io,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(a=>r.jsx(He,{className:"animate-pulse",children:r.jsx(et,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},a))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(a=>r.jsx(He,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:Ut("p-2 rounded-lg",a.bgColor),children:r.jsx(a.icon,{className:Ut("h-5 w-5",a.color)})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:a.label}),r.jsx("p",{className:"text-xl font-bold",children:a.value})]})]})})},a.label))})}const jQt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],kQt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function NQt({open:e,onOpenChange:t,deal:n,defaultStageId:s}){const{data:a}=ove(),{data:o}=Nf(),{data:l}=ERe(),i=NVe(),u=SVe(),[m,x]=A.useState(""),[y,v]=A.useState(!1),b=(l==null?void 0:l.filter(F=>((n==null?void 0:n.listing_id)===F.id,!0)))||[],[N,k]=A.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,listing_date:void 0,priority:"medium",probability:"50",notes:""});A.useEffect(()=>{var F,D,U;e&&(n?(k({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:((F=n.expected_price)==null?void 0:F.toString())||"",commission_percentage:((D=n.commission_percentage)==null?void 0:D.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,listing_date:n.listing_date?new Date(n.listing_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&x(`${n.contact.first_name} ${n.contact.last_name}`)):(k({deal_name:"",deal_type:"buyer",stage_id:s||((U=a==null?void 0:a[0])==null?void 0:U.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,listing_date:void 0,priority:"medium",probability:"50",notes:""}),x("")))},[e,n,s,a]);const M=o==null?void 0:o.filter(F=>{var U,V,W;const D=m.toLowerCase();return((U=F.first_name)==null?void 0:U.toLowerCase().includes(D))||((V=F.last_name)==null?void 0:V.toLowerCase().includes(D))||((W=F.email)==null?void 0:W.toLowerCase().includes(D))}).slice(0,5),I=()=>{const F=parseFloat(N.expected_price)||0,D=parseFloat(N.commission_percentage)||0;return F*(D/100)},T=async F=>{var D,U,V;if(F.preventDefault(),!N.deal_name.trim()){Ae.error("Please enter a deal name");return}try{const W={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:I()||null,commission_percentage:N.commission_percentage?parseFloat(N.commission_percentage):3,target_close_date:((D=N.target_close_date)==null?void 0:D.toISOString().split("T")[0])||null,contract_date:((U=N.contract_date)==null?void 0:U.toISOString().split("T")[0])||null,listing_date:((V=N.listing_date)==null?void 0:V.toISOString().split("T")[0])||null,priority:N.priority,probability:parseInt(N.probability)||50,notes:N.notes||null};n?(await u.mutateAsync({id:n.id,...W}),Ae.success("Deal updated successfully")):(await i.mutateAsync(W),Ae.success("Deal created successfully")),t(!1)}catch{Ae.error("Failed to save deal")}},P=i.isPending||u.isPending;return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Br,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(Yn,{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(ze,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(lt,{id:"deal_name",value:N.deal_name,onChange:F=>k(D=>({...D,deal_name:F.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Deal Type"}),r.jsxs(un,{value:N.deal_type,onValueChange:F=>k(D=>({...D,deal_type:F})),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:jQt.map(F=>r.jsx($t,{value:F.value,children:F.label},F.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Stage"}),r.jsxs(un,{value:N.stage_id||"none",onValueChange:F=>k(D=>({...D,stage_id:F==="none"?"":F})),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select stage"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"No Stage"}),a==null?void 0:a.map(F=>r.jsx($t,{value:F.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:F.color}}),F.name]})},F.id))]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{value:m,onChange:F=>{x(F.target.value),v(!0),F.target.value||k(D=>({...D,contact_id:""}))},onFocus:()=>v(!0),placeholder:"Search contacts...",className:"pl-9"}),y&&m&&M&&M.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:M.map(F=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{k(D=>({...D,contact_id:F.id})),x(`${F.first_name} ${F.last_name}`),v(!1)},children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[F.first_name," ",F.last_name]}),F.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:F.email})]},F.id))})]})]}),b.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(un,{value:N.listing_id||"none",onValueChange:F=>{const D=F==="none"?"":F,U=b.find(V=>V.id===D);k(U?V=>{var W;return{...V,listing_id:D,deal_type:"seller",property_address:U.property_address||V.property_address,city:U.city||V.city,state:U.state||V.state,expected_price:((W=U.price)==null?void 0:W.toString())||V.expected_price}}:V=>({...V,listing_id:D}))},children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"None"}),b.map(F=>r.jsx($t,{value:F.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:F.property_address||`${F.city}, ${F.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",(F.price/1e3).toFixed(0),"K"]})]})},F.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(ze,{htmlFor:"property_address",children:"Address"}),r.jsx(lt,{id:"property_address",value:N.property_address,onChange:F=>k(D=>({...D,property_address:F.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"city",children:"City"}),r.jsx(lt,{id:"city",value:N.city,onChange:F=>k(D=>({...D,city:F.target.value}))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"state",children:"State"}),r.jsx(lt,{id:"state",value:N.state,onChange:F=>k(D=>({...D,state:F.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(lt,{id:"zip_code",value:N.zip_code,onChange:F=>k(D=>({...D,zip_code:F.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(ze,{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(lt,{id:"expected_price",type:"number",value:N.expected_price,onChange:F=>k(D=>({...D,expected_price:F.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(lt,{id:"commission_percentage",type:"number",step:"0.1",value:N.commission_percentage,onChange:F=>k(D=>({...D,commission_percentage:F.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(ze,{children:"Expected GCI"}),r.jsx(lt,{value:I()?`$${I().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(ze,{children:"Target Close Date"}),r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!N.target_close_date&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"mr-2 h-4 w-4"}),N.target_close_date?on(N.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:N.target_close_date,onSelect:F=>k(D=>({...D,target_close_date:F})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Contract Date"}),r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!N.contract_date&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"mr-2 h-4 w-4"}),N.contract_date?on(N.contract_date,"PPP"):"Pick a date"]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:N.contract_date,onSelect:F=>k(D=>({...D,contract_date:F})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),(N.deal_type==="seller"||N.deal_type==="dual")&&!N.listing_id&&r.jsxs("div",{className:"space-y-2 col-span-2",children:[r.jsx(ze,{children:"Listing Date (for Days on Market)"}),r.jsxs(Wc,{children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",className:Ut("w-full justify-start text-left font-normal",!N.listing_date&&"text-muted-foreground"),children:[r.jsx(Cs,{className:"mr-2 h-4 w-4"}),N.listing_date?on(N.listing_date,"PPP"):"Pick a date"]})}),r.jsx(Tc,{className:"w-auto p-0",align:"start",children:r.jsx(Lp,{mode:"single",selected:N.listing_date,onSelect:F=>k(D=>({...D,listing_date:F})),initialFocus:!0,className:"pointer-events-auto"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to calculate Days on Market. Auto-filled for linked listings."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Priority"}),r.jsxs(un,{value:N.priority,onValueChange:F=>k(D=>({...D,priority:F})),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:kQt.map(F=>r.jsx($t,{value:F.value,children:F.label},F.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(lt,{type:"number",min:"0",max:"100",value:N.probability,onChange:F=>k(D=>({...D,probability:F.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(ze,{htmlFor:"notes",children:"Notes"}),r.jsx(Zn,{id:"notes",value:N.notes,onChange:F=>k(D=>({...D,notes:F.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(Q,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(Q,{type:"submit",disabled:P,children:[P&&r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const SQt={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"}},CQt={note:Ro,call:Ai,email:ws,meeting:Cs,stage_change:Ss,task_completed:no,document:ya,system:Xa};function MQt({deal:e,open:t,onOpenChange:n,onEdit:s,onAddToScorecard:a,isWonStage:o}){var pe,ne;const{data:l,isLoading:i}=GXt((e==null?void 0:e.id)||""),{data:u,isLoading:m}=ZXt((e==null?void 0:e.id)||""),x=KXt(),y=XXt(),v=YXt(),b=WXt(),[N,k]=A.useState(""),[M,I]=A.useState(""),[T,P]=A.useState(!1);if(!e)return null;const F=SQt[e.deal_type],D=(()=>{var me;if(e.deal_type!=="seller"&&e.deal_type!=="dual")return null;const fe=((me=e.listing)==null?void 0:me.created_at)||e.listing_date;if(!fe)return null;const se=e.contract_date?new Date(e.contract_date):new Date;return Iy(se,new Date(fe))})(),U=fe=>fe?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(fe):"-",V=async()=>{if(N.trim())try{await x.mutateAsync({deal_id:e.id,activity_type:"note",title:"Note added",description:N}),k(""),Ae.success("Note added")}catch{Ae.error("Failed to add note")}},W=async()=>{if(M.trim())try{await y.mutateAsync({deal_id:e.id,title:M,sort_order:((u==null?void 0:u.length)||0)+1}),I(""),Ae.success("Task added")}catch{Ae.error("Failed to add task")}},G=async(fe,se)=>{try{await v.mutateAsync({id:fe,is_completed:se,deal_id:e.id})}catch{Ae.error("Failed to update task")}},ee=async()=>{try{await b.mutateAsync(e.id),Ae.success("Deal deleted"),n(!1)}catch{Ae.error("Failed to delete deal")}},ae=(u==null?void 0:u.filter(fe=>fe.is_completed).length)||0,oe=(u==null?void 0:u.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(Vse,{open:t,onOpenChange:n,children:r.jsxs(lP,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(Hse,{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(At,{variant:"outline",className:Ut("text-xs",F.color),children:F.label}),r.jsxs(At,{variant:"secondary",className:"text-xs capitalize",children:[e.priority," priority"]})]}),r.jsx(Wse,{className:"text-xl",children:e.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{variant:"outline",size:"icon",onClick:()=>s(e),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>P(!0),children:r.jsx(Bn,{className:"h-4 w-4"})})]})]})}),r.jsx(Vo,{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(ea,{className:"h-10 w-10",children:r.jsxs(ta,{className:"bg-primary/10 text-primary",children:[(pe=e.contact.first_name)==null?void 0:pe[0],(ne=e.contact.last_name)==null?void 0:ne[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(Q,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${e.contact.phone}`,children:r.jsx(Ai,{className:"h-4 w-4"})})}),e.contact.email&&r.jsx(Q,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${e.contact.email}`,children:r.jsx(ws,{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(ya,{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:U(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:U(e.expected_commission)})]}),o&&!e.scorecard_transaction_id&&a&&r.jsxs(Q,{onClick:()=>a(e),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(io,{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(no,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),D!==null&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 col-span-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Days on Market"}),r.jsxs("p",{className:Ut("text-lg font-bold",D>90?"text-red-600":D>60?"text-amber-600":"text-foreground"),children:[D," ",e.contract_date?"(final)":"days"]})]}),e.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Cs,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",on(new Date(e.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Fd,{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(wi,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(_i,{className:"w-full grid grid-cols-2",children:[r.jsxs(sn,{value:"tasks",className:"gap-1",children:[r.jsx(no,{className:"h-4 w-4"}),"Tasks ",oe>0&&`(${ae}/${oe})`]}),r.jsxs(sn,{value:"activity",className:"gap-1",children:[r.jsx(Xa,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(Sn,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{placeholder:"Add a new task...",value:M,onChange:fe=>I(fe.target.value),onKeyDown:fe=>fe.key==="Enter"&&W()}),r.jsx(Q,{onClick:W,disabled:!M.trim(),children:r.jsx(_n,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[u==null?void 0:u.map(fe=>r.jsxs("div",{className:Ut("flex items-center gap-3 p-3 rounded-lg border transition-colors",fe.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(_l,{checked:fe.is_completed,onCheckedChange:se=>G(fe.id,!!se)}),r.jsx("span",{className:Ut("flex-1 text-sm",fe.is_completed&&"line-through text-muted-foreground"),children:fe.title}),fe.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(fe.due_date),"MMM d")})]},fe.id)),(u==null?void 0:u.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs(Sn,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Zn,{placeholder:"Add a note...",value:N,onChange:fe=>k(fe.target.value),rows:2}),r.jsxs(Q,{onClick:V,disabled:!N.trim(),size:"sm",className:"w-full",children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[l==null?void 0:l.map(fe=>{const se=CQt[fe.activity_type]||Xa;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(se,{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:fe.title}),fe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:fe.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:bu(new Date(fe.created_at),{addSuffix:!0})})]})]},fe.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(Pd,{open:T,onOpenChange:P,children:r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Delete Deal?"}),r.jsxs(hd,{children:['This will permanently delete "',e.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function TQt({open:e,onOpenChange:t,deal:n,onComplete:s}){const a=uae(),o=SVe(),{data:l}=dae(),{data:i}=qp(),[u,m]=A.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:on(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});A.useEffect(()=>{if(n&&e){const v=n.deal_type==="seller"?"seller":"buyer",b=n.expected_price||0,N=n.commission_percentage||3,k=n.expected_commission||b*N/100;m({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:v,close_date:n.actual_close_date||n.target_close_date||on(new Date,"yyyy-MM-dd"),sale_price:b,commission_amount:k,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,e]);const x=async v=>{if(v.preventDefault(),!!n)try{const b=await a.mutateAsync({property_address:u.property_address,city:u.city||null,state:u.state||null,zip:u.zip||null,transaction_type:u.transaction_type,close_date:u.close_date,sale_price:u.sale_price,commission_amount:u.commission_amount||null,lead_source_id:u.lead_source_id||null,client_type_id:u.client_type_id||null,contact_id:n.contact_id||null,notes:u.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:b.id,actual_close_date:u.close_date}),Ae.success("Deal added to Scorecard! 🎉"),t(!1),s==null||s()}catch(b){console.error("Error syncing to scorecard:",b),Ae.error("Failed to add to scorecard")}},y=v=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(v);return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{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(io,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(Br,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(Yn,{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(ze,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(ya,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(lt,{id:"property_address",value:u.property_address,onChange:v=>m(b=>({...b,property_address:v.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(ze,{htmlFor:"city",children:"City"}),r.jsx(lt,{id:"city",value:u.city,onChange:v=>m(b=>({...b,city:v.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"state",children:"State"}),r.jsx(lt,{id:"state",value:u.state,onChange:v=>m(b=>({...b,state:v.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"zip",children:"Zip"}),r.jsx(lt,{id:"zip",value:u.zip,onChange:v=>m(b=>({...b,zip:v.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(ze,{children:"Transaction Type *"}),r.jsxs(un,{value:u.transaction_type,onValueChange:v=>m(b=>({...b,transaction_type:v})),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"buyer",children:"Buyer"}),r.jsx($t,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(Cs,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(lt,{id:"close_date",type:"date",value:u.close_date,onChange:v=>m(b=>({...b,close_date:v.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(ze,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(Fd,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(lt,{id:"sale_price",type:"number",value:u.sale_price||"",onChange:v=>m(b=>({...b,sale_price:Number(v.target.value)})),placeholder:"450000",required:!0,min:0}),u.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(u.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ze,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(P4,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(lt,{id:"commission_amount",type:"number",value:u.commission_amount||"",onChange:v=>m(b=>({...b,commission_amount:Number(v.target.value)})),placeholder:"13500",min:0}),u.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(u.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Lead Source"}),r.jsxs(un,{value:u.lead_source_id,onValueChange:v=>m(b=>({...b,lead_source_id:v})),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select source"})}),r.jsx(cn,{children:l==null?void 0:l.map(v=>r.jsx($t,{value:v.id,children:v.name},v.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Client Type"}),r.jsxs(un,{value:u.client_type_id,onValueChange:v=>m(b=>({...b,client_type_id:v})),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select type"})}),r.jsx(cn,{children:i==null?void 0:i.map(v=>r.jsx($t,{value:v.id,children:v.name},v.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"notes",children:"Notes"}),r.jsx(Zn,{id:"notes",value:u.notes,onChange:v=>m(b=>({...b,notes:v.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(Vs,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(Q,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Skip for now"}),r.jsx(Q,{type:"submit",disabled:a.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:a.isPending?"Adding...":r.jsxs(r.Fragment,{children:["Add to Scorecard",r.jsx(No,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const AQt={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"}},kTe={urgent:0,high:1,medium:2,low:3};function EQt({deals:e,stages:t,onDealClick:n,onStageChange:s}){const[a,o]=A.useState("target_close_date"),[l,i]=A.useState("asc"),u=b=>{a===b?i(N=>N==="asc"?"desc":"asc"):(o(b),i("asc"))},m=A.useMemo(()=>[...e].sort((b,N)=>{var M,I;let k=0;switch(a){case"deal_name":k=b.deal_name.localeCompare(N.deal_name);break;case"stage":{const T=((M=t.find(F=>F.id===b.stage_id))==null?void 0:M.sort_order)||0,P=((I=t.find(F=>F.id===N.stage_id))==null?void 0:I.sort_order)||0;k=T-P;break}case"expected_price":k=(b.expected_price||0)-(N.expected_price||0);break;case"expected_commission":k=(b.expected_commission||0)-(N.expected_commission||0);break;case"target_close_date":{const T=b.target_close_date?new Date(b.target_close_date).getTime():1/0,P=N.target_close_date?new Date(N.target_close_date).getTime():1/0;k=T-P;break}case"priority":k=kTe[b.priority]-kTe[N.priority];break}return l==="asc"?k:-k}),[e,t,a,l]),x=b=>b?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(b):"—",y=b=>b?t.find(N=>N.id===b):null,v=({field:b,children:N})=>r.jsxs(Q,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>u(b),children:[N,a===b?l==="asc"?r.jsx(df,{className:"ml-2 h-4 w-4"}):r.jsx(oy,{className:"ml-2 h-4 w-4"}):r.jsx(Og,{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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{className:"bg-muted/50",children:[r.jsx(Mt,{className:"w-[250px]",children:r.jsx(v,{field:"deal_name",children:"Deal Name"})}),r.jsx(Mt,{className:"w-[150px]",children:r.jsx(v,{field:"stage",children:"Stage"})}),r.jsx(Mt,{className:"w-[100px]",children:"Type"}),r.jsx(Mt,{className:"w-[120px]",children:r.jsx(v,{field:"expected_price",children:"Price"})}),r.jsx(Mt,{className:"w-[120px]",children:r.jsx(v,{field:"expected_commission",children:"GCI"})}),r.jsx(Mt,{className:"w-[130px]",children:r.jsx(v,{field:"target_close_date",children:"Close Date"})}),r.jsx(Mt,{className:"w-[100px]",children:r.jsx(v,{field:"priority",children:"Priority"})})]})}),r.jsx(Fs,{children:m.map(b=>{y(b.stage_id);const N=AQt[b.deal_type],k=b.target_close_date?Iy(new Date(b.target_close_date),new Date):null,M=k!==null&&k<0,I=k!==null&&k<=7&&k>=0;return r.jsxs(Sr,{className:Ut("cursor-pointer hover:bg-muted/50 transition-colors",M&&"bg-red-50/50"),onClick:()=>n(b),children:[r.jsx(yt,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:b.deal_name}),b.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[b.contact.first_name," ",b.contact.last_name]})]})}),r.jsx(yt,{onClick:T=>T.stopPropagation(),children:r.jsx(EVe,{stages:t,currentStageId:b.stage_id||"",onStageSelect:(T,P)=>s(b.id,T,P)})}),r.jsx(yt,{children:r.jsx(At,{variant:"outline",className:Ut("text-xs",N.color),children:N.label})}),r.jsx(yt,{children:r.jsx("span",{className:"font-medium",children:x(b.expected_price)})}),r.jsx(yt,{children:r.jsx("span",{className:"text-emerald-600",children:x(b.expected_commission)})}),r.jsx(yt,{children:b.target_close_date?r.jsxs("div",{className:Ut("flex items-center gap-1 text-sm",M&&"text-red-600",I&&!M&&"text-amber-600"),children:[M&&r.jsx(yl,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:on(new Date(b.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{children:r.jsx(At,{variant:"outline",className:Ut("text-xs capitalize",b.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",b.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",b.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",b.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:b.priority})})]},b.id)})})]})})}class IQt extends A.Component{constructor(t){super(t),this.state={hasError:!1,error:null}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("DealPipeline error:",t,n)}render(){return this.state.hasError?r.jsx(Fr,{children:r.jsxs("div",{className:"flex flex-col items-center justify-center h-[60vh] gap-4 text-center px-4",children:[r.jsx("div",{className:"w-16 h-16 bg-destructive/10 rounded-full flex items-center justify-center",children:r.jsx("span",{className:"text-2xl",children:"⚠️"})}),r.jsx("h2",{className:"text-xl font-semibold",children:"Something went wrong"}),r.jsx("p",{className:"text-muted-foreground max-w-md",children:"There was an error in the deal pipeline. Click below to try again."}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),className:"px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm font-medium hover:bg-primary/90",children:"Try Again"}),r.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 border border-border rounded-md text-sm font-medium hover:bg-muted",children:"Refresh Page"})]})]})}):this.props.children}}function PQt(){var we;const e=B3(),{data:t,isLoading:n}=ove(),{data:s,isLoading:a,refetch:o}=kVe(),{data:l,isLoading:i}=QXt(),u=jVe(),m=HXt(),[x,y]=A.useState("board"),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,I]=A.useState(null),[T,P]=A.useState(null),[F,D]=A.useState(null),[U,V]=A.useState(null),[W,G]=A.useState(!1),[ee,ae]=A.useState(null);A.useEffect(()=>{!n&&t&&t.length===0&&u.mutate()},[n,t]);const oe=ve=>{I(ve),k(!0)},pe=ve=>{P(ve||null),I(null),b(!0)},ne=ve=>{I(ve),k(!1),b(!0)},fe=(ve,Xe)=>{D(ve)},se=(ve,Xe)=>{ve.preventDefault(),ve.dataTransfer.dropEffect="move",V(Xe)},me=async(ve,Xe)=>{if(ve.preventDefault(),V(null),!F)return;const Me=s==null?void 0:s.find($e=>$e.id===F),Ie=t==null?void 0:t.find($e=>$e.id===Xe);if(!Me||!Ie||Me.stage_id===Xe){D(null);return}try{if(await m.mutateAsync({dealId:F,stageId:Xe,stageName:Ie.name}),Ae.success(`Moved to ${Ie.name}`),Ie.is_won_stage&&!Me.scorecard_transaction_id){const $e={...Me,stage_id:Xe};ae($e),G(!0)}}catch{Ae.error("Failed to move deal")}D(null)},ue=A.useCallback(async(ve,Xe,Me)=>{const Ie=s==null?void 0:s.find(Be=>Be.id===ve),$e=t==null?void 0:t.find(Be=>Be.id===Xe);if(!(!Ie||!$e||Ie.stage_id===Xe))try{if(await m.mutateAsync({dealId:ve,stageId:Xe,stageName:Me}),Ae.success(`Moved to ${Me}`),$e.is_won_stage&&!Ie.scorecard_transaction_id){const Be={...Ie,stage_id:Xe};ae(Be),G(!0)}}catch{Ae.error("Failed to move deal")}},[s,t,m]),xe=ve=>(s==null?void 0:s.filter(Xe=>Xe.stage_id===ve))||[],Te=n||a,_e=e?"list":x;return r.jsxs(Fr,{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(Q,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Go,{className:"h-4 w-4"})}),!e&&r.jsx(QI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsxs(Q,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),className:"px-3 gap-1.5",children:[r.jsx(hf,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(Pp,{children:"Kanban board view"})]}),r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsxs(Q,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[r.jsx(mf,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(Pp,{children:"Grouped list view"})]}),r.jsxs(Wg,{children:[r.jsx(Gg,{asChild:!0,children:r.jsxs(Q,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[r.jsx(D4,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(Pp,{children:"Sortable table view"})]})]})}),r.jsxs(Q,{onClick:()=>pe(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(wQt,{stats:l||null,isLoading:i})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Te?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(ve=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Er,{className:"h-full rounded-xl"})},ve))}):_e==="board"?r.jsxs(Vo,{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(ve=>r.jsx(bQt,{stage:ve,deals:xe(ve.id),onDealClick:oe,onAddDeal:pe,onDragStart:fe,onDragOver:se,onDrop:me,isDragOver:U===ve.id,isWonStage:ve.is_won_stage},ve.id))}),r.jsx(iye,{orientation:"horizontal"})]}):_e==="table"?r.jsx(Vo,{className:"h-full",children:r.jsx(EQt,{deals:s||[],stages:t||[],onDealClick:oe,onStageChange:ue})}):r.jsx(Vo,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[t==null?void 0:t.map(ve=>{const Xe=xe(ve.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:ve.color}}),r.jsx("h3",{className:"font-semibold",children:ve.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(Me=>r.jsx(IVe,{deal:Me,onClick:()=>oe(Me),stages:t,onStageChange:ue,showStagePicker:!0,isWonStage:ve.is_won_stage},Me.id))})]},ve.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(hf,{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(Q,{onClick:()=>pe(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(NQt,{open:v,onOpenChange:b,deal:M,defaultStageId:T}),r.jsx(MQt,{deal:M,open:N,onOpenChange:k,onEdit:ne,isWonStage:M?(we=t==null?void 0:t.find(ve=>ve.id===M.stage_id))==null?void 0:we.is_won_stage:!1,onAddToScorecard:ve=>{ae(ve),G(!0),k(!1)}}),r.jsx(TQt,{open:W,onOpenChange:G,deal:ee,onComplete:()=>{o(),ae(null)}})]})}function LQt(){return r.jsx(IQt,{children:r.jsx(PQt,{})})}const Xpe=[{value:"video_intro",label:"Video Intro",icon:Ia,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:mA,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:qg,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:gm,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:Nc,description:"Links to your social profiles"}],OQt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],DQt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function PVe({cardId:e}){const{data:t,isLoading:n}=Uct(e),s=qct(),a=Vct(),o=Hct(),[l,i]=A.useState(!1),[u,m]=A.useState(""),[x,y]=A.useState(null);if(n)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Er,{className:"h-16 w-full"}),r.jsx(Er,{className:"h-16 w-full"})]});const v=()=>{u&&s.mutate({card_id:e,block_type:u,sort_order:(t==null?void 0:t.length)||0,config:DQt[u]||{}},{onSuccess:()=>{i(!1),m("")}})},b=T=>{a.mutate({id:T.id,is_visible:!T.is_visible})},N=(T,P)=>{if(!t)return;const F=t.findIndex(V=>V.id===T.id),D=P==="up"?F-1:F+1;if(D<0||D>=t.length)return;const U=t[D];a.mutate({id:T.id,sort_order:U.sort_order}),a.mutate({id:U.id,sort_order:T.sort_order})},k=T=>{confirm("Remove this block from this card?")&&o.mutate(T.id)},M=(T,P)=>{a.mutate({id:T.id,config:P},{onSuccess:()=>y(null)})},I=T=>Xpe.find(P=>P.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(Q,{size:"sm",onClick:()=>i(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):r.jsxs(r.Fragment,{children:[t.map((T,P)=>{const F=I(T.block_type),D=(F==null?void 0:F.icon)||qg;return r.jsx(He,{className:T.is_visible?"":"opacity-50",children:r.jsx(et,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zg,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx(D,{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:(F==null?void 0:F.label)||T.block_type}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:RQt(T)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(T,"up"),disabled:P===0,children:r.jsx(df,{className:"h-3 w-3"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(T,"down"),disabled:P===t.length-1,children:r.jsx(oy,{className:"h-3 w-3"})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>b(T),children:T.is_visible?r.jsx(_o,{className:"h-3 w-3"}):r.jsx(Fg,{className:"h-3 w-3"})}),r.jsx(Q,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(T),children:"Edit"}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>k(T),children:r.jsx(Bn,{className:"h-3 w-3"})})]})]})})},T.id)}),r.jsxs(Q,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Rr,{open:l,onOpenChange:i,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:Xpe.map(T=>{const P=T.icon;return r.jsxs("button",{onClick:()=>m(T.value),className:`flex items-center gap-3 p-3 rounded-lg border text-left transition-colors ${u===T.value?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[r.jsx(P,{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(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(Q,{onClick:v,disabled:!u||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(FQt,{block:x,onSave:T=>M(x,T),onClose:()=>y(null)})]})}function RQt(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(a=>a.platform).join(", "):"No platforms"}default:return""}}function FQt({block:e,onSave:t,onClose:n}){const[s,a]=A.useState(e.config),o=Xpe.find(l=>l.value===e.block_type);return r.jsx(Rr,{open:!0,onOpenChange:n,children:r.jsxs(Dr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsxs(Br,{children:["Edit ",o==null?void 0:o.label]})}),e.block_type==="video_intro"&&r.jsx(zQt,{config:s,onChange:a,cardId:e.card_id}),e.block_type==="testimonials"&&r.jsx(BQt,{config:s,onChange:a}),e.block_type==="specialties"&&r.jsx($Qt,{config:s,onChange:a}),e.block_type==="custom_links"&&r.jsx(UQt,{config:s,onChange:a}),e.block_type==="social_media"&&r.jsx(qQt,{config:s,onChange:a}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(Q,{onClick:()=>t(s),children:"Save"})]})]})})}function zQt({config:e,onChange:t,cardId:n}){var b,N;const[s,a]=A.useState(""),[o,l]=A.useState((b=e.video_url)!=null&&b.includes("youtube")||(N=e.video_url)!=null&&N.includes("youtu.be")?"youtube":"library"),{data:i}=Zt({queryKey:["card-owner",n],queryFn:async()=>{const{data:k}=await Y.from("agent_cards").select("user_id").eq("id",n).single();return k==null?void 0:k.user_id},enabled:!!n}),{data:u,isLoading:m}=Zt({queryKey:["agent-videos-library",i],queryFn:async()=>{const{data:k,error:M}=await Y.from("agent_videos").select("id, title, bunny_video_id, thumbnail_url, playback_url, created_at").eq("owner_user_id",i).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(M)throw M;return k||[]},enabled:!!i}),x=(u==null?void 0:u.filter(k=>!s||(k.title||"").toLowerCase().includes(s.toLowerCase())))||[],y=e.bunny_video_id,v=k=>{var P;const M=(P=k.playback_url)==null?void 0:P.match(/\/(?:play|embed)\/(\d+)\//),T=`https://iframe.mediadelivery.net/embed/${M?M[1]:"570924"}/${k.bunny_video_id}?autoplay=false&responsive=true`;t({...e,video_url:T,bunny_video_id:k.bunny_video_id,video_source:"library"})};return r.jsx("div",{className:"space-y-4",children:r.jsxs(wi,{value:o,onValueChange:l,children:[r.jsxs(_i,{className:"w-full",children:[r.jsx(sn,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(sn,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(Sn,{value:"library",className:"space-y-3 mt-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search videos...",value:s,onChange:k=>a(k.target.value),className:"pl-9"})]}),r.jsx(Vo,{className:"h-[240px]",children:m?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Er,{className:"h-14 w-full"}),r.jsx(Er,{className:"h-14 w-full"})]}):x.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:(u==null?void 0:u.length)===0?"No videos in library yet":"No matching videos"}):r.jsx("div",{className:"space-y-1.5 pr-3",children:x.map(k=>r.jsxs("button",{onClick:()=>v(k),className:`w-full flex items-center gap-3 p-2 rounded-lg border text-left transition-colors ${y===k.bunny_video_id?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[k.thumbnail_url?r.jsx("img",{src:k.thumbnail_url,alt:"",className:"h-10 w-16 rounded object-cover flex-shrink-0 bg-muted",onError:M=>{var I;M.currentTarget.style.display="none",(I=M.currentTarget.nextElementSibling)==null||I.classList.remove("hidden")}}):null,r.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${k.thumbnail_url?"hidden":""}`,children:r.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate flex-1",children:k.title||"Untitled Video"}),y===k.bunny_video_id&&r.jsx(mi,{className:"h-4 w-4 text-primary flex-shrink-0"})]},k.id))})})]}),r.jsx(Sn,{value:"youtube",className:"space-y-3 mt-3",children:r.jsxs("div",{children:[r.jsx(ze,{children:"YouTube URL"}),r.jsx(lt,{placeholder:"https://www.youtube.com/watch?v=...",value:e.video_source==="youtube"&&e.video_url||"",onChange:k=>t({...e,video_url:k.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 BQt({config:e,onChange:t}){const n=e.testimonials||[],s=(l,i,u)=>{const m=[...n];m[l]={...m[l],[i]:u},t({...e,testimonials:m})},a=()=>t({...e,testimonials:[...n,{name:"",quote:"",role:""}]}),o=l=>t({...e,testimonials:n.filter((i,u)=>u!==l)});return r.jsxs("div",{className:"space-y-4",children:[n.map((l,i)=>r.jsx(He,{children:r.jsxs(et,{className:"p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ze,{className:"text-xs font-medium",children:["Testimonial ",i+1]}),n.length>1&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(i),children:r.jsx(Bn,{className:"h-3 w-3"})})]}),r.jsx(lt,{placeholder:"Client name",value:l.name,onChange:u=>s(i,"name",u.target.value)}),r.jsx(lt,{placeholder:"Role/title (optional)",value:l.role||"",onChange:u=>s(i,"role",u.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:u=>s(i,"quote",u.target.value)})]})},i)),r.jsxs(Q,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function $Qt({config:e,onChange:t}){const n=e.tags||[],[s,a]=A.useState(""),o=i=>{t({...e,tags:n.includes(i)?n.filter(u=>u!==i):[...n,i]})},l=()=>{s.trim()&&!n.includes(s.trim())&&(t({...e,tags:[...n,s.trim()]}),a(""))};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{className:"text-sm mb-2 block",children:"Preset Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:OQt.map(i=>r.jsx("button",{onClick:()=>o(i),className:`px-3 py-1.5 text-xs rounded-full border transition-colors ${n.includes(i)?"bg-primary text-primary-foreground border-primary":"bg-muted border-border hover:bg-muted/80"}`,children:i},i))})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-sm mb-2 block",children:"Custom Tag"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{placeholder:"Add your own...",value:s,onChange:i=>a(i.target.value),onKeyDown:i=>i.key==="Enter"&&(i.preventDefault(),l())}),r.jsx(Q,{variant:"outline",size:"sm",onClick:l,children:"Add"})]})]}),n.length>0&&r.jsxs("div",{children:[r.jsxs(ze,{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(i=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-primary/10 text-primary rounded-full",children:[i,r.jsx("button",{onClick:()=>o(i),className:"hover:text-destructive",children:"×"})]},i))})]})]})}function UQt({config:e,onChange:t}){const n=e.links||[],s=(l,i,u)=>{const m=[...n];m[l]={...m[l],[i]:u},t({...e,links:m})},a=()=>t({...e,links:[...n,{label:"",url:""}]}),o=l=>t({...e,links:n.filter((i,u)=>u!==l)});return r.jsxs("div",{className:"space-y-3",children:[n.map((l,i)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(lt,{placeholder:"Button label",value:l.label,onChange:u=>s(i,"label",u.target.value)}),r.jsx(lt,{placeholder:"https://...",value:l.url,onChange:u=>s(i,"url",u.target.value)})]}),n.length>1&&r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(i),children:r.jsx(Bn,{className:"h-3 w-3"})})]},i)),r.jsxs(Q,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(_n,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const NTe=[{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"},{value:"spotify",label:"Spotify"},{value:"apple_music",label:"Apple Music"}];function qQt({config:e,onChange:t}){const n=e.platforms||[],s=u=>{n.find(m=>m.platform===u)||t({...e,platforms:[...n,{platform:u,url:""}]})},a=(u,m)=>{const x=[...n];x[u]={...x[u],url:m},t({...e,platforms:x})},o=u=>{t({...e,platforms:n.filter((m,x)=>x!==u)})},l=NTe.filter(u=>!n.find(m=>m.platform===u.value)),i=u=>{const m=ume[u],x=NTe.find(y=>y.value===u);return{label:(x==null?void 0:x.label)||u,color:(m==null?void 0:m.color)||"#666",iconPath:m==null?void 0:m.icon}};return r.jsxs("div",{className:"space-y-4",children:[n.length>0&&r.jsx("div",{className:"space-y-3",children:n.map((u,m)=>{const x=i(u.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(lt,{placeholder:`Your ${x.label} profile URL`,value:u.url,onChange:y=>a(m,y.target.value)})}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(m),children:r.jsx(Bn,{className:"h-3.5 w-3.5"})})]},m)})}),l.length>0&&r.jsxs("div",{children:[r.jsx(ze,{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(u=>{const m=ume[u.value];return r.jsxs("button",{onClick:()=>s(u.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:[(m==null?void 0:m.icon)&&r.jsx("svg",{viewBox:"0 0 24 24",width:12,height:12,fill:m.color,children:r.jsx("path",{d:m.icon})}),u.label]},u.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 VQt=Object.defineProperty,Qne=Object.getOwnPropertySymbols,LVe=Object.prototype.hasOwnProperty,OVe=Object.prototype.propertyIsEnumerable,STe=(e,t,n)=>t in e?VQt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qpe=(e,t)=>{for(var n in t||(t={}))LVe.call(t,n)&&STe(e,n,t[n]);if(Qne)for(var n of Qne(t))OVe.call(t,n)&&STe(e,n,t[n]);return e},Jpe=(e,t)=>{var n={};for(var s in e)LVe.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Qne)for(var s of Qne(e))t.indexOf(s)<0&&OVe.call(e,s)&&(n[s]=e[s]);return n};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var kk;(e=>{const t=class Fi{constructor(u,m,x,y){if(this.version=u,this.errorCorrectionLevel=m,this.modules=[],this.isFunction=[],uFi.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=u*4+17;let v=[];for(let N=0;N7)throw new RangeError("Invalid value");let N,k;for(N=x;;N++){const P=Fi.getNumDataCodewords(N,m)*8,F=l.getTotalBits(u,N);if(F<=P){k=F;break}if(N>=y)throw new RangeError("Data too long")}for(const P of[Fi.Ecc.MEDIUM,Fi.Ecc.QUARTILE,Fi.Ecc.HIGH])b&&k<=Fi.getNumDataCodewords(N,P)*8&&(m=P);let M=[];for(const P of u){n(P.mode.modeBits,4,M),n(P.numChars,P.mode.numCharCountBits(N),M);for(const F of P.getData())M.push(F)}a(M.length==k);const I=Fi.getNumDataCodewords(N,m)*8;a(M.length<=I),n(0,Math.min(4,I-M.length),M),n(0,(8-M.length%8)%8,M),a(M.length%8==0);for(let P=236;M.lengthT[F>>>3]|=P<<7-(F&7)),new Fi(N,m,T,v)}getModule(u,m){return 0<=u&&u>>9)*1335;const y=(m<<10|x)^21522;a(y>>>15==0);for(let v=0;v<=5;v++)this.setFunctionModule(8,v,s(y,v));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(let v=9;v<15;v++)this.setFunctionModule(14-v,8,s(y,v));for(let v=0;v<8;v++)this.setFunctionModule(this.size-1-v,8,s(y,v));for(let v=8;v<15;v++)this.setFunctionModule(8,this.size-15+v,s(y,v));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let u=this.version;for(let x=0;x<12;x++)u=u<<1^(u>>>11)*7973;const m=this.version<<12|u;a(m>>>18==0);for(let x=0;x<18;x++){const y=s(m,x),v=this.size-11+x%3,b=Math.floor(x/3);this.setFunctionModule(v,b,y),this.setFunctionModule(b,v,y)}}drawFinderPattern(u,m){for(let x=-4;x<=4;x++)for(let y=-4;y<=4;y++){const v=Math.max(Math.abs(y),Math.abs(x)),b=u+y,N=m+x;0<=b&&b{(P!=k-v||D>=N)&&T.push(F[P])});return a(T.length==b),T}drawCodewords(u){if(u.length!=Math.floor(Fi.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let m=0;for(let x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(let y=0;y>>3],7-(m&7)),m++)}}a(m==u.length*8)}applyMask(u){if(u<0||u>7)throw new RangeError("Mask value out of range");for(let m=0;m5&&u++):(this.finderPenaltyAddHistory(N,k),b||(u+=this.finderPenaltyCountPatterns(k)*Fi.PENALTY_N3),b=this.modules[v][M],N=1);u+=this.finderPenaltyTerminateAndCount(b,N,k)*Fi.PENALTY_N3}for(let v=0;v5&&u++):(this.finderPenaltyAddHistory(N,k),b||(u+=this.finderPenaltyCountPatterns(k)*Fi.PENALTY_N3),b=this.modules[M][v],N=1);u+=this.finderPenaltyTerminateAndCount(b,N,k)*Fi.PENALTY_N3}for(let v=0;vb+(N?1:0),m);const x=this.size*this.size,y=Math.ceil(Math.abs(m*20-x*10)/x)-1;return a(0<=y&&y<=9),u+=y*Fi.PENALTY_N4,a(0<=u&&u<=2568888),u}getAlignmentPatternPositions(){if(this.version==1)return[];{const u=Math.floor(this.version/7)+2,m=this.version==32?26:Math.ceil((this.version*4+4)/(u*2-2))*2;let x=[6];for(let y=this.size-7;x.lengthFi.MAX_VERSION)throw new RangeError("Version number out of range");let m=(16*u+128)*u+64;if(u>=2){const x=Math.floor(u/7)+2;m-=(25*x-10)*x-55,u>=7&&(m-=36)}return a(208<=m&&m<=29648),m}static getNumDataCodewords(u,m){return Math.floor(Fi.getNumRawDataModules(u)/8)-Fi.ECC_CODEWORDS_PER_BLOCK[m.ordinal][u]*Fi.NUM_ERROR_CORRECTION_BLOCKS[m.ordinal][u]}static reedSolomonComputeDivisor(u){if(u<1||u>255)throw new RangeError("Degree out of range");let m=[];for(let y=0;y0);for(const y of u){const v=y^x.shift();x.push(0),m.forEach((b,N)=>x[N]^=Fi.reedSolomonMultiply(b,v))}return x}static reedSolomonMultiply(u,m){if(u>>>8||m>>>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^=(m>>>y&1)*u;return a(x>>>8==0),x}finderPenaltyCountPatterns(u){const m=u[1];a(m<=this.size*3);const x=m>0&&u[2]==m&&u[3]==m*3&&u[4]==m&&u[5]==m;return(x&&u[0]>=m*4&&u[6]>=m?1:0)+(x&&u[6]>=m*4&&u[0]>=m?1:0)}finderPenaltyTerminateAndCount(u,m,x){return u&&(this.finderPenaltyAddHistory(m,x),m=0),m+=this.size,this.finderPenaltyAddHistory(m,x),this.finderPenaltyCountPatterns(x)}finderPenaltyAddHistory(u,m){m[0]==0&&(u+=this.size),m.pop(),m.unshift(u)}};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(i,u,m){if(u<0||u>31||i>>>u)throw new RangeError("Value out of range");for(let x=u-1;x>=0;x--)m.push(i>>>x&1)}function s(i,u){return(i>>>u&1)!=0}function a(i){if(!i)throw new Error("Assertion error")}const o=class Zl{constructor(u,m,x){if(this.mode=u,this.numChars=m,this.bitData=x,m<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}static makeBytes(u){let m=[];for(const x of u)n(x,8,m);return new Zl(Zl.Mode.BYTE,u.length,m)}static makeNumeric(u){if(!Zl.isNumeric(u))throw new RangeError("String contains non-numeric characters");let m=[];for(let x=0;x=1<{(t=>{const n=class{constructor(a,o){this.ordinal=a,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={}))})(kk||(kk={}));(e=>{(t=>{const n=class{constructor(a,o){this.modeBits=a,this.numBitsCharCount=o}numCharCountBits(a){return this.numBitsCharCount[Math.floor((a+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={}))})(kk||(kk={}));var u4=kk;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var HQt={L:u4.QrCode.Ecc.LOW,M:u4.QrCode.Ecc.MEDIUM,Q:u4.QrCode.Ecc.QUARTILE,H:u4.QrCode.Ecc.HIGH},DVe=128,RVe="L",FVe="#FFFFFF",zVe="#000000",BVe=!1,$Ve=1,WQt=4,GQt=0,KQt=.1;function UVe(e,t=0){const n=[];return e.forEach(function(s,a){let o=null;s.forEach(function(l,i){if(!l&&o!==null){n.push(`M${o+t} ${a+t}h${i-o}v1H${o+t}z`),o=null;return}if(i===s.length-1){if(!l)return;o===null?n.push(`M${i+t},${a+t} h1v1H${i+t}z`):n.push(`M${o+t},${a+t} h${i+1-o}v1H${o+t}z`);return}l&&o===null&&(o=i)})}),n.join("")}function qVe(e,t){return e.slice().map((n,s)=>s=t.y+t.h?n:n.map((a,o)=>o=t.x+t.w?a:!1))}function ZQt(e,t,n,s){if(s==null)return null;const a=e.length+n*2,o=Math.floor(t*KQt),l=a/t,i=(s.width||o)*l,u=(s.height||o)*l,m=s.x==null?e.length/2-i/2:s.x*l,x=s.y==null?e.length/2-u/2:s.y*l,y=s.opacity==null?1:s.opacity;let v=null;if(s.excavate){let N=Math.floor(m),k=Math.floor(x),M=Math.ceil(i+m-N),I=Math.ceil(u+x-k);v={x:N,y:k,w:M,h:I}}const b=s.crossOrigin;return{x:m,y:x,h:u,w:i,excavation:v,opacity:y,crossOrigin:b}}function YQt(e,t){return t!=null?Math.max(Math.floor(t),0):e?WQt:GQt}function VVe({value:e,level:t,minVersion:n,includeMargin:s,marginSize:a,imageSettings:o,size:l,boostLevel:i}){let u=dt.useMemo(()=>{const N=(Array.isArray(e)?e:[e]).reduce((k,M)=>(k.push(...u4.QrSegment.makeSegments(M)),k),[]);return u4.QrCode.encodeSegments(N,HQt[t],n,void 0,void 0,i)},[e,t,n,i]);const{cells:m,margin:x,numCells:y,calculatedImageSettings:v}=dt.useMemo(()=>{let b=u.getModules();const N=YQt(s,a),k=b.length+N*2,M=ZQt(b,l,N,o);return{cells:b,margin:N,numCells:k,calculatedImageSettings:M}},[u,l,o,s,a]);return{qrcode:u,margin:x,cells:m,numCells:y,calculatedImageSettings:v}}var XQt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),QQt=dt.forwardRef(function(t,n){const s=t,{value:a,size:o=DVe,level:l=RVe,bgColor:i=FVe,fgColor:u=zVe,includeMargin:m=BVe,minVersion:x=$Ve,boostLevel:y,marginSize:v,imageSettings:b}=s,k=Jpe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:M}=k,I=Jpe(k,["style"]),T=b==null?void 0:b.src,P=dt.useRef(null),F=dt.useRef(null),D=dt.useCallback(ne=>{P.current=ne,typeof n=="function"?n(ne):n&&(n.current=ne)},[n]),[U,V]=dt.useState(!1),{margin:W,cells:G,numCells:ee,calculatedImageSettings:ae}=VVe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:m,marginSize:v,imageSettings:b,size:o});dt.useEffect(()=>{if(P.current!=null){const ne=P.current,fe=ne.getContext("2d");if(!fe)return;let se=G;const me=F.current,ue=ae!=null&&me!==null&&me.complete&&me.naturalHeight!==0&&me.naturalWidth!==0;ue&&ae.excavation!=null&&(se=qVe(G,ae.excavation));const xe=window.devicePixelRatio||1;ne.height=ne.width=o*xe;const Te=o/ee*xe;fe.scale(Te,Te),fe.fillStyle=i,fe.fillRect(0,0,ee,ee),fe.fillStyle=u,XQt?fe.fill(new Path2D(UVe(se,W))):G.forEach(function(_e,we){_e.forEach(function(ve,Xe){ve&&fe.fillRect(Xe+W,we+W,1,1)})}),ae&&(fe.globalAlpha=ae.opacity),ue&&fe.drawImage(me,ae.x+W,ae.y+W,ae.w,ae.h)}}),dt.useEffect(()=>{V(!1)},[T]);const oe=Qpe({height:o,width:o},M);let pe=null;return T!=null&&(pe=dt.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{V(!0)},ref:F,crossOrigin:ae==null?void 0:ae.crossOrigin})),dt.createElement(dt.Fragment,null,dt.createElement("canvas",Qpe({style:oe,height:o,width:o,ref:D,role:"img"},I)),pe)});QQt.displayName="QRCodeCanvas";var HVe=dt.forwardRef(function(t,n){const s=t,{value:a,size:o=DVe,level:l=RVe,bgColor:i=FVe,fgColor:u=zVe,includeMargin:m=BVe,minVersion:x=$Ve,boostLevel:y,title:v,marginSize:b,imageSettings:N}=s,k=Jpe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:M,cells:I,numCells:T,calculatedImageSettings:P}=VVe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:m,marginSize:b,imageSettings:N,size:o});let F=I,D=null;N!=null&&P!=null&&(P.excavation!=null&&(F=qVe(I,P.excavation)),D=dt.createElement("image",{href:N.src,height:P.h,width:P.w,x:P.x+M,y:P.y+M,preserveAspectRatio:"none",opacity:P.opacity,crossOrigin:P.crossOrigin}));const U=UVe(F,M);return dt.createElement("svg",Qpe({height:o,width:o,viewBox:`0 0 ${T} ${T}`,ref:n,role:"img"},k),!!v&&dt.createElement("title",null,v),dt.createElement("path",{fill:i,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),dt.createElement("path",{fill:u,d:U,shapeRendering:"crispEdges"}),D)});HVe.displayName="QRCodeSVG";function JQt({slug:e,agentName:t}){const n=A.useRef(null),s=`https://cards.relevelup.com/${e}`,a=A.useCallback(()=>{var y;const o=(y=n.current)==null?void 0:y.querySelector("svg");if(!o)return;const l=document.createElement("canvas"),i=1024;l.width=i,l.height=i;const u=l.getContext("2d");if(!u)return;const m=new XMLSerializer().serializeToString(o),x=new Image;x.onload=()=>{u.fillStyle="#ffffff",u.fillRect(0,0,i,i),u.drawImage(x,0,0,i,i);const v=document.createElement("a");v.download=`${e}-qr-code.png`,v.href=l.toDataURL("image/png"),v.click(),Ae.success("QR code downloaded!")},x.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(m)))},[e]);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{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(HVe,{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(Q,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[r.jsx(so,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function pue(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,bold_theme_colors:e.bold_theme_colors||null}}function eJt(){const{user:e}=tn(),{data:t,isLoading:n}=zct(e==null?void 0:e.id),s=B3(),[a,o]=A.useState(null),l=A.useMemo(()=>a||(t?pue(t):null),[a,t]);if(n)return r.jsx(Fr,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Er,{className:"h-8 w-48"}),r.jsx(Er,{className:"h-32 w-full"}),r.jsx(Er,{className:"h-32 w-full"})]})});if(!t)return r.jsx(Fr,{children:r.jsx(rJt,{userId:e==null?void 0:e.id})});const i=l||pue(t),u=m=>{o(x=>{const y=x||pue(t);return typeof m=="function"?m(y):m})};return r.jsx(Fr,{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(nJt,{card:t}),r.jsx(oJt,{card:t,form:i,setForm:u})]}),!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(Bj,{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(tJt,{card:t,form:i})})]})})]})})}function tJt({card:e,form:t}){const{data:n}=Zt({queryKey:["card-preview-profile",e.user_id],queryFn:async()=>{const{data:a}=await Y.from("profiles").select("name, email, phone, avatar_url, brokerage_id").eq("id",e.user_id).single();let o=(a==null?void 0:a.avatar_url)||null;if(!o){const{data:l}=await Y.storage.from("avatars").list(`${e.user_id}`);if(l&&l.length>0){const{data:i}=Y.storage.from("avatars").getPublicUrl(`${e.user_id}/${l[0].name}`);o=`${i.publicUrl}?t=${Date.now()}`}}return{...a,avatar_url:o}}}),s=A.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,bold_theme_colors:t.bold_theme_colors||null,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(Jxe,{card:s})})}function rJt({userId:e}){var u;const[t,n]=A.useState(""),s=A8e(),{data:a}=Zt({queryKey:["my-profile-for-card",e],queryFn:async()=>{if(!e)return null;const{data:m}=await Y.from("profiles").select("name").eq("id",e).single();return m},enabled:!!e}),o=((u=a==null?void 0:a.name)==null?void 0:u.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||"",l=()=>{if(!e)return;const m=(t.trim()||o).toLowerCase().replace(/[^a-z0-9-]/g,"-");if(!m){Ae.error("Please enter a URL slug for your card");return}s.mutate({user_id:e,slug:m,is_published:!0},{onSuccess:()=>Ae.success("Your digital card has been created!")})},i=[{icon:uy,title:"Shareable Link",desc:"One link that works everywhere"},{icon:Vg,title:"Lead Capture",desc:"Collect leads automatically"},{icon:vm,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:Vc,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(Os,{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:i.map(m=>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(m.icon,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:m.title}),r.jsx("p",{className:"text-xs text-muted-foreground",children:m.desc})]})]},m.title))}),r.jsxs(He,{className:"shadow-lg border-2",children:[r.jsxs(Ht,{className:"text-center pb-2",children:[r.jsx(Gt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(jn,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(et,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx(ze,{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(lt,{value:t||o,onChange:m=>n(m.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),r.jsxs(Q,{onClick:l,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(Os,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function nJt({card:e}){const n=`https://cards.relevelup.com/${e.slug}`,s=()=>{navigator.clipboard.writeText(n),Ae.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(At,{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(uy,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",e.slug]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[r.jsx(Po,{className:"h-3.5 w-3.5"})," Copy Link"]}),r.jsx(Q,{size:"sm",asChild:!0,className:"gap-1.5",children:r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Ss,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function sJt({userId:e}){const t=Vr(),n=A.useRef(null),[s,a]=A.useState(!1),[o,l]=A.useState(""),{data:i,isLoading:u}=Zt({queryKey:["card-editor-profile",e],queryFn:async()=>{const{data:ae}=await Y.from("profiles").select("name, email, phone, avatar_url").eq("id",e).single();let oe=(ae==null?void 0:ae.avatar_url)||null;if(!oe){const{data:pe}=await Y.storage.from("avatars").list(`${e}`);if(pe&&pe.length>0){const{data:ne}=Y.storage.from("avatars").getPublicUrl(`${e}/${pe[0].name}`);oe=`${ne.publicUrl}?t=${Date.now()}`,await Y.from("profiles").update({avatar_url:oe}).eq("id",e)}}return{...ae,avatar_url:oe}}}),[m,x]=A.useState(null),[y,v]=A.useState(null),[b,N]=A.useState(null),[k,M]=A.useState(!1),I=m??(i==null?void 0:i.name)??"",T=y??(i==null?void 0:i.phone)??"",P=b??(i==null?void 0:i.email)??"",F=i==null?void 0:i.avatar_url,D=((i==null?void 0:i.name)||"A").split(" ").map(ae=>ae[0]).join("").toUpperCase().slice(0,2),U=!(i!=null&&i.avatar_url)||!(i!=null&&i.phone),V=ar({mutationFn:async ae=>{const{error:oe}=await Y.from("profiles").update(ae).eq("id",e);if(oe)throw oe},onSuccess:()=>{t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),Ae.success("Profile updated!")},onError:()=>Ae.error("Failed to update profile")}),W=()=>{const ae={};if(m!==null&&m!==(i==null?void 0:i.name)&&(ae.name=m),y!==null&&y!==(i==null?void 0:i.phone)&&(ae.phone=y||null),b!==null&&b!==(i==null?void 0:i.email)&&(ae.email=b),Object.keys(ae).length===0){Ae.info("No changes to save");return}V.mutate(ae)},G=ae=>{var ne;const oe=(ne=ae.target.files)==null?void 0:ne[0];if(!oe)return;if(!oe.type.startsWith("image/")){Ae.error("Please select an image file");return}const pe=new FileReader;pe.onloadend=()=>{l(pe.result),a(!0)},pe.readAsDataURL(oe),ae.target.value=""},ee=async ae=>{M(!0);try{const{data:oe}=await Y.storage.from("avatars").list(`${e}`);oe&&oe.length>0&&await Y.storage.from("avatars").remove(oe.map(me=>`${e}/${me.name}`));const pe=`${e}/avatar.jpg`,{error:ne}=await Y.storage.from("avatars").upload(pe,ae,{upsert:!0,contentType:"image/jpeg"});if(ne)throw ne;const{data:fe}=Y.storage.from("avatars").getPublicUrl(pe),se=fe.publicUrl+"?t="+Date.now();await Y.from("profiles").update({avatar_url:se}).eq("id",e),t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),Ae.success("Photo updated!")}catch{Ae.error("Failed to upload photo")}finally{M(!1)}};return u?r.jsx(Er,{className:"h-32 w-full rounded-xl"}):r.jsxs(r.Fragment,{children:[r.jsx(He,{className:U?"border-amber-300 dark:border-amber-700":"",children:r.jsxs(et,{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(ze,{className:"text-sm font-semibold",children:"Profile Info"}),U&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[r.jsx(yl,{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(ea,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(Ci,{src:F||void 0,alt:I}),r.jsx(ta,{className:"text-lg font-semibold bg-primary/10 text-primary",children:D})]}),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(Rg,{className:"h-5 w-5 text-white"})}),r.jsx("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:G})]}),r.jsxs("div",{className:"flex-1 space-y-0.5",children:[r.jsx("p",{className:"text-sm font-medium",children:k?"Uploading...":F?"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(ze,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),r.jsx(lt,{value:I,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(ze,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),r.jsx(lt,{value:T,onChange:ae=>v(ae.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),r.jsx(lt,{value:P,onChange:ae=>N(ae.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(Q,{variant:"outline",size:"sm",onClick:W,disabled:V.isPending,className:"w-full",children:V.isPending?"Saving...":"Update Profile Info"})]})}),r.jsx(S0e,{open:s,onClose:()=>a(!1),imageSrc:o,onCropComplete:ee,aspectRatio:1})]})}function aJt({form:e,setForm:t,userId:n}){const[s,a]=A.useState(null),[o,l]=A.useState(e.brokerage_logo_url?"logo":"name"),[i,u]=A.useState(e.team_logo_url?"logo":"name"),m=b=>{l(b),t(b==="name"?N=>({...N,brokerage_logo_url:""}):N=>({...N,brokerage_display_name:""}))},x=b=>{u(b),t(b==="name"?N=>({...N,team_logo_url:""}):N=>({...N,team_name:""}))},y=async(b,N)=>{var M;const k=(M=b.target.files)==null?void 0:M[0];if(k){if(!k.type.startsWith("image/")){Ae.error("Please select an image file");return}a(N);try{const I=k.name.split(".").pop()||"png",P=`${n}/${N==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${I}`,{error:F}=await Y.storage.from("card-logos").upload(P,k,{upsert:!0});if(F)throw F;const{data:D}=Y.storage.from("card-logos").getPublicUrl(P),U=D.publicUrl+"?t="+Date.now();t(N==="brokerage_logo_url"?V=>({...V,[N]:U,brokerage_display_name:""}):V=>({...V,[N]:U,team_name:""})),Ae.success("Logo uploaded!")}catch{Ae.error("Failed to upload logo")}finally{a(null),b.target.value=""}}},v=b=>{t(N=>({...N,[b]:""}))};return r.jsx(He,{children:r.jsxs(et,{className:"p-5 space-y-5",children:[r.jsxs("div",{children:[r.jsx(ze,{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(ze,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{type:"button",variant:o==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>m("name"),children:"Use Name"}),r.jsx(Q,{type:"button",variant:o==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>m("logo"),children:"Use Logo"})]}),o==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Name"}),r.jsx(lt,{value:e.brokerage_display_name,onChange:b=>t(N=>({...N,brokerage_display_name:b.target.value})),placeholder:"e.g. Keller Williams Realty",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{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:()=>v("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(Rg,{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:b=>y(b,"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(ze,{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(Np,{value:[e.brokerage_logo_size||56],onValueChange:([b])=>t(N=>({...N,brokerage_logo_size:b})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(ze,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Q,{type:"button",variant:i==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("name"),children:"Use Name"}),r.jsx(Q,{type:"button",variant:i==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("logo"),children:"Use Logo"})]}),i==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-xs font-medium text-muted-foreground",children:"Team Name"}),r.jsx(lt,{value:e.team_name,onChange:b=>t(N=>({...N,team_name:b.target.value})),placeholder:"e.g. The Smith Group",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{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:()=>v("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(Rg,{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:b=>y(b,"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(ze,{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(Np,{value:[e.team_logo_size||56],onValueChange:([b])=>t(N=>({...N,team_logo_size:b})),min:24,max:120,step:4})]})]})]})]})})}function iJt({form:e,setForm:t}){const n={accent:"#ff5722",dark:"#1a1a2e",button:"#ff5722"},s=e.bold_theme_colors||n,a=(i,u)=>{t(m=>({...m,bold_theme_colors:{...n,...m.bold_theme_colors,[i]:u}}))},o=()=>{t(i=>({...i,bold_theme_colors:null}))},l=[{key:"accent",label:"Accent Color",desc:"Page background, icons, highlights"},{key:"dark",label:"Dark Color",desc:"Header background, action buttons, social icons"},{key:"button",label:"CTA Button Color",desc:"Main call-to-action button"}];return r.jsxs("div",{className:"space-y-3 p-4 rounded-xl border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(ze,{className:"text-sm font-semibold flex items-center gap-1.5",children:[r.jsx(Vc,{className:"h-4 w-4"})," Brand Colors"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Customize colors to match your brand"})]}),r.jsx(Q,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:o,children:"Reset to Default"})]}),r.jsx("div",{className:"grid gap-3",children:l.map(({key:i,label:u,desc:m})=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("label",{className:"relative shrink-0",children:[r.jsx("input",{type:"color",value:s[i],onChange:x=>a(i,x.target.value),className:"sr-only"}),r.jsx("div",{className:"h-10 w-10 rounded-lg border-2 border-border cursor-pointer shadow-sm hover:scale-105 transition-transform",style:{backgroundColor:s[i]}})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:u}),r.jsx("p",{className:"text-xs text-muted-foreground",children:m})]}),r.jsx(lt,{value:s[i],onChange:x=>{const y=x.target.value;/^#[0-9a-fA-F]{0,6}$/.test(y)&&a(i,y)},className:"w-24 h-8 text-xs font-mono",placeholder:"#ff5722"})]},i))}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Preview:"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.accent}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.dark}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.button}})]})]})]})}function oJt({card:e,form:t,setForm:n}){var v;const s=E8e(),a=Vr(),{data:o}=I8e(e.id),[l,i]=A.useState(e.slug),[u,m]=A.useState(!1),x=async()=>{const b=l.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!b){Ae.error("Please enter a valid URL");return}if(b===e.slug){Ae.info("No changes to save");return}m(!0);try{const{data:N}=await Y.from("agent_cards").select("id").eq("slug",b).neq("id",e.id).maybeSingle();if(N){Ae.error("This URL is already taken. Try another one.");return}const{error:k}=await Y.from("agent_cards").update({slug:b}).eq("id",e.id);if(k)throw k;i(b),a.invalidateQueries({queryKey:["agent-card"]}),Ae.success("Card address updated!")}catch{Ae.error("Failed to update card address")}finally{m(!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,bold_theme_colors:t.bold_theme_colors||null},{onSuccess:()=>Ae.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(wi,{defaultValue:"content",children:[r.jsxs(_i,{className:"w-full h-11 p-1",children:[r.jsxs(sn,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(uf,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(sn,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(_o,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(sn,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Vg,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(sn,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(yA,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(sn,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Z1,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),r.jsxs(Sn,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(sJt,{userId:e.user_id}),r.jsx(aJt,{form:t,setForm:n,userId:e.user_id}),r.jsx(He,{children:r.jsxs(et,{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(ze,{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(As,{checked:t.is_published,onCheckedChange:b=>n(N=>({...N,is_published:b}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{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(lt,{value:l,onChange:b=>i(b.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"your-name",className:"rounded-l-none h-10"})]}),r.jsx(Q,{variant:"outline",size:"sm",onClick:x,disabled:u||l===e.slug,className:"shrink-0",children:u?"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(ze,{className:"text-sm font-medium",children:"Theme"}),r.jsxs(un,{value:t.theme,onValueChange:b=>n(N=>({...N,theme:b})),children:[r.jsx(ln,{className:"h-11",children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"standard",children:"✨ Standard — Modern & Clean"}),r.jsx($t,{value:"luxury",children:"🌙 Luxury — Dark & Gold"}),r.jsx($t,{value:"bold",children:"🔥 Bold — Vibrant & Punchy"}),r.jsx($t,{value:"classic",children:"📋 Classic — Professional"})]})]})]}),t.theme==="bold"&&r.jsx(iJt,{form:t,setForm:n}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(lt,{value:t.title,onChange:b=>n(N=>({...N,title:b.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(ze,{className:"text-sm font-medium",children:"Positioning Statement"}),r.jsx(lt,{value:t.positioning_statement,onChange:b=>n(N=>({...N,positioning_statement:b.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-sm font-medium",children:"Bio"}),r.jsx(Zn,{value:t.bio,onChange:b=>n(N=>({...N,bio:b.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(ze,{className:"text-sm font-medium",children:"Review Snippet"}),r.jsx(lt,{value:t.review_snippet,onChange:b=>n(N=>({...N,review_snippet:b.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-sm font-medium",children:"Review Source URL"}),r.jsx(lt,{value:t.review_source_url,onChange:b=>n(N=>({...N,review_source_url:b.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{className:"text-sm font-medium",children:"Booking URL"}),r.jsx(lt,{value:t.booking_url,onChange:b=>n(N=>({...N,booking_url:b.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(ze,{className:"text-sm font-medium",children:"Custom CTA Label"}),r.jsx(lt,{value:t.custom_cta_label,onChange:b=>n(N=>({...N,custom_cta_label:b.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(Sn,{value:"sections",className:"mt-4",children:r.jsx(He,{children:r.jsx(et,{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:b,label:N,desc:k})=>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(ze,{className:"text-sm font-medium",children:N}),r.jsx("p",{className:"text-xs text-muted-foreground",children:k})]}),r.jsx(As,{checked:t[b],onCheckedChange:M=>n(I=>({...I,[b]:M}))})]},b))})})}),r.jsx(Sn,{value:"blocks",className:"mt-4",children:r.jsx(PVe,{cardId:e.id})}),r.jsx(Sn,{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:_o,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:Z1,color:"text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900/30"},{label:"Leads",value:((v=o==null?void 0:o.leads)==null?void 0:v.length)??0,icon:th,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(b=>r.jsx(He,{className:"overflow-hidden",children:r.jsxs(et,{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 ${b.color}`,children:r.jsx(b.icon,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:b.label})]}),r.jsx("div",{className:"text-2xl font-bold",children:b.value})]})},b.label))}),o&&o.leads.length>0&&r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsx(Gt,{className:"text-base",children:"Recent Leads"})}),r.jsx(et,{className:"pt-0 space-y-2",children:o.leads.slice(0,5).map(b=>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:b.name}),b.phone&&r.jsx("span",{className:"text-muted-foreground ml-2",children:b.phone})]}),b.intent&&r.jsx(At,{variant:"secondary",className:"text-xs",children:b.intent})]},b.id))})]}),(!o||o.leads.length===0)&&r.jsx(He,{children:r.jsxs(et,{className:"p-8 text-center",children:[r.jsx(Z1,{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(Sn,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(He,{children:r.jsx(et,{className:"p-6",children:r.jsx(JQt,{slug:e.slug})})})})]}),r.jsx(Q,{onClick:y,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:s.isPending?"Saving...":"Save Changes"})]})}function lJt(){const e=Vr(),[t,n]=A.useState(!1),[s,a]=A.useState(!1),[o,l]=A.useState(!1),{data:i,isLoading:u}=Zt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:P,error:F}=await Y.from("gmail_integrations").select("*").maybeSingle();if(F)throw F;return P}}),{data:m}=Zt({queryKey:["social-accounts"],queryFn:async()=>{const{data:{user:P}}=await Y.auth.getUser();if(!P)return[];const{data:F,error:D}=await Y.from("social_accounts").select("*").eq("user_id",P.id).order("created_at",{ascending:!1});if(D)throw D;return F}}),x=async()=>{n(!0);try{const{data:P,error:F}=await Y.functions.invoke("gmail-oauth",{body:{action:"get_auth_url"}});if(F)throw F;if(P!=null&&P.authUrl)window.location.href=P.authUrl;else throw new Error("Failed to get authorization URL")}catch(P){console.error("Gmail OAuth error:",P),Ae.error("Failed to start Gmail connection"),n(!1)}},y=async()=>{a(!0);try{const{data:P,error:F}=await Y.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(F)throw F;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),Ae.error("Failed to start connection. Make sure Meta App credentials are configured."),a(!1)}},v=async()=>{l(!0);try{const{data:P,error:F}=await Y.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(F)throw F;if(P!=null&&P.authUrl)window.location.href=P.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(P){console.error("LinkedIn OAuth error:",P),Ae.error("Failed to start LinkedIn connection. Please try again."),l(!1)}},b=ar({mutationFn:async P=>{const{error:F}=await Y.from("gmail_integrations").delete().eq("id",P);if(F)throw F},onSuccess:()=>{e.invalidateQueries({queryKey:["gmail-integration"]}),Ae.success("Gmail disconnected")},onError:()=>{Ae.error("Failed to disconnect Gmail")}}),N=ar({mutationFn:async P=>{const{error:F}=await Y.from("social_accounts").delete().eq("id",P);if(F)throw F},onSuccess:()=>{e.invalidateQueries({queryKey:["social-accounts"]}),Ae.success("Account disconnected")},onError:()=>{Ae.error("Failed to disconnect account")}}),k=!!(i!=null&&i.is_active),M=(m==null?void 0:m.filter(P=>P.platform==="facebook"))||[],I=(m==null?void 0:m.filter(P=>P.platform==="instagram"))||[],T=(m==null?void 0:m.filter(P=>P.platform==="linkedin"))||[];return r.jsx(Fr,{children:r.jsxs("div",{className:"max-w-3xl mx-auto space-y-6 animate-fade-in",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Integrations"}),r.jsx("p",{className:"text-muted-foreground",children:"Connect third-party services to supercharge your Agent OS workflow."})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-destructive/10 flex items-center justify-center",children:r.jsx(ws,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["Gmail",k&&r.jsx(At,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(jn,{children:"Send emails directly from your contact pages and auto-log them as touchpoints."})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(oi,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Send personalized emails from your Gmail account"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(oi,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Automatically log emails as activity touchpoints"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(oi,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Quick compose from any contact detail page"})]}),k?r.jsxs("div",{className:"flex items-center justify-between mt-4 p-3 rounded-lg border",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:i.gmail_email}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Gmail account"})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect Gmail?"}),r.jsx(hd,{children:"This will remove your Gmail connection. You'll need to reconnect to send emails."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>b.mutate(i.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}):r.jsxs(Q,{className:"mt-4",onClick:x,disabled:t||u,children:[t?r.jsx(Go,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ws,{className:"h-4 w-4 mr-2"}),"Connect Gmail",r.jsx(No,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-500/10 flex items-center justify-center",children:r.jsx(au,{className:"h-5 w-5 text-blue-600"})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["Facebook",M.length>0&&r.jsx(At,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(jn,{children:"Connect Facebook Pages to post content and reach your audience."})]})]})}),r.jsxs(et,{className:"space-y-3",children:[M.length>0&&r.jsx("div",{className:"space-y-2",children:M.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(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:P.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(au,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:P.page_name||P.platform_username||"Facebook Page"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Facebook Page"})]})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect Facebook?"}),r.jsx(hd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>N.mutate(P.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},P.id))}),r.jsxs(Q,{onClick:y,disabled:s,variant:"outline",className:"gap-2",children:[s?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-pink-500/10 flex items-center justify-center",children:r.jsx(_u,{className:"h-5 w-5 text-pink-600"})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["Instagram",I.length>0&&r.jsx(At,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(jn,{children:"Connect Instagram Business accounts to schedule and publish posts."})]})]})}),r.jsxs(et,{className:"space-y-3",children:[I.length>0&&r.jsx("div",{className:"space-y-2",children:I.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(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:P.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(_u,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-sm",children:["@",P.platform_username||"Instagram Account"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Instagram account"})]})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect Instagram?"}),r.jsx(hd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>N.mutate(P.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},P.id))}),r.jsxs(Q,{onClick:y,disabled:s,variant:"outline",className:"gap-2",children:[s?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),"Connect Instagram Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Instagram Business accounts must be connected to a Facebook Page."})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-700/10 flex items-center justify-center",children:r.jsx(xm,{className:"h-5 w-5 text-blue-700"})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["LinkedIn",T.length>0&&r.jsx(At,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(jn,{children:"Connect your LinkedIn profile to share content and grow your professional network."})]})]})}),r.jsxs(et,{className:"space-y-3",children:[T.length>0&&r.jsx("div",{className:"space-y-2",children:T.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(ea,{className:"h-8 w-8",children:[r.jsx(Ci,{src:P.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(xm,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:P.platform_username||"LinkedIn Account"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected LinkedIn profile"})]})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect LinkedIn?"}),r.jsx(hd,{children:"This will remove your LinkedIn connection. You'll need to reconnect to post content."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>N.mutate(P.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},P.id))}),r.jsxs(Q,{onClick:v,disabled:o,variant:"outline",className:"gap-2",children:[o?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),"Connect LinkedIn"]})]})]})]})})}function cJt(){const[e]=Zc(),t=Vn(),[n,s]=A.useState("loading"),[a,o]=A.useState("Connecting your Gmail account...");return A.useEffect(()=>{(async()=>{const i=e.get("code"),u=e.get("error"),m=e.get("error_description"),x=e.get("state");if(u){s("error"),o(m||"Authorization was denied"),Ae.error("Connection failed: "+(m||u));return}if(!i){s("error"),o("No authorization code received"),Ae.error("No authorization code received");return}try{const{data:y,error:v}=await Y.functions.invoke("gmail-oauth",{body:{action:"exchange_code",code:i,state:x}});if(v)throw v;if(y!=null&&y.success)s("success"),o(y.message||"Gmail connected successfully!"),Ae.success("Gmail connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Gmail OAuth callback error:",y),s("error"),o(y instanceof Error?y.message:"Failed to connect Gmail"),Ae.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(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(Gr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(oi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(jn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(Q,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"Back to Integrations":"Try Again"})})]})})}function dJt(){const e=Vn();return A.useEffect(()=>{const t=setTimeout(()=>{e("/mission-control/integrations",{replace:!0})},1500);return()=>clearTimeout(t)},[e]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Finishing Canva connection…"})]})})}function uJt(){const[e]=Zc(),t=Vn(),[n,s]=A.useState("loading"),[a,o]=A.useState("Processing your connection...");return A.useEffect(()=>{(async()=>{var y;const i=e.get("code"),u=e.get("error"),m=e.get("error_description"),x=e.get("state");if(u){s("error"),o(m||"Authorization was denied"),Ae.error("Connection failed: "+(m||u));return}if(!i){s("error"),o("No authorization code received"),Ae.error("No authorization code received");return}try{const{data:v,error:b}=await Y.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x,callbackPath:"/mission-control/integrations/meta/callback"}});if(b)throw b;if(v!=null&&v.success)s("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||0} account(s)!`),Ae.success("Social accounts connected successfully!");else throw new Error((v==null?void 0:v.error)||"Unknown error")}catch(v){console.error("OAuth callback error:",v),s("error"),o(v instanceof Error?v.message:"Failed to connect accounts"),Ae.error("Failed to connect: "+(v instanceof Error?v.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(Gr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(oi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(jn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(Q,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"View Integrations":"Try Again"})})]})})}const WVe=new Date().getFullYear(),hJt=Array.from({length:5},(e,t)=>WVe-t);function mJt(){const[e,t]=A.useState(WVe),n=Vn(),{data:s,isLoading:a}=dxt();return a?r.jsx(Fr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Er,{className:"h-24"},o))}),r.jsx(Er,{className:"h-96"})]})}):r.jsx(Fr,{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(un,{value:String(e),onValueChange:o=>t(Number(o)),children:[r.jsx(ln,{className:"w-[120px]",children:r.jsx(mn,{})}),r.jsx(cn,{children:hJt.map(o=>r.jsx($t,{value:String(o),children:o},o))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($n,{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(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(_c,{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(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Agents with Scorecards"}),r.jsx(jn,{children:"Click to view individual agent scorecards"})]}),r.jsx(et,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(_c,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:s.map(o=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:o.name}),r.jsx(yt,{className:"text-muted-foreground",children:o.email}),r.jsx(yt,{className:"text-right",children:r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const GVe=new Date().getFullYear(),fJt=Array.from({length:10},(e,t)=>GVe-t);function pJt(){var v;const{userId:e}=Ec(),t=Vn(),[n,s]=A.useState(GVe),{data:a,isLoading:o}=Zt({queryKey:["agent-profile",e],queryFn:async()=>{const{data:b,error:N}=await Y.from("profiles").select("id, name, email").eq("id",e).single();if(N)throw N;return b},enabled:!!e}),{data:l,isLoading:i}=Rye(n,e),{yearStats:u,lifetimeStats:m,showCommission:x}=qRe(n,e),{data:y}=URe(n,e);return o?r.jsx(Fr,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(b=>r.jsx(Er,{className:"h-24"},b))})]})}):r.jsx(Fr,{title:`${a==null?void 0:a.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(Q,{variant:"ghost",size:"icon",onClick:()=>t("/admin/scorecard"),children:r.jsx(Wi,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a==null?void 0:a.name}),r.jsx("p",{className:"text-muted-foreground",children:a==null?void 0:a.email})]})]}),r.jsxs(un,{value:String(n),onValueChange:b=>s(Number(b)),children:[r.jsx(ln,{className:"w-[120px]",children:r.jsx(mn,{})}),r.jsx(cn,{children:fJt.map(b=>r.jsx($t,{value:String(b),children:b},b))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ya,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:u.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[m.totalTransactions," lifetime"]})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($n,{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:[u.buyerCount,"/",u.sellerCount]})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Fd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:tu(u.totalVolume,!0)})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(eh,{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:tu(u.averagePrice,!0)})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bl,{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:((v=u.topLeadSource)==null?void 0:v.name)||"-"})]})})]}),y&&r.jsx(TBe,{goals:y,stats:u,year:n,showCommission:x}),r.jsxs(wi,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"transactions",children:"Transactions"}),r.jsx(sn,{value:"charts",children:"Charts"}),r.jsxs(sn,{value:"map",children:[r.jsx(Do,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Sn,{value:"transactions",children:r.jsx(MBe,{transactions:l||[],showCommission:x,isLoading:i})}),r.jsx(Sn,{value:"charts",children:r.jsx(vVe,{stats:u,year:n})}),r.jsx(Sn,{value:"map",children:r.jsx(_Ve,{transactions:l||[],isLoading:i})})]})]})})}function gJt(){const e=Vr(),[t,n]=A.useState(""),[s,a]=A.useState("all");B8e();const{data:o,refetch:l}=Zt({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:T}=await Y.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(T==null?void 0:T.enabled)??!1}}),{data:i,isLoading:u}=Zt({queryKey:["admin-listings"],queryFn:async()=>{const{data:T,error:P}=await Y.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(P)throw P;return T}}),{data:m}=Zt({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:T}=await Y.from("listings").select("id, is_approved, status"),{data:P}=await Y.from("listing_shares").select("id"),{data:F}=await Y.from("listing_views").select("id");return{total:(T==null?void 0:T.length)||0,pending:(T==null?void 0:T.filter(D=>!D.is_approved).length)||0,active:(T==null?void 0:T.filter(D=>D.status==="active").length)||0,totalShares:(P==null?void 0:P.length)||0,totalViews:(F==null?void 0:F.length)||0}}}),x=ar({mutationFn:async({id:T,approved:P})=>{const{error:F}=await Y.from("listings").update({is_approved:P}).eq("id",T);if(F)throw F},onSuccess:(T,{approved:P})=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),Ae.success(P?"Listing approved":"Listing unapproved")}}),y=ar({mutationFn:async({id:T,featured:P})=>{const{error:F}=await Y.from("listings").update({is_featured:P}).eq("id",T);if(F)throw F},onSuccess:(T,{featured:P})=>{e.invalidateQueries({queryKey:["admin-listings"]}),Ae.success(P?"Listing featured":"Listing unfeatured")}}),v=ar({mutationFn:async T=>{const{error:P}=await Y.from("listings").delete().eq("id",T);if(P)throw P},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),Ae.success("Listing deleted")}}),b=ar({mutationFn:async T=>{const{error:P}=await Y.from("feature_flags").update({enabled:T}).eq("key","listing_exchange_enabled");if(P)throw P},onSuccess:()=>{l(),Ae.success("Feature flag updated")}}),N=o??!1,k=i==null?void 0:i.filter(T=>{var D,U,V,W;const P=((D=T.city)==null?void 0:D.toLowerCase().includes(t.toLowerCase()))||((V=(U=T.agent)==null?void 0:U.name)==null?void 0:V.toLowerCase().includes(t.toLowerCase()))||((W=T.property_address)==null?void 0:W.toLowerCase().includes(t.toLowerCase())),F=s==="all"||s==="pending"&&!T.is_approved||s==="approved"&&T.is_approved;return P&&F}),M=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T),I=T=>{const P={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 P[T]||P.active};return r.jsx(Fr,{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(As,{checked:N,onCheckedChange:T=>b.mutate(T)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{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:(m==null?void 0:m.total)||0})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(eh,{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:(m==null?void 0:m.active)||0})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($n,{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:(m==null?void 0:m.pending)||0})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_o,{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:(m==null?void 0:m.totalViews)||0})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Nc,{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:(m==null?void 0:m.totalShares)||0})]})})]}),r.jsx(He,{children:r.jsx(et,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by city, address, or agent...",value:t,onChange:T=>n(T.target.value),className:"pl-9"})]}),r.jsx(wi,{value:s,onValueChange:T=>a(T),children:r.jsxs(_i,{children:[r.jsx(sn,{value:"all",children:"All"}),r.jsx(sn,{value:"pending",children:"Pending"}),r.jsx(sn,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{children:["Listings (",(k==null?void 0:k.length)||0,")"]})}),r.jsx(et,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Property"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Price"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-center",children:"Approved"}),r.jsx(Mt,{className:"text-center",children:"Featured"}),r.jsx(Mt,{children:"Views"}),r.jsx(Mt,{children:"Shares"}),r.jsx(Mt,{children:"Date"}),r.jsx(Mt,{})]})}),r.jsx(Fs,{children:u?r.jsx(Sr,{children:r.jsx(yt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(k==null?void 0:k.length)===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):k==null?void 0:k.map(T=>{var P,F,D,U,V;return r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(F=(P=T.photos)==null?void 0:P[0])!=null&&F.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(hi,{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:(D=T.property_type)==null?void 0:D.replace("_"," ")})]})]})}),r.jsx(yt,{children:r.jsx("p",{className:"text-sm",children:((U=T.agent)==null?void 0:U.name)||"Unknown"})}),r.jsx(yt,{className:"font-medium",children:M(T.price)}),r.jsx(yt,{children:r.jsx(At,{variant:"outline",className:I(T.status),children:(V=T.status)==null?void 0:V.replace("_"," ")})}),r.jsx(yt,{className:"text-center",children:r.jsx(As,{checked:T.is_approved??!1,onCheckedChange:W=>x.mutate({id:T.id,approved:W})})}),r.jsx(yt,{className:"text-center",children:r.jsx(As,{checked:T.is_featured??!1,onCheckedChange:W=>y.mutate({id:T.id,featured:W})})}),r.jsx(yt,{children:T.view_count||0}),r.jsx(yt,{children:T.share_count||0}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:on(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(yt,{children:r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",children:r.jsx(gp,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",children:[r.jsxs(Va,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(Va,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(Va,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&v.mutate(T.id)},children:[r.jsx(ds,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const xJt=()=>{var y,v;const[e,t]=A.useState(""),[n,s]=A.useState(null),{data:a,isLoading:o}=Zt({queryKey:["membership-reviews"],queryFn:async()=>{const{data:b,error:N}=await Y.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(N)throw N;const k=(b==null?void 0:b.map(T=>T.user_id))||[],{data:M}=await Y.from("profiles").select("id, name, email").in("id",k);return b==null?void 0:b.map(T=>({...T,profiles:(M==null?void 0:M.find(P=>P.id===T.user_id))||null}))}}),l=a==null?void 0:a.filter(b=>{var k,M,I,T,P;const N=e.toLowerCase();return((M=(k=b.profiles)==null?void 0:k.name)==null?void 0:M.toLowerCase().includes(N))||((T=(I=b.profiles)==null?void 0:I.email)==null?void 0:T.toLowerCase().includes(N))||((P=b.review_text)==null?void 0:P.toLowerCase().includes(N))}),i=a!=null&&a.length?(a.reduce((b,N)=>b+N.rating,0)/a.length).toFixed(1):"0.0",u=a==null?void 0:a.reduce((b,N)=>(b[N.rating]=(b[N.rating]||0)+1,b),{}),m=(a==null?void 0:a.filter(b=>b.posted_to_google).length)||0,x=b=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(N=>r.jsx(ks,{className:Ut("h-4 w-4",b>=N?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},N))});return r.jsx(Fr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{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(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"Total Reviews"}),r.jsx(Gt,{className:"text-3xl",children:(a==null?void 0:a.length)||0})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"Average Rating"}),r.jsxs(Gt,{className:"flex items-center gap-2 text-3xl",children:[i,r.jsx(ks,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"5-Star Reviews"}),r.jsx(Gt,{className:"text-3xl",children:(u==null?void 0:u[5])||0})]})}),r.jsx(He,{children:r.jsxs(Ht,{className:"pb-2",children:[r.jsx(jn,{children:"Posted to Google"}),r.jsxs(Gt,{className:"flex items-center gap-2 text-3xl",children:[m,r.jsx(Ss,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name, email, or review...",value:e,onChange:b=>t(b.target.value),className:"pl-9"})]}),r.jsx(He,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Member"}),r.jsx(Mt,{children:"Rating"}),r.jsx(Mt,{className:"hidden md:table-cell",children:"Review"}),r.jsx(Mt,{children:"Google"}),r.jsx(Mt,{children:"Date"})]})}),r.jsx(Fs,{children:o?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Sr,{children:r.jsx(yt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(b=>{var N,k;return r.jsxs(Sr,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(b),children:[r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((N=b.profiles)==null?void 0:N.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(k=b.profiles)==null?void 0:k.email})]})}),r.jsx(yt,{children:x(b.rating)}),r.jsx(yt,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:b.review_text||"-"})}),r.jsx(yt,{children:b.posted_to_google?r.jsx(At,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(At,{variant:"outline",children:"No"})}),r.jsx(yt,{className:"text-sm text-muted-foreground",children:on(new Date(b.created_at),"MMM d, yyyy")})]},b.id)})})]})})}),r.jsx(Rr,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Dr,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Br,{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"}),((v=n.profiles)==null?void 0:v.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(ws,{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(Cs,{className:"h-4 w-4"}),on(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(At,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Ss,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(At,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},yJt=[{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"}],vJt=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 _Jt(){const e=Vr(),{user:t}=tn(),[n,s]=A.useState(!1),[a,o]=A.useState(!1),[l,i]=A.useState(!1),{data:u,isLoading:m}=Zt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:W,error:G}=await Y.from("weekly_digest_settings").select("*").single();if(G)throw G;return W}}),{data:x,isLoading:y}=Zt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:W,error:G}=await Y.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(G)throw G;return W}}),{data:v}=Zt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:W,error:G}=await Y.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(G)throw G;return W||0}}),{data:b,refetch:N}=Zt({queryKey:["digest-queue-status"],queryFn:async()=>{const W=new Date;W.setUTCHours(0,0,0,0);const[G,ee,ae,oe]=await Promise.all([Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",W.toISOString()),Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",W.toISOString()),Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",W.toISOString()),Y.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",W.toISOString())]);return{pending:G.count||0,processing:ee.count||0,sent:ae.count||0,failed:oe.count||0,total:(G.count||0)+(ee.count||0)+(ae.count||0)+(oe.count||0)}},refetchInterval:5e3});A.useEffect(()=>{if(b&&(b.pending>0||b.processing>0)){const W=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(W)}},[b,N,e]);const{data:k=0}=Zt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const W=new Date;W.setUTCHours(0,0,0,0);const{count:G,error:ee}=await Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",W.toISOString());if(ee)throw ee;return G||0}}),M=ar({mutationFn:async W=>{const{error:G}=await Y.from("weekly_digest_settings").update(W).eq("id",u==null?void 0:u.id);if(G)throw G},onSuccess:()=>{e.invalidateQueries({queryKey:["weekly-digest-settings"]}),Ae.success("Settings updated")},onError:W=>{Ae.error("Failed to update settings: "+W.message)}}),I=async()=>{s(!0);try{const{data:W,error:G}=await Y.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(G)throw G;W.queued?Ae.success(`${W.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):W.sent!==void 0&&Ae.success(`Digest sent! ${W.sent} emails delivered, ${W.failed} failed`),N(),e.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(W){Ae.error("Failed to send digest: "+W.message)}finally{s(!1)}},T=async()=>{var W,G,ee,ae,oe,pe;if(!(t!=null&&t.email)){Ae.error("No email found for your account");return}o(!0);try{const{data:ne,error:fe}=await Y.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:t.email}});if(fe)throw fe;const se=ne==null?void 0:ne.resendId,me=ne==null?void 0:ne.resendDetails,ue=me==null?void 0:me.status,xe=((W=me==null?void 0:me.body)==null?void 0:W.status)||((ee=(G=me==null?void 0:me.body)==null?void 0:G.data)==null?void 0:ee.status),Te=((oe=(ae=me==null?void 0:me.body)==null?void 0:ae.error)==null?void 0:oe.message)||((pe=me==null?void 0:me.body)==null?void 0:pe.message);Ae.success(se?`Preview accepted by email provider (id: ${se})${ue?`, status check: ${ue}`:""}${xe?`, provider: ${xe}`:""}${Te?` (${Te})`:""}. 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){Ae.error("Failed to send preview: "+ne.message)}finally{o(!1)}},P=async()=>{i(!0);try{const{data:W,error:G}=await Y.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(G)throw G;W.queued===0||W.sent===0&&W.failed===0&&!W.queued?Ae.info("No failed emails to retry"):W.queued?Ae.success(`${W.queued} emails queued for retry!`):Ae.success(`Retry complete! ${W.sent} emails delivered, ${W.failed} failed`),N(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(W){Ae.error("Failed to retry: "+W.message)}finally{i(!1)}},F=b!=null&&b.total?Math.round((b.sent+b.failed)/b.total*100):0,D=((b==null?void 0:b.pending)||0)>0||((b==null?void 0:b.processing)||0)>0,{data:U}=Zt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var pe,ne;const W=new Date;W.setUTCHours(0,0,0,0);const[G,ee,ae,oe]=await Promise.all([Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",W.toISOString()),Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",W.toISOString()),Y.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",W.toISOString()),Y.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:G.count||0,totalFailed:ee.count||0,agentOsEngaged:ae.count||0,lastSent:((ne=(pe=oe.data)==null?void 0:pe[0])==null?void 0:ne.sent_at)||null}},refetchInterval:D?5e3:!1}),V={totalSent:(U==null?void 0:U.totalSent)||0,totalFailed:(U==null?void 0:U.totalFailed)||0,lastSent:U==null?void 0:U.lastSent,agentOsEngaged:(U==null?void 0:U.agentOsEngaged)||0};return m?r.jsx(Fr,{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(Fr,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(wi,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(_i,{children:[r.jsxs(sn,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(zd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(sn,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(_c,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(Sn,{value:"settings",className:"space-y-6",children:[D&&b&&r.jsx(He,{className:"border-primary/50 bg-primary/5",children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(Gr,{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:[b.sent.toLocaleString()," sent, ",b.pending.toLocaleString()," pending",b.failed>0&&`, ${b.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[F,"%"]})]}),r.jsx(Mc,{value:F,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(b.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(He,{children:r.jsx(et,{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($n,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:v}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),r.jsx(He,{children:r.jsx(et,{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(no,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(He,{children:r.jsx(et,{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(bc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(He,{children:r.jsx(et,{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(Xa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.lastSent?on(new Date(V.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(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Xa,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(jn,{children:"Configure when the digest is sent"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(As,{checked:u==null?void 0:u.is_enabled,onCheckedChange:W=>M.mutate({is_enabled:W})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Cron Frequency"}),r.jsxs(un,{value:(u==null?void 0:u.cron_frequency)||"daily",onValueChange:W=>M.mutate({cron_frequency:W}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx($t,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(u==null?void 0:u.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(ze,{children:"Day of Week"}),r.jsxs(un,{value:String(u==null?void 0:u.send_day),onValueChange:W=>M.mutate({send_day:parseInt(W)}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:yJt.map(W=>r.jsx($t,{value:W.value,children:W.label},W.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Time (UTC)"}),r.jsxs(un,{value:String(u==null?void 0:u.send_hour),onValueChange:W=>M.mutate({send_hour:parseInt(W)}),disabled:(u==null?void 0:u.cron_frequency)==="daily",children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:vJt.map(W=>r.jsx($t,{value:W.value,children:W.label},W.value))})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Q,{onClick:T,disabled:a,variant:"outline",className:"flex-1",children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Preview to Me"]}),r.jsxs(Q,{onClick:I,disabled:n,className:"flex-1",children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),k>0&&r.jsxs(Q,{onClick:P,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(Go,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${k} Failed`]})]})]})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(_a,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(jn,{children:"Choose what to include in the digest"})]}),r.jsxs(et,{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(_a,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"New Resources"})]}),r.jsx(As,{checked:u==null?void 0:u.include_new_resources,onCheckedChange:W=>M.mutate({include_new_resources:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Community Highlights"})]}),r.jsx(As,{checked:u==null?void 0:u.include_community_posts,onCheckedChange:W=>M.mutate({include_community_posts:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_c,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Agent OS Stats"})]}),r.jsx(As,{checked:u==null?void 0:u.include_agent_os_stats,onCheckedChange:W=>M.mutate({include_agent_os_stats:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Cs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Upcoming Events"})]}),r.jsx(As,{checked:u==null?void 0:u.include_upcoming_events,onCheckedChange:W=>M.mutate({include_upcoming_events:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xy,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(ze,{children:"Goals Progress"})]}),r.jsx(As,{checked:u==null?void 0:u.include_goals_progress,onCheckedChange:W=>M.mutate({include_goals_progress:W})})]})]})]})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Custom Introduction"}),r.jsx(jn,{children:"Personalize the intro message (optional)"})]}),r.jsx(et,{children:r.jsx(Zn,{placeholder:"Here's what's new this week to help you grow your business...",value:(u==null?void 0:u.custom_intro_text)||"",onChange:W=>M.mutate({custom_intro_text:W.target.value||null}),rows:3})})]})]}),r.jsx(Sn,{value:"stats",children:r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(ws,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(jn,{children:"Recent digest emails sent to members"})]}),r.jsx(et,{children:y?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(W=>r.jsx("div",{className:"h-12 bg-muted rounded"},W))}):x&&x.length>0?r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Email"}),r.jsx(Mt,{children:"Sent At"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{children:"Resources"}),r.jsx(Mt,{children:"Agent OS"})]})}),r.jsx(Fs,{children:x.map(W=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:W.email_sent_to}),r.jsx(yt,{children:on(new Date(W.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(yt,{children:r.jsx(At,{variant:W.delivery_status==="sent"?"default":"destructive",children:W.delivery_status})}),r.jsx(yt,{children:W.resources_count}),r.jsx(yt,{children:W.has_agent_os_activity?r.jsx(At,{variant:"secondary",children:"Active"}):r.jsx(At,{variant:"outline",children:"Not Started"})})]},W.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ws,{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 bJt={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 wJt(){var we,ve,Xe;const e=Vr(),[t,n]=A.useState(""),[s,a]=A.useState(null),[o,l]=A.useState(!1),[i,u]=A.useState(!1),[m,x]=A.useState(""),[y,v]=A.useState(""),[b,N]=A.useState(!0),[k,M]=A.useState(!1),[I,T]=A.useState(""),[P,F]=A.useState(null),{data:D,isLoading:U}=Zt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Me,error:Ie}=await Y.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Ie)throw Ie;const $e=(Me==null?void 0:Me.map(ot=>ot.user_id))||[],{data:Be}=await Y.from("profiles").select("id, name, email").in("id",$e),Ve=new Map((Be==null?void 0:Be.map(ot=>[ot.id,{name:ot.name,email:ot.email}]))||[]);return Me==null?void 0:Me.map(ot=>({...ot,profile:Ve.get(ot.user_id)||null}))}}),{data:V}=Zt({queryKey:["all-profiles-for-points",D],queryFn:async()=>{const{data:Me,error:Ie}=await Y.from("profiles").select("id, name, email").order("name");if(Ie)throw Ie;return Me}}),G=((V==null?void 0:V.filter(Me=>!(D!=null&&D.some(Ie=>Ie.user_id===Me.id))))||[]).filter(Me=>{var $e,Be;if(!I)return!0;const Ie=I.toLowerCase();return(($e=Me.name)==null?void 0:$e.toLowerCase().includes(Ie))||((Be=Me.email)==null?void 0:Be.toLowerCase().includes(Ie))}),{data:ee,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:Me,error:Ie}=await Y.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Ie)throw Ie;return Me},enabled:!!(s!=null&&s.user_id)&&i}),{data:oe}=Zt({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Me,error:Ie}=await Y.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Ie)throw Ie;return Me},enabled:!!(s!=null&&s.user_id)}),pe=ar({mutationFn:async({userId:Me,points:Ie,reason:$e})=>{const{error:Be}=await Y.from("agent_points").insert({user_id:Me,points:Ie,reason:$e});if(Be)throw Be;const{data:Ve}=await Y.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Me).maybeSingle(),ot=((Ve==null?void 0:Ve.total_points)||0)+Ie,Tt=((Ve==null?void 0:Ve.spendable_points)||0)+Ie,{error:Oe}=await Y.from("agent_attendance_stats").upsert({user_id:Me,total_points:Math.max(0,ot),spendable_points:Math.max(0,Tt),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Oe)throw Oe},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-agent-points"]}),e.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),x(""),v(""),Ae.success(b?"Points awarded successfully!":"Points deducted successfully!")},onError:Me=>{console.error("Error modifying points:",Me),Ae.error("Failed to modify points")}}),ne=()=>{if(!s||!m||!y){Ae.error("Please fill in all fields");return}const Me=parseInt(m);if(isNaN(Me)||Me<=0){Ae.error("Please enter a valid positive number");return}pe.mutate({userId:s.user_id,points:b?Me:-Me,reason:y})},fe=()=>{if(!P||!m||!y){Ae.error("Please fill in all fields");return}const Me=parseInt(m);if(isNaN(Me)||Me<=0){Ae.error("Please enter a valid positive number");return}pe.mutate({userId:P.id,points:Me,reason:y},{onSuccess:()=>{M(!1),F(null),T("")}})},se=(Me,Ie)=>{a(Me),N(Ie),l(!0)},me=Me=>{a(Me),u(!0)},ue=D==null?void 0:D.filter(Me=>{var Ve,ot,Tt,Oe;const Ie=((ot=(Ve=Me.profile)==null?void 0:Ve.name)==null?void 0:ot.toLowerCase())||"",$e=((Oe=(Tt=Me.profile)==null?void 0:Tt.email)==null?void 0:Oe.toLowerCase())||"",Be=t.toLowerCase();return Ie.includes(Be)||$e.includes(Be)}),xe=(D==null?void 0:D.reduce((Me,Ie)=>Me+Ie.total_points,0))||0,Te=(D==null?void 0:D.length)||0,_e=Te>0?Math.round(xe/Te):0;return U?r.jsx(Fr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Me=>r.jsx(Er,{className:"h-24"},Me))}),r.jsx(Er,{className:"h-96"})]})}):r.jsx(Fr,{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(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($n,{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:Te}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(io,{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:xe.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(eh,{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:_e}),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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search agents...",value:t,onChange:Me=>n(Me.target.value),className:"pl-10"})]}),r.jsxs(Q,{onClick:()=>M(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsx(Gt,{children:"Agent Leaderboard"}),r.jsx(jn,{children:"All agents with their points, events, and streaks"})]}),r.jsx(et,{children:!ue||ue.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(io,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{className:"w-12",children:"#"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{className:"text-center",children:"Total Points"}),r.jsx(Mt,{className:"text-center",children:"Spendable"}),r.jsx(Mt,{className:"text-center",children:"Events"}),r.jsx(Mt,{className:"text-center",children:"Streak"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:ue.map((Me,Ie)=>{var $e,Be,Ve,ot;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:Ie<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Ie===0?"bg-yellow-100 text-yellow-700":Ie===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Ie+1}):r.jsx("span",{className:"text-muted-foreground",children:Ie+1})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ea,{className:"h-8 w-8",children:r.jsx(ta,{children:((Be=($e=Me.profile)==null?void 0:$e.name)==null?void 0:Be.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Ve=Me.profile)==null?void 0:Ve.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(ot=Me.profile)==null?void 0:ot.email})]})]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(At,{variant:"secondary",className:"font-bold",children:[r.jsx(ks,{className:"h-3 w-3 mr-1"}),Me.total_points]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(At,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(ao,{className:"h-3 w-3 mr-1"}),Me.spendable_points||0]})}),r.jsx(yt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Cs,{className:"h-3 w-3 text-muted-foreground"}),Me.total_events_attended]})}),r.jsx(yt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(fm,{className:"h-3 w-3 text-orange-500"}),Me.current_streak]})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>se(Me,!0),title:"Award points",children:r.jsx(_n,{className:"h-4 w-4 text-green-600"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>se(Me,!1),title:"Deduct points",children:r.jsx(K1,{className:"h-4 w-4 text-red-600"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>me(Me),title:"View history",children:r.jsx(N4,{className:"h-4 w-4"})})]})})]},Me.user_id)})})]})})]}),r.jsx(Rr,{open:o,onOpenChange:l,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:b?"Award Points":"Deduct Points"}),r.jsxs(Yn,{children:[b?"Award":"Deduct"," points ",b?"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(ze,{htmlFor:"points",children:"Points Amount"}),r.jsx(lt,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Me=>x(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"reason",children:"Reason"}),r.jsx(Zn,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Me=>v(Me.target.value)})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(Q,{onClick:ne,disabled:pe.isPending,className:b?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:pe.isPending?"Saving...":b?"Award Points":"Deduct Points"})]})]})}),r.jsx(Rr,{open:i,onOpenChange:u,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsxs(Br,{children:["Point History: ",(ve=s==null?void 0:s.profile)==null?void 0:ve.name]}),r.jsx(Yn,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(wi,{defaultValue:"history",className:"w-full",children:[r.jsxs(_i,{className:"grid w-full grid-cols-2",children:[r.jsx(sn,{value:"history",children:"Point History"}),r.jsx(sn,{value:"badges",children:"Badges"})]}),r.jsx(Sn,{value:"history",className:"mt-4",children:ae?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Me=>r.jsx(Er,{className:"h-12"},Me))}):!ee||ee.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(N4,{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:ee.map(Me=>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:Me.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:on(new Date(Me.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(At,{variant:Me.points>=0?"default":"destructive",className:Me.points>=0?"bg-green-100 text-green-800":"",children:[Me.points>=0?"+":"",Me.points]})]},Me.id))})}),r.jsx(Sn,{value:"badges",className:"mt-4",children:!oe||oe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Bl,{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:oe.map(Me=>r.jsxs("div",{className:`p-3 rounded-lg ${bJt[Me.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bl,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Me.badge_name})]}),Me.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Me.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",on(new Date(Me.earned_at),"MMM d, yyyy")]})]},Me.id))})})]})]})}),r.jsx(Rr,{open:k,onOpenChange:Me=>{M(Me),Me||(F(null),T(""),x(""),v(""))},children:r.jsxs(Dr,{className:"max-w-md",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Award Points to New Agent"}),r.jsx(Yn,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:P?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(ea,{className:"h-10 w-10",children:r.jsx(ta,{children:((Xe=P.name)==null?void 0:Xe.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:P.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:P.email})]}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>F(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(lt,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:m,onChange:Me=>x(Me.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"new-reason",children:"Reason"}),r.jsx(Zn,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:Me=>v(Me.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name or email...",value:I,onChange:Me=>T(Me.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:G.length===0?r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx($n,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:I?"No matching agents found":"All agents already have points"})]}):G.slice(0,20).map(Me=>{var Ie;return r.jsxs("button",{onClick:()=>F(Me),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(ea,{className:"h-8 w-8",children:r.jsx(ta,{children:((Ie=Me.name)==null?void 0:Ie.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Me.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Me.email})]})]},Me.id)})})]})}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),P&&r.jsxs(Q,{onClick:fe,disabled:pe.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function jJt(){const{data:e,isLoading:t}=Fct(),[n,s]=A.useState(null),[a,o]=A.useState(!1),[l,i]=A.useState(""),[u,m]=A.useState("all"),[x,y]=A.useState("newest"),[v,b]=A.useState("table"),N=A.useMemo(()=>(e==null?void 0:e.map(P=>P.user_id))||[],[e]),k=A.useMemo(()=>(e==null?void 0:e.map(P=>P.id))||[],[e]),{data:M}=Zt({queryKey:["card-profiles-lookup",N],queryFn:async()=>{if(N.length===0)return{};const{data:P}=await Y.from("profiles").select("id, name, email").in("id",N),F={};return P==null||P.forEach(D=>{F[D.id]={name:D.name||"",email:D.email||""}}),F},enabled:N.length>0}),{data:I}=Zt({queryKey:["card-stats-all",k],queryFn:async()=>{if(k.length===0)return{};const P={};k.forEach(U=>{P[U]={views:0,leads:0}});const{data:F}=await Y.from("agent_card_interactions").select("card_id").in("card_id",k).eq("interaction_type","card_view");F==null||F.forEach(U=>{P[U.card_id]&&P[U.card_id].views++});const{data:D}=await Y.from("agent_card_leads").select("card_id").in("card_id",k);return D==null||D.forEach(U=>{P[U.card_id]&&P[U.card_id].leads++}),P},enabled:k.length>0}),T=A.useMemo(()=>{if(!e)return[];let P=[...e];if(u==="live"?P=P.filter(F=>F.is_published):u==="draft"&&(P=P.filter(F=>!F.is_published)),l.trim()){const F=l.toLowerCase();P=P.filter(D=>{var V,W;const U=M==null?void 0:M[D.user_id];return D.slug.toLowerCase().includes(F)||((V=U==null?void 0:U.name)==null?void 0:V.toLowerCase().includes(F))||((W=U==null?void 0:U.email)==null?void 0:W.toLowerCase().includes(F))})}return x==="newest"?P.sort((F,D)=>new Date(D.created_at).getTime()-new Date(F.created_at).getTime()):x==="oldest"?P.sort((F,D)=>new Date(F.created_at).getTime()-new Date(D.created_at).getTime()):x==="name"?P.sort((F,D)=>{var U,V;return(((U=M==null?void 0:M[F.user_id])==null?void 0:U.name)||"").localeCompare(((V=M==null?void 0:M[D.user_id])==null?void 0:V.name)||"")}):x==="slug"?P.sort((F,D)=>F.slug.localeCompare(D.slug)):x==="views_desc"?P.sort((F,D)=>{var U,V;return(((U=I==null?void 0:I[D.id])==null?void 0:U.views)||0)-(((V=I==null?void 0:I[F.id])==null?void 0:V.views)||0)}):x==="views_asc"?P.sort((F,D)=>{var U,V;return(((U=I==null?void 0:I[F.id])==null?void 0:U.views)||0)-(((V=I==null?void 0:I[D.id])==null?void 0:V.views)||0)}):x==="leads_desc"?P.sort((F,D)=>{var U,V;return(((U=I==null?void 0:I[D.id])==null?void 0:U.leads)||0)-(((V=I==null?void 0:I[F.id])==null?void 0:V.leads)||0)}):x==="leads_asc"&&P.sort((F,D)=>{var U,V;return(((U=I==null?void 0:I[F.id])==null?void 0:U.leads)||0)-(((V=I==null?void 0:I[D.id])==null?void 0:V.leads)||0)}),P},[e,u,l,x,M]);return r.jsxs(Fr,{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(Q,{onClick:()=>o(!0),children:[r.jsx(_n,{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(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name, email, or slug...",value:l,onChange:P=>i(P.target.value),className:"pl-9"})]}),r.jsxs(un,{value:u,onValueChange:m,children:[r.jsx(ln,{className:"w-full sm:w-36",children:r.jsx(mn,{placeholder:"Status"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"all",children:"All Status"}),r.jsx($t,{value:"live",children:"Live"}),r.jsx($t,{value:"draft",children:"Draft"})]})]}),r.jsxs(un,{value:x,onValueChange:y,children:[r.jsx(ln,{className:"w-full sm:w-44",children:r.jsx(mn,{placeholder:"Sort by"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"newest",children:"Newest First"}),r.jsx($t,{value:"oldest",children:"Oldest First"}),r.jsx($t,{value:"name",children:"Name A–Z"}),r.jsx($t,{value:"slug",children:"Slug A–Z"}),r.jsx($t,{value:"views_desc",children:"Most Views"}),r.jsx($t,{value:"views_asc",children:"Fewest Views"}),r.jsx($t,{value:"leads_desc",children:"Most Leads"}),r.jsx($t,{value:"leads_asc",children:"Fewest Leads"})]})]}),r.jsxs("div",{className:"flex border rounded-md",children:[r.jsx(Q,{variant:v==="table"?"default":"ghost",size:"sm",onClick:()=>b("table"),className:"rounded-r-none",children:r.jsx(D4,{className:"h-4 w-4"})}),r.jsx(Q,{variant:v==="grid"?"default":"ghost",size:"sm",onClick:()=>b("grid"),className:"rounded-l-none",children:r.jsx(hf,{className:"h-4 w-4"})})]})]}),!t&&e&&e.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",T.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(P=>r.jsx(Er,{className:"h-48"},P))}):T.length>0?v==="table"?r.jsx(kJt,{cards:T,cardProfiles:M,cardStats:I,onEdit:s,sortBy:x,setSortBy:y}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:T.map(P=>r.jsx(NJt,{card:P,onEdit:()=>s(P),stats:I==null?void 0:I[P.id]},P.id))}):e&&e.length>0?r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(ma,{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(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx($n,{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(Q,{onClick:()=>o(!0),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(SJt,{open:a,onOpenChange:o}),n&&r.jsx(CJt,{card:n,open:!!n,onOpenChange:P=>!P&&s(null)})]})}function kJt({cards:e,cardProfiles:t,cardStats:n,onEdit:s,sortBy:a,setSortBy:o}){const l=u=>{a===`${u}_desc`?o(`${u}_asc`):o(`${u}_desc`)},i=({field:u})=>a===`${u}_desc`?r.jsx(oy,{className:"h-3 w-3"}):a===`${u}_asc`?r.jsx(df,{className:"h-3 w-3"}):r.jsx(Og,{className:"h-3 w-3 opacity-40"});return r.jsx(He,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b bg-muted/50",children:[r.jsx("th",{className:"text-left p-3 font-medium",children:r.jsxs("button",{onClick:()=>{o(a==="name"?"newest":"name")},className:"flex items-center gap-1 hover:text-foreground text-muted-foreground",children:["Agent ",a==="name"&&r.jsx(df,{className:"h-3 w-3"})]})}),r.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground hidden md:table-cell",children:"Slug"}),r.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Status"}),r.jsx("th",{className:"text-right p-3 font-medium",children:r.jsxs("button",{onClick:()=>l("views"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Views ",r.jsx(i,{field:"views"})]})}),r.jsx("th",{className:"text-right p-3 font-medium",children:r.jsxs("button",{onClick:()=>l("leads"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Leads ",r.jsx(i,{field:"leads"})]})}),r.jsx("th",{className:"text-right p-3 font-medium text-muted-foreground",children:"Actions"})]})}),r.jsx("tbody",{children:e.map(u=>{const m=t==null?void 0:t[u.user_id],x=n==null?void 0:n[u.id],y=`https://cards.relevelup.com/${u.slug}`;return r.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/30 transition-colors",children:[r.jsx("td",{className:"p-3",children:r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:(m==null?void 0:m.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(m==null?void 0:m.email)||""})]})}),r.jsx("td",{className:"p-3 hidden md:table-cell",children:r.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["/",u.slug]})}),r.jsx("td",{className:"p-3 text-center",children:r.jsx(At,{variant:u.is_published?"default":"secondary",className:"text-xs",children:u.is_published?"Live":"Draft"})}),r.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(x==null?void 0:x.views)??0}),r.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(x==null?void 0:x.leads)??0}),r.jsx("td",{className:"p-3",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>s(u),className:"h-8 w-8 p-0",children:r.jsx(Qa,{className:"h-3.5 w-3.5"})}),r.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(y),Ae.success("Link copied!")},children:r.jsx(Po,{className:"h-3.5 w-3.5"})}),r.jsx(Q,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",asChild:!0,children:r.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Ss,{className:"h-3.5 w-3.5"})})})]})})]},u.id)})})]})})})}function NJt({card:e,onEdit:t,stats:n}){const[s,a]=A.useState(null);A.useEffect(()=>{(async()=>{const{data:u}=await Y.from("profiles").select("name").eq("id",e.user_id).single();let m=null;try{const{data:x}=await Y.storage.from("avatars").list(`${e.user_id}`);if(x&&x.length>0){const{data:y}=Y.storage.from("avatars").getPublicUrl(`${e.user_id}/${x[0].name}`);m=y.publicUrl}}catch{}a({name:(u==null?void 0:u.name)||"Unknown",avatar_url:m})})()},[e.user_id]);const o=`https://cards.relevelup.com/${e.slug}`,l=()=>{navigator.clipboard.writeText(o),Ae.success("Link copied!")};return r.jsx(He,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:(s==null?void 0:s.avatar_url)||void 0}),r.jsx(ta,{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(At,{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(_o,{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($n,{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(Q,{variant:"outline",size:"sm",onClick:t,className:"flex-1",children:[r.jsx(Qa,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(Q,{variant:"outline",size:"sm",onClick:l,children:r.jsx(Po,{className:"h-3 w-3"})}),r.jsx(Q,{variant:"outline",size:"sm",asChild:!0,children:r.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Ss,{className:"h-3 w-3"})})})]})]})})}function SJt({open:e,onOpenChange:t}){const[n,s]=A.useState(""),[a,o]=A.useState(""),[l,i]=A.useState(""),[u,m]=A.useState(!1),x=A8e(),y=l.trim(),{data:v}=Zt({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let T=Y.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(T=T.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:P}=await T;return P||[]},enabled:e}),[b,N]=A.useState(null),k=(v==null?void 0:v.find(T=>T.id===n))||b,M=()=>{if(!n||!a.trim()){Ae.error("Select an agent and enter a slug");return}x.mutate({user_id:n,slug:a.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-"),is_published:!0},{onSuccess:()=>{t(!1),s(""),o(""),i("")}})},I=T=>{var F;s(T),m(!1);const P=v==null?void 0:v.find(D=>D.id===T);P&&(N(P),o(((F=P.name)==null?void 0:F.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Rr,{open:e,onOpenChange:t,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Create Agent Card"}),r.jsx(Yn,{children:"Select an agent and set their card URL slug."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Agent"}),r.jsxs(Wc,{open:u,onOpenChange:m,children:[r.jsx(Gc,{asChild:!0,children:r.jsxs(Q,{variant:"outline",role:"combobox","aria-expanded":u,className:"w-full justify-between font-normal",children:[k?`${k.name} (${k.email})`:"Search for an agent...",r.jsx(cy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Tc,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:r.jsxs(Py,{shouldFilter:!1,children:[r.jsx(Ly,{placeholder:"Search by name or email...",value:l,onValueChange:i}),r.jsxs(Oy,{children:[r.jsx(Dy,{children:"No agents found."}),r.jsx(Ry,{children:(v||[]).map(T=>r.jsxs(Fy,{value:T.id,onSelect:I,children:[r.jsx(mi,{className:Ut("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(ze,{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(lt,{value:a,onChange:T=>o(T.target.value),placeholder:"john-doe"})]})]}),r.jsx(Q,{onClick:M,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function CJt({card:e,open:t,onOpenChange:n}){const s=E8e(),{data:a}=I8e(e.id),o=Vr(),[l,i]=A.useState(null),[u,m]=A.useState(!1),[x,y]=A.useState(!1),[v,b]=A.useState(""),[N,k]=A.useState(e.slug),[M,I]=A.useState(!1),[T,P]=A.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});A.useEffect(()=>{t&&(async()=>{try{const{data:ee}=await Y.storage.from("avatars").list(`${e.user_id}`);if(ee&&ee.length>0){const{data:ae}=Y.storage.from("avatars").getPublicUrl(`${e.user_id}/${ee[0].name}`);i(`${ae.publicUrl}?t=${Date.now()}`)}}catch{}})()},[e.user_id,t]);const F=G=>{var oe;const ee=(oe=G.target.files)==null?void 0:oe[0];if(!ee)return;if(!ee.type.startsWith("image/")){Ae.error("Please select an image file");return}if(ee.size>5*1024*1024){Ae.error("Image must be under 5MB");return}const ae=new FileReader;ae.onloadend=()=>{b(ae.result),y(!0)},ae.readAsDataURL(ee),G.target.value=""},D=async G=>{m(!0);try{const{data:ee}=await Y.storage.from("avatars").list(`${e.user_id}`);ee&&ee.length>0&&await Y.storage.from("avatars").remove(ee.map(fe=>`${e.user_id}/${fe.name}`));const ae=`${e.user_id}/avatar.jpg`,{error:oe}=await Y.storage.from("avatars").upload(ae,G,{upsert:!0,contentType:"image/jpeg"});if(oe)throw oe;const{data:pe}=Y.storage.from("avatars").getPublicUrl(ae),ne=`${pe.publicUrl}?t=${Date.now()}`;i(ne),await Y.from("profiles").update({avatar_url:ne}).eq("id",e.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),Ae.success("Photo updated!")}catch(ee){Ae.error(ee.message||"Upload failed")}finally{m(!1)}},U=async()=>{const G=N.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!G){Ae.error("Please enter a valid URL");return}if(G===e.slug){Ae.info("No changes to save");return}I(!0);try{const{data:ee}=await Y.from("agent_cards").select("id").eq("slug",G).neq("id",e.id).maybeSingle();if(ee){Ae.error("This URL is already taken. Try another one.");return}const{error:ae}=await Y.from("agent_cards").update({slug:G}).eq("id",e.id);if(ae)throw ae;k(G),o.invalidateQueries({queryKey:["agent-cards-admin"]}),Ae.success("Card address updated!")}catch{Ae.error("Failed to update card address")}finally{I(!1)}},V=async(G,ee)=>{var oe;const ae=(oe=G.target.files)==null?void 0:oe[0];if(ae){if(!ae.type.startsWith("image/")){Ae.error("Please select an image file");return}try{const pe=ae.name.split(".").pop()||"png",ne=ee==="brokerage_logo_url"?"brokerage-logo":"team-logo",fe=`${e.user_id}/${ne}.${pe}`,{error:se}=await Y.storage.from("card-logos").upload(fe,ae,{upsert:!0});if(se)throw se;const{data:me}=Y.storage.from("card-logos").getPublicUrl(fe),ue=me.publicUrl+"?t="+Date.now();P(ee==="brokerage_logo_url"?xe=>({...xe,[ee]:ue,brokerage_display_name:""}):xe=>({...xe,[ee]:ue,team_name:""})),Ae.success("Logo uploaded!")}catch{Ae.error("Failed to upload logo")}finally{G.target.value=""}}},W=()=>{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(Rr,{open:t,onOpenChange:n,children:r.jsxs(Dr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Edit Agent Card"}),r.jsxs(Yn,{children:["/card/",e.slug]})]}),r.jsxs(wi,{defaultValue:"content",children:[r.jsxs(_i,{className:"w-full",children:[r.jsx(sn,{value:"content",className:"flex-1",children:"Content"}),r.jsx(sn,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(sn,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(sn,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(Sn,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ze,{children:"Published"}),r.jsx(As,{checked:T.is_published,onCheckedChange:G=>P(ee=>({...ee,is_published:G}))})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Agent Photo"}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs(ea,{className:"h-16 w-16",children:[r.jsx(Ci,{src:l||void 0}),r.jsx(ta,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:F,disabled:u}),r.jsx(Q,{variant:"outline",size:"sm",asChild:!0,disabled:u,children:r.jsx("span",{children:u?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(bo,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{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(lt,{value:N,onChange:G=>k(G.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"agent-name",className:"rounded-l-none"})]}),r.jsx(Q,{variant:"outline",size:"sm",onClick:U,disabled:M||N===e.slug,className:"shrink-0",children:M?"Saving...":"Update"})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Theme"}),r.jsxs(un,{value:T.theme,onValueChange:G=>P(ee=>({...ee,theme:G})),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"standard",children:"✨ Standard (Modern Clean)"}),r.jsx($t,{value:"luxury",children:"🌙 Luxury (Dark & Gold)"}),r.jsx($t,{value:"bold",children:"🔥 Bold (Vibrant & Punchy)"}),r.jsx($t,{value:"classic",children:"📋 Classic (Professional)"})]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Title / Tagline"}),r.jsx(lt,{value:T.title,onChange:G=>P(ee=>({...ee,title:G.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(ze,{children:"Positioning Statement"}),r.jsx(lt,{value:T.positioning_statement,onChange:G=>P(ee=>({...ee,positioning_statement:G.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Bio"}),r.jsx(Zn,{value:T.bio,onChange:G=>P(ee=>({...ee,bio:G.target.value})),placeholder:"Short about me...",rows:3})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Review Snippet"}),r.jsx(lt,{value:T.review_snippet,onChange:G=>P(ee=>({...ee,review_snippet:G.target.value})),placeholder:"Best agent we've ever worked with..."})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Review Source URL"}),r.jsx(lt,{value:T.review_source_url,onChange:G=>P(ee=>({...ee,review_source_url:G.target.value})),placeholder:"https://g.page/your-business/review"})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Booking URL (optional — if empty, shows lead form)"}),r.jsx(lt,{value:T.booking_url,onChange:G=>P(ee=>({...ee,booking_url:G.target.value})),placeholder:"https://calendly.com/your-link"})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Custom CTA Label (optional)"}),r.jsx(lt,{value:T.custom_cta_label,onChange:G=>P(ee=>({...ee,custom_cta_label:G.target.value})),placeholder:"Book a Call"})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Custom CTA URL (optional)"}),r.jsx(lt,{value:T.custom_cta_url,onChange:G=>P(ee=>({...ee,custom_cta_url:G.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(ze,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(lt,{value:T.brokerage_display_name,onChange:G=>P(ee=>({...ee,brokerage_display_name:G.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:()=>P(G=>({...G,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(bo,{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:G=>V(G,"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(ze,{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(Np,{value:[T.brokerage_logo_size||56],onValueChange:([G])=>P(ee=>({...ee,brokerage_logo_size:G})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(ze,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(lt,{value:T.team_name,onChange:G=>P(ee=>({...ee,team_name:G.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:()=>P(G=>({...G,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(bo,{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:G=>V(G,"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(ze,{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(Np,{value:[T.team_logo_size||56],onValueChange:([G])=>P(ee=>({...ee,team_logo_size:G})),min:24,max:120,step:4})]})]})]})]}),r.jsx(Sn,{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:G,label:ee,hint:ae})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(ze,{children:ee}),ae&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[ae," ",G==="show_photo"&&r.jsx("a",{href:"/profile",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:"Update Profile"})]})]}),r.jsx(As,{checked:T[G],onCheckedChange:oe=>P(pe=>({...pe,[G]:oe}))})]},G))}),r.jsx(Sn,{value:"blocks",className:"mt-4",children:r.jsx(PVe,{cardId:e.id})}),r.jsx(Sn,{value:"analytics",className:"mt-4",children:a?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(He,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.views}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Views"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.clicks}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),r.jsx(He,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.leads.length}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Leads"})]})})]}),a.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:a.leads.slice(0,5).map(G=>r.jsxs("div",{className:"text-sm p-2 bg-muted/50 rounded-lg",children:[r.jsx("span",{className:"font-medium",children:G.name}),G.phone&&r.jsxs("span",{className:"text-muted-foreground",children:[" · ",G.phone]}),G.intent&&r.jsx(At,{variant:"secondary",className:"ml-2 text-xs",children:G.intent})]},G.id))})]})]}):r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No analytics data yet"})})]}),r.jsx(Q,{onClick:W,disabled:s.isPending,className:"w-full mt-4",children:s.isPending?"Saving...":"Save Changes"})]})}),r.jsx(S0e,{open:x,onClose:()=>y(!1),imageSrc:v,onCropComplete:D,aspectRatio:1})]})}const aC={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"},lve={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 cve(e=!0){return Zt({queryKey:["marketplace-categories",e],queryFn:async()=>{let t=Y.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 MJt(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.from("marketplace_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Ae.success("Category created successfully")},onError:t=>{Ae.error("Failed to create category: "+t.message)}})}function TJt(){const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("marketplace_categories").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Ae.success("Category updated successfully")},onError:t=>{Ae.error("Failed to update category: "+t.message)}})}function AJt(){const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("marketplace_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Ae.success("Category deleted successfully")},onError:t=>{Ae.error("Failed to delete category: "+t.message)}})}function KVe(e,t=!0){return Zt({queryKey:["marketplace-products",e,t],queryFn:async()=>{let n=Y.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:a}=await n;if(a)throw a;return s}})}function EJt(e){return Zt({queryKey:["marketplace-product",e],queryFn:async()=>{const{data:t,error:n}=await Y.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 IJt(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.from("marketplace_products").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),Ae.success("Product created successfully")},onError:t=>{Ae.error("Failed to create product: "+t.message)}})}function PJt(){const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("marketplace_products").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.id]}),Ae.success("Product updated successfully")},onError:t=>{Ae.error("Failed to update product: "+t.message)}})}function LJt(){const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("marketplace_products").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),Ae.success("Product deleted successfully")},onError:t=>{Ae.error("Failed to delete product: "+t.message)}})}function OJt(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.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 DJt(){const e=Vr();return ar({mutationFn:async({id:t,productId:n})=>{const{error:s}=await Y.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]}),Ae.success("Image deleted successfully")},onError:t=>{Ae.error("Failed to delete image: "+t.message)}})}function RJt(){const e=Vr();return ar({mutationFn:async({imageId:t,productId:n})=>{const{error:s}=await Y.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:a}=await Y.from("marketplace_product_images").update({is_primary:!0}).eq("id",t);if(a)throw a;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),Ae.success("Primary image updated")},onError:t=>{Ae.error("Failed to set primary image: "+t.message)}})}function FJt(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.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]}),Ae.success("Variant added successfully")}})}function zJt(){const e=Vr();return ar({mutationFn:async({id:t,productId:n})=>{const{error:s}=await Y.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]}),Ae.success("Variant deleted successfully")}})}function BJt(){const e=Vr();return ar({mutationFn:async({productId:t,videoUrl:n})=>{await Y.from("marketplace_product_videos").delete().eq("product_id",t);const{data:s,error:a}=await Y.from("marketplace_product_videos").insert({product_id:t,video_url:n}).select().single();if(a)throw a;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.productId]}),Ae.success("Video updated successfully")}})}function $Jt(e){const{isAdmin:t}=tn();return Zt({queryKey:["marketplace-orders",e,t],queryFn:async()=>{let n=Y.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:a}=await n;if(a)throw a;if(t&&s){const o=[...new Set(s.map(u=>u.user_id))],{data:l}=await Y.from("profiles").select("id, name, email").in("id",o),i=new Map((l==null?void 0:l.map(u=>[u.id,u]))||[]);return s.map(u=>({...u,user:i.get(u.user_id)}))}return s}})}function UJt(){const{user:e}=tn();return Zt({queryKey:["my-marketplace-orders",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Y.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 qJt(e){return Zt({queryKey:["marketplace-order",e],queryFn:async()=>{const{data:t,error:n}=await Y.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 VJt(){const e=Vr(),{user:t}=tn();return ar({mutationFn:async({orderId:n,status:s,notes:a,trackingNumber:o,trackingUrl:l,previousStatus:i})=>{const u={status:s};o!==void 0&&(u.tracking_number=o),l!==void 0&&(u.tracking_url=l);const{error:m}=await Y.from("marketplace_orders").update(u).eq("id",n);if(m)throw m;const{error:x}=await Y.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:a,created_by:t==null?void 0:t.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(s)&&s!==i)try{await Y.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:l}})}catch(v){console.error("Failed to send notification email:",v)}},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ae.success("Order status updated")},onError:n=>{Ae.error("Failed to update order: "+n.message)}})}function HJt(){const e=Vr();return ar({mutationFn:async({itemId:t,proofUrl:n,proofNotes:s,orderId:a})=>{const{error:o}=await Y.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",t);if(o)throw o;await Y.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",a);try{await Y.functions.invoke("marketplace-order-notify",{body:{orderId:a,notificationType:"proof_ready"}})}catch(l){console.error("Failed to send proof notification:",l)}return a},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ae.success("Proof uploaded & customer notified")}})}function WJt(){const e=Vr();return ar({mutationFn:async({itemId:t,orderId:n})=>{const{error:s}=await Y.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"]}),Ae.success("Proof approved")}})}function GJt(){const e=Vr();return ar({mutationFn:async({itemId:t,orderId:n,reason:s})=>{const{error:a}=await Y.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",t);if(a)throw a;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ae.success("Proof rejected - please upload a new proof")}})}function KJt(){const{data:e,isLoading:t}=cve(!1),n=MJt(),s=TJt(),a=AJt(),[o,l]=A.useState(!1),[i,u]=A.useState(null),[m,x]=A.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),y=()=>{x({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),u(null)},v=k=>{u(k),x({name:k.name,description:k.description||"",image_url:k.image_url||"",sort_order:k.sort_order,is_active:k.is_active}),l(!0)},b=async k=>{k.preventDefault(),i?await s.mutateAsync({id:i.id,...m}):await n.mutateAsync(m),l(!1),y()},N=async k=>{confirm("Are you sure you want to delete this category?")&&await a.mutateAsync(k)};return t?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Er,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(k=>r.jsx(Er,{className:"h-12 w-full"},k))})})]}):r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Gt,{children:"Categories"}),r.jsxs(Rr,{open:o,onOpenChange:k=>{l(k),k||y()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:i?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:b,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"name",children:"Name"}),r.jsx(lt,{id:"name",value:m.name,onChange:k=>x({...m,name:k.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",value:m.description,onChange:k=>x({...m,description:k.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"image_url",children:"Image URL"}),r.jsx(lt,{id:"image_url",value:m.image_url,onChange:k=>x({...m,image_url:k.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(lt,{id:"sort_order",type:"number",value:m.sort_order,onChange:k=>x({...m,sort_order:parseInt(k.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{id:"is_active",checked:m.is_active,onCheckedChange:k=>x({...m,is_active:k})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]}),r.jsx(Q,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:i?"Update Category":"Create Category"})]})]})]})]}),r.jsx(et,{children:e&&e.length>0?r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{children:"Sort Order"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:e.map(k=>r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-medium",children:k.name}),r.jsx(yt,{className:"max-w-xs truncate",children:k.description}),r.jsx(yt,{children:k.sort_order}),r.jsx(yt,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${k.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:k.is_active?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>v(k),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>N(k.id),disabled:a.isPending,children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},k.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function ZJt(){var _e,we;const{data:e,isLoading:t}=KVe(void 0,!1),{data:n}=cve(!1),s=IJt(),a=PJt(),o=LJt(),l=OJt(),i=DJt(),u=RJt(),m=FJt(),x=zJt(),y=BJt(),[v,b]=A.useState(!1),[N,k]=A.useState(!1),[M,I]=A.useState(!1),[T,P]=A.useState(null),[F,D]=A.useState(null),[U,V]=A.useState(!1),[W,G]=A.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}),[ee,ae]=A.useState({name:"",price_adjustment:0}),[oe,pe]=A.useState(""),ne=()=>{G({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),P(null)},fe=ve=>{P(ve),G({name:ve.name,description:ve.description||"",base_price:Number(ve.base_price),shipping_fee:Number(ve.shipping_fee),category_id:ve.category_id||"",allow_artwork_upload:ve.allow_artwork_upload,requires_proof_approval:ve.requires_proof_approval,is_active:ve.is_active,sort_order:ve.sort_order}),b(!0)},se=async ve=>{ve.preventDefault();const Xe={...W,category_id:W.category_id||null};T?await a.mutateAsync({id:T.id,...Xe}):await s.mutateAsync(Xe),b(!1),ne()},me=async ve=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(ve)},ue=async ve=>{if(!F||!ve.target.files||ve.target.files.length===0)return;V(!0);const Xe=ve.target.files[0],Me=Xe.name.split(".").pop(),Ie=`products/${F.id}/${Date.now()}.${Me}`;try{const{error:$e}=await Y.storage.from("marketplace").upload(Ie,Xe);if($e)throw $e;const{data:{publicUrl:Be}}=Y.storage.from("marketplace").getPublicUrl(Ie);await l.mutateAsync({product_id:F.id,image_url:Be,is_primary:!F.images||F.images.length===0}),Ae.success("Image uploaded successfully")}catch($e){Ae.error("Failed to upload image: "+$e.message)}finally{V(!1)}},xe=async ve=>{ve.preventDefault(),F&&(await m.mutateAsync({product_id:F.id,name:ee.name,price_adjustment:ee.price_adjustment}),ae({name:"",price_adjustment:0}))},Te=async()=>{!F||!oe||(await y.mutateAsync({productId:F.id,videoUrl:oe}),pe(""))};return t?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Er,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(ve=>r.jsx(Er,{className:"h-64 w-full"},ve))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Gt,{children:"Products"}),r.jsxs(Rr,{open:v,onOpenChange:ve=>{b(ve),ve||ne()},children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Br,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:se,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(ze,{htmlFor:"name",children:"Product Name"}),r.jsx(lt,{id:"name",value:W.name,onChange:ve=>G({...W,name:ve.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"category",children:"Category"}),r.jsxs(un,{value:W.category_id,onValueChange:ve=>G({...W,category_id:ve}),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select category"})}),r.jsx(cn,{children:n==null?void 0:n.map(ve=>r.jsx($t,{value:ve.id,children:ve.name},ve.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"description",children:"Description"}),r.jsx(Zn,{id:"description",value:W.description,onChange:ve=>G({...W,description:ve.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(ze,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(lt,{id:"base_price",type:"number",step:"0.01",min:"0",value:W.base_price,onChange:ve=>G({...W,base_price:parseFloat(ve.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(lt,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:W.shipping_fee,onChange:ve=>G({...W,shipping_fee:parseFloat(ve.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(lt,{id:"sort_order",type:"number",value:W.sort_order,onChange:ve=>G({...W,sort_order:parseInt(ve.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{id:"allow_artwork_upload",checked:W.allow_artwork_upload,onCheckedChange:ve=>G({...W,allow_artwork_upload:ve})}),r.jsx(ze,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{id:"requires_proof_approval",checked:W.requires_proof_approval,onCheckedChange:ve=>G({...W,requires_proof_approval:ve})}),r.jsx(ze,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{id:"is_active",checked:W.is_active,onCheckedChange:ve=>G({...W,is_active:ve})}),r.jsx(ze,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(Q,{type:"submit",className:"w-full",disabled:s.isPending||a.isPending,children:T?"Update Product":"Create Product"})]})]})]})]}),r.jsx(et,{children:e&&e.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(ve=>{var Xe,Me;return r.jsxs(He,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[ve.images&&ve.images.length>0?r.jsx("img",{src:((Xe=ve.images.find(Ie=>Ie.is_primary))==null?void 0:Xe.image_url)||ve.images[0].image_url,alt:ve.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"}),!ve.is_active&&r.jsx(At,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:ve.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Me=ve.category)==null?void 0:Me.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(ve.base_price).toFixed(2)]}),Number(ve.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(ve.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[ve.allow_artwork_upload&&r.jsx(At,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),ve.requires_proof_approval&&r.jsx(At,{variant:"outline",className:"text-xs",children:"Proof Required"}),ve.variants&&ve.variants.length>0&&r.jsxs(At,{variant:"outline",className:"text-xs",children:[ve.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>fe(ve),children:[r.jsx(Qa,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{D(ve),k(!0)},children:[r.jsx(Dj,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>{D(ve),I(!0)},children:[r.jsx(qg,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>me(ve.id),children:r.jsx(Bn,{className:"h-3 w-3 text-destructive"})})]})]})]},ve.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(Rr,{open:N,onOpenChange:k,children:r.jsxs(Dr,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Br,{children:["Manage Images - ",F==null?void 0:F.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(_e=F==null?void 0:F.images)==null?void 0:_e.map(ve=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:ve.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),ve.is_primary&&r.jsx(At,{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:[!ve.is_primary&&r.jsx(Q,{variant:"secondary",size:"icon",onClick:async()=>{var Xe;await u.mutateAsync({imageId:ve.id,productId:F.id}),D({...F,images:(Xe=F.images)==null?void 0:Xe.map(Me=>({...Me,is_primary:Me.id===ve.id}))})},disabled:u.isPending,title:"Set as primary",children:r.jsx(ks,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"destructive",size:"icon",onClick:async()=>{var Me;await i.mutateAsync({id:ve.id,productId:F.id});const Xe=e==null?void 0:e.find(Ie=>Ie.id===F.id);Xe&&D({...Xe,images:(Me=Xe.images)==null?void 0:Me.filter(Ie=>Ie.id!==ve.id)})},disabled:i.isPending,children:r.jsx(Bn,{className:"h-4 w-4"})})]})]},ve.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:ue,className:"hidden",id:"image-upload",disabled:U}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(Dj,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:U?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx(ze,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(lt,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:oe,onChange:ve=>pe(ve.target.value)}),r.jsxs(Q,{onClick:Te,disabled:!oe,children:[r.jsx(Ia,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),(F==null?void 0:F.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",F.video.video_url]})]})]})]})}),r.jsx(Rr,{open:M,onOpenChange:I,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsxs(Br,{children:["Manage Variants - ",F==null?void 0:F.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:xe,className:"flex gap-2",children:[r.jsx(lt,{placeholder:"Variant name (e.g., 500 count)",value:ee.name,onChange:ve=>ae({...ee,name:ve.target.value}),required:!0}),r.jsx(lt,{type:"number",step:"0.01",placeholder:"Price adj.",value:ee.price_adjustment,onChange:ve=>ae({...ee,price_adjustment:parseFloat(ve.target.value)||0}),className:"w-32"}),r.jsx(Q,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(we=F==null?void 0:F.variants)==null?void 0:we.map(ve=>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:ve.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(ve.price_adjustment)>=0?"+":"","$",Number(ve.price_adjustment).toFixed(2)]})]}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:ve.id,productId:F.id}),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]},ve.id)),(!(F!=null&&F.variants)||F.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 YJt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function XJt(){var k,M,I;const{data:e,isLoading:t}=$Jt(),n=VJt(),s=HJt(),[a,o]=A.useState(null),[l,i]=A.useState(!1),[u,m]=A.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,y]=A.useState(!1),v=T=>{o(T),m({status:T.status,notes:"",trackingNumber:T.tracking_number||"",trackingUrl:T.tracking_url||""}),i(!0)},b=async()=>{a&&(await n.mutateAsync({orderId:a.id,status:u.status,notes:u.notes,trackingNumber:u.trackingNumber,trackingUrl:u.trackingUrl,previousStatus:a.status}),i(!1))},N=async(T,P)=>{if(!a||!T.target.files||T.target.files.length===0)return;y(!0);const F=T.target.files[0],D=F.name.split(".").pop(),U=`proofs/${a.id}/${P}/${Date.now()}.${D}`;try{const{error:V}=await Y.storage.from("marketplace").upload(U,F);if(V)throw V;const{data:{publicUrl:W}}=Y.storage.from("marketplace").getPublicUrl(U);await s.mutateAsync({itemId:P,proofUrl:W,orderId:a.id}),Ae.success("Proof uploaded successfully")}catch(V){Ae.error("Failed to upload proof: "+V.message)}finally{y(!1)}};return t?r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Er,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Er,{className:"h-16 w-full"},T))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Orders"})}),r.jsx(et,{children:e&&e.length>0?r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Order #"}),r.jsx(Mt,{children:"Customer"}),r.jsx(Mt,{children:"Date"}),r.jsx(Mt,{children:"Total"}),r.jsx(Mt,{children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:e.map(T=>{var P,F;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"font-mono",children:T.order_number}),r.jsx(yt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((P=T.user)==null?void 0:P.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(F=T.user)==null?void 0:F.email})]})}),r.jsx(yt,{children:on(new Date(T.created_at),"MMM d, yyyy")}),r.jsxs(yt,{className:"font-bold",children:["$",Number(T.total).toFixed(2)]}),r.jsx(yt,{children:r.jsx(At,{className:lve[T.status],children:aC[T.status]})}),r.jsx(yt,{className:"text-right",children:r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>v(T),children:[r.jsx(_o,{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(Rr,{open:l,onOpenChange:i,children:r.jsxs(Dr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsxs(Br,{children:["Order ",a==null?void 0:a.order_number]})}),a&&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:(k=a.user)==null?void 0:k.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(M=a.user)==null?void 0:M.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:a.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.shipping_address,r.jsx("br",{}),a.shipping_city,", ",a.shipping_state," ",a.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:(I=a.items)==null?void 0:I.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(At,{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:P=>N(P,T.id),className:"hidden",id:`proof-${T.id}`,disabled:x}),r.jsx("label",{htmlFor:`proof-${T.id}`,children:r.jsx(Q,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(bo,{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(a.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(a.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(a.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(ze,{children:"Status"}),r.jsxs(un,{value:u.status,onValueChange:T=>m({...u,status:T}),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:YJt.map(T=>r.jsx($t,{value:T,children:aC[T]},T))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Tracking Number"}),r.jsx(lt,{value:u.trackingNumber,onChange:T=>m({...u,trackingNumber:T.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Tracking URL"}),r.jsx(lt,{value:u.trackingUrl,onChange:T=>m({...u,trackingUrl:T.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Notes (optional)"}),r.jsx(Zn,{value:u.notes,onChange:T=>m({...u,notes:T.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(Q,{onClick:b,disabled:n.isPending,className:"w-full",children:[r.jsx(ql,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),a.status_history&&a.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:a.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(At,{variant:"outline",children:aC[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:on(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function QJt(){const[e,t]=A.useState("products"),n=Vn();return r.jsx(Fr,{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(Q,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(wi,{value:e,onValueChange:t,children:[r.jsxs(_i,{className:"grid w-full grid-cols-3",children:[r.jsxs(sn,{value:"products",className:"flex items-center gap-2",children:[r.jsx(ql,{className:"h-4 w-4"}),"Products"]}),r.jsxs(sn,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(Ap,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(sn,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(Ah,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(Sn,{value:"products",children:r.jsx(ZJt,{})}),r.jsx(Sn,{value:"categories",children:r.jsx(KJt,{})}),r.jsx(Sn,{value:"orders",children:r.jsx(XJt,{})})]})]})})}function ZVe(){return Zt({queryKey:["reward-categories"],queryFn:async()=>{const{data:e,error:t}=await Y.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(t)throw t;return e}})}function JJt(e){return Zt({queryKey:["reward-items",e],queryFn:async()=>{let t=Y.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 eer(e){return Zt({queryKey:["active-reward-items",e],queryFn:async()=>{let t=Y.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 ter(e){return Zt({queryKey:["user-purchases",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Y.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 rer(){return Zt({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:e,error:t}=await Y.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:a}=await Y.from("profiles").select("id, name, email").in("id",n);if(a)throw a;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 ner(e){return Zt({queryKey:["spendable-points",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:n}=await Y.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 ser(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.rpc("purchase_reward_item",{p_item_id:t});if(s)throw s;const a=n;if(!a.success)throw new Error(a.error||"Purchase failed");return a},onSuccess:()=>{e.invalidateQueries({queryKey:["user-purchases"]}),e.invalidateQueries({queryKey:["spendable-points"]}),e.invalidateQueries({queryKey:["active-reward-items"]}),e.invalidateQueries({queryKey:["reward-items"]})}})}function aer(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.from("reward_store_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function ier(){const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("reward_store_categories").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function oer(){const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.from("reward_store_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function ler(){const e=Vr();return ar({mutationFn:async t=>{const{data:n,error:s}=await Y.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 cer(){const e=Vr();return ar({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Y.from("reward_store_items").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function der(){const e=Vr();return ar({mutationFn:async t=>{const{error:n}=await Y.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 uer(e){const t=e.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return t?{bucket:t[1],path:t[2]}:null}async function gue(e,t){const n=uer(e);if(n)try{const{data:s,error:a}=await Y.storage.from(n.bucket).download(n.path);if(a){console.error("Error downloading file:",a),Ae.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),Ae.error("Failed to download file")}else try{const a=await(await fetch(e)).blob(),o=URL.createObjectURL(a),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),Ae.error("Failed to download file")}}function YVe(){return Zt({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:e,error:t}=await Y.from("point_reward_settings").select("*").order("action_name");if(t)throw t;return e}})}function her(){const e=Vr();return ar({mutationFn:async({id:t,points:n,is_active:s})=>{const a={points:n};s!==void 0&&(a.is_active=s);const{data:o,error:l}=await Y.from("point_reward_settings").update(a).eq("id",t).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["point-reward-settings"]})}})}function mer(){const{user:e}=tn(),[t,n]=A.useState("items"),[s,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState(""),[m,x]=A.useState(""),[y,v]=A.useState(""),[b,N]=A.useState(null),[k,M]=A.useState(!1),[I,T]=A.useState(null),[P,F]=A.useState(""),[D,U]=A.useState(""),[V,W]=A.useState(null),[G,ee]=A.useState(""),[ae,oe]=A.useState("file"),[pe,ne]=A.useState(""),[fe,se]=A.useState(""),[me,ue]=A.useState(""),[xe,Te]=A.useState(!0),[_e,we]=A.useState(null),[ve,Xe]=A.useState(!1),[Me,Ie]=A.useState(!1),$e=A.useRef(null),Be=A.useRef(null),{data:Ve,isLoading:ot}=ZVe(),{data:Tt,isLoading:Oe}=JJt(),{data:at,isLoading:le}=rer(),{data:qe,isLoading:Je}=YVe(),st=aer(),je=ier(),ut=oer(),Ce=ler(),Ee=cer(),Ze=der(),Le=her(),[Ke,tt]=A.useState({}),ct=dr=>{dr?(l(dr),u(dr.name),x(dr.description||""),v(dr.icon||"")):(l(null),u(""),x(""),v("")),a(!0)},it=async()=>{if(!i.trim()){Ae.error("Please enter a category name");return}try{o?(await je.mutateAsync({id:o.id,name:i,description:m||null,icon:y||null}),Ae.success("Category updated successfully")):(await st.mutateAsync({name:i,description:m||null,icon:y||null,sort_order:((Ve==null?void 0:Ve.length)||0)+1}),Ae.success("Category created successfully")),a(!1)}catch(dr){console.error("Error saving category:",dr),Ae.error("Failed to save category")}},zt=async()=>{if(b)try{await ut.mutateAsync(b),Ae.success("Category deleted successfully"),N(null)}catch(dr){console.error("Error deleting category:",dr),Ae.error("Failed to delete category")}},Lt=dr=>{var En;dr?(T(dr),F(dr.name),U(dr.description||""),W(dr.category_id),ee(dr.points_cost.toString()),oe(dr.item_type),ne(dr.file_url||""),se(dr.preview_image_url||""),ue(((En=dr.max_quantity)==null?void 0:En.toString())||""),Te(dr.is_active)):(T(null),F(""),U(""),W(null),ee(""),oe("file"),ne(""),se(""),ue(""),Te(!0)),M(!0)},lr=async(dr,En)=>{En==="file"?Xe(!0):Ie(!0);try{const Es=dr.name.split(".").pop(),Hs=`${Date.now()}-${Math.random().toString(36).substring(7)}.${Es}`,Ei=`${En==="file"?"items":"previews"}/${Hs}`,{error:Ii}=await Y.storage.from("reward-store").upload(Ei,dr);if(Ii)throw Ii;const{data:{publicUrl:Ho}}=Y.storage.from("reward-store").getPublicUrl(Ei);En==="file"?ne(Ho):se(Ho),Ae.success("File uploaded successfully")}catch(Es){console.error("Error uploading file:",Es),Ae.error("Failed to upload file")}finally{En==="file"?Xe(!1):Ie(!1)}},Ar=async()=>{if(!P.trim()){Ae.error("Please enter an item name");return}if(!G||parseInt(G)<0){Ae.error("Please enter a valid points cost");return}try{const dr={name:P,description:D||null,category_id:V,points_cost:parseInt(G),item_type:ae,file_url:pe||null,preview_image_url:fe||null,max_quantity:me?parseInt(me):null,current_quantity:me?parseInt(me):null,is_active:xe,created_by:e==null?void 0:e.id};I?(await Ee.mutateAsync({id:I.id,...dr,current_quantity:I.max_quantity!==(me?parseInt(me):null)?me?parseInt(me):null:I.current_quantity}),Ae.success("Item updated successfully")):(await Ce.mutateAsync(dr),Ae.success("Item created successfully")),M(!1)}catch(dr){console.error("Error saving item:",dr),Ae.error("Failed to save item")}},Mr=async()=>{if(_e)try{await Ze.mutateAsync(_e),Ae.success("Item deleted successfully"),we(null)}catch(dr){console.error("Error deleting item:",dr),Ae.error("Failed to delete item")}},Zr=async(dr,En)=>{const Es=Ke[dr];if(Es===void 0||Es===En.toString())return;const Hs=parseInt(Es);if(isNaN(Hs)||Hs<0){Ae.error("Please enter a valid positive number");return}try{await Le.mutateAsync({id:dr,points:Hs}),Ae.success("Points updated successfully"),tt(Ei=>{const Ii={...Ei};return delete Ii[dr],Ii})}catch(Ei){console.error("Error updating points:",Ei),Ae.error("Failed to update points")}};return ot||Oe||le||Je?r.jsx(Fr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{className:"h-8 w-64"}),r.jsx(Er,{className:"h-96"})]})}):r.jsxs(Fr,{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(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ql,{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:(Tt==null?void 0:Tt.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(Tt==null?void 0:Tt.filter(dr=>dr.is_active).length)||0," active"]})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ap,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Ve==null?void 0:Ve.length)||0})]})}),r.jsx(He,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ks,{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:[Tt&&Tt.length>0?Math.round(Tt.reduce((dr,En)=>dr+En.points_cost,0)/Tt.length):0," pts"]})]})})]}),r.jsxs(wi,{value:t,onValueChange:n,children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"items",children:"Items"}),r.jsx(sn,{value:"categories",children:"Categories"}),r.jsx(sn,{value:"purchases",children:"Purchases"}),r.jsx(sn,{value:"point-settings",children:"Point Settings"})]}),r.jsx(Sn,{value:"items",className:"mt-4",children:r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Store Items"}),r.jsx(jn,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(Q,{onClick:()=>Lt(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(et,{children:!Tt||Tt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ao,{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(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Item"}),r.jsx(Mt,{children:"Category"}),r.jsx(Mt,{className:"text-center",children:"Cost"}),r.jsx(Mt,{className:"text-center",children:"Type"}),r.jsx(Mt,{className:"text-center",children:"Quantity"}),r.jsx(Mt,{className:"text-center",children:"Status"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:Tt.map(dr=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[dr.preview_image_url?r.jsx("img",{src:dr.preview_image_url,alt:dr.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(ao,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:dr.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:dr.description||"No description"})]})]})}),r.jsx(yt,{children:dr.category?r.jsx(At,{variant:"outline",children:dr.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(yt,{className:"text-center",children:r.jsxs(At,{variant:"secondary",className:"font-bold",children:[r.jsx(ks,{className:"h-3 w-3 mr-1"}),dr.points_cost]})}),r.jsx(yt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[dr.item_type==="file"?r.jsx(_a,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Oo,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:dr.item_type})]})}),r.jsx(yt,{className:"text-center",children:dr.max_quantity!==null?r.jsxs("span",{className:dr.current_quantity===0?"text-red-500":"",children:[dr.current_quantity,"/",dr.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(yt,{className:"text-center",children:r.jsx(At,{variant:dr.is_active?"default":"secondary",children:dr.is_active?"Active":"Inactive"})}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>Lt(dr),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>we(dr.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},dr.id))})]})})]})}),r.jsx(Sn,{value:"categories",className:"mt-4",children:r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Gt,{children:"Categories"}),r.jsx(jn,{children:"Organize your store items into categories"})]}),r.jsxs(Q,{onClick:()=>ct(),children:[r.jsx(_n,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(et,{children:!Ve||Ve.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ap,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Name"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"text-center",children:"Items"}),r.jsx(Mt,{className:"text-right",children:"Actions"})]})}),r.jsx(Fs,{children:Ve.map(dr=>r.jsxs(Sr,{children:[r.jsxs(yt,{className:"font-medium",children:[dr.icon&&r.jsx("span",{className:"mr-2",children:dr.icon}),dr.name]}),r.jsx(yt,{className:"text-muted-foreground",children:dr.description||"—"}),r.jsx(yt,{className:"text-center",children:(Tt==null?void 0:Tt.filter(En=>En.category_id===dr.id).length)||0}),r.jsx(yt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>ct(dr),children:r.jsx(Qa,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>N(dr.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},dr.id))})]})})]})}),r.jsx(Sn,{value:"purchases",className:"mt-4",children:r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Ah,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(jn,{children:"View all reward redemptions by agents"})]}),r.jsx(et,{children:!at||at.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ah,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Date"}),r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{children:"Item"}),r.jsx(Mt,{className:"text-center",children:"Points Spent"})]})}),r.jsx(Fs,{children:at.map(dr=>{var En,Es,Hs,Ei;return r.jsxs(Sr,{children:[r.jsx(yt,{className:"text-muted-foreground",children:on(new Date(dr.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(yt,{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(ic,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((En=dr.user)==null?void 0:En.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((Es=dr.user)==null?void 0:Es.email)||"—"})]})]})}),r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(Hs=dr.item)!=null&&Hs.preview_image_url?r.jsx("img",{src:dr.item.preview_image_url,alt:dr.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(ao,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((Ei=dr.item)==null?void 0:Ei.name)||"Deleted item"})]})}),r.jsx(yt,{className:"text-center",children:r.jsxs(At,{variant:"secondary",className:"font-bold",children:[r.jsx(ks,{className:"h-3 w-3 mr-1"}),dr.points_spent]})})]},dr.id)})})]})})]})})]})]}),r.jsx(Rr,{open:s,onOpenChange:a,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:o?"Edit Category":"Add Category"}),r.jsx(Yn,{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(ze,{htmlFor:"categoryName",children:"Name"}),r.jsx(lt,{id:"categoryName",value:i,onChange:dr=>u(dr.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(Zn,{id:"categoryDescription",value:m,onChange:dr=>x(dr.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(lt,{id:"categoryIcon",value:y,onChange:dr=>v(dr.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(Q,{onClick:it,disabled:st.isPending||je.isPending,children:st.isPending||je.isPending?"Saving...":"Save"})]})]})}),r.jsx(Rr,{open:k,onOpenChange:M,children:r.jsxs(Dr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Br,{children:I?"Edit Item":"Add Item"}),r.jsx(Yn,{children:I?"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(ze,{htmlFor:"itemName",children:"Name *"}),r.jsx(lt,{id:"itemName",value:P,onChange:dr=>F(dr.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"itemDescription",children:"Description"}),r.jsx(Zn,{id:"itemDescription",value:D,onChange:dr=>U(dr.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(ze,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(un,{value:V||"none",onValueChange:dr=>W(dr==="none"?null:dr),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select category"})}),r.jsxs(cn,{children:[r.jsx($t,{value:"none",children:"No category"}),Ve==null?void 0:Ve.map(dr=>r.jsxs($t,{value:dr.id,children:[dr.icon&&`${dr.icon} `,dr.name]},dr.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(lt,{id:"itemPointsCost",type:"number",min:"0",value:G,onChange:dr=>ee(dr.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(ze,{htmlFor:"itemType",children:"Type"}),r.jsxs(un,{value:ae,onValueChange:oe,children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"file",children:"File Download"}),r.jsx($t,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(lt,{id:"itemMaxQuantity",type:"number",min:"1",value:me,onChange:dr=>ue(dr.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:pe,onChange:dr=>ne(dr.target.value),placeholder:ae==="file"?"Upload a file or paste URL":"Paste external link"}),ae==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>{var dr;return(dr=$e.current)==null?void 0:dr.click()},disabled:ve,children:r.jsx(bo,{className:"h-4 w-4"})}),r.jsx("input",{ref:$e,type:"file",className:"hidden",onChange:dr=>{var Es;const En=(Es=dr.target.files)==null?void 0:Es[0];En&&lr(En,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(lt,{value:fe,onChange:dr=>se(dr.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(Q,{type:"button",variant:"outline",size:"icon",onClick:()=>{var dr;return(dr=Be.current)==null?void 0:dr.click()},disabled:Me,children:r.jsx(Fl,{className:"h-4 w-4"})}),r.jsx("input",{ref:Be,type:"file",accept:"image/*",className:"hidden",onChange:dr=>{var Es;const En=(Es=dr.target.files)==null?void 0:Es[0];En&&lr(En,"preview")}})]}),fe&&r.jsx("img",{src:fe,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(As,{id:"itemIsActive",checked:xe,onCheckedChange:Te}),r.jsx(ze,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),r.jsx(Q,{onClick:Ar,disabled:Ce.isPending||Ee.isPending,children:Ce.isPending||Ee.isPending?"Saving...":"Save"})]})]})}),r.jsx(Pd,{open:!!b,onOpenChange:()=>N(null),children:r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Delete Category"}),r.jsx(hd,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:zt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(Pd,{open:!!_e,onOpenChange:()=>we(null),children:r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Delete Item"}),r.jsx(hd,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:Mr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t==="point-settings"&&r.jsxs(He,{className:"mt-4",children:[r.jsx(Ht,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zd,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Gt,{children:"Point Reward Settings"}),r.jsx(jn,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(et,{children:!qe||qe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(zd,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Action"}),r.jsx(Mt,{children:"Description"}),r.jsx(Mt,{className:"text-center w-32",children:"Points"}),r.jsx(Mt,{className:"text-right w-24",children:"Save"})]})}),r.jsx(Fs,{children:qe.map(dr=>r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsx("p",{className:"font-medium",children:dr.action_name})}),r.jsx(yt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:dr.description})}),r.jsx(yt,{className:"text-center",children:r.jsx(lt,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:Ke[dr.id]??dr.points.toString(),onChange:En=>tt(Es=>({...Es,[dr.id]:En.target.value}))})}),r.jsx(yt,{className:"text-right",children:r.jsx(Q,{size:"sm",variant:"outline",disabled:Ke[dr.id]===void 0||Ke[dr.id]===dr.points.toString()||Le.isPending,onClick:()=>Zr(dr.id,dr.points),children:r.jsx(Ip,{className:"h-4 w-4"})})})]},dr.id))})]})})]})]})}const CTe=()=>r.jsxs("svg",{viewBox:"0 0 100 100",className:"h-5 w-5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("rect",{width:"100",height:"100",rx:"20",fill:"#7D2AE8"}),r.jsx("path",{d:"M50 20C33.43 20 20 33.43 20 50C20 66.57 33.43 80 50 80C66.57 80 80 66.57 80 50C80 33.43 66.57 20 50 20ZM63.5 63.5C58.3 68.7 50 70.6 43.1 67.6C36.2 64.6 32 57.6 32 50C32 42.4 36.2 35.4 43.1 32.4C50 29.4 58.3 31.3 63.5 36.5L59.3 40.7C55.8 37.2 50.7 35.8 46 37.3C41.3 38.8 37.7 42.8 36.6 47.6C35.5 52.4 37 57.4 40.4 60.8C43.8 64.2 48.8 65.7 53.6 64.6C58.4 63.5 62.4 59.9 63.9 55.2L68.7 56.7C66.9 61.3 65.5 61.5 63.5 63.5Z",fill:"white"})]}),MTe=[{value:"template",label:"Templates"},{value:"brand",label:"Brand Assets"},{value:"listing",label:"Listing Assets"},{value:"social",label:"Social Media"},{value:"general",label:"General"}];function fer(){const e=Vr(),[t,n]=A.useState(!1),[s,a]=A.useState(!1),[o,l]=A.useState(!1),[i,u]=A.useState({brokerage_id:"",folder_id:"",folder_name:"",folder_type:"template",description:""}),{data:m,isLoading:x}=Zt({queryKey:["canva-integration"],queryFn:async()=>{const{data:T,error:P}=await Y.from("canva_integration").select("*").eq("is_active",!0).maybeSingle();if(P)throw P;return T}}),{data:y}=Zt({queryKey:["brokerages-list"],queryFn:async()=>{const{data:T,error:P}=await Y.from("brokerages").select("id, name").order("name");if(P)throw P;return T}}),{data:v}=Zt({queryKey:["canva-brokerage-folders"],queryFn:async()=>{const{data:T,error:P}=await Y.from("canva_brokerage_folders").select("*, brokerages(name)").order("sort_order");if(P)throw P;return T}}),b=async()=>{var T;n(!0);try{const{data:P}=await Y.auth.getSession(),F=(T=P==null?void 0:P.session)==null?void 0:T.access_token;if(!F)throw new Error("Not authenticated");const V=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"get_auth_url"})}),W=await V.json();if(!V.ok||W!=null&&W.error)throw new Error((W==null?void 0:W.error)||"Failed to get authorization URL");if(W!=null&&W.authUrl){localStorage.setItem("canva_code_verifier",W.codeVerifier),localStorage.setItem("canva_oauth_state",W.state);const G=window.open(W.authUrl,"canva-oauth","width=600,height=700,scrollbars=yes,resizable=yes");if(!G){Ae.error("Popup was blocked. Please allow popups for this site and try again."),n(!1);return}const ee=oe=>{var pe,ne;oe.origin===window.location.origin&&(((pe=oe.data)==null?void 0:pe.type)==="canva-oauth-success"?(window.removeEventListener("message",ee),Ae.success("Canva connected successfully!"),e.invalidateQueries({queryKey:["canva-integration"]}),n(!1)):((ne=oe.data)==null?void 0:ne.type)==="canva-oauth-error"&&(window.removeEventListener("message",ee),Ae.error("Canva connection failed: "+(oe.data.error||"Unknown error")),n(!1)))};window.addEventListener("message",ee);const ae=setInterval(()=>{G.closed&&(clearInterval(ae),window.removeEventListener("message",ee),e.invalidateQueries({queryKey:["canva-integration"]}),n(!1))},500)}else throw new Error("Failed to get authorization URL")}catch(P){console.error("Canva connect error:",P);const F=(P==null?void 0:P.message)||"";F.includes("CANVA_CLIENT_ID")?Ae.error("Canva app credentials not configured yet."):Ae.error(F||"Failed to start Canva connection"),n(!1)}},N=ar({mutationFn:async T=>{var G;const{data:P}=await Y.auth.getSession(),F=(G=P==null?void 0:P.session)==null?void 0:G.access_token;if(!F)throw new Error("Not authenticated");const V=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"disconnect",integrationId:T})}),W=await V.json();if(!V.ok||W!=null&&W.error)throw new Error((W==null?void 0:W.error)||"Failed to disconnect")},onSuccess:()=>{e.invalidateQueries({queryKey:["canva-integration"]}),Ae.success("Canva disconnected")},onError:T=>{Ae.error(T.message||"Failed to disconnect Canva")}}),k=ar({mutationFn:async T=>{const{error:P}=await Y.from("canva_brokerage_folders").insert({brokerage_id:T.brokerage_id,folder_id:T.folder_id.trim(),folder_name:T.folder_name.trim(),folder_type:T.folder_type,description:T.description.trim()||null,sort_order:(v==null?void 0:v.length)||0});if(P)throw P},onSuccess:()=>{e.invalidateQueries({queryKey:["canva-brokerage-folders"]}),Ae.success("Folder added"),l(!1),u({brokerage_id:"",folder_id:"",folder_name:"",folder_type:"template",description:""})},onError:()=>Ae.error("Failed to add folder")}),M=ar({mutationFn:async T=>{const{error:P}=await Y.from("canva_brokerage_folders").delete().eq("id",T);if(P)throw P},onSuccess:()=>{e.invalidateQueries({queryKey:["canva-brokerage-folders"]}),Ae.success("Folder removed")},onError:()=>Ae.error("Failed to remove folder")}),I=!!m;return r.jsxs(r.Fragment,{children:[r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx("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-lg bg-accent flex items-center justify-center",children:r.jsx(CTe,{})}),r.jsxs("div",{children:[r.jsxs(Gt,{className:"text-lg flex items-center gap-2",children:["Canva Connect",I&&r.jsx(At,{variant:"default",className:"text-xs",children:"Connected"}),r.jsx(At,{variant:"outline",className:"text-xs",children:"Admin Only"})]}),r.jsx(jn,{children:"Auto-share brokerage asset folders with agents when they connect their Canva accounts."})]})]})})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(oi,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),r.jsx("span",{children:"OAuth 2.0 + PKCE for secure authorization"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(oi,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),r.jsx("span",{children:"Map brokerage folders to auto-share with agents on connection"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(oi,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),r.jsx("span",{children:"Multiple folders per brokerage (templates, brand assets, listings)"})]}),r.jsxs("div",{className:"mt-4 p-3 rounded-lg bg-muted border border-dashed",children:[r.jsx("p",{className:"text-xs font-medium text-foreground mb-1",children:"Canva App Redirect URL"}),r.jsx("code",{className:"text-xs text-muted-foreground break-all select-all",children:"https://dashboard.relevelup.com/canva-callback.html"})]}),I?r.jsxs("div",{className:"space-y-3 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:m.canva_team_id?`Team: ${m.canva_team_id}`:"Canva Account"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:m.expires_at?`Token expires ${new Date(m.expires_at).toLocaleDateString()}`:"Platform integration active"})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect Canva?"}),r.jsx(hd,{children:"This will remove the Canva platform integration. Agents who have already connected will not be affected, but new folder sharing will stop."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>N.mutate(m.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}),r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>a(!s),className:"w-full flex items-center justify-between p-3 text-sm font-medium hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ap,{className:"h-4 w-4 text-primary"}),"Brokerage Folder Mappings",v&&v.length>0&&r.jsx(At,{variant:"secondary",className:"text-xs",children:v.length})]}),s?r.jsx(ly,{className:"h-4 w-4"}):r.jsx(Rd,{className:"h-4 w-4"})]}),s&&r.jsxs("div",{className:"border-t p-3 space-y-2",children:[v&&v.length>0?v.map(T=>{var P,F;return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 text-sm",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium truncate",children:T.folder_name}),r.jsx(At,{variant:"outline",className:"text-xs shrink-0",children:((P=MTe.find(D=>D.value===T.folder_type))==null?void 0:P.label)||T.folder_type})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(F=T.brokerages)==null?void 0:F.name," · ID: ",r.jsx("span",{className:"font-mono",children:T.folder_id})]})]}),r.jsx(Q,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive shrink-0 ml-2",onClick:()=>M.mutate(T.id),children:r.jsx(ds,{className:"h-3.5 w-3.5"})})]},T.id)}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"No folders mapped yet"}),r.jsxs(Q,{variant:"outline",size:"sm",className:"w-full gap-1.5 mt-1",onClick:()=>l(!0),children:[r.jsx(_n,{className:"h-3.5 w-3.5"}),"Add Folder Mapping"]})]})]})]}):r.jsxs(Q,{className:"mt-4",onClick:b,disabled:t||x,children:[t?r.jsx(Go,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx("div",{className:"mr-2",children:r.jsx(CTe,{})}),"Connect Canva",r.jsx(No,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsx(Rr,{open:o,onOpenChange:l,children:r.jsxs(Dr,{children:[r.jsx($r,{children:r.jsx(Br,{children:"Add Brokerage Folder Mapping"})}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Brokerage"}),r.jsxs(un,{value:i.brokerage_id,onValueChange:T=>u(P=>({...P,brokerage_id:T})),children:[r.jsx(ln,{children:r.jsx(mn,{placeholder:"Select a brokerage…"})}),r.jsx(cn,{children:y==null?void 0:y.map(T=>r.jsx($t,{value:T.id,children:T.name},T.id))})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Canva Folder ID"}),r.jsx(lt,{placeholder:"e.g. FABCdef123456",value:i.folder_id,onChange:T=>u(P=>({...P,folder_id:T.target.value}))}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Found in the Canva folder URL: canva.com/folder/",r.jsx("strong",{children:"FOLDER_ID"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Folder Display Name"}),r.jsx(lt,{placeholder:"e.g. Brand Templates 2024",value:i.folder_name,onChange:T=>u(P=>({...P,folder_name:T.target.value}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(ze,{children:"Folder Type"}),r.jsxs(un,{value:i.folder_type,onValueChange:T=>u(P=>({...P,folder_type:T})),children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:MTe.map(T=>r.jsx($t,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs(ze,{children:["Description ",r.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),r.jsx(lt,{placeholder:"What's in this folder?",value:i.description,onChange:T=>u(P=>({...P,description:T.target.value}))})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(Q,{onClick:()=>k.mutate(i),disabled:!i.brokerage_id||!i.folder_id||!i.folder_name||k.isPending,children:[k.isPending?r.jsx(Go,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Add Folder"]})]})]})})]})}function per(){return r.jsx(Fr,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(Tu,{title:"Integrations",description:"Manage platform-level service connections"}),r.jsx(fer,{})]})})}const ger={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 ST(e,t=18,n=10){return e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`}function xer(){var ae,oe,pe,ne,fe;const e=Vr(),[t,n]=A.useState("Test Push"),[s,a]=A.useState("Testing web push notification"),[o,l]=A.useState("/community"),[i,u]=A.useState(!1),[m,x]=A.useState(!1),[y,v]=A.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[b,N]=A.useState(null),[k,M]=A.useState(null),{data:I,isLoading:T}=Zt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:se,error:me}=await Y.from("push_notification_settings").select("*").order("setting_key");if(me)throw me;return se}}),{data:P,isLoading:F}=Zt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:se,error:me}=await Y.from("push_subscriptions").select("*",{count:"exact",head:!0});if(me)throw me;return{totalSubscriptions:se||0}}}),D=ar({mutationFn:async({settingKey:se,isEnabled:me})=>{const{error:ue}=await Y.from("push_notification_settings").update({is_enabled:me}).eq("setting_key",se);if(ue)throw ue},onSuccess:()=>{e.invalidateQueries({queryKey:["push-notification-settings"]}),Ae.success("Notification setting updated")},onError:se=>{Ae.error("Failed to update setting: "+se.message)}}),U=A.useMemo(()=>{var se,me;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((se=y.serviceWorker)==null?void 0:se.activeState)??"unknown"} · sub=${(me=y.subscription)!=null&&me.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);A.useEffect(()=>{let se=!0;const me=async()=>{var _e,we,ve,Xe,Me,Ie,$e;const xe="serviceWorker"in navigator&&"PushManager"in window,Te={isSupported:xe,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((_e=navigator.serviceWorker)!=null&&_e.controller)};if(!xe){se&&v(Te);return}try{const{data:Be,error:Ve}=await Y.functions.invoke("get-vapid-public-key",{body:{}});if(Ve)throw Ve;Te.vapidPublicKey=Be==null?void 0:Be.vapidPublicKey;const Tt=(await navigator.serviceWorker.getRegistrations()).find(Oe=>{var le,qe,Je;return(((le=Oe.active)==null?void 0:le.scriptURL)||((qe=Oe.waiting)==null?void 0:qe.scriptURL)||((Je=Oe.installing)==null?void 0:Je.scriptURL)||"").includes("/sw.js")});if(Tt){Te.pushWorkerScriptUrl=((we=Tt.active)==null?void 0:we.scriptURL)||((ve=Tt.waiting)==null?void 0:ve.scriptURL)||((Xe=Tt.installing)==null?void 0:Xe.scriptURL),Te.serviceWorker={scope:Tt.scope,activeState:(Me=Tt.active)==null?void 0:Me.state};const Oe=await Tt.pushManager.getSubscription();if(Oe){const at=Oe.toJSON();Te.subscription={endpoint:at.endpoint,p256dh:(Ie=at.keys)==null?void 0:Ie.p256dh,auth:($e=at.keys)==null?void 0:$e.auth}}}}catch(Be){Te.error=(Be==null?void 0:Be.message)||String(Be)}se&&v(Te)};me();const ue=window.setInterval(me,4e3);return()=>{se=!1,window.clearInterval(ue)}},[]);const V=async()=>{if(typeof Notification>"u"){Ae.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){Ae.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),Ae.success("Triggered a local notification (not push).")}catch(se){Ae.error(`Local notification failed: ${(se==null?void 0:se.message)||String(se)}`)}},W=async()=>{u(!0),N(null);try{const{data:se,error:me}=await Y.functions.invoke("send-push-notification",{body:{title:t,body:s,url:o}});if(me)throw me;N({sent:se==null?void 0:se.sent,failed:se==null?void 0:se.failed,expiredCleaned:se==null?void 0:se.expiredCleaned,vapidPublicKey:se==null?void 0:se.vapidPublicKey}),(se==null?void 0:se.sent)>0?Ae.success(`Test notification sent to ${se.sent} subscriber(s)`):(se==null?void 0:se.failed)>0?Ae.warning(`Notification failed for ${se.failed} subscriber(s). ${se.expired||0} expired subscriptions cleaned up.`):Ae.info("No active subscriptions to send to")}catch(se){console.error("Error sending test notification:",se),N({error:(se==null?void 0:se.message)||String(se)}),Ae.error("Failed to send test notification: "+(se.message||"Unknown error"))}finally{u(!1)}},G=async()=>{x(!0),M(null);try{const{data:se,error:me}=await Y.functions.invoke("generate-vapid-keys",{body:{}});if(me)throw me;const ue=se==null?void 0:se.publicKey,xe=se==null?void 0:se.privateKey;if(!ue||!xe)throw new Error("generate-vapid-keys did not return keys");M({publicKey:ue,privateKey:xe}),Ae.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(se){console.error("Error generating VAPID keys:",se),Ae.error("Failed to generate VAPID keys: "+((se==null?void 0:se.message)||"Unknown error"))}finally{x(!1)}},ee=ar({mutationFn:async()=>{const{error:se}=await Y.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(se)throw se},onSuccess:()=>{Ae.success("All subscriptions cleared. Users will need to re-enable notifications."),e.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:se=>{Ae.error("Failed to clear subscriptions: "+se.message)}});return r.jsx(Fr,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Tu,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx($n,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(jn,{children:"Current active push notification subscriptions"})]}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:F?"...":(P==null?void 0:P.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(zd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(jn,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(et,{children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:I==null?void 0:I.map(se=>{const me=ger[se.setting_key]||{label:se.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:me.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:me.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:se.description})]})]}),r.jsx(As,{checked:se.is_enabled,onCheckedChange:ue=>D.mutate({settingKey:se.setting_key,isEnabled:ue}),disabled:D.isPending})]},se.id)})})})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(Dg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(jn,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(et,{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:U}),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?ST(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?ST(y.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((oe=y.serviceWorker)==null?void 0:oe.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: ",(pe=y.subscription)!=null&&pe.endpoint?ST(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ne=y.subscription)!=null&&ne.p256dh?ST(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(fe=y.subscription)!=null&&fe.auth?ST(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(Q,{variant:"outline",onClick:V,children:"Local notification test"}),r.jsx(Q,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(lt,{id:"test-title",value:t,onChange:se=>n(se.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(Zn,{id:"test-body",value:s,onChange:se=>a(se.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(lt,{id:"test-url",value:o,onChange:se=>l(se.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(Q,{onClick:W,disabled:i||!t||!s,className:"w-full sm:w-auto",children:[r.jsx(Ji,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Test Notification"]}),b&&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"}),b.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",b.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",b.sent??0," sent, ",b.failed??0," failed, ",b.expiredCleaned??0," expired cleaned"]}),b.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:b.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(He,{children:[r.jsxs(Ht,{children:[r.jsxs(Gt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(jn,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(et,{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(Q,{variant:"destructive",onClick:()=>ee.mutate(),disabled:ee.isPending,children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),ee.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(Q,{variant:"outline",onClick:G,disabled:m,children:m?"Generating…":"Generate VAPID keys"})}),k&&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:k.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:k.privateKey})]})]})]})]})]})]})})}function yer(){const{toast:e}=fi(),[t,n]=A.useState([]),[s,a]=A.useState({totalPresentations:0,totalViews:0,totalLeads:0,totalCtaClicks:0,agentsUsing:0}),[o,l]=A.useState(!0);A.useEffect(()=>{i()},[]);const i=async()=>{try{l(!0);const{data:m,error:x}=await Y.rpc("get_admin_presentation_stats");if(x)throw x;if(!m||m.length===0){l(!1);return}const y=m.map(M=>M.owner_user_id),{data:v,error:b}=await Y.from("profiles").select("id, name, email, avatar_url").in("id",y);if(b)throw b;const N=new Map((v==null?void 0:v.map(M=>[M.id,M]))||[]),k=m.map(M=>{const I=N.get(M.owner_user_id);return{owner_user_id:M.owner_user_id,name:(I==null?void 0:I.name)||"Unknown",email:(I==null?void 0:I.email)||"",avatar_url:(I==null?void 0:I.avatar_url)||null,presentation_count:Number(M.presentation_count),total_views:Number(M.total_views),total_leads:Number(M.total_leads),total_cta_clicks:Number(M.total_cta_clicks)}});k.sort((M,I)=>I.presentation_count-M.presentation_count),n(k),a({totalPresentations:k.reduce((M,I)=>M+I.presentation_count,0),totalViews:k.reduce((M,I)=>M+I.total_views,0),totalLeads:k.reduce((M,I)=>M+I.total_leads,0),totalCtaClicks:k.reduce((M,I)=>M+I.total_cta_clicks,0),agentsUsing:k.length})}catch(m){console.error("Error loading presentation stats:",m),e({title:"Error",description:"Failed to load presentation analytics",variant:"destructive"})}finally{l(!1)}},u=[{label:"Agents Using",value:s.agentsUsing,icon:$n,color:"text-blue-600"},{label:"Total Presentations",value:s.totalPresentations,icon:py,color:"text-violet-600"},{label:"Total Views",value:s.totalViews,icon:_o,color:"text-emerald-600"},{label:"Total Leads",value:s.totalLeads,icon:th,color:"text-amber-600"},{label:"CTA Clicks",value:s.totalCtaClicks,icon:Z1,color:"text-rose-600"}];return r.jsx(Fr,{title:"Presentation 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:"Presentation Analytics"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Track Smart Presentations usage and engagement across all agents"})]}),r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:u.map(m=>r.jsxs(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Gt,{className:"text-sm font-medium",children:m.label}),r.jsx(m.icon,{className:`h-4 w-4 ${m.color}`})]}),r.jsx(et,{children:o?r.jsx(Er,{className:"h-8 w-16"}):r.jsx("div",{className:"text-2xl font-bold",children:m.value.toLocaleString()})})]},m.label))}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(eh,{className:"h-5 w-5"}),"Agent Breakdown"]})}),r.jsx(et,{children:o?r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((m,x)=>r.jsx(Er,{className:"h-12 w-full"},x))}):t.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No presentations created yet."}):r.jsxs(Ds,{children:[r.jsx(Rs,{children:r.jsxs(Sr,{children:[r.jsx(Mt,{children:"Agent"}),r.jsx(Mt,{className:"text-center",children:"Presentations"}),r.jsx(Mt,{className:"text-center",children:"Views"}),r.jsx(Mt,{className:"text-center",children:"Leads"}),r.jsx(Mt,{className:"text-center",children:"CTA Clicks"}),r.jsx(Mt,{className:"text-center",children:"Conversion"})]})}),r.jsx(Fs,{children:t.map(m=>{var y,v;const x=m.total_views>0?(m.total_leads/m.total_views*100).toFixed(1):"0.0";return r.jsxs(Sr,{children:[r.jsx(yt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden",children:m.avatar_url?r.jsx("img",{src:m.avatar_url,alt:"",className:"h-full w-full object-cover"}):r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:((v=(y=m.name)==null?void 0:y.charAt(0))==null?void 0:v.toUpperCase())||"?"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:m.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:m.email})]})]})}),r.jsx(yt,{className:"text-center font-medium",children:m.presentation_count}),r.jsx(yt,{className:"text-center",children:m.total_views.toLocaleString()}),r.jsx(yt,{className:"text-center",children:m.total_leads>0?r.jsx(At,{variant:"secondary",children:m.total_leads}):r.jsx("span",{className:"text-muted-foreground",children:"0"})}),r.jsx(yt,{className:"text-center",children:m.total_cta_clicks}),r.jsx(yt,{className:"text-center",children:r.jsxs("span",{className:Number(x)>0?"text-emerald-600 font-medium":"text-muted-foreground",children:[x,"%"]})})]},m.owner_user_id)})})]})})]})]})})}function ver(){const[e]=Zc(),t=Vn(),[n,s]=A.useState("loading"),[a,o]=A.useState("Processing connection...");return A.useEffect(()=>{(async()=>{const i=e.get("code"),u=e.get("error"),m=e.get("error_description"),x=e.get("state");if(u){s("error"),o(m||"Authorization was denied"),Ae.error("Failed to connect: "+(m||u));return}if(!i){s("error"),o("No authorization code received"),Ae.error("Failed to connect: No authorization code");return}try{const{data:y,error:v}=await Y.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x}});if(v)throw v;if(y!=null&&y.success)s("success"),o(y.message||"Accounts connected successfully!"),Ae.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"),Ae.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(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(Gr,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(oi,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Gt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(jn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(Q,{onClick:()=>t("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function _er(){const e=Vn(),t=Vr(),{isAdmin:n}=tn(),[s,a]=A.useState(!1),[o,l]=A.useState(null),[i,u]=A.useState(null),{data:m,isLoading:x}=Zt({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:D},error:U}=await Y.auth.getUser();if(U)throw U;if(!D)return[];const{data:V,error:W}=await Y.from("social_accounts").select("*").eq("user_id",D.id).order("created_at",{ascending:!1});if(W)throw W;return V}}),y=ar({mutationFn:async D=>{const{data:{user:U},error:V}=await Y.auth.getUser();if(V)throw V;if(!U)throw new Error("Not authenticated");const{error:W}=await Y.from("social_accounts").delete().eq("id",D).eq("user_id",U.id);if(W)throw W},onSuccess:()=>{t.invalidateQueries({queryKey:["my-social-accounts"]}),t.invalidateQueries({queryKey:["social-accounts-for-post"]}),Ae.success("Account disconnected successfully")},onError:()=>{Ae.error("Failed to disconnect account")}}),v=async()=>{a(!0);try{const{data:D,error:U}=await Y.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(U)throw U;if(D!=null&&D.authUrl)window.location.href=D.authUrl;else throw new Error("Failed to get authorization URL")}catch(D){console.error("Meta OAuth error:",D),Ae.error("Failed to start connection. Please try again."),a(!1)}},b=async()=>{a(!0);try{const{data:D,error:U}=await Y.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(U)throw U;if(D!=null&&D.authUrl)window.location.href=D.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(D){console.error("LinkedIn OAuth error:",D),Ae.error("Failed to start LinkedIn connection. Please try again."),a(!1)}},N=async()=>{a(!0);try{const{data:D,error:U}=await Y.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(U)throw U;if(D!=null&&D.authUrl)window.location.href=D.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(D){console.error("Google OAuth error:",D),Ae.error("Failed to start Google connection. Please try again."),a(!1)}},k=(m==null?void 0:m.filter(D=>D.platform==="facebook"))||[],M=(m==null?void 0:m.filter(D=>D.platform==="instagram"))||[],I=(m==null?void 0:m.filter(D=>D.platform==="linkedin"))||[],T=(m==null?void 0:m.filter(D=>D.platform==="google_business"))||[],P=((m==null?void 0:m.length)||0)>0,F=async(D,U)=>{l(D),u(null);try{const{data:V,error:W}=await Y.functions.invoke("meta-api-test",{body:{testType:"all",accountId:D}});if(W)throw W;u(V.results||[]),Ae.success(V.summary||"API tests completed")}catch(V){console.error("Meta API test error:",V),Ae.error("Failed to run API tests")}finally{l(null)}};return r.jsx(Fr,{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(At,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Os,{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(Q,{variant:"ghost",onClick:()=>e("/social-swag-2"),className:"gap-2",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(He,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(et,{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(Xa,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(At,{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:[P&&r.jsx(He,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(et,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(oi,{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(He,{children:[r.jsx(Ht,{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(au,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"Facebook"}),r.jsx(jn,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):k.length>0?r.jsx("div",{className:"space-y-3",children:k.map(D=>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(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:D.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(au,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:D.page_name||D.platform_username||"Facebook Page"}),r.jsx(At,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect Facebook?"}),r.jsx(hd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(Q,{onClick:v,disabled:s,className:"w-full gap-2",variant:k.length>0?"outline":"default",children:[s?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),k.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{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(_u,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"Instagram"}),r.jsx(jn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):M.length>0?r.jsx("div",{className:"space-y-3",children:M.map(D=>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(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:D.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(_u,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",D.platform_username||"Instagram Account"]}),r.jsx(At,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect Instagram?"}),r.jsx(hd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(Q,{onClick:v,disabled:s,className:"w-full gap-2",variant:M.length>0?"outline":"default",children:[s?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),M.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(He,{children:[r.jsx(Ht,{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(xm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"LinkedIn"}),r.jsx(jn,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):I.length>0?r.jsx("div",{className:"space-y-3",children:I.map(D=>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(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:D.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(xm,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:D.platform_username||"LinkedIn Account"}),r.jsx(At,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect LinkedIn?"}),r.jsx(hd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(Q,{onClick:b,disabled:s,className:"w-full gap-2",variant:I.length>0?"outline":"default",children:[s?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{className:"h-4 w-4"}),I.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(He,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(At,{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(At,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Ht,{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(Do,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"Google Business"}),r.jsx(jn,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Go,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(D=>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(ea,{className:"h-10 w-10",children:[r.jsx(Ci,{src:D.profile_picture_url||""}),r.jsx(ta,{children:r.jsx(Do,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:D.page_name||D.platform_username||"Google Business"}),r.jsx(At,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Pd,{children:[r.jsx(kp,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Disconnect Google Business?"}),r.jsx(hd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.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(Q,{onClick:n?N:void 0,disabled:!n||s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(Go,{className:"h-4 w-4 animate-spin"}):r.jsx(_n,{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&&(k.length>0||M.length>0)&&r.jsxs(He,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Ht,{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(Lj,{className:"h-6 w-6 text-amber-600"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),r.jsx(jn,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(et,{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:[k.map(D=>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(au,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:D.page_name||"Facebook Page"})]}),r.jsx(Q,{size:"sm",variant:"outline",onClick:()=>F(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${D.id}`)),M.map(D=>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(_u,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",D.platform_username||"Instagram"]})]}),r.jsx(Q,{size:"sm",variant:"outline",onClick:()=>F(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Lj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${D.id}`))]}),i&&i.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:i.map((D,U)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[D.status==="success"?r.jsx(no,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):D.status==="pending"?r.jsx(Gr,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(bc,{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:D.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:D.details})]})]},U))})]}),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(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-lg",children:"How it works"})}),r.jsx(et,{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 ber(){const[e]=Zc(),t=Vn(),[n,s]=A.useState("loading"),[a,o]=A.useState("Processing your connection...");return A.useEffect(()=>{(async()=>{var y;const i=e.get("code"),u=e.get("error"),m=e.get("error_description"),x=e.get("state");if(u){s("error"),o(m||"Authorization was denied"),Ae.error("Connection failed: "+(m||u));return}if(!i){s("error"),o("No authorization code received"),Ae.error("No authorization code received");return}try{const{data:v,error:b}=await Y.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x,callbackPath:"/social-connections/callback"}});if(b)throw b;if(v!=null&&v.success)s("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||0} account(s)!`),Ae.success("Social accounts connected successfully!");else throw new Error((v==null?void 0:v.error)||"Unknown error")}catch(v){console.error("OAuth callback error:",v),s("error"),o(v instanceof Error?v.message:"Failed to connect accounts"),Ae.error("Failed to connect: "+(v instanceof Error?v.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(Gr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(oi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(jn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(Q,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function wer(){const[e]=Zc(),t=Vn(),[n,s]=A.useState("loading"),[a,o]=A.useState("Connecting your Google Business Profile...");return A.useEffect(()=>{(async()=>{const i=e.get("code"),u=e.get("error"),m=e.get("error_description"),x=e.get("state");if(u){s("error"),o(m||"Authorization was denied"),Ae.error("Connection failed: "+(m||u));return}if(!i){s("error"),o("No authorization code received"),Ae.error("No authorization code received");return}try{const{data:y,error:v}=await Y.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:i,state:x}});if(v)throw v;if(y!=null&&y.success)s("success"),o(y.message||"Successfully connected Google Business Profile!"),Ae.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"),Ae.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(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{className:"text-center",children:[n==="loading"&&r.jsx(Gr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(oi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Gt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(jn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(Q,{onClick:()=>t("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function jer(){const[e]=Zc(),t=Vn(),[n,s]=A.useState("loading"),[a,o]=A.useState("Connecting your LinkedIn account...");return A.useEffect(()=>{(async()=>{var y;const i=e.get("code"),u=e.get("state"),m=e.get("error"),x=e.get("error_description");if(m){console.error("LinkedIn OAuth error:",m,x),s("error"),o(x||"Failed to connect LinkedIn account"),Ae.error(x||"Failed to connect LinkedIn");return}if(!i){s("error"),o("No authorization code received"),Ae.error("No authorization code received");return}try{const{data:v,error:b}=await Y.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:i,state:u,callbackPath:"/social-connections/linkedin-callback"}});if(b)throw b;if(v!=null&&v.success)s("success"),o(`Successfully connected ${((y=v.accounts)==null?void 0:y.length)||1} LinkedIn account`),Ae.success("LinkedIn connected successfully!");else throw new Error((v==null?void 0:v.error)||"Failed to connect LinkedIn account")}catch(v){console.error("LinkedIn callback error:",v),s("error"),o(v instanceof Error?v.message:"Failed to connect LinkedIn account"),Ae.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(He,{className:"w-full max-w-md",children:[r.jsxs(Ht,{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(Gr,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(oi,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(bc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Gt,{className:"flex items-center justify-center gap-2",children:[r.jsx(xm,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(jn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(Q,{onClick:()=>t("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function ker(){const e=Vn(),[t,n]=A.useState(null),{data:s,isLoading:a}=KVe(t||void 0,!0),{data:o,isLoading:l}=cve(!0),{cartItems:i}=lae(),u=i.reduce((x,y)=>x+y.quantity,0),m=x=>{e(`/marketplace/${x.id}`)};return a||l?r.jsx(Fr,{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(Er,{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(Er,{className:"h-72 w-full"},x))})]})}):r.jsx(Fr,{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(Q,{variant:"outline",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(Ah,{className:"h-4 w-4 mr-2"}),"Cart",u>0&&r.jsx(At,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:u})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(Q,{variant:t===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(Q,{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(He,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>m(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(v=>v.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(ql,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(At,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(et,{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(ql,{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 XVe=A.forwardRef(({...e},t)=>r.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));XVe.displayName="Breadcrumb";const QVe=A.forwardRef(({className:e,...t},n)=>r.jsx("ol",{ref:n,className:Ut("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));QVe.displayName="BreadcrumbList";const tte=A.forwardRef(({className:e,...t},n)=>r.jsx("li",{ref:n,className:Ut("inline-flex items-center gap-1.5",e),...t}));tte.displayName="BreadcrumbItem";const ege=A.forwardRef(({asChild:e,className:t,...n},s)=>{const a=e?Qge:"a";return r.jsx(a,{ref:s,className:Ut("transition-colors hover:text-foreground",t),...n})});ege.displayName="BreadcrumbLink";const JVe=A.forwardRef(({className:e,...t},n)=>r.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Ut("font-normal text-foreground",e),...t}));JVe.displayName="BreadcrumbPage";const tge=({children:e,className:t,...n})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:Ut("[&>svg]:size-3.5",t),...n,children:e??r.jsx(Gi,{})});tge.displayName="BreadcrumbSeparator";function Ner(){var pe,ne;const{productId:e}=Ec(),t=Vn(),{data:n,isLoading:s}=EJt(e||""),{addToCart:a,cartItems:o}=lae(),[l,i]=A.useState(null),[u,m]=A.useState(1),[x,y]=A.useState(0),[v,b]=A.useState(null),[N,k]=A.useState(!1),[M,I]=A.useState(!1),T=(pe=n==null?void 0:n.variants)==null?void 0:pe.find(fe=>fe.id===l),P=((ne=n==null?void 0:n.variants)==null?void 0:ne.filter(fe=>fe.is_active))||[],F=Number((n==null?void 0:n.base_price)||0),D=T?Number(T.price_adjustment):0,U=F+D,V=Number((n==null?void 0:n.shipping_fee)||0),W=o.reduce((fe,se)=>fe+se.quantity,0),G=async fe=>{if(!fe.target.files||fe.target.files.length===0)return;k(!0);const se=fe.target.files[0],me=se.name.split(".").pop(),ue=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${me}`;try{const{error:xe}=await Y.storage.from("marketplace").upload(ue,se);if(xe)throw xe;const{data:{publicUrl:Te}}=Y.storage.from("marketplace").getPublicUrl(ue);b(Te),Ae.success("Artwork uploaded successfully")}catch(xe){Ae.error("Failed to upload artwork: "+xe.message)}finally{k(!1)}},ee=()=>{if(n){if(P.length>0&&!l){Ae.error("Please select an option");return}a(n,T||void 0,u,v||void 0),I(!0),Ae.success("Added to cart!"),setTimeout(()=>I(!1),2e3)}},ae=()=>{n!=null&&n.images&&y(fe=>(fe+1)%n.images.length)},oe=()=>{n!=null&&n.images&&y(fe=>(fe-1+n.images.length)%n.images.length)};return s?r.jsx(Fr,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Er,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Er,{className:"h-8 w-3/4"}),r.jsx(Er,{className:"h-6 w-1/4"}),r.jsx(Er,{className:"h-24 w-full"}),r.jsx(Er,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Fr,{title:n.name,children:[r.jsx(XVe,{className:"mb-6",children:r.jsxs(QVe,{children:[r.jsx(tte,{children:r.jsx(ege,{asChild:!0,children:r.jsx(co,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(tge,{}),r.jsx(tte,{children:r.jsx(ege,{asChild:!0,children:r.jsx(co,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(tge,{}),r.jsx(tte,{children:r.jsx(JVe,{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(Q,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:oe,children:r.jsx(kc,{className:"h-6 w-6"})}),r.jsx(Q,{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(Gi,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(ql,{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((fe,se)=>r.jsx("button",{onClick:()=>y(se),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${se===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:fe.image_url,alt:"",className:"w-full h-full object-cover"})},fe.id))}),n.video&&r.jsx(He,{children:r.jsxs(et,{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(At,{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:["$",U.toFixed(2)]}),V>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",V.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})}),P.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:P.map(fe=>r.jsxs(Q,{variant:l===fe.id?"default":"outline",onClick:()=>i(fe.id),children:[fe.name,Number(fe.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(fe.price_adjustment)>0?"+":"","$",Number(fe.price_adjustment).toFixed(2),")"]})]},fe.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(ze,{children:"Upload Your Artwork (Optional)"}),v?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:v,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(Q,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>b(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:G,className:"hidden",id:"artwork-upload",disabled:N}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(bo,{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(ze,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Q,{variant:"outline",size:"icon",onClick:()=>m(fe=>Math.max(1,fe-1)),children:"-"}),r.jsx(lt,{type:"number",value:u,onChange:fe=>m(Math.max(1,parseInt(fe.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(Q,{variant:"outline",size:"icon",onClick:()=>m(fe=>fe+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(Q,{size:"lg",className:"flex-1",onClick:ee,disabled:M,children:M?r.jsxs(r.Fragment,{children:[r.jsx(mi,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ah,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(Q,{variant:"outline",size:"lg",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(Ah,{className:"h-5 w-5"}),W>0&&r.jsx(At,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:W})]})]}),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(Fr,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ql,{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(Q,{onClick:()=>t("/marketplace"),children:"Back to Marketplace"})]})})}function Ser(){const e=Vn(),{cartItems:t,removeFromCart:n,updateQuantity:s,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:u}=lae(),[m,x]=A.useState(!1),[y,v]=A.useState(""),b=async()=>{if(t.length===0){Ae.error("Your cart is empty");return}x(!0);try{const{data:N,error:k}=await Y.functions.invoke("marketplace-checkout",{body:{items:t.map(M=>{var I;return{product_id:M.product.id,variant_id:((I=M.variant)==null?void 0:I.id)||null,quantity:M.quantity,artwork_url:M.artworkUrl||null}}),notes:y.trim()||null}});if(k)throw k;if(N!=null&&N.url)u(),window.open(N.url,"_blank");else throw new Error("No checkout URL received")}catch(N){Ae.error("Checkout failed: "+N.message)}finally{x(!1)}};return t.length===0?r.jsx(Fr,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx($g,{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(Q,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Fr,{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 k,M;return r.jsx(He,{children:r.jsx(et,{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:((k=N.product.images.find(I=>I.is_primary))==null?void 0:k.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($g,{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:["$",a(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(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return n(N.product.id,(I=N.variant)==null?void 0:I.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return s(N.product.id,(I=N.variant)==null?void 0:I.id,N.quantity-1)},disabled:N.quantity<=1,children:r.jsx(K1,{className:"h-3 w-3"})}),r.jsx(lt,{type:"number",value:N.quantity,onChange:I=>{var T;return s(N.product.id,(T=N.variant)==null?void 0:T.id,parseInt(I.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(Q,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var I;return s(N.product.id,(I=N.variant)==null?void 0:I.id,N.quantity+1)},children:r.jsx(_n,{className:"h-3 w-3"})})]})]})]})})},`${N.product.id}-${((M=N.variant)==null?void 0:M.id)||"base"}`)}),r.jsx(Q,{variant:"ghost",className:"text-destructive",onClick:u,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(He,{className:"sticky top-4",children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",t.reduce((N,k)=>N+k.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(Od,{}),r.jsxs("div",{className:"flex justify-between font-bold text-lg",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",i().toFixed(2)]})]}),r.jsx(Od,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(ze,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(Zn,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:N=>v(N.target.value),rows:3,className:"resize-none"})]}),r.jsx(Q,{className:"w-full",size:"lg",onClick:b,disabled:m,children:m?r.jsxs(r.Fragment,{children:[r.jsx(Gr,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(No,{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 Cer(){const e=Vn(),{data:t,isLoading:n}=UJt();return n?r.jsx(Fr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Er,{className:"h-32 w-full"},s))})}):!t||t.length===0?r.jsx(Fr,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ql,{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(Q,{onClick:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Fr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:t.map(s=>{var a,o,l;return r.jsx(He,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>e(`/marketplace/orders/${s.id}`),children:r.jsxs(et,{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:on(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(At,{className:lve[s.status],children:aC[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:[(a=s.items)==null?void 0:a.slice(0,3).map((i,u)=>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-u},children:[i.quantity,"×"]},i.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(Q,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Ss,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Gi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const TTe=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function Mer({currentStatus:e,statusHistory:t}){const n=TTe.indexOf(e);return r.jsx("div",{className:"space-y-3",children:TTe.map((s,a)=>{const o=t==null?void 0:t.find(m=>m.status===s),l=an;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":i?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:l?r.jsx(no,{className:"h-4 w-4"}):i?r.jsx(Xa,{className:"h-4 w-4"}):r.jsx("span",{className:"text-xs",children:a+1})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`font-medium ${u?"text-muted-foreground":""}`,children:aC[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[on(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function Ter(){var I;const{orderId:e}=Ec(),t=Vn(),{data:n,isLoading:s,refetch:a}=qJt(e||""),o=WJt(),l=GJt(),[i,u]=A.useState(!1),[m,x]=A.useState(null),[y,v]=A.useState(""),[b,N]=A.useState(null),k=async T=>{N(T);try{await o.mutateAsync({orderId:e,itemId:T}),Ae.success("Proof approved!"),a()}catch{Ae.error("Failed to approve proof")}finally{N(null)}},M=async()=>{if(m){N(m);try{await l.mutateAsync({orderId:e,itemId:m,reason:y}),Ae.success("Revision requested"),u(!1),v(""),x(null),a()}catch{Ae.error("Failed to request revision")}finally{N(null)}}};return s?r.jsx(Fr,{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(Er,{className:"h-64 w-full"}),r.jsx(Er,{className:"h-48 w-full"})]}),r.jsx(Er,{className:"h-96 w-full"})]})}):n?r.jsxs(Fr,{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(He,{children:[r.jsxs(Ht,{className:"flex flex-row items-center justify-between",children:[r.jsx(Gt,{children:"Order Status"}),r.jsx(At,{className:lve[n.status],children:aC[n.status]})]}),r.jsx(et,{children:r.jsx(Mer,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Items"})}),r.jsx(et,{className:"space-y-4",children:(I=n.items)==null?void 0:I.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(q1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Ss,{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(q1,{className:"h-4 w-4"}),"View Proof",r.jsx(Ss,{className:"h-3 w-3"})]}),T.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(Q,{size:"sm",onClick:()=>k(T.id),disabled:b===T.id,children:[b===T.id?r.jsx(Gr,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(Bd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(Q,{size:"sm",variant:"outline",onClick:()=>{x(T.id),u(!0)},disabled:b===T.id,children:[r.jsx(SA,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),T.proof_status==="approved"&&r.jsxs(At,{className:"bg-green-100 text-green-800",children:[r.jsx(no,{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(At,{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(He,{children:[r.jsx(Ht,{children:r.jsxs(Gt,{className:"flex items-center gap-2",children:[r.jsx(MA,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(et,{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(Q,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Ss,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(He,{className:"sticky top-4",children:[r.jsx(Ht,{children:r.jsx(Gt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",on(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(Od,{}),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(Od,{}),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(Od,{}),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(Rr,{open:i,onOpenChange:u,children:r.jsxs(Dr,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Request Changes"}),r.jsx(Yn,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(Zn,{placeholder:"Describe the changes needed...",value:y,onChange:T=>v(T.target.value),rows:4}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(Q,{onClick:M,disabled:!y.trim()||b!==null,children:[b?r.jsx(Gr,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Fr,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ql,{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(Q,{onClick:()=>t("/marketplace/orders"),children:"View All Orders"})]})})}function Aer(){const e=Vn(),[t]=Zc();return t.get("session_id"),A.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Fr,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(He,{children:r.jsxs(et,{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(no,{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(ql,{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(Q,{className:"flex-1",onClick:()=>e("/marketplace/orders"),children:["View My Orders",r.jsx(No,{className:"h-4 w-4 ml-2"})]}),r.jsx(Q,{variant:"outline",className:"flex-1",onClick:()=>e("/marketplace"),children:"Continue Shopping"})]})]})})})})}function Eer(){const{user:e}=tn(),[t,n]=A.useState("store"),[s,a]=A.useState(null),[o,l]=A.useState(null),[i,u]=A.useState(!1),[m,x]=A.useState(5),[y,v]=A.useState(""),[b,N]=A.useState(!1),[k,M]=A.useState(!1),[I,T]=A.useState(""),[P,F]=A.useState(null),[D,U]=A.useState(!1),{hasSubmittedReview:V,submitReview:W,markPostedToGoogle:G}=hRe(),{data:ee}=YVe(),{data:ae,isLoading:oe}=ZVe(),{data:pe,isLoading:ne}=eer(s),{data:fe,isLoading:se}=ter(e==null?void 0:e.id),{data:me=0}=ner(e==null?void 0:e.id),ue=ser(),xe=new Set((fe==null?void 0:fe.map(Ie=>Ie.item_id))||[]),Te=async()=>{if(o)try{await ue.mutateAsync(o.id),Ae.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Ie){Ae.error(Ie.message||"Failed to purchase item")}},_e=async()=>{if(!y.trim()){Ae.error("Please write a review");return}N(!0);const Ie=await W(m,y);N(!1),Ie.success?(Ae.success("Thank you for your review! You earned 25 points!"),T(y),M(!0),v(""),x(5)):Ae.error(Ie.error||"Failed to submit review")},we=()=>{navigator.clipboard.writeText(I),Ae.success("Review copied to clipboard!")},ve=()=>{G(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},Xe=()=>{M(!1),u(!1),T("")};return oe||ne||se?r.jsx(Fr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Er,{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(Ie=>r.jsx(Er,{className:"h-64"},Ie))})]})}):r.jsxs(Fr,{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(He,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{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(ks,{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:me.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(io,{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(fm,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(W4,{open:D,onOpenChange:U,children:r.jsxs(He,{className:"border-primary/20",children:[r.jsx(G4,{asChild:!0,children:r.jsx(Ht,{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(io,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Gt,{className:"text-base",children:"How to Earn Points"}),r.jsx(jn,{children:"See all the ways you can earn spendable points"})]})]}),D?r.jsx(ly,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Rd,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(K4,{children:r.jsx(et,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[ee==null?void 0:ee.filter(Ie=>Ie.is_active).map(Ie=>{const $e=Be=>{switch(Be){case"event_attendance":return r.jsx(Cs,{className:"h-5 w-5"});case"leave_review":return r.jsx(ks,{className:"h-5 w-5"});case"add_listing":return r.jsx(ya,{className:"h-5 w-5"});case"first_contact":return r.jsx($n,{className:"h-5 w-5"});case"first_video":return r.jsx(Ia,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Ro,{className:"h-5 w-5"});default:return r.jsx(ao,{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:$e(Ie.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Ie.action_name}),Ie.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ie.description})]}),r.jsxs(At,{variant:"secondary",className:"font-bold shrink-0",children:["+",Ie.points]})]},Ie.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(fm,{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(At,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!V&&r.jsx(He,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(et,{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(Ro,{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(Q,{onClick:()=>u(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(ks,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(wi,{value:t,onValueChange:n,children:[r.jsxs(_i,{children:[r.jsxs(sn,{value:"store",className:"flex items-center gap-2",children:[r.jsx($g,{className:"h-4 w-4"}),"Store"]}),r.jsxs(sn,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(ql,{className:"h-4 w-4"}),"My Rewards",fe&&fe.length>0&&r.jsx(At,{variant:"secondary",className:"ml-1",children:fe.length})]})]}),r.jsxs(Sn,{value:"store",className:"mt-6",children:[ae&&ae.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(Q,{variant:s===null?"default":"outline",size:"sm",onClick:()=>a(null),children:"All"}),ae.map(Ie=>r.jsxs(Q,{variant:s===Ie.id?"default":"outline",size:"sm",onClick:()=>a(Ie.id),children:[Ie.icon&&`${Ie.icon} `,Ie.name]},Ie.id))]}),!pe||pe.length===0?r.jsx(He,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(ao,{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:pe.map(Ie=>{const $e=xe.has(Ie.id),Be=Ie.max_quantity!==null&&Ie.current_quantity===0,Ve=me>=Ie.points_cost;return r.jsxs(He,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${$e?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>F(Ie),children:[Ie.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Ie.preview_image_url,alt:Ie.name,className:"w-full h-full object-cover"}),$e&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(At,{className:"bg-green-500 text-white",children:[r.jsx(no,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Be&&!$e&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(At,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(ao,{className:"h-12 w-12 text-muted-foreground/50"}),$e&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(At,{className:"bg-green-500 text-white",children:[r.jsx(no,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Ht,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Gt,{className:"text-lg",children:Ie.name}),r.jsxs(At,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(ks,{className:"h-3 w-3 mr-1"}),Ie.points_cost]})]}),Ie.category&&r.jsxs(At,{variant:"outline",className:"w-fit",children:[Ie.category.icon&&`${Ie.category.icon} `,Ie.category.name]})]}),r.jsxs(et,{children:[r.jsx(jn,{className:"mb-4 line-clamp-2",children:Ie.description||"No description available"}),Ie.max_quantity!==null&&!$e&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Ie.current_quantity," of ",Ie.max_quantity," remaining"]}),$e?r.jsx(Q,{className:"w-full",onClick:ot=>{ot.stopPropagation(),Ie.file_url&&gue(Ie.file_url,Ie.name)},disabled:!Ie.file_url,children:Ie.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(Q,{className:"w-full",onClick:ot=>{ot.stopPropagation(),l(Ie)},disabled:Be||!Ve,children:Be?"Sold Out":Ve?r.jsxs(r.Fragment,{children:[r.jsx($g,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Ie.points_cost-me} more pts`})]})]},Ie.id)})})]}),r.jsx(Sn,{value:"my-rewards",className:"mt-6",children:!fe||fe.length===0?r.jsx(He,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(ql,{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:fe.map(Ie=>{var $e,Be,Ve,ot,Tt;return r.jsxs(He,{className:"overflow-hidden",children:[($e=Ie.item)!=null&&$e.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Ie.item.preview_image_url,alt:((Be=Ie.item)==null?void 0:Be.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(ao,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Ht,{className:"pb-2",children:[r.jsx(Gt,{className:"text-lg",children:((Ve=Ie.item)==null?void 0:Ve.name)||"Unknown Item"}),r.jsxs(jn,{className:"text-xs",children:["Purchased for ",Ie.points_spent," points • ",new Date(Ie.purchased_at).toLocaleDateString()]})]}),r.jsx(et,{children:r.jsx(Q,{className:"w-full",onClick:()=>{var Oe,at;(Oe=Ie.item)!=null&&Oe.file_url&&gue(Ie.item.file_url,(at=Ie.item)==null?void 0:at.name)},disabled:!((ot=Ie.item)!=null&&ot.file_url),children:((Tt=Ie.item)==null?void 0:Tt.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Ie.id)})})})]})]}),r.jsx(Pd,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(ld,{children:[r.jsxs(cd,{children:[r.jsx(ud,{children:"Confirm Purchase"}),r.jsxs(hd,{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:[me," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[me-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(dd,{children:[r.jsx(md,{children:"Cancel"}),r.jsx(Uc,{onClick:Te,disabled:ue.isPending,children:ue.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Rr,{open:i,onOpenChange:Ie=>{!Ie&&k?Xe():u(Ie)},children:r.jsx(Dr,{children:k?r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[r.jsx(no,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(Yn,{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:['"',I,'"']})]}),r.jsxs(Q,{variant:"outline",className:"w-full",onClick:we,children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(Vs,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(Q,{variant:"outline",onClick:Xe,children:"Maybe Later"}),r.jsxs(Q,{onClick:ve,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Leave a Review"}),r.jsx(Yn,{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(Ie=>r.jsx("button",{type:"button",onClick:()=>x(Ie),className:"focus:outline-none",children:r.jsx(ks,{className:`h-8 w-8 transition-colors ${m>=Ie?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Ie))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(Zn,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:Ie=>v(Ie.target.value),rows:4})]})]}),r.jsxs(Vs,{children:[r.jsx(Q,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(Q,{onClick:_e,disabled:b,className:"bg-yellow-600 hover:bg-yellow-700",children:b?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Rr,{open:!!P,onOpenChange:()=>F(null),children:r.jsxs(Dr,{className:"max-w-lg",children:[r.jsxs($r,{children:[r.jsxs(Br,{className:"flex items-center gap-2",children:[P==null?void 0:P.name,r.jsxs(At,{variant:"secondary",className:"font-bold",children:[r.jsx(ks,{className:"h-3 w-3 mr-1"}),P==null?void 0:P.points_cost]})]}),(P==null?void 0:P.category)&&r.jsxs(At,{variant:"outline",className:"w-fit",children:[P.category.icon&&`${P.category.icon} `,P.category.name]})]}),(P==null?void 0:P.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:P.preview_image_url,alt:P.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(P==null?void 0:P.description)||"No description available"}),(P==null?void 0:P.max_quantity)!==null&&!xe.has((P==null?void 0:P.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[P==null?void 0:P.current_quantity," of ",P==null?void 0:P.max_quantity," remaining"]})]}),r.jsx(Vs,{children:P&&xe.has(P.id)?r.jsx(Q,{className:"w-full",onClick:()=>{P.file_url&&gue(P.file_url,P.name)},disabled:!P.file_url,children:P.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Access"]})}):P&&r.jsx(Q,{className:"w-full",onClick:()=>{F(null),l(P)},disabled:P.max_quantity!==null&&P.current_quantity===0||me{const{user:e}=tn(),t=Vr(),n=Zt({queryKey:["smart-presentations",e==null?void 0:e.id],queryFn:async()=>{const{data:m,error:x}=await Y.from("smart_presentations").select("*").eq("owner_user_id",e.id).neq("status","archived").order("created_at",{ascending:!1});if(x)throw x;return m||[]},enabled:!!e}),s=Zt({queryKey:["smart-presentation-templates",e==null?void 0:e.id],queryFn:async()=>{const{data:m,error:x}=await Y.from("smart_presentation_templates").select("*").eq("is_active",!0).order("created_at",{ascending:!0});if(x)throw x;return m||[]},enabled:!!e}),a=ar({mutationFn:async m=>{const{data:x,error:y}=await Y.from("smart_presentations").insert({owner_user_id:e.id,...m}).select().single();if(y)throw y;return x},onSuccess:()=>{t.invalidateQueries({queryKey:["smart-presentations"]})}}),o=ar({mutationFn:async({id:m,...x})=>{const{data:y,error:v}=await Y.from("smart_presentations").update(x).eq("id",m).select().single();if(v)throw v;return y},onSuccess:()=>{t.invalidateQueries({queryKey:["smart-presentations"]})}}),l=ar({mutationFn:async m=>{const{data:x,error:y}=await Y.from("smart_presentations").update({status:"published",published_at:new Date().toISOString()}).eq("id",m).select().single();if(y)throw y;return x},onSuccess:()=>{t.invalidateQueries({queryKey:["smart-presentations"]}),Ae.success("Presentation published!")}}),i=ar({mutationFn:async m=>{const{error:x}=await Y.from("smart_presentations").update({status:"archived"}).eq("id",m);if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["smart-presentations"]}),Ae.success("Presentation archived")}}),u=ar({mutationFn:async m=>{const{error:x}=await Y.from("smart_presentation_templates").insert({owner_user_id:e.id,name:m.title+" Template",description:"Created from "+m.title,template_type:"custom",icon:"📄",sections:m.sections,cta_config:{type:m.cta_type,label:m.cta_label},is_system:!1});if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["smart-presentation-templates"]}),Ae.success("Saved as template!")}});return{presentations:n.data||[],templates:s.data||[],isLoading:n.isLoading,templatesLoading:s.isLoading,createPresentation:a,updatePresentation:o,publishPresentation:l,archivePresentation:i,saveAsTemplate:u}},Ier=()=>{const e=Vn(),{presentations:t,isLoading:n,archivePresentation:s,saveAsTemplate:a}=eHe(),o=i=>i.status==="draft"?r.jsx(At,{variant:"outline",className:"text-xs",children:"Draft"}):i.view_count>1?r.jsx(At,{className:"text-xs bg-emerald-100 text-emerald-700 border-emerald-200",children:"Revisited"}):i.view_count===1?r.jsx(At,{className:"text-xs bg-blue-100 text-blue-700 border-blue-200",children:"Opened"}):r.jsx(At,{variant:"secondary",className:"text-xs",children:"Not Opened"}),l=i=>{const u=`https://presentations.relevelup.com/${i}`;navigator.clipboard.writeText(u),Ae.success("Link copied!")};return r.jsx(Fr,{title:"Smart Presentations",children:r.jsxs("div",{className:"max-w-5xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-2xl font-serif font-bold text-foreground",children:"Smart Presentations"}),r.jsx(DRe,{})]}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Create personalized, video-first presentations for your clients"})]}),r.jsxs(Q,{onClick:()=>e("/mission-control/presentations/new"),className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Create Presentation"]})]}),n?r.jsx("div",{className:"space-y-3",children:[1,2,3].map(i=>r.jsx(Er,{className:"h-20 w-full rounded-lg"},i))}):t.length===0?r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-16 text-center",children:[r.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(py,{className:"h-8 w-8 text-primary"})}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No presentations yet"}),r.jsx("p",{className:"text-muted-foreground mb-6 max-w-md",children:"Create your first Smart Presentation to impress clients with personalized, video-first content."}),r.jsxs(Q,{onClick:()=>e("/mission-control/presentations/new"),className:"gap-2",children:[r.jsx(_n,{className:"h-4 w-4"}),"Create Your First Presentation"]})]})}):r.jsx("div",{className:"space-y-3",children:t.map(i=>r.jsx(He,{className:"hover:shadow-sm transition-shadow",children:r.jsxs(et,{className:"flex items-center justify-between p-4",children:[r.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:r.jsx(_a,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-semibold truncate",children:i.title}),o(i)]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground mt-0.5",children:[i.client_name&&r.jsx("span",{children:i.client_name}),r.jsxs("span",{children:["Created ",on(new Date(i.created_at),"MMM d, yyyy")]}),i.view_count>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(_o,{className:"h-3 w-3"})," ",i.view_count," view",i.view_count!==1?"s":""]}),i.cta_clicked_count>0&&r.jsx("span",{className:"text-emerald-600 font-medium",children:"CTA clicked"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[i.status==="published"&&i.share_token&&r.jsxs(Q,{variant:"outline",size:"sm",onClick:()=>l(i.share_token),children:[r.jsx(Po,{className:"h-3.5 w-3.5 mr-1"}),"Copy Link"]}),r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>e(`/mission-control/presentations/${i.id}`),children:i.status==="draft"?"Edit":"View"}),r.jsxs(lh,{children:[r.jsx(ch,{asChild:!0,children:r.jsx(Q,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(kg,{className:"h-4 w-4"})})}),r.jsxs(Nu,{align:"end",children:[i.status==="published"&&i.share_token&&r.jsxs(Va,{onClick:()=>window.open(`https://presentations.relevelup.com/${i.share_token}`,"_blank"),children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Preview Link"]}),r.jsxs(Va,{onClick:()=>a.mutate(i),children:[r.jsx(_a,{className:"h-4 w-4 mr-2"}),"Save as Template"]}),r.jsxs(Va,{onClick:()=>s.mutate(i.id),className:"text-destructive",children:[r.jsx(JT,{className:"h-4 w-4 mr-2"}),"Archive"]})]})]})]})]})},i.id))})]})})},ATe={Welcome:[{label:"Warm & Personal",text:"Hey there! I'm so glad you're here. I put this presentation together just for you because I truly believe we'd make a great team. Over the next few minutes, I'll walk you through exactly how I can help you achieve your real estate goals. Let's dive in!"},{label:"Professional & Confident",text:"Welcome! Thank you for taking the time to check this out. I've prepared this presentation specifically with your needs in mind. I want to show you what sets me apart, the results I've delivered, and how I plan to make your experience smooth and successful. Let's get started!"}],"About Me":[{label:"Relatable Story",text:"Let me tell you a little about myself. I didn't just fall into real estate — I chose it because I love helping people with one of the biggest decisions of their lives. Every client I work with gets my full attention, my honest advice, and someone who truly has their back from start to finish."},{label:"Results-Focused",text:"Here's what I want you to know about me: I'm not just another agent. I've helped dozens of families find their perfect home and get top dollar for their properties. I stay on top of the market, I communicate constantly, and I don't stop until we hit your goals."}],"Market Update":[{label:"Engaging Overview",text:"Let's talk about what's happening in the market right now. I want you to feel confident and informed, so here's the honest picture. I'll break down the key numbers, what they mean for you, and how we can use current conditions to your advantage. Knowledge is power!"},{label:"Buyer-Focused",text:"The market is always moving, and I want to make sure you're in the best position possible. Here's what the latest data tells us, what opportunities are out there for you, and why timing matters. Let me walk you through it."}],"My Process":[{label:"Step-by-Step",text:"I want you to know exactly what to expect when we work together. My process is simple, clear, and designed to take the stress out of the equation. From our first conversation all the way to closing day, I'll be right there guiding you every step of the way. Here's how it works."},{label:"Client-Centered",text:"One thing my clients always tell me is how easy and stress-free the process was. That's not by accident — I've refined my approach over the years to make sure you always know what's happening, what's next, and that someone's got your back. Let me show you how."}],Testimonials:[{label:"Social Proof",text:"Don't just take my word for it — let me share what some of my past clients have said. These are real people, real experiences, and real results. I'm proud of the relationships I've built and the outcomes we've achieved together."}],Pricing:[{label:"Transparent & Value-Driven",text:"Let's talk about the investment. I believe in being completely transparent about pricing because trust is everything. Here's what you get when you work with me, and why my clients say it's the best decision they made. Let me walk you through it."}],"Call to Action":[{label:"Warm Close",text:"So here's my ask — let's connect! I'd love to hop on a quick call, answer any questions you have, and see how I can help. No pressure, no obligation — just a real conversation about your goals. Click the button below and let's make it happen!"},{label:"Urgency Close",text:"The market waits for no one, and neither should you. Let's get started today! Click the link below to schedule a quick chat. I promise — this could be the best 15 minutes you invest in your real estate journey."}]},Per=[{label:"Engaging Introduction",text:"In this section, I want to share something important with you. I've put real thought into this, and I think you'll find it valuable. Let me walk you through what I've prepared — I'm excited for you to see it!"},{label:"Keep It Simple",text:"Let me keep this short and sweet. Here's what you need to know, and why it matters for you. I'm always about giving you the real picture — no fluff, just the facts and my honest take."}];function Ler(e){const t=ATe[e];if(t)return t;const n=e.toLowerCase();for(const[s,a]of Object.entries(ATe))if(n.includes(s.toLowerCase())||s.toLowerCase().includes(n))return a;return Per}function Oer({sectionTitle:e,contactId:t,onVideoReady:n}){const[s,a]=A.useState(!1),[o,l]=A.useState("script"),[i,u]=A.useState(0),[m,x]=A.useState(0),{canRecord:y}=jBe(),v=Q0e(),[b,N]=A.useState(""),[k,M]=A.useState(!1),[I,T]=A.useState(!0),[P,F]=A.useState(!1),[D,U]=A.useState(null),V=Ler(e),W=()=>{l("script"),u(0),x(0),N(""),M(!1),T(!0),F(!1),U(null)},G=ne=>{!ne&&(o==="uploading"||o==="processing")||(a(ne),ne||W())},ee=ne=>{U(ne),N(V[ne].text),M(!1)},ae=()=>{l("record"),T(b.trim().length>0)},oe=()=>{N(""),T(!1),l("record")},pe=A.useCallback(async(ne,fe)=>{l("uploading");try{const se=e||"Presentation Video",{videoId:me,uploadUrl:ue}=await kBe(se),{apiKey:xe}=await NBe(me),Te=new XMLHttpRequest;Te.upload.onprogress=Me=>{Me.lengthComputable&&u(Me.loaded/Me.total*100)},await new Promise((Me,Ie)=>{Te.onload=()=>Te.status>=200&&Te.status<300?Me():Ie(new Error("Upload failed")),Te.onerror=()=>Ie(new Error("Upload failed")),Te.open("PUT",ue),Te.setRequestHeader("AccessKey",xe),Te.send(ne)}),l("processing");let _e=0;const we=Date.now(),ve=9e4;let Xe=null;for(;_e<4;){if(await new Promise(Ie=>setTimeout(Ie,3e3)),Date.now()-we>ve){const Ie=ne.size/1048576,$e=`https://iframe.mediadelivery.net/embed/${me}/${me}?responsive=true`;await v.mutateAsync({bunny_video_id:me,playback_url:$e,file_size_mb:Ie,title:se,contact_id:t||void 0,status:"processing",touch_type:"presentation"}),n($e),Ae.success("Video saved — still encoding. It will be ready shortly."),l("done"),setTimeout(()=>a(!1),1500);return}const Me=await SBe(me);if(_e=Me.status,x(Me.encodeProgress||0),_e===4)Xe={playbackUrl:Me.directPlayUrl,thumbnailUrl:Me.thumbnailUrl,previewUrl:Me.previewUrl||null,duration:Me.length||fe,fileSizeMb:(Me.storageSize||ne.size)/(1024*1024)};else if(_e===5||_e===6)throw new Error("Video processing failed")}if(!Xe)throw new Error("No video data");await v.mutateAsync({bunny_video_id:me,contact_id:t||void 0,playback_url:Xe.playbackUrl,thumbnail_url:Xe.thumbnailUrl,preview_url:Xe.previewUrl,duration_seconds:Xe.duration,file_size_mb:Xe.fileSizeMb,title:se,status:"ready",touch_type:"presentation"}),n(Xe.playbackUrl),Ae.success("Video recorded, saved to library & attached!"),l("done"),setTimeout(()=>a(!1),1500)}catch(se){console.error("Recording upload error:",se),Ae.error("Failed to process video. Please try again."),l("record")}},[e,t,n,v]);return r.jsxs(Rr,{open:s,onOpenChange:G,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",title:"Record a video",children:[r.jsx(Ia,{className:"h-3.5 w-3.5"}),"Record"]})}),r.jsxs(Dr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsxs(Br,{children:[o==="script"&&`Prepare your script for "${e}"`,o==="record"&&`Record video for "${e}"`,o==="uploading"&&"Uploading...",o==="processing"&&"Processing...",o==="done"&&"Done!"]})}),o==="script"&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a starter script below, edit it to make it yours, or skip and speak freely."}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Starter Scripts"}),r.jsx("div",{className:"grid gap-2",children:V.map((ne,fe)=>r.jsxs("button",{onClick:()=>ee(fe),className:Ut("text-left p-3 rounded-lg border transition-all hover:bg-accent/50",D===fe?"border-primary bg-primary/5 ring-1 ring-primary":"border-border"),children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(_a,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm font-medium",children:ne.label})]}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 ml-5.5",children:ne.text})]},fe))})]}),b&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Your Script"}),!k&&r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>M(!0),className:"h-7 text-xs gap-1",children:[r.jsx(Qa,{className:"h-3 w-3"}),"Edit"]})]}),k?r.jsx(Zn,{value:b,onChange:ne=>N(ne.target.value),rows:5,placeholder:"Type your script here...",className:"text-sm"}):r.jsx("div",{className:"p-3 rounded-lg bg-muted/50 text-sm text-foreground leading-relaxed",children:b})]}),!b&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Or Write Your Own"}),r.jsx(Zn,{value:b,onChange:ne=>{N(ne.target.value),U(null)},rows:4,placeholder:"Type your own script here...",className:"text-sm"})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(Q,{variant:"ghost",size:"sm",onClick:oe,className:"text-muted-foreground",children:"Skip — no teleprompter"}),r.jsx(Q,{onClick:ae,disabled:!1,children:b.trim()?"Continue with Script":"Continue Without Script"})]})]}),!y&&o==="record"?r.jsxs("div",{className:"flex flex-col items-center gap-3 py-8 text-center",children:[r.jsx(Nh,{className:"h-10 w-10 text-destructive"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"You've reached your video storage limit. Delete some videos to free up space."})]}):o==="record"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Record up to 60 seconds. Saved to your library & auto-attached."}),b.trim()&&r.jsxs(Q,{variant:"ghost",size:"sm",onClick:()=>T(!I),className:"h-7 text-xs gap-1",children:[I?r.jsx(Fg,{className:"h-3 w-3"}):r.jsx(_o,{className:"h-3 w-3"}),I?"Hide Script":"Show Script"]})]}),r.jsx(CVe,{maxDurationSeconds:60,onRecordingComplete:pe,onRecordingStateChange:F,onError:ne=>Ae.error(ne),teleprompterContent:b.trim()?r.jsx(TVe,{text:b,isVisible:I,onToggleVisibility:()=>T(!I),isRecording:P,startCountdown:!1}):void 0}),r.jsx(Q,{variant:"ghost",size:"sm",onClick:()=>l("script"),className:"text-xs text-muted-foreground",children:"← Back to script"})]}):o==="uploading"?r.jsxs("div",{className:"flex flex-col items-center gap-4 py-12",children:[r.jsx(Gr,{className:"h-10 w-10 animate-spin text-primary"}),r.jsxs("div",{className:"w-full max-w-xs space-y-2",children:[r.jsx(Mc,{value:i,className:"h-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["Uploading... ",Math.round(i),"%"]})]})]}):o==="processing"?r.jsxs("div",{className:"flex flex-col items-center gap-4 py-12",children:[r.jsx(Gr,{className:"h-10 w-10 animate-spin text-primary"}),r.jsxs("div",{className:"w-full max-w-xs space-y-2",children:[r.jsx(Mc,{value:m,className:"h-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground text-center",children:["Processing... ",Math.round(m),"%"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"This usually takes less than a minute"})]})]}):o==="done"?r.jsxs("div",{className:"flex flex-col items-center gap-3 py-12",children:[r.jsx(oi,{className:"h-12 w-12 text-emerald-500"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:"Video attached!"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved to your video library"})]}):null]})]})}const ETe=[{value:"schedule_call",label:"Schedule a Call"},{value:"ready_to_list",label:"Ready to List"},{value:"request_pricing",label:"Request Pricing Update"},{value:"sign_agreement",label:"Sign Buyer Agreement"},{value:"text_questions",label:"Text Me Questions"}],ITe=()=>{const e=Vn(),{id:t}=Ec(),{user:n}=tn(),{templates:s,templatesLoading:a,createPresentation:o,updatePresentation:l,publishPresentation:i}=eHe(),[u,m]=A.useState("client"),[x,y]=A.useState(!1),[v,b]=A.useState(""),[N,k]=A.useState([]),[M,I]=A.useState(!1),[T,P]=A.useState(null),[F,D]=A.useState(!1),[U,V]=A.useState(""),[W,G]=A.useState(""),[ee,ae]=A.useState(""),[oe,pe]=A.useState("buyer"),[ne,fe]=A.useState(""),[se,me]=A.useState(null),[ue,xe]=A.useState(""),[Te,_e]=A.useState([]),[we,ve]=A.useState("schedule_call"),[Xe,Me]=A.useState("Schedule a Call"),[Ie,$e]=A.useState(""),[Be,Ve]=A.useState(null),[ot,Tt]=A.useState(t||null),[Oe,at]=A.useState(null),[le,qe]=A.useState(!1),Je=async(Lt,lr)=>{if(!n)return;const Ar=5*1024*1024;if(Lt.size>Ar){Ae.error("Image must be under 5MB");return}if(!Lt.type.startsWith("image/")){Ae.error("Please upload an image file");return}Ve(lr);try{const Mr=Lt.name.split(".").pop()||"jpg",Zr=`${n.id}/${Date.now()}.${Mr}`,{error:Xn}=await Y.storage.from("listing-photos").upload(Zr,Lt);if(Xn)throw Xn;const{data:{publicUrl:dr}}=Y.storage.from("listing-photos").getPublicUrl(Zr);Ze(lr,{image_url:dr}),Ae.success("Image uploaded")}catch{Ae.error("Failed to upload image")}finally{Ve(null)}};A.useEffect(()=>{t&&st(t)},[t]);const st=async Lt=>{const{data:lr,error:Ar}=await Y.from("smart_presentations").select("*").eq("id",Lt).single();if(Ar||!lr)return;const Mr=lr;y(!0),xe(Mr.title),V(Mr.client_name||""),fe(Mr.property_address||""),_e(Mr.sections||[]),ve(Mr.cta_type||"schedule_call"),Me(Mr.cta_label||"Schedule a Call"),$e(Mr.cta_url||""),at(Mr.share_token),qe(Mr.status==="published"),Tt(Mr.id),m("builder")};A.useEffect(()=>{if(!n||v.length<1){k([]);return}const Lt=setTimeout(async()=>{I(!0);const{data:lr}=await Y.from("innercircle_contacts").select("id, first_name, last_name, email, phone, lead_source").eq("owner_user_id",n.id).or(`first_name.ilike.%${v}%,last_name.ilike.%${v}%,email.ilike.%${v}%`).limit(10);k(lr||[]),I(!1)},300);return()=>clearTimeout(Lt)},[v,n]);const je=Lt=>{P(Lt),V(`${Lt.first_name} ${Lt.last_name||""}`.trim()),G(Lt.email||""),ae(Lt.phone||""),D(!1)},ut=async()=>{if(!U.trim()){Ae.error("Client name is required");return}const Lt=U.trim().split(" "),lr=Lt[0],Ar=Lt.slice(1).join(" ")||null,{data:Mr,error:Zr}=await Y.from("innercircle_contacts").insert({owner_user_id:n.id,first_name:lr,last_name:Ar,email:W||null,phone:ee||null,lead_source:"Smart Presentation"}).select().single();if(Zr){Ae.error("Failed to create client");return}P(Mr),Ae.success("Client created & saved to Agent OS"),m("template")},Ce=Lt=>{me(Lt);const lr=(Lt.sections||[]).map(Ar=>({...Ar,is_visible:!0,video_url:"",text:""}));if(_e(lr),xe(Lt.name+(U?` for ${U}`:"")),Lt.cta_config){const Ar=Lt.cta_config;ve(Ar.type||"schedule_call"),Me(Ar.label||"Schedule a Call")}m("builder")},Ee=()=>{_e([{title:"Welcome",description:"A personal welcome",type:"video",icon:"👋",is_visible:!0}]),xe(U?`Presentation for ${U}`:"New Presentation"),m("builder")},Ze=(Lt,lr)=>{_e(Ar=>Ar.map((Mr,Zr)=>Zr===Lt?{...Mr,...lr}:Mr))},Le=Lt=>{Ze(Lt,{is_visible:!Te[Lt].is_visible})},Ke=()=>{_e(Lt=>[...Lt,{title:"New Section",description:"",type:"video",icon:"📝",is_visible:!0}])},tt=Lt=>{_e(lr=>lr.filter((Ar,Mr)=>Mr!==Lt))},ct=async()=>{if(!ue.trim()){Ae.error("Title is required");return}try{if(ot){const Lt=await l.mutateAsync({id:ot,title:ue,sections:Te,client_name:U,property_address:ne||null,cta_type:we,cta_label:Xe,cta_url:Ie||null});Ae.success("Saved")}else{const Lt=await o.mutateAsync({title:ue,contact_id:(T==null?void 0:T.id)||void 0,client_name:U,property_address:ne||void 0,template_id:(se==null?void 0:se.id)||void 0,sections:Te,cta_type:we,cta_label:Xe,cta_url:Ie||void 0});Tt(Lt.id),at(Lt.share_token),Ae.success("Presentation created!")}}catch{Ae.error("Failed to save")}},it=async()=>{await ct();const Lt=ot;if(Lt){const lr=await i.mutateAsync(Lt);at(lr.share_token),qe(!0),m("share")}},zt=Oe?`https://presentations.relevelup.com/${Oe}`:"";return r.jsx(Fr,{title:"Smart Presentations",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>e("/mission-control/presentations"),children:r.jsx(Wi,{className:"h-4 w-4"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-serif font-bold text-foreground",children:x?"Edit Presentation":"Create Smart Presentation"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[u==="client"&&"Who is this presentation for?",u==="template"&&"Choose a starting template",u==="builder"&&"Customize your presentation",u==="share"&&"Share with your client"]})]})]}),!x&&r.jsx("div",{className:"flex items-center gap-2",children:["client","template","builder","share"].map((Lt,lr)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:Ut("w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors",u===Lt?"bg-primary text-primary-foreground":lr<["client","template","builder","share"].indexOf(u)?"bg-emerald-100 text-emerald-700":"bg-muted text-muted-foreground"),children:lr<["client","template","builder","share"].indexOf(u)?r.jsx(mi,{className:"h-4 w-4"}):lr+1}),r.jsx("span",{className:"text-sm font-medium capitalize hidden sm:inline",children:Lt}),lr<3&&r.jsx("div",{className:"w-8 h-px bg-border"})]},Lt))}),u==="client"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("button",{onClick:()=>{P(null),V(""),G(""),ae(""),D(!1),m("template")},className:"w-full group flex items-center justify-between gap-4 rounded-xl border border-dashed border-primary/30 bg-primary/5 hover:bg-primary/10 transition-all p-4",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 shrink-0",children:r.jsx(Ji,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"text-left",children:[r.jsx("p",{className:"font-semibold text-foreground text-sm",children:"Skip — Use as Lead Gen Tool"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"No specific client. Share broadly to capture new leads."})]})]}),r.jsx(No,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors shrink-0"})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(ma,{className:"h-4 w-4 text-muted-foreground"}),"Select Existing Client"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search by name or email...",value:v,onChange:Lt=>b(Lt.target.value),className:"pl-10"})]}),r.jsxs("div",{className:"space-y-2 max-h-56 overflow-y-auto",children:[M&&r.jsx(Er,{className:"h-12 w-full"}),N.map(Lt=>r.jsxs("button",{onClick:()=>je(Lt),className:Ut("w-full text-left p-3 rounded-lg border transition-colors",(T==null?void 0:T.id)===Lt.id?"border-primary bg-primary/5":"border-border hover:border-primary/50"),children:[r.jsxs("p",{className:"font-medium text-sm",children:[Lt.first_name," ",Lt.last_name]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Lt.email||Lt.phone||"No contact info"})]},Lt.id)),!v&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"Start typing to search your contacts"}),v&&N.length===0&&!M&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No clients found"})]}),T&&r.jsxs(Q,{onClick:()=>m("template"),className:"w-full gap-2",children:["Continue with ",T.first_name,r.jsx(No,{className:"h-4 w-4"})]})]})]}),r.jsxs(He,{children:[r.jsx(Ht,{className:"pb-3",children:r.jsxs(Gt,{className:"text-base flex items-center gap-2",children:[r.jsx(th,{className:"h-4 w-4 text-muted-foreground"}),"Add New Client"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx(ze,{className:"text-xs",children:"Name *"}),r.jsx(lt,{value:U,onChange:Lt=>{V(Lt.target.value),D(!0),P(null)},placeholder:"Sarah & Mike Johnson"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Email"}),r.jsx(lt,{value:W,onChange:Lt=>G(Lt.target.value),placeholder:"Optional",type:"email"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Phone"}),r.jsx(lt,{value:ee,onChange:Lt=>ae(Lt.target.value),placeholder:"Optional"})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Client Type"}),r.jsxs(un,{value:oe,onValueChange:pe,children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsxs(cn,{children:[r.jsx($t,{value:"buyer",children:"Buyer"}),r.jsx($t,{value:"seller",children:"Seller"}),r.jsx($t,{value:"recruit",children:"Recruit"}),r.jsx($t,{value:"other",children:"Other"})]})]})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Property Address"}),r.jsx(lt,{value:ne,onChange:Lt=>fe(Lt.target.value),placeholder:"Optional"})]})]}),F&&U&&r.jsxs(Q,{onClick:ut,className:"w-full gap-2",children:["Create Client & Continue",r.jsx(No,{className:"h-4 w-4"})]})]})]})]})]}),u==="template"&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs(wi,{defaultValue:"system",children:[r.jsxs(_i,{children:[r.jsx(sn,{value:"mine",children:"My Core Templates"}),r.jsx(sn,{value:"system",children:"LevelUp Smart Templates"}),r.jsx(sn,{value:"blank",children:"+ Start Blank"})]}),r.jsx(Sn,{value:"mine",className:"mt-4",children:a?r.jsx("div",{className:"grid grid-cols-2 gap-4",children:[1,2].map(Lt=>r.jsx(Er,{className:"h-32"},Lt))}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:s.filter(Lt=>!Lt.is_system).length===0?r.jsx("p",{className:"text-muted-foreground col-span-2 text-center py-8",children:"You haven't saved any templates yet. Create a presentation and save it as a template!"}):s.filter(Lt=>!Lt.is_system).map(Lt=>r.jsx(PTe,{template:Lt,onSelect:Ce},Lt.id))})}),r.jsx(Sn,{value:"system",className:"mt-4",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:s.filter(Lt=>Lt.is_system).map(Lt=>r.jsx(PTe,{template:Lt,onSelect:Ce},Lt.id))})}),r.jsx(Sn,{value:"blank",className:"mt-4",children:r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"Start with a blank canvas and add your own sections."}),r.jsx(Q,{onClick:Ee,children:"Start from Scratch"})]})})})]}),r.jsxs(Q,{variant:"outline",onClick:()=>m("client"),className:"gap-2",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Back"]})]}),u==="builder"&&r.jsxs("div",{className:"space-y-6",children:[r.jsx(He,{children:r.jsxs(et,{className:"pt-6 space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Presentation Title"}),r.jsx(lt,{value:ue,onChange:Lt=>xe(Lt.target.value)})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"Client Name"}),r.jsx(lt,{value:U,onChange:Lt=>V(Lt.target.value)})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Property Address"}),r.jsx(lt,{value:ne,onChange:Lt=>fe(Lt.target.value),placeholder:"Optional"})]})]})]})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Sections"}),r.jsx(Q,{variant:"outline",size:"sm",onClick:Ke,children:"+ Add Section"})]}),r.jsx("div",{className:"space-y-3",children:Te.map((Lt,lr)=>r.jsx(He,{className:Ut(!Lt.is_visible&&"opacity-50"),children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("div",{className:"flex flex-col items-center gap-1 pt-1",children:[r.jsx(zg,{className:"h-4 w-4 text-muted-foreground cursor-grab"}),r.jsx("span",{className:"text-lg",children:Lt.icon})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(lt,{value:Lt.title,onChange:Ar=>Ze(lr,{title:Ar.target.value}),className:"font-semibold border-none p-0 h-auto text-base focus-visible:ring-0 bg-transparent"}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>Le(lr),children:Lt.is_visible?r.jsx(_o,{className:"h-4 w-4"}):r.jsx(Fg,{className:"h-4 w-4"})}),r.jsx(Q,{variant:"ghost",size:"icon",onClick:()=>tt(lr),className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})]})]}),r.jsx(lt,{value:Lt.description||"",onChange:Ar=>Ze(lr,{description:Ar.target.value}),placeholder:"Section description...",className:"text-sm"}),r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx(ze,{className:"text-xs",children:"Video URL"}),r.jsx(lt,{value:Lt.video_url||"",onChange:Ar=>Ze(lr,{video_url:Ar.target.value}),placeholder:"Paste a YouTube or video URL...",className:"text-sm"})]}),r.jsx(Oer,{sectionTitle:Lt.title,contactId:T==null?void 0:T.id,onVideoReady:Ar=>Ze(lr,{video_url:Ar})}),r.jsx(Der,{userId:n==null?void 0:n.id,onSelect:Ar=>Ze(lr,{video_url:Ar})})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Image (optional — shown if no video is set)"}),Lt.image_url?r.jsxs("div",{className:"relative mt-1 rounded-lg overflow-hidden border border-border bg-muted/30 group",children:[r.jsx("img",{src:Lt.image_url,alt:"",className:"w-full max-h-40 object-cover"}),r.jsx(Q,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>Ze(lr,{image_url:""}),children:r.jsx(ds,{className:"h-3.5 w-3.5"})})]}):r.jsxs("label",{className:"mt-1 flex items-center gap-2 cursor-pointer rounded-lg border border-dashed border-border hover:border-primary/50 p-3 transition-colors",children:[Be===lr?r.jsx(Gr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):r.jsx(Dj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Be===lr?"Uploading...":"Click to upload an image"}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:Be===lr,onChange:Ar=>{var Zr;const Mr=(Zr=Ar.target.files)==null?void 0:Zr[0];Mr&&Je(Mr,lr),Ar.target.value=""}})]})]}),r.jsxs("div",{children:[r.jsx(ze,{className:"text-xs",children:"Text (optional)"}),r.jsx(Hp,{content:Lt.text||"",onChange:Ar=>Ze(lr,{text:Ar}),placeholder:"Add supporting text...",minHeight:"80px",compact:!0})]})]})]})})},lr))})]}),r.jsxs(He,{children:[r.jsx(Ht,{children:r.jsx(Gt,{className:"text-base",children:"Call to Action"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(ze,{children:"CTA Type"}),r.jsxs(un,{value:we,onValueChange:Lt=>{ve(Lt);const lr=ETe.find(Ar=>Ar.value===Lt);lr&&Me(lr.label)},children:[r.jsx(ln,{children:r.jsx(mn,{})}),r.jsx(cn,{children:ETe.map(Lt=>r.jsx($t,{value:Lt.value,children:Lt.label},Lt.value))})]})]}),r.jsxs("div",{children:[r.jsx(ze,{children:"Button Label"}),r.jsx(lt,{value:Xe,onChange:Lt=>Me(Lt.target.value)})]}),r.jsxs("div",{children:[r.jsxs(ze,{children:["Link URL ",r.jsx("span",{className:"text-muted-foreground",children:"(optional — leave blank to show a lead capture form instead)"})]}),r.jsx(lt,{value:Ie,onChange:Lt=>$e(Lt.target.value),placeholder:"https://calendly.com/..."}),!Ie&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Without a URL, clients will see a contact form — their info gets added to your contacts and you'll receive an email notification."})]})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[!x&&r.jsxs(Q,{variant:"outline",onClick:()=>m("template"),className:"gap-2",children:[r.jsx(Wi,{className:"h-4 w-4"}),"Back"]}),r.jsxs("div",{className:"flex gap-3 ml-auto",children:[r.jsx(Q,{variant:"outline",onClick:ct,disabled:o.isPending||l.isPending,children:"Save Draft"}),r.jsxs(Q,{onClick:it,disabled:i.isPending,className:"gap-2",children:[r.jsx(Ji,{className:"h-4 w-4"}),le?"Update & Reshare":"Publish & Share"]})]})]})]}),u==="share"&&Oe&&r.jsxs("div",{className:"space-y-6",children:[r.jsx(He,{children:r.jsxs(et,{className:"flex flex-col items-center py-12 text-center",children:[r.jsx("div",{className:"w-16 h-16 rounded-full bg-emerald-100 flex items-center justify-center mb-4",children:r.jsx(mi,{className:"h-8 w-8 text-emerald-600"})}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your Presentation is Live!"}),r.jsxs("p",{className:"text-muted-foreground mb-6 max-w-md",children:["Share this link with ",U||"your client",". You'll be notified when they view it."]}),r.jsxs("div",{className:"flex items-center gap-2 w-full max-w-lg",children:[r.jsx(lt,{value:zt,readOnly:!0,className:"text-center font-mono text-sm"}),r.jsx(Q,{onClick:()=>{navigator.clipboard.writeText(zt),Ae.success("Link copied!")},children:r.jsx(Po,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-3 mt-6",children:[r.jsxs(Q,{variant:"outline",className:"gap-2",onClick:()=>{const Lt=`Hi ${U||""}! I put together something for you — check it out: ${zt}`;navigator.clipboard.writeText(Lt),Ae.success("Message copied!")},children:[r.jsx(Ro,{className:"h-4 w-4"}),"Copy Text Message"]}),r.jsxs(Q,{variant:"outline",className:"gap-2",onClick:()=>{window.open(`mailto:${W||""}?subject=${encodeURIComponent(ue)}&body=${encodeURIComponent(`Hi ${U||""}, I put together a personalized presentation for you: ${zt} Looking forward to connecting!`)}`)},children:[r.jsx(ws,{className:"h-4 w-4"}),"Send Email"]})]})]})}),r.jsxs("div",{className:"flex justify-between",children:[r.jsxs(Q,{variant:"outline",onClick:()=>m("builder"),children:[r.jsx(Wi,{className:"h-4 w-4 mr-2"}),"Edit Presentation"]}),r.jsx(Q,{onClick:()=>e("/mission-control/presentations"),children:"Done"})]})]})]})})},PTe=({template:e,onSelect:t})=>r.jsx(He,{className:"hover:shadow-sm transition-shadow",children:r.jsxs(et,{className:"p-5",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"text-2xl",children:e.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold",children:e.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:e.description}),r.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[r.jsx(At,{variant:"outline",className:"text-xs capitalize",children:e.template_type}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(e.sections||[]).length," sections"]})]})]})]}),r.jsx(Q,{className:"w-full mt-4",size:"sm",onClick:()=>t(e),children:"Use Template"})]})}),Der=({userId:e,onSelect:t})=>{const[n,s]=A.useState(!1),[a,o]=A.useState([]),[l,i]=A.useState(!1),[u,m]=A.useState("");A.useEffect(()=>{!n||!e||(i(!0),Y.from("agent_videos").select("id, title, recipient_name, playback_url, thumbnail_url, created_at, duration_seconds").eq("owner_user_id",e).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1}).limit(50).then(({data:y})=>{o(y||[]),i(!1)}))},[n,e]);const x=a.filter(y=>!u||(y.title||y.recipient_name||"").toLowerCase().includes(u.toLowerCase()));return r.jsxs(Rr,{open:n,onOpenChange:s,children:[r.jsx(Fo,{asChild:!0,children:r.jsxs(Q,{variant:"outline",size:"sm",className:"gap-1.5 shrink-0",children:[r.jsx(Td,{className:"h-3.5 w-3.5"}),"Library"]})}),r.jsxs(Dr,{className:"max-w-lg max-h-[70vh] flex flex-col",children:[r.jsxs($r,{children:[r.jsx(Br,{children:"Select from Video Library"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a video from your Agent OS library"})]}),r.jsxs("div",{className:"relative mb-3",children:[r.jsx(ma,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(lt,{placeholder:"Search videos...",value:u,onChange:y=>m(y.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex-1 overflow-y-auto space-y-2 min-h-0",children:l?r.jsxs(r.Fragment,{children:[r.jsx(Er,{className:"h-16 w-full"}),r.jsx(Er,{className:"h-16 w-full"})]}):x.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:a.length===0?"No videos in your library yet":"No videos match your search"}):x.map(y=>r.jsxs("button",{onClick:()=>{t(y.playback_url||""),s(!1)},className:"w-full flex items-center gap-3 p-3 rounded-lg border border-border hover:border-primary/50 hover:bg-accent/50 transition-colors text-left",children:[r.jsx("div",{className:"w-16 h-10 rounded bg-muted flex items-center justify-center shrink-0 overflow-hidden",children:y.thumbnail_url?r.jsx("img",{src:y.thumbnail_url,alt:"",className:"w-full h-full object-cover",referrerPolicy:"no-referrer",onError:v=>{const b=v.currentTarget.parentElement;if(b){v.currentTarget.remove();const N=document.createElement("span");N.innerHTML="🎬",N.className="text-lg",b.appendChild(N)}}}):r.jsx(Ia,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:y.title||y.recipient_name||"Untitled Video"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[y.duration_seconds?`${Math.round(y.duration_seconds)}s`:"",y.created_at?` · ${new Date(y.created_at).toLocaleDateString()}`:""]})]})]},y.id))})]})]})},Rer=()=>{var k;const{shareToken:e}=Ec(),[t,n]=A.useState(null),[s,a]=A.useState(!0),[o,l]=A.useState(0),[i,u]=A.useState(!1);A.useEffect(()=>(document.body.classList.add("presentation-page"),()=>{document.body.classList.remove("presentation-page")}),[]),A.useEffect(()=>{e&&m()},[e]);const m=async()=>{const{data:M,error:I}=await Y.from("smart_presentations").select("*").eq("share_token",e).eq("status","published").single();if(I||!M){u(!0),a(!1);return}const{data:T}=await Y.from("profiles").select("name, email, phone, avatar_url, title, brokerage_id").eq("id",M.owner_user_id).single();let P;if(T!=null&&T.brokerage_id){const{data:D}=await Y.from("brokerages").select("name").eq("id",T.brokerage_id).single();P=(D==null?void 0:D.name)||void 0}let F=null;if(M.contact_id){const{data:D}=await Y.from("innercircle_contacts").select("first_name, last_name, email, phone").eq("id",M.contact_id).single();F=D}n({...M,owner_name:T==null?void 0:T.name,owner_email:T==null?void 0:T.email,owner_phone:T==null?void 0:T.phone,owner_avatar:T==null?void 0:T.avatar_url,owner_title:(T==null?void 0:T.title)||void 0,brokerage_name:P,contact_name:F?[F.first_name,F.last_name].filter(Boolean).join(" "):void 0,contact_email:(F==null?void 0:F.email)||void 0,contact_phone:(F==null?void 0:F.phone)||void 0}),a(!1);try{await Y.rpc("log_presentation_view",{p_presentation_id:M.id,p_section_index:0,p_cta_clicked:!1,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch{}},x=async()=>{if(t){try{await Y.rpc("log_presentation_view",{p_presentation_id:t.id,p_section_index:null,p_cta_clicked:!0,p_ip_hash:null,p_user_agent:navigator.userAgent,p_referrer:null})}catch{}t.cta_url&&window.open(t.cta_url,"_blank")}};if(s)return r.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:r.jsxs("div",{className:"space-y-4 w-full max-w-2xl px-4",children:[r.jsx(Er,{className:"h-12 w-3/4 mx-auto"}),r.jsx(Er,{className:"h-64 w-full"}),r.jsx(Er,{className:"h-8 w-1/2 mx-auto"})]})});if(i||!t)return r.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Presentation Not Found"}),r.jsx("p",{className:"text-gray-500",children:"This presentation may have been removed or is no longer available."})]})});const y=t.sections.filter(M=>M.is_visible!==!1),v=y[o],b=M=>{const I=M.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]+)/);if(I)return`https://www.youtube.com/embed/${I[1]}?rel=0`;if(M.includes("iframe.mediadelivery.net/play/")){const F=M.replace("/play/","/embed/"),D=F.includes("?")?"&":"?";return`${F}${D}responsive=true`}if(M.includes("iframe.mediadelivery.net")){const F=M.includes("?")?"&":"?";return`${M}${F}responsive=true`}const T=M.match(/loom\.com\/share\/([a-zA-Z0-9]+)/);if(T)return`https://www.loom.com/embed/${T[1]}`;const P=M.match(/video\.bunnycdn\.com\/play\/(\d+)\/([a-f0-9-]+)/);return P?`https://iframe.mediadelivery.net/embed/${P[1]}/${P[2]}?responsive=true`:M},N=!!((k=t.cta_url)!=null&&k.trim());return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white",children:[r.jsx("header",{className:"bg-white border-b border-gray-100 sticky top-0 z-10",children:r.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex items-center gap-3",children:[t.owner_avatar&&r.jsx("img",{src:t.owner_avatar,alt:t.owner_name||"Agent",className:"h-10 w-10 rounded-full object-cover border border-gray-200"}),r.jsxs("div",{className:"text-right text-sm",children:[r.jsx("p",{className:"font-semibold text-gray-900",children:t.owner_name}),t.owner_title&&r.jsx("p",{className:"text-gray-500 text-xs",children:t.owner_title}),t.brokerage_name&&!t.owner_title&&r.jsx("p",{className:"text-gray-500 text-xs",children:t.brokerage_name})]})]})]})}),r.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsxs("h1",{className:"text-3xl md:text-4xl font-bold text-gray-900 mb-2",children:["Welcome, ",t.client_name||"there","!"]}),t.property_address&&r.jsxs("p",{className:"text-lg text-gray-600",children:["Here's the plan for your home at ",r.jsx("strong",{children:t.property_address}),"."]})]}),r.jsxs("div",{className:"grid md:grid-cols-5 gap-8",children:[r.jsxs("div",{className:"md:col-span-3",children:[v!=null&&v.video_url?r.jsx("div",{className:"relative w-full rounded-xl overflow-hidden shadow-lg bg-gray-900",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:b(v.video_url),className:"absolute inset-0 w-full h-full border-0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,loading:"lazy"})}):v!=null&&v.image_url?r.jsx("div",{className:"rounded-xl overflow-hidden shadow-lg",children:r.jsx("img",{src:v.image_url,alt:v.title,className:"w-full h-auto object-cover",loading:"lazy"})}):r.jsxs("div",{className:"aspect-video bg-gradient-to-br from-blue-50 to-slate-100 rounded-xl flex flex-col items-center justify-center shadow-lg",children:[r.jsx("span",{className:"text-5xl mb-3",children:v==null?void 0:v.icon}),r.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:v==null?void 0:v.title}),r.jsx("p",{className:"text-gray-500 mt-1 text-sm",children:v==null?void 0:v.description})]}),(v==null?void 0:v.text)&&r.jsx("div",{className:"mt-4 p-4 bg-white rounded-lg border text-gray-700 text-sm leading-relaxed prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:v.text}})]}),r.jsx("div",{className:"md:col-span-2 space-y-3",children:y.map((M,I)=>r.jsx("button",{onClick:()=>l(I),className:Ut("w-full text-left p-4 rounded-xl border transition-all",o===I?"border-blue-500 bg-blue-50 shadow-sm":"border-gray-200 bg-white hover:border-blue-200 hover:bg-blue-50/50"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsxs("span",{className:"text-blue-600 font-bold text-sm mt-0.5",children:[String(I+1).padStart(2,"0"),"."]}),r.jsxs("div",{children:[r.jsx("span",{className:"mr-2",children:M.icon}),r.jsx("span",{className:"font-semibold text-gray-900",children:M.title}),r.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:M.description})]})]})},I))})]}),r.jsxs("div",{className:"mt-12 max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6 text-center",children:[t.owner_avatar&&r.jsx("img",{src:t.owner_avatar,alt:t.owner_name||"Agent",className:"h-20 w-20 rounded-full object-cover mx-auto mb-3 border-2 border-gray-100"}),r.jsx("h3",{className:"text-lg font-bold text-gray-900",children:t.owner_name}),t.owner_title&&r.jsx("p",{className:"text-sm text-gray-500",children:t.owner_title}),t.brokerage_name&&r.jsx("p",{className:"text-sm text-gray-500",children:t.brokerage_name}),r.jsxs("div",{className:"mt-3 flex flex-col items-center gap-1 text-sm text-gray-600",children:[t.owner_phone&&r.jsx("a",{href:`tel:${t.owner_phone}`,className:"hover:text-blue-600 transition-colors",children:t.owner_phone}),t.owner_email&&r.jsx("a",{href:`mailto:${t.owner_email}`,className:"hover:text-blue-600 transition-colors",children:t.owner_email})]})]}),t.cta_label&&r.jsxs("div",{className:"text-center mt-8 py-8",children:[r.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Ready to Get Started?"}),N?r.jsxs(Q,{size:"lg",onClick:x,className:"text-lg px-8 py-6 rounded-xl bg-blue-600 hover:bg-blue-700 text-white shadow-lg",children:[t.cta_label,r.jsx(Ss,{className:"h-5 w-5 ml-2"})]}):r.jsx("div",{className:"max-w-md mx-auto bg-white rounded-2xl border border-gray-200 shadow-sm p-6",children:r.jsx(P8e,{presentationId:t.id,ctaLabel:t.cta_label,agentName:t.owner_name||void 0,prefillName:t.contact_name,prefillEmail:t.contact_email,prefillPhone:t.contact_phone})})]})]}),r.jsx("footer",{className:"border-t border-gray-100 bg-white mt-12 py-6 text-center text-xs text-gray-400",children:"Powered by LevelUp"})]})},Fer=()=>{const e=wf();return A.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"})]})})},zer=new Stt,Ber=()=>{const e=window.location.hostname;return e==="listings.relevelup.com"||e.startsWith("listings.")},$er=()=>{const e=window.location.hostname;return e==="cards.relevelup.com"||e.startsWith("cards.")},Uer=()=>{const e=window.location.hostname;return e==="presentations.relevelup.com"||e.startsWith("presentations.")},qer=()=>r.jsx(Ett,{client:zer,children:r.jsx(YPe,{children:r.jsxs(QI,{children:[r.jsx(VQe,{}),r.jsx(wJe,{}),r.jsx(Vrt,{children:r.jsx(Zat,{children:r.jsx(Yat,{children:r.jsxs(Qat,{children:[r.jsx(Xat,{}),r.jsx(Alt,{}),r.jsx(Wlt,{}),$er()?r.jsx(udt,{}):Ber()?r.jsx(Pct,{}):Uer()?r.jsx(fdt,{}):r.jsxs(Drt,{children:[r.jsx(rn,{path:"/",element:r.jsx(kdt,{})}),r.jsx(rn,{path:"/privacy-policy",element:r.jsx(Ndt,{})}),r.jsx(rn,{path:"/terms-of-service",element:r.jsx(Sdt,{})}),r.jsx(rn,{path:"/data-deletion",element:r.jsx(Cdt,{})}),r.jsx(rn,{path:"/public/listings",element:r.jsx(S8e,{})}),r.jsx(rn,{path:"/public/listing/:slugOrId",element:r.jsx(ugt,{})}),r.jsx(rn,{path:"/card/:slug",element:r.jsx(hgt,{})}),r.jsx(rn,{path:"/auth",element:r.jsx(rut,{})}),r.jsx(rn,{path:"/subscription-success",element:r.jsx(nut,{})}),r.jsx(rn,{path:"/subscription",element:r.jsx(Nn,{children:r.jsx(vpt,{})})}),r.jsx(rn,{path:"/share/video",element:r.jsx(ogt,{}),children:r.jsx(rn,{path:":shareToken",element:r.jsx(igt,{})})}),r.jsx(rn,{path:"/p/:shareToken",element:r.jsx(Rer,{})}),r.jsx(rn,{path:"/og/video/:token",element:r.jsx(lgt,{})}),r.jsx(rn,{path:"/setup-brokerage",element:r.jsx(Nn,{children:r.jsx(_pt,{})})}),r.jsx(rn,{path:"/claim-account",element:r.jsx(HNe,{})}),r.jsx(rn,{path:"/claim",element:r.jsx(HNe,{})}),r.jsx(rn,{path:"/join",element:r.jsx(bpt,{})}),r.jsx(rn,{path:"/trial",element:r.jsx(Ipt,{})}),r.jsx(rn,{path:"/trial/success",element:r.jsx(Ppt,{})}),r.jsx(rn,{path:"/dashboard",element:r.jsx(Nn,{children:r.jsx(gxt,{})})}),r.jsx(rn,{path:"/profile",element:r.jsx(Nn,{children:r.jsx(ajt,{})})}),r.jsx(rn,{path:"/apps",element:r.jsx(Nn,{children:r.jsx(yjt,{})})}),r.jsx(rn,{path:"/admin",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(nSt,{})})}),r.jsx(rn,{path:"/admin/apps",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(iSt,{})})}),r.jsx(rn,{path:"/admin/members",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(uSt,{})})}),r.jsx(rn,{path:"/admin/invite-codes",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(hSt,{})})}),r.jsx(rn,{path:"/admin/events",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(xSt,{})})}),r.jsx(rn,{path:"/events",element:r.jsx(Nn,{children:r.jsx(pjt,{})})}),r.jsx(rn,{path:"/events/:eventId",element:r.jsx(Nn,{children:r.jsx(xjt,{})})}),r.jsx(rn,{path:"/templates",element:r.jsx(Nn,{children:r.jsx(vjt,{})})}),r.jsx(rn,{path:"/templates/:templateId",element:r.jsx(Nn,{children:r.jsx(jjt,{})})}),r.jsx(rn,{path:"/admin/templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ySt,{})})}),r.jsx(rn,{path:"/academy",element:r.jsx(Nn,{children:r.jsx(kjt,{})})}),r.jsx(rn,{path:"/academy/:videoId",element:r.jsx(Nn,{children:r.jsx(Sjt,{})})}),r.jsx(rn,{path:"/admin/academy",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(_St,{})})}),r.jsx(rn,{path:"/toolbox",element:r.jsx(Nn,{children:r.jsx(Cjt,{})})}),r.jsx(rn,{path:"/toolbox/:kitId",element:r.jsx(Nn,{children:r.jsx(Mjt,{})})}),r.jsx(rn,{path:"/admin/toolbox",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(bSt,{})})}),r.jsx(rn,{path:"/social-swag",element:r.jsx(Nn,{children:r.jsx(Tjt,{})})}),r.jsx(rn,{path:"/social-swag-2",element:r.jsx(Nn,{children:r.jsx(CNt,{})})}),r.jsx(rn,{path:"/social-swag/:swagId",element:r.jsx(Nn,{children:r.jsx(MNt,{})})}),r.jsx(rn,{path:"/social-connections",element:r.jsx(Nn,{children:r.jsx(_er,{})})}),r.jsx(rn,{path:"/social-connections/callback",element:r.jsx(Nn,{children:r.jsx(ber,{})})}),r.jsx(rn,{path:"/social-connections/linkedin-callback",element:r.jsx(Nn,{children:r.jsx(jer,{})})}),r.jsx(rn,{path:"/social-connections/google-callback",element:r.jsx(Nn,{children:r.jsx(wer,{})})}),r.jsx(rn,{path:"/admin/social-swag",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(wSt,{})})}),r.jsx(rn,{path:"/admin/social-swag-2",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(cCt,{})})}),r.jsx(rn,{path:"/community",element:r.jsx(Nn,{children:r.jsx(GNt,{})})}),r.jsx(rn,{path:"/support",element:r.jsx(Nn,{children:r.jsx(KNt,{})})}),r.jsx(rn,{path:"/admin/community",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(dCt,{})})}),r.jsx(rn,{path:"/admin/support-tickets",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(yCt,{})})}),r.jsx(rn,{path:"/admin/email-templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(bCt,{})})}),r.jsx(rn,{path:"/admin/agent-email-templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(wCt,{})})}),r.jsx(rn,{path:"/admin/analytics",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(pCt,{})})}),r.jsx(rn,{path:"/admin/brokerage-resources",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(gCt,{})})}),r.jsx(rn,{path:"/admin/dashboard-management",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(xCt,{})})}),r.jsx(rn,{path:"/brokerage/dashboard",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(PCt,{})})}),r.jsx(rn,{path:"/my-brokerage",element:r.jsx(Nn,{children:r.jsx(zCt,{})})}),r.jsx(rn,{path:"/brokerage-resources",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(eSt,{})})}),r.jsx(rn,{path:"/brokerage-resources/:resourceId",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(tSt,{})})}),r.jsx(rn,{path:"/newsletters",element:r.jsx(Nn,{children:r.jsx(BCt,{})})}),r.jsx(rn,{path:"/newsletters/:id",element:r.jsx(Nn,{children:r.jsx(UCt,{})})}),r.jsx(rn,{path:"/wishlist",element:r.jsx(Nn,{children:r.jsx(HCt,{})})}),r.jsx(rn,{path:"/wishlist/:itemId",element:r.jsx(Nn,{children:r.jsx(WCt,{})})}),r.jsx(rn,{path:"/admin/wishlist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(GCt,{})})}),r.jsx(rn,{path:"/admin/levelup-brief",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(KCt,{})})}),r.jsx(rn,{path:"/admin/newsletters",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(VCt,{})})}),r.jsx(rn,{path:"/admin/additional-services",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ZCt,{})})}),r.jsx(rn,{path:"/admin/discounts",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(YCt,{})})}),r.jsx(rn,{path:"/admin/subscriptions",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(XCt,{})})}),r.jsx(rn,{path:"/admin/referrals",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(QCt,{})})}),r.jsx(rn,{path:"/admin/onboarding-checklist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(e3t,{})})}),r.jsx(rn,{path:"/admin/marketplace",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(QJt,{})})}),r.jsx(rn,{path:"/admin/agent-points",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(wJt,{})})}),r.jsx(rn,{path:"/admin/reward-store",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(mer,{})})}),r.jsx(rn,{path:"/admin/integrations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(per,{})})}),r.jsx(rn,{path:"/admin/integrations/callback",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ver,{})})}),r.jsx(rn,{path:"/reward-store",element:r.jsx(Nn,{children:r.jsx(Eer,{})})}),r.jsx(rn,{path:"/additional-services",element:r.jsx(Nn,{children:r.jsx(u3t,{})})}),r.jsx(rn,{path:"/additional-services/:serviceId",element:r.jsx(Nn,{children:r.jsx(h3t,{})})}),r.jsx(rn,{path:"/ai-toolkit",element:r.jsx(Nn,{children:r.jsx(m3t,{})})}),r.jsx(rn,{path:"/mission-control",element:r.jsx(Nn,{children:r.jsx(j3t,{})})}),r.jsx(rn,{path:"/mission-control/contacts",element:r.jsx(Nn,{children:r.jsx(U3t,{})})}),r.jsx(rn,{path:"/mission-control/contacts/:contactId",element:r.jsx(Nn,{children:r.jsx(e5t,{})})}),r.jsx(rn,{path:"/mission-control/plans",element:r.jsx(Nn,{children:r.jsx(t5t,{})})}),r.jsx(rn,{path:"/mission-control/popbys",element:r.jsx(Nn,{children:r.jsx(s5t,{})})}),r.jsx(rn,{path:"/mission-control/popbys/map",element:r.jsx(Nn,{children:r.jsx(a5t,{})})}),r.jsx(rn,{path:"/admin/notification-settings",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(xer,{})})}),r.jsx(rn,{path:"/admin/agent-os",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(r3t,{})})}),r.jsx(rn,{path:"/mission-control/listings",element:r.jsx(Nn,{children:r.jsx(VXt,{})})}),r.jsx(rn,{path:"/mission-control/listings/new",element:r.jsx(Nn,{children:r.jsx(jTe,{})})}),r.jsx(rn,{path:"/mission-control/listings/:listingId",element:r.jsx(Nn,{children:r.jsx(aQt,{})})}),r.jsx(rn,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Nn,{children:r.jsx(jTe,{})})}),r.jsx(rn,{path:"/admin/listing-exchange",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(gJt,{})})}),r.jsx(rn,{path:"/mission-control/pipeline",element:r.jsx(Nn,{children:r.jsx(LQt,{})})}),r.jsx(rn,{path:"/mission-control/my-card",element:r.jsx(Nn,{children:r.jsx(eJt,{})})}),r.jsx(rn,{path:"/mission-control/integrations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(lJt,{})})}),r.jsx(rn,{path:"/mission-control/integrations/gmail/callback",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(cJt,{})})}),r.jsx(rn,{path:"/mission-control/integrations/canva/callback",element:r.jsx(dJt,{})}),r.jsx(rn,{path:"/mission-control/integrations/meta/callback",element:r.jsx(Nn,{children:r.jsx(uJt,{})})}),r.jsx(rn,{path:"/mission-control/scorecard",element:r.jsx(Nn,{children:r.jsx(LXt,{})})}),r.jsx(rn,{path:"/admin/scorecard",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(mJt,{})})}),r.jsx(rn,{path:"/admin/scorecard/:userId",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(pJt,{})})}),r.jsx(rn,{path:"/admin/membership-reviews",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(xJt,{})})}),r.jsx(rn,{path:"/admin/weekly-digest",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(_Jt,{})})}),r.jsx(rn,{path:"/mission-control/video/record",element:r.jsx(Nn,{children:r.jsx(mQt,{})})}),r.jsx(rn,{path:"/mission-control/video-library",element:r.jsx(Nn,{children:r.jsx(yQt,{})})}),r.jsx(rn,{path:"/marketplace",element:r.jsx(Nn,{children:r.jsx(ker,{})})}),r.jsx(rn,{path:"/marketplace/:productId",element:r.jsx(Nn,{children:r.jsx(Ner,{})})}),r.jsx(rn,{path:"/marketplace/cart",element:r.jsx(Nn,{children:r.jsx(Ser,{})})}),r.jsx(rn,{path:"/marketplace/orders",element:r.jsx(Nn,{children:r.jsx(Cer,{})})}),r.jsx(rn,{path:"/marketplace/orders/:orderId",element:r.jsx(Nn,{children:r.jsx(Ter,{})})}),r.jsx(rn,{path:"/marketplace/success",element:r.jsx(Nn,{children:r.jsx(Aer,{})})}),r.jsx(rn,{path:"/admin/agent-cards",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(jJt,{})})}),r.jsx(rn,{path:"/admin/presentation-analytics",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(yer,{})})}),r.jsx(rn,{path:"/mission-control/presentations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(Ier,{})})}),r.jsx(rn,{path:"/mission-control/presentations/new",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ITe,{})})}),r.jsx(rn,{path:"/mission-control/presentations/:id",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ITe,{})})}),r.jsx(rn,{path:"*",element:r.jsx(Fer,{})})]}),")"]})})})})]})})});nIe(document.getElementById("root")).render(r.jsx(qer,{}));